@arch-cadre/core 0.0.40 → 0.0.42

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.
Files changed (110) hide show
  1. package/dist/core/auth/email-verification.d.mts +2 -2
  2. package/dist/core/auth/logic.d.mts +6 -6
  3. package/dist/core/auth/rbac.d.mts +2 -2
  4. package/dist/core/notifications/actions.d.mts +1 -1
  5. package/package.json +4 -5
  6. package/dist/core/auth/augment.d.ts +0 -18
  7. package/dist/core/auth/augment.d.ts.map +0 -1
  8. package/dist/core/auth/augment.js +0 -53
  9. package/dist/core/auth/email-verification.d.ts +0 -58
  10. package/dist/core/auth/email-verification.d.ts.map +0 -1
  11. package/dist/core/auth/email-verification.js +0 -115
  12. package/dist/core/auth/events.d.ts +0 -53
  13. package/dist/core/auth/events.d.ts.map +0 -1
  14. package/dist/core/auth/events.js +0 -2
  15. package/dist/core/auth/logic.d.ts +0 -106
  16. package/dist/core/auth/logic.d.ts.map +0 -1
  17. package/dist/core/auth/logic.js +0 -264
  18. package/dist/core/auth/password-reset.d.ts +0 -35
  19. package/dist/core/auth/password-reset.d.ts.map +0 -1
  20. package/dist/core/auth/password-reset.js +0 -132
  21. package/dist/core/auth/rbac.d.ts +0 -56
  22. package/dist/core/auth/rbac.d.ts.map +0 -1
  23. package/dist/core/auth/rbac.js +0 -151
  24. package/dist/core/auth/session.d.ts +0 -50
  25. package/dist/core/auth/session.d.ts.map +0 -1
  26. package/dist/core/auth/session.js +0 -167
  27. package/dist/core/auth/types.d.ts +0 -52
  28. package/dist/core/auth/types.d.ts.map +0 -1
  29. package/dist/core/auth/types.js +0 -2
  30. package/dist/core/auth/utils/encode.d.ts +0 -12
  31. package/dist/core/auth/utils/encode.d.ts.map +0 -1
  32. package/dist/core/auth/utils/encode.js +0 -24
  33. package/dist/core/auth/utils/encryption.d.ts +0 -25
  34. package/dist/core/auth/utils/encryption.d.ts.map +0 -1
  35. package/dist/core/auth/utils/encryption.js +0 -68
  36. package/dist/core/auth/validation.d.ts +0 -44
  37. package/dist/core/auth/validation.d.ts.map +0 -1
  38. package/dist/core/auth/validation.js +0 -44
  39. package/dist/core/bootstrap.d.ts +0 -2
  40. package/dist/core/bootstrap.d.ts.map +0 -1
  41. package/dist/core/bootstrap.js +0 -54
  42. package/dist/core/config.d.ts +0 -9
  43. package/dist/core/config.d.ts.map +0 -1
  44. package/dist/core/config.js +0 -6
  45. package/dist/core/config.server.d.ts +0 -12
  46. package/dist/core/config.server.d.ts.map +0 -1
  47. package/dist/core/config.server.js +0 -101
  48. package/dist/core/event-bus.d.ts +0 -14
  49. package/dist/core/event-bus.d.ts.map +0 -1
  50. package/dist/core/event-bus.js +0 -54
  51. package/dist/core/filesystem/index.d.ts +0 -4
  52. package/dist/core/filesystem/index.d.ts.map +0 -1
  53. package/dist/core/filesystem/index.js +0 -27
  54. package/dist/core/filesystem/providers/local.d.ts +0 -8
  55. package/dist/core/filesystem/providers/local.d.ts.map +0 -1
  56. package/dist/core/filesystem/providers/local.js +0 -49
  57. package/dist/core/filesystem/service.d.ts +0 -16
  58. package/dist/core/filesystem/service.d.ts.map +0 -1
  59. package/dist/core/filesystem/service.js +0 -54
  60. package/dist/core/filesystem/types.d.ts +0 -19
  61. package/dist/core/filesystem/types.d.ts.map +0 -1
  62. package/dist/core/filesystem/types.js +0 -2
  63. package/dist/core/notifications/actions.d.ts +0 -54
  64. package/dist/core/notifications/actions.d.ts.map +0 -1
  65. package/dist/core/notifications/actions.js +0 -49
  66. package/dist/core/notifications/index.d.ts +0 -4
  67. package/dist/core/notifications/index.d.ts.map +0 -1
  68. package/dist/core/notifications/index.js +0 -19
  69. package/dist/core/notifications/service.d.ts +0 -7
  70. package/dist/core/notifications/service.d.ts.map +0 -1
  71. package/dist/core/notifications/service.js +0 -35
  72. package/dist/core/notifications/types.d.ts +0 -17
  73. package/dist/core/notifications/types.d.ts.map +0 -1
  74. package/dist/core/notifications/types.js +0 -2
  75. package/dist/core/setup.d.ts +0 -6
  76. package/dist/core/setup.d.ts.map +0 -1
  77. package/dist/core/setup.js +0 -28
  78. package/dist/core/types.d.ts +0 -10
  79. package/dist/core/types.d.ts.map +0 -1
  80. package/dist/core/types.js +0 -2
  81. package/dist/index.d.ts +0 -8
  82. package/dist/index.d.ts.map +0 -1
  83. package/dist/index.js +0 -32
  84. package/dist/server/auth/email.d.ts +0 -10
  85. package/dist/server/auth/email.d.ts.map +0 -1
  86. package/dist/server/auth/email.js +0 -24
  87. package/dist/server/auth/password.d.ts +0 -20
  88. package/dist/server/auth/password.d.ts.map +0 -1
  89. package/dist/server/auth/password.js +0 -38
  90. package/dist/server/auth/types.d.ts +0 -13
  91. package/dist/server/auth/types.d.ts.map +0 -1
  92. package/dist/server/auth/types.js +0 -17
  93. package/dist/server/auth/user.d.ts +0 -54
  94. package/dist/server/auth/user.d.ts.map +0 -1
  95. package/dist/server/auth/user.js +0 -237
  96. package/dist/server/database/inject.d.ts +0 -11
  97. package/dist/server/database/inject.d.ts.map +0 -1
  98. package/dist/server/database/inject.js +0 -33
  99. package/dist/server/database/schema.d.ts +0 -2953
  100. package/dist/server/database/schema.d.ts.map +0 -1
  101. package/dist/server/database/schema.js +0 -195
  102. package/dist/server/database/types.d.ts +0 -12
  103. package/dist/server/database/types.d.ts.map +0 -1
  104. package/dist/server/database/types.js +0 -2
  105. package/dist/server/emails/index.d.ts +0 -23
  106. package/dist/server/emails/index.d.ts.map +0 -1
  107. package/dist/server/emails/index.js +0 -73
  108. package/dist/server.d.ts +0 -25
  109. package/dist/server.d.ts.map +0 -1
  110. package/dist/server.js +0 -48
@@ -1,101 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getKryoConfig = getKryoConfig;
40
- exports.getModulesDir = getModulesDir;
41
- const node_fs_1 = __importDefault(require("node:fs"));
42
- const node_path_1 = __importDefault(require("node:path"));
43
- const config_1 = require("./config");
44
- let cachedConfig = null;
45
- /**
46
- * Loads the Kryo configuration from kryo.config.ts or kryo.config in the current working directory.
47
- * SERVER ONLY.
48
- */
49
- async function getKryoConfig() {
50
- // Prevent this from ever running on the client even if imported
51
- if (typeof window !== "undefined") {
52
- throw new Error("getKryoConfig can only be called on the server.");
53
- }
54
- // Use memory cache in production
55
- if (process.env.NODE_ENV === "production" && cachedConfig) {
56
- return cachedConfig;
57
- }
58
- const cwd = process.cwd();
59
- const configPathTS = node_path_1.default.join(cwd, "kryo.config.ts");
60
- const configPathJS = node_path_1.default.join(cwd, "kryo.config");
61
- const configPathMJS = node_path_1.default.join(cwd, "kryo.config.mjs");
62
- let loadedConfig = {};
63
- try {
64
- // Dynamic import jiti only on server to avoid bundling issues
65
- const { createJiti } = await Promise.resolve().then(() => __importStar(require("jiti")));
66
- const jiti = createJiti(cwd, {
67
- fsCache: false,
68
- moduleCache: false,
69
- });
70
- if (node_fs_1.default.existsSync(configPathTS)) {
71
- const cacheBuster = `?t=${Date.now()}`;
72
- const imported = await jiti.import(`file://${configPathTS}${cacheBuster}`, { default: true });
73
- loadedConfig = imported.default || imported;
74
- }
75
- else if (node_fs_1.default.existsSync(configPathMJS)) {
76
- const imported = await jiti.import(configPathMJS, { default: true });
77
- loadedConfig = imported.default || imported;
78
- }
79
- else if (node_fs_1.default.existsSync(configPathJS)) {
80
- const imported = await jiti.import(configPathJS, { default: true });
81
- loadedConfig = imported.default || imported;
82
- }
83
- }
84
- catch (error) {
85
- console.warn("[Kryo:Config] Could not load kryo.config.ts, using defaults.", error);
86
- }
87
- const finalConfig = { ...config_1.DEFAULT_CONFIG, ...loadedConfig };
88
- if (process.env.NODE_ENV === "production") {
89
- cachedConfig = finalConfig;
90
- }
91
- return finalConfig;
92
- }
93
- /**
94
- * Helper returning the absolute path to the modules directory.
95
- * SERVER ONLY.
96
- */
97
- async function getModulesDir() {
98
- const config = await getKryoConfig();
99
- const dir = config.modulesDirectory || "modules";
100
- return node_path_1.default.isAbsolute(dir) ? dir : node_path_1.default.join(process.cwd(), dir);
101
- }
@@ -1,14 +0,0 @@
1
- import type { EventHandler } from "./types";
2
- /**
3
- * EventBus (Pub/Sub) - Global Singleton Pattern.
4
- */
5
- declare class EventBus {
6
- private handlers;
7
- subscribe<T>(eventType: string, subscriberId: string, handler: EventHandler<T>): void;
8
- unsubscribe(eventType: string, subscriberId: string): void;
9
- clearAll(): void;
10
- publish<T>(eventType: string, payload: T, source?: string): Promise<void>;
11
- }
12
- export declare const eventBus: EventBus;
13
- export {};
14
- //# sourceMappingURL=event-bus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../src/core/event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAEzD;;GAEG;AACH,cAAM,QAAQ;IACZ,OAAO,CAAC,QAAQ,CAAqD;IAE9D,SAAS,CAAC,CAAC,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,IAAI;IAWA,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAO1D,QAAQ,IAAI,IAAI;IAKV,OAAO,CAAC,CAAC,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,EACV,MAAM,GAAE,MAAiB,GACxB,OAAO,CAAC,IAAI,CAAC;CA2BjB;AAOD,eAAO,MAAM,QAAQ,UAAyD,CAAC"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.eventBus = void 0;
5
- /**
6
- * EventBus (Pub/Sub) - Global Singleton Pattern.
7
- */
8
- class EventBus {
9
- constructor() {
10
- this.handlers = new Map();
11
- }
12
- subscribe(eventType, subscriberId, handler) {
13
- if (!this.handlers.has(eventType)) {
14
- this.handlers.set(eventType, new Map());
15
- }
16
- const eventHandlers = this.handlers.get(eventType);
17
- eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.set(subscriberId, handler);
18
- console.log(`[Event Bus] Subscriber "${subscriberId}" added for "${eventType}"`);
19
- }
20
- unsubscribe(eventType, subscriberId) {
21
- var _a;
22
- (_a = this.handlers.get(eventType)) === null || _a === void 0 ? void 0 : _a.delete(subscriberId);
23
- console.log(`[Event Bus] Subscriber "${subscriberId}" removed from "${eventType}"`);
24
- }
25
- clearAll() {
26
- console.log("[Event Bus] Resetting all listeners...");
27
- this.handlers.clear();
28
- }
29
- async publish(eventType, payload, source = "system") {
30
- const eventHandlers = this.handlers.get(eventType);
31
- if (!eventHandlers)
32
- return;
33
- const handlers = Array.from(eventHandlers.values());
34
- console.log(`[Event Bus] Publishing "${eventType}" to ${handlers.length} subscribers`);
35
- const event = {
36
- type: eventType,
37
- payload,
38
- timestamp: Date.now(),
39
- source,
40
- };
41
- await Promise.all(handlers.map(async (handler) => {
42
- try {
43
- await handler(event);
44
- }
45
- catch (error) {
46
- console.error(`[Event Bus] Handler Error for ${eventType}:`, error);
47
- }
48
- }));
49
- }
50
- }
51
- // Ensure global singleton
52
- const globalForEventBus = globalThis;
53
- exports.eventBus = (_a = globalForEventBus.__KRYO_EVENT_BUS__) !== null && _a !== void 0 ? _a : new EventBus();
54
- globalForEventBus.__KRYO_EVENT_BUS__ = exports.eventBus;
@@ -1,4 +0,0 @@
1
- import { filesystemService } from "./service";
2
- export * from "./types";
3
- export { filesystemService };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/filesystem/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.filesystemService = void 0;
18
- const local_1 = require("./providers/local");
19
- const service_1 = require("./service");
20
- Object.defineProperty(exports, "filesystemService", { enumerable: true, get: function () { return service_1.filesystemService; } });
21
- __exportStar(require("./types"), exports);
22
- // Auto-register local provider
23
- if (typeof window === "undefined") {
24
- const local = new local_1.LocalFileProvider();
25
- service_1.filesystemService.registerProvider(local);
26
- service_1.filesystemService.setDefaultProvider(local.id);
27
- }
@@ -1,8 +0,0 @@
1
- import type { IStorageProvider, StorageResult } from "../types";
2
- export declare class LocalFileProvider implements IStorageProvider {
3
- id: string;
4
- name: string;
5
- private generateUniqueImageName;
6
- upload(file: File): Promise<StorageResult>;
7
- }
8
- //# sourceMappingURL=local.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../../src/core/filesystem/providers/local.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhE,qBAAa,iBAAkB,YAAW,gBAAgB;IACjD,EAAE,SAAW;IACb,IAAI,SAAsB;IAEjC,OAAO,CAAC,uBAAuB;IAUlB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC;CA4BxD"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LocalFileProvider = void 0;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_path_1 = __importDefault(require("node:path"));
9
- class LocalFileProvider {
10
- constructor() {
11
- this.id = "local";
12
- this.name = "Local Filesystem";
13
- }
14
- generateUniqueImageName(name) {
15
- const cleanName = name.replace(/\s+/g, "-").toLowerCase();
16
- const suffix = Math.floor(Math.random() * Date.now()).toString(36);
17
- const index = cleanName.lastIndexOf(".");
18
- return index < 0
19
- ? `${cleanName}-${suffix}`
20
- : `${cleanName.slice(0, index)}-${suffix}${cleanName.slice(index)}`;
21
- }
22
- async upload(file) {
23
- var _a;
24
- try {
25
- const storageFolder = (_a = process.env.FILE_STORAGE_FOLDER) !== null && _a !== void 0 ? _a : "public/storage";
26
- if (!node_fs_1.default.existsSync(storageFolder)) {
27
- node_fs_1.default.mkdirSync(storageFolder, { recursive: true });
28
- }
29
- const name = this.generateUniqueImageName(file.name);
30
- const filePath = node_path_1.default.join(storageFolder, name);
31
- const buffer = await file.arrayBuffer();
32
- node_fs_1.default.writeFileSync(filePath, Buffer.from(buffer));
33
- const url = `${storageFolder}/${name}`.replace("public", "");
34
- return {
35
- name: name,
36
- url,
37
- type: file.type,
38
- size: file.size,
39
- service: "local",
40
- serviceId: filePath,
41
- };
42
- }
43
- catch (error) {
44
- console.error("Error uploading file", error);
45
- return { error: "Error uploading file" };
46
- }
47
- }
48
- }
49
- exports.LocalFileProvider = LocalFileProvider;
@@ -1,16 +0,0 @@
1
- import type { IStorageProvider, StorageResult } from "./types";
2
- declare class FilesystemService {
3
- private providers;
4
- private defaultProviderId;
5
- registerProvider(provider: IStorageProvider): void;
6
- unregisterProvider(id: string): void;
7
- setDefaultProvider(id: string): void;
8
- upload(file: File, providerId?: string): Promise<StorageResult>;
9
- getProviders(): {
10
- id: string;
11
- name: string;
12
- }[];
13
- }
14
- export declare const filesystemService: FilesystemService;
15
- export {};
16
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/filesystem/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/D,cAAM,iBAAiB;IACrB,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,iBAAiB,CAAuB;IAEzC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB;IAQ3C,kBAAkB,CAAC,EAAE,EAAE,MAAM;IAU7B,kBAAkB,CAAC,EAAE,EAAE,MAAM;IAOvB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBrE,YAAY;;;;CAMpB;AAOD,eAAO,MAAM,iBAAiB,mBAC8C,CAAC"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.filesystemService = void 0;
5
- class FilesystemService {
6
- constructor() {
7
- this.providers = new Map();
8
- this.defaultProviderId = null;
9
- }
10
- registerProvider(provider) {
11
- this.providers.set(provider.id, provider);
12
- if (!this.defaultProviderId || this.defaultProviderId === "local") {
13
- this.defaultProviderId = provider.id;
14
- }
15
- console.log(`[Filesystem] Provider registered: ${provider.id}`);
16
- }
17
- unregisterProvider(id) {
18
- this.providers.delete(id);
19
- if (this.defaultProviderId === id) {
20
- this.defaultProviderId = this.providers.has("local")
21
- ? "local"
22
- : Array.from(this.providers.keys())[0] || null;
23
- }
24
- console.log(`[Filesystem] Provider unregistered: ${id}`);
25
- }
26
- setDefaultProvider(id) {
27
- if (this.providers.has(id)) {
28
- this.defaultProviderId = id;
29
- console.log(`[Filesystem] Default provider set to: ${id}`);
30
- }
31
- }
32
- async upload(file, providerId) {
33
- let id = providerId || this.defaultProviderId;
34
- // Fallback logic
35
- if (!id || !this.providers.has(id)) {
36
- id = "local";
37
- }
38
- const provider = this.providers.get(id);
39
- if (!provider) {
40
- return { error: "No storage provider available (local fallback failed)" };
41
- }
42
- return await provider.upload(file);
43
- }
44
- getProviders() {
45
- return Array.from(this.providers.values()).map((p) => ({
46
- id: p.id,
47
- name: p.name,
48
- }));
49
- }
50
- }
51
- // Global Singleton Pattern
52
- const globalForFilesystem = globalThis;
53
- exports.filesystemService = (_a = globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__) !== null && _a !== void 0 ? _a : new FilesystemService();
54
- globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ = exports.filesystemService;
@@ -1,19 +0,0 @@
1
- export interface StorageData {
2
- name: string;
3
- url: string;
4
- type: string;
5
- size: number;
6
- service: string;
7
- serviceId: string;
8
- }
9
- export interface StorageError {
10
- error: string;
11
- }
12
- export type StorageResult = StorageData | StorageError;
13
- export interface IStorageProvider {
14
- id: string;
15
- name: string;
16
- upload(file: File, options?: any): Promise<StorageResult>;
17
- delete?(serviceId: string): Promise<boolean>;
18
- }
19
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/filesystem/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1D,MAAM,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,54 +0,0 @@
1
- import type { CreateNotificationPayload } from "./types";
2
- export declare function getUserNotifications(): Promise<{
3
- id: string;
4
- title: string;
5
- content: string | null;
6
- target: string | null;
7
- type: string | null;
8
- isRead: boolean;
9
- resourceId: string | null;
10
- resourceType: string | null;
11
- userId: string;
12
- createdAt: Date;
13
- updatedAt: Date | null;
14
- }[] | null>;
15
- export declare function createNotification(data: CreateNotificationPayload): Promise<{
16
- id: string;
17
- createdAt: Date;
18
- updatedAt: Date | null;
19
- userId: string;
20
- title: string;
21
- content: string | null;
22
- target: string | null;
23
- type: string | null;
24
- isRead: boolean;
25
- resourceId: string | null;
26
- resourceType: string | null;
27
- }>;
28
- export declare function markNotificationAsRead(id: string): Promise<{
29
- id: string;
30
- title: string;
31
- content: string | null;
32
- target: string | null;
33
- type: string | null;
34
- isRead: boolean;
35
- resourceId: string | null;
36
- resourceType: string | null;
37
- userId: string;
38
- createdAt: Date;
39
- updatedAt: Date | null;
40
- }>;
41
- export declare function markAllNotificationsAsRead(): Promise<{
42
- id: string;
43
- title: string;
44
- content: string | null;
45
- target: string | null;
46
- type: string | null;
47
- isRead: boolean;
48
- resourceId: string | null;
49
- resourceType: string | null;
50
- userId: string;
51
- createdAt: Date;
52
- updatedAt: Date | null;
53
- }[] | null>;
54
- //# sourceMappingURL=actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/core/notifications/actions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,wBAAsB,oBAAoB;;;;;;;;;;;;YASzC;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB;;;;;;;;;;;;GAUvE;AAED,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;GAQtD;AAED,wBAAsB,0BAA0B;;;;;;;;;;;;YAS/C"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- "use server";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getUserNotifications = getUserNotifications;
5
- exports.createNotification = createNotification;
6
- exports.markNotificationAsRead = markNotificationAsRead;
7
- exports.markAllNotificationsAsRead = markAllNotificationsAsRead;
8
- const drizzle_orm_1 = require("drizzle-orm");
9
- const inject_1 = require("../../server/database/inject");
10
- const schema_1 = require("../../server/database/schema");
11
- const session_1 = require("../auth/session");
12
- async function getUserNotifications() {
13
- const { user } = await (0, session_1.getCurrentSession)();
14
- if (!user)
15
- return null;
16
- return await inject_1.db
17
- .select()
18
- .from(schema_1.notificationTable)
19
- .where((0, drizzle_orm_1.eq)(schema_1.notificationTable.userId, user.id))
20
- .orderBy((0, drizzle_orm_1.desc)(schema_1.notificationTable.createdAt));
21
- }
22
- async function createNotification(data) {
23
- const [notification] = await inject_1.db
24
- .insert(schema_1.notificationTable)
25
- .values({
26
- ...data,
27
- isRead: false,
28
- })
29
- .returning();
30
- return notification;
31
- }
32
- async function markNotificationAsRead(id) {
33
- const [updated] = await inject_1.db
34
- .update(schema_1.notificationTable)
35
- .set({ isRead: true })
36
- .where((0, drizzle_orm_1.eq)(schema_1.notificationTable.id, id))
37
- .returning();
38
- return updated;
39
- }
40
- async function markAllNotificationsAsRead() {
41
- const { user } = await (0, session_1.getCurrentSession)();
42
- if (!user)
43
- return null;
44
- return await inject_1.db
45
- .update(schema_1.notificationTable)
46
- .set({ isRead: true })
47
- .where((0, drizzle_orm_1.eq)(schema_1.notificationTable.userId, user.id))
48
- .returning();
49
- }
@@ -1,4 +0,0 @@
1
- export * from "./actions";
2
- export * from "./service";
3
- export * from "./types";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./actions"), exports);
18
- __exportStar(require("./service"), exports);
19
- __exportStar(require("./types"), exports);
@@ -1,7 +0,0 @@
1
- declare class NotificationService {
2
- private initialized;
3
- init(): void;
4
- }
5
- export declare const notificationService: NotificationService;
6
- export {};
7
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/notifications/service.ts"],"names":[],"mappings":"AAIA,cAAM,mBAAmB;IACvB,OAAO,CAAC,WAAW,CAAS;IAErB,IAAI;CAqCZ;AAOD,eAAO,MAAM,mBAAmB,qBAEL,CAAC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.notificationService = void 0;
5
- const event_bus_1 = require("../event-bus");
6
- const actions_1 = require("./actions");
7
- class NotificationService {
8
- constructor() {
9
- this.initialized = false;
10
- }
11
- init() {
12
- if (this.initialized) {
13
- // console.log("[Notification Service] Already initialized.");
14
- return;
15
- }
16
- console.log("[Notification Service] Subscribing to notification:send...");
17
- event_bus_1.eventBus.subscribe("notification:send", "notification-service", async (event) => {
18
- console.log("[Notification Service] Received notification:send event", event.payload);
19
- try {
20
- // const { createNotification } = await import("./actions");
21
- const result = await (0, actions_1.createNotification)(event.payload);
22
- console.log("[Notification Service] Notification created successfully:", result.id);
23
- }
24
- catch (error) {
25
- console.error("[Notification Service] Failed to process notification:send", error);
26
- }
27
- });
28
- this.initialized = true;
29
- console.log("[NotificationService] Initialized and listening for events.");
30
- }
31
- }
32
- // Global Singleton Pattern
33
- const globalForNotifications = globalThis;
34
- exports.notificationService = (_a = globalForNotifications.__KRYO_NOTIFICATION_SERVICE__) !== null && _a !== void 0 ? _a : new NotificationService();
35
- globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ = exports.notificationService;
@@ -1,17 +0,0 @@
1
- import type { InferSelectModel } from "drizzle-orm";
2
- import type { notificationTable } from "../../server/database/schema";
3
- export type Notification = InferSelectModel<typeof notificationTable>;
4
- export type CreateNotificationPayload = {
5
- title: string;
6
- content?: string;
7
- type?: string;
8
- target?: string;
9
- userId: string;
10
- resourceId?: string;
11
- resourceType?: string;
12
- };
13
- export type NotificationEvents = {
14
- "notification:send": CreateNotificationPayload;
15
- "notification:created": Notification;
16
- };
17
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/notifications/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEtE,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mBAAmB,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,EAAE,YAAY,CAAC;CACtC,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- /**
2
- * Checks if the system is installed.
3
- * A system is considered installed if at least one user exists in the database.
4
- */
5
- export declare function isSystemInstalled(): Promise<boolean>;
6
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/core/setup.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAiB1D"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSystemInstalled = isSystemInstalled;
4
- const drizzle_orm_1 = require("drizzle-orm");
5
- const inject_1 = require("../server/database/inject");
6
- const schema_1 = require("../server/database/schema");
7
- /**
8
- * Checks if the system is installed.
9
- * A system is considered installed if at least one user exists in the database.
10
- */
11
- async function isSystemInstalled() {
12
- var _a;
13
- try {
14
- // We check if the users table exists and has at least one record
15
- console.log("[Kernel:Setup] Checking if system is installed...");
16
- const result = await inject_1.db
17
- .select({ count: (0, drizzle_orm_1.sql) `count(*)` })
18
- .from(schema_1.userTable);
19
- const count = Number(((_a = result[0]) === null || _a === void 0 ? void 0 : _a.count) || 0);
20
- console.log(`[Kernel:Setup] User count: ${count}`);
21
- return count > 0;
22
- }
23
- catch (error) {
24
- console.log(`[Kernel:Setup] System not installed or error: ${error.message}`);
25
- // If table doesn't exist, it's definitely not installed
26
- return false;
27
- }
28
- }
@@ -1,10 +0,0 @@
1
- export type UserRole = "user" | "admin" | string;
2
- export type UserPermission = string;
3
- export interface SystemEvent<T = any> {
4
- type: string;
5
- payload: T;
6
- timestamp: number;
7
- source: string;
8
- }
9
- export type EventHandler<T = any> = (event: SystemEvent<T>) => Promise<void> | void;
10
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,GAAG,IAAI,CAClC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAClB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });