@kyro-cms/core 0.3.5 → 0.4.1

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 (78) hide show
  1. package/README.md +3 -3
  2. package/dist/api-handler.cjs +5 -5
  3. package/dist/api-handler.js +4 -4
  4. package/dist/{chunk-X3CU27OO.cjs → chunk-3FW6WVVP.cjs} +2 -17
  5. package/dist/chunk-3FW6WVVP.cjs.map +1 -0
  6. package/dist/{chunk-R4C4O4SE.cjs → chunk-3ZZPZYCM.cjs} +36 -61
  7. package/dist/chunk-3ZZPZYCM.cjs.map +1 -0
  8. package/dist/{chunk-Y3TM7WH7.js → chunk-C4JJEE42.js} +36 -61
  9. package/dist/chunk-C4JJEE42.js.map +1 -0
  10. package/dist/{chunk-2UOI5MUC.cjs → chunk-FWGHXRRI.cjs} +4 -4
  11. package/dist/{chunk-2UOI5MUC.cjs.map → chunk-FWGHXRRI.cjs.map} +1 -1
  12. package/dist/{chunk-DE7OQOMD.cjs → chunk-M4GFA2UQ.cjs} +19 -19
  13. package/dist/chunk-M4GFA2UQ.cjs.map +1 -0
  14. package/dist/{chunk-4UD44U4Z.js → chunk-OJBK3JYF.js} +18 -18
  15. package/dist/chunk-OJBK3JYF.js.map +1 -0
  16. package/dist/{chunk-5FTY2DLG.js → chunk-SAMZQVC2.js} +3 -3
  17. package/dist/{chunk-5FTY2DLG.js.map → chunk-SAMZQVC2.js.map} +1 -1
  18. package/dist/{chunk-RGIQKTZ7.js → chunk-YMG55RSX.js} +4 -18
  19. package/dist/chunk-YMG55RSX.js.map +1 -0
  20. package/dist/drizzle/index.cjs +10 -10
  21. package/dist/drizzle/index.js +2 -2
  22. package/dist/index.cjs +48 -55
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +6 -13
  25. package/dist/index.js.map +1 -1
  26. package/dist/rest/index.cjs +4 -4
  27. package/dist/rest/index.js +2 -2
  28. package/package.json +2 -14
  29. package/dist/WebhookService-118ZTFis.d.ts +0 -112
  30. package/dist/WebhookService-AefJfqX0.d.cts +0 -112
  31. package/dist/api-handler.d.cts +0 -9
  32. package/dist/api-handler.d.ts +0 -9
  33. package/dist/base-DvvNqnM-.d.cts +0 -73
  34. package/dist/base-eVegJ_Pr.d.ts +0 -73
  35. package/dist/chunk-4UD44U4Z.js.map +0 -1
  36. package/dist/chunk-DE7OQOMD.cjs.map +0 -1
  37. package/dist/chunk-R4C4O4SE.cjs.map +0 -1
  38. package/dist/chunk-RGIQKTZ7.js.map +0 -1
  39. package/dist/chunk-X3CU27OO.cjs.map +0 -1
  40. package/dist/chunk-Y3TM7WH7.js.map +0 -1
  41. package/dist/cli/index.d.cts +0 -1
  42. package/dist/cli/index.d.ts +0 -1
  43. package/dist/client.d.cts +0 -12
  44. package/dist/client.d.ts +0 -12
  45. package/dist/drizzle/index.d.cts +0 -135
  46. package/dist/drizzle/index.d.ts +0 -135
  47. package/dist/fields/index.d.cts +0 -27
  48. package/dist/fields/index.d.ts +0 -27
  49. package/dist/graphql/index.d.cts +0 -22
  50. package/dist/graphql/index.d.ts +0 -22
  51. package/dist/index-Bz9JqRGI.d.cts +0 -86
  52. package/dist/index-Bz9JqRGI.d.ts +0 -86
  53. package/dist/index-CLp-DRKA.d.ts +0 -64
  54. package/dist/index-DfO7G4kN.d.cts +0 -64
  55. package/dist/index.d.cts +0 -1363
  56. package/dist/index.d.ts +0 -1363
  57. package/dist/integration.d.cts +0 -27
  58. package/dist/integration.d.ts +0 -27
  59. package/dist/mongodb/index.d.cts +0 -63
  60. package/dist/mongodb/index.d.ts +0 -63
  61. package/dist/mysql-media-AI6YK767.cjs +0 -48
  62. package/dist/mysql-media-AI6YK767.cjs.map +0 -1
  63. package/dist/mysql-media-CDZUS7YX.js +0 -45
  64. package/dist/mysql-media-CDZUS7YX.js.map +0 -1
  65. package/dist/rest/index.d.cts +0 -57
  66. package/dist/rest/index.d.ts +0 -57
  67. package/dist/templates/index.d.cts +0 -59
  68. package/dist/templates/index.d.ts +0 -59
  69. package/dist/trpc/index.d.cts +0 -136
  70. package/dist/trpc/index.d.ts +0 -136
  71. package/dist/types-BnTm7oJG.d.cts +0 -130
  72. package/dist/types-BnTm7oJG.d.ts +0 -130
  73. package/dist/types-Bs1up4yP.d.ts +0 -461
  74. package/dist/types-J3R9nVsZ.d.cts +0 -461
  75. package/dist/types-VtjUxIMp.d.cts +0 -246
  76. package/dist/types-VtjUxIMp.d.ts +0 -246
  77. package/dist/ws/index.d.cts +0 -88
  78. package/dist/ws/index.d.ts +0 -88
@@ -1,136 +0,0 @@
1
- import { B as BaseAdapter, R as Request, m as User, b as FindResult } from '../types-Bs1up4yP.js';
2
- import { i as createWebhookService } from '../WebhookService-118ZTFis.js';
3
- import '../types-VtjUxIMp.js';
4
-
5
- interface ApiKeyContext {
6
- userId: string;
7
- user: Partial<User>;
8
- permissions: string[];
9
- apiKeyId: string;
10
- tenantId?: string;
11
- role?: string;
12
- }
13
- interface KyroContext {
14
- db: BaseAdapter;
15
- registry: any;
16
- user?: User;
17
- tenantID?: string;
18
- req: Request;
19
- apiKey?: ApiKeyContext;
20
- webhookService?: ReturnType<typeof createWebhookService>;
21
- settings?: Record<string, any>;
22
- [key: string]: any;
23
- }
24
- declare function createContext(options: {
25
- db: BaseAdapter;
26
- registry: any;
27
- req: Request;
28
- user?: User;
29
- tenantID?: string;
30
- settings?: Record<string, any>;
31
- }): Promise<KyroContext>;
32
-
33
- declare function createDynamicRouter(ctx: KyroContext): Record<string, any>;
34
- interface KyroRouter {
35
- [collectionSlug: string]: {
36
- find: (input: {
37
- where?: Record<string, any>;
38
- sort?: string;
39
- limit?: number;
40
- page?: number;
41
- depth?: number;
42
- select?: string[];
43
- }) => Promise<{
44
- docs: any[];
45
- totalDocs: number;
46
- limit: number;
47
- totalPages: number;
48
- page: number;
49
- pagingCounter: number;
50
- hasPrevPage: boolean;
51
- hasNextPage: boolean;
52
- prevPage: number | null;
53
- nextPage: number | null;
54
- }>;
55
- findByID: (input: {
56
- id: string;
57
- depth?: number;
58
- select?: string[];
59
- }) => Promise<any>;
60
- create: (input: {
61
- data: Record<string, any>;
62
- depth?: number;
63
- select?: string[];
64
- }) => Promise<{
65
- doc: any;
66
- }>;
67
- update: (input: {
68
- id: string;
69
- data: Record<string, any>;
70
- depth?: number;
71
- select?: string[];
72
- }) => Promise<{
73
- doc: any;
74
- }>;
75
- delete: (input: {
76
- id: string;
77
- }) => Promise<{
78
- doc: any;
79
- message: string;
80
- }>;
81
- count: (input: {
82
- where?: Record<string, any>;
83
- }) => Promise<{
84
- totalDocs: number;
85
- }>;
86
- };
87
- }
88
- declare function createKyroServer(ctx: KyroContext): KyroRouter;
89
-
90
- declare function createFindProcedure(ctx: KyroContext): (input: {
91
- collection: string;
92
- where?: Record<string, any>;
93
- sort?: string;
94
- limit?: number;
95
- page?: number;
96
- depth?: number;
97
- select?: string[];
98
- }) => Promise<FindResult<unknown>>;
99
- declare function createFindByIDProcedure(ctx: KyroContext): (input: {
100
- collection: string;
101
- id: string;
102
- depth?: number;
103
- select?: string[];
104
- }) => Promise<{}>;
105
- declare function createCreateProcedure(ctx: KyroContext): (input: {
106
- collection: string;
107
- data: Record<string, any>;
108
- depth?: number;
109
- select?: string[];
110
- }) => Promise<{
111
- doc: unknown;
112
- }>;
113
- declare function createUpdateProcedure(ctx: KyroContext): (input: {
114
- collection: string;
115
- id: string;
116
- data: Record<string, any>;
117
- depth?: number;
118
- select?: string[];
119
- }) => Promise<{
120
- doc: unknown;
121
- }>;
122
- declare function createDeleteProcedure(ctx: KyroContext): (input: {
123
- collection: string;
124
- id: string;
125
- }) => Promise<{
126
- doc: unknown;
127
- message: string;
128
- }>;
129
- declare function createCountProcedure(ctx: KyroContext): (input: {
130
- collection: string;
131
- where?: Record<string, any>;
132
- }) => Promise<{
133
- totalDocs: number;
134
- }>;
135
-
136
- export { type KyroContext, type KyroRouter, createContext, createCountProcedure, createCreateProcedure, createDeleteProcedure, createDynamicRouter, createFindByIDProcedure, createFindProcedure, createKyroServer, createUpdateProcedure };
@@ -1,130 +0,0 @@
1
- type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_update" | "api_key_rotate" | "api_key_delete" | "tenant_create" | "tenant_delete";
2
- interface AuditLog {
3
- id: string;
4
- timestamp: Date;
5
- action: AuditAction;
6
- userId?: string;
7
- userEmail?: string;
8
- role?: string;
9
- resource: string;
10
- resourceId?: string;
11
- changes?: {
12
- field: string;
13
- old: any;
14
- new: any;
15
- }[];
16
- ipAddress?: string;
17
- userAgent?: string;
18
- success: boolean;
19
- error?: string;
20
- metadata?: Record<string, any>;
21
- }
22
- interface AuditLogFilter {
23
- userId?: string;
24
- action?: AuditAction | AuditAction[];
25
- resource?: string;
26
- resourceId?: string;
27
- success?: boolean;
28
- startDate?: Date;
29
- endDate?: Date;
30
- limit?: number;
31
- offset?: number;
32
- }
33
-
34
- interface AuthUser {
35
- id: string;
36
- name?: string;
37
- email: string;
38
- passwordHash?: string;
39
- role: UserRole;
40
- tenantId?: string;
41
- emailVerified?: boolean;
42
- locked?: boolean;
43
- lastLogin?: string;
44
- failedLoginAttempts?: number;
45
- createdAt: string;
46
- updatedAt: string;
47
- }
48
- type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
49
- interface Session {
50
- id: string;
51
- userId: string;
52
- token: string;
53
- refreshToken?: string;
54
- expiresAt: string;
55
- createdAt: string;
56
- ipAddress?: string;
57
- userAgent?: string;
58
- }
59
- interface JWTPayload {
60
- sub: string;
61
- email: string;
62
- role: UserRole;
63
- tenantId?: string;
64
- iat?: number;
65
- exp?: number;
66
- sid?: string;
67
- }
68
- interface AuthTokenConfig {
69
- secret: string;
70
- expiresIn?: string | number;
71
- refreshExpiresIn?: string | number;
72
- issuer?: string;
73
- audience?: string[];
74
- saltRounds?: number;
75
- }
76
- interface LoginCredentials {
77
- email: string;
78
- password: string;
79
- }
80
- interface RegisterData {
81
- email: string;
82
- password: string;
83
- role?: UserRole;
84
- tenantId?: string;
85
- }
86
- interface AuthResult {
87
- success: boolean;
88
- user?: AuthUser;
89
- session?: Session;
90
- token?: string;
91
- error?: string;
92
- }
93
- interface AuthAdapter {
94
- createUser(data: {
95
- email: string;
96
- password: string;
97
- name?: string;
98
- role?: UserRole;
99
- tenantId?: string;
100
- }): Promise<AuthUser>;
101
- findUserByEmail(email: string): Promise<AuthUser | null>;
102
- findUserById(id: string): Promise<AuthUser | null>;
103
- updateUser(id: string, data: Partial<AuthUser> & {
104
- password?: string;
105
- }): Promise<AuthUser | null>;
106
- deleteUser(id: string): Promise<boolean>;
107
- verifyPassword(email: string, password: string): Promise<AuthUser | null>;
108
- hashPassword(password: string): Promise<string>;
109
- createSession(userId: string, data?: {
110
- ipAddress?: string;
111
- userAgent?: string;
112
- }): Promise<Session>;
113
- findSessionByToken(token: string): Promise<Session | null>;
114
- findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
115
- deleteSession(sessionId: string): Promise<boolean>;
116
- deleteUserSessions(userId: string): Promise<number>;
117
- hasAnyUsers?(): Promise<boolean>;
118
- connect?(): Promise<void>;
119
- disconnect?(): Promise<void>;
120
- addPasswordToHistory?(userId: string, passwordHash: string): Promise<void>;
121
- getPasswordHistory?(userId: string, count?: number): Promise<string[]>;
122
- isPasswordInHistory?(password: string, userId: string, historyCount?: number): Promise<boolean>;
123
- findAuditLogs(filter: AuditLogFilter): Promise<{
124
- logs: AuditLog[];
125
- total: number;
126
- }>;
127
- createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
128
- }
129
-
130
- export type { AuthAdapter as A, JWTPayload as J, LoginCredentials as L, RegisterData as R, Session as S, UserRole as U, AuthResult as a, AuthTokenConfig as b, AuthUser as c, AuditLog as d, AuditLogFilter as e, AuditAction as f };
@@ -1,130 +0,0 @@
1
- type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_update" | "api_key_rotate" | "api_key_delete" | "tenant_create" | "tenant_delete";
2
- interface AuditLog {
3
- id: string;
4
- timestamp: Date;
5
- action: AuditAction;
6
- userId?: string;
7
- userEmail?: string;
8
- role?: string;
9
- resource: string;
10
- resourceId?: string;
11
- changes?: {
12
- field: string;
13
- old: any;
14
- new: any;
15
- }[];
16
- ipAddress?: string;
17
- userAgent?: string;
18
- success: boolean;
19
- error?: string;
20
- metadata?: Record<string, any>;
21
- }
22
- interface AuditLogFilter {
23
- userId?: string;
24
- action?: AuditAction | AuditAction[];
25
- resource?: string;
26
- resourceId?: string;
27
- success?: boolean;
28
- startDate?: Date;
29
- endDate?: Date;
30
- limit?: number;
31
- offset?: number;
32
- }
33
-
34
- interface AuthUser {
35
- id: string;
36
- name?: string;
37
- email: string;
38
- passwordHash?: string;
39
- role: UserRole;
40
- tenantId?: string;
41
- emailVerified?: boolean;
42
- locked?: boolean;
43
- lastLogin?: string;
44
- failedLoginAttempts?: number;
45
- createdAt: string;
46
- updatedAt: string;
47
- }
48
- type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
49
- interface Session {
50
- id: string;
51
- userId: string;
52
- token: string;
53
- refreshToken?: string;
54
- expiresAt: string;
55
- createdAt: string;
56
- ipAddress?: string;
57
- userAgent?: string;
58
- }
59
- interface JWTPayload {
60
- sub: string;
61
- email: string;
62
- role: UserRole;
63
- tenantId?: string;
64
- iat?: number;
65
- exp?: number;
66
- sid?: string;
67
- }
68
- interface AuthTokenConfig {
69
- secret: string;
70
- expiresIn?: string | number;
71
- refreshExpiresIn?: string | number;
72
- issuer?: string;
73
- audience?: string[];
74
- saltRounds?: number;
75
- }
76
- interface LoginCredentials {
77
- email: string;
78
- password: string;
79
- }
80
- interface RegisterData {
81
- email: string;
82
- password: string;
83
- role?: UserRole;
84
- tenantId?: string;
85
- }
86
- interface AuthResult {
87
- success: boolean;
88
- user?: AuthUser;
89
- session?: Session;
90
- token?: string;
91
- error?: string;
92
- }
93
- interface AuthAdapter {
94
- createUser(data: {
95
- email: string;
96
- password: string;
97
- name?: string;
98
- role?: UserRole;
99
- tenantId?: string;
100
- }): Promise<AuthUser>;
101
- findUserByEmail(email: string): Promise<AuthUser | null>;
102
- findUserById(id: string): Promise<AuthUser | null>;
103
- updateUser(id: string, data: Partial<AuthUser> & {
104
- password?: string;
105
- }): Promise<AuthUser | null>;
106
- deleteUser(id: string): Promise<boolean>;
107
- verifyPassword(email: string, password: string): Promise<AuthUser | null>;
108
- hashPassword(password: string): Promise<string>;
109
- createSession(userId: string, data?: {
110
- ipAddress?: string;
111
- userAgent?: string;
112
- }): Promise<Session>;
113
- findSessionByToken(token: string): Promise<Session | null>;
114
- findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
115
- deleteSession(sessionId: string): Promise<boolean>;
116
- deleteUserSessions(userId: string): Promise<number>;
117
- hasAnyUsers?(): Promise<boolean>;
118
- connect?(): Promise<void>;
119
- disconnect?(): Promise<void>;
120
- addPasswordToHistory?(userId: string, passwordHash: string): Promise<void>;
121
- getPasswordHistory?(userId: string, count?: number): Promise<string[]>;
122
- isPasswordInHistory?(password: string, userId: string, historyCount?: number): Promise<boolean>;
123
- findAuditLogs(filter: AuditLogFilter): Promise<{
124
- logs: AuditLog[];
125
- total: number;
126
- }>;
127
- createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
128
- }
129
-
130
- export type { AuthAdapter as A, JWTPayload as J, LoginCredentials as L, RegisterData as R, Session as S, UserRole as U, AuthResult as a, AuthTokenConfig as b, AuthUser as c, AuditLog as d, AuditLogFilter as e, AuditAction as f };