@itwin/ecschema-metadata 5.9.0-dev.1 → 5.9.0-dev.10
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 +16 -1
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +35 -21
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +7 -7
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts +3 -2
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js +7 -6
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts.map +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.js +6 -5
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +6 -4
- 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 -2
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +2 -2
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +6 -3
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +5 -4
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.js +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +2 -2
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.js +2 -2
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js +4 -2
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +35 -21
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +7 -7
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +3 -2
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.js +7 -6
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.d.ts +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.d.ts.map +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.js +6 -5
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +6 -4
- 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 -2
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +2 -2
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +6 -3
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +5 -4
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.js +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +2 -2
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.js +2 -2
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.d.ts.map +1 -1
- package/lib/esm/UnitConversion/Parser.js +4 -2
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/package.json +7 -7
|
@@ -65,7 +65,7 @@ export class SchemaFormatsProvider {
|
|
|
65
65
|
description: kindOfQuantity.description ?? format.description,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
async getKindOfQuantityFormatFromSchema(itemKey) {
|
|
68
|
+
async getKindOfQuantityFormatFromSchema(itemKey, systemOverride) {
|
|
69
69
|
let kindOfQuantity;
|
|
70
70
|
try {
|
|
71
71
|
kindOfQuantity = await this._context.getSchemaItem(itemKey, KindOfQuantity);
|
|
@@ -78,8 +78,9 @@ export class SchemaFormatsProvider {
|
|
|
78
78
|
return undefined;
|
|
79
79
|
}
|
|
80
80
|
// If a unit system is provided, find the first presentation format that matches it.
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
const effectiveSystem = systemOverride ?? this._unitSystem;
|
|
82
|
+
if (effectiveSystem) {
|
|
83
|
+
const unitSystemMatchers = getUnitSystemGroupMatchers(effectiveSystem);
|
|
83
84
|
const presentationFormats = kindOfQuantity.presentationFormats;
|
|
84
85
|
for (const matcher of unitSystemMatchers) {
|
|
85
86
|
for (const lazyFormat of presentationFormats) {
|
|
@@ -123,7 +124,7 @@ export class SchemaFormatsProvider {
|
|
|
123
124
|
* @param name The full name of the Format or KindOfQuantity.
|
|
124
125
|
* @returns
|
|
125
126
|
*/
|
|
126
|
-
async getFormat(name) {
|
|
127
|
+
async getFormat(name, system) {
|
|
127
128
|
const [schemaName, schemaItemName] = SchemaItem.parseFullName(name);
|
|
128
129
|
const schemaKey = new SchemaKey(schemaName);
|
|
129
130
|
let schema;
|
|
@@ -152,7 +153,7 @@ export class SchemaFormatsProvider {
|
|
|
152
153
|
}
|
|
153
154
|
return format.toJSON(true);
|
|
154
155
|
}
|
|
155
|
-
return this.getKindOfQuantityFormatFromSchema(itemKey);
|
|
156
|
+
return this.getKindOfQuantityFormatFromSchema(itemKey, system);
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
function getUnitSystemGroupMatchers(groupKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/SchemaFormatsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkB,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAM5D,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C;;;GAGG;AACH,MAAM,OAAO,qBAAqB;I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CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,CAAC,UAAsB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACjF,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3E,KAAK,aAAa;YAChB,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACrE,KAAK,UAAU;YACb,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,6BAA6B,CAAC,eAAoC;IACzE,oDAAoD;IACpD,OAAO;QACL,YAAY,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,CAAC;QACrE,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,SAAS;QACf,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,eAAe,CAAC,QAAQ;oBAC9B,KAAK,EAAE,eAAe,CAAC,KAAK;iBAC7B;aACF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { Format } from \"../Metadata/Format\";\nimport { SchemaItemFormatProps } from \"../Deserialization/JsonProps\";\nimport { BeEvent, Logger } from \"@itwin/core-bentley\";\nimport { KindOfQuantity } from \"../Metadata/KindOfQuantity\";\nimport { getFormatProps } from \"../Metadata/OverrideFormat\";\nimport { FormatDefinition, FormatProps, FormatsChangedArgs, FormatsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { UnitSystem } from \"../Metadata/UnitSystem\";\nconst loggerCategory = \"SchemaFormatsProvider\";\n/**\n * Provides default formats and kind of quantities from a given SchemaContext or SchemaLocater.\n * @beta\n */\nexport class SchemaFormatsProvider implements FormatsProvider {\n private _context: SchemaContext;\n private _unitSystem?: UnitSystemKey;\n private _formatsRetrieved: Set<string> = new Set();\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param unitSystem Optional unit system used to lookup a default format through a schema specific algorithm, when the format retrieved is associated with a KindOfQuantity.\n * If not provided, the default presentation format will be used directly without matching unit systems.\n */\n constructor(contextOrLocater: ISchemaLocater, unitSystem?: UnitSystemKey) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitSystem = unitSystem;\n }\n\n public get context() { return this._context; }\n public get unitSystem() { return this._unitSystem; }\n\n public set unitSystem(unitSystem: UnitSystemKey | undefined) {\n this._unitSystem = unitSystem;\n this.clear();\n }\n\n private clear(): void {\n const formatsChanged = Array.from(this._formatsRetrieved);\n this._formatsRetrieved.clear();\n this.onFormatsChanged.raiseEvent({ formatsChanged });\n }\n\n /** When using a presentation unit from a KindOfQuantity, the label and description should come from the KindOfQuantity */\n private convertToFormatDefinition(format: SchemaItemFormatProps, kindOfQuantity: KindOfQuantity): FormatDefinition {\n // Destructure all properties except 'rest'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, label, description, $schema, schema, schemaVersion, schemaItemType,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n customAttributes, originalECSpecMajorVersion, originalECSpecMinorVersion, ...rest } = format;\n\n return {\n ...rest,\n name: kindOfQuantity.fullName,\n label: kindOfQuantity.label ?? format.label,\n description: kindOfQuantity.description ?? format.description,\n }\n }\n\n private async getKindOfQuantityFormatFromSchema(itemKey: SchemaItemKey): Promise<FormatDefinition | undefined> {\n let kindOfQuantity: KindOfQuantity | undefined;\n try {\n kindOfQuantity = await this._context.getSchemaItem(itemKey, KindOfQuantity);\n } catch {\n Logger.logError(loggerCategory, `Failed to find KindOfQuantity ${itemKey.fullName}`);\n return undefined;\n }\n\n if (!kindOfQuantity) {\n return undefined;\n }\n\n // If a unit system is provided, find the first presentation format that matches it.\n if (this._unitSystem) {\n const unitSystemMatchers = getUnitSystemGroupMatchers(this._unitSystem);\n const presentationFormats = kindOfQuantity.presentationFormats;\n for (const matcher of unitSystemMatchers) {\n for (const lazyFormat of presentationFormats) {\n const format = await lazyFormat;\n const unit = await (format.units && format.units[0][0]);\n if (!unit) {\n continue;\n }\n const currentUnitSystem = await unit.unitSystem;\n if (currentUnitSystem && matcher(currentUnitSystem)) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getFormatProps(format);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n }\n\n // If no matching presentation format was found, fall back to persistence unit format\n // only if it matches the requested unit system.\n const persistenceUnit = await kindOfQuantity.persistenceUnit;\n const persistenceUnitSystem = await persistenceUnit?.unitSystem;\n if (persistenceUnit && persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getPersistenceUnitFormatProps(persistenceUnit);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n\n // If no unit system was provided, or no matching format was found, use the default presentation format.\n // Unit conversion from persistence unit to presentation unit will be handled by FormatterSpec.\n const defaultFormat = kindOfQuantity.defaultPresentationFormat;\n if (defaultFormat) {\n this._formatsRetrieved.add(itemKey.fullName);\n const defaultProps = getFormatProps(await defaultFormat);\n return this.convertToFormatDefinition(defaultProps, kindOfQuantity);\n }\n\n return undefined;\n }\n\n\n /**\n * Retrieves a Format from a SchemaContext. If the format is part of a KindOfQuantity, the first presentation format in the KindOfQuantity that matches the current unit system will be retrieved.\n * If no presentation format matches the current unit system, the persistence unit format will be retrieved if it matches the current unit system.\n * Else, the default presentation format will be retrieved.\n * @param name The full name of the Format or KindOfQuantity.\n * @returns\n */\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(name);\n const schemaKey = new SchemaKey(schemaName);\n let schema: Schema | undefined;\n try {\n schema = await this._context.getSchema(schemaKey);\n } catch {\n Logger.logError(loggerCategory, `Failed to find schema ${schemaName}`);\n return undefined;\n }\n if (!schema) {\n return undefined;\n }\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n\n if (schema.name === \"Formats\") {\n let format: Format | undefined;\n try {\n format = await this._context.getSchemaItem(itemKey, Format);\n } catch {\n Logger.logError(loggerCategory, `Failed to find Format ${itemKey.fullName}`);\n return undefined;\n }\n if (!format) {\n return undefined;\n }\n return format.toJSON(true);\n }\n return this.getKindOfQuantityFormatFromSchema(itemKey);\n }\n}\n\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\n function createMatcher(name: string | string[]) {\n const names = Array.isArray(name) ? name : [name];\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\n }\n switch (groupKey) {\n case \"imperial\":\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"metric\":\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usCustomary\":\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usSurvey\":\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n }\n return [];\n}\n\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\n // Same as Format \"DefaultRealU\" in Formats ecschema\n return {\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\n precision: 6,\n type: \"Decimal\",\n composite: {\n units: [\n {\n name: persistenceUnit.fullName,\n label: persistenceUnit.label,\n },\n ],\n },\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"SchemaFormatsProvider.js","sourceRoot":"","sources":["../../../src/Formatting/SchemaFormatsProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkB,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAM5D,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAC/C;;;GAGG;AACH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esContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { Format } from \"../Metadata/Format\";\nimport { SchemaItemFormatProps } from \"../Deserialization/JsonProps\";\nimport { BeEvent, Logger } from \"@itwin/core-bentley\";\nimport { KindOfQuantity } from \"../Metadata/KindOfQuantity\";\nimport { getFormatProps } from \"../Metadata/OverrideFormat\";\nimport { FormatDefinition, FormatProps, FormatsChangedArgs, FormatsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { UnitSystem } from \"../Metadata/UnitSystem\";\nconst loggerCategory = \"SchemaFormatsProvider\";\n/**\n * Provides default formats and kind of quantities from a given SchemaContext or SchemaLocater.\n * @beta\n */\nexport class SchemaFormatsProvider implements FormatsProvider {\n private _context: SchemaContext;\n private _unitSystem?: UnitSystemKey;\n private _formatsRetrieved: Set<string> = new Set();\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param unitSystem Optional unit system used to lookup a default format through a schema specific algorithm, when the format retrieved is associated with a KindOfQuantity.\n * If not provided, the default presentation format will be used directly without matching unit systems.\n */\n constructor(contextOrLocater: ISchemaLocater, unitSystem?: UnitSystemKey) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitSystem = unitSystem;\n }\n\n public get context() { return this._context; }\n public get unitSystem() { return this._unitSystem; }\n\n public set unitSystem(unitSystem: UnitSystemKey | undefined) {\n this._unitSystem = unitSystem;\n this.clear();\n }\n\n private clear(): void {\n const formatsChanged = Array.from(this._formatsRetrieved);\n this._formatsRetrieved.clear();\n this.onFormatsChanged.raiseEvent({ formatsChanged });\n }\n\n /** When using a presentation unit from a KindOfQuantity, the label and description should come from the KindOfQuantity */\n private convertToFormatDefinition(format: SchemaItemFormatProps, kindOfQuantity: KindOfQuantity): FormatDefinition {\n // Destructure all properties except 'rest'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, label, description, $schema, schema, schemaVersion, schemaItemType,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n customAttributes, originalECSpecMajorVersion, originalECSpecMinorVersion, ...rest } = format;\n\n return {\n ...rest,\n name: kindOfQuantity.fullName,\n label: kindOfQuantity.label ?? format.label,\n description: kindOfQuantity.description ?? format.description,\n }\n }\n\n private async getKindOfQuantityFormatFromSchema(itemKey: SchemaItemKey, systemOverride?: UnitSystemKey): Promise<FormatDefinition | undefined> {\n let kindOfQuantity: KindOfQuantity | undefined;\n try {\n kindOfQuantity = await this._context.getSchemaItem(itemKey, KindOfQuantity);\n } catch {\n Logger.logError(loggerCategory, `Failed to find KindOfQuantity ${itemKey.fullName}`);\n return undefined;\n }\n\n if (!kindOfQuantity) {\n return undefined;\n }\n\n // If a unit system is provided, find the first presentation format that matches it.\n const effectiveSystem = systemOverride ?? this._unitSystem;\n if (effectiveSystem) {\n const unitSystemMatchers = getUnitSystemGroupMatchers(effectiveSystem);\n const presentationFormats = kindOfQuantity.presentationFormats;\n for (const matcher of unitSystemMatchers) {\n for (const lazyFormat of presentationFormats) {\n const format = await lazyFormat;\n const unit = await (format.units && format.units[0][0]);\n if (!unit) {\n continue;\n }\n const currentUnitSystem = await unit.unitSystem;\n if (currentUnitSystem && matcher(currentUnitSystem)) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getFormatProps(format);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n }\n\n // If no matching presentation format was found, fall back to persistence unit format\n // only if it matches the requested unit system.\n const persistenceUnit = await kindOfQuantity.persistenceUnit;\n const persistenceUnitSystem = await persistenceUnit?.unitSystem;\n if (persistenceUnit && persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getPersistenceUnitFormatProps(persistenceUnit);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n\n // If no unit system was provided, or no matching format was found, use the default presentation format.\n // Unit conversion from persistence unit to presentation unit will be handled by FormatterSpec.\n const defaultFormat = kindOfQuantity.defaultPresentationFormat;\n if (defaultFormat) {\n this._formatsRetrieved.add(itemKey.fullName);\n const defaultProps = getFormatProps(await defaultFormat);\n return this.convertToFormatDefinition(defaultProps, kindOfQuantity);\n }\n\n return undefined;\n }\n\n\n /**\n * Retrieves a Format from a SchemaContext. If the format is part of a KindOfQuantity, the first presentation format in the KindOfQuantity that matches the current unit system will be retrieved.\n * If no presentation format matches the current unit system, the persistence unit format will be retrieved if it matches the current unit system.\n * Else, the default presentation format will be retrieved.\n * @param name The full name of the Format or KindOfQuantity.\n * @returns\n */\n public async getFormat(name: string, system?: UnitSystemKey): Promise<FormatDefinition | undefined> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(name);\n const schemaKey = new SchemaKey(schemaName);\n let schema: Schema | undefined;\n try {\n schema = await this._context.getSchema(schemaKey);\n } catch {\n Logger.logError(loggerCategory, `Failed to find schema ${schemaName}`);\n return undefined;\n }\n if (!schema) {\n return undefined;\n }\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n\n if (schema.name === \"Formats\") {\n let format: Format | undefined;\n try {\n format = await this._context.getSchemaItem(itemKey, Format);\n } catch {\n Logger.logError(loggerCategory, `Failed to find Format ${itemKey.fullName}`);\n return undefined;\n }\n if (!format) {\n return undefined;\n }\n return format.toJSON(true);\n }\n return this.getKindOfQuantityFormatFromSchema(itemKey, system);\n }\n}\n\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\n function createMatcher(name: string | string[]) {\n const names = Array.isArray(name) ? name : [name];\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\n }\n switch (groupKey) {\n case \"imperial\":\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"metric\":\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usCustomary\":\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usSurvey\":\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n }\n return [];\n}\n\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\n // Same as Format \"DefaultRealU\" in Formats ecschema\n return {\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\n precision: 6,\n type: \"Decimal\",\n composite: {\n units: [\n {\n name: persistenceUnit.fullName,\n label: persistenceUnit.label,\n },\n ],\n },\n };\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Class.d.ts","sourceRoot":"","sources":["../../../src/Metadata/Class.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAiD,eAAe,EAA0C,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE9L,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CA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AAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;aACvG,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,mBAAmB;aAElG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;aAC3C,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAChE"}
|
|
@@ -294,8 +294,7 @@ export class ECClass extends SchemaItem {
|
|
|
294
294
|
else
|
|
295
295
|
correctType = structType;
|
|
296
296
|
if (!correctType)
|
|
297
|
-
|
|
298
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);
|
|
297
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${typeof structType === "string" ? structType : structType?.fullName ?? "undefined"}, is not a valid StructClass.`);
|
|
299
298
|
return correctType;
|
|
300
299
|
}
|
|
301
300
|
/**
|
|
@@ -314,8 +313,7 @@ export class ECClass extends SchemaItem {
|
|
|
314
313
|
else
|
|
315
314
|
correctType = structType;
|
|
316
315
|
if (!correctType)
|
|
317
|
-
|
|
318
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);
|
|
316
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${typeof structType === "string" ? structType : structType?.fullName ?? "undefined"}, is not a valid StructClass.`);
|
|
319
317
|
return correctType;
|
|
320
318
|
}
|
|
321
319
|
/**
|
|
@@ -485,6 +483,8 @@ export class ECClass extends SchemaItem {
|
|
|
485
483
|
const schemaList = [this.schema];
|
|
486
484
|
while (schemaList.length > 0) {
|
|
487
485
|
const currentSchema = schemaList.shift();
|
|
486
|
+
if (!currentSchema)
|
|
487
|
+
break;
|
|
488
488
|
if (currentSchema.schemaKey.compareByName(itemKey.schemaKey)) {
|
|
489
489
|
const baseClass = await currentSchema.getItem(itemKey.name, ECClass);
|
|
490
490
|
schemaList.splice(0); // clear the list
|
|
@@ -511,6 +511,8 @@ export class ECClass extends SchemaItem {
|
|
|
511
511
|
const schemaList = [this.schema];
|
|
512
512
|
while (schemaList.length > 0) {
|
|
513
513
|
const currentSchema = schemaList.shift();
|
|
514
|
+
if (!currentSchema)
|
|
515
|
+
break;
|
|
514
516
|
if (currentSchema.schemaKey.compareByName(itemKey.schemaKey)) {
|
|
515
517
|
const baseClass = currentSchema.getItemSync(itemKey.name, ECClass);
|
|
516
518
|
schemaList.splice(0); // clear the list
|
|
@@ -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,EAAE,MAAM,qBAAqB,CAAC;AACrD,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,MAA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,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { AbstractSchemaItemType, classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType, SupportedSchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { AnyClass, LazyLoadedECClass } from \"../Interfaces\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { Enumeration } from \"./Enumeration\";\nimport {\n EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, Property, StructArrayProperty, StructProperty,\n} from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\n\nconst loggingCategory = \"ECClass\";\n\n/**\n * A common abstract class for all of the ECClass types.\n * @public @preview\n */\nexport abstract class ECClass extends SchemaItem implements CustomAttributeContainerProps {\n /** @internal */\n public static override get schemaItemType(): SupportedSchemaItemType { return AbstractSchemaItemType.Class; } // need this so getItem(\"name\", ECClass) in schema works\n private _modifier: ECClassModifier;\n private _baseClass?: LazyLoadedECClass;\n private _properties?: Map<string, Property>;\n private _customAttributes?: Map<string, CustomAttribute>;\n private _mergedPropertyCache?: Map<string, Property>;\n\n public get modifier() { return this._modifier; }\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** @internal */\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name);\n\n if (modifier)\n this._modifier = modifier;\n else\n this._modifier = ECClassModifier.None;\n }\n\n /**\n * Gets the base class if it exists, otherwise returns undefined.\n */\n public get baseClass(): LazyLoadedECClass | undefined {\n return this._baseClass;\n }\n\n public getBaseClassSync(): ECClass | undefined {\n if (!this.baseClass) {\n return undefined;\n }\n\n return this.schema.lookupItemSync(this.baseClass, ECClass);\n }\n\n /**\n * Sets the base class of the ECClass. Pass undefined to 'remove' the base class.\n *\n * @internal\n */\n protected async setBaseClass(baseClass: LazyLoadedECClass | undefined) {\n const oldBaseClass = this._baseClass;\n this._baseClass = baseClass;\n\n if (baseClass)\n this.schema.context.classHierarchy.addBaseClass(this.key, baseClass);\n else if (oldBaseClass)\n this.schema.context.classHierarchy.removeBaseClass(this.key, oldBaseClass);\n }\n\n /**\n * Gets the derived classes belonging to this class.\n * @note This method relies on the `SchemaContext` to find derived classes.\n * It will **only** return derived classes from schemas that have already been loaded into the context.\n * If a derived class exists in a referencing schema that has not yet been loaded, it will not be included in the results.\n * To ensure all derived classes are found, ensure that all relevant referencing schemas are loaded into the `SchemaContext`\n * before calling this method.\n * @returns An array of ECClasses or undefined if no derived classes exist.\n */\n public async getDerivedClasses(): Promise<ECClass[] | undefined> {\n const derivedClasses: ECClass[] = [];\n for(const derivedClassKey of this.schema.context.classHierarchy.getDerivedClassKeys(this.key)) {\n let derivedClass = await this.schema.getItem(derivedClassKey.name, ECClass); // if the derived class is in the same schema this will get it without going to the context\n if (derivedClass) {\n derivedClasses.push(derivedClass);\n continue;\n }\n Logger.logInfo(loggingCategory, `Derived class ${derivedClassKey.name} not found in schema ${this.schema.name}, looking in schema context.`);\n derivedClass = await this.schema.context.getSchemaItem(derivedClassKey, ECClass);\n if (derivedClass)\n derivedClasses.push(derivedClass);\n }\n\n if (derivedClasses.length === 0)\n return undefined;\n\n return derivedClasses;\n }\n\n /**\n * Convenience method for adding an already loaded ECProperty used by create*Property methods.\n * @param prop The property to add.\n * @return The property that was added.\n *\n * @internal\n */\n protected addProperty<T extends Property>(prop: T): T {\n if (!this._properties)\n this._properties = new Map<string, Property>();\n\n this._properties.set(prop.name.toUpperCase(), prop);\n this.cleanCache();\n return prop;\n }\n\n /**\n * Deletes a property from within this class.\n * @param name The property name to delete, lookup is case-insensitive\n * @internal\n */\n protected async deleteProperty(name: string): Promise<void> {\n if (this._properties) {\n const property = await this.getProperty(name);\n if (property) {\n this._properties.delete(name.toUpperCase());\n this.cleanCache();\n }\n }\n }\n\n /**\n * Deletes a property from within this class.\n * @param name The property name to delete, lookup is case-insensitive\n * @internal\n */\n protected deletePropertySync(name: string): void {\n if (this._properties) {\n const property = this.getPropertySync(name);\n if (property) {\n this._properties.delete(name.toUpperCase());\n this.cleanCache();\n }\n }\n }\n\n\n /**\n * Searches, case-insensitive, for an ECProperty with given the name on this class and, by default, on\n * all base classes. Set excludeInherited to 'true' to only search the local class.\n * @param name The name of the property to retrieve.\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\n */\n public async getProperty(name: string, excludeInherited?: boolean): Promise<Property | undefined> {\n const upperKey = name.toUpperCase();\n let property: Property | undefined;\n\n if (this._properties) {\n property = this._properties.get(upperKey);\n if (property) {\n return property;\n }\n }\n\n if (excludeInherited) {\n return undefined;\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = await this.buildPropertyCache();\n }\n\n return this._mergedPropertyCache.get(upperKey);\n }\n\n /**\n * Searches, case-insensitive, for a local ECProperty with the name provided.\n * @param name The name of the property to retrieve.\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\n */\n public getPropertySync(name: string, excludeInherited?: boolean): Property | undefined {\n const upperKey = name.toUpperCase();\n let property: Property | undefined;\n\n if (this._properties) {\n property = this._properties.get(upperKey);\n if (property) {\n return property;\n }\n }\n\n if (excludeInherited) {\n return undefined;\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = this.buildPropertyCacheSync();\n }\n\n return this._mergedPropertyCache.get(upperKey);\n }\n\n /**\n * Searches the base class, if one exists, for the property with the name provided.\n * @param name The name of the inherited property to find.\n */\n public async getInheritedProperty(name: string): Promise<Property | undefined> {\n if (this.baseClass) {\n const baseClassObj = await this.baseClass;\n return baseClassObj.getProperty(name);\n }\n\n return undefined;\n }\n\n /**\n * Searches the base class, if one exists, for the property with the name provided.\n * @param name The name of the inherited property to find.\n */\n public getInheritedPropertySync(name: string): Property | undefined {\n const baseClassObj = this.getBaseClassSync();\n if (baseClassObj)\n return baseClassObj.getPropertySync(name);\n\n return undefined;\n }\n\n /**\n * Creates a PrimitiveECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\n *\n * @internal\n */\n protected async createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\n protected async createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\n protected async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveProperty(this, name, propType));\n\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\n *\n * @internal\n */\n protected createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\n protected createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\n protected createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveProperty(this, name, propType));\n\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveArrayECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n *\n * @internal\n */\n protected async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\n protected async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\n protected async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\n\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveArrayECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n *\n * @internal\n */\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\n protected createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\n\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n *\n * @param name The name of property to create.\n * @param structType The struct type of property to create.\n *\n * @internal\n */\n protected async createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructProperty(this, name, await this.loadStructType(structType, this.schema)));\n }\n\n /**\n *\n * @param name The name of property to create.\n * @param structType The struct type of property to create.\n *\n * @internal\n */\n protected createStructPropertySync(name: string, structType: string | StructClass): StructProperty {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\n }\n\n /**\n *\n * @param name\n * @param type\n *\n * @internal\n */\n protected async createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructArrayProperty(this, name, await this.loadStructType(structType, this.schema)));\n }\n\n /**\n *\n * @param name\n * @param type\n *\n * @internal\n */\n protected createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructArrayProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\n }\n\n /**\n *\n * @param structType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected async loadStructType(structType: string | StructClass | undefined, schema: Schema): Promise<StructClass> {\n let correctType: StructClass | undefined;\n if (typeof (structType) === \"string\") {\n correctType = await schema.lookupItem(structType, StructClass);\n } else\n correctType = structType;\n\n if (!correctType)\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\n\n return correctType;\n }\n\n /**\n *\n * @param structType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected loadStructTypeSync(structType: string | StructClass | undefined, schema: Schema): StructClass {\n let correctType: StructClass | undefined;\n if (typeof (structType) === \"string\") {\n correctType = schema.lookupItemSync(structType, StructClass);\n } else\n correctType = structType;\n\n if (!correctType)\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${structType}, is not a valid StructClass.`);\n\n return correctType;\n }\n\n /**\n *\n * @param primitiveType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected async loadPrimitiveType(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): Promise<PrimitiveType | Enumeration> {\n if (primitiveType === undefined)\n return PrimitiveType.Integer;\n\n if (typeof (primitiveType) === \"string\") {\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\n if (!resolvedType) {\n resolvedType = await schema.lookupItem(primitiveType, Enumeration);\n }\n\n if (resolvedType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n // If resolvedType is a SchemaItem, make sure it is an Enumeration- if not, throw an error\n if (typeof (resolvedType) !== \"number\" && resolvedType.schemaItemType !== SchemaItemType.Enumeration)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n return resolvedType;\n }\n\n return primitiveType;\n }\n\n /**\n *\n * @param primitiveType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected loadPrimitiveTypeSync(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): PrimitiveType | Enumeration {\n if (primitiveType === undefined)\n return PrimitiveType.Integer;\n\n if (typeof (primitiveType) === \"string\") {\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\n if (!resolvedType) {\n resolvedType = schema.lookupItemSync(primitiveType, Enumeration);\n }\n\n if (resolvedType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n return resolvedType;\n }\n\n return primitiveType;\n }\n\n /**\n * Save this Classes properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): ClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n const isMixin = SchemaItemType.Mixin === this.schemaItemType;\n const isRelationship = SchemaItemType.RelationshipClass === this.schemaItemType;\n if (!isMixin && (ECClassModifier.None !== this.modifier || isRelationship))\n schemaJson.modifier = classModifierToString(this.modifier);\n if (this.baseClass !== undefined)\n schemaJson.baseClass = this.baseClass.fullName;\n if (this._properties !== undefined && this._properties.size > 0)\n schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (customAttributes !== undefined)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as ClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n if (undefined !== this.modifier)\n itemElement.setAttribute(\"modifier\", classModifierToString(this.modifier));\n\n if (undefined !== this.baseClass) {\n const baseClass = await this.baseClass;\n const baseClassElement = schemaXml.createElement(\"BaseClass\");\n const baseClassName = XmlSerializationUtils.createXmlTypedName(this.schema, baseClass.schema, baseClass.name);\n baseClassElement.textContent = baseClassName;\n itemElement.appendChild(baseClassElement);\n }\n\n if (this._properties) {\n for (const prop of this._properties.values()) {\n const propXml = await prop.toXml(schemaXml);\n itemElement.appendChild(propXml);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public override fromJSONSync(classProps: ClassProps) {\n super.fromJSONSync(classProps);\n\n if (undefined !== classProps.modifier) {\n const modifier = parseClassModifier(classProps.modifier);\n if (undefined === modifier) {\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: classProps.originalECSpecMajorVersion, writeVersion: classProps.originalECSpecMinorVersion } as ECSpecVersion))\n this._modifier = ECClassModifier.None;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, `The string '${classProps.modifier}' is not a valid ECClassModifier.`);\n } else {\n this._modifier = modifier;\n }\n }\n\n if (undefined !== classProps.baseClass) {\n const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);\n if (!ecClassSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\n\n const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);\n\n let lazyBase: LazyLoadedECClass;\n if (!baseClass) {\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\n async () => {\n const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);\n if (undefined === baseItem || !ECClass.isECClass(baseItem))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\n return baseItem;\n });\n } else {\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\n async () => {\n return baseClass as ECClass;\n });\n }\n\n this._baseClass = lazyBase;\n this.schema.context.classHierarchy.addBaseClass(this.key, lazyBase);\n }\n }\n\n public override async fromJSON(classProps: ClassProps): Promise<void> {\n this.fromJSONSync(classProps);\n }\n\n /**\n *\n * @param customAttribute\n *\n * @internal\n */\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /**\n * Iterates (recursively) over all base classes and mixins, in \"property override\" order.\n * This is essentially a depth-first traversal through the inheritance tree.\n */\n public async *getAllBaseClasses(): AsyncIterable<ECClass> {\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n const baseClass = await this.getClassFromReferencesRecursively(baseClassKey); // Search in schema ref tree all the way to the top\n if (baseClass)\n yield baseClass;\n }\n }\n\n /**\n * gets a class from this schema or its references recursively using the item key\n * @param itemKey\n * @returns ECClass if it could be found, undefined otherwise\n * @internal\n */\n private async getClassFromReferencesRecursively(itemKey: SchemaItemKey): Promise<ECClass | undefined> {\n const schemaList: Schema[] = [this.schema];\n while(schemaList.length > 0) {\n const currentSchema = schemaList.shift();\n if(currentSchema!.schemaKey.compareByName(itemKey.schemaKey)) {\n const baseClass = await currentSchema!.getItem(itemKey.name, ECClass);\n schemaList.splice(0); // clear the list\n return baseClass;\n }\n schemaList.push(...currentSchema!.references);\n }\n return undefined;\n }\n\n public *getAllBaseClassesSync(): Iterable<AnyClass> {\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n const baseClass = this.getClassFromReferencesRecursivelySync(baseClassKey); // Search in schema ref tree all the way to the top\n if (baseClass)\n yield baseClass;\n }\n }\n\n /**\n * gets a class from this schema or its references recursively using the item key synchronously\n * @param itemKey\n * @returns ECClass if it could be found, undefined otherwise\n * @internal\n */\n private getClassFromReferencesRecursivelySync(itemKey: SchemaItemKey): ECClass | undefined {\n const schemaList: Schema[] = [this.schema];\n while(schemaList.length > 0) {\n const currentSchema = schemaList.shift();\n if(currentSchema!.schemaKey.compareByName(itemKey.schemaKey)) {\n const baseClass = currentSchema!.getItemSync(itemKey.name, ECClass);\n schemaList.splice(0); // clear the list\n return baseClass;\n }\n schemaList.push(...currentSchema!.references);\n }\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase())) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n }\n\n if (this._properties) {\n this._properties.forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n for (const property of baseClass.getPropertiesSync()) {\n if (!cache.has(property.name.toUpperCase())) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n }\n\n if (this._properties) {\n this._properties.forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n * Clears all caches on this object. This is called implicitly for this class,\n * but needs to be called if derived classes have changed.\n * @internal\n */\n public cleanCache() {\n this._mergedPropertyCache = undefined;\n }\n\n /**\n * Returns the properties on this class and its base classes.\n * Since this is an expensive operation, results will be cached after first call.\n * @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.\n * @returns An array of properties, empty array if none exist.\n */\n public getPropertiesSync(excludeInherited?: boolean): Iterable<Property> {\n if (excludeInherited) {\n return this._properties && this._properties.size > 0 ? this._properties.values() : [];\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = this.buildPropertyCacheSync();\n }\n\n return this._mergedPropertyCache.values();\n }\n\n /**\n * Quick way to check whether this class has any local properties without having to use the iterable\n */\n public get hasLocalProperties(): boolean {\n return this._properties !== undefined && this._properties.size > 0;\n }\n\n /**\n * Returns the properties on this class and its base classes.\n * Since this is an expensive operation, results will be cached after first call.\n * @param excludeInherited If true, only properties defined directly on this class will be returned.\n * @returns An array of properties, empty array if none exist.\n */\n public async getProperties(excludeInherited?: boolean): Promise<Iterable<Property>> {\n // At the moment we do not lazy load properties, so this is the same as getPropertiesSync\n return this.getPropertiesSync(excludeInherited);\n }\n\n /**\n * Retrieve all custom attributes in the current class and its bases\n * This is the async version of getCustomAttributesSync()\n */\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\n return this.getCustomAttributesSync();\n }\n\n /**\n * Retrieve all custom attributes in the current class and its bases.\n */\n public getCustomAttributesSync(): CustomAttributeSet {\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\n if (undefined === customAttributes) {\n customAttributes = new Map<string, CustomAttribute>();\n }\n\n this.traverseBaseClassesSync((ecClass: ECClass) => {\n if (undefined === ecClass.customAttributes)\n return false;\n\n for (const [className, customAttribute] of ecClass.customAttributes) {\n if (customAttributes.has(className))\n continue;\n customAttributes.set(className, customAttribute);\n }\n\n return false;\n });\n\n return customAttributes;\n }\n\n /**\n * Asynchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\n * function for each base class encountered.\n * @param callback The function to call for each base class in the hierarchy.\n * @param arg An argument that will be passed as the second parameter to the callback function.\n */\n public async traverseBaseClasses(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): Promise<boolean> {\n for await (const baseClass of this.getAllBaseClasses()) {\n if (callback(baseClass, arg))\n return true;\n }\n\n return false;\n }\n\n /**\n * Synchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\n * function for each base class encountered.\n * @param callback The function to call for each base class in the hierarchy.\n * @param arg An argument that will be passed as the second parameter to the callback function.\n */\n public traverseBaseClassesSync(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): boolean {\n const baseClasses = this.getAllBaseClassesSync();\n if (!baseClasses)\n return false;\n\n for (const baseClass of baseClasses) {\n if (callback(baseClass, arg))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if the targetClass is of this type.\n * @param targetClass The ECClass or ECClass name to check.\n * @param schemaName The schema name. Required if targetClass is the ECClass name.\n */\n public async is(targetClass: string, schemaName: string): Promise<boolean>;\n public async is(targetClass: ECClass): Promise<boolean>;\n public async is(targetClass: ECClass | string, schemaName?: string): Promise<boolean> {\n return typeof targetClass === \"string\"\n ? this.isSync(targetClass, schemaName ?? \"\")\n : this.isSync(targetClass);\n }\n\n /**\n * A synchronous version of the [[ECClass.is]], indicating if the targetClass is of this type.\n * @param targetClass The class to check.\n */\n public isSync(targetClass: ECClass): boolean;\n public isSync(targetClass: string, schemaName: string): boolean;\n\n /** @internal */\n public isSync(targetClass: ECClass | string, schemaName?: string): boolean {\n let targetSchemaKey: SchemaItemKey | undefined;\n if (schemaName !== undefined) {\n assert(typeof (targetClass) === \"string\", \"Expected targetClass of type string because schemaName was specified\");\n\n targetSchemaKey = new SchemaItemKey(targetClass, new SchemaKey(schemaName));\n if (SchemaItem.equalByKey(this, targetSchemaKey))\n return true;\n\n } else {\n assert(ECClass.isECClass(targetClass), \"Expected targetClass to be of type ECClass\");\n\n if (SchemaItem.equalByKey(this, targetClass))\n return true;\n\n targetSchemaKey = targetClass.key;\n }\n\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n if(baseClassKey.matchesFullName(targetSchemaKey.fullName)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @internal\n */\n public static isECClass(object: any): object is ECClass {\n if (!SchemaItem.isSchemaItem(object))\n return false;\n\n return object.schemaItemType === SchemaItemType.EntityClass || object.schemaItemType === SchemaItemType.Mixin || object.schemaItemType === SchemaItemType.RelationshipClass ||\n object.schemaItemType === SchemaItemType.StructClass || object.schemaItemType === SchemaItemType.CustomAttributeClass;\n }\n\n /**\n * A setter method for the ECClass modifier, used specifically for schema editing.\n * @param modifier\n * @internal\n */\n protected setModifier(modifier: ECClassModifier) {\n this._modifier = modifier;\n }\n}\n\n/**\n * A Typescript class representation of an ECStructClass.\n * @public @preview\n */\nexport class StructClass extends ECClass {\n /**\n * Get the type of item represented by this instance\n */\n public override readonly schemaItemType = StructClass.schemaItemType;\n\n /**\n * Get the type of item represented by this class\n * @internal\n */\n public static override get schemaItemType() { return SchemaItemType.StructClass; }\n /**\n * Type guard to check if the SchemaItem is of type StructClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a StructClass, false otherwise.\n */\n public static isStructClass(item?: SchemaItem): item is StructClass {\n if (item && item.schemaItemType === SchemaItemType.StructClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type StructClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to StructClass if it is a StructClass, undefined otherwise.\n * @internal\n */\n public static assertIsStructClass(item?: SchemaItem): asserts item is StructClass {\n if (!this.isStructClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableStructClass extends StructClass {\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableClass extends ECClass {\n public abstract override setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override setModifier(modifier: ECClassModifier): void;\n public abstract override setName(name: string): void;\n public abstract override createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\n public abstract override createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\n public abstract override createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\n\n public abstract override createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\n public abstract override createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\n public abstract override createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\n\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\n\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\n\n public abstract override createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;\n public abstract override createStructPropertySync(name: string, structType: string | StructClass): StructProperty;\n\n public abstract override createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;\n public abstract override createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;\n\n public abstract override deleteProperty(name: string): Promise<void>;\n public abstract override deletePropertySync(name: string): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Class.js","sourceRoot":"","sources":["../../../src/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AAa,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { assert, Logger } from \"@itwin/core-bentley\";\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { ClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { AbstractSchemaItemType, classModifierToString, ECClassModifier, parseClassModifier, parsePrimitiveType, PrimitiveType, SchemaItemType, SupportedSchemaItemType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { AnyClass, LazyLoadedECClass } from \"../Interfaces\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { CustomAttribute, CustomAttributeContainerProps, CustomAttributeSet, serializeCustomAttributes } from \"./CustomAttribute\";\nimport { Enumeration } from \"./Enumeration\";\nimport {\n EnumerationArrayProperty, EnumerationProperty, PrimitiveArrayProperty, PrimitiveProperty, Property, StructArrayProperty, StructProperty,\n} from \"./Property\";\nimport { Schema } from \"./Schema\";\nimport { SchemaItem } from \"./SchemaItem\";\nimport { ECSpecVersion, SchemaReadHelper } from \"../Deserialization/Helper\";\n\nconst loggingCategory = \"ECClass\";\n\n/**\n * A common abstract class for all of the ECClass types.\n * @public @preview\n */\nexport abstract class ECClass extends SchemaItem implements CustomAttributeContainerProps {\n /** @internal */\n public static override get schemaItemType(): SupportedSchemaItemType { return AbstractSchemaItemType.Class; } // need this so getItem(\"name\", ECClass) in schema works\n private _modifier: ECClassModifier;\n private _baseClass?: LazyLoadedECClass;\n private _properties?: Map<string, Property>;\n private _customAttributes?: Map<string, CustomAttribute>;\n private _mergedPropertyCache?: Map<string, Property>;\n\n public get modifier() { return this._modifier; }\n public get customAttributes(): CustomAttributeSet | undefined { return this._customAttributes; }\n\n /** @internal */\n constructor(schema: Schema, name: string, modifier?: ECClassModifier) {\n super(schema, name);\n\n if (modifier)\n this._modifier = modifier;\n else\n this._modifier = ECClassModifier.None;\n }\n\n /**\n * Gets the base class if it exists, otherwise returns undefined.\n */\n public get baseClass(): LazyLoadedECClass | undefined {\n return this._baseClass;\n }\n\n public getBaseClassSync(): ECClass | undefined {\n if (!this.baseClass) {\n return undefined;\n }\n\n return this.schema.lookupItemSync(this.baseClass, ECClass);\n }\n\n /**\n * Sets the base class of the ECClass. Pass undefined to 'remove' the base class.\n *\n * @internal\n */\n protected async setBaseClass(baseClass: LazyLoadedECClass | undefined) {\n const oldBaseClass = this._baseClass;\n this._baseClass = baseClass;\n\n if (baseClass)\n this.schema.context.classHierarchy.addBaseClass(this.key, baseClass);\n else if (oldBaseClass)\n this.schema.context.classHierarchy.removeBaseClass(this.key, oldBaseClass);\n }\n\n /**\n * Gets the derived classes belonging to this class.\n * @note This method relies on the `SchemaContext` to find derived classes.\n * It will **only** return derived classes from schemas that have already been loaded into the context.\n * If a derived class exists in a referencing schema that has not yet been loaded, it will not be included in the results.\n * To ensure all derived classes are found, ensure that all relevant referencing schemas are loaded into the `SchemaContext`\n * before calling this method.\n * @returns An array of ECClasses or undefined if no derived classes exist.\n */\n public async getDerivedClasses(): Promise<ECClass[] | undefined> {\n const derivedClasses: ECClass[] = [];\n for (const derivedClassKey of this.schema.context.classHierarchy.getDerivedClassKeys(this.key)) {\n let derivedClass = await this.schema.getItem(derivedClassKey.name, ECClass); // if the derived class is in the same schema this will get it without going to the context\n if (derivedClass) {\n derivedClasses.push(derivedClass);\n continue;\n }\n Logger.logInfo(loggingCategory, `Derived class ${derivedClassKey.name} not found in schema ${this.schema.name}, looking in schema context.`);\n derivedClass = await this.schema.context.getSchemaItem(derivedClassKey, ECClass);\n if (derivedClass)\n derivedClasses.push(derivedClass);\n }\n\n if (derivedClasses.length === 0)\n return undefined;\n\n return derivedClasses;\n }\n\n /**\n * Convenience method for adding an already loaded ECProperty used by create*Property methods.\n * @param prop The property to add.\n * @return The property that was added.\n *\n * @internal\n */\n protected addProperty<T extends Property>(prop: T): T {\n if (!this._properties)\n this._properties = new Map<string, Property>();\n\n this._properties.set(prop.name.toUpperCase(), prop);\n this.cleanCache();\n return prop;\n }\n\n /**\n * Deletes a property from within this class.\n * @param name The property name to delete, lookup is case-insensitive\n * @internal\n */\n protected async deleteProperty(name: string): Promise<void> {\n if (this._properties) {\n const property = await this.getProperty(name);\n if (property) {\n this._properties.delete(name.toUpperCase());\n this.cleanCache();\n }\n }\n }\n\n /**\n * Deletes a property from within this class.\n * @param name The property name to delete, lookup is case-insensitive\n * @internal\n */\n protected deletePropertySync(name: string): void {\n if (this._properties) {\n const property = this.getPropertySync(name);\n if (property) {\n this._properties.delete(name.toUpperCase());\n this.cleanCache();\n }\n }\n }\n\n\n /**\n * Searches, case-insensitive, for an ECProperty with given the name on this class and, by default, on\n * all base classes. Set excludeInherited to 'true' to only search the local class.\n * @param name The name of the property to retrieve.\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\n */\n public async getProperty(name: string, excludeInherited?: boolean): Promise<Property | undefined> {\n const upperKey = name.toUpperCase();\n let property: Property | undefined;\n\n if (this._properties) {\n property = this._properties.get(upperKey);\n if (property) {\n return property;\n }\n }\n\n if (excludeInherited) {\n return undefined;\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = await this.buildPropertyCache();\n }\n\n return this._mergedPropertyCache.get(upperKey);\n }\n\n /**\n * Searches, case-insensitive, for a local ECProperty with the name provided.\n * @param name The name of the property to retrieve.\n * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.\n */\n public getPropertySync(name: string, excludeInherited?: boolean): Property | undefined {\n const upperKey = name.toUpperCase();\n let property: Property | undefined;\n\n if (this._properties) {\n property = this._properties.get(upperKey);\n if (property) {\n return property;\n }\n }\n\n if (excludeInherited) {\n return undefined;\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = this.buildPropertyCacheSync();\n }\n\n return this._mergedPropertyCache.get(upperKey);\n }\n\n /**\n * Searches the base class, if one exists, for the property with the name provided.\n * @param name The name of the inherited property to find.\n */\n public async getInheritedProperty(name: string): Promise<Property | undefined> {\n if (this.baseClass) {\n const baseClassObj = await this.baseClass;\n return baseClassObj.getProperty(name);\n }\n\n return undefined;\n }\n\n /**\n * Searches the base class, if one exists, for the property with the name provided.\n * @param name The name of the inherited property to find.\n */\n public getInheritedPropertySync(name: string): Property | undefined {\n const baseClassObj = this.getBaseClassSync();\n if (baseClassObj)\n return baseClassObj.getPropertySync(name);\n\n return undefined;\n }\n\n /**\n * Creates a PrimitiveECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\n *\n * @internal\n */\n protected async createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\n protected async createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\n protected async createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveProperty(this, name, propType));\n\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n * @throws ECSchemaStatus DuplicateProperty: thrown if a property with the same name already exists in the class.\n *\n * @internal\n */\n protected createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\n protected createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\n protected createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveProperty(this, name, propType));\n\n return this.addProperty(new EnumerationProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveArrayECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n *\n * @internal\n */\n protected async createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\n protected async createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\n protected async createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = await this.loadPrimitiveType(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\n\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n * Creates a PrimitiveArrayECProperty.\n * @param name The name of property to create.\n * @param primitiveType The primitive type of property to create. If not provided the default is PrimitiveType.Integer\n *\n * @internal\n */\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\n protected createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\n protected createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n const propType = this.loadPrimitiveTypeSync(primitiveType, this.schema);\n if (typeof (propType) === \"number\")\n return this.addProperty(new PrimitiveArrayProperty(this, name, propType));\n\n return this.addProperty(new EnumerationArrayProperty(this, name, new DelayedPromiseWithProps(propType.key, async () => propType)));\n }\n\n /**\n *\n * @param name The name of property to create.\n * @param structType The struct type of property to create.\n *\n * @internal\n */\n protected async createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructProperty(this, name, await this.loadStructType(structType, this.schema)));\n }\n\n /**\n *\n * @param name The name of property to create.\n * @param structType The struct type of property to create.\n *\n * @internal\n */\n protected createStructPropertySync(name: string, structType: string | StructClass): StructProperty {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\n }\n\n /**\n *\n * @param name\n * @param type\n *\n * @internal\n */\n protected async createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty> {\n if (await this.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructArrayProperty(this, name, await this.loadStructType(structType, this.schema)));\n }\n\n /**\n *\n * @param name\n * @param type\n *\n * @internal\n */\n protected createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty {\n if (this.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${this.name}.`);\n\n return this.addProperty(new StructArrayProperty(this, name, this.loadStructTypeSync(structType, this.schema)));\n }\n\n /**\n *\n * @param structType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected async loadStructType(structType: string | StructClass | undefined, schema: Schema): Promise<StructClass> {\n let correctType: StructClass | undefined;\n if (typeof (structType) === \"string\") {\n correctType = await schema.lookupItem(structType, StructClass);\n } else\n correctType = structType;\n\n if (!correctType)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${typeof structType === \"string\" ? structType : structType?.fullName ?? \"undefined\"}, is not a valid StructClass.`);\n\n return correctType;\n }\n\n /**\n *\n * @param structType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected loadStructTypeSync(structType: string | StructClass | undefined, schema: Schema): StructClass {\n let correctType: StructClass | undefined;\n if (typeof (structType) === \"string\") {\n correctType = schema.lookupItemSync(structType, StructClass);\n } else\n correctType = structType;\n\n if (!correctType)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided Struct type, ${typeof structType === \"string\" ? structType : structType?.fullName ?? \"undefined\"}, is not a valid StructClass.`);\n\n return correctType;\n }\n\n /**\n *\n * @param primitiveType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected async loadPrimitiveType(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): Promise<PrimitiveType | Enumeration> {\n if (primitiveType === undefined)\n return PrimitiveType.Integer;\n\n if (typeof (primitiveType) === \"string\") {\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\n if (!resolvedType) {\n resolvedType = await schema.lookupItem(primitiveType, Enumeration);\n }\n\n if (resolvedType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n // If resolvedType is a SchemaItem, make sure it is an Enumeration- if not, throw an error\n if (typeof (resolvedType) !== \"number\" && resolvedType.schemaItemType !== SchemaItemType.Enumeration)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n return resolvedType;\n }\n\n return primitiveType;\n }\n\n /**\n *\n * @param primitiveType\n * @param schema\n * @returns\n *\n * @internal\n */\n protected loadPrimitiveTypeSync(primitiveType: string | PrimitiveType | Enumeration | undefined, schema: Schema): PrimitiveType | Enumeration {\n if (primitiveType === undefined)\n return PrimitiveType.Integer;\n\n if (typeof (primitiveType) === \"string\") {\n let resolvedType: (PrimitiveType | Enumeration | undefined) = parsePrimitiveType(primitiveType);\n if (!resolvedType) {\n resolvedType = schema.lookupItemSync(primitiveType, Enumeration);\n }\n\n if (resolvedType === undefined)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided primitive type, ${primitiveType}, is not a valid PrimitiveType or Enumeration.`);\n\n return resolvedType;\n }\n\n return primitiveType;\n }\n\n /**\n * Save this Classes properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): ClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n const isMixin = SchemaItemType.Mixin === this.schemaItemType;\n const isRelationship = SchemaItemType.RelationshipClass === this.schemaItemType;\n if (!isMixin && (ECClassModifier.None !== this.modifier || isRelationship))\n schemaJson.modifier = classModifierToString(this.modifier);\n if (this.baseClass !== undefined)\n schemaJson.baseClass = this.baseClass.fullName;\n if (this._properties !== undefined && this._properties.size > 0)\n schemaJson.properties = [...this._properties.values()].map((prop) => prop.toJSON());\n\n const customAttributes = serializeCustomAttributes(this.customAttributes);\n if (customAttributes !== undefined)\n schemaJson.customAttributes = customAttributes;\n return schemaJson as ClassProps;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n if (undefined !== this.modifier)\n itemElement.setAttribute(\"modifier\", classModifierToString(this.modifier));\n\n if (undefined !== this.baseClass) {\n const baseClass = await this.baseClass;\n const baseClassElement = schemaXml.createElement(\"BaseClass\");\n const baseClassName = XmlSerializationUtils.createXmlTypedName(this.schema, baseClass.schema, baseClass.name);\n baseClassElement.textContent = baseClassName;\n itemElement.appendChild(baseClassElement);\n }\n\n if (this._properties) {\n for (const prop of this._properties.values()) {\n const propXml = await prop.toXml(schemaXml);\n itemElement.appendChild(propXml);\n }\n }\n\n if (this._customAttributes) {\n const caContainerElement = schemaXml.createElement(\"ECCustomAttributes\");\n for (const [name, attribute] of this._customAttributes) {\n const caElement = await XmlSerializationUtils.writeCustomAttribute(name, attribute, schemaXml, this.schema);\n caContainerElement.appendChild(caElement);\n }\n itemElement.appendChild(caContainerElement);\n }\n\n return itemElement;\n }\n\n public override fromJSONSync(classProps: ClassProps) {\n super.fromJSONSync(classProps);\n\n if (undefined !== classProps.modifier) {\n const modifier = parseClassModifier(classProps.modifier);\n if (undefined === modifier) {\n if (SchemaReadHelper.isECSpecVersionNewer({ readVersion: classProps.originalECSpecMajorVersion, writeVersion: classProps.originalECSpecMinorVersion } as ECSpecVersion))\n this._modifier = ECClassModifier.None;\n else\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, `The string '${classProps.modifier}' is not a valid ECClassModifier.`);\n } else {\n this._modifier = modifier;\n }\n }\n\n if (undefined !== classProps.baseClass) {\n const ecClassSchemaItemKey = this.schema.getSchemaItemKey(classProps.baseClass);\n if (!ecClassSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\n\n const baseClass = this.schema.lookupItemSync(ecClassSchemaItemKey);\n\n let lazyBase: LazyLoadedECClass;\n if (!baseClass) {\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\n async () => {\n const baseItem = await this.schema.lookupItem(ecClassSchemaItemKey);\n if (undefined === baseItem || !ECClass.isECClass(baseItem))\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate the baseClass ${classProps.baseClass}.`);\n return baseItem;\n });\n } else {\n lazyBase = new DelayedPromiseWithProps<SchemaItemKey, ECClass>(ecClassSchemaItemKey,\n async () => {\n return baseClass as ECClass;\n });\n }\n\n this._baseClass = lazyBase;\n this.schema.context.classHierarchy.addBaseClass(this.key, lazyBase);\n }\n }\n\n public override async fromJSON(classProps: ClassProps): Promise<void> {\n this.fromJSONSync(classProps);\n }\n\n /**\n *\n * @param customAttribute\n *\n * @internal\n */\n protected addCustomAttribute(customAttribute: CustomAttribute) {\n if (!this._customAttributes)\n this._customAttributes = new Map<string, CustomAttribute>();\n\n this._customAttributes.set(customAttribute.className, customAttribute);\n }\n\n /**\n * Iterates (recursively) over all base classes and mixins, in \"property override\" order.\n * This is essentially a depth-first traversal through the inheritance tree.\n */\n public async *getAllBaseClasses(): AsyncIterable<ECClass> {\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n const baseClass = await this.getClassFromReferencesRecursively(baseClassKey); // Search in schema ref tree all the way to the top\n if (baseClass)\n yield baseClass;\n }\n }\n\n /**\n * gets a class from this schema or its references recursively using the item key\n * @param itemKey\n * @returns ECClass if it could be found, undefined otherwise\n * @internal\n */\n private async getClassFromReferencesRecursively(itemKey: SchemaItemKey): Promise<ECClass | undefined> {\n const schemaList: Schema[] = [this.schema];\n while (schemaList.length > 0) {\n const currentSchema = schemaList.shift();\n if (!currentSchema)\n break;\n if (currentSchema.schemaKey.compareByName(itemKey.schemaKey)) {\n const baseClass = await currentSchema.getItem(itemKey.name, ECClass);\n schemaList.splice(0); // clear the list\n return baseClass;\n }\n schemaList.push(...currentSchema.references);\n }\n return undefined;\n }\n\n public *getAllBaseClassesSync(): Iterable<AnyClass> {\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n const baseClass = this.getClassFromReferencesRecursivelySync(baseClassKey); // Search in schema ref tree all the way to the top\n if (baseClass)\n yield baseClass;\n }\n }\n\n /**\n * gets a class from this schema or its references recursively using the item key synchronously\n * @param itemKey\n * @returns ECClass if it could be found, undefined otherwise\n * @internal\n */\n private getClassFromReferencesRecursivelySync(itemKey: SchemaItemKey): ECClass | undefined {\n const schemaList: Schema[] = [this.schema];\n while (schemaList.length > 0) {\n const currentSchema = schemaList.shift();\n if (!currentSchema)\n break;\n if (currentSchema.schemaKey.compareByName(itemKey.schemaKey)) {\n const baseClass = currentSchema.getItemSync(itemKey.name, ECClass);\n schemaList.splice(0); // clear the list\n return baseClass;\n }\n schemaList.push(...currentSchema.references);\n }\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase())) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n }\n\n if (this._properties) {\n this._properties.forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n for (const property of baseClass.getPropertiesSync()) {\n if (!cache.has(property.name.toUpperCase())) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n }\n\n if (this._properties) {\n this._properties.forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n * Clears all caches on this object. This is called implicitly for this class,\n * but needs to be called if derived classes have changed.\n * @internal\n */\n public cleanCache() {\n this._mergedPropertyCache = undefined;\n }\n\n /**\n * Returns the properties on this class and its base classes.\n * Since this is an expensive operation, results will be cached after first call.\n * @param excludeInherited If true, only properties defined directly on this class will be returned. Defaults to false.\n * @returns An array of properties, empty array if none exist.\n */\n public getPropertiesSync(excludeInherited?: boolean): Iterable<Property> {\n if (excludeInherited) {\n return this._properties && this._properties.size > 0 ? this._properties.values() : [];\n }\n\n if (!this._mergedPropertyCache) {\n this._mergedPropertyCache = this.buildPropertyCacheSync();\n }\n\n return this._mergedPropertyCache.values();\n }\n\n /**\n * Quick way to check whether this class has any local properties without having to use the iterable\n */\n public get hasLocalProperties(): boolean {\n return this._properties !== undefined && this._properties.size > 0;\n }\n\n /**\n * Returns the properties on this class and its base classes.\n * Since this is an expensive operation, results will be cached after first call.\n * @param excludeInherited If true, only properties defined directly on this class will be returned.\n * @returns An array of properties, empty array if none exist.\n */\n public async getProperties(excludeInherited?: boolean): Promise<Iterable<Property>> {\n // At the moment we do not lazy load properties, so this is the same as getPropertiesSync\n return this.getPropertiesSync(excludeInherited);\n }\n\n /**\n * Retrieve all custom attributes in the current class and its bases\n * This is the async version of getCustomAttributesSync()\n */\n public async getCustomAttributes(): Promise<CustomAttributeSet> {\n return this.getCustomAttributesSync();\n }\n\n /**\n * Retrieve all custom attributes in the current class and its bases.\n */\n public getCustomAttributesSync(): CustomAttributeSet {\n let customAttributes: Map<string, CustomAttribute> | undefined = this._customAttributes;\n if (undefined === customAttributes) {\n customAttributes = new Map<string, CustomAttribute>();\n }\n\n this.traverseBaseClassesSync((ecClass: ECClass) => {\n if (undefined === ecClass.customAttributes)\n return false;\n\n for (const [className, customAttribute] of ecClass.customAttributes) {\n if (customAttributes.has(className))\n continue;\n customAttributes.set(className, customAttribute);\n }\n\n return false;\n });\n\n return customAttributes;\n }\n\n /**\n * Asynchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\n * function for each base class encountered.\n * @param callback The function to call for each base class in the hierarchy.\n * @param arg An argument that will be passed as the second parameter to the callback function.\n */\n public async traverseBaseClasses(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): Promise<boolean> {\n for await (const baseClass of this.getAllBaseClasses()) {\n if (callback(baseClass, arg))\n return true;\n }\n\n return false;\n }\n\n /**\n * Synchronously traverses through the inheritance tree, using depth-first traversal, calling the given callback\n * function for each base class encountered.\n * @param callback The function to call for each base class in the hierarchy.\n * @param arg An argument that will be passed as the second parameter to the callback function.\n */\n public traverseBaseClassesSync(callback: (ecClass: ECClass, arg?: any) => boolean, arg?: any): boolean {\n const baseClasses = this.getAllBaseClassesSync();\n if (!baseClasses)\n return false;\n\n for (const baseClass of baseClasses) {\n if (callback(baseClass, arg))\n return true;\n }\n\n return false;\n }\n\n /**\n * Indicates if the targetClass is of this type.\n * @param targetClass The ECClass or ECClass name to check.\n * @param schemaName The schema name. Required if targetClass is the ECClass name.\n */\n public async is(targetClass: string, schemaName: string): Promise<boolean>;\n public async is(targetClass: ECClass): Promise<boolean>;\n public async is(targetClass: ECClass | string, schemaName?: string): Promise<boolean> {\n return typeof targetClass === \"string\"\n ? this.isSync(targetClass, schemaName ?? \"\")\n : this.isSync(targetClass);\n }\n\n /**\n * A synchronous version of the [[ECClass.is]], indicating if the targetClass is of this type.\n * @param targetClass The class to check.\n */\n public isSync(targetClass: ECClass): boolean;\n public isSync(targetClass: string, schemaName: string): boolean;\n\n /** @internal */\n public isSync(targetClass: ECClass | string, schemaName?: string): boolean {\n let targetSchemaKey: SchemaItemKey | undefined;\n if (schemaName !== undefined) {\n assert(typeof (targetClass) === \"string\", \"Expected targetClass of type string because schemaName was specified\");\n\n targetSchemaKey = new SchemaItemKey(targetClass, new SchemaKey(schemaName));\n if (SchemaItem.equalByKey(this, targetSchemaKey))\n return true;\n\n } else {\n assert(ECClass.isECClass(targetClass), \"Expected targetClass to be of type ECClass\");\n\n if (SchemaItem.equalByKey(this, targetClass))\n return true;\n\n targetSchemaKey = targetClass.key;\n }\n\n for (const baseClassKey of this.schema.context.classHierarchy.getBaseClassKeys(this.key)) {\n if (baseClassKey.matchesFullName(targetSchemaKey.fullName)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * @internal\n */\n public static isECClass(object: any): object is ECClass {\n if (!SchemaItem.isSchemaItem(object))\n return false;\n\n return object.schemaItemType === SchemaItemType.EntityClass || object.schemaItemType === SchemaItemType.Mixin || object.schemaItemType === SchemaItemType.RelationshipClass ||\n object.schemaItemType === SchemaItemType.StructClass || object.schemaItemType === SchemaItemType.CustomAttributeClass;\n }\n\n /**\n * A setter method for the ECClass modifier, used specifically for schema editing.\n * @param modifier\n * @internal\n */\n protected setModifier(modifier: ECClassModifier) {\n this._modifier = modifier;\n }\n}\n\n/**\n * A Typescript class representation of an ECStructClass.\n * @public @preview\n */\nexport class StructClass extends ECClass {\n /**\n * Get the type of item represented by this instance\n */\n public override readonly schemaItemType = StructClass.schemaItemType;\n\n /**\n * Get the type of item represented by this class\n * @internal\n */\n public static override get schemaItemType() { return SchemaItemType.StructClass; }\n /**\n * Type guard to check if the SchemaItem is of type StructClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is a StructClass, false otherwise.\n */\n public static isStructClass(item?: SchemaItem): item is StructClass {\n if (item && item.schemaItemType === SchemaItemType.StructClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type StructClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to StructClass if it is a StructClass, undefined otherwise.\n * @internal\n */\n public static assertIsStructClass(item?: SchemaItem): asserts item is StructClass {\n if (!this.isStructClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.StructClass}' (StructClass)`);\n }\n}\n\n/**\n * @internal\n * An abstract class used for schema editing.\n */\nexport abstract class MutableStructClass extends StructClass {\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableClass extends ECClass {\n public abstract override setBaseClass(baseClass: LazyLoadedECClass | undefined): Promise<void>;\n public abstract override addCustomAttribute(customAttribute: CustomAttribute): void;\n public abstract override setModifier(modifier: ECClassModifier): void;\n public abstract override setName(name: string): void;\n public abstract override createPrimitiveProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveProperty>;\n public abstract override createPrimitiveProperty(name: string, primitiveType: Enumeration): Promise<EnumerationProperty>;\n public abstract override createPrimitiveProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\n\n public abstract override createPrimitivePropertySync(name: string, primitiveType: PrimitiveType): PrimitiveProperty;\n public abstract override createPrimitivePropertySync(name: string, primitiveType: Enumeration): EnumerationProperty;\n public abstract override createPrimitivePropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\n\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: PrimitiveType): Promise<PrimitiveArrayProperty>;\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType: Enumeration): Promise<EnumerationArrayProperty>;\n public abstract override createPrimitiveArrayProperty(name: string, primitiveType?: string | PrimitiveType | Enumeration): Promise<Property>;\n\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: PrimitiveType): PrimitiveArrayProperty;\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType: Enumeration): EnumerationArrayProperty;\n public abstract override createPrimitiveArrayPropertySync(name: string, primitiveType?: string | PrimitiveType | Enumeration): Property;\n\n public abstract override createStructProperty(name: string, structType: string | StructClass): Promise<StructProperty>;\n public abstract override createStructPropertySync(name: string, structType: string | StructClass): StructProperty;\n\n public abstract override createStructArrayProperty(name: string, structType: string | StructClass): Promise<StructArrayProperty>;\n public abstract override createStructArrayPropertySync(name: string, structType: string | StructClass): StructArrayProperty;\n\n public abstract override deleteProperty(name: string): Promise<void>;\n public abstract override deletePropertySync(name: string): void;\n}\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,cA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MAAM,GAAG,iBAAiB,GAAG,kBAAkB,CAsBhL"}
|
|
@@ -252,7 +252,7 @@ export async function createNavigationProperty(ecClass, name, relationship, dire
|
|
|
252
252
|
else
|
|
253
253
|
resolvedRelationship = relationship;
|
|
254
254
|
if (!resolvedRelationship)
|
|
255
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`);
|
|
255
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === "string" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);
|
|
256
256
|
if (typeof (direction) === "string") {
|
|
257
257
|
const tmpDirection = parseStrengthDirection(direction);
|
|
258
258
|
if (undefined === tmpDirection)
|
|
@@ -273,7 +273,7 @@ export function createNavigationPropertySync(ecClass, name, relationship, direct
|
|
|
273
273
|
else
|
|
274
274
|
resolvedRelationship = relationship;
|
|
275
275
|
if (!resolvedRelationship)
|
|
276
|
-
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${relationship}, is not a valid RelationshipClassInterface.`);
|
|
276
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === "string" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);
|
|
277
277
|
if (typeof (direction) === "string") {
|
|
278
278
|
const tmpDirection = parseStrengthDirection(direction);
|
|
279
279
|
if (undefined === tmpDirection)
|