@itwin/ecschema-metadata 4.8.0-dev.3 → 4.8.0-dev.31
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 +41 -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.d.ts +4 -0
- package/lib/cjs/Deserialization/JsonProps.d.ts.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/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +0 -6
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +0 -8
- 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.d.ts +7 -3
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +16 -10
- 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.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +3 -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.d.ts +14 -0
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +21 -0
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +5 -0
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +7 -0
- 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.d.ts +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js +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/esm/Constants.d.ts +24 -0
- package/lib/esm/Constants.d.ts.map +1 -0
- package/lib/esm/Constants.js +30 -0
- package/lib/esm/Constants.js.map +1 -0
- package/lib/esm/Context.d.ts +219 -0
- package/lib/esm/Context.d.ts.map +1 -0
- package/lib/esm/Context.js +321 -0
- package/lib/esm/Context.js.map +1 -0
- package/lib/esm/DelayedPromise.d.ts +89 -0
- package/lib/esm/DelayedPromise.d.ts.map +1 -0
- package/lib/esm/DelayedPromise.js +88 -0
- package/lib/esm/DelayedPromise.js.map +1 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts +46 -0
- package/lib/esm/Deserialization/AbstractParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/AbstractParser.js +8 -0
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -0
- package/lib/esm/Deserialization/Helper.d.ts +263 -0
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -0
- package/lib/esm/Deserialization/Helper.js +871 -0
- package/lib/esm/Deserialization/Helper.js.map +1 -0
- package/lib/esm/Deserialization/JsonParser.d.ts +166 -0
- package/lib/esm/Deserialization/JsonParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/JsonParser.js +677 -0
- package/lib/esm/Deserialization/JsonParser.js.map +1 -0
- package/lib/esm/Deserialization/JsonProps.d.ts +273 -0
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -0
- package/lib/esm/Deserialization/JsonProps.js +9 -0
- package/lib/esm/Deserialization/JsonProps.js.map +1 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts +35 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.d.ts.map +1 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.js +74 -0
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -0
- package/lib/esm/Deserialization/XmlParser.d.ts +86 -0
- package/lib/esm/Deserialization/XmlParser.d.ts.map +1 -0
- package/lib/esm/Deserialization/XmlParser.js +970 -0
- package/lib/esm/Deserialization/XmlParser.js.map +1 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +55 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.js +172 -0
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -0
- package/lib/esm/ECName.d.ts +31 -0
- package/lib/esm/ECName.d.ts.map +1 -0
- package/lib/esm/ECName.js +82 -0
- package/lib/esm/ECName.js.map +1 -0
- package/lib/esm/ECObjects.d.ts +166 -0
- package/lib/esm/ECObjects.d.ts.map +1 -0
- package/lib/esm/ECObjects.js +422 -0
- package/lib/esm/ECObjects.js.map +1 -0
- package/lib/esm/Exception.d.ts +45 -0
- package/lib/esm/Exception.d.ts.map +1 -0
- package/lib/esm/Exception.js +82 -0
- package/lib/esm/Exception.js.map +1 -0
- package/lib/esm/Interfaces.d.ts +79 -0
- package/lib/esm/Interfaces.d.ts.map +1 -0
- package/lib/esm/Interfaces.js +9 -0
- package/lib/esm/Interfaces.js.map +1 -0
- package/lib/esm/Metadata/Class.d.ts +245 -0
- package/lib/esm/Metadata/Class.d.ts.map +1 -0
- package/lib/esm/Metadata/Class.js +552 -0
- package/lib/esm/Metadata/Class.js.map +1 -0
- package/lib/esm/Metadata/Constant.d.ts +65 -0
- package/lib/esm/Metadata/Constant.d.ts.map +1 -0
- package/lib/esm/Metadata/Constant.js +119 -0
- package/lib/esm/Metadata/Constant.js.map +1 -0
- package/lib/esm/Metadata/CustomAttribute.d.ts +24 -0
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -0
- package/lib/esm/Metadata/CustomAttribute.js +24 -0
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -0
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +44 -0
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -0
- package/lib/esm/Metadata/CustomAttributeClass.js +70 -0
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -0
- package/lib/esm/Metadata/EntityClass.d.ts +78 -0
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -0
- package/lib/esm/Metadata/EntityClass.js +224 -0
- package/lib/esm/Metadata/EntityClass.js.map +1 -0
- package/lib/esm/Metadata/Enumeration.d.ts +87 -0
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -0
- package/lib/esm/Metadata/Enumeration.js +155 -0
- package/lib/esm/Metadata/Enumeration.js.map +1 -0
- package/lib/esm/Metadata/Format.d.ts +99 -0
- package/lib/esm/Metadata/Format.d.ts.map +1 -0
- package/lib/esm/Metadata/Format.js +238 -0
- package/lib/esm/Metadata/Format.js.map +1 -0
- package/lib/esm/Metadata/InvertedUnit.d.ts +50 -0
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -0
- package/lib/esm/Metadata/InvertedUnit.js +93 -0
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -0
- package/lib/esm/Metadata/KindOfQuantity.d.ts +72 -0
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -0
- package/lib/esm/Metadata/KindOfQuantity.js +229 -0
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -0
- package/lib/esm/Metadata/Mixin.d.ts +55 -0
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -0
- package/lib/esm/Metadata/Mixin.js +109 -0
- package/lib/esm/Metadata/Mixin.js.map +1 -0
- package/lib/esm/Metadata/OverrideFormat.d.ts +68 -0
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -0
- package/lib/esm/Metadata/OverrideFormat.js +124 -0
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -0
- package/lib/esm/Metadata/Phenomenon.d.ts +34 -0
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -0
- package/lib/esm/Metadata/Phenomenon.js +55 -0
- package/lib/esm/Metadata/Phenomenon.js.map +1 -0
- package/lib/esm/Metadata/Property.d.ts +247 -0
- package/lib/esm/Metadata/Property.d.ts.map +1 -0
- package/lib/esm/Metadata/Property.js +565 -0
- package/lib/esm/Metadata/Property.js.map +1 -0
- package/lib/esm/Metadata/PropertyCategory.d.ts +40 -0
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -0
- package/lib/esm/Metadata/PropertyCategory.js +57 -0
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -0
- package/lib/esm/Metadata/RelationshipClass.d.ts +170 -0
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -0
- package/lib/esm/Metadata/RelationshipClass.js +380 -0
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -0
- package/lib/esm/Metadata/Schema.d.ts +330 -0
- package/lib/esm/Metadata/Schema.d.ts.map +1 -0
- package/lib/esm/Metadata/Schema.js +570 -0
- package/lib/esm/Metadata/Schema.js.map +1 -0
- package/lib/esm/Metadata/SchemaItem.d.ts +67 -0
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -0
- package/lib/esm/Metadata/SchemaItem.js +140 -0
- package/lib/esm/Metadata/SchemaItem.js.map +1 -0
- package/lib/esm/Metadata/Unit.d.ts +77 -0
- package/lib/esm/Metadata/Unit.d.ts.map +1 -0
- package/lib/esm/Metadata/Unit.js +158 -0
- package/lib/esm/Metadata/Unit.js.map +1 -0
- package/lib/esm/Metadata/UnitSystem.d.ts +21 -0
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -0
- package/lib/esm/Metadata/UnitSystem.js +25 -0
- package/lib/esm/Metadata/UnitSystem.js.map +1 -0
- package/lib/esm/PropertyTypes.d.ts +50 -0
- package/lib/esm/PropertyTypes.d.ts.map +1 -0
- package/lib/esm/PropertyTypes.js +88 -0
- package/lib/esm/PropertyTypes.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +42 -0
- package/lib/esm/SchemaJsonLocater.d.ts.map +1 -0
- package/lib/esm/SchemaJsonLocater.js +54 -0
- package/lib/esm/SchemaJsonLocater.js.map +1 -0
- package/lib/esm/SchemaKey.d.ts +111 -0
- package/lib/esm/SchemaKey.d.ts.map +1 -0
- package/lib/esm/SchemaKey.js +214 -0
- package/lib/esm/SchemaKey.js.map +1 -0
- package/lib/esm/SchemaLoader.d.ts +32 -0
- package/lib/esm/SchemaLoader.d.ts.map +1 -0
- package/lib/esm/SchemaLoader.js +53 -0
- package/lib/esm/SchemaLoader.js.map +1 -0
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +275 -0
- package/lib/esm/SchemaPartVisitorDelegate.d.ts.map +1 -0
- package/lib/esm/SchemaPartVisitorDelegate.js +209 -0
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -0
- package/lib/esm/UnitConversion/Graph.d.ts +35 -0
- package/lib/esm/UnitConversion/Graph.d.ts.map +1 -0
- package/lib/esm/UnitConversion/Graph.js +80 -0
- package/lib/esm/UnitConversion/Graph.js.map +1 -0
- package/lib/esm/UnitConversion/Parser.d.ts +9 -0
- package/lib/esm/UnitConversion/Parser.d.ts.map +1 -0
- package/lib/esm/UnitConversion/Parser.js +39 -0
- package/lib/esm/UnitConversion/Parser.js.map +1 -0
- package/lib/esm/UnitConversion/UnitConversion.d.ts +46 -0
- package/lib/esm/UnitConversion/UnitConversion.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitConversion.js +74 -0
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -0
- package/lib/esm/UnitConversion/UnitConverter.d.ts +40 -0
- package/lib/esm/UnitConversion/UnitConverter.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitConverter.js +113 -0
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts +44 -0
- package/lib/esm/UnitConversion/UnitTree.d.ts.map +1 -0
- package/lib/esm/UnitConversion/UnitTree.js +165 -0
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts +78 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.d.ts.map +1 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.js +231 -0
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -0
- package/lib/esm/Validation/SchemaWalker.d.ts +24 -0
- package/lib/esm/Validation/SchemaWalker.d.ts.map +1 -0
- package/lib/esm/Validation/SchemaWalker.js +50 -0
- package/lib/esm/Validation/SchemaWalker.js.map +1 -0
- package/lib/esm/ecschema-metadata.d.ts +52 -0
- package/lib/esm/ecschema-metadata.d.ts.map +1 -0
- package/lib/esm/ecschema-metadata.js +55 -0
- package/lib/esm/ecschema-metadata.js.map +1 -0
- package/lib/esm/utils/SchemaGraph.d.ts +44 -0
- package/lib/esm/utils/SchemaGraph.d.ts.map +1 -0
- package/lib/esm/utils/SchemaGraph.js +111 -0
- package/lib/esm/utils/SchemaGraph.js.map +1 -0
- package/package.json +9 -7
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export declare class ECStringConstants {
|
|
5
|
+
static readonly RELATIONSHIP_END_SOURCE: string;
|
|
6
|
+
static readonly RELATIONSHIP_END_TARGET: string;
|
|
7
|
+
static readonly CONTAINERTYPE_SCHEMA: string;
|
|
8
|
+
static readonly CONTAINERTYPE_ENTITYCLASS: string;
|
|
9
|
+
static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string;
|
|
10
|
+
static readonly CONTAINERTYPE_STRUCTCLASS: string;
|
|
11
|
+
static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string;
|
|
12
|
+
static readonly CONTAINERTYPE_ANYCLASS: string;
|
|
13
|
+
static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string;
|
|
14
|
+
static readonly CONTAINERTYPE_STRUCTPROPERTY: string;
|
|
15
|
+
static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string;
|
|
16
|
+
static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string;
|
|
17
|
+
static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string;
|
|
18
|
+
static readonly CONTAINERTYPE_ANYPROPERTY: string;
|
|
19
|
+
static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string;
|
|
20
|
+
static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string;
|
|
21
|
+
static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string;
|
|
22
|
+
static readonly CONTAINERTYPE_ANY: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,iBAAiB;IAE5B,gBAAuB,uBAAuB,EAAE,MAAM,CAAY;IAClE,gBAAuB,uBAAuB,EAAE,MAAM,CAAY;IAGlE,gBAAuB,oBAAoB,EAAE,MAAM,CAAY;IAC/D,gBAAuB,yBAAyB,EAAE,MAAM,CAAiB;IACzE,gBAAuB,kCAAkC,EAAE,MAAM,CAA0B;IAC3F,gBAAuB,yBAAyB,EAAE,MAAM,CAAiB;IACzE,gBAAuB,+BAA+B,EAAE,MAAM,CAAuB;IACrF,gBAAuB,sBAAsB,EAAE,MAAM,CAAc;IAEnE,gBAAuB,+BAA+B,EAAE,MAAM,CAAuB;IACrF,gBAAuB,4BAA4B,EAAE,MAAM,CAAoB;IAC/E,gBAAuB,oCAAoC,EAAE,MAAM,CAAmB;IACtF,gBAAuB,iCAAiC,EAAE,MAAM,CAAyB;IACzF,gBAAuB,gCAAgC,EAAE,MAAM,CAAwB;IACvF,gBAAuB,yBAAyB,EAAE,MAAM,CAAiB;IAEzE,gBAAuB,0CAA0C,EAAE,MAAM,CAAkC;IAC3G,gBAAuB,0CAA0C,EAAE,MAAM,CAAkC;IAC3G,gBAAuB,uCAAuC,EAAE,MAAM,CAA+B;IAErG,gBAAuB,iBAAiB,EAAE,MAAM,CAAS;CAC1D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export class ECStringConstants {
|
|
9
|
+
}
|
|
10
|
+
// Relationship End
|
|
11
|
+
ECStringConstants.RELATIONSHIP_END_SOURCE = "Source";
|
|
12
|
+
ECStringConstants.RELATIONSHIP_END_TARGET = "Target";
|
|
13
|
+
// Container Type
|
|
14
|
+
ECStringConstants.CONTAINERTYPE_SCHEMA = "Schema";
|
|
15
|
+
ECStringConstants.CONTAINERTYPE_ENTITYCLASS = "EntityClass";
|
|
16
|
+
ECStringConstants.CONTAINERTYPE_CUSTOMATTRIBUTECLASS = "CustomAttributeClass";
|
|
17
|
+
ECStringConstants.CONTAINERTYPE_STRUCTCLASS = "StructClass";
|
|
18
|
+
ECStringConstants.CONTAINERTYPE_RELATIONSHIPCLASS = "RelationshipClass";
|
|
19
|
+
ECStringConstants.CONTAINERTYPE_ANYCLASS = "AnyClass";
|
|
20
|
+
ECStringConstants.CONTAINERTYPE_PRIMITIVEPROPERTY = "PrimitiveProperty";
|
|
21
|
+
ECStringConstants.CONTAINERTYPE_STRUCTPROPERTY = "StructProperty";
|
|
22
|
+
ECStringConstants.CONTAINERTYPE_PRIMITIVEARRAYPROPERTY = "ArrayProperty";
|
|
23
|
+
ECStringConstants.CONTAINERTYPE_STRUCTARRAYPROPERTY = "StructArrayProperty";
|
|
24
|
+
ECStringConstants.CONTAINERTYPE_NAVIGATIONPROPERTY = "NavigationProperty";
|
|
25
|
+
ECStringConstants.CONTAINERTYPE_ANYPROPERTY = "AnyProperty";
|
|
26
|
+
ECStringConstants.CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT = "SourceRelationshipConstraint";
|
|
27
|
+
ECStringConstants.CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT = "TargetRelationshipConstraint";
|
|
28
|
+
ECStringConstants.CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT = "AnyRelationshipConstraint";
|
|
29
|
+
ECStringConstants.CONTAINERTYPE_ANY = "Any";
|
|
30
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;;AAC5B,mBAAmB;AACI,yCAAuB,GAAW,QAAQ,CAAC;AAC3C,yCAAuB,GAAW,QAAQ,CAAC;AAElE,iBAAiB;AACM,sCAAoB,GAAW,QAAQ,CAAC;AACxC,2CAAyB,GAAW,aAAa,CAAC;AAClD,oDAAkC,GAAW,sBAAsB,CAAC;AACpE,2CAAyB,GAAW,aAAa,CAAC;AAClD,iDAA+B,GAAW,mBAAmB,CAAC;AAC9D,wCAAsB,GAAW,UAAU,CAAC;AAE5C,iDAA+B,GAAW,mBAAmB,CAAC;AAC9D,8CAA4B,GAAW,gBAAgB,CAAC;AACxD,sDAAoC,GAAW,eAAe,CAAC;AAC/D,mDAAiC,GAAW,qBAAqB,CAAC;AAClE,kDAAgC,GAAW,oBAAoB,CAAC;AAChE,2CAAyB,GAAW,aAAa,CAAC;AAElD,4DAA0C,GAAW,8BAA8B,CAAC;AACpF,4DAA0C,GAAW,8BAA8B,CAAC;AACpF,yDAAuC,GAAW,2BAA2B,CAAC;AAE9E,mCAAiB,GAAW,KAAK,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\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"]}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { SchemaMatchType } from "./ECObjects";
|
|
2
|
+
import { SchemaInfo } from "./Interfaces";
|
|
3
|
+
import { Schema } from "./Metadata/Schema";
|
|
4
|
+
import { SchemaItem } from "./Metadata/SchemaItem";
|
|
5
|
+
import { SchemaItemKey, SchemaKey } from "./SchemaKey";
|
|
6
|
+
/**
|
|
7
|
+
* The interface defines what is needed to be an `ISchemaLocater`.
|
|
8
|
+
* A Schema Locater loads the requested schema if it can or returns undefined.
|
|
9
|
+
* Schema Locaters should always load the schema on each request and should not hold a cache of schemas.
|
|
10
|
+
* Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`
|
|
11
|
+
* and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface ISchemaLocater {
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to get a schema from the locater. Yields undefined if no matching schema is found.
|
|
17
|
+
* For schemas that may have references, construct and call through a SchemaContext instead.
|
|
18
|
+
* @param schemaKey key to look up
|
|
19
|
+
* @param matchType how to match key against candidate schemas
|
|
20
|
+
* @param context context for loading schema references
|
|
21
|
+
*/
|
|
22
|
+
getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
25
|
+
* May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.
|
|
26
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
27
|
+
* @param matchType The match type to use when locating the schema
|
|
28
|
+
*/
|
|
29
|
+
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Attempts to get a schema from the locater. Yields undefined if no matching schema is found.
|
|
32
|
+
* For schemas that may have references, construct and call through a SchemaContext instead.
|
|
33
|
+
* @param schemaKey key to look up
|
|
34
|
+
* @param matchType how to match key against candidate schemas
|
|
35
|
+
* @param context context for loading schema references
|
|
36
|
+
*/
|
|
37
|
+
getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @beta
|
|
41
|
+
*/
|
|
42
|
+
export interface ISchemaItemLocater {
|
|
43
|
+
getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export declare class SchemaCache implements ISchemaLocater {
|
|
49
|
+
private _schema;
|
|
50
|
+
constructor();
|
|
51
|
+
get count(): number;
|
|
52
|
+
private loadedSchemaExists;
|
|
53
|
+
private schemaPromiseExists;
|
|
54
|
+
private findEntry;
|
|
55
|
+
private removeSchemaPromise;
|
|
56
|
+
private removeEntry;
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.
|
|
59
|
+
* @param schemaKey The key to search for.
|
|
60
|
+
*/
|
|
61
|
+
schemaExists(schemaKey: Readonly<SchemaKey>): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
64
|
+
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache
|
|
65
|
+
* @param schemaInfo An object with the schema key for the schema being loaded and it's references
|
|
66
|
+
* @param schema The partially loaded schema that the promise will fulfill
|
|
67
|
+
* @param schemaPromise The schema promise to add to the cache.
|
|
68
|
+
*/
|
|
69
|
+
addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
72
|
+
* @param schema The schema to add to the cache.
|
|
73
|
+
*/
|
|
74
|
+
addSchema<T extends Schema>(schema: T): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
77
|
+
* @param schema The schema to add to the cache.
|
|
78
|
+
*/
|
|
79
|
+
addSchemaSync<T extends Schema>(schema: T): void;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the schema which matches the provided SchemaKey.
|
|
82
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
83
|
+
* @param matchType The match type to use when locating the schema
|
|
84
|
+
*/
|
|
85
|
+
getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
|
|
86
|
+
/**
|
|
87
|
+
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
88
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
89
|
+
* @param matchType The match type to use when locating the schema
|
|
90
|
+
*/
|
|
91
|
+
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<SchemaInfo | undefined>;
|
|
92
|
+
/**
|
|
93
|
+
* Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.
|
|
94
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
95
|
+
* @param matchType The match type to use when locating the schema
|
|
96
|
+
*/
|
|
97
|
+
getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): T | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.
|
|
100
|
+
* Does not include schema items from schemas that are not completely loaded yet.
|
|
101
|
+
*/
|
|
102
|
+
getSchemaItems(): IterableIterator<SchemaItem>;
|
|
103
|
+
/**
|
|
104
|
+
* Gets all the schemas from the schema cache.
|
|
105
|
+
* Does not include schemas from schemas that are not completely loaded yet.
|
|
106
|
+
* @returns An array of Schema objects.
|
|
107
|
+
*/
|
|
108
|
+
getAllSchemas(): Schema[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The SchemaContext, context object is used to facilitate schema and schema item location.
|
|
112
|
+
*
|
|
113
|
+
* The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.
|
|
114
|
+
*
|
|
115
|
+
* The context is made up of a group of Schema Locators.
|
|
116
|
+
* @beta
|
|
117
|
+
*/
|
|
118
|
+
export declare class SchemaContext implements ISchemaItemLocater {
|
|
119
|
+
private _locaters;
|
|
120
|
+
private _knownSchemas;
|
|
121
|
+
constructor();
|
|
122
|
+
addLocater(locater: ISchemaLocater): void;
|
|
123
|
+
/**
|
|
124
|
+
* Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
|
|
125
|
+
* @param schema The schema to add to this context
|
|
126
|
+
*/
|
|
127
|
+
addSchema(schema: Schema): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Adds the schema to this context
|
|
130
|
+
* @param schema The schema to add to this context
|
|
131
|
+
*/
|
|
132
|
+
addSchemaSync(schema: Schema): void;
|
|
133
|
+
/**
|
|
134
|
+
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
135
|
+
* @param schemaItem The SchemaItem to add
|
|
136
|
+
* @deprecated in 4.0 use ecschema-editing package
|
|
137
|
+
*/
|
|
138
|
+
addSchemaItem(schemaItem: SchemaItem): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.
|
|
141
|
+
* @param schemaKey
|
|
142
|
+
*/
|
|
143
|
+
schemaExists(schemaKey: Readonly<SchemaKey>): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
146
|
+
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.
|
|
147
|
+
* Use this method over addSchema when asynchronously loading schemas
|
|
148
|
+
* @param schemaInfo An object with the schema key for the schema being loaded and it's references
|
|
149
|
+
* @param schema The partially loaded schema that the promise will fulfill
|
|
150
|
+
* @param schemaPromise The schema promise to add to the cache.
|
|
151
|
+
*/
|
|
152
|
+
addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>): Promise<void>;
|
|
153
|
+
/** Attempts to obtain a schema from this context that matches the specified criteria.
|
|
154
|
+
* @param schemaKey Identifies the schema to obtain.
|
|
155
|
+
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
156
|
+
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
157
|
+
*/
|
|
158
|
+
getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
|
|
159
|
+
/**
|
|
160
|
+
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
161
|
+
* The fully loaded schema can be gotten later from the context using [[getSchema]].
|
|
162
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
163
|
+
* @param matchType The match type to use when locating the schema
|
|
164
|
+
*/
|
|
165
|
+
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): Promise<SchemaInfo | undefined>;
|
|
166
|
+
/** Attempts to obtain a schema from this context that matches the specified criteria.
|
|
167
|
+
* Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.
|
|
168
|
+
* @param schemaKey Identifies the schema to obtain.
|
|
169
|
+
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
170
|
+
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
171
|
+
*/
|
|
172
|
+
getSchemaSync<T extends Schema>(schemaKey: SchemaKey, matchType?: SchemaMatchType): T | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Attempts to get a Schema from the context's cache.
|
|
175
|
+
* Will await a partially loaded schema then return when it is completely loaded.
|
|
176
|
+
* @param schemaKey The SchemaKey to identify the Schema.
|
|
177
|
+
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
180
|
+
getCachedSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): Promise<T | undefined>;
|
|
181
|
+
/**
|
|
182
|
+
* Attempts to get a Schema from the context's cache.
|
|
183
|
+
* Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.
|
|
184
|
+
* @param schemaKey The SchemaKey to identify the Schema.
|
|
185
|
+
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
getCachedSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType?: SchemaMatchType): T | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
191
|
+
* Will await a partially loaded schema then look in it for the requested item
|
|
192
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
193
|
+
* @returns The requested schema item
|
|
194
|
+
*/
|
|
195
|
+
getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;
|
|
196
|
+
/**
|
|
197
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
198
|
+
* Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
|
|
199
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
200
|
+
* @returns The requested schema item
|
|
201
|
+
*/
|
|
202
|
+
getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): T | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Iterates through the items of each schema known to the context. This includes schemas added to the
|
|
205
|
+
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
206
|
+
* can be located by an ISchemaLocater instance added to the context.
|
|
207
|
+
* Does not include schema items from schemas that are not completely loaded yet.
|
|
208
|
+
*/
|
|
209
|
+
getSchemaItems(): IterableIterator<SchemaItem>;
|
|
210
|
+
/**
|
|
211
|
+
* Gets all the Schemas known by the context. This includes schemas added to the
|
|
212
|
+
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
213
|
+
* can be located by an ISchemaLocater instance added to the context. Does not
|
|
214
|
+
* include schemas that are partially loaded.
|
|
215
|
+
* @returns An array of Schema objects.
|
|
216
|
+
*/
|
|
217
|
+
getKnownSchemas(): Schema[];
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { SchemaMatchType } from "./ECObjects";
|
|
6
|
+
import { ECObjectsError, ECObjectsStatus } from "./Exception";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
class SchemaMap extends Array {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export class SchemaCache {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._schema = new SchemaMap();
|
|
18
|
+
}
|
|
19
|
+
get count() { return this._schema.length; }
|
|
20
|
+
loadedSchemaExists(schemaKey) {
|
|
21
|
+
return undefined !== this._schema.find((entry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);
|
|
22
|
+
}
|
|
23
|
+
schemaPromiseExists(schemaKey) {
|
|
24
|
+
return undefined !== this._schema.find((entry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);
|
|
25
|
+
}
|
|
26
|
+
findEntry(schemaKey, matchType) {
|
|
27
|
+
return this._schema.find((entry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));
|
|
28
|
+
}
|
|
29
|
+
removeSchemaPromise(schemaKey) {
|
|
30
|
+
const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);
|
|
31
|
+
if (entry)
|
|
32
|
+
entry.schemaPromise = undefined;
|
|
33
|
+
}
|
|
34
|
+
removeEntry(schemaKey) {
|
|
35
|
+
this._schema = this._schema.filter((entry) => !entry.schemaInfo.schemaKey.matches(schemaKey));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.
|
|
39
|
+
* @param schemaKey The key to search for.
|
|
40
|
+
*/
|
|
41
|
+
schemaExists(schemaKey) {
|
|
42
|
+
return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
46
|
+
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache
|
|
47
|
+
* @param schemaInfo An object with the schema key for the schema being loaded and it's references
|
|
48
|
+
* @param schema The partially loaded schema that the promise will fulfill
|
|
49
|
+
* @param schemaPromise The schema promise to add to the cache.
|
|
50
|
+
*/
|
|
51
|
+
async addSchemaPromise(schemaInfo, schema, schemaPromise) {
|
|
52
|
+
if (this.schemaExists(schemaInfo.schemaKey))
|
|
53
|
+
throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);
|
|
54
|
+
this._schema.push({ schemaInfo, schema, schemaPromise });
|
|
55
|
+
// This promise is cached and will be awaited when the user requests the full schema.
|
|
56
|
+
// If the promise competes successfully before the user requests the schema it will be removed from the cache
|
|
57
|
+
// If it fails it will remain in the cache until the user awaits it and handles the error
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
59
|
+
schemaPromise.then(() => {
|
|
60
|
+
this.removeSchemaPromise(schemaInfo.schemaKey);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
65
|
+
* @param schema The schema to add to the cache.
|
|
66
|
+
*/
|
|
67
|
+
async addSchema(schema) {
|
|
68
|
+
if (this.schemaExists(schema.schemaKey))
|
|
69
|
+
throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);
|
|
70
|
+
this._schema.push({ schemaInfo: schema, schema });
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.
|
|
74
|
+
* @param schema The schema to add to the cache.
|
|
75
|
+
*/
|
|
76
|
+
addSchemaSync(schema) {
|
|
77
|
+
if (this.schemaExists(schema.schemaKey))
|
|
78
|
+
throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);
|
|
79
|
+
this._schema.push({ schemaInfo: schema, schema });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the schema which matches the provided SchemaKey.
|
|
83
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
84
|
+
* @param matchType The match type to use when locating the schema
|
|
85
|
+
*/
|
|
86
|
+
async getSchema(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
87
|
+
if (this.count === 0)
|
|
88
|
+
return undefined;
|
|
89
|
+
const entry = this.findEntry(schemaKey, matchType);
|
|
90
|
+
if (!entry)
|
|
91
|
+
return undefined;
|
|
92
|
+
if (entry.schemaPromise) {
|
|
93
|
+
try {
|
|
94
|
+
const schema = await entry.schemaPromise;
|
|
95
|
+
return schema;
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
this.removeEntry(schemaKey);
|
|
99
|
+
throw e;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return entry.schema;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
106
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
107
|
+
* @param matchType The match type to use when locating the schema
|
|
108
|
+
*/
|
|
109
|
+
async getSchemaInfo(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
110
|
+
if (this.count === 0)
|
|
111
|
+
return undefined;
|
|
112
|
+
const entry = this.findEntry(schemaKey, matchType);
|
|
113
|
+
if (entry)
|
|
114
|
+
return entry.schemaInfo;
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.
|
|
119
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
120
|
+
* @param matchType The match type to use when locating the schema
|
|
121
|
+
*/
|
|
122
|
+
getSchemaSync(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
123
|
+
if (this.count === 0)
|
|
124
|
+
return undefined;
|
|
125
|
+
const entry = this.findEntry(schemaKey, matchType);
|
|
126
|
+
if (entry) {
|
|
127
|
+
if (entry.schemaPromise) {
|
|
128
|
+
throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);
|
|
129
|
+
}
|
|
130
|
+
return entry.schema;
|
|
131
|
+
}
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.
|
|
136
|
+
* Does not include schema items from schemas that are not completely loaded yet.
|
|
137
|
+
*/
|
|
138
|
+
*getSchemaItems() {
|
|
139
|
+
for (const entry of this._schema) {
|
|
140
|
+
for (const schemaItem of entry.schema.getItems()) {
|
|
141
|
+
yield schemaItem;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Gets all the schemas from the schema cache.
|
|
147
|
+
* Does not include schemas from schemas that are not completely loaded yet.
|
|
148
|
+
* @returns An array of Schema objects.
|
|
149
|
+
*/
|
|
150
|
+
getAllSchemas() {
|
|
151
|
+
return this._schema.map((entry) => entry.schema);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The SchemaContext, context object is used to facilitate schema and schema item location.
|
|
156
|
+
*
|
|
157
|
+
* The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.
|
|
158
|
+
*
|
|
159
|
+
* The context is made up of a group of Schema Locators.
|
|
160
|
+
* @beta
|
|
161
|
+
*/
|
|
162
|
+
export class SchemaContext {
|
|
163
|
+
constructor() {
|
|
164
|
+
this._locaters = [];
|
|
165
|
+
this._knownSchemas = new SchemaCache();
|
|
166
|
+
this._locaters.push(this._knownSchemas);
|
|
167
|
+
}
|
|
168
|
+
addLocater(locater) {
|
|
169
|
+
this._locaters.push(locater);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.
|
|
173
|
+
* @param schema The schema to add to this context
|
|
174
|
+
*/
|
|
175
|
+
async addSchema(schema) {
|
|
176
|
+
this.addSchemaSync(schema);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Adds the schema to this context
|
|
180
|
+
* @param schema The schema to add to this context
|
|
181
|
+
*/
|
|
182
|
+
addSchemaSync(schema) {
|
|
183
|
+
this._knownSchemas.addSchemaSync(schema);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and
|
|
187
|
+
* @param schemaItem The SchemaItem to add
|
|
188
|
+
* @deprecated in 4.0 use ecschema-editing package
|
|
189
|
+
*/
|
|
190
|
+
async addSchemaItem(schemaItem) {
|
|
191
|
+
const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);
|
|
192
|
+
if (!schema)
|
|
193
|
+
throw new ECObjectsError(ECObjectsStatus.UnableToLocateSchema, `Unable to add the schema item ${schemaItem.name} to the schema ${schemaItem.key.schemaKey.toString()} because the schema could not be located.`);
|
|
194
|
+
schema.addItem(schemaItem);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.
|
|
198
|
+
* @param schemaKey
|
|
199
|
+
*/
|
|
200
|
+
schemaExists(schemaKey) {
|
|
201
|
+
return this._knownSchemas.schemaExists(schemaKey);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Adds a promise to load the schema to the cache. Does not allow for duplicate schemas in the cache of schemas or cache of promises, checks using SchemaMatchType.Latest.
|
|
205
|
+
* When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.
|
|
206
|
+
* Use this method over addSchema when asynchronously loading schemas
|
|
207
|
+
* @param schemaInfo An object with the schema key for the schema being loaded and it's references
|
|
208
|
+
* @param schema The partially loaded schema that the promise will fulfill
|
|
209
|
+
* @param schemaPromise The schema promise to add to the cache.
|
|
210
|
+
*/
|
|
211
|
+
async addSchemaPromise(schemaInfo, schema, schemaPromise) {
|
|
212
|
+
return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);
|
|
213
|
+
}
|
|
214
|
+
/** Attempts to obtain a schema from this context that matches the specified criteria.
|
|
215
|
+
* @param schemaKey Identifies the schema to obtain.
|
|
216
|
+
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
217
|
+
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
218
|
+
*/
|
|
219
|
+
async getSchema(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
220
|
+
// the first locater is _knownSchemas, so we don't have to check the cache explicitly here
|
|
221
|
+
for (const locater of this._locaters) {
|
|
222
|
+
const schema = await locater.getSchema(schemaKey, matchType, this);
|
|
223
|
+
if (undefined !== schema)
|
|
224
|
+
return schema;
|
|
225
|
+
}
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.
|
|
230
|
+
* The fully loaded schema can be gotten later from the context using [[getSchema]].
|
|
231
|
+
* @param schemaKey The SchemaKey describing the schema to get from the cache.
|
|
232
|
+
* @param matchType The match type to use when locating the schema
|
|
233
|
+
*/
|
|
234
|
+
async getSchemaInfo(schemaKey, matchType) {
|
|
235
|
+
for (const locater of this._locaters) {
|
|
236
|
+
const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);
|
|
237
|
+
if (undefined !== schemaInfo)
|
|
238
|
+
return schemaInfo;
|
|
239
|
+
}
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
/** Attempts to obtain a schema from this context that matches the specified criteria.
|
|
243
|
+
* Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.
|
|
244
|
+
* @param schemaKey Identifies the schema to obtain.
|
|
245
|
+
* @param matchType Criteria by which to identify potentially matching schemas.
|
|
246
|
+
* @returns the schema matching the input criteria, or `undefined` if no such schema could be located.
|
|
247
|
+
*/
|
|
248
|
+
getSchemaSync(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
249
|
+
// the first locater is _knownSchemas, so we don't have to check the cache explicitly here
|
|
250
|
+
for (const locater of this._locaters) {
|
|
251
|
+
const schema = locater.getSchemaSync(schemaKey, matchType, this);
|
|
252
|
+
if (undefined !== schema)
|
|
253
|
+
return schema;
|
|
254
|
+
}
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Attempts to get a Schema from the context's cache.
|
|
259
|
+
* Will await a partially loaded schema then return when it is completely loaded.
|
|
260
|
+
* @param schemaKey The SchemaKey to identify the Schema.
|
|
261
|
+
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
async getCachedSchema(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
265
|
+
return this._knownSchemas.getSchema(schemaKey, matchType);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Attempts to get a Schema from the context's cache.
|
|
269
|
+
* Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.
|
|
270
|
+
* @param schemaKey The SchemaKey to identify the Schema.
|
|
271
|
+
* @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
getCachedSchemaSync(schemaKey, matchType = SchemaMatchType.Latest) {
|
|
275
|
+
return this._knownSchemas.getSchemaSync(schemaKey, matchType);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
279
|
+
* Will await a partially loaded schema then look in it for the requested item
|
|
280
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
281
|
+
* @returns The requested schema item
|
|
282
|
+
*/
|
|
283
|
+
async getSchemaItem(schemaItemKey) {
|
|
284
|
+
const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);
|
|
285
|
+
if (undefined === schema)
|
|
286
|
+
return undefined;
|
|
287
|
+
return schema.getItem(schemaItemKey.name);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Gets the schema item from the specified schema if it exists in this [[SchemaContext]].
|
|
291
|
+
* Will skip a partially loaded schema and return undefined if the item belongs to that schema. Use the async method to await partially loaded schemas.
|
|
292
|
+
* @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.
|
|
293
|
+
* @returns The requested schema item
|
|
294
|
+
*/
|
|
295
|
+
getSchemaItemSync(schemaItemKey) {
|
|
296
|
+
const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);
|
|
297
|
+
if (undefined === schema)
|
|
298
|
+
return undefined;
|
|
299
|
+
return schema.getItemSync(schemaItemKey.name);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Iterates through the items of each schema known to the context. This includes schemas added to the
|
|
303
|
+
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
304
|
+
* can be located by an ISchemaLocater instance added to the context.
|
|
305
|
+
* Does not include schema items from schemas that are not completely loaded yet.
|
|
306
|
+
*/
|
|
307
|
+
getSchemaItems() {
|
|
308
|
+
return this._knownSchemas.getSchemaItems();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Gets all the Schemas known by the context. This includes schemas added to the
|
|
312
|
+
* context using [[SchemaContext.addSchema]]. This does not include schemas that
|
|
313
|
+
* can be located by an ISchemaLocater instance added to the context. Does not
|
|
314
|
+
* include schemas that are partially loaded.
|
|
315
|
+
* @returns An array of Schema objects.
|
|
316
|
+
*/
|
|
317
|
+
getKnownSchemas() {
|
|
318
|
+
return this._knownSchemas.getAllSchemas();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=Context.js.map
|