@tsed/pulse 7.79.4 → 7.80.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/lib/esm/PulseModule.js +1 -1
- package/lib/types-esm/PulseModule.d.ts +23 -0
- package/lib/types-esm/constants/constants.d.ts +1 -0
- package/lib/types-esm/decorators/define.d.ts +2 -0
- package/lib/types-esm/decorators/every.d.ts +2 -0
- package/lib/types-esm/decorators/pulse.d.ts +5 -0
- package/lib/types-esm/index.d.ts +11 -0
- package/lib/types-esm/interfaces/PulseStore.d.ts +16 -0
- package/lib/types-esm/interfaces/interfaces.d.ts +15 -0
- package/lib/types-esm/services/PulseFactory.d.ts +3 -0
- package/package.json +17 -13
- package/vitest.config.mts +23 -0
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
package/lib/esm/PulseModule.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DIContext, Logger, runInContext } from "@tsed/common";
|
|
|
3
3
|
import { Constant, Inject, InjectorService, Module } from "@tsed/di";
|
|
4
4
|
import { v4 as uuid } from "uuid";
|
|
5
5
|
import { PROVIDER_TYPE_PULSE } from "./constants/constants.js";
|
|
6
|
-
import { PulseService } from "./services/PulseFactory
|
|
6
|
+
import { PulseService } from "./services/PulseFactory";
|
|
7
7
|
let PulseModule = class PulseModule {
|
|
8
8
|
logger;
|
|
9
9
|
injector;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AfterListen, Logger, OnDestroy } from "@tsed/common";
|
|
2
|
+
import { InjectorService, Provider } from "@tsed/di";
|
|
3
|
+
import { Job, Processor, DefineOptions, JobAttributesData } from "@pulsecron/pulse";
|
|
4
|
+
import { PulseService } from "./services/PulseFactory";
|
|
5
|
+
export declare class PulseModule implements OnDestroy, AfterListen {
|
|
6
|
+
protected logger: Logger;
|
|
7
|
+
protected injector: InjectorService;
|
|
8
|
+
protected pulse: PulseService;
|
|
9
|
+
private enabled;
|
|
10
|
+
private drainJobsBeforeClose;
|
|
11
|
+
private disableJobProcessing;
|
|
12
|
+
$afterListen(): Promise<any>;
|
|
13
|
+
$onDestroy(): Promise<any>;
|
|
14
|
+
define<T extends JobAttributesData>(name: string, processor: Processor<T>, options?: DefineOptions): void;
|
|
15
|
+
every(interval: string, name: string, data?: any, options?: any): Promise<Job<JobAttributesData> | Job<JobAttributesData>[]>;
|
|
16
|
+
schedule(when: Date | string, name: string, data?: any): Promise<Job<{}>[]> | Promise<Job<any>>;
|
|
17
|
+
now(name: string, data?: any): Promise<Job<JobAttributesData>>;
|
|
18
|
+
create(name: string, data?: any): Job<any>;
|
|
19
|
+
protected getProviders(): Provider<any>[];
|
|
20
|
+
protected addPulseDefinitionsForProvider(provider: Provider): void;
|
|
21
|
+
protected scheduleJobsForProvider(provider: Provider<any>): Promise<void>;
|
|
22
|
+
protected getNameForJob(propertyKey: string, namespace?: string, customName?: string): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PROVIDER_TYPE_PULSE = "PROVIDER_TYPE_PULSE";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./constants/constants.js";
|
|
5
|
+
export * from "./decorators/define.js";
|
|
6
|
+
export * from "./decorators/every.js";
|
|
7
|
+
export * from "./decorators/pulse.js";
|
|
8
|
+
export * from "./interfaces/interfaces.js";
|
|
9
|
+
export * from "./interfaces/PulseStore.js";
|
|
10
|
+
export * from "./PulseModule.js";
|
|
11
|
+
export * from "./services/PulseFactory.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DefineOptions as PulseDefineOptions, JobOptions } from "@pulsecron/pulse";
|
|
2
|
+
export interface DefineOptions extends PulseDefineOptions {
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
export type EveryOptions = JobOptions & DefineOptions;
|
|
6
|
+
export interface PulseStore {
|
|
7
|
+
namespace?: string;
|
|
8
|
+
define?: {
|
|
9
|
+
[propertyKey: string]: DefineOptions;
|
|
10
|
+
};
|
|
11
|
+
every?: {
|
|
12
|
+
[propertyKey: string]: EveryOptions & {
|
|
13
|
+
interval: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PulseConfig } from "@pulsecron/pulse";
|
|
2
|
+
declare global {
|
|
3
|
+
namespace TsED {
|
|
4
|
+
interface Configuration {
|
|
5
|
+
pulse?: {
|
|
6
|
+
/**
|
|
7
|
+
* Enable Pulse jobs. Default false.
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
disableJobProcessing?: boolean;
|
|
11
|
+
drainJobsBeforeClose?: boolean;
|
|
12
|
+
} & PulseConfig;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/pulse",
|
|
3
|
-
"version": "7.79.4",
|
|
4
3
|
"description": "@pulsecron/pulse package for Ts.ED framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.0",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/cjs/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn barrels && yarn build:ts",
|
|
17
19
|
"barrels": "barrels",
|
|
18
|
-
"test": "
|
|
19
|
-
"build:ts": "tsc --build tsconfig.json
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
22
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"tslib": "2.6.1"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
28
|
"@pulsecron/pulse": "^1.6.1",
|
|
26
|
-
"@tsed/barrels": "7.
|
|
27
|
-
"@tsed/common": "7.
|
|
28
|
-
"@tsed/core": "7.
|
|
29
|
-
"@tsed/di": "7.
|
|
30
|
-
"@tsed/typescript": "7.
|
|
29
|
+
"@tsed/barrels": "7.80.0",
|
|
30
|
+
"@tsed/common": "7.80.0",
|
|
31
|
+
"@tsed/core": "7.80.0",
|
|
32
|
+
"@tsed/di": "7.80.0",
|
|
33
|
+
"@tsed/typescript": "7.80.0",
|
|
31
34
|
"eslint": "^8.57.0",
|
|
32
|
-
"
|
|
35
|
+
"typescript": "4.9.5",
|
|
36
|
+
"vitest": "2.0.4"
|
|
33
37
|
},
|
|
34
38
|
"peerDependencies": {
|
|
35
39
|
"@pulsecron/pulse": ">=1"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
globalSetup: [import.meta.resolve("@tsed/testcontainers-mongo/vitest/setup")],
|
|
12
|
+
coverage: {
|
|
13
|
+
...presets.test.coverage,
|
|
14
|
+
thresholds: {
|
|
15
|
+
statements: 0,
|
|
16
|
+
branches: 0,
|
|
17
|
+
functions: 0,
|
|
18
|
+
lines: 0
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED