@itwin/ecschema-metadata 5.9.0-dev.15 → 5.9.0-dev.17

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 (27) hide show
  1. package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
  2. package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
  3. package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  4. package/lib/cjs/Deserialization/XmlSerializationUtils.js +1 -1
  5. package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
  6. package/lib/cjs/ECObjects.js.map +1 -1
  7. package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  8. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +1 -1
  9. package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  10. package/lib/cjs/Metadata/EntityClass.js.map +1 -1
  11. package/lib/cjs/Metadata/Property.js.map +1 -1
  12. package/lib/cjs/Metadata/Schema.js.map +1 -1
  13. package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
  14. package/lib/esm/Deserialization/JsonParser.js.map +1 -1
  15. package/lib/esm/Deserialization/XmlParser.js.map +1 -1
  16. package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
  17. package/lib/esm/Deserialization/XmlSerializationUtils.js +1 -1
  18. package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
  19. package/lib/esm/ECObjects.js.map +1 -1
  20. package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
  21. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +1 -1
  22. package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
  23. package/lib/esm/Metadata/EntityClass.js.map +1 -1
  24. package/lib/esm/Metadata/Property.js.map +1 -1
  25. package/lib/esm/Metadata/Schema.js.map +1 -1
  26. package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
  27. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAoKH,gDAQC;AAMD,sDAQC;AAQD,kDAkBC;AASD,wDAEC;AAGD,8DAmBC;AAQD,gDAeC;AAGD,sDAeC;AAOD,8EAiEC;AAQD,sDAuDC;AAGD,oDAMC;AAGD,0DAOC;AAQD,sCAOC;AAGD,4CAQC;AAGD,wDAMC;AAGD,8DAOC;AAKD,8DAiBC;AAzfD,2CAAgD;AAChD,2CAA4D;AAE5D,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,+HAA+H;AAC/H,IAAI,CAAE,MAAc,CAAC,aAAa,EAAE,CAAC;IAClC,MAAc,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,mDAAmD;IACnD,qDAAI,CAAA;IACJ,+DAA+D;IAC/D,6DAAQ,CAAA;IACR,4DAA4D;IAC5D,yDAAM,CAAA;AACR,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED;;;;;GAKG;AACH,IAAY,cAeX;AAfD,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,+DAA6C,CAAA;IAC7C,yDAAuC,CAAA;IACvC,6CAA2B,CAAA;IAC3B,mDAAiC,CAAA;IACjC,uDAAqC,CAAA;IACrC,+BAAa,CAAA;IACb,+CAA6B,CAAA;IAC7B,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB,2CAAyB,CAAA;IACzB,mCAAiB,CAAA;AACnB,CAAC,EAfW,cAAc,8BAAd,cAAc,QAezB;AAED;;;GAGG;AACH,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,yFAAyF;IACzF,yC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iDAAiD,CAAC,CAAC;IACxH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,KAAqB,EAAE,SAAkC;IACjG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,SAAS,KAAK,sBAAsB,CAAC,KAAK,IAAI,CAChD,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,KAAK;QAC9B,KAAK,KAAK,cAAc,CAAC,WAAW;QACpC,KAAK,KAAK,cAAc,CAAC,oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,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 { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 - will not be removed until after 2026-06-13. SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType as CustomAttributeContainerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"ECObjects.js","sourceRoot":"","sources":["../../src/ECObjects.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAoKH,gDAQC;AAMD,sDAQC;AAQD,kDAkBC;AASD,wDAEC;AAGD,8DAmBC;AAQD,gDAeC;AAGD,sDAeC;AAOD,8EAiEC;AAQD,sDAuDC;AAGD,oDAMC;AAGD,0DAOC;AAQD,sCAOC;AAGD,4CAQC;AAGD,wDAMC;AAGD,8DAOC;A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oBAAoB;QAC7C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,SAAS,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,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 { ECStringConstants } from \"./Constants\";\nimport { ECSchemaError, ECSchemaStatus } from \"./Exception\";\n\nexport { PropertyType } from \"./PropertyTypes\";\n\n// NEEDSWORK: This shim is currently required to use async iterators. See https://github.com/Microsoft/TypeScript/issues/14151\nif (!(Symbol as any).asyncIterator) {\n (Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\");\n}\n\n/**\n * Identifies a class as abstract or sealed\n *\n * @public @preview\n */\nexport enum ECClassModifier {\n /* normal, instantiable class, can be subclassed */\n None,\n /* abstract class, cannot be instantiated, can be subclassed */\n Abstract,\n /* sealed class, instantiable class, cannot be subclassed */\n Sealed,\n}\n\n/**\n * An enumeration that has all the schema item type names as values\n *\n * @enum {string}\n * @public @preview\n */\nexport enum SchemaItemType {\n EntityClass = \"EntityClass\",\n Mixin = \"Mixin\",\n StructClass = \"StructClass\",\n CustomAttributeClass = \"CustomAttributeClass\",\n RelationshipClass = \"RelationshipClass\",\n Enumeration = \"Enumeration\",\n KindOfQuantity = \"KindOfQuantity\",\n PropertyCategory = \"PropertyCategory\",\n Unit = \"Unit\",\n InvertedUnit = \"InvertedUnit\",\n Constant = \"Constant\",\n Phenomenon = \"Phenomenon\",\n UnitSystem = \"UnitSystem\",\n Format = \"Format\",\n}\n\n/**\n * Additional Schema Item Types which define classes of item types\n * @public @preview\n */\nexport enum AbstractSchemaItemType {\n /* Item is EntityClass, Mixin, StructClass, CustomAttributeClass, or RelationshipClass */\n Class = \"Class\",\n /* Any item type including the Class types */\n SchemaItem = \"SchemaItem\",\n}\n\n/**\n * Defines types of items that may be provided to identify supported items\n * @public @preview\n */\nexport type SupportedSchemaItemType = SchemaItemType | AbstractSchemaItemType;\n\n/**\n * Primitive data types for ECProperties.\n * @public @preview\n */\nexport enum PrimitiveType {\n Uninitialized = 0x00,\n Binary = 0x101,\n Boolean = 0x201,\n DateTime = 0x301,\n Double = 0x401,\n Integer = 0x501,\n Long = 0x601,\n Point2d = 0x701,\n Point3d = 0x801,\n String = 0x901,\n IGeometry = 0xa01,\n}\n\n/**\n * Defines the valid CustomAttribute container types.\n * @public @preview\n */\nexport enum CustomAttributeContainerType {\n Schema = 0x0001 << 0,\n EntityClass = 0x0001 << 1,\n CustomAttributeClass = 0x0001 << 2,\n StructClass = 0x0001 << 3,\n RelationshipClass = 0x0001 << 4,\n AnyClass = EntityClass | CustomAttributeClass | StructClass | RelationshipClass,\n PrimitiveProperty = 0x0001 << 5,\n StructProperty = 0x0001 << 6,\n PrimitiveArrayProperty = 0x0001 << 7,\n StructArrayProperty = 0x0001 << 8,\n NavigationProperty = 0x0001 << 9,\n AnyProperty = PrimitiveProperty | StructProperty | PrimitiveArrayProperty | StructArrayProperty | NavigationProperty,\n SourceRelationshipConstraint = 0x0001 << 10,\n TargetRelationshipConstraint = 0x0001 << 11,\n AnyRelationshipConstraint = SourceRelationshipConstraint | TargetRelationshipConstraint,\n Any = Schema | AnyClass | AnyProperty | AnyRelationshipConstraint,\n}\n\n/**\n * Defines what sort of match should be used when locating a schema.\n * @public @preview\n */\nexport enum SchemaMatchType {\n /*\n * Find exact VersionRead, VersionWrite, VersionMinor match as well as Data. NOTE data is not yet matched\n * @deprecated in 4.10 - will not be removed until after 2026-06-13. Use Exact instead.\n */\n Identical,\n /* Find exact VersionRead, VersionWrite, VersionMinor match. */\n Exact,\n /* Find latest version with matching VersionRead and VersionWrite */\n LatestWriteCompatible,\n /* Find latest version. */\n Latest,\n /* Find latest version with matching VersionRead */\n LatestReadCompatible,\n}\n\n/**\n * Identifer for an ECRelationshipConstraint. Used to determine the side of the relationship the constraint is representing.\n * @public @preview\n */\nexport enum RelationshipEnd {\n Source = 0,\n Target = 1,\n}\n\n/**\n * Defines the how the lifetime of the source and target are related.\n *\n * @public @preview */\nexport enum StrengthType {\n Referencing,\n Holding,\n Embedding,\n}\n\n/**\n * Defines the which side of the relationship is the starting point of the relationship. This impacts how relationship strength is applied.\n *\n * @public @preview */\nexport enum StrengthDirection {\n /** The source is the starting point of the relationship. */\n Forward = 1,\n /** The target is the starting point of the relationship. */\n Backward = 2,\n}\n\n// Helper methods for going to/from string for the above Enumerations.\n\n/**\n * Parses the provided string into an ECClassModifier if the string is a valid modifier.\n * @param modifier The modifier string to parse.\n * @beta\n */\nexport function parseClassModifier(modifier: string): ECClassModifier | undefined {\n const lowerModifier = modifier.toLowerCase();\n switch (lowerModifier) {\n case \"abstract\": return ECClassModifier.Abstract;\n case \"none\": return ECClassModifier.None;\n case \"sealed\": return ECClassModifier.Sealed;\n }\n return undefined;\n}\n\n/**\n * @return A string representing the provided ECClassModifier. If the modifier is not valid, an empty string is returned.\n * @beta\n */\nexport function classModifierToString(modifier: ECClassModifier): string {\n switch (modifier) {\n case ECClassModifier.Abstract: return \"Abstract\";\n case ECClassModifier.None: return \"None\";\n case ECClassModifier.Sealed: return \"Sealed\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidModifier, \"An invalid ECClassModifier has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 8 schema item types.\n * @param type The schema item type string to parse.\n * @returns A valid SchemaItemType if successfully parsed. Otherwise, undefined if the provided string is not a valid SchemaItemType.\n * @beta\n */\nexport function parseSchemaItemType(type: string): SchemaItemType | undefined {\n switch (type.toLowerCase()) {\n case \"entityclass\": return SchemaItemType.EntityClass;\n case \"mixin\": return SchemaItemType.Mixin;\n case \"structclass\": return SchemaItemType.StructClass;\n case \"customattributeclass\": return SchemaItemType.CustomAttributeClass;\n case \"relationshipclass\": return SchemaItemType.RelationshipClass;\n case \"enumeration\": return SchemaItemType.Enumeration;\n case \"kindofquantity\": return SchemaItemType.KindOfQuantity;\n case \"propertycategory\": return SchemaItemType.PropertyCategory;\n case \"unit\": return SchemaItemType.Unit;\n case \"invertedunit\": return SchemaItemType.InvertedUnit;\n case \"constant\": return SchemaItemType.Constant;\n case \"phenomenon\": return SchemaItemType.Phenomenon;\n case \"unitsystem\": return SchemaItemType.UnitSystem;\n case \"format\": return SchemaItemType.Format;\n }\n return undefined;\n}\n\n/**\n * Converts a valid SchemaItemType to a display string.\n * @param value The SchemaItemType to stringify.\n * @return A string representing the provided SchemaItemType. If the type is not valid, an empty string is returned.\n * @beta\n * @deprecated in 4.6.0 - will not be removed until after 2026-06-13. SchemaItemType is a string enum so just use it directly\n */\nexport function schemaItemTypeToString(value: SchemaItemType): string {\n return value; // TODO: Remove\n}\n\n/** @internal */\nexport function schemaItemTypeToXmlString(value: SchemaItemType): string {\n switch (value) {\n case SchemaItemType.EntityClass: return \"ECEntityClass\";\n case SchemaItemType.Mixin: return \"ECEntityClass\";\n case SchemaItemType.StructClass: return \"ECStructClass\";\n case SchemaItemType.CustomAttributeClass: return \"ECCustomAttributeClass\";\n case SchemaItemType.RelationshipClass: return \"ECRelationshipClass\";\n case SchemaItemType.Enumeration: return \"ECEnumeration\";\n case SchemaItemType.KindOfQuantity: return \"KindOfQuantity\";\n case SchemaItemType.PropertyCategory: return \"PropertyCategory\";\n case SchemaItemType.Unit: return \"Unit\";\n case SchemaItemType.InvertedUnit: return \"InvertedUnit\";\n case SchemaItemType.Constant: return \"Constant\";\n case SchemaItemType.Phenomenon: return \"Phenomenon\";\n case SchemaItemType.UnitSystem: return \"UnitSystem\";\n case SchemaItemType.Format: return \"Format\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, \"An invalid SchemaItemType has been provided.\");\n }\n}\n\n/**\n * Tries to parse the given string as one of the 10 primitive types.\n * @param type The primitive type string to parse.\n * @returns A valid PrimitiveType if successfully parsed, or undefined if the provided string is not a valid PrimitiveType.\n * @beta\n */\nexport function parsePrimitiveType(type: string): PrimitiveType | undefined {\n switch (type.toLowerCase()) {\n case \"binary\": return PrimitiveType.Binary;\n case \"boolean\": case \"bool\": return PrimitiveType.Boolean;\n case \"datetime\": return PrimitiveType.DateTime;\n case \"double\": return PrimitiveType.Double;\n case \"int\": return PrimitiveType.Integer;\n case \"long\": return PrimitiveType.Long;\n case \"point2d\": return PrimitiveType.Point2d;\n case \"point3d\": return PrimitiveType.Point3d;\n case \"string\": return PrimitiveType.String;\n case \"bentley.geometry.common.igeometry\": return PrimitiveType.IGeometry;\n }\n\n return undefined;\n}\n\n/** @beta */\nexport function primitiveTypeToString(type: PrimitiveType): string {\n switch (type) {\n case PrimitiveType.Binary: return \"binary\";\n case PrimitiveType.Boolean: return \"boolean\";\n case PrimitiveType.DateTime: return \"dateTime\";\n case PrimitiveType.Double: return \"double\";\n case PrimitiveType.Integer: return \"int\";\n case PrimitiveType.IGeometry: return \"Bentley.Geometry.Common.IGeometry\";\n case PrimitiveType.Long: return \"long\";\n case PrimitiveType.Point2d: return \"point2d\";\n case PrimitiveType.Point3d: return \"point3d\";\n case PrimitiveType.String: return \"string\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidPrimitiveType, \"An invalid PrimitiveType has been provided.\");\n }\n}\n\n/**\n * Parses the given string into the appropriate CustomAttributeContainerType if the string is valid.\n * @param type The container type string to parse.\n * @beta\n */\nexport function parseCustomAttributeContainerType(type: string): CustomAttributeContainerType | undefined {\n const typeTokens = type.split(/[|,;]+/);\n\n let containerType = 0;\n\n typeTokens.forEach((typeToken) => {\n typeToken = typeToken.trim();\n if (typeToken.length === 0) return;\n\n typeToken = typeToken.toLowerCase();\n switch (typeToken) {\n case \"schema\":\n containerType = containerType | CustomAttributeContainerType.Schema;\n break;\n case \"entityclass\":\n containerType = containerType | CustomAttributeContainerType.EntityClass;\n break;\n case \"customattributeclass\":\n containerType = containerType | CustomAttributeContainerType.CustomAttributeClass;\n break;\n case \"structclass\":\n containerType = containerType | CustomAttributeContainerType.StructClass;\n break;\n case \"relationshipclass\":\n containerType = containerType | CustomAttributeContainerType.RelationshipClass;\n break;\n case \"anyclass\":\n containerType = containerType | CustomAttributeContainerType.AnyClass;\n break;\n case \"primitiveproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveProperty;\n break;\n case \"structproperty\":\n containerType = containerType | CustomAttributeContainerType.StructProperty;\n break;\n case \"arrayproperty\":\n containerType = containerType | CustomAttributeContainerType.PrimitiveArrayProperty;\n break;\n case \"structarrayproperty\":\n containerType = containerType | CustomAttributeContainerType.StructArrayProperty;\n break;\n case \"navigationproperty\":\n containerType = containerType | CustomAttributeContainerType.NavigationProperty;\n break;\n case \"anyproperty\":\n containerType = containerType | CustomAttributeContainerType.AnyProperty;\n break;\n case \"sourcerelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.SourceRelationshipConstraint;\n break;\n case \"targetrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.TargetRelationshipConstraint;\n break;\n case \"anyrelationshipconstraint\":\n containerType = containerType | CustomAttributeContainerType.AnyRelationshipConstraint;\n break;\n case \"any\":\n containerType = containerType | CustomAttributeContainerType.Any;\n break;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidContainerType, `${typeToken} is not a valid CustomAttributeContainerType value.`);\n }\n });\n\n return containerType;\n}\n\n/**\n * Creates a string representing a valid CustomAttributeContainerType.\n * @param value The CustomAttributeContainerType to stringify.\n * @return A string representing the provided CustomAttributeContainerType. If the type is not valid, an empty string is returned.\n * @beta\n */\nexport function containerTypeToString(type: CustomAttributeContainerType): string {\n const testContainerTypeValue = (compareType: CustomAttributeContainerType, otherType: CustomAttributeContainerType) => {\n return compareType === (compareType & otherType);\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Any, type))\n return ECStringConstants.CONTAINERTYPE_ANY;\n\n let containerType = \"\";\n const setOrAppend = (val: string) => {\n if (containerType.length === 0) containerType = val;\n else containerType = `${containerType}, ${val}`;\n };\n\n if (testContainerTypeValue(CustomAttributeContainerType.Schema, type))\n setOrAppend(\"Schema\");\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyClass, type))\n setOrAppend(\"AnyClass\");\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.EntityClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ENTITYCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.CustomAttributeClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.StructClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTCLASS);\n if (testContainerTypeValue(CustomAttributeContainerType.RelationshipClass, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYPROPERTY);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.PrimitiveArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.StructArrayProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY);\n if (testContainerTypeValue(CustomAttributeContainerType.NavigationProperty, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY);\n }\n\n if (testContainerTypeValue(CustomAttributeContainerType.AnyRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT);\n else {\n if (testContainerTypeValue(CustomAttributeContainerType.SourceRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT);\n if (testContainerTypeValue(CustomAttributeContainerType.TargetRelationshipConstraint, type))\n setOrAppend(ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT);\n }\n\n return containerType;\n}\n\n/** @beta */\nexport function parseRelationshipEnd(end: string): RelationshipEnd | undefined {\n switch (end.toLowerCase()) {\n case \"source\": return RelationshipEnd.Source;\n case \"target\": return RelationshipEnd.Target;\n }\n return undefined;\n}\n\n/** @beta */\nexport function relationshipEndToString(end: RelationshipEnd): string {\n switch (end) {\n case RelationshipEnd.Source: return ECStringConstants.RELATIONSHIP_END_SOURCE;\n case RelationshipEnd.Target: return ECStringConstants.RELATIONSHIP_END_TARGET;\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidRelationshipEnd, `An invalid RelationshipEnd has been provided.`);\n }\n}\n\n/**\n * Takes a string representing a StrengthType, will parse it and return the corresponding StrengthType.\n * @throws ECSchemaStatus.InvalidStrength if the provided string that is not valid\n * @param strength\n * @beta\n */\nexport function parseStrength(strength: string): StrengthType | undefined {\n switch (strength.toLowerCase()) {\n case \"referencing\": return StrengthType.Referencing;\n case \"holding\": return StrengthType.Holding;\n case \"embedding\": return StrengthType.Embedding;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthToString(strength: StrengthType): string {\n switch (strength) {\n case StrengthType.Embedding: return \"Embedding\";\n case StrengthType.Holding: return \"Holding\";\n case StrengthType.Referencing: return \"Referencing\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrength, `An invalid Strength has been provided.`);\n }\n}\n\n/** @beta */\nexport function parseStrengthDirection(direction: string): StrengthDirection | undefined {\n switch (direction.toLowerCase()) {\n case \"forward\": return StrengthDirection.Forward;\n case \"backward\": return StrengthDirection.Backward;\n }\n return undefined;\n}\n\n/** @beta */\nexport function strengthDirectionToString(direction: StrengthDirection): string {\n switch (direction) {\n case StrengthDirection.Forward: return \"Forward\";\n case StrengthDirection.Backward: return \"Backward\";\n default:\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `An invalid StrengthDirection has been provided.`);\n }\n}\n\n/** Compares a SchemaItemType against supported type.\n * @beta\n */\nexport function isSupportedSchemaItemType(value: SchemaItemType, supported: SupportedSchemaItemType): boolean {\n if (value === supported) return true;\n\n if (supported === AbstractSchemaItemType.Class && (\n value === SchemaItemType.EntityClass ||\n value === SchemaItemType.Mixin ||\n value === SchemaItemType.StructClass ||\n value === SchemaItemType.CustomAttributeClass ||\n value === SchemaItemType.RelationshipClass)) {\n return true;\n }\n\n if (supported === AbstractSchemaItemType.SchemaItem) {\n return true;\n }\n\n return false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ECSqlSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/ECSqlSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,sDAA6C;AAK7C,4CAA+D;AAE/D,4CAAyC;AACzC,2DAAwD;AACxD,yEAA4F;AAC5F,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAmD;AA2DnD,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAqB/D;;;;GAIG;AACH,MAAsB,kBAAmB,SAAQ,mDAAwB;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,CA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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,sDAA6C;AAK7C,4CAA+D;AAE/D,4CAAyC;AACzC,2DAAwD;AACxD,yEAA4F;AAC5F,2DAAwD;AACxD,iDAA8C;AAC9C,2DAAmD;AA2DnD,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAqB/D;;;;GAIG;AACH,MAAsB,kBAAmB,SAAQ,mDAAwB;IACvE;;OAEG;IACH,IAAuB,OAAO;QAC5B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,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,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAExC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB;YACjD,CAAC,CAAC,MAAM,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,OAAO,CAAC;YAC7D,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAEjD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;QAC9C,qBAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,4BAA4B,SAAS,CAAC,IAAI,OAAO,aAAa,IAAI,EAAE;YACnG,UAAU,EAAE,SAA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,UAAU,GAAG,MAAM,2BAAY,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;QAClF,MAAM,eAAe,CAAC,UAAU,EAAE;YAChC,GAAG,UAAU;YACb,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACpB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC,CAAC,SAAS;SACd,CAAC,CAAC;QAEH,MAAM,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE5C,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,SAAS,GAAG,MAAM,2BAAY,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;\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"]}
@@ -118,7 +118,7 @@ class IncrementalSchemaLocater {
118
118
  * @returns The SchemaProps object.
119
119
  */
120
120
  async createSchemaProps(schemaKey, schemaContext) {
121
- const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, ECObjects_1.SchemaMatchType.Latest);
121
+ const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, ECObjects_1.SchemaMatchType.Latest); // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
122
122
  if (!schemaInfo)
123
123
  throw new Error(`Schema ${schemaKey.name} could not be found.`);
124
124
  const schemaReferences = [];
@@ -1 +1 @@
1
- {"version":3,"file":"IncrementalSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;A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AC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;YAC1D,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAoB,EAAE,SAA0B,EAAE,OAAsB;QAC1F,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACnE,OAAO,kBAAkB;YACvB,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC7F,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,SAAoB,EAAE,OAAsB;QACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,kBAAkB;YACrB,OAAO;QAET,MAAM,KAAK,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;QACzG,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF","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 { ECSchemaNamespaceUris } from \"../Constants\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaProps, SchemaReferenceProps } from \"../Deserialization/JsonProps\";\nimport { SchemaGraphUtil } from \"../Deserialization/SchemaGraphUtil\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { SchemaLoadingController } from \"../utils/SchemaLoadingController\";\nimport { IncrementalSchemaReader } from \"./IncrementalSchemaReader\";\n\ninterface IncrementalSchemaInfo extends SchemaInfo {\n readonly description?: string;\n readonly label?: string;\n}\n\ntype LoadSchemaInfoHandler = (context: SchemaContext) => Promise<Iterable<SchemaInfo>>;\n\n/**\n * Defines the SchemaLocater Options which determine how each schema is to be loaded.\n * All options are optional.\n * @beta\n */\nexport interface SchemaLocaterOptions {\n /** Only load partial schemas. Full schema information will not be retrieved. Defaults to false. */\n readonly loadPartialSchemaOnly?: boolean;\n}\n\n/**\n * A [[ISchemaLocater]] implementation for locating and retrieving EC [[Schema]]\n * objects incrementally instead of the full schema and it's references at once. This is useful for large schemas that\n * take a long time to load, but clients need a rough skeleton of the schema as fast as possible.\n *\n * The IncrementalSchemaLocater is a locater around the [[IncrementalSchemaLocater]] to be used in a\n * [[SchemaContext]].\n * @internal\n */\nexport abstract class IncrementalSchemaLocater implements ISchemaLocater {\n private readonly _options: SchemaLocaterOptions;\n protected readonly _schemaInfoCache: SchemaInfoCache;\n\n /**\n * Initializes a new instance of the IncrementalSchemaLocater class.\n * @param options The [[SchemaLocaterOptions]] that control the loading of the schema.\n */\n constructor(options?: SchemaLocaterOptions) {\n this._options = options || {};\n\n this._schemaInfoCache = new SchemaInfoCache(async (context) => {\n return this.loadSchemaInfos(context);\n });\n }\n\n /** Gets the options how the schema locater load the schemas. */\n protected get options(): SchemaLocaterOptions {\n return this._options;\n }\n\n /**\n * Gets the [[SchemaInfo]] which matches the provided SchemaKey. The SchemaInfo may be returned\n * before the schema is fully loaded. May return the entire Schema so long as it is completely loaded as it satisfies\n * the SchemaInfo interface.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n return this._schemaInfoCache.lookup(schemaKey, matchType, context);\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n const schemaInfo = await this.getSchemaInfo(schemaKey, matchType, context);\n return schemaInfo\n ? this.loadSchema(schemaInfo, context)\n : undefined;\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * NOT IMPLEMENTED IN THIS LOCATER - ALWAYS RETURNS UNDEFINED.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n * @returns Incremental schema loading does not work synchronously, this will always return undefined.\n */\n public getSchemaSync(_schemaKey: Readonly<SchemaKey>, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n return undefined;\n }\n\n /**\n * Gets the schema partials for the given schema key. The first item in the array is the\n * actual schema props of the schema to load, the following items are partial schema props\n * of referenced schemas.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;\n\n /**\n * Gets the full schema json for the requested schema key.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;\n\n /**\n * Loads the schema info objects for the given context.\n * @param context The schema context to load the schema infos for.\n * @returns A promise that resolves to an iterable of schema infos.\n */\n protected abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;\n\n /**\n * Checks if the context contains the right schemas to support incremental schema loading.\n * @param context The schema context to check.\n * @returns true if incremental schema loading is supported, false otherwise.\n */\n protected abstract supportPartialSchemaLoading(context: SchemaContext): Promise<boolean>;\n\n /**\n * Start loading the schema for the given schema info incrementally. The schema is returned\n * as soon as the schema stub is loaded while the schema fully resolves in the background. It should\n * only be called by the IncrementalSchemaLocater if a schema has not been loaded or started to\n * load yet.\n * @param schemaInfo The schema info of the schema to load.\n * @param schemaContext The schema context to load the schema into.\n */\n protected async loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema> {\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(schemaContext)) {\n const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);\n if(schemaJson === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n return Schema.fromJson(schemaJson, schemaContext);\n }\n\n // Fetches the schema partials for the given schema key. The first item in the array is the\n // actual schema props of the schema to load, the following items are schema props of referenced\n // schema items that are needed to resolve the schema properly.\n const schemaPartials = await this.getSchemaPartials(schemaInfo.schemaKey, schemaContext);\n if (schemaPartials === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n // Sort the partials in dependency order to ensure referenced schemas exist in the schema context\n // when they get requested. Otherwise the context would call this method again and for referenced\n // schemas, we would not want to request the whole schema props.\n const sortedPartials = await this.sortSchemaPartials(schemaPartials, schemaContext);\n for (const schemaProps of sortedPartials) {\n await this.startLoadingPartialSchema(schemaProps, schemaContext);\n }\n\n const schema = await schemaContext.getCachedSchema(schemaInfo.schemaKey);\n if (!schema)\n throw new Error(`Schema ${schemaInfo.schemaKey.name} could not be found.`);\n\n return schema;\n }\n\n /**\n * Creates a SchemaProps object by loading the Schema information from the given SchemaContext.\n * @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.\n * @param schemaContext The SchemaContext holding the Schema.\n * @returns The SchemaProps object.\n */\n protected async createSchemaProps(schemaKey: SchemaKey, schemaContext: SchemaContext): Promise<SchemaProps> {\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest) as IncrementalSchemaInfo | undefined;\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n const schemaReferences: Array<SchemaReferenceProps> = [];\n const schemaProps: SchemaProps = {\n $schema: ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,\n name: schemaKey.name,\n alias: schemaInfo.alias,\n version: schemaInfo.schemaKey.version.toString(),\n description: schemaInfo.description,\n label: schemaInfo.label,\n references: schemaReferences,\n items: {}\n };\n\n schemaInfo.references.forEach((ref) => {\n schemaReferences.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });\n });\n\n return schemaProps;\n }\n\n private async startLoadingPartialSchema(schemaProps: SchemaProps, schemaContext: SchemaContext): Promise<void> {\n if (schemaContext.schemaExists(SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`))) {\n return;\n }\n\n const controller = new SchemaLoadingController();\n const schemaReader = new IncrementalSchemaReader(schemaContext, true);\n const schema = new Schema(schemaContext);\n schema.setLoadingController(controller);\n\n await schemaReader.readSchema(schema, schemaProps);\n\n if (!this._options.loadPartialSchemaOnly)\n controller.start(this.startLoadingFullSchema(schema));\n }\n\n private async loadFullSchema(schema: Schema): Promise<void> {\n const fullSchemaProps = await this.getSchemaJson(schema.schemaKey, schema.context)\n const reader = new IncrementalSchemaReader(schema.context, false);\n await reader.readSchema(schema, fullSchemaProps, false);\n }\n\n private async startLoadingFullSchema(schema: Schema): Promise<void> {\n if (!schema.loadingController)\n return;\n\n // If the schema is already resolved, return it directly.\n if (schema.loadingController.isComplete || schema.loadingController.inProgress) {\n return;\n }\n\n // Since the schema relies on it's references, they get triggered to be resolved\n // first by recursively calling this method. After all references has been resolved\n // the schema itself gets resolved.\n await Promise.all(schema.references.map(async (referenceSchema) => {\n if (referenceSchema.loadingController && referenceSchema.loadingController.inProgress)\n return referenceSchema.loadingController.wait();\n else\n return this.startLoadingFullSchema(referenceSchema);\n }));\n\n return this.loadFullSchema(schema);\n }\n\n private async sortSchemaPartials(schemaPartials: ReadonlyArray<SchemaProps>, schemaContext: SchemaContext): Promise<ReadonlyArray<SchemaProps>> {\n const schemaInfos: Array<SchemaInfo & { props: SchemaProps }> = [];\n for (const schemaProps of schemaPartials) {\n const schemaKey = SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`);\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n schemaInfos.push({ ...schemaInfo, props: schemaProps });\n }\n\n const orderedSchemaInfos = SchemaGraphUtil.buildDependencyOrderedSchemaInfoList(schemaInfos) as Array<SchemaInfo & { props: SchemaProps }>;\n return orderedSchemaInfos.map((schemaInfo) => schemaInfo.props);\n }\n}\n\n/**\n * Helper class to manage schema infos for a schema context.\n */\nclass SchemaInfoCache {\n private readonly _schemaInfoCache: WeakMap<SchemaContext, Array<IncrementalSchemaInfo>>;\n private readonly _schemaInfoLoader: LoadSchemaInfoHandler;\n\n constructor(schemaInfoLoader: LoadSchemaInfoHandler) {\n this._schemaInfoCache = new WeakMap<SchemaContext, Array<IncrementalSchemaInfo>>();\n this._schemaInfoLoader = schemaInfoLoader;\n }\n\n public async getSchemasByContext(context: SchemaContext): Promise<IncrementalSchemaInfo[] | undefined> {\n if (!this._schemaInfoCache.has(context)) {\n const schemaInfos = await this._schemaInfoLoader(context);\n this._schemaInfoCache.set(context, Array.from(schemaInfos));\n }\n return this._schemaInfoCache.get(context);\n }\n\n public async lookup(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<IncrementalSchemaInfo | undefined> {\n const contextSchemaInfos = await this.getSchemasByContext(context);\n return contextSchemaInfos\n ? contextSchemaInfos.find((schemaInfo) => schemaInfo.schemaKey.matches(schemaKey, matchType))\n : undefined;\n }\n\n public remove(schemaKey: SchemaKey, context: SchemaContext): void {\n const contextSchemaInfos = this._schemaInfoCache.get(context);\n if (!contextSchemaInfos)\n return;\n\n const index = contextSchemaInfos.findIndex((schemaInfo) => schemaInfo.schemaKey.name === schemaKey.name);\n if (index !== -1) {\n contextSchemaInfos.splice(index, 1);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"IncrementalSchemaLocater.js","sourceRoot":"","sources":["../../../src/IncrementalLoading/IncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,4CAAqD;AAGrD,wEAAqE;AACrE,4CAA+C;AAC/C,4CAA6D;AAE7D,+CAA4C;AAC5C,4CAAyC;AACzC,8EAA2E;AAC3E,uEAAoE;AAmBpE;;;;;;;;GAQG;AACH,MAAsB,wBAAwB;IAC3B,QAAQ,CAAuB;IAC7B,gBAAgB,CAAkB;IAErD;;;OAGG;IACH,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5D,OAAO,IAAI,CAAC,eAAe,CAAC,O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M,kBAAkB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACnE,OAAO,kBAAkB;YACvB,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YAC7F,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,SAAoB,EAAE,OAAsB;QACxD,MAAM,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,kBAAkB;YACrB,OAAO;QAET,MAAM,KAAK,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;QACzG,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,kBAAkB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF","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 { ECSchemaNamespaceUris } from \"../Constants\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaProps, SchemaReferenceProps } from \"../Deserialization/JsonProps\";\nimport { SchemaGraphUtil } from \"../Deserialization/SchemaGraphUtil\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\nimport { SchemaLoadingController } from \"../utils/SchemaLoadingController\";\nimport { IncrementalSchemaReader } from \"./IncrementalSchemaReader\";\n\ninterface IncrementalSchemaInfo extends SchemaInfo {\n readonly description?: string;\n readonly label?: string;\n}\n\ntype LoadSchemaInfoHandler = (context: SchemaContext) => Promise<Iterable<SchemaInfo>>;\n\n/**\n * Defines the SchemaLocater Options which determine how each schema is to be loaded.\n * All options are optional.\n * @beta\n */\nexport interface SchemaLocaterOptions {\n /** Only load partial schemas. Full schema information will not be retrieved. Defaults to false. */\n readonly loadPartialSchemaOnly?: boolean;\n}\n\n/**\n * A [[ISchemaLocater]] implementation for locating and retrieving EC [[Schema]]\n * objects incrementally instead of the full schema and it's references at once. This is useful for large schemas that\n * take a long time to load, but clients need a rough skeleton of the schema as fast as possible.\n *\n * The IncrementalSchemaLocater is a locater around the [[IncrementalSchemaLocater]] to be used in a\n * [[SchemaContext]].\n * @internal\n */\nexport abstract class IncrementalSchemaLocater implements ISchemaLocater {\n private readonly _options: SchemaLocaterOptions;\n protected readonly _schemaInfoCache: SchemaInfoCache;\n\n /**\n * Initializes a new instance of the IncrementalSchemaLocater class.\n * @param options The [[SchemaLocaterOptions]] that control the loading of the schema.\n */\n constructor(options?: SchemaLocaterOptions) {\n this._options = options || {};\n\n this._schemaInfoCache = new SchemaInfoCache(async (context) => {\n return this.loadSchemaInfos(context);\n });\n }\n\n /** Gets the options how the schema locater load the schemas. */\n protected get options(): SchemaLocaterOptions {\n return this._options;\n }\n\n /**\n * Gets the [[SchemaInfo]] which matches the provided SchemaKey. The SchemaInfo may be returned\n * before the schema is fully loaded. May return the entire Schema so long as it is completely loaded as it satisfies\n * the SchemaInfo interface.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchemaInfo(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined> {\n return this._schemaInfoCache.lookup(schemaKey, matchType, context);\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n */\n public async getSchema(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<Schema | undefined> {\n const schemaInfo = await this.getSchemaInfo(schemaKey, matchType, context);\n return schemaInfo\n ? this.loadSchema(schemaInfo, context)\n : undefined;\n }\n\n /**\n * Attempts to get a [[Schema]] from the locater. Yields undefined if no matching schema is found.\n * For schemas that may have references, construct and call through a SchemaContext instead.\n * NOT IMPLEMENTED IN THIS LOCATER - ALWAYS RETURNS UNDEFINED.\n * @param schemaKey The [[SchemaKey]] to look up.\n * @param matchType The [[SchemaMatchType]] to use against candidate schemas.\n * @param context The [[SchemaContext]] for loading schema references.\n * @returns Incremental schema loading does not work synchronously, this will always return undefined.\n */\n public getSchemaSync(_schemaKey: Readonly<SchemaKey>, _matchType: SchemaMatchType, _context: SchemaContext): Schema | undefined {\n return undefined;\n }\n\n /**\n * Gets the schema partials for the given schema key. The first item in the array is the\n * actual schema props of the schema to load, the following items are partial schema props\n * of referenced schemas.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;\n\n /**\n * Gets the full schema json for the requested schema key.\n * @param schemaKey The schema key of the requested schema.\n * @param context The schema context.\n */\n protected abstract getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;\n\n /**\n * Loads the schema info objects for the given context.\n * @param context The schema context to load the schema infos for.\n * @returns A promise that resolves to an iterable of schema infos.\n */\n protected abstract loadSchemaInfos(context: SchemaContext): Promise<Iterable<SchemaInfo>>;\n\n /**\n * Checks if the context contains the right schemas to support incremental schema loading.\n * @param context The schema context to check.\n * @returns true if incremental schema loading is supported, false otherwise.\n */\n protected abstract supportPartialSchemaLoading(context: SchemaContext): Promise<boolean>;\n\n /**\n * Start loading the schema for the given schema info incrementally. The schema is returned\n * as soon as the schema stub is loaded while the schema fully resolves in the background. It should\n * only be called by the IncrementalSchemaLocater if a schema has not been loaded or started to\n * load yet.\n * @param schemaInfo The schema info of the schema to load.\n * @param schemaContext The schema context to load the schema into.\n */\n protected async loadSchema(schemaInfo: SchemaInfo, schemaContext: SchemaContext): Promise<Schema> {\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(schemaContext)) {\n const schemaJson = await this.getSchemaJson(schemaInfo.schemaKey, schemaContext);\n if(schemaJson === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n return Schema.fromJson(schemaJson, schemaContext);\n }\n\n // Fetches the schema partials for the given schema key. The first item in the array is the\n // actual schema props of the schema to load, the following items are schema props of referenced\n // schema items that are needed to resolve the schema properly.\n const schemaPartials = await this.getSchemaPartials(schemaInfo.schemaKey, schemaContext);\n if (schemaPartials === undefined)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the schema, ${schemaInfo.schemaKey.name}.${schemaInfo.schemaKey.version.toString()}`);\n\n // Sort the partials in dependency order to ensure referenced schemas exist in the schema context\n // when they get requested. Otherwise the context would call this method again and for referenced\n // schemas, we would not want to request the whole schema props.\n const sortedPartials = await this.sortSchemaPartials(schemaPartials, schemaContext);\n for (const schemaProps of sortedPartials) {\n await this.startLoadingPartialSchema(schemaProps, schemaContext);\n }\n\n const schema = await schemaContext.getCachedSchema(schemaInfo.schemaKey);\n if (!schema)\n throw new Error(`Schema ${schemaInfo.schemaKey.name} could not be found.`);\n\n return schema;\n }\n\n /**\n * Creates a SchemaProps object by loading the Schema information from the given SchemaContext.\n * @param schemaKey The SchemaKey of the Schema whose props are to be retrieved.\n * @param schemaContext The SchemaContext holding the Schema.\n * @returns The SchemaProps object.\n */\n protected async createSchemaProps(schemaKey: SchemaKey, schemaContext: SchemaContext): Promise<SchemaProps> {\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest) as IncrementalSchemaInfo | undefined; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n const schemaReferences: Array<SchemaReferenceProps> = [];\n const schemaProps: SchemaProps = {\n $schema: ECSchemaNamespaceUris.SCHEMAURL3_2_JSON,\n name: schemaKey.name,\n alias: schemaInfo.alias,\n version: schemaInfo.schemaKey.version.toString(),\n description: schemaInfo.description,\n label: schemaInfo.label,\n references: schemaReferences,\n items: {}\n };\n\n schemaInfo.references.forEach((ref) => {\n schemaReferences.push({ name: ref.schemaKey.name, version: ref.schemaKey.version.toString() });\n });\n\n return schemaProps;\n }\n\n private async startLoadingPartialSchema(schemaProps: SchemaProps, schemaContext: SchemaContext): Promise<void> {\n if (schemaContext.schemaExists(SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`))) {\n return;\n }\n\n const controller = new SchemaLoadingController();\n const schemaReader = new IncrementalSchemaReader(schemaContext, true);\n const schema = new Schema(schemaContext);\n schema.setLoadingController(controller);\n\n await schemaReader.readSchema(schema, schemaProps);\n\n if (!this._options.loadPartialSchemaOnly)\n controller.start(this.startLoadingFullSchema(schema));\n }\n\n private async loadFullSchema(schema: Schema): Promise<void> {\n const fullSchemaProps = await this.getSchemaJson(schema.schemaKey, schema.context)\n const reader = new IncrementalSchemaReader(schema.context, false);\n await reader.readSchema(schema, fullSchemaProps, false);\n }\n\n private async startLoadingFullSchema(schema: Schema): Promise<void> {\n if (!schema.loadingController)\n return;\n\n // If the schema is already resolved, return it directly.\n if (schema.loadingController.isComplete || schema.loadingController.inProgress) {\n return;\n }\n\n // Since the schema relies on it's references, they get triggered to be resolved\n // first by recursively calling this method. After all references has been resolved\n // the schema itself gets resolved.\n await Promise.all(schema.references.map(async (referenceSchema) => {\n if (referenceSchema.loadingController && referenceSchema.loadingController.inProgress)\n return referenceSchema.loadingController.wait();\n else\n return this.startLoadingFullSchema(referenceSchema);\n }));\n\n return this.loadFullSchema(schema);\n }\n\n private async sortSchemaPartials(schemaPartials: ReadonlyArray<SchemaProps>, schemaContext: SchemaContext): Promise<ReadonlyArray<SchemaProps>> {\n const schemaInfos: Array<SchemaInfo & { props: SchemaProps }> = [];\n for (const schemaProps of schemaPartials) {\n const schemaKey = SchemaKey.parseString(`${schemaProps.name}.${schemaProps.version}`);\n const schemaInfo = await schemaContext.getSchemaInfo(schemaKey, SchemaMatchType.Latest);\n if (!schemaInfo)\n throw new Error(`Schema ${schemaKey.name} could not be found.`);\n\n schemaInfos.push({ ...schemaInfo, props: schemaProps });\n }\n\n const orderedSchemaInfos = SchemaGraphUtil.buildDependencyOrderedSchemaInfoList(schemaInfos) as Array<SchemaInfo & { props: SchemaProps }>;\n return orderedSchemaInfos.map((schemaInfo) => schemaInfo.props);\n }\n}\n\n/**\n * Helper class to manage schema infos for a schema context.\n */\nclass SchemaInfoCache {\n private readonly _schemaInfoCache: WeakMap<SchemaContext, Array<IncrementalSchemaInfo>>;\n private readonly _schemaInfoLoader: LoadSchemaInfoHandler;\n\n constructor(schemaInfoLoader: LoadSchemaInfoHandler) {\n this._schemaInfoCache = new WeakMap<SchemaContext, Array<IncrementalSchemaInfo>>();\n this._schemaInfoLoader = schemaInfoLoader;\n }\n\n public async getSchemasByContext(context: SchemaContext): Promise<IncrementalSchemaInfo[] | undefined> {\n if (!this._schemaInfoCache.has(context)) {\n const schemaInfos = await this._schemaInfoLoader(context);\n this._schemaInfoCache.set(context, Array.from(schemaInfos));\n }\n return this._schemaInfoCache.get(context);\n }\n\n public async lookup(schemaKey: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise<IncrementalSchemaInfo | undefined> {\n const contextSchemaInfos = await this.getSchemasByContext(context);\n return contextSchemaInfos\n ? contextSchemaInfos.find((schemaInfo) => schemaInfo.schemaKey.matches(schemaKey, matchType))\n : undefined;\n }\n\n public remove(schemaKey: SchemaKey, context: SchemaContext): void {\n const contextSchemaInfos = this._schemaInfoCache.get(context);\n if (!contextSchemaInfos)\n return;\n\n const index = contextSchemaInfos.findIndex((schemaInfo) => schemaInfo.schemaKey.name === schemaKey.name);\n if (index !== -1) {\n contextSchemaInfos.splice(index, 1);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Metadata/EntityClass.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAyRH,4DAsBC;AAGD,oEAsBC;AAtUD,sDAA4D;AAE5D,oFAAiF;AACjF,4CAAyF;AACzF,4CAA6D;AAG7D,mCAAkC;AAClC,mCAAgC;AAChC,yCAAuE;AACvE,2DAAwD;AAGxD;;;GAGG;AACH,MAAa,WAAY,SAAQ,eAAO;IACb,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;IACrE,gBAAgB;IACT,MAAM,KAAc,cAAc,KAAK,OAAO,0BAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAqB;IAEpC,IAAW,MAAM;QACf,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,CAAC,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,OAAO;QAET,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,aAAK,CAAC,CAAC;YACtD,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,IAAI,CAAC;YACb,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;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gCAAgC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;IAEhJ,IAAI,oBAAmD,CAAC;IACxD,IAAI,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QACvC,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,qCAAiB,CAAC,CAAC;IACxF,CAAC;;QACC,oBAAoB,GAAG,YAAY,CAAC;IAEtC,IAAI,CAAC,oBAAoB;QACvB,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,WAAW,EAAE,mCAAmC,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,8CAA8C,CAAC,CAAC;IAEhN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,wCAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,6BAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this.schema.context.classHierarchy.addBaseClass(this.key, mixin.key, true);\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop as AnyProperty;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected override async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n for (const mixin of this.mixins) {\n const mixinObj = await mixin;\n const mixinProps = mixinObj.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = await this.getProperties(true);\n if (localProps) {\n for (const property of localProps) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n return cache;\n }\n\n /**\n *\n * @param cache\n * @internal\n */\n protected override buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n });\n }\n\n for (const mixin of this.getMixinsSync()) {\n const mixinProps = mixin.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = this.getPropertiesSync(true);\n if (localProps) {\n Array.from(localProps).forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * Save this EntityClass' properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\n this.schema.context.classHierarchy.addBaseClass(this.key, mixinSchemaItemKey, true);\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === \"string\" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === \"string\" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}
1
+ {"version":3,"file":"EntityClass.js","sourceRoot":"","sources":["../../../src/Met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AAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,8CAA8C,CAAC,CAAC;IAEhN,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,CAAC;QACvD,IAAI,SAAS,KAAK,YAAY;YAC5B,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,wBAAwB,EAAE,mCAAmC,SAAS,qCAAqC,CAAC,CAAC;QACtJ,SAAS,GAAG,YAAY,CAAC;IAC3B,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,wCAAuB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,CAAC;IACjH,OAAO,IAAI,6BAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Metadata\n */\n\nimport { DelayedPromiseWithProps } from \"../DelayedPromise\";\nimport { EntityClassProps } from \"../Deserialization/JsonProps\";\nimport { XmlSerializationUtils } from \"../Deserialization/XmlSerializationUtils\";\nimport { parseStrengthDirection, SchemaItemType, StrengthDirection } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { HasMixins, LazyLoadedMixin } from \"../Interfaces\";\nimport { SchemaItemKey } from \"../SchemaKey\";\nimport { ECClass } from \"./Class\";\nimport { Mixin } from \"./Mixin\";\nimport { AnyProperty, NavigationProperty, Property } from \"./Property\";\nimport { RelationshipClass } from \"./RelationshipClass\";\nimport { SchemaItem } from \"./SchemaItem\";\n\n/**\n * A Typescript class representation of an ECEntityClass.\n * @public @preview\n */\nexport class EntityClass extends ECClass implements HasMixins {\n public override readonly schemaItemType = EntityClass.schemaItemType;\n /** @internal */\n public static override get schemaItemType() { return SchemaItemType.EntityClass; }\n private _mixins?: LazyLoadedMixin[];\n\n public get mixins(): ReadonlyArray<LazyLoadedMixin> {\n if (!this._mixins)\n return [];\n return this._mixins;\n }\n\n public *getMixinsSync(): Iterable<Mixin> {\n if (!this._mixins)\n return;\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin, Mixin);\n if (mObj) {\n yield mObj;\n }\n }\n }\n\n /**\n *\n * @param mixin\n * @internal\n */\n protected addMixin(mixin: Mixin) {\n if (!this._mixins)\n this._mixins = [];\n\n this.schema.context.classHierarchy.addBaseClass(this.key, mixin.key, true);\n this._mixins.push(new DelayedPromiseWithProps(mixin.key, async () => mixin));\n return;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override async getInheritedProperty(name: string): Promise<AnyProperty | undefined> {\n let inheritedProperty = await super.getInheritedProperty(name);\n\n if (!inheritedProperty && this._mixins) {\n const mixinProps = await Promise.all(this._mixins.map(async (mixin) => (await mixin).getProperty(name)));\n mixinProps.some((prop) => {\n inheritedProperty = prop;\n return inheritedProperty !== undefined;\n });\n }\n\n return inheritedProperty as AnyProperty | undefined;\n }\n\n /**\n * Searches the base class, if one exists, first then any mixins that exist for the property with the name provided.\n * @param name The name of the property to find.\n */\n public override getInheritedPropertySync(name: string): Property | undefined {\n const inheritedProperty = super.getInheritedPropertySync(name);\n if (inheritedProperty)\n return inheritedProperty;\n\n if (!this._mixins) {\n return undefined;\n }\n\n for (const mixin of this._mixins) {\n const mObj = this.schema.lookupItemSync(mixin);\n if (mObj && ECClass.isECClass(mObj)) {\n const result = mObj.getPropertySync(name, true);\n if (result) {\n return result;\n }\n }\n }\n\n return undefined;\n }\n\n /**\n *\n * @param cache\n * @returns\n *\n * @internal\n */\n protected override async buildPropertyCache(): Promise<Map<string, Property>> {\n const cache = new Map<string, Property>();\n const baseClass = await this.baseClass;\n if (baseClass) {\n for (const property of await baseClass.getProperties()) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n for (const mixin of this.mixins) {\n const mixinObj = await mixin;\n const mixinProps = mixinObj.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = await this.getProperties(true);\n if (localProps) {\n for (const property of localProps) {\n cache.set(property.name.toUpperCase(), property);\n }\n }\n return cache;\n }\n\n /**\n *\n * @param cache\n * @internal\n */\n protected override buildPropertyCacheSync(): Map<string, Property> {\n const cache = new Map<string, Property>();\n const baseClass = this.getBaseClassSync();\n if (baseClass) {\n Array.from(baseClass.getPropertiesSync()).forEach((property) => {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n });\n }\n\n for (const mixin of this.getMixinsSync()) {\n const mixinProps = mixin.getPropertiesSync();\n for (const property of mixinProps) {\n if (!cache.has(property.name.toUpperCase()))\n cache.set(property.name.toUpperCase(), property);\n }\n }\n\n const localProps = this.getPropertiesSync(true);\n if (localProps) {\n Array.from(localProps).forEach(property => {\n cache.set(property.name.toUpperCase(), property);\n });\n }\n return cache;\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected async createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n return this.addProperty(await createNavigationProperty(this, name, relationship, direction));\n }\n\n /**\n *\n * @param name\n * @param relationship\n * @param direction\n * @internal\n */\n protected createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n return this.addProperty(createNavigationPropertySync(this, name, relationship, direction));\n }\n\n /**\n * Save this EntityClass' properties to an object for serializing to JSON.\n * @param standalone Serialization includes only this object (as opposed to the full schema).\n * @param includeSchemaVersion Include the Schema's version information in the serialized object.\n */\n public override toJSON(standalone: boolean = false, includeSchemaVersion: boolean = false): EntityClassProps {\n const schemaJson = super.toJSON(standalone, includeSchemaVersion) as any;\n if (this.mixins.length > 0)\n schemaJson.mixins = this.mixins.map((mixin) => mixin.fullName);\n return schemaJson;\n }\n\n /** @internal */\n public override async toXml(schemaXml: Document): Promise<Element> {\n const itemElement = await super.toXml(schemaXml);\n\n for (const lazyMixin of this.mixins) {\n const mixin = await lazyMixin;\n const mixinElement = schemaXml.createElement(\"BaseClass\");\n const mixinName = XmlSerializationUtils.createXmlTypedName(this.schema, mixin.schema, mixin.name);\n mixinElement.textContent = mixinName;\n itemElement.appendChild(mixinElement);\n }\n return itemElement;\n }\n\n public override async fromJSON(entityClassProps: EntityClassProps) {\n this.fromJSONSync(entityClassProps);\n }\n\n public override fromJSONSync(entityClassProps: EntityClassProps) {\n super.fromJSONSync(entityClassProps);\n\n if (undefined !== entityClassProps.mixins) {\n if (!this._mixins)\n this._mixins = [];\n for (const name of entityClassProps.mixins) {\n const mixinSchemaItemKey = this.schema.getSchemaItemKey(name);\n if (!mixinSchemaItemKey)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n\n if (!this._mixins.find((value) => mixinSchemaItemKey.matchesFullName(value.fullName))) {\n this.schema.context.classHierarchy.addBaseClass(this.key, mixinSchemaItemKey, true);\n this._mixins.push(new DelayedPromiseWithProps<SchemaItemKey, Mixin>(mixinSchemaItemKey,\n async () => {\n const mixin = await this.schema.lookupItem(mixinSchemaItemKey, Mixin);\n if (undefined === mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The ECEntityClass ${this.name} has a mixin (\"${name}\") that cannot be found.`);\n return mixin;\n }));\n }\n }\n }\n }\n\n /**\n * Type guard to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns True if the item is an EntityClass, false otherwise.\n */\n public static isEntityClass(item?: SchemaItem): item is EntityClass {\n if (item && item.schemaItemType === SchemaItemType.EntityClass)\n return true;\n\n return false;\n }\n\n /**\n * Type assertion to check if the SchemaItem is of type EntityClass.\n * @param item The SchemaItem to check.\n * @returns The item cast to EntityClass if it is an EntityClass, undefined otherwise.\n * @internal\n */\n public static assertIsEntityClass(item?: SchemaItem): asserts item is EntityClass {\n if (!this.isEntityClass(item))\n throw new ECSchemaError(ECSchemaStatus.InvalidSchemaItemType, `Expected '${SchemaItemType.EntityClass}' (EntityClass)`);\n }\n}\n\n/**\n * Hackish approach that works like a \"friend class\" so we can access protected members without making them public.\n * @internal\n */\nexport abstract class MutableEntityClass extends EntityClass {\n public abstract override addMixin(mixin: Mixin): any;\n public abstract override createNavigationProperty(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty>;\n public abstract override createNavigationPropertySync(name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty;\n public abstract override setDisplayLabel(displayLabel: string): void;\n}\n\n/** @internal */\nexport async function createNavigationProperty(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): Promise<NavigationProperty> {\n if (await ecClass.getProperty(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = await ecClass.schema.lookupItem(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === \"string\" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n\n/** @internal */\nexport function createNavigationPropertySync(ecClass: ECClass, name: string, relationship: string | RelationshipClass, direction: string | StrengthDirection): NavigationProperty {\n if (ecClass.getPropertySync(name, true))\n throw new ECSchemaError(ECSchemaStatus.DuplicateProperty, `An ECProperty with the name ${name} already exists in the class ${ecClass.name}.`);\n\n let resolvedRelationship: RelationshipClass | undefined;\n if (typeof (relationship) === \"string\") {\n resolvedRelationship = ecClass.schema.lookupItemSync(relationship, RelationshipClass);\n } else\n resolvedRelationship = relationship;\n\n if (!resolvedRelationship)\n throw new ECSchemaError(ECSchemaStatus.InvalidType, `The provided RelationshipClass, ${typeof relationship === \"string\" ? relationship : relationship.fullName}, is not a valid RelationshipClassInterface.`);\n\n if (typeof (direction) === \"string\") {\n const tmpDirection = parseStrengthDirection(direction);\n if (undefined === tmpDirection)\n throw new ECSchemaError(ECSchemaStatus.InvalidStrengthDirection, `The provided StrengthDirection, ${direction}, is not a valid StrengthDirection.`);\n direction = tmpDirection;\n }\n\n const lazyRelationship = new DelayedPromiseWithProps(resolvedRelationship.key, async () => resolvedRelationship);\n return new NavigationProperty(ecClass, name, lazyRelationship, direction);\n}\n"]}