@heyo-sh/heyo-cms 0.0.0-stage → 0.1.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 (382) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -2
  3. package/dist/access/index.d.ts +9 -0
  4. package/dist/access/index.d.ts.map +1 -0
  5. package/dist/access/permissions.d.ts +54 -0
  6. package/dist/access/permissions.d.ts.map +1 -0
  7. package/dist/adapters/astro.d.ts +38 -0
  8. package/dist/adapters/astro.d.ts.map +1 -0
  9. package/dist/adapters/astro.js +1 -0
  10. package/dist/adapters/next.d.ts +31 -0
  11. package/dist/adapters/next.d.ts.map +1 -0
  12. package/dist/adapters/next.js +1 -0
  13. package/dist/adapters/nuxt.d.ts +47 -0
  14. package/dist/adapters/nuxt.d.ts.map +1 -0
  15. package/dist/adapters/nuxt.js +1 -0
  16. package/dist/adapters/react-router.d.ts +29 -0
  17. package/dist/adapters/react-router.d.ts.map +1 -0
  18. package/dist/adapters/react-router.js +1 -0
  19. package/dist/adapters/sveltekit.d.ts +37 -0
  20. package/dist/adapters/sveltekit.d.ts.map +1 -0
  21. package/dist/adapters/sveltekit.js +1 -0
  22. package/dist/ai/assistant/context.d.ts +64 -0
  23. package/dist/ai/assistant/context.d.ts.map +1 -0
  24. package/dist/ai/assistant/limits.d.ts +10 -0
  25. package/dist/ai/assistant/limits.d.ts.map +1 -0
  26. package/dist/ai/assistant/plans.d.ts +83 -0
  27. package/dist/ai/assistant/plans.d.ts.map +1 -0
  28. package/dist/ai/assistant/prompt.d.ts +22 -0
  29. package/dist/ai/assistant/prompt.d.ts.map +1 -0
  30. package/dist/ai/assistant/run.d.ts +59 -0
  31. package/dist/ai/assistant/run.d.ts.map +1 -0
  32. package/dist/ai/assistant/runtime.d.ts +35 -0
  33. package/dist/ai/assistant/runtime.d.ts.map +1 -0
  34. package/dist/ai/assistant/schema.d.ts +66 -0
  35. package/dist/ai/assistant/schema.d.ts.map +1 -0
  36. package/dist/ai/assistant/tools.d.ts +41 -0
  37. package/dist/ai/assistant/tools.d.ts.map +1 -0
  38. package/dist/ai/assistant/values.d.ts +33 -0
  39. package/dist/ai/assistant/values.d.ts.map +1 -0
  40. package/dist/ai/crypto.d.ts +12 -0
  41. package/dist/ai/crypto.d.ts.map +1 -0
  42. package/dist/ai/index.d.ts +19 -0
  43. package/dist/ai/index.d.ts.map +1 -0
  44. package/dist/ai/pi.d.ts +89 -0
  45. package/dist/ai/pi.d.ts.map +1 -0
  46. package/dist/ai/registry.d.ts +66 -0
  47. package/dist/ai/registry.d.ts.map +1 -0
  48. package/dist/ai/service.d.ts +31 -0
  49. package/dist/ai/service.d.ts.map +1 -0
  50. package/dist/ai/variant-translation.d.ts +6 -0
  51. package/dist/ai/variant-translation.d.ts.map +1 -0
  52. package/dist/ai.d.ts +12 -0
  53. package/dist/ai.d.ts.map +1 -0
  54. package/dist/ai.js +1 -0
  55. package/dist/auth/config.d.ts +65 -0
  56. package/dist/auth/config.d.ts.map +1 -0
  57. package/dist/auth/crypto.d.ts +44 -0
  58. package/dist/auth/crypto.d.ts.map +1 -0
  59. package/dist/auth/index.d.ts +15 -0
  60. package/dist/auth/index.d.ts.map +1 -0
  61. package/dist/auth/oauth.d.ts +93 -0
  62. package/dist/auth/oauth.d.ts.map +1 -0
  63. package/dist/auth/service.d.ts +38 -0
  64. package/dist/auth/service.d.ts.map +1 -0
  65. package/dist/auth/totp.d.ts +34 -0
  66. package/dist/auth/totp.d.ts.map +1 -0
  67. package/dist/auth.d.ts +9 -0
  68. package/dist/auth.d.ts.map +1 -0
  69. package/dist/auth.js +1 -0
  70. package/dist/cli.d.ts +3 -0
  71. package/dist/cli.d.ts.map +1 -0
  72. package/dist/cli.js +30 -0
  73. package/dist/client/index.d.ts +51 -0
  74. package/dist/client/index.d.ts.map +1 -0
  75. package/dist/client/types.d.ts +340 -0
  76. package/dist/client/types.d.ts.map +1 -0
  77. package/dist/client.d.ts +46 -0
  78. package/dist/client.d.ts.map +1 -0
  79. package/dist/client.js +1 -0
  80. package/dist/config.d.ts +31 -0
  81. package/dist/config.d.ts.map +1 -0
  82. package/dist/config.js +1 -0
  83. package/dist/content/export.d.ts +28 -0
  84. package/dist/content/export.d.ts.map +1 -0
  85. package/dist/content/import.d.ts +65 -0
  86. package/dist/content/import.d.ts.map +1 -0
  87. package/dist/content/records.d.ts +73 -0
  88. package/dist/content/records.d.ts.map +1 -0
  89. package/dist/content.d.ts +12 -0
  90. package/dist/content.d.ts.map +1 -0
  91. package/dist/content.js +1 -0
  92. package/dist/db/d1.d.ts +29 -0
  93. package/dist/db/d1.d.ts.map +1 -0
  94. package/dist/db/d1.js +1 -0
  95. package/dist/db/mongodb.d.ts +128 -0
  96. package/dist/db/mongodb.d.ts.map +1 -0
  97. package/dist/db/mongodb.js +2 -0
  98. package/dist/db/postgres.d.ts +37 -0
  99. package/dist/db/postgres.d.ts.map +1 -0
  100. package/dist/db/postgres.js +1 -0
  101. package/dist/db/sql/adapter.d.ts +57 -0
  102. package/dist/db/sql/adapter.d.ts.map +1 -0
  103. package/dist/db/sql/compile.d.ts +50 -0
  104. package/dist/db/sql/compile.d.ts.map +1 -0
  105. package/dist/db/sql/ddl.d.ts +34 -0
  106. package/dist/db/sql/ddl.d.ts.map +1 -0
  107. package/dist/db/sql/dialect.d.ts +35 -0
  108. package/dist/db/sql/dialect.d.ts.map +1 -0
  109. package/dist/db/sql/driver.d.ts +34 -0
  110. package/dist/db/sql/driver.d.ts.map +1 -0
  111. package/dist/db/sql/introspect.d.ts +15 -0
  112. package/dist/db/sql/introspect.d.ts.map +1 -0
  113. package/dist/db/sqlite.d.ts +39 -0
  114. package/dist/db/sqlite.d.ts.map +1 -0
  115. package/dist/db/sqlite.js +1 -0
  116. package/dist/defaults.d.ts +5 -0
  117. package/dist/defaults.d.ts.map +1 -0
  118. package/dist/duration.d.ts +12 -0
  119. package/dist/duration.d.ts.map +1 -0
  120. package/dist/editor/builtin.d.ts +45 -0
  121. package/dist/editor/builtin.d.ts.map +1 -0
  122. package/dist/editor/index.d.ts +14 -0
  123. package/dist/editor/index.d.ts.map +1 -0
  124. package/dist/editor/markdown.d.ts +19 -0
  125. package/dist/editor/markdown.d.ts.map +1 -0
  126. package/dist/editor/registry.d.ts +30 -0
  127. package/dist/editor/registry.d.ts.map +1 -0
  128. package/dist/editor/serialize.d.ts +41 -0
  129. package/dist/editor/serialize.d.ts.map +1 -0
  130. package/dist/editor.d.ts +10 -0
  131. package/dist/editor.d.ts.map +1 -0
  132. package/dist/editor.js +1 -0
  133. package/dist/engine/access.d.ts +33 -0
  134. package/dist/engine/access.d.ts.map +1 -0
  135. package/dist/engine/activity.d.ts +16 -0
  136. package/dist/engine/activity.d.ts.map +1 -0
  137. package/dist/engine/cursor.d.ts +19 -0
  138. package/dist/engine/cursor.d.ts.map +1 -0
  139. package/dist/engine/documents.d.ts +81 -0
  140. package/dist/engine/documents.d.ts.map +1 -0
  141. package/dist/engine/engine.d.ts +276 -0
  142. package/dist/engine/engine.d.ts.map +1 -0
  143. package/dist/engine/field-access.d.ts +21 -0
  144. package/dist/engine/field-access.d.ts.map +1 -0
  145. package/dist/engine/hooks.d.ts +58 -0
  146. package/dist/engine/hooks.d.ts.map +1 -0
  147. package/dist/engine/index.d.ts +20 -0
  148. package/dist/engine/index.d.ts.map +1 -0
  149. package/dist/engine/jobs.d.ts +63 -0
  150. package/dist/engine/jobs.d.ts.map +1 -0
  151. package/dist/engine/locales.d.ts +40 -0
  152. package/dist/engine/locales.d.ts.map +1 -0
  153. package/dist/engine/outbox.d.ts +81 -0
  154. package/dist/engine/outbox.d.ts.map +1 -0
  155. package/dist/engine/relations.d.ts +60 -0
  156. package/dist/engine/relations.d.ts.map +1 -0
  157. package/dist/engine/scoped-db.d.ts +13 -0
  158. package/dist/engine/scoped-db.d.ts.map +1 -0
  159. package/dist/engine/trash.d.ts +25 -0
  160. package/dist/engine/trash.d.ts.map +1 -0
  161. package/dist/errors.d.ts +42 -0
  162. package/dist/errors.d.ts.map +1 -0
  163. package/dist/fields/builtin.d.ts +142 -0
  164. package/dist/fields/builtin.d.ts.map +1 -0
  165. package/dist/fields/index.d.ts +3 -0
  166. package/dist/fields/index.d.ts.map +1 -0
  167. package/dist/fields/registry.d.ts +35 -0
  168. package/dist/fields/registry.d.ts.map +1 -0
  169. package/dist/fields.d.ts +8 -0
  170. package/dist/fields.d.ts.map +1 -0
  171. package/dist/fields.js +1 -0
  172. package/dist/http/guard.d.ts +45 -0
  173. package/dist/http/guard.d.ts.map +1 -0
  174. package/dist/http/handler.d.ts +31 -0
  175. package/dist/http/handler.d.ts.map +1 -0
  176. package/dist/http/index.d.ts +13 -0
  177. package/dist/http/index.d.ts.map +1 -0
  178. package/dist/http/openapi.d.ts +5 -0
  179. package/dist/http/openapi.d.ts.map +1 -0
  180. package/dist/http/params.d.ts +32 -0
  181. package/dist/http/params.d.ts.map +1 -0
  182. package/dist/http/request-db.d.ts +19 -0
  183. package/dist/http/request-db.d.ts.map +1 -0
  184. package/dist/http/respond.d.ts +48 -0
  185. package/dist/http/respond.d.ts.map +1 -0
  186. package/dist/http/rich-text.d.ts +30 -0
  187. package/dist/http/rich-text.d.ts.map +1 -0
  188. package/dist/http/router.d.ts +55 -0
  189. package/dist/http/router.d.ts.map +1 -0
  190. package/dist/http/routes/access.d.ts +13 -0
  191. package/dist/http/routes/access.d.ts.map +1 -0
  192. package/dist/http/routes/admin.d.ts +28 -0
  193. package/dist/http/routes/admin.d.ts.map +1 -0
  194. package/dist/http/routes/ai.d.ts +26 -0
  195. package/dist/http/routes/ai.d.ts.map +1 -0
  196. package/dist/http/routes/auth.d.ts +13 -0
  197. package/dist/http/routes/auth.d.ts.map +1 -0
  198. package/dist/http/routes/documents.d.ts +24 -0
  199. package/dist/http/routes/documents.d.ts.map +1 -0
  200. package/dist/http/routes/generate.d.ts +5 -0
  201. package/dist/http/routes/generate.d.ts.map +1 -0
  202. package/dist/http/routes/media.d.ts +28 -0
  203. package/dist/http/routes/media.d.ts.map +1 -0
  204. package/dist/http/routes/panel.d.ts +20 -0
  205. package/dist/http/routes/panel.d.ts.map +1 -0
  206. package/dist/http/routes/system.d.ts +25 -0
  207. package/dist/http/routes/system.d.ts.map +1 -0
  208. package/dist/http/routes/webhooks.d.ts +17 -0
  209. package/dist/http/routes/webhooks.d.ts.map +1 -0
  210. package/dist/http/spec.d.ts +28 -0
  211. package/dist/http/spec.d.ts.map +1 -0
  212. package/dist/http.d.ts +17 -0
  213. package/dist/http.d.ts.map +1 -0
  214. package/dist/http.js +1 -0
  215. package/dist/i18n/index.d.ts +12 -0
  216. package/dist/i18n/index.d.ts.map +1 -0
  217. package/dist/i18n/names.d.ts +25 -0
  218. package/dist/i18n/names.d.ts.map +1 -0
  219. package/dist/ids.d.ts +28 -0
  220. package/dist/ids.d.ts.map +1 -0
  221. package/dist/index-2757kej5.js +2 -0
  222. package/dist/index-2kb5nbxx.js +2 -0
  223. package/dist/index-2z1qe5mw.js +2 -0
  224. package/dist/index-34s342fz.js +2 -0
  225. package/dist/index-5ngtc7gy.js +2 -0
  226. package/dist/index-7a231xfp.js +2 -0
  227. package/dist/index-7k091gpe.js +2 -0
  228. package/dist/index-9g2n7xa6.js +2 -0
  229. package/dist/index-9x1z3b85.js +5 -0
  230. package/dist/index-9zqnf6gx.js +23 -0
  231. package/dist/index-b2ecggck.js +26 -0
  232. package/dist/index-cbwwtcm4.js +2 -0
  233. package/dist/index-ebtj6ebd.js +0 -0
  234. package/dist/index-g4crf47y.js +0 -0
  235. package/dist/index-gpwcmmvr.js +2 -0
  236. package/dist/index-hq05mc1n.js +3 -0
  237. package/dist/index-hy1x46nf.js +2 -0
  238. package/dist/index-k8wbg1dw.js +2 -0
  239. package/dist/index-kbsgt44t.js +2 -0
  240. package/dist/index-m82a0shw.js +2 -0
  241. package/dist/index-md79xr6h.js +5 -0
  242. package/dist/index-nvgwyykk.js +40 -0
  243. package/dist/index-ty698y02.js +2 -0
  244. package/dist/index-vq2978e7.js +14 -0
  245. package/dist/index-vxw0a03g.js +2 -0
  246. package/dist/index-wj8y1xcj.js +2 -0
  247. package/dist/index-x72d1hzh.js +2 -0
  248. package/dist/index-y5mwknr9.js +2 -0
  249. package/dist/index-ymq6jsar.js +2 -0
  250. package/dist/index.d.ts +25 -0
  251. package/dist/index.d.ts.map +1 -0
  252. package/dist/index.js +1 -0
  253. package/dist/jobs/runner.d.ts +77 -0
  254. package/dist/jobs/runner.d.ts.map +1 -0
  255. package/dist/jobs.d.ts +11 -0
  256. package/dist/jobs.d.ts.map +1 -0
  257. package/dist/jobs.js +1 -0
  258. package/dist/media/document.d.ts +28 -0
  259. package/dist/media/document.d.ts.map +1 -0
  260. package/dist/media/gc.d.ts +46 -0
  261. package/dist/media/gc.d.ts.map +1 -0
  262. package/dist/media/index.d.ts +20 -0
  263. package/dist/media/index.d.ts.map +1 -0
  264. package/dist/media/pipeline.d.ts +36 -0
  265. package/dist/media/pipeline.d.ts.map +1 -0
  266. package/dist/media/probe.d.ts +6 -0
  267. package/dist/media/probe.d.ts.map +1 -0
  268. package/dist/media/service.d.ts +26 -0
  269. package/dist/media/service.d.ts.map +1 -0
  270. package/dist/media/sharp.d.ts +28 -0
  271. package/dist/media/sharp.d.ts.map +1 -0
  272. package/dist/media/strip.d.ts +16 -0
  273. package/dist/media/strip.d.ts.map +1 -0
  274. package/dist/media/usages.d.ts +69 -0
  275. package/dist/media/usages.d.ts.map +1 -0
  276. package/dist/media/variants.d.ts +50 -0
  277. package/dist/media/variants.d.ts.map +1 -0
  278. package/dist/migrations.d.ts +115 -0
  279. package/dist/migrations.d.ts.map +1 -0
  280. package/dist/migrations.js +1 -0
  281. package/dist/panel.d.ts +31 -0
  282. package/dist/panel.d.ts.map +1 -0
  283. package/dist/query.d.ts +40 -0
  284. package/dist/query.d.ts.map +1 -0
  285. package/dist/query.js +1 -0
  286. package/dist/run-3r72dwhs.js +6 -0
  287. package/dist/schema/describe.d.ts +19 -0
  288. package/dist/schema/describe.d.ts.map +1 -0
  289. package/dist/schema/index.d.ts +5 -0
  290. package/dist/schema/index.d.ts.map +1 -0
  291. package/dist/schema/plan.d.ts +20 -0
  292. package/dist/schema/plan.d.ts.map +1 -0
  293. package/dist/schema/snapshot.d.ts +22 -0
  294. package/dist/schema/snapshot.d.ts.map +1 -0
  295. package/dist/schema/system.d.ts +22 -0
  296. package/dist/schema/system.d.ts.map +1 -0
  297. package/dist/schema.d.ts +7 -0
  298. package/dist/schema.d.ts.map +1 -0
  299. package/dist/schema.js +1 -0
  300. package/dist/storage/bytes.d.ts +17 -0
  301. package/dist/storage/bytes.d.ts.map +1 -0
  302. package/dist/storage/http.d.ts +43 -0
  303. package/dist/storage/http.d.ts.map +1 -0
  304. package/dist/storage/local.d.ts +31 -0
  305. package/dist/storage/local.d.ts.map +1 -0
  306. package/dist/storage/providers.d.ts +95 -0
  307. package/dist/storage/providers.d.ts.map +1 -0
  308. package/dist/storage/sign.d.ts +53 -0
  309. package/dist/storage/sign.d.ts.map +1 -0
  310. package/dist/strings.d.ts +13 -0
  311. package/dist/strings.d.ts.map +1 -0
  312. package/dist/telemetry.d.ts +137 -0
  313. package/dist/telemetry.d.ts.map +1 -0
  314. package/dist/telemetry.js +1 -0
  315. package/dist/types/activity.d.ts +68 -0
  316. package/dist/types/activity.d.ts.map +1 -0
  317. package/dist/types/actor.d.ts +26 -0
  318. package/dist/types/actor.d.ts.map +1 -0
  319. package/dist/types/ai.d.ts +357 -0
  320. package/dist/types/ai.d.ts.map +1 -0
  321. package/dist/types/api.d.ts +212 -0
  322. package/dist/types/api.d.ts.map +1 -0
  323. package/dist/types/auth.d.ts +310 -0
  324. package/dist/types/auth.d.ts.map +1 -0
  325. package/dist/types/config.d.ts +632 -0
  326. package/dist/types/config.d.ts.map +1 -0
  327. package/dist/types/database.d.ts +75 -0
  328. package/dist/types/database.d.ts.map +1 -0
  329. package/dist/types/editor.d.ts +140 -0
  330. package/dist/types/editor.d.ts.map +1 -0
  331. package/dist/types/events.d.ts +72 -0
  332. package/dist/types/events.d.ts.map +1 -0
  333. package/dist/types/fields.d.ts +142 -0
  334. package/dist/types/fields.d.ts.map +1 -0
  335. package/dist/types/hooks.d.ts +142 -0
  336. package/dist/types/hooks.d.ts.map +1 -0
  337. package/dist/types/index.d.ts +25 -0
  338. package/dist/types/index.d.ts.map +1 -0
  339. package/dist/types/instance.d.ts +263 -0
  340. package/dist/types/instance.d.ts.map +1 -0
  341. package/dist/types/jobs.d.ts +78 -0
  342. package/dist/types/jobs.d.ts.map +1 -0
  343. package/dist/types/json.d.ts +24 -0
  344. package/dist/types/json.d.ts.map +1 -0
  345. package/dist/types/locales.d.ts +30 -0
  346. package/dist/types/locales.d.ts.map +1 -0
  347. package/dist/types/media.d.ts +245 -0
  348. package/dist/types/media.d.ts.map +1 -0
  349. package/dist/types/panel.d.ts +249 -0
  350. package/dist/types/panel.d.ts.map +1 -0
  351. package/dist/types/plugin.d.ts +172 -0
  352. package/dist/types/plugin.d.ts.map +1 -0
  353. package/dist/types/query.d.ts +101 -0
  354. package/dist/types/query.d.ts.map +1 -0
  355. package/dist/types/schema.d.ts +203 -0
  356. package/dist/types/schema.d.ts.map +1 -0
  357. package/dist/types/storage.d.ts +61 -0
  358. package/dist/types/storage.d.ts.map +1 -0
  359. package/dist/types/telemetry.d.ts +14 -0
  360. package/dist/types/telemetry.d.ts.map +1 -0
  361. package/dist/types/trash.d.ts +42 -0
  362. package/dist/types/trash.d.ts.map +1 -0
  363. package/dist/types/webhooks.d.ts +133 -0
  364. package/dist/types/webhooks.d.ts.map +1 -0
  365. package/dist/types.d.ts +8 -0
  366. package/dist/types.d.ts.map +1 -0
  367. package/dist/types.js +1 -0
  368. package/dist/uploads.d.ts +21 -0
  369. package/dist/uploads.d.ts.map +1 -0
  370. package/dist/uploads.js +9 -0
  371. package/dist/webhooks/index.d.ts +10 -0
  372. package/dist/webhooks/index.d.ts.map +1 -0
  373. package/dist/webhooks/job.d.ts +17 -0
  374. package/dist/webhooks/job.d.ts.map +1 -0
  375. package/dist/webhooks/service.d.ts +53 -0
  376. package/dist/webhooks/service.d.ts.map +1 -0
  377. package/dist/webhooks/sign.d.ts +26 -0
  378. package/dist/webhooks/sign.d.ts.map +1 -0
  379. package/dist/webhooks.d.ts +10 -0
  380. package/dist/webhooks.d.ts.map +1 -0
  381. package/dist/webhooks.js +1 -0
  382. package/package.json +183 -4
@@ -0,0 +1,57 @@
1
+ import type { AppliedMigration, DatabaseAdapter, DatabaseCapabilities } from "../../types/database";
2
+ import type { Mutation, MutationResult, Query, Row, Tx } from "../../types/query";
3
+ import type { MigrationArtifact, MigrationStep, SchemaSnapshot } from "../../types/schema";
4
+ import type { SqlDialect } from "./dialect";
5
+ import { type SqlDriver } from "./driver";
6
+ export interface SqlAdapterOptions {
7
+ /** Overrides, for engines that are SQL but not fully featured (D1). */
8
+ capabilities?: Partial<DatabaseCapabilities>;
9
+ schema?: SchemaSnapshot;
10
+ }
11
+ /**
12
+ * One adapter for every SQL engine.
13
+ *
14
+ * Postgres, SQLite and D1 differ in a dialect object and a driver, not in a
15
+ * repository: a bug fixed for one is fixed for all three, and the contract
16
+ * suite that proves it runs against each.
17
+ */
18
+ export declare class SqlDatabaseAdapter implements DatabaseAdapter {
19
+ private readonly driver;
20
+ private readonly dialect;
21
+ readonly id: string;
22
+ readonly capabilities: DatabaseCapabilities;
23
+ private readonly catalog;
24
+ private readonly compiler;
25
+ private readonly renderer;
26
+ private schema;
27
+ private journalReady;
28
+ private transactionDepth;
29
+ constructor(driver: SqlDriver, dialect: SqlDialect, options?: SqlAdapterOptions);
30
+ useSchema(schema: SchemaSnapshot): void;
31
+ introspect(): Promise<SchemaSnapshot>;
32
+ plan(from: SchemaSnapshot, to: SchemaSnapshot): MigrationStep[];
33
+ render(steps: MigrationStep[], id: string): MigrationArtifact;
34
+ applyMigration(artifact: MigrationArtifact): Promise<void>;
35
+ listAppliedMigrations(): Promise<AppliedMigration[]>;
36
+ recordMigration(id: string, sum: string): Promise<void>;
37
+ /**
38
+ * Runs a function inside a transaction, or inside nothing at all when the
39
+ * engine has none.
40
+ *
41
+ * The nesting counter keeps a hook that calls back into the engine from
42
+ * issuing a second `BEGIN`, which Postgres warns about and SQLite refuses.
43
+ */
44
+ transaction<T>(fn: (tx: Tx) => Promise<T>): Promise<T>;
45
+ query(tx: Tx, query: Query): Promise<Row[]>;
46
+ mutate(tx: Tx, mutation: Mutation): Promise<MutationResult>;
47
+ close(): Promise<void>;
48
+ /**
49
+ * Creates the journal.
50
+ *
51
+ * It cannot be part of the generated schema: `migrate` has to know what has
52
+ * already run before it runs anything, so the table that answers that
53
+ * question must predate the first migration.
54
+ */
55
+ private ensureJournal;
56
+ }
57
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/db/sql/adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,KAAK,EACL,GAAG,EACH,EAAE,EACH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAY3D,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IAYtD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAZ1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAE5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,MAAM,CAA+D;IAC7E,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAK;IAE7B,YACmB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,EACpC,OAAO,GAAE,iBAAsB,EAYhC;IAED,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAGtC;IAED,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAIpC;IAED,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,aAAa,EAAE,CAE9D;IAED,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAO5D;IAEK,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/D;IAEK,qBAAqB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAWzD;IAEK,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5D;IAED;;;;;;OAMG;IACG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA2B3D;IAEK,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAYhD;IAEK,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAehE;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED;;;;;;OAMG;YACW,aAAa;CAW5B"}
@@ -0,0 +1,50 @@
1
+ import type { Mutation, Query, Row } from "../../types/query";
2
+ import type { ColumnType, SchemaSnapshot } from "../../types/schema";
3
+ import type { SqlDialect } from "./dialect";
4
+ export interface CompiledStatement {
5
+ text: string;
6
+ values: unknown[];
7
+ }
8
+ /**
9
+ * Knows what every column holds.
10
+ *
11
+ * Built from the snapshot the engine hands the adapter. Without it a row
12
+ * would come back with a JSON string where the caller expects an object, and
13
+ * a timestamp as whatever the driver felt like returning.
14
+ */
15
+ export declare class SchemaCatalog {
16
+ private readonly columns;
17
+ private readonly documentColumns;
18
+ constructor(schema?: SchemaSnapshot);
19
+ use(schema: SchemaSnapshot): void;
20
+ columnType(table: string, column: string): ColumnType | undefined;
21
+ /** The JSON column a table stores its document body in, if it has one. */
22
+ documentColumn(table: string): string | undefined;
23
+ tableColumns(table: string): string[];
24
+ knows(table: string): boolean;
25
+ }
26
+ export declare class SqlCompiler {
27
+ private readonly dialect;
28
+ private readonly catalog;
29
+ constructor(dialect: SqlDialect, catalog: SchemaCatalog);
30
+ compileQuery(query: Query): CompiledStatement;
31
+ compileMutation(mutation: Mutation): CompiledStatement;
32
+ /** Turns driver output back into the values the engine declared. */
33
+ decodeRow(table: string, row: Record<string, unknown>): Row;
34
+ private compileSelect;
35
+ private compileWhere;
36
+ /**
37
+ * A comparison decides the type of its own expression.
38
+ *
39
+ * The document body is untyped, so `views > 5` has to extract a number and
40
+ * `slug > "a"` has to extract text out of the very same column. Postgres
41
+ * refuses to compare the two, which is a feature: the cast belongs to the
42
+ * comparison, not to the column.
43
+ */
44
+ private comparisonExpression;
45
+ private compileComparison;
46
+ private expression;
47
+ private resolve;
48
+ private encodeColumn;
49
+ }
50
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/db/sql/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,GAAG,EAEJ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IACtE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;IAE7D,YAAY,MAAM,CAAC,EAAE,cAAc,EAElC;IAED,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAYhC;IAED,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEhE;IAED,0EAA0E;IAC1E,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhD;IAED,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpC;IAED,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5B;CACF;AAeD,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAF1B,YACmB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,aAAa,EACrC;IAEJ,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,CA+B5C;IAED,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,CAsDrD;IAED,oEAAoE;IACpE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG,CAU1D;IAED,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAqBpB;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,iBAAiB;IA0DzB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,OAAO;IAuBf,OAAO,CAAC,YAAY;CAcrB"}
@@ -0,0 +1,34 @@
1
+ import type { MigrationStep, SchemaSnapshot } from "../../types/schema";
2
+ import type { SqlDialect } from "./dialect";
3
+ /**
4
+ * Turns neutral steps into the SQL that lands in the repository.
5
+ *
6
+ * The output is a file a reviewer reads in a pull request, so it carries the
7
+ * step summaries as comments and keeps one statement per line. Nothing here
8
+ * runs against a database: rendering and applying are separate on purpose, or
9
+ * "review the migration" would mean "review what already happened".
10
+ */
11
+ export declare class SqlDdlRenderer {
12
+ private readonly dialect;
13
+ private readonly target;
14
+ constructor(dialect: SqlDialect, target: () => SchemaSnapshot);
15
+ render(steps: MigrationStep[]): string;
16
+ private renderStep;
17
+ private createTable;
18
+ private columnClause;
19
+ private addColumn;
20
+ /**
21
+ * SQLite cannot alter a column, so the table is rebuilt.
22
+ *
23
+ * The twelve-step rebuild from the SQLite documentation, minus the steps
24
+ * that only matter for legacy schemas: create the new shape, copy the
25
+ * columns both shapes share, swap the names, recreate the indexes.
26
+ */
27
+ private alterColumn;
28
+ private createIndex;
29
+ private setDocumentField;
30
+ private unsetDocumentField;
31
+ private literal;
32
+ private q;
33
+ }
34
+ //# sourceMappingURL=ddl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ddl.d.ts","sourceRoot":"","sources":["../../../src/db/sql/ddl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,aAAa,EACb,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;GAOG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,YACmB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,cAAc,EAC3C;IAEJ,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAMrC;IAED,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,SAAS;IAcjB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAsCnB,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,CAAC;CAGV"}
@@ -0,0 +1,35 @@
1
+ import type { ColumnValue } from "../../types/query";
2
+ import type { ColumnSnapshot, ColumnType } from "../../types/schema";
3
+ /**
4
+ * Everything two SQL engines disagree about.
5
+ *
6
+ * The compiler and the DDL renderer are shared; only this table differs. A
7
+ * third SQL engine is a new object here, not a new adapter.
8
+ */
9
+ export interface SqlDialect {
10
+ readonly id: "postgres" | "sqlite";
11
+ /** `$1` on Postgres, `?` on SQLite. */
12
+ placeholder(index: number): string;
13
+ quote(identifier: string): string;
14
+ columnType(column: Pick<ColumnSnapshot, "type" | "array">): string;
15
+ /** Extracts a JSON path as a comparable value. */
16
+ jsonExtract(column: string, path: string[], type: ColumnType): string;
17
+ /** Extracts a JSON path as JSON, for array membership tests. */
18
+ jsonArrayMembership(column: string, path: string[], placeholder: string): string;
19
+ /** Case-insensitive LIKE, when the engine distinguishes the two. */
20
+ likeOperator(caseInsensitive: boolean): string;
21
+ encode(value: ColumnValue | undefined, type: ColumnType): unknown;
22
+ decode(value: unknown, type: ColumnType): ColumnValue;
23
+ /** True when `ALTER TABLE ... ALTER COLUMN` exists. */
24
+ readonly supportsAlterColumn: boolean;
25
+ }
26
+ export declare const postgresDialect: SqlDialect;
27
+ /**
28
+ * SQLite stores timestamps as epoch milliseconds and JSON as text.
29
+ *
30
+ * Milliseconds rather than ISO strings: comparisons and ordering are then
31
+ * plain integer work, and no row can carry a different time zone from its
32
+ * neighbour.
33
+ */
34
+ export declare const sqliteDialect: SqlDialect;
35
+ //# sourceMappingURL=dialect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialect.d.ts","sourceRoot":"","sources":["../../../src/db/sql/dialect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,QAAQ,CAAC;IACnC,uCAAuC;IACvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC;IACnE,kDAAkD;IAClD,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IACtE,gEAAgE;IAChE,mBAAmB,CACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC;IACV,oEAAoE;IACpE,YAAY,CAAC,eAAe,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/C,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAClE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IACtD,uDAAuD;IACvD,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;CACvC;AAiCD,eAAO,MAAM,eAAe,EAAE,UAgD7B,CAAC;AAyBF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,UAgD3B,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The narrow surface every SQL engine has to provide.
3
+ *
4
+ * Four methods, no driver bundled: `pg`, Neon, PGlite, `bun:sqlite`,
5
+ * `node:sqlite` and a D1 binding all fit behind it, and the adapter never
6
+ * learns which one it is talking to.
7
+ */
8
+ export interface SqlDriver {
9
+ readonly id: string;
10
+ all(sql: string, values: unknown[]): Promise<Record<string, unknown>[]>;
11
+ run(sql: string, values: unknown[]): Promise<{
12
+ rowsAffected: number;
13
+ }>;
14
+ /** Multi-statement DDL. Migrations are the only caller. */
15
+ exec(sql: string): Promise<void>;
16
+ /**
17
+ * Runs a function against a connection pinned for the transaction.
18
+ *
19
+ * Optional: a pooled client would otherwise send `BEGIN` on one connection
20
+ * and the write on another. Engines without interactive transactions (D1)
21
+ * leave it out and declare `transactions: false`.
22
+ */
23
+ transaction?<T>(run: (driver: SqlDriver) => Promise<T>): Promise<T>;
24
+ close?(): Promise<void>;
25
+ }
26
+ /**
27
+ * Splits a migration file into statements.
28
+ *
29
+ * Quote-aware rather than a plain `split(";")`: a default value or a backfill
30
+ * literal can contain a semicolon, and cutting a statement in half there
31
+ * would corrupt a migration in the one place nobody tests twice.
32
+ */
33
+ export declare function splitStatements(sql: string): string[];
34
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/db/sql/driver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACxE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvE,2DAA2D;IAC3D,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpE,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAqCrD"}
@@ -0,0 +1,15 @@
1
+ import type { SchemaSnapshot } from "../../types/schema";
2
+ import type { SqlDriver } from "./driver";
3
+ /**
4
+ * Reads the physical schema back out of a live database.
5
+ *
6
+ * Only tables and indexes: a database cannot tell which collection a document
7
+ * belongs to any more than a filesystem can tell which project a file belongs
8
+ * to. The logical layer lives in the committed snapshot, and `generate` diffs
9
+ * against that. This is for drift detection — "the database is not what the
10
+ * migrations say it should be" — which is a different question from "what
11
+ * changed in the configuration".
12
+ */
13
+ export declare function introspectPostgres(driver: SqlDriver): Promise<SchemaSnapshot>;
14
+ export declare function introspectSqlite(driver: SqlDriver): Promise<SchemaSnapshot>;
15
+ //# sourceMappingURL=introspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspect.d.ts","sourceRoot":"","sources":["../../../src/db/sql/introspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,cAAc,CAAC,CAsDzB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,cAAc,CAAC,CAkCzB"}
@@ -0,0 +1,39 @@
1
+ import type { DatabaseAdapter, DatabaseAdapterFactory } from "../types/database";
2
+ /**
3
+ * What `bun:sqlite` and `node:sqlite` both already are.
4
+ *
5
+ * Synchronous, prepared-statement based, and identical enough in shape that
6
+ * one driver covers both runtimes. Neither module is imported here: a Worker
7
+ * bundle must not pull in a native SQLite it will never run.
8
+ */
9
+ export interface SqliteDatabase {
10
+ prepare(sql: string): SqliteStatement;
11
+ exec(sql: string): void;
12
+ close?(): void;
13
+ }
14
+ export interface SqliteStatement {
15
+ all(...values: unknown[]): unknown[];
16
+ run(...values: unknown[]): {
17
+ changes?: number | bigint;
18
+ };
19
+ }
20
+ export interface SqliteOptions {
21
+ id?: string;
22
+ }
23
+ export interface SqliteFileOptions extends SqliteOptions {
24
+ /** Path on disk. `:memory:` is accepted and is what the tests use. */
25
+ file: string;
26
+ }
27
+ /**
28
+ * Creates the SQLite adapter.
29
+ *
30
+ * Transactions use the generic `BEGIN`/`COMMIT` path in the adapter: SQLite
31
+ * has exactly one writer, so there is no pool to pin a transaction to.
32
+ *
33
+ * Passing `{ file }` opens the database on first use through whichever SQLite
34
+ * the runtime provides — `bun:sqlite` or `node:sqlite` — so a configuration
35
+ * module stays importable in a runtime that has neither.
36
+ */
37
+ export declare function sqlite(options: SqliteFileOptions): DatabaseAdapterFactory;
38
+ export declare function sqlite(database: SqliteDatabase, options?: SqliteOptions): DatabaseAdapter;
39
+ //# sourceMappingURL=sqlite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/db/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CACd;AAoCD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;AAC3E,wBAAgB,MAAM,CACpB,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,aAAa,GACtB,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ import{re,Ye}from"../index-b2ecggck.js";import{n}from"../index-x72d1hzh.js";class s{database;id;constructor(t,e="sqlite"){this.database=t;this.id=e}async all(t,e){return this.database.prepare(t).all(...e)}async run(t,e){let a=this.database.prepare(t).run(...e);return{rowsAffected:Number(a.changes??0)}}async exec(t){this.database.exec(t)}async close(){this.database.close?.()}}function r(t,e={}){if("file"in t&&typeof t.file==="string")return async()=>r(await o(t.file),t);return new re(new s(t,e.id??"sqlite"),Ye)}async function o(t){for(let e of["bun:sqlite","node:sqlite"])try{let a=await import(e),i=a.Database??a.DatabaseSync;if(i)return new i(t)}catch{}throw new n("database","no SQLite is available in this runtime; pass a database instance instead")}export{r as sqlite};
@@ -0,0 +1,5 @@
1
+ /** Shared defaults that are safe to import from a browser bundle. */
2
+ export declare const defaultBasePath = "/api/heyo-cms";
3
+ export declare const defaultAdminPath = "/admin";
4
+ export declare const defaultMigrationsDirectory = "./migrations";
5
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,0BAA0B,iBAAiB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Parses `30d` into milliseconds.
3
+ *
4
+ * Durations are strings in the configuration because `2592000000` in a diff
5
+ * tells a reviewer nothing. They are parsed once, while the configuration is
6
+ * being built, so a typo is a start-up error rather than a job that silently
7
+ * never runs.
8
+ */
9
+ export declare function parseDuration(value: string, path?: string): number;
10
+ /** Parses `25mb` into bytes, for the same reason `parseDuration` exists. */
11
+ export declare function parseByteSize(value: string, path?: string): number;
12
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../src/duration.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAS9D;AASD,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAS9D"}
@@ -0,0 +1,45 @@
1
+ import type { EditorMarkDefinition, EditorNodeDefinition } from "../types/editor";
2
+ /**
3
+ * The nodes TipTap's starter kit produces, declared through the public API.
4
+ *
5
+ * Every one of them goes through `defineEditorNode()` — no shortcut, no
6
+ * internal map a built-in gets to use and a plugin does not. That is the same
7
+ * rule the field registry follows, and for the same reason: an extension
8
+ * point that the product itself bypasses is an extension point nobody can
9
+ * trust (stage 9).
10
+ *
11
+ * The serialisers below are therefore also the worked examples. A plugin
12
+ * adding a `callout` writes exactly this much code.
13
+ */
14
+ export declare const docNode: EditorNodeDefinition;
15
+ export declare const paragraphNode: EditorNodeDefinition;
16
+ export declare const headingNode: EditorNodeDefinition;
17
+ export declare const blockquoteNode: EditorNodeDefinition;
18
+ export declare const bulletListNode: EditorNodeDefinition;
19
+ export declare const orderedListNode: EditorNodeDefinition;
20
+ export declare const listItemNode: EditorNodeDefinition;
21
+ export declare const taskListNode: EditorNodeDefinition;
22
+ export declare const taskItemNode: EditorNodeDefinition;
23
+ export declare const codeBlockNode: EditorNodeDefinition;
24
+ export declare const horizontalRuleNode: EditorNodeDefinition;
25
+ export declare const hardBreakNode: EditorNodeDefinition;
26
+ /**
27
+ * An image, by media id.
28
+ *
29
+ * `mediaId` is the attribute the lifecycle counts (section 6): a bare `src`
30
+ * is a URL, and a URL is not a reference. The serialiser prefers a resolved
31
+ * URL when the caller can provide one and falls back to the stored `src`,
32
+ * because a document exported from a CLI still has to render somewhere.
33
+ */
34
+ export declare const imageNode: EditorNodeDefinition;
35
+ export declare const tableNode: EditorNodeDefinition;
36
+ export declare const tableRowNode: EditorNodeDefinition;
37
+ export declare const tableHeaderNode: EditorNodeDefinition;
38
+ export declare const tableCellNode: EditorNodeDefinition;
39
+ export declare const boldMark: EditorMarkDefinition;
40
+ export declare const italicMark: EditorMarkDefinition;
41
+ export declare const underlineMark: EditorMarkDefinition;
42
+ export declare const strikeMark: EditorMarkDefinition;
43
+ export declare const codeMark: EditorMarkDefinition;
44
+ export declare const linkMark: EditorMarkDefinition;
45
+ //# sourceMappingURL=builtin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/editor/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AASlF;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,OAAO,EAAE,oBAKpB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAQ1B,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,oBAWxB,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,oBAU3B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,oBAO3B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,oBAkB5B,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAKzB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAMzB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAQzB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAyB1B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,oBAO/B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAQ1B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,oBA0BtB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,oBAsBtB,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,oBAMzB,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,oBAU5B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAU1B,CAAC;AAMH,eAAO,MAAM,QAAQ,EAAE,oBAIrB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,oBAIvB,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,oBAM1B,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,oBAIvB,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,oBAIrB,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,oBAWrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The rich-text schema: nodes, marks and the serialisers they are required to
3
+ * carry.
4
+ *
5
+ * Importing this module registers the built-in nodes, which is why the
6
+ * serialisers in `renderRichText()` work without any configuration. A plugin
7
+ * that adds a node imports `defineEditorNode` from here and gets exactly the
8
+ * same treatment.
9
+ */
10
+ export { blockquoteNode, boldMark, bulletListNode, codeBlockNode, codeMark, docNode, hardBreakNode, headingNode, horizontalRuleNode, imageNode, italicMark, linkMark, listItemNode, orderedListNode, paragraphNode, strikeMark, tableCellNode, tableHeaderNode, tableNode, tableRowNode, taskItemNode, taskListNode, underlineMark, } from "./builtin";
11
+ export { richTextFromMarkdown, richTextFromText } from "./markdown";
12
+ export { defineEditorMark, defineEditorNode, describeEditorSchema, getEditorMark, getEditorNode, registeredEditorMarks, registeredEditorNodes, } from "./registry";
13
+ export { escapeHtml, escapeMarkdown, htmlAttributes, indentContinuation, renderRichText, richTextToHtml, richTextToMarkdown, richTextToPlainText, stringAttr, } from "./serialize";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,cAAc,EACd,aAAa,EACb,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,GACX,MAAM,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { RichTextDocument } from "../types/editor";
2
+ /**
3
+ * Markdown back into a ProseMirror document.
4
+ *
5
+ * The AI runtime needs this and nothing else does yet: a model is shown a
6
+ * field as Markdown, because that is the format every model writes well, and
7
+ * what comes back has to become a document the editor can open. Without the
8
+ * parser the only honest options would be inserting the raw Markdown as
9
+ * literal text — which is what every CMS that bolts AI onto rich text gets
10
+ * wrong — or refusing AI on rich-text fields.
11
+ *
12
+ * It is deliberately a small parser: the block grammar the serialiser in this
13
+ * directory emits, plus the inline marks. Anything it does not recognise
14
+ * stays as text, which is the failure mode that loses nothing.
15
+ */
16
+ export declare function richTextFromMarkdown(markdown: string): RichTextDocument;
17
+ /** A plain string as one paragraph per blank-line-separated chunk. */
18
+ export declare function richTextFromText(text: string): RichTextDocument;
19
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/editor/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAA8B,MAAM,iBAAiB,CAAC;AAEpF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CASvE;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAgB/D"}
@@ -0,0 +1,30 @@
1
+ import type { EditorMarkDefinition, EditorNodeDefinition, EditorSchemaDescription } from "../types/editor";
2
+ /**
3
+ * Declares a node of the rich-text schema.
4
+ *
5
+ * The serialisers are not optional, and that is the whole point of the
6
+ * function (stage 9). A node without them renders in the panel and nowhere
7
+ * else: `GET /posts/1` answers with a shape no consumer knows, and the
8
+ * promise that the REST API is usable without a frontend quietly stops being
9
+ * true. Refusing at registration makes that failure a start-up error in the
10
+ * plugin that caused it, naming the plugin, instead of a rendering bug in
11
+ * somebody else's site.
12
+ */
13
+ export declare function defineEditorNode(definition: EditorNodeDefinition): EditorNodeDefinition;
14
+ /** Declares a mark. Same contract, one fewer dimension. */
15
+ export declare function defineEditorMark(definition: EditorMarkDefinition): EditorMarkDefinition;
16
+ export declare function getEditorNode(name: string): EditorNodeDefinition | undefined;
17
+ export declare function getEditorMark(name: string): EditorMarkDefinition | undefined;
18
+ export declare function registeredEditorNodes(): string[];
19
+ export declare function registeredEditorMarks(): string[];
20
+ /**
21
+ * The schema as data, for the panel and for `cms.inspect()`.
22
+ *
23
+ * Serialisers and components are dropped: one is a closure and the other is
24
+ * a React component, and neither survives JSON. What crosses is exactly what
25
+ * TipTap needs to build a schema — names, groups, content expressions,
26
+ * attribute defaults — so a plugin's node renders in a bundle compiled before
27
+ * the plugin existed.
28
+ */
29
+ export declare function describeEditorSchema(): EditorSchemaDescription;
30
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/editor/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAezB;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,oBAAoB,GAC/B,oBAAoB,CA6BtB;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,oBAAoB,GAC/B,oBAAoB,CAmBtB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,uBAAuB,CAkB9D"}
@@ -0,0 +1,41 @@
1
+ import type { RenderRichTextOptions, RichTextNode } from "../types/editor";
2
+ import type { JsonValue } from "../types/json";
3
+ /**
4
+ * Turning a stored document into something a consumer can use.
5
+ *
6
+ * The walker is here and the formatting is in the node definitions, which is
7
+ * the split that makes a third-party node a first-class one: a definition
8
+ * receives its children already serialised and decides how to wrap them, and
9
+ * never has to know how the rest of the tree is rendered (stage 9).
10
+ *
11
+ * An unknown node — one written by an editor that had a plugin this
12
+ * deployment does not — renders its children rather than disappearing. A
13
+ * paragraph inside a node nobody recognises is still the author's text, and
14
+ * dropping it would lose content on a configuration change.
15
+ */
16
+ export declare function renderRichText(value: unknown, options: RenderRichTextOptions): string;
17
+ export declare function richTextToHtml(value: unknown, options?: Omit<RenderRichTextOptions, "format">): string;
18
+ export declare function richTextToMarkdown(value: unknown, options?: Omit<RenderRichTextOptions, "format">): string;
19
+ /**
20
+ * Text with no markup at all.
21
+ *
22
+ * What a search index, an excerpt and a token budget want: three uses that
23
+ * would each otherwise strip HTML with a regular expression.
24
+ */
25
+ export declare function richTextToPlainText(value: unknown, options?: Omit<RenderRichTextOptions, "format">): string;
26
+ export declare function escapeHtml(value: string): string;
27
+ /**
28
+ * Escaping for Markdown, deliberately minimal.
29
+ *
30
+ * Only the characters that would otherwise change the structure of the
31
+ * document. Escaping more produces output full of backslashes, which is
32
+ * worse than the rare literal asterisk it protects.
33
+ */
34
+ export declare function escapeMarkdown(value: string): string;
35
+ /** `<a href="x" rel="y">`, with empty attributes dropped. */
36
+ export declare function htmlAttributes(attributes: Record<string, JsonValue | undefined>): string;
37
+ /** Indents every line but the first: Markdown's rule for nested blocks. */
38
+ export declare function indentContinuation(value: string, spaces: number): string;
39
+ export declare function attr(node: RichTextNode, name: string): JsonValue | undefined;
40
+ export declare function stringAttr(node: RichTextNode, name: string): string | undefined;
41
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/editor/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAIrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;;;;;;;;;GAYG;AAEH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,qBAAqB,GAC7B,MAAM,CASR;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAM,GAClD,MAAM,CAER;AAqGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,GAChD,MAAM,CAWR;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAE5E;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAGpB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `@heyo-sh/heyo-cms/editor`.
3
+ *
4
+ * The rich-text schema and its serialisers. Imported by the panel to build
5
+ * the TipTap schema, and by anything that has to turn a stored document into
6
+ * HTML, Markdown or plain text without a browser.
7
+ */
8
+ export * from "./editor/index";
9
+ export type { EditorMarkDefinition, EditorNodeDefinition, EditorSchemaDescription, MarkSerializer, MarkSerializerContext, NodeSerializer, NodeSerializerContext, RenderRichTextOptions, RichTextDocument, RichTextFormat, RichTextMark, RichTextNode, } from "./types/editor";
10
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,gBAAgB,CAAC"}
package/dist/editor.js ADDED
@@ -0,0 +1 @@
1
+ import{x,Y,Ne,wt,Tn,Sn,de,ue,On,J,_n,Ue,oo,We,vt,Z,yo,bo,wo,vo,Ao,xo,ko,Ro,Co,To,So,Oo,_o,Po,$o,jo,Io,Eo,Do,Mo,qo,Lo,Fo,pe,Pn}from"./index-9zqnf6gx.js";export{vo as blockquoteNode,Eo as boldMark,Ao as bulletListNode,To as codeBlockNode,Lo as codeMark,Y as defineEditorMark,x as defineEditorNode,de as describeEditorSchema,yo as docNode,Ue as escapeHtml,oo as escapeMarkdown,wt as getEditorMark,Ne as getEditorNode,Oo as hardBreakNode,wo as headingNode,So as horizontalRuleNode,We as htmlAttributes,_o as imageNode,vt as indentContinuation,Do as italicMark,Fo as linkMark,ko as listItemNode,xo as orderedListNode,bo as paragraphNode,Sn as registeredEditorMarks,Tn as registeredEditorNodes,ue as renderRichText,pe as richTextFromMarkdown,Pn as richTextFromText,On as richTextToHtml,J as richTextToMarkdown,_n as richTextToPlainText,qo as strikeMark,Z as stringAttr,Io as tableCellNode,jo as tableHeaderNode,Po as tableNode,$o as tableRowNode,Co as taskItemNode,Ro as taskListNode,Mo as underlineMark};
@@ -0,0 +1,33 @@
1
+ import type { Actor } from "../types/actor";
2
+ import type { AccessOperation, RbacConfig, ResolvedCollection } from "../types/config";
3
+ import type { JsonObject } from "../types/json";
4
+ import type { Where } from "../types/query";
5
+ export interface AccessRequest {
6
+ actor: Actor | null;
7
+ operation: AccessOperation;
8
+ locale: string | null;
9
+ record?: JsonObject;
10
+ /**
11
+ * Present when the configuration declares roles.
12
+ *
13
+ * It changes the default for a collection with no rule from "open" to
14
+ * "needs `collection:action`" — the only safe reading once roles exist, and
15
+ * the reason declaring `rbac` is a decision rather than a formality.
16
+ */
17
+ rbac?: RbacConfig | undefined;
18
+ }
19
+ /**
20
+ * Evaluates a collection's access rule for one operation.
21
+ *
22
+ * `false` throws here; a `Where` is returned so the caller can add it to the
23
+ * query with `and(requestWhere, accessWhere)`. Filtering after fetching would
24
+ * leak through counts, pagination and `hasNextPage` — the rule has to reach
25
+ * the database, not the serialiser (stage 4).
26
+ *
27
+ * An explicit rule is the final word: RBAC is not consulted for an operation
28
+ * the collection decided for itself, because a rule that said `true` and was
29
+ * then overruled by a permission the developer forgot to grant would be
30
+ * indistinguishable from a bug.
31
+ */
32
+ export declare function accessFilter(collection: ResolvedCollection, request: AccessRequest): Promise<Where | undefined>;
33
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/engine/access.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EAEf,UAAU,EACV,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAoB5C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAiB5B"}
@@ -0,0 +1,16 @@
1
+ import type { CmsActivity } from "../types/activity";
2
+ import type { DatabaseAdapter } from "../types/database";
3
+ export interface ActivityReaderOptions {
4
+ database: () => Promise<DatabaseAdapter>;
5
+ }
6
+ /**
7
+ * `cms.activity`: reading the trail the engine writes.
8
+ *
9
+ * Paged by the row id, descending. The ids are ordered — that is why they are
10
+ * generated the way they are — so the cursor is the last id and nothing else:
11
+ * paging by `created_at` would repeat or skip rows every time two writes to
12
+ * the same document land in the same millisecond, which is the normal case
13
+ * for a form that saves five fields.
14
+ */
15
+ export declare function createActivity(options: ActivityReaderOptions): CmsActivity;
16
+ //# sourceMappingURL=activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/engine/activity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CAoC1E"}
@@ -0,0 +1,19 @@
1
+ import type { OrderBy, Row, Where } from "../types/query";
2
+ /**
3
+ * Keyset pagination over the sort the caller asked for.
4
+ *
5
+ * `offset` re-reads and re-skips every preceding row, which is what makes
6
+ * page 400 of an archive slow and what makes a page shift when somebody
7
+ * publishes while a reader is paging. A cursor is a `WHERE`, so it costs the
8
+ * same on page 400 as on page 1 and cannot skip or repeat a row.
9
+ */
10
+ export declare function encodeCursor(row: Row, orderBy: OrderBy[]): string;
11
+ /**
12
+ * Turns a cursor back into a filter.
13
+ *
14
+ * For `a asc, b desc` the predicate is `a > va OR (a = va AND b < vb)`: one
15
+ * disjunct per sort key, each pinning the keys before it. The last key is
16
+ * always `id`, so the comparison is total and no two rows can tie.
17
+ */
18
+ export declare function cursorWhere(cursor: string, orderBy: OrderBy[]): Where;
19
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/engine/cursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAevE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAUjE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CA0BrE"}