# @brewery/parse-job-scheduler

> Parse server jobs scheduler

Latest version **1.0.1** (published 2020-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @brewery/parse-job-scheduler
pnpm add @brewery/parse-job-scheduler
yarn add @brewery/parse-job-scheduler
bun add @brewery/parse-job-scheduler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-07-28 |
| First published | 2020-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | Ronald DC |
| Maintainers | excelsior.mante, jcalado, brewery-apps |
| Keywords | parse-server, jobs |

## Links

- npm: https://www.npmjs.com/package/@brewery/parse-job-scheduler
- npm.io page: https://npm.io/package/@brewery/parse-job-scheduler

## Dependencies (5)

- [cron](https://npm.io/package/cron.md) ^1.8.2
- [parse](https://npm.io/package/parse.md) ^2.15.0
- [moment](https://npm.io/package/moment.md) ^2.27.0
- [request](https://npm.io/package/request.md) ^2.88.2
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.6

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-07-28

## README

# Parse Server Job Scheduler

## Purpose of the library
By default, *_JobSchedule* objects created on self-hosted Parse servers are not handled by the Parse server library.
This library is a minimalist tool that fetches all *_JobSchedule* objects and schedules cron tasks that will run the scheduled jobs.

## How to use it?

### Install the library

```sh
$ npm install --save @brewery/parse-job-scheduler
```

### Add these lines your Parse Cloud Code main file 

```js
// Import the library
const JobsScheduler = require('@brewery/parse-job-scheduler')

// Initialize a Parse instance
JobsScheduler.init({
    serverURL: 'http://localhost:1337/parse',
    appId: 'myAppId',
    masterKey: 'masterKey'
})

// Recreates all crons when the server is launched
JobsScheduler.recreateSchedule()

// Recreates schedule when a job schedule has changed
Parse.Cloud.afterSave('_JobSchedule', async (request) => {
  JobsScheduler.recreateSchedule(request.object)
})

// Destroy schedule for removed job
Parse.Cloud.afterDelete('_JobSchedule', async (request) => {
  JobsScheduler.destroySchedule(request.object)
})
```

---
_Source: https://npm.io/package/@brewery/parse-job-scheduler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
