@itwin/ecschema-metadata 5.2.0-dev.3 → 5.2.0-dev.30
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 +55 -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 +9 -2
- 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/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js +58 -0
- package/lib/cjs/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/cjs/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/cjs/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js +62 -34
- package/lib/cjs/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js +465 -465
- package/lib/cjs/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
- package/lib/cjs/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/cjs/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js +16 -16
- package/lib/cjs/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/cjs/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/cjs/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/cjs/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js +309 -326
- package/lib/cjs/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +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.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +9 -22
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +2 -1
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/cjs/utils/SchemaLoadingController.js.map +1 -1
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +9 -2
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts +37 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.d.ts.map +1 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js +54 -0
- package/lib/esm/Formatting/FormatSetFormatsProvider.js.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.d.ts → Formatting/SchemaFormatsProvider.d.ts} +1 -1
- package/lib/esm/Formatting/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/{SchemaFormatsProvider.js → Formatting/SchemaFormatsProvider.js} +6 -6
- package/lib/esm/Formatting/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/IncrementalLoading/ClassParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts +18 -24
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js +61 -33
- package/lib/esm/IncrementalLoading/ECSqlSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js +465 -465
- package/lib/esm/IncrementalLoading/FullSchemaQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts +20 -3
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js +7 -4
- package/lib/esm/IncrementalLoading/IncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js +2 -7
- package/lib/esm/IncrementalLoading/IncrementalSchemaReader.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts +4 -4
- package/lib/esm/IncrementalLoading/SchemaItemParsers.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js +16 -16
- package/lib/esm/IncrementalLoading/SchemaItemParsers.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js +235 -235
- package/lib/esm/IncrementalLoading/SchemaItemQueries.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts +10 -4
- package/lib/esm/IncrementalLoading/SchemaParser.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaParser.js +19 -19
- package/lib/esm/IncrementalLoading/SchemaParser.js.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.d.ts.map +1 -1
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js +309 -326
- package/lib/esm/IncrementalLoading/SchemaStubQueries.js.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +1 -1
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +9 -22
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +2 -1
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/utils/SchemaLoadingController.js.map +1 -1
- package/package.json +6 -6
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/cjs/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js +0 -82
- package/lib/cjs/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/cjs/SchemaFormatsProvider.js.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts +0 -60
- package/lib/esm/IncrementalLoading/PerformanceLogger.d.ts.map +0 -1
- package/lib/esm/IncrementalLoading/PerformanceLogger.js +0 -78
- package/lib/esm/IncrementalLoading/PerformanceLogger.js.map +0 -1
- package/lib/esm/SchemaFormatsProvider.d.ts.map +0 -1
- package/lib/esm/SchemaFormatsProvider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAkE;AAClE,wDAAmI;AACnI,wCAA2D;AAC3D,uDAAoD;AACpD,4CAAwD;AACxD,2CAAwC;AACxC,4CAA8C;AAC9C,mEAAgE;AAChE,2DAAwD;AAExD;;;GAGG;AACH,MAAa,kBAAkB;IAWyB;IAV9C,cAAc,CAAgB;IAC9B,QAAQ,CAAgB;IAEhC;;;;;;OAMG;IACH,YAAY,gBAAgC,EAAU,iBAAkC,EAAE;QAApC,mBAAc,GAAd,cAAc,CAAsB;QACxF,IAAI,gBAAgB,YAAY,uBAAa,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,IAAI,uBAAa,EAAE,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,cAAc,CAAC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AAiB,IAAI,iBAAiB;wBAC7D,OAAO,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,uBAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAxRD,gDAwRC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\nimport { Unit } from \"../Metadata/Unit\";\nimport { SchemaItemType } from \"../ECObjects\";\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\n\n/**\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\n * @beta\n */\nexport class SchemaUnitProvider implements UnitsProvider {\n private _unitConverter: UnitConverter;\n private _context: SchemaContext;\n\n /**\n *\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\n * created and the locater will be added.\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\n */\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\n if (contextOrLocater instanceof SchemaContext) {\n this._context = contextOrLocater;\n } else {\n this._context = new SchemaContext();\n this._context.addLocater(contextOrLocater);\n }\n this._unitConverter = new UnitConverter(this._context);\n }\n\n /**\n * Find unit in a schema that has unitName.\n * @param unitName Full name of unit.\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\n */\n public async findUnitByName(unitName: string): Promise<UnitProps> {\n // Check if schema exists and unit exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n return new BadUnit(); // return BadUnit if schema does not exist\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const unit = await this._context.getSchemaItem(itemKey, Unit);\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\n return this.getUnitsProps(unit);\n\n const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit);\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\n return this.getUnitsProps(invertedUnit);\n }\n\n return new BadUnit();\n }\n\n /**\n * Find all units in context that belongs to given phenomenon.\n * @param phenomenon Full name of phenomenon.\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\n */\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\n // Check if schema exists and phenomenon exists in schema\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await this._context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\n return { phenomenon, schema: schemaName };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const phenom = await this._context.getSchemaItem(itemKey);\n if (!phenom)\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\n return { item: schemaItemName, schema: schemaName };\n });\n\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\n return { itemType: phenom.key.fullName };\n });\n\n // Find units' full name that match given phenomenon param.\n const filteredUnits: Array<UnitProps> = [];\n const schemaItems = this._context.getSchemaItems();\n for (const value of schemaItems) {\n if (Unit.isUnit(value)) {\n const foundPhenomenon = await value.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const foundPhenomenon = await invertsUnit.phenomenon;\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\n const unitProps = await this.getUnitsProps(value);\n filteredUnits.push(unitProps);\n }\n }\n }\n }\n\n return filteredUnits;\n }\n\n /**\n * Find alternate display labels associated with unitName, if any.\n * @param unitName Full name of Unit.\n */\n public getAlternateDisplayLabels(unitName: string): Array<string> {\n let alternateLabels: Array<string> = [];\n for (const entry of this._unitExtraData) {\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\n alternateLabels = entry.altDisplayLabels;\n }\n }\n\n return alternateLabels;\n }\n\n /**\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\n *\n * @param unitLabel Display label or alternate display label to query unit by.\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\n * @param phenomenon Full name of phenomenon that Unit belongs to.\n * @param unitSystem Full name of unitSystem that Unit belongs to.\n * @returns The UnitProps interface from the @itwin/core-quantity package.\n */\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n const findLabel = unitLabel.toLowerCase();\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\n\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n if (foundUnit.isValid)\n return foundUnit;\n\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\n }\n\n /**\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\n * @param fromUnit The UnitProps of the 'from' unit.\n * @param toUnit The UnitProps of the 'to' unit.\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\n */\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\n if (!fromUnit.isValid || !toUnit.isValid)\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\n return { fromUnit, toUnit };\n });\n\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\n\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\n const result: UnitConversionProps = {\n factor: conversion.factor,\n offset: conversion.offset,\n };\n if (fromIsInverted && !toIsInverted)\n result.inversion = UnitConversionInvert.InvertPreConversion;\n else if (!fromIsInverted && toIsInverted)\n result.inversion = UnitConversionInvert.InvertPostConversion;\n\n return result;\n }\n\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\n const schemaKey = new SchemaKey(schemaName);\n const schema = await context.getSchema(schemaKey);\n\n if (!schema) {\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\n return { name: input.name };\n });\n }\n\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\n const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit);\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\n }\n\n return { unitName: input.name, isInverted: false };\n }\n\n /**\n * Gets the @itwin/core UnitProps for the given Unit.\n * @param unit The Unit to convert.\n * @returns UnitProps interface from @itwin/core.\n */\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\n if (Unit.isUnit(unit)) {\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n const invertsUnit = await unit.invertsUnit;\n if (!invertsUnit)\n return new BadUnit();\n\n return {\n name: unit.fullName,\n label: unit.label ?? \"\",\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\n isValid: true,\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\n };\n }\n\n /**\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\n const schemaItems = this._context.getSchemaItems();\n for (const value of schemaItems) {\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\n const currPhenomenon = await value.phenomenon;\n const currUnitSystem = await value.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\n const invertsUnit = await value.invertsUnit;\n if (invertsUnit) {\n const currPhenomenon = await invertsUnit.phenomenon;\n const currUnitSystem = await invertsUnit.unitSystem;\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\n return this.getUnitsProps(value);\n }\n }\n }\n\n return new BadUnit();\n }\n\n /**\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\n * @internal\n */\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\n for (const entry of this._unitExtraData) {\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\n // Found altDisplayLabel that matches label to find\n const unitProps = await this.findUnitByName(entry.name);\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\n if (!schemaName && !phenomenon && !unitSystem)\n return unitProps;\n\n // Check if the provided values match unitProps\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\n // If all provided values match, return unitProps\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\n return unitProps;\n }\n }\n }\n return new BadUnit();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaUnitProvider.js","sourceRoot":"","sources":["../../../src/UnitProvider/SchemaUnitProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAkE;AAClE,wDAAmI;AACnI,wCAA2D;AAC3D,uDAAoD;AACpD,4CAAwD;AACxD,2CAAwC;AACxC,4CAA8C;AAC9C,mEAAgE;AAChE,2DAAwD;AAExD;;;GAGG;AACH,MAAa,kBAAkB;IAWyB;IAV9C,cAAc,CAAgB;IAC9B,QAAQ,CAAgB;IAEhC;;;;;;OAMG;IACH,YA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,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU;wBAC3C,OAAO,SAAS,CAAC;oBAEnB,+CAA+C;oBAC/C,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC7F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBAC3F,MAAM,iBAAiB,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;oBACvF,iDAAiD;oBACjD,IAAI,iBAAiB,IAAI,iBAAiB,IAAI,iBAAiB;wBAC7D,OAAO,SAAS,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,uBAAO,EAAE,CAAC;IACvB,CAAC;CACF;AAxRD,gDAwRC","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\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\r\nimport { BadUnit, UnitConversionInvert, UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { ISchemaLocater, SchemaContext } from \"../Context\";\r\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\r\nimport { SchemaItemKey, SchemaKey } from \"../SchemaKey\";\r\nimport { Unit } from \"../Metadata/Unit\";\r\nimport { SchemaItemType } from \"../ECObjects\";\r\nimport { UnitConverter } from \"../UnitConversion/UnitConverter\";\r\nimport { InvertedUnit } from \"../Metadata/InvertedUnit\";\r\n\r\n/**\r\n * Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.\r\n * @beta\r\n */\r\nexport class SchemaUnitProvider implements UnitsProvider {\r\n private _unitConverter: UnitConverter;\r\n private _context: SchemaContext;\r\n\r\n /**\r\n *\r\n * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext\r\n * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be\r\n * created and the locater will be added.\r\n * @param _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.\r\n */\r\n constructor(contextOrLocater: ISchemaLocater, private _unitExtraData: UnitExtraData[] = []) {\r\n if (contextOrLocater instanceof SchemaContext) {\r\n this._context = contextOrLocater;\r\n } else {\r\n this._context = new SchemaContext();\r\n this._context.addLocater(contextOrLocater);\r\n }\r\n this._unitConverter = new UnitConverter(this._context);\r\n }\r\n\r\n /**\r\n * Find unit in a schema that has unitName.\r\n * @param unitName Full name of unit.\r\n * @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.\r\n */\r\n public async findUnitByName(unitName: string): Promise<UnitProps> {\r\n // Check if schema exists and unit exists in schema\r\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(unitName);\r\n const schemaKey = new SchemaKey(schemaName);\r\n const schema = await this._context.getSchema(schemaKey);\r\n\r\n if (!schema) {\r\n return new BadUnit(); // return BadUnit if schema does not exist\r\n }\r\n\r\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\r\n const unit = await this._context.getSchemaItem(itemKey, Unit);\r\n if (unit && unit.schemaItemType === SchemaItemType.Unit)\r\n return this.getUnitsProps(unit);\r\n\r\n const invertedUnit = await this._context.getSchemaItem(itemKey, InvertedUnit);\r\n if (invertedUnit && invertedUnit.schemaItemType === SchemaItemType.InvertedUnit) {\r\n return this.getUnitsProps(invertedUnit);\r\n }\r\n\r\n return new BadUnit();\r\n }\r\n\r\n /**\r\n * Find all units in context that belongs to given phenomenon.\r\n * @param phenomenon Full name of phenomenon.\r\n * @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.\r\n */\r\n public async getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>> {\r\n // Check if schema exists and phenomenon exists in schema\r\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(phenomenon);\r\n const schemaKey = new SchemaKey(schemaName);\r\n const schema = await this._context.getSchema(schemaKey);\r\n\r\n if (!schema) {\r\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema for phenomenon\", () => {\r\n return { phenomenon, schema: schemaName };\r\n });\r\n }\r\n\r\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\r\n const phenom = await this._context.getSchemaItem(itemKey);\r\n if (!phenom)\r\n throw new BentleyError(BentleyStatus.ERROR, \"Cannot find schema item/phenomenon\", () => {\r\n return { item: schemaItemName, schema: schemaName };\r\n });\r\n\r\n if (phenom.schemaItemType !== SchemaItemType.Phenomenon)\r\n throw new BentleyError(BentleyStatus.ERROR, \"Item is not a phenomenon\", () => {\r\n return { itemType: phenom.key.fullName };\r\n });\r\n\r\n // Find units' full name that match given phenomenon param.\r\n const filteredUnits: Array<UnitProps> = [];\r\n const schemaItems = this._context.getSchemaItems();\r\n for (const value of schemaItems) {\r\n if (Unit.isUnit(value)) {\r\n const foundPhenomenon = await value.phenomenon;\r\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\r\n const unitProps = await this.getUnitsProps(value);\r\n filteredUnits.push(unitProps);\r\n }\r\n } else if (InvertedUnit.isInvertedUnit(value) && value.invertsUnit) {\r\n const invertsUnit = await value.invertsUnit;\r\n if (invertsUnit) {\r\n const foundPhenomenon = await invertsUnit.phenomenon;\r\n if (foundPhenomenon && foundPhenomenon.key.matchesFullName(phenomenon)) {\r\n const unitProps = await this.getUnitsProps(value);\r\n filteredUnits.push(unitProps);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return filteredUnits;\r\n }\r\n\r\n /**\r\n * Find alternate display labels associated with unitName, if any.\r\n * @param unitName Full name of Unit.\r\n */\r\n public getAlternateDisplayLabels(unitName: string): Array<string> {\r\n let alternateLabels: Array<string> = [];\r\n for (const entry of this._unitExtraData) {\r\n if (entry.name.toLowerCase() === unitName.toLowerCase()) {\r\n alternateLabels = entry.altDisplayLabels;\r\n }\r\n }\r\n\r\n return alternateLabels;\r\n }\r\n\r\n /**\r\n * Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in\r\n * this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display\r\n * labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.\r\n *\r\n * @param unitLabel Display label or alternate display label to query unit by.\r\n * @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.\r\n * @param phenomenon Full name of phenomenon that Unit belongs to.\r\n * @param unitSystem Full name of unitSystem that Unit belongs to.\r\n * @returns The UnitProps interface from the @itwin/core-quantity package.\r\n */\r\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n const findLabel = unitLabel.toLowerCase();\r\n const findSchema = schemaName ? schemaName.toLowerCase() : undefined;\r\n const findPhenomenon = phenomenon ? phenomenon.toLowerCase() : undefined;\r\n const findUnitSystem = unitSystem ? unitSystem.toLowerCase() : undefined;\r\n\r\n const foundUnit: UnitProps = await this.findUnitByDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\r\n if (foundUnit.isValid)\r\n return foundUnit;\r\n\r\n // If there is no Unit with display label that matches label, then check for alternate display labels that may match\r\n return this.findUnitByAltDisplayLabel(findLabel, findSchema, findPhenomenon, findUnitSystem);\r\n }\r\n\r\n /**\r\n * Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.\r\n * @param fromUnit The UnitProps of the 'from' unit.\r\n * @param toUnit The UnitProps of the 'to' unit.\r\n * @returns The UnitConversionProps interface from the @itwin/core-quantity package.\r\n */\r\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\r\n // need to check if either side is an inverted unit. The UnitConverter can only handle Units\r\n if (!fromUnit.isValid || !toUnit.isValid)\r\n throw new BentleyError(BentleyStatus.ERROR, \"Both provided units must be valid.\", () => {\r\n return { fromUnit, toUnit };\r\n });\r\n\r\n const { unitName: fromUnitName, isInverted: fromIsInverted } = await this.checkUnitPropsForConversion(fromUnit, this._context);\r\n const { unitName: toUnitName, isInverted: toIsInverted } = await this.checkUnitPropsForConversion(toUnit, this._context);\r\n\r\n const conversion = await this._unitConverter.calculateConversion(fromUnitName, toUnitName);\r\n const result: UnitConversionProps = {\r\n factor: conversion.factor,\r\n offset: conversion.offset,\r\n };\r\n if (fromIsInverted && !toIsInverted)\r\n result.inversion = UnitConversionInvert.InvertPreConversion;\r\n else if (!fromIsInverted && toIsInverted)\r\n result.inversion = UnitConversionInvert.InvertPostConversion;\r\n\r\n return result;\r\n }\r\n\r\n private async checkUnitPropsForConversion(input: UnitProps, context: SchemaContext): Promise<{ unitName: string, isInverted: boolean }> {\r\n const [schemaName, schemaItemName] = SchemaItem.parseFullName(input.name);\r\n const schemaKey = new SchemaKey(schemaName);\r\n const schema = await context.getSchema(schemaKey);\r\n\r\n if (!schema) {\r\n throw new BentleyError(BentleyStatus.ERROR, \"Could not obtain schema for unit.\", () => {\r\n return { name: input.name };\r\n });\r\n }\r\n\r\n const itemKey = new SchemaItemKey(schemaItemName, schema.schemaKey);\r\n const invertedUnit = await context.getSchemaItem(itemKey, InvertedUnit);\r\n // Check if we found an item, the item is an inverted unit, and it has its invertsUnit property set\r\n if (invertedUnit && InvertedUnit.isInvertedUnit(invertedUnit) && invertedUnit.invertsUnit) {\r\n return { unitName: invertedUnit.invertsUnit.fullName, isInverted: true };\r\n }\r\n\r\n return { unitName: input.name, isInverted: false };\r\n }\r\n\r\n /**\r\n * Gets the @itwin/core UnitProps for the given Unit.\r\n * @param unit The Unit to convert.\r\n * @returns UnitProps interface from @itwin/core.\r\n */\r\n private async getUnitsProps(unit: Unit | InvertedUnit): Promise<UnitProps> {\r\n if (Unit.isUnit(unit)) {\r\n return {\r\n name: unit.fullName,\r\n label: unit.label ?? \"\",\r\n phenomenon: unit.phenomenon ? unit.phenomenon.fullName : \"\",\r\n isValid: true,\r\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\r\n };\r\n }\r\n\r\n const invertsUnit = await unit.invertsUnit;\r\n if (!invertsUnit)\r\n return new BadUnit();\r\n\r\n return {\r\n name: unit.fullName,\r\n label: unit.label ?? \"\",\r\n phenomenon: invertsUnit.phenomenon ? invertsUnit.phenomenon.fullName : \"\",\r\n isValid: true,\r\n system: unit.unitSystem === undefined ? \"\" : unit.unitSystem.fullName,\r\n };\r\n }\r\n\r\n /**\r\n * Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\r\n * @internal\r\n */\r\n private async findUnitByDisplayLabel(displayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n // TODO: Known bug: This only looks through loaded schemas. If schema name is provided, we can attempt to load that schema\r\n const schemaItems = this._context.getSchemaItems();\r\n for (const value of schemaItems) {\r\n if (Unit.isUnit(value) && value.label?.toLowerCase() === displayLabel) {\r\n // TODO: this can be optimized. We don't have to await these if we don't want to check for them\r\n const currPhenomenon = await value.phenomenon;\r\n const currUnitSystem = await value.unitSystem;\r\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\r\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\r\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\r\n return this.getUnitsProps(value);\r\n } else if (InvertedUnit.isInvertedUnit(value) && value.label?.toLowerCase() === displayLabel && value.invertsUnit) {\r\n const invertsUnit = await value.invertsUnit;\r\n if (invertsUnit) {\r\n const currPhenomenon = await invertsUnit.phenomenon;\r\n const currUnitSystem = await invertsUnit.unitSystem;\r\n if (!schemaName || value.schema.name.toLowerCase() === schemaName)\r\n if (!phenomenon || (currPhenomenon && currPhenomenon.key.matchesFullName(phenomenon)))\r\n if (!unitSystem || (currUnitSystem && currUnitSystem.key.matchesFullName(unitSystem)))\r\n return this.getUnitsProps(value);\r\n }\r\n }\r\n }\r\n\r\n return new BadUnit();\r\n }\r\n\r\n /**\r\n * Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.\r\n * @internal\r\n */\r\n private async findUnitByAltDisplayLabel(altDisplayLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n for (const entry of this._unitExtraData) {\r\n if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {\r\n if (entry.altDisplayLabels.findIndex((ref: string) => ref.toLowerCase() === altDisplayLabel) !== -1) {\r\n // Found altDisplayLabel that matches label to find\r\n const unitProps = await this.findUnitByName(entry.name);\r\n // If no schemaName, phenomenon, or unitSystem are provided, return unitProps\r\n if (!schemaName && !phenomenon && !unitSystem)\r\n return unitProps;\r\n\r\n // Check if the provided values match unitProps\r\n const schemaNameMatches = !schemaName || unitProps.name.toLowerCase().startsWith(schemaName);\r\n const phenomenonMatches = !phenomenon || unitProps.phenomenon.toLowerCase() === phenomenon;\r\n const unitSystemMatches = !unitSystem || unitProps.system.toLowerCase() === unitSystem;\r\n // If all provided values match, return unitProps\r\n if (schemaNameMatches && phenomenonMatches && unitSystemMatches)\r\n return unitProps;\r\n }\r\n }\r\n }\r\n return new BadUnit();\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,4CAA8C;AAC9C,6CAA4C;AAI5C,4EAA6F;AAE7F;;;;GAIG;AACH,MAAa,YAAY;IACf,cAAc,CAA4B;IAElD,2GAA2G;IAC3G,sEAAsE;IAC9D,OAAO,CAAU;IAEzB;;;OAGG;IACH,YAAY,OAA2B;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,qDAAyB,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,cAAc,CAAC,MAAc;QACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAElD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACxC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,UAAsB;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,eAAO,CAAC,SAAS,CAAC,UAAU,CAAC;YAC/B,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB;QAC1C,KAAK,MAAM,QAAQ,IAAI,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,OAAO,CAAC,cAAc,KAAK,0BAAc,CAAC,iBAAiB,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA/CD,oCA+CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { SchemaItemType } from \"../ECObjects\";\nimport { ECClass } from \"../Metadata/Class\";\nimport { RelationshipClass } from \"../Metadata/RelationshipClass\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\n\n/**\n * The purpose of this class is to traverse a given schema, allowing clients to hook into\n * the traversal process via Visitors to allow for custom processing of the schema elements.\n * @internal\n */\nexport class SchemaWalker {\n private _visitorHelper: SchemaPartVisitorDelegate;\n\n // This is a cache of the schema we are traversing. The schema also exists within the _context but in order\n // to not have to go back to the context every time we use this cache.\n private _schema?: Schema;\n\n /**\n * Initializes a new SchemaWalker instance.\n * @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.\n */\n constructor(visitor: ISchemaPartVisitor) {\n this._visitorHelper = new SchemaPartVisitorDelegate(visitor);\n }\n\n /**\n * Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.\n * @param schema The Schema to traverse.\n */\n public async traverseSchema(schema: Schema): Promise<Schema> {\n this._schema = schema;\n\n await this._visitorHelper.visitSchema(schema);\n await this._visitorHelper.visitSchemaPart(schema);\n\n for (const item of this._schema.getItems())\n await this.traverseSchemaItem(item);\n return schema;\n }\n\n private async traverseSchemaItem(schemaItem: SchemaItem): Promise<void> {\n await this._visitorHelper.visitSchemaPart(schemaItem);\n\n if (ECClass.isECClass(schemaItem))\n await this.traverseClass(schemaItem);\n }\n\n private async traverseClass(ecClass: ECClass): Promise<void> {\n for (const property of await ecClass.getProperties(true)) {\n await this._visitorHelper.visitSchemaPart(property);\n }\n\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass) {\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).source);\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).target);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaWalker.js","sourceRoot":"","sources":["../../../src/Validation/SchemaWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,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,CAAC,cAAc,CAAC,eAAe,CAAE,OAA6B,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;CACF;AA/CD,oCA+CC","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 { SchemaItemType } from \"../ECObjects\";\r\nimport { ECClass } from \"../Metadata/Class\";\r\nimport { RelationshipClass } from \"../Metadata/RelationshipClass\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\nimport { SchemaItem } from \"../Metadata/SchemaItem\";\r\nimport { ISchemaPartVisitor, SchemaPartVisitorDelegate } from \"../SchemaPartVisitorDelegate\";\r\n\r\n/**\r\n * The purpose of this class is to traverse a given schema, allowing clients to hook into\r\n * the traversal process via Visitors to allow for custom processing of the schema elements.\r\n * @internal\r\n */\r\nexport class SchemaWalker {\r\n private _visitorHelper: SchemaPartVisitorDelegate;\r\n\r\n // This is a cache of the schema we are traversing. The schema also exists within the _context but in order\r\n // to not have to go back to the context every time we use this cache.\r\n private _schema?: Schema;\r\n\r\n /**\r\n * Initializes a new SchemaWalker instance.\r\n * @param visitor An ISchemaWalkerVisitor implementation whose methods will be called during schema traversal.\r\n */\r\n constructor(visitor: ISchemaPartVisitor) {\r\n this._visitorHelper = new SchemaPartVisitorDelegate(visitor);\r\n }\r\n\r\n /**\r\n * Traverses the given Schema, calling ISchemaWalkerVisitor methods along the way.\r\n * @param schema The Schema to traverse.\r\n */\r\n public async traverseSchema(schema: Schema): Promise<Schema> {\r\n this._schema = schema;\r\n\r\n await this._visitorHelper.visitSchema(schema);\r\n await this._visitorHelper.visitSchemaPart(schema);\r\n\r\n for (const item of this._schema.getItems())\r\n await this.traverseSchemaItem(item);\r\n return schema;\r\n }\r\n\r\n private async traverseSchemaItem(schemaItem: SchemaItem): Promise<void> {\r\n await this._visitorHelper.visitSchemaPart(schemaItem);\r\n\r\n if (ECClass.isECClass(schemaItem))\r\n await this.traverseClass(schemaItem);\r\n }\r\n\r\n private async traverseClass(ecClass: ECClass): Promise<void> {\r\n for (const property of await ecClass.getProperties(true)) {\r\n await this._visitorHelper.visitSchemaPart(property);\r\n }\r\n\r\n if (ecClass.schemaItemType === SchemaItemType.RelationshipClass) {\r\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).source);\r\n await this._visitorHelper.visitSchemaPart((ecClass as RelationshipClass).target);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -36,7 +36,8 @@ export * from "./UnitConversion/UnitConverter";
|
|
|
36
36
|
export * from "./UnitProvider/SchemaUnitProvider";
|
|
37
37
|
export * from "./Validation/SchemaWalker";
|
|
38
38
|
export * from "./SchemaPartVisitorDelegate";
|
|
39
|
-
export * from "./SchemaFormatsProvider";
|
|
39
|
+
export * from "./Formatting/SchemaFormatsProvider";
|
|
40
|
+
export * from "./Formatting/FormatSetFormatsProvider";
|
|
40
41
|
export * from "./IncrementalLoading/ECSqlSchemaLocater";
|
|
41
42
|
export * from "./IncrementalLoading/IncrementalSchemaLocater";
|
|
42
43
|
export { CustomAttribute, CustomAttributeContainerProps } from "./Metadata/CustomAttribute";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.d.ts","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":"AAKA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EA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AAE,aAAa,EAAE,2BAA2B,GACjG,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAC,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -85,7 +85,8 @@ __exportStar(require("./UnitConversion/UnitConverter"), exports);
|
|
|
85
85
|
__exportStar(require("./UnitProvider/SchemaUnitProvider"), exports);
|
|
86
86
|
__exportStar(require("./Validation/SchemaWalker"), exports);
|
|
87
87
|
__exportStar(require("./SchemaPartVisitorDelegate"), exports);
|
|
88
|
-
__exportStar(require("./SchemaFormatsProvider"), exports);
|
|
88
|
+
__exportStar(require("./Formatting/SchemaFormatsProvider"), exports);
|
|
89
|
+
__exportStar(require("./Formatting/FormatSetFormatsProvider"), exports);
|
|
89
90
|
__exportStar(require("./IncrementalLoading/ECSqlSchemaLocater"), exports);
|
|
90
91
|
__exportStar(require("./IncrementalLoading/IncrementalSchemaLocater"), exports);
|
|
91
92
|
var SchemaGraph_1 = require("./utils/SchemaGraph");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecschema-metadata.js","sourceRoot":"","sources":["../../src/ecschema-metadata.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,8CAA4B;AAC5B,4CAA0B;AAC1B,mDAAiC;AACjC,oEAAkD;AAClD,8DAA4C;AAC5C,2DAAyC;AACzC,8DAA4C;AAC5C,2CAAyB;AACzB,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,0CAAwD;AAA/C,gGAAA,OAAO,OAAA;AAAE,oGAAA,WAAW,OAAA;AAC7B,gDAA+C;AAAtC,oGAAA,QAAQ,OAAA;AACjB,wEAAuE;AAA9D,4HAAA,oBAAoB,OAAA;AAC7B,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAgF;AAAxD,0GAAA,WAAW,OAAA;AACnC,4CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,0CAAyC;AAAhC,8FAAA,KAAK,OAAA;AACd,4DAA0C;AAC1C,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,gDAI6B;AAH3B,oGAAA,QAAQ,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxF,+GAAA,mBAAmB,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AACX,yGAAA,aAAa,OAAA;AAAE,uHAAA,2BAA2B,OAAA;AAElG,gEAA+D;AAAtD,oHAAA,gBAAgB,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+GAAA,mBAAmB,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxF,+GAAA,mBAAmB,OAAA;AAAE,oHAAA,wBAAwB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AACX,yGAAA,aAAa,OAAA;AAAE,uHAAA,2BAA2B,OAAA;AAElG,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,kEAAmH;AAA1G,sHAAA,iBAAiB,OAAA;AAAE,2HAAA,sBAAsB,OAAA;AAAE,6HAAA,wBAAwB,OAAA;AAC5E,4CAA2C;AAAlC,gGAAA,MAAM,OAAA;AACf,wDAAsC;AACtC,wCAAuC;AAA9B,4FAAA,IAAI,OAAA;AACb,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,kDAAgC;AAChC,sDAAoC;AACpC,8CAA4B;AAC5B,iDAA+B;AAC/B,kEAAgD;AAChD,iEAA+C;AAC/C,oEAAkD;AAClD,4DAA0C;AAC1C,8DAA4C;AAC5C,qEAAmD;AACnD,wEAAsD;AACtD,0EAAwD;AACxD,gFAA8D;AAE9D,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAEpB;;GAEG;AACH;;;GAGG;AACH;;;GAGG","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\nexport * from \"./Constants\";\r\nexport * from \"./Context\";\r\nexport * from \"./DelayedPromise\";\r\nexport * from \"./Deserialization/SchemaGraphUtil\";\r\nexport * from \"./Deserialization/JsonProps\";\r\nexport * from \"./Deserialization/Helper\";\r\nexport * from \"./Deserialization/XmlParser\";\r\nexport * from \"./ECName\";\r\nexport * from \"./ECObjects\";\r\nexport * from \"./Exception\";\r\nexport * from \"./Interfaces\";\r\nexport { ECClass, StructClass } from \"./Metadata/Class\";\r\nexport { Constant } from \"./Metadata/Constant\";\r\nexport { CustomAttributeClass } from \"./Metadata/CustomAttributeClass\";\r\nexport { EntityClass } from \"./Metadata/EntityClass\";\r\nexport { AnyEnumerator, Enumeration, Enumerator } from \"./Metadata/Enumeration\";\r\nexport { Format } from \"./Metadata/Format\";\r\nexport { InvertedUnit } from \"./Metadata/InvertedUnit\";\r\nexport { KindOfQuantity } from \"./Metadata/KindOfQuantity\";\r\nexport { Mixin } from \"./Metadata/Mixin\";\r\nexport * from \"./Metadata/OverrideFormat\";\r\nexport { Phenomenon } from \"./Metadata/Phenomenon\";\r\nexport {\r\n Property, PrimitiveProperty, PrimitiveArrayProperty, EnumerationProperty, StructProperty,\r\n StructArrayProperty, EnumerationArrayProperty, NavigationProperty, AnyArrayProperty, AnyEnumerationProperty,\r\n AnyPrimitiveProperty, AnyProperty, AnyStructProperty, ArrayProperty, PrimitiveOrEnumPropertyBase,\r\n} from \"./Metadata/Property\";\r\nexport { PropertyCategory } from \"./Metadata/PropertyCategory\";\r\nexport { RelationshipClass, RelationshipConstraint, RelationshipMultiplicity } from \"./Metadata/RelationshipClass\";\r\nexport { Schema } from \"./Metadata/Schema\";\r\nexport * from \"./Metadata/SchemaItem\";\r\nexport { Unit } from \"./Metadata/Unit\";\r\nexport { UnitSystem } from \"./Metadata/UnitSystem\";\r\nexport * from \"./PropertyTypes\";\r\nexport * from \"./SchemaJsonLocater\";\r\nexport * from \"./SchemaKey\";\r\nexport * from \"./SchemaLoader\";\r\nexport * from \"./UnitConversion/UnitConversion\";\r\nexport * from \"./UnitConversion/UnitConverter\";\r\nexport * from \"./UnitProvider/SchemaUnitProvider\";\r\nexport * from \"./Validation/SchemaWalker\";\r\nexport * from \"./SchemaPartVisitorDelegate\";\r\nexport * from \"./Formatting/SchemaFormatsProvider\";\r\nexport * from \"./Formatting/FormatSetFormatsProvider\";\r\nexport * from \"./IncrementalLoading/ECSqlSchemaLocater\";\r\nexport * from \"./IncrementalLoading/IncrementalSchemaLocater\";\r\nexport { CustomAttribute, CustomAttributeContainerProps} from \"./Metadata/CustomAttribute\";\r\nexport { SchemaGraph } from \"./utils/SchemaGraph\";\r\n\r\n/** @docs-package-description\r\n * The ecschema-metadata package contains classes for working with ECSchemas that can be used in both [frontend]($docs/learning/frontend/index.md) and [backend]($docs/learning/backend/index.md).\r\n */\r\n/**\r\n * @docs-group-description Metadata\r\n * Definitions of classes and interfaces that represent all [EC elements]($docs/bis/ec/index.md).\r\n */\r\n/**\r\n * @docs-group-description Utils\r\n * A set of utility classes used throughout the package.\r\n */\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaGraph.js","sourceRoot":"","sources":["../../../src/utils/SchemaGraph.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,4CAA+C;AAC/C,4CAA6D;AAc7D;;;GAGG;AACH,MAAa,WAAW;IACd,QAAQ,GAAiB,EAAE,CAAC;IAEpC,gBAAwB,CAAC;IAEjB,IAAI,CAAC,SAAoB;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,2BAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7G,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACnC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,QAAQ,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,aAAa,EAAE,WAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,2BAA2B,MAAM,EAAE,CAAC,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,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,kCAAkC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;oBACpM,CAAC;oBACD,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAAC,MAAc;QAC5C,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;QAEhC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;YAC7B,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzB,OAAO;YAET,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEvB,KAAK,MAAM,SAAS,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;oBAClC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;CAEF;AAvHD,kCAuHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { SchemaContext } from \"../Context\";\nimport { SchemaMatchType } from \"../ECObjects\";\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\nimport { SchemaInfo } from \"../Interfaces\";\nimport { Schema } from \"../Metadata/Schema\";\nimport { SchemaKey } from \"../SchemaKey\";\n\n/**\n * A schema and it's reference that make up part of a schema cycle\n * @internal\n */\nexport interface ReferenceCycle {\n schema: SchemaInfo;\n refSchema: SchemaInfo;\n}\n\n/**\n * Utility class for detecting cyclic references in a Schema graph.\n * @internal\n */\nexport class SchemaGraph {\n private _schemas: SchemaInfo[] = [];\n\n private constructor() { }\n\n private find(schemaKey: SchemaKey) {\n return this._schemas.find((info: SchemaInfo) => info.schemaKey.matches(schemaKey, SchemaMatchType.Latest));\n }\n\n /**\n * Detected cyclic references in a schema and throw an exception if a cycle is found.\n */\n public throwIfCycles() {\n const cycles = this.detectCycles();\n if (cycles) {\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Schema '${this._schemas[0].schemaKey.name}' has reference cycles: ${result}`);\n }\n }\n\n /**\n * Detected cyclic references in a schema.\n * @returns An array describing the cycle if there is a cycle or undefined if no cycles found.\n */\n public detectCycles(): ReferenceCycle[] | undefined {\n const visited = {};\n const recStack = {};\n const cycles: ReferenceCycle[] = [];\n\n for (const schema of this._schemas) {\n if (this.detectCycleUtil(schema, visited, recStack, cycles)) {\n return cycles.length > 0 ? cycles : undefined;\n }\n }\n\n return undefined;\n }\n\n private detectCycleUtil(schema: SchemaInfo, visited: any, recStack: any, cycles: ReferenceCycle[]): boolean {\n let cycleFound = false;\n\n if (!visited[schema.schemaKey.name]) {\n visited[schema.schemaKey.name] = true;\n recStack[schema.schemaKey.name] = true;\n\n for (const refKey of schema.references) {\n const refSchema = this.find(refKey.schemaKey);\n if (undefined === refSchema)\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not find the schema info for ref schema ${refKey.schemaKey.toString()} for schema ${schema.schemaKey.toString()}`);\n if (!visited[refKey.schemaKey.name] && this.detectCycleUtil(refSchema, visited, recStack, cycles)) {\n cycles.push({ schema, refSchema });\n cycleFound = true;\n } else if (recStack[refKey.schemaKey.name]) {\n cycles.push({ schema, refSchema });\n cycleFound = true;\n }\n }\n }\n if (!cycleFound)\n recStack[schema.schemaKey.name] = false;\n\n return cycleFound;\n }\n\n /**\n * Generates a SchemaGraph for the input schema using the context to find info on referenced schemas. Use the generateGraphSync if you have the fully loaded Schema.\n * @param schema The SchemaInfo to build the graph from\n * @param context The SchemaContext used to locate info on the referenced schemas\n * @returns A SchemaGraph that can be used to detect schema cycles\n */\n public static async generateGraph(schema: SchemaInfo, context: SchemaContext): Promise<SchemaGraph> {\n const graph = new SchemaGraph();\n\n const genGraph = async (s: SchemaInfo) => {\n if (graph.find(s.schemaKey))\n return;\n\n graph._schemas.push(s);\n\n for (const refSchema of s.references) {\n if (!graph.find(refSchema.schemaKey)) {\n const refInfo = await context.getSchemaInfo(refSchema.schemaKey, SchemaMatchType.LatestWriteCompatible);\n if (undefined === refInfo) {\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema,\n `Could not locate the referenced schema, ${refSchema.schemaKey.name}.${refSchema.schemaKey.version.toString()}, of ${s.schemaKey.name} when populating the graph for ${schema.schemaKey.name}`);\n }\n await genGraph(refInfo);\n }\n }\n };\n\n await genGraph(schema);\n return graph;\n }\n\n /**\n * Generates a SchemaGraph for the input schema. Use the generateGraph if you just have schema info.\n * @param schema The Schema to build the graph from.\n * @returns A SchemaGraph that can be used to detect schema cycles\n */\n public static generateGraphSync(schema: Schema): SchemaGraph {\n const graph = new SchemaGraph();\n\n const genGraph = (s: Schema) => {\n if (graph.find(s.schemaKey))\n return;\n\n graph._schemas.push(s);\n\n for (const refSchema of s.references) {\n if (!graph.find(refSchema.schemaKey))\n genGraph(refSchema);\n }\n };\n\n genGraph(schema);\n return graph;\n }\n\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"SchemaGraph.js","sourceRoot":"","sources":["../../../src/utils/SchemaGraph.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAG/F,4CAA+C;AAC/C,4CAA6D;AAc7D;;;GAGG;AACH,MAAa,WAAW;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AAE;YAC7B,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzB,OAAO;YAET,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAEvB,KAAK,MAAM,SAAS,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;oBAClC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;CAEF;AAvHD,kCAuHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { SchemaContext } from \"../Context\";\r\nimport { SchemaMatchType } from \"../ECObjects\";\r\nimport { ECSchemaError, ECSchemaStatus } from \"../Exception\";\r\nimport { SchemaInfo } from \"../Interfaces\";\r\nimport { Schema } from \"../Metadata/Schema\";\r\nimport { SchemaKey } from \"../SchemaKey\";\r\n\r\n/**\r\n * A schema and it's reference that make up part of a schema cycle\r\n * @internal\r\n */\r\nexport interface ReferenceCycle {\r\n schema: SchemaInfo;\r\n refSchema: SchemaInfo;\r\n}\r\n\r\n/**\r\n * Utility class for detecting cyclic references in a Schema graph.\r\n * @internal\r\n */\r\nexport class SchemaGraph {\r\n private _schemas: SchemaInfo[] = [];\r\n\r\n private constructor() { }\r\n\r\n private find(schemaKey: SchemaKey) {\r\n return this._schemas.find((info: SchemaInfo) => info.schemaKey.matches(schemaKey, SchemaMatchType.Latest));\r\n }\r\n\r\n /**\r\n * Detected cyclic references in a schema and throw an exception if a cycle is found.\r\n */\r\n public throwIfCycles() {\r\n const cycles = this.detectCycles();\r\n if (cycles) {\r\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\r\n throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `Schema '${this._schemas[0].schemaKey.name}' has reference cycles: ${result}`);\r\n }\r\n }\r\n\r\n /**\r\n * Detected cyclic references in a schema.\r\n * @returns An array describing the cycle if there is a cycle or undefined if no cycles found.\r\n */\r\n public detectCycles(): ReferenceCycle[] | undefined {\r\n const visited = {};\r\n const recStack = {};\r\n const cycles: ReferenceCycle[] = [];\r\n\r\n for (const schema of this._schemas) {\r\n if (this.detectCycleUtil(schema, visited, recStack, cycles)) {\r\n return cycles.length > 0 ? cycles : undefined;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private detectCycleUtil(schema: SchemaInfo, visited: any, recStack: any, cycles: ReferenceCycle[]): boolean {\r\n let cycleFound = false;\r\n\r\n if (!visited[schema.schemaKey.name]) {\r\n visited[schema.schemaKey.name] = true;\r\n recStack[schema.schemaKey.name] = true;\r\n\r\n for (const refKey of schema.references) {\r\n const refSchema = this.find(refKey.schemaKey);\r\n if (undefined === refSchema)\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLoadSchema, `Could not find the schema info for ref schema ${refKey.schemaKey.toString()} for schema ${schema.schemaKey.toString()}`);\r\n if (!visited[refKey.schemaKey.name] && this.detectCycleUtil(refSchema, visited, recStack, cycles)) {\r\n cycles.push({ schema, refSchema });\r\n cycleFound = true;\r\n } else if (recStack[refKey.schemaKey.name]) {\r\n cycles.push({ schema, refSchema });\r\n cycleFound = true;\r\n }\r\n }\r\n }\r\n if (!cycleFound)\r\n recStack[schema.schemaKey.name] = false;\r\n\r\n return cycleFound;\r\n }\r\n\r\n /**\r\n * Generates a SchemaGraph for the input schema using the context to find info on referenced schemas. Use the generateGraphSync if you have the fully loaded Schema.\r\n * @param schema The SchemaInfo to build the graph from\r\n * @param context The SchemaContext used to locate info on the referenced schemas\r\n * @returns A SchemaGraph that can be used to detect schema cycles\r\n */\r\n public static async generateGraph(schema: SchemaInfo, context: SchemaContext): Promise<SchemaGraph> {\r\n const graph = new SchemaGraph();\r\n\r\n const genGraph = async (s: SchemaInfo) => {\r\n if (graph.find(s.schemaKey))\r\n return;\r\n\r\n graph._schemas.push(s);\r\n\r\n for (const refSchema of s.references) {\r\n if (!graph.find(refSchema.schemaKey)) {\r\n const refInfo = await context.getSchemaInfo(refSchema.schemaKey, SchemaMatchType.LatestWriteCompatible);\r\n if (undefined === refInfo) {\r\n throw new ECSchemaError(ECSchemaStatus.UnableToLocateSchema,\r\n `Could not locate the referenced schema, ${refSchema.schemaKey.name}.${refSchema.schemaKey.version.toString()}, of ${s.schemaKey.name} when populating the graph for ${schema.schemaKey.name}`);\r\n }\r\n await genGraph(refInfo);\r\n }\r\n }\r\n };\r\n\r\n await genGraph(schema);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Generates a SchemaGraph for the input schema. Use the generateGraph if you just have schema info.\r\n * @param schema The Schema to build the graph from.\r\n * @returns A SchemaGraph that can be used to detect schema cycles\r\n */\r\n public static generateGraphSync(schema: Schema): SchemaGraph {\r\n const graph = new SchemaGraph();\r\n\r\n const genGraph = (s: Schema) => {\r\n if (graph.find(s.schemaKey))\r\n return;\r\n\r\n graph._schemas.push(s);\r\n\r\n for (const refSchema of s.references) {\r\n if (!graph.find(refSchema.schemaKey))\r\n genGraph(refSchema);\r\n }\r\n };\r\n\r\n genGraph(schema);\r\n return graph;\r\n }\r\n\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaLoadingController.js","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;;;GAIG;AACH,MAAa,uBAAuB;IAC1B,SAAS,CAAC;IACV,WAAW,CAAC;IACZ,QAAQ,CAAiB;IAEjC;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAsB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAxDD,0DAwDC","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 * Assists in tracking the loading progress of Schemas and SchemaItems. An instance of this\n * class is set in Schema and SchemaItem instances.\n * @internal\n */\nexport class SchemaLoadingController {\n private _complete;\n private _inProgress;\n private _promise?: Promise<void>;\n\n /**\n * Indicates of the Schema or SchemaItem has been fully loaded.\n */\n public get isComplete() {\n return this._complete;\n }\n\n /**\n * Marks that a Schema or SchemaItem has been fully loaded.\n */\n public set isComplete(value: boolean) {\n this._complete = value;\n }\n\n /**\n * Indicates that the loading of a Schema or SchemaItem is still in progress\n */\n public get inProgress() {\n return this._inProgress;\n }\n\n /**\n * Initializes a new SchemaLoadingController instance.\n */\n constructor() {\n this._complete = false;\n this._inProgress = false;\n }\n\n /**\n * Call this method when starting to load a Schema or SchemaItem\n * @param promise The promise used to update the controller state when the promise is resolved.\n */\n public start(promise: Promise<void>) {\n this._inProgress = true;\n void promise.then(() => {\n this._complete = true;\n this._inProgress = false;\n });\n this._promise = promise;\n }\n\n /**\n * Waits on the Promise given in SchemaLoadingController.start().\n * @returns A Promised that can be awaited while the Schema or SchemaItem is being loaded.\n */\n public async wait(): Promise<void> {\n if (!this._promise)\n throw new Error(\"LoadingController 'start' must be called before 'wait'\");\n return this._promise;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"SchemaLoadingController.js","sourceRoot":"","sources":["../../../src/utils/SchemaLoadingController.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;;;GAIG;AACH,MAAa,uBAAuB;IAC1B,SAAS,CAAC;IACV,WAAW,CAAC;IACZ,QAAQ,CAAiB;IAEjC;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU,CAAC,KAAc;QAClC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH;QACE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAsB;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ;YAChB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAxDD,0DAwDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\n/**\r\n * Assists in tracking the loading progress of Schemas and SchemaItems. An instance of this\r\n * class is set in Schema and SchemaItem instances.\r\n * @internal\r\n */\r\nexport class SchemaLoadingController {\r\n private _complete;\r\n private _inProgress;\r\n private _promise?: Promise<void>;\r\n\r\n /**\r\n * Indicates of the Schema or SchemaItem has been fully loaded.\r\n */\r\n public get isComplete() {\r\n return this._complete;\r\n }\r\n\r\n /**\r\n * Marks that a Schema or SchemaItem has been fully loaded.\r\n */\r\n public set isComplete(value: boolean) {\r\n this._complete = value;\r\n }\r\n\r\n /**\r\n * Indicates that the loading of a Schema or SchemaItem is still in progress\r\n */\r\n public get inProgress() {\r\n return this._inProgress;\r\n }\r\n\r\n /**\r\n * Initializes a new SchemaLoadingController instance.\r\n */\r\n constructor() {\r\n this._complete = false;\r\n this._inProgress = false;\r\n }\r\n\r\n /**\r\n * Call this method when starting to load a Schema or SchemaItem\r\n * @param promise The promise used to update the controller state when the promise is resolved.\r\n */\r\n public start(promise: Promise<void>) {\r\n this._inProgress = true;\r\n void promise.then(() => {\r\n this._complete = true;\r\n this._inProgress = false;\r\n });\r\n this._promise = promise;\r\n }\r\n\r\n /**\r\n * Waits on the Promise given in SchemaLoadingController.start().\r\n * @returns A Promised that can be awaited while the Schema or SchemaItem is being loaded.\r\n */\r\n public async wait(): Promise<void> {\r\n if (!this._promise)\r\n throw new Error(\"LoadingController 'start' must be called before 'wait'\");\r\n return this._promise;\r\n }\r\n}"]}
|
package/lib/esm/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,CAAC;;AAG3D;;GAEG;AACH,MAAM,KAAW,qBAAqB,CAKrC;AALD,WAAiB,qBAAqB;IACvB,uCAAiB,GAAG,qDAAqD,CAAC;IAC1E,sCAAgB,GAAG,uDAAuD,CAAC;IAE3E,sCAAgB,GAAG,kDAAkD,CAAC;AACrF,CAAC,EALgB,qBAAqB,KAArB,qBAAqB,QAKrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/**\n * @internal\n */\nexport class ECStringConstants {\n // Relationship End\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\n\n // Container Type\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\n\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\n\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\n\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\n}\n\n/**\n * @internal\n */\nexport namespace ECSchemaNamespaceUris {\n export const SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\n export const SCHEMAITEMURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\n\n export const SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,mBAAmB;IACZ,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAC3D,MAAM,CAAU,uBAAuB,GAAW,QAAQ,CAAC;IAElE,iBAAiB;IACV,MAAM,CAAU,oBAAoB,GAAW,QAAQ,CAAC;IACxD,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,kCAAkC,GAAW,sBAAsB,CAAC;IACpF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAClE,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,sBAAsB,GAAW,UAAU,CAAC;IAE5D,MAAM,CAAU,+BAA+B,GAAW,mBAAmB,CAAC;IAC9E,MAAM,CAAU,4BAA4B,GAAW,gBAAgB,CAAC;IACxE,MAAM,CAAU,oCAAoC,GAAW,eAAe,CAAC;IAC/E,MAAM,CAAU,iCAAiC,GAAW,qBAAqB,CAAC;IAClF,MAAM,CAAU,gCAAgC,GAAW,oBAAoB,CAAC;IAChF,MAAM,CAAU,yBAAyB,GAAW,aAAa,CAAC;IAElE,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,0CAA0C,GAAW,8BAA8B,CAAC;IACpG,MAAM,CAAU,uCAAuC,GAAW,2BAA2B,CAAC;IAE9F,MAAM,CAAU,iBAAiB,GAAW,KAAK,CAAC;;AAG3D;;GAEG;AACH,MAAM,KAAW,qBAAqB,CAKrC;AALD,WAAiB,qBAAqB;IACvB,uCAAiB,GAAG,qDAAqD,CAAC;IAC1E,sCAAgB,GAAG,uDAAuD,CAAC;IAE3E,sCAAgB,GAAG,kDAAkD,CAAC;AACrF,CAAC,EALgB,qBAAqB,KAArB,qBAAqB,QAKrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ECStringConstants {\r\n // Relationship End\r\n public static readonly RELATIONSHIP_END_SOURCE: string = \"Source\";\r\n public static readonly RELATIONSHIP_END_TARGET: string = \"Target\";\r\n\r\n // Container Type\r\n public static readonly CONTAINERTYPE_SCHEMA: string = \"Schema\";\r\n public static readonly CONTAINERTYPE_ENTITYCLASS: string = \"EntityClass\";\r\n public static readonly CONTAINERTYPE_CUSTOMATTRIBUTECLASS: string = \"CustomAttributeClass\";\r\n public static readonly CONTAINERTYPE_STRUCTCLASS: string = \"StructClass\";\r\n public static readonly CONTAINERTYPE_RELATIONSHIPCLASS: string = \"RelationshipClass\";\r\n public static readonly CONTAINERTYPE_ANYCLASS: string = \"AnyClass\";\r\n\r\n public static readonly CONTAINERTYPE_PRIMITIVEPROPERTY: string = \"PrimitiveProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTPROPERTY: string = \"StructProperty\";\r\n public static readonly CONTAINERTYPE_PRIMITIVEARRAYPROPERTY: string = \"ArrayProperty\";\r\n public static readonly CONTAINERTYPE_STRUCTARRAYPROPERTY: string = \"StructArrayProperty\";\r\n public static readonly CONTAINERTYPE_NAVIGATIONPROPERTY: string = \"NavigationProperty\";\r\n public static readonly CONTAINERTYPE_ANYPROPERTY: string = \"AnyProperty\";\r\n\r\n public static readonly CONTAINERTYPE_SOURCERELATIONSHIPCONSTRAINT: string = \"SourceRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_TARGETRELATIONSHIPCONSTRAINT: string = \"TargetRelationshipConstraint\";\r\n public static readonly CONTAINERTYPE_ANYRELATIONSHIPCONSTRAINT: string = \"AnyRelationshipConstraint\";\r\n\r\n public static readonly CONTAINERTYPE_ANY: string = \"Any\";\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport namespace ECSchemaNamespaceUris {\r\n export const SCHEMAURL3_2_JSON = \"https://dev.bentley.com/json_schemas/ec/32/ecschema\";\r\n export const SCHEMAITEMURL3_2 = \"https://dev.bentley.com/json_schemas/ec/32/schemaitem\";\r\n\r\n export const SCHEMAURL3_2_XML = \"http://www.bentley.com/schemas/Bentley.ECXML.3.2\";\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,cAAc;IAEzB;;;OAGG;IACH,YAAY,aAA+B;QACzC,IAAI,OAA+B,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,EAAE;YACtB,OAAO,GAAG,OAAO,IAAI,aAAa,EAAE,CAAC;YACrC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;IAED,qGAAqG;IACrF,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,SAAkB,CAAC;IAE1D;;OAEG;IACI,KAAK,CAAmB;IAE/B;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAAiC,WAAiF,EAAE,UAAmF;QACtN,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAkB,UAAiF;QACnH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,SAA2C;QAC9D,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;CACF;AAgCD,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,CAAsC,CAAC;IACxE,CAAC;CACF,CAAuC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/**\n * Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)\n * and resulting value of an asynchronous operation ***that has not yet started***.\n *\n * The asynchronous operation behind a DelayedPromise will start when any of the following occurs:\n * - The DelayedPromise is `await`ed.\n * - A callback is attached via `.then()` or `.catch(() => { })`.\n * - The asynchronous operation is explicitly started via `.start()`\n *\n * Just as normal Promises will never return to their pending state once fulfilled or rejected,\n * a DelayedPromise will never re-execute its asynchronous operation more than **once**.\n *\n * Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to\n * represent an (asynchronously) lazily-loaded value as an instance property instead of a method.\n * You could also accomplish something similar by defining an async function as a property getter.\n * However, since a property defined as a DelayedPromise will not start simply by being accessed,\n * additional (non-lazily-loaded) \"nested\" properties can be added.\n *\n * [!alert text=\"*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening.\" kind=\"warning\"]\n * @internal\n */\nexport class DelayedPromise<T> implements Promise<T> {\n\n /**\n * Constructs a DelayedPromise object.\n * @param startCallback The asynchronous callback to execute when this DelayedPromise should be \"started\".\n */\n constructor(startCallback: () => Promise<T>) {\n let pending: Promise<T> | undefined;\n this.start = async () => {\n pending = pending || startCallback();\n return pending;\n };\n }\n\n // We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts\n public readonly [Symbol.toStringTag] = \"Promise\" as const;\n\n /**\n * Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).\n */\n public start: () => Promise<T>;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @return A Promise for the completion of which ever callback is executed.\n */\n public async then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {\n return this.start().then(onfulfilled, onrejected);\n }\n\n /**\n * Attaches a callback for only the rejection of the Promise.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @return A Promise for the completion of the callback.\n */\n public async catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {\n return this.start().catch(onrejected);\n }\n\n /**\n * Attaches a callback for only the finally clause of the Promise.\n * @param onrejected The callback to execute when the Promise is finalized.\n * @return A Promise for the completion of the callback.\n */\n public async finally(onFinally?: (() => void) | undefined | null): Promise<T> {\n return this.start().finally(onFinally);\n }\n}\n\n// This keeps us from accidentally overriding one of DelayedPromise's methods in the DelayedPromiseWithProps constructor\n/**\n * @internal\n */\nexport interface NoDelayedPromiseMethods {\n [propName: string]: any;\n start?: never;\n then?: never;\n catch?: never;\n}\n\n// See definition of DelayedPromiseWithProps below\n/**\n * @internal\n */\nexport interface DelayedPromiseWithPropsConstructor {\n\n /**\n * Constructs a DelayedPromiseWithProps object, which is at once both:\n * - A DelayedPromise object representing the eventual completion (or failure)\n * of an asynchronous operation returning a value of type `TPayload`\n * - _and_ a readonly \"wrapper\" around an instance of type `TProps`\n *\n * @param props An object with properties and methods that will be accessible\n * as if they were readonly properties of the DelayedPromiseWithProps object being constructed.\n * @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be \"started\".\n */\n new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): TProps & DelayedPromise<TPayload>; // eslint-disable-line @typescript-eslint/prefer-function-type\n}\n\n// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.\n// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const DelayedPromiseWithProps = (class <TProps extends NoDelayedPromiseMethods, TPayload> extends DelayedPromise<TPayload> {\n constructor(props: TProps, cb: () => Promise<TPayload>) {\n super(cb);\n\n const handler = {\n get: (target: TProps, name: string) => {\n return (name in this) ? this[name as keyof this] : target[name as keyof TProps];\n },\n };\n\n return new Proxy(props, handler) as TProps & DelayedPromise<TPayload>;\n }\n}) as DelayedPromiseWithPropsConstructor;\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\n/**\n * Define the type of a DelayedPromiseWithProps instance\n * @internal\n */\nexport type DelayedPromiseWithProps<TProps, TPayload> = TProps & DelayedPromise<TPayload>;\n"]}
|
|
1
|
+
{"version":3,"file":"DelayedPromise.js","sourceRoot":"","sources":["../../src/DelayedPromise.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;;;;;;;;;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,KAAK,CAAC,KAAK,EAAE,OAAO,CAAsC,CAAC;IACxE,CAAC;CACF,CAAuC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/**\r\n * Similar to a normal Promise, a DelayedPromise represents the eventual completion (or failure)\r\n * and resulting value of an asynchronous operation ***that has not yet started***.\r\n *\r\n * The asynchronous operation behind a DelayedPromise will start when any of the following occurs:\r\n * - The DelayedPromise is `await`ed.\r\n * - A callback is attached via `.then()` or `.catch(() => { })`.\r\n * - The asynchronous operation is explicitly started via `.start()`\r\n *\r\n * Just as normal Promises will never return to their pending state once fulfilled or rejected,\r\n * a DelayedPromise will never re-execute its asynchronous operation more than **once**.\r\n *\r\n * Ultimately, a DelayedPromise is nothing more than some syntactic sugar that allows you to\r\n * represent an (asynchronously) lazily-loaded value as an instance property instead of a method.\r\n * You could also accomplish something similar by defining an async function as a property getter.\r\n * However, since a property defined as a DelayedPromise will not start simply by being accessed,\r\n * additional (non-lazily-loaded) \"nested\" properties can be added.\r\n *\r\n * [!alert text=\"*Remember:* Unlike regular Promises in JavaScript, DelayedPromises represent processes that **may not** already be happening.\" kind=\"warning\"]\r\n * @internal\r\n */\r\nexport class DelayedPromise<T> implements Promise<T> {\r\n\r\n /**\r\n * Constructs a DelayedPromise object.\r\n * @param startCallback The asynchronous callback to execute when this DelayedPromise should be \"started\".\r\n */\r\n constructor(startCallback: () => Promise<T>) {\r\n let pending: Promise<T> | undefined;\r\n this.start = async () => {\r\n pending = pending || startCallback();\r\n return pending;\r\n };\r\n }\r\n\r\n // We need this in order to fulfill the Promise interface defined in lib.es2015.symbol.wellknown.d.ts\r\n public readonly [Symbol.toStringTag] = \"Promise\" as const;\r\n\r\n /**\r\n * Explicitly starts the asynchronous operation behind this DelayedPromise (if it hasn't started already).\r\n */\r\n public start: () => Promise<T>;\r\n\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @return A Promise for the completion of which ever callback is executed.\r\n */\r\n public async then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {\r\n return this.start().then(onfulfilled, onrejected);\r\n }\r\n\r\n /**\r\n * Attaches a callback for only the rejection of the Promise.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @return A Promise for the completion of the callback.\r\n */\r\n public async catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult> {\r\n return this.start().catch(onrejected);\r\n }\r\n\r\n /**\r\n * Attaches a callback for only the finally clause of the Promise.\r\n * @param onrejected The callback to execute when the Promise is finalized.\r\n * @return A Promise for the completion of the callback.\r\n */\r\n public async finally(onFinally?: (() => void) | undefined | null): Promise<T> {\r\n return this.start().finally(onFinally);\r\n }\r\n}\r\n\r\n// This keeps us from accidentally overriding one of DelayedPromise's methods in the DelayedPromiseWithProps constructor\r\n/**\r\n * @internal\r\n */\r\nexport interface NoDelayedPromiseMethods {\r\n [propName: string]: any;\r\n start?: never;\r\n then?: never;\r\n catch?: never;\r\n}\r\n\r\n// See definition of DelayedPromiseWithProps below\r\n/**\r\n * @internal\r\n */\r\nexport interface DelayedPromiseWithPropsConstructor {\r\n\r\n /**\r\n * Constructs a DelayedPromiseWithProps object, which is at once both:\r\n * - A DelayedPromise object representing the eventual completion (or failure)\r\n * of an asynchronous operation returning a value of type `TPayload`\r\n * - _and_ a readonly \"wrapper\" around an instance of type `TProps`\r\n *\r\n * @param props An object with properties and methods that will be accessible\r\n * as if they were readonly properties of the DelayedPromiseWithProps object being constructed.\r\n * @param startCallback The asynchronous callback to execute when as soon as this DelayedPromise should be \"started\".\r\n */\r\n new <TProps extends NoDelayedPromiseMethods, TPayload>(props: TProps, startCallback: () => Promise<TPayload>): TProps & DelayedPromise<TPayload>; // eslint-disable-line @typescript-eslint/prefer-function-type\r\n}\r\n\r\n// Because the property getters that wrap `props` are dynamically added, TypeScript isn't aware of them.\r\n// So by defining this as a class _expression_, we can cast the constructed type to Readonly<TProps> & DelayedPromise<TPayload>\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const DelayedPromiseWithProps = (class <TProps extends NoDelayedPromiseMethods, TPayload> extends DelayedPromise<TPayload> {\r\n constructor(props: TProps, cb: () => Promise<TPayload>) {\r\n super(cb);\r\n\r\n const handler = {\r\n get: (target: TProps, name: string) => {\r\n return (name in this) ? this[name as keyof this] : target[name as keyof TProps];\r\n },\r\n };\r\n\r\n return new Proxy(props, handler) as TProps & DelayedPromise<TPayload>;\r\n }\r\n}) as DelayedPromiseWithPropsConstructor;\r\n\r\n/* eslint-disable @typescript-eslint/no-redeclare */\r\n\r\n/**\r\n * Define the type of a DelayedPromiseWithProps instance\r\n * @internal\r\n */\r\nexport type DelayedPromiseWithProps<TProps, TPayload> = TProps & DelayedPromise<TPayload>;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAoB/F,gBAAgB;AAChB,MAAM,OAAgB,cAAc;IACxB,cAAc,CAAiB;CAmC1C","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport {\n ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\n NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps,\n SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\n} from \"../Deserialization/JsonProps\";\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\nimport { ECSpecVersion } from \"./Helper\";\n\ntype SchemaItemTuple<T> = Readonly<[string /** Name */, string /** SchemaItemType */, Readonly<T>]>;\ntype PropertyTuple<T> = Readonly<[string /** Name */, string /** Property */, Readonly<T>]>;\n\n/** @internal */\nexport type CustomAttributeProvider = (caClass: CustomAttributeClass) => CustomAttribute;\n\n/** @internal */\nexport type CAProviderTuple = Readonly<[string /** Full Name */, CustomAttributeProvider]>;\n\n/** @internal */\nexport abstract class AbstractParser<TItem = any, TProperty = TItem> {\n protected _ecSpecVersion?: ECSpecVersion;\n\n public abstract parseSchema(): SchemaProps;\n public abstract getReferences(): Iterable<SchemaReferenceProps>;\n\n public abstract getItems(): Iterable<SchemaItemTuple<TItem>>;\n public abstract findItem(itemName: string): SchemaItemTuple<TItem> | undefined;\n\n public abstract parseEntityClass(data: Readonly<TItem>): EntityClassProps;\n public abstract parseMixin(data: Readonly<TItem>): MixinProps;\n public abstract parseStructClass(data: Readonly<TItem>): StructClassProps;\n public abstract parseCustomAttributeClass(data: Readonly<TItem>): CustomAttributeClassProps;\n public abstract parseRelationshipClass(data: Readonly<TItem>): RelationshipClassProps;\n public abstract parseEnumeration(data: Readonly<TItem>): EnumerationProps;\n public abstract parseKindOfQuantity(data: Readonly<TItem>): KindOfQuantityProps;\n public abstract parsePropertyCategory(data: Readonly<TItem>): PropertyCategoryProps;\n public abstract parseUnit(data: Readonly<TItem>): SchemaItemUnitProps;\n public abstract parseInvertedUnit(data: Readonly<TItem>): InvertedUnitProps;\n public abstract parseConstant(data: Readonly<TItem>): ConstantProps;\n public abstract parsePhenomenon(data: Readonly<TItem>): PhenomenonProps;\n public abstract parseFormat(data: Readonly<TItem>): SchemaItemFormatProps;\n public abstract parseUnitSystem(data: Readonly<TItem>): UnitSystemProps;\n\n public abstract getProperties(data: Readonly<TItem>, itemName: string): Iterable<PropertyTuple<TProperty>>;\n public abstract parsePrimitiveProperty(data: Readonly<TProperty>): PrimitivePropertyProps;\n public abstract parseStructProperty(data: Readonly<TProperty>): StructPropertyProps;\n public abstract parsePrimitiveArrayProperty(data: Readonly<TProperty>): PrimitiveArrayPropertyProps;\n public abstract parseStructArrayProperty(data: Readonly<TProperty>): StructArrayPropertyProps;\n public abstract parseNavigationProperty(data: Readonly<TProperty>): NavigationPropertyProps;\n\n public abstract getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple>;\n public abstract getClassCustomAttributeProviders(data: Readonly<TItem>): Iterable<CAProviderTuple>;\n public abstract getPropertyCustomAttributeProviders(data: Readonly<TProperty>): Iterable<CAProviderTuple>;\n public abstract getRelationshipConstraintCustomAttributeProviders(data: Readonly<TItem>): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */];\n public abstract get getECSpecVersion(): ECSpecVersion | undefined;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/prefer-function-type\nexport interface AbstractParserConstructor<TSchema, TItem = any, TProperty = TItem> { new(obj: Readonly<TSchema>): AbstractParser<TItem, TProperty> }\n"]}
|
|
1
|
+
{"version":3,"file":"AbstractParser.js","sourceRoot":"","sources":["../../../src/Deserialization/AbstractParser.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAoB/F,gBAAgB;AAChB,MAAM,OAAgB,cAAc;IACxB,cAAc,CAAiB;CAmC1C","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport {\r\n ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps,\r\n NavigationPropertyProps, PhenomenonProps, PrimitiveArrayPropertyProps, PrimitivePropertyProps, PropertyCategoryProps, RelationshipClassProps,\r\n SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, SchemaReferenceProps, StructArrayPropertyProps, StructClassProps, StructPropertyProps, UnitSystemProps,\r\n} from \"../Deserialization/JsonProps\";\r\nimport { CustomAttribute } from \"../Metadata/CustomAttribute\";\r\nimport { CustomAttributeClass } from \"../Metadata/CustomAttributeClass\";\r\nimport { ECSpecVersion } from \"./Helper\";\r\n\r\ntype SchemaItemTuple<T> = Readonly<[string /** Name */, string /** SchemaItemType */, Readonly<T>]>;\r\ntype PropertyTuple<T> = Readonly<[string /** Name */, string /** Property */, Readonly<T>]>;\r\n\r\n/** @internal */\r\nexport type CustomAttributeProvider = (caClass: CustomAttributeClass) => CustomAttribute;\r\n\r\n/** @internal */\r\nexport type CAProviderTuple = Readonly<[string /** Full Name */, CustomAttributeProvider]>;\r\n\r\n/** @internal */\r\nexport abstract class AbstractParser<TItem = any, TProperty = TItem> {\r\n protected _ecSpecVersion?: ECSpecVersion;\r\n\r\n public abstract parseSchema(): SchemaProps;\r\n public abstract getReferences(): Iterable<SchemaReferenceProps>;\r\n\r\n public abstract getItems(): Iterable<SchemaItemTuple<TItem>>;\r\n public abstract findItem(itemName: string): SchemaItemTuple<TItem> | undefined;\r\n\r\n public abstract parseEntityClass(data: Readonly<TItem>): EntityClassProps;\r\n public abstract parseMixin(data: Readonly<TItem>): MixinProps;\r\n public abstract parseStructClass(data: Readonly<TItem>): StructClassProps;\r\n public abstract parseCustomAttributeClass(data: Readonly<TItem>): CustomAttributeClassProps;\r\n public abstract parseRelationshipClass(data: Readonly<TItem>): RelationshipClassProps;\r\n public abstract parseEnumeration(data: Readonly<TItem>): EnumerationProps;\r\n public abstract parseKindOfQuantity(data: Readonly<TItem>): KindOfQuantityProps;\r\n public abstract parsePropertyCategory(data: Readonly<TItem>): PropertyCategoryProps;\r\n public abstract parseUnit(data: Readonly<TItem>): SchemaItemUnitProps;\r\n public abstract parseInvertedUnit(data: Readonly<TItem>): InvertedUnitProps;\r\n public abstract parseConstant(data: Readonly<TItem>): ConstantProps;\r\n public abstract parsePhenomenon(data: Readonly<TItem>): PhenomenonProps;\r\n public abstract parseFormat(data: Readonly<TItem>): SchemaItemFormatProps;\r\n public abstract parseUnitSystem(data: Readonly<TItem>): UnitSystemProps;\r\n\r\n public abstract getProperties(data: Readonly<TItem>, itemName: string): Iterable<PropertyTuple<TProperty>>;\r\n public abstract parsePrimitiveProperty(data: Readonly<TProperty>): PrimitivePropertyProps;\r\n public abstract parseStructProperty(data: Readonly<TProperty>): StructPropertyProps;\r\n public abstract parsePrimitiveArrayProperty(data: Readonly<TProperty>): PrimitiveArrayPropertyProps;\r\n public abstract parseStructArrayProperty(data: Readonly<TProperty>): StructArrayPropertyProps;\r\n public abstract parseNavigationProperty(data: Readonly<TProperty>): NavigationPropertyProps;\r\n\r\n public abstract getSchemaCustomAttributeProviders(): Iterable<CAProviderTuple>;\r\n public abstract getClassCustomAttributeProviders(data: Readonly<TItem>): Iterable<CAProviderTuple>;\r\n public abstract getPropertyCustomAttributeProviders(data: Readonly<TProperty>): Iterable<CAProviderTuple>;\r\n public abstract getRelationshipConstraintCustomAttributeProviders(data: Readonly<TItem>): [Iterable<CAProviderTuple> /* source */, Iterable<CAProviderTuple> /* target */];\r\n public abstract get getECSpecVersion(): ECSpecVersion | undefined;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/prefer-function-type\r\nexport interface AbstractParserConstructor<TSchema, TItem = any, TProperty = TItem> { new(obj: Readonly<TSchema>): AbstractParser<TItem, TProperty> }\r\n"]}
|