@itwin/ecschema-metadata 5.5.0-dev.2 → 5.5.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +466 -466
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -309
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -1
- package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js +466 -466
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -309
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Change Log - @itwin/ecschema-metadata
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 02 Dec 2025 23:11:57 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.4.0
|
|
6
|
+
Tue, 02 Dec 2025 21:22:25 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
4
9
|
|
|
5
10
|
## 5.3.3
|
|
6
11
|
Thu, 20 Nov 2025 22:30:37 GMT
|
package/lib/cjs/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,MAAa,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,CAAC;;AAxB3D,8CAyBC;AAED;;GAEG;AACH,IAAiB,qBAAqB,CAKrC;AALD,WAAiB,qBAAqB;IACvB,uCAAiB,GAAG,qDAAqD,CAAC;IAC1E,sCAAgB,GAAG,uDAAuD,CAAC;IAE3E,sCAAgB,GAAG,kDAAkD,CAAC;AACrF,CAAC,EALgB,qBAAqB,qCAArB,qBAAqB,QAKrC","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\n/**\n * @internal\n */\nexport class ECStringConstants {\n // Relationship End\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\n\n // Container Type\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\n\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\n\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\n\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\n}\n\n/**\n * @internal\n */\nexport namespace ECSchemaNamespaceUris {\n export const SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\n export const SCHEMAITEMURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\n\n export const SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,MAAa,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,CAAC;;AAxB3D,8CAyBC;AAED;;GAEG;AACH,IAAiB,qBAAqB,CAKrC;AALD,WAAiB,qBAAqB;IACvB,uCAAiB,GAAG,qDAAqD,CAAC;IAC1E,sCAAgB,GAAG,uDAAuD,CAAC;IAE3E,sCAAgB,GAAG,kDAAkD,CAAC;AACrF,CAAC,EALgB,qBAAqB,qCAArB,qBAAqB,QAKrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ECStringConstants {\r\n // Relationship End\r\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\r\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\r\n\r\n // Container Type\r\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\r\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\r\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\r\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\r\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\r\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\r\n\r\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\r\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\r\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\r\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\r\n\r\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\r\n\r\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport namespace ECSchemaNamespaceUris {\r\n export const SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\r\n export const SCHEMAITEMURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\r\n\r\n export const SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,cAAc;IAEzB;;;OAGG;IACH,YAAY,aAA+B;QACzC,IAAI,OAA+B,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;YACtB,OAAO,GAAG,OAAO,IAAI,aAAa,EAAE,CAAC;YACrC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAED,qGAAqG;IACrF,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,SAAkB,CAAC;IAE1D;;OAEG;IACI,KAAK,CAAmB;IAE/B;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAAiC,WAAiF,EAAE,UAAmF;QACtN,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAkB,UAAiF;QACnH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,SAA2C;QAC9D,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAjDD,wCAiDC;AAgCD,wGAAwG;AACxG,+HAA+H;AAC/H;;GAEG;AACH,gEAAgE;AACnD,QAAA,uBAAuB,GAAG,CAAC,KAAyD,SAAQ,cAAwB;IAC/H,YAAY,KAAa,EAAE,EAA2B;QACpD,KAAK,CAAC,EAAE,CAAC,CAAC;QAEV,MAAM,OAAO,GAAG;YACd,GAAG,EAAE,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE;gBACpC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAkB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAoB,CAAC,CAAC;YAClF,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAsC,CAAC;IACxE,CAAC;CACF,CAAuC,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 Utils\n */\n\n/**\n * Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)\n * and resulting value of an asynchronous operation ***that has not yet started***.\n *\n * The asynchronous operation behind a DelayedPromise will start when any of the following occurs:\n * - The DelayedPromise is `await`ed.\n * - A callback is attached via `.then()` or `.catch(() => { })`.\n * - The asynchronous operation is explicitly started via `.start()`\n *\n * Just as normal Promises will never return to their pending state once fulfilled or rejected,\n * a DelayedPromise will never re-execute its asynchronous operation more than **once**.\n *\n * Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to\n * represent an (asynchronously) lazily-loaded value as an instance property instead of a method.\n * You could also accomplish something similar by defining an async function as a property getter.\n * However, since a property defined as a DelayedPromise will not start simply by being accessed,\n * additional (non-lazily-loaded) \"nested\" properties can be added.\n *\n * [!alert text=\"*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening.\" kind=\"warning\"]\n * @internal\n */\nexport class DelayedPromise<T> implements Promise<T> {\n\n /**\n * Constructs a DelayedPromise object.\n * @param startCallback The asynchronous callback to execute when this DelayedPromise should be \"started\".\n */\n constructor(startCallback: () => Promise<T>) {\n let pending: Promise<T> | undefined;\n this.start = async () => {\n pending = pending || startCallback();\n return pending;\n };\n }\n\n // We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts\n public readonly [Symbol.toStringTag] = \"Promise\" as const;\n\n /**\n * Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).\n */\n public start: () => Promise<T>;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @return A Promise for the completion of which ever callback is executed.\n */\n public async then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {\n return this.start().then(onfulfilled, onrejected);\n }\n\n /**\n * Attaches a callback for only the rejection of the Promise.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @return A Promise for the completion of the callback.\n */\n public async catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {\n return this.start().catch(onrejected);\n }\n\n /**\n * Attaches a callback for only the finally clause of the Promise.\n * @param onrejected The callback to execute when the Promise is finalized.\n * @return A Promise for the completion of the callback.\n */\n public async finally(onFinally?: (() => void) | undefined | null): Promise<T> {\n return this.start().finally(onFinally);\n }\n}\n\n// This keeps us from accidentally overriding one of DelayedPromise's methods in the DelayedPromiseWithProps constructor\n/**\n * @internal\n */\nexport interface NoDelayedPromiseMethods {\n [propName: string]: any;\n start?: never;\n then?: never;\n catch?: never;\n}\n\n// See definition of DelayedPromiseWithProps below\n/**\n * @internal\n */\nexport interface DelayedPromiseWithPropsConstructor {\n\n /**\n * Constructs a DelayedPromiseWithProps object, which is at once both:\n * - A DelayedPromise object representing the eventual completion (or failure)\n * of an asynchronous operation returning a value of type `TPayload`\n * - _and_ a readonly \"wrapper\" around an instance of type `TProps`\n *\n * @param props An object with properties and methods that will be accessible\n * as if they were readonly properties of the DelayedPromiseWithProps object being constructed.\n * @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be \"started\".\n */\n new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): TProps & DelayedPromise<TPayload>; // eslint-disable-line @typescript-eslint/prefer-function-type\n}\n\n// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.\n// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const DelayedPromiseWithProps = (class <TProps extends NoDelayedPromiseMethods, TPayload> extends DelayedPromise<TPayload> {\n constructor(props: TProps, cb: () => Promise<TPayload>) {\n super(cb);\n\n const handler = {\n get: (target: TProps, name: string) => {\n return (name in this) ? this[name as keyof this] : target[name as keyof TProps];\n },\n };\n\n return new Proxy(props, handler) as TProps & DelayedPromise<TPayload>;\n }\n}) as DelayedPromiseWithPropsConstructor;\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\n/**\n * Define the type of a DelayedPromiseWithProps instance\n * @internal\n */\nexport type DelayedPromiseWithProps<TProps, TPayload> = TProps & DelayedPromise<TPayload>;\n"]}
|
|
1
|
+
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],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AM,CAAC,IAAoB,CAAC,CAAC;YAClF,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAsC,CAAC;IACxE,CAAC;CACF,CAAuC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/**\r\n * Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)\r\n * and resulting value of an asynchronous operation ***that has not yet started***.\r\n *\r\n * The asynchronous operation behind a DelayedPromise will start when any of the following occurs:\r\n * - The DelayedPromise is `await`ed.\r\n * - A callback is attached via `.then()` or `.catch(() => { })`.\r\n * - The asynchronous operation is explicitly started via `.start()`\r\n *\r\n * Just as normal Promises will never return to their pending state once fulfilled or rejected,\r\n * a DelayedPromise will never re-execute its asynchronous operation more than **once**.\r\n *\r\n * Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to\r\n * represent an (asynchronously) lazily-loaded value as an instance property instead of a method.\r\n * You could also accomplish something similar by defining an async function as a property getter.\r\n * However, since a property defined as a DelayedPromise will not start simply by being accessed,\r\n * additional (non-lazily-loaded) \"nested\" properties can be added.\r\n *\r\n * [!alert text=\"*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening.\" kind=\"warning\"]\r\n * @internal\r\n */\r\nexport class DelayedPromise<T> implements Promise<T> {\r\n\r\n /**\r\n * Constructs a DelayedPromise object.\r\n * @param startCallback The asynchronous callback to execute when this DelayedPromise should be \"started\".\r\n */\r\n constructor(startCallback: () => Promise<T>) {\r\n let pending: Promise<T> | undefined;\r\n this.start = async () => {\r\n pending = pending || startCallback();\r\n return pending;\r\n };\r\n }\r\n\r\n // We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts\r\n public readonly [Symbol.toStringTag] = \"Promise\" as const;\r\n\r\n /**\r\n * Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).\r\n */\r\n public start: () => Promise<T>;\r\n\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @return A Promise for the completion of which ever callback is executed.\r\n */\r\n public async then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {\r\n return this.start().then(onfulfilled, onrejected);\r\n }\r\n\r\n /**\r\n * Attaches a callback for only the rejection of the Promise.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @return A Promise for the completion of the callback.\r\n */\r\n public async catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {\r\n return this.start().catch(onrejected);\r\n }\r\n\r\n /**\r\n * Attaches a callback for only the finally clause of the Promise.\r\n * @param onrejected The callback to execute when the Promise is finalized.\r\n * @return A Promise for the completion of the callback.\r\n */\r\n public async finally(onFinally?: (() => void) | undefined | null): Promise<T> {\r\n return this.start().finally(onFinally);\r\n }\r\n}\r\n\r\n// This keeps us from accidentally overriding one of DelayedPromise's methods in the DelayedPromiseWithProps constructor\r\n/**\r\n * @internal\r\n */\r\nexport interface NoDelayedPromiseMethods {\r\n [propName: string]: any;\r\n start?: never;\r\n then?: never;\r\n catch?: never;\r\n}\r\n\r\n// See definition of DelayedPromiseWithProps below\r\n/**\r\n * @internal\r\n */\r\nexport interface DelayedPromiseWithPropsConstructor {\r\n\r\n /**\r\n * Constructs a DelayedPromiseWithProps object, which is at once both:\r\n * - A DelayedPromise object representing the eventual completion (or failure)\r\n * of an asynchronous operation returning a value of type `TPayload`\r\n * - _and_ a readonly \"wrapper\" around an instance of type `TProps`\r\n *\r\n * @param props An object with properties and methods that will be accessible\r\n * as if they were readonly properties of the DelayedPromiseWithProps object being constructed.\r\n * @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be \"started\".\r\n */\r\n new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): TProps & DelayedPromise<TPayload>; // eslint-disable-line @typescript-eslint/prefer-function-type\r\n}\r\n\r\n// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.\r\n// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const DelayedPromiseWithProps = (class <TProps extends NoDelayedPromiseMethods, TPayload> extends DelayedPromise<TPayload> {\r\n constructor(props: TProps, cb: () => Promise<TPayload>) {\r\n super(cb);\r\n\r\n const handler = {\r\n get: (target: TProps, name: string) => {\r\n return (name in this) ? this[name as keyof this] : target[name as keyof TProps];\r\n },\r\n };\r\n\r\n return new Proxy(props, handler) as TProps & DelayedPromise<TPayload>;\r\n }\r\n}) as DelayedPromiseWithPropsConstructor;\r\n\r\n/* eslint-disable @typescript-eslint/no-redeclare */\r\n\r\n/**\r\n * Define the type of a DelayedPromiseWithProps instance\r\n * @internal\r\n */\r\nexport type DelayedPromiseWithProps<TProps, TPayload> = TProps & DelayedPromise<TPayload>;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAoB/F,gBAAgB;AAChB,MAAsB,cAAc;IACxB,cAAc,CAAiB;CAmC1C;AApCD,wCAoCC","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\nimport {\n ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\n NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps,\n SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\n} from \"../Deserialization/JsonProps\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ECSpecVersion } from \"./Helper\";\n\ntype SchemaItemTuple<T> = Readonly<[string /** Name */, string /** SchemaItemType */, Readonly<T>]>;\ntype PropertyTuple<T> = Readonly<[string /** Name */, string /** Property */, Readonly<T>]>;\n\n/** @internal */\nexport type CustomAttributeProvider = (caClass: CustomAttributeClass) => CustomAttribute;\n\n/** @internal */\nexport type CAProviderTuple = Readonly<[string /** Full Name */, CustomAttributeProvider]>;\n\n/** @internal */\nexport abstract class AbstractParser<TItem = any, TProperty = TItem> {\n protected _ecSpecVersion?: ECSpecVersion;\n\n public abstract parseSchema(): SchemaProps;\n public abstract getReferences(): Iterable<SchemaReferenceProps>;\n\n public abstract getItems(): Iterable<SchemaItemTuple<TItem>>;\n public abstract findItem(itemName: string): SchemaItemTuple<TItem> | undefined;\n\n public abstract parseEntityClass(data: Readonly<TItem>): EntityClassProps;\n public abstract parseMixin(data: Readonly<TItem>): MixinProps;\n public abstract parseStructClass(data: Readonly<TItem>): StructClassProps;\n public abstract parseCustomAttributeClass(data: Readonly<TItem>): CustomAttributeClassProps;\n public abstract parseRelationshipClass(data: Readonly<TItem>): RelationshipClassProps;\n public abstract parseEnumeration(data: Readonly<TItem>): EnumerationProps;\n public abstract parseKindOfQuantity(data: Readonly<TItem>): KindOfQuantityProps;\n public abstract parsePropertyCategory(data: Readonly<TItem>): PropertyCategoryProps;\n public abstract parseUnit(data: Readonly<TItem>): SchemaItemUnitProps;\n public abstract parseInvertedUnit(data: Readonly<TItem>): InvertedUnitProps;\n public abstract parseConstant(data: Readonly<TItem>): ConstantProps;\n public abstract parsePhenomenon(data: Readonly<TItem>): PhenomenonProps;\n public abstract parseFormat(data: Readonly<TItem>): SchemaItemFormatProps;\n public abstract parseUnitSystem(data: Readonly<TItem>): UnitSystemProps;\n\n public abstract getProperties(data: Readonly<TItem>, itemName: string): Iterable<PropertyTuple<TProperty>>;\n public abstract parsePrimitiveProperty(data: Readonly<TProperty>): PrimitivePropertyProps;\n public abstract parseStructProperty(data: Readonly<TProperty>): StructPropertyProps;\n public abstract parsePrimitiveArrayProperty(data: Readonly<TProperty>): PrimitiveArrayPropertyProps;\n public abstract parseStructArrayProperty(data: Readonly<TProperty>): StructArrayPropertyProps;\n public abstract parseNavigationProperty(data: Readonly<TProperty>): NavigationPropertyProps;\n\n public abstract getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple>;\n public abstract getClassCustomAttributeProviders(data: Readonly<TItem>): Iterable<CAProviderTuple>;\n public abstract getPropertyCustomAttributeProviders(data: Readonly<TProperty>): Iterable<CAProviderTuple>;\n public abstract getRelationshipConstraintCustomAttributeProviders(data: Readonly<TItem>): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */];\n public abstract get getECSpecVersion(): ECSpecVersion | undefined;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/prefer-function-type\nexport interface AbstractParserConstructor<TSchema, TItem = any, TProperty = TItem> { new(obj: Readonly<TSchema>): AbstractParser<TItem, TProperty> }\n"]}
|
|
1
|
+
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAoB/F,gBAAgB;AAChB,MAAsB,cAAc;IACxB,cAAc,CAAiB;CAmC1C;AApCD,wCAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport {\r\n ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\r\n NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps,\r\n SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\r\n} from \"../Deserialization/JsonProps\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ECSpecVersion } from \"./Helper\";\r\n\r\ntype SchemaItemTuple<T> = Readonly<[string /** Name */, string /** SchemaItemType */, Readonly<T>]>;\r\ntype PropertyTuple<T> = Readonly<[string /** Name */, string /** Property */, Readonly<T>]>;\r\n\r\n/** @internal */\r\nexport type CustomAttributeProvider = (caClass: CustomAttributeClass) => CustomAttribute;\r\n\r\n/** @internal */\r\nexport type CAProviderTuple = Readonly<[string /** Full Name */, CustomAttributeProvider]>;\r\n\r\n/** @internal */\r\nexport abstract class AbstractParser<TItem = any, TProperty = TItem> {\r\n protected _ecSpecVersion?: ECSpecVersion;\r\n\r\n public abstract parseSchema(): SchemaProps;\r\n public abstract getReferences(): Iterable<SchemaReferenceProps>;\r\n\r\n public abstract getItems(): Iterable<SchemaItemTuple<TItem>>;\r\n public abstract findItem(itemName: string): SchemaItemTuple<TItem> | undefined;\r\n\r\n public abstract parseEntityClass(data: Readonly<TItem>): EntityClassProps;\r\n public abstract parseMixin(data: Readonly<TItem>): MixinProps;\r\n public abstract parseStructClass(data: Readonly<TItem>): StructClassProps;\r\n public abstract parseCustomAttributeClass(data: Readonly<TItem>): CustomAttributeClassProps;\r\n public abstract parseRelationshipClass(data: Readonly<TItem>): RelationshipClassProps;\r\n public abstract parseEnumeration(data: Readonly<TItem>): EnumerationProps;\r\n public abstract parseKindOfQuantity(data: Readonly<TItem>): KindOfQuantityProps;\r\n public abstract parsePropertyCategory(data: Readonly<TItem>): PropertyCategoryProps;\r\n public abstract parseUnit(data: Readonly<TItem>): SchemaItemUnitProps;\r\n public abstract parseInvertedUnit(data: Readonly<TItem>): InvertedUnitProps;\r\n public abstract parseConstant(data: Readonly<TItem>): ConstantProps;\r\n public abstract parsePhenomenon(data: Readonly<TItem>): PhenomenonProps;\r\n public abstract parseFormat(data: Readonly<TItem>): SchemaItemFormatProps;\r\n public abstract parseUnitSystem(data: Readonly<TItem>): UnitSystemProps;\r\n\r\n public abstract getProperties(data: Readonly<TItem>, itemName: string): Iterable<PropertyTuple<TProperty>>;\r\n public abstract parsePrimitiveProperty(data: Readonly<TProperty>): PrimitivePropertyProps;\r\n public abstract parseStructProperty(data: Readonly<TProperty>): StructPropertyProps;\r\n public abstract parsePrimitiveArrayProperty(data: Readonly<TProperty>): PrimitiveArrayPropertyProps;\r\n public abstract parseStructArrayProperty(data: Readonly<TProperty>): StructArrayPropertyProps;\r\n public abstract parseNavigationProperty(data: Readonly<TProperty>): NavigationPropertyProps;\r\n\r\n public abstract getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple>;\r\n public abstract getClassCustomAttributeProviders(data: Readonly<TItem>): Iterable<CAProviderTuple>;\r\n public abstract getPropertyCustomAttributeProviders(data: Readonly<TProperty>): Iterable<CAProviderTuple>;\r\n public abstract getRelationshipConstraintCustomAttributeProviders(data: Readonly<TItem>): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */];\r\n public abstract get getECSpecVersion(): ECSpecVersion | undefined;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/prefer-function-type\r\nexport interface AbstractParserConstructor<TSchema, TItem = any, TProperty = TItem> { new(obj: Readonly<TSchema>): AbstractParser<TItem, TProperty> }\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,SAAS,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;QAED,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,mCAAmC,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED;;;;OAIG;IACK,wBAAwB,CAAC,SAAyB,EAAE,WAAsC;QAChG,KAAK,MAAM,aAAa,IAAI,WAAW,EAAE,CAAC;YACxC,0CAA0C;YAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAyB,CAAC;YAElF,kEAAkE;YAClE,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;YACzC,SAAmC,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,oBAAoB,CAAC,aAA6B;QAC9D,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,CAAC,YAAY,KAAK,SAAS;YACpH,OAAO,KAAK,CAAC;QAEf,OAAO,CAAC,CAAC,aAAa,CAAC,WAAW,GAAG,eAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,KAAK,eAAM,CAAC,yBAAyB,IAAI,aAAa,CAAC,YAAY,GAAG,eAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAC/M,CAAC;CACF;AAniCD,4CAmiCC","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\nimport { SchemaContext } from \"../Context\";\nimport { parsePrimitiveType, parseSchemaItemType, SchemaItemType, SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { AnyClass, SchemaInfo, WithSchemaKey } from \"../Interfaces\";\nimport { ECClass, MutableClass, StructClass } from \"../Metadata/Class\";\nimport { Constant } from \"../Metadata/Constant\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { EntityClass, MutableEntityClass } from \"../Metadata/EntityClass\";\nimport { Format } from \"../Metadata/Format\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\nimport { KindOfQuantity } from \"../Metadata/KindOfQuantity\";\nimport { Mixin } from \"../Metadata/Mixin\";\nimport { MutableProperty, Property } from \"../Metadata/Property\";\nimport { MutableRelationshipConstraint, RelationshipClass, RelationshipConstraint } from \"../Metadata/RelationshipClass\";\nimport { MutableSchema, Schema } from \"../Metadata/Schema\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\nimport { getItemNamesFromFormatString } from \"@itwin/core-quantity\";\nimport { AbstractParser, AbstractParserConstructor, CAProviderTuple } from \"./AbstractParser\";\nimport { ClassProps, PropertyProps, RelationshipConstraintProps, SchemaReferenceProps } from \"./JsonProps\";\nimport { SchemaGraph } from \"../utils/SchemaGraph\";\n\ntype AnyCAContainer = Schema | ECClass | Property | RelationshipConstraint;\ntype AnyMutableCAContainer = MutableSchema | MutableClass | MutableProperty | MutableRelationshipConstraint;\n\n/**\n * Specifies the version specification for the schema\n * @internal\n */\nexport interface ECSpecVersion {\n readVersion: number;\n writeVersion: number;\n}\n\n/**\n * This class properly handles the order the deserialization of ECSchemas and SchemaItems from serialized formats.\n * For example, when deserializing an ECClass most times all base class should be de-serialized before the given class.\n * @internal\n */\nexport class SchemaReadHelper<T = unknown> {\n private _context: SchemaContext;\n private _visitorHelper?: SchemaPartVisitorDelegate;\n private _parserType: AbstractParserConstructor<T, unknown>;\n private _parser!: AbstractParser<unknown>;\n\n // Cache of the schema currently being loaded. This schema is in the _context but to\n // avoid going back to the context every time, the cache is used.\n private _schema?: Schema;\n private _schemaInfo?: SchemaInfo;\n\n constructor(parserType: AbstractParserConstructor<T>, context?: SchemaContext, visitor?: ISchemaPartVisitor) {\n this._context = (undefined !== context) ? context : new SchemaContext();\n this._visitorHelper = visitor ? new SchemaPartVisitorDelegate(visitor) : undefined;\n this._parserType = parserType;\n }\n\n /**\n * Creates a complete SchemaInfo and starts parsing the schema from a serialized representation.\n * The info and schema promise will be registered with the SchemaContext. The complete schema can be retrieved by\n * calling getCachedSchema on the context.\n * @param schema The Schema to populate\n * @param rawSchema The serialized data to use to populate the Schema.\n * @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.\n * The default is true. If false, the schema loading will not begin asynchronously in the background because the\n * schema promise must be added to the context. In this case, only the SchemaInfo is returned.\n */\n public async readSchemaInfo(schema: Schema, rawSchema: T, addSchemaToCache: boolean = true): Promise<SchemaInfo> {\n // Ensure context matches schema context\n if (schema.context) {\n if (this._context !== schema.context)\n throw new ECSchemaError(ECSchemaStatus.DifferentSchemaContexts, \"The SchemaContext of the schema must be the same SchemaContext held by the SchemaReadHelper.\");\n } else {\n (schema as MutableSchema).setContext(this._context);\n }\n\n this._parser = new this._parserType(rawSchema);\n\n // Loads all of the properties on the Schema object\n await schema.fromJSON(this._parser.parseSchema());\n\n this._schema = schema;\n\n const schemaReferences: WithSchemaKey[] = [];\n const schemaInfo: SchemaInfo = { schemaKey: schema.schemaKey, alias: schema.alias, references: schemaReferences };\n for (const reference of this._parser.getReferences()) {\n const refKey = new SchemaKey(reference.name, ECVersion.fromString(reference.version));\n schemaReferences.push({ schemaKey: refKey });\n }\n\n this._schemaInfo = schemaInfo;\n\n // Need to add this schema to the context to be able to locate schemaItems within the context.\n if (addSchemaToCache && !this._context.schemaExists(schema.schemaKey)) {\n await this._context.addSchemaPromise(schemaInfo, schema, this.loadSchema(schemaInfo, schema));\n }\n return schemaInfo;\n }\n\n /**\n * Populates the given Schema from a serialized representation.\n * @param schema The Schema to populate\n * @param rawSchema The serialized data to use to populate the Schema.\n * @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.\n * The default is true. If false, the schema will be loaded directly by this method and not from the context's schema cache.\n */\n public async readSchema(schema: Schema, rawSchema: T, addSchemaToCache: boolean = true): Promise<Schema> {\n if (!this._schemaInfo) {\n await this.readSchemaInfo(schema, rawSchema, addSchemaToCache);\n }\n\n // If not adding schema to cache (occurs in readSchemaInfo), we must load the schema here\n if (!addSchemaToCache) {\n const loadedSchema = await this.loadSchema(this._schemaInfo!, schema);\n if (undefined === loadedSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);\n\n return loadedSchema;\n }\n\n const cachedSchema = await this._context.getCachedSchema(this._schemaInfo!.schemaKey, SchemaMatchType.Latest);\n if (undefined === cachedSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);\n\n return cachedSchema;\n }\n\n /**\n * Called when a SchemaItem has been successfully loaded by the Helper. The default implementation simply\n * checks if the schema item is undefined. An implementation of the helper may choose to partially load\n * a schema item in which case this method would indicate if the item has been fully loaded.\n * @param schemaItem The SchemaItem to check.\n * @returns True if the SchemaItem has been fully loaded, false otherwise.\n */\n protected isSchemaItemLoaded(schemaItem: SchemaItem | undefined): boolean {\n return schemaItem !== undefined;\n }\n\n /* Finish loading the rest of the schema */\n private async loadSchema(schemaInfo: SchemaInfo, schema: Schema): Promise<Schema> {\n // Verify that there are no schema reference cycles, this will start schema loading by loading their headers\n (await SchemaGraph.generateGraph(schemaInfo, this._context)).throwIfCycles();\n\n for (const reference of schemaInfo.references) {\n await this.loadSchemaReference(schema, reference.schemaKey);\n }\n\n if (this._visitorHelper)\n await this._visitorHelper.visitSchema(schema, false);\n\n // Load all schema items\n for (const [itemName, itemType, rawItem] of this._parser.getItems()) {\n // Make sure the item has not already been loaded. No need to check the SchemaContext because all SchemaItems are added to a Schema,\n // which would be found when adding to the context.\n const schemaItem = await schema.getItem(itemName);\n if (this.isSchemaItemLoaded(schemaItem))\n continue;\n\n const loadedItem = await this.loadSchemaItem(schema, itemName, itemType, rawItem);\n if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {\n await this._visitorHelper.visitSchemaPart(loadedItem!);\n }\n }\n\n await this.loadCustomAttributes(schema, this._parser.getSchemaCustomAttributeProviders());\n\n if (this._visitorHelper)\n await this._visitorHelper.visitSchema(schema);\n\n return schema;\n }\n\n /**\n * Populates the given Schema from a serialized representation.\n * @param schema The Schema to populate\n * @param rawSchema The serialized data to use to populate the Schema.\n */\n public readSchemaSync(schema: Schema, rawSchema: T): Schema {\n this._parser = new this._parserType(rawSchema);\n\n // Loads all of the properties on the Schema object\n schema.fromJSONSync(this._parser.parseSchema());\n\n this._schema = schema;\n\n // Need to add this schema to the context to be able to locate schemaItems within the context.\n if (!this._context.schemaExists(schema.schemaKey))\n this._context.addSchemaSync(schema);\n\n // Load schema references first\n // Need to figure out if other schemas are present.\n for (const reference of this._parser.getReferences()) {\n this.loadSchemaReferenceSync(reference);\n }\n\n if (this._visitorHelper)\n this._visitorHelper.visitSchemaSync(schema, false);\n\n // Load all schema items\n for (const [itemName, itemType, rawItem] of this._parser.getItems()) {\n const loadedItem = this.loadSchemaItemSync(schema, itemName, itemType, rawItem);\n if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {\n this._visitorHelper.visitSchemaPartSync(loadedItem!);\n }\n }\n\n this.loadCustomAttributesSync(schema, this._parser.getSchemaCustomAttributeProviders());\n\n if (this._visitorHelper)\n this._visitorHelper.visitSchemaSync(schema);\n\n return schema;\n }\n\n /**\n * Ensures that the schema references can be located and adds them to the schema.\n * @param ref The object to read the SchemaReference's props from.\n */\n private async loadSchemaReference(schema: Schema, refKey: SchemaKey): Promise<Schema> {\n const refSchema = await this._context.getSchema(refKey, SchemaMatchType.LatestWriteCompatible);\n if (undefined === refSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${refKey.name}.${refKey.version.toString()}, of ${schema.schemaKey.name}`);\n\n if (schema.references.find((ref) => ref.schemaKey.matches(refSchema.schemaKey)))\n return refSchema;\n\n await (schema as MutableSchema).addReference(refSchema);\n const results = this.validateSchemaReferences(schema);\n\n let errorMessage: string = \"\";\n for (const result of results) {\n errorMessage += `${result}\\r\\n`;\n }\n\n if (errorMessage) {\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);\n }\n\n return refSchema;\n }\n\n /**\n * Ensures that the schema references can be located and adds them to the schema.\n * @param ref The object to read the SchemaReference's props from.\n */\n private loadSchemaReferenceSync(ref: SchemaReferenceProps): void {\n const schemaKey = new SchemaKey(ref.name, ECVersion.fromString(ref.version));\n const refSchema = this._context.getSchemaSync(schemaKey, SchemaMatchType.LatestWriteCompatible);\n if (!refSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${ref.name}.${ref.version}, of ${this._schema!.schemaKey.name}`);\n\n (this._schema as MutableSchema).addReferenceSync(refSchema);\n\n SchemaGraph.generateGraphSync(this._schema!).throwIfCycles();\n const results = this.validateSchemaReferences(this._schema!);\n\n let errorMessage: string = \"\";\n for (const result of results) {\n errorMessage += `${result}\\r\\n`;\n }\n\n if (errorMessage) {\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);\n }\n }\n\n /**\n * Validates schema references against multiple EC rules.\n * @param schema The schema to validate.\n */\n private *validateSchemaReferences(schema: Schema): Iterable<string> {\n const aliases = new Map();\n for (const schemaRef of schema.references) {\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\n yield `Referenced schema '${schemaRef.name}' of schema '${schema.name}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.`;\n\n if (schema.schemaKey.matches(schemaRef.schemaKey))\n yield `Schema '${schema.name}' has reference cycles: '${schema.name} --> ${schemaRef.name}'`;\n\n if (aliases.has(schemaRef.alias)) {\n const currentRef = aliases.get(schemaRef.alias);\n yield `Schema '${schema.name}' has multiple schema references (${currentRef.name}, $schemaRef.name}) with the same alias '${schemaRef.alias}', which is not allowed.`;\n } else {\n aliases.set(schemaRef.alias, schemaRef);\n }\n }\n }\n\n /**\n * Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.\n * @param schema The Schema the SchemaItem to.\n * @param name The name of the schema item to be loaded.\n * @param itemType The SchemaItemType of the item to load.\n * @param schemaItemObject The Object to populate the SchemaItem with.\n */\n protected async loadSchemaItem(schema: Schema, name: string, itemType: string, schemaItemObject?: Readonly<unknown>): Promise<SchemaItem | undefined> {\n let schemaItem = await schema.getItem(name);\n if (this.isSchemaItemLoaded(schemaItem)) {\n return schemaItem;\n }\n\n switch (parseSchemaItemType(itemType)) {\n case SchemaItemType.EntityClass:\n schemaItem = schemaItem || await (schema as MutableSchema).createEntityClass(name);\n schemaItemObject && await this.loadEntityClass(schemaItem as EntityClass, schemaItemObject);\n break;\n case SchemaItemType.StructClass:\n schemaItem = schemaItem || await (schema as MutableSchema).createStructClass(name);\n const structProps = schemaItemObject && this._parser.parseStructClass(schemaItemObject);\n structProps && await this.loadClass(schemaItem as StructClass, structProps, schemaItemObject);\n break;\n case SchemaItemType.Mixin:\n schemaItem = schemaItem || await (schema as MutableSchema).createMixinClass(name);\n schemaItemObject && await this.loadMixin(schemaItem as Mixin, schemaItemObject);\n break;\n case SchemaItemType.CustomAttributeClass:\n schemaItem = schemaItem || await (schema as MutableSchema).createCustomAttributeClass(name);\n const caClassProps = schemaItemObject && this._parser.parseCustomAttributeClass(schemaItemObject);\n caClassProps && await this.loadClass(schemaItem as CustomAttributeClass, caClassProps, schemaItemObject);\n break;\n case SchemaItemType.RelationshipClass:\n schemaItem = schemaItem || await (schema as MutableSchema).createRelationshipClass(name);\n schemaItemObject && await this.loadRelationshipClass(schemaItem as RelationshipClass, schemaItemObject);\n break;\n case SchemaItemType.KindOfQuantity:\n schemaItem = schemaItem || await (schema as MutableSchema).createKindOfQuantity(name);\n schemaItemObject && await this.loadKindOfQuantity(schemaItem as KindOfQuantity, schemaItemObject);\n break;\n case SchemaItemType.Unit:\n schemaItem = schemaItem || await (schema as MutableSchema).createUnit(name);\n schemaItemObject && await this.loadUnit(schemaItem as Unit, schemaItemObject);\n break;\n case SchemaItemType.Constant:\n schemaItem = schemaItem || await (schema as MutableSchema).createConstant(name);\n schemaItemObject && await this.loadConstant(schemaItem as Constant, schemaItemObject);\n break;\n case SchemaItemType.InvertedUnit:\n schemaItem = schemaItem || await (schema as MutableSchema).createInvertedUnit(name);\n schemaItemObject && await this.loadInvertedUnit(schemaItem as InvertedUnit, schemaItemObject);\n break;\n case SchemaItemType.Format:\n schemaItem = schemaItem || await (schema as MutableSchema).createFormat(name);\n schemaItemObject && await this.loadFormat(schemaItem as Format, schemaItemObject);\n break;\n case SchemaItemType.Phenomenon:\n schemaItem = schemaItem || await (schema as MutableSchema).createPhenomenon(name);\n const phenomenonProps = schemaItemObject && this._parser.parsePhenomenon(schemaItemObject);\n phenomenonProps && await schemaItem.fromJSON(phenomenonProps);\n break;\n case SchemaItemType.UnitSystem:\n schemaItem = schemaItem || await (schema as MutableSchema).createUnitSystem(name);\n schemaItemObject && await schemaItem.fromJSON(this._parser.parseUnitSystem(schemaItemObject));\n break;\n case SchemaItemType.PropertyCategory:\n schemaItem = schemaItem || await (schema as MutableSchema).createPropertyCategory(name);\n const propertyCategoryProps = schemaItemObject && this._parser.parsePropertyCategory(schemaItemObject);\n propertyCategoryProps && schemaItemObject && await schemaItem.fromJSON(propertyCategoryProps);\n break;\n case SchemaItemType.Enumeration:\n schemaItem = schemaItem || await (schema as MutableSchema).createEnumeration(name);\n const enumerationProps = schemaItemObject && this._parser.parseEnumeration(schemaItemObject);\n enumerationProps && await schemaItem.fromJSON(enumerationProps);\n break;\n // NOTE: we are being permissive here and allowing unknown types to silently fail. Not sure if we want to hard fail or just do a basic deserialization\n }\n return schemaItem;\n }\n\n /**\n * Load the customAttribute class dependencies for a set of CustomAttribute objects and add\n * them to a given custom attribute container.\n * @param container The CustomAttributeContainer that each CustomAttribute will be added to.\n * @param customAttributes An iterable set of parsed CustomAttribute objects.\n */\n protected async loadCustomAttributes(container: AnyCAContainer, caProviders: Iterable<CAProviderTuple>): Promise<void> {\n for (const providerTuple of caProviders) {\n // First tuple entry is the CA class name.\n const caClass = await this.findSchemaItem(providerTuple[0]);\n\n // If custom attribute exist within the context and is referenced, validate the reference is defined in the container's schema\n if (caClass && caClass.key.schemaName !== container.schema.name &&\n !container.schema.getReferenceSync(caClass.key.schemaName)) {\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to load custom attribute ${caClass.fullName} from container ${container.fullName}, ${caClass.key.schemaName} reference not defined`);\n }\n\n // Second tuple entry ia a function that provides the CA instance.\n const provider = providerTuple[1];\n const customAttribute = provider(caClass as CustomAttributeClass);\n\n (container as AnyMutableCAContainer).addCustomAttribute(customAttribute);\n }\n }\n\n /**\n * Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.\n * @param schema The Schema the SchemaItem to.\n * @param name The name of the schema item to be loaded.\n * @param itemType The SchemaItemType of the item to load.\n * @param schemaItemObject The Object to populate the SchemaItem with.\n */\n private loadSchemaItemSync(schema: Schema, name: string, itemType: string, schemaItemObject: Readonly<unknown>): SchemaItem | undefined {\n let schemaItem = schema.getItemSync(name);\n if (this.isSchemaItemLoaded(schemaItem)) {\n return schemaItem;\n }\n\n switch (parseSchemaItemType(itemType)) {\n case SchemaItemType.EntityClass:\n schemaItem = schemaItem || (schema as MutableSchema).createEntityClassSync(name);\n this.loadEntityClassSync(schemaItem as EntityClass, schemaItemObject);\n break;\n case SchemaItemType.StructClass:\n schemaItem = schemaItem || (schema as MutableSchema).createStructClassSync(name);\n const structProps = this._parser.parseStructClass(schemaItemObject);\n this.loadClassSync(schemaItem as StructClass, structProps, schemaItemObject);\n break;\n case SchemaItemType.Mixin:\n schemaItem = schemaItem || (schema as MutableSchema).createMixinClassSync(name);\n this.loadMixinSync(schemaItem as Mixin, schemaItemObject);\n break;\n case SchemaItemType.CustomAttributeClass:\n schemaItem = schemaItem || (schema as MutableSchema).createCustomAttributeClassSync(name);\n const caClassProps = this._parser.parseCustomAttributeClass(schemaItemObject);\n this.loadClassSync(schemaItem as CustomAttributeClass, caClassProps, schemaItemObject);\n break;\n case SchemaItemType.RelationshipClass:\n schemaItem = schemaItem || (schema as MutableSchema).createRelationshipClassSync(name);\n this.loadRelationshipClassSync(schemaItem as RelationshipClass, schemaItemObject);\n break;\n case SchemaItemType.KindOfQuantity:\n schemaItem = schemaItem || (schema as MutableSchema).createKindOfQuantitySync(name);\n this.loadKindOfQuantitySync(schemaItem as KindOfQuantity, schemaItemObject);\n break;\n case SchemaItemType.Unit:\n schemaItem = schemaItem || (schema as MutableSchema).createUnitSync(name);\n this.loadUnitSync(schemaItem as Unit, schemaItemObject);\n break;\n case SchemaItemType.Constant:\n schemaItem = schemaItem || (schema as MutableSchema).createConstantSync(name);\n this.loadConstantSync(schemaItem as Constant, schemaItemObject);\n break;\n case SchemaItemType.InvertedUnit:\n schemaItem = schemaItem || (schema as MutableSchema).createInvertedUnitSync(name);\n this.loadInvertedUnitSync(schemaItem as InvertedUnit, schemaItemObject);\n break;\n case SchemaItemType.Format:\n schemaItem = schemaItem || (schema as MutableSchema).createFormatSync(name);\n this.loadFormatSync(schemaItem as Format, schemaItemObject);\n break;\n case SchemaItemType.Phenomenon:\n schemaItem = schemaItem || (schema as MutableSchema).createPhenomenonSync(name);\n const phenomenonProps = this._parser.parsePhenomenon(schemaItemObject);\n schemaItem.fromJSONSync(phenomenonProps);\n break;\n case SchemaItemType.UnitSystem:\n schemaItem = schemaItem || (schema as MutableSchema).createUnitSystemSync(name);\n schemaItem.fromJSONSync(this._parser.parseUnitSystem(schemaItemObject));\n break;\n case SchemaItemType.PropertyCategory:\n schemaItem = schemaItem || (schema as MutableSchema).createPropertyCategorySync(name);\n const propertyCategoryProps = this._parser.parsePropertyCategory(schemaItemObject);\n schemaItem.fromJSONSync(propertyCategoryProps);\n break;\n case SchemaItemType.Enumeration:\n schemaItem = schemaItem || (schema as MutableSchema).createEnumerationSync(name);\n const enumerationProps = this._parser.parseEnumeration(schemaItemObject);\n schemaItem.fromJSONSync(enumerationProps);\n break;\n // NOTE: we are being permissive here and allowing unknown types to silently fail. Not sure if we want to hard fail or just do a basic deserialization\n }\n return schemaItem;\n }\n\n /**\n * Given the full (Schema.ItemName) or qualified (alias:ItemName) item name, returns\n * a tuple of strings in the format [\"SchemaName\", \"ItemName\"]. The schema name may be\n * empty if the item comes from the schema being parsed.\n * @param fullOrQualifiedName The full or qualified name of the schema item.\n * @param schema The schema that will be used to lookup the schema name by alias, if necessary.\n */\n private static resolveSchemaAndItemName(fullOrQualifiedName: string, schema?: Schema): [string, string] {\n const [schemaName, itemName] = SchemaItem.parseFullName(fullOrQualifiedName);\n\n // If a schema is provided we attempt to resolve the alias by looking at the reference schemas.\n if (undefined !== schema && -1 !== fullOrQualifiedName.indexOf(\":\")) {\n const refName = schema.getReferenceNameByAlias(schemaName);\n if (undefined === refName)\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not resolve schema alias '${schemaName}' for schema item '${itemName}.`);\n return [refName, itemName];\n }\n\n return [schemaName, itemName];\n }\n\n /**\n * Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does\n * not exist within the schema, the SchemaContext will be searched.\n * @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.\n * @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.\n * @param loadCallBack Only called if the SchemaItem had to be loaded.\n * @return The SchemaItem if it had to be loaded, otherwise undefined.\n */\n private async findSchemaItem(name: string, skipVisitor = false, loadCallBack?: (item: SchemaItem) => void): Promise<SchemaItem | undefined> {\n let schemaItem: SchemaItem | undefined;\n // TODO: A better solution should be investigated for handling both an alias and the schema name.\n const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);\n const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());\n\n if (undefined === schemaName || 0 === schemaName.length)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);\n\n if (isInThisSchema) {\n schemaItem = await this._schema!.getItem(itemName);\n if (schemaItem)\n return schemaItem;\n\n const foundItem = this._parser.findItem(itemName);\n if (foundItem) {\n schemaItem = await this.loadSchemaItem(this._schema!, ...foundItem);\n if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {\n await this._visitorHelper.visitSchemaPart(schemaItem!);\n }\n if (loadCallBack && schemaItem)\n loadCallBack(schemaItem);\n\n return schemaItem;\n }\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\n }\n\n schemaItem = await this._context.getSchemaItem(new SchemaItemKey(itemName, new SchemaKey(schemaName)));\n if (undefined === schemaItem)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\n\n return schemaItem;\n }\n\n /**\n * Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does\n * not exist within the schema, the SchemaContext will be searched.\n * @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.\n * @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.\n * @param loadCallBack Only called if the SchemaItem had to be loaded.\n * @return The SchemaItem if it had to be loaded, otherwise undefined.\n */\n private findSchemaItemSync(name: string, skipVisitor = false, loadCallBack?: (item: SchemaItem) => void): SchemaItem | undefined {\n let schemaItem: SchemaItem | undefined;\n // TODO: A better solution should be investigated for handling both an alias and the schema name.\n const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);\n const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());\n\n if (undefined === schemaName || schemaName.length === 0)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);\n\n if (isInThisSchema && undefined === this._schema!.getItemSync(itemName)) {\n const foundItem = this._parser.findItem(itemName);\n if (foundItem) {\n schemaItem = this.loadSchemaItemSync(this._schema!, ...foundItem);\n if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {\n this._visitorHelper.visitSchemaPartSync(schemaItem!);\n }\n if (loadCallBack && schemaItem)\n loadCallBack(schemaItem);\n\n return schemaItem;\n }\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\n }\n\n schemaItem = this._context.getSchemaItemSync(new SchemaItemKey(itemName, new SchemaKey(schemaName)));\n if (undefined === schemaItem)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\n\n return schemaItem;\n }\n\n /**\n * Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.\n * @param unit The Unit object that we are loading dependencies for and \"deserializing into\".\n * @param rawUnit The serialized unit data\n */\n private async loadUnit(unit: Unit, rawUnit: Readonly<unknown>): Promise<void> {\n const unitProps = this._parser.parseUnit(rawUnit);\n\n await this.findSchemaItem(unitProps.phenomenon, true);\n await this.findSchemaItem(unitProps.unitSystem, true);\n\n await unit.fromJSON(unitProps);\n }\n\n /**\n * Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.\n * @param unit The Unit object that we are loading dependencies for and \"deserializing into\".\n * @param rawUnit The serialized unit data\n */\n private loadUnitSync(unit: Unit, rawUnit: Readonly<unknown>) {\n const unitProps = this._parser.parseUnit(rawUnit);\n\n this.findSchemaItemSync(unitProps.phenomenon, true);\n this.findSchemaItemSync(unitProps.unitSystem, true);\n\n unit.fromJSONSync(unitProps);\n }\n\n /**\n * Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.\n * @param koq The KindOfQuantity object that we are loading dependencies for and \"deserializing into\".\n * @param rawKoQ The serialized kind of quantity data\n */\n private async loadKindOfQuantity(koq: KindOfQuantity, rawKoQ: Readonly<unknown>): Promise<void> {\n const koqProps = this._parser.parseKindOfQuantity(rawKoQ);\n await this.findSchemaItem(koqProps.persistenceUnit);\n\n if (undefined !== koqProps.presentationUnits) {\n for (const formatString of koqProps.presentationUnits) {\n for (const name of getItemNamesFromFormatString(formatString)) {\n await this.findSchemaItem(name);\n }\n }\n }\n\n await koq.fromJSON(koqProps);\n }\n\n /**\n * Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.\n * @param koq The KindOfQuantity object that we are loading dependencies for and \"deserializing into\".\n * @param rawKoQ The serialized kind of quantity data\n */\n private loadKindOfQuantitySync(koq: KindOfQuantity, rawKoQ: Readonly<unknown>) {\n const koqProps = this._parser.parseKindOfQuantity(rawKoQ);\n this.findSchemaItemSync(koqProps.persistenceUnit);\n\n if (undefined !== koqProps.presentationUnits) {\n for (const formatString of koqProps.presentationUnits) {\n for (const name of getItemNamesFromFormatString(formatString)) {\n this.findSchemaItemSync(name);\n }\n }\n }\n koq.fromJSONSync(koqProps);\n }\n\n /**\n * Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.\n * @param constant The Constant object that we are loading the phenomenon dependency for\n * @param rawConstant The serialized constant data\n */\n private async loadConstant(constant: Constant, rawConstant: Readonly<unknown>): Promise<void> {\n const constantProps = this._parser.parseConstant(rawConstant);\n\n await this.findSchemaItem(constantProps.phenomenon, true);\n await constant.fromJSON(constantProps);\n }\n\n /**\n * Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.\n * @param constant The Constant object that we are loading dependencies for and \"deserializing into\".\n * @param rawConstant The serialized constant data\n */\n private loadConstantSync(constant: Constant, rawConstant: Readonly<unknown>) {\n const constantProps = this._parser.parseConstant(rawConstant);\n\n this.findSchemaItemSync(constantProps.phenomenon, true);\n constant.fromJSONSync(constantProps);\n }\n\n /**\n * Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.\n * @param invertedUnit The InvertedUnit object that we are loading dependencies for and \"deserializing into\".\n * @param rawInvertedUnit The serialized inverted unit data.\n */\n private async loadInvertedUnit(invertedUnit: InvertedUnit, rawInvertedUnit: Readonly<unknown>): Promise<void> {\n const invertedUnitProps = this._parser.parseInvertedUnit(rawInvertedUnit);\n\n await this.findSchemaItem(invertedUnitProps.invertsUnit, true);\n await this.findSchemaItem(invertedUnitProps.unitSystem, true);\n\n await invertedUnit.fromJSON(invertedUnitProps);\n }\n\n /**\n * Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.\n * @param invertedUnit The InvertedUnit object that we are loading dependencies for and \"deserializing into\".\n * @param rawInvertedUnit The serialized inverted unit data.\n */\n private loadInvertedUnitSync(invertedUnit: InvertedUnit, rawInvertedUnit: Readonly<unknown>) {\n const invertedUnitProps = this._parser.parseInvertedUnit(rawInvertedUnit);\n\n this.findSchemaItemSync(invertedUnitProps.invertsUnit, true);\n this.findSchemaItemSync(invertedUnitProps.unitSystem, true);\n\n invertedUnit.fromJSONSync(invertedUnitProps);\n }\n\n /**\n * Load the unit dependencies for a Format object and load the Format from its serialized format.\n * @param format The Format object that we are loading dependencies for and \"deserializing into\".\n * @param rawFormat The serialized format data.\n */\n private async loadFormat(format: Format, rawFormat: Readonly<unknown>): Promise<void> {\n const formatProps = this._parser.parseFormat(rawFormat);\n\n if (undefined !== formatProps.composite) {\n const formatUnits = formatProps.composite.units;\n for (const unit of formatUnits) {\n await this.findSchemaItem(unit.name, true);\n }\n }\n await format.fromJSON(formatProps);\n }\n\n /**\n * Load the unit dependencies for a Format object and load the Format from its serialized format.\n * @param format The Format object that we are loading dependencies for and \"deserializing into\".\n * @param rawFormat The serialized format data.\n */\n private loadFormatSync(format: Format, rawFormat: Readonly<unknown>) {\n const formatProps = this._parser.parseFormat(rawFormat);\n\n if (undefined !== formatProps.composite) {\n const formatUnits = formatProps.composite.units;\n for (const unit of formatUnits) {\n this.findSchemaItemSync(unit.name, true);\n }\n }\n\n format.fromJSONSync(formatProps);\n }\n\n /**\n * Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.\n * @param classObj The ECClass object that we are loading dependencies for and \"deserializing into\".\n * @param classProps The parsed class props object.\n * @param rawClass The serialized class data.\n */\n private async loadClass(classObj: AnyClass, classProps: ClassProps, rawClass: Readonly<unknown>): Promise<void> {\n const baseClassLoaded = async (baseClass: SchemaItem) => {\n if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))\n await this._visitorHelper.visitSchemaPart(baseClass);\n };\n\n // Load base class first\n if (undefined !== classProps.baseClass) {\n await this.findSchemaItem(classProps.baseClass, true, baseClassLoaded);\n }\n\n // Now deserialize the class itself, *before* any properties\n // (We need to do this to break Entity -navProp-> Relationship -constraint-> Entity cycle.)\n await (classObj as ECClass).fromJSON(classProps);\n\n for (const [propName, propType, rawProp] of this._parser.getProperties(rawClass, classObj.fullName)) {\n await this.loadPropertyTypes(classObj, propName, propType, rawProp);\n }\n\n await this.loadCustomAttributes(classObj, this._parser.getClassCustomAttributeProviders(rawClass));\n }\n\n /**\n * Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.\n * @param classObj The ECClass object that we are loading dependencies for and \"deserializing into\".\n * @param classProps The parsed class props object.\n * @param rawClass The serialized class data.\n */\n private loadClassSync(classObj: AnyClass, classProps: ClassProps, rawClass: Readonly<unknown>): void {\n const baseClassLoaded = async (baseClass: SchemaItem) => {\n if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))\n this._visitorHelper.visitSchemaPartSync(baseClass);\n };\n\n // Load base class first\n if (undefined !== classProps.baseClass) {\n this.findSchemaItemSync(classProps.baseClass, true, baseClassLoaded);\n }\n\n // Now deserialize the class itself, *before* any properties\n // (We need to do this to break Entity -navProp-> Relationship -constraint-> Entity cycle.)\n (classObj as ECClass).fromJSONSync(classProps);\n\n for (const [propName, propType, rawProp] of this._parser.getProperties(rawClass, classObj.fullName)) {\n this.loadPropertyTypesSync(classObj, propName, propType, rawProp);\n }\n\n this.loadCustomAttributesSync(classObj, this._parser.getClassCustomAttributeProviders(rawClass));\n }\n\n /**\n * Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.\n * @param entity The EntityClass that we are loading dependencies for and \"deserializing into\".\n * @param rawEntity The serialized entity class data.\n */\n private async loadEntityClass(entity: EntityClass, rawEntity: Readonly<unknown>): Promise<void> {\n const entityClassProps = this._parser.parseEntityClass(rawEntity);\n\n // Load Mixin classes first\n if (undefined !== entityClassProps.mixins) {\n for (const mixinName of entityClassProps.mixins)\n await this.findSchemaItem(mixinName);\n }\n\n await this.loadClass(entity, entityClassProps, rawEntity);\n }\n\n /**\n * Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.\n * @param entity The EntityClass that we are loading dependencies for and \"deserializing into\".\n * @param rawEntity The serialized entity class data.\n */\n private loadEntityClassSync(entity: EntityClass, rawEntity: Readonly<unknown>): void {\n const entityClassProps = this._parser.parseEntityClass(rawEntity);\n\n // Load Mixin classes first\n if (undefined !== entityClassProps.mixins) {\n for (const mixinName of entityClassProps.mixins)\n this.findSchemaItemSync(mixinName);\n }\n\n this.loadClassSync(entity, entityClassProps, rawEntity);\n }\n\n /**\n * Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.\n * @param mixin The Mixin that we are loading dependencies for and \"deserializing into\".\n * @param rawMixin The serialized mixin data.\n */\n private async loadMixin(mixin: Mixin, rawMixin: Readonly<unknown>): Promise<void> {\n const mixinProps = this._parser.parseMixin(rawMixin);\n\n const appliesToLoaded = async (appliesToClass: SchemaItem) => {\n if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))\n await this._visitorHelper.visitSchemaPart(appliesToClass);\n };\n\n await this.findSchemaItem(mixinProps.appliesTo, true, appliesToLoaded);\n\n await this.loadClass(mixin, mixinProps, rawMixin);\n }\n\n /**\n * Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.\n * @param mixin The Mixin that we are loading dependencies for and \"deserializing into\".\n * @param rawMixin The serialized mixin data.\n */\n private loadMixinSync(mixin: Mixin, rawMixin: Readonly<unknown>): void {\n const mixinProps = this._parser.parseMixin(rawMixin);\n\n const appliesToLoaded = async (appliesToClass: SchemaItem) => {\n if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))\n await this._visitorHelper.visitSchemaPart(appliesToClass);\n };\n\n this.findSchemaItemSync(mixinProps.appliesTo, true, appliesToLoaded);\n\n this.loadClassSync(mixin, mixinProps, rawMixin);\n }\n\n /**\n * Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.\n * @param rel The RelationshipClass that we are loading dependencies for and \"deserializing into\".\n * @param rawRel The serialized relationship class data.\n */\n private async loadRelationshipClass(rel: RelationshipClass, rawRel: Readonly<unknown>): Promise<void> {\n const relationshipClassProps = this._parser.parseRelationshipClass(rawRel);\n await this.loadClass(rel, relationshipClassProps, rawRel);\n await this.loadRelationshipConstraint(rel.source, relationshipClassProps.source);\n await this.loadRelationshipConstraint(rel.target, relationshipClassProps.target);\n\n const [sourceCustomAttributes, targetCustomAttributes] = this._parser.getRelationshipConstraintCustomAttributeProviders(rawRel);\n await this.loadCustomAttributes(rel.source, sourceCustomAttributes);\n await this.loadCustomAttributes(rel.target, targetCustomAttributes);\n }\n\n /**\n * Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.\n * @param rel The RelationshipClass that we are loading dependencies for and \"deserializing into\".\n * @param rawRel The serialized relationship class data.\n */\n private loadRelationshipClassSync(rel: RelationshipClass, rawRel: Readonly<unknown>): void {\n const relationshipClassProps = this._parser.parseRelationshipClass(rawRel);\n this.loadClassSync(rel, relationshipClassProps, rawRel);\n this.loadRelationshipConstraintSync(rel.source, relationshipClassProps.source);\n this.loadRelationshipConstraintSync(rel.target, relationshipClassProps.target);\n\n const [sourceCustomAttributes, targetCustomAttributes] = this._parser.getRelationshipConstraintCustomAttributeProviders(rawRel);\n this.loadCustomAttributesSync(rel.source, sourceCustomAttributes);\n this.loadCustomAttributesSync(rel.target, targetCustomAttributes);\n }\n\n /**\n * Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.\n * @param relConstraint The RelationshipConstraint that we are loading dependencies for and \"deserializing into\".\n * @param props The parsed relationship constraint props.\n */\n private async loadRelationshipConstraint(relConstraint: RelationshipConstraint, props: RelationshipConstraintProps): Promise<void> {\n if (undefined !== props.abstractConstraint) {\n await this.findSchemaItem(props.abstractConstraint);\n }\n if (undefined !== props.constraintClasses) { // TODO: this should be required\n for (const constraintClass of props.constraintClasses) {\n await this.findSchemaItem(constraintClass);\n }\n }\n await relConstraint.fromJSON(props);\n }\n\n /**\n * Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.\n * @param relConstraint The RelationshipConstraint that we are loading dependencies for and \"deserializing into\".\n * @param props The parsed relationship constraint props.\n */\n private loadRelationshipConstraintSync(relConstraint: RelationshipConstraint, props: RelationshipConstraintProps): void {\n if (undefined !== props.abstractConstraint) {\n this.findSchemaItemSync(props.abstractConstraint);\n }\n if (undefined !== props.constraintClasses) {\n for (const constraintClass of props.constraintClasses) {\n this.findSchemaItemSync(constraintClass);\n }\n }\n\n relConstraint.fromJSONSync(props);\n }\n\n /**\n * Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.\n * @param classObj The ECClass that the Property should be created in.\n * @param propName The name of the Property.\n * @param propType The (serialized string) kind of property to create.\n * @param rawProperty The serialized property data.\n */\n private async loadPropertyTypes(classObj: AnyClass, propName: string, propType: string, rawProperty: Readonly<unknown>): Promise<void> {\n\n const loadTypeName = async (typeName: string): Promise<ECSchemaStatus> => {\n if (undefined === parsePrimitiveType(typeName)) {\n if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))\n return ECSchemaStatus.NewerECSpecVersion;\n await this.findSchemaItem(typeName);\n }\n return ECSchemaStatus.Success;\n };\n\n const lowerCasePropType = propType.toLowerCase();\n\n switch (lowerCasePropType) {\n case \"primitiveproperty\":\n const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);\n if (await loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\n (primPropertyProps as any).typeName = \"string\";\n const primProp = await (classObj as MutableClass).createPrimitiveProperty(propName, primPropertyProps.typeName);\n return this.loadProperty(primProp, primPropertyProps, rawProperty);\n\n case \"structproperty\":\n const structPropertyProps = this._parser.parseStructProperty(rawProperty);\n await loadTypeName(structPropertyProps.typeName);\n const structProp = await (classObj as MutableClass).createStructProperty(propName, structPropertyProps.typeName);\n return this.loadProperty(structProp, structPropertyProps, rawProperty);\n\n case \"primitivearrayproperty\":\n const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);\n if (await loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\n (primArrPropertyProps as any).typeName = \"string\";\n const primArrProp = await (classObj as MutableClass).createPrimitiveArrayProperty(propName, primArrPropertyProps.typeName);\n return this.loadProperty(primArrProp, primArrPropertyProps, rawProperty);\n\n case \"structarrayproperty\":\n const structArrPropertyProps = this._parser.parseStructArrayProperty(rawProperty);\n await loadTypeName(structArrPropertyProps.typeName);\n const structArrProp = await (classObj as MutableClass).createStructArrayProperty(propName, structArrPropertyProps.typeName);\n return this.loadProperty(structArrProp, structArrPropertyProps, rawProperty);\n\n case \"navigationproperty\":\n if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);\n\n const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);\n await this.findSchemaItem(navPropertyProps.relationshipName);\n const navProp = await (classObj as MutableEntityClass).createNavigationProperty(propName, navPropertyProps.relationshipName, navPropertyProps.direction);\n return this.loadProperty(navProp, navPropertyProps, rawProperty);\n }\n }\n\n /**\n * Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.\n * @param classObj The ECClass that the Property should be created in.\n * @param propName The name of the Property.\n * @param propType The (serialized string) kind of property to create.\n * @param rawProperty The serialized property data.\n */\n private loadPropertyTypesSync(classObj: AnyClass, propName: string, propType: string, rawProperty: Readonly<unknown>): void {\n const loadTypeName = (typeName: string): ECSchemaStatus => {\n if (undefined === parsePrimitiveType(typeName)) {\n if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))\n return ECSchemaStatus.NewerECSpecVersion;\n this.findSchemaItemSync(typeName);\n }\n return ECSchemaStatus.Success;\n };\n\n const lowerCasePropType = propType.toLowerCase();\n\n switch (lowerCasePropType) {\n case \"primitiveproperty\":\n const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);\n if (loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\n (primPropertyProps as any).typeName = \"string\";\n const primProp = (classObj as MutableClass).createPrimitivePropertySync(propName, primPropertyProps.typeName);\n return this.loadPropertySync(primProp, primPropertyProps, rawProperty);\n\n case \"structproperty\":\n const structPropertyProps = this._parser.parseStructProperty(rawProperty);\n loadTypeName(structPropertyProps.typeName);\n const structProp = (classObj as MutableClass).createStructPropertySync(propName, structPropertyProps.typeName);\n return this.loadPropertySync(structProp, structPropertyProps, rawProperty);\n\n case \"primitivearrayproperty\":\n const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);\n if (loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\n (primArrPropertyProps as any).typeName = \"string\";\n const primArrProp = (classObj as MutableClass).createPrimitiveArrayPropertySync(propName, primArrPropertyProps.typeName);\n return this.loadPropertySync(primArrProp, primArrPropertyProps, rawProperty);\n\n case \"structarrayproperty\":\n const structArrPropertyProps = this._parser.parseStructArrayProperty(rawProperty);\n loadTypeName(structArrPropertyProps.typeName);\n const structArrProp = (classObj as MutableClass).createStructArrayPropertySync(propName, structArrPropertyProps.typeName);\n return this.loadPropertySync(structArrProp, structArrPropertyProps, rawProperty);\n\n case \"navigationproperty\":\n if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);\n\n const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);\n this.findSchemaItemSync(navPropertyProps.relationshipName);\n const navProp = (classObj as MutableEntityClass).createNavigationPropertySync(propName, navPropertyProps.relationshipName, navPropertyProps.direction);\n return this.loadPropertySync(navProp, navPropertyProps, rawProperty);\n }\n }\n\n /**\n * Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.\n * @param propertyObj The Property that we are loading dependencies for and \"deserializing into\".\n * @param props The parsed property props.\n * @param rawProperty The serialized property data.\n */\n private async loadProperty<U extends Property>(propertyObj: U, props: PropertyProps, rawProperty: Readonly<unknown>): Promise<void> {\n if (undefined !== props.category) {\n await this.findSchemaItem(props.category);\n }\n\n if (undefined !== props.kindOfQuantity) {\n await this.findSchemaItem(props.kindOfQuantity);\n }\n\n await propertyObj.fromJSON(props);\n await this.loadCustomAttributes(propertyObj, this._parser.getPropertyCustomAttributeProviders(rawProperty));\n }\n\n /**\n * Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.\n * @param propertyObj The Property that we are loading dependencies for and \"deserializing into\".\n * @param props The parsed property props.\n * @param rawProperty The serialized property data.\n */\n private loadPropertySync<U extends Property>(propertyObj: U, props: PropertyProps, rawProperty: Readonly<unknown>): void {\n if (undefined !== props.category) {\n this.findSchemaItemSync(props.category);\n }\n\n if (undefined !== props.kindOfQuantity) {\n this.findSchemaItemSync(props.kindOfQuantity);\n }\n\n propertyObj.fromJSONSync(props);\n this.loadCustomAttributesSync(propertyObj, this._parser.getPropertyCustomAttributeProviders(rawProperty));\n }\n\n /**\n * Load the customAttribute class dependencies for a set of CustomAttribute objects and add them to a given custom attribute container.\n * @param container The CustomAttributeContainer that each CustomAttribute will be added to.\n * @param customAttributes An iterable set of parsed CustomAttribute objects.\n */\n private loadCustomAttributesSync(container: AnyCAContainer, caProviders: Iterable<CAProviderTuple>): void {\n for (const providerTuple of caProviders) {\n // First tuple entry is the CA class name.\n const caClass = this.findSchemaItemSync(providerTuple[0]) as CustomAttributeClass;\n\n // Second tuple entry ia a function that provides the CA instance.\n const provider = providerTuple[1];\n const customAttribute = provider(caClass);\n (container as AnyMutableCAContainer).addCustomAttribute(customAttribute);\n }\n }\n\n public static isECSpecVersionNewer(ecSpecVersion?: ECSpecVersion): boolean {\n if (ecSpecVersion === undefined || ecSpecVersion.readVersion === undefined || ecSpecVersion.writeVersion === undefined)\n return false;\n\n return ((ecSpecVersion.readVersion > Schema.currentECSpecMajorVersion) || (ecSpecVersion.readVersion === Schema.currentECSpecMajorVersion && ecSpecVersion.writeVersion > Schema.currentECSpecMinorVersion));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Helper.js","sourceRoot":"","sources":["../../../src/Deserialization/Helper.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,wCAA2C;AAC3C,4CAAwG;AACxG,4CAA6D;AA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CAAC,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;QAED,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,mCAAmC,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5G,CAAC;IAED;;;;OAIG;IACK,wBAAwB,CAAC,SAAyB,EAAE,WAAsC;QAChG,KAAK,MAAM,aAAa,IAAI,WAAW,EAAE,CAAC;YACxC,0CAA0C;YAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAyB,CAAC;YAElF,kEAAkE;YAClE,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;YACzC,SAAmC,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAEM,MAAM,CAAC,oBAAoB,CAAC,aAA6B;QAC9D,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,CAAC,YAAY,KAAK,SAAS;YACpH,OAAO,KAAK,CAAC;QAEf,OAAO,CAAC,CAAC,aAAa,CAAC,WAAW,GAAG,eAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,KAAK,eAAM,CAAC,yBAAyB,IAAI,aAAa,CAAC,YAAY,GAAG,eAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAC/M,CAAC;CACF;AAniCD,4CAmiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { SchemaContext } from \"../Context\";\r\nimport { parsePrimitiveType, parseSchemaItemType, SchemaItemType, SchemaMatchType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { AnyClass, SchemaInfo, WithSchemaKey } from \"../Interfaces\";\r\nimport { ECClass, MutableClass, StructClass } from \"../Metadata/Class\";\r\nimport { Constant } from \"../Metadata/Constant\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { EntityClass, MutableEntityClass } from \"../Metadata/EntityClass\";\r\nimport { Format } from \"../Metadata/Format\";\r\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\r\nimport { KindOfQuantity } from \"../Metadata/KindOfQuantity\";\r\nimport { Mixin } from \"../Metadata/Mixin\";\r\nimport { MutableProperty, Property } from \"../Metadata/Property\";\r\nimport { MutableRelationshipConstraint, RelationshipClass, RelationshipConstraint } from \"../Metadata/RelationshipClass\";\r\nimport { MutableSchema, Schema } from \"../Metadata/Schema\";\r\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\r\nimport { Unit } from \"../Metadata/Unit\";\r\nimport { ECVersion, SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\r\nimport { getItemNamesFromFormatString } from \"@itwin/core-quantity\";\r\nimport { AbstractParser, AbstractParserConstructor, CAProviderTuple } from \"./AbstractParser\";\r\nimport { ClassProps, PropertyProps, RelationshipConstraintProps, SchemaReferenceProps } from \"./JsonProps\";\r\nimport { SchemaGraph } from \"../utils/SchemaGraph\";\r\n\r\ntype AnyCAContainer = Schema | ECClass | Property | RelationshipConstraint;\r\ntype AnyMutableCAContainer = MutableSchema | MutableClass | MutableProperty | MutableRelationshipConstraint;\r\n\r\n/**\r\n * Specifies the version specification for the schema\r\n * @internal\r\n */\r\nexport interface ECSpecVersion {\r\n readVersion: number;\r\n writeVersion: number;\r\n}\r\n\r\n/**\r\n * This class properly handles the order the deserialization of ECSchemas and SchemaItems from serialized formats.\r\n * For example, when deserializing an ECClass most times all base class should be de-serialized before the given class.\r\n * @internal\r\n */\r\nexport class SchemaReadHelper<T = unknown> {\r\n private _context: SchemaContext;\r\n private _visitorHelper?: SchemaPartVisitorDelegate;\r\n private _parserType: AbstractParserConstructor<T, unknown>;\r\n private _parser!: AbstractParser<unknown>;\r\n\r\n // Cache of the schema currently being loaded. This schema is in the _context but to\r\n // avoid going back to the context every time, the cache is used.\r\n private _schema?: Schema;\r\n private _schemaInfo?: SchemaInfo;\r\n\r\n constructor(parserType: AbstractParserConstructor<T>, context?: SchemaContext, visitor?: ISchemaPartVisitor) {\r\n this._context = (undefined !== context) ? context : new SchemaContext();\r\n this._visitorHelper = visitor ? new SchemaPartVisitorDelegate(visitor) : undefined;\r\n this._parserType = parserType;\r\n }\r\n\r\n /**\r\n * Creates a complete SchemaInfo and starts parsing the schema from a serialized representation.\r\n * The info and schema promise will be registered with the SchemaContext. The complete schema can be retrieved by\r\n * calling getCachedSchema on the context.\r\n * @param schema The Schema to populate\r\n * @param rawSchema The serialized data to use to populate the Schema.\r\n * @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.\r\n * The default is true. If false, the schema loading will not begin asynchronously in the background because the\r\n * schema promise must be added to the context. In this case, only the SchemaInfo is returned.\r\n */\r\n public async readSchemaInfo(schema: Schema, rawSchema: T, addSchemaToCache: boolean = true): Promise<SchemaInfo> {\r\n // Ensure context matches schema context\r\n if (schema.context) {\r\n if (this._context !== schema.context)\r\n throw new ECSchemaError(ECSchemaStatus.DifferentSchemaContexts, \"The SchemaContext of the schema must be the same SchemaContext held by the SchemaReadHelper.\");\r\n } else {\r\n (schema as MutableSchema).setContext(this._context);\r\n }\r\n\r\n this._parser = new this._parserType(rawSchema);\r\n\r\n // Loads all of the properties on the Schema object\r\n await schema.fromJSON(this._parser.parseSchema());\r\n\r\n this._schema = schema;\r\n\r\n const schemaReferences: WithSchemaKey[] = [];\r\n const schemaInfo: SchemaInfo = { schemaKey: schema.schemaKey, alias: schema.alias, references: schemaReferences };\r\n for (const reference of this._parser.getReferences()) {\r\n const refKey = new SchemaKey(reference.name, ECVersion.fromString(reference.version));\r\n schemaReferences.push({ schemaKey: refKey });\r\n }\r\n\r\n this._schemaInfo = schemaInfo;\r\n\r\n // Need to add this schema to the context to be able to locate schemaItems within the context.\r\n if (addSchemaToCache && !this._context.schemaExists(schema.schemaKey)) {\r\n await this._context.addSchemaPromise(schemaInfo, schema, this.loadSchema(schemaInfo, schema));\r\n }\r\n return schemaInfo;\r\n }\r\n\r\n /**\r\n * Populates the given Schema from a serialized representation.\r\n * @param schema The Schema to populate\r\n * @param rawSchema The serialized data to use to populate the Schema.\r\n * @param addSchemaToCache Optional parameter that indicates if the schema should be added to the SchemaContext.\r\n * The default is true. If false, the schema will be loaded directly by this method and not from the context's schema cache.\r\n */\r\n public async readSchema(schema: Schema, rawSchema: T, addSchemaToCache: boolean = true): Promise<Schema> {\r\n if (!this._schemaInfo) {\r\n await this.readSchemaInfo(schema, rawSchema, addSchemaToCache);\r\n }\r\n\r\n // If not adding schema to cache (occurs in readSchemaInfo), we must load the schema here\r\n if (!addSchemaToCache) {\r\n const loadedSchema = await this.loadSchema(this._schemaInfo!, schema);\r\n if (undefined === loadedSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);\r\n\r\n return loadedSchema;\r\n }\r\n\r\n const cachedSchema = await this._context.getCachedSchema(this._schemaInfo!.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === cachedSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);\r\n\r\n return cachedSchema;\r\n }\r\n\r\n /**\r\n * Called when a SchemaItem has been successfully loaded by the Helper. The default implementation simply\r\n * checks if the schema item is undefined. An implementation of the helper may choose to partially load\r\n * a schema item in which case this method would indicate if the item has been fully loaded.\r\n * @param schemaItem The SchemaItem to check.\r\n * @returns True if the SchemaItem has been fully loaded, false otherwise.\r\n */\r\n protected isSchemaItemLoaded(schemaItem: SchemaItem | undefined): boolean {\r\n return schemaItem !== undefined;\r\n }\r\n\r\n /* Finish loading the rest of the schema */\r\n private async loadSchema(schemaInfo: SchemaInfo, schema: Schema): Promise<Schema> {\r\n // Verify that there are no schema reference cycles, this will start schema loading by loading their headers\r\n (await SchemaGraph.generateGraph(schemaInfo, this._context)).throwIfCycles();\r\n\r\n for (const reference of schemaInfo.references) {\r\n await this.loadSchemaReference(schema, reference.schemaKey);\r\n }\r\n\r\n if (this._visitorHelper)\r\n await this._visitorHelper.visitSchema(schema, false);\r\n\r\n // Load all schema items\r\n for (const [itemName, itemType, rawItem] of this._parser.getItems()) {\r\n // Make sure the item has not already been loaded. No need to check the SchemaContext because all SchemaItems are added to a Schema,\r\n // which would be found when adding to the context.\r\n const schemaItem = await schema.getItem(itemName);\r\n if (this.isSchemaItemLoaded(schemaItem))\r\n continue;\r\n\r\n const loadedItem = await this.loadSchemaItem(schema, itemName, itemType, rawItem);\r\n if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {\r\n await this._visitorHelper.visitSchemaPart(loadedItem!);\r\n }\r\n }\r\n\r\n await this.loadCustomAttributes(schema, this._parser.getSchemaCustomAttributeProviders());\r\n\r\n if (this._visitorHelper)\r\n await this._visitorHelper.visitSchema(schema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * Populates the given Schema from a serialized representation.\r\n * @param schema The Schema to populate\r\n * @param rawSchema The serialized data to use to populate the Schema.\r\n */\r\n public readSchemaSync(schema: Schema, rawSchema: T): Schema {\r\n this._parser = new this._parserType(rawSchema);\r\n\r\n // Loads all of the properties on the Schema object\r\n schema.fromJSONSync(this._parser.parseSchema());\r\n\r\n this._schema = schema;\r\n\r\n // Need to add this schema to the context to be able to locate schemaItems within the context.\r\n if (!this._context.schemaExists(schema.schemaKey))\r\n this._context.addSchemaSync(schema);\r\n\r\n // Load schema references first\r\n // Need to figure out if other schemas are present.\r\n for (const reference of this._parser.getReferences()) {\r\n this.loadSchemaReferenceSync(reference);\r\n }\r\n\r\n if (this._visitorHelper)\r\n this._visitorHelper.visitSchemaSync(schema, false);\r\n\r\n // Load all schema items\r\n for (const [itemName, itemType, rawItem] of this._parser.getItems()) {\r\n const loadedItem = this.loadSchemaItemSync(schema, itemName, itemType, rawItem);\r\n if (this.isSchemaItemLoaded(loadedItem) && this._visitorHelper) {\r\n this._visitorHelper.visitSchemaPartSync(loadedItem!);\r\n }\r\n }\r\n\r\n this.loadCustomAttributesSync(schema, this._parser.getSchemaCustomAttributeProviders());\r\n\r\n if (this._visitorHelper)\r\n this._visitorHelper.visitSchemaSync(schema);\r\n\r\n return schema;\r\n }\r\n\r\n /**\r\n * Ensures that the schema references can be located and adds them to the schema.\r\n * @param ref The object to read the SchemaReference's props from.\r\n */\r\n private async loadSchemaReference(schema: Schema, refKey: SchemaKey): Promise<Schema> {\r\n const refSchema = await this._context.getSchema(refKey, SchemaMatchType.LatestWriteCompatible);\r\n if (undefined === refSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${refKey.name}.${refKey.version.toString()}, of ${schema.schemaKey.name}`);\r\n\r\n if (schema.references.find((ref) => ref.schemaKey.matches(refSchema.schemaKey)))\r\n return refSchema;\r\n\r\n await (schema as MutableSchema).addReference(refSchema);\r\n const results = this.validateSchemaReferences(schema);\r\n\r\n let errorMessage: string = \"\";\r\n for (const result of results) {\r\n errorMessage += `${result}\\r\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);\r\n }\r\n\r\n return refSchema;\r\n }\r\n\r\n /**\r\n * Ensures that the schema references can be located and adds them to the schema.\r\n * @param ref The object to read the SchemaReference's props from.\r\n */\r\n private loadSchemaReferenceSync(ref: SchemaReferenceProps): void {\r\n const schemaKey = new SchemaKey(ref.name, ECVersion.fromString(ref.version));\r\n const refSchema = this._context.getSchemaSync(schemaKey, SchemaMatchType.LatestWriteCompatible);\r\n if (!refSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${ref.name}.${ref.version}, of ${this._schema!.schemaKey.name}`);\r\n\r\n (this._schema as MutableSchema).addReferenceSync(refSchema);\r\n\r\n SchemaGraph.generateGraphSync(this._schema!).throwIfCycles();\r\n const results = this.validateSchemaReferences(this._schema!);\r\n\r\n let errorMessage: string = \"\";\r\n for (const result of results) {\r\n errorMessage += `${result}\\r\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);\r\n }\r\n }\r\n\r\n /**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n */\r\n private *validateSchemaReferences(schema: Schema): Iterable<string> {\r\n const aliases = new Map();\r\n for (const schemaRef of schema.references) {\r\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\r\n yield `Referenced schema '${schemaRef.name}' of schema '${schema.name}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.`;\r\n\r\n if (schema.schemaKey.matches(schemaRef.schemaKey))\r\n yield `Schema '${schema.name}' has reference cycles: '${schema.name} --> ${schemaRef.name}'`;\r\n\r\n if (aliases.has(schemaRef.alias)) {\r\n const currentRef = aliases.get(schemaRef.alias);\r\n yield `Schema '${schema.name}' has multiple schema references (${currentRef.name}, $schemaRef.name}) with the same alias '${schemaRef.alias}', which is not allowed.`;\r\n } else {\r\n aliases.set(schemaRef.alias, schemaRef);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.\r\n * @param schema The Schema the SchemaItem to.\r\n * @param name The name of the schema item to be loaded.\r\n * @param itemType The SchemaItemType of the item to load.\r\n * @param schemaItemObject The Object to populate the SchemaItem with.\r\n */\r\n protected async loadSchemaItem(schema: Schema, name: string, itemType: string, schemaItemObject?: Readonly<unknown>): Promise<SchemaItem | undefined> {\r\n let schemaItem = await schema.getItem(name);\r\n if (this.isSchemaItemLoaded(schemaItem)) {\r\n return schemaItem;\r\n }\r\n\r\n switch (parseSchemaItemType(itemType)) {\r\n case SchemaItemType.EntityClass:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createEntityClass(name);\r\n schemaItemObject && await this.loadEntityClass(schemaItem as EntityClass, schemaItemObject);\r\n break;\r\n case SchemaItemType.StructClass:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createStructClass(name);\r\n const structProps = schemaItemObject && this._parser.parseStructClass(schemaItemObject);\r\n structProps && await this.loadClass(schemaItem as StructClass, structProps, schemaItemObject);\r\n break;\r\n case SchemaItemType.Mixin:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createMixinClass(name);\r\n schemaItemObject && await this.loadMixin(schemaItem as Mixin, schemaItemObject);\r\n break;\r\n case SchemaItemType.CustomAttributeClass:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createCustomAttributeClass(name);\r\n const caClassProps = schemaItemObject && this._parser.parseCustomAttributeClass(schemaItemObject);\r\n caClassProps && await this.loadClass(schemaItem as CustomAttributeClass, caClassProps, schemaItemObject);\r\n break;\r\n case SchemaItemType.RelationshipClass:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createRelationshipClass(name);\r\n schemaItemObject && await this.loadRelationshipClass(schemaItem as RelationshipClass, schemaItemObject);\r\n break;\r\n case SchemaItemType.KindOfQuantity:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createKindOfQuantity(name);\r\n schemaItemObject && await this.loadKindOfQuantity(schemaItem as KindOfQuantity, schemaItemObject);\r\n break;\r\n case SchemaItemType.Unit:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createUnit(name);\r\n schemaItemObject && await this.loadUnit(schemaItem as Unit, schemaItemObject);\r\n break;\r\n case SchemaItemType.Constant:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createConstant(name);\r\n schemaItemObject && await this.loadConstant(schemaItem as Constant, schemaItemObject);\r\n break;\r\n case SchemaItemType.InvertedUnit:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createInvertedUnit(name);\r\n schemaItemObject && await this.loadInvertedUnit(schemaItem as InvertedUnit, schemaItemObject);\r\n break;\r\n case SchemaItemType.Format:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createFormat(name);\r\n schemaItemObject && await this.loadFormat(schemaItem as Format, schemaItemObject);\r\n break;\r\n case SchemaItemType.Phenomenon:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createPhenomenon(name);\r\n const phenomenonProps = schemaItemObject && this._parser.parsePhenomenon(schemaItemObject);\r\n phenomenonProps && await schemaItem.fromJSON(phenomenonProps);\r\n break;\r\n case SchemaItemType.UnitSystem:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createUnitSystem(name);\r\n schemaItemObject && await schemaItem.fromJSON(this._parser.parseUnitSystem(schemaItemObject));\r\n break;\r\n case SchemaItemType.PropertyCategory:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createPropertyCategory(name);\r\n const propertyCategoryProps = schemaItemObject && this._parser.parsePropertyCategory(schemaItemObject);\r\n propertyCategoryProps && schemaItemObject && await schemaItem.fromJSON(propertyCategoryProps);\r\n break;\r\n case SchemaItemType.Enumeration:\r\n schemaItem = schemaItem || await (schema as MutableSchema).createEnumeration(name);\r\n const enumerationProps = schemaItemObject && this._parser.parseEnumeration(schemaItemObject);\r\n enumerationProps && await schemaItem.fromJSON(enumerationProps);\r\n break;\r\n // NOTE: we are being permissive here and allowing unknown types to silently fail. Not sure if we want to hard fail or just do a basic deserialization\r\n }\r\n return schemaItem;\r\n }\r\n\r\n /**\r\n * Load the customAttribute class dependencies for a set of CustomAttribute objects and add\r\n * them to a given custom attribute container.\r\n * @param container The CustomAttributeContainer that each CustomAttribute will be added to.\r\n * @param customAttributes An iterable set of parsed CustomAttribute objects.\r\n */\r\n protected async loadCustomAttributes(container: AnyCAContainer, caProviders: Iterable<CAProviderTuple>): Promise<void> {\r\n for (const providerTuple of caProviders) {\r\n // First tuple entry is the CA class name.\r\n const caClass = await this.findSchemaItem(providerTuple[0]);\r\n\r\n // If custom attribute exist within the context and is referenced, validate the reference is defined in the container's schema\r\n if (caClass && caClass.key.schemaName !== container.schema.name &&\r\n !container.schema.getReferenceSync(caClass.key.schemaName)) {\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to load custom attribute ${caClass.fullName} from container ${container.fullName}, ${caClass.key.schemaName} reference not defined`);\r\n }\r\n\r\n // Second tuple entry ia a function that provides the CA instance.\r\n const provider = providerTuple[1];\r\n const customAttribute = provider(caClass as CustomAttributeClass);\r\n\r\n (container as AnyMutableCAContainer).addCustomAttribute(customAttribute);\r\n }\r\n }\r\n\r\n /**\r\n * Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.\r\n * @param schema The Schema the SchemaItem to.\r\n * @param name The name of the schema item to be loaded.\r\n * @param itemType The SchemaItemType of the item to load.\r\n * @param schemaItemObject The Object to populate the SchemaItem with.\r\n */\r\n private loadSchemaItemSync(schema: Schema, name: string, itemType: string, schemaItemObject: Readonly<unknown>): SchemaItem | undefined {\r\n let schemaItem = schema.getItemSync(name);\r\n if (this.isSchemaItemLoaded(schemaItem)) {\r\n return schemaItem;\r\n }\r\n\r\n switch (parseSchemaItemType(itemType)) {\r\n case SchemaItemType.EntityClass:\r\n schemaItem = schemaItem || (schema as MutableSchema).createEntityClassSync(name);\r\n this.loadEntityClassSync(schemaItem as EntityClass, schemaItemObject);\r\n break;\r\n case SchemaItemType.StructClass:\r\n schemaItem = schemaItem || (schema as MutableSchema).createStructClassSync(name);\r\n const structProps = this._parser.parseStructClass(schemaItemObject);\r\n this.loadClassSync(schemaItem as StructClass, structProps, schemaItemObject);\r\n break;\r\n case SchemaItemType.Mixin:\r\n schemaItem = schemaItem || (schema as MutableSchema).createMixinClassSync(name);\r\n this.loadMixinSync(schemaItem as Mixin, schemaItemObject);\r\n break;\r\n case SchemaItemType.CustomAttributeClass:\r\n schemaItem = schemaItem || (schema as MutableSchema).createCustomAttributeClassSync(name);\r\n const caClassProps = this._parser.parseCustomAttributeClass(schemaItemObject);\r\n this.loadClassSync(schemaItem as CustomAttributeClass, caClassProps, schemaItemObject);\r\n break;\r\n case SchemaItemType.RelationshipClass:\r\n schemaItem = schemaItem || (schema as MutableSchema).createRelationshipClassSync(name);\r\n this.loadRelationshipClassSync(schemaItem as RelationshipClass, schemaItemObject);\r\n break;\r\n case SchemaItemType.KindOfQuantity:\r\n schemaItem = schemaItem || (schema as MutableSchema).createKindOfQuantitySync(name);\r\n this.loadKindOfQuantitySync(schemaItem as KindOfQuantity, schemaItemObject);\r\n break;\r\n case SchemaItemType.Unit:\r\n schemaItem = schemaItem || (schema as MutableSchema).createUnitSync(name);\r\n this.loadUnitSync(schemaItem as Unit, schemaItemObject);\r\n break;\r\n case SchemaItemType.Constant:\r\n schemaItem = schemaItem || (schema as MutableSchema).createConstantSync(name);\r\n this.loadConstantSync(schemaItem as Constant, schemaItemObject);\r\n break;\r\n case SchemaItemType.InvertedUnit:\r\n schemaItem = schemaItem || (schema as MutableSchema).createInvertedUnitSync(name);\r\n this.loadInvertedUnitSync(schemaItem as InvertedUnit, schemaItemObject);\r\n break;\r\n case SchemaItemType.Format:\r\n schemaItem = schemaItem || (schema as MutableSchema).createFormatSync(name);\r\n this.loadFormatSync(schemaItem as Format, schemaItemObject);\r\n break;\r\n case SchemaItemType.Phenomenon:\r\n schemaItem = schemaItem || (schema as MutableSchema).createPhenomenonSync(name);\r\n const phenomenonProps = this._parser.parsePhenomenon(schemaItemObject);\r\n schemaItem.fromJSONSync(phenomenonProps);\r\n break;\r\n case SchemaItemType.UnitSystem:\r\n schemaItem = schemaItem || (schema as MutableSchema).createUnitSystemSync(name);\r\n schemaItem.fromJSONSync(this._parser.parseUnitSystem(schemaItemObject));\r\n break;\r\n case SchemaItemType.PropertyCategory:\r\n schemaItem = schemaItem || (schema as MutableSchema).createPropertyCategorySync(name);\r\n const propertyCategoryProps = this._parser.parsePropertyCategory(schemaItemObject);\r\n schemaItem.fromJSONSync(propertyCategoryProps);\r\n break;\r\n case SchemaItemType.Enumeration:\r\n schemaItem = schemaItem || (schema as MutableSchema).createEnumerationSync(name);\r\n const enumerationProps = this._parser.parseEnumeration(schemaItemObject);\r\n schemaItem.fromJSONSync(enumerationProps);\r\n break;\r\n // NOTE: we are being permissive here and allowing unknown types to silently fail. Not sure if we want to hard fail or just do a basic deserialization\r\n }\r\n return schemaItem;\r\n }\r\n\r\n /**\r\n * Given the full (Schema.ItemName) or qualified (alias:ItemName) item name, returns\r\n * a tuple of strings in the format [\"SchemaName\", \"ItemName\"]. The schema name may be\r\n * empty if the item comes from the schema being parsed.\r\n * @param fullOrQualifiedName The full or qualified name of the schema item.\r\n * @param schema The schema that will be used to lookup the schema name by alias, if necessary.\r\n */\r\n private static resolveSchemaAndItemName(fullOrQualifiedName: string, schema?: Schema): [string, string] {\r\n const [schemaName, itemName] = SchemaItem.parseFullName(fullOrQualifiedName);\r\n\r\n // If a schema is provided we attempt to resolve the alias by looking at the reference schemas.\r\n if (undefined !== schema && -1 !== fullOrQualifiedName.indexOf(\":\")) {\r\n const refName = schema.getReferenceNameByAlias(schemaName);\r\n if (undefined === refName)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not resolve schema alias '${schemaName}' for schema item '${itemName}.`);\r\n return [refName, itemName];\r\n }\r\n\r\n return [schemaName, itemName];\r\n }\r\n\r\n /**\r\n * Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does\r\n * not exist within the schema, the SchemaContext will be searched.\r\n * @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.\r\n * @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.\r\n * @param loadCallBack Only called if the SchemaItem had to be loaded.\r\n * @return The SchemaItem if it had to be loaded, otherwise undefined.\r\n */\r\n private async findSchemaItem(name: string, skipVisitor = false, loadCallBack?: (item: SchemaItem) => void): Promise<SchemaItem | undefined> {\r\n let schemaItem: SchemaItem | undefined;\r\n // TODO: A better solution should be investigated for handling both an alias and the schema name.\r\n const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);\r\n const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());\r\n\r\n if (undefined === schemaName || 0 === schemaName.length)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);\r\n\r\n if (isInThisSchema) {\r\n schemaItem = await this._schema!.getItem(itemName);\r\n if (schemaItem)\r\n return schemaItem;\r\n\r\n const foundItem = this._parser.findItem(itemName);\r\n if (foundItem) {\r\n schemaItem = await this.loadSchemaItem(this._schema!, ...foundItem);\r\n if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {\r\n await this._visitorHelper.visitSchemaPart(schemaItem!);\r\n }\r\n if (loadCallBack && schemaItem)\r\n loadCallBack(schemaItem);\r\n\r\n return schemaItem;\r\n }\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\r\n }\r\n\r\n schemaItem = await this._context.getSchemaItem(new SchemaItemKey(itemName, new SchemaKey(schemaName)));\r\n if (undefined === schemaItem)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\r\n\r\n return schemaItem;\r\n }\r\n\r\n /**\r\n * Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does\r\n * not exist within the schema, the SchemaContext will be searched.\r\n * @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.\r\n * @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.\r\n * @param loadCallBack Only called if the SchemaItem had to be loaded.\r\n * @return The SchemaItem if it had to be loaded, otherwise undefined.\r\n */\r\n private findSchemaItemSync(name: string, skipVisitor = false, loadCallBack?: (item: SchemaItem) => void): SchemaItem | undefined {\r\n let schemaItem: SchemaItem | undefined;\r\n // TODO: A better solution should be investigated for handling both an alias and the schema name.\r\n const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);\r\n const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());\r\n\r\n if (undefined === schemaName || schemaName.length === 0)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);\r\n\r\n if (isInThisSchema && undefined === this._schema!.getItemSync(itemName)) {\r\n const foundItem = this._parser.findItem(itemName);\r\n if (foundItem) {\r\n schemaItem = this.loadSchemaItemSync(this._schema!, ...foundItem);\r\n if (!skipVisitor && this.isSchemaItemLoaded(schemaItem) && this._visitorHelper) {\r\n this._visitorHelper.visitSchemaPartSync(schemaItem!);\r\n }\r\n if (loadCallBack && schemaItem)\r\n loadCallBack(schemaItem);\r\n\r\n return schemaItem;\r\n }\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\r\n }\r\n\r\n schemaItem = this._context.getSchemaItemSync(new SchemaItemKey(itemName, new SchemaKey(schemaName)));\r\n if (undefined === schemaItem)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);\r\n\r\n return schemaItem;\r\n }\r\n\r\n /**\r\n * Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.\r\n * @param unit The Unit object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawUnit The serialized unit data\r\n */\r\n private async loadUnit(unit: Unit, rawUnit: Readonly<unknown>): Promise<void> {\r\n const unitProps = this._parser.parseUnit(rawUnit);\r\n\r\n await this.findSchemaItem(unitProps.phenomenon, true);\r\n await this.findSchemaItem(unitProps.unitSystem, true);\r\n\r\n await unit.fromJSON(unitProps);\r\n }\r\n\r\n /**\r\n * Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.\r\n * @param unit The Unit object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawUnit The serialized unit data\r\n */\r\n private loadUnitSync(unit: Unit, rawUnit: Readonly<unknown>) {\r\n const unitProps = this._parser.parseUnit(rawUnit);\r\n\r\n this.findSchemaItemSync(unitProps.phenomenon, true);\r\n this.findSchemaItemSync(unitProps.unitSystem, true);\r\n\r\n unit.fromJSONSync(unitProps);\r\n }\r\n\r\n /**\r\n * Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.\r\n * @param koq The KindOfQuantity object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawKoQ The serialized kind of quantity data\r\n */\r\n private async loadKindOfQuantity(koq: KindOfQuantity, rawKoQ: Readonly<unknown>): Promise<void> {\r\n const koqProps = this._parser.parseKindOfQuantity(rawKoQ);\r\n await this.findSchemaItem(koqProps.persistenceUnit);\r\n\r\n if (undefined !== koqProps.presentationUnits) {\r\n for (const formatString of koqProps.presentationUnits) {\r\n for (const name of getItemNamesFromFormatString(formatString)) {\r\n await this.findSchemaItem(name);\r\n }\r\n }\r\n }\r\n\r\n await koq.fromJSON(koqProps);\r\n }\r\n\r\n /**\r\n * Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.\r\n * @param koq The KindOfQuantity object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawKoQ The serialized kind of quantity data\r\n */\r\n private loadKindOfQuantitySync(koq: KindOfQuantity, rawKoQ: Readonly<unknown>) {\r\n const koqProps = this._parser.parseKindOfQuantity(rawKoQ);\r\n this.findSchemaItemSync(koqProps.persistenceUnit);\r\n\r\n if (undefined !== koqProps.presentationUnits) {\r\n for (const formatString of koqProps.presentationUnits) {\r\n for (const name of getItemNamesFromFormatString(formatString)) {\r\n this.findSchemaItemSync(name);\r\n }\r\n }\r\n }\r\n koq.fromJSONSync(koqProps);\r\n }\r\n\r\n /**\r\n * Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.\r\n * @param constant The Constant object that we are loading the phenomenon dependency for\r\n * @param rawConstant The serialized constant data\r\n */\r\n private async loadConstant(constant: Constant, rawConstant: Readonly<unknown>): Promise<void> {\r\n const constantProps = this._parser.parseConstant(rawConstant);\r\n\r\n await this.findSchemaItem(constantProps.phenomenon, true);\r\n await constant.fromJSON(constantProps);\r\n }\r\n\r\n /**\r\n * Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.\r\n * @param constant The Constant object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawConstant The serialized constant data\r\n */\r\n private loadConstantSync(constant: Constant, rawConstant: Readonly<unknown>) {\r\n const constantProps = this._parser.parseConstant(rawConstant);\r\n\r\n this.findSchemaItemSync(constantProps.phenomenon, true);\r\n constant.fromJSONSync(constantProps);\r\n }\r\n\r\n /**\r\n * Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.\r\n * @param invertedUnit The InvertedUnit object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawInvertedUnit The serialized inverted unit data.\r\n */\r\n private async loadInvertedUnit(invertedUnit: InvertedUnit, rawInvertedUnit: Readonly<unknown>): Promise<void> {\r\n const invertedUnitProps = this._parser.parseInvertedUnit(rawInvertedUnit);\r\n\r\n await this.findSchemaItem(invertedUnitProps.invertsUnit, true);\r\n await this.findSchemaItem(invertedUnitProps.unitSystem, true);\r\n\r\n await invertedUnit.fromJSON(invertedUnitProps);\r\n }\r\n\r\n /**\r\n * Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.\r\n * @param invertedUnit The InvertedUnit object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawInvertedUnit The serialized inverted unit data.\r\n */\r\n private loadInvertedUnitSync(invertedUnit: InvertedUnit, rawInvertedUnit: Readonly<unknown>) {\r\n const invertedUnitProps = this._parser.parseInvertedUnit(rawInvertedUnit);\r\n\r\n this.findSchemaItemSync(invertedUnitProps.invertsUnit, true);\r\n this.findSchemaItemSync(invertedUnitProps.unitSystem, true);\r\n\r\n invertedUnit.fromJSONSync(invertedUnitProps);\r\n }\r\n\r\n /**\r\n * Load the unit dependencies for a Format object and load the Format from its serialized format.\r\n * @param format The Format object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawFormat The serialized format data.\r\n */\r\n private async loadFormat(format: Format, rawFormat: Readonly<unknown>): Promise<void> {\r\n const formatProps = this._parser.parseFormat(rawFormat);\r\n\r\n if (undefined !== formatProps.composite) {\r\n const formatUnits = formatProps.composite.units;\r\n for (const unit of formatUnits) {\r\n await this.findSchemaItem(unit.name, true);\r\n }\r\n }\r\n await format.fromJSON(formatProps);\r\n }\r\n\r\n /**\r\n * Load the unit dependencies for a Format object and load the Format from its serialized format.\r\n * @param format The Format object that we are loading dependencies for and \"deserializing into\".\r\n * @param rawFormat The serialized format data.\r\n */\r\n private loadFormatSync(format: Format, rawFormat: Readonly<unknown>) {\r\n const formatProps = this._parser.parseFormat(rawFormat);\r\n\r\n if (undefined !== formatProps.composite) {\r\n const formatUnits = formatProps.composite.units;\r\n for (const unit of formatUnits) {\r\n this.findSchemaItemSync(unit.name, true);\r\n }\r\n }\r\n\r\n format.fromJSONSync(formatProps);\r\n }\r\n\r\n /**\r\n * Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.\r\n * @param classObj The ECClass object that we are loading dependencies for and \"deserializing into\".\r\n * @param classProps The parsed class props object.\r\n * @param rawClass The serialized class data.\r\n */\r\n private async loadClass(classObj: AnyClass, classProps: ClassProps, rawClass: Readonly<unknown>): Promise<void> {\r\n const baseClassLoaded = async (baseClass: SchemaItem) => {\r\n if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))\r\n await this._visitorHelper.visitSchemaPart(baseClass);\r\n };\r\n\r\n // Load base class first\r\n if (undefined !== classProps.baseClass) {\r\n await this.findSchemaItem(classProps.baseClass, true, baseClassLoaded);\r\n }\r\n\r\n // Now deserialize the class itself, *before* any properties\r\n // (We need to do this to break Entity -navProp-> Relationship -constraint-> Entity cycle.)\r\n await (classObj as ECClass).fromJSON(classProps);\r\n\r\n for (const [propName, propType, rawProp] of this._parser.getProperties(rawClass, classObj.fullName)) {\r\n await this.loadPropertyTypes(classObj, propName, propType, rawProp);\r\n }\r\n\r\n await this.loadCustomAttributes(classObj, this._parser.getClassCustomAttributeProviders(rawClass));\r\n }\r\n\r\n /**\r\n * Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.\r\n * @param classObj The ECClass object that we are loading dependencies for and \"deserializing into\".\r\n * @param classProps The parsed class props object.\r\n * @param rawClass The serialized class data.\r\n */\r\n private loadClassSync(classObj: AnyClass, classProps: ClassProps, rawClass: Readonly<unknown>): void {\r\n const baseClassLoaded = async (baseClass: SchemaItem) => {\r\n if (this._visitorHelper && this.isSchemaItemLoaded(baseClass))\r\n this._visitorHelper.visitSchemaPartSync(baseClass);\r\n };\r\n\r\n // Load base class first\r\n if (undefined !== classProps.baseClass) {\r\n this.findSchemaItemSync(classProps.baseClass, true, baseClassLoaded);\r\n }\r\n\r\n // Now deserialize the class itself, *before* any properties\r\n // (We need to do this to break Entity -navProp-> Relationship -constraint-> Entity cycle.)\r\n (classObj as ECClass).fromJSONSync(classProps);\r\n\r\n for (const [propName, propType, rawProp] of this._parser.getProperties(rawClass, classObj.fullName)) {\r\n this.loadPropertyTypesSync(classObj, propName, propType, rawProp);\r\n }\r\n\r\n this.loadCustomAttributesSync(classObj, this._parser.getClassCustomAttributeProviders(rawClass));\r\n }\r\n\r\n /**\r\n * Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.\r\n * @param entity The EntityClass that we are loading dependencies for and \"deserializing into\".\r\n * @param rawEntity The serialized entity class data.\r\n */\r\n private async loadEntityClass(entity: EntityClass, rawEntity: Readonly<unknown>): Promise<void> {\r\n const entityClassProps = this._parser.parseEntityClass(rawEntity);\r\n\r\n // Load Mixin classes first\r\n if (undefined !== entityClassProps.mixins) {\r\n for (const mixinName of entityClassProps.mixins)\r\n await this.findSchemaItem(mixinName);\r\n }\r\n\r\n await this.loadClass(entity, entityClassProps, rawEntity);\r\n }\r\n\r\n /**\r\n * Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.\r\n * @param entity The EntityClass that we are loading dependencies for and \"deserializing into\".\r\n * @param rawEntity The serialized entity class data.\r\n */\r\n private loadEntityClassSync(entity: EntityClass, rawEntity: Readonly<unknown>): void {\r\n const entityClassProps = this._parser.parseEntityClass(rawEntity);\r\n\r\n // Load Mixin classes first\r\n if (undefined !== entityClassProps.mixins) {\r\n for (const mixinName of entityClassProps.mixins)\r\n this.findSchemaItemSync(mixinName);\r\n }\r\n\r\n this.loadClassSync(entity, entityClassProps, rawEntity);\r\n }\r\n\r\n /**\r\n * Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.\r\n * @param mixin The Mixin that we are loading dependencies for and \"deserializing into\".\r\n * @param rawMixin The serialized mixin data.\r\n */\r\n private async loadMixin(mixin: Mixin, rawMixin: Readonly<unknown>): Promise<void> {\r\n const mixinProps = this._parser.parseMixin(rawMixin);\r\n\r\n const appliesToLoaded = async (appliesToClass: SchemaItem) => {\r\n if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))\r\n await this._visitorHelper.visitSchemaPart(appliesToClass);\r\n };\r\n\r\n await this.findSchemaItem(mixinProps.appliesTo, true, appliesToLoaded);\r\n\r\n await this.loadClass(mixin, mixinProps, rawMixin);\r\n }\r\n\r\n /**\r\n * Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.\r\n * @param mixin The Mixin that we are loading dependencies for and \"deserializing into\".\r\n * @param rawMixin The serialized mixin data.\r\n */\r\n private loadMixinSync(mixin: Mixin, rawMixin: Readonly<unknown>): void {\r\n const mixinProps = this._parser.parseMixin(rawMixin);\r\n\r\n const appliesToLoaded = async (appliesToClass: SchemaItem) => {\r\n if (this._visitorHelper && this.isSchemaItemLoaded(appliesToClass))\r\n await this._visitorHelper.visitSchemaPart(appliesToClass);\r\n };\r\n\r\n this.findSchemaItemSync(mixinProps.appliesTo, true, appliesToLoaded);\r\n\r\n this.loadClassSync(mixin, mixinProps, rawMixin);\r\n }\r\n\r\n /**\r\n * Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.\r\n * @param rel The RelationshipClass that we are loading dependencies for and \"deserializing into\".\r\n * @param rawRel The serialized relationship class data.\r\n */\r\n private async loadRelationshipClass(rel: RelationshipClass, rawRel: Readonly<unknown>): Promise<void> {\r\n const relationshipClassProps = this._parser.parseRelationshipClass(rawRel);\r\n await this.loadClass(rel, relationshipClassProps, rawRel);\r\n await this.loadRelationshipConstraint(rel.source, relationshipClassProps.source);\r\n await this.loadRelationshipConstraint(rel.target, relationshipClassProps.target);\r\n\r\n const [sourceCustomAttributes, targetCustomAttributes] = this._parser.getRelationshipConstraintCustomAttributeProviders(rawRel);\r\n await this.loadCustomAttributes(rel.source, sourceCustomAttributes);\r\n await this.loadCustomAttributes(rel.target, targetCustomAttributes);\r\n }\r\n\r\n /**\r\n * Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.\r\n * @param rel The RelationshipClass that we are loading dependencies for and \"deserializing into\".\r\n * @param rawRel The serialized relationship class data.\r\n */\r\n private loadRelationshipClassSync(rel: RelationshipClass, rawRel: Readonly<unknown>): void {\r\n const relationshipClassProps = this._parser.parseRelationshipClass(rawRel);\r\n this.loadClassSync(rel, relationshipClassProps, rawRel);\r\n this.loadRelationshipConstraintSync(rel.source, relationshipClassProps.source);\r\n this.loadRelationshipConstraintSync(rel.target, relationshipClassProps.target);\r\n\r\n const [sourceCustomAttributes, targetCustomAttributes] = this._parser.getRelationshipConstraintCustomAttributeProviders(rawRel);\r\n this.loadCustomAttributesSync(rel.source, sourceCustomAttributes);\r\n this.loadCustomAttributesSync(rel.target, targetCustomAttributes);\r\n }\r\n\r\n /**\r\n * Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.\r\n * @param relConstraint The RelationshipConstraint that we are loading dependencies for and \"deserializing into\".\r\n * @param props The parsed relationship constraint props.\r\n */\r\n private async loadRelationshipConstraint(relConstraint: RelationshipConstraint, props: RelationshipConstraintProps): Promise<void> {\r\n if (undefined !== props.abstractConstraint) {\r\n await this.findSchemaItem(props.abstractConstraint);\r\n }\r\n if (undefined !== props.constraintClasses) { // TODO: this should be required\r\n for (const constraintClass of props.constraintClasses) {\r\n await this.findSchemaItem(constraintClass);\r\n }\r\n }\r\n await relConstraint.fromJSON(props);\r\n }\r\n\r\n /**\r\n * Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.\r\n * @param relConstraint The RelationshipConstraint that we are loading dependencies for and \"deserializing into\".\r\n * @param props The parsed relationship constraint props.\r\n */\r\n private loadRelationshipConstraintSync(relConstraint: RelationshipConstraint, props: RelationshipConstraintProps): void {\r\n if (undefined !== props.abstractConstraint) {\r\n this.findSchemaItemSync(props.abstractConstraint);\r\n }\r\n if (undefined !== props.constraintClasses) {\r\n for (const constraintClass of props.constraintClasses) {\r\n this.findSchemaItemSync(constraintClass);\r\n }\r\n }\r\n\r\n relConstraint.fromJSONSync(props);\r\n }\r\n\r\n /**\r\n * Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.\r\n * @param classObj The ECClass that the Property should be created in.\r\n * @param propName The name of the Property.\r\n * @param propType The (serialized string) kind of property to create.\r\n * @param rawProperty The serialized property data.\r\n */\r\n private async loadPropertyTypes(classObj: AnyClass, propName: string, propType: string, rawProperty: Readonly<unknown>): Promise<void> {\r\n\r\n const loadTypeName = async (typeName: string): Promise<ECSchemaStatus> => {\r\n if (undefined === parsePrimitiveType(typeName)) {\r\n if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))\r\n return ECSchemaStatus.NewerECSpecVersion;\r\n await this.findSchemaItem(typeName);\r\n }\r\n return ECSchemaStatus.Success;\r\n };\r\n\r\n const lowerCasePropType = propType.toLowerCase();\r\n\r\n switch (lowerCasePropType) {\r\n case \"primitiveproperty\":\r\n const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);\r\n if (await loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\r\n (primPropertyProps as any).typeName = \"string\";\r\n const primProp = await (classObj as MutableClass).createPrimitiveProperty(propName, primPropertyProps.typeName);\r\n return this.loadProperty(primProp, primPropertyProps, rawProperty);\r\n\r\n case \"structproperty\":\r\n const structPropertyProps = this._parser.parseStructProperty(rawProperty);\r\n await loadTypeName(structPropertyProps.typeName);\r\n const structProp = await (classObj as MutableClass).createStructProperty(propName, structPropertyProps.typeName);\r\n return this.loadProperty(structProp, structPropertyProps, rawProperty);\r\n\r\n case \"primitivearrayproperty\":\r\n const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);\r\n if (await loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\r\n (primArrPropertyProps as any).typeName = \"string\";\r\n const primArrProp = await (classObj as MutableClass).createPrimitiveArrayProperty(propName, primArrPropertyProps.typeName);\r\n return this.loadProperty(primArrProp, primArrPropertyProps, rawProperty);\r\n\r\n case \"structarrayproperty\":\r\n const structArrPropertyProps = this._parser.parseStructArrayProperty(rawProperty);\r\n await loadTypeName(structArrPropertyProps.typeName);\r\n const structArrProp = await (classObj as MutableClass).createStructArrayProperty(propName, structArrPropertyProps.typeName);\r\n return this.loadProperty(structArrProp, structArrPropertyProps, rawProperty);\r\n\r\n case \"navigationproperty\":\r\n if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);\r\n\r\n const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);\r\n await this.findSchemaItem(navPropertyProps.relationshipName);\r\n const navProp = await (classObj as MutableEntityClass).createNavigationProperty(propName, navPropertyProps.relationshipName, navPropertyProps.direction);\r\n return this.loadProperty(navProp, navPropertyProps, rawProperty);\r\n }\r\n }\r\n\r\n /**\r\n * Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.\r\n * @param classObj The ECClass that the Property should be created in.\r\n * @param propName The name of the Property.\r\n * @param propType The (serialized string) kind of property to create.\r\n * @param rawProperty The serialized property data.\r\n */\r\n private loadPropertyTypesSync(classObj: AnyClass, propName: string, propType: string, rawProperty: Readonly<unknown>): void {\r\n const loadTypeName = (typeName: string): ECSchemaStatus => {\r\n if (undefined === parsePrimitiveType(typeName)) {\r\n if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))\r\n return ECSchemaStatus.NewerECSpecVersion;\r\n this.findSchemaItemSync(typeName);\r\n }\r\n return ECSchemaStatus.Success;\r\n };\r\n\r\n const lowerCasePropType = propType.toLowerCase();\r\n\r\n switch (lowerCasePropType) {\r\n case \"primitiveproperty\":\r\n const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);\r\n if (loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\r\n (primPropertyProps as any).typeName = \"string\";\r\n const primProp = (classObj as MutableClass).createPrimitivePropertySync(propName, primPropertyProps.typeName);\r\n return this.loadPropertySync(primProp, primPropertyProps, rawProperty);\r\n\r\n case \"structproperty\":\r\n const structPropertyProps = this._parser.parseStructProperty(rawProperty);\r\n loadTypeName(structPropertyProps.typeName);\r\n const structProp = (classObj as MutableClass).createStructPropertySync(propName, structPropertyProps.typeName);\r\n return this.loadPropertySync(structProp, structPropertyProps, rawProperty);\r\n\r\n case \"primitivearrayproperty\":\r\n const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);\r\n if (loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)\r\n (primArrPropertyProps as any).typeName = \"string\";\r\n const primArrProp = (classObj as MutableClass).createPrimitiveArrayPropertySync(propName, primArrPropertyProps.typeName);\r\n return this.loadPropertySync(primArrProp, primArrPropertyProps, rawProperty);\r\n\r\n case \"structarrayproperty\":\r\n const structArrPropertyProps = this._parser.parseStructArrayProperty(rawProperty);\r\n loadTypeName(structArrPropertyProps.typeName);\r\n const structArrProp = (classObj as MutableClass).createStructArrayPropertySync(propName, structArrPropertyProps.typeName);\r\n return this.loadPropertySync(structArrProp, structArrPropertyProps, rawProperty);\r\n\r\n case \"navigationproperty\":\r\n if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);\r\n\r\n const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);\r\n this.findSchemaItemSync(navPropertyProps.relationshipName);\r\n const navProp = (classObj as MutableEntityClass).createNavigationPropertySync(propName, navPropertyProps.relationshipName, navPropertyProps.direction);\r\n return this.loadPropertySync(navProp, navPropertyProps, rawProperty);\r\n }\r\n }\r\n\r\n /**\r\n * Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.\r\n * @param propertyObj The Property that we are loading dependencies for and \"deserializing into\".\r\n * @param props The parsed property props.\r\n * @param rawProperty The serialized property data.\r\n */\r\n private async loadProperty<U extends Property>(propertyObj: U, props: PropertyProps, rawProperty: Readonly<unknown>): Promise<void> {\r\n if (undefined !== props.category) {\r\n await this.findSchemaItem(props.category);\r\n }\r\n\r\n if (undefined !== props.kindOfQuantity) {\r\n await this.findSchemaItem(props.kindOfQuantity);\r\n }\r\n\r\n await propertyObj.fromJSON(props);\r\n await this.loadCustomAttributes(propertyObj, this._parser.getPropertyCustomAttributeProviders(rawProperty));\r\n }\r\n\r\n /**\r\n * Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.\r\n * @param propertyObj The Property that we are loading dependencies for and \"deserializing into\".\r\n * @param props The parsed property props.\r\n * @param rawProperty The serialized property data.\r\n */\r\n private loadPropertySync<U extends Property>(propertyObj: U, props: PropertyProps, rawProperty: Readonly<unknown>): void {\r\n if (undefined !== props.category) {\r\n this.findSchemaItemSync(props.category);\r\n }\r\n\r\n if (undefined !== props.kindOfQuantity) {\r\n this.findSchemaItemSync(props.kindOfQuantity);\r\n }\r\n\r\n propertyObj.fromJSONSync(props);\r\n this.loadCustomAttributesSync(propertyObj, this._parser.getPropertyCustomAttributeProviders(rawProperty));\r\n }\r\n\r\n /**\r\n * Load the customAttribute class dependencies for a set of CustomAttribute objects and add them to a given custom attribute container.\r\n * @param container The CustomAttributeContainer that each CustomAttribute will be added to.\r\n * @param customAttributes An iterable set of parsed CustomAttribute objects.\r\n */\r\n private loadCustomAttributesSync(container: AnyCAContainer, caProviders: Iterable<CAProviderTuple>): void {\r\n for (const providerTuple of caProviders) {\r\n // First tuple entry is the CA class name.\r\n const caClass = this.findSchemaItemSync(providerTuple[0]) as CustomAttributeClass;\r\n\r\n // Second tuple entry ia a function that provides the CA instance.\r\n const provider = providerTuple[1];\r\n const customAttribute = provider(caClass);\r\n (container as AnyMutableCAContainer).addCustomAttribute(customAttribute);\r\n }\r\n }\r\n\r\n public static isECSpecVersionNewer(ecSpecVersion?: ECSpecVersion): boolean {\r\n if (ecSpecVersion === undefined || ecSpecVersion.readVersion === undefined || ecSpecVersion.writeVersion === undefined)\r\n return false;\r\n\r\n return ((ecSpecVersion.readVersion > Schema.currentECSpecMajorVersion) || (ecSpecVersion.readVersion === Schema.currentECSpecMajorVersion && ecSpecVersion.writeVersion > Schema.currentECSpecMinorVersion));\r\n }\r\n}\r\n"]}
|