@itwin/ecschema-metadata 5.5.0-dev.9 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/lib/cjs/Context.d.ts +4 -0
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +9 -1
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +0 -15
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +29 -82
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +2 -0
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/utils/ECClassHierarchy.d.ts +18 -0
- package/lib/cjs/utils/ECClassHierarchy.d.ts.map +1 -0
- package/lib/cjs/utils/ECClassHierarchy.js +78 -0
- package/lib/cjs/utils/ECClassHierarchy.js.map +1 -0
- package/lib/cjs/utils/SchemaLoadingController.d.ts.map +1 -1
- package/lib/cjs/utils/SchemaLoadingController.js +5 -1
- package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
- package/lib/esm/Context.d.ts +4 -0
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +9 -1
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +0 -15
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +29 -82
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +2 -0
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/utils/ECClassHierarchy.d.ts +18 -0
- package/lib/esm/utils/ECClassHierarchy.d.ts.map +1 -0
- package/lib/esm/utils/ECClassHierarchy.js +74 -0
- package/lib/esm/utils/ECClassHierarchy.js.map +1 -0
- package/lib/esm/utils/SchemaLoadingController.d.ts.map +1 -1
- package/lib/esm/utils/SchemaLoadingController.js +5 -1
- package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Class.js","sourceRoot":"","sources":["../../../src/Metadata/Class.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,cAAc,CAAC;AAC9L,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,wBAAwB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAY,mBAAmB,EAAE,cAAc,GACxI,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5E;;;GAGG;AACH,MAAM,OAAgB,OAAQ,SAAQ,UAAU;IAC9C,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AAC,YAAY,CAAC,QAAQ,CAAC;YACvD,OAAO;QAET,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IACtC;;OAEG;IACsB,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IAErE;;;OAGG;IACI,MAAM,KAAc,cAAc,KAAK,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAClF;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,IAAiB;QAC3C,IAAI,IAAI,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,CAAC,WAAW;YAC5D,OAAO,IAAI,CAAC;QAEd,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAiB;QACjD,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YAC3B,MAAM,IAAI,aAAa,CAAC,cAAc,CAAC,qBAAqB,EAAE,aAAa,cAAc,CAAC,WAAW,iBAAiB,CAAC,CAAC;IAC5H,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,WAAW;CAE3D;AAED;;;GAGG;AACH,MAAM,OAAgB,YAAa,SAAQ,OAAO;CA6BjD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ClassProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { AbstractSchemaItemType, classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType, SupportedSchemaItemType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { AnyClass, HasMixins, LazyLoadedECClass } from \"../Interfaces\";\r\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport {\r\n EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, Property, StructArrayProperty, StructProperty,\r\n} from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\n\r\n/**\r\n * A common abstract class for all of the ECClass types.\r\n * @public @preview\r\n */\r\nexport abstract class ECClass extends SchemaItem implements CustomAttributeContainerProps {\r\n /** @internal */\r\n public static override get schemaItemType(): SupportedSchemaItemType { return AbstractSchemaItemType.Class; } // need this so getItem(\"name\", ECClass) in schema works\r\n private _modifier: ECClassModifier;\r\n private _baseClass?: LazyLoadedECClass;\r\n private _derivedClasses?: Map<string, LazyLoadedECClass>;\r\n private _properties?: Map<string, Property>;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n private _mergedPropertyCache?: Map<string, Property>;\r\n\r\n public get modifier() { return this._modifier; }\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name);\r\n\r\n if (modifier)\r\n this._modifier = modifier;\r\n else\r\n this._modifier = ECClassModifier.None;\r\n }\r\n\r\n /**\r\n * Gets the base class if it exists, otherwise returns undefined.\r\n */\r\n public get baseClass(): LazyLoadedECClass | undefined {\r\n return this._baseClass;\r\n }\r\n\r\n public getBaseClassSync(): ECClass | undefined {\r\n if (!this.baseClass) {\r\n return undefined;\r\n }\r\n\r\n return this.schema.lookupItemSync(this.baseClass, ECClass);\r\n }\r\n\r\n /**\r\n * Sets the base class of the ECClass. Pass undefined to 'remove' the base class.\r\n *\r\n * @internal\r\n */\r\n protected async setBaseClass(baseClass: LazyLoadedECClass | undefined) {\r\n const oldBaseClass = this._baseClass;\r\n this._baseClass = baseClass;\r\n\r\n if (baseClass)\r\n this.addDerivedClass(await baseClass, this);\r\n else if (oldBaseClass)\r\n this.removeDerivedClass(await oldBaseClass, this);\r\n }\r\n\r\n /**\r\n * Gets the derived classes belonging to this class.\r\n * @returns An array of ECClasses or undefined if no derived classes exist.\r\n */\r\n public async getDerivedClasses(): Promise<ECClass[] | undefined> {\r\n if (!this._derivedClasses || this._derivedClasses.size === 0)\r\n return undefined;\r\n\r\n return Array.from(await Promise.all(this._derivedClasses.values()));\r\n }\r\n\r\n /**\r\n * Convenience method for adding an already loaded ECProperty used by create*Property methods.\r\n * @param prop The property to add.\r\n * @return The property that was added.\r\n *\r\n * @internal\r\n */\r\n protected addProperty<T extends Property>(prop: T): T {\r\n if (!this._properties)\r\n this._properties = new Map<string, Property>();\r\n\r\n this._properties.set(prop.name.toUpperCase(), prop);\r\n this.cleanCache();\r\n return prop;\r\n }\r\n\r\n /**\r\n * Deletes a property from within this class.\r\n * @param name The property name to delete, lookup is case-insensitive\r\n * @internal\r\n */\r\n protected async deleteProperty(name: string): Promise<void> {\r\n if (this._properties) {\r\n const property = await this.getProperty(name);\r\n if (property) {\r\n this._properties.delete(name.toUpperCase());\r\n this.cleanCache();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a property from within this class.\r\n * @param name The property name to delete, lookup is case-insensitive\r\n * @internal\r\n */\r\n protected deletePropertySync(name: string): void {\r\n if (this._properties) {\r\n const property = this.getPropertySync(name);\r\n if (property) {\r\n this._properties.delete(name.toUpperCase());\r\n this.cleanCache();\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Searches, case-insensitive, for an ECProperty with given the name on this class and, by default, on\r\n * all base classes. Set excludeInherited to 'true' to only search the local class.\r\n * @param name The name of the property to retrieve.\r\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\r\n */\r\n public async getProperty(name: string, excludeInherited?: boolean): Promise<Property | undefined> {\r\n const upperKey = name.toUpperCase();\r\n let property: Property | undefined;\r\n\r\n if (this._properties) {\r\n property = this._properties.get(upperKey);\r\n if (property) {\r\n return property;\r\n }\r\n }\r\n\r\n if (excludeInherited) {\r\n return undefined;\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = await this.buildPropertyCache();\r\n }\r\n\r\n return this._mergedPropertyCache.get(upperKey);\r\n }\r\n\r\n /**\r\n * Searches, case-insensitive, for a local ECProperty with the name provided.\r\n * @param name The name of the property to retrieve.\r\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\r\n */\r\n public getPropertySync(name: string, excludeInherited?: boolean): Property | undefined {\r\n const upperKey = name.toUpperCase();\r\n let property: Property | undefined;\r\n\r\n if (this._properties) {\r\n property = this._properties.get(upperKey);\r\n if (property) {\r\n return property;\r\n }\r\n }\r\n\r\n if (excludeInherited) {\r\n return undefined;\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = this.buildPropertyCacheSync();\r\n }\r\n\r\n return this._mergedPropertyCache.get(upperKey);\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, for the property with the name provided.\r\n * @param name The name of the inherited property to find.\r\n */\r\n public async getInheritedProperty(name: string): Promise<Property | undefined> {\r\n if (this.baseClass) {\r\n const baseClassObj = await this.baseClass;\r\n return baseClassObj.getProperty(name);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, for the property with the name provided.\r\n * @param name The name of the inherited property to find.\r\n */\r\n public getInheritedPropertySync(name: string): Property | undefined {\r\n const baseClassObj = this.getBaseClassSync();\r\n if (baseClassObj)\r\n return baseClassObj.getPropertySync(name);\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\r\n *\r\n * @internal\r\n */\r\n protected async createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\r\n protected async createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\r\n protected async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\r\n *\r\n * @internal\r\n */\r\n protected createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\r\n protected createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\r\n protected createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveArrayECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n *\r\n * @internal\r\n */\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveArrayECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n *\r\n * @internal\r\n */\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name The name of property to create.\r\n * @param structType The struct type of property to create.\r\n *\r\n * @internal\r\n */\r\n protected async createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructProperty(this, name, await this.loadStructType(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name The name of property to create.\r\n * @param structType The struct type of property to create.\r\n *\r\n * @internal\r\n */\r\n protected createStructPropertySync(name: string, structType: string | StructClass): StructProperty {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param type\r\n *\r\n * @internal\r\n */\r\n protected async createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructArrayProperty(this, name, await this.loadStructType(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param type\r\n *\r\n * @internal\r\n */\r\n protected createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructArrayProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param structType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected async loadStructType(structType: string | StructClass | undefined, schema: Schema): Promise<StructClass> {\r\n let correctType: StructClass | undefined;\r\n if (typeof (structType) === \"string\") {\r\n correctType = await schema.lookupItem(structType, StructClass);\r\n } else\r\n correctType = structType;\r\n\r\n if (!correctType)\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\r\n\r\n return correctType;\r\n }\r\n\r\n /**\r\n *\r\n * @param structType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected loadStructTypeSync(structType: string | StructClass | undefined, schema: Schema): StructClass {\r\n let correctType: StructClass | undefined;\r\n if (typeof (structType) === \"string\") {\r\n correctType = schema.lookupItemSync(structType, StructClass);\r\n } else\r\n correctType = structType;\r\n\r\n if (!correctType)\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\r\n\r\n return correctType;\r\n }\r\n\r\n /**\r\n *\r\n * @param primitiveType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected async loadPrimitiveType(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): Promise<PrimitiveType | Enumeration> {\r\n if (primitiveType === undefined)\r\n return PrimitiveType.Integer;\r\n\r\n if (typeof (primitiveType) === \"string\") {\r\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\r\n if (!resolvedType) {\r\n resolvedType = await schema.lookupItem(primitiveType, Enumeration);\r\n }\r\n\r\n if (resolvedType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n // If resolvedType is a SchemaItem, make sure it is an Enumeration- if not, throw an error\r\n if (typeof (resolvedType) !== \"number\" && resolvedType.schemaItemType !== SchemaItemType.Enumeration)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n return resolvedType;\r\n }\r\n\r\n return primitiveType;\r\n }\r\n\r\n /**\r\n *\r\n * @param primitiveType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected loadPrimitiveTypeSync(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): PrimitiveType | Enumeration {\r\n if (primitiveType === undefined)\r\n return PrimitiveType.Integer;\r\n\r\n if (typeof (primitiveType) === \"string\") {\r\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\r\n if (!resolvedType) {\r\n resolvedType = schema.lookupItemSync(primitiveType, Enumeration);\r\n }\r\n\r\n if (resolvedType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n return resolvedType;\r\n }\r\n\r\n return primitiveType;\r\n }\r\n\r\n /**\r\n * Save this Classes properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): ClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n const isMixin = SchemaItemType.Mixin === this.schemaItemType;\r\n const isRelationship = SchemaItemType.RelationshipClass === this.schemaItemType;\r\n if (!isMixin && (ECClassModifier.None !== this.modifier || isRelationship))\r\n schemaJson.modifier = classModifierToString(this.modifier);\r\n if (this.baseClass !== undefined)\r\n schemaJson.baseClass = this.baseClass.fullName;\r\n if (this._properties !== undefined && this._properties.size > 0)\r\n schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (customAttributes !== undefined)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as ClassProps;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n if (undefined !== this.modifier)\r\n itemElement.setAttribute(\"modifier\", classModifierToString(this.modifier));\r\n\r\n if (undefined !== this.baseClass) {\r\n const baseClass = await this.baseClass;\r\n const baseClassElement = schemaXml.createElement(\"BaseClass\");\r\n const baseClassName = XmlSerializationUtils.createXmlTypedName(this.schema, baseClass.schema, baseClass.name);\r\n baseClassElement.textContent = baseClassName;\r\n itemElement.appendChild(baseClassElement);\r\n }\r\n\r\n if (this._properties) {\r\n for (const prop of this._properties.values()) {\r\n const propXml = await prop.toXml(schemaXml);\r\n itemElement.appendChild(propXml);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(classProps: ClassProps) {\r\n super.fromJSONSync(classProps);\r\n\r\n if (undefined !== classProps.modifier) {\r\n const modifier = parseClassModifier(classProps.modifier);\r\n if (undefined === modifier) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: classProps.originalECSpecMajorVersion, writeVersion: classProps.originalECSpecMinorVersion } as ECSpecVersion))\r\n this._modifier = ECClassModifier.None;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, `The string '${classProps.modifier}' is not a valid ECClassModifier.`);\r\n } else {\r\n this._modifier = modifier;\r\n }\r\n }\r\n\r\n if (undefined !== classProps.baseClass) {\r\n const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);\r\n if (!ecClassSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\r\n\r\n const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);\r\n\r\n let lazyBase: LazyLoadedECClass;\r\n if (!baseClass) {\r\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\r\n async () => {\r\n const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);\r\n if (undefined === baseItem || !ECClass.isECClass(baseItem))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\r\n return baseItem;\r\n });\r\n } else {\r\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\r\n async () => {\r\n return baseClass as ECClass;\r\n });\r\n }\r\n\r\n this._baseClass = lazyBase;\r\n\r\n if (!baseClass)\r\n return;\r\n\r\n this.addDerivedClass(baseClass as ECClass, this);\r\n }\r\n }\r\n\r\n public override async fromJSON(classProps: ClassProps): Promise<void> {\r\n this.fromJSONSync(classProps);\r\n }\r\n\r\n /**\r\n *\r\n * @param customAttribute\r\n *\r\n * @internal\r\n */\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /**\r\n * Iterates (recursively) over all base classes and mixins, in \"property override\" order.\r\n * This is essentially a depth-first traversal through the inheritance tree.\r\n */\r\n public async *getAllBaseClasses(): AsyncIterable<ECClass> {\r\n const baseClasses: ECClass[] = [this];\r\n const addBaseClasses = async (ecClass: AnyClass) => {\r\n if (SchemaItemType.EntityClass === ecClass.schemaItemType) {\r\n for (let i = (ecClass as HasMixins).mixins.length - 1; i >= 0; i--) {\r\n baseClasses.push(await (ecClass as HasMixins).mixins[i]);\r\n }\r\n }\r\n\r\n if (ecClass.baseClass)\r\n baseClasses.push(await ecClass.baseClass);\r\n };\r\n\r\n while (baseClasses.length > 0) {\r\n const baseClass = baseClasses.pop() as AnyClass;\r\n await addBaseClasses(baseClass);\r\n if (baseClass !== this)\r\n yield baseClass as ECClass;\r\n }\r\n }\r\n\r\n public *getAllBaseClassesSync(): Iterable<AnyClass> {\r\n const baseClasses: ECClass[] = [this];\r\n const addBaseClasses = (ecClass: AnyClass) => {\r\n if (ecClass.schemaItemType === SchemaItemType.EntityClass) { // cannot use EntityClass typeguard because of circular reference\r\n for (const m of Array.from((ecClass as HasMixins).getMixinsSync()).reverse()) {\r\n baseClasses.push(m);\r\n }\r\n }\r\n\r\n const baseClass = ecClass.getBaseClassSync();\r\n if (baseClass)\r\n baseClasses.push(baseClass);\r\n };\r\n\r\n while (baseClasses.length > 0) {\r\n const baseClass = baseClasses.pop() as AnyClass;\r\n addBaseClasses(baseClass);\r\n if (baseClass !== this)\r\n yield baseClass;\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\nprotected async buildPropertyCache(): Promise<Map<string, Property>> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = await this.baseClass;\r\n if (baseClass) {\r\n for (const property of await baseClass.getProperties()) {\r\n if (!cache.has(property.name.toUpperCase())) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n }\r\n\r\n if (this._properties) {\r\n this._properties.forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n}\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected buildPropertyCacheSync(): Map<string, Property> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = this.getBaseClassSync();\r\n if (baseClass) {\r\n for (const property of baseClass.getPropertiesSync()) {\r\n if (!cache.has(property.name.toUpperCase())) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n }\r\n\r\n if (this._properties) {\r\n this._properties.forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n }\r\n\r\n /**\r\n * Clears all caches on this object. This is called implicitly for this class,\r\n * but needs to be called if derived classes have changed.\r\n * @internal\r\n */\r\n public cleanCache() {\r\n this._mergedPropertyCache = undefined;\r\n }\r\n\r\n /**\r\n * Returns the properties on this class and its base classes.\r\n * Since this is an expensive operation, results will be cached after first call.\r\n * @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.\r\n * @returns An array of properties, empty array if none exist.\r\n */\r\n public getPropertiesSync(excludeInherited?: boolean): Iterable<Property> {\r\n if (excludeInherited) {\r\n return this._properties && this._properties.size > 0 ? this._properties.values() : [];\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = this.buildPropertyCacheSync();\r\n }\r\n\r\n return this._mergedPropertyCache.values();\r\n }\r\n\r\n /**\r\n * Quick way to check whether this class has any local properties without having to use the iterable\r\n */\r\n public get hasLocalProperties(): boolean {\r\n return this._properties !== undefined && this._properties.size > 0;\r\n }\r\n\r\n /**\r\n * Returns the properties on this class and its base classes.\r\n * Since this is an expensive operation, results will be cached after first call.\r\n * @param excludeInherited If true, only properties defined directly on this class will be returned.\r\n * @returns An array of properties, empty array if none exist.\r\n */\r\n public async getProperties(excludeInherited?: boolean): Promise<Iterable<Property>> {\r\n // At the moment we do not lazy load properties, so this is the same as getPropertiesSync\r\n return this.getPropertiesSync(excludeInherited);\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current class and its bases\r\n * This is the async version of getCustomAttributesSync()\r\n */\r\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\r\n return this.getCustomAttributesSync();\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current class and its bases.\r\n */\r\n public getCustomAttributesSync(): CustomAttributeSet {\r\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\r\n if (undefined === customAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>();\r\n }\r\n\r\n this.traverseBaseClassesSync((ecClass: ECClass) => {\r\n if (undefined === ecClass.customAttributes)\r\n return false;\r\n\r\n for (const [className, customAttribute] of ecClass.customAttributes) {\r\n if (customAttributes.has(className))\r\n continue;\r\n customAttributes.set(className, customAttribute);\r\n }\r\n\r\n return false;\r\n });\r\n\r\n return customAttributes;\r\n }\r\n\r\n /**\r\n * Asynchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\r\n * function for each base class encountered.\r\n * @param callback The function to call for each base class in the hierarchy.\r\n * @param arg An argument that will be passed as the second parameter to the callback function.\r\n */\r\n public async traverseBaseClasses(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): Promise<boolean> {\r\n for await (const baseClass of this.getAllBaseClasses()) {\r\n if (callback(baseClass, arg))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Synchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\r\n * function for each base class encountered.\r\n * @param callback The function to call for each base class in the hierarchy.\r\n * @param arg An argument that will be passed as the second parameter to the callback function.\r\n */\r\n public traverseBaseClassesSync(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): boolean {\r\n const baseClasses = this.getAllBaseClassesSync();\r\n if (!baseClasses)\r\n return false;\r\n\r\n for (const baseClass of baseClasses) {\r\n if (callback(baseClass, arg))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if the targetClass is of this type.\r\n * @param targetClass The ECClass or ECClass name to check.\r\n * @param schemaName The schema name. Required if targetClass is the ECClass name.\r\n */\r\n public async is(targetClass: string, schemaName: string): Promise<boolean>;\r\n public async is(targetClass: ECClass): Promise<boolean>;\r\n public async is(targetClass: ECClass | string, schemaName?: string): Promise<boolean> {\r\n if (schemaName !== undefined) {\r\n assert(typeof (targetClass) === \"string\", \"Expected targetClass of type string because schemaName was specified\");\r\n\r\n const key = new SchemaItemKey(targetClass, new SchemaKey(schemaName));\r\n if (SchemaItem.equalByKey(this, key))\r\n return true;\r\n\r\n return this.traverseBaseClasses((thisSchemaItem, thatSchemaItemOrKey) => SchemaItem.equalByKey(thisSchemaItem, thatSchemaItemOrKey), key);\r\n } else {\r\n assert(ECClass.isECClass(targetClass), \"Expected targetClass to be of type ECClass\");\r\n\r\n if (SchemaItem.equalByKey(this, targetClass))\r\n return true;\r\n\r\n return this.traverseBaseClasses((thisSchemaItem, thatSchemaItemOrKey) => SchemaItem.equalByKey(thisSchemaItem, thatSchemaItemOrKey), targetClass);\r\n }\r\n }\r\n\r\n /**\r\n * A synchronous version of the [[ECClass.is]], indicating if the targetClass is of this type.\r\n * @param targetClass The class to check.\r\n */\r\n public isSync(targetClass: ECClass): boolean;\r\n public isSync(targetClass: string, schemaName: string): boolean;\r\n\r\n /** @internal */\r\n public isSync(targetClass: ECClass | string, schemaName?: string): boolean {\r\n if (schemaName !== undefined) {\r\n assert(typeof (targetClass) === \"string\", \"Expected targetClass of type string because schemaName was specified\");\r\n\r\n const key = new SchemaItemKey(targetClass, new SchemaKey(schemaName));\r\n if (SchemaItem.equalByKey(this, key))\r\n return true;\r\n\r\n return this.traverseBaseClassesSync((thisSchemaItem, thatSchemaItemOrKey) => SchemaItem.equalByKey(thisSchemaItem, thatSchemaItemOrKey), key);\r\n } else {\r\n assert(ECClass.isECClass(targetClass), \"Expected targetClass to be of type ECClass\");\r\n\r\n if (SchemaItem.equalByKey(this, targetClass))\r\n return true;\r\n\r\n return this.traverseBaseClassesSync((thisSchemaItem, thatSchemaItemOrKey) => SchemaItem.equalByKey(thisSchemaItem, thatSchemaItemOrKey), targetClass);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isECClass(object: any): object is ECClass {\r\n if (!SchemaItem.isSchemaItem(object))\r\n return false;\r\n\r\n return object.schemaItemType === SchemaItemType.EntityClass || object.schemaItemType === SchemaItemType.Mixin || object.schemaItemType === SchemaItemType.RelationshipClass ||\r\n object.schemaItemType === SchemaItemType.StructClass || object.schemaItemType === SchemaItemType.CustomAttributeClass;\r\n }\r\n\r\n /**\r\n * A setter method for the ECClass modifier, used specifically for schema editing.\r\n * @param modifier\r\n * @internal\r\n */\r\n protected setModifier(modifier: ECClassModifier) {\r\n this._modifier = modifier;\r\n }\r\n\r\n /**\r\n * Adds an ECClass to the derived class collection. This method is only intended to update the local\r\n * cache of derived classes. For adding a class to the hierarchy, use the baseClass setter method.\r\n * @param prop The property to add.\r\n * @return The property that was added.\r\n */\r\n private addDerivedClass(baseClass: ECClass, derivedClass: ECClass) {\r\n if (!baseClass._derivedClasses)\r\n baseClass._derivedClasses = new Map<string, LazyLoadedECClass>();\r\n\r\n if (baseClass._derivedClasses.has(derivedClass.fullName))\r\n return;\r\n\r\n if (derivedClass.isSync(baseClass)) {\r\n const promise = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(derivedClass.key, async () => derivedClass);\r\n baseClass._derivedClasses.set(derivedClass.fullName, promise);\r\n }\r\n }\r\n\r\n /**\r\n * Removes an ECClass from the derived class collection. This method is only intended to update the local\r\n * cache of derived classes. For updating the class hierarchy, use the baseClass setter method.\r\n * @param prop The property to add.\r\n * @return The property that was added.\r\n */\r\n private removeDerivedClass(baseClass: ECClass, derivedClass: ECClass) {\r\n if (!baseClass._derivedClasses)\r\n return;\r\n\r\n if (!baseClass._derivedClasses.has(derivedClass.fullName))\r\n return;\r\n\r\n baseClass._derivedClasses.delete(derivedClass.fullName);\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of an ECStructClass.\r\n * @public @preview\r\n */\r\nexport class StructClass extends ECClass {\r\n /**\r\n * Get the type of item represented by this instance\r\n */\r\n public override readonly schemaItemType = StructClass.schemaItemType;\r\n\r\n /**\r\n * Get the type of item represented by this class\r\n * @internal\r\n */\r\n public static override get schemaItemType() { return SchemaItemType.StructClass; }\r\n /**\r\n * Type guard to check if the SchemaItem is of type StructClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a StructClass, false otherwise.\r\n */\r\n public static isStructClass(item?: SchemaItem): item is StructClass {\r\n if (item && item.schemaItemType === SchemaItemType.StructClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type StructClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to StructClass if it is a StructClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsStructClass(item?: SchemaItem): asserts item is StructClass {\r\n if (!this.isStructClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableStructClass extends StructClass {\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableClass extends ECClass {\r\n public abstract override setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override setModifier(modifier: ECClassModifier): void;\r\n public abstract override setName(name: string): void;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\r\n\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\r\n\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\r\n\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\r\n\r\n public abstract override createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;\r\n public abstract override createStructPropertySync(name: string, structType: string | StructClass): StructProperty;\r\n\r\n public abstract override createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;\r\n public abstract override createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;\r\n\r\n public abstract override deleteProperty(name: string): Promise<void>;\r\n public abstract override deletePropertySync(name: string): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Class.js","sourceRoot":"","sources":["../../../src/Metadata/Class.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,cAAc,CAAC;AAC9L,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAsE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAClI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,wBAAwB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAY,mBAAmB,EAAE,cAAc,GACxI,MAAM,YAAY,CAAC;AAEpB,OAA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,aAAa,cAAc,CAAC,WAAW,iBAAiB,CAAC,CAAC;IAC5H,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,WAAW;CAE3D;AAED;;;GAGG;AACH,MAAM,OAAgB,YAAa,SAAQ,OAAO;CA6BjD","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { ClassProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { AbstractSchemaItemType, classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType, SupportedSchemaItemType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { AnyClass, LazyLoadedECClass } from \"../Interfaces\";\r\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\r\nimport { Enumeration } from \"./Enumeration\";\r\nimport {\r\n EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, Property, StructArrayProperty, StructProperty,\r\n} from \"./Property\";\r\nimport { Schema } from \"./Schema\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\r\n\r\n/**\r\n * A common abstract class for all of the ECClass types.\r\n * @public @preview\r\n */\r\nexport abstract class ECClass extends SchemaItem implements CustomAttributeContainerProps {\r\n /** @internal */\r\n public static override get schemaItemType(): SupportedSchemaItemType { return AbstractSchemaItemType.Class; } // need this so getItem(\"name\", ECClass) in schema works\r\n private _modifier: ECClassModifier;\r\n private _baseClass?: LazyLoadedECClass;\r\n private _properties?: Map<string, Property>;\r\n private _customAttributes?: Map<string, CustomAttribute>;\r\n private _mergedPropertyCache?: Map<string, Property>;\r\n\r\n public get modifier() { return this._modifier; }\r\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\r\n\r\n /** @internal */\r\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\r\n super(schema, name);\r\n\r\n if (modifier)\r\n this._modifier = modifier;\r\n else\r\n this._modifier = ECClassModifier.None;\r\n }\r\n\r\n /**\r\n * Gets the base class if it exists, otherwise returns undefined.\r\n */\r\n public get baseClass(): LazyLoadedECClass | undefined {\r\n return this._baseClass;\r\n }\r\n\r\n public getBaseClassSync(): ECClass | undefined {\r\n if (!this.baseClass) {\r\n return undefined;\r\n }\r\n\r\n return this.schema.lookupItemSync(this.baseClass, ECClass);\r\n }\r\n\r\n /**\r\n * Sets the base class of the ECClass. Pass undefined to 'remove' the base class.\r\n *\r\n * @internal\r\n */\r\n protected async setBaseClass(baseClass: LazyLoadedECClass | undefined) {\r\n const oldBaseClass = this._baseClass;\r\n this._baseClass = baseClass;\r\n\r\n if (baseClass)\r\n this.schema.context.classHierarchy.addBaseClass(this.key, baseClass);\r\n else if (oldBaseClass)\r\n this.schema.context.classHierarchy.removeBaseClass(this.key, oldBaseClass);\r\n }\r\n\r\n /**\r\n * Gets the derived classes belonging to this class.\r\n * @returns An array of ECClasses or undefined if no derived classes exist.\r\n */\r\n public async getDerivedClasses(): Promise<ECClass[] | undefined> {\r\n const derivedClasses: ECClass[] = [];\r\n for(const derivedClassKey of this.schema.context.classHierarchy.getDerivedClassKeys(this.key)) {\r\n const derivedClass = await this.schema.context.getSchemaItem(derivedClassKey, ECClass);\r\n if (derivedClass)\r\n derivedClasses.push(derivedClass);\r\n }\r\n\r\n if (derivedClasses.length === 0)\r\n return undefined;\r\n\r\n return derivedClasses;\r\n }\r\n\r\n /**\r\n * Convenience method for adding an already loaded ECProperty used by create*Property methods.\r\n * @param prop The property to add.\r\n * @return The property that was added.\r\n *\r\n * @internal\r\n */\r\n protected addProperty<T extends Property>(prop: T): T {\r\n if (!this._properties)\r\n this._properties = new Map<string, Property>();\r\n\r\n this._properties.set(prop.name.toUpperCase(), prop);\r\n this.cleanCache();\r\n return prop;\r\n }\r\n\r\n /**\r\n * Deletes a property from within this class.\r\n * @param name The property name to delete, lookup is case-insensitive\r\n * @internal\r\n */\r\n protected async deleteProperty(name: string): Promise<void> {\r\n if (this._properties) {\r\n const property = await this.getProperty(name);\r\n if (property) {\r\n this._properties.delete(name.toUpperCase());\r\n this.cleanCache();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Deletes a property from within this class.\r\n * @param name The property name to delete, lookup is case-insensitive\r\n * @internal\r\n */\r\n protected deletePropertySync(name: string): void {\r\n if (this._properties) {\r\n const property = this.getPropertySync(name);\r\n if (property) {\r\n this._properties.delete(name.toUpperCase());\r\n this.cleanCache();\r\n }\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Searches, case-insensitive, for an ECProperty with given the name on this class and, by default, on\r\n * all base classes. Set excludeInherited to 'true' to only search the local class.\r\n * @param name The name of the property to retrieve.\r\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\r\n */\r\n public async getProperty(name: string, excludeInherited?: boolean): Promise<Property | undefined> {\r\n const upperKey = name.toUpperCase();\r\n let property: Property | undefined;\r\n\r\n if (this._properties) {\r\n property = this._properties.get(upperKey);\r\n if (property) {\r\n return property;\r\n }\r\n }\r\n\r\n if (excludeInherited) {\r\n return undefined;\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = await this.buildPropertyCache();\r\n }\r\n\r\n return this._mergedPropertyCache.get(upperKey);\r\n }\r\n\r\n /**\r\n * Searches, case-insensitive, for a local ECProperty with the name provided.\r\n * @param name The name of the property to retrieve.\r\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\r\n */\r\n public getPropertySync(name: string, excludeInherited?: boolean): Property | undefined {\r\n const upperKey = name.toUpperCase();\r\n let property: Property | undefined;\r\n\r\n if (this._properties) {\r\n property = this._properties.get(upperKey);\r\n if (property) {\r\n return property;\r\n }\r\n }\r\n\r\n if (excludeInherited) {\r\n return undefined;\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = this.buildPropertyCacheSync();\r\n }\r\n\r\n return this._mergedPropertyCache.get(upperKey);\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, for the property with the name provided.\r\n * @param name The name of the inherited property to find.\r\n */\r\n public async getInheritedProperty(name: string): Promise<Property | undefined> {\r\n if (this.baseClass) {\r\n const baseClassObj = await this.baseClass;\r\n return baseClassObj.getProperty(name);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, for the property with the name provided.\r\n * @param name The name of the inherited property to find.\r\n */\r\n public getInheritedPropertySync(name: string): Property | undefined {\r\n const baseClassObj = this.getBaseClassSync();\r\n if (baseClassObj)\r\n return baseClassObj.getPropertySync(name);\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\r\n *\r\n * @internal\r\n */\r\n protected async createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\r\n protected async createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\r\n protected async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\r\n *\r\n * @internal\r\n */\r\n protected createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\r\n protected createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\r\n protected createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveArrayECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n *\r\n * @internal\r\n */\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\r\n protected async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n * Creates a PrimitiveArrayECProperty.\r\n * @param name The name of property to create.\r\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\r\n *\r\n * @internal\r\n */\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\r\n protected createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\r\n if (typeof (propType) === \"number\")\r\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\r\n\r\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name The name of property to create.\r\n * @param structType The struct type of property to create.\r\n *\r\n * @internal\r\n */\r\n protected async createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructProperty(this, name, await this.loadStructType(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name The name of property to create.\r\n * @param structType The struct type of property to create.\r\n *\r\n * @internal\r\n */\r\n protected createStructPropertySync(name: string, structType: string | StructClass): StructProperty {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param type\r\n *\r\n * @internal\r\n */\r\n protected async createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty> {\r\n if (await this.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructArrayProperty(this, name, await this.loadStructType(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param type\r\n *\r\n * @internal\r\n */\r\n protected createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty {\r\n if (this.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\r\n\r\n return this.addProperty(new StructArrayProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\r\n }\r\n\r\n /**\r\n *\r\n * @param structType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected async loadStructType(structType: string | StructClass | undefined, schema: Schema): Promise<StructClass> {\r\n let correctType: StructClass | undefined;\r\n if (typeof (structType) === \"string\") {\r\n correctType = await schema.lookupItem(structType, StructClass);\r\n } else\r\n correctType = structType;\r\n\r\n if (!correctType)\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\r\n\r\n return correctType;\r\n }\r\n\r\n /**\r\n *\r\n * @param structType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected loadStructTypeSync(structType: string | StructClass | undefined, schema: Schema): StructClass {\r\n let correctType: StructClass | undefined;\r\n if (typeof (structType) === \"string\") {\r\n correctType = schema.lookupItemSync(structType, StructClass);\r\n } else\r\n correctType = structType;\r\n\r\n if (!correctType)\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\r\n\r\n return correctType;\r\n }\r\n\r\n /**\r\n *\r\n * @param primitiveType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected async loadPrimitiveType(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): Promise<PrimitiveType | Enumeration> {\r\n if (primitiveType === undefined)\r\n return PrimitiveType.Integer;\r\n\r\n if (typeof (primitiveType) === \"string\") {\r\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\r\n if (!resolvedType) {\r\n resolvedType = await schema.lookupItem(primitiveType, Enumeration);\r\n }\r\n\r\n if (resolvedType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n // If resolvedType is a SchemaItem, make sure it is an Enumeration- if not, throw an error\r\n if (typeof (resolvedType) !== \"number\" && resolvedType.schemaItemType !== SchemaItemType.Enumeration)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n return resolvedType;\r\n }\r\n\r\n return primitiveType;\r\n }\r\n\r\n /**\r\n *\r\n * @param primitiveType\r\n * @param schema\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected loadPrimitiveTypeSync(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): PrimitiveType | Enumeration {\r\n if (primitiveType === undefined)\r\n return PrimitiveType.Integer;\r\n\r\n if (typeof (primitiveType) === \"string\") {\r\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\r\n if (!resolvedType) {\r\n resolvedType = schema.lookupItemSync(primitiveType, Enumeration);\r\n }\r\n\r\n if (resolvedType === undefined)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\r\n\r\n return resolvedType;\r\n }\r\n\r\n return primitiveType;\r\n }\r\n\r\n /**\r\n * Save this Classes properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): ClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n const isMixin = SchemaItemType.Mixin === this.schemaItemType;\r\n const isRelationship = SchemaItemType.RelationshipClass === this.schemaItemType;\r\n if (!isMixin && (ECClassModifier.None !== this.modifier || isRelationship))\r\n schemaJson.modifier = classModifierToString(this.modifier);\r\n if (this.baseClass !== undefined)\r\n schemaJson.baseClass = this.baseClass.fullName;\r\n if (this._properties !== undefined && this._properties.size > 0)\r\n schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());\r\n\r\n const customAttributes = serializeCustomAttributes(this.customAttributes);\r\n if (customAttributes !== undefined)\r\n schemaJson.customAttributes = customAttributes;\r\n return schemaJson as ClassProps;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n if (undefined !== this.modifier)\r\n itemElement.setAttribute(\"modifier\", classModifierToString(this.modifier));\r\n\r\n if (undefined !== this.baseClass) {\r\n const baseClass = await this.baseClass;\r\n const baseClassElement = schemaXml.createElement(\"BaseClass\");\r\n const baseClassName = XmlSerializationUtils.createXmlTypedName(this.schema, baseClass.schema, baseClass.name);\r\n baseClassElement.textContent = baseClassName;\r\n itemElement.appendChild(baseClassElement);\r\n }\r\n\r\n if (this._properties) {\r\n for (const prop of this._properties.values()) {\r\n const propXml = await prop.toXml(schemaXml);\r\n itemElement.appendChild(propXml);\r\n }\r\n }\r\n\r\n if (this._customAttributes) {\r\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\r\n for (const [name, attribute] of this._customAttributes) {\r\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\r\n caContainerElement.appendChild(caElement);\r\n }\r\n itemElement.appendChild(caContainerElement);\r\n }\r\n\r\n return itemElement;\r\n }\r\n\r\n public override fromJSONSync(classProps: ClassProps) {\r\n super.fromJSONSync(classProps);\r\n\r\n if (undefined !== classProps.modifier) {\r\n const modifier = parseClassModifier(classProps.modifier);\r\n if (undefined === modifier) {\r\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: classProps.originalECSpecMajorVersion, writeVersion: classProps.originalECSpecMinorVersion } as ECSpecVersion))\r\n this._modifier = ECClassModifier.None;\r\n else\r\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, `The string '${classProps.modifier}' is not a valid ECClassModifier.`);\r\n } else {\r\n this._modifier = modifier;\r\n }\r\n }\r\n\r\n if (undefined !== classProps.baseClass) {\r\n const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);\r\n if (!ecClassSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\r\n\r\n const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);\r\n\r\n let lazyBase: LazyLoadedECClass;\r\n if (!baseClass) {\r\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\r\n async () => {\r\n const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);\r\n if (undefined === baseItem || !ECClass.isECClass(baseItem))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\r\n return baseItem;\r\n });\r\n } else {\r\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\r\n async () => {\r\n return baseClass as ECClass;\r\n });\r\n }\r\n\r\n this._baseClass = lazyBase;\r\n this.schema.context.classHierarchy.addBaseClass(this.key, lazyBase);\r\n }\r\n }\r\n\r\n public override async fromJSON(classProps: ClassProps): Promise<void> {\r\n this.fromJSONSync(classProps);\r\n }\r\n\r\n /**\r\n *\r\n * @param customAttribute\r\n *\r\n * @internal\r\n */\r\n protected addCustomAttribute(customAttribute: CustomAttribute) {\r\n if (!this._customAttributes)\r\n this._customAttributes = new Map<string, CustomAttribute>();\r\n\r\n this._customAttributes.set(customAttribute.className, customAttribute);\r\n }\r\n\r\n /**\r\n * Iterates (recursively) over all base classes and mixins, in \"property override\" order.\r\n * This is essentially a depth-first traversal through the inheritance tree.\r\n */\r\n public async *getAllBaseClasses(): AsyncIterable<ECClass> {\r\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\r\n const baseClass = await this.schema.lookupItem(baseClassKey, ECClass);\r\n if (baseClass)\r\n yield baseClass;\r\n }\r\n }\r\n\r\n public *getAllBaseClassesSync(): Iterable<AnyClass> {\r\n for(const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\r\n const baseClass = this.schema.lookupItemSync(baseClassKey, ECClass);\r\n if (baseClass)\r\n yield baseClass;\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\nprotected async buildPropertyCache(): Promise<Map<string, Property>> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = await this.baseClass;\r\n if (baseClass) {\r\n for (const property of await baseClass.getProperties()) {\r\n if (!cache.has(property.name.toUpperCase())) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n }\r\n\r\n if (this._properties) {\r\n this._properties.forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n}\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\n protected buildPropertyCacheSync(): Map<string, Property> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = this.getBaseClassSync();\r\n if (baseClass) {\r\n for (const property of baseClass.getPropertiesSync()) {\r\n if (!cache.has(property.name.toUpperCase())) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n }\r\n\r\n if (this._properties) {\r\n this._properties.forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n }\r\n\r\n /**\r\n * Clears all caches on this object. This is called implicitly for this class,\r\n * but needs to be called if derived classes have changed.\r\n * @internal\r\n */\r\n public cleanCache() {\r\n this._mergedPropertyCache = undefined;\r\n }\r\n\r\n /**\r\n * Returns the properties on this class and its base classes.\r\n * Since this is an expensive operation, results will be cached after first call.\r\n * @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.\r\n * @returns An array of properties, empty array if none exist.\r\n */\r\n public getPropertiesSync(excludeInherited?: boolean): Iterable<Property> {\r\n if (excludeInherited) {\r\n return this._properties && this._properties.size > 0 ? this._properties.values() : [];\r\n }\r\n\r\n if (!this._mergedPropertyCache) {\r\n this._mergedPropertyCache = this.buildPropertyCacheSync();\r\n }\r\n\r\n return this._mergedPropertyCache.values();\r\n }\r\n\r\n /**\r\n * Quick way to check whether this class has any local properties without having to use the iterable\r\n */\r\n public get hasLocalProperties(): boolean {\r\n return this._properties !== undefined && this._properties.size > 0;\r\n }\r\n\r\n /**\r\n * Returns the properties on this class and its base classes.\r\n * Since this is an expensive operation, results will be cached after first call.\r\n * @param excludeInherited If true, only properties defined directly on this class will be returned.\r\n * @returns An array of properties, empty array if none exist.\r\n */\r\n public async getProperties(excludeInherited?: boolean): Promise<Iterable<Property>> {\r\n // At the moment we do not lazy load properties, so this is the same as getPropertiesSync\r\n return this.getPropertiesSync(excludeInherited);\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current class and its bases\r\n * This is the async version of getCustomAttributesSync()\r\n */\r\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\r\n return this.getCustomAttributesSync();\r\n }\r\n\r\n /**\r\n * Retrieve all custom attributes in the current class and its bases.\r\n */\r\n public getCustomAttributesSync(): CustomAttributeSet {\r\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\r\n if (undefined === customAttributes) {\r\n customAttributes = new Map<string, CustomAttribute>();\r\n }\r\n\r\n this.traverseBaseClassesSync((ecClass: ECClass) => {\r\n if (undefined === ecClass.customAttributes)\r\n return false;\r\n\r\n for (const [className, customAttribute] of ecClass.customAttributes) {\r\n if (customAttributes.has(className))\r\n continue;\r\n customAttributes.set(className, customAttribute);\r\n }\r\n\r\n return false;\r\n });\r\n\r\n return customAttributes;\r\n }\r\n\r\n /**\r\n * Asynchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\r\n * function for each base class encountered.\r\n * @param callback The function to call for each base class in the hierarchy.\r\n * @param arg An argument that will be passed as the second parameter to the callback function.\r\n */\r\n public async traverseBaseClasses(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): Promise<boolean> {\r\n for await (const baseClass of this.getAllBaseClasses()) {\r\n if (callback(baseClass, arg))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Synchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\r\n * function for each base class encountered.\r\n * @param callback The function to call for each base class in the hierarchy.\r\n * @param arg An argument that will be passed as the second parameter to the callback function.\r\n */\r\n public traverseBaseClassesSync(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): boolean {\r\n const baseClasses = this.getAllBaseClassesSync();\r\n if (!baseClasses)\r\n return false;\r\n\r\n for (const baseClass of baseClasses) {\r\n if (callback(baseClass, arg))\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Indicates if the targetClass is of this type.\r\n * @param targetClass The ECClass or ECClass name to check.\r\n * @param schemaName The schema name. Required if targetClass is the ECClass name.\r\n */\r\n public async is(targetClass: string, schemaName: string): Promise<boolean>;\r\n public async is(targetClass: ECClass): Promise<boolean>;\r\n public async is(targetClass: ECClass | string, schemaName?: string): Promise<boolean> {\r\n return typeof targetClass === \"string\"\r\n ? this.isSync(targetClass, schemaName ?? \"\")\r\n : this.isSync(targetClass);\r\n }\r\n\r\n /**\r\n * A synchronous version of the [[ECClass.is]], indicating if the targetClass is of this type.\r\n * @param targetClass The class to check.\r\n */\r\n public isSync(targetClass: ECClass): boolean;\r\n public isSync(targetClass: string, schemaName: string): boolean;\r\n\r\n /** @internal */\r\n public isSync(targetClass: ECClass | string, schemaName?: string): boolean {\r\n let targetSchemaKey: SchemaItemKey | undefined;\r\n if (schemaName !== undefined) {\r\n assert(typeof (targetClass) === \"string\", \"Expected targetClass of type string because schemaName was specified\");\r\n\r\n targetSchemaKey = new SchemaItemKey(targetClass, new SchemaKey(schemaName));\r\n if (SchemaItem.equalByKey(this, targetSchemaKey))\r\n return true;\r\n\r\n } else {\r\n assert(ECClass.isECClass(targetClass), \"Expected targetClass to be of type ECClass\");\r\n\r\n if (SchemaItem.equalByKey(this, targetClass))\r\n return true;\r\n\r\n targetSchemaKey = targetClass.key;\r\n }\r\n\r\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\r\n if(baseClassKey.matchesFullName(targetSchemaKey.fullName)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static isECClass(object: any): object is ECClass {\r\n if (!SchemaItem.isSchemaItem(object))\r\n return false;\r\n\r\n return object.schemaItemType === SchemaItemType.EntityClass || object.schemaItemType === SchemaItemType.Mixin || object.schemaItemType === SchemaItemType.RelationshipClass ||\r\n object.schemaItemType === SchemaItemType.StructClass || object.schemaItemType === SchemaItemType.CustomAttributeClass;\r\n }\r\n\r\n /**\r\n * A setter method for the ECClass modifier, used specifically for schema editing.\r\n * @param modifier\r\n * @internal\r\n */\r\n protected setModifier(modifier: ECClassModifier) {\r\n this._modifier = modifier;\r\n }\r\n}\r\n\r\n/**\r\n * A Typescript class representation of an ECStructClass.\r\n * @public @preview\r\n */\r\nexport class StructClass extends ECClass {\r\n /**\r\n * Get the type of item represented by this instance\r\n */\r\n public override readonly schemaItemType = StructClass.schemaItemType;\r\n\r\n /**\r\n * Get the type of item represented by this class\r\n * @internal\r\n */\r\n public static override get schemaItemType() { return SchemaItemType.StructClass; }\r\n /**\r\n * Type guard to check if the SchemaItem is of type StructClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is a StructClass, false otherwise.\r\n */\r\n public static isStructClass(item?: SchemaItem): item is StructClass {\r\n if (item && item.schemaItemType === SchemaItemType.StructClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type StructClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to StructClass if it is a StructClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsStructClass(item?: SchemaItem): asserts item is StructClass {\r\n if (!this.isStructClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * An abstract class used for schema editing.\r\n */\r\nexport abstract class MutableStructClass extends StructClass {\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableClass extends ECClass {\r\n public abstract override setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;\r\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\r\n public abstract override setModifier(modifier: ECClassModifier): void;\r\n public abstract override setName(name: string): void;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\r\n public abstract override createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\r\n\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\r\n public abstract override createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\r\n\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\r\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\r\n\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\r\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\r\n\r\n public abstract override createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;\r\n public abstract override createStructPropertySync(name: string, structType: string | StructClass): StructProperty;\r\n\r\n public abstract override createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;\r\n public abstract override createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;\r\n\r\n public abstract override deleteProperty(name: string): Promise<void>;\r\n public abstract override deletePropertySync(name: string): void;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityClass.d.ts","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAA0B,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,YA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;GAGG;AACH,8BAAsB,kBAAmB,SAAQ,WAAW;aACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG;aAC3B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;aACpJ,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,kBAAkB;aAC/I,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;CACrE;AAED,gBAAgB;AAChB,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsB3L;AAED,gBAAgB;AAChB,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB,GAAG,kBAAkB,CAsBhL"}
|
|
@@ -45,6 +45,7 @@ export class EntityClass extends ECClass {
|
|
|
45
45
|
addMixin(mixin) {
|
|
46
46
|
if (!this._mixins)
|
|
47
47
|
this._mixins = [];
|
|
48
|
+
this.schema.context.classHierarchy.addBaseClass(this.key, mixin.key, true);
|
|
48
49
|
this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
@@ -202,6 +203,7 @@ export class EntityClass extends ECClass {
|
|
|
202
203
|
if (!mixinSchemaItemKey)
|
|
203
204
|
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin ("${name}") that cannot be found.`);
|
|
204
205
|
if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {
|
|
206
|
+
this.schema.context.classHierarchy.addBaseClass(this.key, mixinSchemaItemKey, true);
|
|
205
207
|
this._mixins.push(new DelayedPromiseWithProps(mixinSchemaItemKey, async () => {
|
|
206
208
|
const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);
|
|
207
209
|
if (undefined === mixin)
|
|
@@ -1 +1 @@
|
|
|
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,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAqB;IAEpC,IAAW,MAAM;QACf,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,CAAC,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO;QAET,K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,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * A Typescript class representation of an ECEntityClass.\r\n * @public @preview\r\n */\r\nexport class EntityClass extends ECClass implements HasMixins {\r\n public override readonly schemaItemType = EntityClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\r\n private _mixins?: LazyLoadedMixin[];\r\n\r\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\r\n if (!this._mixins)\r\n return [];\r\n return this._mixins;\r\n }\r\n\r\n public *getMixinsSync(): Iterable<Mixin> {\r\n if (!this._mixins)\r\n return;\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\r\n if (mObj) {\r\n yield mObj;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param mixin\r\n * @internal\r\n */\r\n protected addMixin(mixin: Mixin) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n\r\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\r\n return;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\r\n let inheritedProperty = await super.getInheritedProperty(name);\r\n\r\n if (!inheritedProperty && this._mixins) {\r\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\r\n mixinProps.some((prop) => {\r\n inheritedProperty = prop as AnyProperty;\r\n return inheritedProperty !== undefined;\r\n });\r\n }\r\n\r\n return inheritedProperty as AnyProperty | undefined;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override getInheritedPropertySync(name: string): Property | undefined {\r\n const inheritedProperty = super.getInheritedPropertySync(name);\r\n if (inheritedProperty)\r\n return inheritedProperty;\r\n\r\n if (!this._mixins) {\r\n return undefined;\r\n }\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin);\r\n if (mObj && ECClass.isECClass(mObj)) {\r\n const result = mObj.getPropertySync(name, true);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\nprotected override async buildPropertyCache(): Promise<Map<string, Property>> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = await this.baseClass;\r\n if (baseClass) {\r\n for (const property of await baseClass.getProperties()) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n for (const mixin of this.mixins) {\r\n const mixinObj = await mixin;\r\n const mixinProps = mixinObj.getPropertiesSync();\r\n for (const property of mixinProps) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n const localProps = await this.getProperties(true);\r\n if (localProps) {\r\n for (const property of localProps) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n return cache;\r\n}\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @internal\r\n */\r\n protected override buildPropertyCacheSync(): Map<string, Property> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = this.getBaseClassSync();\r\n if (baseClass) {\r\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n\r\n for (const mixin of this.getMixinsSync()) {\r\n const mixinProps = mixin.getPropertiesSync();\r\n for (const property of mixinProps) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n const localProps = this.getPropertiesSync(true);\r\n if (localProps) {\r\n Array.from(localProps).forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * Save this EntityClass' properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n if (this.mixins.length > 0)\r\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n for (const lazyMixin of this.mixins) {\r\n const mixin = await lazyMixin;\r\n const mixinElement = schemaXml.createElement(\"BaseClass\");\r\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\r\n mixinElement.textContent = mixinName;\r\n itemElement.appendChild(mixinElement);\r\n }\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(entityClassProps: EntityClassProps) {\r\n this.fromJSONSync(entityClassProps);\r\n }\r\n\r\n public override fromJSONSync(entityClassProps: EntityClassProps) {\r\n super.fromJSONSync(entityClassProps);\r\n\r\n if (undefined !== entityClassProps.mixins) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n for (const name of entityClassProps.mixins) {\r\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\r\n if (!mixinSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n\r\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\r\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\r\n async () => {\r\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\r\n if (undefined === mixin)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n return mixin;\r\n }));\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is an EntityClass, false otherwise.\r\n */\r\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\r\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\r\n if (!this.isEntityClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableEntityClass extends EntityClass {\r\n public abstract override addMixin(mixin: Mixin): any;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n if (await ecClass.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n\r\n/** @internal */\r\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n if (ecClass.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\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,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAqB;IAEpC,I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C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Metadata\r\n */\r\n\r\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\r\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\r\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\r\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\nimport { ECClass } from \"./Class\";\r\nimport { Mixin } from \"./Mixin\";\r\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\r\nimport { RelationshipClass } from \"./RelationshipClass\";\r\nimport { SchemaItem } from \"./SchemaItem\";\r\n\r\n/**\r\n * A Typescript class representation of an ECEntityClass.\r\n * @public @preview\r\n */\r\nexport class EntityClass extends ECClass implements HasMixins {\r\n public override readonly schemaItemType = EntityClass.schemaItemType;\r\n /** @internal */\r\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\r\n private _mixins?: LazyLoadedMixin[];\r\n\r\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\r\n if (!this._mixins)\r\n return [];\r\n return this._mixins;\r\n }\r\n\r\n public *getMixinsSync(): Iterable<Mixin> {\r\n if (!this._mixins)\r\n return;\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\r\n if (mObj) {\r\n yield mObj;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param mixin\r\n * @internal\r\n */\r\n protected addMixin(mixin: Mixin) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n\r\n this.schema.context.classHierarchy.addBaseClass(this.key, mixin.key, true);\r\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\r\n return;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\r\n let inheritedProperty = await super.getInheritedProperty(name);\r\n\r\n if (!inheritedProperty && this._mixins) {\r\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\r\n mixinProps.some((prop) => {\r\n inheritedProperty = prop as AnyProperty;\r\n return inheritedProperty !== undefined;\r\n });\r\n }\r\n\r\n return inheritedProperty as AnyProperty | undefined;\r\n }\r\n\r\n /**\r\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\r\n * @param name The name of the property to find.\r\n */\r\n public override getInheritedPropertySync(name: string): Property | undefined {\r\n const inheritedProperty = super.getInheritedPropertySync(name);\r\n if (inheritedProperty)\r\n return inheritedProperty;\r\n\r\n if (!this._mixins) {\r\n return undefined;\r\n }\r\n\r\n for (const mixin of this._mixins) {\r\n const mObj = this.schema.lookupItemSync(mixin);\r\n if (mObj && ECClass.isECClass(mObj)) {\r\n const result = mObj.getPropertySync(name, true);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @returns\r\n *\r\n * @internal\r\n */\r\nprotected override async buildPropertyCache(): Promise<Map<string, Property>> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = await this.baseClass;\r\n if (baseClass) {\r\n for (const property of await baseClass.getProperties()) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n for (const mixin of this.mixins) {\r\n const mixinObj = await mixin;\r\n const mixinProps = mixinObj.getPropertiesSync();\r\n for (const property of mixinProps) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n const localProps = await this.getProperties(true);\r\n if (localProps) {\r\n for (const property of localProps) {\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n return cache;\r\n}\r\n\r\n /**\r\n *\r\n * @param cache\r\n * @internal\r\n */\r\n protected override buildPropertyCacheSync(): Map<string, Property> {\r\n const cache = new Map<string, Property>();\r\n const baseClass = this.getBaseClassSync();\r\n if (baseClass) {\r\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n\r\n for (const mixin of this.getMixinsSync()) {\r\n const mixinProps = mixin.getPropertiesSync();\r\n for (const property of mixinProps) {\r\n if (!cache.has(property.name.toUpperCase()))\r\n cache.set(property.name.toUpperCase(), property);\r\n }\r\n }\r\n\r\n const localProps = this.getPropertiesSync(true);\r\n if (localProps) {\r\n Array.from(localProps).forEach(property => {\r\n cache.set(property.name.toUpperCase(), property);\r\n });\r\n }\r\n return cache;\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n *\r\n * @param name\r\n * @param relationship\r\n * @param direction\r\n * @internal\r\n */\r\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\r\n }\r\n\r\n /**\r\n * Save this EntityClass' properties to an object for serializing to JSON.\r\n * @param standalone Serialization includes only this object (as opposed to the full schema).\r\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\r\n */\r\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\r\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\r\n if (this.mixins.length > 0)\r\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\r\n return schemaJson;\r\n }\r\n\r\n /** @internal */\r\n public override async toXml(schemaXml: Document): Promise<Element> {\r\n const itemElement = await super.toXml(schemaXml);\r\n\r\n for (const lazyMixin of this.mixins) {\r\n const mixin = await lazyMixin;\r\n const mixinElement = schemaXml.createElement(\"BaseClass\");\r\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\r\n mixinElement.textContent = mixinName;\r\n itemElement.appendChild(mixinElement);\r\n }\r\n return itemElement;\r\n }\r\n\r\n public override async fromJSON(entityClassProps: EntityClassProps) {\r\n this.fromJSONSync(entityClassProps);\r\n }\r\n\r\n public override fromJSONSync(entityClassProps: EntityClassProps) {\r\n super.fromJSONSync(entityClassProps);\r\n\r\n if (undefined !== entityClassProps.mixins) {\r\n if (!this._mixins)\r\n this._mixins = [];\r\n for (const name of entityClassProps.mixins) {\r\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\r\n if (!mixinSchemaItemKey)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n\r\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\r\n this.schema.context.classHierarchy.addBaseClass(this.key, mixinSchemaItemKey, true);\r\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\r\n async () => {\r\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\r\n if (undefined === mixin)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\r\n return mixin;\r\n }));\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Type guard to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns True if the item is an EntityClass, false otherwise.\r\n */\r\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\r\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\r\n return true;\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Type assertion to check if the SchemaItem is of type EntityClass.\r\n * @param item The SchemaItem to check.\r\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\r\n * @internal\r\n */\r\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\r\n if (!this.isEntityClass(item))\r\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\r\n }\r\n}\r\n\r\n/**\r\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\r\n * @internal\r\n */\r\nexport abstract class MutableEntityClass extends EntityClass {\r\n public abstract override addMixin(mixin: Mixin): any;\r\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\r\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\r\n public abstract override setDisplayLabel(displayLabel: string): void;\r\n}\r\n\r\n/** @internal */\r\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\r\n if (await ecClass.getProperty(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n\r\n/** @internal */\r\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\r\n if (ecClass.getPropertySync(name, true))\r\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\r\n\r\n let resolvedRelationship: RelationshipClass | undefined;\r\n if (typeof (relationship) === \"string\") {\r\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\r\n } else\r\n resolvedRelationship = relationship;\r\n\r\n if (!resolvedRelationship)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`); // eslint-disable-line @typescript-eslint/no-base-to-string\r\n\r\n if (typeof (direction) === \"string\") {\r\n const tmpDirection = parseStrengthDirection(direction);\r\n if (undefined === tmpDirection)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\r\n direction = tmpDirection;\r\n }\r\n\r\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\r\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\r\n}\r\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SchemaItemKey } from "../SchemaKey";
|
|
2
|
+
/**
|
|
3
|
+
* The class hierarchy is a helper class that maintains the relationships between ECClasses and their base classes
|
|
4
|
+
* within a SchemaContext. It allows for efficient retrieval of base and derived classes based on their schema item
|
|
5
|
+
* keys to support lazy loaded classes properly.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class ECClassHierarchy {
|
|
9
|
+
private _hierarchy;
|
|
10
|
+
private addClassEntry;
|
|
11
|
+
addBaseClass(classKey: SchemaItemKey, baseClassKey: SchemaItemKey, isMixin?: boolean): void;
|
|
12
|
+
private addDerivedClass;
|
|
13
|
+
removeBaseClass(classKey: SchemaItemKey, baseClassKey: SchemaItemKey): void;
|
|
14
|
+
private removedDerivedClass;
|
|
15
|
+
getBaseClassKeys(classKey: SchemaItemKey): ReadonlyArray<SchemaItemKey>;
|
|
16
|
+
getDerivedClassKeys(classKey: SchemaItemKey): ReadonlyArray<SchemaItemKey>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ECClassHierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ECClassHierarchy.d.ts","sourceRoot":"","sources":["../../../src/utils/ECClassHierarchy.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAa7C;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO,CAAC,aAAa;IAMd,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,GAAE,OAAe,GAAG,IAAI;IAYzG,OAAO,CAAC,eAAe;IAOhB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,GAAG,IAAI;IAalF,OAAO,CAAC,mBAAmB;IAWpB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC;IAevE,mBAAmB,CAAC,QAAQ,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC;CAYlF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The class hierarchy is a helper class that maintains the relationships between ECClasses and their base classes
|
|
3
|
+
* within a SchemaContext. It allows for efficient retrieval of base and derived classes based on their schema item
|
|
4
|
+
* keys to support lazy loaded classes properly.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export class ECClassHierarchy {
|
|
8
|
+
_hierarchy = new Map();
|
|
9
|
+
addClassEntry(classKey) {
|
|
10
|
+
const classEntry = { baseClasses: [], derivedClasses: [] };
|
|
11
|
+
this._hierarchy.set(classKey.fullName, classEntry);
|
|
12
|
+
return classEntry;
|
|
13
|
+
}
|
|
14
|
+
addBaseClass(classKey, baseClassKey, isMixin = false) {
|
|
15
|
+
const classEntry = this._hierarchy.get(classKey.fullName) ?? this.addClassEntry(classKey);
|
|
16
|
+
if (!classEntry.baseClasses.find((entry) => entry.baseClassKey.matches(baseClassKey))) {
|
|
17
|
+
classEntry.baseClasses.push({ baseClassKey, isMixin });
|
|
18
|
+
}
|
|
19
|
+
if (!isMixin) {
|
|
20
|
+
this.addDerivedClass(baseClassKey, classKey);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
addDerivedClass(baseClassKey, classKey) {
|
|
24
|
+
const baseClassEntry = this._hierarchy.get(baseClassKey.fullName) ?? this.addClassEntry(baseClassKey);
|
|
25
|
+
if (!baseClassEntry.derivedClasses.find((derivedKey) => derivedKey.matches(classKey))) {
|
|
26
|
+
baseClassEntry.derivedClasses.push(classKey);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
removeBaseClass(classKey, baseClassKey) {
|
|
30
|
+
const classEntry = this._hierarchy.get(classKey.fullName);
|
|
31
|
+
if (!classEntry) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const index = classEntry.baseClasses.findIndex((entry) => entry.baseClassKey.matches(baseClassKey));
|
|
35
|
+
if (index !== -1) {
|
|
36
|
+
classEntry.baseClasses.splice(index, 1);
|
|
37
|
+
}
|
|
38
|
+
this.removedDerivedClass(baseClassKey, classKey);
|
|
39
|
+
}
|
|
40
|
+
removedDerivedClass(baseClassKey, classKey) {
|
|
41
|
+
const baseClassEntry = this._hierarchy.get(baseClassKey.fullName);
|
|
42
|
+
if (!baseClassEntry) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const derivedIndex = baseClassEntry.derivedClasses.findIndex((derivedKey) => derivedKey.matches(classKey));
|
|
46
|
+
if (derivedIndex !== -1) {
|
|
47
|
+
baseClassEntry.derivedClasses.splice(derivedIndex, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getBaseClassKeys(classKey) {
|
|
51
|
+
const classEntry = this._hierarchy.get(classKey.fullName);
|
|
52
|
+
if (!classEntry) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const baseClassKeys = [];
|
|
56
|
+
for (const entry of classEntry.baseClasses) {
|
|
57
|
+
baseClassKeys.push(entry.baseClassKey);
|
|
58
|
+
baseClassKeys.push(...this.getBaseClassKeys(entry.baseClassKey));
|
|
59
|
+
}
|
|
60
|
+
return baseClassKeys;
|
|
61
|
+
}
|
|
62
|
+
getDerivedClassKeys(classKey) {
|
|
63
|
+
const classEntry = this._hierarchy.get(classKey.fullName);
|
|
64
|
+
if (!classEntry) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const derivedClassKeys = [...classEntry.derivedClasses];
|
|
68
|
+
for (const derivedClassKey of classEntry.derivedClasses) {
|
|
69
|
+
derivedClassKeys.push(...this.getDerivedClassKeys(derivedClassKey));
|
|
70
|
+
}
|
|
71
|
+
return derivedClassKeys;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=ECClassHierarchy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ECClassHierarchy.js","sourceRoot":"","sources":["../../../src/utils/ECClassHierarchy.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IACnB,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE3C,aAAa,CAAC,QAAuB;QAC3C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,EAAE,CAAC;YAC3C,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YACvC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;IAEM,mBAAmB,CAAC,QAAuB;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,gBAAgB,GAAoB,CAAC,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;QACzE,KAAK,MAAM,eAAe,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;YACxD,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { SchemaItemKey } from \"../SchemaKey\";\r\n\r\ninterface ClassEntry {\r\n readonly baseClasses: BaseClassEntry[];\r\n readonly derivedClasses: SchemaItemKey[];\r\n}\r\n\r\n/** Interface for a Baseclass entry in the hierarchy */\r\ninterface BaseClassEntry {\r\n readonly baseClassKey: SchemaItemKey;\r\n readonly isMixin: boolean;\r\n}\r\n\r\n/**\r\n * The class hierarchy is a helper class that maintains the relationships between ECClasses and their base classes\r\n * within a SchemaContext. It allows for efficient retrieval of base and derived classes based on their schema item\r\n * keys to support lazy loaded classes properly.\r\n * @internal\r\n */\r\nexport class ECClassHierarchy {\r\n private _hierarchy = new Map<string, ClassEntry>();\r\n\r\n private addClassEntry(classKey: SchemaItemKey): ClassEntry {\r\n const classEntry: ClassEntry = { baseClasses: [], derivedClasses: [] };\r\n this._hierarchy.set(classKey.fullName, classEntry);\r\n return classEntry;\r\n }\r\n\r\n public addBaseClass(classKey: SchemaItemKey, baseClassKey: SchemaItemKey, isMixin: boolean = false): void {\r\n const classEntry = this._hierarchy.get(classKey.fullName) ?? this.addClassEntry(classKey);\r\n\r\n if (!classEntry.baseClasses.find((entry) => entry.baseClassKey.matches(baseClassKey))) {\r\n classEntry.baseClasses.push({ baseClassKey, isMixin });\r\n }\r\n\r\n if (!isMixin) {\r\n this.addDerivedClass(baseClassKey, classKey);\r\n }\r\n }\r\n\r\n private addDerivedClass(baseClassKey: SchemaItemKey, classKey: SchemaItemKey): void {\r\n const baseClassEntry = this._hierarchy.get(baseClassKey.fullName) ?? this.addClassEntry(baseClassKey);\r\n if (!baseClassEntry.derivedClasses.find((derivedKey) => derivedKey.matches(classKey))) {\r\n baseClassEntry.derivedClasses.push(classKey);\r\n }\r\n }\r\n\r\n public removeBaseClass(classKey: SchemaItemKey, baseClassKey: SchemaItemKey): void {\r\n const classEntry = this._hierarchy.get(classKey.fullName);\r\n if (!classEntry) {\r\n return;\r\n }\r\n const index = classEntry.baseClasses.findIndex((entry) => entry.baseClassKey.matches(baseClassKey));\r\n if (index !== -1) {\r\n classEntry.baseClasses.splice(index, 1);\r\n }\r\n\r\n this.removedDerivedClass(baseClassKey, classKey);\r\n }\r\n\r\n private removedDerivedClass(baseClassKey: SchemaItemKey, classKey: SchemaItemKey): void {\r\n const baseClassEntry = this._hierarchy.get(baseClassKey.fullName);\r\n if (!baseClassEntry) {\r\n return;\r\n }\r\n const derivedIndex = baseClassEntry.derivedClasses.findIndex((derivedKey) => derivedKey.matches(classKey));\r\n if (derivedIndex !== -1) {\r\n baseClassEntry.derivedClasses.splice(derivedIndex, 1);\r\n }\r\n }\r\n\r\n public getBaseClassKeys(classKey: SchemaItemKey): ReadonlyArray<SchemaItemKey> {\r\n const classEntry = this._hierarchy.get(classKey.fullName);\r\n if (!classEntry) {\r\n return [];\r\n }\r\n\r\n const baseClassKeys: SchemaItemKey[] = [];\r\n for (const entry of classEntry.baseClasses) {\r\n baseClassKeys.push(entry.baseClassKey);\r\n baseClassKeys.push(...this.getBaseClassKeys(entry.baseClassKey));\r\n }\r\n\r\n return baseClassKeys;\r\n }\r\n\r\n public getDerivedClassKeys(classKey: SchemaItemKey): ReadonlyArray<SchemaItemKey> {\r\n const classEntry = this._hierarchy.get(classKey.fullName);\r\n if (!classEntry) {\r\n return [];\r\n }\r\n\r\n const derivedClassKeys: SchemaItemKey[] = [...classEntry.derivedClasses];\r\n for (const derivedClassKey of classEntry.derivedClasses) {\r\n derivedClassKeys.push(...this.getDerivedClassKeys(derivedClassKey));\r\n }\r\n return derivedClassKeys;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaLoadingController.d.ts","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,CAAgB;IAEjC;;OAEG;IACH,IAAW,UAAU,IAOQ,OAAO,CALnC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAEnC;IAED;;OAEG;IACH,IAAW,UAAU,YAEpB;IAED;;OAEG;;IAMH;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"SchemaLoadingController.d.ts","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAC;IAClB,OAAO,CAAC,WAAW,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,CAAgB;IAEjC;;OAEG;IACH,IAAW,UAAU,IAOQ,OAAO,CALnC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAEnC;IAED;;OAEG;IACH,IAAW,UAAU,YAEpB;IAED;;OAEG;;IAMH;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;IAanC;;;OAGG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAKnC"}
|
|
@@ -42,9 +42,13 @@ export class SchemaLoadingController {
|
|
|
42
42
|
*/
|
|
43
43
|
start(promise) {
|
|
44
44
|
this._inProgress = true;
|
|
45
|
-
|
|
45
|
+
promise.then(() => {
|
|
46
46
|
this._complete = true;
|
|
47
47
|
this._inProgress = false;
|
|
48
|
+
}).catch(() => {
|
|
49
|
+
// Errors are handled when wait() is called. This catch prevents unhandled rejection warnings.
|
|
50
|
+
this._complete = false;
|
|
51
|
+
this._inProgress = false;
|
|
48
52
|
});
|
|
49
53
|
this._promise = promise;
|
|
50
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaLoadingController.js","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAC1B,SAAS,CAAC;IACV,WAAW,CAAC;IACZ,QAAQ,CAAiB;IAEjC;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAsB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,
|
|
1
|
+
{"version":3,"file":"SchemaLoadingController.js","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAC1B,SAAS,CAAC;IACV,WAAW,CAAC;IACZ,QAAQ,CAAiB;IAEjC;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAsB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACZ,8FAA8F;YAC9F,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\n/**\r\n * Assists in tracking the loading progress of Schemas and SchemaItems. An instance of this\r\n * class is set in Schema and SchemaItem instances.\r\n * @internal\r\n */\r\nexport class SchemaLoadingController {\r\n private _complete;\r\n private _inProgress;\r\n private _promise?: Promise<void>;\r\n\r\n /**\r\n * Indicates of the Schema or SchemaItem has been fully loaded.\r\n */\r\n public get isComplete() {\r\n return this._complete;\r\n }\r\n\r\n /**\r\n * Marks that a Schema or SchemaItem has been fully loaded.\r\n */\r\n public set isComplete(value: boolean) {\r\n this._complete = value;\r\n }\r\n\r\n /**\r\n * Indicates that the loading of a Schema or SchemaItem is still in progress\r\n */\r\n public get inProgress() {\r\n return this._inProgress;\r\n }\r\n\r\n /**\r\n * Initializes a new SchemaLoadingController instance.\r\n */\r\n constructor() {\r\n this._complete = false;\r\n this._inProgress = false;\r\n }\r\n\r\n /**\r\n * Call this method when starting to load a Schema or SchemaItem\r\n * @param promise The promise used to update the controller state when the promise is resolved.\r\n */\r\n public start(promise: Promise<void>) {\r\n this._inProgress = true;\r\n promise.then(() => {\r\n this._complete = true;\r\n this._inProgress = false;\r\n }).catch(() => {\r\n // Errors are handled when wait() is called. This catch prevents unhandled rejection warnings.\r\n this._complete = false;\r\n this._inProgress = false;\r\n });\r\n this._promise = promise;\r\n }\r\n\r\n /**\r\n * Waits on the Promise given in SchemaLoadingController.start().\r\n * @returns A Promised that can be awaited while the Schema or SchemaItem is being loaded.\r\n */\r\n public async wait(): Promise<void> {\r\n if (!this._promise)\r\n throw new Error(\"LoadingController 'start' must be called before 'wait'\");\r\n return this._promise;\r\n }\r\n}"]}
|