UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

45 lines 1.75 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Core */ import { createCombinedDiagnosticsHandler } from "@itwin/presentation-frontend"; /** * Creates diagnostics options that can be passed to presentation requests based on given * diagnostics props. * * @public */ export function createDiagnosticsOptions(props) { if (!props.ruleDiagnostics && !props.devDiagnostics) { return undefined; } const options = {}; if (props.devDiagnostics?.perf) { options.perf = props.devDiagnostics.perf; } if (props.devDiagnostics?.severity) { options.dev = props.devDiagnostics.severity; } if (props.ruleDiagnostics?.severity) { options.editor = props.ruleDiagnostics.severity; } let handler; if (props.devDiagnostics && props.ruleDiagnostics && props.devDiagnostics.handler !== props.ruleDiagnostics.handler) { handler = createCombinedDiagnosticsHandler([props.devDiagnostics.handler, props.ruleDiagnostics.handler]); } else if (props.devDiagnostics) { handler = props.devDiagnostics.handler; } else if (props.ruleDiagnostics) { handler = props.ruleDiagnostics.handler; } return { ...options, ...(props.devDiagnostics?.backendVersion ? { backendVersion: props.devDiagnostics.backendVersion } : undefined), handler: handler, }; } //# sourceMappingURL=Diagnostics.js.map