@liorandb/core 1.0.12 → 1.0.14

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,43 +0,0 @@
1
- import { LioranManager } from "../LioranManager.js";
2
-
3
- const manager = new LioranManager({ ipc: false });
4
-
5
- process.on("message", async (msg: any) => {
6
- const { id, action, args } = msg;
7
-
8
- try {
9
- let result;
10
-
11
- switch (action) {
12
- case "shutdown":
13
- await manager.closeAll();
14
- result = true;
15
- break;
16
-
17
- case "db":
18
- await manager.db(args.db);
19
- result = true;
20
- break;
21
-
22
- case "op": {
23
- const { db, col, method, params } = args;
24
- const collection = (await manager.db(db)).collection(col);
25
- result = await (collection as any)[method](...params);
26
- break;
27
- }
28
-
29
- case "tx": {
30
- const db = await manager.db(args.db);
31
- result = await db.transaction(args.fn);
32
- break;
33
- }
34
-
35
- default:
36
- throw new Error("Unknown IPC action");
37
- }
38
-
39
- process.send?.({ id, ok: true, result });
40
- } catch (err: any) {
41
- process.send?.({ id, ok: false, error: err.message });
42
- }
43
- });