camunda-external-task-client-js
Advanced tools
Comparing version 3.0.1 to 3.1.0
# Changelog | ||
## 3.1.0 | ||
### Features | ||
- Update dependencies ([#3698](https://github.com/camunda/camunda-bpm-platform/issues/3698),[#3906](https://github.com/camunda/camunda-bpm-platform/issues/3906)) | ||
- Add sort by create time capability ([#3928](https://github.com/camunda/camunda-bpm-platform/issues/3928)) | ||
## 3.0.1 | ||
@@ -4,0 +10,0 @@ ### Features |
@@ -35,3 +35,11 @@ # `Client` | ||
| use | Function(s) that have access to the client instance as soon as it is created and before any polling happens. Check out [logger](/lib/logger.js) for a better understanding of the usage of middlewares. | function or [function] | | | | ||
| sorting | Defines the sorting of the fetched tasks. It can be used together with `usePriority`, but the sorting will be based on priority first. | Array of `Sorting` objects | | | | ||
`Sorting` object properties: | ||
| Option | Description | Type | Required | Default | | ||
|:---------:|:-------------------------------------------------------------------------:|--------|:--------:|:-------:| | ||
| sortBy | Specifies the sorting by property. [Possible values.](/lib/Client.js#L67) | string | ✓ | | | ||
| sortOrder | Specifies the sorting direction. [Possible values.](/lib/Client.js#L71) | string | ✓ | | | ||
### About interceptors | ||
@@ -38,0 +46,0 @@ |
@@ -53,2 +53,9 @@ /* | ||
const WRONG_SORTING = | ||
"Couldn't instantiate Client, 'sorting' parameter should be an array."; | ||
const WRONG_SORTING_SORT_BY = | ||
"Couldn't instantiate Client, wrong 'sorting.sortBy' parameter. Possible values: "; | ||
const WRONG_SORTING_SORT_ORDER = | ||
"Couldn't instantiate Client, wrong 'sorting.sortOrder' parameter. Possible values: "; | ||
export { | ||
@@ -68,2 +75,5 @@ MISSING_BASE_URL, | ||
MISSING_FILE_OPTIONS, | ||
WRONG_SORTING, | ||
WRONG_SORTING_SORT_BY, | ||
WRONG_SORTING_SORT_ORDER, | ||
}; |
@@ -30,2 +30,5 @@ /* | ||
WRONG_MIDDLEWARES, | ||
WRONG_SORTING, | ||
WRONG_SORTING_SORT_ORDER, | ||
WRONG_SORTING_SORT_BY, | ||
} from "./__internal/errors.js"; | ||
@@ -59,7 +62,17 @@ | ||
* @param customOptions.interceptors | ||
* @param customOptions.use | ||
* @param customOptions.usePriority | ||
* @param customOptions.maxParallelExecutions | ||
* @param customOptions.sorting | ||
* @constructor | ||
*/ | ||
class Client extends events { | ||
static SortBy = Object.freeze({ | ||
CreateTime: "createTime", | ||
}); | ||
static SortOrder = Object.freeze({ | ||
ASC: "asc", | ||
DESC: "desc", | ||
}); | ||
constructor(customOptions) { | ||
@@ -134,2 +147,27 @@ super(); | ||
} | ||
if (this.options.sorting) { | ||
// sanitize sorting | ||
if (!Array.isArray(this.options.sorting)) { | ||
throw new Error(WRONG_SORTING); | ||
} | ||
// sanitize sorting.sortBy | ||
const sortByPredicate = (sorting) => | ||
!sorting.sortBy || | ||
!Object.values(Client.SortBy).includes(sorting.sortBy); | ||
if (this.options.sorting.some(sortByPredicate)) { | ||
throw new Error(WRONG_SORTING_SORT_BY + Object.values(Client.SortBy)); | ||
} | ||
// sanitize sorting.sortOrder | ||
const sortOrderPredicate = (sorting) => | ||
!sorting.sortOrder || | ||
!Object.values(Client.SortOrder).includes(sorting.sortOrder); | ||
if (this.options.sorting.some(sortOrderPredicate)) { | ||
throw new Error( | ||
WRONG_SORTING_SORT_ORDER + Object.values(Client.SortOrder) | ||
); | ||
} | ||
} | ||
} | ||
@@ -159,2 +197,3 @@ | ||
usePriority, | ||
sorting, | ||
interval, | ||
@@ -181,2 +220,5 @@ asyncResponseTimeout, | ||
} | ||
if (sorting) { | ||
pollingOptions = { ...pollingOptions, sorting }; | ||
} | ||
@@ -183,0 +225,0 @@ // if there are no topic subscriptions, reschedule polling |
@@ -48,2 +48,5 @@ /* | ||
lockDuration: 30000, | ||
sorting: [ | ||
{ sortBy: Client.SortBy.CreateTime, sortOrder: Client.SortOrder.ASC }, | ||
], | ||
}; | ||
@@ -50,0 +53,0 @@ |
{ | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"name": "camunda-external-task-client-js", | ||
@@ -15,15 +15,15 @@ "exports": "./index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.20.2", | ||
"@babel/plugin-transform-modules-commonjs": "^7.19.6", | ||
"@babel/preset-env": "^7.20.2", | ||
"@jest/globals": "^29.2.2", | ||
"babel-jest": "^29.3.1", | ||
"eslint": "^8.26.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-bpmn-io": "0.16.0", | ||
"@babel/core": "^7.23.9", | ||
"@babel/plugin-transform-modules-commonjs": "^7.23.3", | ||
"@babel/preset-env": "^7.23.9", | ||
"@jest/globals": "^29.7.0", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-bpmn-io": "1.0.0", | ||
"eslint-plugin-camunda-licensed": "0.4.6", | ||
"eslint-plugin-jest": "^27.1.3", | ||
"eslint-plugin-jest": "^27.6.3", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"form-data": "^4.0.0", | ||
"jest": "29.2.2", | ||
"jest": "29.7.0", | ||
"license-checker": "^25.0.1", | ||
@@ -33,4 +33,4 @@ "prettier": "^2.7.1" | ||
"dependencies": { | ||
"chalk": "^5.1.2", | ||
"got": "^13.0.0" | ||
"chalk": "^5.3.0", | ||
"got": "^14.2.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "description": "Implement your [BPMN Service Task](https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/) in NodeJS.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234112
47
3601
+ Added@sec-ant/readable-stream@0.4.1(transitive)
+ Added@sindresorhus/is@7.0.1(transitive)
+ Addedcacheable-request@12.0.1(transitive)
+ Addedform-data-encoder@4.0.2(transitive)
+ Addedget-stream@9.0.1(transitive)
+ Addedgot@14.4.4(transitive)
+ Addedis-stream@4.0.1(transitive)
+ Addedp-cancelable@4.0.1(transitive)
+ Addedtype-fest@4.27.0(transitive)
- Removed@sindresorhus/is@5.6.0(transitive)
- Removedcacheable-request@10.2.14(transitive)
- Removedform-data-encoder@2.1.4(transitive)
- Removedget-stream@6.0.1(transitive)
- Removedgot@13.0.0(transitive)
- Removedp-cancelable@3.0.0(transitive)
Updatedchalk@^5.3.0
Updatedgot@^14.2.0