@arch-cadre/core 0.0.56 → 0.0.58

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 (297) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +1 -0
  3. package/dist/core/auth/augment.cjs +1 -0
  4. package/dist/core/auth/augment.d.cts +20 -0
  5. package/dist/core/auth/augment.d.cts.map +1 -0
  6. package/dist/core/auth/augment.d.mts +20 -0
  7. package/dist/core/auth/augment.d.mts.map +1 -0
  8. package/dist/core/auth/augment.mjs +2 -0
  9. package/dist/core/auth/augment.mjs.map +1 -0
  10. package/dist/core/auth/email-verification.cjs +1 -0
  11. package/dist/core/auth/email-verification.d.cts +62 -0
  12. package/dist/core/auth/email-verification.d.cts.map +1 -0
  13. package/dist/core/auth/email-verification.d.mts +62 -0
  14. package/dist/core/auth/email-verification.d.mts.map +1 -0
  15. package/dist/core/auth/email-verification.mjs +2 -0
  16. package/dist/core/auth/email-verification.mjs.map +1 -0
  17. package/dist/core/auth/logic.cjs +1 -0
  18. package/dist/core/auth/logic.d.cts +110 -0
  19. package/dist/core/auth/logic.d.cts.map +1 -0
  20. package/dist/core/auth/logic.d.mts +110 -0
  21. package/dist/core/auth/logic.d.mts.map +1 -0
  22. package/dist/core/auth/logic.mjs +2 -0
  23. package/dist/core/auth/logic.mjs.map +1 -0
  24. package/dist/core/auth/password-reset.cjs +1 -0
  25. package/dist/core/auth/password-reset.d.cts +39 -0
  26. package/dist/core/auth/password-reset.d.cts.map +1 -0
  27. package/dist/core/auth/password-reset.d.mts +39 -0
  28. package/dist/core/auth/password-reset.d.mts.map +1 -0
  29. package/dist/core/auth/password-reset.mjs +2 -0
  30. package/dist/core/auth/password-reset.mjs.map +1 -0
  31. package/dist/core/auth/rbac.cjs +1 -0
  32. package/dist/core/auth/rbac.d.cts +61 -0
  33. package/dist/core/auth/rbac.d.cts.map +1 -0
  34. package/dist/core/auth/rbac.d.mts +61 -0
  35. package/dist/core/auth/rbac.d.mts.map +1 -0
  36. package/dist/core/auth/rbac.mjs +2 -0
  37. package/dist/core/auth/rbac.mjs.map +1 -0
  38. package/dist/core/auth/session.cjs +1 -0
  39. package/dist/core/auth/session.d.cts +54 -0
  40. package/dist/core/auth/session.d.cts.map +1 -0
  41. package/dist/core/auth/session.d.mts +54 -0
  42. package/dist/core/auth/session.d.mts.map +1 -0
  43. package/dist/core/auth/session.mjs +2 -0
  44. package/dist/core/auth/session.mjs.map +1 -0
  45. package/dist/core/auth/types.d.cts +55 -0
  46. package/dist/core/auth/types.d.cts.map +1 -0
  47. package/dist/core/auth/types.d.mts +55 -0
  48. package/dist/core/auth/types.d.mts.map +1 -0
  49. package/dist/core/auth/utils/encode.cjs +1 -0
  50. package/dist/core/auth/utils/encode.d.cts +15 -0
  51. package/dist/core/auth/utils/encode.d.cts.map +1 -0
  52. package/dist/core/auth/utils/encode.d.mts +15 -0
  53. package/dist/core/auth/utils/encode.d.mts.map +1 -0
  54. package/dist/core/auth/utils/encode.mjs +2 -0
  55. package/dist/core/auth/utils/encode.mjs.map +1 -0
  56. package/dist/core/auth/utils/encryption.cjs +1 -0
  57. package/dist/core/auth/utils/{encryption.d.ts → encryption.d.cts} +8 -5
  58. package/dist/core/auth/utils/encryption.d.cts.map +1 -0
  59. package/dist/core/auth/utils/encryption.d.mts +28 -0
  60. package/dist/core/auth/utils/encryption.d.mts.map +1 -0
  61. package/dist/core/auth/utils/encryption.mjs +2 -0
  62. package/dist/core/auth/utils/encryption.mjs.map +1 -0
  63. package/dist/core/auth/validation.cjs +1 -0
  64. package/dist/core/auth/validation.d.cts +48 -0
  65. package/dist/core/auth/validation.d.cts.map +1 -0
  66. package/dist/core/auth/validation.d.mts +48 -0
  67. package/dist/core/auth/validation.d.mts.map +1 -0
  68. package/dist/core/auth/validation.mjs +2 -0
  69. package/dist/core/auth/validation.mjs.map +1 -0
  70. package/dist/core/bootstrap.cjs +1 -0
  71. package/dist/core/bootstrap.d.cts +5 -0
  72. package/dist/core/bootstrap.d.cts.map +1 -0
  73. package/dist/core/bootstrap.d.mts +5 -0
  74. package/dist/core/bootstrap.d.mts.map +1 -0
  75. package/dist/core/bootstrap.mjs +2 -0
  76. package/dist/core/bootstrap.mjs.map +1 -0
  77. package/dist/core/config.cjs +1 -0
  78. package/dist/core/config.d.cts +11 -0
  79. package/dist/core/config.d.cts.map +1 -0
  80. package/dist/core/config.d.mts +11 -0
  81. package/dist/core/config.d.mts.map +1 -0
  82. package/dist/core/config.mjs +2 -0
  83. package/dist/core/config.mjs.map +1 -0
  84. package/dist/core/config.server.cjs +1 -0
  85. package/dist/core/config.server.d.cts +16 -0
  86. package/dist/core/config.server.d.cts.map +1 -0
  87. package/dist/core/config.server.d.mts +16 -0
  88. package/dist/core/config.server.d.mts.map +1 -0
  89. package/dist/core/config.server.mjs +2 -0
  90. package/dist/core/config.server.mjs.map +1 -0
  91. package/dist/core/event-bus.cjs +1 -0
  92. package/dist/core/event-bus.d.cts +17 -0
  93. package/dist/core/event-bus.d.cts.map +1 -0
  94. package/dist/core/event-bus.d.mts +17 -0
  95. package/dist/core/event-bus.d.mts.map +1 -0
  96. package/dist/core/event-bus.mjs +2 -0
  97. package/dist/core/event-bus.mjs.map +1 -0
  98. package/dist/core/filesystem/index.cjs +1 -0
  99. package/dist/core/filesystem/index.mjs +2 -0
  100. package/dist/core/filesystem/index.mjs.map +1 -0
  101. package/dist/core/filesystem/providers/local.cjs +1 -0
  102. package/dist/core/filesystem/providers/local.mjs +2 -0
  103. package/dist/core/filesystem/providers/local.mjs.map +1 -0
  104. package/dist/core/filesystem/service.cjs +1 -0
  105. package/dist/core/filesystem/service.d.cts +19 -0
  106. package/dist/core/filesystem/service.d.cts.map +1 -0
  107. package/dist/core/filesystem/service.d.mts +19 -0
  108. package/dist/core/filesystem/service.d.mts.map +1 -0
  109. package/dist/core/filesystem/service.mjs +2 -0
  110. package/dist/core/filesystem/service.mjs.map +1 -0
  111. package/dist/core/filesystem/types.d.cts +22 -0
  112. package/dist/core/filesystem/types.d.cts.map +1 -0
  113. package/dist/core/filesystem/types.d.mts +22 -0
  114. package/dist/core/filesystem/types.d.mts.map +1 -0
  115. package/dist/core/notifications/actions.cjs +1 -0
  116. package/dist/core/notifications/actions.d.cts +58 -0
  117. package/dist/core/notifications/actions.d.cts.map +1 -0
  118. package/dist/core/notifications/actions.d.mts +58 -0
  119. package/dist/core/notifications/actions.d.mts.map +1 -0
  120. package/dist/core/notifications/actions.mjs +2 -0
  121. package/dist/core/notifications/actions.mjs.map +1 -0
  122. package/dist/core/notifications/index.cjs +1 -0
  123. package/dist/core/notifications/index.mjs +1 -0
  124. package/dist/core/notifications/service.cjs +1 -0
  125. package/dist/core/notifications/service.d.cts +9 -0
  126. package/dist/core/notifications/service.d.cts.map +1 -0
  127. package/dist/core/notifications/service.d.mts +9 -0
  128. package/dist/core/notifications/service.d.mts.map +1 -0
  129. package/dist/core/notifications/service.mjs +2 -0
  130. package/dist/core/notifications/service.mjs.map +1 -0
  131. package/dist/core/notifications/types.d.cts +21 -0
  132. package/dist/core/notifications/types.d.cts.map +1 -0
  133. package/dist/core/notifications/types.d.mts +21 -0
  134. package/dist/core/notifications/types.d.mts.map +1 -0
  135. package/dist/core/setup.cjs +1 -0
  136. package/dist/core/setup.d.cts +9 -0
  137. package/dist/core/setup.d.cts.map +1 -0
  138. package/dist/core/setup.d.mts +9 -0
  139. package/dist/core/setup.d.mts.map +1 -0
  140. package/dist/core/setup.mjs +2 -0
  141. package/dist/core/setup.mjs.map +1 -0
  142. package/dist/core/types.d.cts +13 -0
  143. package/dist/core/types.d.cts.map +1 -0
  144. package/dist/core/types.d.mts +13 -0
  145. package/dist/core/types.d.mts.map +1 -0
  146. package/dist/index.cjs +1 -0
  147. package/dist/index.d.cts +8 -0
  148. package/dist/index.d.mts +8 -0
  149. package/dist/index.mjs +1 -0
  150. package/dist/server/auth/email.cjs +1 -0
  151. package/dist/server/auth/email.d.cts +13 -0
  152. package/dist/server/auth/email.d.cts.map +1 -0
  153. package/dist/server/auth/email.d.mts +13 -0
  154. package/dist/server/auth/email.d.mts.map +1 -0
  155. package/dist/server/auth/email.mjs +2 -0
  156. package/dist/server/auth/email.mjs.map +1 -0
  157. package/dist/server/auth/password.cjs +1 -0
  158. package/dist/server/auth/{password.d.ts → password.d.cts} +7 -4
  159. package/dist/server/auth/password.d.cts.map +1 -0
  160. package/dist/server/auth/{password.js → password.d.mts} +7 -14
  161. package/dist/server/auth/password.d.mts.map +1 -0
  162. package/dist/server/auth/password.mjs +2 -0
  163. package/dist/server/auth/password.mjs.map +1 -0
  164. package/dist/server/auth/user.cjs +1 -0
  165. package/dist/server/auth/user.d.cts +58 -0
  166. package/dist/server/auth/user.d.cts.map +1 -0
  167. package/dist/server/auth/user.d.mts +58 -0
  168. package/dist/server/auth/user.d.mts.map +1 -0
  169. package/dist/server/auth/user.mjs +2 -0
  170. package/dist/server/auth/user.mjs.map +1 -0
  171. package/dist/server/database/inject.cjs +1 -0
  172. package/dist/server/database/inject.d.cts +15 -0
  173. package/dist/server/database/inject.d.cts.map +1 -0
  174. package/dist/server/database/inject.d.mts +15 -0
  175. package/dist/server/database/inject.d.mts.map +1 -0
  176. package/dist/server/database/inject.mjs +2 -0
  177. package/dist/server/database/inject.mjs.map +1 -0
  178. package/dist/server/database/schema.cjs +1 -0
  179. package/dist/server/database/schema.d.cts +3065 -0
  180. package/dist/server/database/{schema.d.ts.map → schema.d.cts.map} +1 -1
  181. package/dist/server/database/schema.d.mts +3065 -0
  182. package/dist/server/database/schema.d.mts.map +1 -0
  183. package/dist/server/database/schema.mjs +2 -0
  184. package/dist/server/database/schema.mjs.map +1 -0
  185. package/dist/server/emails/index.cjs +1 -0
  186. package/dist/server/emails/index.d.cts +26 -0
  187. package/dist/server/emails/index.d.cts.map +1 -0
  188. package/dist/server/emails/index.d.mts +26 -0
  189. package/dist/server/emails/index.d.mts.map +1 -0
  190. package/dist/server/emails/index.mjs +2 -0
  191. package/dist/server/emails/index.mjs.map +1 -0
  192. package/dist/server.cjs +1 -0
  193. package/dist/server.d.cts +26 -0
  194. package/dist/server.d.mts +26 -0
  195. package/dist/server.mjs +1 -0
  196. package/package.json +15 -7
  197. package/dist/core/auth/augment.d.ts +0 -18
  198. package/dist/core/auth/augment.d.ts.map +0 -1
  199. package/dist/core/auth/augment.js +0 -45
  200. package/dist/core/auth/email-verification.d.ts +0 -58
  201. package/dist/core/auth/email-verification.d.ts.map +0 -1
  202. package/dist/core/auth/email-verification.js +0 -105
  203. package/dist/core/auth/events.d.ts +0 -53
  204. package/dist/core/auth/events.d.ts.map +0 -1
  205. package/dist/core/auth/events.js +0 -1
  206. package/dist/core/auth/logic.d.ts +0 -106
  207. package/dist/core/auth/logic.d.ts.map +0 -1
  208. package/dist/core/auth/logic.js +0 -245
  209. package/dist/core/auth/password-reset.d.ts +0 -35
  210. package/dist/core/auth/password-reset.d.ts.map +0 -1
  211. package/dist/core/auth/password-reset.js +0 -122
  212. package/dist/core/auth/rbac.d.ts +0 -56
  213. package/dist/core/auth/rbac.d.ts.map +0 -1
  214. package/dist/core/auth/rbac.js +0 -134
  215. package/dist/core/auth/session.d.ts +0 -50
  216. package/dist/core/auth/session.d.ts.map +0 -1
  217. package/dist/core/auth/session.js +0 -152
  218. package/dist/core/auth/types.d.ts +0 -52
  219. package/dist/core/auth/types.d.ts.map +0 -1
  220. package/dist/core/auth/types.js +0 -1
  221. package/dist/core/auth/utils/encode.d.ts +0 -12
  222. package/dist/core/auth/utils/encode.d.ts.map +0 -1
  223. package/dist/core/auth/utils/encode.js +0 -20
  224. package/dist/core/auth/utils/encryption.d.ts.map +0 -1
  225. package/dist/core/auth/utils/encryption.js +0 -62
  226. package/dist/core/auth/validation.d.ts +0 -44
  227. package/dist/core/auth/validation.d.ts.map +0 -1
  228. package/dist/core/auth/validation.js +0 -41
  229. package/dist/core/bootstrap.d.ts +0 -2
  230. package/dist/core/bootstrap.d.ts.map +0 -1
  231. package/dist/core/bootstrap.js +0 -51
  232. package/dist/core/config.d.ts +0 -9
  233. package/dist/core/config.d.ts.map +0 -1
  234. package/dist/core/config.js +0 -3
  235. package/dist/core/config.server.d.ts +0 -12
  236. package/dist/core/config.server.d.ts.map +0 -1
  237. package/dist/core/config.server.js +0 -61
  238. package/dist/core/event-bus.d.ts +0 -14
  239. package/dist/core/event-bus.d.ts.map +0 -1
  240. package/dist/core/event-bus.js +0 -51
  241. package/dist/core/filesystem/index.d.ts +0 -4
  242. package/dist/core/filesystem/index.d.ts.map +0 -1
  243. package/dist/core/filesystem/index.js +0 -10
  244. package/dist/core/filesystem/providers/local.d.ts +0 -8
  245. package/dist/core/filesystem/providers/local.d.ts.map +0 -1
  246. package/dist/core/filesystem/providers/local.js +0 -42
  247. package/dist/core/filesystem/service.d.ts +0 -16
  248. package/dist/core/filesystem/service.d.ts.map +0 -1
  249. package/dist/core/filesystem/service.js +0 -51
  250. package/dist/core/filesystem/types.d.ts +0 -19
  251. package/dist/core/filesystem/types.d.ts.map +0 -1
  252. package/dist/core/filesystem/types.js +0 -1
  253. package/dist/core/notifications/actions.d.ts +0 -54
  254. package/dist/core/notifications/actions.d.ts.map +0 -1
  255. package/dist/core/notifications/actions.js +0 -43
  256. package/dist/core/notifications/index.d.ts +0 -4
  257. package/dist/core/notifications/index.d.ts.map +0 -1
  258. package/dist/core/notifications/index.js +0 -3
  259. package/dist/core/notifications/service.d.ts +0 -7
  260. package/dist/core/notifications/service.d.ts.map +0 -1
  261. package/dist/core/notifications/service.js +0 -32
  262. package/dist/core/notifications/types.d.ts +0 -17
  263. package/dist/core/notifications/types.d.ts.map +0 -1
  264. package/dist/core/notifications/types.js +0 -1
  265. package/dist/core/setup.d.ts +0 -6
  266. package/dist/core/setup.d.ts.map +0 -1
  267. package/dist/core/setup.js +0 -25
  268. package/dist/core/types.d.ts +0 -10
  269. package/dist/core/types.d.ts.map +0 -1
  270. package/dist/core/types.js +0 -1
  271. package/dist/index.d.ts +0 -8
  272. package/dist/index.d.ts.map +0 -1
  273. package/dist/index.js +0 -16
  274. package/dist/server/auth/email.d.ts +0 -10
  275. package/dist/server/auth/email.d.ts.map +0 -1
  276. package/dist/server/auth/email.js +0 -20
  277. package/dist/server/auth/password.d.ts.map +0 -1
  278. package/dist/server/auth/types.d.ts +0 -13
  279. package/dist/server/auth/types.d.ts.map +0 -1
  280. package/dist/server/auth/types.js +0 -1
  281. package/dist/server/auth/user.d.ts +0 -54
  282. package/dist/server/auth/user.d.ts.map +0 -1
  283. package/dist/server/auth/user.js +0 -222
  284. package/dist/server/database/inject.d.ts +0 -11
  285. package/dist/server/database/inject.d.ts.map +0 -1
  286. package/dist/server/database/inject.js +0 -29
  287. package/dist/server/database/schema.d.ts +0 -3056
  288. package/dist/server/database/schema.js +0 -205
  289. package/dist/server/database/types.d.ts +0 -12
  290. package/dist/server/database/types.d.ts.map +0 -1
  291. package/dist/server/database/types.js +0 -1
  292. package/dist/server/emails/index.d.ts +0 -23
  293. package/dist/server/emails/index.d.ts.map +0 -1
  294. package/dist/server/emails/index.js +0 -67
  295. package/dist/server.d.ts +0 -25
  296. package/dist/server.d.ts.map +0 -1
  297. package/dist/server.js +0 -32
@@ -1,3 +0,0 @@
1
- export const DEFAULT_CONFIG = {
2
- modulesDirectory: "modules",
3
- };
@@ -1,12 +0,0 @@
1
- import { type KryoConfig } from "./config";
2
- /**
3
- * Loads the Kryo configuration from kryo.config.ts or kryo.config in the current working directory.
4
- * SERVER ONLY.
5
- */
6
- export declare function getKryoConfig(): Promise<KryoConfig>;
7
- /**
8
- * Helper returning the absolute path to the modules directory.
9
- * SERVER ONLY.
10
- */
11
- export declare function getModulesDir(): Promise<string>;
12
- //# sourceMappingURL=config.server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.server.d.ts","sourceRoot":"","sources":["../../src/core/config.server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3D;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAsDzD;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAKrD"}
@@ -1,61 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import { DEFAULT_CONFIG } from "./config";
4
- let cachedConfig = null;
5
- /**
6
- * Loads the Kryo configuration from kryo.config.ts or kryo.config in the current working directory.
7
- * SERVER ONLY.
8
- */
9
- export async function getKryoConfig() {
10
- // Prevent this from ever running on the client even if imported
11
- if (typeof window !== "undefined") {
12
- throw new Error("getKryoConfig can only be called on the server.");
13
- }
14
- // Use memory cache in production
15
- if (process.env.NODE_ENV === "production" && cachedConfig) {
16
- return cachedConfig;
17
- }
18
- const cwd = process.cwd();
19
- const configPathTS = path.join(cwd, "kryo.config.ts");
20
- const configPathJS = path.join(cwd, "kryo.config");
21
- const configPathMJS = path.join(cwd, "kryo.config.mjs");
22
- let loadedConfig = {};
23
- try {
24
- // Dynamic import jiti only on server to avoid bundling issues
25
- const { createJiti } = await import("jiti");
26
- const jiti = createJiti(cwd, {
27
- fsCache: false,
28
- moduleCache: false,
29
- });
30
- if (fs.existsSync(configPathTS)) {
31
- const cacheBuster = `?t=${Date.now()}`;
32
- const imported = await jiti.import(`file://${configPathTS}${cacheBuster}`, { default: true });
33
- loadedConfig = imported.default || imported;
34
- }
35
- else if (fs.existsSync(configPathMJS)) {
36
- const imported = await jiti.import(configPathMJS, { default: true });
37
- loadedConfig = imported.default || imported;
38
- }
39
- else if (fs.existsSync(configPathJS)) {
40
- const imported = await jiti.import(configPathJS, { default: true });
41
- loadedConfig = imported.default || imported;
42
- }
43
- }
44
- catch (error) {
45
- console.warn("[Kryo:Config] Could not load kryo.config.ts, using defaults.", error);
46
- }
47
- const finalConfig = { ...DEFAULT_CONFIG, ...loadedConfig };
48
- if (process.env.NODE_ENV === "production") {
49
- cachedConfig = finalConfig;
50
- }
51
- return finalConfig;
52
- }
53
- /**
54
- * Helper returning the absolute path to the modules directory.
55
- * SERVER ONLY.
56
- */
57
- export async function getModulesDir() {
58
- const config = await getKryoConfig();
59
- const dir = config.modulesDirectory || "modules";
60
- return path.isAbsolute(dir) ? dir : path.join(process.cwd(), dir);
61
- }
@@ -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,51 +0,0 @@
1
- var _a;
2
- /**
3
- * EventBus (Pub/Sub) - Global Singleton Pattern.
4
- */
5
- class EventBus {
6
- constructor() {
7
- this.handlers = new Map();
8
- }
9
- subscribe(eventType, subscriberId, handler) {
10
- if (!this.handlers.has(eventType)) {
11
- this.handlers.set(eventType, new Map());
12
- }
13
- const eventHandlers = this.handlers.get(eventType);
14
- eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.set(subscriberId, handler);
15
- console.log(`[Event Bus] Subscriber "${subscriberId}" added for "${eventType}"`);
16
- }
17
- unsubscribe(eventType, subscriberId) {
18
- var _a;
19
- (_a = this.handlers.get(eventType)) === null || _a === void 0 ? void 0 : _a.delete(subscriberId);
20
- console.log(`[Event Bus] Subscriber "${subscriberId}" removed from "${eventType}"`);
21
- }
22
- clearAll() {
23
- console.log("[Event Bus] Resetting all listeners...");
24
- this.handlers.clear();
25
- }
26
- async publish(eventType, payload, source = "system") {
27
- const eventHandlers = this.handlers.get(eventType);
28
- if (!eventHandlers)
29
- return;
30
- const handlers = Array.from(eventHandlers.values());
31
- console.log(`[Event Bus] Publishing "${eventType}" to ${handlers.length} subscribers`);
32
- const event = {
33
- type: eventType,
34
- payload,
35
- timestamp: Date.now(),
36
- source,
37
- };
38
- await Promise.all(handlers.map(async (handler) => {
39
- try {
40
- await handler(event);
41
- }
42
- catch (error) {
43
- console.error(`[Event Bus] Handler Error for ${eventType}:`, error);
44
- }
45
- }));
46
- }
47
- }
48
- // Ensure global singleton
49
- const globalForEventBus = globalThis;
50
- export const eventBus = (_a = globalForEventBus.__KRYO_EVENT_BUS__) !== null && _a !== void 0 ? _a : new EventBus();
51
- globalForEventBus.__KRYO_EVENT_BUS__ = 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,10 +0,0 @@
1
- import { LocalFileProvider } from "./providers/local";
2
- import { filesystemService } from "./service";
3
- export * from "./types";
4
- export { filesystemService };
5
- // Auto-register local provider
6
- if (typeof window === "undefined") {
7
- const local = new LocalFileProvider();
8
- filesystemService.registerProvider(local);
9
- filesystemService.setDefaultProvider(local.id);
10
- }
@@ -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,42 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- export class LocalFileProvider {
4
- constructor() {
5
- this.id = "local";
6
- this.name = "Local Filesystem";
7
- }
8
- generateUniqueImageName(name) {
9
- const cleanName = name.replace(/\s+/g, "-").toLowerCase();
10
- const suffix = Math.floor(Math.random() * Date.now()).toString(36);
11
- const index = cleanName.lastIndexOf(".");
12
- return index < 0
13
- ? `${cleanName}-${suffix}`
14
- : `${cleanName.slice(0, index)}-${suffix}${cleanName.slice(index)}`;
15
- }
16
- async upload(file) {
17
- var _a;
18
- try {
19
- const storageFolder = (_a = process.env.FILE_STORAGE_FOLDER) !== null && _a !== void 0 ? _a : "public/storage";
20
- if (!fs.existsSync(storageFolder)) {
21
- fs.mkdirSync(storageFolder, { recursive: true });
22
- }
23
- const name = this.generateUniqueImageName(file.name);
24
- const filePath = path.join(storageFolder, name);
25
- const buffer = await file.arrayBuffer();
26
- fs.writeFileSync(filePath, Buffer.from(buffer));
27
- const url = `${storageFolder}/${name}`.replace("public", "");
28
- return {
29
- name: name,
30
- url,
31
- type: file.type,
32
- size: file.size,
33
- service: "local",
34
- serviceId: filePath,
35
- };
36
- }
37
- catch (error) {
38
- console.error("Error uploading file", error);
39
- return { error: "Error uploading file" };
40
- }
41
- }
42
- }
@@ -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,51 +0,0 @@
1
- var _a;
2
- class FilesystemService {
3
- constructor() {
4
- this.providers = new Map();
5
- this.defaultProviderId = null;
6
- }
7
- registerProvider(provider) {
8
- this.providers.set(provider.id, provider);
9
- if (!this.defaultProviderId || this.defaultProviderId === "local") {
10
- this.defaultProviderId = provider.id;
11
- }
12
- console.log(`[Filesystem] Provider registered: ${provider.id}`);
13
- }
14
- unregisterProvider(id) {
15
- this.providers.delete(id);
16
- if (this.defaultProviderId === id) {
17
- this.defaultProviderId = this.providers.has("local")
18
- ? "local"
19
- : Array.from(this.providers.keys())[0] || null;
20
- }
21
- console.log(`[Filesystem] Provider unregistered: ${id}`);
22
- }
23
- setDefaultProvider(id) {
24
- if (this.providers.has(id)) {
25
- this.defaultProviderId = id;
26
- console.log(`[Filesystem] Default provider set to: ${id}`);
27
- }
28
- }
29
- async upload(file, providerId) {
30
- let id = providerId || this.defaultProviderId;
31
- // Fallback logic
32
- if (!id || !this.providers.has(id)) {
33
- id = "local";
34
- }
35
- const provider = this.providers.get(id);
36
- if (!provider) {
37
- return { error: "No storage provider available (local fallback failed)" };
38
- }
39
- return await provider.upload(file);
40
- }
41
- getProviders() {
42
- return Array.from(this.providers.values()).map((p) => ({
43
- id: p.id,
44
- name: p.name,
45
- }));
46
- }
47
- }
48
- // Global Singleton Pattern
49
- const globalForFilesystem = globalThis;
50
- export const filesystemService = (_a = globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__) !== null && _a !== void 0 ? _a : new FilesystemService();
51
- globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ = 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 +0,0 @@
1
- export {};
@@ -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,43 +0,0 @@
1
- "use server";
2
- import { desc, eq } from "drizzle-orm";
3
- import { db } from "../../server/database/inject";
4
- import { notificationTable } from "../../server/database/schema";
5
- import { getCurrentSession } from "../auth/session";
6
- export async function getUserNotifications() {
7
- const { user } = await getCurrentSession();
8
- if (!user)
9
- return null;
10
- return await db
11
- .select()
12
- .from(notificationTable)
13
- .where(eq(notificationTable.userId, user.id))
14
- .orderBy(desc(notificationTable.createdAt));
15
- }
16
- export async function createNotification(data) {
17
- const [notification] = await db
18
- .insert(notificationTable)
19
- .values({
20
- ...data,
21
- isRead: false,
22
- })
23
- .returning();
24
- return notification;
25
- }
26
- export async function markNotificationAsRead(id) {
27
- const [updated] = await db
28
- .update(notificationTable)
29
- .set({ isRead: true })
30
- .where(eq(notificationTable.id, id))
31
- .returning();
32
- return updated;
33
- }
34
- export async function markAllNotificationsAsRead() {
35
- const { user } = await getCurrentSession();
36
- if (!user)
37
- return null;
38
- return await db
39
- .update(notificationTable)
40
- .set({ isRead: true })
41
- .where(eq(notificationTable.userId, user.id))
42
- .returning();
43
- }
@@ -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,3 +0,0 @@
1
- export * from "./actions";
2
- export * from "./service";
3
- export * from "./types";
@@ -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,32 +0,0 @@
1
- var _a;
2
- import { eventBus } from "../event-bus";
3
- import { createNotification } from "./actions";
4
- class NotificationService {
5
- constructor() {
6
- this.initialized = false;
7
- }
8
- init() {
9
- if (this.initialized) {
10
- // console.log("[Notification Service] Already initialized.");
11
- return;
12
- }
13
- console.log("[Notification Service] Subscribing to notification:send...");
14
- eventBus.subscribe("notification:send", "notification-service", async (event) => {
15
- console.log("[Notification Service] Received notification:send event", event.payload);
16
- try {
17
- // const { createNotification } = await import("./actions");
18
- const result = await createNotification(event.payload);
19
- console.log("[Notification Service] Notification created successfully:", result.id);
20
- }
21
- catch (error) {
22
- console.error("[Notification Service] Failed to process notification:send", error);
23
- }
24
- });
25
- this.initialized = true;
26
- console.log("[NotificationService] Initialized and listening for events.");
27
- }
28
- }
29
- // Global Singleton Pattern
30
- const globalForNotifications = globalThis;
31
- export const notificationService = (_a = globalForNotifications.__KRYO_NOTIFICATION_SERVICE__) !== null && _a !== void 0 ? _a : new NotificationService();
32
- globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ = 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 +0,0 @@
1
- export {};
@@ -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,25 +0,0 @@
1
- import { sql } from "drizzle-orm";
2
- import { db } from "../server/database/inject";
3
- import { userTable } from "../server/database/schema";
4
- /**
5
- * Checks if the system is installed.
6
- * A system is considered installed if at least one user exists in the database.
7
- */
8
- export async function isSystemInstalled() {
9
- var _a;
10
- try {
11
- // We check if the users table exists and has at least one record
12
- console.log("[Kernel:Setup] Checking if system is installed...");
13
- const result = await db
14
- .select({ count: sql `count(*)` })
15
- .from(userTable);
16
- const count = Number(((_a = result[0]) === null || _a === void 0 ? void 0 : _a.count) || 0);
17
- console.log(`[Kernel:Setup] User count: ${count}`);
18
- return count > 0;
19
- }
20
- catch (error) {
21
- console.log(`[Kernel:Setup] System not installed or error: ${error.message}`);
22
- // If table doesn't exist, it's definitely not installed
23
- return false;
24
- }
25
- }
@@ -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 +0,0 @@
1
- export {};
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./core/auth/types";
2
- export * from "./core/auth/validation";
3
- export * from "./core/event-bus";
4
- export * from "./core/notifications/service";
5
- export * from "./core/notifications/types";
6
- export * from "./core/types";
7
- export * from "./server/database/schema";
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,kBAAkB,CAAC;AAMjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAE7B,cAAc,0BAA0B,CAAC"}
package/dist/index.js DELETED
@@ -1,16 +0,0 @@
1
- // export { ExtensionPoint } from "./client/extension-point";
2
- // export { ExtensionPointClient } from "./client/extension-point-client";
3
- // export { WidgetArea } from "./client/widget-area";
4
- // Common Types & Constants
5
- export * from "./core/auth/types";
6
- export * from "./core/auth/validation";
7
- // Shared Services (Singletons / Handlers)
8
- export * from "./core/event-bus";
9
- // Shared Constants & Models (Safe for Browser)
10
- // export * from "./core/modules/ui";
11
- // export * from "./core/modules/types";
12
- // Client Hooks & Providers
13
- export * from "./core/notifications/service";
14
- export * from "./core/notifications/types";
15
- export * from "./core/types";
16
- export * from "./server/database/schema";
@@ -1,10 +0,0 @@
1
- /**
2
- * Validates the email format and length.
3
- */
4
- export declare function verifyEmailInput(email: string): boolean;
5
- /**
6
- * Checks if an email address is already in use.
7
- * @returns True if the email is available, false otherwise.
8
- */
9
- export declare function checkEmailAvailability(email: string): Promise<boolean>;
10
- //# sourceMappingURL=email.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/server/auth/email.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5E"}
@@ -1,20 +0,0 @@
1
- import { count, eq } from "drizzle-orm";
2
- import { db } from "../database/inject";
3
- import { userTable } from "../database/schema";
4
- /**
5
- * Validates the email format and length.
6
- */
7
- export function verifyEmailInput(email) {
8
- return /^.+@.+\..+$/.test(email) && email.length < 256 && email.length > 0;
9
- }
10
- /**
11
- * Checks if an email address is already in use.
12
- * @returns True if the email is available, false otherwise.
13
- */
14
- export async function checkEmailAvailability(email) {
15
- const [entries] = await db
16
- .select({ count: count() })
17
- .from(userTable)
18
- .where(eq(userTable.email, email));
19
- return entries.count === 0;
20
- }