@itwin/ecschema-metadata 5.0.0-dev.89 → 5.0.0-dev.90
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/Context.d.ts +48 -39
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +39 -13
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +0 -2
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECObjects.js +0 -1
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +22 -11
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +50 -27
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +2 -2
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +13 -13
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +4 -0
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +3 -3
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +2 -6
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +2 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +1 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/esm/Context.d.ts +48 -39
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +39 -13
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +0 -2
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +2 -6
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECObjects.js +0 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +22 -11
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +50 -27
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +2 -2
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +13 -13
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +4 -0
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +3 -3
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +2 -6
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js +2 -4
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +1 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sDAA4E;AAC5E,8DAA2D;AAE3D,4DAAyD;AACzD,oFAAiF;AACjF,4CAAyF;AACzF,4CAA+D;AAE/D,4CAAmE;AACnE,sCAAmC;AACnC,mCAA+C;AAC/C,yCAAsC;AACtC,uDAAkI;AAClI,iEAA8D;AAC9D,+CAA4C;AAC5C,+CAA4C;AAC5C,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAkD;AAClD,mCAAgC;AAChC,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,6CAA0C;AAC1C,iCAA8B;AAC9B,6CAA0C;AAE1C,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E;;GAEG;AACH,MAAa,MAAM;IACT,MAAM,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,QAAQ,CAAgB;IACtB,UAAU,CAAa;IACvB,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,YAAY,CAAU;IAChB,UAAU,CAAW;IACpB,MAAM,CAA0B;IACzC,iBAAiB,CAAgC;IACjD,2BAA2B,CAAU;IACrC,2BAA2B,CAAU;IAuB7C,gBAAgB;IAChB,YAAY,OAAsB,EAAE,SAA8B,EAAE,KAAc,EAAE,OAAgB,EAAE,QAAiB,EAAE,QAAiB;QACxI,IAAI,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,SAAS,EAAE,IAAI,qBAAS,CAAC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aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;;AAx2BH,wBAy2BC;AAED;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAuCjD;AAvCD,sCAuCC","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 { SchemaContext } from \"../Context\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { JsonParser } from \"../Deserialization/JsonParser\";\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\nimport { XmlParser } from \"../Deserialization/XmlParser\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { ECClassModifier, isSupportedSchemaItemType, PrimitiveType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { AnyClass, SchemaInfo } from \"../Interfaces\";\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { ECName } from \"../ECName\";\nimport { ECClass, StructClass } from \"./Class\";\nimport { Constant } from \"./Constant\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\nimport { EntityClass } from \"./EntityClass\";\nimport { Enumeration } from \"./Enumeration\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { KindOfQuantity } from \"./KindOfQuantity\";\nimport { Mixin } from \"./Mixin\";\nimport { Phenomenon } from \"./Phenomenon\";\nimport { PropertyCategory } from \"./PropertyCategory\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { UnitSystem } from \"./UnitSystem\";\n\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n\n/**\n * @beta\n */\nexport class Schema implements CustomAttributeContainerProps {\n private static _currentECSpecVersion = \"3.2\";\n private _context: SchemaContext;\n protected _schemaKey?: SchemaKey;\n protected _alias?: string;\n protected _label?: string;\n protected _description?: string;\n public readonly references: Schema[];\n private readonly _items: Map<string, SchemaItem>;\n private _customAttributes?: Map<string, CustomAttribute>;\n private _originalECSpecMajorVersion?: number;\n private _originalECSpecMinorVersion?: number;\n /**\n * Constructs an empty Schema with the given name and version in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param name The schema's name\n * @param readVersion The integer read (major) version of the schema\n * @param writeVersion The integer write version of the schema\n * @param minorVersion The integer minor version of the schema\n */\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\n /**\n * Constructs an empty Schema with the given key in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param key A SchemaKey that uniquely identifies the schema\n */\n constructor(context: SchemaContext, key: SchemaKey, alias: string);\n /**\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @internal\n */\n constructor(context: SchemaContext);\n /** @internal */\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\n this._context = context;\n this.references = [];\n this._items = new Map<string, SchemaItem>();\n\n if (alias !== undefined && ECName.validate(alias)) {\n this._alias = alias;\n } else if (nameOrKey !== undefined) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n }\n\n this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;\n this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;\n }\n\n public get schemaKey() {\n if (undefined === this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this._schemaKey;\n }\n\n public get name() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.name;\n }\n\n public get readVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.readVersion;\n }\n\n public get writeVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.writeVersion;\n }\n\n public get minorVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.minorVersion;\n }\n\n public get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }\n public get originalECSpecMinorVersion() { return this._originalECSpecMinorVersion; }\n public static get currentECSpecMajorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[0], 10); }\n public static get currentECSpecMinorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[1], 10); }\n\n public get alias() {\n if (this._alias === undefined || this._alias === null) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n } else { return this._alias; }\n }\n\n public get label() { return this._label; }\n\n public get description() { return this._description; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the schema name. */\n public get fullName() { return this.schemaKey.name; }\n\n /** Returns the schema. */\n public get schema(): Schema { return this; }\n\n /** Returns the schema context this schema is within. */\n public get context(): SchemaContext { return this._context; }\n\n /**\n * Returns a SchemaItemKey given the item name and the schema it belongs to\n * @param fullName fully qualified name {Schema name}.{Item Name}\n */\n public getSchemaItemKey(fullName: string): SchemaItemKey {\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\n let schemaKey = this.schemaKey;\n if (this.name !== schemaName) {\n const newSchemaRef = this.getReferenceSync(schemaName);\n if (undefined === newSchemaRef)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\n schemaKey = newSchemaRef.schemaKey;\n }\n return new SchemaItemKey(itemName, schemaKey);\n }\n\n protected addItem<T extends SchemaItem>(item: T): void {\n if (undefined !== this.getItemSync(item.name))\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\n\n this._items.set(item.name.toUpperCase(), item);\n }\n\n /**\n * @alpha\n */\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\n const item = new type(this, name, modifier);\n this.addItem(item);\n return item;\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteClass(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (ECClass.isECClass(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteClassSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (ECClass.isECClass(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteSchemaItem(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (SchemaItem.isSchemaItem(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteSchemaItemSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (SchemaItem.isSchemaItem(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * @alpha\n */\n protected createItem<T extends SchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\n const item = new type(this, name);\n this.addItem(item);\n return item;\n }\n\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /**\n * Creates a EntityClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n /**\n * Creates a Mixin with the provided name in this schema.\n * @param name\n */\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\n\n /**\n * Creates a StructClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n /**\n * Creates a CustomAttributeClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n /**\n * Creates a RelationshipClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\n return this.createRelationshipClassSync(name, modifier);\n }\n\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\n }\n\n /**\n * Creates an Enumeration with the provided name in this schema.\n * @param name\n */\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\n return this.createEnumerationSync(name, primitiveType);\n }\n\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\n const item = new Enumeration(this, name, primitiveType);\n this.addItem(item);\n return item;\n }\n\n /**\n * Creates an KindOfQuantity with the provided name in this schema.\n * @param name\n */\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\n return this.createKindOfQuantitySync(name);\n }\n\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\n }\n\n /**\n * Creates a Constant with the provided name in this schema.\n * @param name\n */\n protected async createConstant(name: string): Promise<Constant> {\n return this.createItem<Constant>(Constant, name);\n }\n\n protected createConstantSync(name: string): Constant {\n return this.createItem<Constant>(Constant, name);\n }\n\n /**\n * Creates a Inverted Unit with the provided name in this schema.\n * @param name\n */\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n protected createInvertedUnitSync(name: string): InvertedUnit {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n /**\n * Creates an Format with the provided name in this schema.\n * @param name\n */\n protected async createFormat(name: string): Promise<Format> {\n return this.createItem<Format>(Format, name);\n }\n\n protected createFormatSync(name: string): Format {\n return this.createItem<Format>(Format, name);\n }\n\n /**\n * Creates a UnitSystem with the provided name in this schema.\n * @param name\n */\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n protected createUnitSystemSync(name: string): UnitSystem {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n /**\n * Creates a Phenomenon with the provided name in this schema.\n * @param name\n */\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n protected createPhenomenonSync(name: string): Phenomenon {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n /**\n * Creates a Unit with the provided name in this schema.\n * @param name\n */\n protected async createUnit(name: string): Promise<Unit> {\n return this.createItem<Unit>(Unit, name);\n }\n\n protected createUnitSync(name: string): Unit {\n return this.createItem<Unit>(Unit, name);\n }\n\n /**\n * Creates an PropertyCategory with the provided name in this schema.\n * @param name\n */\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n\n protected createPropertyCategorySync(name: string): PropertyCategory {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n /**\n *\n * @param refSchema\n */\n protected async addReference(refSchema: Schema): Promise<void> {\n // TODO validation of reference schema. For now just adding\n this.addReferenceSync(refSchema);\n }\n\n protected addReferenceSync(refSchema: Schema): void {\n this.references.push(refSchema);\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setContext(context: SchemaContext): void {\n this._context = context;\n }\n\n /**\n * Sets the version of the SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\n */\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\n if (!this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\n\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\n }\n\n /**\n * Shortcut for calling getItem with EntityClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested EntityClass or undefined if not found.\n */\n public async getEntityClass(name: string): Promise<EntityClass | undefined> { return this.getItem(name, EntityClass); }\n\n /**\n * Shortcut for calling getItem with Mixin.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Mixin or undefined if not found.\n */\n public async getMixin(name: string): Promise<Mixin | undefined> { return this.getItem(name, Mixin); }\n\n /**\n * Shortcut for calling getItem with StructClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested StructClass or undefined if not found.\n */\n public async getStructClass(name: string): Promise<StructClass | undefined> { return this.getItem(name, StructClass); }\n\n /**\n * Shortcut for calling getItem with CustomAttributeClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested CustomAttributeClass or undefined if not found.\n */\n public async getCustomAttributeClass(name: string): Promise<CustomAttributeClass | undefined> { return this.getItem(name, CustomAttributeClass); }\n\n /**\n * Shortcut for calling getItem with RelationshipClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested RelationshipClass or undefined if not found.\n */\n public async getRelationshipClass(name: string): Promise<RelationshipClass | undefined> { return this.getItem(name, RelationshipClass); }\n\n /**\n * Shortcut for calling getItem with Enumeration.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Enumeration or undefined if not found.\n */\n public async getEnumeration(name: string): Promise<Enumeration | undefined> { return this.getItem(name, Enumeration); }\n\n /**\n * Shortcut for calling getItem with KindOfQuantity.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested KindOfQuantity or undefined if not found.\n */\n public async getKindOfQuantity(name: string): Promise<KindOfQuantity | undefined> { return this.getItem(name, KindOfQuantity); }\n\n /**\n * Shortcut for calling getItem with PropertyCategory.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested PropertyCategory or undefined if not found.\n */\n public async getPropertyCategory(name: string): Promise<PropertyCategory | undefined> { return this.getItem(name, PropertyCategory); }\n\n /**\n * Shortcut for calling getItem with Unit.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Unit or undefined if not found.\n */\n public async getUnit(name: string): Promise<Unit | undefined> { return this.getItem(name, Unit); }\n\n /**\n * Shortcut for calling getItem with InvertedUnit.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested InvertedUnit or undefined if not found.\n */\n public async getInvertedUnit(name: string): Promise<InvertedUnit | undefined> { return this.getItem(name, InvertedUnit); }\n\n /**\n * Shortcut for calling getItem with Constant.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Constant or undefined if not found.\n */\n public async getConstant(name: string): Promise<Constant | undefined> { return this.getItem(name, Constant); }\n\n /**\n * Shortcut for calling getItem with Phenomenon.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Phenomenon or undefined if not found.\n */\n public async getPhenomenon(name: string): Promise<Phenomenon | undefined> { return this.getItem(name, Phenomenon); }\n\n /**\n * Shortcut for calling getItem with UnitSystem.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested UnitSystem or undefined if not found.\n */\n public async getUnitSystem(name: string): Promise<UnitSystem | undefined> { return this.getItem(name, UnitSystem); }\n\n /**\n * Shortcut for calling getItem with Format.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Format or undefined if not found.\n */\n public async getFormat(name: string): Promise<Format | undefined> { return this.getItem(name, Format); }\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * @param key the local (unqualified) name, lookup is case-insensitive\n */\n public async getItem(name: string): Promise<SchemaItem | undefined>\n public async getItem<T extends typeof SchemaItem>(name: string, itemConstructor: T): Promise<InstanceType<T> | undefined>\n public async getItem<T extends typeof SchemaItem>(name: string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\n if(itemConstructor === undefined)\n return this.getItemSync(name) as InstanceType<T> | undefined;\n\n return this.getItemSync(name, itemConstructor);\n }\n\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * If an item of the name exists but does not match the requested type, undefined is returned\n * @param key the local (unqualified) name, lookup is case-insensitive\n * @param itemConstructor The constructor of the item to return.\n */\n public getItemSync(name: string): SchemaItem | undefined\n public getItemSync<T extends typeof SchemaItem>(name: string, itemConstructor: T): InstanceType<T> | undefined\n public getItemSync<T extends typeof SchemaItem>(name: string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\n const value = this._items.get(name.toUpperCase());\n if (value === undefined || itemConstructor === undefined)\n return value;\n\n if(isSupportedSchemaItemType(value.schemaItemType, itemConstructor.schemaItemType))\n return value as InstanceType<T>;\n\n return undefined;\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public async lookupItem(key: Readonly<SchemaItemKey> | string): Promise<SchemaItem | undefined>;\n public async lookupItem<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor: T): Promise<InstanceType<T> | undefined>;\n public async lookupItem<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return itemConstructor\n ? this.getItem(itemName, itemConstructor)\n : this.getItem(itemName);\n }\n\n const refSchema = await this.getReference(schemaName);\n if (!refSchema)\n return undefined;\n\n return itemConstructor\n ? refSchema.getItem(itemName, itemConstructor)\n : refSchema.getItem(itemName);\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public lookupItemSync(key: Readonly<SchemaItemKey> | string): SchemaItem | undefined;\n public lookupItemSync<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor: T): InstanceType<T> | undefined;\n public lookupItemSync<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return itemConstructor\n ? this.getItemSync(itemName, itemConstructor)\n : this.getItemSync(itemName);\n }\n\n const refSchema = this.getReferenceSync(schemaName);\n if (!refSchema)\n return undefined;\n\n return itemConstructor\n ? refSchema.getItemSync(itemName, itemConstructor)\n : refSchema.getItemSync(itemName);\n }\n\n /**\n * Returns an iterator over all of the items in this schema.\n */\n public getItems(): IterableIterator<SchemaItem>;\n public getItems<T extends typeof SchemaItem>(itemConstructor: T): IterableIterator<InstanceType<T>>;\n public * getItems<T extends typeof SchemaItem>(itemConstructor?: T): IterableIterator<InstanceType<T> | SchemaItem> {\n if (!this._items)\n return;\n\n for (const item of this._items.values()) {\n if (itemConstructor === undefined || isSupportedSchemaItemType(item.schemaItemType, itemConstructor.schemaItemType))\n yield item;\n }\n }\n\n /**\n * Gets a referenced schema by name\n * @param refSchemaName schema name to find\n */\n public async getReference(refSchemaName: string): Promise<Schema | undefined> {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase());\n }\n\n /**\n * Gets a referenced schema by alias\n * @param alias alias to find\n */\n public getReferenceNameByAlias(alias: string): string | undefined {\n if (this.references.length === 0)\n return undefined;\n\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\n return schema ? schema.name : undefined;\n }\n\n /**\n * Gets a referenced schema by name\n * @param refSchemaName schema name to find\n */\n public getReferenceSync(refSchemaName: string): Schema | undefined {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase());\n }\n\n /**\n * Save this Schema's properties to an object for serializing to JSON.\n */\n public toJSON(): SchemaProps {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaJson: { [value: string]: any } = {};\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\n schemaJson.name = this.name; // name is required\n schemaJson.version = this.schemaKey.version.toString(true);\n schemaJson.alias = this.alias; // alias is required\n if (undefined !== this.label) // label is optional\n schemaJson.label = this.label;\n if (undefined !== this.description) // description is optional\n schemaJson.description = this.description;\n if (undefined !== this.references && this.references.length > 0) // references is optional\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n if (this._items.size > 0) {\n schemaJson.items = {};\n this._items.forEach((schemaItem: SchemaItem) => {\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\n });\n }\n return schemaJson as SchemaProps;\n }\n\n /**\n * Converts the schema to a DOM XML Document.\n * @param schemaXml An empty DOM document to which the schema will be written\n */\n public async toXml(schemaXml: Document): Promise<Document> {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\n schemaMetadata.setAttribute(\"schemaName\", this.name);\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\n if (undefined !== this.label)\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\n if (undefined !== this.description)\n schemaMetadata.setAttribute(\"description\", this.description);\n\n // Map used for CA serialization\n const refSchemaMap = new Map<string, string>();\n\n this.references.forEach(({ name, schemaKey, alias }) => {\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\n schemaRef.setAttribute(\"name\", name);\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\n schemaMetadata.appendChild(schemaRef);\n refSchemaMap.set(name, schemaKey.version.toString());\n });\n\n if (this._customAttributes) {\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\n parentElem.appendChild(caElem);\n }\n schemaMetadata.appendChild(parentElem);\n }\n\n for (const [, item] of this._items) {\n const itemXml = await item.toXml(schemaXml);\n schemaMetadata.appendChild(itemXml);\n }\n\n schemaXml.appendChild(schemaMetadata);\n return schemaXml;\n }\n\n // Check if the ECSpecVersion read-version is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck?: number): boolean {\n // If argument is supplied, check the argument against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined)\n return (Schema.currentECSpecMajorVersion >= ecSpecMajorVersionToCheck);\n\n // If argument is not supplied, check against the original ECSpecVersion of the schema\n if (this.originalECSpecMajorVersion === undefined)\n return false;\n return (Schema.currentECSpecMajorVersion >= this.originalECSpecMajorVersion);\n }\n\n // Check if the full ECSpecVersion is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecVersionSupported(ecSpecMajorVersionToCheck?: number, ecSpecMinorVersionToCheck?: number): boolean {\n // If arguments are supplied, check the arguments against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined && ecSpecMinorVersionToCheck !== undefined) {\n if (!this.isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck))\n return false;\n return (Schema.currentECSpecMinorVersion >= ecSpecMinorVersionToCheck);\n }\n // If arguments are not supplied, check against the original ECSpecVersion of the schema\n if (!this.isECSpecMajorVersionSupported() || this.originalECSpecMinorVersion === undefined)\n return false;\n return (Schema.currentECSpecMinorVersion >= this.originalECSpecMinorVersion);\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public fromJSONSync(schemaProps: SchemaProps) {\n if (undefined === this._schemaKey) {\n const schemaName = schemaProps.name;\n const version = ECVersion.fromString(schemaProps.version);\n this._schemaKey = new SchemaKey(schemaName, version);\n } else {\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);\n }\n\n if (schemaProps.$schema.match(`https://dev\\\\.bentley\\\\.com/json_schemas/ec/([0-9]+)/ecschema`) == null && schemaProps.$schema.match(`http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\\\\.([0-9]+)`) == null)\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);\n\n // The schema props have not been parsed. Parse the ECXml version from the $schema attribute\n let ecVersion: ECSpecVersion;\n if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {\n ecVersion = ((schemaProps.$schema.search(\"ECXML\") !== -1) ? XmlParser.parseXmlNamespace(schemaProps.$schema) : JsonParser.parseJSUri(schemaProps.$schema)) as ECSpecVersion;\n } else {\n ecVersion = { readVersion: schemaProps.ecSpecMajorVersion, writeVersion: schemaProps.ecSpecMinorVersion } as ECSpecVersion;\n }\n\n this._originalECSpecMajorVersion = ecVersion?.readVersion;\n this._originalECSpecMinorVersion = ecVersion?.writeVersion;\n\n if (!this.isECSpecMajorVersionSupported(ecVersion?.readVersion))\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECVersion and cannot be loaded.`);\n\n if (ECName.validate(schemaProps.alias)) {\n this._alias = schemaProps.alias;\n } else {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\n }\n\n if (undefined !== schemaProps.label)\n this._label = schemaProps.label;\n\n if (undefined !== schemaProps.description)\n this._description = schemaProps.description;\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public async fromJSON(schemaProps: SchemaProps) {\n this.fromJSONSync(schemaProps);\n }\n\n /**\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\n * schema context using the getCachedSchema method\n */\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\n const schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n return reader.readSchemaInfo(schema, rawSchema);\n }\n\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = await reader.readSchema(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\n */\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = reader.readSchemaSync(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * @internal\n */\n public static isSchema(object: any): object is Schema {\n const schema = object as Schema;\n\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDisplayLabel(displayLabel: string) {\n this._label = displayLabel;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDescription(description: string) {\n this._description = description;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setAlias(alias: string) {\n if (!ECName.validate(alias)) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\n }\n this._alias = alias;\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\n * would prevent this class from extending Schema.\n * @internal\n */\nexport abstract class MutableSchema extends Schema {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\n public abstract override createMixinClass(name: string): Promise<Mixin>;\n public abstract override createMixinClassSync(name: string): Mixin;\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\n public abstract override createUnit(name: string): Promise<Unit>;\n public abstract override createUnitSync(name: string): Unit;\n public abstract override createConstant(name: string): Promise<Constant>;\n public abstract override createConstantSync(name: string): Constant;\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\n public abstract override createPhenomenonSync(name: string): Phenomenon;\n public abstract override createFormat(name: string): Promise<Format>;\n public abstract override createFormatSync(name: string): Format;\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\n public abstract override createUnitSystemSync(name: string): UnitSystem;\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\n public abstract override addItem<T extends SchemaItem>(item: T): void;\n public abstract override addReference(refSchema: Schema): Promise<void>;\n public abstract override addReferenceSync(refSchema: Schema): void;\n public abstract override setContext(schemaContext: SchemaContext): void;\n public abstract override deleteClass(name: string): Promise<void>;\n public abstract override deleteClassSync(name: string): void;\n public abstract override deleteSchemaItem(name: string): Promise<void>;\n public abstract override deleteSchemaItemSync(name: string): void;\n public abstract override setAlias(alias: string): void;\n}"]}
|
|
1
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sDAA4E;AAC5E,8DAA2D;AAE3D,4DAAyD;AACzD,oFAAiF;AACjF,4CAAyF;AACzF,4CAA+D;AAE/D,4CAAmE;AACnE,sCAAmC;AACnC,mCAA+C;AAC/C,yCAAsC;AACtC,uDAAkI;AAClI,iEAA8D;AAC9D,+CAA4C;AAC5C,+CAA4C;AAC5C,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAkD;AAClD,mCAAgC;AAChC,6CAA0C;AAC1C,yDAAsD;AACtD,2DAA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MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,MAAW;QAChC,MAAM,MAAM,GAAG,MAAgB,CAAC;QAEhC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC;IAChG,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,YAAoB;QAC5C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAAmB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,KAAa;QAC9B,IAAI,CAAC,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;;AAx2BH,wBAy2BC;AAED;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAuCjD;AAvCD,sCAuCC","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 { SchemaContext } from \"../Context\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\nimport { JsonParser } from \"../Deserialization/JsonParser\";\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\nimport { XmlParser } from \"../Deserialization/XmlParser\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { ECClassModifier, isSupportedSchemaItemType, PrimitiveType } from \"../ECObjects\";\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\nimport { AnyClass, SchemaInfo } from \"../Interfaces\";\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { ECName } from \"../ECName\";\nimport { ECClass, StructClass } from \"./Class\";\nimport { Constant } from \"./Constant\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\nimport { EntityClass } from \"./EntityClass\";\nimport { Enumeration } from \"./Enumeration\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { KindOfQuantity } from \"./KindOfQuantity\";\nimport { Mixin } from \"./Mixin\";\nimport { Phenomenon } from \"./Phenomenon\";\nimport { PropertyCategory } from \"./PropertyCategory\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\nimport { UnitSystem } from \"./UnitSystem\";\n\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n\n/**\n * @beta\n */\nexport class Schema implements CustomAttributeContainerProps {\n private static _currentECSpecVersion = \"3.2\";\n private _context: SchemaContext;\n protected _schemaKey?: SchemaKey;\n protected _alias?: string;\n protected _label?: string;\n protected _description?: string;\n public readonly references: Schema[];\n private readonly _items: Map<string, SchemaItem>;\n private _customAttributes?: Map<string, CustomAttribute>;\n private _originalECSpecMajorVersion?: number;\n private _originalECSpecMinorVersion?: number;\n /**\n * Constructs an empty Schema with the given name and version in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param name The schema's name\n * @param readVersion The integer read (major) version of the schema\n * @param writeVersion The integer write version of the schema\n * @param minorVersion The integer minor version of the schema\n */\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\n /**\n * Constructs an empty Schema with the given key in the provided context.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @param key A SchemaKey that uniquely identifies the schema\n */\n constructor(context: SchemaContext, key: SchemaKey, alias: string);\n /**\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\n * @param context The SchemaContext that will control the lifetime of the schema\n * @internal\n */\n constructor(context: SchemaContext);\n /** @internal */\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\n this._context = context;\n this.references = [];\n this._items = new Map<string, SchemaItem>();\n\n if (alias !== undefined && ECName.validate(alias)) {\n this._alias = alias;\n } else if (nameOrKey !== undefined) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n }\n\n this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;\n this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;\n }\n\n public get schemaKey() {\n if (undefined === this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this._schemaKey;\n }\n\n public get name() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.name;\n }\n\n public get readVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.readVersion;\n }\n\n public get writeVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.writeVersion;\n }\n\n public get minorVersion() {\n if (this._schemaKey === undefined)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\n return this.schemaKey.minorVersion;\n }\n\n public get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }\n public get originalECSpecMinorVersion() { return this._originalECSpecMinorVersion; }\n public static get currentECSpecMajorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[0], 10); }\n public static get currentECSpecMinorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[1], 10); }\n\n public get alias() {\n if (this._alias === undefined || this._alias === null) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\n } else { return this._alias; }\n }\n\n public get label() { return this._label; }\n\n public get description() { return this._description; }\n\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** Returns the schema name. */\n public get fullName() { return this.schemaKey.name; }\n\n /** Returns the schema. */\n public get schema(): Schema { return this; }\n\n /** Returns the schema context this schema is within. */\n public get context(): SchemaContext { return this._context; }\n\n /**\n * Returns a SchemaItemKey given the item name and the schema it belongs to\n * @param fullName fully qualified name {Schema name}.{Item Name}\n */\n public getSchemaItemKey(fullName: string): SchemaItemKey {\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\n let schemaKey = this.schemaKey;\n if (this.name !== schemaName) {\n const newSchemaRef = this.getReferenceSync(schemaName);\n if (undefined === newSchemaRef)\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\n schemaKey = newSchemaRef.schemaKey;\n }\n return new SchemaItemKey(itemName, schemaKey);\n }\n\n protected addItem<T extends SchemaItem>(item: T): void {\n if (undefined !== this.getItemSync(item.name))\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\n\n this._items.set(item.name.toUpperCase(), item);\n }\n\n /**\n * @alpha\n */\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\n const item = new type(this, name, modifier);\n this.addItem(item);\n return item;\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteClass(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (ECClass.isECClass(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a class from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteClassSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (ECClass.isECClass(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected async deleteSchemaItem(name: string): Promise<void> {\n const schemaItem = await this.getItem(name);\n if (SchemaItem.isSchemaItem(schemaItem)) {\n this._items.delete(name.toUpperCase());\n }\n }\n\n /**\n * Deletes a SchemaItem from within this schema.\n * @param name the local (unqualified) class name, lookup is case-insensitive\n * @alpha\n */\n protected deleteSchemaItemSync(name: string): void {\n const schemaItem = this.getItemSync(name);\n if (SchemaItem.isSchemaItem(schemaItem))\n this._items.delete(name.toUpperCase());\n }\n\n /**\n * @alpha\n */\n protected createItem<T extends SchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\n const item = new type(this, name);\n this.addItem(item);\n return item;\n }\n\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /**\n * Creates a EntityClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\n return this.createClass<EntityClass>(EntityClass, name, modifier);\n }\n\n /**\n * Creates a Mixin with the provided name in this schema.\n * @param name\n */\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\n\n /**\n * Creates a StructClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\n return this.createClass<StructClass>(StructClass, name, modifier);\n }\n\n /**\n * Creates a CustomAttributeClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\n }\n\n /**\n * Creates a RelationshipClass with the provided name in this schema.\n * @param name\n * @param modifier\n */\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\n return this.createRelationshipClassSync(name, modifier);\n }\n\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\n }\n\n /**\n * Creates an Enumeration with the provided name in this schema.\n * @param name\n */\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\n return this.createEnumerationSync(name, primitiveType);\n }\n\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\n const item = new Enumeration(this, name, primitiveType);\n this.addItem(item);\n return item;\n }\n\n /**\n * Creates an KindOfQuantity with the provided name in this schema.\n * @param name\n */\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\n return this.createKindOfQuantitySync(name);\n }\n\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\n }\n\n /**\n * Creates a Constant with the provided name in this schema.\n * @param name\n */\n protected async createConstant(name: string): Promise<Constant> {\n return this.createItem<Constant>(Constant, name);\n }\n\n protected createConstantSync(name: string): Constant {\n return this.createItem<Constant>(Constant, name);\n }\n\n /**\n * Creates a Inverted Unit with the provided name in this schema.\n * @param name\n */\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n protected createInvertedUnitSync(name: string): InvertedUnit {\n return this.createItem<InvertedUnit>(InvertedUnit, name);\n }\n\n /**\n * Creates an Format with the provided name in this schema.\n * @param name\n */\n protected async createFormat(name: string): Promise<Format> {\n return this.createItem<Format>(Format, name);\n }\n\n protected createFormatSync(name: string): Format {\n return this.createItem<Format>(Format, name);\n }\n\n /**\n * Creates a UnitSystem with the provided name in this schema.\n * @param name\n */\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n protected createUnitSystemSync(name: string): UnitSystem {\n return this.createItem<UnitSystem>(UnitSystem, name);\n }\n\n /**\n * Creates a Phenomenon with the provided name in this schema.\n * @param name\n */\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n protected createPhenomenonSync(name: string): Phenomenon {\n return this.createItem<Phenomenon>(Phenomenon, name);\n }\n\n /**\n * Creates a Unit with the provided name in this schema.\n * @param name\n */\n protected async createUnit(name: string): Promise<Unit> {\n return this.createItem<Unit>(Unit, name);\n }\n\n protected createUnitSync(name: string): Unit {\n return this.createItem<Unit>(Unit, name);\n }\n\n /**\n * Creates an PropertyCategory with the provided name in this schema.\n * @param name\n */\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n\n protected createPropertyCategorySync(name: string): PropertyCategory {\n return this.createItem<PropertyCategory>(PropertyCategory, name);\n }\n /**\n *\n * @param refSchema\n */\n protected async addReference(refSchema: Schema): Promise<void> {\n // TODO validation of reference schema. For now just adding\n this.addReferenceSync(refSchema);\n }\n\n protected addReferenceSync(refSchema: Schema): void {\n this.references.push(refSchema);\n }\n\n /**\n * @alpha Used for schema editing.\n */\n protected setContext(context: SchemaContext): void {\n this._context = context;\n }\n\n /**\n * Sets the version of the SchemaKey identifying the schema.\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\n */\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\n if (!this._schemaKey)\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\n\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\n }\n\n /**\n * Shortcut for calling getItem with EntityClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested EntityClass or undefined if not found.\n */\n public async getEntityClass(name: string): Promise<EntityClass | undefined> { return this.getItem(name, EntityClass); }\n\n /**\n * Shortcut for calling getItem with Mixin.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Mixin or undefined if not found.\n */\n public async getMixin(name: string): Promise<Mixin | undefined> { return this.getItem(name, Mixin); }\n\n /**\n * Shortcut for calling getItem with StructClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested StructClass or undefined if not found.\n */\n public async getStructClass(name: string): Promise<StructClass | undefined> { return this.getItem(name, StructClass); }\n\n /**\n * Shortcut for calling getItem with CustomAttributeClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested CustomAttributeClass or undefined if not found.\n */\n public async getCustomAttributeClass(name: string): Promise<CustomAttributeClass | undefined> { return this.getItem(name, CustomAttributeClass); }\n\n /**\n * Shortcut for calling getItem with RelationshipClass.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested RelationshipClass or undefined if not found.\n */\n public async getRelationshipClass(name: string): Promise<RelationshipClass | undefined> { return this.getItem(name, RelationshipClass); }\n\n /**\n * Shortcut for calling getItem with Enumeration.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Enumeration or undefined if not found.\n */\n public async getEnumeration(name: string): Promise<Enumeration | undefined> { return this.getItem(name, Enumeration); }\n\n /**\n * Shortcut for calling getItem with KindOfQuantity.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested KindOfQuantity or undefined if not found.\n */\n public async getKindOfQuantity(name: string): Promise<KindOfQuantity | undefined> { return this.getItem(name, KindOfQuantity); }\n\n /**\n * Shortcut for calling getItem with PropertyCategory.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested PropertyCategory or undefined if not found.\n */\n public async getPropertyCategory(name: string): Promise<PropertyCategory | undefined> { return this.getItem(name, PropertyCategory); }\n\n /**\n * Shortcut for calling getItem with Unit.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Unit or undefined if not found.\n */\n public async getUnit(name: string): Promise<Unit | undefined> { return this.getItem(name, Unit); }\n\n /**\n * Shortcut for calling getItem with InvertedUnit.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested InvertedUnit or undefined if not found.\n */\n public async getInvertedUnit(name: string): Promise<InvertedUnit | undefined> { return this.getItem(name, InvertedUnit); }\n\n /**\n * Shortcut for calling getItem with Constant.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Constant or undefined if not found.\n */\n public async getConstant(name: string): Promise<Constant | undefined> { return this.getItem(name, Constant); }\n\n /**\n * Shortcut for calling getItem with Phenomenon.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Phenomenon or undefined if not found.\n */\n public async getPhenomenon(name: string): Promise<Phenomenon | undefined> { return this.getItem(name, Phenomenon); }\n\n /**\n * Shortcut for calling getItem with UnitSystem.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested UnitSystem or undefined if not found.\n */\n public async getUnitSystem(name: string): Promise<UnitSystem | undefined> { return this.getItem(name, UnitSystem); }\n\n /**\n * Shortcut for calling getItem with Format.\n * @param name The local (unqualified) name of the item to return.\n * @returns The requested Format or undefined if not found.\n */\n public async getFormat(name: string): Promise<Format | undefined> { return this.getItem(name, Format); }\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * @param key the local (unqualified) name, lookup is case-insensitive\n */\n public async getItem(name: string): Promise<SchemaItem | undefined>\n public async getItem<T extends typeof SchemaItem>(name: string, itemConstructor: T): Promise<InstanceType<T> | undefined>\n public async getItem<T extends typeof SchemaItem>(name: string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\n if(itemConstructor === undefined)\n return this.getItemSync(name) as InstanceType<T> | undefined;\n\n return this.getItemSync(name, itemConstructor);\n }\n\n /**\n * Gets an item from within this schema. To get by full name use lookupItem instead.\n * If an item of the name exists but does not match the requested type, undefined is returned\n * @param key the local (unqualified) name, lookup is case-insensitive\n * @param itemConstructor The constructor of the item to return.\n */\n public getItemSync(name: string): SchemaItem | undefined\n public getItemSync<T extends typeof SchemaItem>(name: string, itemConstructor: T): InstanceType<T> | undefined\n public getItemSync<T extends typeof SchemaItem>(name: string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\n const value = this._items.get(name.toUpperCase());\n if (value === undefined || itemConstructor === undefined)\n return value;\n\n if(isSupportedSchemaItemType(value.schemaItemType, itemConstructor.schemaItemType))\n return value as InstanceType<T>;\n\n return undefined;\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public async lookupItem(key: Readonly<SchemaItemKey> | string): Promise<SchemaItem | undefined>;\n public async lookupItem<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor: T): Promise<InstanceType<T> | undefined>;\n public async lookupItem<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor?: T): Promise<SchemaItem | InstanceType<T> | undefined> {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return itemConstructor\n ? this.getItem(itemName, itemConstructor)\n : this.getItem(itemName);\n }\n\n const refSchema = await this.getReference(schemaName);\n if (!refSchema)\n return undefined;\n\n return itemConstructor\n ? refSchema.getItem(itemName, itemConstructor)\n : refSchema.getItem(itemName);\n }\n\n /**\n * Attempts to find a schema item within this schema or a (directly) referenced schema\n * @param key The full name or a SchemaItemKey identifying the desired item.\n */\n public lookupItemSync(key: Readonly<SchemaItemKey> | string): SchemaItem | undefined;\n public lookupItemSync<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor: T): InstanceType<T> | undefined;\n public lookupItemSync<T extends typeof SchemaItem>(key: Readonly<SchemaItemKey> | string, itemConstructor?: T): SchemaItem | InstanceType<T> | undefined {\n let schemaName, itemName: string;\n if (typeof (key) === \"string\") {\n [schemaName, itemName] = SchemaItem.parseFullName(key);\n } else {\n itemName = key.name;\n schemaName = key.schemaName;\n }\n\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\n return itemConstructor\n ? this.getItemSync(itemName, itemConstructor)\n : this.getItemSync(itemName);\n }\n\n const refSchema = this.getReferenceSync(schemaName);\n if (!refSchema)\n return undefined;\n\n return itemConstructor\n ? refSchema.getItemSync(itemName, itemConstructor)\n : refSchema.getItemSync(itemName);\n }\n\n /**\n * Returns all of the loaded items in this schema.\n */\n public getItems(): Iterable<SchemaItem>;\n public getItems<T extends typeof SchemaItem>(itemConstructor: T): Iterable<InstanceType<T>>;\n public * getItems<T extends typeof SchemaItem>(itemConstructor?: T): Iterable<InstanceType<T> | SchemaItem> {\n if (!this._items)\n return;\n\n for (const item of this._items.values()) {\n if (itemConstructor === undefined || isSupportedSchemaItemType(item.schemaItemType, itemConstructor.schemaItemType))\n yield item;\n }\n }\n\n /**\n * Gets a referenced schema by name\n * @param refSchemaName schema name to find\n */\n public async getReference(refSchemaName: string): Promise<Schema | undefined> {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase());\n }\n\n /**\n * Gets a referenced schema by alias\n * @param alias alias to find\n */\n public getReferenceNameByAlias(alias: string): string | undefined {\n if (this.references.length === 0)\n return undefined;\n\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\n return schema ? schema.name : undefined;\n }\n\n /**\n * Gets a referenced schema by name\n * @param refSchemaName schema name to find\n */\n public getReferenceSync(refSchemaName: string): Schema | undefined {\n if (this.references.length === 0)\n return undefined;\n\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase());\n }\n\n /**\n * Save this Schema's properties to an object for serializing to JSON.\n */\n public toJSON(): SchemaProps {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaJson: { [value: string]: any } = {};\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\n schemaJson.name = this.name; // name is required\n schemaJson.version = this.schemaKey.version.toString(true);\n schemaJson.alias = this.alias; // alias is required\n if (undefined !== this.label) // label is optional\n schemaJson.label = this.label;\n if (undefined !== this.description) // description is optional\n schemaJson.description = this.description;\n if (undefined !== this.references && this.references.length > 0) // references is optional\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (undefined !== customAttributes)\n schemaJson.customAttributes = customAttributes;\n if (this._items.size > 0) {\n schemaJson.items = {};\n this._items.forEach((schemaItem: SchemaItem) => {\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\n });\n }\n return schemaJson as SchemaProps;\n }\n\n /**\n * Converts the schema to a DOM XML Document.\n * @param schemaXml An empty DOM document to which the schema will be written\n */\n public async toXml(schemaXml: Document): Promise<Document> {\n if (!this.isECSpecVersionSupported())\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\n\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\n schemaMetadata.setAttribute(\"schemaName\", this.name);\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\n if (undefined !== this.label)\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\n if (undefined !== this.description)\n schemaMetadata.setAttribute(\"description\", this.description);\n\n // Map used for CA serialization\n const refSchemaMap = new Map<string, string>();\n\n this.references.forEach(({ name, schemaKey, alias }) => {\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\n schemaRef.setAttribute(\"name\", name);\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\n schemaMetadata.appendChild(schemaRef);\n refSchemaMap.set(name, schemaKey.version.toString());\n });\n\n if (this._customAttributes) {\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\n parentElem.appendChild(caElem);\n }\n schemaMetadata.appendChild(parentElem);\n }\n\n for (const [, item] of this._items) {\n const itemXml = await item.toXml(schemaXml);\n schemaMetadata.appendChild(itemXml);\n }\n\n schemaXml.appendChild(schemaMetadata);\n return schemaXml;\n }\n\n // Check if the ECSpecVersion read-version is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck?: number): boolean {\n // If argument is supplied, check the argument against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined)\n return (Schema.currentECSpecMajorVersion >= ecSpecMajorVersionToCheck);\n\n // If argument is not supplied, check against the original ECSpecVersion of the schema\n if (this.originalECSpecMajorVersion === undefined)\n return false;\n return (Schema.currentECSpecMajorVersion >= this.originalECSpecMajorVersion);\n }\n\n // Check if the full ECSpecVersion is greater than the current ECSpecVersion supported.\n // If a specific ECSpecVersion is given, check against that version.\n // If no argument is given, check against the original ECSpecVersion of the schema.\n private isECSpecVersionSupported(ecSpecMajorVersionToCheck?: number, ecSpecMinorVersionToCheck?: number): boolean {\n // If arguments are supplied, check the arguments against the current ECSpecVersion supported\n if (ecSpecMajorVersionToCheck !== undefined && ecSpecMinorVersionToCheck !== undefined) {\n if (!this.isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck))\n return false;\n return (Schema.currentECSpecMinorVersion >= ecSpecMinorVersionToCheck);\n }\n // If arguments are not supplied, check against the original ECSpecVersion of the schema\n if (!this.isECSpecMajorVersionSupported() || this.originalECSpecMinorVersion === undefined)\n return false;\n return (Schema.currentECSpecMinorVersion >= this.originalECSpecMinorVersion);\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public fromJSONSync(schemaProps: SchemaProps) {\n if (undefined === this._schemaKey) {\n const schemaName = schemaProps.name;\n const version = ECVersion.fromString(schemaProps.version);\n this._schemaKey = new SchemaKey(schemaName, version);\n } else {\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} has the version '${this.schemaKey.version}' that does not match the provided version '${schemaProps.version}'.`);\n }\n\n if (schemaProps.$schema.match(`https://dev\\\\.bentley\\\\.com/json_schemas/ec/([0-9]+)/ecschema`) == null && schemaProps.$schema.match(`http://www\\\\.bentley\\\\.com/schemas/Bentley\\\\.ECXML\\\\.([0-9]+)`) == null)\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);\n\n // The schema props have not been parsed. Parse the ECXml version from the $schema attribute\n let ecVersion: ECSpecVersion;\n if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {\n ecVersion = ((schemaProps.$schema.search(\"ECXML\") !== -1) ? XmlParser.parseXmlNamespace(schemaProps.$schema) : JsonParser.parseJSUri(schemaProps.$schema)) as ECSpecVersion;\n } else {\n ecVersion = { readVersion: schemaProps.ecSpecMajorVersion, writeVersion: schemaProps.ecSpecMinorVersion } as ECSpecVersion;\n }\n\n this._originalECSpecMajorVersion = ecVersion?.readVersion;\n this._originalECSpecMinorVersion = ecVersion?.writeVersion;\n\n if (!this.isECSpecMajorVersionSupported(ecVersion?.readVersion))\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECVersion and cannot be loaded.`);\n\n if (ECName.validate(schemaProps.alias)) {\n this._alias = schemaProps.alias;\n } else {\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\n }\n\n if (undefined !== schemaProps.label)\n this._label = schemaProps.label;\n\n if (undefined !== schemaProps.description)\n this._description = schemaProps.description;\n }\n\n /**\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\n */\n public async fromJSON(schemaProps: SchemaProps) {\n this.fromJSONSync(schemaProps);\n }\n\n /**\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\n * schema context using the getCachedSchema method\n */\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\n const schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n return reader.readSchemaInfo(schema, rawSchema);\n }\n\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = await reader.readSchema(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\n */\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\n let schema: Schema = new Schema(context);\n\n const reader = new SchemaReadHelper(JsonParser, context);\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\n schema = reader.readSchemaSync(schema, rawSchema);\n\n return schema;\n }\n\n /**\n * @internal\n */\n public static isSchema(object: any): object is Schema {\n const schema = object as Schema;\n\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDisplayLabel(displayLabel: string) {\n this._label = displayLabel;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setDescription(description: string) {\n this._description = description;\n }\n\n /**\n * @alpha\n * Used for schema editing.\n */\n protected setAlias(alias: string) {\n if (!ECName.validate(alias)) {\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\n }\n this._alias = alias;\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * We cannot put this into Helper.ts and make it non-export, because we are importing Helper.ts from this file, and the circular import\n * would prevent this class from extending Schema.\n * @internal\n */\nexport abstract class MutableSchema extends Schema {\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\n public abstract override createMixinClass(name: string): Promise<Mixin>;\n public abstract override createMixinClassSync(name: string): Mixin;\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\n public abstract override createUnit(name: string): Promise<Unit>;\n public abstract override createUnitSync(name: string): Unit;\n public abstract override createConstant(name: string): Promise<Constant>;\n public abstract override createConstantSync(name: string): Constant;\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\n public abstract override createPhenomenonSync(name: string): Phenomenon;\n public abstract override createFormat(name: string): Promise<Format>;\n public abstract override createFormatSync(name: string): Format;\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\n public abstract override createUnitSystemSync(name: string): UnitSystem;\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\n public abstract override addItem<T extends SchemaItem>(item: T): void;\n public abstract override addReference(refSchema: Schema): Promise<void>;\n public abstract override addReferenceSync(refSchema: Schema): void;\n public abstract override setContext(schemaContext: SchemaContext): void;\n public abstract override deleteClass(name: string): Promise<void>;\n public abstract override deleteClassSync(name: string): void;\n public abstract override deleteSchemaItem(name: string): Promise<void>;\n public abstract override deleteSchemaItemSync(name: string): void;\n public abstract override setAlias(alias: string): void;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaUnitProvider.d.ts","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,mBAAmB,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnI,OAAO,EAAE,cAAc,EAAiB,MAAM,YAAY,CAAC;AAQ3D;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IAWR,OAAO,CAAC,cAAc;IAVpE,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAgB;IAEhC;;;;;;OAMG;gBACS,gBAAgB,EAAE,cAAc,EAAU,cAAc,GAAE,aAAa,EAAO;IAU1F;;;;OAIG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBjE;;;;OAIG;IACU,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaUnitProvider.d.ts","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiC,mBAAmB,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnI,OAAO,EAAE,cAAc,EAAiB,MAAM,YAAY,CAAC;AAQ3D;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IAWR,OAAO,CAAC,cAAc;IAVpE,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAgB;IAEhC;;;;;;OAMG;gBACS,gBAAgB,EAAE,cAAc,EAAU,cAAc,GAAE,aAAa,EAAO;IAU1F;;;;OAIG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAuBjE;;;;OAIG;IACU,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAiD5E;;;OAGG;IACI,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAWjE;;;;;;;;;;OAUG;IACU,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAc3H;;;;;OAKG;IACU,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAuBlF,2BAA2B;IAqBzC;;;;OAIG;YACW,aAAa;IAwB3B;;;OAGG;YACW,sBAAsB;IA4BpC;;;OAGG;YACW,yBAAyB;CAsBxC"}
|
|
@@ -91,8 +91,7 @@ class SchemaUnitProvider {
|
|
|
91
91
|
// Find units' full name that match given phenomenon param.
|
|
92
92
|
const filteredUnits = [];
|
|
93
93
|
const schemaItems = this._context.getSchemaItems();
|
|
94
|
-
|
|
95
|
-
while (!done) {
|
|
94
|
+
for (const value of schemaItems) {
|
|
96
95
|
if (Unit_1.Unit.isUnit(value)) {
|
|
97
96
|
const foundPhenomenon = await value.phenomenon;
|
|
98
97
|
if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {
|
|
@@ -110,7 +109,6 @@ class SchemaUnitProvider {
|
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
|
-
({ value, done } = schemaItems.next());
|
|
114
112
|
}
|
|
115
113
|
return filteredUnits;
|
|
116
114
|
}
|
|
@@ -224,8 +222,7 @@ class SchemaUnitProvider {
|
|
|
224
222
|
async findUnitByDisplayLabel(displayLabel, schemaName, phenomenon, unitSystem) {
|
|
225
223
|
// TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema
|
|
226
224
|
const schemaItems = this._context.getSchemaItems();
|
|
227
|
-
|
|
228
|
-
while (!done) {
|
|
225
|
+
for (const value of schemaItems) {
|
|
229
226
|
if (Unit_1.Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {
|
|
230
227
|
// TODO: this can be optimized. We don't have to await these if we don't want to check for them
|
|
231
228
|
const currPhenomenon = await value.phenomenon;
|
|
@@ -246,7 +243,6 @@ class SchemaUnitProvider {
|
|
|
246
243
|
return this.getUnitsProps(value);
|
|
247
244
|
}
|
|
248
245
|
}
|
|
249
|
-
({ value, done } = schemaItems.next());
|
|
250
246
|
}
|
|
251
247
|
return new core_quantity_1.BadUnit();
|
|
252
248
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAkE;AAClE,wDAAmI;AACnI,wCAA2D;AAC3D,uDAAoD;AACpD,4CAAwD;AACxD,2CAAwC;AACxC,4CAA8C;AAC9C,mEAAgE;AAChE,2DAAwD;AAExD;;;GAGG;AACH,MAAa,kBAAkB;IAWyB;IAV9C,cAAc,CAAgB;IAC9B,QAAQ,CAAgB;IAEhC;;;;;;OAMG;IACH,YAAY,gBAAgC,EAAU,iBAAkC,EAAE;QAApC,mBAAc,GAAd,cAAc,CAAsB;QACxF,IAAI,gBAAgB,YAAY,uBAAa,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QA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M,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxD,6EAA6E;oBAC7E,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;wBAC3C,OAAO,SAAS,CAAC;oBAEnB,+CAA+C;oBAC/C,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC7F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBAC3F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBACvF,iDAAiD;oBACjD,IAAI,iBAAiB,IAAI,iBAAiB,IAAI,iBAAiB;wBAC7D,OAAO,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,uBAAO,EAAE,CAAC;IACvB,CAAC;CACF;AA5RD,gDA4RC","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*--------------------------------------------------------------------------------------------*/\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\n\n/**\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\n * @beta\n */\nexport class SchemaUnitProvider implements UnitsProvider {\n private _unitConverter: UnitConverter;\n private _context: SchemaContext;\n\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\n */\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitConverter = new UnitConverter(this._context);\n }\n\n /**\n * Find unit in a schema that has unitName.\n * @param unitName Full name of unit.\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\n */\n public async findUnitByName(unitName: string): Promise<UnitProps> {\n // Check if schema exists and unit exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n return new BadUnit(); // return BadUnit if schema does not exist\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const unit = await this._context.getSchemaItem(itemKey, Unit);\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\n return this.getUnitsProps(unit);\n\n const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit);\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\n return this.getUnitsProps(invertedUnit);\n }\n\n return new BadUnit();\n }\n\n /**\n * Find all units in context that belongs to given phenomenon.\n * @param phenomenon Full name of phenomenon.\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\n */\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\n // Check if schema exists and phenomenon exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\n return { phenomenon, schema: schemaName };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const phenom = await this._context.getSchemaItem(itemKey);\n if (!phenom)\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\n return { item: schemaItemName, schema: schemaName };\n });\n\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\n return { itemType: phenom.key.fullName };\n });\n\n // Find units' full name that match given phenomenon param.\n const filteredUnits: Array<UnitProps> = [];\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value)) {\n const foundPhenomenon = await value.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const foundPhenomenon = await invertsUnit.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return filteredUnits;\n }\n\n /**\n * Find alternate display labels associated with unitName, if any.\n * @param unitName Full name of Unit.\n */\n public getAlternateDisplayLabels(unitName: string): Array<string> {\n let alternateLabels: Array<string> = [];\n for (const entry of this._unitExtraData) {\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\n alternateLabels = entry.altDisplayLabels;\n }\n }\n\n return alternateLabels;\n }\n\n /**\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\n *\n * @param unitLabel Display label or alternate display label to query unit by.\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\n * @param phenomenon Full name of phenomenon that Unit belongs to.\n * @param unitSystem Full name of unitSystem that Unit belongs to.\n * @returns The UnitProps interface from the @itwin/core-quantity package.\n */\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n const findLabel = unitLabel.toLowerCase();\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\n\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n if (foundUnit.isValid)\n return foundUnit;\n\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n }\n\n /**\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\n * @param fromUnit The UnitProps of the 'from' unit.\n * @param toUnit The UnitProps of the 'to' unit.\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\n */\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\n if (!fromUnit.isValid || !toUnit.isValid)\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\n return { fromUnit, toUnit };\n });\n\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\n\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\n const result: UnitConversionProps = {\n factor: conversion.factor,\n offset: conversion.offset,\n };\n if (fromIsInverted && !toIsInverted)\n result.inversion = UnitConversionInvert.InvertPreConversion;\n else if (!fromIsInverted && toIsInverted)\n result.inversion = UnitConversionInvert.InvertPostConversion;\n\n return result;\n }\n\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\n return { name: input.name };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit);\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\n }\n\n return { unitName: input.name, isInverted: false };\n }\n\n /**\n * Gets the @itwin/core UnitProps for the given Unit.\n * @param unit The Unit to convert.\n * @returns UnitProps interface from @itwin/core.\n */\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\n if (Unit.isUnit(unit)) {\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n const invertsUnit = await unit.invertsUnit;\n if (!invertsUnit)\n return new BadUnit();\n\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n /**\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\n const schemaItems = this._context.getSchemaItems();\n let { value, done } = schemaItems.next();\n while (!done) {\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\n const currPhenomenon = await value.phenomenon;\n const currUnitSystem = await value.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const currPhenomenon = await invertsUnit.phenomenon;\n const currUnitSystem = await invertsUnit.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n }\n }\n ({ value, done } = schemaItems.next());\n }\n\n return new BadUnit();\n }\n\n /**\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n for (const entry of this._unitExtraData) {\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\n // Found altDisplayLabel that matches label to find\n const unitProps = await this.findUnitByName(entry.name);\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\n if (!schemaName && !phenomenon && !unitSystem)\n return unitProps;\n\n // Check if the provided values match unitProps\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\n // If all provided values match, return unitProps\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\n return unitProps;\n }\n }\n }\n return new BadUnit();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAkE;AAClE,wDAAmI;AACnI,wCAA2D;AAC3D,uDAAoD;AACpD,4CAAwD;AACxD,2CAAwC;AACxC,4CAA8C;AAC9C,mEAAgE;AAChE,2DAAwD;AAExD;;;GAGG;AACH,MAAa,kBAAkB;IAWyB;IAV9C,cAAc,CAAgB;IAC9B,QAAQ,CAAgB;IAEhC;;;;;;OAMG;IACH,YAAY,gBAAgC,EAAU,iBAAkC,EAAE;QAApC,mBAAc,GAAd,cAAc,CAAsB;QACxF,IAAI,gBAAgB,YAAY,uBAAa,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,IAAI,uBAAa,EAAE,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC,QAAgB;QAC1C,mDAAmD;QACnD,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,uBAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxE,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,UAAU,CAA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------------------------------------------------------------------\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*--------------------------------------------------------------------------------------------*/\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\n\n/**\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\n * @beta\n */\nexport class SchemaUnitProvider implements UnitsProvider {\n private _unitConverter: UnitConverter;\n private _context: SchemaContext;\n\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\n */\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitConverter = new UnitConverter(this._context);\n }\n\n /**\n * Find unit in a schema that has unitName.\n * @param unitName Full name of unit.\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\n */\n public async findUnitByName(unitName: string): Promise<UnitProps> {\n // Check if schema exists and unit exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n return new BadUnit(); // return BadUnit if schema does not exist\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const unit = await this._context.getSchemaItem(itemKey, Unit);\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\n return this.getUnitsProps(unit);\n\n const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit);\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\n return this.getUnitsProps(invertedUnit);\n }\n\n return new BadUnit();\n }\n\n /**\n * Find all units in context that belongs to given phenomenon.\n * @param phenomenon Full name of phenomenon.\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\n */\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\n // Check if schema exists and phenomenon exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\n return { phenomenon, schema: schemaName };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const phenom = await this._context.getSchemaItem(itemKey);\n if (!phenom)\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\n return { item: schemaItemName, schema: schemaName };\n });\n\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\n return { itemType: phenom.key.fullName };\n });\n\n // Find units' full name that match given phenomenon param.\n const filteredUnits: Array<UnitProps> = [];\n const schemaItems = this._context.getSchemaItems();\n for( const value of schemaItems) {\n if (Unit.isUnit(value)) {\n const foundPhenomenon = await value.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const foundPhenomenon = await invertsUnit.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n }\n }\n }\n\n return filteredUnits;\n }\n\n /**\n * Find alternate display labels associated with unitName, if any.\n * @param unitName Full name of Unit.\n */\n public getAlternateDisplayLabels(unitName: string): Array<string> {\n let alternateLabels: Array<string> = [];\n for (const entry of this._unitExtraData) {\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\n alternateLabels = entry.altDisplayLabels;\n }\n }\n\n return alternateLabels;\n }\n\n /**\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\n *\n * @param unitLabel Display label or alternate display label to query unit by.\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\n * @param phenomenon Full name of phenomenon that Unit belongs to.\n * @param unitSystem Full name of unitSystem that Unit belongs to.\n * @returns The UnitProps interface from the @itwin/core-quantity package.\n */\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n const findLabel = unitLabel.toLowerCase();\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\n\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n if (foundUnit.isValid)\n return foundUnit;\n\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n }\n\n /**\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\n * @param fromUnit The UnitProps of the 'from' unit.\n * @param toUnit The UnitProps of the 'to' unit.\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\n */\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\n if (!fromUnit.isValid || !toUnit.isValid)\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\n return { fromUnit, toUnit };\n });\n\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\n\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\n const result: UnitConversionProps = {\n factor: conversion.factor,\n offset: conversion.offset,\n };\n if (fromIsInverted && !toIsInverted)\n result.inversion = UnitConversionInvert.InvertPreConversion;\n else if (!fromIsInverted && toIsInverted)\n result.inversion = UnitConversionInvert.InvertPostConversion;\n\n return result;\n }\n\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\n return { name: input.name };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit);\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\n }\n\n return { unitName: input.name, isInverted: false };\n }\n\n /**\n * Gets the @itwin/core UnitProps for the given Unit.\n * @param unit The Unit to convert.\n * @returns UnitProps interface from @itwin/core.\n */\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\n if (Unit.isUnit(unit)) {\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n const invertsUnit = await unit.invertsUnit;\n if (!invertsUnit)\n return new BadUnit();\n\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n /**\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\n const schemaItems = this._context.getSchemaItems();\n for(const value of schemaItems) {\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\n const currPhenomenon = await value.phenomenon;\n const currUnitSystem = await value.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const currPhenomenon = await invertsUnit.phenomenon;\n const currUnitSystem = await invertsUnit.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n }\n }\n }\n\n return new BadUnit();\n }\n\n /**\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n for (const entry of this._unitExtraData) {\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\n // Found altDisplayLabel that matches label to find\n const unitProps = await this.findUnitByName(entry.name);\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\n if (!schemaName && !phenomenon && !unitSystem)\n return unitProps;\n\n // Check if the provided values match unitProps\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\n // If all provided values match, return unitProps\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\n return unitProps;\n }\n }\n }\n return new BadUnit();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAA6B,MAAM,8BAA8B,CAAC;AAE7F;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAA4B;IAIlD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;OAGG;gBACS,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACU,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAW9C,kBAAkB;YAOlB,aAAa;
|
|
1
|
+
{"version":3,"file":"SchemaWalker.d.ts","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAA6B,MAAM,8BAA8B,CAAC;AAE7F;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,cAAc,CAA4B;IAIlD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;OAGG;gBACS,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACU,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAW9C,kBAAkB;YAOlB,aAAa;CAU5B"}
|
|
@@ -43,10 +43,8 @@ class SchemaWalker {
|
|
|
43
43
|
await this.traverseClass(schemaItem);
|
|
44
44
|
}
|
|
45
45
|
async traverseClass(ecClass) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
await this._visitorHelper.visitSchemaPart(property);
|
|
49
|
-
}
|
|
46
|
+
for (const property of await ecClass.getProperties(true)) {
|
|
47
|
+
await this._visitorHelper.visitSchemaPart(property);
|
|
50
48
|
}
|
|
51
49
|
if (ecClass.schemaItemType === ECObjects_1.SchemaItemType.RelationshipClass) {
|
|
52
50
|
await this._visitorHelper.visitSchemaPart(ecClass.source);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAA8C;AAC9C,6CAA4C;AAI5C,4EAA6F;AAE7F;;;;GAIG;AACH,MAAa,YAAY;IACf,cAAc,CAA4B;IAElD,2GAA2G;IAC3G,sEAAsE;IAC9D,OAAO,CAAU;IAEzB;;;OAGG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,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,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,UAAsB;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,eAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB;QAC1C,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,KAAK,0BAAc,CAAC,iBAAiB,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA/CD,oCA+CC","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\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECClass } from \"../Metadata/Class\";\nimport { RelationshipClass } from \"../Metadata/RelationshipClass\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\n\n/**\n * The purpose of this class is to traverse a given schema, allowing clients to hook into\n * the traversal process via Visitors to allow for custom processing of the schema elements.\n * @internal\n */\nexport class SchemaWalker {\n private _visitorHelper: SchemaPartVisitorDelegate;\n\n // This is a cache of the schema we are traversing. The schema also exists within the _context but in order\n // to not have to go back to the context every time we use this cache.\n private _schema?: Schema;\n\n /**\n * Initializes a new SchemaWalker instance.\n * @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.\n */\n constructor(visitor: ISchemaPartVisitor) {\n this._visitorHelper = new SchemaPartVisitorDelegate(visitor);\n }\n\n /**\n * Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.\n * @param schema The Schema to traverse.\n */\n public async traverseSchema(schema: Schema): Promise<Schema> {\n this._schema = schema;\n\n await this._visitorHelper.visitSchema(schema);\n await this._visitorHelper.visitSchemaPart(schema);\n\n for (const item of this._schema.getItems())\n await this.traverseSchemaItem(item);\n return schema;\n }\n\n private async traverseSchemaItem(schemaItem: SchemaItem): Promise<void> {\n await this._visitorHelper.visitSchemaPart(schemaItem);\n\n if (ECClass.isECClass(schemaItem))\n await this.traverseClass(schemaItem);\n }\n\n private async traverseClass(ecClass: ECClass): Promise<void> {\n for (const property of await ecClass.getProperties(true)) {\n await this._visitorHelper.visitSchemaPart(property);\n }\n\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass) {\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).source);\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).target);\n }\n }\n}\n"]}
|
|
@@ -20,7 +20,7 @@ export { KindOfQuantity } from "./Metadata/KindOfQuantity";
|
|
|
20
20
|
export { Mixin } from "./Metadata/Mixin";
|
|
21
21
|
export * from "./Metadata/OverrideFormat";
|
|
22
22
|
export { Phenomenon } from "./Metadata/Phenomenon";
|
|
23
|
-
export { Property, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty, StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty, AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase, } from "./Metadata/Property";
|
|
23
|
+
export { Property, PropertyHandler, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty, StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty, AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase, } from "./Metadata/Property";
|
|
24
24
|
export { PropertyCategory } from "./Metadata/PropertyCategory";
|
|
25
25
|
export { RelationshipClass, RelationshipConstraint, RelationshipMultiplicity } from "./Metadata/RelationshipClass";
|
|
26
26
|
export { Schema } from "./Metadata/Schema";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.d.ts","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":"AAKA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC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C;AAC1C,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,gDAI6B;AAH3B,oGAAA,QAAQ,OAAA;AAAmB,6GAAA,iBAAiB,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,0GAAA,cAAc,OAAA;AACzG,+GAAA,mBAAmB,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AACX,yGAAA,aAAa,OAAA;AAAE,uHAAA,2BAA2B,OAAA;AAElG,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,kEAAmH;AAA1G,sHAAA,iBAAiB,OAAA;AAAE,2HAAA,sBAAsB,OAAA;AAAE,6HAAA,wBAAwB,OAAA;AAC5E,4CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,wDAAsC;AACtC,wCAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,kDAAgC;AAChC,sDAAoC;AACpC,8CAA4B;AAC5B,iDAA+B;AAC/B,kEAAgD;AAChD,iEAA+C;AAC/C,oEAAkD;AAClD,4DAA0C;AAC1C,8DAA4C;AAE5C,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAEpB;;GAEG;AACH;;;GAGG;AACH;;;GAGG","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\nexport * from \"./Constants\";\nexport * from \"./Context\";\nexport * from \"./DelayedPromise\";\nexport * from \"./Deserialization/SchemaGraphUtil\";\nexport * from \"./Deserialization/JsonProps\";\nexport * from \"./Deserialization/Helper\";\nexport * from \"./Deserialization/XmlParser\";\nexport * from \"./ECName\";\nexport * from \"./ECObjects\";\nexport * from \"./Exception\";\nexport * from \"./Interfaces\";\nexport { ECClass, StructClass } from \"./Metadata/Class\";\nexport { Constant } from \"./Metadata/Constant\";\nexport { CustomAttributeClass } from \"./Metadata/CustomAttributeClass\";\nexport { EntityClass } from \"./Metadata/EntityClass\";\nexport { AnyEnumerator, Enumeration, Enumerator } from \"./Metadata/Enumeration\";\nexport { Format } from \"./Metadata/Format\";\nexport { InvertedUnit } from \"./Metadata/InvertedUnit\";\nexport { KindOfQuantity } from \"./Metadata/KindOfQuantity\";\nexport { Mixin } from \"./Metadata/Mixin\";\nexport * from \"./Metadata/OverrideFormat\";\nexport { Phenomenon } from \"./Metadata/Phenomenon\";\nexport {\n Property, PropertyHandler, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty,\n StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty,\n AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase,\n} from \"./Metadata/Property\";\nexport { PropertyCategory } from \"./Metadata/PropertyCategory\";\nexport { RelationshipClass, RelationshipConstraint, RelationshipMultiplicity } from \"./Metadata/RelationshipClass\";\nexport { Schema } from \"./Metadata/Schema\";\nexport * from \"./Metadata/SchemaItem\";\nexport { Unit } from \"./Metadata/Unit\";\nexport { UnitSystem } from \"./Metadata/UnitSystem\";\nexport * from \"./PropertyTypes\";\nexport * from \"./SchemaJsonLocater\";\nexport * from \"./SchemaKey\";\nexport * from \"./SchemaLoader\";\nexport * from \"./UnitConversion/UnitConversion\";\nexport * from \"./UnitConversion/UnitConverter\";\nexport * from \"./UnitProvider/SchemaUnitProvider\";\nexport * from \"./Validation/SchemaWalker\";\nexport * from \"./SchemaPartVisitorDelegate\";\nexport { CustomAttribute, CustomAttributeContainerProps} from \"./Metadata/CustomAttribute\";\nexport { SchemaGraph } from \"./utils/SchemaGraph\";\n\n/** @docs-package-description\n * The ecschema-metadata package contains classes for working with ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\n */\n/**\n * @docs-group-description Metadata\n * Definitions of classes and interfaces that represent all [EC elements]($docs/bis/ec/index.md).\n */\n/**\n * @docs-group-description Utils\n * A set of utility classes used throughout the package.\n */\n"]}
|