@itwin/ecschema-metadata 4.10.0-dev.9 → 5.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/lib/cjs/DelayedPromise.d.ts.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.d.ts +3 -0
- package/lib/cjs/Deserialization/AbstractParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +9 -0
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +24 -6
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.d.ts +3 -0
- package/lib/cjs/Deserialization/JsonParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +55 -9
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +4 -0
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts +3 -2
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +32 -13
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +24 -21
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.d.ts +2 -1
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +1 -0
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +10 -3
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js +1 -2
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +3 -3
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +11 -4
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +6 -6
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +4 -0
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +6 -0
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +0 -4
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +2 -54
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -0
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +55 -2
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +8 -3
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +9 -0
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +74 -7
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.js +2 -2
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +1 -5
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js +1 -2
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts +1 -6
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +100 -58
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/DelayedPromise.d.ts.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.d.ts +3 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +9 -0
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +24 -6
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.d.ts +3 -0
- package/lib/esm/Deserialization/JsonParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +55 -9
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +4 -0
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts +3 -2
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +32 -13
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +8 -5
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.d.ts +2 -1
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +1 -0
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +10 -3
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +11 -4
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +7 -7
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +4 -0
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +6 -0
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +0 -4
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +2 -54
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.d.ts +12 -0
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +53 -0
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +8 -3
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +9 -0
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +74 -7
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +1 -5
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts +1 -6
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +100 -58
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBA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Y,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,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAgB,aAAc,SAAQ,MAAM;CAuCjD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaContext } from \"../Context\";\r\nimport { SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { JsonParser } from \"../Deserialization/JsonParser\";\r\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { ECClassModifier, PrimitiveType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { AnyClass, AnySchemaItem, SchemaInfo } from \"../Interfaces\";\r\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { Constant } from \"./Constant\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\r\nimport { EntityClass } from \"./EntityClass\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { Format } from \"./Format\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { Phenomenon } from \"./Phenomenon\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\r\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class Schema implements CustomAttributeContainerProps {\r\n private _context: SchemaContext;\r\n protected _schemaKey?: SchemaKey;\r\n protected _alias?: string;\r\n protected _label?: string;\r\n protected _description?: string;\r\n public readonly references: Schema[];\r\n private readonly _items: Map<string, SchemaItem>;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n /**\r\n * Constructs an empty Schema with the given name and version in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param name The schema's name\r\n * @param readVersion The integer read (major) version of the schema\r\n * @param writeVersion The integer write version of the schema\r\n * @param minorVersion The integer minor version of the schema\r\n */\r\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\r\n /**\r\n * Constructs an empty Schema with the given key in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param key A SchemaKey that uniquely identifies the schema\r\n */\r\n constructor(context: SchemaContext, key: SchemaKey, alias: string); // eslint-disable-line @typescript-eslint/unified-signatures\r\n /**\r\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\r\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @internal\r\n */\r\n constructor(context: SchemaContext);\r\n /** @internal */\r\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\r\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\r\n this._context = context;\r\n this.references = [];\r\n this._items = new Map<string, SchemaItem>();\r\n\r\n if (alias !== undefined && ECName.validate(alias)) {\r\n this._alias = alias;\r\n } else if (nameOrKey !== undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n }\r\n }\r\n\r\n public get schemaKey() {\r\n if (undefined === this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema '${this.name}' has an invalid SchemaKey.`);\r\n return this._schemaKey;\r\n }\r\n\r\n public get name() { return this.schemaKey.name; }\r\n\r\n public get readVersion() { return this.schemaKey.readVersion; }\r\n\r\n public get writeVersion() { return this.schemaKey.writeVersion; }\r\n\r\n public get minorVersion() { return this.schemaKey.minorVersion; }\r\n\r\n public get alias() {\r\n if (this._alias === undefined || this._alias === null) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n } else { return this._alias; }\r\n }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the schema name. */\r\n public get fullName() { return this.schemaKey.name; }\r\n\r\n /** Returns the schema. */\r\n public get schema(): Schema { return this; }\r\n\r\n /** Returns the schema context this schema is within. */\r\n public get context(): SchemaContext { return this._context; }\r\n\r\n /**\r\n * Returns a SchemaItemKey given the item name and the schema it belongs to\r\n * @param fullName fully qualified name {Schema name}.{Item Name}\r\n */\r\n public getSchemaItemKey(fullName: string): SchemaItemKey {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\r\n let schemaKey = this.schemaKey;\r\n if (this.name !== schemaName) {\r\n const newSchemaRef = this.getReferenceSync(schemaName);\r\n if (undefined === newSchemaRef)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\r\n schemaKey = newSchemaRef.schemaKey;\r\n }\r\n return new SchemaItemKey(itemName, schemaKey);\r\n }\r\n\r\n protected addItem<T extends SchemaItem>(item: T): void {\r\n if (undefined !== this.getItemSync(item.name))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\r\n\r\n this._items.set(item.name.toUpperCase(), item);\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\r\n const item = new type(this, name, modifier);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteClass(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (ECClass.isECClass(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteClassSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (ECClass.isECClass(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteSchemaItem(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (SchemaItem.isSchemaItem(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteSchemaItemSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (SchemaItem.isSchemaItem(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createItem<T extends AnySchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\r\n const item = new type(this, name);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /**\r\n * Creates a EntityClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a Mixin with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\r\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\r\n\r\n /**\r\n * Creates a StructClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\r\n return this.createRelationshipClassSync(name, modifier);\r\n }\r\n\r\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\r\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates an Enumeration with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\r\n return this.createEnumerationSync(name, primitiveType);\r\n }\r\n\r\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\r\n const item = new Enumeration(this, name, primitiveType);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Creates an KindOfQuantity with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\r\n return this.createKindOfQuantitySync(name);\r\n }\r\n\r\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\r\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\r\n }\r\n\r\n /**\r\n * Creates a Constant with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createConstant(name: string): Promise<Constant> {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n protected createConstantSync(name: string): Constant {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n /**\r\n * Creates a Inverted Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n protected createInvertedUnitSync(name: string): InvertedUnit {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n /**\r\n * Creates an Format with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createFormat(name: string): Promise<Format> {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n protected createFormatSync(name: string): Format {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n /**\r\n * Creates a UnitSystem with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n protected createUnitSystemSync(name: string): UnitSystem {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n /**\r\n * Creates a Phenomenon with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n protected createPhenomenonSync(name: string): Phenomenon {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n /**\r\n * Creates a Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnit(name: string): Promise<Unit> {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n protected createUnitSync(name: string): Unit {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n /**\r\n * Creates an PropertyCategory with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n\r\n protected createPropertyCategorySync(name: string): PropertyCategory {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n /**\r\n *\r\n * @param refSchema\r\n */\r\n protected async addReference(refSchema: Schema): Promise<void> {\r\n // TODO validation of reference schema. For now just adding\r\n this.addReferenceSync(refSchema);\r\n }\r\n\r\n protected addReferenceSync(refSchema: Schema): void {\r\n this.references.push(refSchema);\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setContext(context: SchemaContext): void {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Sets the version of the SchemaKey identifying the schema.\r\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n */\r\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\r\n if (!this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\r\n\r\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\r\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public async getItem<T extends SchemaItem>(name: string): Promise<T | undefined> {\r\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\r\n return this.getItemSync<T>(name);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public getItemSync<T extends SchemaItem>(name: string): T | undefined {\r\n // Case-insensitive search\r\n return this._items.get(name.toUpperCase()) as T;\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public async lookupItem<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): Promise<T | undefined> {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItem<T>(itemName);\r\n }\r\n\r\n const refSchema = await this.getReference(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItem<T>(itemName);\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public lookupItemSync<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): T | undefined {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItemSync<T>(itemName);\r\n }\r\n\r\n const refSchema = this.getReferenceSync(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItemSync<T>(itemName);\r\n }\r\n\r\n public getItems<T extends AnySchemaItem>(): IterableIterator<T> {\r\n if (!this._items)\r\n return new Map<string, SchemaItem>().values() as IterableIterator<T>;\r\n\r\n return this._items.values() as IterableIterator<T>;\r\n }\r\n\r\n public *getClasses(): IterableIterator<ECClass> {\r\n for (const [, value] of this._items) {\r\n if (ECClass.isECClass(value))\r\n yield value;\r\n }\r\n }\r\n\r\n public async getReference<T extends Schema>(refSchemaName: string): Promise<T | undefined> {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n public getReferenceNameByAlias(alias: string): string | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\r\n return schema ? schema.name : undefined;\r\n }\r\n\r\n public getReferenceSync<T extends Schema>(refSchemaName: string): T | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n /**\r\n * Save this Schema's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): SchemaProps {\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\r\n schemaJson.name = this.name; // name is required\r\n schemaJson.version = this.schemaKey.version.toString(true);\r\n schemaJson.alias = this.alias; // alias is required\r\n if (undefined !== this.label) // label is optional\r\n schemaJson.label = this.label;\r\n if (undefined !== this.description) // description is optional\r\n schemaJson.description = this.description;\r\n if (undefined !== this.references && this.references.length > 0) // references is optional\r\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n if (this._items.size > 0) {\r\n schemaJson.items = {};\r\n this._items.forEach((schemaItem: SchemaItem) => {\r\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\r\n });\r\n }\r\n return schemaJson as SchemaProps;\r\n }\r\n\r\n /**\r\n * Converts the schema to a DOM XML Document.\r\n * @param schemaXml An empty DOM document to which the schema will be written\r\n */\r\n public async toXml(schemaXml: Document): Promise<Document> {\r\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\r\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\r\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\r\n schemaMetadata.setAttribute(\"schemaName\", this.name);\r\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\r\n if (undefined !== this.label)\r\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.description)\r\n schemaMetadata.setAttribute(\"description\", this.description);\r\n\r\n // Map used for CA serialization\r\n const refSchemaMap = new Map<string, string>();\r\n\r\n this.references.forEach(({ name, schemaKey, alias }) => {\r\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\r\n schemaRef.setAttribute(\"name\", name);\r\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\r\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\r\n schemaMetadata.appendChild(schemaRef);\r\n refSchemaMap.set(name, schemaKey.version.toString());\r\n });\r\n\r\n if (this._customAttributes) {\r\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\r\n parentElem.appendChild(caElem);\r\n }\r\n schemaMetadata.appendChild(parentElem);\r\n }\r\n\r\n for (const [, item] of this._items) {\r\n const itemXml = await item.toXml(schemaXml);\r\n schemaMetadata.appendChild(itemXml);\r\n }\r\n\r\n schemaXml.appendChild(schemaMetadata);\r\n return schemaXml;\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public fromJSONSync(schemaProps: SchemaProps) {\r\n if (undefined === this._schemaKey) {\r\n const schemaName = schemaProps.name;\r\n const version = ECVersion.fromString(schemaProps.version);\r\n this._schemaKey = new SchemaKey(schemaName, version);\r\n } else {\r\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\r\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\r\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}'.`);\r\n }\r\n\r\n if (SCHEMAURL3_2_JSON !== schemaProps.$schema && SCHEMAURL3_2_XML !== schemaProps.$schema) // TODO: Allow for 3.x URI versions to allow the API to read newer specs. (Start at 3.2 though)\r\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema ${this.name} has an unsupported namespace '${schemaProps.$schema}'.`);\r\n\r\n if (ECName.validate(schemaProps.alias)) {\r\n this._alias = schemaProps.alias;\r\n } else {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\r\n }\r\n\r\n if (undefined !== schemaProps.label)\r\n this._label = schemaProps.label;\r\n\r\n if (undefined !== schemaProps.description)\r\n this._description = schemaProps.description;\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public async fromJSON(schemaProps: SchemaProps) {\r\n this.fromJSONSync(schemaProps);\r\n }\r\n\r\n /**\r\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\r\n * schema context using the getCachedSchema method\r\n */\r\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\r\n const schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n return reader.readSchemaInfo(schema, rawSchema);\r\n }\r\n\r\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = await reader.readSchema(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\r\n */\r\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = reader.readSchemaSync(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isSchema(object: any): object is Schema {\r\n const schema = object as Schema;\r\n\r\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDisplayLabel(displayLabel: string) {\r\n this._label = displayLabel;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setAlias(alias: string) {\r\n if (!ECName.validate(alias)) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\r\n }\r\n this._alias = alias;\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\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\r\n * would prevent this class from extending Schema.\r\n * @internal\r\n */\r\nexport abstract class MutableSchema extends Schema {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\r\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\r\n public abstract override createMixinClass(name: string): Promise<Mixin>;\r\n public abstract override createMixinClassSync(name: string): Mixin;\r\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\r\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\r\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\r\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\r\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\r\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\r\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\r\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\r\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\r\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\r\n public abstract override createUnit(name: string): Promise<Unit>;\r\n public abstract override createUnitSync(name: string): Unit;\r\n public abstract override createConstant(name: string): Promise<Constant>;\r\n public abstract override createConstantSync(name: string): Constant;\r\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\r\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\r\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\r\n public abstract override createPhenomenonSync(name: string): Phenomenon;\r\n public abstract override createFormat(name: string): Promise<Format>;\r\n public abstract override createFormatSync(name: string): Format;\r\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\r\n public abstract override createUnitSystemSync(name: string): UnitSystem;\r\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\r\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\r\n public abstract override addItem<T extends SchemaItem>(item: T): void;\r\n public abstract override addReference(refSchema: Schema): Promise<void>;\r\n public abstract override addReferenceSync(refSchema: Schema): void;\r\n public abstract override setContext(schemaContext: SchemaContext): void;\r\n public abstract override deleteClass(name: string): Promise<void>;\r\n public abstract override deleteClassSync(name: string): void;\r\n public abstract override deleteSchemaItem(name: string): Promise<void>;\r\n public abstract override deleteSchemaItemSync(name: string): void;\r\n public abstract override setAlias(alias: string): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B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,CAAC;YAC5B,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;;AA9tBc,4BAAqB,GAAG,KAAK,CAAC;AAiuB/C;;;;;GAKG;AACH,MAAM,OAAgB,aAAc,SAAQ,MAAM;CAuCjD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaContext } from \"../Context\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\nimport { JsonParser } from \"../Deserialization/JsonParser\";\r\nimport { SchemaProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlParser } from \"../Deserialization/XmlParser\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { ECClassModifier, PrimitiveType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { AnyClass, AnySchemaItem, SchemaInfo } from \"../Interfaces\";\r\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { ECName } from \"../ECName\";\r\nimport { ECClass, StructClass } from \"./Class\";\r\nimport { Constant } from \"./Constant\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { CustomAttributeClass } from \"./CustomAttributeClass\";\r\nimport { EntityClass } from \"./EntityClass\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport { Format } from \"./Format\";\r\nimport { InvertedUnit } from \"./InvertedUnit\";\r\nimport { KindOfQuantity } from \"./KindOfQuantity\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { Phenomenon } from \"./Phenomenon\";\r\nimport { PropertyCategory } from \"./PropertyCategory\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { Unit } from \"./Unit\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\nconst SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\r\nconst SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class Schema implements CustomAttributeContainerProps {\r\n private static _currentECSpecVersion = \"3.2\";\r\n private _context: SchemaContext;\r\n protected _schemaKey?: SchemaKey;\r\n protected _alias?: string;\r\n protected _label?: string;\r\n protected _description?: string;\r\n public readonly references: Schema[];\r\n private readonly _items: Map<string, SchemaItem>;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n private _originalECSpecMajorVersion?: number;\r\n private _originalECSpecMinorVersion?: number;\r\n /**\r\n * Constructs an empty Schema with the given name and version in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param name The schema's name\r\n * @param readVersion The integer read (major) version of the schema\r\n * @param writeVersion The integer write version of the schema\r\n * @param minorVersion The integer minor version of the schema\r\n */\r\n constructor(context: SchemaContext, name: string, alias: string, readVersion: number, writeVersion: number, minorVersion: number);\r\n /**\r\n * Constructs an empty Schema with the given key in the provided context.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @param key A SchemaKey that uniquely identifies the schema\r\n */\r\n constructor(context: SchemaContext, key: SchemaKey, alias: string);\r\n /**\r\n * Constructs an empty Schema (without a SchemaKey) in the provided context.\r\n * This should only be used when the schema name and version will be deserialized (via `fromJson()`) immediately after this Schema is instantiated.\r\n * @param context The SchemaContext that will control the lifetime of the schema\r\n * @internal\r\n */\r\n constructor(context: SchemaContext);\r\n /** @internal */\r\n constructor(context: SchemaContext, nameOrKey?: SchemaKey | string, alias?: string, readVer?: number, writeVer?: number, minorVer?: number) {\r\n this._schemaKey = (typeof (nameOrKey) === \"string\") ? new SchemaKey(nameOrKey, new ECVersion(readVer as number, writeVer, minorVer)) : nameOrKey;\r\n this._context = context;\r\n this.references = [];\r\n this._items = new Map<string, SchemaItem>();\r\n\r\n if (alias !== undefined && ECName.validate(alias)) {\r\n this._alias = alias;\r\n } else if (nameOrKey !== undefined) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n }\r\n\r\n this._originalECSpecMajorVersion = Schema.currentECSpecMajorVersion;\r\n this._originalECSpecMinorVersion = Schema.currentECSpecMinorVersion;\r\n }\r\n\r\n public get schemaKey() {\r\n if (undefined === this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this._schemaKey;\r\n }\r\n\r\n public get name() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.name;\r\n }\r\n\r\n public get readVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.readVersion;\r\n }\r\n\r\n public get writeVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.writeVersion;\r\n }\r\n\r\n public get minorVersion() {\r\n if (this._schemaKey === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The schema has an invalid or missing SchemaKey.`);\r\n return this.schemaKey.minorVersion;\r\n }\r\n\r\n public get originalECSpecMajorVersion() { return this._originalECSpecMajorVersion; }\r\n public get originalECSpecMinorVersion() { return this._originalECSpecMinorVersion; }\r\n public static get currentECSpecMajorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[0], 10); }\r\n public static get currentECSpecMinorVersion(): number { return parseInt(Schema._currentECSpecVersion.split(\".\")[1], 10); }\r\n\r\n public get alias() {\r\n if (this._alias === undefined || this._alias === null) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not have the required 'alias' attribute.`);\r\n } else { return this._alias; }\r\n }\r\n\r\n public get label() { return this._label; }\r\n\r\n public get description() { return this._description; }\r\n\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** Returns the schema name. */\r\n public get fullName() { return this.schemaKey.name; }\r\n\r\n /** Returns the schema. */\r\n public get schema(): Schema { return this; }\r\n\r\n /** Returns the schema context this schema is within. */\r\n public get context(): SchemaContext { return this._context; }\r\n\r\n /**\r\n * Returns a SchemaItemKey given the item name and the schema it belongs to\r\n * @param fullName fully qualified name {Schema name}.{Item Name}\r\n */\r\n public getSchemaItemKey(fullName: string): SchemaItemKey {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(fullName);\r\n let schemaKey = this.schemaKey;\r\n if (this.name !== schemaName) {\r\n const newSchemaRef = this.getReferenceSync(schemaName);\r\n if (undefined === newSchemaRef)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to find the referenced SchemaItem ${itemName}.`);\r\n schemaKey = newSchemaRef.schemaKey;\r\n }\r\n return new SchemaItemKey(itemName, schemaKey);\r\n }\r\n\r\n protected addItem<T extends SchemaItem>(item: T): void {\r\n if (undefined !== this.getItemSync(item.name))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateItem, `The SchemaItem ${item.name} cannot be added to the schema ${this.name} because it already exists`);\r\n\r\n this._items.set(item.name.toUpperCase(), item);\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createClass<T extends AnyClass>(type: (new (_schema: Schema, _name: string, _modifier?: ECClassModifier) => T), name: string, modifier?: ECClassModifier): T {\r\n const item = new type(this, name, modifier);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteClass(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (ECClass.isECClass(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a class from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteClassSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (ECClass.isECClass(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected async deleteSchemaItem(name: string): Promise<void> {\r\n const schemaItem = await this.getItem(name);\r\n if (SchemaItem.isSchemaItem(schemaItem)) {\r\n this._items.delete(name.toUpperCase());\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a SchemaItem from within this schema.\r\n * @param name the local (unqualified) class name, lookup is case-insensitive\r\n * @alpha\r\n */\r\n protected deleteSchemaItemSync(name: string): void {\r\n const schemaItem = this.getItemSync(name);\r\n if (SchemaItem.isSchemaItem(schemaItem))\r\n this._items.delete(name.toUpperCase());\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n protected createItem<T extends AnySchemaItem>(type: (new (_schema: Schema, _name: string) => T), name: string): T {\r\n const item = new type(this, name);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /**\r\n * Creates a EntityClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass> {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n protected createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass {\r\n return this.createClass<EntityClass>(EntityClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a Mixin with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createMixinClass(name: string): Promise<Mixin> { return this.createClass<Mixin>(Mixin, name); }\r\n protected createMixinClassSync(name: string): Mixin { return this.createClass<Mixin>(Mixin, name); }\r\n\r\n /**\r\n * Creates a StructClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass> {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n protected createStructClassSync(name: string, modifier?: ECClassModifier): StructClass {\r\n return this.createClass<StructClass>(StructClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a CustomAttributeClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass> {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n protected createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass {\r\n return this.createClass<CustomAttributeClass>(CustomAttributeClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates a RelationshipClass with the provided name in this schema.\r\n * @param name\r\n * @param modifier\r\n */\r\n protected async createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass> {\r\n return this.createRelationshipClassSync(name, modifier);\r\n }\r\n\r\n protected createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass {\r\n return this.createClass<RelationshipClass>(RelationshipClass, name, modifier);\r\n }\r\n\r\n /**\r\n * Creates an Enumeration with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration> {\r\n return this.createEnumerationSync(name, primitiveType);\r\n }\r\n\r\n protected createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration {\r\n const item = new Enumeration(this, name, primitiveType);\r\n this.addItem(item);\r\n return item;\r\n }\r\n\r\n /**\r\n * Creates an KindOfQuantity with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createKindOfQuantity(name: string): Promise<KindOfQuantity> {\r\n return this.createKindOfQuantitySync(name);\r\n }\r\n\r\n protected createKindOfQuantitySync(name: string): KindOfQuantity {\r\n return this.createItem<KindOfQuantity>(KindOfQuantity, name);\r\n }\r\n\r\n /**\r\n * Creates a Constant with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createConstant(name: string): Promise<Constant> {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n protected createConstantSync(name: string): Constant {\r\n return this.createItem<Constant>(Constant, name);\r\n }\r\n\r\n /**\r\n * Creates a Inverted Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createInvertedUnit(name: string): Promise<InvertedUnit> {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n protected createInvertedUnitSync(name: string): InvertedUnit {\r\n return this.createItem<InvertedUnit>(InvertedUnit, name);\r\n }\r\n\r\n /**\r\n * Creates an Format with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createFormat(name: string): Promise<Format> {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n protected createFormatSync(name: string): Format {\r\n return this.createItem<Format>(Format, name);\r\n }\r\n\r\n /**\r\n * Creates a UnitSystem with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnitSystem(name: string): Promise<UnitSystem> {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n protected createUnitSystemSync(name: string): UnitSystem {\r\n return this.createItem<UnitSystem>(UnitSystem, name);\r\n }\r\n\r\n /**\r\n * Creates a Phenomenon with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPhenomenon(name: string): Promise<Phenomenon> {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n protected createPhenomenonSync(name: string): Phenomenon {\r\n return this.createItem<Phenomenon>(Phenomenon, name);\r\n }\r\n\r\n /**\r\n * Creates a Unit with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createUnit(name: string): Promise<Unit> {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n protected createUnitSync(name: string): Unit {\r\n return this.createItem<Unit>(Unit, name);\r\n }\r\n\r\n /**\r\n * Creates an PropertyCategory with the provided name in this schema.\r\n * @param name\r\n */\r\n protected async createPropertyCategory(name: string): Promise<PropertyCategory> {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n\r\n protected createPropertyCategorySync(name: string): PropertyCategory {\r\n return this.createItem<PropertyCategory>(PropertyCategory, name);\r\n }\r\n /**\r\n *\r\n * @param refSchema\r\n */\r\n protected async addReference(refSchema: Schema): Promise<void> {\r\n // TODO validation of reference schema. For now just adding\r\n this.addReferenceSync(refSchema);\r\n }\r\n\r\n protected addReferenceSync(refSchema: Schema): void {\r\n this.references.push(refSchema);\r\n }\r\n\r\n /**\r\n * @alpha Used for schema editing.\r\n */\r\n protected setContext(context: SchemaContext): void {\r\n this._context = context;\r\n }\r\n\r\n /**\r\n * Sets the version of the SchemaKey identifying the schema.\r\n * @param readVersion The read version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param writeVersion The write version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n * @param minorVersion The minor version of the schema. If undefined, the value from the existing SchemaKey will be used.\r\n */\r\n public setVersion(readVersion?: number, writeVersion?: number, minorVersion?: number): void {\r\n if (!this._schemaKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaKey, `The schema '${this.name}' has an invalid SchemaKey.`);\r\n\r\n const newVersion = new ECVersion(readVersion ?? this._schemaKey.readVersion, writeVersion ?? this._schemaKey.writeVersion, minorVersion ?? this._schemaKey.minorVersion);\r\n this._schemaKey = new SchemaKey(this._schemaKey.name, newVersion);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public async getItem<T extends SchemaItem>(name: string): Promise<T | undefined> {\r\n // this method exists so we can rewire it later when we load partial schemas, for now it is identical to the sync version\r\n return this.getItemSync<T>(name);\r\n }\r\n\r\n /**\r\n * Gets an item from within this schema. To get by full name use lookupItem instead.\r\n * @param key the local (unqualified) name, lookup is case-insensitive\r\n */\r\n public getItemSync<T extends SchemaItem>(name: string): T | undefined {\r\n // Case-insensitive search\r\n return this._items.get(name.toUpperCase()) as T;\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public async lookupItem<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): Promise<T | undefined> {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItem<T>(itemName);\r\n }\r\n\r\n const refSchema = await this.getReference(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItem<T>(itemName);\r\n }\r\n\r\n /**\r\n * Attempts to find a schema item within this schema or a (directly) referenced schema\r\n * @param key The full name or a SchemaItemKey identifying the desired item.\r\n */\r\n public lookupItemSync<T extends SchemaItem>(key: Readonly<SchemaItemKey> | string): T | undefined {\r\n let schemaName, itemName: string;\r\n if (typeof (key) === \"string\") {\r\n [schemaName, itemName] = SchemaItem.parseFullName(key);\r\n } else {\r\n itemName = key.name;\r\n schemaName = key.schemaName;\r\n }\r\n\r\n if (!schemaName || schemaName.toUpperCase() === this.name.toUpperCase()) {\r\n return this.getItemSync<T>(itemName);\r\n }\r\n\r\n const refSchema = this.getReferenceSync(schemaName);\r\n if (!refSchema)\r\n return undefined;\r\n\r\n return refSchema.getItemSync<T>(itemName);\r\n }\r\n\r\n public getItems<T extends AnySchemaItem>(): IterableIterator<T> {\r\n if (!this._items)\r\n return new Map<string, SchemaItem>().values() as IterableIterator<T>;\r\n\r\n return this._items.values() as IterableIterator<T>;\r\n }\r\n\r\n public *getClasses(): IterableIterator<ECClass> {\r\n for (const [, value] of this._items) {\r\n if (ECClass.isECClass(value))\r\n yield value;\r\n }\r\n }\r\n\r\n public async getReference<T extends Schema>(refSchemaName: string): Promise<T | undefined> {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n public getReferenceNameByAlias(alias: string): string | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n const schema = this.references.find((ref) => ref.alias ? ref.alias.toLowerCase() === alias.toLowerCase() : false);\r\n return schema ? schema.name : undefined;\r\n }\r\n\r\n public getReferenceSync<T extends Schema>(refSchemaName: string): T | undefined {\r\n if (this.references.length === 0)\r\n return undefined;\r\n\r\n return this.references.find((ref) => ref.name.toLowerCase() === refSchemaName.toLowerCase()) as T;\r\n }\r\n\r\n /**\r\n * Save this Schema's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): SchemaProps {\r\n if (!this.isECSpecVersionSupported())\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\r\n\r\n const schemaJson: { [value: string]: any } = {};\r\n schemaJson.$schema = SCHEMAURL3_2_JSON; // $schema is required\r\n schemaJson.name = this.name; // name is required\r\n schemaJson.version = this.schemaKey.version.toString(true);\r\n schemaJson.alias = this.alias; // alias is required\r\n if (undefined !== this.label) // label is optional\r\n schemaJson.label = this.label;\r\n if (undefined !== this.description) // description is optional\r\n schemaJson.description = this.description;\r\n if (undefined !== this.references && this.references.length > 0) // references is optional\r\n schemaJson.references = this.references.map(({ name, schemaKey }) => ({ name, version: schemaKey.version.toString() }));\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (undefined !== customAttributes)\r\n schemaJson.customAttributes = customAttributes;\r\n if (this._items.size > 0) {\r\n schemaJson.items = {};\r\n this._items.forEach((schemaItem: SchemaItem) => {\r\n schemaJson.items[schemaItem.name] = schemaItem.toJSON(false, true);\r\n });\r\n }\r\n return schemaJson as SchemaProps;\r\n }\r\n\r\n /**\r\n * Converts the schema to a DOM XML Document.\r\n * @param schemaXml An empty DOM document to which the schema will be written\r\n */\r\n public async toXml(schemaXml: Document): Promise<Document> {\r\n if (!this.isECSpecVersionSupported())\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECSpecVersion and cannot be serialized.`);\r\n\r\n const schemaMetadata = schemaXml.createElement(\"ECSchema\");\r\n schemaMetadata.setAttribute(\"xmlns\", SCHEMAURL3_2_XML);\r\n schemaMetadata.setAttribute(\"version\", this.schemaKey.version.toString());\r\n schemaMetadata.setAttribute(\"schemaName\", this.name);\r\n schemaMetadata.setAttribute(\"alias\", this.alias ? this.alias : \"\");\r\n if (undefined !== this.label)\r\n schemaMetadata.setAttribute(\"displayLabel\", this.label);\r\n if (undefined !== this.description)\r\n schemaMetadata.setAttribute(\"description\", this.description);\r\n\r\n // Map used for CA serialization\r\n const refSchemaMap = new Map<string, string>();\r\n\r\n this.references.forEach(({ name, schemaKey, alias }) => {\r\n const schemaRef = schemaXml.createElement(\"ECSchemaReference\");\r\n schemaRef.setAttribute(\"name\", name);\r\n schemaRef.setAttribute(\"version\", schemaKey.version.toString());\r\n schemaRef.setAttribute(\"alias\", alias ? alias : \"\");\r\n schemaMetadata.appendChild(schemaRef);\r\n refSchemaMap.set(name, schemaKey.version.toString());\r\n });\r\n\r\n if (this._customAttributes) {\r\n const parentElem = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElem = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this);\r\n parentElem.appendChild(caElem);\r\n }\r\n schemaMetadata.appendChild(parentElem);\r\n }\r\n\r\n for (const [, item] of this._items) {\r\n const itemXml = await item.toXml(schemaXml);\r\n schemaMetadata.appendChild(itemXml);\r\n }\r\n\r\n schemaXml.appendChild(schemaMetadata);\r\n return schemaXml;\r\n }\r\n\r\n // Check if the ECSpecVersion read-version is greater than the current ECSpecVersion supported.\r\n // If a specific ECSpecVersion is given, check against that version.\r\n // If no argument is given, check against the original ECSpecVersion of the schema.\r\n private isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck?: number): boolean {\r\n // If argument is supplied, check the argument against the current ECSpecVersion supported\r\n if (ecSpecMajorVersionToCheck !== undefined)\r\n return (Schema.currentECSpecMajorVersion >= ecSpecMajorVersionToCheck);\r\n\r\n // If argument is not supplied, check against the original ECSpecVersion of the schema\r\n if (this.originalECSpecMajorVersion === undefined)\r\n return false;\r\n return (Schema.currentECSpecMajorVersion >= this.originalECSpecMajorVersion);\r\n }\r\n\r\n // Check if the full ECSpecVersion is greater than the current ECSpecVersion supported.\r\n // If a specific ECSpecVersion is given, check against that version.\r\n // If no argument is given, check against the original ECSpecVersion of the schema.\r\n private isECSpecVersionSupported(ecSpecMajorVersionToCheck?: number, ecSpecMinorVersionToCheck?: number): boolean {\r\n // If arguments are supplied, check the arguments against the current ECSpecVersion supported\r\n if (ecSpecMajorVersionToCheck !== undefined && ecSpecMinorVersionToCheck !== undefined) {\r\n if (!this.isECSpecMajorVersionSupported(ecSpecMajorVersionToCheck))\r\n return false;\r\n return (Schema.currentECSpecMinorVersion >= ecSpecMinorVersionToCheck);\r\n }\r\n // If arguments are not supplied, check against the original ECSpecVersion of the schema\r\n if (!this.isECSpecMajorVersionSupported() || this.originalECSpecMinorVersion === undefined)\r\n return false;\r\n return (Schema.currentECSpecMinorVersion >= this.originalECSpecMinorVersion);\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public fromJSONSync(schemaProps: SchemaProps) {\r\n if (undefined === this._schemaKey) {\r\n const schemaName = schemaProps.name;\r\n const version = ECVersion.fromString(schemaProps.version);\r\n this._schemaKey = new SchemaKey(schemaName, version);\r\n } else {\r\n if (schemaProps.name.toLowerCase() !== this.name.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${this.name} does not match the provided name, '${schemaProps.name}'.`);\r\n if (this.schemaKey.version.compare(ECVersion.fromString(schemaProps.version)))\r\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}'.`);\r\n }\r\n\r\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)\r\n throw new ECObjectsError(ECObjectsStatus.MissingSchemaUrl, `The Schema '${this.name}' has an unsupported namespace '${schemaProps.$schema}'.`);\r\n\r\n // The schema props have not been parsed. Parse the ECXml version from the $schema attribute\r\n let ecVersion: ECSpecVersion;\r\n if (schemaProps.ecSpecMajorVersion === undefined || schemaProps.ecSpecMinorVersion === undefined) {\r\n ecVersion = ((schemaProps.$schema.search(\"ECXML\") !== -1) ? XmlParser.parseXmlNamespace(schemaProps.$schema) : JsonParser.parseJSUri(schemaProps.$schema)) as ECSpecVersion;\r\n } else {\r\n ecVersion = { readVersion: schemaProps.ecSpecMajorVersion, writeVersion: schemaProps.ecSpecMinorVersion } as ECSpecVersion;\r\n }\r\n\r\n this._originalECSpecMajorVersion = ecVersion?.readVersion;\r\n this._originalECSpecMinorVersion = ecVersion?.writeVersion;\r\n\r\n if (!this.isECSpecMajorVersionSupported(ecVersion?.readVersion))\r\n throw new ECObjectsError(ECObjectsStatus.NewerECSpecVersion, `The Schema '${this.name}' has an unsupported ECVersion and cannot be loaded.`);\r\n\r\n if (ECName.validate(schemaProps.alias)) {\r\n this._alias = schemaProps.alias;\r\n } else {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Schema ${schemaProps.name} does not have the required 'alias' attribute.`);\r\n }\r\n\r\n if (undefined !== schemaProps.label)\r\n this._label = schemaProps.label;\r\n\r\n if (undefined !== schemaProps.description)\r\n this._description = schemaProps.description;\r\n }\r\n\r\n /**\r\n * Loads the schema header (name, version alias, label and description) from the input SchemaProps\r\n */\r\n public async fromJSON(schemaProps: SchemaProps) {\r\n this.fromJSONSync(schemaProps);\r\n }\r\n\r\n /**\r\n * Completely loads the SchemaInfo from the input json and starts loading the entire schema. The complete schema can be retrieved from the\r\n * schema context using the getCachedSchema method\r\n */\r\n public static async startLoadingFromJson(jsonObj: object | string, context: SchemaContext): Promise<SchemaInfo> {\r\n const schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n return reader.readSchemaInfo(schema, rawSchema);\r\n }\r\n\r\n public static async fromJson(jsonObj: object | string, context: SchemaContext): Promise<Schema> {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = await reader.readSchema(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * Completely loads the Schema from the input json. The schema is cached in the schema context.\r\n */\r\n public static fromJsonSync(jsonObj: object | string, context: SchemaContext): Schema {\r\n let schema: Schema = new Schema(context);\r\n\r\n const reader = new SchemaReadHelper(JsonParser, context);\r\n const rawSchema = typeof jsonObj === \"string\" ? JSON.parse(jsonObj) : jsonObj;\r\n schema = reader.readSchemaSync(schema, rawSchema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isSchema(object: any): object is Schema {\r\n const schema = object as Schema;\r\n\r\n return schema !== undefined && schema.schemaKey !== undefined && schema.context !== undefined;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDisplayLabel(displayLabel: string) {\r\n this._label = displayLabel;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setDescription(description: string) {\r\n this._description = description;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected setAlias(alias: string) {\r\n if (!ECName.validate(alias)) {\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName, \"The specified schema alias is invalid.\");\r\n }\r\n this._alias = alias;\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\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\r\n * would prevent this class from extending Schema.\r\n * @internal\r\n */\r\nexport abstract class MutableSchema extends Schema {\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override createEntityClass(name: string, modifier?: ECClassModifier): Promise<EntityClass>;\r\n public abstract override createEntityClassSync(name: string, modifier?: ECClassModifier): EntityClass;\r\n public abstract override createMixinClass(name: string): Promise<Mixin>;\r\n public abstract override createMixinClassSync(name: string): Mixin;\r\n public abstract override createStructClass(name: string, modifier?: ECClassModifier): Promise<StructClass>;\r\n public abstract override createStructClassSync(name: string, modifier?: ECClassModifier): StructClass;\r\n public abstract override createCustomAttributeClass(name: string, modifier?: ECClassModifier): Promise<CustomAttributeClass>;\r\n public abstract override createCustomAttributeClassSync(name: string, modifier?: ECClassModifier): CustomAttributeClass;\r\n public abstract override createRelationshipClass(name: string, modifier?: ECClassModifier): Promise<RelationshipClass>;\r\n public abstract override createRelationshipClassSync(name: string, modifier?: ECClassModifier): RelationshipClass;\r\n public abstract override createEnumeration(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Promise<Enumeration>;\r\n public abstract override createEnumerationSync(name: string, primitiveType?: PrimitiveType.Integer | PrimitiveType.String): Enumeration;\r\n public abstract override createKindOfQuantity(name: string): Promise<KindOfQuantity>;\r\n public abstract override createKindOfQuantitySync(name: string): KindOfQuantity;\r\n public abstract override createUnit(name: string): Promise<Unit>;\r\n public abstract override createUnitSync(name: string): Unit;\r\n public abstract override createConstant(name: string): Promise<Constant>;\r\n public abstract override createConstantSync(name: string): Constant;\r\n public abstract override createInvertedUnit(name: string): Promise<InvertedUnit>;\r\n public abstract override createInvertedUnitSync(name: string): InvertedUnit;\r\n public abstract override createPhenomenon(name: string): Promise<Phenomenon>;\r\n public abstract override createPhenomenonSync(name: string): Phenomenon;\r\n public abstract override createFormat(name: string): Promise<Format>;\r\n public abstract override createFormatSync(name: string): Format;\r\n public abstract override createUnitSystem(name: string): Promise<UnitSystem>;\r\n public abstract override createUnitSystemSync(name: string): UnitSystem;\r\n public abstract override createPropertyCategory(name: string): Promise<PropertyCategory>;\r\n public abstract override createPropertyCategorySync(name: string): PropertyCategory;\r\n public abstract override addItem<T extends SchemaItem>(item: T): void;\r\n public abstract override addReference(refSchema: Schema): Promise<void>;\r\n public abstract override addReferenceSync(refSchema: Schema): void;\r\n public abstract override setContext(schemaContext: SchemaContext): void;\r\n public abstract override deleteClass(name: string): Promise<void>;\r\n public abstract override deleteClassSync(name: string): void;\r\n public abstract override deleteSchemaItem(name: string): Promise<void>;\r\n public abstract override deleteSchemaItemSync(name: string): void;\r\n public abstract override setAlias(alias: string): void;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaItem.d.ts","sourceRoot":"","sources":["../../../src/Metadata/SchemaItem.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAA6B,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAa,aAAa,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,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,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,SAAS,CAAC,WAAW,KAAK,IAAI,CAAC,YAAY;gBAC7C,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC;QAC9C,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,OAAO;gBACnC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;QACpC,CAAC;IACH,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,SAA8B;QAC3D,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAgC;QAC5D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAgC;QAC5D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,WAAY,SAAQ,IAAI;CAK7C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { SchemaItemUnitProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedPhenomenon, LazyLoadedUnitSystem } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { Phenomenon } from \"./Phenomenon\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\n/**\r\n * An abstract class that adds the ability to define Units and everything that goes with them, within an ECSchema as a\r\n * first-class concept is to allow the iModel to not be dependent on any hard-coded Units\r\n * @beta\r\n */\r\nexport class Unit extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.Unit; // eslint-disable-line\r\n protected _phenomenon?: LazyLoadedPhenomenon;\r\n protected _unitSystem?: LazyLoadedUnitSystem;\r\n protected _definition: string;\r\n protected _numerator?: number;\r\n protected _denominator?: number;\r\n protected _offset?: number;\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.Unit;\r\n this._definition = \"\";\r\n }\r\n\r\n public get phenomenon(): LazyLoadedPhenomenon | undefined { return this._phenomenon; }\r\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\r\n public get definition(): string { return this._definition; }\r\n public get numerator(): number { return this._numerator ?? 1.0; }\r\n public get offset(): number { return this._offset ?? 0.0; }\r\n public get denominator(): number { return this._denominator ?? 1.0; }\r\n public get hasNumerator(): boolean { return (this._numerator !== undefined); }\r\n public get hasOffset(): boolean { return (this._offset !== undefined); }\r\n public get hasDenominator(): boolean { return (this._denominator !== undefined); }\r\n\r\n /**\r\n * Returns true if a conversion can be calculated between the input units\r\n * @alpha\r\n */\r\n public static async areCompatible(unitA: Unit, unitB: Unit): Promise<boolean> {\r\n const unitAPhenomenon = await unitA.phenomenon;\r\n const unitBPhenomenon = await unitB.phenomenon;\r\n\r\n if (!unitAPhenomenon || !unitBPhenomenon || !unitAPhenomenon.key.matches(unitBPhenomenon.key))\r\n return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n public static isUnit(object: any): object is Unit {\r\n return SchemaItem.isSchemaItem(object) && object.schemaItemType === SchemaItemType.Unit;\r\n }\r\n\r\n /**\r\n * Save this Unit's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): SchemaItemUnitProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.phenomenon = this.phenomenon!.fullName;\r\n schemaJson.unitSystem = this.unitSystem!.fullName;\r\n schemaJson.definition = this.definition;\r\n if (this.hasNumerator)\r\n schemaJson.numerator = this.numerator;\r\n if (this.hasDenominator)\r\n schemaJson.denominator = this.denominator;\r\n if (this.hasOffset)\r\n schemaJson.offset = this.offset;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n const phenomenon = await this.phenomenon;\r\n if (undefined !== phenomenon) {\r\n const phenomenonName = XmlSerializationUtils.createXmlTypedName(this.schema, phenomenon.schema, phenomenon.name);\r\n itemElement.setAttribute(\"phenomenon\", phenomenonName);\r\n }\r\n\r\n const unitSystem = await this.unitSystem;\r\n if (undefined !== unitSystem) {\r\n const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);\r\n itemElement.setAttribute(\"unitSystem\", unitSystemName);\r\n }\r\n\r\n itemElement.setAttribute(\"definition\", this.definition);\r\n if (this.hasNumerator)\r\n itemElement.setAttribute(\"numerator\", this.numerator.toString());\r\n if (this.hasDenominator)\r\n itemElement.setAttribute(\"denominator\", this.denominator.toString());\r\n if (this.hasOffset)\r\n itemElement.setAttribute(\"offset\", this.offset.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(unitProps: SchemaItemUnitProps) {\r\n super.fromJSONSync(unitProps);\r\n\r\n const phenomenonSchemaItemKey = this.schema.getSchemaItemKey(unitProps.phenomenon);\r\n if (!phenomenonSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the phenomenon ${unitProps.phenomenon}.`);\r\n this._phenomenon = new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenonSchemaItemKey,\r\n async () => {\r\n const phenom = await this.schema.lookupItem<Phenomenon>(phenomenonSchemaItemKey);\r\n if (undefined === phenom)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the phenomenon ${unitProps.phenomenon}.`);\r\n return phenom;\r\n });\r\n\r\n const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(unitProps.unitSystem);\r\n if (!unitSystemSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${unitProps.unitSystem}.`);\r\n this._unitSystem = new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemSchemaItemKey,\r\n async () => {\r\n const unitSystem = await this.schema.lookupItem<UnitSystem>(unitSystemSchemaItemKey);\r\n if (undefined === unitSystem)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${unitProps.unitSystem}.`);\r\n return unitSystem;\r\n });\r\n\r\n if (this._definition !== \"\" && unitProps.definition.toLowerCase() !== this._definition.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${this.name} has an invalid 'definition' attribute.`);\r\n else if (this._definition === \"\")\r\n this._definition = unitProps.definition;\r\n\r\n if (undefined !== unitProps.numerator) {\r\n if (unitProps.numerator !== this._numerator)\r\n this._numerator = unitProps.numerator;\r\n }\r\n\r\n if (undefined !== unitProps.denominator) {\r\n if (unitProps.denominator !== this._denominator)\r\n this._denominator = unitProps.denominator;\r\n }\r\n\r\n if (undefined !== unitProps.offset) {\r\n if (unitProps.offset !== this._offset)\r\n this._offset = unitProps.offset;\r\n }\r\n }\r\n\r\n public override async fromJSON(unitProps: SchemaItemUnitProps) {\r\n this.fromJSONSync(unitProps);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setPhenomenon(phenomenon: LazyLoadedPhenomenon) {\r\n this._phenomenon = phenomenon;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setUnitSystem(unitSystem: LazyLoadedUnitSystem) {\r\n this._unitSystem = unitSystem;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setDefinition(definition: string) {\r\n this._definition = definition;\r\n }\r\n}\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableUnit extends Unit {\r\n public abstract override setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>;\r\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>;\r\n public abstract override setDefinition(definition: string): Promise<void>;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Unit.js","sourceRoot":"","sources":["../../../src/Metadata/Unit.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;GAIG;AACH,MAAM,OAAO,IAAK,SAAQ,UAAU;IASlC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC;QAC1C,IAAI,CAAC,WA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AC,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC;QAC9C,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,OAAO;gBACnC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;QACpC,CAAC;IACH,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,SAA8B;QAC3D,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAgC;QAC5D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAgC;QAC5D,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,CAAC,UAAkB;QAC9C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,WAAY,SAAQ,IAAI;CAK7C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { SchemaItemUnitProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { LazyLoadedPhenomenon, LazyLoadedUnitSystem } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { Phenomenon } from \"./Phenomenon\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { UnitSystem } from \"./UnitSystem\";\r\n\r\n/**\r\n * An abstract class that adds the ability to define Units and everything that goes with them, within an ECSchema as a\r\n * first-class concept is to allow the iModel to not be dependent on any hard-coded Units\r\n * @beta\r\n */\r\nexport class Unit extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.Unit;\r\n protected _phenomenon?: LazyLoadedPhenomenon;\r\n protected _unitSystem?: LazyLoadedUnitSystem;\r\n protected _definition: string;\r\n protected _numerator?: number;\r\n protected _denominator?: number;\r\n protected _offset?: number;\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.Unit;\r\n this._definition = \"\";\r\n }\r\n\r\n public get phenomenon(): LazyLoadedPhenomenon | undefined { return this._phenomenon; }\r\n public get unitSystem(): LazyLoadedUnitSystem | undefined { return this._unitSystem; }\r\n public get definition(): string { return this._definition; }\r\n public get numerator(): number { return this._numerator ?? 1.0; }\r\n public get offset(): number { return this._offset ?? 0.0; }\r\n public get denominator(): number { return this._denominator ?? 1.0; }\r\n public get hasNumerator(): boolean { return (this._numerator !== undefined); }\r\n public get hasOffset(): boolean { return (this._offset !== undefined); }\r\n public get hasDenominator(): boolean { return (this._denominator !== undefined); }\r\n\r\n /**\r\n * Returns true if a conversion can be calculated between the input units\r\n * @alpha\r\n */\r\n public static async areCompatible(unitA: Unit, unitB: Unit): Promise<boolean> {\r\n const unitAPhenomenon = await unitA.phenomenon;\r\n const unitBPhenomenon = await unitB.phenomenon;\r\n\r\n if (!unitAPhenomenon || !unitBPhenomenon || !unitAPhenomenon.key.matches(unitBPhenomenon.key))\r\n return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * @alpha\r\n */\r\n public static isUnit(object: any): object is Unit {\r\n return SchemaItem.isSchemaItem(object) && object.schemaItemType === SchemaItemType.Unit;\r\n }\r\n\r\n /**\r\n * Save this Unit's properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): SchemaItemUnitProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n schemaJson.phenomenon = this.phenomenon!.fullName;\r\n schemaJson.unitSystem = this.unitSystem!.fullName;\r\n schemaJson.definition = this.definition;\r\n if (this.hasNumerator)\r\n schemaJson.numerator = this.numerator;\r\n if (this.hasDenominator)\r\n schemaJson.denominator = this.denominator;\r\n if (this.hasOffset)\r\n schemaJson.offset = this.offset;\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n const phenomenon = await this.phenomenon;\r\n if (undefined !== phenomenon) {\r\n const phenomenonName = XmlSerializationUtils.createXmlTypedName(this.schema, phenomenon.schema, phenomenon.name);\r\n itemElement.setAttribute(\"phenomenon\", phenomenonName);\r\n }\r\n\r\n const unitSystem = await this.unitSystem;\r\n if (undefined !== unitSystem) {\r\n const unitSystemName = XmlSerializationUtils.createXmlTypedName(this.schema, unitSystem.schema, unitSystem.name);\r\n itemElement.setAttribute(\"unitSystem\", unitSystemName);\r\n }\r\n\r\n itemElement.setAttribute(\"definition\", this.definition);\r\n if (this.hasNumerator)\r\n itemElement.setAttribute(\"numerator\", this.numerator.toString());\r\n if (this.hasDenominator)\r\n itemElement.setAttribute(\"denominator\", this.denominator.toString());\r\n if (this.hasOffset)\r\n itemElement.setAttribute(\"offset\", this.offset.toString());\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(unitProps: SchemaItemUnitProps) {\r\n super.fromJSONSync(unitProps);\r\n\r\n const phenomenonSchemaItemKey = this.schema.getSchemaItemKey(unitProps.phenomenon);\r\n if (!phenomenonSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the phenomenon ${unitProps.phenomenon}.`);\r\n this._phenomenon = new DelayedPromiseWithProps<SchemaItemKey, Phenomenon>(phenomenonSchemaItemKey,\r\n async () => {\r\n const phenom = await this.schema.lookupItem<Phenomenon>(phenomenonSchemaItemKey);\r\n if (undefined === phenom)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the phenomenon ${unitProps.phenomenon}.`);\r\n return phenom;\r\n });\r\n\r\n const unitSystemSchemaItemKey = this.schema.getSchemaItemKey(unitProps.unitSystem);\r\n if (!unitSystemSchemaItemKey)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${unitProps.unitSystem}.`);\r\n this._unitSystem = new DelayedPromiseWithProps<SchemaItemKey, UnitSystem>(unitSystemSchemaItemKey,\r\n async () => {\r\n const unitSystem = await this.schema.lookupItem<UnitSystem>(unitSystemSchemaItemKey);\r\n if (undefined === unitSystem)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `Unable to locate the unitSystem ${unitProps.unitSystem}.`);\r\n return unitSystem;\r\n });\r\n\r\n if (this._definition !== \"\" && unitProps.definition.toLowerCase() !== this._definition.toLowerCase())\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECJson, `The Unit ${this.name} has an invalid 'definition' attribute.`);\r\n else if (this._definition === \"\")\r\n this._definition = unitProps.definition;\r\n\r\n if (undefined !== unitProps.numerator) {\r\n if (unitProps.numerator !== this._numerator)\r\n this._numerator = unitProps.numerator;\r\n }\r\n\r\n if (undefined !== unitProps.denominator) {\r\n if (unitProps.denominator !== this._denominator)\r\n this._denominator = unitProps.denominator;\r\n }\r\n\r\n if (undefined !== unitProps.offset) {\r\n if (unitProps.offset !== this._offset)\r\n this._offset = unitProps.offset;\r\n }\r\n }\r\n\r\n public override async fromJSON(unitProps: SchemaItemUnitProps) {\r\n this.fromJSONSync(unitProps);\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setPhenomenon(phenomenon: LazyLoadedPhenomenon) {\r\n this._phenomenon = phenomenon;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setUnitSystem(unitSystem: LazyLoadedUnitSystem) {\r\n this._unitSystem = unitSystem;\r\n }\r\n\r\n /**\r\n * @alpha\r\n * Used for schema editing.\r\n */\r\n protected async setDefinition(definition: string) {\r\n this._definition = definition;\r\n }\r\n}\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableUnit extends Unit {\r\n public abstract override setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>;\r\n public abstract override setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>;\r\n public abstract override setDefinition(definition: string): Promise<void>;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitSystem.js","sourceRoot":"","sources":["../../../src/Metadata/UnitSystem.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAGxC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC;IAClD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;CAEzD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class UnitSystem extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.UnitSystem
|
|
1
|
+
{"version":3,"file":"UnitSystem.js","sourceRoot":"","sources":["../../../src/Metadata/UnitSystem.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAGxC,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC;IAClD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;CAEzD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class UnitSystem extends SchemaItem {\r\n public override readonly schemaItemType!: SchemaItemType.UnitSystem;\r\n\r\n constructor(schema: Schema, name: string) {\r\n super(schema, name);\r\n this.schemaItemType = SchemaItemType.UnitSystem;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * Used for schema editing.\r\n */\r\nexport abstract class MutableUnitSystem extends UnitSystem {\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaKey.d.ts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IACtD,IAAW,YAAY,WAAiC;IACxD,IAAW,YAAY,WAAiC;IAExD;;;;OAIG;IACI,QAAQ,CAAC,SAAS,GAAE,OAAc;WAE3B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAY1C;;;OAGG;IACI,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO;IAUlE;;;;OAIG;IACI,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAI/C;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAE,eAAuC,GAAG,OAAO;IA2BrG;;;;OAIG;WACW,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS;IAIxD;;OAEG;IACI,MAAM,IAAI,cAAc;CAQhC;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;gBAEpB,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS;IAK3C,IAAW,SAAS,cAA8B;IAClD,IAAW,IAAI,WAA8B;IAE7C,IAAW,UAAU,WAAkC;IAEvD,2DAA2D;IAC3D,IAAW,QAAQ,WAAgD;IAEnE;;;OAGG;IAEI,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO;IAUpC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAK9C"}
|
package/lib/esm/SchemaKey.js
CHANGED
|
@@ -132,13 +132,9 @@ export class SchemaKey {
|
|
|
132
132
|
* @param rhs The SchemaKey to compare with
|
|
133
133
|
* @param matchType The match type to use for comparison.
|
|
134
134
|
*/
|
|
135
|
-
matches(rhs, matchType = SchemaMatchType.
|
|
135
|
+
matches(rhs, matchType = SchemaMatchType.Exact) {
|
|
136
136
|
switch (matchType) {
|
|
137
137
|
case SchemaMatchType.Identical:
|
|
138
|
-
// TODO: if (this.checksum && rhs.checksum)
|
|
139
|
-
// TODO: return this.checksum === rhs.checksum;
|
|
140
|
-
return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&
|
|
141
|
-
this.writeVersion === rhs.writeVersion && this.minorVersion === rhs.minorVersion;
|
|
142
138
|
case SchemaMatchType.Exact:
|
|
143
139
|
return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&
|
|
144
140
|
this.writeVersion === rhs.writeVersion && this.minorVersion === rhs.minorVersion;
|
package/lib/esm/SchemaKey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaKey.js","sourceRoot":"","sources":["../../src/SchemaKey.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,SAAS;IAKpB;;;;;;OAMG;IACH,YAAY,IAAa,EAAE,KAAc,EAAE,KAAc;QAXjD,UAAK,GAAW,CAAC,CAAC;QAClB,WAAM,GAAW,CAAC,CAAC;QACnB,WAAM,GAAW,CAAC,CAAC;QAUzB,IAAI,SAAS,KAAK,IAAI;YACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACtB,IAAI,SAAS,KAAK,KAAK;YACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEtB,IAAI,IAAI,CAAC,KAAK,GAAG,GAAG,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,IAAI,CAAC,MAAM,GAAG,CA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AK,IAAI,CAAC,IAAI;YACxB,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;YAChE,OAAO,KAAK,CAAC;QAEf,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,eAAe,CAAC,IAAY;QACjC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC9E,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,OAAO,aAAa,SAAS,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;QACpG,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaKeyProps } from \"./Deserialization/JsonProps\";\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { ECName } from \"./ECName\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class ECVersion {\r\n private _read: number = 0;\r\n private _write: number = 0;\r\n private _minor: number = 0;\r\n\r\n /**\r\n * The constructor will throw an ECObjectsError if any of the parameters below are above the threshold.\r\n * @param read Can support up to 999.\r\n * @param write Can support up to 999.\r\n * @param minor Can support up to 9999999.\r\n *\r\n */\r\n constructor(read?: number, write?: number, minor?: number) {\r\n if (undefined !== read)\r\n this._read = read;\r\n if (undefined !== write)\r\n this._write = write;\r\n if (undefined !== minor)\r\n this._minor = minor;\r\n\r\n if (this._read > 999 || this._read < 0 || this._write > 999 || this._write < 0 || this._minor > 9999999 || this._minor < 0)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion);\r\n }\r\n\r\n public get read() { return this._read; }\r\n public get write() { return this._write; }\r\n public get minor() { return this._minor; }\r\n\r\n /**\r\n * Creates a string, in the format 'RR.ww.mm', representing this ECVersion.\r\n * @note The default is to pad with zeroes.\r\n * @param padZeroes If true, the returned string will strictly follow `RR.ww.mm` and add leading zeroes if necessary.\r\n */\r\n public toString(padZeroes: boolean = true): string {\r\n if (!padZeroes)\r\n return `${this.read}.${this.write}.${this.minor}`;\r\n\r\n const padWithZeroes = (num: number) => {\r\n return (num < 10 ? \"0\" : \"\") + num;\r\n };\r\n\r\n return `${padWithZeroes(this.read)}.${padWithZeroes(this.write)}.${padWithZeroes(this.minor)}`;\r\n }\r\n\r\n /**\r\n * Given a valid version string the\r\n * @param versionString A valid version string of the format, 'RR.ww.mm'.\r\n */\r\n public static fromString(versionString: string): ECVersion {\r\n const [read, write, minor] = versionString.split(\".\");\r\n if (!read)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The read version is missing from version string, ${versionString}`);\r\n\r\n if (!write)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The write version is missing from version string, ${versionString}`);\r\n\r\n if (!minor)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The minor version is missing from version string, ${versionString}`);\r\n\r\n return new ECVersion(+read, +write, +minor);\r\n }\r\n\r\n /**\r\n * Compares two schema versions.\r\n * @param rhs The schema to compare.\r\n * @return A negative number if this schema version is less than the given version, a positive number if greater, and 0 if are equivalent.\r\n */\r\n public compare(rhv: ECVersion): number {\r\n if (this.read !== rhv.read)\r\n return this.read - rhv.read;\r\n\r\n if (this.write !== rhv.write)\r\n return this.write - rhv.write;\r\n\r\n return this.minor - rhv.minor;\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaKey contains a Schemas name and version.\r\n * @beta\r\n */\r\nexport class SchemaKey {\r\n private _name: ECName;\r\n protected _version: ECVersion;\r\n // public checksum: number;\r\n // TODO: need to add a checksum\r\n\r\n constructor(name: string, version: ECVersion);\r\n constructor(name: string, readVersion?: number, writeVersion?: number, minorVersion?: number);\r\n constructor(name: string, readOrVersion?: number | ECVersion, writeVersion?: number, minorVersion?: number) {\r\n this._name = new ECName(name);\r\n if (readOrVersion !== undefined && typeof (readOrVersion) !== \"number\")\r\n this._version = readOrVersion;\r\n else\r\n this._version = new ECVersion(readOrVersion, writeVersion, minorVersion);\r\n }\r\n\r\n public get version() { return this._version; }\r\n public get name() { return this._name.name; }\r\n public get readVersion() { return this.version.read; }\r\n public get writeVersion() { return this.version.write; }\r\n public get minorVersion() { return this.version.minor; }\r\n\r\n /**\r\n * Creates a string, in the format 'RR.ww.mm', representing this SchemaKey.\r\n * @note The default is to pad the full name with zeroes.\r\n * @param padZeroes If true, the returned string will strictly follow `Name.RR.ww.mm` and add leading zeroes if necessary.\r\n */\r\n public toString(padZeroes: boolean = true) { return `${this.name}.${this.version.toString(padZeroes)}`; }\r\n\r\n public static parseString(fullName: string) {\r\n const keyPieces = fullName.split(\".\");\r\n if (keyPieces.length !== 4)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName);\r\n\r\n const schemaName = keyPieces[0];\r\n const readVer = Number(keyPieces[1]);\r\n const writeVer = Number(keyPieces[2]);\r\n const minorVer = Number(keyPieces[3]);\r\n return new SchemaKey(schemaName, new ECVersion(readVer, writeVer, minorVer));\r\n }\r\n\r\n /**\r\n * Compares two schema names, case-insensitive.\r\n * @return True if they match; otherwise, false.\r\n */\r\n public compareByName(rhs: SchemaKey | string | undefined): boolean {\r\n if (undefined === rhs)\r\n return false;\r\n\r\n if (typeof (rhs) === \"string\")\r\n return rhs.toLowerCase() === this.name.toLowerCase();\r\n\r\n return rhs.name.toLowerCase() === this.name.toLowerCase();\r\n }\r\n\r\n /**\r\n * Compares two schema versions.\r\n * @param rhs The schema to compare.\r\n * @return A negative number if this schema version is less than the given version, a positive number if greater, and 0 if are equivalent.\r\n */\r\n public compareByVersion(rhs: SchemaKey): number {\r\n return this.version.compare(rhs.version);\r\n }\r\n\r\n /**\r\n *\r\n * @param rhs The SchemaKey to compare with\r\n * @param matchType The match type to use for comparison.\r\n */\r\n public matches(rhs: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Identical): boolean {\r\n switch (matchType) {\r\n case SchemaMatchType.Identical:\r\n // TODO: if (this.checksum && rhs.checksum)\r\n // TODO: return this.checksum === rhs.checksum;\r\n return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&\r\n this.writeVersion === rhs.writeVersion && this.minorVersion === rhs.minorVersion;\r\n case SchemaMatchType.Exact:\r\n return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&\r\n this.writeVersion === rhs.writeVersion && this.minorVersion === rhs.minorVersion;\r\n case SchemaMatchType.LatestReadCompatible:\r\n if (!this.compareByName(rhs.name))\r\n return false;\r\n\r\n if (rhs.readVersion !== this.readVersion)\r\n return false;\r\n\r\n if (this.writeVersion === rhs.writeVersion)\r\n return this.minorVersion >= rhs.minorVersion;\r\n\r\n return this.writeVersion > rhs.writeVersion;\r\n case SchemaMatchType.LatestWriteCompatible:\r\n return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&\r\n this.writeVersion === rhs.writeVersion && this.minorVersion >= rhs.minorVersion;\r\n case SchemaMatchType.Latest:\r\n return this.compareByName(rhs.name);\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes a SchemaKeyProps JSON object into a SchemaKey object.\r\n * @param props SchemaKeyProps\r\n * @returns A SchemaKey object.\r\n */\r\n public static fromJSON(props: SchemaKeyProps): SchemaKey {\r\n return new SchemaKey(props.name, props.read, props.write, props.minor);\r\n }\r\n\r\n /**\r\n * Save this SchemaKey's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): SchemaKeyProps {\r\n return {\r\n name: this.name,\r\n read: this.readVersion,\r\n write: this.writeVersion,\r\n minor: this.minorVersion,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaItemKey contains a SchemaItem's name and SchemaKey.\r\n * @beta\r\n */\r\nexport class SchemaItemKey {\r\n private _name: ECName;\r\n protected _schemaKey: SchemaKey;\r\n\r\n constructor(name: string, schema: SchemaKey) {\r\n this._name = new ECName(name);\r\n this._schemaKey = schema;\r\n }\r\n\r\n public get schemaKey() { return this._schemaKey; }\r\n public get name() { return this._name.name; }\r\n\r\n public get schemaName() { return this.schemaKey.name; }\r\n\r\n /** Returns the name in the format, {schemaName}.{name}. */\r\n public get fullName() { return `${this.schemaName}.${this.name}`; }\r\n\r\n /**\r\n * Checks whether this SchemaItemKey matches the one provided.\r\n * @param rhs The SchemaItemKey to compare to this.\r\n */\r\n // TODO: Need to add a match type\r\n public matches(rhs: SchemaItemKey): boolean {\r\n if (rhs.name !== this.name)\r\n return false;\r\n\r\n if (!rhs.schemaKey.matches(this.schemaKey, SchemaMatchType.Latest))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n public matchesFullName(name: string): boolean {\r\n const schemaVersion = this.schemaKey.version.toString().replace(/\\./g, \"\\\\.\");\r\n const fullNameRegex = new RegExp(`^${this.schemaName}(\\\\.${schemaVersion})?[.:]${this.name}$`, \"i\");\r\n return fullNameRegex.test(name);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaKey.js","sourceRoot":"","sources":["../../src/SchemaKey.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,SAAS;IAKpB;;;;;;OAMG;IACH,YAAY,IAAa,EAAE,KAAc,EAAE,KAAc;QAXjD,UAAK,GAAW,CAAC,CAAC;QAClB,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CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,2DAA2D;IAC3D,IAAW,QAAQ,KAAK,OAAO,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEnE;;;OAGG;IACH,iCAAiC;IAC1B,OAAO,CAAC,GAAkB;QAC/B,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YACxB,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;YAChE,OAAO,KAAK,CAAC;QAEf,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,eAAe,CAAC,IAAY;QACjC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC9E,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,OAAO,aAAa,SAAS,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;QACpG,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { SchemaKeyProps } from \"./Deserialization/JsonProps\";\r\nimport { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { ECName } from \"./ECName\";\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class ECVersion {\r\n private _read: number = 0;\r\n private _write: number = 0;\r\n private _minor: number = 0;\r\n\r\n /**\r\n * The constructor will throw an ECObjectsError if any of the parameters below are above the threshold.\r\n * @param read Can support up to 999.\r\n * @param write Can support up to 999.\r\n * @param minor Can support up to 9999999.\r\n *\r\n */\r\n constructor(read?: number, write?: number, minor?: number) {\r\n if (undefined !== read)\r\n this._read = read;\r\n if (undefined !== write)\r\n this._write = write;\r\n if (undefined !== minor)\r\n this._minor = minor;\r\n\r\n if (this._read > 999 || this._read < 0 || this._write > 999 || this._write < 0 || this._minor > 9999999 || this._minor < 0)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion);\r\n }\r\n\r\n public get read() { return this._read; }\r\n public get write() { return this._write; }\r\n public get minor() { return this._minor; }\r\n\r\n /**\r\n * Creates a string, in the format 'RR.ww.mm', representing this ECVersion.\r\n * @note The default is to pad with zeroes.\r\n * @param padZeroes If true, the returned string will strictly follow `RR.ww.mm` and add leading zeroes if necessary.\r\n */\r\n public toString(padZeroes: boolean = true): string {\r\n if (!padZeroes)\r\n return `${this.read}.${this.write}.${this.minor}`;\r\n\r\n const padWithZeroes = (num: number) => {\r\n return (num < 10 ? \"0\" : \"\") + num;\r\n };\r\n\r\n return `${padWithZeroes(this.read)}.${padWithZeroes(this.write)}.${padWithZeroes(this.minor)}`;\r\n }\r\n\r\n /**\r\n * Given a valid version string the\r\n * @param versionString A valid version string of the format, 'RR.ww.mm'.\r\n */\r\n public static fromString(versionString: string): ECVersion {\r\n const [read, write, minor] = versionString.split(\".\");\r\n if (!read)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The read version is missing from version string, ${versionString}`);\r\n\r\n if (!write)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The write version is missing from version string, ${versionString}`);\r\n\r\n if (!minor)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECVersion, `The minor version is missing from version string, ${versionString}`);\r\n\r\n return new ECVersion(+read, +write, +minor);\r\n }\r\n\r\n /**\r\n * Compares two schema versions.\r\n * @param rhs The schema to compare.\r\n * @return A negative number if this schema version is less than the given version, a positive number if greater, and 0 if are equivalent.\r\n */\r\n public compare(rhv: ECVersion): number {\r\n if (this.read !== rhv.read)\r\n return this.read - rhv.read;\r\n\r\n if (this.write !== rhv.write)\r\n return this.write - rhv.write;\r\n\r\n return this.minor - rhv.minor;\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaKey contains a Schemas name and version.\r\n * @beta\r\n */\r\nexport class SchemaKey {\r\n private _name: ECName;\r\n protected _version: ECVersion;\r\n // public checksum: number;\r\n // TODO: need to add a checksum\r\n\r\n constructor(name: string, version: ECVersion);\r\n constructor(name: string, readVersion?: number, writeVersion?: number, minorVersion?: number);\r\n constructor(name: string, readOrVersion?: number | ECVersion, writeVersion?: number, minorVersion?: number) {\r\n this._name = new ECName(name);\r\n if (readOrVersion !== undefined && typeof (readOrVersion) !== \"number\")\r\n this._version = readOrVersion;\r\n else\r\n this._version = new ECVersion(readOrVersion, writeVersion, minorVersion);\r\n }\r\n\r\n public get version() { return this._version; }\r\n public get name() { return this._name.name; }\r\n public get readVersion() { return this.version.read; }\r\n public get writeVersion() { return this.version.write; }\r\n public get minorVersion() { return this.version.minor; }\r\n\r\n /**\r\n * Creates a string, in the format 'RR.ww.mm', representing this SchemaKey.\r\n * @note The default is to pad the full name with zeroes.\r\n * @param padZeroes If true, the returned string will strictly follow `Name.RR.ww.mm` and add leading zeroes if necessary.\r\n */\r\n public toString(padZeroes: boolean = true) { return `${this.name}.${this.version.toString(padZeroes)}`; }\r\n\r\n public static parseString(fullName: string) {\r\n const keyPieces = fullName.split(\".\");\r\n if (keyPieces.length !== 4)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidECName);\r\n\r\n const schemaName = keyPieces[0];\r\n const readVer = Number(keyPieces[1]);\r\n const writeVer = Number(keyPieces[2]);\r\n const minorVer = Number(keyPieces[3]);\r\n return new SchemaKey(schemaName, new ECVersion(readVer, writeVer, minorVer));\r\n }\r\n\r\n /**\r\n * Compares two schema names, case-insensitive.\r\n * @return True if they match; otherwise, false.\r\n */\r\n public compareByName(rhs: SchemaKey | string | undefined): boolean {\r\n if (undefined === rhs)\r\n return false;\r\n\r\n if (typeof (rhs) === \"string\")\r\n return rhs.toLowerCase() === this.name.toLowerCase();\r\n\r\n return rhs.name.toLowerCase() === this.name.toLowerCase();\r\n }\r\n\r\n /**\r\n * Compares two schema versions.\r\n * @param rhs The schema to compare.\r\n * @return A negative number if this schema version is less than the given version, a positive number if greater, and 0 if are equivalent.\r\n */\r\n public compareByVersion(rhs: SchemaKey): number {\r\n return this.version.compare(rhs.version);\r\n }\r\n\r\n /**\r\n *\r\n * @param rhs The SchemaKey to compare with\r\n * @param matchType The match type to use for comparison.\r\n */\r\n public matches(rhs: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Exact): boolean {\r\n switch (matchType) {\r\n case SchemaMatchType.Identical:\r\n case SchemaMatchType.Exact:\r\n return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&\r\n this.writeVersion === rhs.writeVersion && this.minorVersion === rhs.minorVersion;\r\n case SchemaMatchType.LatestReadCompatible:\r\n if (!this.compareByName(rhs.name))\r\n return false;\r\n\r\n if (rhs.readVersion !== this.readVersion)\r\n return false;\r\n\r\n if (this.writeVersion === rhs.writeVersion)\r\n return this.minorVersion >= rhs.minorVersion;\r\n\r\n return this.writeVersion > rhs.writeVersion;\r\n case SchemaMatchType.LatestWriteCompatible:\r\n return this.compareByName(rhs.name) && this.readVersion === rhs.readVersion &&\r\n this.writeVersion === rhs.writeVersion && this.minorVersion >= rhs.minorVersion;\r\n case SchemaMatchType.Latest:\r\n return this.compareByName(rhs.name);\r\n default:\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Deserializes a SchemaKeyProps JSON object into a SchemaKey object.\r\n * @param props SchemaKeyProps\r\n * @returns A SchemaKey object.\r\n */\r\n public static fromJSON(props: SchemaKeyProps): SchemaKey {\r\n return new SchemaKey(props.name, props.read, props.write, props.minor);\r\n }\r\n\r\n /**\r\n * Save this SchemaKey's properties to an object for serializing to JSON.\r\n */\r\n public toJSON(): SchemaKeyProps {\r\n return {\r\n name: this.name,\r\n read: this.readVersion,\r\n write: this.writeVersion,\r\n minor: this.minorVersion,\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaItemKey contains a SchemaItem's name and SchemaKey.\r\n * @beta\r\n */\r\nexport class SchemaItemKey {\r\n private _name: ECName;\r\n protected _schemaKey: SchemaKey;\r\n\r\n constructor(name: string, schema: SchemaKey) {\r\n this._name = new ECName(name);\r\n this._schemaKey = schema;\r\n }\r\n\r\n public get schemaKey() { return this._schemaKey; }\r\n public get name() { return this._name.name; }\r\n\r\n public get schemaName() { return this.schemaKey.name; }\r\n\r\n /** Returns the name in the format, {schemaName}.{name}. */\r\n public get fullName() { return `${this.schemaName}.${this.name}`; }\r\n\r\n /**\r\n * Checks whether this SchemaItemKey matches the one provided.\r\n * @param rhs The SchemaItemKey to compare to this.\r\n */\r\n // TODO: Need to add a match type\r\n public matches(rhs: SchemaItemKey): boolean {\r\n if (rhs.name !== this.name)\r\n return false;\r\n\r\n if (!rhs.schemaKey.matches(this.schemaKey, SchemaMatchType.Latest))\r\n return false;\r\n\r\n return true;\r\n }\r\n\r\n public matchesFullName(name: string): boolean {\r\n const schemaVersion = this.schemaKey.version.toString().replace(/\\./g, \"\\\\.\");\r\n const fullNameRegex = new RegExp(`^${this.schemaName}(\\\\.${schemaVersion})?[.:]${this.name}$`, \"i\");\r\n return fullNameRegex.test(name);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/UnitConversion/Graph.ts"],"names":[],"mappings":"AA8CA,gBAAgB;AAChB,qBAAa,KAAK,CAAC,CAAC;IAClB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAc;;IASxB,QAAQ,UAAW,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../../../src/UnitConversion/Graph.ts"],"names":[],"mappings":"AA8CA,gBAAgB;AAChB,qBAAa,KAAK,CAAC,CAAC;IAClB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,SAAS,CAAc;;IASxB,QAAQ,UAAW,MAAM,KAAG,KAAK,CAAC,CAAC,CAAC,CAGzC;IAEK,KAAK,eAEV;IAEK,SAAS,eAEd;IAEK,KAAK,iBAEV;IAEK,OAAO,YAAa,MAAM,aAAa,CAAC,UAQ7C;IAEK,IAAI,YAAa,MAAM,OAE5B;IAEK,OAAO,YAAa,MAAM,aAE/B;IAEK,SAAS,eAEd;IAEK,KAAK;WAnFP,MAAM;WACN,MAAM;QAoFT;IAEK,OAAO,MAAO,MAAM,KAAK,MAAM,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,UAkBjE;IAEK,IAAI,MAAO,MAAM,KAAK,MAAM;kBAjGP,MAAM;MAoGhC;IAEK,QAAQ,MAAO,MAAM;WA5FrB,MAAM;WACN,MAAM;QA+FX;CACH"}
|
|
@@ -52,12 +52,7 @@ export declare class SchemaUnitProvider implements UnitsProvider {
|
|
|
52
52
|
* @returns The UnitConversionProps interface from the @itwin/core-quantity package.
|
|
53
53
|
*/
|
|
54
54
|
getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps>;
|
|
55
|
-
|
|
56
|
-
* Find unit in a schema that has unitName.
|
|
57
|
-
* @param unitName Full name of unit.
|
|
58
|
-
* @returns Unit whose full name matches unitName.
|
|
59
|
-
*/
|
|
60
|
-
private findECUnitByName;
|
|
55
|
+
private checkUnitPropsForConversion;
|
|
61
56
|
/**
|
|
62
57
|
* Gets the @itwin/core UnitProps for the given Unit.
|
|
63
58
|
* @param unit The Unit to convert.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaUnitProvider.d.ts","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
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;IAmD5E;;;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;IA8BpC;;;OAGG;YACW,yBAAyB;CAsBxC"}
|