@tsed/pulse 7.79.4 → 7.80.1

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.
@@ -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.js";
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,2 @@
1
+ import { DefineOptions } from "../interfaces/PulseStore";
2
+ export declare function Define(options?: DefineOptions): MethodDecorator;
@@ -0,0 +1,2 @@
1
+ import { EveryOptions } from "../interfaces/PulseStore";
2
+ export declare function Every(interval: string, options?: EveryOptions): MethodDecorator;
@@ -0,0 +1,5 @@
1
+ interface PulseOptions {
2
+ namespace?: string;
3
+ }
4
+ export declare function Pulse(options?: PulseOptions): ClassDecorator;
5
+ export {};
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ import { Pulse } from "@pulsecron/pulse";
2
+ export declare const PulseService: typeof Pulse;
3
+ export type PulseService = Pulse;
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.1",
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
- "types": "./lib/types/index.d.ts",
11
- "import": "./lib/esm/index.js",
12
- "require": "./lib/cjs/index.js",
13
- "default": "./lib/esm/index.js"
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": "jest --runInBand && jest-coverage-thresholds-bumper",
19
- "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.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.79.4",
27
- "@tsed/common": "7.79.4",
28
- "@tsed/core": "7.79.4",
29
- "@tsed/di": "7.79.4",
30
- "@tsed/typescript": "7.79.4",
29
+ "@tsed/barrels": "7.80.1",
30
+ "@tsed/common": "7.80.1",
31
+ "@tsed/core": "7.80.1",
32
+ "@tsed/di": "7.80.1",
33
+ "@tsed/typescript": "7.80.1",
31
34
  "eslint": "^8.57.0",
32
- "jest": "^29.7.0"
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
+ );
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }