@arch-cadre/core 0.0.40 → 0.0.41

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 (111) hide show
  1. package/package.json +1 -1
  2. package/dist/_virtual/_rolldown/runtime.mjs +0 -1
  3. package/dist/core/auth/augment.d.mts +0 -20
  4. package/dist/core/auth/augment.d.mts.map +0 -1
  5. package/dist/core/auth/augment.mjs +0 -2
  6. package/dist/core/auth/augment.mjs.map +0 -1
  7. package/dist/core/auth/email-verification.d.mts +0 -62
  8. package/dist/core/auth/email-verification.d.mts.map +0 -1
  9. package/dist/core/auth/email-verification.mjs +0 -2
  10. package/dist/core/auth/email-verification.mjs.map +0 -1
  11. package/dist/core/auth/logic.d.mts +0 -110
  12. package/dist/core/auth/logic.d.mts.map +0 -1
  13. package/dist/core/auth/logic.mjs +0 -2
  14. package/dist/core/auth/logic.mjs.map +0 -1
  15. package/dist/core/auth/password-reset.d.mts +0 -39
  16. package/dist/core/auth/password-reset.d.mts.map +0 -1
  17. package/dist/core/auth/password-reset.mjs +0 -2
  18. package/dist/core/auth/password-reset.mjs.map +0 -1
  19. package/dist/core/auth/rbac.d.mts +0 -61
  20. package/dist/core/auth/rbac.d.mts.map +0 -1
  21. package/dist/core/auth/rbac.mjs +0 -2
  22. package/dist/core/auth/rbac.mjs.map +0 -1
  23. package/dist/core/auth/session.d.mts +0 -54
  24. package/dist/core/auth/session.d.mts.map +0 -1
  25. package/dist/core/auth/session.mjs +0 -2
  26. package/dist/core/auth/session.mjs.map +0 -1
  27. package/dist/core/auth/types.d.mts +0 -55
  28. package/dist/core/auth/types.d.mts.map +0 -1
  29. package/dist/core/auth/utils/encode.d.mts +0 -15
  30. package/dist/core/auth/utils/encode.d.mts.map +0 -1
  31. package/dist/core/auth/utils/encode.mjs +0 -2
  32. package/dist/core/auth/utils/encode.mjs.map +0 -1
  33. package/dist/core/auth/utils/encryption.d.mts +0 -28
  34. package/dist/core/auth/utils/encryption.d.mts.map +0 -1
  35. package/dist/core/auth/utils/encryption.mjs +0 -2
  36. package/dist/core/auth/utils/encryption.mjs.map +0 -1
  37. package/dist/core/auth/validation.d.mts +0 -48
  38. package/dist/core/auth/validation.d.mts.map +0 -1
  39. package/dist/core/auth/validation.mjs +0 -2
  40. package/dist/core/auth/validation.mjs.map +0 -1
  41. package/dist/core/bootstrap.d.mts +0 -5
  42. package/dist/core/bootstrap.d.mts.map +0 -1
  43. package/dist/core/bootstrap.mjs +0 -2
  44. package/dist/core/bootstrap.mjs.map +0 -1
  45. package/dist/core/config.d.mts +0 -11
  46. package/dist/core/config.d.mts.map +0 -1
  47. package/dist/core/config.mjs +0 -2
  48. package/dist/core/config.mjs.map +0 -1
  49. package/dist/core/config.server.d.mts +0 -16
  50. package/dist/core/config.server.d.mts.map +0 -1
  51. package/dist/core/config.server.mjs +0 -2
  52. package/dist/core/config.server.mjs.map +0 -1
  53. package/dist/core/event-bus.d.mts +0 -17
  54. package/dist/core/event-bus.d.mts.map +0 -1
  55. package/dist/core/event-bus.mjs +0 -2
  56. package/dist/core/event-bus.mjs.map +0 -1
  57. package/dist/core/filesystem/index.mjs +0 -2
  58. package/dist/core/filesystem/index.mjs.map +0 -1
  59. package/dist/core/filesystem/providers/local.mjs +0 -2
  60. package/dist/core/filesystem/providers/local.mjs.map +0 -1
  61. package/dist/core/filesystem/service.d.mts +0 -19
  62. package/dist/core/filesystem/service.d.mts.map +0 -1
  63. package/dist/core/filesystem/service.mjs +0 -2
  64. package/dist/core/filesystem/service.mjs.map +0 -1
  65. package/dist/core/filesystem/types.d.mts +0 -22
  66. package/dist/core/filesystem/types.d.mts.map +0 -1
  67. package/dist/core/notifications/actions.d.mts +0 -58
  68. package/dist/core/notifications/actions.d.mts.map +0 -1
  69. package/dist/core/notifications/actions.mjs +0 -2
  70. package/dist/core/notifications/actions.mjs.map +0 -1
  71. package/dist/core/notifications/index.mjs +0 -1
  72. package/dist/core/notifications/service.d.mts +0 -9
  73. package/dist/core/notifications/service.d.mts.map +0 -1
  74. package/dist/core/notifications/service.mjs +0 -2
  75. package/dist/core/notifications/service.mjs.map +0 -1
  76. package/dist/core/notifications/types.d.mts +0 -21
  77. package/dist/core/notifications/types.d.mts.map +0 -1
  78. package/dist/core/setup.d.mts +0 -9
  79. package/dist/core/setup.d.mts.map +0 -1
  80. package/dist/core/setup.mjs +0 -2
  81. package/dist/core/setup.mjs.map +0 -1
  82. package/dist/core/types.d.mts +0 -13
  83. package/dist/core/types.d.mts.map +0 -1
  84. package/dist/index.d.mts +0 -8
  85. package/dist/index.mjs +0 -1
  86. package/dist/server/auth/email.d.mts +0 -13
  87. package/dist/server/auth/email.d.mts.map +0 -1
  88. package/dist/server/auth/email.mjs +0 -2
  89. package/dist/server/auth/email.mjs.map +0 -1
  90. package/dist/server/auth/password.d.mts +0 -23
  91. package/dist/server/auth/password.d.mts.map +0 -1
  92. package/dist/server/auth/password.mjs +0 -2
  93. package/dist/server/auth/password.mjs.map +0 -1
  94. package/dist/server/auth/user.d.mts +0 -58
  95. package/dist/server/auth/user.d.mts.map +0 -1
  96. package/dist/server/auth/user.mjs +0 -2
  97. package/dist/server/auth/user.mjs.map +0 -1
  98. package/dist/server/database/inject.d.mts +0 -15
  99. package/dist/server/database/inject.d.mts.map +0 -1
  100. package/dist/server/database/inject.mjs +0 -2
  101. package/dist/server/database/inject.mjs.map +0 -1
  102. package/dist/server/database/schema.d.mts +0 -2962
  103. package/dist/server/database/schema.d.mts.map +0 -1
  104. package/dist/server/database/schema.mjs +0 -2
  105. package/dist/server/database/schema.mjs.map +0 -1
  106. package/dist/server/emails/index.d.mts +0 -26
  107. package/dist/server/emails/index.d.mts.map +0 -1
  108. package/dist/server/emails/index.mjs +0 -2
  109. package/dist/server/emails/index.mjs.map +0 -1
  110. package/dist/server.d.mts +0 -26
  111. package/dist/server.mjs +0 -1
@@ -1,15 +0,0 @@
1
- //#region src/core/auth/utils/encode.d.ts
2
- /**
3
- * Generates a random one-time code (OTP).
4
- * @param length Length of the generated code (default 6).
5
- * @returns A random uppercase base32 string.
6
- */
7
- declare function generateRandomOTP(length?: number): string;
8
- /**
9
- * Generates a random recovery code.
10
- * @returns A random uppercase base32 string.
11
- */
12
- declare function generateRandomRecoveryCode(): string;
13
- //#endregion
14
- export { generateRandomOTP, generateRandomRecoveryCode };
15
- //# sourceMappingURL=encode.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode.d.mts","names":[],"sources":["../../../../src/core/auth/utils/encode.ts"],"mappings":";;AAOA;;;;iBAAgB,iBAAA,CAAkB,MAAA;AAUlC;;;;AAAA,iBAAgB,0BAAA,CAAA"}
@@ -1,2 +0,0 @@
1
- import{encodeBase32UpperCaseNoPadding as e}from"@oslojs/encoding";function t(t=6){let n=new Uint8Array(5);return crypto.getRandomValues(n),e(n).substring(0,t)}function n(){let t=new Uint8Array(10);return crypto.getRandomValues(t),e(t)}export{t as generateRandomOTP,n as generateRandomRecoveryCode};
2
- //# sourceMappingURL=encode.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode.mjs","names":[],"sources":["../../../../src/core/auth/utils/encode.ts"],"sourcesContent":["import { encodeBase32UpperCaseNoPadding } from \"@oslojs/encoding\";\n\n/**\n * Generates a random one-time code (OTP).\n * @param length Length of the generated code (default 6).\n * @returns A random uppercase base32 string.\n */\nexport function generateRandomOTP(length = 6): string {\n const bytes = new Uint8Array(5);\n crypto.getRandomValues(bytes);\n return encodeBase32UpperCaseNoPadding(bytes).substring(0, length);\n}\n\n/**\n * Generates a random recovery code.\n * @returns A random uppercase base32 string.\n */\nexport function generateRandomRecoveryCode(): string {\n const recoveryCodeBytes = new Uint8Array(10);\n crypto.getRandomValues(recoveryCodeBytes);\n return encodeBase32UpperCaseNoPadding(recoveryCodeBytes);\n}\n"],"mappings":"kEAOA,SAAgB,EAAkB,EAAS,EAAW,CACpD,IAAM,EAAQ,IAAI,WAAW,EAAE,CAE/B,OADA,OAAO,gBAAgB,EAAM,CACtB,EAA+B,EAAM,CAAC,UAAU,EAAG,EAAO,CAOnE,SAAgB,GAAqC,CACnD,IAAM,EAAoB,IAAI,WAAW,GAAG,CAE5C,OADA,OAAO,gBAAgB,EAAkB,CAClC,EAA+B,EAAkB"}
@@ -1,28 +0,0 @@
1
- //#region src/core/auth/utils/encryption.d.ts
2
- /**
3
- * Encrypts data using AES-128-GCM.
4
- * @param data Data to be encrypted.
5
- * @returns Encrypted data including IV and auth tag.
6
- */
7
- declare function encrypt(data: Uint8Array): Uint8Array;
8
- /**
9
- * Encrypts a string.
10
- * @param data String to be encrypted.
11
- * @returns Encrypted data as Uint8Array.
12
- */
13
- declare function encryptString(data: string): Uint8Array;
14
- /**
15
- * Decrypts data using AES-128-GCM.
16
- * @param encrypted Encrypted data (IV + content + auth tag).
17
- * @returns Decrypted data.
18
- */
19
- declare function decrypt(encrypted: Uint8Array): Uint8Array;
20
- /**
21
- * Decrypts data to a string.
22
- * @param data Encrypted data.
23
- * @returns Odszyfrowany ciąg znaków.
24
- */
25
- declare function decryptToString(data: Uint8Array): string;
26
- //#endregion
27
- export { decrypt, decryptToString, encrypt, encryptString };
28
- //# sourceMappingURL=encryption.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encryption.d.mts","names":[],"sources":["../../../../src/core/auth/utils/encryption.ts"],"mappings":";;AAoBA;;;;iBAAgB,OAAA,CAAQ,IAAA,EAAM,UAAA,GAAa,UAAA;;;;;AAiB3C;iBAAgB,aAAA,CAAc,IAAA,WAAe,UAAA;;;;AAS7C;;iBAAgB,OAAA,CAAQ,SAAA,EAAW,UAAA,GAAa,UAAA;;;;;;iBAsBhC,eAAA,CAAgB,IAAA,EAAM,UAAA"}
@@ -1,2 +0,0 @@
1
- import{decodeBase64 as e}from"@oslojs/encoding";import{createCipheriv as t,createDecipheriv as n}from"node:crypto";import{DynamicBuffer as r}from"@oslojs/binary";const i=process.env.ENCRYPTION_KEY;if(!i)throw Error(`ENCRYPTION_KEY environment variable is not set`);const a=e(i);function o(e){let n=new Uint8Array(16);crypto.getRandomValues(n);let i=t(`aes-128-gcm`,a,n),o=new r(0);return o.write(n),o.write(i.update(e)),o.write(i.final()),o.write(i.getAuthTag()),o.bytes()}function s(e){return o(new TextEncoder().encode(e))}function c(e){if(e.byteLength<33)throw Error(`Invalid encrypted data length`);let t=e.slice(0,16),i=e.slice(e.byteLength-16),o=e.slice(16,e.byteLength-16),s=n(`aes-128-gcm`,a,t);s.setAuthTag(i);let c=new r(0);return c.write(s.update(o)),c.write(s.final()),c.bytes()}function l(e){return new TextDecoder().decode(c(e))}export{c as decrypt,l as decryptToString,o as encrypt,s as encryptString};
2
- //# sourceMappingURL=encryption.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encryption.mjs","names":[],"sources":["../../../../src/core/auth/utils/encryption.ts"],"sourcesContent":["import { createCipheriv, createDecipheriv } from \"node:crypto\";\nimport { DynamicBuffer } from \"@oslojs/binary\";\nimport { decodeBase64 } from \"@oslojs/encoding\";\n\nconst ENCRYPTION_KEY = process.env.ENCRYPTION_KEY;\n\nif (!ENCRYPTION_KEY) {\n throw new Error(\"ENCRYPTION_KEY environment variable is not set\");\n}\n\n/**\n * The encryption key decoded from base64.\n */\nconst key = decodeBase64(ENCRYPTION_KEY);\n\n/**\n * Encrypts data using AES-128-GCM.\n * @param data Data to be encrypted.\n * @returns Encrypted data including IV and auth tag.\n */\nexport function encrypt(data: Uint8Array): Uint8Array {\n const iv = new Uint8Array(16);\n crypto.getRandomValues(iv);\n const cipher = createCipheriv(\"aes-128-gcm\", key, iv);\n const encrypted = new DynamicBuffer(0);\n encrypted.write(iv);\n encrypted.write(cipher.update(data));\n encrypted.write(cipher.final());\n encrypted.write(cipher.getAuthTag());\n return encrypted.bytes();\n}\n\n/**\n * Encrypts a string.\n * @param data String to be encrypted.\n * @returns Encrypted data as Uint8Array.\n */\nexport function encryptString(data: string): Uint8Array {\n return encrypt(new TextEncoder().encode(data));\n}\n\n/**\n * Decrypts data using AES-128-GCM.\n * @param encrypted Encrypted data (IV + content + auth tag).\n * @returns Decrypted data.\n */\nexport function decrypt(encrypted: Uint8Array): Uint8Array {\n if (encrypted.byteLength < 33) {\n throw new Error(\"Invalid encrypted data length\");\n }\n const iv = encrypted.slice(0, 16);\n const authTag = encrypted.slice(encrypted.byteLength - 16);\n const content = encrypted.slice(16, encrypted.byteLength - 16);\n\n const decipher = createDecipheriv(\"aes-128-gcm\", key, iv);\n decipher.setAuthTag(authTag);\n\n const decrypted = new DynamicBuffer(0);\n decrypted.write(decipher.update(content));\n decrypted.write(decipher.final());\n return decrypted.bytes();\n}\n\n/**\n * Decrypts data to a string.\n * @param data Encrypted data.\n * @returns Odszyfrowany ciąg znaków.\n */\nexport function decryptToString(data: Uint8Array): string {\n return new TextDecoder().decode(decrypt(data));\n}\n"],"mappings":"kKAIA,MAAM,EAAiB,QAAQ,IAAI,eAEnC,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAMnE,MAAM,EAAM,EAAa,EAAe,CAOxC,SAAgB,EAAQ,EAA8B,CACpD,IAAM,EAAK,IAAI,WAAW,GAAG,CAC7B,OAAO,gBAAgB,EAAG,CAC1B,IAAM,EAAS,EAAe,cAAe,EAAK,EAAG,CAC/C,EAAY,IAAI,EAAc,EAAE,CAKtC,OAJA,EAAU,MAAM,EAAG,CACnB,EAAU,MAAM,EAAO,OAAO,EAAK,CAAC,CACpC,EAAU,MAAM,EAAO,OAAO,CAAC,CAC/B,EAAU,MAAM,EAAO,YAAY,CAAC,CAC7B,EAAU,OAAO,CAQ1B,SAAgB,EAAc,EAA0B,CACtD,OAAO,EAAQ,IAAI,aAAa,CAAC,OAAO,EAAK,CAAC,CAQhD,SAAgB,EAAQ,EAAmC,CACzD,GAAI,EAAU,WAAa,GACzB,MAAU,MAAM,gCAAgC,CAElD,IAAM,EAAK,EAAU,MAAM,EAAG,GAAG,CAC3B,EAAU,EAAU,MAAM,EAAU,WAAa,GAAG,CACpD,EAAU,EAAU,MAAM,GAAI,EAAU,WAAa,GAAG,CAExD,EAAW,EAAiB,cAAe,EAAK,EAAG,CACzD,EAAS,WAAW,EAAQ,CAE5B,IAAM,EAAY,IAAI,EAAc,EAAE,CAGtC,OAFA,EAAU,MAAM,EAAS,OAAO,EAAQ,CAAC,CACzC,EAAU,MAAM,EAAS,OAAO,CAAC,CAC1B,EAAU,OAAO,CAQ1B,SAAgB,EAAgB,EAA0B,CACxD,OAAO,IAAI,aAAa,CAAC,OAAO,EAAQ,EAAK,CAAC"}
@@ -1,48 +0,0 @@
1
- import { z } from "zod";
2
-
3
- //#region src/core/auth/validation.d.ts
4
- declare const loginSchema: z.ZodObject<{
5
- email: z.ZodString;
6
- password: z.ZodString;
7
- remember: z.ZodOptional<z.ZodBoolean>;
8
- }, z.core.$strip>;
9
- declare const registerSchema: z.ZodObject<{
10
- username: z.ZodString;
11
- email: z.ZodString;
12
- password: z.ZodString;
13
- terms: z.ZodBoolean;
14
- }, z.core.$strip>;
15
- declare const forgotPasswordSchema: z.ZodObject<{
16
- email: z.ZodString;
17
- }, z.core.$strip>;
18
- declare const resetPasswordSchema: z.ZodObject<{
19
- password: z.ZodString;
20
- confirm: z.ZodString;
21
- }, z.core.$strip>;
22
- declare const verifyEmailSchema: z.ZodObject<{
23
- code: z.ZodString;
24
- }, z.core.$strip>;
25
- declare const totpSetupSchema: z.ZodObject<{
26
- code: z.ZodString;
27
- }, z.core.$strip>;
28
- declare const totpVerifySchema: z.ZodObject<{
29
- code: z.ZodString;
30
- }, z.core.$strip>;
31
- declare const passkeysSetupSchema: z.ZodObject<{
32
- name: z.ZodString;
33
- }, z.core.$strip>;
34
- declare const recoveryCodeVerifySchema: z.ZodObject<{
35
- code: z.ZodString;
36
- }, z.core.$strip>;
37
- type LoginInput = z.infer<typeof loginSchema>;
38
- type RegisterInput = z.infer<typeof registerSchema>;
39
- type ForgotPasswordInput = z.infer<typeof forgotPasswordSchema>;
40
- type ResetPasswordInput = z.infer<typeof resetPasswordSchema>;
41
- type TOTPSetupInput = z.infer<typeof totpSetupSchema>;
42
- type TOTPVerifyInput = z.infer<typeof totpVerifySchema>;
43
- type PasskeysSetupInput = z.infer<typeof passkeysSetupSchema>;
44
- type VerifyEmailInput = z.infer<typeof verifyEmailSchema>;
45
- type RecoveryVerifyInput = z.infer<typeof recoveryCodeVerifySchema>;
46
- //#endregion
47
- export { ForgotPasswordInput, LoginInput, PasskeysSetupInput, RecoveryVerifyInput, RegisterInput, ResetPasswordInput, TOTPSetupInput, TOTPVerifyInput, VerifyEmailInput, forgotPasswordSchema, loginSchema, passkeysSetupSchema, recoveryCodeVerifySchema, registerSchema, resetPasswordSchema, totpSetupSchema, totpVerifySchema, verifyEmailSchema };
48
- //# sourceMappingURL=validation.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.mts","names":[],"sources":["../../../src/core/auth/validation.ts"],"mappings":";;;cAGa,WAAA,EAAW,CAAA,CAAA,SAAA;;;;;cAMX,cAAA,EAAc,CAAA,CAAA,SAAA;;;;;;cAOd,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;cAIpB,mBAAA,EAAmB,CAAA,CAAA,SAAA;;;;cAUnB,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;cAKjB,eAAA,EAAe,CAAA,CAAA,SAAA;;;cAIf,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;cAIhB,mBAAA,EAAmB,CAAA,CAAA,SAAA;;;cAInB,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;KAKzB,UAAA,GAAa,CAAA,CAAE,KAAA,QAAa,WAAA;AAAA,KAC5B,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,cAAA;AAAA,KAC/B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,KACrC,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,mBAAA;AAAA,KACpC,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,eAAA;AAAA,KAChC,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,KACjC,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,mBAAA;AAAA,KACpC,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,iBAAA;AAAA,KAClC,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,wBAAA"}
@@ -1,2 +0,0 @@
1
- import{z as e}from"zod";const t=e.object({email:e.string().email(`Invalid email address`),password:e.string().min(8),remember:e.boolean().optional()}),n=e.object({username:e.string().min(2,`Name must be at least 2 characters`),email:e.string().email(`Invalid email address`),password:e.string().min(8,`Password must be at least 8 characters`),terms:e.boolean().refine(e=>e===!0,`You must accept the terms`)}),r=e.object({email:e.string().email(`Invalid email address`)}),i=e.object({password:e.string().min(8,`Password must be at least 8 characters`),confirm:e.string()}).refine(e=>e.password===e.confirm,{message:`Passwords do not match`,path:[`confirm`]}),a=e.object({code:e.string().min(6).max(6)}),o=e.object({code:e.string().regex(/^\d{6}$/,`Code must be 6 digits`)}),s=e.object({code:e.string().regex(/^\d{6}$/,`Code must be 6 digits`)}),c=e.object({name:e.string().min(1,`Passkey name is required`)}),l=e.object({code:e.string().min(16,`Recovery code is required`).max(16)});export{r as forgotPasswordSchema,t as loginSchema,c as passkeysSetupSchema,l as recoveryCodeVerifySchema,n as registerSchema,i as resetPasswordSchema,o as totpSetupSchema,s as totpVerifySchema,a as verifyEmailSchema};
2
- //# sourceMappingURL=validation.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.mjs","names":[],"sources":["../../../src/core/auth/validation.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// Auth validation schemas - CLEAN (No DB dependencies for client-side)\nexport const loginSchema = z.object({\n email: z.string().email(\"Invalid email address\"),\n password: z.string().min(8),\n remember: z.boolean().optional(),\n});\n\nexport const registerSchema = z.object({\n username: z.string().min(2, \"Name must be at least 2 characters\"),\n email: z.string().email(\"Invalid email address\"),\n password: z.string().min(8, \"Password must be at least 8 characters\"),\n terms: z.boolean().refine((val) => val === true, \"You must accept the terms\"),\n});\n\nexport const forgotPasswordSchema = z.object({\n email: z.string().email(\"Invalid email address\"),\n});\n\nexport const resetPasswordSchema = z\n .object({\n password: z.string().min(8, \"Password must be at least 8 characters\"),\n confirm: z.string(),\n })\n .refine((data) => data.password === data.confirm, {\n message: \"Passwords do not match\",\n path: [\"confirm\"],\n });\n\nexport const verifyEmailSchema = z.object({\n code: z.string().min(6).max(6),\n});\n\n// mfa validation schemas\nexport const totpSetupSchema = z.object({\n code: z.string().regex(/^\\d{6}$/, \"Code must be 6 digits\"),\n});\n\nexport const totpVerifySchema = z.object({\n code: z.string().regex(/^\\d{6}$/, \"Code must be 6 digits\"),\n});\n\nexport const passkeysSetupSchema = z.object({\n name: z.string().min(1, \"Passkey name is required\"),\n});\n\nexport const recoveryCodeVerifySchema = z.object({\n code: z.string().min(16, \"Recovery code is required\").max(16),\n});\n\n// Type exports for use in components\nexport type LoginInput = z.infer<typeof loginSchema>;\nexport type RegisterInput = z.infer<typeof registerSchema>;\nexport type ForgotPasswordInput = z.infer<typeof forgotPasswordSchema>;\nexport type ResetPasswordInput = z.infer<typeof resetPasswordSchema>;\nexport type TOTPSetupInput = z.infer<typeof totpSetupSchema>;\nexport type TOTPVerifyInput = z.infer<typeof totpVerifySchema>;\nexport type PasskeysSetupInput = z.infer<typeof passkeysSetupSchema>;\nexport type VerifyEmailInput = z.infer<typeof verifyEmailSchema>;\nexport type RecoveryVerifyInput = z.infer<typeof recoveryCodeVerifySchema>;\n"],"mappings":"wBAGA,MAAa,EAAc,EAAE,OAAO,CAClC,MAAO,EAAE,QAAQ,CAAC,MAAM,wBAAwB,CAChD,SAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,CAC3B,SAAU,EAAE,SAAS,CAAC,UAAU,CACjC,CAAC,CAEW,EAAiB,EAAE,OAAO,CACrC,SAAU,EAAE,QAAQ,CAAC,IAAI,EAAG,qCAAqC,CACjE,MAAO,EAAE,QAAQ,CAAC,MAAM,wBAAwB,CAChD,SAAU,EAAE,QAAQ,CAAC,IAAI,EAAG,yCAAyC,CACrE,MAAO,EAAE,SAAS,CAAC,OAAQ,GAAQ,IAAQ,GAAM,4BAA4B,CAC9E,CAAC,CAEW,EAAuB,EAAE,OAAO,CAC3C,MAAO,EAAE,QAAQ,CAAC,MAAM,wBAAwB,CACjD,CAAC,CAEW,EAAsB,EAChC,OAAO,CACN,SAAU,EAAE,QAAQ,CAAC,IAAI,EAAG,yCAAyC,CACrE,QAAS,EAAE,QAAQ,CACpB,CAAC,CACD,OAAQ,GAAS,EAAK,WAAa,EAAK,QAAS,CAChD,QAAS,yBACT,KAAM,CAAC,UAAU,CAClB,CAAC,CAES,EAAoB,EAAE,OAAO,CACxC,KAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAC/B,CAAC,CAGW,EAAkB,EAAE,OAAO,CACtC,KAAM,EAAE,QAAQ,CAAC,MAAM,UAAW,wBAAwB,CAC3D,CAAC,CAEW,EAAmB,EAAE,OAAO,CACvC,KAAM,EAAE,QAAQ,CAAC,MAAM,UAAW,wBAAwB,CAC3D,CAAC,CAEW,EAAsB,EAAE,OAAO,CAC1C,KAAM,EAAE,QAAQ,CAAC,IAAI,EAAG,2BAA2B,CACpD,CAAC,CAEW,EAA2B,EAAE,OAAO,CAC/C,KAAM,EAAE,QAAQ,CAAC,IAAI,GAAI,4BAA4B,CAAC,IAAI,GAAG,CAC9D,CAAC"}
@@ -1,5 +0,0 @@
1
- //#region src/core/bootstrap.d.ts
2
- declare function ensureSystemInitialized(providedDb?: any): Promise<void>;
3
- //#endregion
4
- export { ensureSystemInitialized };
5
- //# sourceMappingURL=bootstrap.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.d.mts","names":[],"sources":["../../src/core/bootstrap.ts"],"mappings":";iBAQsB,uBAAA,CAAwB,UAAA,SAAgB,OAAA"}
@@ -1,2 +0,0 @@
1
- import{eventBus as e}from"./event-bus.mjs";import{injectDb as t}from"../server/database/inject.mjs";import{initEmailVerification as n}from"./auth/email-verification.mjs";import{notificationService as r}from"./notifications/service.mjs";import{LocalFileProvider as i}from"./filesystem/providers/local.mjs";import{filesystemService as a}from"./filesystem/service.mjs";import"./filesystem/index.mjs";import{isSystemInstalled as o}from"./setup.mjs";async function s(s){if(typeof window<`u`)return;let c=globalThis;if(s&&t(s),!c.__KRYO_INITIALIZED__&&!c.__KRYO_INITIALIZING__){c.__KRYO_INITIALIZING__=!0;try{if(console.log(`[Kryo:Bootstrap] Starting system initialization...`),c.__KRYO_DB__||console.warn(`[Kryo:Bootstrap] DB not detected during bootstrap start. Trying to continue...`),await o()){r.init(),await n();let e=new i;a.registerProvider(e),a.setDefaultProvider(e.id)}else console.log(`[Kryo:Bootstrap] System not installed. Skipping module initialization.`);await e.publish(`system:start`,{runtime:`nodejs`}),console.log(`[Kryo:Bootstrap] System initialized successfully.`),c.__KRYO_INITIALIZED__=!0}catch(e){console.error(`[Kryo:Bootstrap] Initialization failed:`,e)}finally{c.__KRYO_INITIALIZING__=!1}}}export{s as ensureSystemInitialized};
2
- //# sourceMappingURL=bootstrap.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.mjs","names":[],"sources":["../../src/core/bootstrap.ts"],"sourcesContent":["import { injectDb } from \"../server/database/inject\";\nimport { initEmailVerification } from \"./auth/email-verification\";\nimport { eventBus } from \"./event-bus\";\nimport { filesystemService } from \"./filesystem/index\";\nimport { LocalFileProvider } from \"./filesystem/providers/local\";\nimport { notificationService } from \"./notifications/service\";\nimport { isSystemInstalled } from \"./setup\";\n\nexport async function ensureSystemInitialized(providedDb?: any) {\n if (typeof window !== \"undefined\") return;\n\n const g = globalThis as any;\n\n // 1. Immediate injection if provided\n if (providedDb) {\n injectDb(providedDb);\n }\n\n // 2. Prevent infinite recursion and double initialization\n if (g.__KRYO_INITIALIZED__) return;\n if (g.__KRYO_INITIALIZING__) return; // Already in progress, don't block/deadlock\n\n g.__KRYO_INITIALIZING__ = true;\n\n try {\n console.log(\"[Kryo:Bootstrap] Starting system initialization...\");\n\n // Check if we have DB after any possible injection\n if (!g.__KRYO_DB__) {\n console.warn(\n \"[Kryo:Bootstrap] DB not detected during bootstrap start. Trying to continue...\",\n );\n }\n\n // Check if system is installed before initializing modules\n if (await isSystemInstalled()) {\n // Order matters: services first, then modules (which use services)\n notificationService.init();\n await initEmailVerification();\n\n // Auto-register local filesystem provider as a fallback\n const local = new LocalFileProvider();\n\n filesystemService.registerProvider(local);\n filesystemService.setDefaultProvider(local.id);\n } else {\n console.log(\n \"[Kryo:Bootstrap] System not installed. Skipping module initialization.\",\n );\n }\n\n await eventBus.publish(\"system:start\", { runtime: \"nodejs\" });\n\n console.log(\"[Kryo:Bootstrap] System initialized successfully.\");\n g.__KRYO_INITIALIZED__ = true;\n } catch (error) {\n console.error(\"[Kryo:Bootstrap] Initialization failed:\", error);\n } finally {\n g.__KRYO_INITIALIZING__ = false;\n }\n}\n"],"mappings":"6bAQA,eAAsB,EAAwB,EAAkB,CAC9D,GAAI,OAAO,OAAW,IAAa,OAEnC,IAAM,EAAI,WAGV,GAAI,GACF,EAAS,EAAW,CAIlB,GAAE,sBACF,GAAE,sBAEN,GAAE,sBAAwB,GAE1B,GAAI,CAWF,GAVA,QAAQ,IAAI,qDAAqD,CAG5D,EAAE,aACL,QAAQ,KACN,iFACD,CAIC,MAAM,GAAmB,CAAE,CAE7B,EAAoB,MAAM,CAC1B,MAAM,GAAuB,CAG7B,IAAM,EAAQ,IAAI,EAElB,EAAkB,iBAAiB,EAAM,CACzC,EAAkB,mBAAmB,EAAM,GAAG,MAE9C,QAAQ,IACN,yEACD,CAGH,MAAM,EAAS,QAAQ,eAAgB,CAAE,QAAS,SAAU,CAAC,CAE7D,QAAQ,IAAI,oDAAoD,CAChE,EAAE,qBAAuB,SAClB,EAAO,CACd,QAAQ,MAAM,0CAA2C,EAAM,QACvD,CACR,EAAE,sBAAwB"}
@@ -1,11 +0,0 @@
1
- //#region src/core/config.d.ts
2
- interface KryoConfig {
3
- /**
4
- * Path to the directory with local modules.
5
- * Default: "./modules"
6
- */
7
- modulesDirectory?: string;
8
- }
9
- //#endregion
10
- export { KryoConfig };
11
- //# sourceMappingURL=config.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/core/config.ts"],"mappings":";UAAiB,UAAA;EAAA;;;;EAKf,gBAAA;AAAA"}
@@ -1,2 +0,0 @@
1
- const e={modulesDirectory:`modules`};export{e as DEFAULT_CONFIG};
2
- //# sourceMappingURL=config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../src/core/config.ts"],"sourcesContent":["export interface KryoConfig {\n /**\n * Path to the directory with local modules.\n * Default: \"./modules\"\n */\n modulesDirectory?: string;\n}\n\nexport const DEFAULT_CONFIG: KryoConfig = {\n modulesDirectory: \"modules\",\n};\n"],"mappings":"AAQA,MAAa,EAA6B,CACxC,iBAAkB,UACnB"}
@@ -1,16 +0,0 @@
1
- import { KryoConfig } from "./config.mjs";
2
-
3
- //#region src/core/config.server.d.ts
4
- /**
5
- * Loads the Kryo configuration from kryo.config.ts or kryo.config in the current working directory.
6
- * SERVER ONLY.
7
- */
8
- declare function getKryoConfig(): Promise<KryoConfig>;
9
- /**
10
- * Helper returning the absolute path to the modules directory.
11
- * SERVER ONLY.
12
- */
13
- declare function getModulesDir(): Promise<string>;
14
- //#endregion
15
- export { getKryoConfig, getModulesDir };
16
- //# sourceMappingURL=config.server.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.server.d.mts","names":[],"sources":["../../src/core/config.server.ts"],"mappings":";;;;;AAUA;;iBAAsB,aAAA,CAAA,GAAiB,OAAA,CAAQ,UAAA;;;AA4D/C;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
@@ -1,2 +0,0 @@
1
- import{DEFAULT_CONFIG as e}from"./config.mjs";import t from"node:fs";import n from"node:path";let r=null;async function i(){if(typeof window<`u`)throw Error(`getKryoConfig can only be called on the server.`);if(process.env.NODE_ENV===`production`&&r)return r;let i=process.cwd(),a=n.join(i,`kryo.config.ts`),o=n.join(i,`kryo.config`),s=n.join(i,`kryo.config.mjs`),c={};try{let{createJiti:e}=await import(`jiti`),n=e(i,{fsCache:!1,moduleCache:!1});if(t.existsSync(a)){let e=`?t=${Date.now()}`,t=await n.import(`file://${a}${e}`,{default:!0});c=t.default||t}else if(t.existsSync(s)){let e=await n.import(s,{default:!0});c=e.default||e}else if(t.existsSync(o)){let e=await n.import(o,{default:!0});c=e.default||e}}catch(e){console.warn(`[Kryo:Config] Could not load kryo.config.ts, using defaults.`,e)}let l={...e,...c};return process.env.NODE_ENV===`production`&&(r=l),l}async function a(){let e=(await i()).modulesDirectory||`modules`;return n.isAbsolute(e)?e:n.join(process.cwd(),e)}export{i as getKryoConfig,a as getModulesDir};
2
- //# sourceMappingURL=config.server.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.server.mjs","names":[],"sources":["../../src/core/config.server.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { DEFAULT_CONFIG, type KryoConfig } from \"./config\";\n\nlet cachedConfig: KryoConfig | null = null;\n\n/**\n * Loads the Kryo configuration from kryo.config.ts or kryo.config in the current working directory.\n * SERVER ONLY.\n */\nexport async function getKryoConfig(): Promise<KryoConfig> {\n // Prevent this from ever running on the client even if imported\n if (typeof window !== \"undefined\") {\n throw new Error(\"getKryoConfig can only be called on the server.\");\n }\n\n // Use memory cache in production\n if (process.env.NODE_ENV === \"production\" && cachedConfig) {\n return cachedConfig;\n }\n\n const cwd = process.cwd();\n const configPathTS = path.join(cwd, \"kryo.config.ts\");\n const configPathJS = path.join(cwd, \"kryo.config\");\n const configPathMJS = path.join(cwd, \"kryo.config.mjs\");\n\n let loadedConfig: Partial<KryoConfig> = {};\n\n try {\n // Dynamic import jiti only on server to avoid bundling issues\n const { createJiti } = await import(\"jiti\");\n const jiti = createJiti(cwd, {\n fsCache: false,\n moduleCache: false,\n });\n\n if (fs.existsSync(configPathTS)) {\n const cacheBuster = `?t=${Date.now()}`;\n const imported: any = await jiti.import(\n `file://${configPathTS}${cacheBuster}`,\n { default: true },\n );\n loadedConfig = imported.default || imported;\n } else if (fs.existsSync(configPathMJS)) {\n const imported: any = await jiti.import(configPathMJS, { default: true });\n loadedConfig = imported.default || imported;\n } else if (fs.existsSync(configPathJS)) {\n const imported: any = await jiti.import(configPathJS, { default: true });\n loadedConfig = imported.default || imported;\n }\n } catch (error) {\n console.warn(\n \"[Kryo:Config] Could not load kryo.config.ts, using defaults.\",\n error,\n );\n }\n\n const finalConfig = { ...DEFAULT_CONFIG, ...loadedConfig };\n\n if (process.env.NODE_ENV === \"production\") {\n cachedConfig = finalConfig;\n }\n\n return finalConfig;\n}\n\n/**\n * Helper returning the absolute path to the modules directory.\n * SERVER ONLY.\n */\nexport async function getModulesDir(): Promise<string> {\n const config = await getKryoConfig();\n\n const dir = config.modulesDirectory || \"modules\";\n return path.isAbsolute(dir) ? dir : path.join(process.cwd(), dir);\n}\n"],"mappings":"8FAIA,IAAI,EAAkC,KAMtC,eAAsB,GAAqC,CAEzD,GAAI,OAAO,OAAW,IACpB,MAAU,MAAM,kDAAkD,CAIpE,GAAI,QAAQ,IAAI,WAAa,cAAgB,EAC3C,OAAO,EAGT,IAAM,EAAM,QAAQ,KAAK,CACnB,EAAe,EAAK,KAAK,EAAK,iBAAiB,CAC/C,EAAe,EAAK,KAAK,EAAK,cAAc,CAC5C,EAAgB,EAAK,KAAK,EAAK,kBAAkB,CAEnD,EAAoC,EAAE,CAE1C,GAAI,CAEF,GAAM,CAAE,cAAe,MAAM,OAAO,QAC9B,EAAO,EAAW,EAAK,CAC3B,QAAS,GACT,YAAa,GACd,CAAC,CAEF,GAAI,EAAG,WAAW,EAAa,CAAE,CAC/B,IAAM,EAAc,MAAM,KAAK,KAAK,GAC9B,EAAgB,MAAM,EAAK,OAC/B,UAAU,IAAe,IACzB,CAAE,QAAS,GAAM,CAClB,CACD,EAAe,EAAS,SAAW,UAC1B,EAAG,WAAW,EAAc,CAAE,CACvC,IAAM,EAAgB,MAAM,EAAK,OAAO,EAAe,CAAE,QAAS,GAAM,CAAC,CACzE,EAAe,EAAS,SAAW,UAC1B,EAAG,WAAW,EAAa,CAAE,CACtC,IAAM,EAAgB,MAAM,EAAK,OAAO,EAAc,CAAE,QAAS,GAAM,CAAC,CACxE,EAAe,EAAS,SAAW,SAE9B,EAAO,CACd,QAAQ,KACN,+DACA,EACD,CAGH,IAAM,EAAc,CAAE,GAAG,EAAgB,GAAG,EAAc,CAM1D,OAJI,QAAQ,IAAI,WAAa,eAC3B,EAAe,GAGV,EAOT,eAAsB,GAAiC,CAGrD,IAAM,GAFS,MAAM,GAAe,EAEjB,kBAAoB,UACvC,OAAO,EAAK,WAAW,EAAI,CAAG,EAAM,EAAK,KAAK,QAAQ,KAAK,CAAE,EAAI"}
@@ -1,17 +0,0 @@
1
- import { EventHandler } from "./types.mjs";
2
-
3
- //#region src/core/event-bus.d.ts
4
- /**
5
- * EventBus (Pub/Sub) - Global Singleton Pattern.
6
- */
7
- declare class EventBus {
8
- private handlers;
9
- subscribe<T>(eventType: string, subscriberId: string, handler: EventHandler<T>): void;
10
- unsubscribe(eventType: string, subscriberId: string): void;
11
- clearAll(): void;
12
- publish<T>(eventType: string, payload: T, source?: string): Promise<void>;
13
- }
14
- declare const eventBus: EventBus;
15
- //#endregion
16
- export { eventBus };
17
- //# sourceMappingURL=event-bus.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.d.mts","names":[],"sources":["../../src/core/event-bus.ts"],"mappings":";;;;;AAAyD;cAKnD,QAAA;EAAA,QACI,QAAA;EAED,SAAA,GAAA,CACL,SAAA,UACA,YAAA,UACA,OAAA,EAAS,YAAA,CAAa,CAAA;EAYjB,WAAA,CAAY,SAAA,UAAmB,YAAA;EAO/B,QAAA,CAAA;EAKM,OAAA,GAAA,CACX,SAAA,UACA,OAAA,EAAS,CAAA,EACT,MAAA,YACC,OAAA;AAAA;AAAA,cAkCQ,QAAA,EAAQ,QAAA"}
@@ -1,2 +0,0 @@
1
- var e=class{constructor(){this.handlers=new Map}subscribe(e,t,n){this.handlers.has(e)||this.handlers.set(e,new Map),this.handlers.get(e)?.set(t,n),console.log(`[Event Bus] Subscriber "${t}" added for "${e}"`)}unsubscribe(e,t){this.handlers.get(e)?.delete(t),console.log(`[Event Bus] Subscriber "${t}" removed from "${e}"`)}clearAll(){console.log(`[Event Bus] Resetting all listeners...`),this.handlers.clear()}async publish(e,t,n=`system`){let r=this.handlers.get(e);if(!r)return;let i=Array.from(r.values());console.log(`[Event Bus] Publishing "${e}" to ${i.length} subscribers`);let a={type:e,payload:t,timestamp:Date.now(),source:n};await Promise.all(i.map(async t=>{try{await t(a)}catch(t){console.error(`[Event Bus] Handler Error for ${e}:`,t)}}))}};const t=globalThis,n=t.__KRYO_EVENT_BUS__??new e;t.__KRYO_EVENT_BUS__=n;export{n as eventBus};
2
- //# sourceMappingURL=event-bus.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.mjs","names":[],"sources":["../../src/core/event-bus.ts"],"sourcesContent":["import type { EventHandler, SystemEvent } from \"./types\";\n\n/**\n * EventBus (Pub/Sub) - Global Singleton Pattern.\n */\nclass EventBus {\n private handlers: Map<string, Map<string, EventHandler>> = new Map();\n\n public subscribe<T>(\n eventType: string,\n subscriberId: string,\n handler: EventHandler<T>,\n ): void {\n if (!this.handlers.has(eventType)) {\n this.handlers.set(eventType, new Map());\n }\n const eventHandlers = this.handlers.get(eventType);\n eventHandlers?.set(subscriberId, handler);\n console.log(\n `[Event Bus] Subscriber \"${subscriberId}\" added for \"${eventType}\"`,\n );\n }\n\n public unsubscribe(eventType: string, subscriberId: string): void {\n this.handlers.get(eventType)?.delete(subscriberId);\n console.log(\n `[Event Bus] Subscriber \"${subscriberId}\" removed from \"${eventType}\"`,\n );\n }\n\n public clearAll(): void {\n console.log(\"[Event Bus] Resetting all listeners...\");\n this.handlers.clear();\n }\n\n public async publish<T>(\n eventType: string,\n payload: T,\n source: string = \"system\",\n ): Promise<void> {\n const eventHandlers = this.handlers.get(eventType);\n if (!eventHandlers) return;\n\n const handlers = Array.from(eventHandlers.values());\n\n console.log(\n `[Event Bus] Publishing \"${eventType}\" to ${handlers.length} subscribers`,\n );\n\n const event: SystemEvent<T> = {\n type: eventType,\n payload,\n timestamp: Date.now(),\n source,\n };\n\n await Promise.all(\n handlers.map(async (handler) => {\n try {\n await handler(event);\n } catch (error) {\n console.error(`[Event Bus] Handler Error for ${eventType}:`, error);\n }\n }),\n );\n }\n}\n\n// Ensure global singleton\nconst globalForEventBus = globalThis as unknown as {\n __KRYO_EVENT_BUS__: EventBus | undefined;\n};\n\nexport const eventBus = globalForEventBus.__KRYO_EVENT_BUS__ ?? new EventBus();\n\nglobalForEventBus.__KRYO_EVENT_BUS__ = eventBus;\n"],"mappings":"AAKA,IAAM,EAAN,KAAe,6BAC8C,IAAI,IAE/D,UACE,EACA,EACA,EACM,CACD,KAAK,SAAS,IAAI,EAAU,EAC/B,KAAK,SAAS,IAAI,EAAW,IAAI,IAAM,CAEnB,KAAK,SAAS,IAAI,EAAU,EACnC,IAAI,EAAc,EAAQ,CACzC,QAAQ,IACN,2BAA2B,EAAa,eAAe,EAAU,GAClE,CAGH,YAAmB,EAAmB,EAA4B,CAChE,KAAK,SAAS,IAAI,EAAU,EAAE,OAAO,EAAa,CAClD,QAAQ,IACN,2BAA2B,EAAa,kBAAkB,EAAU,GACrE,CAGH,UAAwB,CACtB,QAAQ,IAAI,yCAAyC,CACrD,KAAK,SAAS,OAAO,CAGvB,MAAa,QACX,EACA,EACA,EAAiB,SACF,CACf,IAAM,EAAgB,KAAK,SAAS,IAAI,EAAU,CAClD,GAAI,CAAC,EAAe,OAEpB,IAAM,EAAW,MAAM,KAAK,EAAc,QAAQ,CAAC,CAEnD,QAAQ,IACN,2BAA2B,EAAU,OAAO,EAAS,OAAO,cAC7D,CAED,IAAM,EAAwB,CAC5B,KAAM,EACN,UACA,UAAW,KAAK,KAAK,CACrB,SACD,CAED,MAAM,QAAQ,IACZ,EAAS,IAAI,KAAO,IAAY,CAC9B,GAAI,CACF,MAAM,EAAQ,EAAM,OACb,EAAO,CACd,QAAQ,MAAM,iCAAiC,EAAU,GAAI,EAAM,GAErE,CACH,GAKL,MAAM,EAAoB,WAIb,EAAW,EAAkB,oBAAsB,IAAI,EAEpE,EAAkB,mBAAqB"}
@@ -1,2 +0,0 @@
1
- import{LocalFileProvider as e}from"./providers/local.mjs";import{filesystemService as t}from"./service.mjs";if(typeof window>`u`){let n=new e;t.registerProvider(n),t.setDefaultProvider(n.id)}export{};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/core/filesystem/index.ts"],"sourcesContent":["import { LocalFileProvider } from \"./providers/local\";\nimport { filesystemService } from \"./service\";\n\nexport * from \"./types\";\nexport { filesystemService };\n\n// Auto-register local provider\nif (typeof window === \"undefined\") {\n const local = new LocalFileProvider();\n\n filesystemService.registerProvider(local);\n filesystemService.setDefaultProvider(local.id);\n}\n"],"mappings":"4GAOA,GAAI,OAAO,OAAW,IAAa,CACjC,IAAM,EAAQ,IAAI,EAElB,EAAkB,iBAAiB,EAAM,CACzC,EAAkB,mBAAmB,EAAM,GAAG"}
@@ -1,2 +0,0 @@
1
- import e from"node:fs";import t from"node:path";var n=class{constructor(){this.id=`local`,this.name=`Local Filesystem`}generateUniqueImageName(e){let t=e.replace(/\s+/g,`-`).toLowerCase(),n=Math.floor(Math.random()*Date.now()).toString(36),r=t.lastIndexOf(`.`);return r<0?`${t}-${n}`:`${t.slice(0,r)}-${n}${t.slice(r)}`}async upload(n){try{let r=process.env.FILE_STORAGE_FOLDER??`public/storage`;e.existsSync(r)||e.mkdirSync(r,{recursive:!0});let i=this.generateUniqueImageName(n.name),a=t.join(r,i),o=await n.arrayBuffer();return e.writeFileSync(a,Buffer.from(o)),{name:i,url:`${r}/${i}`.replace(`public`,``),type:n.type,size:n.size,service:`local`,serviceId:a}}catch(e){return console.error(`Error uploading file`,e),{error:`Error uploading file`}}}};export{n as LocalFileProvider};
2
- //# sourceMappingURL=local.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local.mjs","names":[],"sources":["../../../../src/core/filesystem/providers/local.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { IStorageProvider, StorageResult } from \"../types\";\n\nexport class LocalFileProvider implements IStorageProvider {\n public id = \"local\";\n public name = \"Local Filesystem\";\n\n private generateUniqueImageName(name: string) {\n const cleanName = name.replace(/\\s+/g, \"-\").toLowerCase();\n const suffix = Math.floor(Math.random() * Date.now()).toString(36);\n const index = cleanName.lastIndexOf(\".\");\n\n return index < 0\n ? `${cleanName}-${suffix}`\n : `${cleanName.slice(0, index)}-${suffix}${cleanName.slice(index)}`;\n }\n\n public async upload(file: File): Promise<StorageResult> {\n try {\n const storageFolder = process.env.FILE_STORAGE_FOLDER ?? \"public/storage\";\n\n if (!fs.existsSync(storageFolder)) {\n fs.mkdirSync(storageFolder, { recursive: true });\n }\n\n const name = this.generateUniqueImageName(file.name);\n const filePath = path.join(storageFolder, name);\n const buffer = await file.arrayBuffer();\n fs.writeFileSync(filePath, Buffer.from(buffer));\n\n const url = `${storageFolder}/${name}`.replace(\"public\", \"\");\n\n return {\n name: name,\n url,\n type: file.type,\n size: file.size,\n service: \"local\",\n serviceId: filePath,\n };\n } catch (error) {\n console.error(\"Error uploading file\", error);\n return { error: \"Error uploading file\" };\n }\n }\n}\n"],"mappings":"gDAIA,IAAa,EAAb,KAA2D,uBAC7C,kBACE,mBAEd,wBAAgC,EAAc,CAC5C,IAAM,EAAY,EAAK,QAAQ,OAAQ,IAAI,CAAC,aAAa,CACnD,EAAS,KAAK,MAAM,KAAK,QAAQ,CAAG,KAAK,KAAK,CAAC,CAAC,SAAS,GAAG,CAC5D,EAAQ,EAAU,YAAY,IAAI,CAExC,OAAO,EAAQ,EACX,GAAG,EAAU,GAAG,IAChB,GAAG,EAAU,MAAM,EAAG,EAAM,CAAC,GAAG,IAAS,EAAU,MAAM,EAAM,GAGrE,MAAa,OAAO,EAAoC,CACtD,GAAI,CACF,IAAM,EAAgB,QAAQ,IAAI,qBAAuB,iBAEpD,EAAG,WAAW,EAAc,EAC/B,EAAG,UAAU,EAAe,CAAE,UAAW,GAAM,CAAC,CAGlD,IAAM,EAAO,KAAK,wBAAwB,EAAK,KAAK,CAC9C,EAAW,EAAK,KAAK,EAAe,EAAK,CACzC,EAAS,MAAM,EAAK,aAAa,CAKvC,OAJA,EAAG,cAAc,EAAU,OAAO,KAAK,EAAO,CAAC,CAIxC,CACC,OACN,IAJU,GAAG,EAAc,GAAG,IAAO,QAAQ,SAAU,GAAG,CAK1D,KAAM,EAAK,KACX,KAAM,EAAK,KACX,QAAS,QACT,UAAW,EACZ,OACM,EAAO,CAEd,OADA,QAAQ,MAAM,uBAAwB,EAAM,CACrC,CAAE,MAAO,uBAAwB"}
@@ -1,19 +0,0 @@
1
- import { IStorageProvider, StorageResult } from "./types.mjs";
2
-
3
- //#region src/core/filesystem/service.d.ts
4
- declare class FilesystemService {
5
- private providers;
6
- private defaultProviderId;
7
- registerProvider(provider: IStorageProvider): void;
8
- unregisterProvider(id: string): void;
9
- setDefaultProvider(id: string): void;
10
- upload(file: File, providerId?: string): Promise<StorageResult>;
11
- getProviders(): {
12
- id: string;
13
- name: string;
14
- }[];
15
- }
16
- declare const filesystemService: FilesystemService;
17
- //#endregion
18
- export { filesystemService };
19
- //# sourceMappingURL=service.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.mts","names":[],"sources":["../../../src/core/filesystem/service.ts"],"mappings":";;;cAEM,iBAAA;EAAA,QACI,SAAA;EAAA,QACA,iBAAA;EAED,gBAAA,CAAiB,QAAA,EAAU,gBAAA;EAQ3B,kBAAA,CAAmB,EAAA;EAUnB,kBAAA,CAAmB,EAAA;EAOb,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,UAAA,YAAsB,OAAA,CAAQ,aAAA;EAiBvD,YAAA,CAAA;;;;;cAaI,iBAAA,EAAiB,iBAAA"}
@@ -1,2 +0,0 @@
1
- var e=class{constructor(){this.providers=new Map,this.defaultProviderId=null}registerProvider(e){this.providers.set(e.id,e),(!this.defaultProviderId||this.defaultProviderId===`local`)&&(this.defaultProviderId=e.id),console.log(`[Filesystem] Provider registered: ${e.id}`)}unregisterProvider(e){this.providers.delete(e),this.defaultProviderId===e&&(this.defaultProviderId=this.providers.has(`local`)?`local`:Array.from(this.providers.keys())[0]||null),console.log(`[Filesystem] Provider unregistered: ${e}`)}setDefaultProvider(e){this.providers.has(e)&&(this.defaultProviderId=e,console.log(`[Filesystem] Default provider set to: ${e}`))}async upload(e,t){let n=t||this.defaultProviderId;(!n||!this.providers.has(n))&&(n=`local`);let r=this.providers.get(n);return r?await r.upload(e):{error:`No storage provider available (local fallback failed)`}}getProviders(){return Array.from(this.providers.values()).map(e=>({id:e.id,name:e.name}))}};const t=globalThis,n=t.__KRYO_FILESYSTEM_SERVICE__??new e;t.__KRYO_FILESYSTEM_SERVICE__=n;export{n as filesystemService};
2
- //# sourceMappingURL=service.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/core/filesystem/service.ts"],"sourcesContent":["import type { IStorageProvider, StorageResult } from \"./types\";\n\nclass FilesystemService {\n private providers: Map<string, IStorageProvider> = new Map();\n private defaultProviderId: string | null = null;\n\n public registerProvider(provider: IStorageProvider) {\n this.providers.set(provider.id, provider);\n if (!this.defaultProviderId || this.defaultProviderId === \"local\") {\n this.defaultProviderId = provider.id;\n }\n console.log(`[Filesystem] Provider registered: ${provider.id}`);\n }\n\n public unregisterProvider(id: string) {\n this.providers.delete(id);\n if (this.defaultProviderId === id) {\n this.defaultProviderId = this.providers.has(\"local\")\n ? \"local\"\n : Array.from(this.providers.keys())[0] || null;\n }\n console.log(`[Filesystem] Provider unregistered: ${id}`);\n }\n\n public setDefaultProvider(id: string) {\n if (this.providers.has(id)) {\n this.defaultProviderId = id;\n console.log(`[Filesystem] Default provider set to: ${id}`);\n }\n }\n\n public async upload(file: File, providerId?: string): Promise<StorageResult> {\n let id = providerId || this.defaultProviderId;\n\n // Fallback logic\n if (!id || !this.providers.has(id)) {\n id = \"local\";\n }\n\n const provider = this.providers.get(id);\n\n if (!provider) {\n return { error: \"No storage provider available (local fallback failed)\" };\n }\n\n return await provider.upload(file);\n }\n\n public getProviders() {\n return Array.from(this.providers.values()).map((p) => ({\n id: p.id,\n name: p.name,\n }));\n }\n}\n\n// Global Singleton Pattern\nconst globalForFilesystem = globalThis as unknown as {\n __KRYO_FILESYSTEM_SERVICE__: FilesystemService | undefined;\n};\n\nexport const filesystemService =\n globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ ?? new FilesystemService();\n\nglobalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ = filesystemService;\n"],"mappings":"AAEA,IAAM,EAAN,KAAwB,8BAC6B,IAAI,2BACZ,KAE3C,iBAAwB,EAA4B,CAClD,KAAK,UAAU,IAAI,EAAS,GAAI,EAAS,EACrC,CAAC,KAAK,mBAAqB,KAAK,oBAAsB,WACxD,KAAK,kBAAoB,EAAS,IAEpC,QAAQ,IAAI,qCAAqC,EAAS,KAAK,CAGjE,mBAA0B,EAAY,CACpC,KAAK,UAAU,OAAO,EAAG,CACrB,KAAK,oBAAsB,IAC7B,KAAK,kBAAoB,KAAK,UAAU,IAAI,QAAQ,CAChD,QACA,MAAM,KAAK,KAAK,UAAU,MAAM,CAAC,CAAC,IAAM,MAE9C,QAAQ,IAAI,uCAAuC,IAAK,CAG1D,mBAA0B,EAAY,CAChC,KAAK,UAAU,IAAI,EAAG,GACxB,KAAK,kBAAoB,EACzB,QAAQ,IAAI,yCAAyC,IAAK,EAI9D,MAAa,OAAO,EAAY,EAA6C,CAC3E,IAAI,EAAK,GAAc,KAAK,mBAGxB,CAAC,GAAM,CAAC,KAAK,UAAU,IAAI,EAAG,IAChC,EAAK,SAGP,IAAM,EAAW,KAAK,UAAU,IAAI,EAAG,CAMvC,OAJK,EAIE,MAAM,EAAS,OAAO,EAAK,CAHzB,CAAE,MAAO,wDAAyD,CAM7E,cAAsB,CACpB,OAAO,MAAM,KAAK,KAAK,UAAU,QAAQ,CAAC,CAAC,IAAK,IAAO,CACrD,GAAI,EAAE,GACN,KAAM,EAAE,KACT,EAAE,GAKP,MAAM,EAAsB,WAIf,EACX,EAAoB,6BAA+B,IAAI,EAEzD,EAAoB,4BAA8B"}
@@ -1,22 +0,0 @@
1
- //#region src/core/filesystem/types.d.ts
2
- interface StorageData {
3
- name: string;
4
- url: string;
5
- type: string;
6
- size: number;
7
- service: string;
8
- serviceId: string;
9
- }
10
- interface StorageError {
11
- error: string;
12
- }
13
- type StorageResult = StorageData | StorageError;
14
- interface IStorageProvider {
15
- id: string;
16
- name: string;
17
- upload(file: File, options?: any): Promise<StorageResult>;
18
- delete?(serviceId: string): Promise<boolean>;
19
- }
20
- //#endregion
21
- export { IStorageProvider, StorageData, StorageError, StorageResult };
22
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/core/filesystem/types.ts"],"mappings":";UAAiB,WAAA;EACf,IAAA;EACA,GAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;EACA,SAAA;AAAA;AAAA,UAGe,YAAA;EACf,KAAA;AAAA;AAAA,KAGU,aAAA,GAAgB,WAAA,GAAc,YAAA;AAAA,UAEzB,gBAAA;EACf,EAAA;EACA,IAAA;EACA,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAA,SAAgB,OAAA,CAAQ,aAAA;EAC3C,MAAA,EAAQ,SAAA,WAAoB,OAAA;AAAA"}
@@ -1,58 +0,0 @@
1
- import { CreateNotificationPayload } from "./types.mjs";
2
-
3
- //#region src/core/notifications/actions.d.ts
4
- declare function getUserNotifications(): Promise<{
5
- id: string;
6
- title: string;
7
- content: string | null;
8
- target: string | null;
9
- type: string | null;
10
- isRead: boolean;
11
- resourceId: string | null;
12
- resourceType: string | null;
13
- userId: string;
14
- createdAt: Date;
15
- updatedAt: Date | null;
16
- }[] | null>;
17
- declare function createNotification(data: CreateNotificationPayload): Promise<{
18
- id: string;
19
- createdAt: Date;
20
- updatedAt: Date | null;
21
- userId: string;
22
- type: string | null;
23
- title: string;
24
- content: string | null;
25
- target: string | null;
26
- isRead: boolean;
27
- resourceId: string | null;
28
- resourceType: string | null;
29
- }>;
30
- declare function markNotificationAsRead(id: string): Promise<{
31
- id: string;
32
- title: string;
33
- content: string | null;
34
- target: string | null;
35
- type: string | null;
36
- isRead: boolean;
37
- resourceId: string | null;
38
- resourceType: string | null;
39
- userId: string;
40
- createdAt: Date;
41
- updatedAt: Date | null;
42
- }>;
43
- declare function markAllNotificationsAsRead(): Promise<{
44
- id: string;
45
- title: string;
46
- content: string | null;
47
- target: string | null;
48
- type: string | null;
49
- isRead: boolean;
50
- resourceId: string | null;
51
- resourceType: string | null;
52
- userId: string;
53
- createdAt: Date;
54
- updatedAt: Date | null;
55
- }[] | null>;
56
- //#endregion
57
- export { createNotification, getUserNotifications, markAllNotificationsAsRead, markNotificationAsRead };
58
- //# sourceMappingURL=actions.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.mts","names":[],"sources":["../../../src/core/notifications/actions.ts"],"mappings":";;;iBAQsB,oBAAA,CAAA,GAAoB,OAAA;;;;;;;;;;;;;iBAWpB,kBAAA,CAAmB,IAAA,EAAM,yBAAA,GAAyB,OAAA;;;;;;;;;;;;;iBAYlD,sBAAA,CAAuB,EAAA,WAAU,OAAA;;;;;;;;;;;;;iBAUjC,0BAAA,CAAA,GAA0B,OAAA"}
@@ -1,2 +0,0 @@
1
- "use server";import{db as e}from"../../server/database/inject.mjs";import{notificationTable as t}from"../../server/database/schema.mjs";import{getCurrentSession as n}from"../auth/session.mjs";import{desc as r,eq as i}from"drizzle-orm";async function a(){let{user:a}=await n();return a?await e.select().from(t).where(i(t.userId,a.id)).orderBy(r(t.createdAt)):null}async function o(n){let[r]=await e.insert(t).values({...n,isRead:!1}).returning();return r}async function s(n){let[r]=await e.update(t).set({isRead:!0}).where(i(t.id,n)).returning();return r}async function c(){let{user:r}=await n();return r?await e.update(t).set({isRead:!0}).where(i(t.userId,r.id)).returning():null}export{o as createNotification,a as getUserNotifications,c as markAllNotificationsAsRead,s as markNotificationAsRead};
2
- //# sourceMappingURL=actions.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.mjs","names":[],"sources":["../../../src/core/notifications/actions.ts"],"sourcesContent":["\"use server\";\n\nimport { desc, eq } from \"drizzle-orm\";\nimport { db } from \"../../server/database/inject\";\nimport { notificationTable } from \"../../server/database/schema\";\nimport { getCurrentSession } from \"../auth/session\";\nimport type { CreateNotificationPayload } from \"./types\";\n\nexport async function getUserNotifications() {\n const { user } = await getCurrentSession();\n if (!user) return null;\n\n return await db\n .select()\n .from(notificationTable)\n .where(eq(notificationTable.userId, user.id))\n .orderBy(desc(notificationTable.createdAt));\n}\n\nexport async function createNotification(data: CreateNotificationPayload) {\n const [notification] = await db\n .insert(notificationTable)\n .values({\n ...data,\n isRead: false,\n })\n .returning();\n\n return notification;\n}\n\nexport async function markNotificationAsRead(id: string) {\n const [updated] = await db\n .update(notificationTable)\n .set({ isRead: true })\n .where(eq(notificationTable.id, id))\n .returning();\n\n return updated;\n}\n\nexport async function markAllNotificationsAsRead() {\n const { user } = await getCurrentSession();\n if (!user) return null;\n\n return await db\n .update(notificationTable)\n .set({ isRead: true })\n .where(eq(notificationTable.userId, user.id))\n .returning();\n}\n"],"mappings":"2OAQA,eAAsB,GAAuB,CAC3C,GAAM,CAAE,QAAS,MAAM,GAAmB,CAG1C,OAFK,EAEE,MAAM,EACV,QAAQ,CACR,KAAK,EAAkB,CACvB,MAAM,EAAG,EAAkB,OAAQ,EAAK,GAAG,CAAC,CAC5C,QAAQ,EAAK,EAAkB,UAAU,CAAC,CAN3B,KASpB,eAAsB,EAAmB,EAAiC,CACxE,GAAM,CAAC,GAAgB,MAAM,EAC1B,OAAO,EAAkB,CACzB,OAAO,CACN,GAAG,EACH,OAAQ,GACT,CAAC,CACD,WAAW,CAEd,OAAO,EAGT,eAAsB,EAAuB,EAAY,CACvD,GAAM,CAAC,GAAW,MAAM,EACrB,OAAO,EAAkB,CACzB,IAAI,CAAE,OAAQ,GAAM,CAAC,CACrB,MAAM,EAAG,EAAkB,GAAI,EAAG,CAAC,CACnC,WAAW,CAEd,OAAO,EAGT,eAAsB,GAA6B,CACjD,GAAM,CAAE,QAAS,MAAM,GAAmB,CAG1C,OAFK,EAEE,MAAM,EACV,OAAO,EAAkB,CACzB,IAAI,CAAE,OAAQ,GAAM,CAAC,CACrB,MAAM,EAAG,EAAkB,OAAQ,EAAK,GAAG,CAAC,CAC5C,WAAW,CANI"}
@@ -1 +0,0 @@
1
- import{createNotification as e,getUserNotifications as t,markAllNotificationsAsRead as n,markNotificationAsRead as r}from"./actions.mjs";import{notificationService as i}from"./service.mjs";export{};
@@ -1,9 +0,0 @@
1
- //#region src/core/notifications/service.d.ts
2
- declare class NotificationService {
3
- private initialized;
4
- init(): void;
5
- }
6
- declare const notificationService: NotificationService;
7
- //#endregion
8
- export { notificationService };
9
- //# sourceMappingURL=service.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.mts","names":[],"sources":["../../../src/core/notifications/service.ts"],"mappings":";cAIM,mBAAA;EAAA,QACI,WAAA;EAED,IAAA,CAAA;AAAA;AAAA,cA4CI,mBAAA,EAAmB,mBAAA"}
@@ -1,2 +0,0 @@
1
- import{eventBus as e}from"../event-bus.mjs";import{createNotification as t}from"./actions.mjs";var n=class{constructor(){this.initialized=!1}init(){this.initialized||(console.log(`[Notification Service] Subscribing to notification:send...`),e.subscribe(`notification:send`,`notification-service`,async e=>{console.log(`[Notification Service] Received notification:send event`,e.payload);try{let n=await t(e.payload);console.log(`[Notification Service] Notification created successfully:`,n.id)}catch(e){console.error(`[Notification Service] Failed to process notification:send`,e)}}),this.initialized=!0,console.log(`[NotificationService] Initialized and listening for events.`))}};const r=globalThis,i=r.__KRYO_NOTIFICATION_SERVICE__??new n;r.__KRYO_NOTIFICATION_SERVICE__=i;export{i as notificationService};
2
- //# sourceMappingURL=service.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/core/notifications/service.ts"],"sourcesContent":["import { eventBus } from \"../event-bus\";\nimport { createNotification } from \"./actions\";\nimport type { CreateNotificationPayload } from \"./types\";\n\nclass NotificationService {\n private initialized = false;\n\n public init() {\n if (this.initialized) {\n // console.log(\"[Notification Service] Already initialized.\");\n return;\n }\n\n console.log(\"[Notification Service] Subscribing to notification:send...\");\n\n eventBus.subscribe(\n \"notification:send\",\n \"notification-service\",\n async (event) => {\n console.log(\n \"[Notification Service] Received notification:send event\",\n event.payload,\n );\n try {\n // const { createNotification } = await import(\"./actions\");\n const result = await createNotification(\n event.payload as CreateNotificationPayload,\n );\n console.log(\n \"[Notification Service] Notification created successfully:\",\n result.id,\n );\n } catch (error) {\n console.error(\n \"[Notification Service] Failed to process notification:send\",\n error,\n );\n }\n },\n );\n\n this.initialized = true;\n console.log(\"[NotificationService] Initialized and listening for events.\");\n }\n}\n\n// Global Singleton Pattern\nconst globalForNotifications = globalThis as unknown as {\n __KRYO_NOTIFICATION_SERVICE__: NotificationService | undefined;\n};\n\nexport const notificationService =\n globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ ??\n new NotificationService();\n\nglobalForNotifications.__KRYO_NOTIFICATION_SERVICE__ = notificationService;\n"],"mappings":"+FAIA,IAAM,EAAN,KAA0B,gCACF,GAEtB,MAAc,CACR,KAAK,cAKT,QAAQ,IAAI,6DAA6D,CAEzE,EAAS,UACP,oBACA,uBACA,KAAO,IAAU,CACf,QAAQ,IACN,0DACA,EAAM,QACP,CACD,GAAI,CAEF,IAAM,EAAS,MAAM,EACnB,EAAM,QACP,CACD,QAAQ,IACN,4DACA,EAAO,GACR,OACM,EAAO,CACd,QAAQ,MACN,6DACA,EACD,GAGN,CAED,KAAK,YAAc,GACnB,QAAQ,IAAI,8DAA8D,IAK9E,MAAM,EAAyB,WAIlB,EACX,EAAuB,+BACvB,IAAI,EAEN,EAAuB,8BAAgC"}
@@ -1,21 +0,0 @@
1
- import { notificationTable } from "../../server/database/schema.mjs";
2
- import { InferSelectModel } from "drizzle-orm";
3
-
4
- //#region src/core/notifications/types.d.ts
5
- type Notification = InferSelectModel<typeof notificationTable>;
6
- type CreateNotificationPayload = {
7
- title: string;
8
- content?: string;
9
- type?: string;
10
- target?: string;
11
- userId: string;
12
- resourceId?: string;
13
- resourceType?: string;
14
- };
15
- type NotificationEvents = {
16
- "notification:send": CreateNotificationPayload;
17
- "notification:created": Notification;
18
- };
19
- //#endregion
20
- export { CreateNotificationPayload, Notification, NotificationEvents };
21
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../src/core/notifications/types.ts"],"mappings":";;;;KAGY,YAAA,GAAe,gBAAA,QAAwB,iBAAA;AAAA,KAEvC,yBAAA;EACV,KAAA;EACA,OAAA;EACA,IAAA;EACA,MAAA;EACA,MAAA;EACA,UAAA;EACA,YAAA;AAAA;AAAA,KAGU,kBAAA;EACV,mBAAA,EAAqB,yBAAA;EACrB,sBAAA,EAAwB,YAAA;AAAA"}
@@ -1,9 +0,0 @@
1
- //#region src/core/setup.d.ts
2
- /**
3
- * Checks if the system is installed.
4
- * A system is considered installed if at least one user exists in the database.
5
- */
6
- declare function isSystemInstalled(): Promise<boolean>;
7
- //#endregion
8
- export { isSystemInstalled };
9
- //# sourceMappingURL=setup.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.mts","names":[],"sources":["../../src/core/setup.ts"],"mappings":";;AAQA;;;iBAAsB,iBAAA,CAAA,GAAqB,OAAA"}
@@ -1,2 +0,0 @@
1
- import{db as e}from"../server/database/inject.mjs";import{userTable as t}from"../server/database/schema.mjs";import{sql as n}from"drizzle-orm";async function r(){try{console.log(`[Kernel:Setup] Checking if system is installed...`);let r=await e.select({count:n`count(*)`}).from(t),i=Number(r[0]?.count||0);return console.log(`[Kernel:Setup] User count: ${i}`),i>0}catch(e){return console.log(`[Kernel:Setup] System not installed or error: ${e.message}`),!1}}export{r as isSystemInstalled};
2
- //# sourceMappingURL=setup.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.mjs","names":[],"sources":["../../src/core/setup.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport { db } from \"../server/database/inject\";\nimport { userTable } from \"../server/database/schema\";\n\n/**\n * Checks if the system is installed.\n * A system is considered installed if at least one user exists in the database.\n */\nexport async function isSystemInstalled(): Promise<boolean> {\n try {\n // We check if the users table exists and has at least one record\n console.log(\"[Kernel:Setup] Checking if system is installed...\");\n const result = await db\n .select({ count: sql<string | number>`count(*)` })\n .from(userTable);\n const count = Number(result[0]?.count || 0);\n console.log(`[Kernel:Setup] User count: ${count}`);\n return count > 0;\n } catch (error: any) {\n console.log(\n `[Kernel:Setup] System not installed or error: ${error.message}`,\n );\n // If table doesn't exist, it's definitely not installed\n return false;\n }\n}\n"],"mappings":"+IAQA,eAAsB,GAAsC,CAC1D,GAAI,CAEF,QAAQ,IAAI,oDAAoD,CAChE,IAAM,EAAS,MAAM,EAClB,OAAO,CAAE,MAAO,CAAoB,WAAY,CAAC,CACjD,KAAK,EAAU,CACZ,EAAQ,OAAO,EAAO,IAAI,OAAS,EAAE,CAE3C,OADA,QAAQ,IAAI,8BAA8B,IAAQ,CAC3C,EAAQ,QACR,EAAY,CAKnB,OAJA,QAAQ,IACN,iDAAiD,EAAM,UACxD,CAEM"}
@@ -1,13 +0,0 @@
1
- //#region src/core/types.d.ts
2
- type UserRole = "user" | "admin" | string;
3
- type UserPermission = string;
4
- interface SystemEvent<T = any> {
5
- type: string;
6
- payload: T;
7
- timestamp: number;
8
- source: string;
9
- }
10
- type EventHandler<T = any> = (event: SystemEvent<T>) => Promise<void> | void;
11
- //#endregion
12
- export { EventHandler, SystemEvent, UserPermission, UserRole };
13
- //# sourceMappingURL=types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/core/types.ts"],"mappings":";KAAY,QAAA;AAAA,KACA,cAAA;AAAA,UAEK,WAAA;EACf,IAAA;EACA,OAAA,EAAS,CAAA;EACT,SAAA;EACA,MAAA;AAAA;AAAA,KAGU,YAAA,aACV,KAAA,EAAO,WAAA,CAAY,CAAA,MAChB,OAAA"}
package/dist/index.d.mts DELETED
@@ -1,8 +0,0 @@
1
- import { DatabaseSchema, coreSchema, emailVerificationTable, notificationTable, passwordResetSessionTable, permissionsTable, relations, rolesTable, rolesToPermissionsTable, sessionTable, systemModulesTable, userTable, usersToPermissionsTable, usersToRolesTable } from "./server/database/schema.mjs";
2
- import { EventHandler, SystemEvent, UserPermission, UserRole } from "./core/types.mjs";
3
- import { AuthResponse, AuthSession, FullUser, PasswordResetAuthSession, PasswordResetSession, Session, SessionFlags, User, UserSession } from "./core/auth/types.mjs";
4
- import { ForgotPasswordInput, LoginInput, PasskeysSetupInput, RecoveryVerifyInput, RegisterInput, ResetPasswordInput, TOTPSetupInput, TOTPVerifyInput, VerifyEmailInput, forgotPasswordSchema, loginSchema, passkeysSetupSchema, recoveryCodeVerifySchema, registerSchema, resetPasswordSchema, totpSetupSchema, totpVerifySchema, verifyEmailSchema } from "./core/auth/validation.mjs";
5
- import { eventBus } from "./core/event-bus.mjs";
6
- import { notificationService } from "./core/notifications/service.mjs";
7
- import { CreateNotificationPayload, Notification, NotificationEvents } from "./core/notifications/types.mjs";
8
- export { AuthResponse, AuthSession, CreateNotificationPayload, DatabaseSchema, EventHandler, ForgotPasswordInput, FullUser, LoginInput, Notification, NotificationEvents, PasskeysSetupInput, PasswordResetAuthSession, PasswordResetSession, RecoveryVerifyInput, RegisterInput, ResetPasswordInput, Session, SessionFlags, SystemEvent, TOTPSetupInput, TOTPVerifyInput, User, UserPermission, UserRole, UserSession, VerifyEmailInput, coreSchema, emailVerificationTable, eventBus, forgotPasswordSchema, loginSchema, notificationService, notificationTable, passkeysSetupSchema, passwordResetSessionTable, permissionsTable, recoveryCodeVerifySchema, registerSchema, relations, resetPasswordSchema, rolesTable, rolesToPermissionsTable, sessionTable, systemModulesTable, totpSetupSchema, totpVerifySchema, userTable, usersToPermissionsTable, usersToRolesTable, verifyEmailSchema };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{forgotPasswordSchema as e,loginSchema as t,passkeysSetupSchema as n,recoveryCodeVerifySchema as r,registerSchema as i,resetPasswordSchema as a,totpSetupSchema as o,totpVerifySchema as s,verifyEmailSchema as c}from"./core/auth/validation.mjs";import{eventBus as l}from"./core/event-bus.mjs";import{coreSchema as u,emailVerificationTable as d,notificationTable as f,passwordResetSessionTable as p,permissionsTable as m,relations as h,rolesTable as g,rolesToPermissionsTable as _,sessionTable as v,systemModulesTable as y,userTable as b,usersToPermissionsTable as x,usersToRolesTable as S}from"./server/database/schema.mjs";import{notificationService as C}from"./core/notifications/service.mjs";export{u as coreSchema,d as emailVerificationTable,l as eventBus,e as forgotPasswordSchema,t as loginSchema,C as notificationService,f as notificationTable,n as passkeysSetupSchema,p as passwordResetSessionTable,m as permissionsTable,r as recoveryCodeVerifySchema,i as registerSchema,h as relations,a as resetPasswordSchema,g as rolesTable,_ as rolesToPermissionsTable,v as sessionTable,y as systemModulesTable,o as totpSetupSchema,s as totpVerifySchema,b as userTable,x as usersToPermissionsTable,S as usersToRolesTable,c as verifyEmailSchema};
@@ -1,13 +0,0 @@
1
- //#region src/server/auth/email.d.ts
2
- /**
3
- * Validates the email format and length.
4
- */
5
- declare function verifyEmailInput(email: string): boolean;
6
- /**
7
- * Checks if an email address is already in use.
8
- * @returns True if the email is available, false otherwise.
9
- */
10
- declare function checkEmailAvailability(email: string): Promise<boolean>;
11
- //#endregion
12
- export { checkEmailAvailability, verifyEmailInput };
13
- //# sourceMappingURL=email.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.d.mts","names":[],"sources":["../../../src/server/auth/email.ts"],"mappings":";;AAOA;;iBAAgB,gBAAA,CAAiB,KAAA;;;AAQjC;;iBAAsB,sBAAA,CAAuB,KAAA,WAAgB,OAAA"}
@@ -1,2 +0,0 @@
1
- import{db as e}from"../database/inject.mjs";import{userTable as t}from"../database/schema.mjs";import{count as n,eq as r}from"drizzle-orm";function i(e){return/^.+@.+\..+$/.test(e)&&e.length<256&&e.length>0}async function a(i){let[a]=await e.select({count:n()}).from(t).where(r(t.email,i));return a.count===0}export{a as checkEmailAvailability,i as verifyEmailInput};
2
- //# sourceMappingURL=email.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.mjs","names":[],"sources":["../../../src/server/auth/email.ts"],"sourcesContent":["import { count, eq } from \"drizzle-orm\";\nimport { db } from \"../database/inject\";\nimport { userTable } from \"../database/schema\";\n\n/**\n * Validates the email format and length.\n */\nexport function verifyEmailInput(email: string): boolean {\n return /^.+@.+\\..+$/.test(email) && email.length < 256 && email.length > 0;\n}\n\n/**\n * Checks if an email address is already in use.\n * @returns True if the email is available, false otherwise.\n */\nexport async function checkEmailAvailability(email: string): Promise<boolean> {\n const [entries] = await db\n .select({ count: count() })\n .from(userTable)\n .where(eq(userTable.email, email));\n\n return entries.count === 0;\n}\n"],"mappings":"2IAOA,SAAgB,EAAiB,EAAwB,CACvD,MAAO,cAAc,KAAK,EAAM,EAAI,EAAM,OAAS,KAAO,EAAM,OAAS,EAO3E,eAAsB,EAAuB,EAAiC,CAC5E,GAAM,CAAC,GAAW,MAAM,EACrB,OAAO,CAAE,MAAO,GAAO,CAAE,CAAC,CAC1B,KAAK,EAAU,CACf,MAAM,EAAG,EAAU,MAAO,EAAM,CAAC,CAEpC,OAAO,EAAQ,QAAU"}