import { CamundaPlatform8Configuration, DeepPartial } from '../../lib'; import { IHeadersProvider } from '../../oauth'; import { ChangeStatus, DecisionDefinition, DecisionInstance, DecisionRequirements, FlownodeInstance, Incident, ProcessDefinition, ProcessInstance, ProcessInstanceStatistics, Query, SearchResults, Variable } from './OperateDto'; type JSONDoc = { [key: string]: string | boolean | number | JSONDoc; }; type EnhanceWithTenantIdIfMissing = T extends { filter: { tenantId: string | undefined; }; } ? T : T extends { filter: infer F; } ? { filter: F & { tenantId: string | undefined; }; } & Omit : { filter: { tenantId: string | undefined; }; } & T; /** * The high-level client for Operate. * All constructor parameters for configuration are optional. If no configuration is provided, the SDK will use environment variables to configure itself. * See {@link CamundaSDKConfiguration} for the complete list of configuration parameters. Values can be passed in explicitly in code, or set via environment variables (recommended: separate configuration and application logic). * Explicitly set values will override environment variables, which are merged into the configuration. * @example * ``` * const operate = new OperateApiClient() * * operate.searchProcessInstances({ * filter: { * state: "ACTIVE" * }, * size: 50 * }).then(instances => { * console.log(instances) * }) * ``` */ export declare class OperateApiClient { private userAgentString; private oAuthProvider; private rest; private tenantId; /** * @example * ``` * const operate = new OperateApiClient() * ``` * @throws {RESTError} An error that may occur during API operations. */ constructor(options?: { config?: DeepPartial; oAuthProvider?: IHeadersProvider; }); private getHeaders; protected addTenantIdToFilter(query: Query, tenantId?: string | undefined): Query>; /** * Search and retrieve process definitions. * * [Camunda 8 Documentation](https://docs.camunda.io/docs/apis-clients/operate-api/#process-definition) * @throws {RESTError} * @example * ``` * const query: Query = { * filter: {}, * size: 50, * sort: [ * { * field: "bpmnProcessId", * order: "ASC", * }, * ], * }; * const operate = newOperateClient() * const defs = await operate.searchProcessDefinitions(query); * ``` */ searchProcessDefinitions(query?: Query): Promise>; /** * * Retrieve the metadata for a specific process definition, by key. * @throws {RESTError} * [Camunda 8 Documentation](https://docs.camunda.io/docs/apis-clients/operate-api/#process-definition) * @example * ``` * const operate = new OperateApiClient() * const definition = await operate.getProcessDefinition(2251799817140074); * ``` */ getProcessDefinition(processDefinitionKey: number | string): Promise; getProcessDefinitionXML(processDefinitionKey: number | string): Promise; /** * * @throws {RESTError} */ searchDecisionDefinitions(query: Query): Promise>; /** * @throws {RESTError} */ getDecisionDefinition(decisionDefinitionKey: number | string): Promise; /** * @throws {RESTError} */ searchDecisionInstances(query: Query): Promise>; /** * @throws {RESTError} */ getDecisionInstance(decisionInstanceKey: number | string): Promise; /** * Search and retrieve process instances. * @throws {RESTError} * @example * ``` * const operate = new OperateApiClient() * const query: Query = { * filter: { * processVersion: 1 * }, * size: 50, * sort: [ * { * field: "bpmProcessId", * order: "ASC" * } * ] * } * const instances = await operate.searchProcessInstances(query) * console.log(`Found ${instances.total} instances`) */ searchProcessInstances(query?: Query): Promise>; /** * * Retrieve a specific process instance by id. * @throws {RESTError} * @example * ``` * const operate = new OperateApiClient() * const instance = await operate.getProcessInstance(2251799819847322) * ``` */ getProcessInstance(processInstanceKey: number | string): Promise; /** * Delete a specific process instance by key. * @throws {RESTError} * @example * ``` * const operate = new OperateApiClient() * await operate.deleteProcessInstance(2251799819847322) * ``` */ deleteProcessInstance(processInstanceKey: number | string): Promise; /** * Get the statistics for a process instance, grouped by flow nodes * @throws {RESTError} */ getProcessInstanceStatistics(processInstanceKey: number | string): Promise; /** * Get sequence flows of process instance by key * @throws {RESTError} */ getProcessInstanceSequenceFlows(processInstanceKey: number | string): Promise; /** * * Search and retrieve incidents. * @throws {RESTError} * @example * ``` * const operate = new OperateApiClient() * const query: Query = { * filter: { * state: "ACTIVE" * }, * size: 50, * sort: [ * { * field: "creationTime", * order: "ASC" * } * ] * } * const incidents = operate.searchIncidents(query) * ``` */ searchIncidents(query?: Query): Promise>; /** * * Retrieve an incident by incident key. * @throws {RESTError} * @example * ``` * const operate = new OperateApiClient() * const incident = await operate.getIncident(2251799818436725) * console.log(incident.message) * ``` */ getIncident(key: number | string): Promise; /** * @throws {RESTError} */ searchFlownodeInstances(query: Query): Promise>; /** * @throws {RESTError} */ getFlownodeInstance(key: number | string): Promise; /** * @throws {RESTError} */ searchVariables(query: Query): Promise>; /** * Retrieve the variables for a Process Instance, given its key. Documentation: https://docs.camunda.io/docs/apis-tools/operate-api/specifications/search/ * @throws {RESTError} * @param processInstanceKey * @returns */ getVariablesforProcess(processInstanceKey: number | string, options?: { /** Defaults to 1000 */ size?: number; searchAfter?: unknown[]; sort?: { field: string; order?: 'ASC' | 'DESC'; }[]; }): Promise<{ items: Variable[]; sortValues: unknown[]; total: number; }>; /** * Retrieve the variables for a Process Instance as an object, given its key * @param processInstanceKey * @throws {RESTError} */ getJSONVariablesforProcess(processInstanceKey: number | string, size?: number): Promise; private safeJSONparse; /** * * Return a variable identified by its variable key * @throws {RESTError} * @returns */ getVariables(variableKey: number | string): Promise; /** * @throws {RESTError} */ searchDecisionRequirements(query: Query): Promise; getDecisionRequirements(key: string | number): Promise; /** * @throws {RESTError} */ getDecisionRequirementsXML(key: string | number): Promise; } export {};