@arch-cadre/core 0.0.23 → 0.0.26
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.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/_virtual/_rolldown/runtime.mjs +1 -18
- package/dist/core/auth/augment.cjs +1 -71
- package/dist/core/auth/augment.d.cts.map +1 -1
- package/dist/core/auth/augment.d.mts.map +1 -1
- package/dist/core/auth/augment.mjs +1 -65
- package/dist/core/auth/augment.mjs.map +1 -1
- package/dist/core/auth/email-verification.cjs +1 -99
- package/dist/core/auth/email-verification.d.cts +1 -1
- package/dist/core/auth/email-verification.d.mts +1 -1
- package/dist/core/auth/email-verification.mjs +1 -91
- package/dist/core/auth/email-verification.mjs.map +1 -1
- package/dist/core/auth/logic.cjs +1 -224
- package/dist/core/auth/logic.d.cts +6 -6
- package/dist/core/auth/logic.d.mts +6 -6
- package/dist/core/auth/logic.mjs +1 -212
- package/dist/core/auth/logic.mjs.map +1 -1
- package/dist/core/auth/password-reset.cjs +1 -118
- package/dist/core/auth/password-reset.mjs +1 -110
- package/dist/core/auth/password-reset.mjs.map +1 -1
- package/dist/core/auth/rbac.cjs +1 -118
- package/dist/core/auth/rbac.d.cts +2 -2
- package/dist/core/auth/rbac.d.mts +2 -2
- package/dist/core/auth/rbac.mjs +1 -103
- package/dist/core/auth/rbac.mjs.map +1 -1
- package/dist/core/auth/session.cjs +1 -154
- package/dist/core/auth/session.mjs +1 -142
- package/dist/core/auth/session.mjs.map +1 -1
- package/dist/core/auth/types.d.cts.map +1 -1
- package/dist/core/auth/types.d.mts.map +1 -1
- package/dist/core/auth/utils/encode.cjs +1 -27
- package/dist/core/auth/utils/encode.mjs +1 -25
- package/dist/core/auth/utils/encode.mjs.map +1 -1
- package/dist/core/auth/utils/encryption.cjs +1 -67
- package/dist/core/auth/utils/encryption.mjs +1 -63
- package/dist/core/auth/utils/encryption.mjs.map +1 -1
- package/dist/core/auth/validation.cjs +1 -39
- package/dist/core/auth/validation.mjs +1 -30
- package/dist/core/auth/validation.mjs.map +1 -1
- package/dist/core/bootstrap.cjs +1 -39
- package/dist/core/bootstrap.mjs +1 -39
- package/dist/core/bootstrap.mjs.map +1 -1
- package/dist/core/config.cjs +1 -6
- package/dist/core/config.mjs +1 -5
- package/dist/core/config.mjs.map +1 -1
- package/dist/core/config.server.cjs +1 -60
- package/dist/core/config.server.mjs +1 -56
- package/dist/core/config.server.mjs.map +1 -1
- package/dist/core/event-bus.cjs +1 -48
- package/dist/core/event-bus.d.cts.map +1 -1
- package/dist/core/event-bus.d.mts.map +1 -1
- package/dist/core/event-bus.mjs +1 -47
- package/dist/core/event-bus.mjs.map +1 -1
- package/dist/core/filesystem/index.cjs +1 -11
- package/dist/core/filesystem/index.mjs +1 -12
- package/dist/core/filesystem/index.mjs.map +1 -1
- package/dist/core/filesystem/providers/local.cjs +1 -43
- package/dist/core/filesystem/providers/local.mjs +1 -40
- package/dist/core/filesystem/providers/local.mjs.map +1 -1
- package/dist/core/filesystem/service.cjs +1 -43
- package/dist/core/filesystem/service.mjs +1 -42
- package/dist/core/filesystem/service.mjs.map +1 -1
- package/dist/core/notifications/actions.cjs +1 -36
- package/dist/core/notifications/actions.d.cts +1 -1
- package/dist/core/notifications/actions.d.mts +1 -1
- package/dist/core/notifications/actions.mjs +1 -32
- package/dist/core/notifications/actions.mjs.map +1 -1
- package/dist/core/notifications/index.cjs +1 -2
- package/dist/core/notifications/index.mjs +1 -4
- package/dist/core/notifications/service.cjs +1 -30
- package/dist/core/notifications/service.mjs +1 -30
- package/dist/core/notifications/service.mjs.map +1 -1
- package/dist/core/setup.cjs +1 -25
- package/dist/core/setup.mjs +1 -24
- package/dist/core/setup.mjs.map +1 -1
- package/dist/index.cjs +1 -30
- package/dist/index.mjs +1 -6
- package/dist/server/auth/email.cjs +1 -24
- package/dist/server/auth/email.mjs +1 -22
- package/dist/server/auth/email.mjs.map +1 -1
- package/dist/server/auth/password.cjs +1 -37
- package/dist/server/auth/password.mjs +1 -33
- package/dist/server/auth/password.mjs.map +1 -1
- package/dist/server/auth/user.cjs +1 -165
- package/dist/server/auth/user.mjs +1 -152
- package/dist/server/auth/user.mjs.map +1 -1
- package/dist/server/database/inject.cjs +1 -24
- package/dist/server/database/inject.mjs +1 -22
- package/dist/server/database/inject.mjs.map +1 -1
- package/dist/server/database/schema.cjs +1 -163
- package/dist/server/database/schema.mjs +1 -150
- package/dist/server/database/schema.mjs.map +1 -1
- package/dist/server/emails/index.cjs +1 -32
- package/dist/server/emails/index.mjs +1 -28
- package/dist/server/emails/index.mjs.map +1 -1
- package/dist/server.cjs +1 -145
- package/dist/server.mjs +1 -23
- package/package.json +1 -1
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/core/filesystem/service.ts
|
|
3
|
-
var FilesystemService = class {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.providers = /* @__PURE__ */ new Map();
|
|
6
|
-
this.defaultProviderId = null;
|
|
7
|
-
}
|
|
8
|
-
registerProvider(provider) {
|
|
9
|
-
this.providers.set(provider.id, provider);
|
|
10
|
-
if (!this.defaultProviderId || this.defaultProviderId === "local") this.defaultProviderId = provider.id;
|
|
11
|
-
console.log(`[Filesystem] Provider registered: ${provider.id}`);
|
|
12
|
-
}
|
|
13
|
-
unregisterProvider(id) {
|
|
14
|
-
this.providers.delete(id);
|
|
15
|
-
if (this.defaultProviderId === id) this.defaultProviderId = this.providers.has("local") ? "local" : Array.from(this.providers.keys())[0] || null;
|
|
16
|
-
console.log(`[Filesystem] Provider unregistered: ${id}`);
|
|
17
|
-
}
|
|
18
|
-
setDefaultProvider(id) {
|
|
19
|
-
if (this.providers.has(id)) {
|
|
20
|
-
this.defaultProviderId = id;
|
|
21
|
-
console.log(`[Filesystem] Default provider set to: ${id}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async upload(file, providerId) {
|
|
25
|
-
let id = providerId || this.defaultProviderId;
|
|
26
|
-
if (!id || !this.providers.has(id)) id = "local";
|
|
27
|
-
const provider = this.providers.get(id);
|
|
28
|
-
if (!provider) return { error: "No storage provider available (local fallback failed)" };
|
|
29
|
-
return await provider.upload(file);
|
|
30
|
-
}
|
|
31
|
-
getProviders() {
|
|
32
|
-
return Array.from(this.providers.values()).map((p) => ({
|
|
33
|
-
id: p.id,
|
|
34
|
-
name: p.name
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const globalForFilesystem = globalThis;
|
|
39
|
-
const filesystemService = globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ ?? new FilesystemService();
|
|
40
|
-
globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ = filesystemService;
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
exports.filesystemService = filesystemService;
|
|
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,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var FilesystemService = class {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.providers = /* @__PURE__ */ new Map();
|
|
5
|
-
this.defaultProviderId = null;
|
|
6
|
-
}
|
|
7
|
-
registerProvider(provider) {
|
|
8
|
-
this.providers.set(provider.id, provider);
|
|
9
|
-
if (!this.defaultProviderId || this.defaultProviderId === "local") this.defaultProviderId = provider.id;
|
|
10
|
-
console.log(`[Filesystem] Provider registered: ${provider.id}`);
|
|
11
|
-
}
|
|
12
|
-
unregisterProvider(id) {
|
|
13
|
-
this.providers.delete(id);
|
|
14
|
-
if (this.defaultProviderId === id) this.defaultProviderId = this.providers.has("local") ? "local" : Array.from(this.providers.keys())[0] || null;
|
|
15
|
-
console.log(`[Filesystem] Provider unregistered: ${id}`);
|
|
16
|
-
}
|
|
17
|
-
setDefaultProvider(id) {
|
|
18
|
-
if (this.providers.has(id)) {
|
|
19
|
-
this.defaultProviderId = id;
|
|
20
|
-
console.log(`[Filesystem] Default provider set to: ${id}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async upload(file, providerId) {
|
|
24
|
-
let id = providerId || this.defaultProviderId;
|
|
25
|
-
if (!id || !this.providers.has(id)) id = "local";
|
|
26
|
-
const provider = this.providers.get(id);
|
|
27
|
-
if (!provider) return { error: "No storage provider available (local fallback failed)" };
|
|
28
|
-
return await provider.upload(file);
|
|
29
|
-
}
|
|
30
|
-
getProviders() {
|
|
31
|
-
return Array.from(this.providers.values()).map((p) => ({
|
|
32
|
-
id: p.id,
|
|
33
|
-
name: p.name
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const globalForFilesystem = globalThis;
|
|
38
|
-
const filesystemService = globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ ?? new FilesystemService();
|
|
39
|
-
globalForFilesystem.__KRYO_FILESYSTEM_SERVICE__ = filesystemService;
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
42
|
-
export { filesystemService };
|
|
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};
|
|
43
2
|
//# sourceMappingURL=service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
1
|
+
{"version":3,"file":"service.mjs","names":[],"sources":["../../../src/core/filesystem/service.ts"],"sourcesContent":["import type { IStorageProvider, StorageResult } from \"./types.js\";\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,36 +1 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
|
|
3
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
-
const require_inject = require('../../server/database/inject.cjs');
|
|
5
|
-
const require_schema = require('../../server/database/schema.cjs');
|
|
6
|
-
const require_session = require('../auth/session.cjs');
|
|
7
|
-
let drizzle_orm = require("drizzle-orm");
|
|
8
|
-
|
|
9
|
-
//#region src/core/notifications/actions.ts
|
|
10
|
-
async function getUserNotifications() {
|
|
11
|
-
const { user } = await require_session.getCurrentSession();
|
|
12
|
-
if (!user) return null;
|
|
13
|
-
return await require_inject.db.select().from(require_schema.notificationTable).where((0, drizzle_orm.eq)(require_schema.notificationTable.userId, user.id)).orderBy((0, drizzle_orm.desc)(require_schema.notificationTable.createdAt));
|
|
14
|
-
}
|
|
15
|
-
async function createNotification(data) {
|
|
16
|
-
const [notification] = await require_inject.db.insert(require_schema.notificationTable).values({
|
|
17
|
-
...data,
|
|
18
|
-
isRead: false
|
|
19
|
-
}).returning();
|
|
20
|
-
return notification;
|
|
21
|
-
}
|
|
22
|
-
async function markNotificationAsRead(id) {
|
|
23
|
-
const [updated] = await require_inject.db.update(require_schema.notificationTable).set({ isRead: true }).where((0, drizzle_orm.eq)(require_schema.notificationTable.id, id)).returning();
|
|
24
|
-
return updated;
|
|
25
|
-
}
|
|
26
|
-
async function markAllNotificationsAsRead() {
|
|
27
|
-
const { user } = await require_session.getCurrentSession();
|
|
28
|
-
if (!user) return null;
|
|
29
|
-
return await require_inject.db.update(require_schema.notificationTable).set({ isRead: true }).where((0, drizzle_orm.eq)(require_schema.notificationTable.userId, user.id)).returning();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.createNotification = createNotification;
|
|
34
|
-
exports.getUserNotifications = getUserNotifications;
|
|
35
|
-
exports.markAllNotificationsAsRead = markAllNotificationsAsRead;
|
|
36
|
-
exports.markNotificationAsRead = markNotificationAsRead;
|
|
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;
|
|
@@ -15,11 +15,11 @@ declare function getUserNotifications(): Promise<{
|
|
|
15
15
|
updatedAt: Date | null;
|
|
16
16
|
}[] | null>;
|
|
17
17
|
declare function createNotification(data: CreateNotificationPayload): Promise<{
|
|
18
|
+
type: string | null;
|
|
18
19
|
id: string;
|
|
19
20
|
createdAt: Date;
|
|
20
21
|
updatedAt: Date | null;
|
|
21
22
|
userId: string;
|
|
22
|
-
type: string | null;
|
|
23
23
|
title: string;
|
|
24
24
|
content: string | null;
|
|
25
25
|
target: string | null;
|
|
@@ -15,11 +15,11 @@ declare function getUserNotifications(): Promise<{
|
|
|
15
15
|
updatedAt: Date | null;
|
|
16
16
|
}[] | null>;
|
|
17
17
|
declare function createNotification(data: CreateNotificationPayload): Promise<{
|
|
18
|
+
type: string | null;
|
|
18
19
|
id: string;
|
|
19
20
|
createdAt: Date;
|
|
20
21
|
updatedAt: Date | null;
|
|
21
22
|
userId: string;
|
|
22
|
-
type: string | null;
|
|
23
23
|
title: string;
|
|
24
24
|
content: string | null;
|
|
25
25
|
target: string | null;
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
|
|
3
|
-
import { db } from "../../server/database/inject.mjs";
|
|
4
|
-
import { notificationTable } from "../../server/database/schema.mjs";
|
|
5
|
-
import { getCurrentSession } from "../auth/session.mjs";
|
|
6
|
-
import { desc, eq } from "drizzle-orm";
|
|
7
|
-
|
|
8
|
-
//#region src/core/notifications/actions.ts
|
|
9
|
-
async function getUserNotifications() {
|
|
10
|
-
const { user } = await getCurrentSession();
|
|
11
|
-
if (!user) return null;
|
|
12
|
-
return await db.select().from(notificationTable).where(eq(notificationTable.userId, user.id)).orderBy(desc(notificationTable.createdAt));
|
|
13
|
-
}
|
|
14
|
-
async function createNotification(data) {
|
|
15
|
-
const [notification] = await db.insert(notificationTable).values({
|
|
16
|
-
...data,
|
|
17
|
-
isRead: false
|
|
18
|
-
}).returning();
|
|
19
|
-
return notification;
|
|
20
|
-
}
|
|
21
|
-
async function markNotificationAsRead(id) {
|
|
22
|
-
const [updated] = await db.update(notificationTable).set({ isRead: true }).where(eq(notificationTable.id, id)).returning();
|
|
23
|
-
return updated;
|
|
24
|
-
}
|
|
25
|
-
async function markAllNotificationsAsRead() {
|
|
26
|
-
const { user } = await getCurrentSession();
|
|
27
|
-
if (!user) return null;
|
|
28
|
-
return await db.update(notificationTable).set({ isRead: true }).where(eq(notificationTable.userId, user.id)).returning();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { createNotification, getUserNotifications, markAllNotificationsAsRead, markNotificationAsRead };
|
|
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};
|
|
33
2
|
//# sourceMappingURL=actions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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.js\";\nimport { notificationTable } from \"../../server/database/schema.js\";\nimport { getCurrentSession } from \"../auth/session.js\";\nimport type { CreateNotificationPayload } from \"./types.js\";\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,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const require_service = require('./service.cjs');
|
|
1
|
+
require(`./actions.cjs`),require(`./service.cjs`);
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { notificationService } from "./service.mjs";
|
|
3
|
-
|
|
4
|
-
export { };
|
|
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,30 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_actions = require('./actions.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/core/notifications/service.ts
|
|
5
|
-
var NotificationService = class {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.initialized = false;
|
|
8
|
-
}
|
|
9
|
-
init() {
|
|
10
|
-
if (this.initialized) return;
|
|
11
|
-
console.log("[Notification Service] Subscribing to notification:send...");
|
|
12
|
-
require_event_bus.eventBus.subscribe("notification:send", "notification-service", async (event) => {
|
|
13
|
-
console.log("[Notification Service] Received notification:send event", event.payload);
|
|
14
|
-
try {
|
|
15
|
-
const result = await require_actions.createNotification(event.payload);
|
|
16
|
-
console.log("[Notification Service] Notification created successfully:", result.id);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error("[Notification Service] Failed to process notification:send", error);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
this.initialized = true;
|
|
22
|
-
console.log("[NotificationService] Initialized and listening for events.");
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const globalForNotifications = globalThis;
|
|
26
|
-
const notificationService = globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ ?? new NotificationService();
|
|
27
|
-
globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ = notificationService;
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
exports.notificationService = notificationService;
|
|
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,31 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createNotification } from "./actions.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/core/notifications/service.ts
|
|
5
|
-
var NotificationService = class {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.initialized = false;
|
|
8
|
-
}
|
|
9
|
-
init() {
|
|
10
|
-
if (this.initialized) return;
|
|
11
|
-
console.log("[Notification Service] Subscribing to notification:send...");
|
|
12
|
-
eventBus.subscribe("notification:send", "notification-service", async (event) => {
|
|
13
|
-
console.log("[Notification Service] Received notification:send event", event.payload);
|
|
14
|
-
try {
|
|
15
|
-
const result = await createNotification(event.payload);
|
|
16
|
-
console.log("[Notification Service] Notification created successfully:", result.id);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.error("[Notification Service] Failed to process notification:send", error);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
this.initialized = true;
|
|
22
|
-
console.log("[NotificationService] Initialized and listening for events.");
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const globalForNotifications = globalThis;
|
|
26
|
-
const notificationService = globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ ?? new NotificationService();
|
|
27
|
-
globalForNotifications.__KRYO_NOTIFICATION_SERVICE__ = notificationService;
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { notificationService };
|
|
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};
|
|
31
2
|
//# sourceMappingURL=service.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
1
|
+
{"version":3,"file":"service.mjs","names":[],"sources":["../../../src/core/notifications/service.ts"],"sourcesContent":["import { eventBus } from \"../event-bus.js\";\nimport { createNotification } from \"./actions.js\";\nimport type { CreateNotificationPayload } from \"./types.js\";\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"}
|
package/dist/core/setup.cjs
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const require_inject = require('../server/database/inject.cjs');
|
|
3
|
-
const require_schema = require('../server/database/schema.cjs');
|
|
4
|
-
let drizzle_orm = require("drizzle-orm");
|
|
5
|
-
|
|
6
|
-
//#region src/core/setup.ts
|
|
7
|
-
/**
|
|
8
|
-
* Checks if the system is installed.
|
|
9
|
-
* A system is considered installed if at least one user exists in the database.
|
|
10
|
-
*/
|
|
11
|
-
async function isSystemInstalled() {
|
|
12
|
-
try {
|
|
13
|
-
console.log("[Kernel:Setup] Checking if system is installed...");
|
|
14
|
-
const result = await require_inject.db.select({ count: drizzle_orm.sql`count(*)` }).from(require_schema.userTable);
|
|
15
|
-
const count = Number(result[0]?.count || 0);
|
|
16
|
-
console.log(`[Kernel:Setup] User count: ${count}`);
|
|
17
|
-
return count > 0;
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.log(`[Kernel:Setup] System not installed or error: ${error.message}`);
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
exports.isSystemInstalled = isSystemInstalled;
|
|
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;
|
package/dist/core/setup.mjs
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { userTable } from "../server/database/schema.mjs";
|
|
3
|
-
import { sql } from "drizzle-orm";
|
|
4
|
-
|
|
5
|
-
//#region src/core/setup.ts
|
|
6
|
-
/**
|
|
7
|
-
* Checks if the system is installed.
|
|
8
|
-
* A system is considered installed if at least one user exists in the database.
|
|
9
|
-
*/
|
|
10
|
-
async function isSystemInstalled() {
|
|
11
|
-
try {
|
|
12
|
-
console.log("[Kernel:Setup] Checking if system is installed...");
|
|
13
|
-
const result = await db.select({ count: sql`count(*)` }).from(userTable);
|
|
14
|
-
const count = Number(result[0]?.count || 0);
|
|
15
|
-
console.log(`[Kernel:Setup] User count: ${count}`);
|
|
16
|
-
return count > 0;
|
|
17
|
-
} catch (error) {
|
|
18
|
-
console.log(`[Kernel:Setup] System not installed or error: ${error.message}`);
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { isSystemInstalled };
|
|
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};
|
|
25
2
|
//# sourceMappingURL=setup.mjs.map
|
package/dist/core/setup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":"
|
|
1
|
+
{"version":3,"file":"setup.mjs","names":[],"sources":["../../src/core/setup.ts"],"sourcesContent":["import { sql } from \"drizzle-orm\";\nimport { db } from \"../server/database/inject.js\";\nimport { userTable } from \"../server/database/schema.js\";\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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_validation = require('./core/auth/validation.cjs');
|
|
3
|
-
const require_event_bus = require('./core/event-bus.cjs');
|
|
4
|
-
const require_schema = require('./server/database/schema.cjs');
|
|
5
|
-
const require_service = require('./core/notifications/service.cjs');
|
|
6
|
-
|
|
7
|
-
exports.coreSchema = require_schema.coreSchema;
|
|
8
|
-
exports.emailVerificationTable = require_schema.emailVerificationTable;
|
|
9
|
-
exports.eventBus = require_event_bus.eventBus;
|
|
10
|
-
exports.forgotPasswordSchema = require_validation.forgotPasswordSchema;
|
|
11
|
-
exports.loginSchema = require_validation.loginSchema;
|
|
12
|
-
exports.notificationService = require_service.notificationService;
|
|
13
|
-
exports.notificationTable = require_schema.notificationTable;
|
|
14
|
-
exports.passkeysSetupSchema = require_validation.passkeysSetupSchema;
|
|
15
|
-
exports.passwordResetSessionTable = require_schema.passwordResetSessionTable;
|
|
16
|
-
exports.permissionsTable = require_schema.permissionsTable;
|
|
17
|
-
exports.recoveryCodeVerifySchema = require_validation.recoveryCodeVerifySchema;
|
|
18
|
-
exports.registerSchema = require_validation.registerSchema;
|
|
19
|
-
exports.relations = require_schema.relations;
|
|
20
|
-
exports.resetPasswordSchema = require_validation.resetPasswordSchema;
|
|
21
|
-
exports.rolesTable = require_schema.rolesTable;
|
|
22
|
-
exports.rolesToPermissionsTable = require_schema.rolesToPermissionsTable;
|
|
23
|
-
exports.sessionTable = require_schema.sessionTable;
|
|
24
|
-
exports.systemModulesTable = require_schema.systemModulesTable;
|
|
25
|
-
exports.totpSetupSchema = require_validation.totpSetupSchema;
|
|
26
|
-
exports.totpVerifySchema = require_validation.totpVerifySchema;
|
|
27
|
-
exports.userTable = require_schema.userTable;
|
|
28
|
-
exports.usersToPermissionsTable = require_schema.usersToPermissionsTable;
|
|
29
|
-
exports.usersToRolesTable = require_schema.usersToRolesTable;
|
|
30
|
-
exports.verifyEmailSchema = require_validation.verifyEmailSchema;
|
|
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.mjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { eventBus } from "./core/event-bus.mjs";
|
|
3
|
-
import { coreSchema, emailVerificationTable, notificationTable, passwordResetSessionTable, permissionsTable, relations, rolesTable, rolesToPermissionsTable, sessionTable, systemModulesTable, userTable, usersToPermissionsTable, usersToRolesTable } from "./server/database/schema.mjs";
|
|
4
|
-
import { notificationService } from "./core/notifications/service.mjs";
|
|
5
|
-
|
|
6
|
-
export { 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
|
+
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,24 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const require_inject = require('../database/inject.cjs');
|
|
3
|
-
const require_schema = require('../database/schema.cjs');
|
|
4
|
-
let drizzle_orm = require("drizzle-orm");
|
|
5
|
-
|
|
6
|
-
//#region src/server/auth/email.ts
|
|
7
|
-
/**
|
|
8
|
-
* Validates the email format and length.
|
|
9
|
-
*/
|
|
10
|
-
function verifyEmailInput(email) {
|
|
11
|
-
return /^.+@.+\..+$/.test(email) && email.length < 256 && email.length > 0;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Checks if an email address is already in use.
|
|
15
|
-
* @returns True if the email is available, false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
async function checkEmailAvailability(email) {
|
|
18
|
-
const [entries] = await require_inject.db.select({ count: (0, drizzle_orm.count)() }).from(require_schema.userTable).where((0, drizzle_orm.eq)(require_schema.userTable.email, email));
|
|
19
|
-
return entries.count === 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
exports.checkEmailAvailability = checkEmailAvailability;
|
|
24
|
-
exports.verifyEmailInput = verifyEmailInput;
|
|
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,23 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { userTable } from "../database/schema.mjs";
|
|
3
|
-
import { count, eq } from "drizzle-orm";
|
|
4
|
-
|
|
5
|
-
//#region src/server/auth/email.ts
|
|
6
|
-
/**
|
|
7
|
-
* Validates the email format and length.
|
|
8
|
-
*/
|
|
9
|
-
function verifyEmailInput(email) {
|
|
10
|
-
return /^.+@.+\..+$/.test(email) && email.length < 256 && email.length > 0;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Checks if an email address is already in use.
|
|
14
|
-
* @returns True if the email is available, false otherwise.
|
|
15
|
-
*/
|
|
16
|
-
async function checkEmailAvailability(email) {
|
|
17
|
-
const [entries] = await db.select({ count: count() }).from(userTable).where(eq(userTable.email, email));
|
|
18
|
-
return entries.count === 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { checkEmailAvailability, verifyEmailInput };
|
|
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};
|
|
23
2
|
//# sourceMappingURL=email.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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.js\";\nimport { userTable } from \"../database/schema.js\";\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"}
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
|
|
3
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
-
let bcryptjs = require("bcryptjs");
|
|
5
|
-
bcryptjs = require_runtime.__toESM(bcryptjs);
|
|
6
|
-
|
|
7
|
-
//#region src/server/auth/password.ts
|
|
8
|
-
/**
|
|
9
|
-
* Hashes the password using bcrypt.
|
|
10
|
-
* @param password Password to be hashed.
|
|
11
|
-
* @returns Returns the hashed password.
|
|
12
|
-
*/
|
|
13
|
-
async function hashPassword(password) {
|
|
14
|
-
return await bcryptjs.default.hash(password, 10);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Verifies the password hash.
|
|
18
|
-
* @param hash bcrypt hash.
|
|
19
|
-
* @param password Password for comparison.
|
|
20
|
-
* @returns Returns true if the password is correct, false otherwise.
|
|
21
|
-
*/
|
|
22
|
-
async function verifyPasswordHash(hash, password) {
|
|
23
|
-
return await bcryptjs.default.compare(password, hash);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Validates password strength.
|
|
27
|
-
* @param password Password to validate.
|
|
28
|
-
* @returns Returns true if the password meets complexity requirements.
|
|
29
|
-
*/
|
|
30
|
-
async function verifyPasswordStrength(password) {
|
|
31
|
-
return password.length >= 8 && password.length <= 255;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
|
-
exports.hashPassword = hashPassword;
|
|
36
|
-
exports.verifyPasswordHash = verifyPasswordHash;
|
|
37
|
-
exports.verifyPasswordStrength = verifyPasswordStrength;
|
|
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,34 +1,2 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
|
|
3
|
-
import bcrypt from "bcryptjs";
|
|
4
|
-
|
|
5
|
-
//#region src/server/auth/password.ts
|
|
6
|
-
/**
|
|
7
|
-
* Hashes the password using bcrypt.
|
|
8
|
-
* @param password Password to be hashed.
|
|
9
|
-
* @returns Returns the hashed password.
|
|
10
|
-
*/
|
|
11
|
-
async function hashPassword(password) {
|
|
12
|
-
return await bcrypt.hash(password, 10);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Verifies the password hash.
|
|
16
|
-
* @param hash bcrypt hash.
|
|
17
|
-
* @param password Password for comparison.
|
|
18
|
-
* @returns Returns true if the password is correct, false otherwise.
|
|
19
|
-
*/
|
|
20
|
-
async function verifyPasswordHash(hash, password) {
|
|
21
|
-
return await bcrypt.compare(password, hash);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Validates password strength.
|
|
25
|
-
* @param password Password to validate.
|
|
26
|
-
* @returns Returns true if the password meets complexity requirements.
|
|
27
|
-
*/
|
|
28
|
-
async function verifyPasswordStrength(password) {
|
|
29
|
-
return password.length >= 8 && password.length <= 255;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { hashPassword, verifyPasswordHash, verifyPasswordStrength };
|
|
1
|
+
"use server";import e from"bcryptjs";async function t(t){return await e.hash(t,10)}async function n(t,n){return await e.compare(n,t)}async function r(e){return e.length>=8&&e.length<=255}export{t as hashPassword,n as verifyPasswordHash,r as verifyPasswordStrength};
|
|
34
2
|
//# sourceMappingURL=password.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password.mjs","names":[],"sources":["../../../src/server/auth/password.ts"],"sourcesContent":["\"use server\";\n\nimport bcrypt from \"bcryptjs\";\n\n/**\n * Hashes the password using bcrypt.\n * @param password Password to be hashed.\n * @returns Returns the hashed password.\n */\nexport async function hashPassword(password: string): Promise<string> {\n const saltRounds = 10;\n return await bcrypt.hash(password, saltRounds);\n // return password;\n}\n\n/**\n * Verifies the password hash.\n * @param hash bcrypt hash.\n * @param password Password for comparison.\n * @returns Returns true if the password is correct, false otherwise.\n */\nexport async function verifyPasswordHash(\n hash: string,\n password: string,\n): Promise<boolean> {\n return await bcrypt.compare(password, hash);\n // return password === hash;\n}\n\n/**\n * Validates password strength.\n * @param password Password to validate.\n * @returns Returns true if the password meets complexity requirements.\n */\nexport async function verifyPasswordStrength(\n password: string,\n): Promise<boolean> {\n return password.length >= 8 && password.length <= 255;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"password.mjs","names":[],"sources":["../../../src/server/auth/password.ts"],"sourcesContent":["\"use server\";\n\nimport bcrypt from \"bcryptjs\";\n\n/**\n * Hashes the password using bcrypt.\n * @param password Password to be hashed.\n * @returns Returns the hashed password.\n */\nexport async function hashPassword(password: string): Promise<string> {\n const saltRounds = 10;\n return await bcrypt.hash(password, saltRounds);\n // return password;\n}\n\n/**\n * Verifies the password hash.\n * @param hash bcrypt hash.\n * @param password Password for comparison.\n * @returns Returns true if the password is correct, false otherwise.\n */\nexport async function verifyPasswordHash(\n hash: string,\n password: string,\n): Promise<boolean> {\n return await bcrypt.compare(password, hash);\n // return password === hash;\n}\n\n/**\n * Validates password strength.\n * @param password Password to validate.\n * @returns Returns true if the password meets complexity requirements.\n */\nexport async function verifyPasswordStrength(\n password: string,\n): Promise<boolean> {\n return password.length >= 8 && password.length <= 255;\n}\n"],"mappings":"qCASA,eAAsB,EAAa,EAAmC,CAEpE,OAAO,MAAM,EAAO,KAAK,EADN,GAC2B,CAUhD,eAAsB,EACpB,EACA,EACkB,CAClB,OAAO,MAAM,EAAO,QAAQ,EAAU,EAAK,CAS7C,eAAsB,EACpB,EACkB,CAClB,OAAO,EAAS,QAAU,GAAK,EAAS,QAAU"}
|