@tsed/agenda 8.0.0-alpha.4 → 8.0.0-alpha.6

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/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@tsed/agenda",
3
3
  "description": "Agenda package for Ts.ED framework",
4
- "type": "commonjs",
5
- "version": "8.0.0-alpha.4",
4
+ "type": "module",
5
+ "version": "8.0.0-alpha.6",
6
6
  "source": "./src/index.ts",
7
- "main": "./lib/cjs/index.js",
7
+ "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
9
9
  "typings": "./lib/types/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./lib/types/index.d.ts",
13
13
  "import": "./lib/esm/index.js",
14
- "require": "./lib/cjs/index.js",
15
14
  "default": "./lib/cjs/index.js"
16
15
  }
17
16
  },
@@ -26,11 +25,11 @@
26
25
  "tslib": "2.6.1"
27
26
  },
28
27
  "devDependencies": {
29
- "@tsed/barrels": "8.0.0-alpha.4",
30
- "@tsed/common": "8.0.0-alpha.4",
31
- "@tsed/core": "8.0.0-alpha.4",
32
- "@tsed/di": "8.0.0-alpha.4",
33
- "@tsed/typescript": "8.0.0-alpha.4",
28
+ "@tsed/barrels": "8.0.0-alpha.6",
29
+ "@tsed/common": "8.0.0-alpha.6",
30
+ "@tsed/core": "8.0.0-alpha.6",
31
+ "@tsed/di": "8.0.0-alpha.6",
32
+ "@tsed/typescript": "8.0.0-alpha.6",
34
33
  "agenda": "^5.0.0",
35
34
  "eslint": "^8.57.0",
36
35
  "typescript": "4.9.5",
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgendaModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@tsed/common");
6
- const di_1 = require("@tsed/di");
7
- const uuid_1 = require("uuid");
8
- const constants_js_1 = require("./constants/constants.js");
9
- const AgendaFactory_js_1 = require("./services/AgendaFactory.js");
10
- let AgendaModule = class AgendaModule {
11
- async $afterListen() {
12
- if (this.enabled) {
13
- const providers = this.getProviders();
14
- if (!this.disableJobProcessing) {
15
- this.logger.info({
16
- event: "AGENDA_ADD_DEFINITIONS",
17
- message: "Agenda add definitions"
18
- });
19
- providers.forEach((provider) => this.addAgendaDefinitionsForProvider(provider));
20
- await this.injector.emit("$beforeAgendaStart");
21
- }
22
- await this.agenda.start();
23
- if (!this.disableJobProcessing) {
24
- this.logger.info({
25
- event: "AGENDA_ADD_JOBS",
26
- message: "Agenda add scheduled jobs"
27
- });
28
- await Promise.all(providers.map((provider) => this.scheduleJobsForProvider(provider)));
29
- await this.injector.emit("$afterAgendaStart");
30
- }
31
- }
32
- }
33
- async $onDestroy() {
34
- if (this.enabled) {
35
- if (this.drainJobsBeforeClose && "drain" in this.agenda) {
36
- this.logger.info({
37
- event: "AGENDA_DRAIN",
38
- message: "Agenda is draining all jobs before close"
39
- });
40
- await this.agenda.drain();
41
- }
42
- else {
43
- this.logger.info({
44
- event: "AGENDA_STOP",
45
- message: "Agenda is stopping"
46
- });
47
- await this.agenda.stop();
48
- }
49
- await this.agenda.close({ force: true });
50
- this.logger.info({ event: "AGENDA_STOP", message: "Agenda stopped" });
51
- }
52
- }
53
- define(name, options, processor) {
54
- return this.agenda.define(name, options, (job) => {
55
- const $ctx = new common_1.DIContext({
56
- injector: this.injector,
57
- id: (0, uuid_1.v4)(),
58
- logger: this.injector.logger
59
- });
60
- $ctx.set("job", job);
61
- return (0, common_1.runInContext)($ctx, () => processor(job));
62
- });
63
- }
64
- every(interval, name, data, options) {
65
- return this.agenda.every(interval, name, data, options);
66
- }
67
- schedule(when, name, data) {
68
- return this.agenda.schedule(when, name, data);
69
- }
70
- now(name, data) {
71
- return this.agenda.now(name, data);
72
- }
73
- create(name, data) {
74
- return this.agenda.create(name, data);
75
- }
76
- getProviders() {
77
- return this.injector.getProviders(constants_js_1.PROVIDER_TYPE_AGENDA);
78
- }
79
- addAgendaDefinitionsForProvider(provider) {
80
- const store = provider.store.get("agenda", {});
81
- if (!store.define) {
82
- return;
83
- }
84
- Object.entries(store.define).forEach(([propertyKey, { name, ...options }]) => {
85
- const instance = this.injector.get(provider.token);
86
- const jobProcessor = instance[propertyKey].bind(instance);
87
- const jobName = this.getNameForJob(propertyKey, store.namespace, name);
88
- this.define(jobName, options, jobProcessor);
89
- });
90
- }
91
- async scheduleJobsForProvider(provider) {
92
- const store = provider.store.get("agenda", {});
93
- if (!store.every) {
94
- return;
95
- }
96
- const promises = Object.entries(store.every).map(([propertyKey, { interval, name, ...options }]) => {
97
- const jobName = this.getNameForJob(propertyKey, store.namespace, name);
98
- return this.every(interval, jobName, {}, options);
99
- });
100
- await Promise.all(promises);
101
- }
102
- getNameForJob(propertyKey, namespace, customName) {
103
- const name = customName || propertyKey;
104
- return namespace ? `${namespace}.${name}` : name;
105
- }
106
- };
107
- tslib_1.__decorate([
108
- (0, di_1.Inject)(),
109
- tslib_1.__metadata("design:type", common_1.Logger)
110
- ], AgendaModule.prototype, "logger", void 0);
111
- tslib_1.__decorate([
112
- (0, di_1.Inject)(),
113
- tslib_1.__metadata("design:type", di_1.InjectorService)
114
- ], AgendaModule.prototype, "injector", void 0);
115
- tslib_1.__decorate([
116
- (0, di_1.Inject)(),
117
- tslib_1.__metadata("design:type", AgendaFactory_js_1.AgendaService)
118
- ], AgendaModule.prototype, "agenda", void 0);
119
- tslib_1.__decorate([
120
- (0, di_1.Constant)("agenda.enabled", false),
121
- tslib_1.__metadata("design:type", Boolean)
122
- ], AgendaModule.prototype, "enabled", void 0);
123
- tslib_1.__decorate([
124
- (0, di_1.Constant)("agenda.drainJobsBeforeClose", false),
125
- tslib_1.__metadata("design:type", Boolean)
126
- ], AgendaModule.prototype, "drainJobsBeforeClose", void 0);
127
- tslib_1.__decorate([
128
- (0, di_1.Constant)("agenda.disableJobProcessing", false),
129
- tslib_1.__metadata("design:type", Boolean)
130
- ], AgendaModule.prototype, "disableJobProcessing", void 0);
131
- AgendaModule = tslib_1.__decorate([
132
- (0, di_1.Module)()
133
- ], AgendaModule);
134
- exports.AgendaModule = AgendaModule;
135
- //# sourceMappingURL=AgendaModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgendaModule.js","sourceRoot":"","sources":["../../src/AgendaModule.ts"],"names":[],"mappings":";;;;AAAA,yCAAqF;AACrF,iCAA6E;AAE7E,+BAAgC;AAChC,2DAA8D;AAE9D,kEAA0D;AAGnD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAmBvB,KAAK,CAAC,YAAY;QAChB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAEtC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBACf,KAAK,EAAE,wBAAwB;oBAC/B,OAAO,EAAE,wBAAwB;iBAClC,CAAC,CAAC;gBACH,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,+BAA+B,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAEhF,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;aAChD;YAED,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAE1B,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBACf,KAAK,EAAE,iBAAiB;oBACxB,OAAO,EAAE,2BAA2B;iBACrC,CAAC,CAAC;gBACH,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAEvF,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,mB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ACS,gCAAa;4CAAC;AAEhC;IAAC,IAAA,aAAQ,EAAC,gBAAgB,EAAE,KAAK,CAAC;;6CACT;AAEzB;IAAC,IAAA,aAAQ,EAAC,6BAA6B,EAAE,KAAK,CAAC;;0DACT;AAEtC;IAAC,IAAA,aAAQ,EAAC,6BAA6B,EAAE,KAAK,CAAC;;0DACT;AAjB3B,YAAY;IADxB,IAAA,WAAM,GAAE;GACI,YAAY,CA6IxB;AA7IY,oCAAY"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROVIDER_TYPE_AGENDA = void 0;
4
- exports.PROVIDER_TYPE_AGENDA = "PROVIDER_TYPE_AGENDA";
5
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,sBAAsB,CAAC"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Agenda = void 0;
4
- const core_1 = require("@tsed/core");
5
- const di_1 = require("@tsed/di");
6
- const constants_js_1 = require("../constants/constants.js");
7
- function Agenda(options) {
8
- return (0, core_1.useDecorators)(options?.namespace && (0, core_1.StoreMerge)("agenda", options), (0, di_1.Injectable)({
9
- type: constants_js_1.PROVIDER_TYPE_AGENDA
10
- }));
11
- }
12
- exports.Agenda = Agenda;
13
- //# sourceMappingURL=agenda.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agenda.js","sourceRoot":"","sources":["../../../src/decorators/agenda.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AACrD,iCAAoC;AACpC,4DAA+D;AAM/D,SAAgB,MAAM,CAAC,OAAuB;IAC5C,OAAO,IAAA,oBAAa,EAClB,OAAO,EAAE,SAAS,IAAI,IAAA,iBAAU,EAAC,QAAQ,EAAE,OAAO,CAAC,EACnD,IAAA,eAAU,EAAC;QACT,IAAI,EAAE,mCAAoB;KAC3B,CAAC,CACH,CAAC;AACJ,CAAC;AAPD,wBAOC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Define = void 0;
4
- const core_1 = require("@tsed/core");
5
- function Define(options = {}) {
6
- return (target, propertyKey) => {
7
- const store = {
8
- define: {
9
- [propertyKey]: options
10
- }
11
- };
12
- core_1.Store.from(target).merge("agenda", store);
13
- };
14
- }
15
- exports.Define = Define;
16
- //# sourceMappingURL=define.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/decorators/define.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAGjC,SAAgB,MAAM,CAAC,UAAyB,EAAE;IAChD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAgB;YACzB,MAAM,EAAE;gBACN,CAAC,WAAW,CAAC,EAAE,OAAO;aACvB;SACF,CAAC;QAEF,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAVD,wBAUC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Every = void 0;
4
- const core_1 = require("@tsed/core");
5
- const define_js_1 = require("./define.js");
6
- function Every(interval, options = {}) {
7
- return (0, core_1.useDecorators)((0, define_js_1.Define)(options), (target, propertyKey) => {
8
- const store = {
9
- every: {
10
- [propertyKey]: { ...options, interval }
11
- }
12
- };
13
- core_1.Store.from(target).merge("agenda", store);
14
- });
15
- }
16
- exports.Every = Every;
17
- //# sourceMappingURL=every.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"every.js","sourceRoot":"","sources":["../../../src/decorators/every.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAChD,2CAAmC;AAGnC,SAAgB,KAAK,CAAC,QAAgB,EAAE,UAAwB,EAAE;IAChE,OAAO,IAAA,oBAAa,EAAC,IAAA,kBAAM,EAAC,OAAO,CAAC,EAAE,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;QACzE,MAAM,KAAK,GAAgB;YACzB,KAAK,EAAE;gBACL,CAAC,WAAW,CAAC,EAAE,EAAC,GAAG,OAAO,EAAE,QAAQ,EAAC;aACtC;SACF,CAAC;QACF,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC;AATD,sBASC"}
package/lib/cjs/index.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @file Automatically generated by @tsed/barrels.
6
- */
7
- tslib_1.__exportStar(require("./AgendaModule.js"), exports);
8
- tslib_1.__exportStar(require("./constants/constants.js"), exports);
9
- tslib_1.__exportStar(require("./decorators/agenda.js"), exports);
10
- tslib_1.__exportStar(require("./decorators/define.js"), exports);
11
- tslib_1.__exportStar(require("./decorators/every.js"), exports);
12
- tslib_1.__exportStar(require("./interfaces/AgendaStore.js"), exports);
13
- tslib_1.__exportStar(require("./interfaces/interfaces.js"), exports);
14
- tslib_1.__exportStar(require("./services/AgendaFactory.js"), exports);
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,4DAAkC;AAClC,mEAAyC;AACzC,iEAAuC;AACvC,iEAAuC;AACvC,gEAAsC;AACtC,sEAA4C;AAC5C,qEAA2C;AAC3C,sEAA4C"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=AgendaStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgendaStore.js","sourceRoot":"","sources":["../../../src/interfaces/AgendaStore.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgendaService = void 0;
4
- const di_1 = require("@tsed/di");
5
- const agenda_1 = require("agenda");
6
- // create Alias to avoid confusing import between Agenda from "agenda" and Agenda decorator
7
- exports.AgendaService = agenda_1.Agenda;
8
- (0, di_1.registerProvider)({
9
- provide: agenda_1.Agenda,
10
- deps: [di_1.Configuration],
11
- useFactory(settings) {
12
- const opts = settings.get("agenda", { enabled: false });
13
- return opts.enabled ? new agenda_1.Agenda(opts) : {};
14
- }
15
- });
16
- //# sourceMappingURL=AgendaFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgendaFactory.js","sourceRoot":"","sources":["../../../src/services/AgendaFactory.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AACzD,mCAA4C;AAE5C,2FAA2F;AAC9E,QAAA,aAAa,GAAG,eAAM,CAAC;AAGpC,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,eAAM;IACf,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,UAAU,CAAC,QAAuB;QAChC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAoC,QAAQ,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,eAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,CAAC;CACF,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,23 +0,0 @@
1
- import { AfterListen, Logger, OnDestroy } from "@tsed/common";
2
- import { InjectorService, Provider } from "@tsed/di";
3
- import { Job } from "agenda";
4
- import { AgendaService } from "./services/AgendaFactory.js";
5
- export declare class AgendaModule implements OnDestroy, AfterListen {
6
- protected logger: Logger;
7
- protected injector: InjectorService;
8
- protected agenda: AgendaService;
9
- private enabled;
10
- private drainJobsBeforeClose;
11
- private disableJobProcessing;
12
- $afterListen(): Promise<any>;
13
- $onDestroy(): Promise<any>;
14
- define(name: string, options?: any, processor?: any): void;
15
- every(interval: string, name: string, data?: any, options?: any): Promise<any>;
16
- schedule(when: Date | string, name: string, data?: any): Promise<Job<import("agenda").JobAttributesData>>;
17
- now(name: string, data?: any): Promise<Job<import("agenda").JobAttributesData>>;
18
- create(name: string, data?: any): Job<import("agenda").JobAttributesData>;
19
- protected getProviders(): Provider<any>[];
20
- protected addAgendaDefinitionsForProvider(provider: Provider): void;
21
- protected scheduleJobsForProvider(provider: Provider<any>): Promise<void>;
22
- protected getNameForJob(propertyKey: string, namespace?: string, customName?: string): string;
23
- }
@@ -1 +0,0 @@
1
- export declare const PROVIDER_TYPE_AGENDA = "PROVIDER_TYPE_AGENDA";
@@ -1,5 +0,0 @@
1
- interface AgendaOptions {
2
- namespace?: string;
3
- }
4
- export declare function Agenda(options?: AgendaOptions): ClassDecorator;
5
- export {};
@@ -1,2 +0,0 @@
1
- import { DefineOptions } from "../interfaces/AgendaStore.js";
2
- export declare function Define(options?: DefineOptions): MethodDecorator;
@@ -1,2 +0,0 @@
1
- import { EveryOptions } from "../interfaces/AgendaStore.js";
2
- export declare function Every(interval: string, options?: EveryOptions): MethodDecorator;
@@ -1,11 +0,0 @@
1
- /**
2
- * @file Automatically generated by @tsed/barrels.
3
- */
4
- export * from "./AgendaModule.js";
5
- export * from "./constants/constants.js";
6
- export * from "./decorators/agenda.js";
7
- export * from "./decorators/define.js";
8
- export * from "./decorators/every.js";
9
- export * from "./interfaces/AgendaStore.js";
10
- export * from "./interfaces/interfaces.js";
11
- export * from "./services/AgendaFactory.js";
@@ -1,16 +0,0 @@
1
- import { DefineOptions as AgendaDefineOptions, JobOptions } from "agenda";
2
- export interface DefineOptions extends AgendaDefineOptions {
3
- name?: string;
4
- }
5
- export type EveryOptions = JobOptions & DefineOptions;
6
- export interface AgendaStore {
7
- namespace?: string;
8
- define?: {
9
- [propertyKey: string]: DefineOptions;
10
- };
11
- every?: {
12
- [propertyKey: string]: EveryOptions & {
13
- interval: string;
14
- };
15
- };
16
- }
@@ -1,15 +0,0 @@
1
- import { AgendaConfig } from "agenda";
2
- declare global {
3
- namespace TsED {
4
- interface Configuration {
5
- agenda?: {
6
- /**
7
- * Enable Agenda jobs. Default false.
8
- */
9
- enabled?: boolean;
10
- disableJobProcessing?: boolean;
11
- drainJobsBeforeClose?: boolean;
12
- } & AgendaConfig;
13
- }
14
- }
15
- }
@@ -1,3 +0,0 @@
1
- import { Agenda } from "agenda";
2
- export declare const AgendaService: typeof Agenda;
3
- export type AgendaService = Agenda;