@archlast/server 0.1.7 → 0.1.9

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 (372) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +14 -10
  3. package/dist/admin/auth.d.ts +24 -5
  4. package/dist/admin/auth.js +49 -25
  5. package/dist/admin/schema.d.ts +122 -32
  6. package/dist/admin/schema.js +131 -95
  7. package/dist/admin/seed.d.ts +1 -1
  8. package/dist/admin/seed.js +79 -47
  9. package/dist/auth/api-key-resolver.d.ts +1 -1
  10. package/dist/auth/api-key-resolver.js +7 -3
  11. package/dist/auth/archlast-auth-adapter.d.ts +2 -5
  12. package/dist/auth/archlast-auth-adapter.js +1 -1
  13. package/dist/auth/better-auth-adapter.d.ts.map +1 -1
  14. package/dist/auth/better-auth-adapter.js +41 -26
  15. package/dist/auth/better-auth-adapter.js.map +1 -1
  16. package/dist/auth/better-auth-admin.d.ts.map +1 -1
  17. package/dist/auth/better-auth-admin.js +1 -1
  18. package/dist/auth/better-auth-admin.js.map +1 -1
  19. package/dist/auth/better-auth-api-key-resolver.js +1 -1
  20. package/dist/auth/better-auth-api-key-resolver.js.map +1 -1
  21. package/dist/auth/better-auth-instance.d.ts +247 -303
  22. package/dist/auth/better-auth-instance.d.ts.map +1 -1
  23. package/dist/auth/better-auth-instance.js +11 -0
  24. package/dist/auth/better-auth-instance.js.map +1 -1
  25. package/dist/auth/better-auth-seed.d.ts +5 -2
  26. package/dist/auth/better-auth-seed.js +31 -22
  27. package/dist/auth/better-auth-session-adapter.d.ts.map +1 -1
  28. package/dist/auth/better-auth-session-adapter.js +14 -10
  29. package/dist/auth/better-auth-session-adapter.js.map +1 -1
  30. package/dist/auth/errors.d.ts.map +1 -1
  31. package/dist/auth/errors.js +11 -11
  32. package/dist/auth/errors.js.map +1 -1
  33. package/dist/auth/oauth-proxy.d.ts +5 -2
  34. package/dist/auth/oauth-proxy.js +23 -27
  35. package/dist/auth/resolver.d.ts.map +1 -1
  36. package/dist/auth/resolver.js.map +1 -1
  37. package/dist/auth/role-helpers.d.ts +1 -1
  38. package/dist/auth/role-helpers.d.ts.map +1 -1
  39. package/dist/auth/role-helpers.js.map +1 -1
  40. package/dist/auth/session-manager.d.ts +2 -5
  41. package/dist/auth/session-manager.js +16 -6
  42. package/dist/auth/system/better-auth-schema.d.ts.map +1 -1
  43. package/dist/auth/system/better-auth-schema.js +6 -23
  44. package/dist/auth/system/better-auth-schema.js.map +1 -1
  45. package/dist/cache/circuit-breaker.d.ts +81 -0
  46. package/dist/cache/circuit-breaker.d.ts.map +1 -0
  47. package/dist/cache/circuit-breaker.js +170 -0
  48. package/dist/cache/circuit-breaker.js.map +1 -0
  49. package/dist/cache/client.d.ts +6 -3
  50. package/dist/cache/client.d.ts.map +1 -1
  51. package/dist/cache/client.js +12 -53
  52. package/dist/cache/client.js.map +1 -1
  53. package/dist/cache/index.d.ts +2 -0
  54. package/dist/cache/index.d.ts.map +1 -1
  55. package/dist/cache/index.js +5 -1
  56. package/dist/cache/index.js.map +1 -1
  57. package/dist/cache/invalidation-queue.d.ts +63 -0
  58. package/dist/cache/invalidation-queue.d.ts.map +1 -0
  59. package/dist/cache/invalidation-queue.js +196 -0
  60. package/dist/cache/invalidation-queue.js.map +1 -0
  61. package/dist/cache/layers.d.ts +14 -4
  62. package/dist/cache/layers.d.ts.map +1 -1
  63. package/dist/cache/layers.js +66 -72
  64. package/dist/cache/layers.js.map +1 -1
  65. package/dist/cache/manager.d.ts.map +1 -1
  66. package/dist/cache/manager.js +6 -41
  67. package/dist/cache/manager.js.map +1 -1
  68. package/dist/cache/protocol.d.ts +4 -39
  69. package/dist/cache/protocol.d.ts.map +1 -1
  70. package/dist/cache/protocol.js.map +1 -1
  71. package/dist/cache/redis-adapter.d.ts +103 -0
  72. package/dist/cache/redis-adapter.d.ts.map +1 -0
  73. package/dist/cache/redis-adapter.js +424 -0
  74. package/dist/cache/redis-adapter.js.map +1 -0
  75. package/dist/cache/run-sidecar.js +10 -1
  76. package/dist/cache/run-sidecar.js.map +1 -1
  77. package/dist/cache/sidecar-server.d.ts +51 -1
  78. package/dist/cache/sidecar-server.d.ts.map +1 -1
  79. package/dist/cache/sidecar-server.js +368 -22
  80. package/dist/cache/sidecar-server.js.map +1 -1
  81. package/dist/cache/store.d.ts +43 -0
  82. package/dist/cache/store.d.ts.map +1 -1
  83. package/dist/cache/store.js +69 -76
  84. package/dist/cache/store.js.map +1 -1
  85. package/dist/cache/strategies.d.ts +2 -9
  86. package/dist/cache/strategies.d.ts.map +1 -1
  87. package/dist/cache/types.d.ts +130 -0
  88. package/dist/cache/types.d.ts.map +1 -0
  89. package/dist/cache/types.js +60 -0
  90. package/dist/cache/types.js.map +1 -0
  91. package/dist/config/bullmq.d.ts +16 -0
  92. package/dist/config/bullmq.d.ts.map +1 -0
  93. package/dist/config/bullmq.js +103 -0
  94. package/dist/config/bullmq.js.map +1 -0
  95. package/dist/config/index.d.ts +1 -0
  96. package/dist/config/index.d.ts.map +1 -1
  97. package/dist/config/index.js +1 -0
  98. package/dist/config/index.js.map +1 -1
  99. package/dist/config/schema.d.ts +80 -6
  100. package/dist/config/schema.d.ts.map +1 -1
  101. package/dist/config/schema.js +71 -6
  102. package/dist/config/schema.js.map +1 -1
  103. package/dist/config/service.d.ts +54 -4
  104. package/dist/config/service.d.ts.map +1 -1
  105. package/dist/config/service.js +56 -2
  106. package/dist/config/service.js.map +1 -1
  107. package/dist/controllers/admin/admin-tokens.controller.d.ts +131 -115
  108. package/dist/controllers/admin/admin-tokens.controller.js +117 -98
  109. package/dist/controllers/admin/api-keys.controller.d.ts +1 -1
  110. package/dist/controllers/admin/api-keys.controller.d.ts.map +1 -1
  111. package/dist/controllers/admin/api-keys.controller.js.map +1 -1
  112. package/dist/controllers/admin/app-users.controller.d.ts +274 -243
  113. package/dist/controllers/admin/app-users.controller.js +301 -257
  114. package/dist/controllers/admin/auth.controller.d.ts +260 -236
  115. package/dist/controllers/admin/auth.controller.js +197 -174
  116. package/dist/controllers/admin/backup.controller.d.ts.map +1 -1
  117. package/dist/controllers/admin/backup.controller.js.map +1 -1
  118. package/dist/controllers/admin/settings.controller.d.ts +1 -1
  119. package/dist/controllers/admin/storage-stats.controller.d.ts +63 -0
  120. package/dist/controllers/admin/storage-stats.controller.d.ts.map +1 -0
  121. package/dist/controllers/admin/storage-stats.controller.js +33 -0
  122. package/dist/controllers/admin/storage-stats.controller.js.map +1 -0
  123. package/dist/controllers/admin/tenants.controller.d.ts.map +1 -1
  124. package/dist/controllers/admin/tenants.controller.js.map +1 -1
  125. package/dist/controllers/admin/users.controller.d.ts +1 -1
  126. package/dist/controllers/admin/users.controller.d.ts.map +1 -1
  127. package/dist/controllers/admin/users.controller.js.map +1 -1
  128. package/dist/controllers/auth.controller.d.ts +289 -271
  129. package/dist/controllers/auth.controller.js +275 -226
  130. package/dist/controllers/crud-generator.controller.d.ts.map +1 -1
  131. package/dist/controllers/crud-generator.controller.js +4 -2
  132. package/dist/controllers/crud-generator.controller.js.map +1 -1
  133. package/dist/controllers/index.d.ts +1 -1
  134. package/dist/controllers/index.d.ts.map +1 -1
  135. package/dist/controllers/index.js.map +1 -1
  136. package/dist/controllers/introspection.controller.d.ts +666 -0
  137. package/dist/controllers/introspection.controller.d.ts.map +1 -1
  138. package/dist/controllers/introspection.controller.js +628 -0
  139. package/dist/controllers/introspection.controller.js.map +1 -1
  140. package/dist/controllers/invite.controller.d.ts +190 -170
  141. package/dist/controllers/invite.controller.js +183 -164
  142. package/dist/controllers/mfa.controller.d.ts +205 -183
  143. package/dist/controllers/mfa.controller.js +131 -111
  144. package/dist/controllers/otp.controller.d.ts +194 -171
  145. package/dist/controllers/otp.controller.js +192 -175
  146. package/dist/controllers/storage.controller.d.ts.map +1 -1
  147. package/dist/controllers/storage.controller.js.map +1 -1
  148. package/dist/controllers/system.controller.d.ts +21 -3
  149. package/dist/controllers/system.controller.d.ts.map +1 -1
  150. package/dist/controllers/system.controller.js +32 -2
  151. package/dist/controllers/system.controller.js.map +1 -1
  152. package/dist/controllers/tenant.controller.d.ts +258 -227
  153. package/dist/controllers/tenant.controller.js +224 -200
  154. package/dist/db/cachedclient.d.ts +6 -11
  155. package/dist/db/cachedclient.d.ts.map +1 -1
  156. package/dist/db/cachedclient.js +79 -43
  157. package/dist/db/cachedclient.js.map +1 -1
  158. package/dist/db/distributed-client.d.ts +79 -24
  159. package/dist/db/distributed-client.js +23 -24
  160. package/dist/db/factory.d.ts +3 -8
  161. package/dist/db/factory.d.ts.map +1 -1
  162. package/dist/db/factory.js +3 -22
  163. package/dist/db/factory.js.map +1 -1
  164. package/dist/db/socket-client.d.ts +7 -0
  165. package/dist/db/socket-client.d.ts.map +1 -1
  166. package/dist/db/socket-client.js +140 -11
  167. package/dist/db/socket-client.js.map +1 -1
  168. package/dist/deployment/handler.d.ts +10 -2
  169. package/dist/deployment/handler.d.ts.map +1 -1
  170. package/dist/deployment/handler.js +103 -21
  171. package/dist/deployment/handler.js.map +1 -1
  172. package/dist/deployment/persistence.d.ts.map +1 -1
  173. package/dist/deployment/persistence.js +6 -1
  174. package/dist/deployment/persistence.js.map +1 -1
  175. package/dist/docker/compose.d.ts.map +1 -1
  176. package/dist/docker/compose.js +76 -0
  177. package/dist/docker/compose.js.map +1 -1
  178. package/dist/engine/runner.d.ts.map +1 -1
  179. package/dist/engine/runner.js +0 -43
  180. package/dist/engine/runner.js.map +1 -1
  181. package/dist/functions/built-in/auth-apikey.d.ts.map +1 -1
  182. package/dist/functions/built-in/auth-apikey.js.map +1 -1
  183. package/dist/functions/built-in/system-cache.d.ts.map +1 -1
  184. package/dist/functions/built-in/system-cache.js +6 -31
  185. package/dist/functions/built-in/system-cache.js.map +1 -1
  186. package/dist/functions/built-in/system-data.d.ts.map +1 -1
  187. package/dist/functions/built-in/system-data.js +4 -2
  188. package/dist/functions/built-in/system-data.js.map +1 -1
  189. package/dist/functions/definition.d.ts.map +1 -1
  190. package/dist/functions/definition.js +6 -2
  191. package/dist/functions/definition.js.map +1 -1
  192. package/dist/http/router.d.ts +1 -0
  193. package/dist/http/router.d.ts.map +1 -1
  194. package/dist/http/router.js +14 -3
  195. package/dist/http/router.js.map +1 -1
  196. package/dist/http/routes/metrics.d.ts +42 -0
  197. package/dist/http/routes/metrics.d.ts.map +1 -0
  198. package/dist/http/routes/metrics.js +29 -0
  199. package/dist/http/routes/metrics.js.map +1 -0
  200. package/dist/http/server.d.ts +1 -0
  201. package/dist/http/server.d.ts.map +1 -1
  202. package/dist/http/server.js +63 -22
  203. package/dist/http/server.js.map +1 -1
  204. package/dist/ipc/socket-bridge.d.ts +1 -0
  205. package/dist/ipc/socket-bridge.d.ts.map +1 -1
  206. package/dist/ipc/socket-bridge.js +5 -1
  207. package/dist/ipc/socket-bridge.js.map +1 -1
  208. package/dist/jobs/bullmq-adapter.d.ts +154 -0
  209. package/dist/jobs/bullmq-adapter.d.ts.map +1 -0
  210. package/dist/jobs/bullmq-adapter.js +688 -0
  211. package/dist/jobs/bullmq-adapter.js.map +1 -0
  212. package/dist/jobs/bullmq-circuit-breaker.d.ts +133 -0
  213. package/dist/jobs/bullmq-circuit-breaker.d.ts.map +1 -0
  214. package/dist/jobs/bullmq-circuit-breaker.js +323 -0
  215. package/dist/jobs/bullmq-circuit-breaker.js.map +1 -0
  216. package/dist/jobs/bullmq-dlq-manager.d.ts +155 -0
  217. package/dist/jobs/bullmq-dlq-manager.d.ts.map +1 -0
  218. package/dist/jobs/bullmq-dlq-manager.js +325 -0
  219. package/dist/jobs/bullmq-dlq-manager.js.map +1 -0
  220. package/dist/jobs/bullmq-metrics.d.ts +104 -0
  221. package/dist/jobs/bullmq-metrics.d.ts.map +1 -0
  222. package/dist/jobs/bullmq-metrics.js +323 -0
  223. package/dist/jobs/bullmq-metrics.js.map +1 -0
  224. package/dist/jobs/bullmq-priority-service.d.ts +173 -0
  225. package/dist/jobs/bullmq-priority-service.d.ts.map +1 -0
  226. package/dist/jobs/bullmq-priority-service.js +390 -0
  227. package/dist/jobs/bullmq-priority-service.js.map +1 -0
  228. package/dist/jobs/bullmq-scheduler.d.ts +111 -0
  229. package/dist/jobs/bullmq-scheduler.d.ts.map +1 -0
  230. package/dist/jobs/bullmq-scheduler.js +300 -0
  231. package/dist/jobs/bullmq-scheduler.js.map +1 -0
  232. package/dist/jobs/bullmq-worker.d.ts +155 -0
  233. package/dist/jobs/bullmq-worker.d.ts.map +1 -0
  234. package/dist/jobs/bullmq-worker.js +651 -0
  235. package/dist/jobs/bullmq-worker.js.map +1 -0
  236. package/dist/jobs/circuit-breaker.d.ts +120 -0
  237. package/dist/jobs/circuit-breaker.d.ts.map +1 -0
  238. package/dist/jobs/circuit-breaker.js +262 -0
  239. package/dist/jobs/circuit-breaker.js.map +1 -0
  240. package/dist/jobs/index.d.ts +1 -1
  241. package/dist/jobs/index.d.ts.map +1 -1
  242. package/dist/jobs/index.js.map +1 -1
  243. package/dist/jobs/queue.d.ts +120 -1
  244. package/dist/jobs/queue.d.ts.map +1 -1
  245. package/dist/jobs/queue.js +487 -9
  246. package/dist/jobs/queue.js.map +1 -1
  247. package/dist/jobs/redis-connection.d.ts +50 -0
  248. package/dist/jobs/redis-connection.d.ts.map +1 -0
  249. package/dist/jobs/redis-connection.js +123 -0
  250. package/dist/jobs/redis-connection.js.map +1 -0
  251. package/dist/jobs/run-scheduler.js +163 -10
  252. package/dist/jobs/run-scheduler.js.map +1 -1
  253. package/dist/jobs/run-worker.js +101 -9
  254. package/dist/jobs/run-worker.js.map +1 -1
  255. package/dist/jobs/worker-thread.d.ts +6 -0
  256. package/dist/jobs/worker-thread.d.ts.map +1 -1
  257. package/dist/jobs/worker-thread.js +37 -8
  258. package/dist/jobs/worker-thread.js.map +1 -1
  259. package/dist/jobs/worker.d.ts +33 -0
  260. package/dist/jobs/worker.d.ts.map +1 -1
  261. package/dist/jobs/worker.js +358 -115
  262. package/dist/jobs/worker.js.map +1 -1
  263. package/dist/linq/async-enumerable.d.ts.map +1 -1
  264. package/dist/linq/async-enumerable.js.map +1 -1
  265. package/dist/linq/enumerable.d.ts.map +1 -1
  266. package/dist/linq/enumerable.js +10 -10
  267. package/dist/linq/enumerable.js.map +1 -1
  268. package/dist/metrics/collector.d.ts +26 -0
  269. package/dist/metrics/collector.d.ts.map +1 -0
  270. package/dist/metrics/collector.js +103 -0
  271. package/dist/metrics/collector.js.map +1 -0
  272. package/dist/polling/updates.controller.d.ts +57 -0
  273. package/dist/polling/updates.controller.d.ts.map +1 -0
  274. package/dist/polling/updates.controller.js +70 -0
  275. package/dist/polling/updates.controller.js.map +1 -0
  276. package/dist/repository/db-set.d.ts.map +1 -1
  277. package/dist/repository/db-set.js +12 -8
  278. package/dist/repository/db-set.js.map +1 -1
  279. package/dist/repository/ef-core.d.ts.map +1 -1
  280. package/dist/repository/ef-core.js +6 -6
  281. package/dist/repository/ef-core.js.map +1 -1
  282. package/dist/repository/factory.d.ts +1 -1
  283. package/dist/repository/factory.d.ts.map +1 -1
  284. package/dist/repository/factory.js.map +1 -1
  285. package/dist/repository/interfaces.d.ts.map +1 -1
  286. package/dist/repository/interfaces.js.map +1 -1
  287. package/dist/repository/queryable.d.ts.map +1 -1
  288. package/dist/repository/queryable.js.map +1 -1
  289. package/dist/rpc/adapter.d.ts.map +1 -1
  290. package/dist/rpc/adapter.js.map +1 -1
  291. package/dist/rpc/router.d.ts +2 -2
  292. package/dist/rpc/router.d.ts.map +1 -1
  293. package/dist/rpc/router.js +1 -1
  294. package/dist/rpc/router.js.map +1 -1
  295. package/dist/schema/input-types.d.ts +1 -1
  296. package/dist/schema/input-types.d.ts.map +1 -1
  297. package/dist/schema/input-types.js +4 -3
  298. package/dist/schema/input-types.js.map +1 -1
  299. package/dist/schema/modifiers.d.ts +2 -1
  300. package/dist/schema/modifiers.d.ts.map +1 -1
  301. package/dist/schema/modifiers.js +41 -5
  302. package/dist/schema/modifiers.js.map +1 -1
  303. package/dist/schema/relationship-types.d.ts +7 -2
  304. package/dist/schema/relationship-types.js +1 -1
  305. package/dist/schema/type-helpers.d.ts +35 -0
  306. package/dist/schema/type-helpers.d.ts.map +1 -1
  307. package/dist/schema/type-helpers.js +32 -21
  308. package/dist/schema/type-helpers.js.map +1 -1
  309. package/dist/schema/types.d.ts.map +1 -1
  310. package/dist/schema/validators.d.ts +1 -1
  311. package/dist/schema/validators.d.ts.map +1 -1
  312. package/dist/schema/validators.js +27 -16
  313. package/dist/schema/validators.js.map +1 -1
  314. package/dist/services/admin/app-users.service.d.ts +1 -1
  315. package/dist/services/admin/app-users.service.js +31 -38
  316. package/dist/services/admin/auth.service.d.ts +1 -1
  317. package/dist/services/admin/auth.service.js +11 -5
  318. package/dist/services/admin/backup/BackupOrchestrator.d.ts.map +1 -1
  319. package/dist/services/admin/backup/BackupOrchestrator.js +4 -7
  320. package/dist/services/admin/backup/BackupOrchestrator.js.map +1 -1
  321. package/dist/services/admin/backup/StorageStreamer.d.ts +3 -3
  322. package/dist/services/admin/backup/StorageStreamer.d.ts.map +1 -1
  323. package/dist/services/admin/backup/StorageStreamer.js +16 -55
  324. package/dist/services/admin/backup/StorageStreamer.js.map +1 -1
  325. package/dist/services/admin/backup/ZipComposer.d.ts +2 -0
  326. package/dist/services/admin/backup/ZipComposer.d.ts.map +1 -1
  327. package/dist/services/admin/backup/ZipComposer.js +23 -0
  328. package/dist/services/admin/backup/ZipComposer.js.map +1 -1
  329. package/dist/services/admin/backup.service.d.ts.map +1 -1
  330. package/dist/services/admin/backup.service.js.map +1 -1
  331. package/dist/services/admin/data.service.d.ts.map +1 -1
  332. package/dist/services/admin/data.service.js +287 -286
  333. package/dist/services/admin/data.service.js.map +1 -1
  334. package/dist/services/admin/tenants.service.d.ts.map +1 -1
  335. package/dist/services/admin/tenants.service.js.map +1 -1
  336. package/dist/services/auth.service.d.ts +2 -3
  337. package/dist/services/auth.service.js +16 -16
  338. package/dist/services/introspection.service.d.ts.map +1 -1
  339. package/dist/services/introspection.service.js +6 -3
  340. package/dist/services/introspection.service.js.map +1 -1
  341. package/dist/services/invite.service.d.ts +1 -1
  342. package/dist/services/invite.service.js +17 -15
  343. package/dist/services/storage.service.d.ts.map +1 -1
  344. package/dist/services/storage.service.js +35 -4
  345. package/dist/services/storage.service.js.map +1 -1
  346. package/dist/services/system.service.d.ts +4 -0
  347. package/dist/services/system.service.d.ts.map +1 -1
  348. package/dist/services/system.service.js +43 -1
  349. package/dist/services/system.service.js.map +1 -1
  350. package/dist/services/tenant.service.d.ts +1 -1
  351. package/dist/services/tenant.service.js +43 -31
  352. package/dist/sse/subscriptions.controller.d.ts +57 -0
  353. package/dist/sse/subscriptions.controller.d.ts.map +1 -0
  354. package/dist/sse/subscriptions.controller.js +127 -0
  355. package/dist/sse/subscriptions.controller.js.map +1 -0
  356. package/dist/startup/bootstrap.d.ts +13 -2
  357. package/dist/startup/bootstrap.d.ts.map +1 -1
  358. package/dist/startup/bootstrap.js +85 -13
  359. package/dist/startup/bootstrap.js.map +1 -1
  360. package/dist/storage/s3-backend.d.ts.map +1 -1
  361. package/dist/storage/s3-backend.js +3 -3
  362. package/dist/storage/s3-backend.js.map +1 -1
  363. package/dist/websocket/server.d.ts.map +1 -1
  364. package/dist/websocket/server.js +14 -3
  365. package/dist/websocket/server.js.map +1 -1
  366. package/docker/README.md +299 -1
  367. package/package.json +5 -1
  368. package/templates/.env.example +76 -16
  369. package/templates/archlast.config.js +15 -1
  370. package/templates/docker-compose.dev.yml +8 -8
  371. package/templates/docker-compose.prod.yml +29 -12
  372. package/templates/docker-compose.yml +112 -28
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Archlast Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Archlast Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -22,10 +22,10 @@ by the CLI (`archlast start`).
22
22
  import { defineSchema, defineTable, v } from "@archlast/server/schema/definition";
23
23
 
24
24
  export default defineSchema({
25
- tasks: defineTable({
26
- id: v.id(),
27
- text: v.string(),
28
- }),
25
+ tasks: defineTable({
26
+ id: v.id(),
27
+ text: v.string(),
28
+ }),
29
29
  });
30
30
  ```
31
31
 
@@ -36,16 +36,17 @@ import { query, mutation } from "@archlast/server/functions/definition";
36
36
  import { z } from "zod";
37
37
 
38
38
  export const list = query({
39
- handler: async (ctx) => ctx.db.table("tasks").findMany(),
39
+ handler: async (ctx) => ctx.db.table("tasks").findMany(),
40
40
  });
41
41
 
42
42
  export const create = mutation({
43
- args: { text: z.string() },
44
- handler: async (ctx, args) => ctx.db.table("tasks").insert({ text: args.text }),
43
+ args: { text: z.string() },
44
+ handler: async (ctx, args) => ctx.db.table("tasks").insert({ text: args.text }),
45
45
  });
46
46
  ```
47
47
 
48
48
  Other function types:
49
+
49
50
  - `action` for long running tasks
50
51
  - `http` for explicit HTTP routes
51
52
  - `webhook` for signed incoming events
@@ -58,14 +59,15 @@ optional, and attach permissions.
58
59
 
59
60
  ```ts
60
61
  export const publicPing = query({
61
- auth: "public",
62
- handler: async () => "pong",
62
+ auth: "public",
63
+ handler: async () => "pong",
63
64
  });
64
65
  ```
65
66
 
66
67
  ## Runtime exports
67
68
 
68
69
  Common entry points:
70
+
69
71
  - `@archlast/server/schema/definition` and `@archlast/server/schema/validators`
70
72
  - `@archlast/server/functions/definition` and `@archlast/server/functions/types`
71
73
  - `@archlast/server/http` and `@archlast/server/webhook`
@@ -76,6 +78,7 @@ Common entry points:
76
78
  ## Docker templates
77
79
 
78
80
  Templates live under `templates/` in this package:
81
+
79
82
  - `docker-compose.yml`, `docker-compose.dev.yml`, `docker-compose.prod.yml`
80
83
  - `.env.example`
81
84
  - `archlast.config.js`
@@ -85,6 +88,7 @@ The CLI uses these templates to generate a local Docker setup.
85
88
  ## Environment configuration
86
89
 
87
90
  Key variables used by the server runtime:
91
+
88
92
  - `PORT` (default: 4000)
89
93
  - `ARCHLAST_DB_ROOT` (default: `./data`)
90
94
  - `ARCHLAST_ALLOWED_ORIGINS` (CSV)
@@ -97,4 +101,4 @@ Key variables used by the server runtime:
97
101
 
98
102
  ## Publishing (maintainers)
99
103
 
100
- See `docs/npm-publishing.md` for release and publish steps.
104
+ See `docs/npm-publishing.md` for release and publish steps.
@@ -29,11 +29,23 @@ export declare function isSetupRequired(db: IDatabaseClient): Promise<boolean>;
29
29
  /**
30
30
  * Setup: Create the first admin user
31
31
  */
32
- export declare function setupFirstAdmin(db: IDatabaseClient, username: string, password: string, userAgent: string | null, ipAddress: string | null): Promise<SetupResult | AuthError>;
32
+ export declare function setupFirstAdmin(
33
+ db: IDatabaseClient,
34
+ username: string,
35
+ password: string,
36
+ userAgent: string | null,
37
+ ipAddress: string | null
38
+ ): Promise<SetupResult | AuthError>;
33
39
  /**
34
40
  * Login: Authenticate admin user
35
41
  */
36
- export declare function loginAdmin(db: IDatabaseClient, username: string, password: string, userAgent: string | null, ipAddress: string | null): Promise<LoginResult | AuthError>;
42
+ export declare function loginAdmin(
43
+ db: IDatabaseClient,
44
+ username: string,
45
+ password: string,
46
+ userAgent: string | null,
47
+ ipAddress: string | null
48
+ ): Promise<LoginResult | AuthError>;
37
49
  /**
38
50
  * Logout: Invalidate session
39
51
  */
@@ -41,7 +53,10 @@ export declare function logoutAdmin(db: IDatabaseClient, token: string): Promise
41
53
  /**
42
54
  * Verify session and get admin user
43
55
  */
44
- export declare function verifyAdminSession(db: IDatabaseClient, token: string): Promise<{
56
+ export declare function verifyAdminSession(
57
+ db: IDatabaseClient,
58
+ token: string
59
+ ): Promise<{
45
60
  user: Omit<AdminUser, "password_hash">;
46
61
  session: AdminSession;
47
62
  } | null>;
@@ -56,7 +71,11 @@ export declare function extractAdminSessionTokens(req: Request): string[];
56
71
  * 2. ast_ session tokens (login sessions) - not obfuscated (for browser)
57
72
  * 3. ak_ API keys (legacy, user-created) - not obfuscated
58
73
  */
59
- export declare function requireAdminAuth(db: IDatabaseClient, req: Request, requestPath?: string): Promise<{
74
+ export declare function requireAdminAuth(
75
+ db: IDatabaseClient,
76
+ req: Request,
77
+ requestPath?: string
78
+ ): Promise<{
60
79
  user: Omit<AdminUser, "password_hash">;
61
80
  session: AdminSession;
62
81
  } | null>;
@@ -76,4 +95,4 @@ export declare function getUserAgent(req: Request): string | null;
76
95
  * Get IP address from request
77
96
  */
78
97
  export declare function getIpAddress(req: Request): string | null;
79
- //# sourceMappingURL=auth.d.ts.map
98
+ //# sourceMappingURL=auth.d.ts.map
@@ -43,7 +43,10 @@ async function setupFirstAdmin(db, username, password, userAgent, ipAddress) {
43
43
  // Validate username
44
44
  const normalizedUsername = (0, schema_js_1.normalizeUsername)(username);
45
45
  if (!(0, schema_js_1.isValidUsername)(normalizedUsername)) {
46
- return { success: false, error: "Invalid username. Must be 3-32 characters, alphanumeric and underscore only." };
46
+ return {
47
+ success: false,
48
+ error: "Invalid username. Must be 3-32 characters, alphanumeric and underscore only.",
49
+ };
47
50
  }
48
51
  // Validate password
49
52
  if (!password || password.length < 8) {
@@ -52,10 +55,21 @@ async function setupFirstAdmin(db, username, password, userAgent, ipAddress) {
52
55
  // Hash password
53
56
  const passwordHash = await (0, crypto_js_1.hashPassword)(password);
54
57
  // Create first admin user (always super admin)
55
- const user = await (0, schema_js_1.createFirstAdminUser)(db, normalizedUsername, passwordHash);
58
+ const user = await (0, schema_js_1.createFirstAdminUser)(
59
+ db,
60
+ normalizedUsername,
61
+ passwordHash
62
+ );
56
63
  // Create session
57
64
  const token = `ast_${(0, cuid2_1.createId)()}`; // Admin Session Token
58
- const session = await (0, schema_js_1.createAdminSession)(db, user._id, token, exports.ADMIN_SESSION_TTL_MS, userAgent, ipAddress);
65
+ const session = await (0, schema_js_1.createAdminSession)(
66
+ db,
67
+ user._id,
68
+ token,
69
+ exports.ADMIN_SESSION_TTL_MS,
70
+ userAgent,
71
+ ipAddress
72
+ );
59
73
  return {
60
74
  success: true,
61
75
  token: session.token,
@@ -70,8 +84,7 @@ async function setupFirstAdmin(db, username, password, userAgent, ipAddress) {
70
84
  updated_at: user.updated_at,
71
85
  },
72
86
  };
73
- }
74
- catch (err) {
87
+ } catch (err) {
75
88
  logger_js_1.logger.log({
76
89
  timestamp: Date.now(),
77
90
  level: "error",
@@ -100,7 +113,14 @@ async function loginAdmin(db, username, password, userAgent, ipAddress) {
100
113
  }
101
114
  // Create session
102
115
  const token = `ast_${(0, cuid2_1.createId)()}`;
103
- const session = await (0, schema_js_1.createAdminSession)(db, user._id, token, exports.ADMIN_SESSION_TTL_MS, userAgent, ipAddress);
116
+ const session = await (0, schema_js_1.createAdminSession)(
117
+ db,
118
+ user._id,
119
+ token,
120
+ exports.ADMIN_SESSION_TTL_MS,
121
+ userAgent,
122
+ ipAddress
123
+ );
104
124
  return {
105
125
  success: true,
106
126
  token: session.token,
@@ -115,8 +135,7 @@ async function loginAdmin(db, username, password, userAgent, ipAddress) {
115
135
  updated_at: user.updated_at,
116
136
  },
117
137
  };
118
- }
119
- catch (err) {
138
+ } catch (err) {
120
139
  logger_js_1.logger.log({
121
140
  timestamp: Date.now(),
122
141
  level: "error",
@@ -167,8 +186,7 @@ async function verifyAdminSession(db, token) {
167
186
  },
168
187
  session,
169
188
  };
170
- }
171
- catch (err) {
189
+ } catch (err) {
172
190
  logger_js_1.logger.log({
173
191
  timestamp: Date.now(),
174
192
  level: "error",
@@ -185,7 +203,8 @@ async function verifyAdminSession(db, token) {
185
203
  // ============================================================================
186
204
  // TOKEN OBFUSCATION
187
205
  // ============================================================================
188
- const TOKEN_OBFUSCATION_SECRET = process.env.ARCHLAST_TOKEN_OBFUSCATION_SECRET || "archlast-default-secret-change-in-production";
206
+ const TOKEN_OBFUSCATION_SECRET =
207
+ process.env.ARCHLAST_TOKEN_OBFUSCATION_SECRET || "archlast-default-secret-change-in-production";
189
208
  const TIMESTAMP_WINDOW_MS = 5 * 60 * 1000; // 5 minutes
190
209
  /**
191
210
  * Deobfuscate a dynamic token and return the raw token
@@ -219,7 +238,9 @@ function deobfuscateToken(obfuscated, requestPath) {
219
238
  .update(message)
220
239
  .digest("base64url");
221
240
  // Use timing-safe comparison to prevent timing attacks
222
- if (!(0, crypto_1.timingSafeEqual)(Buffer.from(signature), Buffer.from(expectedSignature))) {
241
+ if (
242
+ !(0, crypto_1.timingSafeEqual)(Buffer.from(signature), Buffer.from(expectedSignature))
243
+ ) {
223
244
  logger_js_1.logger.log({
224
245
  timestamp: Date.now(),
225
246
  level: "warn",
@@ -235,8 +256,7 @@ function deobfuscateToken(obfuscated, requestPath) {
235
256
  message: `[Token Obfuscation] ✓ Token deobfuscated successfully`,
236
257
  });
237
258
  return token;
238
- }
239
- catch (error) {
259
+ } catch (error) {
240
260
  logger_js_1.logger.log({
241
261
  timestamp: Date.now(),
242
262
  level: "error",
@@ -256,16 +276,14 @@ function extractAndDeobfuscateTokens(req, requestPath) {
256
276
  const xAdminToken = req.headers.get("x-admin-token");
257
277
  if (xAdminToken) {
258
278
  const deobfuscated = deobfuscateToken(xAdminToken, requestPath);
259
- if (deobfuscated)
260
- tokens.push(deobfuscated);
279
+ if (deobfuscated) tokens.push(deobfuscated);
261
280
  }
262
281
  // 2. Authorization header
263
282
  const authHeader = req.headers.get("authorization");
264
283
  if (authHeader?.startsWith("Bearer ")) {
265
284
  const token = authHeader.slice(7);
266
285
  const deobfuscated = deobfuscateToken(token, requestPath);
267
- if (deobfuscated)
268
- tokens.push(deobfuscated);
286
+ if (deobfuscated) tokens.push(deobfuscated);
269
287
  }
270
288
  // 3. Cookie (session tokens are not obfuscated)
271
289
  const cookieHeader = req.headers.get("cookie");
@@ -287,8 +305,7 @@ function extractAdminSessionTokens(req) {
287
305
  const tokens = [];
288
306
  // 1. X-Admin-Token header (highest priority, manual bypass)
289
307
  const xAdminToken = req.headers.get("x-admin-token");
290
- if (xAdminToken)
291
- tokens.push(xAdminToken);
308
+ if (xAdminToken) tokens.push(xAdminToken);
292
309
  // 2. Authorization header
293
310
  const authHeader = req.headers.get("authorization");
294
311
  if (authHeader?.startsWith("Bearer ")) {
@@ -334,7 +351,7 @@ async function requireAdminAuth(db, req, requestPath) {
334
351
  level: "debug",
335
352
  kind: "system",
336
353
  message: `[Admin Auth] Found ${tokens.length} token(s)`,
337
- context: { tokenTypes: tokens.map(t => `${t.slice(0, 4)}...${t.slice(-4)}`) },
354
+ context: { tokenTypes: tokens.map((t) => `${t.slice(0, 4)}...${t.slice(-4)}`) },
338
355
  });
339
356
  for (const token of tokens) {
340
357
  // 1. Check for sat_ admin tokens (Server Admin Tokens - dashboard-generated)
@@ -357,7 +374,10 @@ async function requireAdminAuth(db, req, requestPath) {
357
374
  });
358
375
  }
359
376
  if (adminTokenRecord) {
360
- const user = await (0, schema_js_1.findAdminUserById)(db, adminTokenRecord.created_by_admin_id);
377
+ const user = await (0, schema_js_1.findAdminUserById)(
378
+ db,
379
+ adminTokenRecord.created_by_admin_id
380
+ );
361
381
  if (user) {
362
382
  await (0, schema_js_1.updateAdminTokenLastUsed)(db, adminTokenRecord._id);
363
383
  const now = Date.now();
@@ -384,7 +404,8 @@ async function requireAdminAuth(db, req, requestPath) {
384
404
  _collection: "admin_tokens",
385
405
  admin_user_id: user._id,
386
406
  token: adminTokenRecord.token,
387
- expires_at: adminTokenRecord.expires_at ?? now + exports.ADMIN_SESSION_TTL_MS,
407
+ expires_at:
408
+ adminTokenRecord.expires_at ?? now + exports.ADMIN_SESSION_TTL_MS,
388
409
  user_agent: req.headers.get("user-agent"),
389
410
  ip_address: getIpAddress(req),
390
411
  created_at: adminTokenRecord.created_at,
@@ -405,7 +426,10 @@ async function requireAdminAuth(db, req, requestPath) {
405
426
  if (token.startsWith("ak_")) {
406
427
  const apiKey = await (0, schema_js_1.findApiKeyByKey)(db, token);
407
428
  if (apiKey) {
408
- const user = await (0, schema_js_1.findAdminUserById)(db, apiKey.created_by_admin_id);
429
+ const user = await (0, schema_js_1.findAdminUserById)(
430
+ db,
431
+ apiKey.created_by_admin_id
432
+ );
409
433
  if (user) {
410
434
  await (0, schema_js_1.updateApiKeyLastUsed)(db, apiKey._id);
411
435
  const now = Date.now();
@@ -484,4 +508,4 @@ function getIpAddress(req) {
484
508
  // Fallback to direct connection (may be proxy IP in production)
485
509
  return null;
486
510
  }
487
- //# sourceMappingURL=auth.js.map
511
+ //# sourceMappingURL=auth.js.map
@@ -37,9 +37,15 @@ export declare const adminSchema: {
37
37
  _id: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
38
38
  username: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
39
39
  password_hash: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
40
- name: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodString>>;
41
- avatar_url: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodString>>;
42
- is_super_admin: import("../schema/validators.js").FieldSchema<import("zod").ZodDefault<import("zod").ZodBoolean>>;
40
+ name: import("../schema/validators.js").FieldSchema<
41
+ import("zod").ZodOptional<import("zod").ZodString>
42
+ >;
43
+ avatar_url: import("../schema/validators.js").FieldSchema<
44
+ import("zod").ZodOptional<import("zod").ZodString>
45
+ >;
46
+ is_super_admin: import("../schema/validators.js").FieldSchema<
47
+ import("zod").ZodDefault<import("zod").ZodBoolean>
48
+ >;
43
49
  created_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
44
50
  updated_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
45
51
  }>;
@@ -49,28 +55,50 @@ export declare const adminSchema: {
49
55
  token: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
50
56
  expires_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
51
57
  created_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
52
- last_accessed_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
53
- user_agent: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodString>>;
54
- ip_address: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodString>>;
58
+ last_accessed_at: import("../schema/validators.js").FieldSchema<
59
+ import("zod").ZodNumber
60
+ >;
61
+ user_agent: import("../schema/validators.js").FieldSchema<
62
+ import("zod").ZodOptional<import("zod").ZodString>
63
+ >;
64
+ ip_address: import("../schema/validators.js").FieldSchema<
65
+ import("zod").ZodOptional<import("zod").ZodString>
66
+ >;
55
67
  }>;
56
68
  _api_keys: import("../schema/definition.js").TableDefinition<{
57
69
  _id: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
58
70
  key: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
59
71
  name: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
60
- created_by_admin_id: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
72
+ created_by_admin_id: import("../schema/validators.js").FieldSchema<
73
+ import("zod").ZodString
74
+ >;
61
75
  created_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
62
- last_used_at: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodNumber>>;
63
- is_revoked: import("../schema/validators.js").FieldSchema<import("zod").ZodDefault<import("zod").ZodBoolean>>;
76
+ last_used_at: import("../schema/validators.js").FieldSchema<
77
+ import("zod").ZodOptional<import("zod").ZodNumber>
78
+ >;
79
+ is_revoked: import("../schema/validators.js").FieldSchema<
80
+ import("zod").ZodDefault<import("zod").ZodBoolean>
81
+ >;
64
82
  }>;
65
83
  _admin_tokens: import("../schema/definition.js").TableDefinition<{
66
84
  _id: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
67
85
  token: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
68
86
  name: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
69
- created_by_admin_id: import("../schema/validators.js").FieldSchema<import("zod").ZodString>;
70
- scopes: import("../schema/validators.js").FieldSchema<import("zod").ZodArray<import("zod").ZodString>>;
71
- expires_at: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodNumber>>;
72
- last_used_at: import("../schema/validators.js").FieldSchema<import("zod").ZodOptional<import("zod").ZodNumber>>;
73
- is_revoked: import("../schema/validators.js").FieldSchema<import("zod").ZodDefault<import("zod").ZodBoolean>>;
87
+ created_by_admin_id: import("../schema/validators.js").FieldSchema<
88
+ import("zod").ZodString
89
+ >;
90
+ scopes: import("../schema/validators.js").FieldSchema<
91
+ import("zod").ZodArray<import("zod").ZodString>
92
+ >;
93
+ expires_at: import("../schema/validators.js").FieldSchema<
94
+ import("zod").ZodOptional<import("zod").ZodNumber>
95
+ >;
96
+ last_used_at: import("../schema/validators.js").FieldSchema<
97
+ import("zod").ZodOptional<import("zod").ZodNumber>
98
+ >;
99
+ is_revoked: import("../schema/validators.js").FieldSchema<
100
+ import("zod").ZodDefault<import("zod").ZodBoolean>
101
+ >;
74
102
  created_at: import("../schema/validators.js").FieldSchema<import("zod").ZodNumber>;
75
103
  }>;
76
104
  };
@@ -126,32 +154,59 @@ export declare function hasAnyAdminUsers(db: IDatabaseClient): Promise<boolean>;
126
154
  /**
127
155
  * Create the first admin user (setup flow)
128
156
  */
129
- export declare function createFirstAdminUser(db: IDatabaseClient, username: string, passwordHash: string, name?: string): Promise<AdminUser>;
157
+ export declare function createFirstAdminUser(
158
+ db: IDatabaseClient,
159
+ username: string,
160
+ passwordHash: string,
161
+ name?: string
162
+ ): Promise<AdminUser>;
130
163
  /**
131
164
  * Find admin user by username
132
165
  */
133
- export declare function findAdminUserByUsername(db: IDatabaseClient, username: string): Promise<AdminUser | null>;
166
+ export declare function findAdminUserByUsername(
167
+ db: IDatabaseClient,
168
+ username: string
169
+ ): Promise<AdminUser | null>;
134
170
  /**
135
171
  * Find admin user by email (deprecated, use findAdminUserByUsername)
136
172
  * @deprecated Use findAdminUserByUsername instead
137
173
  */
138
- export declare function findAdminUserByEmail(db: IDatabaseClient, email: string): Promise<AdminUser | null>;
174
+ export declare function findAdminUserByEmail(
175
+ db: IDatabaseClient,
176
+ email: string
177
+ ): Promise<AdminUser | null>;
139
178
  /**
140
179
  * Find admin user by ID
141
180
  */
142
- export declare function findAdminUserById(db: IDatabaseClient, id: string): Promise<AdminUser | null>;
181
+ export declare function findAdminUserById(
182
+ db: IDatabaseClient,
183
+ id: string
184
+ ): Promise<AdminUser | null>;
143
185
  /**
144
186
  * Create admin session
145
187
  */
146
- export declare function createAdminSession(db: IDatabaseClient, adminUserId: string, token: string, expiresInMs: number, userAgent: string | null, ipAddress: string | null): Promise<AdminSession>;
188
+ export declare function createAdminSession(
189
+ db: IDatabaseClient,
190
+ adminUserId: string,
191
+ token: string,
192
+ expiresInMs: number,
193
+ userAgent: string | null,
194
+ ipAddress: string | null
195
+ ): Promise<AdminSession>;
147
196
  /**
148
197
  * Find session by token
149
198
  */
150
- export declare function findAdminSessionByToken(db: IDatabaseClient, token: string): Promise<AdminSession | null>;
199
+ export declare function findAdminSessionByToken(
200
+ db: IDatabaseClient,
201
+ token: string
202
+ ): Promise<AdminSession | null>;
151
203
  /**
152
204
  * Update session last accessed time
153
205
  */
154
- export declare function updateSessionLastAccessed(db: IDatabaseClient, sessionId: string): Promise<void>;
206
+ export declare function updateSessionLastAccessed(
207
+ db: IDatabaseClient,
208
+ sessionId: string
209
+ ): Promise<void>;
155
210
  /**
156
211
  * Delete session (logout)
157
212
  */
@@ -159,11 +214,17 @@ export declare function deleteAdminSession(db: IDatabaseClient, token: string):
159
214
  /**
160
215
  * Delete all sessions for a user
161
216
  */
162
- export declare function deleteAllUserSessions(db: IDatabaseClient, adminUserId: string): Promise<number>;
217
+ export declare function deleteAllUserSessions(
218
+ db: IDatabaseClient,
219
+ adminUserId: string
220
+ ): Promise<number>;
163
221
  /**
164
222
  * List all sessions for an admin user
165
223
  */
166
- export declare function listAdminSessions(db: IDatabaseClient, adminUserId: string): Promise<AdminSession[]>;
224
+ export declare function listAdminSessions(
225
+ db: IDatabaseClient,
226
+ adminUserId: string
227
+ ): Promise<AdminSession[]>;
167
228
  /**
168
229
  * Clean up expired sessions
169
230
  */
@@ -171,11 +232,18 @@ export declare function cleanupExpiredSessions(db: IDatabaseClient): Promise<num
171
232
  /**
172
233
  * Create admin user (requires existing admin)
173
234
  */
174
- export declare function createAdminUser(db: IDatabaseClient, username: string, passwordHash: string, isSuperAdmin?: boolean): Promise<AdminUser>;
235
+ export declare function createAdminUser(
236
+ db: IDatabaseClient,
237
+ username: string,
238
+ passwordHash: string,
239
+ isSuperAdmin?: boolean
240
+ ): Promise<AdminUser>;
175
241
  /**
176
242
  * List all admin users
177
243
  */
178
- export declare function listAdminUsers(db: IDatabaseClient): Promise<Omit<AdminUser, "password_hash">[]>;
244
+ export declare function listAdminUsers(
245
+ db: IDatabaseClient
246
+ ): Promise<Omit<AdminUser, "password_hash">[]>;
179
247
  /**
180
248
  * Delete admin user
181
249
  */
@@ -183,11 +251,19 @@ export declare function deleteAdminUser(db: IDatabaseClient, id: string): Promis
183
251
  /**
184
252
  * Update admin user
185
253
  */
186
- export declare function updateAdminUser(db: IDatabaseClient, id: string, data: Partial<Pick<AdminUser, "name" | "avatar_url">>): Promise<void>;
254
+ export declare function updateAdminUser(
255
+ db: IDatabaseClient,
256
+ id: string,
257
+ data: Partial<Pick<AdminUser, "name" | "avatar_url">>
258
+ ): Promise<void>;
187
259
  /**
188
260
  * Create API key
189
261
  */
190
- export declare function createApiKey(db: IDatabaseClient, name: string, createdByAdminId: string): Promise<ApiKey>;
262
+ export declare function createApiKey(
263
+ db: IDatabaseClient,
264
+ name: string,
265
+ createdByAdminId: string
266
+ ): Promise<ApiKey>;
191
267
  /**
192
268
  * Find API key by key string
193
269
  */
@@ -211,15 +287,26 @@ export declare function deleteApiKey(db: IDatabaseClient, id: string): Promise<v
211
287
  /**
212
288
  * Create admin token (sat_ prefix)
213
289
  */
214
- export declare function createAdminToken(db: IDatabaseClient, name: string, createdByAdminId: string, expiresInDays?: number | null): Promise<AdminToken>;
290
+ export declare function createAdminToken(
291
+ db: IDatabaseClient,
292
+ name: string,
293
+ createdByAdminId: string,
294
+ expiresInDays?: number | null
295
+ ): Promise<AdminToken>;
215
296
  /**
216
297
  * Find admin token by token string
217
298
  */
218
- export declare function findAdminTokenByToken(db: IDatabaseClient, token: string): Promise<AdminToken | null>;
299
+ export declare function findAdminTokenByToken(
300
+ db: IDatabaseClient,
301
+ token: string
302
+ ): Promise<AdminToken | null>;
219
303
  /**
220
304
  * Update admin token last used time
221
305
  */
222
- export declare function updateAdminTokenLastUsed(db: IDatabaseClient, tokenId: string): Promise<void>;
306
+ export declare function updateAdminTokenLastUsed(
307
+ db: IDatabaseClient,
308
+ tokenId: string
309
+ ): Promise<void>;
223
310
  /**
224
311
  * List admin tokens (masked, excludes token value)
225
312
  */
@@ -228,7 +315,10 @@ export declare function listAdminTokens(db: IDatabaseClient): Promise<Omit<Admin
228
315
  * Get admin token by ID with full token value (for copy functionality)
229
316
  * Warning: Only use this when user explicitly requests to reveal the token
230
317
  */
231
- export declare function getAdminTokenById(db: IDatabaseClient, id: string): Promise<AdminToken | null>;
318
+ export declare function getAdminTokenById(
319
+ db: IDatabaseClient,
320
+ id: string
321
+ ): Promise<AdminToken | null>;
232
322
  /**
233
323
  * Revoke admin token
234
324
  */
@@ -237,4 +327,4 @@ export declare function revokeAdminToken(db: IDatabaseClient, id: string): Promi
237
327
  * Delete admin token permanently
238
328
  */
239
329
  export declare function deleteAdminToken(db: IDatabaseClient, id: string): Promise<void>;
240
- //# sourceMappingURL=schema.d.ts.map
330
+ //# sourceMappingURL=schema.d.ts.map