@itwin/ecschema-metadata 5.3.0-dev.9 → 5.3.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 (132) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/lib/cjs/Constants.js.map +1 -1
  3. package/lib/cjs/DelayedPromise.js.map +1 -1
  4. package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
  5. package/lib/cjs/Deserialization/Helper.js.map +1 -1
  6. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  7. package/lib/cjs/Deserialization/JsonProps.d.ts +6 -2
  8. package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
  9. package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
  10. package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
  11. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  12. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  13. package/lib/cjs/ECName.js.map +1 -1
  14. package/lib/cjs/ECObjects.js.map +1 -1
  15. package/lib/cjs/Exception.js.map +1 -1
  16. package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts +19 -5
  17. package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -1
  18. package/lib/cjs/Formatting/FormatSetFormatsProvider.js +79 -7
  19. package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
  20. package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
  21. package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
  22. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  23. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
  24. package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  25. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  26. package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  27. package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  28. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
  29. package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  30. package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
  31. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
  32. package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  33. package/lib/cjs/Interfaces.js.map +1 -1
  34. package/lib/cjs/Metadata/Class.js.map +1 -1
  35. package/lib/cjs/Metadata/Constant.js.map +1 -1
  36. package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
  37. package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
  38. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  39. package/lib/cjs/Metadata/Enumeration.js.map +1 -1
  40. package/lib/cjs/Metadata/Format.js.map +1 -1
  41. package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
  42. package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
  43. package/lib/cjs/Metadata/Mixin.js.map +1 -1
  44. package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
  45. package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
  46. package/lib/cjs/Metadata/Property.js.map +1 -1
  47. package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
  48. package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
  49. package/lib/cjs/Metadata/Schema.js.map +1 -1
  50. package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
  51. package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
  52. package/lib/cjs/PropertyTypes.js.map +1 -1
  53. package/lib/cjs/SchemaJsonLocater.js.map +1 -1
  54. package/lib/cjs/SchemaKey.js.map +1 -1
  55. package/lib/cjs/SchemaLoader.js.map +1 -1
  56. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  57. package/lib/cjs/UnitConversion/Graph.js.map +1 -1
  58. package/lib/cjs/UnitConversion/Parser.js.map +1 -1
  59. package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
  60. package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
  61. package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
  62. package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
  63. package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
  64. package/lib/cjs/ecschema-metadata.js.map +1 -1
  65. package/lib/cjs/utils/SchemaGraph.js.map +1 -1
  66. package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
  67. package/lib/esm/Constants.js.map +1 -1
  68. package/lib/esm/DelayedPromise.js.map +1 -1
  69. package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
  70. package/lib/esm/Deserialization/Helper.js.map +1 -1
  71. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  72. package/lib/esm/Deserialization/JsonProps.d.ts +6 -2
  73. package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
  74. package/lib/esm/Deserialization/JsonProps.js.map +1 -1
  75. package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
  76. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  77. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  78. package/lib/esm/ECName.js.map +1 -1
  79. package/lib/esm/ECObjects.js.map +1 -1
  80. package/lib/esm/Exception.js.map +1 -1
  81. package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +19 -5
  82. package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -1
  83. package/lib/esm/Formatting/FormatSetFormatsProvider.js +79 -7
  84. package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
  85. package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
  86. package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
  87. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  88. package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
  89. package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
  90. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  91. package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
  92. package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
  93. package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
  94. package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
  95. package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
  96. package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
  97. package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
  98. package/lib/esm/Interfaces.js.map +1 -1
  99. package/lib/esm/Metadata/Class.js.map +1 -1
  100. package/lib/esm/Metadata/Constant.js.map +1 -1
  101. package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
  102. package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
  103. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  104. package/lib/esm/Metadata/Enumeration.js.map +1 -1
  105. package/lib/esm/Metadata/Format.js.map +1 -1
  106. package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
  107. package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
  108. package/lib/esm/Metadata/Mixin.js.map +1 -1
  109. package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
  110. package/lib/esm/Metadata/Phenomenon.js.map +1 -1
  111. package/lib/esm/Metadata/Property.js.map +1 -1
  112. package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
  113. package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
  114. package/lib/esm/Metadata/Schema.js.map +1 -1
  115. package/lib/esm/Metadata/SchemaItem.js.map +1 -1
  116. package/lib/esm/Metadata/UnitSystem.js.map +1 -1
  117. package/lib/esm/PropertyTypes.js.map +1 -1
  118. package/lib/esm/SchemaJsonLocater.js.map +1 -1
  119. package/lib/esm/SchemaKey.js.map +1 -1
  120. package/lib/esm/SchemaLoader.js.map +1 -1
  121. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  122. package/lib/esm/UnitConversion/Graph.js.map +1 -1
  123. package/lib/esm/UnitConversion/Parser.js.map +1 -1
  124. package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
  125. package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
  126. package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
  127. package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
  128. package/lib/esm/Validation/SchemaWalker.js.map +1 -1
  129. package/lib/esm/ecschema-metadata.js.map +1 -1
  130. package/lib/esm/utils/SchemaGraph.js.map +1 -1
  131. package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
  132. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAkB,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAwB,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA2DnD,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAqB/D;;;;GAIG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,wBAAwB;IACvE;;OAEG;IACH,IAAuB,OAAO;QAC5B,OAAO,KAAK,CAAC,OAAoC,CAAC;IACpD,CAAC;IAED;;;OAG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,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACvF,MAAM,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACrC,GAAG,SAAS;gBACZ,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,cAAc,EAAE,SAAS,CAAC,cAAc;aACzC,CAAC,CAAC;YACH,MAAM,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,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 *--------------------------------------------------------------------------------------------*/\nimport { Logger } from \"@itwin/core-bentley\";\nimport { SchemaContext } from \"../Context\";\nimport { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\n PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemProps, SchemaItemUnitProps, SchemaProps,\n StructClassProps, UnitSystemProps } from \"../Deserialization/JsonProps\";\nimport { SchemaItemType, SchemaMatchType } from \"../ECObjects\";\nimport { SchemaInfo, WithSchemaKey } from \"../Interfaces\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { FullSchemaQueries } from \"./FullSchemaQueries\";\nimport { IncrementalSchemaLocater, SchemaLocaterOptions } from \"./IncrementalSchemaLocater\";\nimport { SchemaItemQueries } from \"./SchemaItemQueries\";\nimport { SchemaParser } from \"./SchemaParser\";\nimport { ecsqlQueries } from \"./SchemaStubQueries\";\n\ninterface SchemaItemInfo {\n readonly name: string;\n readonly schemaItemType: SchemaItemType;\n}\n\ninterface SchemaInfoRow {\n readonly name: string;\n readonly version: string;\n readonly alias: string;\n readonly label: string;\n readonly description: string; \n readonly references: string;\n}\n\ninterface SchemaStubRow {\n readonly item: string;\n}\n\ninterface BaseClassStubRow {\n readonly schema: string;\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n}\n\ninterface SchemaItemStubRow {\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier?: number;\n readonly baseClasses?: Array<BaseClassStubRow>;\n readonly mixins?: Array<{\n readonly schema: string,\n readonly name: string;\n readonly schemaItemType: string;\n readonly modifier: number;\n readonly baseClasses?: Array<BaseClassStubRow>\n }>;\n}\n\ninterface SchemaRow {\n schema: string\n}\n\ninterface SchemaItemRow {\n item: string | SchemaItemProps;\n}\n\ntype AddSchemaItemHandler = <T extends SchemaItemInfo>(schemaName: string, itemStub: T) => Promise<void>;\n\ntype MutableSchemaProps = {\n -readonly [K in keyof SchemaProps]: SchemaProps[K];\n};\n\ninterface QueryParameters {\n [parameterName: string]: string | number;\n}\n\nconst LOGGER_CATEGORY = \"IncrementalSchemaLoading.Performance\";\n\n/**\n * Query options used by the ECSqlSchemaLocater.\n * @internal\n */\nexport interface ECSqlQueryOptions {\n parameters?: QueryParameters;\n limit?: number;\n}\n\n/**\n * Defines the [[ECSqlSchemaLocater]] options which determine how each\n * schema is to be loaded. All options are optional.\n * @internal\n */\nexport interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {\n /** Query for Schemas using multiple queries. Defaults to false. */\n readonly useMultipleQueries?: boolean;\n}\n\n/**\n * An abstract [[IncrementalSchemaLocater]] implementation for loading\n * EC [Schema] instances from an iModelDb using ECSql queries.\n * @internal\n */\nexport abstract class ECSqlSchemaLocater extends IncrementalSchemaLocater {\n /**\n * Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.\n */\n protected override get options(): ECSqlSchemaLocaterOptions {\n return super.options as ECSqlSchemaLocaterOptions;\n }\n\n /**\n * Initializes a new ECSqlSchemaLocater instance.\n * @param options The options used by this Schema locater.\n */\n constructor(options?: ECSqlSchemaLocaterOptions) {\n super(options);\n }\n\n /**\n * Executes the given ECSql query and returns the resulting rows.\n * @param query The ECSql query to execute.\n * @param options Optional arguments to control the query result.\n * @returns A promise that resolves to the resulting rows.\n */\n protected abstract executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;\n\n /**\n * Gets the [[SchemaProps]] for the given schema key.\n * @param schemaKey The schema key of the schema to be resolved.\n */\n protected abstract getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>\n\n /**\n * Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined\n * in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @internal\n */\n protected async getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\n // to fetch the whole schema json.\n if (!await this.supportPartialSchemaLoading(context))\n return this.getSchemaProps(schemaKey);\n\n const queryStart = Date.now();\n const schemaProps = this.options.useMultipleQueries\n ? await this.getFullSchemaMultipleQueries(schemaKey, context)\n : await this.getFullSchema(schemaKey, context);\n\n const queryDuration = Date.now() - queryStart;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved SchemaProps for ${schemaKey.name} in ${queryDuration}ms`, {\n schemaName: schemaKey.name,\n queryMode: this.options.useMultipleQueries ? \"parallel\" : \"single\",\n duration: queryDuration,\n });\n\n return schemaProps;\n };\n\n /**\n * Gets the [[SchemaProps]] without schemaItems for the given schema name.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to use for resolving references.\n * @returns\n * @internal\n */\n private async getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaNoItemsQuery, { parameters: { schemaName } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return SchemaParser.parse(schema, schemaInfos);\n }\n\n /**\n * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.\n * @param context The schema context to lookup the meta schema.\n * @returns true if the context has a supported meta schema version, false otherwise.\n */\n protected async supportPartialSchemaLoading(context: SchemaContext): Promise<boolean> {\n const metaSchemaKey = new SchemaKey(\"ECDbMeta\", 4, 0, 3);\n const metaSchemaInfo = await context.getSchemaInfo(metaSchemaKey, SchemaMatchType.LatestWriteCompatible);\n return metaSchemaInfo !== undefined;\n };\n\n /**\n * Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The [[SchemaContext]] to which the schema belongs.\n * @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.\n * @internal\n */\n protected async getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.entityQuery;\n return this.querySchemaItem<EntityClassProps>(context, schema, query, \"EntityClass\");\n }\n\n /**\n * Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.\n * @internal\n */\n protected async getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]> {\n const query = queryOverride ?? FullSchemaQueries.mixinQuery;\n return this.querySchemaItem<MixinProps>(context, schema, query, \"Mixin\");\n }\n\n /**\n * Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.\n * @internal\n */\n protected async getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.relationshipClassQuery;\n return this.querySchemaItem<RelationshipClassProps>(context, schema, query, \"RelationshipClass\");\n }\n\n /**\n * Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.customAttributeQuery;\n return this.querySchemaItem<CustomAttributeClassProps>(context, schema, query, \"CustomAttributeClass\");\n }\n\n\n /**\n * Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.\n * @param schemaName The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]> {\n const query = queryOverride ?? FullSchemaQueries.structQuery;\n return this.querySchemaItem<StructClassProps>(context, schema, query, \"StructClass\");\n }\n\n /**\n * Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]> {\n return this.querySchemaItem<KindOfQuantityProps>(context, schema, SchemaItemQueries.kindOfQuantity(true), \"KindOfQuantity\");\n }\n\n /**\n * Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]> {\n return this.querySchemaItem<PropertyCategoryProps>(context, schema, SchemaItemQueries.propertyCategory(true), \"PropertyCategory\");\n }\n\n /**\n * Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]> {\n return this.querySchemaItem<EnumerationProps>(context, schema, SchemaItemQueries.enumeration(true), \"Enumeration\");\n }\n\n /**\n * Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]> {\n return this.querySchemaItem<SchemaItemUnitProps>(context, schema, SchemaItemQueries.unit(true), \"Unit\");\n }\n\n /**\n * Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]> {\n return this.querySchemaItem<InvertedUnitProps>(context, schema, SchemaItemQueries.invertedUnit(true), \"InvertedUnit\");\n }\n\n /**\n * Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]> {\n return this.querySchemaItem<ConstantProps>(context, schema, SchemaItemQueries.constant(true), \"Constant\");\n }\n\n /**\n * Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]> {\n return this.querySchemaItem<UnitSystemProps>(context, schema, SchemaItemQueries.unitSystem(true), \"UnitSystem\");\n }\n\n /**\n * Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]> {\n return this.querySchemaItem<PhenomenonProps>(context, schema, SchemaItemQueries.phenomenon(true), \"Phenomenon\");\n }\n\n /**\n * Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.\n * @param schema The name of the Schema.\n * @param context The SchemaContext to which the schema belongs.\n * @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.\n * @internal\n */\n protected async getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]> {\n return this.querySchemaItem<SchemaItemFormatProps>(context, schema, SchemaItemQueries.format(true), \"Format\");\n }\n\n /**\n * Gets [[SchemaInfo]] objects for all schemas including their direct schema references.\n * @internal\n */\n protected async loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>> {\n const schemaRows = await this.executeQuery<SchemaInfoRow>(ecsqlQueries.schemaInfoQuery);\n return schemaRows.map((schemaRow) => (\n {\n alias: schemaRow.alias,\n description: schemaRow.description,\n label: schemaRow.label,\n schemaKey: SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),\n references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),\n }\n ));\n }\n\n /**\n * Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy\n * can be included in the initial fetch.\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\n * @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].\n * @internal\n */\n protected async getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined> {\n const queryStart = Date.now();\n const itemRows = await this.executeQuery<SchemaStubRow>(ecsqlQueries.schemaStubQuery, {\n parameters: { schemaName: schemaKey.name }\n });\n\n const queryDuration = Date.now() - queryStart;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved PartialSchema for ${schemaKey.name} in ${queryDuration}ms`, {\n schemaName: schemaKey.name,\n itemCount: itemRows.length,\n duration: queryDuration,\n });\n\n if (itemRows.length === 0)\n return undefined;\n\n const schemaPartials: Array<SchemaProps> = [];\n const addSchema = async (key: SchemaKey) => {\n const stub = await this.createSchemaProps(key, context);\n schemaPartials.push(stub);\n\n if (stub.references) {\n for (const referenceProps of stub.references) {\n if (!schemaPartials.some((schema) => schema.name === referenceProps.name)) {\n await addSchema(SchemaKey.parseString(`${referenceProps.name}.${referenceProps.version}`));\n }\n }\n }\n\n return stub;\n };\n\n const addItems = async (schemaName: string, itemInfo: SchemaItemInfo) => {\n let schemaStub = schemaPartials.find((schema) => schema.name === schemaName);\n if (!schemaStub) {\n schemaStub = await addSchema(SchemaKey.parseString(`${schemaName}.0.0.0`));\n }\n\n let items = schemaStub.items;\n if (!items) {\n Object.assign(schemaStub, items = { items: {} });\n }\n\n const existingItem = items[itemInfo.name] || {};\n Object.assign(items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });\n };\n\n const reviver = (_key: string, value: any) => {\n return value === null ? undefined : value;\n };\n\n await addSchema(schemaKey);\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n const stubItems = itemRows.map((itemRow) => {\n return JSON.parse(itemRow.item, reviver) as SchemaItemStubRow;\n });\n await parseSchemaItemStubs(schemaKey.name, stubItems, addItems, schemaInfos);\n\n return schemaPartials;\n }\n\n private async querySchemaItem<TRow extends SchemaItemProps>(context: SchemaContext, schemaName: string, query: string, schemaType: string): Promise<Array<TRow>> {\n const start = Date.now();\n const itemRows = await this.executeQuery<SchemaItemRow>(query, { parameters: { schemaName } });\n\n const queryDuration = Date.now() - start;\n Logger.logTrace(LOGGER_CATEGORY, `Recieved rows of ${schemaType} items for ${schemaName} in ${queryDuration}ms`, {\n schemaName,\n itemCount: itemRows.length,\n itemType: schemaType,\n duration: queryDuration,\n });\n\n if (itemRows.length === 0)\n return [];\n\n const items = itemRows.map((itemRow: SchemaItemRow) => {\n return \"string\" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;\n });\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return await SchemaParser.parseSchemaItems(items, schemaName, schemaInfos) as Array<TRow> ?? []\n }\n\n private async getFullSchema(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });\n const schemaRow = schemaRows[0];\n if (schemaRow === undefined)\n return undefined;\n\n // Map SchemaItemRow array, [{item: SchemaItemProps}], to array of SchemaItemProps.\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\n if (schema.items) {\n (schema as any).items = (schema.items as any).map((itemRow: SchemaItemRow) => { return itemRow.item; });\n }\n\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\n return SchemaParser.parse(schema, schemaInfos);\n }\n\n private async getFullSchemaMultipleQueries(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\n const schema = await this.getSchemaNoItems(schemaKey.name, context) as MutableSchemaProps;\n if (!schema)\n return undefined;\n\n const items = schema.items || (schema.items = {});\n await Promise.all([\n this.getEntities(schemaKey.name, context),\n this.getMixins(schemaKey.name, context),\n this.getStructs(schemaKey.name, context),\n this.getRelationships(schemaKey.name, context),\n this.getCustomAttributeClasses(schemaKey.name, context),\n this.getKindOfQuantities(schemaKey.name, context),\n this.getPropertyCategories(schemaKey.name, context),\n this.getEnumerations(schemaKey.name, context),\n this.getUnits(schemaKey.name, context),\n this.getInvertedUnits(schemaKey.name, context),\n this.getUnitSystems(schemaKey.name, context),\n this.getConstants(schemaKey.name, context),\n this.getPhenomenon(schemaKey.name, context),\n this.getFormats(schemaKey.name, context)\n ]).then((itemResults) => {\n const flatItemList = itemResults.reduce((acc, result) => acc.concat(result));\n flatItemList.forEach((schemaItem) => {\n if(!schemaItem.name) {\n // This should never be happen, as we query the schema items by name from the database, but since the SchemaProps\n // have name optional, we need the check here to make the compiler happy.\n throw new Error(`SchemaItem with no name encountered in schema ${schemaKey.name}`);\n }\n items[schemaItem.name] = schemaItem;\n });\n });\n\n return schema;\n }\n}\n\nfunction parseSchemaReference(referenceName: string): WithSchemaKey {\n return { schemaKey: SchemaKey.parseString(referenceName) };\n}\n\nasync function parseSchemaItemStubs(schemaName: string, itemRows: Array<SchemaItemStubRow>, addItemsHandler: AddSchemaItemHandler, schemaInfos: Iterable<SchemaInfo>) {\n if (!itemRows || itemRows.length === 0) {\n return;\n }\n\n const parseBaseClasses = async (baseClasses: Array<BaseClassStubRow> | undefined) => {\n if (!baseClasses || baseClasses.length < 2)\n return;\n\n for (let index = baseClasses.length - 1; index >= 0;) {\n const currentItem = baseClasses[index--];\n const baseClassItem = baseClasses[index];\n const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;\n\n const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, schemaInfos);\n await addItemsHandler(currentItem.schema, {\n ...schemaItem,\n name: schemaItem.name,\n schemaItemType: schemaItem.schemaItemType,\n baseClass: baseClassName,\n });\n }\n };\n\n for (const itemRow of itemRows) {\n const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, schemaInfos);\n await addItemsHandler(schemaName, {\n ...schemaItem,\n name: schemaItem.name,\n schemaItemType: schemaItem.schemaItemType,\n mixins: itemRow.mixins\n ? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })\n : undefined,\n });\n\n await parseBaseClasses(itemRow.baseClasses);\n\n for (const mixinRow of itemRow.mixins || []) {\n const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, schemaInfos);\n await addItemsHandler(mixinRow.schema, {\n ...mixinItem,\n name: mixinItem.name,\n schemaItemType: mixinItem.schemaItemType,\n });\n await parseBaseClasses(mixinRow.baseClasses);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ECSqlSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAkB,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAwB,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA2DnD,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAqB/D;;;;GAIG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,wBAAwB;IACvE;;OAEG;IACH,IAAuB,OAAO;QAC5B,OAAO,KAAK,CAAC,OAAoC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAgBD;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,SAAoB,EAAE,OAAsB;QACxE,gHAAgH;QAChH,gHAAgH;QAChH,kCAAkC;QAClC,IAAI,CAAC,MAAM,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC;YAClD,OAAO,IA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AI,EAAE,SAAS,CAAC,IAAI;gBACpB,cAAc,EAAE,SAAS,CAAC,cAAc;aACzC,CAAC,CAAC;YACH,MAAM,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { SchemaContext } from \"../Context\";\r\nimport { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\r\n PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemProps, SchemaItemUnitProps, SchemaProps,\r\n StructClassProps, UnitSystemProps } from \"../Deserialization/JsonProps\";\r\nimport { SchemaItemType, SchemaMatchType } from \"../ECObjects\";\r\nimport { SchemaInfo, WithSchemaKey } from \"../Interfaces\";\r\nimport { SchemaKey } from \"../SchemaKey\";\r\nimport { FullSchemaQueries } from \"./FullSchemaQueries\";\r\nimport { IncrementalSchemaLocater, SchemaLocaterOptions } from \"./IncrementalSchemaLocater\";\r\nimport { SchemaItemQueries } from \"./SchemaItemQueries\";\r\nimport { SchemaParser } from \"./SchemaParser\";\r\nimport { ecsqlQueries } from \"./SchemaStubQueries\";\r\n\r\ninterface SchemaItemInfo {\r\n readonly name: string;\r\n readonly schemaItemType: SchemaItemType;\r\n}\r\n\r\ninterface SchemaInfoRow {\r\n readonly name: string;\r\n readonly version: string;\r\n readonly alias: string;\r\n readonly label: string;\r\n readonly description: string; \r\n readonly references: string;\r\n}\r\n\r\ninterface SchemaStubRow {\r\n readonly item: string;\r\n}\r\n\r\ninterface BaseClassStubRow {\r\n readonly schema: string;\r\n readonly name: string;\r\n readonly schemaItemType: string;\r\n readonly modifier: number;\r\n}\r\n\r\ninterface SchemaItemStubRow {\r\n readonly name: string;\r\n readonly schemaItemType: string;\r\n readonly modifier?: number;\r\n readonly baseClasses?: Array<BaseClassStubRow>;\r\n readonly mixins?: Array<{\r\n readonly schema: string,\r\n readonly name: string;\r\n readonly schemaItemType: string;\r\n readonly modifier: number;\r\n readonly baseClasses?: Array<BaseClassStubRow>\r\n }>;\r\n}\r\n\r\ninterface SchemaRow {\r\n schema: string\r\n}\r\n\r\ninterface SchemaItemRow {\r\n item: string | SchemaItemProps;\r\n}\r\n\r\ntype AddSchemaItemHandler = <T extends SchemaItemInfo>(schemaName: string, itemStub: T) => Promise<void>;\r\n\r\ntype MutableSchemaProps = {\r\n -readonly [K in keyof SchemaProps]: SchemaProps[K];\r\n};\r\n\r\ninterface QueryParameters {\r\n [parameterName: string]: string | number;\r\n}\r\n\r\nconst LOGGER_CATEGORY = \"IncrementalSchemaLoading.Performance\";\r\n\r\n/**\r\n * Query options used by the ECSqlSchemaLocater.\r\n * @internal\r\n */\r\nexport interface ECSqlQueryOptions {\r\n parameters?: QueryParameters;\r\n limit?: number;\r\n}\r\n\r\n/**\r\n * Defines the [[ECSqlSchemaLocater]] options which determine how each\r\n * schema is to be loaded. All options are optional.\r\n * @internal\r\n */\r\nexport interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {\r\n /** Query for Schemas using multiple queries. Defaults to false. */\r\n readonly useMultipleQueries?: boolean;\r\n}\r\n\r\n/**\r\n * An abstract [[IncrementalSchemaLocater]] implementation for loading\r\n * EC [Schema] instances from an iModelDb using ECSql queries.\r\n * @internal\r\n */\r\nexport abstract class ECSqlSchemaLocater extends IncrementalSchemaLocater {\r\n /**\r\n * Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.\r\n */\r\n protected override get options(): ECSqlSchemaLocaterOptions {\r\n return super.options as ECSqlSchemaLocaterOptions;\r\n }\r\n\r\n /**\r\n * Initializes a new ECSqlSchemaLocater instance.\r\n * @param options The options used by this Schema locater.\r\n */\r\n constructor(options?: ECSqlSchemaLocaterOptions) {\r\n super(options);\r\n }\r\n\r\n /**\r\n * Executes the given ECSql query and returns the resulting rows.\r\n * @param query The ECSql query to execute.\r\n * @param options Optional arguments to control the query result.\r\n * @returns A promise that resolves to the resulting rows.\r\n */\r\n protected abstract executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;\r\n\r\n /**\r\n * Gets the [[SchemaProps]] for the given schema key.\r\n * @param schemaKey The schema key of the schema to be resolved.\r\n */\r\n protected abstract getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>\r\n\r\n /**\r\n * Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined\r\n * in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.\r\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\r\n * @param context The [[SchemaContext]] to use for resolving references.\r\n * @internal\r\n */\r\n protected async getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\r\n // If the meta schema is an earlier version than 4.0.3, we can't use the ECSql query interface to get the schema\r\n // information required to load the schema entirely. In this case, we fallback to use the ECSchema RPC interface\r\n // to fetch the whole schema json.\r\n if (!await this.supportPartialSchemaLoading(context))\r\n return this.getSchemaProps(schemaKey);\r\n\r\n const queryStart = Date.now();\r\n const schemaProps = this.options.useMultipleQueries\r\n ? await this.getFullSchemaMultipleQueries(schemaKey, context)\r\n : await this.getFullSchema(schemaKey, context);\r\n\r\n const queryDuration = Date.now() - queryStart;\r\n Logger.logTrace(LOGGER_CATEGORY, `Recieved SchemaProps for ${schemaKey.name} in ${queryDuration}ms`, {\r\n schemaName: schemaKey.name,\r\n queryMode: this.options.useMultipleQueries ? \"parallel\" : \"single\",\r\n duration: queryDuration,\r\n });\r\n\r\n return schemaProps;\r\n };\r\n\r\n /**\r\n * Gets the [[SchemaProps]] without schemaItems for the given schema name.\r\n * @param schemaName The name of the Schema.\r\n * @param context The [[SchemaContext]] to use for resolving references.\r\n * @returns\r\n * @internal\r\n */\r\n private async getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined> {\r\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaNoItemsQuery, { parameters: { schemaName } });\r\n const schemaRow = schemaRows[0];\r\n if (schemaRow === undefined)\r\n return undefined;\r\n\r\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\r\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\r\n return SchemaParser.parse(schema, schemaInfos);\r\n }\r\n\r\n /**\r\n * Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.\r\n * @param context The schema context to lookup the meta schema.\r\n * @returns true if the context has a supported meta schema version, false otherwise.\r\n */\r\n protected async supportPartialSchemaLoading(context: SchemaContext): Promise<boolean> {\r\n const metaSchemaKey = new SchemaKey(\"ECDbMeta\", 4, 0, 3);\r\n const metaSchemaInfo = await context.getSchemaInfo(metaSchemaKey, SchemaMatchType.LatestWriteCompatible);\r\n return metaSchemaInfo !== undefined;\r\n };\r\n\r\n /**\r\n * Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.\r\n * @param schemaName The name of the Schema.\r\n * @param context The [[SchemaContext]] to which the schema belongs.\r\n * @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.\r\n * @internal\r\n */\r\n protected async getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]> {\r\n const query = queryOverride ?? FullSchemaQueries.entityQuery;\r\n return this.querySchemaItem<EntityClassProps>(context, schema, query, \"EntityClass\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.\r\n * @param schemaName The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.\r\n * @internal\r\n */\r\n protected async getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]> {\r\n const query = queryOverride ?? FullSchemaQueries.mixinQuery;\r\n return this.querySchemaItem<MixinProps>(context, schema, query, \"Mixin\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.\r\n * @param schemaName The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.\r\n * @internal\r\n */\r\n protected async getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]> {\r\n const query = queryOverride ?? FullSchemaQueries.relationshipClassQuery;\r\n return this.querySchemaItem<RelationshipClassProps>(context, schema, query, \"RelationshipClass\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.\r\n * @param schemaName The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]> {\r\n const query = queryOverride ?? FullSchemaQueries.customAttributeQuery;\r\n return this.querySchemaItem<CustomAttributeClassProps>(context, schema, query, \"CustomAttributeClass\");\r\n }\r\n\r\n\r\n /**\r\n * Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.\r\n * @param schemaName The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]> {\r\n const query = queryOverride ?? FullSchemaQueries.structQuery;\r\n return this.querySchemaItem<StructClassProps>(context, schema, query, \"StructClass\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]> {\r\n return this.querySchemaItem<KindOfQuantityProps>(context, schema, SchemaItemQueries.kindOfQuantity(true), \"KindOfQuantity\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]> {\r\n return this.querySchemaItem<PropertyCategoryProps>(context, schema, SchemaItemQueries.propertyCategory(true), \"PropertyCategory\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]> {\r\n return this.querySchemaItem<EnumerationProps>(context, schema, SchemaItemQueries.enumeration(true), \"Enumeration\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]> {\r\n return this.querySchemaItem<SchemaItemUnitProps>(context, schema, SchemaItemQueries.unit(true), \"Unit\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]> {\r\n return this.querySchemaItem<InvertedUnitProps>(context, schema, SchemaItemQueries.invertedUnit(true), \"InvertedUnit\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]> {\r\n return this.querySchemaItem<ConstantProps>(context, schema, SchemaItemQueries.constant(true), \"Constant\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]> {\r\n return this.querySchemaItem<UnitSystemProps>(context, schema, SchemaItemQueries.unitSystem(true), \"UnitSystem\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]> {\r\n return this.querySchemaItem<PhenomenonProps>(context, schema, SchemaItemQueries.phenomenon(true), \"Phenomenon\");\r\n }\r\n\r\n /**\r\n * Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.\r\n * @param schema The name of the Schema.\r\n * @param context The SchemaContext to which the schema belongs.\r\n * @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.\r\n * @internal\r\n */\r\n protected async getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]> {\r\n return this.querySchemaItem<SchemaItemFormatProps>(context, schema, SchemaItemQueries.format(true), \"Format\");\r\n }\r\n\r\n /**\r\n * Gets [[SchemaInfo]] objects for all schemas including their direct schema references.\r\n * @internal\r\n */\r\n protected async loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>> {\r\n const schemaRows = await this.executeQuery<SchemaInfoRow>(ecsqlQueries.schemaInfoQuery);\r\n return schemaRows.map((schemaRow) => (\r\n {\r\n alias: schemaRow.alias,\r\n description: schemaRow.description,\r\n label: schemaRow.label,\r\n schemaKey: SchemaKey.parseString(`${schemaRow.name}.${schemaRow.version}`),\r\n references: Array.from(JSON.parse(schemaRow.references), parseSchemaReference),\r\n }\r\n ));\r\n }\r\n\r\n /**\r\n * Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy\r\n * can be included in the initial fetch.\r\n * @param schemaKey The [[SchemaKey]] of the schema to be resolved.\r\n * @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].\r\n * @internal\r\n */\r\n protected async getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined> {\r\n const queryStart = Date.now();\r\n const itemRows = await this.executeQuery<SchemaStubRow>(ecsqlQueries.schemaStubQuery, {\r\n parameters: { schemaName: schemaKey.name }\r\n });\r\n\r\n const queryDuration = Date.now() - queryStart;\r\n Logger.logTrace(LOGGER_CATEGORY, `Recieved PartialSchema for ${schemaKey.name} in ${queryDuration}ms`, {\r\n schemaName: schemaKey.name,\r\n itemCount: itemRows.length,\r\n duration: queryDuration,\r\n });\r\n\r\n if (itemRows.length === 0)\r\n return undefined;\r\n\r\n const schemaPartials: Array<SchemaProps> = [];\r\n const addSchema = async (key: SchemaKey) => {\r\n const stub = await this.createSchemaProps(key, context);\r\n schemaPartials.push(stub);\r\n\r\n if (stub.references) {\r\n for (const referenceProps of stub.references) {\r\n if (!schemaPartials.some((schema) => schema.name === referenceProps.name)) {\r\n await addSchema(SchemaKey.parseString(`${referenceProps.name}.${referenceProps.version}`));\r\n }\r\n }\r\n }\r\n\r\n return stub;\r\n };\r\n\r\n const addItems = async (schemaName: string, itemInfo: SchemaItemInfo) => {\r\n let schemaStub = schemaPartials.find((schema) => schema.name === schemaName);\r\n if (!schemaStub) {\r\n schemaStub = await addSchema(SchemaKey.parseString(`${schemaName}.0.0.0`));\r\n }\r\n\r\n let items = schemaStub.items;\r\n if (!items) {\r\n Object.assign(schemaStub, items = { items: {} });\r\n }\r\n\r\n const existingItem = items[itemInfo.name] || {};\r\n Object.assign(items, { [itemInfo.name]: Object.assign(existingItem, itemInfo) });\r\n };\r\n\r\n const reviver = (_key: string, value: any) => {\r\n return value === null ? undefined : value;\r\n };\r\n\r\n await addSchema(schemaKey);\r\n\r\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\r\n const stubItems = itemRows.map((itemRow) => {\r\n return JSON.parse(itemRow.item, reviver) as SchemaItemStubRow;\r\n });\r\n await parseSchemaItemStubs(schemaKey.name, stubItems, addItems, schemaInfos);\r\n\r\n return schemaPartials;\r\n }\r\n\r\n private async querySchemaItem<TRow extends SchemaItemProps>(context: SchemaContext, schemaName: string, query: string, schemaType: string): Promise<Array<TRow>> {\r\n const start = Date.now();\r\n const itemRows = await this.executeQuery<SchemaItemRow>(query, { parameters: { schemaName } });\r\n\r\n const queryDuration = Date.now() - start;\r\n Logger.logTrace(LOGGER_CATEGORY, `Recieved rows of ${schemaType} items for ${schemaName} in ${queryDuration}ms`, {\r\n schemaName,\r\n itemCount: itemRows.length,\r\n itemType: schemaType,\r\n duration: queryDuration,\r\n });\r\n\r\n if (itemRows.length === 0)\r\n return [];\r\n\r\n const items = itemRows.map((itemRow: SchemaItemRow) => {\r\n return \"string\" === typeof itemRow.item ? JSON.parse(itemRow.item) : itemRow.item;\r\n });\r\n\r\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\r\n return await SchemaParser.parseSchemaItems(items, schemaName, schemaInfos) as Array<TRow> ?? []\r\n }\r\n\r\n private async getFullSchema(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\r\n const schemaRows = await this.executeQuery<SchemaRow>(FullSchemaQueries.schemaQuery, { parameters: { schemaName: schemaKey.name } });\r\n const schemaRow = schemaRows[0];\r\n if (schemaRow === undefined)\r\n return undefined;\r\n\r\n // Map SchemaItemRow array, [{item: SchemaItemProps}], to array of SchemaItemProps.\r\n const schema = JSON.parse(schemaRow.schema) as SchemaProps;\r\n if (schema.items) {\r\n (schema as any).items = (schema.items as any).map((itemRow: SchemaItemRow) => { return itemRow.item; });\r\n }\r\n\r\n const schemaInfos = await this._schemaInfoCache.getSchemasByContext(context) ?? [];\r\n return SchemaParser.parse(schema, schemaInfos);\r\n }\r\n\r\n private async getFullSchemaMultipleQueries(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined> {\r\n const schema = await this.getSchemaNoItems(schemaKey.name, context) as MutableSchemaProps;\r\n if (!schema)\r\n return undefined;\r\n\r\n const items = schema.items || (schema.items = {});\r\n await Promise.all([\r\n this.getEntities(schemaKey.name, context),\r\n this.getMixins(schemaKey.name, context),\r\n this.getStructs(schemaKey.name, context),\r\n this.getRelationships(schemaKey.name, context),\r\n this.getCustomAttributeClasses(schemaKey.name, context),\r\n this.getKindOfQuantities(schemaKey.name, context),\r\n this.getPropertyCategories(schemaKey.name, context),\r\n this.getEnumerations(schemaKey.name, context),\r\n this.getUnits(schemaKey.name, context),\r\n this.getInvertedUnits(schemaKey.name, context),\r\n this.getUnitSystems(schemaKey.name, context),\r\n this.getConstants(schemaKey.name, context),\r\n this.getPhenomenon(schemaKey.name, context),\r\n this.getFormats(schemaKey.name, context)\r\n ]).then((itemResults) => {\r\n const flatItemList = itemResults.reduce((acc, result) => acc.concat(result));\r\n flatItemList.forEach((schemaItem) => {\r\n if(!schemaItem.name) {\r\n // This should never be happen, as we query the schema items by name from the database, but since the SchemaProps\r\n // have name optional, we need the check here to make the compiler happy.\r\n throw new Error(`SchemaItem with no name encountered in schema ${schemaKey.name}`);\r\n }\r\n items[schemaItem.name] = schemaItem;\r\n });\r\n });\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nfunction parseSchemaReference(referenceName: string): WithSchemaKey {\r\n return { schemaKey: SchemaKey.parseString(referenceName) };\r\n}\r\n\r\nasync function parseSchemaItemStubs(schemaName: string, itemRows: Array<SchemaItemStubRow>, addItemsHandler: AddSchemaItemHandler, schemaInfos: Iterable<SchemaInfo>) {\r\n if (!itemRows || itemRows.length === 0) {\r\n return;\r\n }\r\n\r\n const parseBaseClasses = async (baseClasses: Array<BaseClassStubRow> | undefined) => {\r\n if (!baseClasses || baseClasses.length < 2)\r\n return;\r\n\r\n for (let index = baseClasses.length - 1; index >= 0;) {\r\n const currentItem = baseClasses[index--];\r\n const baseClassItem = baseClasses[index];\r\n const baseClassName = baseClassItem ? `${baseClassItem.schema}.${baseClassItem.name}` : undefined;\r\n\r\n const schemaItem = await SchemaParser.parseItem(currentItem, currentItem.schema, schemaInfos);\r\n await addItemsHandler(currentItem.schema, {\r\n ...schemaItem,\r\n name: schemaItem.name,\r\n schemaItemType: schemaItem.schemaItemType,\r\n baseClass: baseClassName,\r\n });\r\n }\r\n };\r\n\r\n for (const itemRow of itemRows) {\r\n const schemaItem = await SchemaParser.parseItem(itemRow, schemaName, schemaInfos);\r\n await addItemsHandler(schemaName, {\r\n ...schemaItem,\r\n name: schemaItem.name,\r\n schemaItemType: schemaItem.schemaItemType,\r\n mixins: itemRow.mixins\r\n ? itemRow.mixins.map(mixin => { return `${mixin.schema}.${mixin.name}`; })\r\n : undefined,\r\n });\r\n\r\n await parseBaseClasses(itemRow.baseClasses);\r\n\r\n for (const mixinRow of itemRow.mixins || []) {\r\n const mixinItem = await SchemaParser.parseItem(mixinRow, mixinRow.schema, schemaInfos);\r\n await addItemsHandler(mixinRow.schema, {\r\n ...mixinItem,\r\n name: mixinItem.name,\r\n schemaItemType: mixinItem.schemaItemType,\r\n });\r\n await parseBaseClasses(mixinRow.baseClasses);\r\n }\r\n }\r\n}\r\n"]}