import { ReqFileDefinition, ResExport, ResOutput, ResParameter, SdGeometryError } from "@shapediver/sdk.geometry-api-sdk-v2"; import { type ITreeNode } from "@shapediver/viewer.shared.node-tree"; import { ShapeDiverViewerError } from "@shapediver/viewer.shared.services"; import { type ITaskEvent } from "@shapediver/viewer.shared.types"; import { type IParameter } from "../../interfaces/dto/IParameter"; import { SessionEngineCore } from "../SessionEngineCore"; /** * Manager responsible for utility functions. * This is the manager for miscellaneous utility functions that do not fit into other managers. * * The manager is created by the SessionEngineCore and can be accessed * via the `utilsManager` property. */ export declare class UtilsManager { private readonly _converter; private readonly _eventEngine; private readonly _globalAccessObjects; private readonly _httpClient; private readonly _logger; private readonly _sceneTree; private readonly _sessionEngineCore; private readonly _stateEngine; private _retryCounter; constructor(sessionEngineCore: SessionEngineCore); /** * Add a busy mode to all viewport engines. * To remove the busy mode, use `removeBusyMode`. * * @param busyId The ID of the busy mode to add */ addBusyMode(busyId: string): void; /** * Adds a node to the scene tree and updates the root version. * * @param node The tree node to add */ addToSceneTree(node: ITreeNode): void; /** * Cancels the current process if a new customization request has been made or if the session was closed. * If the process is cancelled, a TASK_CANCEL event is emitted and the busy mode is removed. * * @param eventInfo The task event information * @param customizationId The ID of the customization process * @param newNode The new tree node to return if the process is cancelled * @returns The new tree node if the process was cancelled, otherwise undefined */ cancelProcess(eventInfo: ITaskEvent, customizationId: string, newNode?: ITreeNode): ITreeNode | undefined; /** * Checks the availability of the session and optionally a specific action. * * @param action The action to check for availability * @param checkForModelId Whether to check for the model ID availability * @throws ShapeDiverViewerSessionError if the session or action is not available */ checkAvailability(action?: string, checkForModelId?: boolean): void; /** * Create an interaction parameter based on the parameter definition. * * @param parameter * @returns */ createInteractionParameter(parameter: ResParameter): IParameter; /** * Handles errors that occur during session operations. * * @param err The error to handle * @param retry Whether to retry the operation * @returns A promise that resolves when the error has been handled */ handleError(err: SdGeometryError | ShapeDiverViewerError | Error | unknown, retry?: boolean): Promise; /** * Process the image input and return the image data and array buffer. * * In the case of the image being a Blob or File, the image data is constructed from the Blob or File. * In the case of the image being a string, we check if it is a data URL or a URL. * If it is a data URL, we convert it to a Blob and construct the image data from the Blob. * If it is a URL, we download the image and return the image data and array buffer. * * @param image * @returns */ processImageInput(image: (() => string) | (() => Promise) | string | Promise | Blob | File): Promise<{ imageData: ReqFileDefinition; arrayBuffer: ArrayBuffer; }>; removeBusyMode(busyId: string): void; /** * Removes a node from the scene tree and updates the root version. * * @param node The tree node to remove */ removeFromSceneTree(node: ITreeNode): void; /** * Returns a promise that resolves after the amount of milliseconds provided. * * @param ms the milliseconds * @returns promise that resolve after specified milliseconds */ timeout(ms: number): Promise; /** * Waits for all update callbacks to finish. * * @param newOutputVersions The new output versions * @param oldOutputVersions The old output versions * @param newNode The new tree node * @param oldNode The old tree node */ waitForUpdateCallbacks(newOutputVersions: { [key: string]: string; }, oldOutputVersions: { [key: string]: string; }, newNode: ITreeNode, oldNode: ITreeNode): Promise; /** * Creates warnings for outputs and exports with issues. * If `throwError` is true, a ShapeDiverViewerCustomizationError is thrown instead. * * @param outputs The outputs to check for issues * @param exports The exports to check for issues * @param throwError Whether to throw an error instead of creating warnings */ warningCreator(outputs: { [id: string]: ResOutput; } | undefined, exports: { [key: string]: ResExport; }, throwError?: boolean): void; } //# sourceMappingURL=UtilsManager.d.ts.map