@itwin/ecschema-metadata 5.2.0-dev.3 → 5.2.0-dev.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +9 -2
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js +58 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +62 -34
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +1 -0
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js +17 -17
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +4 -4
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +7 -24
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +1 -1
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +9 -22
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +2 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +9 -2
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js +54 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +61 -33
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js +1 -0
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js +17 -17
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +4 -4
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js +7 -24
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +9 -22
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +2 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/package.json +6 -6
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js +0 -82
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.js.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.js +0 -78
- package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/esm/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/esm/SchemaFormatsProvider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"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sBAAsB,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\nprotected override async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n for (const mixin of this.mixins) {\n const mixinObj = await mixin;\n const mixinProps = mixinObj.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = await this.getProperties(true);\n if (localProps) {\n for (const property of localProps) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n return cache;\n}\n\n /**\n *\n * @param cache\n * @internal\n */\n protected override buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n });\n }\n\n for (const mixin of this.getMixinsSync()) {\n const mixinProps = mixin.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = this.getPropertiesSync(true);\n if (localProps) {\n Array.from(localProps).forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * Save this EntityClass' properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAqB,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAe,kBAAkB,EAAY,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IACrE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,C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AC1J,IAAI,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QACrC,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,iBAAiB,EAAE,+BAA+B,IAAI,gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAEhJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,WAAW,EAAE,mCAAmC,YAAY,8CAA8C,CAAC,CAAC,CAAE,2DAA2D;IAElN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\nprotected override async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n for (const mixin of this.mixins) {\n const mixinObj = await mixin;\n const mixinProps = mixinObj.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = await this.getProperties(true);\n if (localProps) {\n for (const property of localProps) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n return cache;\n}\n\n /**\n *\n * @param cache\n * @internal\n */\n protected override buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n });\n }\n\n for (const mixin of this.getMixinsSync()) {\n const mixinProps = mixin.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = this.getPropertiesSync(true);\n if (localProps) {\n Array.from(localProps).forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * Save this EntityClass' properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KindOfQuantity.d.ts","sourceRoot":"","sources":["../../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cAAc,GAAG,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,cAAc;aACnK,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;aAC3C,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,sBAAsB,GAAG,SAAS,GAAG,IAAI;aACpF,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;CACvE"}
|
|
@@ -156,32 +156,19 @@ export class KindOfQuantity extends SchemaItem {
|
|
|
156
156
|
fromJSONSync(kindOfQuantityProps) {
|
|
157
157
|
super.fromJSONSync(kindOfQuantityProps);
|
|
158
158
|
this._relativeError = kindOfQuantityProps.relativeError;
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);
|
|
159
|
+
const unitItemKey = this.schema.getSchemaItemKey(kindOfQuantityProps.persistenceUnit);
|
|
160
|
+
this._persistenceUnit = new DelayedPromiseWithProps(unitItemKey, async () => {
|
|
161
|
+
const unitItem = await this.schema.lookupItem(unitItemKey, Unit)
|
|
162
|
+
|| await this.schema.lookupItem(unitItemKey, InvertedUnit);
|
|
163
|
+
if (undefined === unitItem)
|
|
164
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the unit ${kindOfQuantityProps.persistenceUnit}.`);
|
|
165
|
+
return unitItem;
|
|
166
|
+
});
|
|
168
167
|
if (undefined !== kindOfQuantityProps.presentationUnits)
|
|
169
168
|
this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);
|
|
170
169
|
}
|
|
171
170
|
async fromJSON(kindOfQuantityProps) {
|
|
172
|
-
|
|
173
|
-
this._relativeError = kindOfQuantityProps.relativeError;
|
|
174
|
-
const persistenceUnit = await this.schema.lookupItem(kindOfQuantityProps.persistenceUnit);
|
|
175
|
-
if (undefined === persistenceUnit)
|
|
176
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);
|
|
177
|
-
if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))
|
|
178
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);
|
|
179
|
-
if (Unit.isUnit(persistenceUnit))
|
|
180
|
-
this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);
|
|
181
|
-
else
|
|
182
|
-
this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);
|
|
183
|
-
if (undefined !== kindOfQuantityProps.presentationUnits)
|
|
184
|
-
await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);
|
|
171
|
+
this.fromJSONSync(kindOfQuantityProps);
|
|
185
172
|
}
|
|
186
173
|
/**
|
|
187
174
|
* Used for schema editing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KindOfQuantity.js","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,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AC;YAC9B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,cAAc,oBAAoB,CAAC,CAAC;IAClI,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,cAAc;CAMjE","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedFormat, LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\n\n/** A Typescript class representation of a KindOfQuantity.\n * @public @preview\n */\nexport class KindOfQuantity extends SchemaItem {\n public override readonly schemaItemType = KindOfQuantity.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.KindOfQuantity; }\n private _relativeError: number = 1.0;\n private _presentationFormats: Array<LazyLoadedFormat | OverrideFormat> = [];\n private _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n /** The first presentation format in the list of Formats. */\n public get defaultPresentationFormat(): LazyLoadedFormat | OverrideFormat | undefined { return this.presentationFormats[0]; }\n\n /** A list of presentation formats. */\n public get presentationFormats(): Array<LazyLoadedFormat | OverrideFormat> { return this._presentationFormats; }\n\n /** Persistence unit */\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\n\n public get relativeError() { return this._relativeError; }\n\n /**\n *\n * @param format The Format to add to this KindOfQuantity\n * @param isDefault\n * @internal\n */\n protected addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean = false) {\n // TODO: Add some sort of validation?\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\n }\n\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\n * @param parent The Format to override.\n * @param precision The precision override\n * @param unitLabelOverrides The list of unit and label overrides.\n * @internal\n */\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat {\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\n\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\n\n // TODO: Check compatibility of Unit overrides with the persistence unit\n\n return new OverrideFormat(parent, precision, unitLabelOverrides);\n }\n\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = await this.schema.lookupItem(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = await this.schema.lookupItem(unitOverride[0]);\n\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = this.schema.lookupItemSync(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = this.schema.lookupItemSync(unitOverride[0]);\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n /**\n * Save this KindOfQuantity's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): KindOfQuantityProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.relativeError = this.relativeError;\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\n schemaJson.presentationUnits = this.presentationFormats.map((format) => format.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n const persistenceUnit = await this.persistenceUnit;\n if (undefined !== persistenceUnit) {\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\n itemElement.setAttribute(\"persistenceUnit\", unitName);\n }\n\n if (undefined !== this.presentationFormats) {\n const presUnitStrings: string[] = [];\n for(const format of this.presentationFormats) {\n if (!OverrideFormat.isOverrideFormat(format)) {\n const resolvedFormat = await format;\n presUnitStrings.push(XmlSerializationUtils.createXmlTypedName(this.schema, resolvedFormat.schema, format.name));\n continue;\n }\n presUnitStrings.push(format.fullNameXml(this.schema));\n };\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\n }\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\n super.fromJSONSync(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = this.schema.lookupItemSync(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\n }\n\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\n await super.fromJSON(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const persistenceUnit = await this.schema.lookupItem(kindOfQuantityProps.persistenceUnit);\n if (undefined === persistenceUnit)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Unit ${kindOfQuantityProps.persistenceUnit} does not exist.`);\n\n if (!Unit.isUnit(persistenceUnit) && !InvertedUnit.isInvertedUnit(persistenceUnit))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The item ${kindOfQuantityProps.persistenceUnit} is not a Unit or InvertedUnit.`);\n\n if (Unit.isUnit(persistenceUnit))\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n else\n this._persistenceUnit = new DelayedPromiseWithProps(persistenceUnit.key, async () => persistenceUnit);\n\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n await this.processPresentationUnits(kindOfQuantityProps.presentationUnits);\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setRelativeError(relativeError: number): void {\n this._relativeError = relativeError;\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void {\n this._persistenceUnit = value;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns True if the item is a KindOfQuantity, false otherwise.\n */\n public static isKindOfQuantity(item?: SchemaItem): item is KindOfQuantity {\n if (item && item.schemaItemType === SchemaItemType.KindOfQuantity)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns The item cast to KindOfQuantity if it is a KindOfQuantity, undefined otherwise.\n * @internal\n */\n public static assertIsKindOfQuantity(item?: SchemaItem): asserts item is KindOfQuantity {\n if (!this.isKindOfQuantity(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.KindOfQuantity}' (KindOfQuantity)`);\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\n public abstract override addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean): void;\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void;\n public abstract override setRelativeError(relativeError: number): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KindOfQuantity.js","sourceRoot":"","sources":["../../../src/Metadata/KindOfQuantity.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IACnB,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC;IACxE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;IAC7E,cAAc,GAAW,GAAG,CAAC;IAC7B,oBAAoB,GAA6C,EAAE,CAAC;IACpE,gBAAgB,CAA2C;IAEnE,4DAA4D;IAC5D,IAAW,yBAAyB,KAAoD,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,sCAAsC;IACtC,IAAW,mBAAmB,KAA+C,OAAO,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAEhH,uBAAuB;IACvB,IAAW,eAAe,KAA0D,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEnH,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC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CAAC;QAClB,CAAC,CAA4C,CAAC;QAE9C,IAAI,SAAS,KAAK,mBAAmB,CAAC,iBAAiB;YACrD,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;IAC7E,CAAC;IAEe,KAAK,CAAC,QAAQ,CAAC,mBAAwC;QACrE,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACO,gBAAgB,CAAC,aAAqB;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IAED;;;OAGG;IACO,kBAAkB,CAAC,KAA0D;QACrF,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAC,IAAiB;QAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,cAAc;YAC/D,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAiB;QACpD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YAC9B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,cAAc,oBAAoB,CAAC,CAAC;IAClI,CAAC;CACF;AACD;;;GAGG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,cAAc;CAMjE","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { KindOfQuantityProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { LazyLoadedFormat, LazyLoadedInvertedUnit, LazyLoadedUnit } from \"../Interfaces\";\nimport { Format } from \"./Format\";\nimport { InvertedUnit } from \"./InvertedUnit\";\nimport { OverrideFormat, OverrideFormatProps } from \"./OverrideFormat\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { Unit } from \"./Unit\";\n\n/** A Typescript class representation of a KindOfQuantity.\n * @public @preview\n */\nexport class KindOfQuantity extends SchemaItem {\n public override readonly schemaItemType = KindOfQuantity.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.KindOfQuantity; }\n private _relativeError: number = 1.0;\n private _presentationFormats: Array<LazyLoadedFormat | OverrideFormat> = [];\n private _persistenceUnit?: LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n /** The first presentation format in the list of Formats. */\n public get defaultPresentationFormat(): LazyLoadedFormat | OverrideFormat | undefined { return this.presentationFormats[0]; }\n\n /** A list of presentation formats. */\n public get presentationFormats(): Array<LazyLoadedFormat | OverrideFormat> { return this._presentationFormats; }\n\n /** Persistence unit */\n public get persistenceUnit(): LazyLoadedUnit | LazyLoadedInvertedUnit | undefined { return this._persistenceUnit; }\n\n public get relativeError() { return this._relativeError; }\n\n /**\n *\n * @param format The Format to add to this KindOfQuantity\n * @param isDefault\n * @internal\n */\n protected addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean = false) {\n // TODO: Add some sort of validation?\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n (isDefault) ? this._presentationFormats.splice(0, 0, format) : this._presentationFormats.push(format);\n }\n\n /** Creates an OverrideFormat in the context of this KindOfQuantity.\n * @param parent The Format to override.\n * @param precision The precision override\n * @param unitLabelOverrides The list of unit and label overrides.\n * @internal\n */\n protected createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat {\n if (unitLabelOverrides && parent.units && parent.units.length !== unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add presentation format to KindOfQuantity '${this.name}' because the number of unit overrides is inconsistent with the number in the Format '${parent.name}'.`);\n\n if (parent.units && 0 === parent.units.length && unitLabelOverrides && 0 < unitLabelOverrides.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Cannot add a presentation format to KindOfQuantity '${this.name}' without any units and no unit overrides.`);\n\n // TODO: Check compatibility of Unit overrides with the persistence unit\n\n return new OverrideFormat(parent, precision, unitLabelOverrides);\n }\n\n private async processPresentationUnits(presentationUnitsJson: string | string[]): Promise<void> {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = await this.schema.lookupItem(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = await this.schema.lookupItem(unitOverride[0]);\n\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n private processPresentationUnitsSync(presentationUnitsJson: string | string[]): void {\n const presUnitsArr = Array.isArray(presentationUnitsJson) ? presentationUnitsJson : presentationUnitsJson.split(\";\");\n for (const formatString of presUnitsArr) {\n const presFormatOverride: OverrideFormatProps = OverrideFormat.parseFormatString(formatString);\n\n const format = this.schema.lookupItemSync(presFormatOverride.name, Format);\n if (undefined === format || format.schemaItemType !== SchemaItemType.Format)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate Format '${presFormatOverride.name}' for the presentation unit on KindOfQuantity ${this.fullName}.`);\n\n if (undefined === presFormatOverride.precision && undefined === presFormatOverride.unitAndLabels) {\n this.addPresentationFormat(new DelayedPromiseWithProps(format.key, async () => format));\n continue;\n }\n\n let unitAndLabels: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]> | undefined;\n if (undefined !== presFormatOverride.unitAndLabels) {\n if (4 < presFormatOverride.unitAndLabels.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, ``);\n\n unitAndLabels = [];\n for (const unitOverride of presFormatOverride.unitAndLabels) {\n const unitOrInverted = this.schema.lookupItemSync(unitOverride[0]);\n if(Unit.isUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else if(InvertedUnit.isInvertedUnit(unitOrInverted))\n unitAndLabels.push([new DelayedPromiseWithProps(unitOrInverted.key, async () => unitOrInverted), unitOverride[1]]);\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${unitOverride[0]}.`);\n }\n }\n\n const overrideFormat = this.createFormatOverride(format, presFormatOverride.precision, unitAndLabels);\n this.addPresentationFormat(overrideFormat);\n }\n }\n\n /**\n * Save this KindOfQuantity's properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): KindOfQuantityProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n schemaJson.relativeError = this.relativeError;\n schemaJson.persistenceUnit = this.persistenceUnit!.fullName;\n if (undefined !== this.presentationFormats && 0 < this.presentationFormats.length)\n schemaJson.presentationUnits = this.presentationFormats.map((format) => format.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n const persistenceUnit = await this.persistenceUnit;\n if (undefined !== persistenceUnit) {\n const unitName = XmlSerializationUtils.createXmlTypedName(this.schema, persistenceUnit.schema, persistenceUnit.name);\n itemElement.setAttribute(\"persistenceUnit\", unitName);\n }\n\n if (undefined !== this.presentationFormats) {\n const presUnitStrings: string[] = [];\n for(const format of this.presentationFormats) {\n if (!OverrideFormat.isOverrideFormat(format)) {\n const resolvedFormat = await format;\n presUnitStrings.push(XmlSerializationUtils.createXmlTypedName(this.schema, resolvedFormat.schema, format.name));\n continue;\n }\n presUnitStrings.push(format.fullNameXml(this.schema));\n };\n itemElement.setAttribute(\"presentationUnits\", presUnitStrings.join(\";\"));\n }\n itemElement.setAttribute(\"relativeError\", this.relativeError.toString());\n\n return itemElement;\n }\n\n public override fromJSONSync(kindOfQuantityProps: KindOfQuantityProps): void {\n super.fromJSONSync(kindOfQuantityProps);\n this._relativeError = kindOfQuantityProps.relativeError;\n\n const unitItemKey = this.schema.getSchemaItemKey(kindOfQuantityProps.persistenceUnit);\n this._persistenceUnit = new DelayedPromiseWithProps(unitItemKey, async () => {\n const unitItem = await this.schema.lookupItem(unitItemKey, Unit)\n || await this.schema.lookupItem(unitItemKey, InvertedUnit);\n\n if (undefined === unitItem)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the unit ${kindOfQuantityProps.persistenceUnit}.`);\n\n return unitItem;\n }) as LazyLoadedUnit | LazyLoadedInvertedUnit;\n\n if (undefined !== kindOfQuantityProps.presentationUnits)\n this.processPresentationUnitsSync(kindOfQuantityProps.presentationUnits);\n }\n\n public override async fromJSON(kindOfQuantityProps: KindOfQuantityProps): Promise<void> {\n this.fromJSONSync(kindOfQuantityProps);\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setRelativeError(relativeError: number): void {\n this._relativeError = relativeError;\n }\n\n /**\n * Used for schema editing.\n * @internal\n */\n protected setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void {\n this._persistenceUnit = value;\n }\n\n /**\n * Type guard to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns True if the item is a KindOfQuantity, false otherwise.\n */\n public static isKindOfQuantity(item?: SchemaItem): item is KindOfQuantity {\n if (item && item.schemaItemType === SchemaItemType.KindOfQuantity)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type KindOfQuantity.\n * @param item The SchemaItem to check.\n * @returns The item cast to KindOfQuantity if it is a KindOfQuantity, undefined otherwise.\n * @internal\n */\n public static assertIsKindOfQuantity(item?: SchemaItem): asserts item is KindOfQuantity {\n if (!this.isKindOfQuantity(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.KindOfQuantity}' (KindOfQuantity)`);\n }\n}\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableKindOfQuantity extends KindOfQuantity {\n public abstract override addPresentationFormat(format: LazyLoadedFormat | OverrideFormat, isDefault: boolean): void;\n public abstract override createFormatOverride(parent: Format, precision?: number, unitLabelOverrides?: Array<[LazyLoadedUnit | LazyLoadedInvertedUnit, string | undefined]>): OverrideFormat;\n public abstract override setDisplayLabel(displayLabel: string): void;\n public abstract override setPersistenceUnit(value: LazyLoadedUnit | LazyLoadedInvertedUnit | undefined): void;\n public abstract override setRelativeError(relativeError: number): void;\n}\n"]}
|
|
@@ -36,7 +36,8 @@ export * from "./UnitConversion/UnitConverter";
|
|
|
36
36
|
export * from "./UnitProvider/SchemaUnitProvider";
|
|
37
37
|
export * from "./Validation/SchemaWalker";
|
|
38
38
|
export * from "./SchemaPartVisitorDelegate";
|
|
39
|
-
export * from "./SchemaFormatsProvider";
|
|
39
|
+
export * from "./Formatting/SchemaFormatsProvider";
|
|
40
|
+
export * from "./Formatting/FormatSetFormatsProvider";
|
|
40
41
|
export * from "./IncrementalLoading/ECSqlSchemaLocater";
|
|
41
42
|
export * from "./IncrementalLoading/IncrementalSchemaLocater";
|
|
42
43
|
export { CustomAttribute, CustomAttributeContainerProps } from "./Metadata/CustomAttribute";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.d.ts","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":"AAKA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAA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BAAmB,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAC,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -40,7 +40,8 @@ export * from "./UnitConversion/UnitConverter";
|
|
|
40
40
|
export * from "./UnitProvider/SchemaUnitProvider";
|
|
41
41
|
export * from "./Validation/SchemaWalker";
|
|
42
42
|
export * from "./SchemaPartVisitorDelegate";
|
|
43
|
-
export * from "./SchemaFormatsProvider";
|
|
43
|
+
export * from "./Formatting/SchemaFormatsProvider";
|
|
44
|
+
export * from "./Formatting/FormatSetFormatsProvider";
|
|
44
45
|
export * from "./IncrementalLoading/ECSqlSchemaLocater";
|
|
45
46
|
export * from "./IncrementalLoading/IncrementalSchemaLocater";
|
|
46
47
|
export { SchemaGraph } from "./utils/SchemaGraph";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.js","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CA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AM,uBAAuB,CAAC;AACnD,OAAO,EACL,QAAQ,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,cAAc,EACxF,mBAAmB,EAAE,wBAAwB,EAAE,kBAAkB,EACX,aAAa,EAAE,2BAA2B,GACjG,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH;;;GAGG;AACH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nexport * from \"./Constants\";\nexport * from \"./Context\";\nexport * from \"./DelayedPromise\";\nexport * from \"./Deserialization/SchemaGraphUtil\";\nexport * from \"./Deserialization/JsonProps\";\nexport * from \"./Deserialization/Helper\";\nexport * from \"./Deserialization/XmlParser\";\nexport * from \"./ECName\";\nexport * from \"./ECObjects\";\nexport * from \"./Exception\";\nexport * from \"./Interfaces\";\nexport { ECClass, StructClass } from \"./Metadata/Class\";\nexport { Constant } from \"./Metadata/Constant\";\nexport { CustomAttributeClass } from \"./Metadata/CustomAttributeClass\";\nexport { EntityClass } from \"./Metadata/EntityClass\";\nexport { AnyEnumerator, Enumeration, Enumerator } from \"./Metadata/Enumeration\";\nexport { Format } from \"./Metadata/Format\";\nexport { InvertedUnit } from \"./Metadata/InvertedUnit\";\nexport { KindOfQuantity } from \"./Metadata/KindOfQuantity\";\nexport { Mixin } from \"./Metadata/Mixin\";\nexport * from \"./Metadata/OverrideFormat\";\nexport { Phenomenon } from \"./Metadata/Phenomenon\";\nexport {\n Property, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty,\n StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty,\n AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase,\n} from \"./Metadata/Property\";\nexport { PropertyCategory } from \"./Metadata/PropertyCategory\";\nexport { RelationshipClass, RelationshipConstraint, RelationshipMultiplicity } from \"./Metadata/RelationshipClass\";\nexport { Schema } from \"./Metadata/Schema\";\nexport * from \"./Metadata/SchemaItem\";\nexport { Unit } from \"./Metadata/Unit\";\nexport { UnitSystem } from \"./Metadata/UnitSystem\";\nexport * from \"./PropertyTypes\";\nexport * from \"./SchemaJsonLocater\";\nexport * from \"./SchemaKey\";\nexport * from \"./SchemaLoader\";\nexport * from \"./UnitConversion/UnitConversion\";\nexport * from \"./UnitConversion/UnitConverter\";\nexport * from \"./UnitProvider/SchemaUnitProvider\";\nexport * from \"./Validation/SchemaWalker\";\nexport * from \"./SchemaPartVisitorDelegate\";\nexport * from \"./Formatting/SchemaFormatsProvider\";\nexport * from \"./Formatting/FormatSetFormatsProvider\";\nexport * from \"./IncrementalLoading/ECSqlSchemaLocater\";\nexport * from \"./IncrementalLoading/IncrementalSchemaLocater\";\nexport { CustomAttribute, CustomAttributeContainerProps} from \"./Metadata/CustomAttribute\";\nexport { SchemaGraph } from \"./utils/SchemaGraph\";\n\n/** @docs-package-description\n * The ecschema-metadata package contains classes for working with ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\n */\n/**\n * @docs-group-description Metadata\n * Definitions of classes and interfaces that represent all [EC elements]($docs/bis/ec/index.md).\n */\n/**\n * @docs-group-description Utils\n * A set of utility classes used throughout the package.\n */\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/ecschema-metadata",
|
|
3
|
-
"version": "5.2.0-dev.
|
|
3
|
+
"version": "5.2.0-dev.31",
|
|
4
4
|
"description": "ECObjects core concepts in typescript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/ecschema-metadata.js",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"rimraf": "^6.0.1",
|
|
49
49
|
"sinon": "^17.0.2",
|
|
50
50
|
"typescript": "~5.6.2",
|
|
51
|
-
"@itwin/build-tools": "5.2.0-dev.
|
|
52
|
-
"@itwin/core-
|
|
53
|
-
"@itwin/core-
|
|
51
|
+
"@itwin/build-tools": "5.2.0-dev.31",
|
|
52
|
+
"@itwin/core-quantity": "5.2.0-dev.31",
|
|
53
|
+
"@itwin/core-bentley": "5.2.0-dev.31"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@itwin/core-bentley": "5.2.0-dev.
|
|
57
|
-
"@itwin/core-quantity": "5.2.0-dev.
|
|
56
|
+
"@itwin/core-bentley": "5.2.0-dev.31",
|
|
57
|
+
"@itwin/core-quantity": "5.2.0-dev.31"
|
|
58
58
|
},
|
|
59
59
|
"nyc": {
|
|
60
60
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains the properties needed to track load times
|
|
3
|
-
* for SchemaItem queries.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export interface SchemaItemLoadData {
|
|
7
|
-
loadTime: number;
|
|
8
|
-
itemCount: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Contains the properties needed to track load times
|
|
12
|
-
* for Schema queries.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export interface SchemaLoadData {
|
|
16
|
-
loadTime?: number;
|
|
17
|
-
schemaItemMap: Map<string, SchemaItemLoadData>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Utility class used to log query load times for Schema and
|
|
21
|
-
* SchemaItem queries.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export declare class PerformanceLogger {
|
|
25
|
-
private _iModelItems;
|
|
26
|
-
private _label;
|
|
27
|
-
disableLogging: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Initializes a new PerformanceLogger instance.
|
|
30
|
-
* @param label Arbitrary label used to tag this logging session (ex. IModel name)
|
|
31
|
-
*/
|
|
32
|
-
constructor(label?: string);
|
|
33
|
-
/**
|
|
34
|
-
* Gets the Map of logged Schema entries. The Map key is the iModel name. The Map
|
|
35
|
-
* value is a second Map whose key is a Schema name and value is a SchemaLoadData
|
|
36
|
-
* object.
|
|
37
|
-
*/
|
|
38
|
-
get logItems(): Map<string, Map<string, SchemaLoadData>>;
|
|
39
|
-
/**
|
|
40
|
-
* Adds a new log entry to the Schema Map.
|
|
41
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
42
|
-
* @param schemaName The Schema being queried.
|
|
43
|
-
*/
|
|
44
|
-
logSchema(startTime: number, schemaName: string): void;
|
|
45
|
-
/**
|
|
46
|
-
* Adds a new log entry to the SchemaItem Map.
|
|
47
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
48
|
-
* @param schemaName The name of the Schema being queried.
|
|
49
|
-
* @param schemaItemType The SchemaItemType name of the type being queried.
|
|
50
|
-
* @param itemCount The number of items retrieved in the query.
|
|
51
|
-
*/
|
|
52
|
-
logSchemaItem(startTime: number, schemaName: string, schemaItemType: string, itemCount: number): void;
|
|
53
|
-
/**
|
|
54
|
-
* Clears all log entries from the Map.
|
|
55
|
-
*/
|
|
56
|
-
clearLogs(): void;
|
|
57
|
-
private getSchemaMap;
|
|
58
|
-
private getSchemaLoadData;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=PerformanceLogger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceLogger.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/PerformanceLogger.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChD;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAuD;IAC3E,OAAO,CAAC,MAAM,CAAS;IAGhB,cAAc,UAAS;IAE9B;;;OAGG;gBACS,KAAK,CAAC,EAAE,MAAM;IAI1B;;;;OAIG;IACH,IAAW,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAE9D;IAED;;;;OAIG;IACI,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAYtD;;;;;;OAMG;IACI,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAerG;;OAEG;IACI,SAAS;IAIhB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,iBAAiB;CAM1B"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PerformanceLogger = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Utility class used to log query load times for Schema and
|
|
10
|
-
* SchemaItem queries.
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
class PerformanceLogger {
|
|
14
|
-
_iModelItems = new Map();
|
|
15
|
-
_label;
|
|
16
|
-
// flag that controls if logging is enabled.
|
|
17
|
-
disableLogging = false;
|
|
18
|
-
/**
|
|
19
|
-
* Initializes a new PerformanceLogger instance.
|
|
20
|
-
* @param label Arbitrary label used to tag this logging session (ex. IModel name)
|
|
21
|
-
*/
|
|
22
|
-
constructor(label) {
|
|
23
|
-
this._label = label || "";
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Gets the Map of logged Schema entries. The Map key is the iModel name. The Map
|
|
27
|
-
* value is a second Map whose key is a Schema name and value is a SchemaLoadData
|
|
28
|
-
* object.
|
|
29
|
-
*/
|
|
30
|
-
get logItems() {
|
|
31
|
-
return this._iModelItems;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Adds a new log entry to the Schema Map.
|
|
35
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
36
|
-
* @param schemaName The Schema being queried.
|
|
37
|
-
*/
|
|
38
|
-
logSchema(startTime, schemaName) {
|
|
39
|
-
if (this.disableLogging)
|
|
40
|
-
return;
|
|
41
|
-
const loadTime = new Date().getTime() - startTime;
|
|
42
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
43
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
44
|
-
schemaLoadData.loadTime = loadTime;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Adds a new log entry to the SchemaItem Map.
|
|
48
|
-
* @param startTime The start time of the entry to be logged (end time/duration is handled in this method).
|
|
49
|
-
* @param schemaName The name of the Schema being queried.
|
|
50
|
-
* @param schemaItemType The SchemaItemType name of the type being queried.
|
|
51
|
-
* @param itemCount The number of items retrieved in the query.
|
|
52
|
-
*/
|
|
53
|
-
logSchemaItem(startTime, schemaName, schemaItemType, itemCount) {
|
|
54
|
-
if (this.disableLogging)
|
|
55
|
-
return;
|
|
56
|
-
const loadTime = new Date().getTime() - startTime;
|
|
57
|
-
const schemaMap = this.getSchemaMap(this._label);
|
|
58
|
-
const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);
|
|
59
|
-
if (schemaLoadData.schemaItemMap.has(schemaItemType))
|
|
60
|
-
throw new Error("There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.");
|
|
61
|
-
schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Clears all log entries from the Map.
|
|
65
|
-
*/
|
|
66
|
-
clearLogs() {
|
|
67
|
-
this._iModelItems.clear();
|
|
68
|
-
}
|
|
69
|
-
getSchemaMap(iModel) {
|
|
70
|
-
if (!this._iModelItems.has(iModel)) {
|
|
71
|
-
this._iModelItems.set(iModel, new Map());
|
|
72
|
-
}
|
|
73
|
-
return this._iModelItems.get(iModel);
|
|
74
|
-
}
|
|
75
|
-
getSchemaLoadData(schemaMap, schemaName) {
|
|
76
|
-
if (!schemaMap.has(schemaName))
|
|
77
|
-
schemaMap.set(schemaName, { schemaItemMap: new Map() });
|
|
78
|
-
return schemaMap.get(schemaName);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.PerformanceLogger = PerformanceLogger;
|
|
82
|
-
//# sourceMappingURL=PerformanceLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceLogger.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/PerformanceLogger.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAsBhG;;;;GAIG;AACH,MAAa,iBAAiB;IACpB,YAAY,GAA6C,IAAI,GAAG,EAAE,CAAC;IACnE,MAAM,CAAS;IAEvB,4CAA4C;IACrC,cAAc,GAAG,KAAK,CAAC;IAE9B;;;OAGG;IACH,YAAY,KAAc;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,SAAiB,EAAE,UAAkB;QACpD,IAAI,IAAI,CAAC,cAAc;YACrB,OAAO;QAET,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;QAElD,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAErE,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAAC,SAAiB,EAAE,UAAkB,EAAE,cAAsB,EAAE,SAAiB;QACnG,IAAI,IAAI,CAAC,cAAc;YACrB,OAAO;QAET,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;QAElD,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAErE,IAAI,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,mGAAmG,CAAC,CAAC;QAEvH,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAEO,YAAY,CAAC,MAAc;QACjC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAgC,CAAC;IACtE,CAAC;IAEO,iBAAiB,CAAC,SAAsC,EAAE,UAAkB;QAClF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAC5B,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAA;QAEzD,OAAO,SAAS,CAAC,GAAG,CAAC,UAAU,CAAmB,CAAC;IACrD,CAAC;CACF;AApFD,8CAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/**\n * Contains the properties needed to track load times\n * for SchemaItem queries.\n * @internal\n */\nexport interface SchemaItemLoadData {\n loadTime: number,\n itemCount: number\n}\n\n/**\n * Contains the properties needed to track load times\n * for Schema queries.\n * @internal\n */\nexport interface SchemaLoadData {\n loadTime?: number,\n schemaItemMap: Map<string, SchemaItemLoadData>;\n}\n\n/**\n * Utility class used to log query load times for Schema and\n * SchemaItem queries.\n * @internal\n */\nexport class PerformanceLogger {\n private _iModelItems: Map<string, Map<string, SchemaLoadData>> = new Map();\n private _label: string;\n\n // flag that controls if logging is enabled.\n public disableLogging = false;\n\n /**\n * Initializes a new PerformanceLogger instance.\n * @param label Arbitrary label used to tag this logging session (ex. IModel name)\n */\n constructor(label?: string) {\n this._label = label || \"\";\n }\n\n /**\n * Gets the Map of logged Schema entries. The Map key is the iModel name. The Map\n * value is a second Map whose key is a Schema name and value is a SchemaLoadData\n * object.\n */\n public get logItems(): Map<string, Map<string, SchemaLoadData>> {\n return this._iModelItems;\n }\n\n /**\n * Adds a new log entry to the Schema Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The Schema being queried.\n */\n public logSchema(startTime: number, schemaName: string) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n schemaLoadData.loadTime = loadTime;\n }\n\n /**\n * Adds a new log entry to the SchemaItem Map.\n * @param startTime The start time of the entry to be logged (end time/duration is handled in this method).\n * @param schemaName The name of the Schema being queried.\n * @param schemaItemType The SchemaItemType name of the type being queried.\n * @param itemCount The number of items retrieved in the query.\n */\n public logSchemaItem(startTime: number, schemaName: string, schemaItemType: string, itemCount: number) {\n if (this.disableLogging)\n return;\n\n const loadTime = new Date().getTime() - startTime;\n\n const schemaMap = this.getSchemaMap(this._label);\n const schemaLoadData = this.getSchemaLoadData(schemaMap, schemaName);\n\n if (schemaLoadData.schemaItemMap.has(schemaItemType))\n throw new Error(\"There should not be a multiple load times for a given iModel, Schema, SchemaItemType combination.\");\n\n schemaLoadData.schemaItemMap.set(schemaItemType, { loadTime, itemCount });\n }\n\n /**\n * Clears all log entries from the Map.\n */\n public clearLogs() {\n this._iModelItems.clear();\n }\n\n private getSchemaMap(iModel: string): Map<string, SchemaLoadData> {\n if (!this._iModelItems.has(iModel)) {\n this._iModelItems.set(iModel, new Map());\n }\n\n return this._iModelItems.get(iModel) as Map<string, SchemaLoadData>;\n }\n\n private getSchemaLoadData(schemaMap: Map<string, SchemaLoadData>, schemaName: string): SchemaLoadData {\n if (!schemaMap.has(schemaName))\n schemaMap.set(schemaName, { schemaItemMap: new Map() })\n\n return schemaMap.get(schemaName) as SchemaLoadData;\n }\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaFormatsProvider.d.ts","sourceRoot":"","sources":["../../src/SchemaFormatsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1D,OAAO,EAAE,OAAO,EAAU,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAe,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAMzH;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IAC3D,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,iBAAiB,CAA0B;IAC5C,gBAAgB,iBAAsB,kBAAkB,KAAK,IAAI,EAAI;IAC5E;;;;;;OAMG;gBACS,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa;IAUvE,IAAW,OAAO,kBAA4B;IAC9C,IAAW,UAAU,IAEa,aAAa,CAFK;IAEpD,IAAW,UAAU,CAAC,UAAU,EAAE,aAAa,EAG9C;IAED,OAAO,CAAC,KAAK;IAMb,0HAA0H;IAC1H,OAAO,CAAC,yBAAyB;YAenB,iCAAiC;IAmD/C;;;;;;OAMG;IACU,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CA8B5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{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AAE;gBACL;oBACE,IAAI,EAAE,eAAe,CAAC,QAAQ;oBAC9B,KAAK,EAAE,eAAe,CAAC,KAAK;iBAC7B;aACF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ISchemaLocater, SchemaContext } from \"./Context\";\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\nimport { Format } from \"./Metadata/Format\";\nimport { SchemaItemFormatProps } from \"./Deserialization/JsonProps\";\nimport { BeEvent, Logger } from \"@itwin/core-bentley\";\nimport { KindOfQuantity } from \"./Metadata/KindOfQuantity\";\nimport { getFormatProps } from \"./Metadata/OverrideFormat\";\nimport { FormatDefinition, FormatProps, FormatsChangedArgs, FormatsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\nimport { Unit } from \"./Metadata/Unit\";\nimport { InvertedUnit } from \"./Metadata/InvertedUnit\";\nimport { Schema } from \"./Metadata/Schema\";\nimport { UnitSystem } from \"./Metadata/UnitSystem\";\nconst loggerCategory = \"SchemaFormatsProvider\";\n/**\n * Provides default formats and kind of quantities from a given SchemaContext or SchemaLocater.\n * @beta\n */\nexport class SchemaFormatsProvider implements FormatsProvider {\n private _context: SchemaContext;\n private _unitSystem: UnitSystemKey;\n private _formatsRetrieved: Set<string> = new Set();\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param unitSystem Used to lookup a default format through a schema specific algorithm, when the format retrieved is associated with a KindOfQuantity.\n */\n constructor(contextOrLocater: ISchemaLocater, unitSystem: UnitSystemKey) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitSystem = unitSystem;\n }\n\n public get context() { return this._context; }\n public get unitSystem() { return this._unitSystem; }\n\n public set unitSystem(unitSystem: UnitSystemKey) {\n this._unitSystem = unitSystem;\n this.clear();\n }\n\n private clear(): void {\n const formatsChanged = Array.from(this._formatsRetrieved);\n this._formatsRetrieved.clear();\n this.onFormatsChanged.raiseEvent({ formatsChanged });\n }\n\n /** When using a presentation unit from a KindOfQuantity, the label and description should come from the KindOfQuantity */\n private convertToFormatDefinition(format: SchemaItemFormatProps, kindOfQuantity: KindOfQuantity): FormatDefinition {\n // Destructure all properties except 'rest'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, label, description, $schema, schema, schemaVersion, schemaItemType,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n customAttributes, originalECSpecMajorVersion, originalECSpecMinorVersion, ...rest } = format;\n\n return {\n ...rest,\n name: kindOfQuantity.fullName,\n label: kindOfQuantity.label ?? format.label,\n description: kindOfQuantity.description ?? format.description,\n }\n }\n\n private async getKindOfQuantityFormatFromSchema(itemKey: SchemaItemKey): Promise<FormatDefinition | undefined> {\n let kindOfQuantity: KindOfQuantity | undefined;\n try {\n kindOfQuantity = await this._context.getSchemaItem(itemKey, KindOfQuantity);\n } catch {\n Logger.logError(loggerCategory, `Failed to find KindOfQuantity ${itemKey.fullName}`);\n return undefined;\n }\n\n if (!kindOfQuantity) {\n return undefined;\n }\n\n // Find the first presentation format that matches the provided unit system.\n const unitSystemMatchers = getUnitSystemGroupMatchers(this._unitSystem);\n const presentationFormats = kindOfQuantity.presentationFormats;\n for (const matcher of unitSystemMatchers) {\n for (const lazyFormat of presentationFormats) {\n const format = await lazyFormat;\n const unit = await (format.units && format.units[0][0]);\n if (!unit) {\n continue;\n }\n const currentUnitSystem = await unit.unitSystem;\n if (currentUnitSystem && matcher(currentUnitSystem)) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getFormatProps(format);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n }\n\n // If no matching presentation format was found, use persistence unit format if it matches unit system.\n const persistenceUnit = await kindOfQuantity.persistenceUnit;\n const persistenceUnitSystem = await persistenceUnit?.unitSystem;\n if (persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getPersistenceUnitFormatProps(persistenceUnit!);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n\n const defaultFormat = kindOfQuantity.defaultPresentationFormat;\n if (!defaultFormat) {\n return undefined;\n }\n this._formatsRetrieved.add(itemKey.fullName);\n const defaultProps = getFormatProps(await defaultFormat);\n return this.convertToFormatDefinition(defaultProps, kindOfQuantity);\n }\n\n\n /**\n * Retrieves a Format from a SchemaContext. If the format is part of a KindOfQuantity, the first presentation format in the KindOfQuantity that matches the current unit system will be retrieved.\n * If no presentation format matches the current unit system, the persistence unit format will be retrieved if it matches the current unit system.\n * Else, the default presentation format will be retrieved.\n * @param name The full name of the Format or KindOfQuantity.\n * @returns\n */\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(name);\n const schemaKey = new SchemaKey(schemaName);\n let schema: Schema | undefined;\n try {\n schema = await this._context.getSchema(schemaKey);\n } catch {\n Logger.logError(loggerCategory, `Failed to find schema ${schemaName}`);\n return undefined;\n }\n if (!schema) {\n return undefined;\n }\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n\n if (schema.name === \"Formats\") {\n let format: Format | undefined;\n try {\n format = await this._context.getSchemaItem(itemKey, Format);\n } catch {\n Logger.logError(loggerCategory, `Failed to find Format ${itemKey.fullName}`);\n return undefined;\n }\n if (!format) {\n return undefined;\n }\n return format.toJSON(true);\n }\n return this.getKindOfQuantityFormatFromSchema(itemKey);\n }\n}\n\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\n function createMatcher(name: string | string[]) {\n const names = Array.isArray(name) ? name : [name];\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\n }\n switch (groupKey) {\n case \"imperial\":\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"metric\":\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usCustomary\":\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usSurvey\":\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n }\n return [];\n}\n\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\n // Same as Format \"DefaultRealU\" in Formats ecschema\n return {\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\n precision: 6,\n type: \"Decimal\",\n composite: {\n units: [\n {\n name: persistenceUnit.fullName,\n label: persistenceUnit.label,\n },\n ],\n },\n };\n}"]}
|