UNPKG

@itwin/core-backend

Version:
41 lines 2.46 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Schema */ Object.defineProperty(exports, "__esModule", { value: true }); exports.convertEC2SchemasToEC3Schemas = convertEC2SchemasToEC3Schemas; exports.upgradeCustomAttributesToEC3 = upgradeCustomAttributesToEC3; const core_bentley_1 = require("@itwin/core-bentley"); const core_common_1 = require("@itwin/core-common"); const NativePlatform_1 = require("./internal/NativePlatform"); /** Converts EC2 Xml ECSchema(s). On success, the `EC2 Xml schemas` are converted into `EC3.2 Xml schemas`. * @param ec2XmlSchemas The EC2 Xml string(s) created from a serialized ECSchema. * @returns EC3.2 Xml ECSchema(s). * @throws [[IModelError]] if there is a problem converting the EC2 schemas. * @beta */ function convertEC2SchemasToEC3Schemas(ec2XmlSchemas, schemaContext) { const maybeNativeContext = schemaContext?.nativeContext; const ec3XmlSchemas = NativePlatform_1.IModelNative.platform.SchemaUtility.convertEC2XmlSchemas(ec2XmlSchemas, maybeNativeContext); if (ec2XmlSchemas.length === 0) throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Error converting EC2 Xml schemas"); return ec3XmlSchemas; } /** Converts schema metadata to EC3 concepts by traversing custom attributes of the supplied schema and calling converters based on schemaName:customAttributeName * @param xmlSchemas The ECSchema Xml string(s). * @returns EC3.2 Xml ECSchema(s) with converted custom attributes. * @throws [[IModelError]] if there is a problem converting the custom attributes of a schema. * @beta */ function upgradeCustomAttributesToEC3(xmlSchemas, schemaContext) { const maybeNativeContext = schemaContext?.nativeContext; const schemasWithConvertedCA = NativePlatform_1.IModelNative.platform.SchemaUtility.convertCustomAttributes(xmlSchemas, maybeNativeContext); if (schemasWithConvertedCA.length === 0) throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Error converting custom attributes of Xml schemas"); return schemasWithConvertedCA; } //# sourceMappingURL=SchemaUtils.js.map