@lobb-js/core 0.26.2 → 0.28.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lobb-js/core",
3
3
  "license": "UNLICENSED",
4
- "version": "0.26.2",
4
+ "version": "0.28.0",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -59,6 +59,8 @@ export class CollectionService {
59
59
  }
60
60
  }
61
61
 
62
+ await Lobb.instance.eventSystem.emit("core.service.preCreateOne", props);
63
+
62
64
  return Lobb.instance.collectionStore.createOne(props as unknown as P<"createOne">) as Promise<T["output"]>;
63
65
  }
64
66
 
@@ -73,6 +75,8 @@ export class CollectionService {
73
75
  }
74
76
  }
75
77
 
78
+ await Lobb.instance.eventSystem.emit("core.service.preUpdateOne", props);
79
+
76
80
  return Lobb.instance.collectionStore.updateOne(props as unknown as P<"updateOne">) as Promise<T["output"]>;
77
81
  }
78
82
 
@@ -87,6 +91,8 @@ export class CollectionService {
87
91
  }
88
92
  }
89
93
 
94
+ await Lobb.instance.eventSystem.emit("core.service.preDeleteOne", props);
95
+
90
96
  return Lobb.instance.collectionStore.deleteOne(props as unknown as P<"deleteOne">) as Promise<T["output"]>;
91
97
  }
92
98
 
@@ -129,6 +135,8 @@ export class CollectionService {
129
135
  }
130
136
  }
131
137
 
138
+ await Lobb.instance.eventSystem.emit("core.service.preDeleteMany", props);
139
+
132
140
  return Lobb.instance.collectionStore.deleteMany(props as unknown as P<"deleteMany">) as Promise<T["output"]>;
133
141
  }
134
142
 
@@ -123,6 +123,29 @@ export function getCoreEvents(): Event[] {
123
123
  inputSchema: z.object({}),
124
124
  outputSchema: z.object({}),
125
125
  });
126
+ // service pre-events
127
+ events.push({
128
+ name: "core.service.preCreateOne",
129
+ inputSchema: z.object({}),
130
+ outputSchema: z.object({}),
131
+ });
132
+ events.push({
133
+ name: "core.service.preUpdateOne",
134
+ inputSchema: z.object({}),
135
+ outputSchema: z.object({}),
136
+ });
137
+ events.push({
138
+ name: "core.service.preDeleteOne",
139
+ inputSchema: z.object({}),
140
+ outputSchema: z.object({}),
141
+ });
142
+ events.push({
143
+ name: "core.service.preDeleteMany",
144
+ inputSchema: z.object({}),
145
+ outputSchema: z.object({}),
146
+ });
147
+
148
+ // service override events
126
149
  events.push({
127
150
  name: "core.service.findAll.override",
128
151
  inputSchema: z.object({}),
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export type { Config, WebConfig } from "./types/config/config.ts";
20
20
  export type { RelationsConfig } from "./types/config/relations.ts";
21
21
  export type {
22
22
  CollectionConfig,
23
+ NormalCollectionConfig,
23
24
  CollectionIndex,
24
25
  CollectionIndexes,
25
26
  CollectionsConfig,