@itwin/ecschema-metadata 4.8.0-dev.8 → 4.8.0
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 +47 -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 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/Context.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAM9D;;GAEG;AACH,MAAM,SAAU,SAAQ,KAAkB;CAAI;AAuD9C;;GAEG;AACH,MAAM,OAAO,WAAW;IAGtB;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,IAAW,KAAK,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,kBAAkB,CAAC,SAA8B;QACvD,OAAO,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAChK,CAAC;IAEO,mBAAmB,CAAC,SAA8B;QACxD,OAAO,SAAS,KAAK,IAAI,CAAC,O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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 { SchemaMatchType } from \"./ECObjects\";\r\nimport { ECObjectsError, ECObjectsStatus } from \"./Exception\";\r\nimport { SchemaInfo } from \"./Interfaces\";\r\nimport { MutableSchema, Schema } from \"./Metadata/Schema\";\r\nimport { SchemaItem } from \"./Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"./SchemaKey\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass SchemaMap extends Array<SchemaEntry> { }\r\n\r\n/**\r\n * @internal\r\n */\r\ninterface SchemaEntry {\r\n schemaInfo: SchemaInfo;\r\n schema: Schema;\r\n schemaPromise?: Promise<Schema>;\r\n}\r\n\r\n/**\r\n * The interface defines what is needed to be an `ISchemaLocater`.\r\n * A Schema Locater loads the requested schema if it can or returns undefined.\r\n * Schema Locaters should always load the schema on each request and should not hold a cache of schemas.\r\n * Schema locaters should never be used directly to load a schema, they should be added to a `SchemaContext`\r\n * and the context should be used to load schemas. The `SchemaContext` caches schemas and manages schema life time.\r\n * @beta\r\n */\r\nexport interface ISchemaLocater {\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<T | undefined>;\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * May return the entire Schema so long as it is completely loaded as it satisfies the SchemaInfo interface.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<SchemaInfo | undefined>;\r\n\r\n /**\r\n * Attempts to get a schema from the locater. Yields undefined if no matching schema is found.\r\n * For schemas that may have references, construct and call through a SchemaContext instead.\r\n * @param schemaKey key to look up\r\n * @param matchType how to match key against candidate schemas\r\n * @param context context for loading schema references\r\n */\r\n getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): T | undefined;\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport interface ISchemaItemLocater {\r\n getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined>;\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class SchemaCache implements ISchemaLocater {\r\n private _schema: SchemaMap;\r\n\r\n constructor() {\r\n this._schema = new SchemaMap();\r\n }\r\n\r\n public get count() { return this._schema.length; }\r\n\r\n private loadedSchemaExists(schemaKey: Readonly<SchemaKey>): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && !entry.schemaPromise);\r\n }\r\n\r\n private schemaPromiseExists(schemaKey: Readonly<SchemaKey>): boolean {\r\n return undefined !== this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, SchemaMatchType.Latest) && undefined !== entry.schemaPromise);\r\n }\r\n\r\n private findEntry(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): SchemaEntry | undefined {\r\n return this._schema.find((entry: SchemaEntry) => entry.schemaInfo.schemaKey.matches(schemaKey, matchType));\r\n }\r\n\r\n private removeSchemaPromise(schemaKey: Readonly<SchemaKey>) {\r\n const entry = this.findEntry(schemaKey, SchemaMatchType.Latest);\r\n if (entry)\r\n entry.schemaPromise = undefined;\r\n }\r\n\r\n private removeEntry(schemaKey: Readonly<SchemaKey>) {\r\n this._schema = this._schema.filter((entry: SchemaEntry) => !entry.schemaInfo.schemaKey.matches(schemaKey));\r\n }\r\n\r\n /**\r\n * Returns true if the schema exists in either the schema cache or the promise cache. SchemaMatchType.Latest used.\r\n * @param schemaKey The key to search for.\r\n */\r\n public schemaExists(schemaKey: Readonly<SchemaKey>): boolean {\r\n return this.loadedSchemaExists(schemaKey) || this.schemaPromiseExists(schemaKey);\r\n }\r\n\r\n /**\r\n * 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.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n if (this.schemaExists(schemaInfo.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schemaInfo.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo, schema, schemaPromise });\r\n\r\n // This promise is cached and will be awaited when the user requests the full schema.\r\n // If the promise competes successfully before the user requests the schema it will be removed from the cache\r\n // If it fails it will remain in the cache until the user awaits it and handles the error\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n schemaPromise.then(() => {\r\n this.removeSchemaPromise(schemaInfo.schemaKey);\r\n });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public async addSchema<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Adds a schema to the cache. Does not allow for duplicate schemas, checks using SchemaMatchType.Latest.\r\n * @param schema The schema to add to the cache.\r\n */\r\n public addSchemaSync<T extends Schema>(schema: T) {\r\n if (this.schemaExists(schema.schemaKey))\r\n throw new ECObjectsError(ECObjectsStatus.DuplicateSchema, `The schema, ${schema.schemaKey.toString()}, already exists within this cache.`);\r\n\r\n this._schema.push({ schemaInfo: schema, schema });\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (!entry)\r\n return undefined;\r\n\r\n if (entry.schemaPromise) {\r\n try {\r\n const schema = await entry.schemaPromise as T;\r\n return schema;\r\n } catch (e) {\r\n this.removeEntry(schemaKey);\r\n throw e;\r\n }\r\n }\r\n\r\n return entry.schema as T;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<SchemaInfo | undefined> {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry)\r\n return entry.schemaInfo;\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema which matches the provided SchemaKey. If the schema is partially loaded an exception will be thrown.\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public getSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n if (this.count === 0)\r\n return undefined;\r\n\r\n const entry = this.findEntry(schemaKey, matchType);\r\n if (entry) {\r\n if (entry.schemaPromise) {\r\n throw new ECObjectsError(ECObjectsStatus.UnableToLoadSchema, `The Schema ${schemaKey.toString()} is partially loaded so cannot be loaded synchronously.`);\r\n }\r\n return entry.schema as T;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generator function that can iterate through each schema in _schema SchemaMap and items for each Schema.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public * getSchemaItems(): IterableIterator<SchemaItem> {\r\n for (const entry of this._schema) {\r\n for (const schemaItem of entry.schema.getItems()) {\r\n yield schemaItem;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets all the schemas from the schema cache.\r\n * Does not include schemas from schemas that are not completely loaded yet.\r\n * @returns An array of Schema objects.\r\n */\r\n public getAllSchemas(): Schema[] {\r\n return this._schema.map((entry: SchemaEntry) => entry.schema);\r\n }\r\n}\r\n\r\n/**\r\n * The SchemaContext, context object is used to facilitate schema and schema item location.\r\n *\r\n * 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.\r\n *\r\n * The context is made up of a group of Schema Locators.\r\n * @beta\r\n */\r\nexport class SchemaContext implements ISchemaItemLocater {\r\n private _locaters: ISchemaLocater[];\r\n\r\n private _knownSchemas: SchemaCache;\r\n\r\n constructor() {\r\n this._locaters = [];\r\n\r\n this._knownSchemas = new SchemaCache();\r\n this._locaters.push(this._knownSchemas);\r\n }\r\n\r\n public addLocater(locater: ISchemaLocater) {\r\n this._locaters.push(locater);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context. Use addSchemaPromise instead when asynchronously loading schemas.\r\n * @param schema The schema to add to this context\r\n */\r\n public async addSchema(schema: Schema) {\r\n this.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the schema to this context\r\n * @param schema The schema to add to this context\r\n */\r\n public addSchemaSync(schema: Schema) {\r\n this._knownSchemas.addSchemaSync(schema);\r\n }\r\n\r\n /**\r\n * Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and\r\n * @param schemaItem The SchemaItem to add\r\n * @deprecated in 4.0 use ecschema-editing package\r\n */\r\n public async addSchemaItem(schemaItem: SchemaItem) {\r\n const schema = await this.getSchema(schemaItem.key.schemaKey, SchemaMatchType.Exact);\r\n if (!schema)\r\n 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.`);\r\n\r\n (schema as MutableSchema).addItem(schemaItem);\r\n }\r\n\r\n /**\r\n * Returns true if the schema is already in the context. SchemaMatchType.Latest is used to find a match.\r\n * @param schemaKey\r\n */\r\n public schemaExists(schemaKey: Readonly<SchemaKey>): boolean {\r\n return this._knownSchemas.schemaExists(schemaKey);\r\n }\r\n\r\n /**\r\n * 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.\r\n * When the promise completes the schema will be added to the schema cache and the promise will be removed from the promise cache.\r\n * Use this method over addSchema when asynchronously loading schemas\r\n * @param schemaInfo An object with the schema key for the schema being loaded and it's references\r\n * @param schema The partially loaded schema that the promise will fulfill\r\n * @param schemaPromise The schema promise to add to the cache.\r\n */\r\n public async addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>) {\r\n return this._knownSchemas.addSchemaPromise(schemaInfo, schema, schemaPromise);\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public async getSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | undefined> {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = await locater.getSchema<T>(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets the schema info which matches the provided SchemaKey. The schema info may be returned before the schema is fully loaded.\r\n * The fully loaded schema can be gotten later from the context using [[getSchema]].\r\n * @param schemaKey The SchemaKey describing the schema to get from the cache.\r\n * @param matchType The match type to use when locating the schema\r\n */\r\n public async getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): Promise<SchemaInfo | undefined> {\r\n for (const locater of this._locaters) {\r\n const schemaInfo = await locater.getSchemaInfo(schemaKey, matchType, this);\r\n if (undefined !== schemaInfo)\r\n return schemaInfo;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Attempts to obtain a schema from this context that matches the specified criteria.\r\n * Will return undefined if the schema is partially loaded. Use [[getSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey Identifies the schema to obtain.\r\n * @param matchType Criteria by which to identify potentially matching schemas.\r\n * @returns the schema matching the input criteria, or `undefined` if no such schema could be located.\r\n */\r\n public getSchemaSync<T extends Schema>(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n // the first locater is _knownSchemas, so we don't have to check the cache explicitly here\r\n for (const locater of this._locaters) {\r\n const schema = locater.getSchemaSync<T>(schemaKey, matchType, this);\r\n if (undefined !== schema)\r\n return schema;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will await a partially loaded schema then return when it is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public async getCachedSchema<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<T | undefined> {\r\n return this._knownSchemas.getSchema<T>(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Attempts to get a Schema from the context's cache.\r\n * Will return undefined if the cached schema is partially loaded. Use [[getCachedSchema]] to await until the schema is completely loaded.\r\n * @param schemaKey The SchemaKey to identify the Schema.\r\n * @param matchType The SchemaMatch type to use. Default is SchemaMatchType.Latest.\r\n * @internal\r\n */\r\n public getCachedSchemaSync<T extends Schema>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): T | undefined {\r\n return this._knownSchemas.getSchemaSync<T>(schemaKey, matchType);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * Will await a partially loaded schema then look in it for the requested item\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public async getSchemaItem<T extends SchemaItem>(schemaItemKey: SchemaItemKey): Promise<T | undefined> {\r\n const schema = await this.getSchema(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItem<T>(schemaItemKey.name);\r\n }\r\n\r\n /**\r\n * Gets the schema item from the specified schema if it exists in this [[SchemaContext]].\r\n * 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.\r\n * @param schemaItemKey The SchemaItemKey identifying the item to return. SchemaMatchType.Latest is used to match the schema.\r\n * @returns The requested schema item\r\n */\r\n public getSchemaItemSync<T extends SchemaItem>(schemaItemKey: SchemaItemKey): T | undefined {\r\n const schema = this.getSchemaSync(schemaItemKey.schemaKey, SchemaMatchType.Latest);\r\n if (undefined === schema)\r\n return undefined;\r\n return schema.getItemSync<T>(schemaItemKey.name);\r\n }\r\n\r\n /**\r\n * Iterates through the items of each schema known to the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context.\r\n * Does not include schema items from schemas that are not completely loaded yet.\r\n */\r\n public getSchemaItems(): IterableIterator<SchemaItem> {\r\n return this._knownSchemas.getSchemaItems();\r\n }\r\n\r\n /**\r\n * Gets all the Schemas known by the context. This includes schemas added to the\r\n * context using [[SchemaContext.addSchema]]. This does not include schemas that\r\n * can be located by an ISchemaLocater instance added to the context. Does not\r\n * include schemas that are partially loaded.\r\n * @returns An array of Schema objects.\r\n */\r\n public getKnownSchemas(): Schema[] {\r\n return this._knownSchemas.getAllSchemas();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Utils
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)
|
|
6
|
+
* and resulting value of an asynchronous operation ***that has not yet started***.
|
|
7
|
+
*
|
|
8
|
+
* The asynchronous operation behind a DelayedPromise will start when any of the following occurs:
|
|
9
|
+
* - The DelayedPromise is `await`ed.
|
|
10
|
+
* - A callback is attached via `.then()` or `.catch(() => { })`.
|
|
11
|
+
* - The asynchronous operation is explicitly started via `.start()`
|
|
12
|
+
*
|
|
13
|
+
* Just as normal Promises will never return to their pending state once fulfilled or rejected,
|
|
14
|
+
* a DelayedPromise will never re-execute its asynchronous operation more than **once**.
|
|
15
|
+
*
|
|
16
|
+
* Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to
|
|
17
|
+
* represent an (asynchronously) lazily-loaded value as an instance property instead of a method.
|
|
18
|
+
* You could also accomplish something similar by defining an async function as a property getter.
|
|
19
|
+
* However, since a property defined as a DelayedPromise will not start simply by being accessed,
|
|
20
|
+
* additional (non-lazily-loaded) "nested" properties can be added.
|
|
21
|
+
*
|
|
22
|
+
* [!alert text="*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening." kind="warning"]
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare class DelayedPromise<T> implements Promise<T> {
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a DelayedPromise object.
|
|
28
|
+
* @param startCallback The asynchronous callback to execute when this DelayedPromise should be "started".
|
|
29
|
+
*/
|
|
30
|
+
constructor(startCallback: () => Promise<T>);
|
|
31
|
+
readonly [Symbol.toStringTag]: "Promise";
|
|
32
|
+
/**
|
|
33
|
+
* Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).
|
|
34
|
+
*/
|
|
35
|
+
start: () => Promise<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
38
|
+
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
39
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
40
|
+
* @return A Promise for the completion of which ever callback is executed.
|
|
41
|
+
*/
|
|
42
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
43
|
+
/**
|
|
44
|
+
* Attaches a callback for only the rejection of the Promise.
|
|
45
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
46
|
+
* @return A Promise for the completion of the callback.
|
|
47
|
+
*/
|
|
48
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Attaches a callback for only the finally clause of the Promise.
|
|
51
|
+
* @param onrejected The callback to execute when the Promise is finalized.
|
|
52
|
+
* @return A Promise for the completion of the callback.
|
|
53
|
+
*/
|
|
54
|
+
finally(onFinally?: (() => void) | undefined | null): Promise<T>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
export interface NoDelayedPromiseMethods {
|
|
60
|
+
[propName: string]: any;
|
|
61
|
+
start?: never;
|
|
62
|
+
then?: never;
|
|
63
|
+
catch?: never;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export interface DelayedPromiseWithPropsConstructor {
|
|
69
|
+
/**
|
|
70
|
+
* Constructs a DelayedPromiseWithProps object, which is at once both:
|
|
71
|
+
* - A DelayedPromise object representing the eventual completion (or failure)
|
|
72
|
+
* of an asynchronous operation returning a value of type `TPayload`
|
|
73
|
+
* - _and_ a readonly "wrapper" around an instance of type `TProps`
|
|
74
|
+
*
|
|
75
|
+
* @param props An object with properties and methods that will be accessible
|
|
76
|
+
* as if they were readonly properties of the DelayedPromiseWithProps object being constructed.
|
|
77
|
+
* @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be "started".
|
|
78
|
+
*/
|
|
79
|
+
new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): Readonly<TProps> & DelayedPromise<TPayload>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @beta
|
|
83
|
+
*/
|
|
84
|
+
export declare const DelayedPromiseWithProps: DelayedPromiseWithPropsConstructor;
|
|
85
|
+
/** Define the type of a DelayedPromiseWithProps instance
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
export type DelayedPromiseWithProps<TProps, TPayload> = Readonly<TProps> & DelayedPromise<TPayload>;
|
|
89
|
+
//# sourceMappingURL=DelayedPromise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DelayedPromise.d.ts","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,cAAc,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IAElD;;;OAGG;gBACS,aAAa,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAS3C,SAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,YAAsB;IAE1D;;OAEG;IACI,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAE/B;;;;;OAKG;IACU,IAAI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H,MAAM,MAAM,uBAAuB,CAAC,MAAM,EAAE,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Utils
|
|
7
|
+
*/
|
|
8
|
+
var _a;
|
|
9
|
+
/**
|
|
10
|
+
* Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)
|
|
11
|
+
* and resulting value of an asynchronous operation ***that has not yet started***.
|
|
12
|
+
*
|
|
13
|
+
* The asynchronous operation behind a DelayedPromise will start when any of the following occurs:
|
|
14
|
+
* - The DelayedPromise is `await`ed.
|
|
15
|
+
* - A callback is attached via `.then()` or `.catch(() => { })`.
|
|
16
|
+
* - The asynchronous operation is explicitly started via `.start()`
|
|
17
|
+
*
|
|
18
|
+
* Just as normal Promises will never return to their pending state once fulfilled or rejected,
|
|
19
|
+
* a DelayedPromise will never re-execute its asynchronous operation more than **once**.
|
|
20
|
+
*
|
|
21
|
+
* Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to
|
|
22
|
+
* represent an (asynchronously) lazily-loaded value as an instance property instead of a method.
|
|
23
|
+
* You could also accomplish something similar by defining an async function as a property getter.
|
|
24
|
+
* However, since a property defined as a DelayedPromise will not start simply by being accessed,
|
|
25
|
+
* additional (non-lazily-loaded) "nested" properties can be added.
|
|
26
|
+
*
|
|
27
|
+
* [!alert text="*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening." kind="warning"]
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
export class DelayedPromise {
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a DelayedPromise object.
|
|
33
|
+
* @param startCallback The asynchronous callback to execute when this DelayedPromise should be "started".
|
|
34
|
+
*/
|
|
35
|
+
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
|
+
let pending;
|
|
39
|
+
this.start = async () => {
|
|
40
|
+
pending = pending || startCallback();
|
|
41
|
+
return pending;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
|
46
|
+
* @param onfulfilled The callback to execute when the Promise is resolved.
|
|
47
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
48
|
+
* @return A Promise for the completion of which ever callback is executed.
|
|
49
|
+
*/
|
|
50
|
+
async then(onfulfilled, onrejected) {
|
|
51
|
+
return this.start().then(onfulfilled, onrejected);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Attaches a callback for only the rejection of the Promise.
|
|
55
|
+
* @param onrejected The callback to execute when the Promise is rejected.
|
|
56
|
+
* @return A Promise for the completion of the callback.
|
|
57
|
+
*/
|
|
58
|
+
async catch(onrejected) {
|
|
59
|
+
return this.start().catch(onrejected);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Attaches a callback for only the finally clause of the Promise.
|
|
63
|
+
* @param onrejected The callback to execute when the Promise is finalized.
|
|
64
|
+
* @return A Promise for the completion of the callback.
|
|
65
|
+
*/
|
|
66
|
+
async finally(onFinally) {
|
|
67
|
+
return this.start().finally(onFinally);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
_a = Symbol.toStringTag;
|
|
71
|
+
// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.
|
|
72
|
+
// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>
|
|
73
|
+
/**
|
|
74
|
+
* @beta
|
|
75
|
+
*/
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
77
|
+
export const DelayedPromiseWithProps = (class extends DelayedPromise {
|
|
78
|
+
constructor(props, cb) {
|
|
79
|
+
super(cb);
|
|
80
|
+
const handler = {
|
|
81
|
+
get: (target, name) => {
|
|
82
|
+
return (name in this) ? this[name] : target[name];
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return new Proxy(props, handler);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=DelayedPromise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,cAAc;IAEzB;;;OAGG;IACH,YAAY,aAA+B;QAQ3C,qGAAqG;QACrF,QAAoB,GAAG,SAAkB,CAAC;QARxD,IAAI,OAA+B,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;YACtB,OAAO,GAAG,OAAO,IAAI,aAAa,EAAE,CAAC;YACrC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAUD;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAAiC,WAAiF,EAAE,UAAmF;QACtN,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAkB,UAAiF;QACnH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,SAA2C;QAC9D,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;KAlCkB,MAAM,CAAC,WAAW;AAkErC,wGAAwG;AACxG,+HAA+H;AAC/H;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAyD,SAAQ,cAAwB;IAC/H,YAAY,KAAa,EAAE,EAA2B;QACpD,KAAK,CAAC,EAAE,CAAC,CAAC;QAEV,MAAM,OAAO,GAAG;YACd,GAAG,EAAE,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE;gBACpC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAkB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAoB,CAAC,CAAC;YAClF,CAAC;SACF,CAAC;QAEF,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAgD,CAAC;IAClF,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 * @beta\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 * @beta\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 * @beta\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>): Readonly<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 * @beta\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 Readonly<TProps> & DelayedPromise<TPayload>;\r\n }\r\n}) as DelayedPromiseWithPropsConstructor;\r\n\r\n/* eslint-disable @typescript-eslint/no-redeclare */\r\n\r\n/** Define the type of a DelayedPromiseWithProps instance\r\n * @beta\r\n */\r\nexport type DelayedPromiseWithProps<TProps, TPayload> = Readonly<TProps> & DelayedPromise<TPayload>;\r\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps, NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps } from "../Deserialization/JsonProps";
|
|
2
|
+
import { CustomAttribute } from "../Metadata/CustomAttribute";
|
|
3
|
+
import { CustomAttributeClass } from "../Metadata/CustomAttributeClass";
|
|
4
|
+
type SchemaItemTuple<T> = Readonly<[string /** Name */, string /** SchemaItemType */, Readonly<T>]>;
|
|
5
|
+
type PropertyTuple<T> = Readonly<[string /** Name */, string /** Property */, Readonly<T>]>;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export type CustomAttributeProvider = (caClass: CustomAttributeClass) => CustomAttribute;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export type CAProviderTuple = Readonly<[string /** Full Name */, CustomAttributeProvider]>;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare abstract class AbstractParser<TItem = any, TProperty = TItem> {
|
|
12
|
+
abstract parseSchema(): SchemaProps;
|
|
13
|
+
abstract getReferences(): Iterable<SchemaReferenceProps>;
|
|
14
|
+
abstract getItems(): Iterable<SchemaItemTuple<TItem>>;
|
|
15
|
+
abstract findItem(itemName: string): SchemaItemTuple<TItem> | undefined;
|
|
16
|
+
abstract parseEntityClass(data: Readonly<TItem>): EntityClassProps;
|
|
17
|
+
abstract parseMixin(data: Readonly<TItem>): MixinProps;
|
|
18
|
+
abstract parseStructClass(data: Readonly<TItem>): StructClassProps;
|
|
19
|
+
abstract parseCustomAttributeClass(data: Readonly<TItem>): CustomAttributeClassProps;
|
|
20
|
+
abstract parseRelationshipClass(data: Readonly<TItem>): RelationshipClassProps;
|
|
21
|
+
abstract parseEnumeration(data: Readonly<TItem>): EnumerationProps;
|
|
22
|
+
abstract parseKindOfQuantity(data: Readonly<TItem>): KindOfQuantityProps;
|
|
23
|
+
abstract parsePropertyCategory(data: Readonly<TItem>): PropertyCategoryProps;
|
|
24
|
+
abstract parseUnit(data: Readonly<TItem>): SchemaItemUnitProps;
|
|
25
|
+
abstract parseInvertedUnit(data: Readonly<TItem>): InvertedUnitProps;
|
|
26
|
+
abstract parseConstant(data: Readonly<TItem>): ConstantProps;
|
|
27
|
+
abstract parsePhenomenon(data: Readonly<TItem>): PhenomenonProps;
|
|
28
|
+
abstract parseFormat(data: Readonly<TItem>): SchemaItemFormatProps;
|
|
29
|
+
abstract parseUnitSystem(data: Readonly<TItem>): UnitSystemProps;
|
|
30
|
+
abstract getProperties(data: Readonly<TItem>, itemName: string): Iterable<PropertyTuple<TProperty>>;
|
|
31
|
+
abstract parsePrimitiveProperty(data: Readonly<TProperty>): PrimitivePropertyProps;
|
|
32
|
+
abstract parseStructProperty(data: Readonly<TProperty>): StructPropertyProps;
|
|
33
|
+
abstract parsePrimitiveArrayProperty(data: Readonly<TProperty>): PrimitiveArrayPropertyProps;
|
|
34
|
+
abstract parseStructArrayProperty(data: Readonly<TProperty>): StructArrayPropertyProps;
|
|
35
|
+
abstract parseNavigationProperty(data: Readonly<TProperty>): NavigationPropertyProps;
|
|
36
|
+
abstract getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple>;
|
|
37
|
+
abstract getClassCustomAttributeProviders(data: Readonly<TItem>): Iterable<CAProviderTuple>;
|
|
38
|
+
abstract getPropertyCustomAttributeProviders(data: Readonly<TProperty>): Iterable<CAProviderTuple>;
|
|
39
|
+
abstract getRelationshipConstraintCustomAttributeProviders(data: Readonly<TItem>): [Iterable<CAProviderTuple>, Iterable<CAProviderTuple>];
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
export interface AbstractParserConstructor<TSchema, TItem = any, TProperty = TItem> {
|
|
43
|
+
new (obj: Readonly<TSchema>): AbstractParser<TItem, TProperty>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=AbstractParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractParser.d.ts","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,aAAa,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAChI,uBAAuB,EAAE,eAAe,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,sBAAsB,EAC5I,qBAAqB,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAChK,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,KAAK,eAAe,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,KAAK,aAAa,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5F,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,eAAe,CAAC;AAEzF,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAC,CAAC;AAE3F,gBAAgB;AAChB,8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,QAAQ,CAAC,KAAK,CAAC,GAAG,eAAe;aAEvD,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;aAC1F,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,sBAAsB;aACzE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,mBAAmB;aACnE,2BAA2B,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,2BAA2B;aACnF,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,wBAAwB;aAC7E,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,uBAAuB;aAE3E,iCAAiC,IAAI,QAAQ,CAAC,eAAe,CAAC;aAC9D,gCAAgC,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC;aAClF,mCAAmC,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC;aACzF,iDAAiD,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAe,QAAQ,CAAC,eAAe,CAAC,CAAc;CAC3K;AAED,gBAAgB;AAEhB,MAAM,WAAW,yBAAyB,CAAC,OAAO,EAAE,KAAK,GAAG,GAAG,EAAE,SAAS,GAAG,KAAK;IAAI,KAAI,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;CAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
/** @internal */
|
|
6
|
+
export class AbstractParser {
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=AbstractParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAmB/F,gBAAgB;AAChB,MAAM,OAAgB,cAAc;CAiCnC","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\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 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}\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"]}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { SchemaContext } from "../Context";
|
|
2
|
+
import { SchemaInfo } from "../Interfaces";
|
|
3
|
+
import { Schema } from "../Metadata/Schema";
|
|
4
|
+
import { ISchemaPartVisitor } from "../SchemaPartVisitorDelegate";
|
|
5
|
+
import { AbstractParserConstructor } from "./AbstractParser";
|
|
6
|
+
/**
|
|
7
|
+
* This class properly handles the order the deserialization of ECSchemas and SchemaItems from serialized formats.
|
|
8
|
+
* For example, when deserializing an ECClass most times all base class should be de-serialized before the given class.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class SchemaReadHelper<T = unknown> {
|
|
12
|
+
private _context;
|
|
13
|
+
private _visitorHelper?;
|
|
14
|
+
private _parserType;
|
|
15
|
+
private _parser;
|
|
16
|
+
private _schema?;
|
|
17
|
+
private _schemaInfo?;
|
|
18
|
+
constructor(parserType: AbstractParserConstructor<T>, context?: SchemaContext, visitor?: ISchemaPartVisitor);
|
|
19
|
+
/**
|
|
20
|
+
* Creates a complete SchemaInfo and starts parsing the schema from a serialized representation.
|
|
21
|
+
* The info and schema promise will be registered with the SchemaContext. The complete schema can be retrieved by
|
|
22
|
+
* calling getCachedSchema on the context.
|
|
23
|
+
* @param schema The Schema to populate
|
|
24
|
+
* @param rawSchema The serialized data to use to populate the Schema.
|
|
25
|
+
*/
|
|
26
|
+
readSchemaInfo<U extends Schema>(schema: U, rawSchema: T): Promise<SchemaInfo>;
|
|
27
|
+
/**
|
|
28
|
+
* Populates the given Schema from a serialized representation.
|
|
29
|
+
* @param schema The Schema to populate
|
|
30
|
+
* @param rawSchema The serialized data to use to populate the Schema.
|
|
31
|
+
*/
|
|
32
|
+
readSchema<U extends Schema>(schema: U, rawSchema: T): Promise<U>;
|
|
33
|
+
private loadSchema;
|
|
34
|
+
/**
|
|
35
|
+
* Populates the given Schema from a serialized representation.
|
|
36
|
+
* @param schema The Schema to populate
|
|
37
|
+
* @param rawSchema The serialized data to use to populate the Schema.
|
|
38
|
+
*/
|
|
39
|
+
readSchemaSync<U extends Schema>(schema: U, rawSchema: T): U;
|
|
40
|
+
/**
|
|
41
|
+
* Ensures that the schema references can be located and adds them to the schema.
|
|
42
|
+
* @param ref The object to read the SchemaReference's props from.
|
|
43
|
+
*/
|
|
44
|
+
private loadSchemaReference;
|
|
45
|
+
/**
|
|
46
|
+
* Ensures that the schema references can be located and adds them to the schema.
|
|
47
|
+
* @param ref The object to read the SchemaReference's props from.
|
|
48
|
+
*/
|
|
49
|
+
private loadSchemaReferenceSync;
|
|
50
|
+
/**
|
|
51
|
+
* Validates schema references against multiple EC rules.
|
|
52
|
+
* @param schema The schema to validate.
|
|
53
|
+
*/
|
|
54
|
+
private validateSchemaReferences;
|
|
55
|
+
/**
|
|
56
|
+
* Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.
|
|
57
|
+
* @param schema The Schema the SchemaItem to.
|
|
58
|
+
* @param name The name of the schema item to be loaded.
|
|
59
|
+
* @param itemType The SchemaItemType of the item to load.
|
|
60
|
+
* @param schemaItemObject The Object to populate the SchemaItem with.
|
|
61
|
+
*/
|
|
62
|
+
private loadSchemaItem;
|
|
63
|
+
/**
|
|
64
|
+
* Given the schema item object, the anticipated type and the name a schema item is created and loaded into the schema provided.
|
|
65
|
+
* @param schema The Schema the SchemaItem to.
|
|
66
|
+
* @param name The name of the schema item to be loaded.
|
|
67
|
+
* @param itemType The SchemaItemType of the item to load.
|
|
68
|
+
* @param schemaItemObject The Object to populate the SchemaItem with.
|
|
69
|
+
*/
|
|
70
|
+
private loadSchemaItemSync;
|
|
71
|
+
/**
|
|
72
|
+
* Given the full (Schema.ItemName) or qualified (alias:ItemName) item name, returns
|
|
73
|
+
* a tuple of strings in the format ["SchemaName", "ItemName"]. The schema name may be
|
|
74
|
+
* empty if the item comes from the schema being parsed.
|
|
75
|
+
* @param fullOrQualifiedName The full or qualified name of the schema item.
|
|
76
|
+
* @param schema The schema that will be used to lookup the schema name by alias, if necessary.
|
|
77
|
+
*/
|
|
78
|
+
private static resolveSchemaAndItemName;
|
|
79
|
+
/**
|
|
80
|
+
* Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does
|
|
81
|
+
* not exist within the schema, the SchemaContext will be searched.
|
|
82
|
+
* @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.
|
|
83
|
+
* @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.
|
|
84
|
+
* @param loadCallBack Only called if the SchemaItem had to be loaded.
|
|
85
|
+
* @return The SchemaItem if it had to be loaded, otherwise undefined.
|
|
86
|
+
*/
|
|
87
|
+
private findSchemaItem;
|
|
88
|
+
/**
|
|
89
|
+
* Finds the a SchemaItem matching the name first by checking the schema that is being deserialized. If it does
|
|
90
|
+
* not exist within the schema, the SchemaContext will be searched.
|
|
91
|
+
* @param name The full (Schema.ItemName) or qualified (alias:ItemName) name of the SchemaItem to search for.
|
|
92
|
+
* @param skipVisitor Used to break Mixin -appliesTo-> Entity -extends-> Mixin cycle.
|
|
93
|
+
* @param loadCallBack Only called if the SchemaItem had to be loaded.
|
|
94
|
+
* @return The SchemaItem if it had to be loaded, otherwise undefined.
|
|
95
|
+
*/
|
|
96
|
+
private findSchemaItemSync;
|
|
97
|
+
/**
|
|
98
|
+
* Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.
|
|
99
|
+
* @param unit The Unit object that we are loading dependencies for and "deserializing into".
|
|
100
|
+
* @param rawUnit The serialized unit data
|
|
101
|
+
*/
|
|
102
|
+
private loadUnit;
|
|
103
|
+
/**
|
|
104
|
+
* Load dependencies on phenomenon and unitSystem for a Unit object and load the Unit from its serialized format.
|
|
105
|
+
* @param unit The Unit object that we are loading dependencies for and "deserializing into".
|
|
106
|
+
* @param rawUnit The serialized unit data
|
|
107
|
+
*/
|
|
108
|
+
private loadUnitSync;
|
|
109
|
+
/**
|
|
110
|
+
* Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.
|
|
111
|
+
* @param koq The KindOfQuantity object that we are loading dependencies for and "deserializing into".
|
|
112
|
+
* @param rawKoQ The serialized kind of quantity data
|
|
113
|
+
*/
|
|
114
|
+
private loadKindOfQuantity;
|
|
115
|
+
/**
|
|
116
|
+
* Load the persistence unit and presentation unit dependencies for a KindOfQuantity object and load the KoQ from its serialized format.
|
|
117
|
+
* @param koq The KindOfQuantity object that we are loading dependencies for and "deserializing into".
|
|
118
|
+
* @param rawKoQ The serialized kind of quantity data
|
|
119
|
+
*/
|
|
120
|
+
private loadKindOfQuantitySync;
|
|
121
|
+
/**
|
|
122
|
+
* Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.
|
|
123
|
+
* @param constant The Constant object that we are loading the phenomenon dependency for
|
|
124
|
+
* @param rawConstant The serialized constant data
|
|
125
|
+
*/
|
|
126
|
+
private loadConstant;
|
|
127
|
+
/**
|
|
128
|
+
* Load the phenomenon dependency for a Constant object and load the Constant from its serialized format.
|
|
129
|
+
* @param constant The Constant object that we are loading dependencies for and "deserializing into".
|
|
130
|
+
* @param rawConstant The serialized constant data
|
|
131
|
+
*/
|
|
132
|
+
private loadConstantSync;
|
|
133
|
+
/**
|
|
134
|
+
* Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.
|
|
135
|
+
* @param invertedUnit The InvertedUnit object that we are loading dependencies for and "deserializing into".
|
|
136
|
+
* @param rawInvertedUnit The serialized inverted unit data.
|
|
137
|
+
*/
|
|
138
|
+
private loadInvertedUnit;
|
|
139
|
+
/**
|
|
140
|
+
* Load the unit system and invertsUnit dependencies for an Inverted Unit object and load the Inverted Unit from its serialized format.
|
|
141
|
+
* @param invertedUnit The InvertedUnit object that we are loading dependencies for and "deserializing into".
|
|
142
|
+
* @param rawInvertedUnit The serialized inverted unit data.
|
|
143
|
+
*/
|
|
144
|
+
private loadInvertedUnitSync;
|
|
145
|
+
/**
|
|
146
|
+
* Load the unit dependencies for a Format object and load the Format from its serialized format.
|
|
147
|
+
* @param format The Format object that we are loading dependencies for and "deserializing into".
|
|
148
|
+
* @param rawFormat The serialized format data.
|
|
149
|
+
*/
|
|
150
|
+
private loadFormat;
|
|
151
|
+
/**
|
|
152
|
+
* Load the unit dependencies for a Format object and load the Format from its serialized format.
|
|
153
|
+
* @param format The Format object that we are loading dependencies for and "deserializing into".
|
|
154
|
+
* @param rawFormat The serialized format data.
|
|
155
|
+
*/
|
|
156
|
+
private loadFormatSync;
|
|
157
|
+
/**
|
|
158
|
+
* Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.
|
|
159
|
+
* @param classObj The ECClass object that we are loading dependencies for and "deserializing into".
|
|
160
|
+
* @param classProps The parsed class props object.
|
|
161
|
+
* @param rawClass The serialized class data.
|
|
162
|
+
*/
|
|
163
|
+
private loadClass;
|
|
164
|
+
/**
|
|
165
|
+
* Load the base class and property type dependencies for an ECClass object and load the ECClass (and its properties) from its serialized format.
|
|
166
|
+
* @param classObj The ECClass object that we are loading dependencies for and "deserializing into".
|
|
167
|
+
* @param classProps The parsed class props object.
|
|
168
|
+
* @param rawClass The serialized class data.
|
|
169
|
+
*/
|
|
170
|
+
private loadClassSync;
|
|
171
|
+
/**
|
|
172
|
+
* Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.
|
|
173
|
+
* @param entity The EntityClass that we are loading dependencies for and "deserializing into".
|
|
174
|
+
* @param rawEntity The serialized entity class data.
|
|
175
|
+
*/
|
|
176
|
+
private loadEntityClass;
|
|
177
|
+
/**
|
|
178
|
+
* Load the mixin, base class, and property type dependencies for an EntityClass object and load the EntityClass (and properties) from its serialized format.
|
|
179
|
+
* @param entity The EntityClass that we are loading dependencies for and "deserializing into".
|
|
180
|
+
* @param rawEntity The serialized entity class data.
|
|
181
|
+
*/
|
|
182
|
+
private loadEntityClassSync;
|
|
183
|
+
/**
|
|
184
|
+
* Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.
|
|
185
|
+
* @param mixin The Mixin that we are loading dependencies for and "deserializing into".
|
|
186
|
+
* @param rawMixin The serialized mixin data.
|
|
187
|
+
*/
|
|
188
|
+
private loadMixin;
|
|
189
|
+
/**
|
|
190
|
+
* Load the appliesTo class, base class, and property type dependencies for a Mixin object and load the Mixin (and properties) from its serialized format.
|
|
191
|
+
* @param mixin The Mixin that we are loading dependencies for and "deserializing into".
|
|
192
|
+
* @param rawMixin The serialized mixin data.
|
|
193
|
+
*/
|
|
194
|
+
private loadMixinSync;
|
|
195
|
+
/**
|
|
196
|
+
* Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.
|
|
197
|
+
* @param rel The RelationshipClass that we are loading dependencies for and "deserializing into".
|
|
198
|
+
* @param rawRel The serialized relationship class data.
|
|
199
|
+
*/
|
|
200
|
+
private loadRelationshipClass;
|
|
201
|
+
/**
|
|
202
|
+
* Load the relationship constraint, base class, and property type dependencies for a RelationshipClass object and load the RelationshipClass (and properties) from its serialized format.
|
|
203
|
+
* @param rel The RelationshipClass that we are loading dependencies for and "deserializing into".
|
|
204
|
+
* @param rawRel The serialized relationship class data.
|
|
205
|
+
*/
|
|
206
|
+
private loadRelationshipClassSync;
|
|
207
|
+
/**
|
|
208
|
+
* Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.
|
|
209
|
+
* @param relConstraint The RelationshipConstraint that we are loading dependencies for and "deserializing into".
|
|
210
|
+
* @param props The parsed relationship constraint props.
|
|
211
|
+
*/
|
|
212
|
+
private loadRelationshipConstraint;
|
|
213
|
+
/**
|
|
214
|
+
* Load the abstract constraint and constraint class dependencies for a RelationshipConstraint object and load the RelationshipConstraint from its parsed props.
|
|
215
|
+
* @param relConstraint The RelationshipConstraint that we are loading dependencies for and "deserializing into".
|
|
216
|
+
* @param props The parsed relationship constraint props.
|
|
217
|
+
*/
|
|
218
|
+
private loadRelationshipConstraintSync;
|
|
219
|
+
/**
|
|
220
|
+
* Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.
|
|
221
|
+
* @param classObj The ECClass that the Property should be created in.
|
|
222
|
+
* @param propName The name of the Property.
|
|
223
|
+
* @param propType The (serialized string) kind of property to create.
|
|
224
|
+
* @param rawProperty The serialized property data.
|
|
225
|
+
*/
|
|
226
|
+
private loadPropertyTypes;
|
|
227
|
+
/**
|
|
228
|
+
* Load the type dependencies for a serialized property, then creates and deserialized the Property object in the given ECClass.
|
|
229
|
+
* @param classObj The ECClass that the Property should be created in.
|
|
230
|
+
* @param propName The name of the Property.
|
|
231
|
+
* @param propType The (serialized string) kind of property to create.
|
|
232
|
+
* @param rawProperty The serialized property data.
|
|
233
|
+
*/
|
|
234
|
+
private loadPropertyTypesSync;
|
|
235
|
+
/**
|
|
236
|
+
* Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.
|
|
237
|
+
* @param propertyObj The Property that we are loading dependencies for and "deserializing into".
|
|
238
|
+
* @param props The parsed property props.
|
|
239
|
+
* @param rawProperty The serialized property data.
|
|
240
|
+
*/
|
|
241
|
+
private loadProperty;
|
|
242
|
+
/**
|
|
243
|
+
* Load the propertyCategory, kindOfQuantity, and customAttribute dependencies for a Property object and load the Property from its parsed props.
|
|
244
|
+
* @param propertyObj The Property that we are loading dependencies for and "deserializing into".
|
|
245
|
+
* @param props The parsed property props.
|
|
246
|
+
* @param rawProperty The serialized property data.
|
|
247
|
+
*/
|
|
248
|
+
private loadPropertySync;
|
|
249
|
+
/**
|
|
250
|
+
* Load the customAttribute class dependencies for a set of CustomAttribute objects and add
|
|
251
|
+
* them to a given custom attribute container.
|
|
252
|
+
* @param container The CustomAttributeContainer that each CustomAttribute will be added to.
|
|
253
|
+
* @param customAttributes An iterable set of parsed CustomAttribute objects.
|
|
254
|
+
*/
|
|
255
|
+
private loadCustomAttributes;
|
|
256
|
+
/**
|
|
257
|
+
* Load the customAttribute class dependencies for a set of CustomAttribute objects and add them to a given custom attribute container.
|
|
258
|
+
* @param container The CustomAttributeContainer that each CustomAttribute will be added to.
|
|
259
|
+
* @param customAttributes An iterable set of parsed CustomAttribute objects.
|
|
260
|
+
*/
|
|
261
|
+
private loadCustomAttributesSync;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=Helper.d.ts.map
|
|
@@ -0,0 +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,EAAE,MAAM,eAAe,CAAC;AAWpE,OAAO,EAAiB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,EAAE,kBAAkB,EAA6B,MAAM,8BAA8B,CAAC;AAE7F,OAAO,EAAkB,yBAAyB,EAAmB,MAAM,kBAAkB,CAAC;AAO9F;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,GAAG,OAAO;IACvC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,cAAc,CAAC,CAA4B;IACnD,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,OAAO,CAA2B;IAI1C,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,WAAW,CAAC,CAAa;gBAErB,UAAU,EAAE,yBAAyB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EA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