@itwin/ecschema-metadata 4.9.0-dev.9 → 4.10.0-dev.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sDAA6D;AAC7D,8DAA2D;AAE3D,oFAAiF;AAEjF,4CAA+D;AAE/D,4CAAmE;AACnE,sCAAmC;AACnC,mCAA+C;AAC/C,yCAAsC;AACtC,uDAAkI;AAClI,iEAA8D;AAC9D,+CAA4C;AAC5C,+CAA4C;AAC5C,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAkD;AAClD,mCAAgC;AAChC,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,6CAA0C;AAC1C,iCAA8B;AAC9B,6CAA0C;AAE1C,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E;;GAEG;AACH,MAAa,MAAM;IA+BjB,gBAAgB;IAChB,YAAY,OAAsB,EAAE,SAA8B,EAAE,KAAc,EAAE,OAAgB,EAAE,QAAiB,EAAE,QAAiB;QACxI,IAAI,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAS,CAAC,SAAS,EAAE,IAAI,qBAAS,CAAC,OAAiB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACjJ,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAC;QAE5C,IAAI,KAAK,KAAK,SAAS,IAAI,eAAM,CAAC,QAAQ,CAAC,KAAK,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AED;;;OAGG;IACO,cAAc,CAAC,WAAmB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;CACF;AAxoBD,wBAwoBC;AAED;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAsCjD;AAtCD,sCAsCC","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/**\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}\r\n"]}
1
+ {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../../src/Metadata/Schema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,sDAA6D;AAC7D,8DAA2D;AAE3D,oFAAiF;AAEjF,4CAA+D;AAE/D,4CAAmE;AACnE,sCAAmC;AACnC,mCAA+C;AAC/C,yCAAsC;AACtC,uDAAkI;AAClI,iEAA8D;AAC9D,+CAA4C;AAC5C,+CAA4C;AAC5C,qCAAkC;AAClC,iDAA8C;AAC9C,qDAAkD;AAClD,mCAAgC;AAChC,6CAA0C;AAC1C,yDAAsD;AACtD,2DAAwD;AACxD,6CAA0C;AAC1C,iCAA8B;AAC9B,6CAA0C;AAE1C,MAAM,iBAAiB,GAAG,qDAAqD,CAAC;AAChF,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E;;GAEG;AACH,MAAa,MAAM;IA+BjB,gBAAgB;IAChB,YAAY,OAAsB,EAAE,SAA8B,EAAE,KAAc,EAAE,OAAgB,EAAE,QAAiB,EAAE,QAAiB;QACxI,IAAI,CAAC,UAAU,GAAG,CAAC,OAAO,CAAC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,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,MAAW;QAChC,MAAM,MAAM,GAAG,MAAgB,CAAC;QAEhC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC;IAChG,CAAC;IAED;;;OAGG;IACO,eAAe,CAAC,YAAoB;QAC5C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,WAAmB;QAC1C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,KAAa;QAC9B,IAAI,CAAC,eAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,0BAAc,CAAC,2BAAe,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;QACpG,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AAnpBD,wBAmpBC;AAED;;;;;GAKG;AACH,MAAsB,aAAc,SAAQ,MAAM;CAuCjD;AAvCD,sCAuCC","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 +1 @@
1
- {"version":3,"file":"UnitConversion.d.ts","sourceRoot":"","sources":["../../../src/UnitConversion/UnitConversion.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC;;;GAGG;AACH,qBAAa,cAAc;aACG,MAAM,EAAE,MAAM;aAAwB,MAAM,EAAE,MAAM;gBAApD,MAAM,GAAE,MAAY,EAAkB,MAAM,GAAE,MAAY;IAEtF;;;;OAIG;IACI,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACI,OAAO,IAAI,cAAc;IAKhC;;;;OAIG;IACI,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,cAAc;IAO1D;;;OAGG;IACI,QAAQ,CAAC,UAAU,EAAE,cAAc,GAAG,cAAc;IAO3D;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAY3C,gBAAgB;IAChB,OAAc,QAAQ,iBAAwB;IAE9C;;;OAGG;WACW,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,cAAc;CAM1D"}
1
+ {"version":3,"file":"UnitConversion.d.ts","sourceRoot":"","sources":["../../../src/UnitConversion/UnitConversion.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC;;;GAGG;AACH,qBAAa,cAAc;aACG,MAAM,EAAE,MAAM;aAAwB,MAAM,EAAE,MAAM;gBAApD,MAAM,GAAE,MAAY,EAAkB,MAAM,GAAE,MAAY;IAEtF;;;;OAIG;IACI,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACI,OAAO,IAAI,cAAc;IAKhC;;;;OAIG;IACI,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,cAAc;IAO1D;;;OAGG;IACI,QAAQ,CAAC,UAAU,EAAE,cAAc,GAAG,cAAc;IAO3D;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAY3C,gBAAgB;IAChB,OAAc,QAAQ,iBAAwB;IAE9C;;;OAGG;WACW,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,cAAc;CAM1D"}
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnitConversion = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const almostEqual = require("almost-equal");
9
4
  const ECObjects_1 = require("../ECObjects");
5
+ const core_quantity_1 = require("@itwin/core-quantity");
10
6
  /**
11
7
  * Class used for storing calculated conversion between two Units [[UnitConverter.calculateConversion]] and converting values from one Unit to another [[UnitConverter.evaluate]]
12
8
  * @internal
@@ -45,7 +41,7 @@ class UnitConversion {
45
41
  * @internal
46
42
  */
47
43
  multiply(conversion) {
48
- if (almostEqual(conversion.offset, 0.0) && almostEqual(this.offset, 0.0))
44
+ if ((0, core_quantity_1.almostEqual)(conversion.offset, 0.0) && (0, core_quantity_1.almostEqual)(this.offset, 0.0))
49
45
  return new UnitConversion(this.factor * conversion.factor, 0.0);
50
46
  throw new Error("Cannot multiply two maps with non-zero offsets");
51
47
  }
@@ -54,11 +50,11 @@ class UnitConversion {
54
50
  * @internal
55
51
  */
56
52
  raise(power) {
57
- if (almostEqual(power, 1.0))
53
+ if ((0, core_quantity_1.almostEqual)(power, 1.0))
58
54
  return new UnitConversion(this.factor, this.offset);
59
- else if (almostEqual(power, 0.0))
55
+ else if ((0, core_quantity_1.almostEqual)(power, 0.0))
60
56
  return new UnitConversion(1.0, 0.0);
61
- if (almostEqual(this.offset, 0.0))
57
+ if ((0, core_quantity_1.almostEqual)(this.offset, 0.0))
62
58
  return new UnitConversion(this.factor ** power, 0.0);
63
59
  throw new Error("Cannot raise map with non-zero offset");
64
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UnitConversion.js","sourceRoot":"","sources":["../../../src/UnitConversion/UnitConversion.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,4CAA4C;AAG5C,4CAA8C;AAE9C;;;GAGG;AACH,MAAa,cAAc;IACzB,YAA4B,SAAiB,GAAG,EAAkB,SAAiB,GAAG;QAA1D,WAAM,GAAN,MAAM,CAAc;QAAkB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE1F;;;;OAIG;IACI,QAAQ,CAAC,CAAS;QACvB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,OAAO;QACZ,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,OAAO,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,UAA0B;QACvC,OAAO,IAAI,cAAc,CACvB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAC/B,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CACpD,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,UAA0B;QACxC,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;YACtE,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAElE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,KAAa;QACxB,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC;YACzB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aACjD,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC;YAC9B,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAEtC,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;YAC/B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,GAAG,CAAC,CAAC;QAEvD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,IAAI,CAAC,IAAqB;QACtC,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,IAAI;YAC7C,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7E,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;;AAxEH,wCAyEC;AAbC,gBAAgB;AACF,uBAAQ,GAAG,IAAI,cAAc,EAAE,CAAC","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\nimport * as almostEqual from \"almost-equal\";\r\nimport { Constant } from \"../Metadata/Constant\";\r\nimport { Unit } from \"../Metadata/Unit\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\n\r\n/**\r\n * Class used for storing calculated conversion between two Units [[UnitConverter.calculateConversion]] and converting values from one Unit to another [[UnitConverter.evaluate]]\r\n * @internal\r\n */\r\nexport class UnitConversion {\r\n constructor(public readonly factor: number = 1.0, public readonly offset: number = 0.0) {}\r\n\r\n /**\r\n * Converts x using UnitConversion\r\n * @param x Input magnitude to be converted\r\n * @returns Output magnitude after conversion\r\n */\r\n public evaluate(x: number): number {\r\n return this.factor * x + this.offset;\r\n }\r\n\r\n /**\r\n * Used to invert source's UnitConversion so that it can be composed with target's UnitConversion cleanly\r\n * @internal\r\n */\r\n public inverse(): UnitConversion {\r\n const inverseFactor = 1.0 / this.factor;\r\n return new UnitConversion(inverseFactor, -this.offset * inverseFactor);\r\n }\r\n\r\n /**\r\n * Combines two UnitConversions\r\n * Used to combine source's UnitConversion and target's UnitConversion for a final UnitConversion that can be evaluated\r\n * @internal\r\n */\r\n public compose(conversion: UnitConversion): UnitConversion {\r\n return new UnitConversion(\r\n this.factor * conversion.factor,\r\n conversion.factor * this.offset + conversion.offset,\r\n );\r\n }\r\n\r\n /**\r\n * Multiples two UnitConversions together to calculate factor during reducing\r\n * @internal\r\n */\r\n public multiply(conversion: UnitConversion): UnitConversion {\r\n if (almostEqual(conversion.offset, 0.0) && almostEqual(this.offset, 0.0))\r\n return new UnitConversion(this.factor * conversion.factor, 0.0);\r\n\r\n throw new Error(\"Cannot multiply two maps with non-zero offsets\");\r\n }\r\n\r\n /**\r\n * Raise UnitConversion's factor with power exponent to calculate factor during reducing\r\n * @internal\r\n */\r\n public raise(power: number): UnitConversion {\r\n if (almostEqual(power, 1.0))\r\n return new UnitConversion(this.factor, this.offset);\r\n else if (almostEqual(power, 0.0))\r\n return new UnitConversion(1.0, 0.0);\r\n\r\n if (almostEqual(this.offset, 0.0))\r\n return new UnitConversion(this.factor ** power, 0.0);\r\n\r\n throw new Error(\"Cannot raise map with non-zero offset\");\r\n }\r\n\r\n /** @internal */\r\n public static identity = new UnitConversion();\r\n\r\n /**\r\n * Returns UnitConversion with unit's numerator and denominator in factor and unit's offset in offset for reducing\r\n * @internal\r\n */\r\n public static from(unit: Unit | Constant): UnitConversion {\r\n if (unit.schemaItemType === SchemaItemType.Unit)\r\n return new UnitConversion(unit.denominator / unit.numerator, -unit.offset);\r\n\r\n return new UnitConversion(unit.denominator / unit.numerator, 0.0);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"UnitConversion.js","sourceRoot":"","sources":["../../../src/UnitConversion/UnitConversion.ts"],"names":[],"mappings":";;;AAMA,4CAA8C;AAC9C,wDAAmD;AAEnD;;;GAGG;AACH,MAAa,cAAc;IACzB,YAA4B,SAAiB,GAAG,EAAkB,SAAiB,GAAG;QAA1D,WAAM,GAAN,MAAM,CAAc;QAAkB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE1F;;;;OAIG;IACI,QAAQ,CAAC,CAAS;QACvB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,OAAO;QACZ,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,OAAO,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IACzE,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,UAA0B;QACvC,OAAO,IAAI,cAAc,CACvB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAC/B,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CACpD,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,UAA0B;QACxC,IAAI,IAAA,2BAAW,EAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAA,2BAAW,EAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;YACtE,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAElE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,KAAa;QACxB,IAAI,IAAA,2BAAW,EAAC,KAAK,EAAE,GAAG,CAAC;YACzB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aACjD,IAAI,IAAA,2BAAW,EAAC,KAAK,EAAE,GAAG,CAAC;YAC9B,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAEtC,IAAI,IAAA,2BAAW,EAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC;YAC/B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,GAAG,CAAC,CAAC;QAEvD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,IAAI,CAAC,IAAqB;QACtC,IAAI,IAAI,CAAC,cAAc,KAAK,0BAAc,CAAC,IAAI;YAC7C,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7E,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACpE,CAAC;;AAxEH,wCAyEC;AAbC,gBAAgB;AACF,uBAAQ,GAAG,IAAI,cAAc,EAAE,CAAC","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\nimport { Constant } from \"../Metadata/Constant\";\r\nimport { Unit } from \"../Metadata/Unit\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { almostEqual } from \"@itwin/core-quantity\";\r\n\r\n/**\r\n * Class used for storing calculated conversion between two Units [[UnitConverter.calculateConversion]] and converting values from one Unit to another [[UnitConverter.evaluate]]\r\n * @internal\r\n */\r\nexport class UnitConversion {\r\n constructor(public readonly factor: number = 1.0, public readonly offset: number = 0.0) {}\r\n\r\n /**\r\n * Converts x using UnitConversion\r\n * @param x Input magnitude to be converted\r\n * @returns Output magnitude after conversion\r\n */\r\n public evaluate(x: number): number {\r\n return this.factor * x + this.offset;\r\n }\r\n\r\n /**\r\n * Used to invert source's UnitConversion so that it can be composed with target's UnitConversion cleanly\r\n * @internal\r\n */\r\n public inverse(): UnitConversion {\r\n const inverseFactor = 1.0 / this.factor;\r\n return new UnitConversion(inverseFactor, -this.offset * inverseFactor);\r\n }\r\n\r\n /**\r\n * Combines two UnitConversions\r\n * Used to combine source's UnitConversion and target's UnitConversion for a final UnitConversion that can be evaluated\r\n * @internal\r\n */\r\n public compose(conversion: UnitConversion): UnitConversion {\r\n return new UnitConversion(\r\n this.factor * conversion.factor,\r\n conversion.factor * this.offset + conversion.offset,\r\n );\r\n }\r\n\r\n /**\r\n * Multiples two UnitConversions together to calculate factor during reducing\r\n * @internal\r\n */\r\n public multiply(conversion: UnitConversion): UnitConversion {\r\n if (almostEqual(conversion.offset, 0.0) && almostEqual(this.offset, 0.0))\r\n return new UnitConversion(this.factor * conversion.factor, 0.0);\r\n\r\n throw new Error(\"Cannot multiply two maps with non-zero offsets\");\r\n }\r\n\r\n /**\r\n * Raise UnitConversion's factor with power exponent to calculate factor during reducing\r\n * @internal\r\n */\r\n public raise(power: number): UnitConversion {\r\n if (almostEqual(power, 1.0))\r\n return new UnitConversion(this.factor, this.offset);\r\n else if (almostEqual(power, 0.0))\r\n return new UnitConversion(1.0, 0.0);\r\n\r\n if (almostEqual(this.offset, 0.0))\r\n return new UnitConversion(this.factor ** power, 0.0);\r\n\r\n throw new Error(\"Cannot raise map with non-zero offset\");\r\n }\r\n\r\n /** @internal */\r\n public static identity = new UnitConversion();\r\n\r\n /**\r\n * Returns UnitConversion with unit's numerator and denominator in factor and unit's offset in offset for reducing\r\n * @internal\r\n */\r\n public static from(unit: Unit | Constant): UnitConversion {\r\n if (unit.schemaItemType === SchemaItemType.Unit)\r\n return new UnitConversion(unit.denominator / unit.numerator, -unit.offset);\r\n\r\n return new UnitConversion(unit.denominator / unit.numerator, 0.0);\r\n }\r\n}\r\n"]}
@@ -132,7 +132,7 @@ export var XmlSerializationUtils;
132
132
  propertyElement.textContent = propertyValue.toString();
133
133
  return;
134
134
  case PrimitiveType.DateTime:
135
- propertyElement.textContent = propertyValue.getTime().toString();
135
+ propertyElement.textContent = new Date(propertyValue).getTime().toString();
136
136
  return;
137
137
  case PrimitiveType.Point2d:
138
138
  propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;
@@ -1 +1 @@
1
- {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/D;;;GAGG;AACH,MAAM,KAAW,qBAAqB,CA4KrC;AA5KD,WAAiB,qBAAqB;IACpC;;;;;;;OAOG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;Q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AC;QAE7B,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpI,IAAI,CAAC,eAAe;YAClB,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,oBAAoB,EAAE,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAE1M,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EA5KgB,qBAAqB,KAArB,qBAAqB,QA4KrC","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\r\nimport { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\n\r\n/**\r\n * Namespace holding utility functions for serializing EC types to the EC XML format.\r\n * @internal\r\n */\r\nexport namespace XmlSerializationUtils {\r\n /**\r\n * Serializes a CustomAttribute instance to the EC XML format.\r\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\r\n * @param customAttribute The CustomAttribute instance to serialize.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @param schema The Schema object being serialized.\r\n * @beta\r\n */\r\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\r\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\r\n if (!caClass)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\r\n\r\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\r\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\r\n\r\n if (nameAndNamespace[1])\r\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\r\n\r\n if (!caClass.properties)\r\n return caElement;\r\n\r\n for (const property of caClass.properties)\r\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\r\n\r\n return caElement;\r\n }\r\n\r\n /**\r\n * Serializes an EC Property instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param instance The Property instance.\r\n * @param instanceElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\r\n const propertyValue = instance[propertyClass.name];\r\n if (propertyValue === undefined)\r\n return;\r\n\r\n const propertyElement = schemaDoc.createElement(propertyClass.name);\r\n instanceElement.appendChild(propertyElement);\r\n\r\n if (propertyClass.isArray()) {\r\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n } else if (propertyClass.isPrimitive()) {\r\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\r\n } else if (propertyClass.isStruct()) {\r\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC ArrayProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue An array holding the property values.\r\n * @param arrayElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\r\n if (propertyClass.isPrimitive()) {\r\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\r\n for (const value of propertyValue) {\r\n const entryElement = schemaDoc.createElement(typeString);\r\n await writePrimitiveProperty(propertyClass, value, entryElement);\r\n arrayElement.appendChild(entryElement);\r\n }\r\n }\r\n\r\n if (propertyClass.isStruct()) {\r\n for (const value of propertyValue) {\r\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\r\n arrayElement.appendChild(structElement);\r\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC StructProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param structElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\r\n const structClass = propertyClass.structClass;\r\n if (!structClass.properties)\r\n return;\r\n\r\n for (const propertyMetadata of structClass.properties)\r\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\r\n }\r\n\r\n /**\r\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param propertyElement The XML Element that will contain the serialized property instance.\r\n * @beta\r\n */\r\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\r\n let primitiveType: PrimitiveType;\r\n if (propertyClass.isEnumeration()) {\r\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\r\n if (!enumeration)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\r\n\r\n if (enumeration.type === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\r\n\r\n primitiveType = enumeration.type;\r\n } else\r\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\r\n\r\n switch (primitiveType) {\r\n case PrimitiveType.String:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n case PrimitiveType.Boolean:\r\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\r\n return;\r\n case PrimitiveType.Integer:\r\n case PrimitiveType.Double:\r\n case PrimitiveType.Long:\r\n propertyElement.textContent = propertyValue.toString();\r\n return;\r\n case PrimitiveType.DateTime:\r\n propertyElement.textContent = (propertyValue as Date).getTime().toString();\r\n return;\r\n case PrimitiveType.Point2d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\r\n return;\r\n case PrimitiveType.Point3d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\r\n return;\r\n case PrimitiveType.IGeometry:\r\n case PrimitiveType.Binary:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n default:\r\n throw new ECObjectsError(ECObjectsStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\r\n }\r\n }\r\n\r\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\r\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\r\n return typeName;\r\n\r\n // Alias is required in Spec. It could be undefined (technically), so\r\n // throw until fixed.\r\n if (typeSchema.alias === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\r\n\r\n return `${typeSchema.alias}:${typeName}`;\r\n }\r\n\r\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\r\n const nameParts = caName.split(\".\");\r\n if (nameParts.length === 1)\r\n return [caName, undefined];\r\n\r\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\r\n if (!attributeSchema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\r\n\r\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"XmlSerializationUtils.js","sourceRoot":"","sources":["../../../src/Deserialization/XmlSerializationUtils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/D;;;GAGG;AACH,MAAM,KAAW,qBAAqB,CA4KrC;AA5KD,WAAiB,qBAAqB;IACpC;;;;;;;OAOG;IACI,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,eAAgC,EAAE,SAAmB,EAAE,MAAc;QAChI,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAyB,CAAC;QAC1E,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,cAAc,CAAC,eAAe,CAAC,aAAa,EAAE,cAAc,QAAQ,qDAAqD,CAAC,CAAC;QAEvI,MAAM,gBAAgB,GAAG,MAAM,+BAA+B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjF,MAAM,SAAS,GAAG,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAE/D,IAAI,gBAAgB,CAAC,CAAC,CAAC;YACrB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvD,IAAI,CAAC,OAAO,CAAC,UAAU;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E,wDAAwD,MAAM,oCAAoC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAE1M,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC,EA5KgB,qBAAqB,KAArB,qBAAqB,QA4KrC","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\r\nimport { PrimitiveType, primitiveTypeToString } from \"../ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"../Exception\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ArrayProperty, EnumerationProperty, PrimitiveOrEnumPropertyBase, PrimitiveProperty, Property, StructProperty } from \"../Metadata/Property\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\n\r\n/**\r\n * Namespace holding utility functions for serializing EC types to the EC XML format.\r\n * @internal\r\n */\r\nexport namespace XmlSerializationUtils {\r\n /**\r\n * Serializes a CustomAttribute instance to the EC XML format.\r\n * @param fullName The full name of the CustomAttribute (qualified by schema name).\r\n * @param customAttribute The CustomAttribute instance to serialize.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @param schema The Schema object being serialized.\r\n * @beta\r\n */\r\n export async function writeCustomAttribute(fullName: string, customAttribute: CustomAttribute, schemaDoc: Document, schema: Schema): Promise<Element> {\r\n const caClass = await schema.lookupItem(fullName) as CustomAttributeClass;\r\n if (!caClass)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The class '${fullName}' could not be found in the current schema context.`);\r\n\r\n const nameAndNamespace = await resolveCustomAttributeNamespace(fullName, schema);\r\n const caElement = schemaDoc.createElement(nameAndNamespace[0]);\r\n\r\n if (nameAndNamespace[1])\r\n caElement.setAttribute(\"xmlns\", nameAndNamespace[1]);\r\n\r\n if (!caClass.properties)\r\n return caElement;\r\n\r\n for (const property of caClass.properties)\r\n await writeInstanceProperty(property, customAttribute, caElement, schemaDoc);\r\n\r\n return caElement;\r\n }\r\n\r\n /**\r\n * Serializes an EC Property instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param instance The Property instance.\r\n * @param instanceElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeInstanceProperty(propertyClass: Property, instance: any, instanceElement: Element, schemaDoc: Document): Promise<void> {\r\n const propertyValue = instance[propertyClass.name];\r\n if (propertyValue === undefined)\r\n return;\r\n\r\n const propertyElement = schemaDoc.createElement(propertyClass.name);\r\n instanceElement.appendChild(propertyElement);\r\n\r\n if (propertyClass.isArray()) {\r\n await writeArrayProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n } else if (propertyClass.isPrimitive()) {\r\n await writePrimitiveProperty(propertyClass, propertyValue, propertyElement);\r\n } else if (propertyClass.isStruct()) {\r\n await writeStructProperty(propertyClass, propertyValue, propertyElement, schemaDoc);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC ArrayProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue An array holding the property values.\r\n * @param arrayElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeArrayProperty(propertyClass: ArrayProperty, propertyValue: any[], arrayElement: Element, schemaDoc: Document): Promise<void> {\r\n if (propertyClass.isPrimitive()) {\r\n const typeString = primitiveTypeToString(propertyClass.primitiveType);\r\n for (const value of propertyValue) {\r\n const entryElement = schemaDoc.createElement(typeString);\r\n await writePrimitiveProperty(propertyClass, value, entryElement);\r\n arrayElement.appendChild(entryElement);\r\n }\r\n }\r\n\r\n if (propertyClass.isStruct()) {\r\n for (const value of propertyValue) {\r\n const structElement = schemaDoc.createElement(propertyClass.structClass.name);\r\n arrayElement.appendChild(structElement);\r\n await writeStructProperty(propertyClass, value, structElement, schemaDoc);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes an EC StructProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param structElement The XML Element that will contain the serialized property instance.\r\n * @param schemaDoc The Xml Document object holding the serialized EC Schema.\r\n * @beta\r\n */\r\n export async function writeStructProperty(propertyClass: StructProperty, propertyValue: any, structElement: Element, schemaDoc: Document): Promise<void> {\r\n const structClass = propertyClass.structClass;\r\n if (!structClass.properties)\r\n return;\r\n\r\n for (const propertyMetadata of structClass.properties)\r\n await writeInstanceProperty(propertyMetadata, propertyValue, structElement, schemaDoc);\r\n }\r\n\r\n /**\r\n * Serializes an EC PrimitiveProperty instance to the EC XML format.\r\n * @param propertyClass The Property metadata object.\r\n * @param propertyValue The struct object holding the property values.\r\n * @param propertyElement The XML Element that will contain the serialized property instance.\r\n * @beta\r\n */\r\n export async function writePrimitiveProperty(propertyClass: PrimitiveOrEnumPropertyBase, propertyValue: any, propertyElement: Element): Promise<void> {\r\n let primitiveType: PrimitiveType;\r\n if (propertyClass.isEnumeration()) {\r\n const enumeration = await (propertyClass as EnumerationProperty).enumeration;\r\n if (!enumeration)\r\n throw new ECObjectsError(ECObjectsStatus.ClassNotFound, `The enumeration on property class '${propertyClass.fullName}' could not be found in the current schema context.`);\r\n\r\n if (enumeration.type === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidType, `The enumeration on property class '${propertyClass.fullName}' has an invalid primitive type.`);\r\n\r\n primitiveType = enumeration.type;\r\n } else\r\n primitiveType = (propertyClass as PrimitiveProperty).primitiveType;\r\n\r\n switch (primitiveType) {\r\n case PrimitiveType.String:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n case PrimitiveType.Boolean:\r\n propertyElement.textContent = (propertyValue as boolean) ? \"True\" : \"False\";\r\n return;\r\n case PrimitiveType.Integer:\r\n case PrimitiveType.Double:\r\n case PrimitiveType.Long:\r\n propertyElement.textContent = propertyValue.toString();\r\n return;\r\n case PrimitiveType.DateTime:\r\n propertyElement.textContent = new Date(propertyValue).getTime().toString();\r\n return;\r\n case PrimitiveType.Point2d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y}`;\r\n return;\r\n case PrimitiveType.Point3d:\r\n propertyElement.textContent = `${propertyValue.x},${propertyValue.y},${propertyValue.z}`;\r\n return;\r\n case PrimitiveType.IGeometry:\r\n case PrimitiveType.Binary:\r\n propertyElement.textContent = propertyValue;\r\n return;\r\n default:\r\n throw new ECObjectsError(ECObjectsStatus.InvalidPrimitiveType, `The property '${propertyClass.fullName}' has an invalid primitive type.`);\r\n }\r\n }\r\n\r\n export function createXmlTypedName(currentSchema: Schema, typeSchema: Schema, typeName: string) {\r\n if (currentSchema.schemaKey.matches(typeSchema.schemaKey))\r\n return typeName;\r\n\r\n // Alias is required in Spec. It could be undefined (technically), so\r\n // throw until fixed.\r\n if (typeSchema.alias === undefined)\r\n throw new ECObjectsError(ECObjectsStatus.InvalidSchemaAlias, `The schema '${typeSchema.name}' has an invalid alias.`);\r\n\r\n return `${typeSchema.alias}:${typeName}`;\r\n }\r\n\r\n async function resolveCustomAttributeNamespace(caName: string, schema: Schema): Promise<[string, string | undefined]> {\r\n const nameParts = caName.split(\".\");\r\n if (nameParts.length === 1)\r\n return [caName, undefined];\r\n\r\n const attributeSchema = nameParts[0].toUpperCase() === schema.name.toUpperCase() ? schema : await schema.getReference(nameParts[0]);\r\n if (!attributeSchema)\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to resolve the namespace for CustomAttribute '${caName}' because the referenced schema '${nameParts[0]}' could not be located.`);\r\n\r\n return [nameParts[1], `${nameParts[0]}.${attributeSchema.schemaKey.version.toString()}`];\r\n }\r\n}\r\n"]}
@@ -79,6 +79,10 @@ export declare abstract class Property implements CustomAttributeContainerProps
79
79
  * @internal Used in schema editing.
80
80
  */
81
81
  protected setCategory(category: LazyLoadedPropertyCategory): void;
82
+ /**
83
+ * @internal Used in schema editing.
84
+ */
85
+ protected setKindOfQuantity(kindOfQuantity: LazyLoadedKindOfQuantity): void;
82
86
  /**
83
87
  * Retrieve all custom attributes in the current property and its base
84
88
  * This is the async version of getCustomAttributesSync()
@@ -1 +1 @@
1
- {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Property.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACe,wBAAwB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,gCAAgC,EACpI,sBAAsB,EAAE,aAAa,EAAE,mBAAmB,EAC3D,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAsB,aAAa,EAAyB,iBAAiB,EAA6B,MAAM,cAAc,CAAC;AAEtI,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACnJ,OAAO,EAAE,YAAY,EAA2C,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAElI,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;GAGG;AACH,8BAAsB,QAAS,YAAW,6BAA6B;IACrE,SAAS,CAAC,KAAK,E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SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;CAGzC;;AAoED,YAAY;AACZ,qBAAa,sBAAuB,SAAQ,2BAAqC;gBACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,GAAE,aAAqC;IAIhG;;OAEG;IACa,MAAM,IAAI,2BAA2B;CAItD;;AAED,YAAY;AACZ,qBAAa,wBAAyB,SAAQ,6BAAuC;gBACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB;CAGxE;;AAED,YAAY;AACZ,qBAAa,mBAAoB,SAAQ,wBAAkC;gBAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;CAG9D;AAED,YAAY;AACZ,MAAM,MAAM,gBAAgB,GAAG,sBAAsB,GAAG,wBAAwB,GAAG,mBAAmB,CAAC;AACvG,YAAY;AACZ,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;AAC9E,YAAY;AACZ,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG,wBAAwB,CAAC;AACpF,YAAY;AACZ,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,mBAAmB,CAAC;AACrE,YAAY;AACZ,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAEjH;;;GAGG;AACH,8BAAsB,eAAgB,SAAQ,QAAQ;aAC3B,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CACpF"}
@@ -185,6 +185,12 @@ export class Property {
185
185
  setCategory(category) {
186
186
  this._category = category;
187
187
  }
188
+ /**
189
+ * @internal Used in schema editing.
190
+ */
191
+ setKindOfQuantity(kindOfQuantity) {
192
+ this._kindOfQuantity = kindOfQuantity;
193
+ }
188
194
  /**
189
195
  * Retrieve all custom attributes in the current property and its base
190
196
  * This is the async version of getCustomAttributesSync()