Light Croncile node client with full TypeScript support
- Fully typed api client for Cronicle
- No dependencies (you need to install your own
- Helper methods to build Timing objects for scheduling events
- Type safety extendable for Categories, Plugins and Targets
npm install cronicle-client
request-promise is a peer dependency and must be installed by you (>=1.0.0)
If you want to use the timing utils, you must also install
Extending with custom types example
For all api endpoints documentations, please refer to Cronicle api reference
When creating an event, there is no unique restriction on the title/id.
While searching for an event using
api allows you to search by title/id, which is great, but as of now (cronicle v0.89) it will return a single result.
This imposes an issue when you don't enforce a unique title/id since you will get a random result (see #186)
Until this behaviour is fixed, you can tell the
createEvent method to enforce uniqueness and it will fail if an event with the provided title/id already exists.
id is provided - it will be used as the unique key, otherwise
title will be used.
Croncile will always return a valid HTTP response (code
To raise an error, the
code property of the response will be different than
In such cases, the current method will be rejected with
CronicleError with the proper error message and the
||The full url to the master Cronicle server|
||The api key to use (make sure it has relevant permissions enabled)|
The client can enforce the proper usage of categories, targets and plugins (with their required parameters).
This is done using optional generics:
|Generics Parameter Name||Description|
||Enum containing the ids of the categories available at you Cronicle server (Defaults to
||Enum containing the ids of the targets available at you Cronicle server (Defaults to
||Interface containing mapping between plugin ids and the interface representing their required event params (Defaults to
Example constructor with defaults:
Example for setting the categories your server supports:
Example for setting the targets your server supports:
Example for setting the plugins your server supports:
Example constructor with overrides:
To support a wide variety of scheduling, the timing object
an be very cumbersome...
To make life easier (at least when you just want to schedule an event for a single future run) you can use the
If you want to use the timing utils, you MUST
npm install --save moment
Cronicle client supports Node 6 LTS and higher.
All contributions are happily welcomed!
Please make all pull requests to the
master branch from your fork and ensure tests pass locally.