@itwin/ecschema-metadata 5.0.0-dev.11 → 5.0.0-dev.110
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 +61 -1
- package/lib/cjs/Constants.d.ts +8 -0
- package/lib/cjs/Constants.d.ts.map +1 -1
- package/lib/cjs/Constants.js +30 -21
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +85 -36
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +79 -29
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/DelayedPromise.d.ts +9 -8
- package/lib/cjs/DelayedPromise.d.ts.map +1 -1
- package/lib/cjs/DelayedPromise.js +8 -6
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js +1 -0
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts +3 -3
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +35 -26
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +153 -150
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +47 -33
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js +3 -3
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +60 -52
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +8 -17
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.d.ts +2 -2
- package/lib/cjs/ECName.js +5 -4
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +41 -9
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +78 -24
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.d.ts +4 -4
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +61 -60
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.d.ts +35 -32
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +179 -32
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +290 -88
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.d.ts +26 -10
- package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
- package/lib/cjs/Metadata/Constant.js +38 -10
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +21 -7
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +28 -8
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +40 -11
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +72 -34
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts +30 -10
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +41 -13
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +65 -17
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +107 -22
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +19 -10
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +32 -15
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +38 -18
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +90 -40
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.d.ts +31 -4
- package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
- package/lib/cjs/Metadata/Mixin.js +42 -8
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +36 -19
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts +24 -3
- package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js +32 -3
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +47 -25
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +128 -49
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts +20 -4
- package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js +31 -4
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts +63 -27
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +100 -43
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +167 -41
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +211 -111
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +19 -19
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +23 -21
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +24 -21
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +40 -24
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts +17 -4
- package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js +24 -4
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.d.ts +11 -11
- package/lib/cjs/PropertyTypes.d.ts.map +1 -1
- package/lib/cjs/PropertyTypes.js +28 -20
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/SchemaFormatsProvider.js +146 -0
- package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/SchemaJsonLocater.d.ts +8 -8
- package/lib/cjs/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js +7 -7
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts +13 -7
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +22 -12
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +5 -5
- package/lib/cjs/SchemaLoader.d.ts.map +1 -1
- package/lib/cjs/SchemaLoader.js +5 -4
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/cjs/SchemaPartVisitorDelegate.js +2 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js +69 -65
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js +9 -7
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js +2 -0
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/cjs/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js +11 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +8 -9
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts +1 -1
- package/lib/cjs/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js +6 -4
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +1 -0
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +1 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js +5 -6
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.d.ts +8 -0
- package/lib/esm/Constants.d.ts.map +1 -1
- package/lib/esm/Constants.js +29 -20
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +85 -36
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +78 -28
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/DelayedPromise.d.ts +9 -8
- package/lib/esm/DelayedPromise.d.ts.map +1 -1
- package/lib/esm/DelayedPromise.js +8 -6
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js +1 -0
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts +3 -3
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +36 -27
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +154 -151
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +47 -33
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js +3 -3
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +61 -53
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +9 -18
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.d.ts +2 -2
- package/lib/esm/ECName.js +6 -5
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +41 -9
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +77 -24
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.d.ts +4 -4
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +59 -58
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +35 -32
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +179 -32
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +292 -90
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.d.ts +26 -10
- package/lib/esm/Metadata/Constant.d.ts.map +1 -1
- package/lib/esm/Metadata/Constant.js +39 -11
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +21 -7
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +29 -9
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +40 -11
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +73 -35
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts +30 -10
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +42 -14
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +65 -17
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +108 -23
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +19 -10
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +33 -16
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +38 -18
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +91 -41
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.d.ts +31 -4
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
- package/lib/esm/Metadata/Mixin.js +44 -10
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +37 -20
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.d.ts +24 -3
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js +33 -4
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +47 -25
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +130 -51
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts +20 -4
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js +31 -4
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts +63 -27
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +102 -45
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +167 -41
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +212 -112
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +19 -19
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +25 -23
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.d.ts +24 -21
- package/lib/esm/Metadata/Unit.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js +41 -25
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.d.ts +17 -4
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js +24 -4
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.d.ts +11 -11
- package/lib/esm/PropertyTypes.d.ts.map +1 -1
- package/lib/esm/PropertyTypes.js +29 -21
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
- package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/SchemaFormatsProvider.js +142 -0
- package/lib/esm/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +8 -8
- package/lib/esm/SchemaJsonLocater.d.ts.map +1 -1
- package/lib/esm/SchemaJsonLocater.js +7 -7
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts +13 -7
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +23 -13
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +5 -5
- package/lib/esm/SchemaLoader.d.ts.map +1 -1
- package/lib/esm/SchemaLoader.js +6 -5
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/esm/SchemaPartVisitorDelegate.js +2 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js +69 -65
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts +1 -1
- package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js +9 -7
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js +2 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.d.ts +2 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js +11 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +8 -9
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts +1 -1
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js +6 -4
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +1 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +1 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js +6 -7
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/package.json +16 -14
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* additional (non-lazily-loaded) "nested" properties can be added.
|
|
21
21
|
*
|
|
22
22
|
* [!alert text="*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening." kind="warning"]
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export declare class DelayedPromise<T> implements Promise<T> {
|
|
26
26
|
/**
|
|
@@ -54,7 +54,7 @@ export declare class DelayedPromise<T> implements Promise<T> {
|
|
|
54
54
|
finally(onFinally?: (() => void) | undefined | null): Promise<T>;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* @
|
|
57
|
+
* @internal
|
|
58
58
|
*/
|
|
59
59
|
export interface NoDelayedPromiseMethods {
|
|
60
60
|
[propName: string]: any;
|
|
@@ -63,7 +63,7 @@ export interface NoDelayedPromiseMethods {
|
|
|
63
63
|
catch?: never;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* @
|
|
66
|
+
* @internal
|
|
67
67
|
*/
|
|
68
68
|
export interface DelayedPromiseWithPropsConstructor {
|
|
69
69
|
/**
|
|
@@ -76,14 +76,15 @@ export interface DelayedPromiseWithPropsConstructor {
|
|
|
76
76
|
* as if they were readonly properties of the DelayedPromiseWithProps object being constructed.
|
|
77
77
|
* @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be "started".
|
|
78
78
|
*/
|
|
79
|
-
new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>):
|
|
79
|
+
new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): TProps & DelayedPromise<TPayload>;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* @
|
|
82
|
+
* @internal
|
|
83
83
|
*/
|
|
84
84
|
export declare const DelayedPromiseWithProps: DelayedPromiseWithPropsConstructor;
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
85
|
+
/**
|
|
86
|
+
* Define the type of a DelayedPromiseWithProps instance
|
|
87
|
+
* @internal
|
|
87
88
|
*/
|
|
88
|
-
export type DelayedPromiseWithProps<TProps, TPayload> =
|
|
89
|
+
export type DelayedPromiseWithProps<TProps, TPayload> = TProps & DelayedPromise<TPayload>;
|
|
89
90
|
//# sourceMappingURL=DelayedPromise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayedPromise.d.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;;;;OAIG;IACU,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;CAG9E;AAGD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAGD;;GAEG;AACH,MAAM,WAAW,kCAAkC;IAEjD;;;;;;;;;OASG;IACH,KAAK,MAAM,SAAS,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;CAClJ;AAID;;GAEG;AAEH,eAAO,MAAM,uBAAuB,EAY9B,kCAAkC,CAAC;AAIzC;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Utils
|
|
7
7
|
*/
|
|
8
|
-
var _a;
|
|
9
8
|
/**
|
|
10
9
|
* Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)
|
|
11
10
|
* and resulting value of an asynchronous operation ***that has not yet started***.
|
|
@@ -25,7 +24,7 @@ var _a;
|
|
|
25
24
|
* additional (non-lazily-loaded) "nested" properties can be added.
|
|
26
25
|
*
|
|
27
26
|
* [!alert text="*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening." kind="warning"]
|
|
28
|
-
* @
|
|
27
|
+
* @internal
|
|
29
28
|
*/
|
|
30
29
|
export class DelayedPromise {
|
|
31
30
|
/**
|
|
@@ -33,14 +32,18 @@ export class DelayedPromise {
|
|
|
33
32
|
* @param startCallback The asynchronous callback to execute when this DelayedPromise should be "started".
|
|
34
33
|
*/
|
|
35
34
|
constructor(startCallback) {
|
|
36
|
-
// We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts
|
|
37
|
-
this[_a] = "Promise";
|
|
38
35
|
let pending;
|
|
39
36
|
this.start = async () => {
|
|
40
37
|
pending = pending || startCallback();
|
|
41
38
|
return pending;
|
|
42
39
|
};
|
|
43
40
|
}
|
|
41
|
+
// We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts
|
|
42
|
+
[Symbol.toStringTag] = "Promise";
|
|
43
|
+
/**
|
|
44
|
+
* Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).
|
|
45
|
+
*/
|
|
46
|
+
start;
|
|
44
47
|
/**
|
|
45
48
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
46
49
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
@@ -67,11 +70,10 @@ export class DelayedPromise {
|
|
|
67
70
|
return this.start().finally(onFinally);
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
_a = Symbol.toStringTag;
|
|
71
73
|
// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.
|
|
72
74
|
// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>
|
|
73
75
|
/**
|
|
74
|
-
* @
|
|
76
|
+
* @internal
|
|
75
77
|
*/
|
|
76
78
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
77
79
|
export const DelayedPromiseWithProps = (class extends DelayedPromise {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG
|
|
1
|
+
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedP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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":["/*---------------------------------------------------------------------------------------------\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,MAAM,OAAgB,cAAc;
|
|
1
|
+
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAoB/F,gBAAgB;AAChB,MAAM,OAAgB,cAAc;IACxB,cAAc,CAAiB;CAmC1C","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"]}
|
|
@@ -31,20 +31,20 @@ export declare class SchemaReadHelper<T = unknown> {
|
|
|
31
31
|
* @param schema The Schema to populate
|
|
32
32
|
* @param rawSchema The serialized data to use to populate the Schema.
|
|
33
33
|
*/
|
|
34
|
-
readSchemaInfo
|
|
34
|
+
readSchemaInfo(schema: Schema, rawSchema: T): Promise<SchemaInfo>;
|
|
35
35
|
/**
|
|
36
36
|
* Populates the given Schema from a serialized representation.
|
|
37
37
|
* @param schema The Schema to populate
|
|
38
38
|
* @param rawSchema The serialized data to use to populate the Schema.
|
|
39
39
|
*/
|
|
40
|
-
readSchema
|
|
40
|
+
readSchema(schema: Schema, rawSchema: T): Promise<Schema>;
|
|
41
41
|
private loadSchema;
|
|
42
42
|
/**
|
|
43
43
|
* Populates the given Schema from a serialized representation.
|
|
44
44
|
* @param schema The Schema to populate
|
|
45
45
|
* @param rawSchema The serialized data to use to populate the Schema.
|
|
46
46
|
*/
|
|
47
|
-
readSchemaSync
|
|
47
|
+
readSchemaSync(schema: Schema, rawSchema: T): Schema;
|
|
48
48
|
/**
|
|
49
49
|
* Ensures that the schema references can be located and adds them to the schema.
|
|
50
50
|
* @param ref The object to read the SchemaReference's props from.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Helper.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/Helper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAA2B,UAAU,
|
|
1
|
+
{"version":3,"file":"Helper.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/Helper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAA2B,UAAU,EAAiB,MAAM,eAAe,CAAC;AAWnF,OAAO,EAAiB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,EAAE,kBAAkB,EAA6B,M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AStB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IASpB;;;;OAIG;YACW,kBAAkB;IAehC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;;;OAIG;YACW,YAAY;IAO1B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;;OAIG;YACW,gBAAgB;IAS9B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;OAIG;YACW,UAAU;IAYxB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAatB;;;;;OAKG;YACW,SAAS;IAsBvB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAsBrB;;;;OAIG;YACW,eAAe;IAY7B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;OAIG;YACW,SAAS;IAavB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAarB;;;;OAIG;YACW,qBAAqB;IAWnC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;OAIG;YACW,0BAA0B;IAYxC;;;;OAIG;IACH,OAAO,CAAC,8BAA8B;IAatC;;;;;;OAMG;YACW,iBAAiB;IAmD/B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAkD7B;;;;;OAKG;YACW,YAAY;IAa1B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;OAKG;YACW,oBAAoB;IAmBlC;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;WAYlB,oBAAoB,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO;CAM3E"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { SchemaContext } from "../Context";
|
|
6
6
|
import { parsePrimitiveType, parseSchemaItemType, SchemaItemType, SchemaMatchType } from "../ECObjects";
|
|
7
|
-
import {
|
|
7
|
+
import { ECSchemaError, ECSchemaStatus } from "../Exception";
|
|
8
8
|
import { Schema } from "../Metadata/Schema";
|
|
9
9
|
import { SchemaItem } from "../Metadata/SchemaItem";
|
|
10
10
|
import { ECVersion, SchemaItemKey, SchemaKey } from "../SchemaKey";
|
|
@@ -17,6 +17,14 @@ import { SchemaGraph } from "../utils/SchemaGraph";
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export class SchemaReadHelper {
|
|
20
|
+
_context;
|
|
21
|
+
_visitorHelper;
|
|
22
|
+
_parserType;
|
|
23
|
+
_parser;
|
|
24
|
+
// Cache of the schema currently being loaded. This schema is in the _context but to
|
|
25
|
+
// avoid going back to the context every time, the cache is used.
|
|
26
|
+
_schema;
|
|
27
|
+
_schemaInfo;
|
|
20
28
|
constructor(parserType, context, visitor) {
|
|
21
29
|
this._context = (undefined !== context) ? context : new SchemaContext();
|
|
22
30
|
this._visitorHelper = visitor ? new SchemaPartVisitorDelegate(visitor) : undefined;
|
|
@@ -33,7 +41,7 @@ export class SchemaReadHelper {
|
|
|
33
41
|
// Ensure context matches schema context
|
|
34
42
|
if (schema.context) {
|
|
35
43
|
if (this._context !== schema.context)
|
|
36
|
-
throw new
|
|
44
|
+
throw new ECSchemaError(ECSchemaStatus.DifferentSchemaContexts, "The SchemaContext of the schema must be the same SchemaContext held by the SchemaReadHelper.");
|
|
37
45
|
}
|
|
38
46
|
else {
|
|
39
47
|
schema.setContext(this._context);
|
|
@@ -42,10 +50,11 @@ export class SchemaReadHelper {
|
|
|
42
50
|
// Loads all of the properties on the Schema object
|
|
43
51
|
await schema.fromJSON(this._parser.parseSchema());
|
|
44
52
|
this._schema = schema;
|
|
45
|
-
const
|
|
53
|
+
const schemaInfoReferences = [];
|
|
54
|
+
const schemaInfo = { schemaKey: schema.schemaKey, alias: schema.alias, references: schemaInfoReferences };
|
|
46
55
|
for (const reference of this._parser.getReferences()) {
|
|
47
56
|
const refKey = new SchemaKey(reference.name, ECVersion.fromString(reference.version));
|
|
48
|
-
|
|
57
|
+
schemaInfoReferences.push({ schemaKey: refKey });
|
|
49
58
|
}
|
|
50
59
|
this._schemaInfo = schemaInfo;
|
|
51
60
|
// Need to add this schema to the context to be able to locate schemaItems within the context.
|
|
@@ -65,7 +74,7 @@ export class SchemaReadHelper {
|
|
|
65
74
|
}
|
|
66
75
|
const cachedSchema = await this._context.getCachedSchema(this._schemaInfo.schemaKey, SchemaMatchType.Latest);
|
|
67
76
|
if (undefined === cachedSchema)
|
|
68
|
-
throw new
|
|
77
|
+
throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not load schema ${schema.schemaKey.toString()}`);
|
|
69
78
|
return cachedSchema;
|
|
70
79
|
}
|
|
71
80
|
/* Finish loading the rest of the schema */
|
|
@@ -136,7 +145,7 @@ export class SchemaReadHelper {
|
|
|
136
145
|
async loadSchemaReference(schemaInfo, refKey) {
|
|
137
146
|
const refSchema = await this._context.getSchema(refKey, SchemaMatchType.LatestWriteCompatible);
|
|
138
147
|
if (undefined === refSchema)
|
|
139
|
-
throw new
|
|
148
|
+
throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${refKey.name}.${refKey.version.toString()}, of ${schemaInfo.schemaKey.name}`);
|
|
140
149
|
await this._schema.addReference(refSchema);
|
|
141
150
|
const results = this.validateSchemaReferences(this._schema);
|
|
142
151
|
let errorMessage = "";
|
|
@@ -144,7 +153,7 @@ export class SchemaReadHelper {
|
|
|
144
153
|
errorMessage += `${result}\r\n`;
|
|
145
154
|
}
|
|
146
155
|
if (errorMessage) {
|
|
147
|
-
throw new
|
|
156
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
159
|
/**
|
|
@@ -155,7 +164,7 @@ export class SchemaReadHelper {
|
|
|
155
164
|
const schemaKey = new SchemaKey(ref.name, ECVersion.fromString(ref.version));
|
|
156
165
|
const refSchema = this._context.getSchemaSync(schemaKey, SchemaMatchType.LatestWriteCompatible);
|
|
157
166
|
if (!refSchema)
|
|
158
|
-
throw new
|
|
167
|
+
throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not locate the referenced schema, ${ref.name}.${ref.version}, of ${this._schema.schemaKey.name}`);
|
|
159
168
|
this._schema.addReferenceSync(refSchema);
|
|
160
169
|
SchemaGraph.generateGraphSync(this._schema).throwIfCycles();
|
|
161
170
|
const results = this.validateSchemaReferences(this._schema);
|
|
@@ -164,7 +173,7 @@ export class SchemaReadHelper {
|
|
|
164
173
|
errorMessage += `${result}\r\n`;
|
|
165
174
|
}
|
|
166
175
|
if (errorMessage) {
|
|
167
|
-
throw new
|
|
176
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `${errorMessage}`);
|
|
168
177
|
}
|
|
169
178
|
}
|
|
170
179
|
/**
|
|
@@ -350,7 +359,7 @@ export class SchemaReadHelper {
|
|
|
350
359
|
if (undefined !== schema && -1 !== fullOrQualifiedName.indexOf(":")) {
|
|
351
360
|
const refName = schema.getReferenceNameByAlias(schemaName);
|
|
352
361
|
if (undefined === refName)
|
|
353
|
-
throw new
|
|
362
|
+
throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema, `Could not resolve schema alias '${schemaName}' for schema item '${itemName}.`);
|
|
354
363
|
return [refName, itemName];
|
|
355
364
|
}
|
|
356
365
|
return [schemaName, itemName];
|
|
@@ -369,7 +378,7 @@ export class SchemaReadHelper {
|
|
|
369
378
|
const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);
|
|
370
379
|
const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());
|
|
371
380
|
if (undefined === schemaName || 0 === schemaName.length)
|
|
372
|
-
throw new
|
|
381
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);
|
|
373
382
|
if (isInThisSchema) {
|
|
374
383
|
schemaItem = await this._schema.getItem(itemName);
|
|
375
384
|
if (schemaItem)
|
|
@@ -384,11 +393,11 @@ export class SchemaReadHelper {
|
|
|
384
393
|
loadCallBack(schemaItem);
|
|
385
394
|
return schemaItem;
|
|
386
395
|
}
|
|
387
|
-
throw new
|
|
396
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);
|
|
388
397
|
}
|
|
389
398
|
schemaItem = await this._context.getSchemaItem(new SchemaItemKey(itemName, new SchemaKey(schemaName)));
|
|
390
399
|
if (undefined === schemaItem)
|
|
391
|
-
throw new
|
|
400
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);
|
|
392
401
|
return schemaItem;
|
|
393
402
|
}
|
|
394
403
|
/**
|
|
@@ -405,7 +414,7 @@ export class SchemaReadHelper {
|
|
|
405
414
|
const [schemaName, itemName] = SchemaReadHelper.resolveSchemaAndItemName(name, this._schema);
|
|
406
415
|
const isInThisSchema = (this._schema && this._schema.name.toLowerCase() === schemaName.toLowerCase());
|
|
407
416
|
if (undefined === schemaName || schemaName.length === 0)
|
|
408
|
-
throw new
|
|
417
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The SchemaItem ${name} is invalid without a schema name`);
|
|
409
418
|
if (isInThisSchema && undefined === this._schema.getItemSync(itemName)) {
|
|
410
419
|
const foundItem = this._parser.findItem(itemName);
|
|
411
420
|
if (foundItem) {
|
|
@@ -417,11 +426,11 @@ export class SchemaReadHelper {
|
|
|
417
426
|
loadCallBack(schemaItem);
|
|
418
427
|
return schemaItem;
|
|
419
428
|
}
|
|
420
|
-
throw new
|
|
429
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);
|
|
421
430
|
}
|
|
422
431
|
schemaItem = this._context.getSchemaItemSync(new SchemaItemKey(itemName, new SchemaKey(schemaName)));
|
|
423
432
|
if (undefined === schemaItem)
|
|
424
|
-
throw new
|
|
433
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to locate SchemaItem ${name}.`);
|
|
425
434
|
return schemaItem;
|
|
426
435
|
}
|
|
427
436
|
/**
|
|
@@ -725,16 +734,16 @@ export class SchemaReadHelper {
|
|
|
725
734
|
const loadTypeName = async (typeName) => {
|
|
726
735
|
if (undefined === parsePrimitiveType(typeName)) {
|
|
727
736
|
if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))
|
|
728
|
-
return
|
|
737
|
+
return ECSchemaStatus.NewerECSpecVersion;
|
|
729
738
|
await this.findSchemaItem(typeName);
|
|
730
739
|
}
|
|
731
|
-
return
|
|
740
|
+
return ECSchemaStatus.Success;
|
|
732
741
|
};
|
|
733
742
|
const lowerCasePropType = propType.toLowerCase();
|
|
734
743
|
switch (lowerCasePropType) {
|
|
735
744
|
case "primitiveproperty":
|
|
736
745
|
const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);
|
|
737
|
-
if (await loadTypeName(primPropertyProps.typeName) ===
|
|
746
|
+
if (await loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)
|
|
738
747
|
primPropertyProps.typeName = "string";
|
|
739
748
|
const primProp = await classObj.createPrimitiveProperty(propName, primPropertyProps.typeName);
|
|
740
749
|
return this.loadProperty(primProp, primPropertyProps, rawProperty);
|
|
@@ -745,7 +754,7 @@ export class SchemaReadHelper {
|
|
|
745
754
|
return this.loadProperty(structProp, structPropertyProps, rawProperty);
|
|
746
755
|
case "primitivearrayproperty":
|
|
747
756
|
const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);
|
|
748
|
-
if (await loadTypeName(primArrPropertyProps.typeName) ===
|
|
757
|
+
if (await loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)
|
|
749
758
|
primArrPropertyProps.typeName = "string";
|
|
750
759
|
const primArrProp = await classObj.createPrimitiveArrayProperty(propName, primArrPropertyProps.typeName);
|
|
751
760
|
return this.loadProperty(primArrProp, primArrPropertyProps, rawProperty);
|
|
@@ -756,7 +765,7 @@ export class SchemaReadHelper {
|
|
|
756
765
|
return this.loadProperty(structArrProp, structArrPropertyProps, rawProperty);
|
|
757
766
|
case "navigationproperty":
|
|
758
767
|
if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)
|
|
759
|
-
throw new
|
|
768
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);
|
|
760
769
|
const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);
|
|
761
770
|
await this.findSchemaItem(navPropertyProps.relationshipName);
|
|
762
771
|
const navProp = await classObj.createNavigationProperty(propName, navPropertyProps.relationshipName, navPropertyProps.direction);
|
|
@@ -774,16 +783,16 @@ export class SchemaReadHelper {
|
|
|
774
783
|
const loadTypeName = (typeName) => {
|
|
775
784
|
if (undefined === parsePrimitiveType(typeName)) {
|
|
776
785
|
if (SchemaReadHelper.isECSpecVersionNewer(this._parser.getECSpecVersion))
|
|
777
|
-
return
|
|
786
|
+
return ECSchemaStatus.NewerECSpecVersion;
|
|
778
787
|
this.findSchemaItemSync(typeName);
|
|
779
788
|
}
|
|
780
|
-
return
|
|
789
|
+
return ECSchemaStatus.Success;
|
|
781
790
|
};
|
|
782
791
|
const lowerCasePropType = propType.toLowerCase();
|
|
783
792
|
switch (lowerCasePropType) {
|
|
784
793
|
case "primitiveproperty":
|
|
785
794
|
const primPropertyProps = this._parser.parsePrimitiveProperty(rawProperty);
|
|
786
|
-
if (loadTypeName(primPropertyProps.typeName) ===
|
|
795
|
+
if (loadTypeName(primPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)
|
|
787
796
|
primPropertyProps.typeName = "string";
|
|
788
797
|
const primProp = classObj.createPrimitivePropertySync(propName, primPropertyProps.typeName);
|
|
789
798
|
return this.loadPropertySync(primProp, primPropertyProps, rawProperty);
|
|
@@ -794,7 +803,7 @@ export class SchemaReadHelper {
|
|
|
794
803
|
return this.loadPropertySync(structProp, structPropertyProps, rawProperty);
|
|
795
804
|
case "primitivearrayproperty":
|
|
796
805
|
const primArrPropertyProps = this._parser.parsePrimitiveArrayProperty(rawProperty);
|
|
797
|
-
if (loadTypeName(primArrPropertyProps.typeName) ===
|
|
806
|
+
if (loadTypeName(primArrPropertyProps.typeName) === ECSchemaStatus.NewerECSpecVersion)
|
|
798
807
|
primArrPropertyProps.typeName = "string";
|
|
799
808
|
const primArrProp = classObj.createPrimitiveArrayPropertySync(propName, primArrPropertyProps.typeName);
|
|
800
809
|
return this.loadPropertySync(primArrProp, primArrPropertyProps, rawProperty);
|
|
@@ -805,7 +814,7 @@ export class SchemaReadHelper {
|
|
|
805
814
|
return this.loadPropertySync(structArrProp, structArrPropertyProps, rawProperty);
|
|
806
815
|
case "navigationproperty":
|
|
807
816
|
if (classObj.schemaItemType !== SchemaItemType.EntityClass && classObj.schemaItemType !== SchemaItemType.RelationshipClass && classObj.schemaItemType !== SchemaItemType.Mixin)
|
|
808
|
-
throw new
|
|
817
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Navigation Property ${classObj.name}.${propName} is invalid, because only EntityClasses, Mixins, and RelationshipClasses can have NavigationProperties.`);
|
|
809
818
|
const navPropertyProps = this._parser.parseNavigationProperty(rawProperty);
|
|
810
819
|
this.findSchemaItemSync(navPropertyProps.relationshipName);
|
|
811
820
|
const navProp = classObj.createNavigationPropertySync(propName, navPropertyProps.relationshipName, navPropertyProps.direction);
|
|
@@ -857,7 +866,7 @@ export class SchemaReadHelper {
|
|
|
857
866
|
// If custom attribute exist within the context and is referenced, validate the reference is defined in the container's schema
|
|
858
867
|
if (caClass && caClass.key.schemaName !== container.schema.name &&
|
|
859
868
|
!container.schema.getReferenceSync(caClass.key.schemaName)) {
|
|
860
|
-
throw new
|
|
869
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Unable to load custom attribute ${caClass.fullName} from container ${container.fullName}, ${caClass.key.schemaName} reference not defined`);
|
|
861
870
|
}
|
|
862
871
|
// Second tuple entry ia a function that provides the CA instance.
|
|
863
872
|
const provider = providerTuple[1];
|