@itwin/ecschema-metadata 5.2.0-dev.8 → 5.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/lib/cjs/Deserialization/JsonProps.d.ts +9 -2
  3. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  4. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  5. package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts +37 -0
  6. package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
  7. package/lib/cjs/Formatting/FormatSetFormatsProvider.js +58 -0
  8. package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -0
  9. package/lib/cjs/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
  10. package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
  11. package/lib/cjs/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
  12. package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -0
  13. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
  14. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
  15. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +62 -34
  16. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  17. package/lib/cjs/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -1
  18. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +1 -0
  19. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  20. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
  21. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
  22. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
  23. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  24. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
  25. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +2 -7
  26. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  27. package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
  28. package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
  29. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js +17 -17
  30. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  31. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +4 -4
  32. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  33. package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +10 -4
  34. package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -1
  35. package/lib/cjs/IncrementalLoading/SchemaParser.js +19 -19
  36. package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
  37. package/lib/cjs/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
  38. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +7 -24
  39. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  40. package/lib/cjs/Metadata/EntityClass.js +1 -1
  41. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  42. package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
  43. package/lib/cjs/Metadata/KindOfQuantity.js +9 -22
  44. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  45. package/lib/cjs/Metadata/Schema.d.ts +2 -0
  46. package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
  47. package/lib/cjs/Metadata/Schema.js +4 -0
  48. package/lib/cjs/Metadata/Schema.js.map +1 -1
  49. package/lib/cjs/ecschema-metadata.d.ts +2 -1
  50. package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
  51. package/lib/cjs/ecschema-metadata.js +2 -1
  52. package/lib/cjs/ecschema-metadata.js.map +1 -1
  53. package/lib/esm/Deserialization/JsonProps.d.ts +9 -2
  54. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  55. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  56. package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +37 -0
  57. package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
  58. package/lib/esm/Formatting/FormatSetFormatsProvider.js +54 -0
  59. package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -0
  60. package/lib/esm/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
  61. package/lib/esm/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
  62. package/lib/esm/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
  63. package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -0
  64. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
  65. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
  66. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +61 -33
  67. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  68. package/lib/esm/IncrementalLoading/FullSchemaQueries.d.ts.map +1 -1
  69. package/lib/esm/IncrementalLoading/FullSchemaQueries.js +1 -0
  70. package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  71. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
  72. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
  73. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
  74. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  75. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
  76. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +2 -7
  77. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  78. package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
  79. package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
  80. package/lib/esm/IncrementalLoading/SchemaItemParsers.js +17 -17
  81. package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  82. package/lib/esm/IncrementalLoading/SchemaItemQueries.js +4 -4
  83. package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  84. package/lib/esm/IncrementalLoading/SchemaParser.d.ts +10 -4
  85. package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -1
  86. package/lib/esm/IncrementalLoading/SchemaParser.js +19 -19
  87. package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
  88. package/lib/esm/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
  89. package/lib/esm/IncrementalLoading/SchemaStubQueries.js +7 -24
  90. package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  91. package/lib/esm/Metadata/EntityClass.js +1 -1
  92. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  93. package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
  94. package/lib/esm/Metadata/KindOfQuantity.js +9 -22
  95. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  96. package/lib/esm/Metadata/Schema.d.ts +2 -0
  97. package/lib/esm/Metadata/Schema.d.ts.map +1 -1
  98. package/lib/esm/Metadata/Schema.js +4 -0
  99. package/lib/esm/Metadata/Schema.js.map +1 -1
  100. package/lib/esm/ecschema-metadata.d.ts +2 -1
  101. package/lib/esm/ecschema-metadata.d.ts.map +1 -1
  102. package/lib/esm/ecschema-metadata.js +2 -1
  103. package/lib/esm/ecschema-metadata.js.map +1 -1
  104. package/package.json +6 -6
  105. package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +0 -60
  106. package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
  107. package/lib/cjs/IncrementalLoading/PerformanceLogger.js +0 -82
  108. package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +0 -1
  109. package/lib/cjs/SchemaFormatsProvider.d.ts.map +0 -1
  110. package/lib/cjs/SchemaFormatsProvider.js.map +0 -1
  111. package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +0 -60
  112. package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
  113. package/lib/esm/IncrementalLoading/PerformanceLogger.js +0 -78
  114. package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +0 -1
  115. package/lib/esm/SchemaFormatsProvider.d.ts.map +0 -1
  116. package/lib/esm/SchemaFormatsProvider.js.map +0 -1
@@ -5,13 +5,13 @@
5
5
  /** @packageDocumentation
6
6
  * @module Metadata
7
7
  */
8
- import { SchemaContext } from "./Context";
9
- import { SchemaItemKey, SchemaKey } from "./SchemaKey";
10
- import { SchemaItem } from "./Metadata/SchemaItem";
11
- import { Format } from "./Metadata/Format";
8
+ import { SchemaContext } from "../Context";
9
+ import { SchemaItemKey, SchemaKey } from "../SchemaKey";
10
+ import { SchemaItem } from "../Metadata/SchemaItem";
11
+ import { Format } from "../Metadata/Format";
12
12
  import { BeEvent, Logger } from "@itwin/core-bentley";
13
- import { KindOfQuantity } from "./Metadata/KindOfQuantity";
14
- import { getFormatProps } from "./Metadata/OverrideFormat";
13
+ import { KindOfQuantity } from "../Metadata/KindOfQuantity";
14
+ import { getFormatProps } from "../Metadata/OverrideFormat";
15
15
  const loggerCategory = "SchemaFormatsProvider";
16
16
  /**
17
17
  * Provides default formats and kind of quantities from a given SchemaContext or SchemaLocater.
@@ -0,0 +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,YA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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 Used to lookup a default format through a schema specific algorithm, when the format retrieved is associated with a KindOfQuantity.\n */\n constructor(contextOrLocater: ISchemaLocater, unitSystem: UnitSystemKey) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitSystem = unitSystem;\n }\n\n public get context() { return this._context; }\n public get unitSystem() { return this._unitSystem; }\n\n public set unitSystem(unitSystem: UnitSystemKey) {\n this._unitSystem = unitSystem;\n this.clear();\n }\n\n private clear(): void {\n const formatsChanged = Array.from(this._formatsRetrieved);\n this._formatsRetrieved.clear();\n this.onFormatsChanged.raiseEvent({ formatsChanged });\n }\n\n /** When using a presentation unit from a KindOfQuantity, the label and description should come from the KindOfQuantity */\n private convertToFormatDefinition(format: SchemaItemFormatProps, kindOfQuantity: KindOfQuantity): FormatDefinition {\n // Destructure all properties except 'rest'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { name, label, description, $schema, schema, schemaVersion, schemaItemType,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n customAttributes, originalECSpecMajorVersion, originalECSpecMinorVersion, ...rest } = format;\n\n return {\n ...rest,\n name: kindOfQuantity.fullName,\n label: kindOfQuantity.label ?? format.label,\n description: kindOfQuantity.description ?? format.description,\n }\n }\n\n private async getKindOfQuantityFormatFromSchema(itemKey: SchemaItemKey): Promise<FormatDefinition | undefined> {\n let kindOfQuantity: KindOfQuantity | undefined;\n try {\n kindOfQuantity = await this._context.getSchemaItem(itemKey, KindOfQuantity);\n } catch {\n Logger.logError(loggerCategory, `Failed to find KindOfQuantity ${itemKey.fullName}`);\n return undefined;\n }\n\n if (!kindOfQuantity) {\n return undefined;\n }\n\n // Find the first presentation format that matches the provided unit system.\n const unitSystemMatchers = getUnitSystemGroupMatchers(this._unitSystem);\n const presentationFormats = kindOfQuantity.presentationFormats;\n for (const matcher of unitSystemMatchers) {\n for (const lazyFormat of presentationFormats) {\n const format = await lazyFormat;\n const unit = await (format.units && format.units[0][0]);\n if (!unit) {\n continue;\n }\n const currentUnitSystem = await unit.unitSystem;\n if (currentUnitSystem && matcher(currentUnitSystem)) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getFormatProps(format);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n }\n }\n\n // If no matching presentation format was found, use persistence unit format if it matches unit system.\n const persistenceUnit = await kindOfQuantity.persistenceUnit;\n const persistenceUnitSystem = await persistenceUnit?.unitSystem;\n if (persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\n this._formatsRetrieved.add(itemKey.fullName);\n const props = getPersistenceUnitFormatProps(persistenceUnit!);\n return this.convertToFormatDefinition(props, kindOfQuantity);\n }\n\n const defaultFormat = kindOfQuantity.defaultPresentationFormat;\n if (!defaultFormat) {\n return undefined;\n }\n this._formatsRetrieved.add(itemKey.fullName);\n const defaultProps = getFormatProps(await defaultFormat);\n return this.convertToFormatDefinition(defaultProps, kindOfQuantity);\n }\n\n\n /**\n * Retrieves a Format from a SchemaContext. If the format is part of a KindOfQuantity, the first presentation format in the KindOfQuantity that matches the current unit system will be retrieved.\n * If no presentation format matches the current unit system, the persistence unit format will be retrieved if it matches the current unit system.\n * Else, the default presentation format will be retrieved.\n * @param name The full name of the Format or KindOfQuantity.\n * @returns\n */\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(name);\n const schemaKey = new SchemaKey(schemaName);\n let schema: Schema | undefined;\n try {\n schema = await this._context.getSchema(schemaKey);\n } catch {\n Logger.logError(loggerCategory, `Failed to find schema ${schemaName}`);\n return undefined;\n }\n if (!schema) {\n return undefined;\n }\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n\n if (schema.name === \"Formats\") {\n let format: Format | undefined;\n try {\n format = await this._context.getSchemaItem(itemKey, Format);\n } catch {\n Logger.logError(loggerCategory, `Failed to find Format ${itemKey.fullName}`);\n return undefined;\n }\n if (!format) {\n return undefined;\n }\n return format.toJSON(true);\n }\n return this.getKindOfQuantityFormatFromSchema(itemKey);\n }\n}\n\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\n function createMatcher(name: string | string[]) {\n const names = Array.isArray(name) ? name : [name];\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\n }\n switch (groupKey) {\n case \"imperial\":\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"metric\":\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usCustomary\":\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n case \"usSurvey\":\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\n }\n return [];\n}\n\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\n // Same as Format \"DefaultRealU\" in Formats ecschema\n return {\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\n precision: 6,\n type: \"Decimal\",\n composite: {\n units: [\n {\n name: persistenceUnit.fullName,\n label: persistenceUnit.label,\n },\n ],\n },\n };\n}"]}
@@ -3,7 +3,6 @@ import { ConstantProps, CustomAttributeClassProps, EntityClassProps, Enumeration
3
3
  import { SchemaInfo } from "../Interfaces";
4
4
  import { SchemaKey } from "../SchemaKey";
5
5
  import { IncrementalSchemaLocater, SchemaLocaterOptions } from "./IncrementalSchemaLocater";
6
- import { PerformanceLogger } from "./PerformanceLogger";
7
6
  interface QueryParameters {
8
7
  [parameterName: string]: string | number;
9
8
  }
@@ -23,8 +22,6 @@ export interface ECSqlQueryOptions {
23
22
  export interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {
24
23
  /** Query for Schemas using multiple queries. Defaults to false. */
25
24
  readonly useMultipleQueries?: boolean;
26
- /** Collects query execution performance data. Defaults to false. */
27
- readonly performanceLogger?: PerformanceLogger;
28
25
  }
29
26
  /**
30
27
  * An abstract [[IncrementalSchemaLocater]] implementation for loading
@@ -60,10 +57,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
60
57
  * @param context The [[SchemaContext]] to use for resolving references.
61
58
  * @internal
62
59
  */
63
- getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;
64
- /**
65
- * Gets the [[SchemaProps]] without schemaItems.
66
- */
60
+ protected getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;
67
61
  /**
68
62
  * Gets the [[SchemaProps]] without schemaItems for the given schema name.
69
63
  * @param schemaName The name of the Schema.
@@ -71,7 +65,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
71
65
  * @returns
72
66
  * @internal
73
67
  */
74
- getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined>;
68
+ private getSchemaNoItems;
75
69
  /**
76
70
  * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.
77
71
  * @param context The schema context to lookup the meta schema.
@@ -85,7 +79,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
85
79
  * @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.
86
80
  * @internal
87
81
  */
88
- getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]>;
82
+ protected getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]>;
89
83
  /**
90
84
  * Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.
91
85
  * @param schemaName The name of the Schema.
@@ -93,7 +87,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
93
87
  * @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.
94
88
  * @internal
95
89
  */
96
- getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]>;
90
+ protected getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]>;
97
91
  /**
98
92
  * Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.
99
93
  * @param schemaName The name of the Schema.
@@ -101,7 +95,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
101
95
  * @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.
102
96
  * @internal
103
97
  */
104
- getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]>;
98
+ protected getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]>;
105
99
  /**
106
100
  * Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.
107
101
  * @param schemaName The name of the Schema.
@@ -109,7 +103,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
109
103
  * @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.
110
104
  * @internal
111
105
  */
112
- getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]>;
106
+ protected getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]>;
113
107
  /**
114
108
  * Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.
115
109
  * @param schemaName The name of the Schema.
@@ -117,7 +111,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
117
111
  * @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.
118
112
  * @internal
119
113
  */
120
- getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]>;
114
+ protected getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]>;
121
115
  /**
122
116
  * Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.
123
117
  * @param schema The name of the Schema.
@@ -125,7 +119,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
125
119
  * @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.
126
120
  * @internal
127
121
  */
128
- getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]>;
122
+ protected getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]>;
129
123
  /**
130
124
  * Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.
131
125
  * @param schema The name of the Schema.
@@ -133,7 +127,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
133
127
  * @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.
134
128
  * @internal
135
129
  */
136
- getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]>;
130
+ protected getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]>;
137
131
  /**
138
132
  * Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.
139
133
  * @param schema The name of the Schema.
@@ -141,7 +135,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
141
135
  * @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.
142
136
  * @internal
143
137
  */
144
- getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]>;
138
+ protected getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]>;
145
139
  /**
146
140
  * Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.
147
141
  * @param schema The name of the Schema.
@@ -149,7 +143,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
149
143
  * @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.
150
144
  * @internal
151
145
  */
152
- getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]>;
146
+ protected getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]>;
153
147
  /**
154
148
  * Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.
155
149
  * @param schema The name of the Schema.
@@ -157,7 +151,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
157
151
  * @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.
158
152
  * @internal
159
153
  */
160
- getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]>;
154
+ protected getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]>;
161
155
  /**
162
156
  * Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.
163
157
  * @param schema The name of the Schema.
@@ -165,7 +159,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
165
159
  * @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.
166
160
  * @internal
167
161
  */
168
- getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]>;
162
+ protected getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]>;
169
163
  /**
170
164
  * Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.
171
165
  * @param schema The name of the Schema.
@@ -173,7 +167,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
173
167
  * @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.
174
168
  * @internal
175
169
  */
176
- getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]>;
170
+ protected getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]>;
177
171
  /**
178
172
  * Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.
179
173
  * @param schema The name of the Schema.
@@ -181,7 +175,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
181
175
  * @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.
182
176
  * @internal
183
177
  */
184
- getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]>;
178
+ protected getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]>;
185
179
  /**
186
180
  * Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.
187
181
  * @param schema The name of the Schema.
@@ -189,12 +183,12 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
189
183
  * @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.
190
184
  * @internal
191
185
  */
192
- getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]>;
186
+ protected getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]>;
193
187
  /**
194
188
  * Gets [[SchemaInfo]] objects for all schemas including their direct schema references.
195
189
  * @internal
196
190
  */
197
- loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>>;
191
+ protected loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>>;
198
192
  /**
199
193
  * Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy
200
194
  * can be included in the initial fetch.
@@ -202,7 +196,7 @@ export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocate
202
196
  * @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].
203
197
  * @internal
204
198
  */
205
- getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;
199
+ protected getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;
206
200
  private querySchemaItem;
207
201
  private getFullSchema;
208
202
  private getFullSchemaMultipleQueries;
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlSchemaLocater.d.ts","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EACvI,eAAe,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAmB,mBAAmB,EAAE,WAAW,EAC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gB,EAAE,CAAC;IAIpG;;;;;;OAMG;cACa,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIhG;;;;;;OAMG;cACa,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItG;;;;;;OAMG;cACa,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI9F;;;;;;OAMG;cACa,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAIlG;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAIjG;;;;;;OAMG;cACa,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIpG;;;OAGG;cACa,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAarE;;;;;;OAMG;cACa,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;YA8DlH,eAAe;YAuBf,aAAa;YAgBb,4BAA4B;CAmC3C"}
@@ -2,13 +2,15 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { parseSchemaItemType, SchemaMatchType } from "../ECObjects";
5
+ import { Logger } from "@itwin/core-bentley";
6
+ import { SchemaMatchType } from "../ECObjects";
6
7
  import { SchemaKey } from "../SchemaKey";
7
8
  import { FullSchemaQueries } from "./FullSchemaQueries";
8
9
  import { IncrementalSchemaLocater } from "./IncrementalSchemaLocater";
9
10
  import { SchemaItemQueries } from "./SchemaItemQueries";
10
11
  import { SchemaParser } from "./SchemaParser";
11
12
  import { ecsqlQueries } from "./SchemaStubQueries";
13
+ const LOGGER_CATEGORY = "IncrementalSchemaLoading.Performance";
12
14
  /**
13
15
  * An abstract [[IncrementalSchemaLocater]] implementation for loading
14
16
  * EC [Schema] instances from an iModelDb using ECSql queries.
@@ -41,17 +43,19 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
41
43
  // to fetch the whole schema json.
42
44
  if (!await this.supportPartialSchemaLoading(context))
43
45
  return this.getSchemaProps(schemaKey);
44
- const start = Date.now();
46
+ const queryStart = Date.now();
45
47
  const schemaProps = this.options.useMultipleQueries
46
48
  ? await this.getFullSchemaMultipleQueries(schemaKey, context)
47
49
  : await this.getFullSchema(schemaKey, context);
48
- this.options.performanceLogger?.logSchema(start, schemaKey.name);
50
+ const queryDuration = Date.now() - queryStart;
51
+ Logger.logTrace(LOGGER_CATEGORY, `Recieved SchemaProps for ${schemaKey.name} in ${queryDuration}ms`, {
52
+ schemaName: schemaKey.name,
53
+ queryMode: this.options.useMultipleQueries ? "parallel" : "single",
54
+ duration: queryDuration,
55
+ });
49
56
  return schemaProps;
50
57
  }
51
58
  ;
52
- /**
53
- * Gets the [[SchemaProps]] without schemaItems.
54
- */
55
59
  /**
56
60
  * Gets the [[SchemaProps]] without schemaItems for the given schema name.
57
61
  * @param schemaName The name of the Schema.
@@ -65,7 +69,8 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
65
69
  if (schemaRow === undefined)
66
70
  return undefined;
67
71
  const schema = JSON.parse(schemaRow.schema);
68
- return SchemaParser.parse(schema, context);
72
+ const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
73
+ return SchemaParser.parse(schema, schemaInfos);
69
74
  }
70
75
  /**
71
76
  * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.
@@ -231,6 +236,8 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
231
236
  const schemaRows = await this.executeQuery(ecsqlQueries.schemaInfoQuery);
232
237
  return schemaRows.map((schemaRow) => ({
233
238
  alias: schemaRow.alias,
239
+ description: schemaRow.description,
240
+ label: schemaRow.label,
234
241
  schemaKey: SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),
235
242
  references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),
236
243
  }));
@@ -243,11 +250,17 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
243
250
  * @internal
244
251
  */
245
252
  async getSchemaPartials(schemaKey, context) {
246
- const [schemaRow] = await this.executeQuery(ecsqlQueries.schemaStubQuery, {
247
- parameters: { schemaName: schemaKey.name },
248
- limit: 1
253
+ const queryStart = Date.now();
254
+ const itemRows = await this.executeQuery(ecsqlQueries.schemaStubQuery, {
255
+ parameters: { schemaName: schemaKey.name }
256
+ });
257
+ const queryDuration = Date.now() - queryStart;
258
+ Logger.logTrace(LOGGER_CATEGORY, `Recieved PartialSchema for ${schemaKey.name} in ${queryDuration}ms`, {
259
+ schemaName: schemaKey.name,
260
+ itemCount: itemRows.length,
261
+ duration: queryDuration,
249
262
  });
250
- if (!schemaRow)
263
+ if (itemRows.length === 0)
251
264
  return undefined;
252
265
  const schemaPartials = [];
253
266
  const addSchema = async (key) => {
@@ -267,32 +280,41 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
267
280
  if (!schemaStub) {
268
281
  schemaStub = await addSchema(SchemaKey.parseString(`${schemaName}.0.0.0`));
269
282
  }
270
- if (!schemaStub.items) {
271
- Object.assign(schemaStub, { items: {} });
283
+ let items = schemaStub.items;
284
+ if (!items) {
285
+ Object.assign(schemaStub, items = { items: {} });
272
286
  }
273
- const existingItem = schemaStub.items[itemInfo.name] || {};
274
- Object.assign(schemaStub.items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });
287
+ const existingItem = items[itemInfo.name] || {};
288
+ Object.assign(items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });
275
289
  };
276
290
  const reviver = (_key, value) => {
277
- if (value === null) {
278
- return undefined;
279
- }
280
- return value;
291
+ return value === null ? undefined : value;
281
292
  };
282
293
  await addSchema(schemaKey);
283
- await parseSchemaItemStubs(schemaKey.name, context, JSON.parse(schemaRow.items, reviver), addItems);
294
+ const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
295
+ const stubItems = itemRows.map((itemRow) => {
296
+ return JSON.parse(itemRow.item, reviver);
297
+ });
298
+ await parseSchemaItemStubs(schemaKey.name, stubItems, addItems, schemaInfos);
284
299
  return schemaPartials;
285
300
  }
286
301
  async querySchemaItem(context, schemaName, query, schemaType) {
287
302
  const start = Date.now();
288
303
  const itemRows = await this.executeQuery(query, { parameters: { schemaName } });
289
- this.options.performanceLogger?.logSchemaItem(start, schemaName, schemaType, itemRows.length);
304
+ const queryDuration = Date.now() - start;
305
+ Logger.logTrace(LOGGER_CATEGORY, `Recieved rows of ${schemaType} items for ${schemaName} in ${queryDuration}ms`, {
306
+ schemaName,
307
+ itemCount: itemRows.length,
308
+ itemType: schemaType,
309
+ duration: queryDuration,
310
+ });
290
311
  if (itemRows.length === 0)
291
312
  return [];
292
313
  const items = itemRows.map((itemRow) => {
293
314
  return "string" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;
294
315
  });
295
- return await SchemaParser.parseSchemaItems(items, schemaName, context) ?? [];
316
+ const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
317
+ return await SchemaParser.parseSchemaItems(items, schemaName, schemaInfos) ?? [];
296
318
  }
297
319
  async getFullSchema(schemaKey, context) {
298
320
  const schemaRows = await this.executeQuery(FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });
@@ -304,13 +326,14 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
304
326
  if (schema.items) {
305
327
  schema.items = schema.items.map((itemRow) => { return itemRow.item; });
306
328
  }
307
- return SchemaParser.parse(schema, context);
329
+ const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];
330
+ return SchemaParser.parse(schema, schemaInfos);
308
331
  }
309
332
  async getFullSchemaMultipleQueries(schemaKey, context) {
310
333
  const schema = await this.getSchemaNoItems(schemaKey.name, context);
311
334
  if (!schema)
312
335
  return undefined;
313
- schema.items = {};
336
+ const items = schema.items || (schema.items = {});
314
337
  await Promise.all([
315
338
  this.getEntities(schemaKey.name, context),
316
339
  this.getMixins(schemaKey.name, context),
@@ -327,9 +350,14 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
327
350
  this.getPhenomenon(schemaKey.name, context),
328
351
  this.getFormats(schemaKey.name, context)
329
352
  ]).then((itemResults) => {
330
- const flatItemList = itemResults.reduce((acc, item) => acc.concat(item));
353
+ const flatItemList = itemResults.reduce((acc, result) => acc.concat(result));
331
354
  flatItemList.forEach((schemaItem) => {
332
- schema.items[schemaItem.name] = schemaItem;
355
+ if (!schemaItem.name) {
356
+ // This should never be happen, as we query the schema items by name from the database, but since the SchemaProps
357
+ // have name optional, we need the check here to make the compiler happy.
358
+ throw new Error(`SchemaItem with no name encountered in schema ${schemaKey.name}`);
359
+ }
360
+ items[schemaItem.name] = schemaItem;
333
361
  });
334
362
  });
335
363
  return schema;
@@ -338,7 +366,7 @@ export class ECSqlSchemaLocater extends IncrementalSchemaLocater {
338
366
  function parseSchemaReference(referenceName) {
339
367
  return { schemaKey: SchemaKey.parseString(referenceName) };
340
368
  }
341
- async function parseSchemaItemStubs(schemaName, context, itemRows, addItemsHandler) {
369
+ async function parseSchemaItemStubs(schemaName, itemRows, addItemsHandler, schemaInfos) {
342
370
  if (!itemRows || itemRows.length === 0) {
343
371
  return;
344
372
  }
@@ -349,32 +377,32 @@ async function parseSchemaItemStubs(schemaName, context, itemRows, addItemsHandl
349
377
  const currentItem = baseClasses[index--];
350
378
  const baseClassItem = baseClasses[index];
351
379
  const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;
352
- const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, context);
380
+ const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, schemaInfos);
353
381
  await addItemsHandler(currentItem.schema, {
354
382
  ...schemaItem,
355
383
  name: schemaItem.name,
356
- schemaItemType: parseSchemaItemType(schemaItem.schemaItemType),
384
+ schemaItemType: schemaItem.schemaItemType,
357
385
  baseClass: baseClassName,
358
386
  });
359
387
  }
360
388
  };
361
389
  for (const itemRow of itemRows) {
362
- const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, context);
390
+ const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, schemaInfos);
363
391
  await addItemsHandler(schemaName, {
364
392
  ...schemaItem,
365
393
  name: schemaItem.name,
366
- schemaItemType: parseSchemaItemType(schemaItem.schemaItemType),
394
+ schemaItemType: schemaItem.schemaItemType,
367
395
  mixins: itemRow.mixins
368
396
  ? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })
369
397
  : undefined,
370
398
  });
371
399
  await parseBaseClasses(itemRow.baseClasses);
372
400
  for (const mixinRow of itemRow.mixins || []) {
373
- const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, context);
401
+ const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, schemaInfos);
374
402
  await addItemsHandler(mixinRow.schema, {
375
403
  ...mixinItem,
376
404
  name: mixinItem.name,
377
- schemaItemType: parseSchemaItemType(mixinItem.schemaItemType),
405
+ schemaItemType: mixinItem.schemaItemType,
378
406
  });
379
407
  await parseBaseClasses(mixinRow.baseClasses);
380
408
  }