@ruiapp/rapid-core 0.1.18 → 0.1.19

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.
@@ -1,6 +1,7 @@
1
1
  import { IRpdServer } from "../../core/server";
2
2
  import { RpdServerEventTypes } from "../../types";
3
- export interface EntityWatcher<TEventName extends keyof RpdServerEventTypes> {
3
+ export type EntityWatcherType = EntityWatcher<"entity.create"> | EntityWatcher<"entity.update"> | EntityWatcher<"entity.delete"> | EntityWatcher<"entity.addRelations"> | EntityWatcher<"entity.removeRelations"> | EntityWatcher<any>;
4
+ export interface EntityWatcher<TEventName extends keyof RpdServerEventTypes = any> {
4
5
  eventName: TEventName;
5
6
  modelSingularCode: string;
6
7
  handler: EntityWatchHandler<TEventName>;
@@ -11,5 +12,5 @@ export type EntityWatchHandlerContext<TEventName extends keyof RpdServerEventTyp
11
12
  payload: RpdServerEventTypes[TEventName][1];
12
13
  };
13
14
  export interface EntityWatchPluginInitOptions {
14
- watchers: EntityWatcher<keyof RpdServerEventTypes>[];
15
+ watchers: EntityWatcherType[];
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],
@@ -1,7 +1,6 @@
1
1
  import type { RpdEntityCreateEventPayload, RpdServerEventTypes } from "~/types";
2
-
3
2
  import { IRpdServer, RapidPlugin, RpdConfigurationItemOptions, RpdServerPluginConfigurableTargetOptions, RpdServerPluginExtendingAbilities } from "~/core/server";
4
- import { EntityWatchHandlerContext, EntityWatchPluginInitOptions, EntityWatcher } from "./EntityWatchPluginTypes";
3
+ import { EntityWatchHandlerContext, EntityWatchPluginInitOptions } from "./EntityWatchPluginTypes";
5
4
  import EventManager from "~/core/eventManager";
6
5
 
7
6
  class EntityWatchPlugin implements RapidPlugin {
@@ -1,7 +1,16 @@
1
1
  import { IRpdServer } from "~/core/server";
2
2
  import { RpdServerEventTypes } from "~/types";
3
3
 
4
- export interface EntityWatcher<TEventName extends keyof RpdServerEventTypes> {
4
+ export type EntityWatcherType =
5
+ | EntityWatcher<"entity.create">
6
+ | EntityWatcher<"entity.update">
7
+ | EntityWatcher<"entity.delete">
8
+ | EntityWatcher<"entity.addRelations">
9
+ | EntityWatcher<"entity.removeRelations">
10
+ | EntityWatcher<any>
11
+ ;
12
+
13
+ export interface EntityWatcher<TEventName extends keyof RpdServerEventTypes = any> {
5
14
  eventName: TEventName;
6
15
  modelSingularCode: string;
7
16
  handler: EntityWatchHandler<TEventName>;
@@ -15,5 +24,5 @@ export type EntityWatchHandlerContext<TEventName extends keyof RpdServerEventTyp
15
24
  }
16
25
 
17
26
  export interface EntityWatchPluginInitOptions {
18
- watchers: EntityWatcher<keyof RpdServerEventTypes>[];
27
+ watchers: EntityWatcherType[];
19
28
  }