forked from ajmath/serverless-offline-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (29 loc) · 880 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"use strict";
const Scheduler = require("./lib/scheduler");
class ServerlessOfflineScheduler {
constructor(serverless, options) {
this.serverless = serverless;
this.scheduler = new Scheduler(serverless, options);
this.options = options;
this.commands = {
schedule: {
usage: "Run scheduled lambadas locally",
lifecycleEvents: ["run"],
options: {
runSchedulesOnInit: {
usage:
"run scheduled functions immediately in addition to defined interval" +
"(e.g \"--runSchedulesOnInit\")",
required: false,
type: "boolean"
}
}
}
};
this.hooks = {
"schedule:run": (opts) => this.scheduler.run(opts),
"before:offline:start:init": (opts) => this.scheduler.run(opts)
};
}
}
module.exports = ServerlessOfflineScheduler;