sa2kit 1.0.0

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 (218) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +298 -0
  3. package/dist/AliyunOSSProvider-7JLMJDXK.js +15 -0
  4. package/dist/AliyunOSSProvider-7JLMJDXK.js.map +1 -0
  5. package/dist/AliyunOSSProvider-GQMSDJGZ.mjs +6 -0
  6. package/dist/AliyunOSSProvider-GQMSDJGZ.mjs.map +1 -0
  7. package/dist/LocalStorageProvider-FVLLHBHO.mjs +6 -0
  8. package/dist/LocalStorageProvider-FVLLHBHO.mjs.map +1 -0
  9. package/dist/LocalStorageProvider-NBNHHWLY.js +15 -0
  10. package/dist/LocalStorageProvider-NBNHHWLY.js.map +1 -0
  11. package/dist/analytics/index.d.mts +1084 -0
  12. package/dist/analytics/index.d.ts +1084 -0
  13. package/dist/analytics/index.js +2595 -0
  14. package/dist/analytics/index.js.map +1 -0
  15. package/dist/analytics/index.mjs +2518 -0
  16. package/dist/analytics/index.mjs.map +1 -0
  17. package/dist/analytics/server/index.d.mts +499 -0
  18. package/dist/analytics/server/index.d.ts +499 -0
  19. package/dist/analytics/server/index.js +529 -0
  20. package/dist/analytics/server/index.js.map +1 -0
  21. package/dist/analytics/server/index.mjs +525 -0
  22. package/dist/analytics/server/index.mjs.map +1 -0
  23. package/dist/auth/client/index.d.mts +104 -0
  24. package/dist/auth/client/index.d.ts +104 -0
  25. package/dist/auth/client/index.js +21 -0
  26. package/dist/auth/client/index.js.map +1 -0
  27. package/dist/auth/client/index.mjs +4 -0
  28. package/dist/auth/client/index.mjs.map +1 -0
  29. package/dist/auth/components/index.d.mts +82 -0
  30. package/dist/auth/components/index.d.ts +82 -0
  31. package/dist/auth/components/index.js +93 -0
  32. package/dist/auth/components/index.js.map +1 -0
  33. package/dist/auth/components/index.mjs +86 -0
  34. package/dist/auth/components/index.mjs.map +1 -0
  35. package/dist/auth/hooks/index.d.mts +2 -0
  36. package/dist/auth/hooks/index.d.ts +2 -0
  37. package/dist/auth/hooks/index.js +17 -0
  38. package/dist/auth/hooks/index.js.map +1 -0
  39. package/dist/auth/hooks/index.mjs +4 -0
  40. package/dist/auth/hooks/index.mjs.map +1 -0
  41. package/dist/auth/index.d.mts +15 -0
  42. package/dist/auth/index.d.ts +15 -0
  43. package/dist/auth/index.js +110 -0
  44. package/dist/auth/index.js.map +1 -0
  45. package/dist/auth/index.mjs +9 -0
  46. package/dist/auth/index.mjs.map +1 -0
  47. package/dist/auth/middleware/index.d.mts +75 -0
  48. package/dist/auth/middleware/index.d.ts +75 -0
  49. package/dist/auth/middleware/index.js +15 -0
  50. package/dist/auth/middleware/index.js.map +1 -0
  51. package/dist/auth/middleware/index.mjs +6 -0
  52. package/dist/auth/middleware/index.mjs.map +1 -0
  53. package/dist/auth/routes/index.d.mts +163 -0
  54. package/dist/auth/routes/index.d.ts +163 -0
  55. package/dist/auth/routes/index.js +27 -0
  56. package/dist/auth/routes/index.js.map +1 -0
  57. package/dist/auth/routes/index.mjs +6 -0
  58. package/dist/auth/routes/index.mjs.map +1 -0
  59. package/dist/auth/schema/index.d.mts +789 -0
  60. package/dist/auth/schema/index.d.ts +789 -0
  61. package/dist/auth/schema/index.js +41 -0
  62. package/dist/auth/schema/index.js.map +1 -0
  63. package/dist/auth/schema/index.mjs +4 -0
  64. package/dist/auth/schema/index.mjs.map +1 -0
  65. package/dist/auth/services/index.d.mts +47 -0
  66. package/dist/auth/services/index.d.ts +47 -0
  67. package/dist/auth/services/index.js +34 -0
  68. package/dist/auth/services/index.js.map +1 -0
  69. package/dist/auth/services/index.mjs +5 -0
  70. package/dist/auth/services/index.mjs.map +1 -0
  71. package/dist/chunk-3RFBUDRA.js +507 -0
  72. package/dist/chunk-3RFBUDRA.js.map +1 -0
  73. package/dist/chunk-3XG5OHFD.mjs +37 -0
  74. package/dist/chunk-3XG5OHFD.mjs.map +1 -0
  75. package/dist/chunk-6BL3AZGD.js +285 -0
  76. package/dist/chunk-6BL3AZGD.js.map +1 -0
  77. package/dist/chunk-6FNUWAIV.js +394 -0
  78. package/dist/chunk-6FNUWAIV.js.map +1 -0
  79. package/dist/chunk-6PRFP5EG.js +171 -0
  80. package/dist/chunk-6PRFP5EG.js.map +1 -0
  81. package/dist/chunk-6VHWOPRR.mjs +90 -0
  82. package/dist/chunk-6VHWOPRR.mjs.map +1 -0
  83. package/dist/chunk-AIKEVVDR.mjs +122 -0
  84. package/dist/chunk-AIKEVVDR.mjs.map +1 -0
  85. package/dist/chunk-APY57REU.js +300 -0
  86. package/dist/chunk-APY57REU.js.map +1 -0
  87. package/dist/chunk-BJTO5JO5.mjs +10 -0
  88. package/dist/chunk-BJTO5JO5.mjs.map +1 -0
  89. package/dist/chunk-C64RY2OW.mjs +295 -0
  90. package/dist/chunk-C64RY2OW.mjs.map +1 -0
  91. package/dist/chunk-DGUM43GV.js +12 -0
  92. package/dist/chunk-DGUM43GV.js.map +1 -0
  93. package/dist/chunk-FV3FNHQY.js +92 -0
  94. package/dist/chunk-FV3FNHQY.js.map +1 -0
  95. package/dist/chunk-GSTLV3MB.mjs +316 -0
  96. package/dist/chunk-GSTLV3MB.mjs.map +1 -0
  97. package/dist/chunk-HEMA7SWK.mjs +212 -0
  98. package/dist/chunk-HEMA7SWK.mjs.map +1 -0
  99. package/dist/chunk-HWJ34NL6.js +43 -0
  100. package/dist/chunk-HWJ34NL6.js.map +1 -0
  101. package/dist/chunk-HXFFYNIF.mjs +385 -0
  102. package/dist/chunk-HXFFYNIF.mjs.map +1 -0
  103. package/dist/chunk-KGRQNEIR.mjs +183 -0
  104. package/dist/chunk-KGRQNEIR.mjs.map +1 -0
  105. package/dist/chunk-KH6RQ4J5.js +28 -0
  106. package/dist/chunk-KH6RQ4J5.js.map +1 -0
  107. package/dist/chunk-KQGP6BTS.mjs +165 -0
  108. package/dist/chunk-KQGP6BTS.mjs.map +1 -0
  109. package/dist/chunk-NMF4ANIC.js +365 -0
  110. package/dist/chunk-NMF4ANIC.js.map +1 -0
  111. package/dist/chunk-O26VCNS3.js +216 -0
  112. package/dist/chunk-O26VCNS3.js.map +1 -0
  113. package/dist/chunk-OLHGZXN3.mjs +86 -0
  114. package/dist/chunk-OLHGZXN3.mjs.map +1 -0
  115. package/dist/chunk-QU5OT4DF.js +88 -0
  116. package/dist/chunk-QU5OT4DF.js.map +1 -0
  117. package/dist/chunk-RCNNVNLT.mjs +356 -0
  118. package/dist/chunk-RCNNVNLT.mjs.map +1 -0
  119. package/dist/chunk-ROEYW4A7.js +186 -0
  120. package/dist/chunk-ROEYW4A7.js.map +1 -0
  121. package/dist/chunk-SVWQN2LR.js +131 -0
  122. package/dist/chunk-SVWQN2LR.js.map +1 -0
  123. package/dist/chunk-TKCYPDWU.js +338 -0
  124. package/dist/chunk-TKCYPDWU.js.map +1 -0
  125. package/dist/chunk-U2L6V7KD.mjs +273 -0
  126. package/dist/chunk-U2L6V7KD.mjs.map +1 -0
  127. package/dist/chunk-YVBU7QDJ.mjs +505 -0
  128. package/dist/chunk-YVBU7QDJ.mjs.map +1 -0
  129. package/dist/chunk-ZGVB35L2.mjs +25 -0
  130. package/dist/chunk-ZGVB35L2.mjs.map +1 -0
  131. package/dist/config/index.d.mts +64 -0
  132. package/dist/config/index.d.ts +64 -0
  133. package/dist/config/index.js +136 -0
  134. package/dist/config/index.js.map +1 -0
  135. package/dist/config/index.mjs +128 -0
  136. package/dist/config/index.mjs.map +1 -0
  137. package/dist/drizzle-auth-service-Bxlovhv8.d.ts +145 -0
  138. package/dist/drizzle-auth-service-DZY2F1sv.d.mts +145 -0
  139. package/dist/enums-Dume-V5Y.d.mts +16 -0
  140. package/dist/enums-Dume-V5Y.d.ts +16 -0
  141. package/dist/i18n/index.d.mts +416 -0
  142. package/dist/i18n/index.d.ts +416 -0
  143. package/dist/i18n/index.js +671 -0
  144. package/dist/i18n/index.js.map +1 -0
  145. package/dist/i18n/index.mjs +650 -0
  146. package/dist/i18n/index.mjs.map +1 -0
  147. package/dist/index-8VoHap_4.d.mts +105 -0
  148. package/dist/index-8VoHap_4.d.ts +105 -0
  149. package/dist/index.d.mts +4 -0
  150. package/dist/index.d.ts +4 -0
  151. package/dist/index.js +84 -0
  152. package/dist/index.js.map +1 -0
  153. package/dist/index.mjs +7 -0
  154. package/dist/index.mjs.map +1 -0
  155. package/dist/logger/index.d.mts +125 -0
  156. package/dist/logger/index.d.ts +125 -0
  157. package/dist/logger/index.js +29 -0
  158. package/dist/logger/index.js.map +1 -0
  159. package/dist/logger/index.mjs +4 -0
  160. package/dist/logger/index.mjs.map +1 -0
  161. package/dist/request/index.d.mts +51 -0
  162. package/dist/request/index.d.ts +51 -0
  163. package/dist/request/index.js +85 -0
  164. package/dist/request/index.js.map +1 -0
  165. package/dist/request/index.mjs +82 -0
  166. package/dist/request/index.mjs.map +1 -0
  167. package/dist/storage/index.d.mts +74 -0
  168. package/dist/storage/index.d.ts +74 -0
  169. package/dist/storage/index.js +46 -0
  170. package/dist/storage/index.js.map +1 -0
  171. package/dist/storage/index.mjs +5 -0
  172. package/dist/storage/index.mjs.map +1 -0
  173. package/dist/types-BINlP9MK.d.mts +286 -0
  174. package/dist/types-BINlP9MK.d.ts +286 -0
  175. package/dist/types-BaZccpvk.d.mts +48 -0
  176. package/dist/types-BaZccpvk.d.ts +48 -0
  177. package/dist/types-CbTsi9CZ.d.mts +31 -0
  178. package/dist/types-CbTsi9CZ.d.ts +31 -0
  179. package/dist/types-CoGG1rNV.d.mts +258 -0
  180. package/dist/types-CoGG1rNV.d.ts +258 -0
  181. package/dist/types-DAxQ1MeY.d.ts +70 -0
  182. package/dist/types-DT8LVCvE.d.mts +70 -0
  183. package/dist/types-DW9qar-w.d.mts +52 -0
  184. package/dist/types-DW9qar-w.d.ts +52 -0
  185. package/dist/universalExport/index.d.mts +235 -0
  186. package/dist/universalExport/index.d.ts +235 -0
  187. package/dist/universalExport/index.js +621 -0
  188. package/dist/universalExport/index.js.map +1 -0
  189. package/dist/universalExport/index.mjs +580 -0
  190. package/dist/universalExport/index.mjs.map +1 -0
  191. package/dist/universalExport/server/index.d.mts +429 -0
  192. package/dist/universalExport/server/index.d.ts +429 -0
  193. package/dist/universalExport/server/index.js +263 -0
  194. package/dist/universalExport/server/index.js.map +1 -0
  195. package/dist/universalExport/server/index.mjs +242 -0
  196. package/dist/universalExport/server/index.mjs.map +1 -0
  197. package/dist/universalFile/index.d.mts +310 -0
  198. package/dist/universalFile/index.d.ts +310 -0
  199. package/dist/universalFile/index.js +811 -0
  200. package/dist/universalFile/index.js.map +1 -0
  201. package/dist/universalFile/index.mjs +736 -0
  202. package/dist/universalFile/index.mjs.map +1 -0
  203. package/dist/universalFile/server/index.d.mts +2428 -0
  204. package/dist/universalFile/server/index.d.ts +2428 -0
  205. package/dist/universalFile/server/index.js +4578 -0
  206. package/dist/universalFile/server/index.js.map +1 -0
  207. package/dist/universalFile/server/index.mjs +4518 -0
  208. package/dist/universalFile/server/index.mjs.map +1 -0
  209. package/dist/useElectronStorage-Dj0rcorG.d.mts +65 -0
  210. package/dist/useElectronStorage-DwnNfIhl.d.ts +65 -0
  211. package/dist/utils/index.d.mts +188 -0
  212. package/dist/utils/index.d.ts +188 -0
  213. package/dist/utils/index.js +42 -0
  214. package/dist/utils/index.js.map +1 -0
  215. package/dist/utils/index.mjs +5 -0
  216. package/dist/utils/index.mjs.map +1 -0
  217. package/package.json +220 -0
  218. package/tailwind.animations.js +34 -0
@@ -0,0 +1,15 @@
1
+ export { U as UserRole, u as userRole } from '../enums-Dume-V5Y.mjs';
2
+ export { Account, NewAccount, NewSession, NewUser, NewVerification, Session, User, Verification, account, accountRelations, session, sessionRelations, user, userRelations, verifications } from './schema/index.mjs';
3
+ export { A as AuthResult, a as AuthServiceConfig, D as DrizzleAuthService, S as SessionInfo, U as UserInfo, V as VerifyResult } from '../drizzle-auth-service-DZY2F1sv.mjs';
4
+ export { JwtPayload, generateToken, getTokenFromRequest, hashPassword, verifyJwtToken, verifyPassword } from './services/index.mjs';
5
+ export { ApiResponse, BaseRouteConfig, LoginRouteConfig, RegisterRouteConfig, createLoginHandler, createLogoutHandler, createMeHandler, createRegisterHandler } from './routes/index.mjs';
6
+ export { AuthLevel, AuthMiddlewareConfig, RouteContext, RouteHandler, createAuthMiddleware } from './middleware/index.mjs';
7
+ export { L as LoginFormData, R as RegisterFormData, U as UseAuthReturn, u as useAuth, a as useAuthForm } from '../index-8VoHap_4.mjs';
8
+ export { BaseApiClient } from './client/index.mjs';
9
+ export { A as API_ROUTES, S as STORAGE_KEYS } from '../types-DW9qar-w.mjs';
10
+ export { L as LoginFormState, R as RegisterFormState } from '../types-DT8LVCvE.mjs';
11
+ import 'drizzle-orm/pg-core';
12
+ import 'drizzle-orm';
13
+ import 'react';
14
+ import '../types-BaZccpvk.mjs';
15
+ import '../types-CbTsi9CZ.mjs';
@@ -0,0 +1,15 @@
1
+ export { U as UserRole, u as userRole } from '../enums-Dume-V5Y.js';
2
+ export { Account, NewAccount, NewSession, NewUser, NewVerification, Session, User, Verification, account, accountRelations, session, sessionRelations, user, userRelations, verifications } from './schema/index.js';
3
+ export { A as AuthResult, a as AuthServiceConfig, D as DrizzleAuthService, S as SessionInfo, U as UserInfo, V as VerifyResult } from '../drizzle-auth-service-Bxlovhv8.js';
4
+ export { JwtPayload, generateToken, getTokenFromRequest, hashPassword, verifyJwtToken, verifyPassword } from './services/index.js';
5
+ export { ApiResponse, BaseRouteConfig, LoginRouteConfig, RegisterRouteConfig, createLoginHandler, createLogoutHandler, createMeHandler, createRegisterHandler } from './routes/index.js';
6
+ export { AuthLevel, AuthMiddlewareConfig, RouteContext, RouteHandler, createAuthMiddleware } from './middleware/index.js';
7
+ export { L as LoginFormData, R as RegisterFormData, U as UseAuthReturn, u as useAuth, a as useAuthForm } from '../index-8VoHap_4.js';
8
+ export { BaseApiClient } from './client/index.js';
9
+ export { A as API_ROUTES, S as STORAGE_KEYS } from '../types-DW9qar-w.js';
10
+ export { L as LoginFormState, R as RegisterFormState } from '../types-DAxQ1MeY.js';
11
+ import 'drizzle-orm/pg-core';
12
+ import 'drizzle-orm';
13
+ import 'react';
14
+ import '../types-BaZccpvk.js';
15
+ import '../types-CbTsi9CZ.js';
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ var chunkFV3FNHQY_js = require('../chunk-FV3FNHQY.js');
4
+ var chunkO26VCNS3_js = require('../chunk-O26VCNS3.js');
5
+ var chunkROEYW4A7_js = require('../chunk-ROEYW4A7.js');
6
+ var chunkAPY57REU_js = require('../chunk-APY57REU.js');
7
+ var chunk6BL3AZGD_js = require('../chunk-6BL3AZGD.js');
8
+ var chunkSVWQN2LR_js = require('../chunk-SVWQN2LR.js');
9
+ require('../chunk-DGUM43GV.js');
10
+
11
+
12
+
13
+ Object.defineProperty(exports, "createAuthMiddleware", {
14
+ enumerable: true,
15
+ get: function () { return chunkFV3FNHQY_js.createAuthMiddleware; }
16
+ });
17
+ Object.defineProperty(exports, "API_ROUTES", {
18
+ enumerable: true,
19
+ get: function () { return chunkO26VCNS3_js.API_ROUTES; }
20
+ });
21
+ Object.defineProperty(exports, "BaseApiClient", {
22
+ enumerable: true,
23
+ get: function () { return chunkO26VCNS3_js.BaseApiClient; }
24
+ });
25
+ Object.defineProperty(exports, "STORAGE_KEYS", {
26
+ enumerable: true,
27
+ get: function () { return chunkO26VCNS3_js.STORAGE_KEYS; }
28
+ });
29
+ Object.defineProperty(exports, "useAuth", {
30
+ enumerable: true,
31
+ get: function () { return chunkROEYW4A7_js.useAuth; }
32
+ });
33
+ Object.defineProperty(exports, "useAuthForm", {
34
+ enumerable: true,
35
+ get: function () { return chunkROEYW4A7_js.useAuthForm; }
36
+ });
37
+ Object.defineProperty(exports, "createLoginHandler", {
38
+ enumerable: true,
39
+ get: function () { return chunkAPY57REU_js.createLoginHandler; }
40
+ });
41
+ Object.defineProperty(exports, "createLogoutHandler", {
42
+ enumerable: true,
43
+ get: function () { return chunkAPY57REU_js.createLogoutHandler; }
44
+ });
45
+ Object.defineProperty(exports, "createMeHandler", {
46
+ enumerable: true,
47
+ get: function () { return chunkAPY57REU_js.createMeHandler; }
48
+ });
49
+ Object.defineProperty(exports, "createRegisterHandler", {
50
+ enumerable: true,
51
+ get: function () { return chunkAPY57REU_js.createRegisterHandler; }
52
+ });
53
+ Object.defineProperty(exports, "DrizzleAuthService", {
54
+ enumerable: true,
55
+ get: function () { return chunk6BL3AZGD_js.DrizzleAuthService; }
56
+ });
57
+ Object.defineProperty(exports, "generateToken", {
58
+ enumerable: true,
59
+ get: function () { return chunk6BL3AZGD_js.generateToken; }
60
+ });
61
+ Object.defineProperty(exports, "getTokenFromRequest", {
62
+ enumerable: true,
63
+ get: function () { return chunk6BL3AZGD_js.getTokenFromRequest; }
64
+ });
65
+ Object.defineProperty(exports, "hashPassword", {
66
+ enumerable: true,
67
+ get: function () { return chunk6BL3AZGD_js.hashPassword; }
68
+ });
69
+ Object.defineProperty(exports, "verifyJwtToken", {
70
+ enumerable: true,
71
+ get: function () { return chunk6BL3AZGD_js.verifyJwtToken; }
72
+ });
73
+ Object.defineProperty(exports, "verifyPassword", {
74
+ enumerable: true,
75
+ get: function () { return chunk6BL3AZGD_js.verifyPassword; }
76
+ });
77
+ Object.defineProperty(exports, "account", {
78
+ enumerable: true,
79
+ get: function () { return chunkSVWQN2LR_js.account; }
80
+ });
81
+ Object.defineProperty(exports, "accountRelations", {
82
+ enumerable: true,
83
+ get: function () { return chunkSVWQN2LR_js.accountRelations; }
84
+ });
85
+ Object.defineProperty(exports, "session", {
86
+ enumerable: true,
87
+ get: function () { return chunkSVWQN2LR_js.session; }
88
+ });
89
+ Object.defineProperty(exports, "sessionRelations", {
90
+ enumerable: true,
91
+ get: function () { return chunkSVWQN2LR_js.sessionRelations; }
92
+ });
93
+ Object.defineProperty(exports, "user", {
94
+ enumerable: true,
95
+ get: function () { return chunkSVWQN2LR_js.user; }
96
+ });
97
+ Object.defineProperty(exports, "userRelations", {
98
+ enumerable: true,
99
+ get: function () { return chunkSVWQN2LR_js.userRelations; }
100
+ });
101
+ Object.defineProperty(exports, "userRole", {
102
+ enumerable: true,
103
+ get: function () { return chunkSVWQN2LR_js.userRole; }
104
+ });
105
+ Object.defineProperty(exports, "verifications", {
106
+ enumerable: true,
107
+ get: function () { return chunkSVWQN2LR_js.verifications; }
108
+ });
109
+ //# sourceMappingURL=index.js.map
110
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,9 @@
1
+ export { createAuthMiddleware } from '../chunk-6VHWOPRR.mjs';
2
+ export { API_ROUTES, BaseApiClient, STORAGE_KEYS } from '../chunk-HEMA7SWK.mjs';
3
+ export { useAuth, useAuthForm } from '../chunk-KGRQNEIR.mjs';
4
+ export { createLoginHandler, createLogoutHandler, createMeHandler, createRegisterHandler } from '../chunk-C64RY2OW.mjs';
5
+ export { DrizzleAuthService, generateToken, getTokenFromRequest, hashPassword, verifyJwtToken, verifyPassword } from '../chunk-U2L6V7KD.mjs';
6
+ export { account, accountRelations, session, sessionRelations, user, userRelations, userRole, verifications } from '../chunk-AIKEVVDR.mjs';
7
+ import '../chunk-BJTO5JO5.mjs';
8
+ //# sourceMappingURL=index.mjs.map
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,75 @@
1
+ import { D as DrizzleAuthService, U as UserInfo, S as SessionInfo } from '../../drizzle-auth-service-DZY2F1sv.mjs';
2
+ import '../../enums-Dume-V5Y.mjs';
3
+ import 'drizzle-orm/pg-core';
4
+
5
+ /**
6
+ * Auth Middleware - Types
7
+ * 认证中间件类型定义
8
+ */
9
+
10
+ /**
11
+ * 认证级别
12
+ */
13
+ type AuthLevel = 'none' | 'user' | 'admin' | 'super_admin';
14
+ /**
15
+ * 路由上下文
16
+ */
17
+ interface RouteContext {
18
+ /**
19
+ * 用户信息(认证后注入)
20
+ */
21
+ user?: UserInfo;
22
+ /**
23
+ * 会话信息(认证后注入)
24
+ */
25
+ session?: SessionInfo;
26
+ /**
27
+ * 路由参数
28
+ */
29
+ params?: any;
30
+ }
31
+ /**
32
+ * 路由处理器
33
+ */
34
+ type RouteHandler = (request: Request, context: RouteContext) => Promise<Response>;
35
+ /**
36
+ * 认证中间件配置
37
+ */
38
+ interface AuthMiddlewareConfig {
39
+ /**
40
+ * 认证服务实例
41
+ */
42
+ authService: DrizzleAuthService;
43
+ }
44
+
45
+ /**
46
+ * Auth Middleware - withAuth
47
+ * 认证中间件
48
+ */
49
+
50
+ /**
51
+ * 创建认证中间件
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { createAuthMiddleware } from '@qhr123/sa2kit/auth/middleware';
56
+ *
57
+ * const { withAuth, requireAdmin } = createAuthMiddleware({
58
+ * authService: myAuthService,
59
+ * });
60
+ *
61
+ * // 使用中间件
62
+ * export const GET = requireAdmin(async (request, context) => {
63
+ * const { user } = context; // 自动注入用户信息
64
+ * // ... 业务逻辑
65
+ * });
66
+ * ```
67
+ */
68
+ declare function createAuthMiddleware(config: AuthMiddlewareConfig): {
69
+ withAuth: (handler: RouteHandler, level?: AuthLevel) => RouteHandler;
70
+ requireAuth: (handler: RouteHandler) => RouteHandler;
71
+ requireAdmin: (handler: RouteHandler) => RouteHandler;
72
+ requireSuperAdmin: (handler: RouteHandler) => RouteHandler;
73
+ };
74
+
75
+ export { type AuthLevel, type AuthMiddlewareConfig, type RouteContext, type RouteHandler, createAuthMiddleware };
@@ -0,0 +1,75 @@
1
+ import { D as DrizzleAuthService, U as UserInfo, S as SessionInfo } from '../../drizzle-auth-service-Bxlovhv8.js';
2
+ import '../../enums-Dume-V5Y.js';
3
+ import 'drizzle-orm/pg-core';
4
+
5
+ /**
6
+ * Auth Middleware - Types
7
+ * 认证中间件类型定义
8
+ */
9
+
10
+ /**
11
+ * 认证级别
12
+ */
13
+ type AuthLevel = 'none' | 'user' | 'admin' | 'super_admin';
14
+ /**
15
+ * 路由上下文
16
+ */
17
+ interface RouteContext {
18
+ /**
19
+ * 用户信息(认证后注入)
20
+ */
21
+ user?: UserInfo;
22
+ /**
23
+ * 会话信息(认证后注入)
24
+ */
25
+ session?: SessionInfo;
26
+ /**
27
+ * 路由参数
28
+ */
29
+ params?: any;
30
+ }
31
+ /**
32
+ * 路由处理器
33
+ */
34
+ type RouteHandler = (request: Request, context: RouteContext) => Promise<Response>;
35
+ /**
36
+ * 认证中间件配置
37
+ */
38
+ interface AuthMiddlewareConfig {
39
+ /**
40
+ * 认证服务实例
41
+ */
42
+ authService: DrizzleAuthService;
43
+ }
44
+
45
+ /**
46
+ * Auth Middleware - withAuth
47
+ * 认证中间件
48
+ */
49
+
50
+ /**
51
+ * 创建认证中间件
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { createAuthMiddleware } from '@qhr123/sa2kit/auth/middleware';
56
+ *
57
+ * const { withAuth, requireAdmin } = createAuthMiddleware({
58
+ * authService: myAuthService,
59
+ * });
60
+ *
61
+ * // 使用中间件
62
+ * export const GET = requireAdmin(async (request, context) => {
63
+ * const { user } = context; // 自动注入用户信息
64
+ * // ... 业务逻辑
65
+ * });
66
+ * ```
67
+ */
68
+ declare function createAuthMiddleware(config: AuthMiddlewareConfig): {
69
+ withAuth: (handler: RouteHandler, level?: AuthLevel) => RouteHandler;
70
+ requireAuth: (handler: RouteHandler) => RouteHandler;
71
+ requireAdmin: (handler: RouteHandler) => RouteHandler;
72
+ requireSuperAdmin: (handler: RouteHandler) => RouteHandler;
73
+ };
74
+
75
+ export { type AuthLevel, type AuthMiddlewareConfig, type RouteContext, type RouteHandler, createAuthMiddleware };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var chunkFV3FNHQY_js = require('../../chunk-FV3FNHQY.js');
4
+ require('../../chunk-6BL3AZGD.js');
5
+ require('../../chunk-SVWQN2LR.js');
6
+ require('../../chunk-DGUM43GV.js');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "createAuthMiddleware", {
11
+ enumerable: true,
12
+ get: function () { return chunkFV3FNHQY_js.createAuthMiddleware; }
13
+ });
14
+ //# sourceMappingURL=index.js.map
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,6 @@
1
+ export { createAuthMiddleware } from '../../chunk-6VHWOPRR.mjs';
2
+ import '../../chunk-U2L6V7KD.mjs';
3
+ import '../../chunk-AIKEVVDR.mjs';
4
+ import '../../chunk-BJTO5JO5.mjs';
5
+ //# sourceMappingURL=index.mjs.map
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,163 @@
1
+ import { D as DrizzleAuthService } from '../../drizzle-auth-service-DZY2F1sv.mjs';
2
+ import '../../enums-Dume-V5Y.mjs';
3
+ import 'drizzle-orm/pg-core';
4
+
5
+ /**
6
+ * Auth Routes - Types
7
+ * 路由处理器类型定义
8
+ */
9
+
10
+ /**
11
+ * 基础路由配置
12
+ */
13
+ interface BaseRouteConfig {
14
+ /**
15
+ * 认证服务实例
16
+ */
17
+ authService: DrizzleAuthService;
18
+ /**
19
+ * 可选的 Analytics 服务
20
+ */
21
+ analytics?: {
22
+ track: (eventName: string, properties: any) => Promise<void>;
23
+ };
24
+ /**
25
+ * CORS 配置
26
+ */
27
+ cors?: {
28
+ enabled?: boolean;
29
+ origin?: string | string[];
30
+ methods?: string[];
31
+ allowedHeaders?: string[];
32
+ credentials?: boolean;
33
+ };
34
+ }
35
+ /**
36
+ * 登录路由配置
37
+ */
38
+ interface LoginRouteConfig extends BaseRouteConfig {
39
+ /**
40
+ * Cookie 配置
41
+ */
42
+ cookieOptions?: {
43
+ name?: string;
44
+ httpOnly?: boolean;
45
+ secure?: boolean;
46
+ sameSite?: 'strict' | 'lax' | 'none';
47
+ maxAge?: number;
48
+ path?: string;
49
+ };
50
+ }
51
+ /**
52
+ * 注册路由配置
53
+ */
54
+ interface RegisterRouteConfig extends BaseRouteConfig {
55
+ /**
56
+ * 默认角色
57
+ */
58
+ defaultRole?: 'USER' | 'ADMIN' | 'SUPER_ADMIN';
59
+ /**
60
+ * 是否需要邮箱验证
61
+ */
62
+ emailVerificationRequired?: boolean;
63
+ /**
64
+ * Cookie 配置
65
+ */
66
+ cookieOptions?: {
67
+ name?: string;
68
+ httpOnly?: boolean;
69
+ secure?: boolean;
70
+ sameSite?: 'strict' | 'lax' | 'none';
71
+ maxAge?: number;
72
+ path?: string;
73
+ };
74
+ }
75
+ /**
76
+ * 标准 API 响应
77
+ */
78
+ interface ApiResponse<T = any> {
79
+ success: boolean;
80
+ data?: T;
81
+ error?: string;
82
+ message?: string;
83
+ }
84
+
85
+ /**
86
+ * Auth Routes - Login
87
+ * 登录路由处理器
88
+ */
89
+
90
+ /**
91
+ * 创建登录路由处理器
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { createLoginHandler } from '@qhr123/sa2kit/auth/routes';
96
+ *
97
+ * export const POST = createLoginHandler({
98
+ * authService: myAuthService,
99
+ * analytics: myAnalytics,
100
+ * });
101
+ * ```
102
+ */
103
+ declare function createLoginHandler(config: LoginRouteConfig): (request: Request) => Promise<Response>;
104
+
105
+ /**
106
+ * Auth Routes - Register
107
+ * 注册路由处理器
108
+ */
109
+
110
+ /**
111
+ * 创建注册路由处理器
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { createRegisterHandler } from '@qhr123/sa2kit/auth/routes';
116
+ *
117
+ * export const POST = createRegisterHandler({
118
+ * authService: myAuthService,
119
+ * defaultRole: 'USER',
120
+ * });
121
+ * ```
122
+ */
123
+ declare function createRegisterHandler(config: RegisterRouteConfig): (request: Request) => Promise<Response>;
124
+
125
+ /**
126
+ * Auth Routes - Me
127
+ * 获取当前用户信息路由处理器
128
+ */
129
+
130
+ /**
131
+ * 创建获取当前用户信息路由处理器
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * import { createMeHandler } from '@qhr123/sa2kit/auth/routes';
136
+ *
137
+ * export const GET = createMeHandler({
138
+ * authService: myAuthService,
139
+ * });
140
+ * ```
141
+ */
142
+ declare function createMeHandler(config: BaseRouteConfig): (request: Request) => Promise<Response>;
143
+
144
+ /**
145
+ * Auth Routes - Logout
146
+ * 登出路由处理器
147
+ */
148
+
149
+ /**
150
+ * 创建登出路由处理器
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { createLogoutHandler } from '@qhr123/sa2kit/auth/routes';
155
+ *
156
+ * export const POST = createLogoutHandler({
157
+ * authService: myAuthService,
158
+ * });
159
+ * ```
160
+ */
161
+ declare function createLogoutHandler(config: BaseRouteConfig): (request: Request) => Promise<Response>;
162
+
163
+ export { type ApiResponse, type BaseRouteConfig, type LoginRouteConfig, type RegisterRouteConfig, createLoginHandler, createLogoutHandler, createMeHandler, createRegisterHandler };
@@ -0,0 +1,163 @@
1
+ import { D as DrizzleAuthService } from '../../drizzle-auth-service-Bxlovhv8.js';
2
+ import '../../enums-Dume-V5Y.js';
3
+ import 'drizzle-orm/pg-core';
4
+
5
+ /**
6
+ * Auth Routes - Types
7
+ * 路由处理器类型定义
8
+ */
9
+
10
+ /**
11
+ * 基础路由配置
12
+ */
13
+ interface BaseRouteConfig {
14
+ /**
15
+ * 认证服务实例
16
+ */
17
+ authService: DrizzleAuthService;
18
+ /**
19
+ * 可选的 Analytics 服务
20
+ */
21
+ analytics?: {
22
+ track: (eventName: string, properties: any) => Promise<void>;
23
+ };
24
+ /**
25
+ * CORS 配置
26
+ */
27
+ cors?: {
28
+ enabled?: boolean;
29
+ origin?: string | string[];
30
+ methods?: string[];
31
+ allowedHeaders?: string[];
32
+ credentials?: boolean;
33
+ };
34
+ }
35
+ /**
36
+ * 登录路由配置
37
+ */
38
+ interface LoginRouteConfig extends BaseRouteConfig {
39
+ /**
40
+ * Cookie 配置
41
+ */
42
+ cookieOptions?: {
43
+ name?: string;
44
+ httpOnly?: boolean;
45
+ secure?: boolean;
46
+ sameSite?: 'strict' | 'lax' | 'none';
47
+ maxAge?: number;
48
+ path?: string;
49
+ };
50
+ }
51
+ /**
52
+ * 注册路由配置
53
+ */
54
+ interface RegisterRouteConfig extends BaseRouteConfig {
55
+ /**
56
+ * 默认角色
57
+ */
58
+ defaultRole?: 'USER' | 'ADMIN' | 'SUPER_ADMIN';
59
+ /**
60
+ * 是否需要邮箱验证
61
+ */
62
+ emailVerificationRequired?: boolean;
63
+ /**
64
+ * Cookie 配置
65
+ */
66
+ cookieOptions?: {
67
+ name?: string;
68
+ httpOnly?: boolean;
69
+ secure?: boolean;
70
+ sameSite?: 'strict' | 'lax' | 'none';
71
+ maxAge?: number;
72
+ path?: string;
73
+ };
74
+ }
75
+ /**
76
+ * 标准 API 响应
77
+ */
78
+ interface ApiResponse<T = any> {
79
+ success: boolean;
80
+ data?: T;
81
+ error?: string;
82
+ message?: string;
83
+ }
84
+
85
+ /**
86
+ * Auth Routes - Login
87
+ * 登录路由处理器
88
+ */
89
+
90
+ /**
91
+ * 创建登录路由处理器
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { createLoginHandler } from '@qhr123/sa2kit/auth/routes';
96
+ *
97
+ * export const POST = createLoginHandler({
98
+ * authService: myAuthService,
99
+ * analytics: myAnalytics,
100
+ * });
101
+ * ```
102
+ */
103
+ declare function createLoginHandler(config: LoginRouteConfig): (request: Request) => Promise<Response>;
104
+
105
+ /**
106
+ * Auth Routes - Register
107
+ * 注册路由处理器
108
+ */
109
+
110
+ /**
111
+ * 创建注册路由处理器
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { createRegisterHandler } from '@qhr123/sa2kit/auth/routes';
116
+ *
117
+ * export const POST = createRegisterHandler({
118
+ * authService: myAuthService,
119
+ * defaultRole: 'USER',
120
+ * });
121
+ * ```
122
+ */
123
+ declare function createRegisterHandler(config: RegisterRouteConfig): (request: Request) => Promise<Response>;
124
+
125
+ /**
126
+ * Auth Routes - Me
127
+ * 获取当前用户信息路由处理器
128
+ */
129
+
130
+ /**
131
+ * 创建获取当前用户信息路由处理器
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * import { createMeHandler } from '@qhr123/sa2kit/auth/routes';
136
+ *
137
+ * export const GET = createMeHandler({
138
+ * authService: myAuthService,
139
+ * });
140
+ * ```
141
+ */
142
+ declare function createMeHandler(config: BaseRouteConfig): (request: Request) => Promise<Response>;
143
+
144
+ /**
145
+ * Auth Routes - Logout
146
+ * 登出路由处理器
147
+ */
148
+
149
+ /**
150
+ * 创建登出路由处理器
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * import { createLogoutHandler } from '@qhr123/sa2kit/auth/routes';
155
+ *
156
+ * export const POST = createLogoutHandler({
157
+ * authService: myAuthService,
158
+ * });
159
+ * ```
160
+ */
161
+ declare function createLogoutHandler(config: BaseRouteConfig): (request: Request) => Promise<Response>;
162
+
163
+ export { type ApiResponse, type BaseRouteConfig, type LoginRouteConfig, type RegisterRouteConfig, createLoginHandler, createLogoutHandler, createMeHandler, createRegisterHandler };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var chunkAPY57REU_js = require('../../chunk-APY57REU.js');
4
+ require('../../chunk-6BL3AZGD.js');
5
+ require('../../chunk-SVWQN2LR.js');
6
+ require('../../chunk-DGUM43GV.js');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "createLoginHandler", {
11
+ enumerable: true,
12
+ get: function () { return chunkAPY57REU_js.createLoginHandler; }
13
+ });
14
+ Object.defineProperty(exports, "createLogoutHandler", {
15
+ enumerable: true,
16
+ get: function () { return chunkAPY57REU_js.createLogoutHandler; }
17
+ });
18
+ Object.defineProperty(exports, "createMeHandler", {
19
+ enumerable: true,
20
+ get: function () { return chunkAPY57REU_js.createMeHandler; }
21
+ });
22
+ Object.defineProperty(exports, "createRegisterHandler", {
23
+ enumerable: true,
24
+ get: function () { return chunkAPY57REU_js.createRegisterHandler; }
25
+ });
26
+ //# sourceMappingURL=index.js.map
27
+ //# sourceMappingURL=index.js.map