File tree 5 files changed +17
-13
lines changed
5 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,11 @@ const debug = createDebugger("agenda:db_init");
13
13
*/
14
14
export const dbInit = function (
15
15
this : Agenda ,
16
- collection : string | undefined ,
16
+ collection = "agendaJobs" ,
17
17
cb ?: ( error : Error , collection : Collection < any > | null ) => void
18
18
) : void {
19
19
debug ( "init database collection using name [%s]" , collection ) ;
20
- this . _collection = this . _mdb . collection ( collection || "agendaJobs" ) ; // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing
20
+ this . _collection = this . _mdb . collection ( collection ) ;
21
21
debug ( "attempting index creation" ) ;
22
22
this . _collection . createIndex (
23
23
this . _indices ,
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export const every = async function (
19
19
this : Agenda ,
20
20
interval : string ,
21
21
names : string | string [ ] ,
22
- data : unknown ,
23
- options : JobOptions
22
+ data ? : unknown ,
23
+ options ? : JobOptions
24
24
) : Promise < any > {
25
25
/**
26
26
* Internal method to setup job that gets run every interval
@@ -33,8 +33,8 @@ export const every = async function (
33
33
const createJob = async (
34
34
interval : string ,
35
35
name : string ,
36
- data : unknown ,
37
- options : JobOptions
36
+ data ? : unknown ,
37
+ options ? : JobOptions
38
38
) : Promise < Job > => {
39
39
const job = this . create ( name , data ) ;
40
40
@@ -54,8 +54,8 @@ export const every = async function (
54
54
const createJobs = async (
55
55
interval : string ,
56
56
names : string [ ] ,
57
- data : unknown ,
58
- options : JobOptions
57
+ data ? : unknown ,
58
+ options ? : JobOptions
59
59
) : Promise < Job [ ] | undefined > => {
60
60
try {
61
61
const jobs : Array < Promise < Job > > = [ ] ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { Agenda } from ".";
12
12
export const mongo = function (
13
13
this : Agenda ,
14
14
mdb : Db ,
15
- collection : string | undefined ,
15
+ collection ? : string ,
16
16
cb ?: ( error : Error , collection : Collection < any > | null ) => void
17
17
) : Agenda {
18
18
this . _mdb = mdb ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const debug = createDebugger("agenda:schedule");
15
15
*/
16
16
export const schedule = function (
17
17
this : Agenda ,
18
- when : string ,
18
+ when : string | Date ,
19
19
names : string [ ] ,
20
20
data : any
21
21
) : undefined | Promise < Job | Job [ ] > {
@@ -27,7 +27,7 @@ export const schedule = function (
27
27
* @returns instance of new job
28
28
*/
29
29
const createJob = async (
30
- when : string ,
30
+ when : string | Date ,
31
31
name : string ,
32
32
data : any
33
33
) : Promise < Job > => {
@@ -46,7 +46,7 @@ export const schedule = function (
46
46
* @returns jobs that were created
47
47
*/
48
48
const createJobs = async (
49
- when : string ,
49
+ when : string | Date ,
50
50
names : string [ ] ,
51
51
data : any
52
52
) : Promise < Job [ ] > => {
Original file line number Diff line number Diff line change 1
- export { Agenda , AgendaConfig } from "./agenda" ;
1
+ export * from "./agenda" ;
2
+ export * from "./job" ;
2
3
3
4
export { DefineOptions , JobPriority , Processor } from "./agenda/define" ;
4
5
export { JobOptions } from "./job/repeat-every" ;
6
+
7
+ import { Agenda } from "./agenda" ;
8
+ export default Agenda ;
You can’t perform that action at this time.
0 commit comments