Skip to content

Commit

Permalink
Human task upgrades (#54)
Browse files Browse the repository at this point in the history
* refactor: add support for human task

* fix: types for human task

* feat: updated human task with new api

* feat: added getExecution

* feat: added helper

* refactor: remove the browser module everything uses the same module

* fix: version number
  • Loading branch information
Sudakatux authored Jan 19, 2024
1 parent 4a225e0 commit 20a20de
Show file tree
Hide file tree
Showing 34 changed files with 451 additions and 513 deletions.
5 changes: 0 additions & 5 deletions browser.ts

This file was deleted.

18 changes: 2 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./browser": {
"require": "./dist/browser.js",
"import": "./dist/browser.mjs",
"types": "./dist/browser.d.ts"
}
},
"private": false,
Expand All @@ -30,7 +25,7 @@
"main": "dist/index.js",
"scripts": {
"lint": "npx eslint . --ext .js,.ts",
"build": "tsup",
"build": "tsup index.ts",
"prepublishOnly": "npm run build",
"lint-fix": "npx eslint . --fix --ext .js,.ts",
"test": "jest --force-exit --detectOpenHandles",
Expand Down Expand Up @@ -66,7 +61,6 @@
"dotenv": "^16.0.1",
"eslint": "^6.1.0",
"jest": "^29.4.3",
"@types/node-fetch": "^2.6.4",
"ts-jest": "^29.0.5",
"ts-node": "^10.7.0",
"tsup": "^7.1.0",
Expand All @@ -82,21 +76,13 @@
"esm",
"cjs"
],
"entry": [
"index.ts",
"browser.ts"
],
"dts": true,
"clean": true,
"splitting": false,
"types": [
"index.ts"
]
"splitting": false
},
"engines": {
"node": ">=18"
},
"dependencies": {
"node-fetch": "^2.6.12"
}
}
24 changes: 9 additions & 15 deletions src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,16 @@ export {
TokenResourceService,
WorkflowBulkResourceService,
WorkflowResourceService,
AssignmentPolicy,
Fixed,
BackToAssigment,
ClearAssigment,
Escalate,
FFAAssignment,
HTScrollableSearchResultHumanTaskEntry,
HumanTaskActionLogEntry,
HumanTaskEntry,
HumanTaskLoad,
HumanTaskStateLogEntry,
HumanTaskTemplate,
HumanTaskTemplateEntry,
LeastBusyGroupMemberAssignment,
Never,
SearchResultHumanTaskEntry,
Terminate,
TimeoutPolicy,
HumanTaskUser,
HumanTaskDefinition,
HumanTaskAssignment,
HumanTaskTrigger,
UserFormTemplate,
HumanTaskTemplate,
HumanTaskSearchResult,
HumanTaskSearch,
HumanTaskEntry
} from "./open-api";
23 changes: 8 additions & 15 deletions src/common/open-api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,18 @@ export type { WorkflowSummary } from "./models/WorkflowSummary";
export type { WorkflowTask } from "./models/WorkflowTask";

// HUMAN
export type { AssignmentPolicy } from "./models/AssignmentPolicy";
export type { Fixed } from "./models/Fixed";
export type { BackToAssigment } from "./models/BackToAssigment";
export type { ClearAssigment } from "./models/ClearAssigment";
export type { Escalate } from "./models/Escalate";
export type { FFAAssignment } from "./models/FFAAssignment";
export type { HTScrollableSearchResultHumanTaskEntry } from "./models/HTScrollableSearchResultHumanTaskEntry";
export type { HumanTaskActionLogEntry } from "./models/HumanTaskActionLogEntry";
export type { HumanTaskEntry } from "./models/HumanTaskEntry";
export type { HumanTaskLoad } from "./models/HumanTaskLoad";
export type { HumanTaskStateLogEntry } from "./models/HumanTaskStateLogEntry";
export type { HumanTaskUser } from "./models/HumanTaskUser";
export type { HumanTaskDefinition } from "./models/HumanTaskDefinition";
export type { HumanTaskAssignment } from "./models/HumanTaskAssignment";
export type { HumanTaskTrigger } from "./models/HumanTaskTrigger";
export type { UserFormTemplate } from "./models/UserFormTemplate";
export type { HumanTaskTemplate } from "./models/HumanTaskTemplate";
export type { HumanTaskTemplateEntry } from "./models/HumanTaskTemplateEntry";
export type { LeastBusyGroupMemberAssignment } from "./models/LeastBusyGroupMemberAssignment";
export type { Never } from "./models/Never";
export type { SearchResultHumanTaskEntry } from "./models/SearchResultHumanTaskEntry";
export type { HumanTaskSearchResult } from "./models/HumanTaskSearchResult";
export type { HumanTaskSearch } from "./models/HumanTaskSearch";
export type { Terminate } from "./models/Terminate";
export type { TimeoutPolicy } from "./models/TimeoutPolicy";
export type { HumanTaskEntry } from "./models/HumanTaskEntry";

export { EventResourceService } from "./services/EventResourceService";
export { HealthCheckResourceService } from "./services/HealthCheckResourceService";
Expand All @@ -76,4 +70,3 @@ export { WorkflowBulkResourceService } from "./services/WorkflowBulkResourceServ
export { WorkflowResourceService } from "./services/WorkflowResourceService";
export { HumanTaskResourceService } from "./services/HumanTaskResourceService";
export { HumanTaskService } from "./services/HumanTaskService";

10 changes: 0 additions & 10 deletions src/common/open-api/models/BackToAssigment.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/common/open-api/models/ClearAssigment.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/common/open-api/models/Escalate.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/common/open-api/models/FFAAssignment.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/common/open-api/models/Fixed.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/common/open-api/models/HumanTaskActionLogEntry.ts

This file was deleted.

11 changes: 11 additions & 0 deletions src/common/open-api/models/HumanTaskAssignment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { HumanTaskUser } from './HumanTaskUser';

export type HumanTaskAssignment = {
assignee?: HumanTaskUser;
slaMinutes?: number;
};

15 changes: 15 additions & 0 deletions src/common/open-api/models/HumanTaskDefinition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { HumanTaskAssignment } from './HumanTaskAssignment';
import type { HumanTaskTrigger } from './HumanTaskTrigger';
import type { UserFormTemplate } from './UserFormTemplate';

export type HumanTaskDefinition = {
assignmentCompletionStrategy?: 'LEAVE_OPEN' | 'TERMINATE';
assignments?: Array<HumanTaskAssignment>;
taskTriggers?: Array<HumanTaskTrigger>;
userFormTemplate?: UserFormTemplate;
};

31 changes: 11 additions & 20 deletions src/common/open-api/models/HumanTaskEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,23 @@
/* tslint:disable */
/* eslint-disable */

import type { BackToAssigment } from './BackToAssigment';
import type { ClearAssigment } from './ClearAssigment';
import type { Escalate } from './Escalate';
import type { FFAAssignment } from './FFAAssignment';
import type { Fixed } from './Fixed';
import type { LeastBusyGroupMemberAssignment } from './LeastBusyGroupMemberAssignment';
import type { Never } from './Never';
import type { Terminate } from './Terminate';
import type { HumanTaskDefinition } from './HumanTaskDefinition';
import type { HumanTaskUser } from './HumanTaskUser';

export type HumanTaskEntry = {
assignee?: string;
assigneeType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP';
assignmentPolicy?: (FFAAssignment | Fixed | LeastBusyGroupMemberAssignment);
claimedBy?: string;
assignee?: HumanTaskUser;
claimant?: HumanTaskUser;
createdBy?: string;
createdOn?: number;
escalatedAt?: number;
output?: Record<string, Record<string, any>>;
owners?: Array<string>;
predefinedInput?: Record<string, Record<string, any>>;
state?: 'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT';
definitionName?: string;
humanTaskDef?: HumanTaskDefinition;
input?: Record<string, any>;
output?: Record<string, any>;
state?: 'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT' | 'DELETED';
taskId?: string;
taskName?: string;
taskRefName?: string;
templateId?: string;
timeoutPolicy?: (BackToAssigment | ClearAssigment | Escalate | Never | Terminate);
updatedBy?: string;
updatedOn?: number;
workflowId?: string;
workflowName?: string;
};
Expand Down
11 changes: 0 additions & 11 deletions src/common/open-api/models/HumanTaskLoad.ts

This file was deleted.

20 changes: 20 additions & 0 deletions src/common/open-api/models/HumanTaskSearch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { HumanTaskUser } from './HumanTaskUser';

export type HumanTaskSearch = {
assignees?: Array<HumanTaskUser>;
claimants?: Array<HumanTaskUser>;
definitionNames?: Array<string>;
taskOutputQuery?: string;
taskInputQuery?: string;
searchType?: 'ADMIN' | 'INBOX';
size?: number;
start?: number;
states?: Array<'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT' | 'DELETED'>;
taskRefNames?: Array<string>;
workflowNames?: Array<string>;
};

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import type { HumanTaskEntry } from './HumanTaskEntry';

export type SearchResultHumanTaskEntry = {
export type HumanTaskSearchResult = {
results?: Array<HumanTaskEntry>;
totalHits?: number;
};
Expand Down
18 changes: 0 additions & 18 deletions src/common/open-api/models/HumanTaskStateLogEntry.ts

This file was deleted.

10 changes: 7 additions & 3 deletions src/common/open-api/models/HumanTaskTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
/* eslint-disable */

export type HumanTaskTemplate = {
jsonSchema: Record<string, Record<string, any>>;
createdBy?: string;
createdOn?: number;
jsonSchema: Record<string, any>;
name: string;
templateUI: Record<string, Record<string, any>>;
version?: number;
templateUI: Record<string, any>;
updatedBy?: string;
updatedOn?: number;
version: number;
};

16 changes: 0 additions & 16 deletions src/common/open-api/models/HumanTaskTemplateEntry.ts

This file was deleted.

11 changes: 11 additions & 0 deletions src/common/open-api/models/HumanTaskTrigger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { StartWorkflowRequest } from './StartWorkflowRequest';

export type HumanTaskTrigger = {
startWorkflowRequest?: StartWorkflowRequest;
triggerType?: 'ASSIGNEE_CHANGED' | 'PENDING' | 'IN_PROGRESS' | 'ASSIGNED' | 'COMPLETED' | 'TIMED_OUT';
};

9 changes: 9 additions & 0 deletions src/common/open-api/models/HumanTaskUser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

export type HumanTaskUser = {
user?: string;
userType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP';
};

Loading

0 comments on commit 20a20de

Please sign in to comment.