@itwin/ecschema-metadata 4.10.0-dev.37 → 4.10.0-dev.39
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/lib/cjs/Deserialization/AbstractParser.d.ts +3 -0
- package/lib/cjs/Deserialization/AbstractParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +9 -0
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +24 -6
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.d.ts +3 -0
- package/lib/cjs/Deserialization/JsonParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +55 -9
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +4 -0
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts +3 -2
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +29 -12
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Exception.d.ts +2 -1
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +1 -0
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +10 -3
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +11 -4
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +8 -3
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +9 -0
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +74 -7
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.d.ts +3 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +9 -0
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +24 -6
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.d.ts +3 -0
- package/lib/esm/Deserialization/JsonParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +55 -9
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +4 -0
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts +3 -2
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +29 -12
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Exception.d.ts +2 -1
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +1 -0
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +10 -3
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +11 -4
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +8 -3
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +9 -0
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +74 -7
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { FormatProps } from \"@itwin/core-quantity\";\n\n/**\n * @beta\n */\nexport type AnyPropertyProps = PrimitivePropertyProps | StructPropertyProps | PrimitiveArrayPropertyProps | StructArrayPropertyProps | NavigationPropertyProps;\n/**\n * @beta\n */\nexport type AnyClassProps = EntityClassProps | MixinProps | CustomAttributeClassProps | RelationshipClassProps;\n/**\n * @beta\n */\nexport type AnySchemaItemProps = AnyClassProps | EnumerationProps | KindOfQuantityProps | PropertyCategoryProps | SchemaItemUnitProps | InvertedUnitProps | ConstantProps | PhenomenonProps | SchemaItemFormatProps | SchemaItemOverrideFormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @beta\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @beta\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @beta\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @beta\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @beta\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @beta\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @beta\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n}\n\n/**\n * @beta\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @beta\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @beta\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitivePropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface EnumerationPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @beta\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @beta\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @beta\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @beta\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @beta\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"JsonProps.js","sourceRoot":"","sources":["../../../src/Deserialization/JsonProps.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { FormatProps } from \"@itwin/core-quantity\";\n\n/**\n * @beta\n */\nexport type AnyPropertyProps = PrimitivePropertyProps | StructPropertyProps | PrimitiveArrayPropertyProps | StructArrayPropertyProps | NavigationPropertyProps;\n/**\n * @beta\n */\nexport type AnyClassProps = EntityClassProps | MixinProps | CustomAttributeClassProps | RelationshipClassProps;\n/**\n * @beta\n */\nexport type AnySchemaItemProps = AnyClassProps | EnumerationProps | KindOfQuantityProps | PropertyCategoryProps | SchemaItemUnitProps | InvertedUnitProps | ConstantProps | PhenomenonProps | SchemaItemFormatProps | SchemaItemOverrideFormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaProps {\n readonly $schema: string;\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label?: string;\n readonly description?: string;\n readonly references?: SchemaReferenceProps[];\n readonly items?: { [name: string]: SchemaItemProps };\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly ecSpecMajorVersion?: number;\n readonly ecSpecMinorVersion?: number;\n}\n\n/**\n * JSON Object interface used to deserialize into a [[SchemaKey]].\n * @beta\n */\nexport interface SchemaKeyProps {\n /** The schema name */\n readonly name: string;\n /** Read version of the schema */\n readonly read: number;\n /** Write version of the schema */\n readonly write: number;\n /** Minor version of the schema */\n readonly minor: number;\n}\n\n/**\n * @beta\n */\nexport interface SchemaReferenceProps {\n readonly name: string;\n readonly version: string;\n}\n\n/**\n * @beta\n */\nexport interface SchemaItemProps {\n // NEEDSWORK: Still need to clarify how single-item deserialization works...\n readonly $schema?: string;\n readonly schema?: string; // conditionally required\n readonly schemaVersion?: string;\n readonly name?: string;\n readonly schemaItemType?: string;\n readonly label?: string;\n readonly description?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n readonly originalECSpecMajorVersion?: number;\n readonly originalECSpecMinorVersion?: number;\n}\n\n/**\n * @beta\n */\nexport interface ClassProps extends SchemaItemProps {\n readonly modifier?: string;\n readonly baseClass?: string;\n readonly properties?: AnyPropertyProps[];\n}\n\n/**\n * @beta\n */\nexport interface EntityClassProps extends ClassProps {\n readonly mixins?: string[];\n}\n\n/**\n * @beta\n */\nexport interface MixinProps extends ClassProps {\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport type StructClassProps = ClassProps;\n\n/**\n * @beta\n */\nexport interface CustomAttributeClassProps extends ClassProps {\n /**\n * Can be any combination of the [CustomAttributeContainerType]$(docs/bis/ec/customattribute-container-types.md) string values\n * separated by commas.\n */\n readonly appliesTo: string;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipClassProps extends ClassProps {\n readonly strength: string;\n readonly strengthDirection: string;\n readonly source: RelationshipConstraintProps;\n readonly target: RelationshipConstraintProps;\n}\n\n/**\n * @beta\n */\nexport interface RelationshipConstraintProps {\n readonly multiplicity: string;\n readonly roleLabel: string;\n readonly polymorphic: boolean;\n readonly abstractConstraint?: string;\n readonly constraintClasses: string[];\n}\n\n/**\n * @beta\n */\nexport interface EnumerationProps extends SchemaItemProps {\n readonly type: string;\n readonly isStrict: boolean;\n readonly enumerators: EnumeratorProps[];\n}\n\n/**\n * @beta\n */\nexport interface EnumeratorProps {\n readonly name: string;\n readonly value: string | number;\n readonly label?: string;\n readonly description?: string;\n}\n\n/**\n * @beta\n */\nexport interface KindOfQuantityProps extends SchemaItemProps {\n readonly persistenceUnit: string;\n readonly presentationUnits?: string | string[];\n readonly relativeError: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyCategoryProps extends SchemaItemProps {\n readonly priority: number;\n}\n\n/**\n * @beta\n */\nexport interface PropertyProps {\n readonly name: string;\n readonly type: string;\n readonly description?: string;\n readonly label?: string;\n readonly isReadOnly?: boolean;\n readonly category?: string;\n readonly priority?: number;\n readonly inherited?: boolean;\n readonly kindOfQuantity?: string;\n readonly customAttributes?: Array<{ [value: string]: any }>;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveOrEnumPropertyBaseProps extends PropertyProps {\n readonly extendedTypeName?: string;\n readonly minLength?: number;\n readonly maxLength?: number;\n readonly minValue?: number;\n readonly maxValue?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitivePropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructPropertyProps extends PropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface EnumerationPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface ArrayPropertyProps extends PrimitiveOrEnumPropertyBaseProps {\n readonly minOccurs?: number;\n readonly maxOccurs?: number;\n}\n\n/**\n * @beta\n */\nexport interface PrimitiveArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface StructArrayPropertyProps extends ArrayPropertyProps {\n readonly typeName: string;\n}\n\n/**\n * @beta\n */\nexport interface NavigationPropertyProps extends PropertyProps {\n readonly relationshipName: string;\n readonly direction: string;\n}\n\n/**\n * @beta\n */\nexport interface ConstantProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n}\n\n/**\n * @beta\n */\nexport type SchemaItemFormatProps = SchemaItemProps & FormatProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemOverrideFormatProps extends SchemaItemFormatProps {\n readonly parent: string;\n}\n\n/**\n * @beta\n */\nexport interface InvertedUnitProps extends SchemaItemProps {\n readonly invertsUnit: string;\n readonly unitSystem: string;\n}\n\n/**\n * @beta\n */\nexport interface PhenomenonProps extends SchemaItemProps {\n readonly definition: string;\n}\n\n/**\n * @beta\n */\nexport type UnitSystemProps = SchemaItemProps;\n\n/**\n * @beta\n */\nexport interface SchemaItemUnitProps extends SchemaItemProps {\n readonly phenomenon: string;\n readonly unitSystem: string;\n readonly definition: string;\n readonly numerator?: number;\n readonly denominator?: number;\n readonly offset?: number;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractParser, CAProviderTuple } from "./AbstractParser";
|
|
2
2
|
import { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps, NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps } from "./JsonProps";
|
|
3
|
+
import { ECSpecVersion } from "./Helper";
|
|
3
4
|
/** @internal */
|
|
4
5
|
export declare class XmlParser extends AbstractParser<Element> {
|
|
5
6
|
private _rawSchema;
|
|
@@ -8,11 +9,11 @@ export declare class XmlParser extends AbstractParser<Element> {
|
|
|
8
9
|
private _schemaAlias;
|
|
9
10
|
private _schemaVersion?;
|
|
10
11
|
private _xmlNamespace?;
|
|
11
|
-
private _ecXmlVersion?;
|
|
12
12
|
private _currentItemFullName?;
|
|
13
13
|
private _schemaItems;
|
|
14
14
|
private _mapIsPopulated;
|
|
15
15
|
constructor(rawSchema: Readonly<Document>);
|
|
16
|
+
get getECSpecVersion(): ECSpecVersion | undefined;
|
|
16
17
|
parseSchema(): SchemaProps;
|
|
17
18
|
getReferences(): Iterable<SchemaReferenceProps>;
|
|
18
19
|
getItems(): Iterable<[string, string, Element]>;
|
|
@@ -76,7 +77,7 @@ export declare class XmlParser extends AbstractParser<Element> {
|
|
|
76
77
|
private getPoint2DPropertyValue;
|
|
77
78
|
private getPoint3DPropertyValue;
|
|
78
79
|
private isSchemaFullNameValidForVersion;
|
|
79
|
-
|
|
80
|
+
static parseXmlNamespace(xmlNamespace: string): ECSpecVersion | undefined;
|
|
80
81
|
private getQualifiedTypeName;
|
|
81
82
|
/** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,
|
|
82
83
|
* meaning all of the references in the format string need to be changed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XmlParser.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/XmlParser.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACO,aAAa,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAmB,iBAAiB,EAC5H,mBAAmB,EAAE,UAAU,EAAE,uBAAuB,EAAE,eAAe,EAAE,2BAA2B,EACtG,sBAAsB,EAAE,qBAAqB,EAAiB,sBAAsB,EAA+B,qBAAqB,EACxI,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EACzI,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"XmlParser.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/XmlParser.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EACO,aAAa,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAmB,iBAAiB,EAC5H,mB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Name");
|
|
12
12
|
const AbstractParser_1 = require("./AbstractParser");
|
|
13
|
+
const Helper_1 = require("./Helper");
|
|
13
14
|
const NON_ITEM_SCHEMA_ELEMENTS = ["ECSchemaReference", "ECCustomAttributes"];
|
|
14
15
|
const ECXML_URI = "http://www\\.bentley\\.com/schemas/Bentley\\.ECXML";
|
|
15
16
|
/** @internal */
|
|
@@ -32,11 +33,12 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
32
33
|
const xmlNamespace = schemaInfo.getAttribute("xmlns");
|
|
33
34
|
if (xmlNamespace) {
|
|
34
35
|
this._xmlNamespace = xmlNamespace;
|
|
35
|
-
this.
|
|
36
|
+
this._ecSpecVersion = XmlParser.parseXmlNamespace(this._xmlNamespace);
|
|
36
37
|
}
|
|
37
38
|
this._schemaItems = new Map();
|
|
38
39
|
this._mapIsPopulated = false;
|
|
39
40
|
}
|
|
41
|
+
get getECSpecVersion() { return this._ecSpecVersion; }
|
|
40
42
|
parseSchema() {
|
|
41
43
|
const schemaMetadata = this._rawSchema.documentElement;
|
|
42
44
|
if ("ECSchema" !== schemaMetadata.nodeName)
|
|
@@ -50,7 +52,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
50
52
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);
|
|
51
53
|
if (this._xmlNamespace === undefined)
|
|
52
54
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);
|
|
53
|
-
if (this.
|
|
55
|
+
if (this._ecSpecVersion === undefined)
|
|
54
56
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);
|
|
55
57
|
const alias = this.getRequiredAttribute(schemaMetadata, "alias", `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);
|
|
56
58
|
const description = this.getOptionalAttribute(schemaMetadata, "description");
|
|
@@ -62,6 +64,8 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
62
64
|
alias,
|
|
63
65
|
label: displayLabel,
|
|
64
66
|
description,
|
|
67
|
+
ecSpecMajorVersion: this._ecSpecVersion.readVersion,
|
|
68
|
+
ecSpecMinorVersion: this._ecSpecVersion.writeVersion,
|
|
65
69
|
};
|
|
66
70
|
return schemaProps;
|
|
67
71
|
}
|
|
@@ -87,8 +91,11 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
87
91
|
rawItemType = "Mixin";
|
|
88
92
|
}
|
|
89
93
|
const itemType = this.getSchemaItemType(rawItemType);
|
|
90
|
-
if (itemType === undefined)
|
|
94
|
+
if (itemType === undefined) {
|
|
95
|
+
if (Helper_1.SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
96
|
+
continue;
|
|
91
97
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);
|
|
98
|
+
}
|
|
92
99
|
const itemName = this.getRequiredAttribute(item, "typeName", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);
|
|
93
100
|
if (!ECName_1.ECName.validate(itemName))
|
|
94
101
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);
|
|
@@ -221,12 +228,18 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
221
228
|
// TODO: This shouldn't be verified here. It's for the deserialize method to handle. The only reason it's currently done here so that the xml
|
|
222
229
|
// value can be put in the correct type, number or string.
|
|
223
230
|
let tempBackingType;
|
|
224
|
-
if (/int/i.test(enumType))
|
|
231
|
+
if (/int/i.test(enumType)) {
|
|
225
232
|
tempBackingType = ECObjects_1.PrimitiveType.Integer;
|
|
226
|
-
|
|
233
|
+
}
|
|
234
|
+
else if (/string/i.test(enumType)) {
|
|
227
235
|
tempBackingType = ECObjects_1.PrimitiveType.String;
|
|
228
|
-
|
|
229
|
-
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
if (Helper_1.SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
239
|
+
tempBackingType = ECObjects_1.PrimitiveType.String;
|
|
240
|
+
else
|
|
241
|
+
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
|
|
242
|
+
}
|
|
230
243
|
let isStrictString = this.getOptionalAttribute(xmlElement, "isStrict");
|
|
231
244
|
if (isStrictString === undefined)
|
|
232
245
|
isStrictString = "true";
|
|
@@ -257,6 +270,8 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
257
270
|
type: enumType,
|
|
258
271
|
isStrict,
|
|
259
272
|
enumerators,
|
|
273
|
+
originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,
|
|
274
|
+
originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,
|
|
260
275
|
};
|
|
261
276
|
}
|
|
262
277
|
parseKindOfQuantity(xmlElement) {
|
|
@@ -619,6 +634,8 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
619
634
|
...itemProps,
|
|
620
635
|
modifier,
|
|
621
636
|
baseClass,
|
|
637
|
+
originalECSpecMajorVersion: this._ecSpecVersion?.readVersion,
|
|
638
|
+
originalECSpecMinorVersion: this._ecSpecVersion?.writeVersion,
|
|
622
639
|
};
|
|
623
640
|
}
|
|
624
641
|
getRelationshipConstraintProps(xmlElement, isSource) {
|
|
@@ -750,14 +767,14 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
750
767
|
}
|
|
751
768
|
}
|
|
752
769
|
getCustomAttributeProvider(xmlCustomAttribute) {
|
|
753
|
-
(0, core_bentley_1.assert)(this.
|
|
770
|
+
(0, core_bentley_1.assert)(this._ecSpecVersion !== undefined);
|
|
754
771
|
let ns = xmlCustomAttribute.getAttribute("xmlns");
|
|
755
772
|
if (!ns) {
|
|
756
773
|
(0, core_bentley_1.assert)(this._schemaName !== undefined);
|
|
757
774
|
(0, core_bentley_1.assert)(this._schemaVersion !== undefined);
|
|
758
775
|
ns = `${this._schemaName}.${this._schemaVersion}`;
|
|
759
776
|
}
|
|
760
|
-
if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this.
|
|
777
|
+
if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))
|
|
761
778
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);
|
|
762
779
|
const schemaNameParts = ns.split(".");
|
|
763
780
|
const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;
|
|
@@ -915,9 +932,9 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
915
932
|
throw new Exception_1.ECObjectsError(Exception_1.ECObjectsStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
916
933
|
return { x, y, z };
|
|
917
934
|
}
|
|
918
|
-
isSchemaFullNameValidForVersion(schemaFullName,
|
|
935
|
+
isSchemaFullNameValidForVersion(schemaFullName, ecSpecVersion) {
|
|
919
936
|
const schemaNameParts = schemaFullName.split(".");
|
|
920
|
-
if ((
|
|
937
|
+
if ((ecSpecVersion.readVersion >= 3 && ecSpecVersion.writeVersion >= 2) || ecSpecVersion.readVersion > 3) {
|
|
921
938
|
if (schemaNameParts.length < 4)
|
|
922
939
|
return false;
|
|
923
940
|
}
|
|
@@ -927,7 +944,7 @@ class XmlParser extends AbstractParser_1.AbstractParser {
|
|
|
927
944
|
}
|
|
928
945
|
return true;
|
|
929
946
|
}
|
|
930
|
-
parseXmlNamespace(xmlNamespace) {
|
|
947
|
+
static parseXmlNamespace(xmlNamespace) {
|
|
931
948
|
const regEx = new RegExp(`^${ECXML_URI}\\.([0-9]+)\\.([0-9]+)$`);
|
|
932
949
|
const match = xmlNamespace.match(regEx);
|
|
933
950
|
if (!match)
|