@wavezync/nestjs-pgboss 1.0.0-alpha → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE
CHANGED
package/README.MD
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# `@wavezync/nestjs-pgboss`
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
Use <a href="https://github.com/timgit/pg-boss" target="_blank">pg-boss</a> in your Nest.js
|
|
4
|
+
Use <a href="https://github.com/timgit/pg-boss" target="_blank">pg-boss</a> in your Nest.js app!
|
|
5
5
|
<p align="center">
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
<a href="https://github.com/wavezync/nestjs-pgboss/actions/workflows/build.yaml">
|
|
9
9
|
<img src="https://img.shields.io/github/actions/workflow/status/wavezync/nestjs-pgboss/build.yaml?branch=main" alt="Build Status">
|
|
10
10
|
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@wavezync/nestjs-pgboss">
|
|
12
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/%40wavezync%2Fnestjs-pgboss">
|
|
13
|
+
</a>
|
|
11
14
|
<a href="https://github.com/wavezync/nestjs-pgboss/blob/main/LICENSE">
|
|
12
15
|
<img src="https://img.shields.io/badge/License-MIT-green" alt="License">
|
|
13
16
|
</a>
|
|
@@ -16,7 +19,7 @@
|
|
|
16
19
|
## Installation
|
|
17
20
|
|
|
18
21
|
```bash
|
|
19
|
-
npm install @wavezync/nestjs-pgboss
|
|
22
|
+
npm install pg-boss @wavezync/nestjs-pgboss
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Usage
|
|
@@ -43,7 +46,7 @@ import { PGBossModule } from "@wavezync/nestjs-pgboss";
|
|
|
43
46
|
export class AppModule {}
|
|
44
47
|
```
|
|
45
48
|
|
|
46
|
-
Schedule a job using `PgBossService
|
|
49
|
+
#### Schedule a job using `PgBossService`
|
|
47
50
|
|
|
48
51
|
```ts
|
|
49
52
|
import { Injectable } from '@nestjs/common';
|
|
@@ -59,7 +62,8 @@ export class JobSchedulerService {
|
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
```
|
|
62
|
-
|
|
65
|
+
|
|
66
|
+
#### Handle jobs using the `@Job` decorator
|
|
63
67
|
|
|
64
68
|
```ts
|
|
65
69
|
import { Injectable, Logger } from '@nestjs/common';
|
|
@@ -76,10 +80,12 @@ export class MyJobHandler {
|
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
```
|
|
79
|
-
|
|
83
|
+
|
|
84
|
+
#### Handle cron jobs using the `@CronJob` decorator
|
|
85
|
+
|
|
80
86
|
```ts
|
|
81
87
|
import { Injectable, Logger } from '@nestjs/common';
|
|
82
|
-
import { PgBossService,
|
|
88
|
+
import { PgBossService, CronJob } from '@wavezync/nestjs-pgboss';
|
|
83
89
|
|
|
84
90
|
@Injectable()
|
|
85
91
|
export class MyCronJobService {
|
|
@@ -103,4 +109,4 @@ $ npm run test
|
|
|
103
109
|
|
|
104
110
|
## License
|
|
105
111
|
|
|
106
|
-
`@wavezync/nestjs-pgboss` is [MIT licensed](LICENSE)
|
|
112
|
+
`@wavezync/nestjs-pgboss` is [MIT licensed](LICENSE)
|
|
@@ -4,4 +4,4 @@ export declare const JOB_OPTIONS = "JOB_OPTIONS";
|
|
|
4
4
|
export declare const CRON_EXPRESSION = "CRON_EXPRESSION";
|
|
5
5
|
export declare const CRON_OPTIONS = "CRON_OPTIONS";
|
|
6
6
|
export declare function Job<_TData extends object = any>(name: string, options?: JobOptions): (target: any, key: string, descriptor: PropertyDescriptor) => void;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function CronJob<_TData extends object = any>(name: string, cron: string, options?: JobOptions): (target: any, key: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CRON_OPTIONS = exports.CRON_EXPRESSION = exports.JOB_OPTIONS = exports.JOB_NAME = void 0;
|
|
4
4
|
exports.Job = Job;
|
|
5
|
-
exports.
|
|
5
|
+
exports.CronJob = CronJob;
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
exports.JOB_NAME = "JOB_NAME";
|
|
8
8
|
exports.JOB_OPTIONS = "JOB_OPTIONS";
|
|
@@ -14,7 +14,7 @@ function Job(name, options = {}) {
|
|
|
14
14
|
(0, common_1.SetMetadata)(exports.JOB_OPTIONS, options)(target, key, descriptor);
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function CronJob(name, cron, options = {}) {
|
|
18
18
|
return (target, key, descriptor) => {
|
|
19
19
|
(0, common_1.SetMetadata)(exports.JOB_NAME, name)(target, key, descriptor);
|
|
20
20
|
(0, common_1.SetMetadata)(exports.CRON_EXPRESSION, cron)(target, key, descriptor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.decorator.js","sourceRoot":"","sources":["../../lib/decorators/job.decorator.ts"],"names":[],"mappings":";;;AAQA,kBAQC;AAED,
|
|
1
|
+
{"version":3,"file":"job.decorator.js","sourceRoot":"","sources":["../../lib/decorators/job.decorator.ts"],"names":[],"mappings":";;;AAQA,kBAQC;AAED,0BAUC;AA5BD,2CAA6C;AAGhC,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,YAAY,GAAG,cAAc,CAAC;AAE3C,SAAgB,GAAG,CACjB,IAAY,EACZ,UAAsB,EAAE;IAExB,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,IAAA,oBAAW,EAAC,gBAAQ,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QACrD,IAAA,oBAAW,EAAC,mBAAW,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,OAAO,CACrB,IAAY,EACZ,IAAY,EACZ,UAAsB,EAAE;IAExB,OAAO,CAAC,MAAW,EAAE,GAAW,EAAE,UAA8B,EAAE,EAAE;QAClE,IAAA,oBAAW,EAAC,gBAAQ,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QACrD,IAAA,oBAAW,EAAC,uBAAe,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC5D,IAAA,oBAAW,EAAC,oBAAY,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED