@camunda8/sdk 8.4.0 → 8.4.1
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/.eslintrc.json +34 -0
- package/CHANGELOG.md +61 -21
- package/CODE_OF_CONDUCT.md +73 -0
- package/CONTRIBUTING.md +116 -0
- package/LICENSE +3 -3
- package/README.md +229 -33
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +30 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/lib/AdminApiClient.d.ts +121 -0
- package/dist/admin/lib/AdminApiClient.js +254 -0
- package/dist/admin/lib/AdminApiClient.js.map +1 -0
- package/dist/admin/lib/AdminDto.d.ts +98 -0
- package/dist/admin/lib/AdminDto.js +3 -0
- package/dist/admin/lib/AdminDto.js.map +1 -0
- package/dist/c8/index.d.ts +42 -0
- package/dist/c8/index.js +95 -0
- package/dist/c8/index.js.map +1 -0
- package/dist/index.d.ts +15 -14
- package/dist/index.js +14 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/CertificateAuthority.d.ts +2 -0
- package/dist/lib/CertificateAuthority.js +15 -0
- package/dist/lib/CertificateAuthority.js.map +1 -0
- package/dist/lib/ClientConstructor.d.ts +6 -0
- package/dist/lib/ClientConstructor.js +3 -0
- package/dist/lib/ClientConstructor.js.map +1 -0
- package/dist/lib/Configuration.d.ts +113 -0
- package/dist/lib/Configuration.js +367 -0
- package/dist/lib/Configuration.js.map +1 -0
- package/dist/lib/ConstructOAuthProvider.d.ts +3 -0
- package/dist/lib/ConstructOAuthProvider.js +14 -0
- package/dist/lib/ConstructOAuthProvider.js.map +1 -0
- package/dist/lib/CreateUserAgentString.d.ts +2 -0
- package/dist/lib/CreateUserAgentString.js +11 -0
- package/dist/lib/CreateUserAgentString.js.map +1 -0
- package/dist/lib/Delay.d.ts +1 -0
- package/dist/lib/Delay.js +6 -0
- package/dist/lib/Delay.js.map +1 -0
- package/dist/lib/EnvironmentSetup.d.ts +11 -0
- package/dist/lib/EnvironmentSetup.js +35 -0
- package/dist/lib/EnvironmentSetup.js.map +1 -0
- package/dist/lib/GetPackageVersion.d.ts +1 -0
- package/dist/lib/GetPackageVersion.js +32 -0
- package/dist/lib/GetPackageVersion.js.map +1 -0
- package/dist/lib/LosslessJsonParser.d.ts +103 -0
- package/dist/lib/LosslessJsonParser.js +252 -0
- package/dist/lib/LosslessJsonParser.js.map +1 -0
- package/dist/lib/RequireConfiguration.d.ts +2 -0
- package/dist/lib/RequireConfiguration.js +11 -0
- package/dist/lib/RequireConfiguration.js.map +1 -0
- package/dist/lib/SuppressZeebeLogging.d.ts +2 -0
- package/dist/lib/SuppressZeebeLogging.js +14 -0
- package/dist/lib/SuppressZeebeLogging.js.map +1 -0
- package/dist/lib/ValueOrDefault.d.ts +1 -0
- package/dist/lib/ValueOrDefault.js +8 -0
- package/dist/lib/ValueOrDefault.js.map +1 -0
- package/dist/lib/index.d.ts +12 -0
- package/dist/lib/index.js +32 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/modeler/index.d.ts +2 -0
- package/dist/modeler/index.js +30 -0
- package/dist/modeler/index.js.map +1 -0
- package/dist/modeler/lib/ModelerAPIClient.d.ts +210 -0
- package/dist/modeler/lib/ModelerAPIClient.js +417 -0
- package/dist/modeler/lib/ModelerAPIClient.js.map +1 -0
- package/dist/modeler/lib/ModelerDto.d.ts +187 -0
- package/dist/modeler/lib/ModelerDto.js +3 -0
- package/dist/modeler/lib/ModelerDto.js.map +1 -0
- package/dist/oauth/index.d.ts +15 -0
- package/dist/oauth/index.js +8 -0
- package/dist/oauth/index.js.map +1 -0
- package/dist/oauth/lib/IOAuthProvider.d.ts +4 -0
- package/dist/oauth/lib/IOAuthProvider.js +3 -0
- package/dist/oauth/lib/IOAuthProvider.js.map +1 -0
- package/dist/oauth/lib/NullAuthProvider.d.ts +5 -0
- package/dist/oauth/lib/NullAuthProvider.js +16 -0
- package/dist/oauth/lib/NullAuthProvider.js.map +1 -0
- package/dist/oauth/lib/OAuthProvider.d.ts +44 -0
- package/dist/oauth/lib/OAuthProvider.js +316 -0
- package/dist/oauth/lib/OAuthProvider.js.map +1 -0
- package/dist/operate/index.d.ts +2 -0
- package/dist/operate/index.js +30 -0
- package/dist/operate/index.js.map +1 -0
- package/dist/operate/lib/OperateApiClient.d.ts +204 -0
- package/dist/operate/lib/OperateApiClient.js +440 -0
- package/dist/operate/lib/OperateApiClient.js.map +1 -0
- package/dist/operate/lib/OperateDto.d.ts +126 -0
- package/dist/operate/lib/OperateDto.js +125 -0
- package/dist/operate/lib/OperateDto.js.map +1 -0
- package/dist/operate/lib/TestableOperateApiClient.d.ts +7 -0
- package/dist/operate/lib/TestableOperateApiClient.js +15 -0
- package/dist/operate/lib/TestableOperateApiClient.js.map +1 -0
- package/dist/operate/lib/parseSearchResults.d.ts +4 -0
- package/dist/operate/lib/parseSearchResults.js +26 -0
- package/dist/operate/lib/parseSearchResults.js.map +1 -0
- package/dist/optimize/index.d.ts +2 -0
- package/dist/optimize/index.js +30 -0
- package/dist/optimize/index.js.map +1 -0
- package/dist/optimize/lib/APIObjects.d.ts +191 -0
- package/dist/optimize/lib/APIObjects.js +3 -0
- package/dist/optimize/lib/APIObjects.js.map +1 -0
- package/dist/optimize/lib/OptimizeApiClient.d.ts +269 -0
- package/dist/optimize/lib/OptimizeApiClient.js +410 -0
- package/dist/optimize/lib/OptimizeApiClient.js.map +1 -0
- package/dist/optimize/lib/ReportResults.d.ts +23 -0
- package/dist/optimize/lib/ReportResults.js +28 -0
- package/dist/optimize/lib/ReportResults.js.map +1 -0
- package/dist/proto/zeebe.proto +996 -0
- package/dist/tasklist/index.d.ts +2 -0
- package/dist/tasklist/index.js +30 -0
- package/dist/tasklist/index.js.map +1 -0
- package/dist/tasklist/lib/TasklistApiClient.d.ts +104 -0
- package/dist/tasklist/lib/TasklistApiClient.js +233 -0
- package/dist/tasklist/lib/TasklistApiClient.js.map +1 -0
- package/dist/tasklist/lib/TasklistDto.d.ts +147 -0
- package/dist/tasklist/lib/TasklistDto.js +26 -0
- package/dist/tasklist/lib/TasklistDto.js.map +1 -0
- package/dist/tasklist/lib/utils.d.ts +15 -0
- package/dist/tasklist/lib/utils.js +25 -0
- package/dist/tasklist/lib/utils.js.map +1 -0
- package/dist/zeebe/index.d.ts +21 -0
- package/dist/zeebe/index.js +53 -0
- package/dist/zeebe/index.js.map +1 -0
- package/dist/zeebe/lib/BpmnParser.d.ts +38 -0
- package/dist/zeebe/lib/BpmnParser.js +274 -0
- package/dist/zeebe/lib/BpmnParser.js.map +1 -0
- package/dist/zeebe/lib/ConnectionFactory.d.ts +25 -0
- package/dist/zeebe/lib/ConnectionFactory.js +43 -0
- package/dist/zeebe/lib/ConnectionFactory.js.map +1 -0
- package/dist/zeebe/lib/ConnectionStatusEvent.d.ts +6 -0
- package/dist/zeebe/lib/ConnectionStatusEvent.js +10 -0
- package/dist/zeebe/lib/ConnectionStatusEvent.js.map +1 -0
- package/dist/zeebe/lib/GetPackageVersion.d.ts +1 -0
- package/dist/zeebe/lib/GetPackageVersion.js +32 -0
- package/dist/zeebe/lib/GetPackageVersion.js.map +1 -0
- package/dist/zeebe/lib/GrpcClient.d.ts +75 -0
- package/dist/zeebe/lib/GrpcClient.js +467 -0
- package/dist/zeebe/lib/GrpcClient.js.map +1 -0
- package/dist/zeebe/lib/GrpcError.d.ts +19 -0
- package/dist/zeebe/lib/GrpcError.js +23 -0
- package/dist/zeebe/lib/GrpcError.js.map +1 -0
- package/dist/zeebe/lib/GrpcMiddleware.d.ts +21 -0
- package/dist/zeebe/lib/GrpcMiddleware.js +78 -0
- package/dist/zeebe/lib/GrpcMiddleware.js.map +1 -0
- package/dist/zeebe/lib/MockStdOut.d.ts +7 -0
- package/dist/zeebe/lib/MockStdOut.js +19 -0
- package/dist/zeebe/lib/MockStdOut.js.map +1 -0
- package/dist/zeebe/lib/Queue.d.ts +8 -0
- package/dist/zeebe/lib/Queue.js +15 -0
- package/dist/zeebe/lib/Queue.js.map +1 -0
- package/dist/zeebe/lib/SimpleLogger.d.ts +8 -0
- package/dist/zeebe/lib/SimpleLogger.js +47 -0
- package/dist/zeebe/lib/SimpleLogger.js.map +1 -0
- package/dist/zeebe/lib/StatefulLogInterceptor.d.ts +29 -0
- package/dist/zeebe/lib/StatefulLogInterceptor.js +81 -0
- package/dist/zeebe/lib/StatefulLogInterceptor.js.map +1 -0
- package/dist/zeebe/lib/TypedEmitter.d.ts +16 -0
- package/dist/zeebe/lib/TypedEmitter.js +24 -0
- package/dist/zeebe/lib/TypedEmitter.js.map +1 -0
- package/dist/zeebe/lib/ZBJsonLogger.d.ts +5 -0
- package/dist/zeebe/lib/ZBJsonLogger.js +12 -0
- package/dist/zeebe/lib/ZBJsonLogger.js.map +1 -0
- package/dist/zeebe/lib/ZBLogger.d.ts +20 -0
- package/dist/zeebe/lib/ZBLogger.js +134 -0
- package/dist/zeebe/lib/ZBLogger.js.map +1 -0
- package/dist/zeebe/lib/ZBWorkerBase.d.ts +78 -0
- package/dist/zeebe/lib/ZBWorkerBase.js +417 -0
- package/dist/zeebe/lib/ZBWorkerBase.js.map +1 -0
- package/dist/zeebe/lib/cancelProcesses.d.ts +1 -0
- package/dist/zeebe/lib/cancelProcesses.js +40 -0
- package/dist/zeebe/lib/cancelProcesses.js.map +1 -0
- package/dist/zeebe/lib/createUniqueTaskType.d.ts +0 -0
- package/dist/zeebe/lib/createUniqueTaskType.js +65 -0
- package/dist/zeebe/lib/createUniqueTaskType.js.map +1 -0
- package/dist/zeebe/lib/index.d.ts +2 -0
- package/dist/zeebe/lib/index.js +19 -0
- package/dist/zeebe/lib/index.js.map +1 -0
- package/dist/zeebe/lib/interfaces-1.0.d.ts +303 -0
- package/dist/zeebe/lib/interfaces-1.0.js +5 -0
- package/dist/zeebe/lib/interfaces-1.0.js.map +1 -0
- package/dist/zeebe/lib/interfaces-grpc-1.0.d.ts +679 -0
- package/dist/zeebe/lib/interfaces-grpc-1.0.js +22 -0
- package/dist/zeebe/lib/interfaces-grpc-1.0.js.map +1 -0
- package/dist/zeebe/lib/interfaces-published-contract.d.ts +67 -0
- package/dist/zeebe/lib/interfaces-published-contract.js +3 -0
- package/dist/zeebe/lib/interfaces-published-contract.js.map +1 -0
- package/dist/zeebe/lib/stringifyVariables.d.ts +18 -0
- package/dist/zeebe/lib/stringifyVariables.js +28 -0
- package/dist/zeebe/lib/stringifyVariables.js.map +1 -0
- package/dist/zeebe/lib/utils.d.ts +7 -0
- package/dist/zeebe/lib/utils.js +48 -0
- package/dist/zeebe/lib/utils.js.map +1 -0
- package/dist/zeebe/types.d.ts +3 -0
- package/dist/zeebe/types.js +20 -0
- package/dist/zeebe/types.js.map +1 -0
- package/dist/zeebe/zb/ZBWorker.d.ts +7 -0
- package/dist/zeebe/zb/ZBWorker.js +73 -0
- package/dist/zeebe/zb/ZBWorker.js.map +1 -0
- package/dist/zeebe/zb/ZeebeGrpcClient.d.ts +587 -0
- package/dist/zeebe/zb/ZeebeGrpcClient.js +1021 -0
- package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -0
- package/package.json +120 -30
- package/release.config.js +49 -0
- package/renovate.json +9 -0
- package/smoke-test/package-lock.json +29 -0
- package/smoke-test/package.json +15 -0
- package/smoke-test/smoke-test.js +45 -0
- package/test-d/index.test-d.ts +31 -0
- package/.github/workflows/build-docs.yml +0 -39
- package/.github/workflows/tag-and-publish.yml +0 -48
- package/.prettierignore +0 -2
- package/img/video.png +0 -0
- package/jest.config.js +0 -5
- package/src/__tests__/exports.spec.ts +0 -7
- package/src/index.ts +0 -17
- package/tsconfig.build.json +0 -8
- package/tsconfig.json +0 -10
- package/tsconfig.tsbuildinfo +0 -1
- package/typedoc.json +0 -10
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TasklistDto = exports.TasklistApiClient = void 0;
|
|
27
|
+
var TasklistApiClient_1 = require("./lib/TasklistApiClient");
|
|
28
|
+
Object.defineProperty(exports, "TasklistApiClient", { enumerable: true, get: function () { return TasklistApiClient_1.TasklistApiClient; } });
|
|
29
|
+
exports.TasklistDto = __importStar(require("./lib/TasklistDto"));
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasklist/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA2D;AAAlD,sHAAA,iBAAiB,OAAA;AAE1B,iEAAgD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { CamundaPlatform8Configuration, DeepPartial } from '../../lib';
|
|
2
|
+
import { IOAuthProvider } from '../../oauth';
|
|
3
|
+
import { Form, TaskResponse, TaskSearchAfterOrEqualRequest, TaskSearchAfterRequest, TaskSearchBeforeOrEqualRequest, TaskSearchBeforeRequest, TaskSearchRequestBase, TaskSearchResponse, Variable, VariableSearchResponse } from './TasklistDto';
|
|
4
|
+
import { JSONDoc } from './utils';
|
|
5
|
+
/**
|
|
6
|
+
* @description The high-level client for the Tasklist REST API
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare class TasklistApiClient {
|
|
13
|
+
private userAgentString;
|
|
14
|
+
private oAuthProvider;
|
|
15
|
+
private rest;
|
|
16
|
+
/**
|
|
17
|
+
* @example
|
|
18
|
+
* ```
|
|
19
|
+
* const tasklist = new TasklistApiClient()
|
|
20
|
+
* const tasks = await tasklist.getTasks({ state: TaskState.CREATED })
|
|
21
|
+
* ```
|
|
22
|
+
* @description
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
constructor(options?: {
|
|
26
|
+
config?: DeepPartial<CamundaPlatform8Configuration>;
|
|
27
|
+
oAuthProvider?: IOAuthProvider;
|
|
28
|
+
});
|
|
29
|
+
private getHeaders;
|
|
30
|
+
private replaceDatesWithString;
|
|
31
|
+
/**
|
|
32
|
+
* @description Query Tasklist for a list of tasks. See the [API documentation](https://docs.camunda.io/docs/apis-clients/tasklist-api/queries/tasks/).
|
|
33
|
+
* @throws Status 400 - An error is returned when more than one search parameters among [`searchAfter`, `searchAfterOrEqual`, `searchBefore`, `searchBeforeOrEqual`] are present in request
|
|
34
|
+
* @example
|
|
35
|
+
* ```
|
|
36
|
+
* const tasklist = new TasklistApiClient()
|
|
37
|
+
*
|
|
38
|
+
* async function getTasks() {
|
|
39
|
+
* const res = await tasklist.searchTasks({
|
|
40
|
+
* state: TaskState.CREATED
|
|
41
|
+
* })
|
|
42
|
+
* console.log(res ? 'Nothing' : JSON.stringify(res, null, 2))
|
|
43
|
+
* return res
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
* @param query
|
|
47
|
+
*/
|
|
48
|
+
searchTasks(query: TaskSearchAfterRequest | TaskSearchAfterOrEqualRequest | TaskSearchBeforeRequest | TaskSearchBeforeOrEqualRequest | Partial<TaskSearchRequestBase>): Promise<TaskSearchResponse[]>;
|
|
49
|
+
/**
|
|
50
|
+
* @description Return a task by id, or throw if not found.
|
|
51
|
+
* @throws Will throw if no task of the given taskId exists
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
getTask(taskId: string): Promise<TaskResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* @description Get the form details by form id and processDefinitionKey.
|
|
57
|
+
*/
|
|
58
|
+
getForm(formId: string, processDefinitionKey: string, version?: string | number): Promise<Form>;
|
|
59
|
+
/**
|
|
60
|
+
* @description This method returns a list of task variables for the specified taskId and variableNames. If the variableNames parameter is empty, all variables associated with the task will be returned.
|
|
61
|
+
* @throws Status 404 - An error is returned when the task with the taskId is not found.
|
|
62
|
+
*/
|
|
63
|
+
getVariables({ taskId, variableNames, includeVariables, }: {
|
|
64
|
+
taskId: string;
|
|
65
|
+
variableNames?: string[];
|
|
66
|
+
includeVariables?: {
|
|
67
|
+
name: string;
|
|
68
|
+
alwaysReturnFullValue: boolean;
|
|
69
|
+
}[];
|
|
70
|
+
}): Promise<VariableSearchResponse[]>;
|
|
71
|
+
/**
|
|
72
|
+
* @description https://docs.camunda.io/docs/apis-clients/tasklist-api/queries/variable/
|
|
73
|
+
* @throws Throws 404 if no variable of the id is found
|
|
74
|
+
*/
|
|
75
|
+
getVariable(variableId: string): Promise<Variable>;
|
|
76
|
+
/**
|
|
77
|
+
* @description Assign a task with taskId to assignee or the active user.
|
|
78
|
+
* @throws Status 400 - An error is returned when the task is not active (not in the CREATED state).
|
|
79
|
+
* Status 400 - An error is returned when task was already assigned, except the case when JWT authentication token used and allowOverrideAssignment = true.
|
|
80
|
+
* Status 403 - An error is returned when user doesn't have the permission to assign another user to this task.
|
|
81
|
+
* Status 404 - An error is returned when the task with the taskId is not found.
|
|
82
|
+
*/
|
|
83
|
+
assignTask({ taskId, allowOverrideAssignment, assignee, }: {
|
|
84
|
+
taskId: string;
|
|
85
|
+
assignee?: string;
|
|
86
|
+
allowOverrideAssignment?: boolean;
|
|
87
|
+
}): Promise<TaskResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* @description Complete a task with taskId and optional variables
|
|
90
|
+
* @throws Status 400 An error is returned when the task is not active (not in the CREATED state).
|
|
91
|
+
* @throws Status 400 An error is returned if the task was not claimed (assigned) before.
|
|
92
|
+
* @throws Status 400 An error is returned if the task is not assigned to the current user.
|
|
93
|
+
* @throws Status 403 User has no permission to access the task (Self-managed only).
|
|
94
|
+
* @throws Status 404 An error is returned when the task with the taskId is not found.
|
|
95
|
+
*/
|
|
96
|
+
completeTask(taskId: string, variables?: JSONDoc): Promise<TaskResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* @description Unassign a task with taskId
|
|
99
|
+
* @throws Status 400 An error is returned when the task is not active (not in the CREATED state).
|
|
100
|
+
* @throws Status 400 An error is returned if the task was not claimed (assigned) before.
|
|
101
|
+
* @throws Status 404 An error is returned when the task with the taskId is not found.
|
|
102
|
+
*/
|
|
103
|
+
unassignTask(taskId: string): Promise<TaskResponse>;
|
|
104
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TasklistApiClient = void 0;
|
|
7
|
+
const debug_1 = require("debug");
|
|
8
|
+
const got_1 = __importDefault(require("got"));
|
|
9
|
+
const lib_1 = require("../../lib");
|
|
10
|
+
const TasklistDto_1 = require("./TasklistDto");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const trace = (0, debug_1.debug)('camunda:tasklist');
|
|
13
|
+
const TASKLIST_API_VERSION = 'v1';
|
|
14
|
+
/**
|
|
15
|
+
* @description The high-level client for the Tasklist REST API
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
class TasklistApiClient {
|
|
22
|
+
/**
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* const tasklist = new TasklistApiClient()
|
|
26
|
+
* const tasks = await tasklist.getTasks({ state: TaskState.CREATED })
|
|
27
|
+
* ```
|
|
28
|
+
* @description
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
constructor(options) {
|
|
32
|
+
const config = lib_1.CamundaEnvironmentConfigurator.mergeConfigWithEnvironment(options?.config ?? {});
|
|
33
|
+
this.oAuthProvider =
|
|
34
|
+
options?.oAuthProvider ?? (0, lib_1.constructOAuthProvider)(config);
|
|
35
|
+
this.userAgentString = (0, lib_1.createUserAgentString)(config);
|
|
36
|
+
const baseUrl = (0, lib_1.RequireConfiguration)(config.CAMUNDA_TASKLIST_BASE_URL, 'CAMUNDA_TASKLIST_BASE_URL');
|
|
37
|
+
const prefixUrl = `${baseUrl}/${TASKLIST_API_VERSION}`;
|
|
38
|
+
const certificateAuthority = (0, lib_1.GetCertificateAuthority)(config);
|
|
39
|
+
this.rest = got_1.default.extend({
|
|
40
|
+
prefixUrl,
|
|
41
|
+
https: {
|
|
42
|
+
certificateAuthority,
|
|
43
|
+
},
|
|
44
|
+
hooks: {
|
|
45
|
+
beforeError: [
|
|
46
|
+
(error) => {
|
|
47
|
+
const { request } = error;
|
|
48
|
+
if (request) {
|
|
49
|
+
(0, debug_1.debug)(`Error in request to ${request.options.url.href}`);
|
|
50
|
+
(0, debug_1.debug)(`Request headers: ${JSON.stringify(request.options.headers)}`);
|
|
51
|
+
(0, debug_1.debug)(`Error: ${error.code} - ${error.message}`);
|
|
52
|
+
// Attach more contextual information to the error object
|
|
53
|
+
error.message += ` (request to ${request.options.url.href})`;
|
|
54
|
+
}
|
|
55
|
+
return error;
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
trace(`prefixUrl: ${prefixUrl}`);
|
|
61
|
+
}
|
|
62
|
+
async getHeaders() {
|
|
63
|
+
const token = await this.oAuthProvider.getToken('TASKLIST');
|
|
64
|
+
return {
|
|
65
|
+
'content-type': 'application/json',
|
|
66
|
+
authorization: `Bearer ${token}`,
|
|
67
|
+
'user-agent': this.userAgentString,
|
|
68
|
+
accept: '*/*',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
replaceDatesWithString(query) {
|
|
72
|
+
if (query.followUpDate) {
|
|
73
|
+
if (typeof query.followUpDate.from === 'object') {
|
|
74
|
+
query.followUpDate.from = query.followUpDate.from.toISOString();
|
|
75
|
+
}
|
|
76
|
+
if (typeof query.followUpDate.to === 'object') {
|
|
77
|
+
query.followUpDate.to = query.followUpDate.to.toISOString();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (query.dueDate) {
|
|
81
|
+
if (typeof query.dueDate.from === 'object') {
|
|
82
|
+
query.dueDate.from = query.dueDate.from.toISOString();
|
|
83
|
+
}
|
|
84
|
+
if (typeof query.dueDate.to === 'object') {
|
|
85
|
+
query.dueDate.to = query.dueDate.to.toISOString();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return query;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @description Query Tasklist for a list of tasks. See the [API documentation](https://docs.camunda.io/docs/apis-clients/tasklist-api/queries/tasks/).
|
|
92
|
+
* @throws Status 400 - An error is returned when more than one search parameters among [`searchAfter`, `searchAfterOrEqual`, `searchBefore`, `searchBeforeOrEqual`] are present in request
|
|
93
|
+
* @example
|
|
94
|
+
* ```
|
|
95
|
+
* const tasklist = new TasklistApiClient()
|
|
96
|
+
*
|
|
97
|
+
* async function getTasks() {
|
|
98
|
+
* const res = await tasklist.searchTasks({
|
|
99
|
+
* state: TaskState.CREATED
|
|
100
|
+
* })
|
|
101
|
+
* console.log(res ? 'Nothing' : JSON.stringify(res, null, 2))
|
|
102
|
+
* return res
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
* @param query
|
|
106
|
+
*/
|
|
107
|
+
async searchTasks(query) {
|
|
108
|
+
const headers = await this.getHeaders();
|
|
109
|
+
const url = 'tasks/search';
|
|
110
|
+
trace(`Requesting ${url}`);
|
|
111
|
+
return this.rest
|
|
112
|
+
.post(url, {
|
|
113
|
+
json: this.replaceDatesWithString(query),
|
|
114
|
+
headers,
|
|
115
|
+
parseJson: (text) => (0, lib_1.losslessParse)(text, TasklistDto_1.TaskSearchResponse),
|
|
116
|
+
})
|
|
117
|
+
.json();
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description Return a task by id, or throw if not found.
|
|
121
|
+
* @throws Will throw if no task of the given taskId exists
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
async getTask(taskId) {
|
|
125
|
+
const headers = await this.getHeaders();
|
|
126
|
+
return this.rest
|
|
127
|
+
.get(`tasks/${taskId}`, {
|
|
128
|
+
headers,
|
|
129
|
+
})
|
|
130
|
+
.json();
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @description Get the form details by form id and processDefinitionKey.
|
|
134
|
+
*/
|
|
135
|
+
async getForm(formId, processDefinitionKey, version) {
|
|
136
|
+
const headers = await this.getHeaders();
|
|
137
|
+
return this.rest
|
|
138
|
+
.get(`forms/${formId}`, {
|
|
139
|
+
searchParams: {
|
|
140
|
+
processDefinitionKey,
|
|
141
|
+
version,
|
|
142
|
+
},
|
|
143
|
+
parseJson: (text) => (0, lib_1.losslessParse)(text, TasklistDto_1.Form),
|
|
144
|
+
headers,
|
|
145
|
+
})
|
|
146
|
+
.json();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @description This method returns a list of task variables for the specified taskId and variableNames. If the variableNames parameter is empty, all variables associated with the task will be returned.
|
|
150
|
+
* @throws Status 404 - An error is returned when the task with the taskId is not found.
|
|
151
|
+
*/
|
|
152
|
+
async getVariables({ taskId, variableNames, includeVariables, }) {
|
|
153
|
+
const headers = await this.getHeaders();
|
|
154
|
+
return this.rest
|
|
155
|
+
.post(`tasks/${taskId}/variables/search`, {
|
|
156
|
+
body: (0, lib_1.losslessStringify)({
|
|
157
|
+
variableNames: variableNames || [],
|
|
158
|
+
includeVariables: includeVariables || {},
|
|
159
|
+
}),
|
|
160
|
+
headers,
|
|
161
|
+
})
|
|
162
|
+
.json();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @description https://docs.camunda.io/docs/apis-clients/tasklist-api/queries/variable/
|
|
166
|
+
* @throws Throws 404 if no variable of the id is found
|
|
167
|
+
*/
|
|
168
|
+
async getVariable(variableId) {
|
|
169
|
+
const headers = await this.getHeaders();
|
|
170
|
+
return this.rest
|
|
171
|
+
.get(`variables/${variableId}`, {
|
|
172
|
+
headers,
|
|
173
|
+
})
|
|
174
|
+
.json();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @description Assign a task with taskId to assignee or the active user.
|
|
178
|
+
* @throws Status 400 - An error is returned when the task is not active (not in the CREATED state).
|
|
179
|
+
* Status 400 - An error is returned when task was already assigned, except the case when JWT authentication token used and allowOverrideAssignment = true.
|
|
180
|
+
* Status 403 - An error is returned when user doesn't have the permission to assign another user to this task.
|
|
181
|
+
* Status 404 - An error is returned when the task with the taskId is not found.
|
|
182
|
+
*/
|
|
183
|
+
async assignTask({ taskId, allowOverrideAssignment = false, assignee, }) {
|
|
184
|
+
const headers = await this.getHeaders();
|
|
185
|
+
return this.rest
|
|
186
|
+
.patch(`tasks/${taskId}/assign`, {
|
|
187
|
+
body: (0, lib_1.losslessStringify)({
|
|
188
|
+
assignee,
|
|
189
|
+
allowOverrideAssignment,
|
|
190
|
+
}),
|
|
191
|
+
headers,
|
|
192
|
+
parseJson: (text) => (0, lib_1.losslessParse)(text, TasklistDto_1.TaskResponse),
|
|
193
|
+
})
|
|
194
|
+
.json();
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @description Complete a task with taskId and optional variables
|
|
198
|
+
* @throws Status 400 An error is returned when the task is not active (not in the CREATED state).
|
|
199
|
+
* @throws Status 400 An error is returned if the task was not claimed (assigned) before.
|
|
200
|
+
* @throws Status 400 An error is returned if the task is not assigned to the current user.
|
|
201
|
+
* @throws Status 403 User has no permission to access the task (Self-managed only).
|
|
202
|
+
* @throws Status 404 An error is returned when the task with the taskId is not found.
|
|
203
|
+
*/
|
|
204
|
+
async completeTask(taskId, variables) {
|
|
205
|
+
const headers = await this.getHeaders();
|
|
206
|
+
return this.rest
|
|
207
|
+
.patch(`tasks/${taskId}/complete`, {
|
|
208
|
+
headers,
|
|
209
|
+
body: (0, lib_1.losslessStringify)({
|
|
210
|
+
variables: (0, utils_1.encodeTaskVariablesForAPIRequest)(variables || {}),
|
|
211
|
+
}),
|
|
212
|
+
parseJson: (text) => (0, lib_1.losslessParse)(text, TasklistDto_1.TaskResponse),
|
|
213
|
+
})
|
|
214
|
+
.json();
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @description Unassign a task with taskId
|
|
218
|
+
* @throws Status 400 An error is returned when the task is not active (not in the CREATED state).
|
|
219
|
+
* @throws Status 400 An error is returned if the task was not claimed (assigned) before.
|
|
220
|
+
* @throws Status 404 An error is returned when the task with the taskId is not found.
|
|
221
|
+
*/
|
|
222
|
+
async unassignTask(taskId) {
|
|
223
|
+
const headers = await this.getHeaders();
|
|
224
|
+
return this.rest
|
|
225
|
+
.patch(`tasks/${taskId}/unassign`, {
|
|
226
|
+
headers,
|
|
227
|
+
parseJson: (text) => (0, lib_1.losslessParse)(text, TasklistDto_1.TaskResponse),
|
|
228
|
+
})
|
|
229
|
+
.json();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.TasklistApiClient = TasklistApiClient;
|
|
233
|
+
//# sourceMappingURL=TasklistApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TasklistApiClient.js","sourceRoot":"","sources":["../../../src/tasklist/lib/TasklistApiClient.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA6B;AAC7B,8CAAqB;AAErB,mCAUkB;AAGlB,+CAYsB;AACtB,mCAAmE;AAEnE,MAAM,KAAK,GAAG,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAA;AAEvC,MAAM,oBAAoB,GAAG,IAAI,CAAA;AAEjC;;;;;;GAMG;AACH,MAAa,iBAAiB;IAK7B;;;;;;;;OAQG;IACH,YAAY,OAGX;QACA,MAAM,MAAM,GAAG,oCAA8B,CAAC,0BAA0B,CACvE,OAAO,EAAE,MAAM,IAAI,EAAE,CACrB,CAAA;QACD,IAAI,CAAC,aAAa;YACjB,OAAO,EAAE,aAAa,IAAI,IAAA,4BAAsB,EAAC,MAAM,CAAC,CAAA;QACzD,IAAI,CAAC,eAAe,GAAG,IAAA,2BAAqB,EAAC,MAAM,CAAC,CAAA;QACpD,MAAM,OAAO,GAAG,IAAA,0BAAoB,EACnC,MAAM,CAAC,yBAAyB,EAChC,2BAA2B,CAC3B,CAAA;QACD,MAAM,SAAS,GAAG,GAAG,OAAO,IAAI,oBAAoB,EAAE,CAAA;QAEtD,MAAM,oBAAoB,GAAG,IAAA,6BAAuB,EAAC,MAAM,CAAC,CAAA;QAE5D,IAAI,CAAC,IAAI,GAAG,aAAG,CAAC,MAAM,CAAC;YACtB,SAAS;YACT,KAAK,EAAE;gBACN,oBAAoB;aACpB;YACD,KAAK,EAAE;gBACN,WAAW,EAAE;oBACZ,CAAC,KAAK,EAAE,EAAE;wBACT,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;wBACzB,IAAI,OAAO,EAAE,CAAC;4BACb,IAAA,aAAK,EAAC,uBAAuB,OAAO,CAAC,OAAO,CAAC,GAAG,CAA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gBACR,uBAAuB;aACvB,CAAC;YACF,OAAO;YACP,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAa,EAAC,IAAI,EAAE,0BAAY,CAAC;SACtD,CAAC;aACD,IAAI,EAAE,CAAA;IACT,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,YAAY,CACxB,MAAc,EACd,SAAmB;QAEnB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;QACvC,OAAO,IAAI,CAAC,IAAI;aACd,KAAK,CAAC,SAAS,MAAM,WAAW,EAAE;YAClC,OAAO;YACP,IAAI,EAAE,IAAA,uBAAiB,EAAC;gBACvB,SAAS,EAAE,IAAA,wCAAgC,EAAC,SAAS,IAAI,EAAE,CAAC;aAC5D,CAAC;YACF,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAa,EAAC,IAAI,EAAE,0BAAY,CAAC;SACtD,CAAC;aACD,IAAI,EAAE,CAAA;IACT,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CAAC,MAAc;QACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;QACvC,OAAO,IAAI,CAAC,IAAI;aACd,KAAK,CAAC,SAAS,MAAM,WAAW,EAAE;YAClC,OAAO;YACP,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAa,EAAC,IAAI,EAAE,0BAAY,CAAC;SACtD,CAAC;aACD,IAAI,EAAE,CAAA;IACT,CAAC;CACD;AA9QD,8CA8QC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { LosslessDto } from '../../lib';
|
|
2
|
+
export type TaskState = 'COMPLETED' | 'CREATED' | 'CANCELED' | 'FAILED';
|
|
3
|
+
export interface DraftSearchVariableValue {
|
|
4
|
+
value: string;
|
|
5
|
+
isValueTruncated: boolean;
|
|
6
|
+
previewValue: string;
|
|
7
|
+
}
|
|
8
|
+
export interface VariableSearchResponseWithoutDraft {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
previewValue: string;
|
|
13
|
+
}
|
|
14
|
+
export interface VariableSearchResponse extends VariableSearchResponseWithoutDraft {
|
|
15
|
+
draft: DraftSearchVariableValue;
|
|
16
|
+
}
|
|
17
|
+
export interface Variable {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
draft: DraftSearchVariableValue;
|
|
23
|
+
}
|
|
24
|
+
export interface DateFilter {
|
|
25
|
+
from: Date | string;
|
|
26
|
+
to: Date | string;
|
|
27
|
+
}
|
|
28
|
+
export interface TaskByVariables {
|
|
29
|
+
name: string;
|
|
30
|
+
value: string;
|
|
31
|
+
operator: 'eq';
|
|
32
|
+
}
|
|
33
|
+
interface TaskOrderBy {
|
|
34
|
+
field: 'completionTime' | 'creationTime' | 'followUpDate' | 'dueDate';
|
|
35
|
+
order: 'ASC' | 'DESC';
|
|
36
|
+
}
|
|
37
|
+
interface IncludeVariable {
|
|
38
|
+
name: string;
|
|
39
|
+
alwaysReturnFullValue?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface TaskSearchRequestBase {
|
|
42
|
+
state: TaskState;
|
|
43
|
+
assigned: boolean;
|
|
44
|
+
assignee: string;
|
|
45
|
+
assignees: string[];
|
|
46
|
+
taskDefinitionId: string;
|
|
47
|
+
candidateGroup: string;
|
|
48
|
+
candidateGroups: string[];
|
|
49
|
+
candidateUser: string;
|
|
50
|
+
candidateUsers: string[];
|
|
51
|
+
processDefinitionKey: string;
|
|
52
|
+
processInstanceKey: string;
|
|
53
|
+
pageSize: number;
|
|
54
|
+
followUpDate: DateFilter;
|
|
55
|
+
dueDate: DateFilter;
|
|
56
|
+
/** An array of filter clauses specifying the variables to filter for.
|
|
57
|
+
* If defined, the query returns only tasks to which all clauses apply.
|
|
58
|
+
* However, it's important to note that this filtering mechanism is
|
|
59
|
+
* designed to work exclusively with truncated variables. This means
|
|
60
|
+
* variables of a larger size are not compatible with this filter, and
|
|
61
|
+
* attempts to use them may result in inaccurate or incomplete query results.
|
|
62
|
+
*/
|
|
63
|
+
taskVariables: TaskByVariables[];
|
|
64
|
+
tenantIds: string[];
|
|
65
|
+
sort: TaskOrderBy[];
|
|
66
|
+
/**
|
|
67
|
+
* An array used to specify a list of variable names that should be included in the response when querying tasks.
|
|
68
|
+
* This field allows users to selectively retrieve specific variables associated with the tasks returned in the search results.
|
|
69
|
+
*/
|
|
70
|
+
includeVariables: IncludeVariable[];
|
|
71
|
+
implementation: 'JOB_WORKER' | 'ZEEBE_USER_TASK';
|
|
72
|
+
}
|
|
73
|
+
export interface TaskSearchAfterRequest extends Partial<TaskSearchRequestBase> {
|
|
74
|
+
/**
|
|
75
|
+
* Used to return a paginated result. Array of values that should be copied from sortValues of one of the tasks from the current search results page.
|
|
76
|
+
* It enables the API to return a page of tasks that directly follow the task identified by the provided values, with respect to the sorting order.
|
|
77
|
+
*/
|
|
78
|
+
searchAfter: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface TaskSearchAfterOrEqualRequest extends Partial<TaskSearchRequestBase> {
|
|
81
|
+
/**
|
|
82
|
+
* Used to return a paginated result. Array of values that should be copied from sortValues of one of the tasks from the current search results page.
|
|
83
|
+
* It enables the API to return a page of tasks that directly follow or are equal to the task identified by the provided values, with respect to the sorting order.
|
|
84
|
+
*/
|
|
85
|
+
searchAfterOrEqual: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface TaskSearchBeforeRequest extends Partial<TaskSearchRequestBase> {
|
|
88
|
+
/**
|
|
89
|
+
* Used to return a paginated result. Array of values that should be copied from sortValues of one of the tasks from the current search results page.
|
|
90
|
+
* It enables the API to return a page of tasks that directly precede the task identified by the provided values, with respect to the sorting order.
|
|
91
|
+
*/
|
|
92
|
+
searchBefore: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface TaskSearchBeforeOrEqualRequest extends Partial<TaskSearchRequestBase> {
|
|
95
|
+
/**
|
|
96
|
+
* Used to return a paginated result. Array of values that should be copied from sortValues of one of the tasks from the current search results page.
|
|
97
|
+
* It enables the API to return a page of tasks that directly precede or are equal to the task identified by the provided values, with respect to the sorting order.
|
|
98
|
+
*/
|
|
99
|
+
searchBeforeOrEqual: string[];
|
|
100
|
+
}
|
|
101
|
+
export declare class TaskResponse extends LosslessDto {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
taskDefinitionId: string;
|
|
105
|
+
processName: string;
|
|
106
|
+
creationDate: string;
|
|
107
|
+
completionDate: string;
|
|
108
|
+
assignee: string;
|
|
109
|
+
taskState: 'COMPLETED' | 'CREATED' | 'CANCELED' | 'FAILED';
|
|
110
|
+
formKey: string;
|
|
111
|
+
formId: string;
|
|
112
|
+
formVersion?: string;
|
|
113
|
+
isFormEmbedded?: boolean;
|
|
114
|
+
processDefinitionKey: string;
|
|
115
|
+
processInstanceKey: string;
|
|
116
|
+
tenantId: string;
|
|
117
|
+
dueDate: string;
|
|
118
|
+
followUpDate: string;
|
|
119
|
+
candidateGroups: string[];
|
|
120
|
+
candidateUsers: string[];
|
|
121
|
+
implementation: 'JOB_WORKER' | 'ZEEBE_USER_TASK';
|
|
122
|
+
}
|
|
123
|
+
export declare class TaskSearchResponse extends TaskResponse {
|
|
124
|
+
sortValues: string[];
|
|
125
|
+
isFirst: boolean;
|
|
126
|
+
variables: VariableSearchResponseWithoutDraft[];
|
|
127
|
+
}
|
|
128
|
+
export interface VariableInput {
|
|
129
|
+
name: string;
|
|
130
|
+
value: string;
|
|
131
|
+
}
|
|
132
|
+
export interface User {
|
|
133
|
+
userId: string;
|
|
134
|
+
displayName: string;
|
|
135
|
+
permissions: string[];
|
|
136
|
+
roles: string[];
|
|
137
|
+
salesPlanType: string;
|
|
138
|
+
}
|
|
139
|
+
export declare class Form extends LosslessDto {
|
|
140
|
+
id: string;
|
|
141
|
+
processDefinitionId: string;
|
|
142
|
+
schema: string;
|
|
143
|
+
version: string;
|
|
144
|
+
tenantId: string;
|
|
145
|
+
isDeleted: boolean;
|
|
146
|
+
}
|
|
147
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Form = exports.TaskSearchResponse = exports.TaskResponse = void 0;
|
|
10
|
+
const lib_1 = require("../../lib");
|
|
11
|
+
class TaskResponse extends lib_1.LosslessDto {
|
|
12
|
+
}
|
|
13
|
+
exports.TaskResponse = TaskResponse;
|
|
14
|
+
__decorate([
|
|
15
|
+
lib_1.Int64String
|
|
16
|
+
], TaskResponse.prototype, "formVersion", void 0);
|
|
17
|
+
class TaskSearchResponse extends TaskResponse {
|
|
18
|
+
}
|
|
19
|
+
exports.TaskSearchResponse = TaskSearchResponse;
|
|
20
|
+
class Form extends lib_1.LosslessDto {
|
|
21
|
+
}
|
|
22
|
+
exports.Form = Form;
|
|
23
|
+
__decorate([
|
|
24
|
+
lib_1.Int64String
|
|
25
|
+
], Form.prototype, "version", void 0);
|
|
26
|
+
//# sourceMappingURL=TasklistDto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TasklistDto.js","sourceRoot":"","sources":["../../../src/tasklist/lib/TasklistDto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAoD;AAwJpD,MAAa,YAAa,SAAQ,iBAAW;CAyC5C;AAzCD,oCAyCC;AAlBA;IADC,iBAAW;iDACQ;AAoBrB,MAAa,kBAAmB,SAAQ,YAAY;CAOnD;AAPD,gDAOC;AAeD,MAAa,IAAK,SAAQ,iBAAW;CAQpC;AARD,oBAQC;AAHA;IADC,iBAAW;qCACI"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type JSON = string | number | boolean | JSON[] | JSONDoc[];
|
|
2
|
+
export interface JSONDoc {
|
|
3
|
+
[key: string]: JSON;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Shallow escape
|
|
7
|
+
* @param variable
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const escape: (variable: JSON) => string | number | boolean;
|
|
11
|
+
export declare const encodeTaskVariablesForAPIRequest: (variables: JSONDoc) => {
|
|
12
|
+
name: string;
|
|
13
|
+
value: string | number | boolean;
|
|
14
|
+
}[];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeTaskVariablesForAPIRequest = exports.escape = void 0;
|
|
4
|
+
const lib_1 = require("../../lib");
|
|
5
|
+
/**
|
|
6
|
+
* Shallow escape
|
|
7
|
+
* @param variable
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
const escape = (variable) => {
|
|
11
|
+
if (typeof variable === 'object') {
|
|
12
|
+
return `${(0, lib_1.losslessStringify)(variable)}`;
|
|
13
|
+
}
|
|
14
|
+
if (typeof variable === 'string') {
|
|
15
|
+
return `"${variable}"`;
|
|
16
|
+
}
|
|
17
|
+
return variable;
|
|
18
|
+
};
|
|
19
|
+
exports.escape = escape;
|
|
20
|
+
const encodeTaskVariablesForAPIRequest = (variables) => Object.keys(variables).map((key) => ({
|
|
21
|
+
name: `${key}`,
|
|
22
|
+
value: (0, exports.escape)(variables[key]),
|
|
23
|
+
}));
|
|
24
|
+
exports.encodeTaskVariablesForAPIRequest = encodeTaskVariablesForAPIRequest;
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/tasklist/lib/utils.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAM7C;;;;GAIG;AACI,MAAM,MAAM,GAAG,CAAC,QAAc,EAAE,EAAE;IACxC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,GAAG,IAAA,uBAAiB,EAAC,QAAQ,CAAC,EAAE,CAAA;IACxC,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,IAAI,QAAQ,GAAG,CAAA;IACvB,CAAC;IACD,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA;AARY,QAAA,MAAM,UAQlB;AAEM,MAAM,gCAAgC,GAAG,CAAC,SAAkB,EAAE,EAAE,CACtE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpC,IAAI,EAAE,GAAG,GAAG,EAAE;IACd,KAAK,EAAE,IAAA,cAAM,EAAC,SAAS,CAAC,GAAG,CAAC,CAAC;CAC7B,CAAC,CAAC,CAAA;AAJS,QAAA,gCAAgC,oCAIzC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { Duration } from 'typed-duration';
|
|
2
|
+
export { BpmnParser } from './lib/BpmnParser';
|
|
3
|
+
import { ZBLogger } from './lib/ZBLogger';
|
|
4
|
+
import * as GrpcInterfaces from './lib/interfaces-grpc-1.0';
|
|
5
|
+
export * from './zb/ZBWorker';
|
|
6
|
+
export * from './zb/ZeebeGrpcClient';
|
|
7
|
+
/** @namespace */
|
|
8
|
+
export declare const Types: {
|
|
9
|
+
PartitionBrokerRole: typeof GrpcInterfaces.PartitionBrokerRole;
|
|
10
|
+
PartitionBrokerHealth: typeof GrpcInterfaces.PartitionBrokerHealth;
|
|
11
|
+
JOB_ACTION_ACKNOWLEDGEMENT: "JOB_ACTION_ACKNOWLEDGEMENT";
|
|
12
|
+
};
|
|
13
|
+
export declare const Logging: {
|
|
14
|
+
ZBJsonLogger: {
|
|
15
|
+
error: (message?: any, ...optionalParams: any[]) => void;
|
|
16
|
+
info: (message?: any, ...optionalParams: any[]) => void;
|
|
17
|
+
debug: (message?: any, ...optionalParams: any[]) => void;
|
|
18
|
+
};
|
|
19
|
+
ZBLogger: typeof ZBLogger;
|
|
20
|
+
ZBSimpleLogger: import("./lib/SimpleLogger").Logger;
|
|
21
|
+
};
|