@alneas/eaos-server 0.0.0-stage → 0.2.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 (360) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +21 -0
  3. package/README.ja.md +49 -0
  4. package/README.md +46 -2
  5. package/dist/agentic/agent-jobs.d.ts +333 -0
  6. package/dist/agentic/agent-jobs.js +15 -0
  7. package/dist/agentic/agent-jobs.js.map +1 -0
  8. package/dist/agentic/agent-node.d.ts +40 -0
  9. package/dist/agentic/agent-node.js +7 -0
  10. package/dist/agentic/agent-node.js.map +1 -0
  11. package/dist/agentic/agent-runner.d.ts +33 -0
  12. package/dist/agentic/agent-runner.js +7 -0
  13. package/dist/agentic/agent-runner.js.map +1 -0
  14. package/dist/agentic/ai-broker.d.ts +169 -0
  15. package/dist/agentic/ai-broker.js +8 -0
  16. package/dist/agentic/ai-broker.js.map +1 -0
  17. package/dist/agentic/atomic-checkpointer.d.ts +137 -0
  18. package/dist/agentic/atomic-checkpointer.js +9 -0
  19. package/dist/agentic/atomic-checkpointer.js.map +1 -0
  20. package/dist/agentic/autonomous-worker.d.ts +122 -0
  21. package/dist/agentic/autonomous-worker.js +10 -0
  22. package/dist/agentic/autonomous-worker.js.map +1 -0
  23. package/dist/agentic/event-bridge.d.ts +350 -0
  24. package/dist/agentic/event-bridge.js +9 -0
  25. package/dist/agentic/event-bridge.js.map +1 -0
  26. package/dist/agentic/executor.d.ts +91 -0
  27. package/dist/agentic/executor.js +12 -0
  28. package/dist/agentic/executor.js.map +1 -0
  29. package/dist/agentic/graph-projection.d.ts +119 -0
  30. package/dist/agentic/graph-projection.js +7 -0
  31. package/dist/agentic/graph-projection.js.map +1 -0
  32. package/dist/agentic/graph.d.ts +524 -0
  33. package/dist/agentic/graph.js +7 -0
  34. package/dist/agentic/graph.js.map +1 -0
  35. package/dist/agentic/index.d.ts +28 -0
  36. package/dist/agentic/index.js +87 -0
  37. package/dist/agentic/index.js.map +1 -0
  38. package/dist/agentic/local-runner.d.ts +106 -0
  39. package/dist/agentic/local-runner.js +7 -0
  40. package/dist/agentic/local-runner.js.map +1 -0
  41. package/dist/agentic/remote-executor.d.ts +67 -0
  42. package/dist/agentic/remote-executor.js +8 -0
  43. package/dist/agentic/remote-executor.js.map +1 -0
  44. package/dist/agentic/types.d.ts +157 -0
  45. package/dist/agentic/types.js +7 -0
  46. package/dist/agentic/types.js.map +1 -0
  47. package/dist/agentic/workflow-catalog.d.ts +152 -0
  48. package/dist/agentic/workflow-catalog.js +7 -0
  49. package/dist/agentic/workflow-catalog.js.map +1 -0
  50. package/dist/agentic/workflow-compiler.d.ts +44 -0
  51. package/dist/agentic/workflow-compiler.js +8 -0
  52. package/dist/agentic/workflow-compiler.js.map +1 -0
  53. package/dist/agentic/workflow-coordinator.d.ts +170 -0
  54. package/dist/agentic/workflow-coordinator.js +8 -0
  55. package/dist/agentic/workflow-coordinator.js.map +1 -0
  56. package/dist/agentic/workflow-manager.d.ts +91 -0
  57. package/dist/agentic/workflow-manager.js +7 -0
  58. package/dist/agentic/workflow-manager.js.map +1 -0
  59. package/dist/agentic/workflow-registry.d.ts +334 -0
  60. package/dist/agentic/workflow-registry.js +7 -0
  61. package/dist/agentic/workflow-registry.js.map +1 -0
  62. package/dist/artifacts-CteHmCMI.d.ts +614 -0
  63. package/dist/auth-hooks/api-key.d.ts +75 -0
  64. package/dist/auth-hooks/api-key.js +7 -0
  65. package/dist/auth-hooks/api-key.js.map +1 -0
  66. package/dist/auth-hooks/index.d.ts +80 -0
  67. package/dist/auth-hooks/index.js +28 -0
  68. package/dist/auth-hooks/index.js.map +1 -0
  69. package/dist/browser-auth/account-memberships.d.ts +213 -0
  70. package/dist/browser-auth/account-memberships.js +13 -0
  71. package/dist/browser-auth/account-memberships.js.map +1 -0
  72. package/dist/browser-auth/index.d.ts +8 -0
  73. package/dist/browser-auth/index.js +59 -0
  74. package/dist/browser-auth/index.js.map +1 -0
  75. package/dist/browser-auth/kratos-session.d.ts +37 -0
  76. package/dist/browser-auth/kratos-session.js +7 -0
  77. package/dist/browser-auth/kratos-session.js.map +1 -0
  78. package/dist/browser-auth/platform-session.d.ts +120 -0
  79. package/dist/browser-auth/platform-session.js +7 -0
  80. package/dist/browser-auth/platform-session.js.map +1 -0
  81. package/dist/browser-auth/public-memberships.d.ts +22 -0
  82. package/dist/browser-auth/public-memberships.js +7 -0
  83. package/dist/browser-auth/public-memberships.js.map +1 -0
  84. package/dist/cache/index.d.ts +181 -0
  85. package/dist/cache/index.js +197 -0
  86. package/dist/cache/index.js.map +1 -0
  87. package/dist/chunk-32746UQZ.js +131 -0
  88. package/dist/chunk-32746UQZ.js.map +1 -0
  89. package/dist/chunk-3NLSWP2Y.js +223 -0
  90. package/dist/chunk-3NLSWP2Y.js.map +1 -0
  91. package/dist/chunk-3P4XTTQH.js +346 -0
  92. package/dist/chunk-3P4XTTQH.js.map +1 -0
  93. package/dist/chunk-3VITSHN3.js +15 -0
  94. package/dist/chunk-3VITSHN3.js.map +1 -0
  95. package/dist/chunk-46UWPEW2.js +226 -0
  96. package/dist/chunk-46UWPEW2.js.map +1 -0
  97. package/dist/chunk-4BARRLJR.js +180 -0
  98. package/dist/chunk-4BARRLJR.js.map +1 -0
  99. package/dist/chunk-4VORUFKR.js +45 -0
  100. package/dist/chunk-4VORUFKR.js.map +1 -0
  101. package/dist/chunk-55D4ERWO.js +1 -0
  102. package/dist/chunk-55D4ERWO.js.map +1 -0
  103. package/dist/chunk-5TBBZIND.js +18 -0
  104. package/dist/chunk-5TBBZIND.js.map +1 -0
  105. package/dist/chunk-5WOZWPZA.js +211 -0
  106. package/dist/chunk-5WOZWPZA.js.map +1 -0
  107. package/dist/chunk-6CBVZ6CT.js +168 -0
  108. package/dist/chunk-6CBVZ6CT.js.map +1 -0
  109. package/dist/chunk-6XZXYNJR.js +74 -0
  110. package/dist/chunk-6XZXYNJR.js.map +1 -0
  111. package/dist/chunk-753HWDSC.js +222 -0
  112. package/dist/chunk-753HWDSC.js.map +1 -0
  113. package/dist/chunk-7AHSS7SO.js +81 -0
  114. package/dist/chunk-7AHSS7SO.js.map +1 -0
  115. package/dist/chunk-7FTJN4SA.js +1 -0
  116. package/dist/chunk-7FTJN4SA.js.map +1 -0
  117. package/dist/chunk-AVDMLTPF.js +24 -0
  118. package/dist/chunk-AVDMLTPF.js.map +1 -0
  119. package/dist/chunk-BKAHUEIT.js +95 -0
  120. package/dist/chunk-BKAHUEIT.js.map +1 -0
  121. package/dist/chunk-CJ7OFEF7.js +134 -0
  122. package/dist/chunk-CJ7OFEF7.js.map +1 -0
  123. package/dist/chunk-EJKWDZIU.js +111 -0
  124. package/dist/chunk-EJKWDZIU.js.map +1 -0
  125. package/dist/chunk-F2J6IQ6I.js +247 -0
  126. package/dist/chunk-F2J6IQ6I.js.map +1 -0
  127. package/dist/chunk-F3O7CELI.js +23 -0
  128. package/dist/chunk-F3O7CELI.js.map +1 -0
  129. package/dist/chunk-F4IITPGX.js +221 -0
  130. package/dist/chunk-F4IITPGX.js.map +1 -0
  131. package/dist/chunk-FD6VC2NA.js +66 -0
  132. package/dist/chunk-FD6VC2NA.js.map +1 -0
  133. package/dist/chunk-FRRRWAHO.js +14 -0
  134. package/dist/chunk-FRRRWAHO.js.map +1 -0
  135. package/dist/chunk-HCKAGLLB.js +17 -0
  136. package/dist/chunk-HCKAGLLB.js.map +1 -0
  137. package/dist/chunk-HVC7FG6B.js +191 -0
  138. package/dist/chunk-HVC7FG6B.js.map +1 -0
  139. package/dist/chunk-HXFVOR7Z.js +496 -0
  140. package/dist/chunk-HXFVOR7Z.js.map +1 -0
  141. package/dist/chunk-IJWYS2PF.js +122 -0
  142. package/dist/chunk-IJWYS2PF.js.map +1 -0
  143. package/dist/chunk-INCHXAFK.js +1395 -0
  144. package/dist/chunk-INCHXAFK.js.map +1 -0
  145. package/dist/chunk-JT6BRGQM.js +1 -0
  146. package/dist/chunk-JT6BRGQM.js.map +1 -0
  147. package/dist/chunk-L6PMAEMB.js +115 -0
  148. package/dist/chunk-L6PMAEMB.js.map +1 -0
  149. package/dist/chunk-LOUGW6MU.js +126 -0
  150. package/dist/chunk-LOUGW6MU.js.map +1 -0
  151. package/dist/chunk-LYPZPE53.js +129 -0
  152. package/dist/chunk-LYPZPE53.js.map +1 -0
  153. package/dist/chunk-NNCCN7JP.js +186 -0
  154. package/dist/chunk-NNCCN7JP.js.map +1 -0
  155. package/dist/chunk-PBC3MZUL.js +212 -0
  156. package/dist/chunk-PBC3MZUL.js.map +1 -0
  157. package/dist/chunk-R4ADP2DC.js +20 -0
  158. package/dist/chunk-R4ADP2DC.js.map +1 -0
  159. package/dist/chunk-RHN4Y6VS.js +44 -0
  160. package/dist/chunk-RHN4Y6VS.js.map +1 -0
  161. package/dist/chunk-SDJNYPYK.js +770 -0
  162. package/dist/chunk-SDJNYPYK.js.map +1 -0
  163. package/dist/chunk-UGNTCOVR.js +28 -0
  164. package/dist/chunk-UGNTCOVR.js.map +1 -0
  165. package/dist/chunk-VC2PCK2S.js +31 -0
  166. package/dist/chunk-VC2PCK2S.js.map +1 -0
  167. package/dist/chunk-VF5YDZJC.js +305 -0
  168. package/dist/chunk-VF5YDZJC.js.map +1 -0
  169. package/dist/chunk-VISRDVTK.js +675 -0
  170. package/dist/chunk-VISRDVTK.js.map +1 -0
  171. package/dist/chunk-W6O3LVBY.js +102 -0
  172. package/dist/chunk-W6O3LVBY.js.map +1 -0
  173. package/dist/chunk-WFEAKJLR.js +47 -0
  174. package/dist/chunk-WFEAKJLR.js.map +1 -0
  175. package/dist/chunk-XIEY2OF4.js +67 -0
  176. package/dist/chunk-XIEY2OF4.js.map +1 -0
  177. package/dist/chunk-XITLHDG3.js +37 -0
  178. package/dist/chunk-XITLHDG3.js.map +1 -0
  179. package/dist/chunk-XMWPYZWZ.js +61 -0
  180. package/dist/chunk-XMWPYZWZ.js.map +1 -0
  181. package/dist/chunk-XUP6CNOM.js +34 -0
  182. package/dist/chunk-XUP6CNOM.js.map +1 -0
  183. package/dist/chunk-YABTQZDJ.js +25 -0
  184. package/dist/chunk-YABTQZDJ.js.map +1 -0
  185. package/dist/chunk-YMHVRBUU.js +199 -0
  186. package/dist/chunk-YMHVRBUU.js.map +1 -0
  187. package/dist/chunk-YMJ7BRKU.js +510 -0
  188. package/dist/chunk-YMJ7BRKU.js.map +1 -0
  189. package/dist/chunk-ZC3XWU7B.js +28 -0
  190. package/dist/chunk-ZC3XWU7B.js.map +1 -0
  191. package/dist/chunk-ZHMTD5KV.js +90 -0
  192. package/dist/chunk-ZHMTD5KV.js.map +1 -0
  193. package/dist/chunk-ZWZDLOE7.js +160 -0
  194. package/dist/chunk-ZWZDLOE7.js.map +1 -0
  195. package/dist/db-package/db/local-first-sqlite-adapter.d.ts +432 -0
  196. package/dist/db-package/db/local-first-sqlite-adapter.js +7 -0
  197. package/dist/db-package/db/local-first-sqlite-adapter.js.map +1 -0
  198. package/dist/db-package/index.d.ts +7 -0
  199. package/dist/db-package/index.js +16 -0
  200. package/dist/db-package/index.js.map +1 -0
  201. package/dist/db-package/migration/aggregator.d.ts +86 -0
  202. package/dist/db-package/migration/aggregator.js +7 -0
  203. package/dist/db-package/migration/aggregator.js.map +1 -0
  204. package/dist/db-package/migration/index.d.ts +3 -0
  205. package/dist/db-package/migration/index.js +8 -0
  206. package/dist/db-package/migration/index.js.map +1 -0
  207. package/dist/engine.d.ts +205 -0
  208. package/dist/engine.js +20 -0
  209. package/dist/engine.js.map +1 -0
  210. package/dist/entitlements/index.d.ts +313 -0
  211. package/dist/entitlements/index.js +23 -0
  212. package/dist/entitlements/index.js.map +1 -0
  213. package/dist/execution/chat.d.ts +7 -0
  214. package/dist/execution/chat.js +7 -0
  215. package/dist/execution/chat.js.map +1 -0
  216. package/dist/execution/index.d.ts +342 -0
  217. package/dist/execution/index.js +66 -0
  218. package/dist/execution/index.js.map +1 -0
  219. package/dist/execution/tool-agent.d.ts +7 -0
  220. package/dist/execution/tool-agent.js +8 -0
  221. package/dist/execution/tool-agent.js.map +1 -0
  222. package/dist/extensions/index.d.ts +172 -0
  223. package/dist/extensions/index.js +95 -0
  224. package/dist/extensions/index.js.map +1 -0
  225. package/dist/health/index.d.ts +35 -0
  226. package/dist/health/index.js +7 -0
  227. package/dist/health/index.js.map +1 -0
  228. package/dist/index.d.ts +43 -0
  229. package/dist/index.js +161 -0
  230. package/dist/index.js.map +1 -0
  231. package/dist/lifecycle/index.d.ts +133 -0
  232. package/dist/lifecycle/index.js +13 -0
  233. package/dist/lifecycle/index.js.map +1 -0
  234. package/dist/lifecycle-engine/backend-migration.d.ts +2 -0
  235. package/dist/lifecycle-engine/backend-migration.js +11 -0
  236. package/dist/lifecycle-engine/backend-migration.js.map +1 -0
  237. package/dist/lifecycle-engine/baseline.d.ts +2 -0
  238. package/dist/lifecycle-engine/baseline.js +9 -0
  239. package/dist/lifecycle-engine/baseline.js.map +1 -0
  240. package/dist/lifecycle-engine/index.d.ts +1497 -0
  241. package/dist/lifecycle-engine/index.js +41 -0
  242. package/dist/lifecycle-engine/index.js.map +1 -0
  243. package/dist/lifecycle-engine/platform/artifacts.d.ts +4 -0
  244. package/dist/lifecycle-engine/platform/artifacts.js +7 -0
  245. package/dist/lifecycle-engine/platform/artifacts.js.map +1 -0
  246. package/dist/lifecycle-engine/platform/control-plane.d.ts +12 -0
  247. package/dist/lifecycle-engine/platform/control-plane.js +2 -0
  248. package/dist/lifecycle-engine/platform/control-plane.js.map +1 -0
  249. package/dist/lifecycle-engine/platform/database-router.d.ts +118 -0
  250. package/dist/lifecycle-engine/platform/database-router.js +7 -0
  251. package/dist/lifecycle-engine/platform/database-router.js.map +1 -0
  252. package/dist/lifecycle-engine/platform/deployment-placements.d.ts +464 -0
  253. package/dist/lifecycle-engine/platform/deployment-placements.js +16 -0
  254. package/dist/lifecycle-engine/platform/deployment-placements.js.map +1 -0
  255. package/dist/lifecycle-engine/platform/deployment.d.ts +4 -0
  256. package/dist/lifecycle-engine/platform/deployment.js +17 -0
  257. package/dist/lifecycle-engine/platform/deployment.js.map +1 -0
  258. package/dist/lifecycle-engine/platform/index.d.ts +737 -0
  259. package/dist/lifecycle-engine/platform/index.js +60 -0
  260. package/dist/lifecycle-engine/platform/index.js.map +1 -0
  261. package/dist/lifecycle-engine/platform/runtime.d.ts +80 -0
  262. package/dist/lifecycle-engine/platform/runtime.js +11 -0
  263. package/dist/lifecycle-engine/platform/runtime.js.map +1 -0
  264. package/dist/lifecycle-engine/platform/site-publication.d.ts +102 -0
  265. package/dist/lifecycle-engine/platform/site-publication.js +7 -0
  266. package/dist/lifecycle-engine/platform/site-publication.js.map +1 -0
  267. package/dist/lifecycle-engine/platform/user-directory.d.ts +139 -0
  268. package/dist/lifecycle-engine/platform/user-directory.js +13 -0
  269. package/dist/lifecycle-engine/platform/user-directory.js.map +1 -0
  270. package/dist/mcp.d.ts +92 -0
  271. package/dist/mcp.js +10 -0
  272. package/dist/mcp.js.map +1 -0
  273. package/dist/middleware/auth.d.ts +118 -0
  274. package/dist/middleware/auth.js +7 -0
  275. package/dist/middleware/auth.js.map +1 -0
  276. package/dist/middleware/error-handler.d.ts +35 -0
  277. package/dist/middleware/error-handler.js +7 -0
  278. package/dist/middleware/error-handler.js.map +1 -0
  279. package/dist/middleware/module-guard.d.ts +33 -0
  280. package/dist/middleware/module-guard.js +7 -0
  281. package/dist/middleware/module-guard.js.map +1 -0
  282. package/dist/platform-admin/index.d.ts +37 -0
  283. package/dist/platform-admin/index.js +11 -0
  284. package/dist/platform-admin/index.js.map +1 -0
  285. package/dist/platform-admin/store.d.ts +346 -0
  286. package/dist/platform-admin/store.js +7 -0
  287. package/dist/platform-admin/store.js.map +1 -0
  288. package/dist/plugin-data/annotations.d.ts +6 -0
  289. package/dist/plugin-data/annotations.js +12 -0
  290. package/dist/plugin-data/annotations.js.map +1 -0
  291. package/dist/plugin-data/atomic-context.d.ts +41 -0
  292. package/dist/plugin-data/atomic-context.js +9 -0
  293. package/dist/plugin-data/atomic-context.js.map +1 -0
  294. package/dist/plugin-data/atomic.d.ts +6 -0
  295. package/dist/plugin-data/atomic.js +26 -0
  296. package/dist/plugin-data/atomic.js.map +1 -0
  297. package/dist/plugin-data/audit.d.ts +6 -0
  298. package/dist/plugin-data/audit.js +12 -0
  299. package/dist/plugin-data/audit.js.map +1 -0
  300. package/dist/plugin-data/commands.d.ts +6 -0
  301. package/dist/plugin-data/commands.js +8 -0
  302. package/dist/plugin-data/commands.js.map +1 -0
  303. package/dist/plugin-data/composite.d.ts +6 -0
  304. package/dist/plugin-data/composite.js +8 -0
  305. package/dist/plugin-data/composite.js.map +1 -0
  306. package/dist/plugin-data/delivery.d.ts +6 -0
  307. package/dist/plugin-data/delivery.js +16 -0
  308. package/dist/plugin-data/delivery.js.map +1 -0
  309. package/dist/plugin-data/index.d.ts +2798 -0
  310. package/dist/plugin-data/index.js +102 -0
  311. package/dist/plugin-data/index.js.map +1 -0
  312. package/dist/plugin-data/json-documents.d.ts +6 -0
  313. package/dist/plugin-data/json-documents.js +16 -0
  314. package/dist/plugin-data/json-documents.js.map +1 -0
  315. package/dist/plugin-data/outbox.d.ts +6 -0
  316. package/dist/plugin-data/outbox.js +16 -0
  317. package/dist/plugin-data/outbox.js.map +1 -0
  318. package/dist/plugin-data/scoped-records.d.ts +6 -0
  319. package/dist/plugin-data/scoped-records.js +10 -0
  320. package/dist/plugin-data/scoped-records.js.map +1 -0
  321. package/dist/plugin-sdk.d.ts +41 -0
  322. package/dist/plugin-sdk.js +10 -0
  323. package/dist/plugin-sdk.js.map +1 -0
  324. package/dist/sql-lifecycle/index.d.ts +138 -0
  325. package/dist/sql-lifecycle/index.js +167 -0
  326. package/dist/sql-lifecycle/index.js.map +1 -0
  327. package/dist/storage/index.d.ts +2 -0
  328. package/dist/storage/index.js +13 -0
  329. package/dist/storage/index.js.map +1 -0
  330. package/dist/storage/s3-compatible.d.ts +139 -0
  331. package/dist/storage/s3-compatible.js +11 -0
  332. package/dist/storage/s3-compatible.js.map +1 -0
  333. package/dist/tenant.d.ts +108 -0
  334. package/dist/tenant.js +9 -0
  335. package/dist/tenant.js.map +1 -0
  336. package/dist/workspace-context.d.ts +119 -0
  337. package/dist/workspace-context.js +9 -0
  338. package/dist/workspace-context.js.map +1 -0
  339. package/docs/api.md +30560 -0
  340. package/docs/db/README.md +49 -0
  341. package/docs/db/docs/api.md +1613 -0
  342. package/docs/db/docs/guide.md +47 -0
  343. package/docs/entitlements.md +60 -0
  344. package/docs/guide.md +92 -0
  345. package/docs/index.md +57 -0
  346. package/docs/ja/db/README.md +46 -0
  347. package/docs/ja/db/docs/guide.md +53 -0
  348. package/docs/ja/guide.md +46 -0
  349. package/docs/ja/lifecycle/README.md +46 -0
  350. package/docs/ja/lifecycle/docs/guide.md +45 -0
  351. package/docs/ja/storage/README.md +46 -0
  352. package/docs/ja/storage/docs/guide.md +43 -0
  353. package/docs/lifecycle/README.md +49 -0
  354. package/docs/lifecycle/docs/api.md +3770 -0
  355. package/docs/lifecycle/docs/baseline.md +50 -0
  356. package/docs/lifecycle/docs/guide.md +47 -0
  357. package/docs/storage/README.md +49 -0
  358. package/docs/storage/docs/api.md +470 -0
  359. package/docs/storage/docs/guide.md +47 -0
  360. package/package.json +354 -4
@@ -0,0 +1,1613 @@
1
+ ---
2
+ title: "@alneas/eaos-server API"
3
+ description: "@alneas/eaos-server API: source-derived declarations, parameter tables, return types and public import examples."
4
+ sidebar:
5
+ order: 30
6
+ archetype: "reference"
7
+ project: "eaos-workspace"
8
+ tags: ["api", "generated"]
9
+ ---
10
+
11
+ <!-- Generated by scripts/generate-public-api.ts from built source declarations. Edit source JSDoc/types and regenerate; do not edit these cards. -->
12
+
13
+ # @alneas/eaos-server API
14
+
15
+ ## Public entrypoints
16
+
17
+ | Import | Contract |
18
+ | --- | --- |
19
+ | `@alneas/eaos-server/db/local-first-sqlite-adapter` | Typed public export |
20
+ | `@alneas/eaos-server/db` | Typed public export |
21
+ | `@alneas/eaos-server/db/migration/aggregator` | Typed public export |
22
+ | `@alneas/eaos-server/db/migration` | Typed public export |
23
+
24
+ <a id="api-AccessFrequencyRecord"></a>
25
+
26
+ ## [INTERFACE] `AccessFrequencyRecord`
27
+
28
+ Per-table local counters used to rank adaptive synchronization candidates.
29
+
30
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
31
+
32
+ ### Signature
33
+
34
+ ```typescript
35
+ interface AccessFrequencyRecord {
36
+ table_name: string;
37
+ read_count: number;
38
+ write_count: number;
39
+ last_accessed_at: string;
40
+ }
41
+ ```
42
+
43
+ ### Parameters
44
+
45
+ | Name | Type | Required | Description |
46
+ | --- | --- | --- | --- |
47
+ | `table_name` | `string` | Yes | Tracked collection identifier. |
48
+ | `read_count` | `number` | Yes | Accumulated read count. |
49
+ | `write_count` | `number` | Yes | Accumulated write count. |
50
+ | `last_accessed_at` | `string` | Yes | ISO timestamp of the most recently recorded access. |
51
+
52
+ ### Returns
53
+
54
+ Type declaration; no runtime value.
55
+
56
+ ### See also
57
+
58
+ LocalFirstSqliteAdapter.recordAccess.
59
+
60
+ ### Public members
61
+
62
+ #### `table_name`
63
+
64
+ Tracked collection identifier.
65
+
66
+
67
+ #### `read_count`
68
+
69
+ Accumulated read count.
70
+
71
+
72
+ #### `write_count`
73
+
74
+ Accumulated write count.
75
+
76
+
77
+ #### `last_accessed_at`
78
+
79
+ ISO timestamp of the most recently recorded access.
80
+
81
+
82
+
83
+ ### Example
84
+
85
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
86
+
87
+ <a id="api-assertDataContractBinding"></a>
88
+
89
+ ## [FUNCTION] `assertDataContractBinding`
90
+
91
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
92
+
93
+ Imports: `@alneas/eaos-server/db`.
94
+
95
+ ### Signature
96
+
97
+ ```typescript
98
+ declare function assertDataContractBinding(catalog: DataContractCatalog, binding: DataContractBinding): void;
99
+ ```
100
+
101
+ ### Parameters
102
+
103
+ | Name | Type | Required | Description |
104
+ | --- | --- | --- | --- |
105
+ | `catalog` | `DataContractCatalog` | Yes | See the upstream owning declaration. |
106
+ | `binding` | `DataContractBinding` | Yes | See the upstream owning declaration. |
107
+
108
+ ### Returns
109
+
110
+ `void`
111
+
112
+ ### Example
113
+
114
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
115
+
116
+ <a id="api-assertJsonDocumentContracts"></a>
117
+
118
+ ## [FUNCTION] `assertJsonDocumentContracts`
119
+
120
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
121
+
122
+ Imports: `@alneas/eaos-server/db`.
123
+
124
+ ### Signature
125
+
126
+ ```typescript
127
+ declare function assertJsonDocumentContracts(documents: readonly JsonDocumentContract[], tables: ReadonlyMap<string, Record<string, unknown>>): void;
128
+ ```
129
+
130
+ ### Parameters
131
+
132
+ | Name | Type | Required | Description |
133
+ | --- | --- | --- | --- |
134
+ | `documents` | `readonly JsonDocumentContract[]` | Yes | See the upstream owning declaration. |
135
+ | `tables` | `ReadonlyMap<string, Record<string, unknown>>` | Yes | See the upstream owning declaration. |
136
+
137
+ ### Returns
138
+
139
+ `void`
140
+
141
+ ### Example
142
+
143
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
144
+
145
+ <a id="api-collectSchemaMigrations"></a>
146
+
147
+ ## [FUNCTION] `collectSchemaMigrations`
148
+
149
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
150
+
151
+ Imports: `@alneas/eaos-server/db`.
152
+
153
+ ### Signature
154
+
155
+ ```typescript
156
+ declare function collectSchemaMigrations(releases: readonly SchemaMigrationSource[], available?: readonly DataContract[]): PluginMigration[];
157
+ ```
158
+
159
+ ### Parameters
160
+
161
+ | Name | Type | Required | Description |
162
+ | --- | --- | --- | --- |
163
+ | `releases` | `readonly SchemaMigrationSource[]` | Yes | See the upstream owning declaration. |
164
+ | `available` | `readonly DataContract[]` | No | See the upstream owning declaration. |
165
+
166
+ ### Returns
167
+
168
+ `PluginMigration[]`
169
+
170
+ ### Example
171
+
172
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
173
+
174
+ <a id="api-ConnectionStats"></a>
175
+
176
+ ## [INTERFACE] `ConnectionStats`
177
+
178
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
179
+
180
+ Imports: `@alneas/eaos-server/db`.
181
+
182
+ ### Signature
183
+
184
+ ```typescript
185
+ interface ConnectionStats {
186
+ activeConnections: number;
187
+ poolSize: number;
188
+ driver: DbDriverType;
189
+ }
190
+ ```
191
+
192
+ ### Parameters
193
+
194
+ | Name | Type | Required | Description |
195
+ | --- | --- | --- | --- |
196
+ | `activeConnections` | `number` | Yes | See the upstream owning declaration. |
197
+ | `poolSize` | `number` | Yes | See the upstream owning declaration. |
198
+ | `driver` | `DbDriverType` | Yes | See the upstream owning declaration. |
199
+
200
+ ### Returns
201
+
202
+ Type declaration; no runtime value.
203
+
204
+ ### Example
205
+
206
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
207
+
208
+ <a id="api-createJsonDocumentAssertion"></a>
209
+
210
+ ## [FUNCTION] `createJsonDocumentAssertion`
211
+
212
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
213
+
214
+ Imports: `@alneas/eaos-server/db`.
215
+
216
+ ### Signature
217
+
218
+ ```typescript
219
+ declare function createJsonDocumentAssertion(document: JsonDocumentContract): (value: unknown) => void;
220
+ ```
221
+
222
+ ### Parameters
223
+
224
+ | Name | Type | Required | Description |
225
+ | --- | --- | --- | --- |
226
+ | `document` | `JsonDocumentContract` | Yes | See the upstream owning declaration. |
227
+
228
+ ### Returns
229
+
230
+ `(value: unknown) => void`
231
+
232
+ ### Example
233
+
234
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
235
+
236
+ <a id="api-DatabaseAdapter"></a>
237
+
238
+ ## [INTERFACE] `DatabaseAdapter`
239
+
240
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
241
+
242
+ Imports: `@alneas/eaos-server/db`.
243
+
244
+ ### Signature
245
+
246
+ ```typescript
247
+ interface DatabaseAdapter {
248
+ readonly type: DbDriverType;
249
+ withConnection<T>(domain: string, callback: (connection: any) => Promise<T>): Promise<T>;
250
+ withTenantConnection<T>(domain: string, callback: (connection: any) => Promise<T>, context: TenantSessionContext): Promise<T>;
251
+ ping(): Promise<boolean>;
252
+ getStats(): ConnectionStats;
253
+ close(): Promise<void>;
254
+ }
255
+ ```
256
+
257
+ ### Parameters
258
+
259
+ | Name | Type | Required | Description |
260
+ | --- | --- | --- | --- |
261
+ | `type` | `DbDriverType` | Yes | See the upstream owning declaration. |
262
+ | `withConnection` | `Promise<T>` | Yes | See the upstream owning declaration. |
263
+ | `withTenantConnection` | `Promise<T>` | Yes | See the upstream owning declaration. |
264
+ | `ping` | `Promise<boolean>` | Yes | See the upstream owning declaration. |
265
+ | `getStats` | `ConnectionStats` | Yes | See the upstream owning declaration. |
266
+ | `close` | `Promise<void>` | Yes | See the upstream owning declaration. |
267
+
268
+ ### Returns
269
+
270
+ Type declaration; no runtime value.
271
+
272
+ ### Example
273
+
274
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
275
+
276
+ <a id="api-DataContract"></a>
277
+
278
+ ## [INTERFACE] `DataContract`
279
+
280
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
281
+
282
+ Imports: `@alneas/eaos-server/db`.
283
+
284
+ ### Signature
285
+
286
+ ```typescript
287
+ interface DataContract {
288
+ id: string;
289
+ version: string;
290
+ description: string;
291
+ schema: Record<string, unknown>;
292
+ migrations: PluginMigration[];
293
+ dependencies?: Record<string, string>;
294
+ migrationIdentity?: string;
295
+ jsonDocuments?: JsonDocumentContract[];
296
+ }
297
+ ```
298
+
299
+ ### Parameters
300
+
301
+ | Name | Type | Required | Description |
302
+ | --- | --- | --- | --- |
303
+ | `id` | `string` | Yes | See the upstream owning declaration. |
304
+ | `version` | `string` | Yes | See the upstream owning declaration. |
305
+ | `description` | `string` | Yes | See the upstream owning declaration. |
306
+ | `schema` | `Record<string, unknown>` | Yes | See the upstream owning declaration. |
307
+ | `migrations` | `PluginMigration[]` | Yes | See the upstream owning declaration. |
308
+ | `dependencies` | `Record<string, string>` | No | See the upstream owning declaration. |
309
+ | `migrationIdentity` | `string` | No | See the upstream owning declaration. |
310
+ | `jsonDocuments` | `JsonDocumentContract[]` | No | See the upstream owning declaration. |
311
+
312
+ ### Returns
313
+
314
+ Type declaration; no runtime value.
315
+
316
+ ### Example
317
+
318
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
319
+
320
+ <a id="api-DataContractBinding"></a>
321
+
322
+ ## [INTERFACE] `DataContractBinding`
323
+
324
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
325
+
326
+ Imports: `@alneas/eaos-server/db`.
327
+
328
+ ### Signature
329
+
330
+ ```typescript
331
+ interface DataContractBinding {
332
+ contractId: string;
333
+ version: string;
334
+ table: string;
335
+ namespace?: string;
336
+ }
337
+ ```
338
+
339
+ ### Parameters
340
+
341
+ | Name | Type | Required | Description |
342
+ | --- | --- | --- | --- |
343
+ | `contractId` | `string` | Yes | See the upstream owning declaration. |
344
+ | `version` | `string` | Yes | See the upstream owning declaration. |
345
+ | `table` | `string` | Yes | See the upstream owning declaration. |
346
+ | `namespace` | `string` | No | See the upstream owning declaration. |
347
+
348
+ ### Returns
349
+
350
+ Type declaration; no runtime value.
351
+
352
+ ### Example
353
+
354
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
355
+
356
+ <a id="api-DataContractCatalog"></a>
357
+
358
+ ## [INTERFACE] `DataContractCatalog`
359
+
360
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
361
+
362
+ Imports: `@alneas/eaos-server/db`.
363
+
364
+ ### Signature
365
+
366
+ ```typescript
367
+ interface DataContractCatalog {
368
+ contracts: DataContract[];
369
+ tables: {
370
+ name: string;
371
+ contractId: string;
372
+ version: string;
373
+ schema: Record<string, unknown>;
374
+ }[];
375
+ }
376
+ ```
377
+
378
+ ### Parameters
379
+
380
+ | Name | Type | Required | Description |
381
+ | --- | --- | --- | --- |
382
+ | `contracts` | `DataContract[]` | Yes | See the upstream owning declaration. |
383
+ | `tables` | `{ name: string; contractId: string; version: string; schema: Record<string, unknown>; }[]` | Yes | See the upstream owning declaration. |
384
+
385
+ ### Returns
386
+
387
+ Type declaration; no runtime value.
388
+
389
+ ### Example
390
+
391
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
392
+
393
+ <a id="api-dataContractTables"></a>
394
+
395
+ ## [FUNCTION] `dataContractTables`
396
+
397
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
398
+
399
+ Imports: `@alneas/eaos-server/db`.
400
+
401
+ ### Signature
402
+
403
+ ```typescript
404
+ declare function dataContractTables(schema: Record<string, unknown>): Map<string, Record<string, unknown>>;
405
+ ```
406
+
407
+ ### Parameters
408
+
409
+ | Name | Type | Required | Description |
410
+ | --- | --- | --- | --- |
411
+ | `schema` | `Record<string, unknown>` | Yes | See the upstream owning declaration. |
412
+
413
+ ### Returns
414
+
415
+ `Map<string, Record<string, unknown>>`
416
+
417
+ ### Example
418
+
419
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
420
+
421
+ <a id="api-JsonDocumentContract"></a>
422
+
423
+ ## [INTERFACE] `JsonDocumentContract`
424
+
425
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
426
+
427
+ Imports: `@alneas/eaos-server/db`.
428
+
429
+ ### Signature
430
+
431
+ ```typescript
432
+ interface JsonDocumentContract {
433
+ id: string;
434
+ version: string;
435
+ table: string;
436
+ column: string;
437
+ namespace?: string;
438
+ jsonPath?: string;
439
+ recordPrefix?: string;
440
+ schema: Record<string, unknown>;
441
+ immutable?: boolean;
442
+ maxBytes?: number;
443
+ }
444
+ ```
445
+
446
+ ### Parameters
447
+
448
+ | Name | Type | Required | Description |
449
+ | --- | --- | --- | --- |
450
+ | `id` | `string` | Yes | See the upstream owning declaration. |
451
+ | `version` | `string` | Yes | See the upstream owning declaration. |
452
+ | `table` | `string` | Yes | See the upstream owning declaration. |
453
+ | `column` | `string` | Yes | See the upstream owning declaration. |
454
+ | `namespace` | `string` | No | See the upstream owning declaration. |
455
+ | `jsonPath` | `string` | No | See the upstream owning declaration. |
456
+ | `recordPrefix` | `string` | No | See the upstream owning declaration. |
457
+ | `schema` | `Record<string, unknown>` | Yes | See the upstream owning declaration. |
458
+ | `immutable` | `boolean` | No | See the upstream owning declaration. |
459
+ | `maxBytes` | `number` | No | See the upstream owning declaration. |
460
+
461
+ ### Returns
462
+
463
+ Type declaration; no runtime value.
464
+
465
+ ### Example
466
+
467
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
468
+
469
+ <a id="api-LocalFirstSqliteAdapter"></a>
470
+
471
+ ## [CLASS] `LocalFirstSqliteAdapter`
472
+
473
+ Persists local mutations and an outbox, then synchronizes with a host-provided upstream adapter.
474
+
475
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
476
+
477
+ ### Signature
478
+
479
+ ```typescript
480
+ declare class LocalFirstSqliteAdapter implements DataAccessAdapter {
481
+ readonly tenantId?: string;
482
+ constructor(options: LocalFirstSqliteAdapterOptions);
483
+ initSchema(): Promise<void>;
484
+ recordAccess(collection: string, type: 'read' | 'write'): Promise<void>;
485
+ syncActiveTables(limit?: number): Promise<string[]>;
486
+ find<T = unknown>(collection: string, filter?: Filter, options?: QueryOptions): Promise<T[]>;
487
+ count(collection: string, filter?: Filter, options?: QueryOptions): Promise<number>;
488
+ findOne<T = unknown>(collection: string, id: string, options?: QueryOptions): Promise<T | null>;
489
+ create<T = unknown>(collection: string, data: Record<string, unknown>, _options?: QueryOptions): Promise<T>;
490
+ update<T = unknown>(collection: string, id: string, data: Record<string, unknown>, _options?: QueryOptions): Promise<T>;
491
+ delete<T = unknown>(collection: string, id: string, _options?: QueryOptions): Promise<T>;
492
+ pullChanges(collection: string): Promise<number>;
493
+ processOutbox(): Promise<void>;
494
+ destroy(): void;
495
+ }
496
+ ```
497
+
498
+ ### Parameters
499
+
500
+ | Name | Type | Required | Description |
501
+ | --- | --- | --- | --- |
502
+ | `options` | `LocalFirstSqliteAdapterOptions` | Yes | Host drivers and synchronization settings; see {@link LocalFirstSqliteAdapterOptions}. |
503
+
504
+ ### Returns
505
+
506
+ `LocalFirstSqliteAdapter`
507
+
508
+ ### Remarks
509
+
510
+ Call initSchema before use; it creates metadata only, so provision domain tables separately. Local mutation and outbox insertion are separate writes, so failure may leave an unqueued local change. No tenant authorization is implemented: tenantId is only a create default. Serialize transaction-sensitive operations on the host driver; processOutbox excludes overlapping calls on this instance only. Call destroy to remove timers/listeners; it does not cancel in-flight work or close either driver.
511
+
512
+ ### Constructor contract
513
+
514
+ ### Remarks
515
+
516
+ The constructor performs no schema initialization. Timers/listeners start immediately unless disabled; call destroy when the instance is no longer needed.
517
+
518
+ ### Public members
519
+
520
+ #### `tenantId`
521
+
522
+ Optional create-time tenant_id fallback captured from options; not a read or mutation authorization filter.
523
+
524
+
525
+ #### `initSchema`
526
+
527
+ Initializes SQLite synchronization metadata tables and attempts WAL, NORMAL, and 5000 ms busy-timeout pragmas.
528
+
529
+ Returns: No value; resolves after metadata table creation. Pragma failures are deliberately ignored.
530
+
531
+ ### Errors and rejections
532
+
533
+ Rejects metadata table creation failures; earlier tables may already exist.
534
+
535
+ Example:
536
+
537
+ ```typescript
538
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
539
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
540
+ // The host supplies an initialized domain schema and authorized upstream adapter.
541
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
542
+ try {
543
+ await adapter.initSchema();
544
+ await adapter.initSchema();
545
+ } finally { adapter.destroy(); }
546
+ }
547
+ ```
548
+
549
+
550
+ #### `recordAccess`
551
+
552
+ Increments a table read or write counter and records the current ISO timestamp.
553
+
554
+ Parameters:
555
+
556
+ - `collection`: Table name recorded as a metadata value.
557
+ - `type`: Counter to increment; read contributes weight 2 and write weight 5 in adaptive ranking.
558
+
559
+ Returns: No value; resolves after the counter upsert.
560
+
561
+ ### Errors and rejections
562
+
563
+ Rejects SQLite failures.
564
+
565
+ Example:
566
+
567
+ ```typescript
568
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
569
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
570
+ // The host supplies an initialized domain schema and authorized upstream adapter.
571
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
572
+ try {
573
+ await adapter.initSchema();
574
+ await adapter.recordAccess("records", "read");
575
+ } finally { adapter.destroy(); }
576
+ }
577
+ ```
578
+
579
+
580
+ #### `syncActiveTables`
581
+
582
+ Pulls every essential table plus the highest weighted access-frequency tables sequentially.
583
+
584
+ Parameters:
585
+
586
+ - `limit`: Maximum frequency-ranked tables selected in addition to essential tables; defaults to 8 and is passed to SQLite without additional validation.
587
+
588
+ Returns: Names whose pullChanges calls completed, including tables with no new rows; failed tables are warned and omitted.
589
+
590
+ ### Errors and rejections
591
+
592
+ Rejects the initial frequency query failure; individual pull failures are caught.
593
+
594
+ Example:
595
+
596
+ ```typescript
597
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
598
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
599
+ // The host supplies an initialized domain schema and authorized upstream adapter.
600
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
601
+ try {
602
+ await adapter.initSchema();
603
+ return await adapter.syncActiveTables(8);
604
+ } finally { adapter.destroy(); }
605
+ }
606
+ ```
607
+
608
+
609
+ #### `find`
610
+
611
+ Queries local SQLite rows and schedules a best-effort read-frequency update.
612
+
613
+ Parameters:
614
+
615
+ - `collection`: Local table identifier, quoted by the adapter.
616
+ - `filter`: AND-combined equality/null or $eq/$gt/$gte/$lt/$lte column conditions; other operator objects are rejected.
617
+ - `options`: Supports sort, limit, and skip; limit/skip must be nonnegative safe integers. Projection and other options are ignored.
618
+
619
+ Returns: Local rows, or an empty array; remote freshness is not implied.
620
+
621
+ ### Type parameters
622
+
623
+ - `T`: Expected local row shape; no runtime schema validation is performed.
624
+
625
+ ### Errors and rejections
626
+
627
+ Rejects unsupported filters, invalid pagination, or SQLite query failures. Access-stat failures are ignored.
628
+
629
+ Example:
630
+
631
+ ```typescript
632
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
633
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
634
+ // The host supplies an initialized domain schema and authorized upstream adapter.
635
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
636
+ try {
637
+ await adapter.initSchema();
638
+ return await adapter.find("records", { active: true }, { limit: 10 });
639
+ } finally { adapter.destroy(); }
640
+ }
641
+ ```
642
+
643
+
644
+ #### `count`
645
+
646
+ Counts local rows matching a filter without pagination.
647
+
648
+ Parameters:
649
+
650
+ - `collection`: Local table identifier, quoted by the adapter.
651
+ - `filter`: Same supported AND-combined conditions as find.
652
+ - `options`: Sort is retained; limit and skip are discarded. Other options are ignored.
653
+
654
+ Returns: Numeric count, or zero if the driver returns no count row.
655
+
656
+ ### Errors and rejections
657
+
658
+ Rejects unsupported filters or SQLite failures; access-stat failures are ignored.
659
+
660
+ Example:
661
+
662
+ ```typescript
663
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
664
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
665
+ // The host supplies an initialized domain schema and authorized upstream adapter.
666
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
667
+ try {
668
+ await adapter.initSchema();
669
+ return await adapter.count("records");
670
+ } finally { adapter.destroy(); }
671
+ }
672
+ ```
673
+
674
+
675
+ #### `findOne`
676
+
677
+ Queries a local row by its id column.
678
+
679
+ Parameters:
680
+
681
+ - `collection`: Local table identifier.
682
+ - `id`: ID value bound to an equality filter.
683
+ - `options`: find options with limit overridden to 1; skip, if supplied, still applies.
684
+
685
+ Returns: First matching row, or null.
686
+
687
+ ### Type parameters
688
+
689
+ - `T`: Expected local row shape; no runtime validation is performed.
690
+
691
+ ### Errors and rejections
692
+
693
+ Rejects invalid pagination or SQLite query failures.
694
+
695
+ Example:
696
+
697
+ ```typescript
698
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
699
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
700
+ // The host supplies an initialized domain schema and authorized upstream adapter.
701
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
702
+ try {
703
+ await adapter.initSchema();
704
+ return await adapter.findOne("records", "record-1");
705
+ } finally { adapter.destroy(); }
706
+ }
707
+ ```
708
+
709
+
710
+ #### `create`
711
+
712
+ Inserts a local record before separately enqueueing its upstream INSERT.
713
+
714
+ Parameters:
715
+
716
+ - `collection`: Provisioned local table identifier.
717
+ - `data`: Column values; a truthy id is retained, otherwise an ID is generated. Missing tenant columns may receive the configured tenantId. Object values are JSON-encoded for local SQL.
718
+ - `_options`: Accepted for DataAccessAdapter compatibility and ignored.
719
+
720
+ Returns: The input record with its chosen ID and optional tenant default, before upstream acknowledgement.
721
+
722
+ ### Type parameters
723
+
724
+ - `T`: Expected returned record shape; no runtime validation is performed.
725
+
726
+ ### Errors and rejections
727
+
728
+ Rejects local SQL, serialization, or enqueue failure; a local insert may already have committed. Background outbox errors are ignored by this call.
729
+
730
+ Example:
731
+
732
+ ```typescript
733
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
734
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
735
+ // The host supplies an initialized domain schema and authorized upstream adapter.
736
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
737
+ try {
738
+ await adapter.initSchema();
739
+ return await adapter.create("records", { title: "Example" });
740
+ } finally { adapter.destroy(); }
741
+ }
742
+ ```
743
+
744
+
745
+ #### `update`
746
+
747
+ Snapshots a local row, updates its columns, and separately enqueues an upstream UPDATE.
748
+
749
+ Parameters:
750
+
751
+ - `collection`: Provisioned local table identifier.
752
+ - `id`: Record ID bound in local SQL and used for upstream update.
753
+ - `data`: Updated columns; local SQL excludes id but the payload is forwarded unchanged upstream. An empty update can cause a SQLite syntax failure.
754
+ - `_options`: Accepted for DataAccessAdapter compatibility and ignored.
755
+
756
+ Returns: Snapshot merged with data and the supplied id, even if no local row existed.
757
+
758
+ ### Type parameters
759
+
760
+ - `T`: Expected returned merged record shape.
761
+
762
+ ### Errors and rejections
763
+
764
+ Rejects snapshot, local SQL, serialization, or enqueue failures; local changes may already have committed.
765
+
766
+ Example:
767
+
768
+ ```typescript
769
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
770
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
771
+ // The host supplies an initialized domain schema and authorized upstream adapter.
772
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
773
+ try {
774
+ await adapter.initSchema();
775
+ return await adapter.update("records", "record-1", { title: "Changed" });
776
+ } finally { adapter.destroy(); }
777
+ }
778
+ ```
779
+
780
+
781
+ #### `delete`
782
+
783
+ Deletes a local row and separately enqueues upstream deletion with a rollback snapshot.
784
+
785
+ Parameters:
786
+
787
+ - `collection`: Provisioned local table identifier.
788
+ - `id`: Record ID used for local and upstream deletion.
789
+ - `_options`: Accepted for DataAccessAdapter compatibility and ignored.
790
+
791
+ Returns: The previous local record, or an object containing only id when absent.
792
+
793
+ ### Type parameters
794
+
795
+ - `T`: Expected deleted record shape.
796
+
797
+ ### Errors and rejections
798
+
799
+ Rejects snapshot, local delete, or enqueue failures; local deletion may already have committed.
800
+
801
+ Example:
802
+
803
+ ```typescript
804
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
805
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
806
+ // The host supplies an initialized domain schema and authorized upstream adapter.
807
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
808
+ try {
809
+ await adapter.initSchema();
810
+ return await adapter.delete("records", "record-1");
811
+ } finally { adapter.destroy(); }
812
+ }
813
+ ```
814
+
815
+
816
+ #### `pullChanges`
817
+
818
+ Pulls incremental remote changes from Oracle ADB using ORA_ROWSCN cursor within a batch transaction.
819
+
820
+ Parameters:
821
+
822
+ - `collection`: Provisioned local table whose upstream supports ORA_ROWSCN filtering, ordering, and projection.
823
+
824
+ Returns: Number of remote rows upserted, or zero when no changes were returned.
825
+
826
+ ### Remarks
827
+
828
+ Remote deletes are not discovered by this pull. No per-table synchronization lock prevents overlapping pulls or concurrent host transactions.
829
+
830
+ ### Errors and rejections
831
+
832
+ Rejects upstream or local SQL failures; an opened local transaction is rolled back best-effort on upsert/cursor failure.
833
+
834
+ Example:
835
+
836
+ ```typescript
837
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
838
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
839
+ // The host supplies an initialized domain schema and authorized upstream adapter.
840
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
841
+ try {
842
+ await adapter.initSchema();
843
+ return await adapter.pullChanges("records");
844
+ } finally { adapter.destroy(); }
845
+ }
846
+ ```
847
+
848
+
849
+ #### `processOutbox`
850
+
851
+ Background Outbox Worker:
852
+ Processes at most 20 pending mutations in creation order, pushes upstream, and attempts rollback for non-network failures.
853
+
854
+ Returns: No value; resolves after one batch, or immediately if this instance already has a batch running.
855
+
856
+ ### Remarks
857
+
858
+ Recognized network failures return rows to pending and increment retry_count; no delay/backoff is applied here. Other failures attempt local snapshot rollback and mark failed; rollback/callback errors are logged. Remote success followed by local queue-delete failure may leave an uncertain delivery outcome. There is no cross-instance lease or deduplication.
859
+
860
+ ### Errors and rejections
861
+
862
+ Rejects metadata reads, malformed persisted JSON, or error-handling SQL failures. Ordinary upstream failures are recorded or rolled back rather than rejected.
863
+
864
+ Example:
865
+
866
+ ```typescript
867
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
868
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
869
+ // The host supplies an initialized domain schema and authorized upstream adapter.
870
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
871
+ try {
872
+ await adapter.initSchema();
873
+ await adapter.processOutbox();
874
+ } finally { adapter.destroy(); }
875
+ }
876
+ ```
877
+
878
+
879
+ #### `destroy`
880
+
881
+ Stops this instance's polling timer and removes its browser focus/online listeners.
882
+
883
+ Returns: No value; repeated calls are safe. In-flight synchronization continues and drivers remain open.
884
+
885
+ Example:
886
+
887
+ ```typescript
888
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
889
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
890
+ // The host supplies an initialized domain schema and authorized upstream adapter.
891
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
892
+ try {
893
+ await adapter.initSchema();
894
+ adapter.destroy();
895
+ } finally { adapter.destroy(); }
896
+ }
897
+ ```
898
+
899
+
900
+
901
+ ### Example
902
+
903
+ ```typescript
904
+ import { LocalFirstSqliteAdapter, type LocalFirstSqliteAdapterOptions } from "@alneas/eaos-server/db/local-first-sqlite-adapter";
905
+ export async function example(options: LocalFirstSqliteAdapterOptions) {
906
+ // The host supplies an initialized domain schema and authorized upstream adapter.
907
+ const adapter = new LocalFirstSqliteAdapter({ ...options, syncIntervalMs: 0, enableLifecycleSync: false });
908
+ try {
909
+ await adapter.initSchema();
910
+ return await adapter.find("records");
911
+ } finally { adapter.destroy(); }
912
+ }
913
+ ```
914
+
915
+
916
+ <a id="api-LocalFirstSqliteAdapterOptions"></a>
917
+
918
+ ## [INTERFACE] `LocalFirstSqliteAdapterOptions`
919
+
920
+ Host drivers, sync behavior, and cleanup-sensitive scheduling for [LocalFirstSqliteAdapter](#api-LocalFirstSqliteAdapter).
921
+
922
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
923
+
924
+ ### Signature
925
+
926
+ ```typescript
927
+ interface LocalFirstSqliteAdapterOptions {
928
+ sqlite: SqliteDriver;
929
+ upstream: DataAccessAdapter;
930
+ tenantId?: string;
931
+ essentialTables?: string[];
932
+ onSyncError?: (event: SyncErrorEvent) => void;
933
+ syncIntervalMs?: number;
934
+ autoSyncOnMutation?: boolean;
935
+ enableLifecycleSync?: boolean;
936
+ }
937
+ ```
938
+
939
+ ### Parameters
940
+
941
+ | Name | Type | Required | Description |
942
+ | --- | --- | --- | --- |
943
+ | `sqlite` | `SqliteDriver` | Yes | SQLite driver instance |
944
+ | `upstream` | `DataAccessAdapter` | Yes | Cloud upstream adapter (e.g. OracleOrdsAdapter / SupabaseAdapter) |
945
+ | `tenantId` | `string` | No | Optional tenant_id default added only on create when neither tenant_id nor tenantId is supplied; this does not scope reads, updates, deletes, or upstream access. Host authorization remains required. |
946
+ | `essentialTables` | `string[]` | No | Essential master tables that are always synchronized (Tier 1) |
947
+ | `onSyncError` | `(event: SyncErrorEvent) => void` | No | Callback fired when an outbox sync fails permanently and triggers a rollback |
948
+ | `syncIntervalMs` | `number` | No | Outbox polling interval in milliseconds. Zero disables polling; other falsy values fall back to 5000. |
949
+ | `autoSyncOnMutation` | `boolean` | No | Whether to immediately trigger background sync after local mutation (default: true) |
950
+ | `enableLifecycleSync` | `boolean` | No | Whether to attach window focus / online event listeners (default: true if in browser/tauri) |
951
+
952
+ ### Returns
953
+
954
+ Type declaration; no runtime value.
955
+
956
+ ### Public members
957
+
958
+ #### `sqlite`
959
+
960
+ SQLite driver instance
961
+
962
+
963
+ #### `upstream`
964
+
965
+ Cloud upstream adapter (e.g. OracleOrdsAdapter / SupabaseAdapter)
966
+
967
+
968
+ #### `tenantId`
969
+
970
+ Optional tenant_id default added only on create when neither tenant_id nor tenantId is supplied; this does not scope reads, updates, deletes, or upstream access. Host authorization remains required.
971
+
972
+
973
+ #### `essentialTables`
974
+
975
+ Essential master tables that are always synchronized (Tier 1)
976
+
977
+
978
+ #### `onSyncError`
979
+
980
+ Callback fired when an outbox sync fails permanently and triggers a rollback
981
+
982
+
983
+ #### `syncIntervalMs`
984
+
985
+ Outbox polling interval in milliseconds. Zero disables polling; other falsy values fall back to 5000.
986
+
987
+ Default: `5000`.
988
+
989
+
990
+ #### `autoSyncOnMutation`
991
+
992
+ Whether to immediately trigger background sync after local mutation (default: true)
993
+
994
+
995
+ #### `enableLifecycleSync`
996
+
997
+ Whether to attach window focus / online event listeners (default: true if in browser/tauri)
998
+
999
+
1000
+
1001
+ ### Example
1002
+
1003
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1004
+
1005
+ <a id="api-MigrationAggregator"></a>
1006
+
1007
+ ## [CLASS] `MigrationAggregator`
1008
+
1009
+ Collects plugin schema sources and renders legacy PostgreSQL or Oracle DDL text.
1010
+
1011
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/migration`, `@alneas/eaos-server/db/migration/aggregator`.
1012
+
1013
+ ### Signature
1014
+
1015
+ ```typescript
1016
+ declare class MigrationAggregator {
1017
+ constructor(plugins: PluginManifest[], dataContracts?: DataContract[]);
1018
+ collectSchemas(resolveSchema: (pluginId: string, extensionId?: string) => Record<string, any> | null): SchemaSource[];
1019
+ generatePostgres(sources: SchemaSource[], dbDriver?: string): string;
1020
+ generateOracle(sources: SchemaSource[]): string;
1021
+ }
1022
+ ```
1023
+
1024
+ ### Parameters
1025
+
1026
+ | Name | Type | Required | Description |
1027
+ | --- | --- | --- | --- |
1028
+ | `plugins` | `PluginManifest[]` | Yes | Manifests consulted on every collection call; the array is retained rather than cloned. |
1029
+ | `dataContracts` | `DataContract[]` | No | Available contracts used to resolve manifest requirements; defaults to none and is retained. |
1030
+
1031
+ ### Returns
1032
+
1033
+ `MigrationAggregator`
1034
+
1035
+ ### Remarks
1036
+
1037
+ Generation never executes SQL. Schema identifiers, defaults, and comments are interpolated from trusted schema inputs; review generated SQL before applying it. Canonical data-contract JSON Schema requires reviewed lifecycle migrations rather than these legacy converters.
1038
+
1039
+ ### Constructor contract
1040
+
1041
+ ### Public members
1042
+
1043
+ #### `collectSchemas`
1044
+
1045
+ Collects resolved data contracts first, then plugin and extension schemas by migration order.
1046
+
1047
+ Parameters:
1048
+
1049
+ - `resolveSchema`: Called with plugin ID and optional extension ID; returns a legacy schema or null to skip it. Plugin schemas declaring data contracts skip the plugin-level callback, but extensions are still resolved.
1050
+
1051
+ Returns: Ordered schema sources; manifests with equal order retain their sort order and missing callback results are omitted.
1052
+
1053
+ ### Errors and rejections
1054
+
1055
+ Propagates contract resolution or callback errors.
1056
+
1057
+ Example:
1058
+
1059
+ ```typescript
1060
+ import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
1061
+ const aggregator = new MigrationAggregator([]);
1062
+ console.log(aggregator.collectSchemas(() => null)); // []
1063
+ ```
1064
+
1065
+
1066
+ #### `generatePostgres`
1067
+
1068
+ Renders PostgreSQL table DDL and tenant_id row-level-security policies as text.
1069
+
1070
+ Parameters:
1071
+
1072
+ - `sources`: Trusted legacy schemas rendered in supplied order. Every table must declare tenant_id not explicitly nullable.
1073
+ - `dbDriver`: Label included in SQL comments only; defaults to postgres and does not change dialect.
1074
+
1075
+ Returns: SQL text with a generated timestamp, CREATE TABLE IF NOT EXISTS, and tenant policies using app.current_tenant as UUID.
1076
+
1077
+ ### Remarks
1078
+
1079
+ The host must set app.current_tenant appropriately and review/apply SQL separately.
1080
+
1081
+ ### Errors and rejections
1082
+
1083
+ For canonical x-db/$defs schemas or missing/nullable tenant_id columns.
1084
+
1085
+ Example:
1086
+
1087
+ ```typescript
1088
+ import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
1089
+ const aggregator = new MigrationAggregator([]);
1090
+ console.log(aggregator.generatePostgres([]));
1091
+ ```
1092
+
1093
+
1094
+ #### `generateOracle`
1095
+
1096
+ Renders legacy Oracle table DDL as text.
1097
+
1098
+ Parameters:
1099
+
1100
+ - `sources`: Trusted legacy schemas rendered in supplied order; every table must declare tenant_id not explicitly nullable.
1101
+
1102
+ Returns: SQL text with a generated timestamp and CREATE TABLE statements; no VPD policies or default clauses are emitted by this converter.
1103
+
1104
+ ### Remarks
1105
+
1106
+ Applying SQL and enforcing Oracle tenant isolation remain host responsibilities.
1107
+
1108
+ ### Errors and rejections
1109
+
1110
+ For canonical x-db/$defs schemas or missing/nullable tenant_id columns.
1111
+
1112
+ Example:
1113
+
1114
+ ```typescript
1115
+ import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
1116
+ const aggregator = new MigrationAggregator([]);
1117
+ console.log(aggregator.generateOracle([]));
1118
+ ```
1119
+
1120
+
1121
+
1122
+ ### Example
1123
+
1124
+ ```typescript
1125
+ import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
1126
+ const aggregator = new MigrationAggregator([]);
1127
+ console.log(aggregator.generatePostgres([]));
1128
+ ```
1129
+
1130
+
1131
+ <a id="api-OutboxItem"></a>
1132
+
1133
+ ## [INTERFACE] `OutboxItem`
1134
+
1135
+ Local mutation and rollback snapshot awaiting upstream synchronization.
1136
+
1137
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
1138
+
1139
+ ### Signature
1140
+
1141
+ ```typescript
1142
+ interface OutboxItem {
1143
+ id: string;
1144
+ tableName: string;
1145
+ recordId: string;
1146
+ operation: 'INSERT' | 'UPDATE' | 'DELETE';
1147
+ payload: Record<string, any>;
1148
+ previousState?: Record<string, any> | null;
1149
+ status: SyncStatus;
1150
+ errorMessage?: string;
1151
+ retryCount: number;
1152
+ createdAt: string;
1153
+ }
1154
+ ```
1155
+
1156
+ ### Parameters
1157
+
1158
+ | Name | Type | Required | Description |
1159
+ | --- | --- | --- | --- |
1160
+ | `id` | `string` | Yes | Outbox row identifier. |
1161
+ | `tableName` | `string` | Yes | Target local/upstream table. |
1162
+ | `recordId` | `string` | Yes | Mutation record identifier. |
1163
+ | `operation` | `'INSERT' \| 'UPDATE' \| 'DELETE'` | Yes | INSERT, UPDATE, or DELETE operation forwarded upstream. |
1164
+ | `payload` | `Record<string, any>` | Yes | Mutation data; update retains only the supplied changes. |
1165
+ | `previousState` | `Record<string, any> \| null` | No | Optional pre-mutation row used for rollback; null for inserts or missing snapshots. |
1166
+ | `status` | `SyncStatus` | Yes | Persisted synchronization state. |
1167
+ | `errorMessage` | `string` | No | Optional most recent persisted error description. |
1168
+ | `retryCount` | `number` | Yes | Number of recognized transient failures recorded so far. |
1169
+ | `createdAt` | `string` | Yes | ISO creation timestamp used for batch ordering. |
1170
+
1171
+ ### Returns
1172
+
1173
+ Type declaration; no runtime value.
1174
+
1175
+ ### See also
1176
+
1177
+ LocalFirstSqliteAdapter.processOutbox.
1178
+
1179
+ ### Public members
1180
+
1181
+ #### `id`
1182
+
1183
+ Outbox row identifier.
1184
+
1185
+
1186
+ #### `tableName`
1187
+
1188
+ Target local/upstream table.
1189
+
1190
+
1191
+ #### `recordId`
1192
+
1193
+ Mutation record identifier.
1194
+
1195
+
1196
+ #### `operation`
1197
+
1198
+ INSERT, UPDATE, or DELETE operation forwarded upstream.
1199
+
1200
+
1201
+ #### `payload`
1202
+
1203
+ Mutation data; update retains only the supplied changes.
1204
+
1205
+
1206
+ #### `previousState`
1207
+
1208
+ Optional pre-mutation row used for rollback; null for inserts or missing snapshots.
1209
+
1210
+
1211
+ #### `status`
1212
+
1213
+ Persisted synchronization state.
1214
+
1215
+
1216
+ #### `errorMessage`
1217
+
1218
+ Optional most recent persisted error description.
1219
+
1220
+
1221
+ #### `retryCount`
1222
+
1223
+ Number of recognized transient failures recorded so far.
1224
+
1225
+
1226
+ #### `createdAt`
1227
+
1228
+ ISO creation timestamp used for batch ordering.
1229
+
1230
+
1231
+
1232
+ ### Example
1233
+
1234
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1235
+
1236
+ <a id="api-PluginMigration"></a>
1237
+
1238
+ ## [INTERFACE] `PluginMigration`
1239
+
1240
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
1241
+
1242
+ Imports: `@alneas/eaos-server/db`.
1243
+
1244
+ ### Signature
1245
+
1246
+ ```typescript
1247
+ interface PluginMigration {
1248
+ id: string;
1249
+ scope: 'database' | 'tenant';
1250
+ sql: Partial<Record<'sqlite' | 'oracle' | 'postgres', string[]>>;
1251
+ }
1252
+ ```
1253
+
1254
+ ### Parameters
1255
+
1256
+ | Name | Type | Required | Description |
1257
+ | --- | --- | --- | --- |
1258
+ | `id` | `string` | Yes | See the upstream owning declaration. |
1259
+ | `scope` | `'database' \| 'tenant'` | Yes | See the upstream owning declaration. |
1260
+ | `sql` | `Partial<Record<'sqlite' \| 'oracle' \| 'postgres', string[]>>` | Yes | See the upstream owning declaration. |
1261
+
1262
+ ### Returns
1263
+
1264
+ Type declaration; no runtime value.
1265
+
1266
+ ### Example
1267
+
1268
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1269
+
1270
+ <a id="api-resolveDataContracts"></a>
1271
+
1272
+ ## [FUNCTION] `resolveDataContracts`
1273
+
1274
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
1275
+
1276
+ Imports: `@alneas/eaos-server/db`.
1277
+
1278
+ ### Signature
1279
+
1280
+ ```typescript
1281
+ declare function resolveDataContracts(available: readonly DataContract[], requirements: Record<string, string>): DataContractCatalog;
1282
+ ```
1283
+
1284
+ ### Parameters
1285
+
1286
+ | Name | Type | Required | Description |
1287
+ | --- | --- | --- | --- |
1288
+ | `available` | `readonly DataContract[]` | Yes | See the upstream owning declaration. |
1289
+ | `requirements` | `Record<string, string>` | Yes | See the upstream owning declaration. |
1290
+
1291
+ ### Returns
1292
+
1293
+ `DataContractCatalog`
1294
+
1295
+ ### Example
1296
+
1297
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1298
+
1299
+ <a id="api-SchemaMigrationSource"></a>
1300
+
1301
+ ## [INTERFACE] `SchemaMigrationSource`
1302
+
1303
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
1304
+
1305
+ Imports: `@alneas/eaos-server/db`.
1306
+
1307
+ ### Signature
1308
+
1309
+ ```typescript
1310
+ interface SchemaMigrationSource {
1311
+ migrations: PluginMigration[];
1312
+ schemaDependencies?: Record<string, string>;
1313
+ schemaContracts?: DataContract[];
1314
+ }
1315
+ ```
1316
+
1317
+ ### Parameters
1318
+
1319
+ | Name | Type | Required | Description |
1320
+ | --- | --- | --- | --- |
1321
+ | `migrations` | `PluginMigration[]` | Yes | See the upstream owning declaration. |
1322
+ | `schemaDependencies` | `Record<string, string>` | No | See the upstream owning declaration. |
1323
+ | `schemaContracts` | `DataContract[]` | No | See the upstream owning declaration. |
1324
+
1325
+ ### Returns
1326
+
1327
+ Type declaration; no runtime value.
1328
+
1329
+ ### Example
1330
+
1331
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1332
+
1333
+ <a id="api-SchemaSource"></a>
1334
+
1335
+ ## [INTERFACE] `SchemaSource`
1336
+
1337
+ Legacy table-schema input collected for migration text generation.
1338
+
1339
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/migration`, `@alneas/eaos-server/db/migration/aggregator`.
1340
+
1341
+ ### Signature
1342
+
1343
+ ```typescript
1344
+ interface SchemaSource {
1345
+ pluginId: string;
1346
+ pluginName?: string;
1347
+ extensionId?: string;
1348
+ migrationOrder?: number;
1349
+ schemaJson: Record<string, any>;
1350
+ }
1351
+ ```
1352
+
1353
+ ### Parameters
1354
+
1355
+ | Name | Type | Required | Description |
1356
+ | --- | --- | --- | --- |
1357
+ | `pluginId` | `string` | Yes | Plugin ID, or data:{contractId} for resolved data contracts. |
1358
+ | `pluginName` | `string` | No | Optional display label used in generated SQL comments. |
1359
+ | `extensionId` | `string` | No | Optional extension ID appended to the source identifier. |
1360
+ | `migrationOrder` | `number` | No | Sort order from the plugin manifest; defaults to 999 for plugin schemas. |
1361
+ | `schemaJson` | `Record<string, any>` | Yes | Legacy tables/columns schema; canonical x-db/$defs schemas require reviewed lifecycle migrations instead. |
1362
+
1363
+ ### Returns
1364
+
1365
+ Type declaration; no runtime value.
1366
+
1367
+ ### See also
1368
+
1369
+ MigrationAggregator for a complete usage example.
1370
+
1371
+ ### Public members
1372
+
1373
+ #### `pluginId`
1374
+
1375
+ Plugin ID, or data:{contractId} for resolved data contracts.
1376
+
1377
+
1378
+ #### `pluginName`
1379
+
1380
+ Optional display label used in generated SQL comments.
1381
+
1382
+
1383
+ #### `extensionId`
1384
+
1385
+ Optional extension ID appended to the source identifier.
1386
+
1387
+
1388
+ #### `migrationOrder`
1389
+
1390
+ Sort order from the plugin manifest; defaults to 999 for plugin schemas.
1391
+
1392
+
1393
+ #### `schemaJson`
1394
+
1395
+ Legacy tables/columns schema; canonical x-db/$defs schemas require reviewed lifecycle migrations instead.
1396
+
1397
+
1398
+
1399
+ ### Example
1400
+
1401
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1402
+
1403
+ <a id="api-SqliteDriver"></a>
1404
+
1405
+ ## [INTERFACE] `SqliteDriver`
1406
+
1407
+ Host SQLite operations required by [LocalFirstSqliteAdapter](#api-LocalFirstSqliteAdapter); execution and transaction ownership belong to the host.
1408
+
1409
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
1410
+
1411
+ ### Signature
1412
+
1413
+ ```typescript
1414
+ interface SqliteDriver {
1415
+ execute(sql: string, params?: any[]): Promise<any>;
1416
+ select<T = any>(sql: string, params?: any[]): Promise<T[]>;
1417
+ }
1418
+ ```
1419
+
1420
+ ### Parameters
1421
+
1422
+ | Name | Type | Required | Description |
1423
+ | --- | --- | --- | --- |
1424
+ | `execute` | `Promise<any>` | Yes | Executes SQLite SQL with positional bindings. |
1425
+ | `select` | `Promise<T[]>` | Yes | Selects SQLite rows using positional bindings. |
1426
+
1427
+ ### Returns
1428
+
1429
+ Type declaration; no runtime value.
1430
+
1431
+ ### Public members
1432
+
1433
+ #### `execute`
1434
+
1435
+ Executes SQLite SQL with positional bindings.
1436
+
1437
+ Parameters:
1438
+
1439
+ - `sql`: SQL statement, including transaction control statements.
1440
+ - `params`: Positional values for question-mark placeholders; omitted for parameterless SQL.
1441
+
1442
+ Returns: Driver-specific execution result, which the adapter does not inspect.
1443
+
1444
+ ### Errors and rejections
1445
+
1446
+ Rejects on driver/database failure; callers determine rollback handling.
1447
+
1448
+ Example:
1449
+
1450
+ ```typescript
1451
+ import type { SqliteDriver } from "@alneas/eaos-server/db";
1452
+ export async function inspectConnectedSqlite(driver: SqliteDriver) {
1453
+ // The host opens and closes the connection; this statement changes no records.
1454
+ return await driver.execute("SELECT 1 AS ready", []);
1455
+ }
1456
+ ```
1457
+
1458
+
1459
+ #### `select`
1460
+
1461
+ Selects SQLite rows using positional bindings.
1462
+
1463
+ Parameters:
1464
+
1465
+ - `sql`: SELECT statement.
1466
+ - `params`: Positional values, or omitted for parameterless queries.
1467
+
1468
+ Returns: Matching rows, or an empty array.
1469
+
1470
+ ### Type parameters
1471
+
1472
+ - `T`: Row shape expected by the caller; the driver does not establish runtime validation.
1473
+
1474
+ ### Errors and rejections
1475
+
1476
+ Rejects on driver/database failure.
1477
+
1478
+ Example:
1479
+
1480
+ ```typescript
1481
+ import type { SqliteDriver } from "@alneas/eaos-server/db";
1482
+ export async function selectConnectedSqlite(driver: SqliteDriver) {
1483
+ const rows = await driver.select<{ ready: number }>("SELECT 1 AS ready", []);
1484
+ return rows[0]?.ready; // The type argument does not perform runtime validation.
1485
+ }
1486
+ ```
1487
+
1488
+
1489
+
1490
+ ### Example
1491
+
1492
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1493
+
1494
+ <a id="api-SyncErrorEvent"></a>
1495
+
1496
+ ## [INTERFACE] `SyncErrorEvent`
1497
+
1498
+ Permanent synchronization failure notification emitted after local rollback handling.
1499
+
1500
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
1501
+
1502
+ ### Signature
1503
+
1504
+ ```typescript
1505
+ interface SyncErrorEvent {
1506
+ item: OutboxItem;
1507
+ error: Error;
1508
+ rolledBack: boolean;
1509
+ }
1510
+ ```
1511
+
1512
+ ### Parameters
1513
+
1514
+ | Name | Type | Required | Description |
1515
+ | --- | --- | --- | --- |
1516
+ | `item` | `OutboxItem` | Yes | Outbox item whose permanent failure caused rollback handling. |
1517
+ | `error` | `Error` | Yes | Underlying synchronization failure. |
1518
+ | `rolledBack` | `boolean` | Yes | True when rollback handling reached the callback; it is not a remote rollback guarantee. |
1519
+
1520
+ ### Returns
1521
+
1522
+ Type declaration; no runtime value.
1523
+
1524
+ ### See also
1525
+
1526
+ LocalFirstSqliteAdapterOptions.onSyncError.
1527
+
1528
+ ### Public members
1529
+
1530
+ #### `item`
1531
+
1532
+ Outbox item whose permanent failure caused rollback handling.
1533
+
1534
+
1535
+ #### `error`
1536
+
1537
+ Underlying synchronization failure.
1538
+
1539
+
1540
+ #### `rolledBack`
1541
+
1542
+ True when rollback handling reached the callback; it is not a remote rollback guarantee.
1543
+
1544
+
1545
+
1546
+ ### Example
1547
+
1548
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1549
+
1550
+ <a id="api-SyncStatus"></a>
1551
+
1552
+ ## [TYPE] `SyncStatus`
1553
+
1554
+ Local outbox lifecycle status; successfully synchronized rows are removed by processOutbox.
1555
+
1556
+ Imports: `@alneas/eaos-server/db`, `@alneas/eaos-server/db/local-first-sqlite-adapter`.
1557
+
1558
+ ### Signature
1559
+
1560
+ ```typescript
1561
+ type SyncStatus = 'pending' | 'syncing' | 'synced' | 'failed';
1562
+ ```
1563
+
1564
+ ### Parameters
1565
+
1566
+ | Name | Type | Required | Description |
1567
+ | --- | --- | --- | --- |
1568
+ | — | — | — | No call parameters. |
1569
+
1570
+ ### Returns
1571
+
1572
+ Type declaration; no runtime value.
1573
+
1574
+ ### See also
1575
+
1576
+ LocalFirstSqliteAdapter.processOutbox.
1577
+
1578
+ ### Example
1579
+
1580
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1581
+
1582
+ <a id="api-TenantSessionContext"></a>
1583
+
1584
+ ## [INTERFACE] `TenantSessionContext`
1585
+
1586
+ Compatibility re-export; its implementation and documentation are owned by the owning package ``.
1587
+
1588
+ Imports: `@alneas/eaos-server/db`.
1589
+
1590
+ ### Signature
1591
+
1592
+ ```typescript
1593
+ interface TenantSessionContext {
1594
+ tenantId: string;
1595
+ userId?: string;
1596
+ }
1597
+ ```
1598
+
1599
+ ### Parameters
1600
+
1601
+ | Name | Type | Required | Description |
1602
+ | --- | --- | --- | --- |
1603
+ | `tenantId` | `string` | Yes | See the upstream owning declaration. |
1604
+ | `userId` | `string` | No | See the upstream owning declaration. |
1605
+
1606
+ ### Returns
1607
+
1608
+ Type declaration; no runtime value.
1609
+
1610
+ ### Example
1611
+
1612
+ See the owning declaration and linked feature guide for usage; no standalone example is documented in source.
1613
+