@arch-cadre/core 0.0.32 → 0.0.34

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 (90) hide show
  1. package/dist/core/auth/email-verification.d.mts +1 -1
  2. package/dist/core/auth/logic.d.mts +6 -6
  3. package/dist/core/auth/rbac.d.mts +2 -2
  4. package/dist/core/notifications/actions.d.mts +1 -1
  5. package/package.json +5 -15
  6. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
  7. package/dist/core/auth/augment.cjs +0 -1
  8. package/dist/core/auth/augment.d.cts +0 -20
  9. package/dist/core/auth/augment.d.cts.map +0 -1
  10. package/dist/core/auth/email-verification.cjs +0 -1
  11. package/dist/core/auth/email-verification.d.cts +0 -62
  12. package/dist/core/auth/email-verification.d.cts.map +0 -1
  13. package/dist/core/auth/logic.cjs +0 -1
  14. package/dist/core/auth/logic.d.cts +0 -110
  15. package/dist/core/auth/logic.d.cts.map +0 -1
  16. package/dist/core/auth/password-reset.cjs +0 -1
  17. package/dist/core/auth/password-reset.d.cts +0 -39
  18. package/dist/core/auth/password-reset.d.cts.map +0 -1
  19. package/dist/core/auth/rbac.cjs +0 -1
  20. package/dist/core/auth/rbac.d.cts +0 -61
  21. package/dist/core/auth/rbac.d.cts.map +0 -1
  22. package/dist/core/auth/session.cjs +0 -1
  23. package/dist/core/auth/session.d.cts +0 -54
  24. package/dist/core/auth/session.d.cts.map +0 -1
  25. package/dist/core/auth/types.d.cts +0 -55
  26. package/dist/core/auth/types.d.cts.map +0 -1
  27. package/dist/core/auth/utils/encode.cjs +0 -1
  28. package/dist/core/auth/utils/encode.d.cts +0 -15
  29. package/dist/core/auth/utils/encode.d.cts.map +0 -1
  30. package/dist/core/auth/utils/encryption.cjs +0 -1
  31. package/dist/core/auth/utils/encryption.d.cts +0 -28
  32. package/dist/core/auth/utils/encryption.d.cts.map +0 -1
  33. package/dist/core/auth/validation.cjs +0 -1
  34. package/dist/core/auth/validation.d.cts +0 -48
  35. package/dist/core/auth/validation.d.cts.map +0 -1
  36. package/dist/core/bootstrap.cjs +0 -1
  37. package/dist/core/bootstrap.d.cts +0 -5
  38. package/dist/core/bootstrap.d.cts.map +0 -1
  39. package/dist/core/config.cjs +0 -1
  40. package/dist/core/config.d.cts +0 -11
  41. package/dist/core/config.d.cts.map +0 -1
  42. package/dist/core/config.server.cjs +0 -1
  43. package/dist/core/config.server.d.cts +0 -16
  44. package/dist/core/config.server.d.cts.map +0 -1
  45. package/dist/core/event-bus.cjs +0 -1
  46. package/dist/core/event-bus.d.cts +0 -17
  47. package/dist/core/event-bus.d.cts.map +0 -1
  48. package/dist/core/filesystem/index.cjs +0 -1
  49. package/dist/core/filesystem/providers/local.cjs +0 -1
  50. package/dist/core/filesystem/service.cjs +0 -1
  51. package/dist/core/filesystem/service.d.cts +0 -19
  52. package/dist/core/filesystem/service.d.cts.map +0 -1
  53. package/dist/core/filesystem/types.d.cts +0 -22
  54. package/dist/core/filesystem/types.d.cts.map +0 -1
  55. package/dist/core/notifications/actions.cjs +0 -1
  56. package/dist/core/notifications/actions.d.cts +0 -58
  57. package/dist/core/notifications/actions.d.cts.map +0 -1
  58. package/dist/core/notifications/index.cjs +0 -1
  59. package/dist/core/notifications/service.cjs +0 -1
  60. package/dist/core/notifications/service.d.cts +0 -9
  61. package/dist/core/notifications/service.d.cts.map +0 -1
  62. package/dist/core/notifications/types.d.cts +0 -21
  63. package/dist/core/notifications/types.d.cts.map +0 -1
  64. package/dist/core/setup.cjs +0 -1
  65. package/dist/core/setup.d.cts +0 -9
  66. package/dist/core/setup.d.cts.map +0 -1
  67. package/dist/core/types.d.cts +0 -13
  68. package/dist/core/types.d.cts.map +0 -1
  69. package/dist/index.cjs +0 -1
  70. package/dist/index.d.cts +0 -8
  71. package/dist/server/auth/email.cjs +0 -1
  72. package/dist/server/auth/email.d.cts +0 -13
  73. package/dist/server/auth/email.d.cts.map +0 -1
  74. package/dist/server/auth/password.cjs +0 -1
  75. package/dist/server/auth/password.d.cts +0 -23
  76. package/dist/server/auth/password.d.cts.map +0 -1
  77. package/dist/server/auth/user.cjs +0 -1
  78. package/dist/server/auth/user.d.cts +0 -58
  79. package/dist/server/auth/user.d.cts.map +0 -1
  80. package/dist/server/database/inject.cjs +0 -1
  81. package/dist/server/database/inject.d.cts +0 -15
  82. package/dist/server/database/inject.d.cts.map +0 -1
  83. package/dist/server/database/schema.cjs +0 -1
  84. package/dist/server/database/schema.d.cts +0 -2962
  85. package/dist/server/database/schema.d.cts.map +0 -1
  86. package/dist/server/emails/index.cjs +0 -1
  87. package/dist/server/emails/index.d.cts +0 -26
  88. package/dist/server/emails/index.d.cts.map +0 -1
  89. package/dist/server.cjs +0 -1
  90. package/dist/server.d.cts +0 -26
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encryption.d.cts","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 +0,0 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`zod`);const t=e.z.object({email:e.z.string().email(`Invalid email address`),password:e.z.string().min(8),remember:e.z.boolean().optional()}),n=e.z.object({username:e.z.string().min(2,`Name must be at least 2 characters`),email:e.z.string().email(`Invalid email address`),password:e.z.string().min(8,`Password must be at least 8 characters`),terms:e.z.boolean().refine(e=>e===!0,`You must accept the terms`)}),r=e.z.object({email:e.z.string().email(`Invalid email address`)}),i=e.z.object({password:e.z.string().min(8,`Password must be at least 8 characters`),confirm:e.z.string()}).refine(e=>e.password===e.confirm,{message:`Passwords do not match`,path:[`confirm`]}),a=e.z.object({code:e.z.string().min(6).max(6)}),o=e.z.object({code:e.z.string().regex(/^\d{6}$/,`Code must be 6 digits`)}),s=e.z.object({code:e.z.string().regex(/^\d{6}$/,`Code must be 6 digits`)}),c=e.z.object({name:e.z.string().min(1,`Passkey name is required`)}),l=e.z.object({code:e.z.string().min(16,`Recovery code is required`).max(16)});exports.forgotPasswordSchema=r,exports.loginSchema=t,exports.passkeysSetupSchema=c,exports.recoveryCodeVerifySchema=l,exports.registerSchema=n,exports.resetPasswordSchema=i,exports.totpSetupSchema=o,exports.totpVerifySchema=s,exports.verifyEmailSchema=a;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.cts","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 +0,0 @@
1
- const e=require(`./event-bus.cjs`),t=require(`../server/database/inject.cjs`),n=require(`./auth/email-verification.cjs`),r=require(`./notifications/service.cjs`),i=require(`./filesystem/providers/local.cjs`),a=require(`./filesystem/service.cjs`);require(`./filesystem/index.cjs`);const o=require(`./setup.cjs`);async function s(s){if(typeof window<`u`)return;let c=globalThis;if(s&&t.injectDb(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.isSystemInstalled()){r.notificationService.init(),await n.initEmailVerification();let e=new i.LocalFileProvider;a.filesystemService.registerProvider(e),a.filesystemService.setDefaultProvider(e.id)}else console.log(`[Kryo:Bootstrap] System not installed. Skipping module initialization.`);await e.eventBus.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}}}exports.ensureSystemInitialized=s;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.d.cts","names":[],"sources":["../../src/core/bootstrap.ts"],"mappings":";iBAQsB,uBAAA,CAAwB,UAAA,SAAgB,OAAA"}
@@ -1 +0,0 @@
1
- const e={modulesDirectory:`modules`};exports.DEFAULT_CONFIG=e;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.cts","names":[],"sources":["../../src/core/config.ts"],"mappings":";UAAiB,UAAA;EAAA;;;;EAKf,gBAAA;AAAA"}
@@ -1 +0,0 @@
1
- const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./config.cjs`);let n=require(`node:fs`);n=e.__toESM(n);let r=require(`node:path`);r=e.__toESM(r);let i=null;async function a(){if(typeof window<`u`)throw Error(`getKryoConfig can only be called on the server.`);if(process.env.NODE_ENV===`production`&&i)return i;let e=process.cwd(),a=r.default.join(e,`kryo.config.ts`),o=r.default.join(e,`kryo.config`),s=r.default.join(e,`kryo.config.mjs`),c={};try{let{createJiti:t}=await import(`jiti`),r=t(e,{fsCache:!1,moduleCache:!1});if(n.default.existsSync(a)){let e=`?t=${Date.now()}`,t=await r.import(`file://${a}${e}`,{default:!0});c=t.default||t}else if(n.default.existsSync(s)){let e=await r.import(s,{default:!0});c=e.default||e}else if(n.default.existsSync(o)){let e=await r.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={...t.DEFAULT_CONFIG,...c};return process.env.NODE_ENV===`production`&&(i=l),l}async function o(){let e=(await a()).modulesDirectory||`modules`;return r.default.isAbsolute(e)?e:r.default.join(process.cwd(),e)}exports.getKryoConfig=a,exports.getModulesDir=o;
@@ -1,16 +0,0 @@
1
- import { KryoConfig } from "./config.cjs";
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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.server.d.cts","names":[],"sources":["../../src/core/config.server.ts"],"mappings":";;;;;AAUA;;iBAAsB,aAAA,CAAA,GAAiB,OAAA,CAAQ,UAAA;;;AA4D/C;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
@@ -1 +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,exports.eventBus=n;
@@ -1,17 +0,0 @@
1
- import { EventHandler } from "./types.cjs";
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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-bus.d.cts","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 +0,0 @@
1
- const e=require(`./providers/local.cjs`),t=require(`./service.cjs`);if(typeof window>`u`){let n=new e.LocalFileProvider;t.filesystemService.registerProvider(n),t.filesystemService.setDefaultProvider(n.id)}
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/_rolldown/runtime.cjs`);let t=require(`node:fs`);t=e.__toESM(t);let n=require(`node:path`);n=e.__toESM(n);var r=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(e){try{let r=process.env.FILE_STORAGE_FOLDER??`public/storage`;t.default.existsSync(r)||t.default.mkdirSync(r,{recursive:!0});let i=this.generateUniqueImageName(e.name),a=n.default.join(r,i),o=await e.arrayBuffer();return t.default.writeFileSync(a,Buffer.from(o)),{name:i,url:`${r}/${i}`.replace(`public`,``),type:e.type,size:e.size,service:`local`,serviceId:a}}catch(e){return console.error(`Error uploading file`,e),{error:`Error uploading file`}}}};exports.LocalFileProvider=r;
@@ -1 +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,exports.filesystemService=n;
@@ -1,19 +0,0 @@
1
- import { IStorageProvider, StorageResult } from "./types.cjs";
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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.cts","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,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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.cts","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 +0,0 @@
1
- "use server";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../server/database/inject.cjs`),t=require(`../../server/database/schema.cjs`),n=require(`../auth/session.cjs`);let r=require(`drizzle-orm`);async function i(){let{user:i}=await n.getCurrentSession();return i?await e.db.select().from(t.notificationTable).where((0,r.eq)(t.notificationTable.userId,i.id)).orderBy((0,r.desc)(t.notificationTable.createdAt)):null}async function a(n){let[r]=await e.db.insert(t.notificationTable).values({...n,isRead:!1}).returning();return r}async function o(n){let[i]=await e.db.update(t.notificationTable).set({isRead:!0}).where((0,r.eq)(t.notificationTable.id,n)).returning();return i}async function s(){let{user:i}=await n.getCurrentSession();return i?await e.db.update(t.notificationTable).set({isRead:!0}).where((0,r.eq)(t.notificationTable.userId,i.id)).returning():null}exports.createNotification=a,exports.getUserNotifications=i,exports.markAllNotificationsAsRead=s,exports.markNotificationAsRead=o;
@@ -1,58 +0,0 @@
1
- import { CreateNotificationPayload } from "./types.cjs";
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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.cts","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 +0,0 @@
1
- require(`./actions.cjs`),require(`./service.cjs`);
@@ -1 +0,0 @@
1
- const e=require(`../event-bus.cjs`),t=require(`./actions.cjs`);var n=class{constructor(){this.initialized=!1}init(){this.initialized||(console.log(`[Notification Service] Subscribing to notification:send...`),e.eventBus.subscribe(`notification:send`,`notification-service`,async e=>{console.log(`[Notification Service] Received notification:send event`,e.payload);try{let n=await t.createNotification(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,exports.notificationService=i;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.cts","names":[],"sources":["../../../src/core/notifications/service.ts"],"mappings":";cAIM,mBAAA;EAAA,QACI,WAAA;EAED,IAAA,CAAA;AAAA;AAAA,cA4CI,mBAAA,EAAmB,mBAAA"}
@@ -1,21 +0,0 @@
1
- import { notificationTable } from "../../server/database/schema.cjs";
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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.cts","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 +0,0 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../server/database/inject.cjs`),t=require(`../server/database/schema.cjs`);let n=require(`drizzle-orm`);async function r(){try{console.log(`[Kernel:Setup] Checking if system is installed...`);let r=await e.db.select({count:n.sql`count(*)`}).from(t.userTable),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}}exports.isSystemInstalled=r;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.cts","names":[],"sources":["../../src/core/setup.ts"],"mappings":";;AAQA;;;iBAAsB,iBAAA,CAAA,GAAqB,OAAA"}
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.cts","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.cjs DELETED
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core/auth/validation.cjs`),t=require(`./core/event-bus.cjs`),n=require(`./server/database/schema.cjs`),r=require(`./core/notifications/service.cjs`);exports.coreSchema=n.coreSchema,exports.emailVerificationTable=n.emailVerificationTable,exports.eventBus=t.eventBus,exports.forgotPasswordSchema=e.forgotPasswordSchema,exports.loginSchema=e.loginSchema,exports.notificationService=r.notificationService,exports.notificationTable=n.notificationTable,exports.passkeysSetupSchema=e.passkeysSetupSchema,exports.passwordResetSessionTable=n.passwordResetSessionTable,exports.permissionsTable=n.permissionsTable,exports.recoveryCodeVerifySchema=e.recoveryCodeVerifySchema,exports.registerSchema=e.registerSchema,exports.relations=n.relations,exports.resetPasswordSchema=e.resetPasswordSchema,exports.rolesTable=n.rolesTable,exports.rolesToPermissionsTable=n.rolesToPermissionsTable,exports.sessionTable=n.sessionTable,exports.systemModulesTable=n.systemModulesTable,exports.totpSetupSchema=e.totpSetupSchema,exports.totpVerifySchema=e.totpVerifySchema,exports.userTable=n.userTable,exports.usersToPermissionsTable=n.usersToPermissionsTable,exports.usersToRolesTable=n.usersToRolesTable,exports.verifyEmailSchema=e.verifyEmailSchema;
package/dist/index.d.cts 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.cjs";
2
- import { EventHandler, SystemEvent, UserPermission, UserRole } from "./core/types.cjs";
3
- import { AuthResponse, AuthSession, FullUser, PasswordResetAuthSession, PasswordResetSession, Session, SessionFlags, User, UserSession } from "./core/auth/types.cjs";
4
- import { ForgotPasswordInput, LoginInput, PasskeysSetupInput, RecoveryVerifyInput, RegisterInput, ResetPasswordInput, TOTPSetupInput, TOTPVerifyInput, VerifyEmailInput, forgotPasswordSchema, loginSchema, passkeysSetupSchema, recoveryCodeVerifySchema, registerSchema, resetPasswordSchema, totpSetupSchema, totpVerifySchema, verifyEmailSchema } from "./core/auth/validation.cjs";
5
- import { eventBus } from "./core/event-bus.cjs";
6
- import { notificationService } from "./core/notifications/service.cjs";
7
- import { CreateNotificationPayload, Notification, NotificationEvents } from "./core/notifications/types.cjs";
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 };
@@ -1 +0,0 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../database/inject.cjs`),t=require(`../database/schema.cjs`);let n=require(`drizzle-orm`);function r(e){return/^.+@.+\..+$/.test(e)&&e.length<256&&e.length>0}async function i(r){let[i]=await e.db.select({count:(0,n.count)()}).from(t.userTable).where((0,n.eq)(t.userTable.email,r));return i.count===0}exports.checkEmailAvailability=i,exports.verifyEmailInput=r;
@@ -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.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.d.cts","names":[],"sources":["../../../src/server/auth/email.ts"],"mappings":";;AAOA;;iBAAgB,gBAAA,CAAiB,KAAA;;;AAQjC;;iBAAsB,sBAAA,CAAuB,KAAA,WAAgB,OAAA"}
@@ -1 +0,0 @@
1
- "use server";const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`bcryptjs`);t=e.__toESM(t);async function n(e){return await t.default.hash(e,10)}async function r(e,n){return await t.default.compare(n,e)}async function i(e){return e.length>=8&&e.length<=255}exports.hashPassword=n,exports.verifyPasswordHash=r,exports.verifyPasswordStrength=i;
@@ -1,23 +0,0 @@
1
- //#region src/server/auth/password.d.ts
2
- /**
3
- * Hashes the password using bcrypt.
4
- * @param password Password to be hashed.
5
- * @returns Returns the hashed password.
6
- */
7
- declare function hashPassword(password: string): Promise<string>;
8
- /**
9
- * Verifies the password hash.
10
- * @param hash bcrypt hash.
11
- * @param password Password for comparison.
12
- * @returns Returns true if the password is correct, false otherwise.
13
- */
14
- declare function verifyPasswordHash(hash: string, password: string): Promise<boolean>;
15
- /**
16
- * Validates password strength.
17
- * @param password Password to validate.
18
- * @returns Returns true if the password meets complexity requirements.
19
- */
20
- declare function verifyPasswordStrength(password: string): Promise<boolean>;
21
- //#endregion
22
- export { hashPassword, verifyPasswordHash, verifyPasswordStrength };
23
- //# sourceMappingURL=password.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"password.d.cts","names":[],"sources":["../../../src/server/auth/password.ts"],"mappings":";;AASA;;;;iBAAsB,YAAA,CAAa,QAAA,WAAmB,OAAA;AAYtD;;;;;;AAAA,iBAAsB,kBAAA,CACpB,IAAA,UACA,QAAA,WACC,OAAA;;;AAUH;;;iBAAsB,sBAAA,CACpB,QAAA,WACC,OAAA"}
@@ -1 +0,0 @@
1
- "use server";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../database/inject.cjs`),t=require(`../database/schema.cjs`),n=require(`./password.cjs`),r=require(`../../core/auth/utils/encode.cjs`),i=require(`../../core/auth/utils/encryption.cjs`),a=require(`../emails/index.cjs`);let o=require(`drizzle-orm`);async function s(e){return e.length>3&&e.length<32&&e.trim()===e}async function c(s,c,l){let u=await n.hashPassword(l),d=r.generateRandomRecoveryCode(),f=i.encryptString(d);return await e.db.transaction(async e=>{let[n]=await e.insert(t.userTable).values({email:s,name:c,password:u,recovery_code:Buffer.from(f)}).returning();if(!n)throw Error(`Failed to create user`);let[r]=await e.select().from(t.rolesTable).where((0,o.eq)(t.rolesTable.name,`user`));return r||([r]=await e.insert(t.rolesTable).values({name:`user`,description:`Default user role`}).returning()),await e.insert(t.usersToRolesTable).values({userId:n.id,roleId:r.id}),await a.sendRecoveryCode(n.email,d),n})}async function l(n,a,s){let c=i.encryptString(r.generateRandomRecoveryCode());return await e.db.transaction(async e=>{let[r]=await e.insert(t.userTable).values({email:n,name:a,image:s,emailVerifiedAt:new Date,recovery_code:Buffer.from(c)}).returning(),[i]=await e.select().from(t.rolesTable).where((0,o.eq)(t.rolesTable.name,`user`));return i||([i]=await e.insert(t.rolesTable).values({name:`user`,description:`Default user role`}).returning()),await e.insert(t.usersToRolesTable).values({userId:r.id,roleId:i.id}),r})}async function u(n){let[r]=await e.db.select().from(t.userTable).where((0,o.eq)(t.userTable.id,n));if(!r)return null;let{password:i,recovery_code:a,...s}=r;return s}async function d(n){let[r]=await e.db.select({recovery_code:t.userTable.recovery_code}).from(t.userTable).where((0,o.eq)(t.userTable.id,n));if(!r||!r.recovery_code)throw Error(`Recovery code not found for user`);return i.decryptToString(r.recovery_code)}async function f(n){let s=r.generateRandomRecoveryCode(),c=i.encryptString(s),[l]=await e.db.update(t.userTable).set({recovery_code:Buffer.from(c)}).where((0,o.eq)(t.userTable.id,n)).returning();if(!l)throw Error(`User not found`);return await a.sendRecoveryCode(l.email,s),s}async function p(r,i){let a=await n.hashPassword(i);await e.db.update(t.userTable).set({password:a}).where((0,o.eq)(t.userTable.id,r))}async function m(n,r){await e.db.update(t.userTable).set({name:r}).where((0,o.eq)(t.userTable.id,n))}async function h(n,r){await e.db.update(t.userTable).set({image:r}).where((0,o.eq)(t.userTable.id,n))}async function g(n,r){await e.db.update(t.userTable).set({email:r,emailVerifiedAt:new Date}).where((0,o.eq)(t.userTable.id,n))}async function _(n,r){return(await e.db.update(t.userTable).set({emailVerifiedAt:new Date}).where((0,o.and)((0,o.eq)(t.userTable.id,n),(0,o.eq)(t.userTable.email,r))).returning({id:t.userTable.id})).length>0}async function v(n){let[r]=await e.db.select({password:t.userTable.password}).from(t.userTable).where((0,o.eq)(t.userTable.id,n));if(!r)throw Error(`User not found`);return r.password}async function y(n){let[r]=await e.db.select().from(t.userTable).where((0,o.eq)(t.userTable.email,n));if(!r)return null;let{password:i,recovery_code:a,...s}=r;return s}exports.createOAuthUser=l,exports.createUser=c,exports.getUserById=u,exports.getUserFromEmail=y,exports.getUserPasswordHash=v,exports.getUserRecoverCode=d,exports.resetUserRecoveryCode=f,exports.setUserAsEmailVerifiedIfEmailMatches=_,exports.updateUserAwatar=h,exports.updateUserEmailAndSetEmailAsVerified=g,exports.updateUserName=m,exports.updateUserPassword=p,exports.verifyUsernameInput=s;
@@ -1,58 +0,0 @@
1
- import { User } from "../../core/auth/types.cjs";
2
-
3
- //#region src/server/auth/user.d.ts
4
- /**
5
- * Validates the username input.
6
- */
7
- declare function verifyUsernameInput(username: string): Promise<boolean>;
8
- /**
9
- * Creates a new user with an initial recovery code and default 'user' role.
10
- */
11
- declare function createUser(email: string, username: string, password: string): Promise<User>;
12
- /**
13
- * Creates a new user from an OAuth provider.
14
- */
15
- declare function createOAuthUser(email: string, name: string, image?: string): Promise<User>;
16
- /**
17
- * Returns a user by ID.
18
- */
19
- declare function getUserById(userId: string): Promise<User | null>;
20
- /**
21
- * Decrypts and returns the user's recovery code.
22
- */
23
- declare function getUserRecoverCode(userId: string): Promise<string>;
24
- /**
25
- * Generates and sets a new recovery code for the user.
26
- */
27
- declare function resetUserRecoveryCode(userId: string): Promise<string>;
28
- /**
29
- * Updates the user's password.
30
- */
31
- declare function updateUserPassword(userId: string, password: string): Promise<void>;
32
- /**
33
- * Updates the user's name.
34
- */
35
- declare function updateUserName(userId: string, name: string): Promise<void>;
36
- /**
37
- * Updates the user's image.
38
- */
39
- declare function updateUserAwatar(userId: string, image: string): Promise<void>;
40
- /**
41
- * Updates the user's email and marks it as verified.
42
- */
43
- declare function updateUserEmailAndSetEmailAsVerified(userId: string, email: string): Promise<void>;
44
- /**
45
- * Sets the user as email verified if the provided email matches.
46
- */
47
- declare function setUserAsEmailVerifiedIfEmailMatches(userId: string, email: string): Promise<boolean>;
48
- /**
49
- * Returns the user's password hash.
50
- */
51
- declare function getUserPasswordHash(userId: string): Promise<string | null>;
52
- /**
53
- * Returns a user by email.
54
- */
55
- declare function getUserFromEmail(email: string): Promise<User | null>;
56
- //#endregion
57
- export { createOAuthUser, createUser, getUserById, getUserFromEmail, getUserPasswordHash, getUserRecoverCode, resetUserRecoveryCode, setUserAsEmailVerifiedIfEmailMatches, updateUserAwatar, updateUserEmailAndSetEmailAsVerified, updateUserName, updateUserPassword, verifyUsernameInput };
58
- //# sourceMappingURL=user.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user.d.cts","names":[],"sources":["../../../src/server/auth/user.ts"],"mappings":";;;;;AAiBA;iBAAsB,mBAAA,CAAoB,QAAA,WAAmB,OAAA;;;;iBASvC,UAAA,CACpB,KAAA,UACA,QAAA,UACA,QAAA,WACC,OAAA,CAAQ,IAAA;;;;iBA+CW,eAAA,CACpB,KAAA,UACA,IAAA,UACA,KAAA,YACC,OAAA,CAAQ,IAAA;;;;iBAyCW,WAAA,CAAY,MAAA,WAAiB,OAAA,CAAQ,IAAA;;;AA7C3D;iBA2DsB,kBAAA,CAAmB,MAAA,WAAiB,OAAA;;;;iBAkBpC,qBAAA,CAAsB,MAAA,WAAiB,OAAA;;;;iBAuBvC,kBAAA,CACpB,MAAA,UACA,QAAA,WACC,OAAA;;AA1DH;;iBAwEsB,cAAA,CACpB,MAAA,UACA,IAAA,WACC,OAAA;;;;iBAWmB,gBAAA,CACpB,MAAA,UACA,KAAA,WACC,OAAA;;;AA3EH;iBAuFsB,oCAAA,CACpB,MAAA,UACA,KAAA,WACC,OAAA;;;;iBAamB,oCAAA,CACpB,MAAA,UACA,KAAA,WACC,OAAA;;;;iBAemB,mBAAA,CACpB,MAAA,WACC,OAAA;AAlFH;;;AAAA,iBAoGsB,gBAAA,CAAiB,KAAA,WAAgB,OAAA,CAAQ,IAAA"}
@@ -1 +0,0 @@
1
- const e=globalThis;function t(t){e.__KRYO_DB__||=(console.log(`[Kryo:Core] >>> DATABASE INJECTED <<<`),t)}const n=new Proxy({},{get(t,n){if(n===`then`)return;if(typeof n==`symbol`||n===`inspect`||n===`toString`)return e.__KRYO_DB__?.[n];let r=e.__KRYO_DB__;if(!r)throw Error(`[Kryo:Core] Database access error: tried to use "db.${String(n)}" but database is not injected yet. Ensure you call "ensureSystemInitialized()" before using the database.`);return r[n]}});exports.db=n,exports.injectDb=t;
@@ -1,15 +0,0 @@
1
- import { schema_d_exports } from "./schema.cjs";
2
- import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
-
4
- //#region src/server/database/inject.d.ts
5
- type KryoDatabase = NodePgDatabase<typeof schema_d_exports>;
6
- declare function injectDb(db: KryoDatabase): void;
7
- /**
8
- * Shared 'db' proxy.
9
- * Resolves to globalThis.__KRYO_DB__ on every property access.
10
- * Safe to import statically at top-level.
11
- */
12
- declare const db: KryoDatabase;
13
- //#endregion
14
- export { KryoDatabase, db, injectDb };
15
- //# sourceMappingURL=inject.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject.d.cts","names":[],"sources":["../../../src/server/database/inject.ts"],"mappings":";;;;KAGY,YAAA,GAAe,cAAA,QAAsB,gBAAA;AAAA,iBAKjC,QAAA,CAAS,EAAA,EAAI,YAAA;AAL7B;;;;;AAAA,cAgBa,EAAA,EAAE,YAAA"}
@@ -1 +0,0 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`drizzle-orm`),t=require(`drizzle-orm/pg-core`);const n=(0,t.pgTable)(`users`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),email:(0,t.text)(`email`).notNull().unique(),name:(0,t.text)(`name`).notNull(),password:(0,t.text)(`password`),image:(0,t.text)(`image`),recovery_code:(0,t.bytea)(`recovery_code`).notNull(),emailVerifiedAt:(0,t.timestamp)(`email_verified_at`,{precision:3}),createdAt:(0,t.timestamp)(`created_at`,{precision:3}).notNull().defaultNow(),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3})}),r=(0,t.pgTable)(`roles`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),name:(0,t.text)(`name`).notNull().unique(),description:(0,t.text)(`description`)}),i=(0,t.pgTable)(`permissions`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),name:(0,t.text)(`name`).notNull().unique(),description:(0,t.text)(`description`)}),a=(0,t.pgTable)(`users_to_roles`,{userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`}),roleId:(0,t.text)(`role_id`).notNull().references(()=>r.id,{onDelete:`cascade`})},t=>[{pk:e.sql`PRIMARY KEY (${t.userId}, ${t.roleId})`}]),o=(0,t.pgTable)(`users_to_permissions`,{userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`}),permissionId:(0,t.text)(`permission_id`).notNull().references(()=>i.id,{onDelete:`cascade`})},t=>[{pk:e.sql`PRIMARY KEY (${t.userId}, ${t.permissionId})`}]),s=(0,t.pgTable)(`roles_to_permissions`,{roleId:(0,t.text)(`role_id`).notNull().references(()=>r.id,{onDelete:`cascade`}),permissionId:(0,t.text)(`permission_id`).notNull().references(()=>i.id,{onDelete:`cascade`})},t=>[{pk:e.sql`PRIMARY KEY (${t.roleId}, ${t.permissionId})`}]),c=(0,t.pgTable)(`sessions`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),active_organization_id:(0,t.text)(`active_organization_id`),userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`,onUpdate:`cascade`}),expiresAt:(0,t.timestamp)(`expires_at`,{precision:3}).notNull(),createdAt:(0,t.timestamp)(`created_at`,{precision:3}).notNull().defaultNow(),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3})}),l=(0,t.pgTable)(`email_verification_requests`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),email:(0,t.text)(`email`).notNull(),code:(0,t.text)(`code`).notNull(),userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`,onUpdate:`cascade`}),expiresAt:(0,t.timestamp)(`expires_at`,{precision:3}).notNull(),createdAt:(0,t.timestamp)(`created_at`,{precision:3}).notNull().defaultNow(),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3})}),u=(0,t.pgTable)(`password_reset_sessions`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),email:(0,t.text)(`email`).notNull(),code:(0,t.text)(`code`).notNull(),emailVerified:(0,t.boolean)(`emailVerified`).default(!1),userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`,onUpdate:`cascade`}),expiresAt:(0,t.timestamp)(`expires_at`,{precision:3}).notNull(),createdAt:(0,t.timestamp)(`created_at`,{precision:3}).notNull().defaultNow(),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3})}),d=(0,t.pgTable)(`notification`,{id:(0,t.text)(`id`).$defaultFn(()=>crypto.randomUUID()).notNull().primaryKey(),title:(0,t.text)(`title`).notNull(),content:(0,t.text)(`content`),target:(0,t.text)(`target`),type:(0,t.text)(`type`),isRead:(0,t.boolean)(`isRead`).notNull(),resourceId:(0,t.text)(`resource_id`),resourceType:(0,t.text)(`resource_type`),userId:(0,t.text)(`user_id`).notNull().references(()=>n.id,{onDelete:`cascade`,onUpdate:`cascade`}),createdAt:(0,t.timestamp)(`created_at`,{precision:3}).notNull().defaultNow(),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3})}),f=(0,t.pgTable)(`system_modules`,{id:(0,t.text)(`id`).notNull().primaryKey(),enabled:(0,t.boolean)(`enabled`).notNull().default(!1),installed:(0,t.boolean)(`installed`).notNull().default(!1),deleted:(0,t.boolean)(`deleted`).notNull().default(!1),system:(0,t.boolean)(`system`).notNull().default(!1),config:(0,t.text)(`config`),lastStep:(0,t.text)(`last_step`),updatedAt:(0,t.timestamp)(`updated_at`,{precision:3}).defaultNow()}),p=(0,e.defineRelations)({user:n,emailVerification:l,passwordResetSession:u,session:c,notification:d,systemModulesTable:f},e=>({user:{sessions:e.many.session({from:e.user.id,to:e.session.userId}),emailVerification:e.many.emailVerification({from:e.user.id,to:e.emailVerification.userId}),passwordResetSession:e.many.passwordResetSession({from:e.user.id,to:e.passwordResetSession.userId})},session:{user:e.one.user({from:e.session.userId,to:e.user.id})},emailVerification:{user:e.one.user({from:e.emailVerification.userId,to:e.user.id})},passwordResetSession:{user:e.one.user({from:e.passwordResetSession.userId,to:e.user.id})}})),m={userTable:n,rolesTable:r,permissionsTable:i,usersToRolesTable:a,usersToPermissionsTable:o,rolesToPermissionsTable:s,sessionTable:c,emailVerificationTable:l,passwordResetSessionTable:u,notificationTable:d,systemModulesTable:f};exports.coreSchema=m,exports.emailVerificationTable=l,exports.notificationTable=d,exports.passwordResetSessionTable=u,exports.permissionsTable=i,exports.relations=p,exports.rolesTable=r,exports.rolesToPermissionsTable=s,exports.sessionTable=c,exports.systemModulesTable=f,exports.userTable=n,exports.usersToPermissionsTable=o,exports.usersToRolesTable=a;