@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,249 @@
1
+ import type { EditorSchemaDescription } from "./editor";
2
+ import type { JsonValue } from "./json";
3
+ /**
4
+ * What the panel is told about this deployment (stage 8).
5
+ *
6
+ * The panel is one static bundle serving every configuration, so everything
7
+ * it renders — which collections exist, which fields they carry, which
8
+ * languages are registered, whether there is a trash — has to arrive as data.
9
+ * `GET /panel` is that payload, and this file is its type.
10
+ *
11
+ * Two rules decide what may appear here:
12
+ *
13
+ * 1. **Only what survives JSON.** An access rule, a `condition` and a hook
14
+ * are functions; they stay on the server and the panel is told *that they
15
+ * exist* instead of being handed something it cannot run.
16
+ * 2. **Resolved, not raw.** `purgeAfter: "30d"` is also given in milliseconds
17
+ * because a countdown should not re-implement the duration grammar, and a
18
+ * locale arrives with the name of its language, because `pl` is not a
19
+ * label a switcher can show.
20
+ */
21
+ /** One entry in the AI menu next to a field. Keys come from `field.ai`. */
22
+ export interface PanelFieldAiAction {
23
+ key: string;
24
+ label: string;
25
+ /** Present when the action overrides `ai.defaultModel`. */
26
+ model?: {
27
+ provider: string;
28
+ model: string;
29
+ };
30
+ }
31
+ /**
32
+ * Whether the caller may see and write a field.
33
+ *
34
+ * Evaluated with the actor but **without a record**, because the panel asks
35
+ * before a document is chosen — so a rule that reads `record` answers for the
36
+ * generic case and the engine remains the authority on the specific one. A
37
+ * rule that throws without a record counts as permitted here and is still
38
+ * enforced on the write.
39
+ */
40
+ export interface PanelAccessFlags {
41
+ read: boolean;
42
+ update: boolean;
43
+ }
44
+ export interface PanelField {
45
+ name: string;
46
+ type: string;
47
+ label: string;
48
+ description?: string;
49
+ required: boolean;
50
+ localized: boolean;
51
+ readOnly: boolean;
52
+ unique: boolean;
53
+ /** Server-side deterministic generator is available for this field. */
54
+ generate: boolean;
55
+ defaultValue?: JsonValue;
56
+ /**
57
+ * The field type's own options, minus everything that is a function.
58
+ *
59
+ * `select` carries its choices here, `relation` its target, `media` its
60
+ * accept list — the panel reads them by field type, exactly as the field
61
+ * type's `Input` would.
62
+ */
63
+ options: Record<string, JsonValue>;
64
+ admin: {
65
+ placeholder?: string;
66
+ hidden: boolean;
67
+ };
68
+ ai: PanelFieldAiAction[];
69
+ access: PanelAccessFlags;
70
+ }
71
+ export interface PanelCollection {
72
+ name: string;
73
+ slug: string;
74
+ label: string;
75
+ kind: "collection" | "global";
76
+ group?: string;
77
+ description?: string;
78
+ /** Field used as the row title. Resolved here so the panel never guesses. */
79
+ useAsTitle: string | null;
80
+ defaultColumns: string[];
81
+ fields: PanelField[];
82
+ /**
83
+ * What this actor may do, evaluated without a record.
84
+ *
85
+ * Drives whether the panel offers a "New" button, not whether the write
86
+ * succeeds: a rule that depends on the document is answered properly by the
87
+ * engine when the document exists.
88
+ */
89
+ can: {
90
+ read: boolean;
91
+ create: boolean;
92
+ update: boolean;
93
+ delete: boolean;
94
+ };
95
+ }
96
+ export interface PanelLocale {
97
+ code: string;
98
+ /** The English name of the language, looked up from the code. */
99
+ name: string;
100
+ rtl: boolean;
101
+ isDefault: boolean;
102
+ }
103
+ /**
104
+ * The languages, as the switcher needs them.
105
+ *
106
+ * Configuration, not a registry: `i18n.locales` is a list of codes, so the
107
+ * panel renders it and never offers to edit it.
108
+ */
109
+ export interface PanelI18n {
110
+ locales: PanelLocale[];
111
+ defaultLocale: string;
112
+ }
113
+ export interface PanelMedia {
114
+ enabled: boolean;
115
+ /** Declared sizes. Nothing else may be requested from a URL. */
116
+ variants: string[];
117
+ variantMode: "on-demand" | "pregenerate" | null;
118
+ focalPoint: boolean;
119
+ crop: boolean;
120
+ accept: string[];
121
+ maxFileSize: string | null;
122
+ maxFileSizeBytes: number | null;
123
+ /** How long an unused file keeps serving, for the countdown. */
124
+ purgeAfter: string | null;
125
+ purgeAfterMs: number | null;
126
+ }
127
+ export interface PanelTrash {
128
+ enabled: boolean;
129
+ purgeAfter: string | null;
130
+ purgeAfterMs: number | null;
131
+ }
132
+ export interface PanelAuth {
133
+ methods: string[];
134
+ twoFactor: boolean;
135
+ apiKeys: boolean;
136
+ sso: string | null;
137
+ /**
138
+ * Whether the magic-link and password-reset routes exist at all.
139
+ *
140
+ * They are registered only when `admin.auth.deliverToken` is configured, so
141
+ * a sign-in screen that offered them unconditionally would offer a 404.
142
+ */
143
+ magicLink: boolean;
144
+ passwordReset: boolean;
145
+ /**
146
+ * Whether this deployment has no account yet.
147
+ *
148
+ * `true` turns the sign-in screen into a "claim this CMS" screen: there is
149
+ * nobody to sign in as, and `POST /auth/setup` is open for exactly as long
150
+ * as that sentence stays true.
151
+ */
152
+ setupRequired: boolean;
153
+ }
154
+ export interface PanelRbac {
155
+ enabled: boolean;
156
+ roles: string[];
157
+ customRoles: boolean;
158
+ }
159
+ /**
160
+ * AI, as the panel sees it.
161
+ *
162
+ * `configured` is "there is an `ai` section"; `runtime` is "something answers
163
+ * the AI routes". They are still two flags rather than one because they fail
164
+ * for different reasons — no section, or no credentials for the provider the
165
+ * default model names — and a greyed-out button with no explanation is a bug
166
+ * report.
167
+ */
168
+ export interface PanelAi {
169
+ configured: boolean;
170
+ runtime: boolean;
171
+ defaultModel: {
172
+ provider: string;
173
+ model: string;
174
+ } | null;
175
+ /**
176
+ * Whether the panel-wide assistant is switched on for this deployment.
177
+ *
178
+ * The composer is rendered either way. A disabled composer that names its
179
+ * reason is a feature somebody can fix; a composer that is simply not there
180
+ * is a feature nobody reports as missing.
181
+ */
182
+ assistant: boolean;
183
+ /** Effective assistant settings. Instructions themselves never leave the server. */
184
+ assistantSettings: {
185
+ model: {
186
+ provider: string;
187
+ model: string;
188
+ };
189
+ maxTurns: number;
190
+ maxToolCalls: number;
191
+ timeoutMs: number;
192
+ customInstructions: boolean;
193
+ } | null;
194
+ /** Every registered action id, including the ones plugins added. */
195
+ actions: string[];
196
+ /** Whether provider keys can be managed from the settings screen. */
197
+ managedKeys: boolean;
198
+ }
199
+ export interface PanelWebhooks {
200
+ enabled: boolean;
201
+ managedInAdmin: boolean;
202
+ /** Whether the delivery endpoints answer. */
203
+ runtime: boolean;
204
+ /** The event catalogue, so the subscription form is a picker. */
205
+ events: string[];
206
+ }
207
+ /**
208
+ * A plugin, as the panel can act on it.
209
+ *
210
+ * `scripts` is the whole of the client extension story: the panel is one
211
+ * static bundle compiled before any plugin existed, so a plugin that wants
212
+ * to render something ships a script the panel loads at boot, and that
213
+ * script registers a field control or a view against the global the panel
214
+ * exposes. The alternative — shipping React components through JSON — is not
215
+ * a thing that can work.
216
+ */
217
+ export interface PanelPlugin {
218
+ id: string;
219
+ navItems: {
220
+ label: string;
221
+ path: string;
222
+ icon?: string;
223
+ }[];
224
+ /** URLs, relative to `basePath` unless absolute. Loaded in order. */
225
+ scripts: string[];
226
+ /** Field types the plugin says it renders, for a diagnostic when it fails. */
227
+ fields: string[];
228
+ }
229
+ export interface PanelConfig {
230
+ title: string;
231
+ /** Where the API is mounted, absolute: every request the panel makes. */
232
+ basePath: string;
233
+ /** Where the panel itself is mounted, absolute: its router's prefix. */
234
+ panelPath: string;
235
+ collections: PanelCollection[];
236
+ globals: PanelCollection[];
237
+ i18n: PanelI18n;
238
+ media: PanelMedia;
239
+ trash: PanelTrash;
240
+ auth: PanelAuth;
241
+ rbac: PanelRbac;
242
+ ai: PanelAi;
243
+ webhooks: PanelWebhooks;
244
+ /** Rich-text nodes and marks, including the ones plugins registered. */
245
+ editor: EditorSchemaDescription;
246
+ /** Installed plugins and what they contribute to this screen. */
247
+ plugins: PanelPlugin[];
248
+ }
249
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/types/panel.ts"],"names":[],"mappings":"AAAA,OAAO,K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;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3D,qEAAqE;IACrE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,aAAa,CAAC;IACxB,wEAAwE;IACxE,MAAM,EAAE,uBAAuB,CAAC;IAChC,iEAAiE;IACjE,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB"}
@@ -0,0 +1,172 @@
1
+ import type { Actor } from "./actor";
2
+ import type { CollectionDefinition } from "./config";
3
+ import type { DatabaseAdapter } from "./database";
4
+ import type { FieldsConfig } from "./fields";
5
+ import type { CollectionDatabaseHooks, HookContext, HookOperation, HookResult, MaybePromise, ScopedDb } from "./hooks";
6
+ import type { CmsInstance } from "./instance";
7
+ import type { ComponentType, JsonObject } from "./json";
8
+ import type { MigrationStep, TableSnapshot } from "./schema";
9
+ /**
10
+ * What a route handler receives.
11
+ *
12
+ * Deliberately not a third-party router's context. The router inside the core
13
+ * is the core's own (section 10): a plugin contract typed against a specific
14
+ * router version is a lock-in the plan's "zero framework coupling" promise
15
+ * cannot afford, and a route that only ever needs `Request` and the matched
16
+ * parameters has no business importing one.
17
+ *
18
+ * The pair `db`/`cms` is the same distinction hooks make, by name rather than
19
+ * by a flag: `db` bypasses access control, `cms` enforces it.
20
+ */
21
+ export interface RouteContext {
22
+ request: Request;
23
+ /** Path parameters, e.g. `{ id: "doc_1" }` for `/posts/:id`. */
24
+ params: Record<string, string>;
25
+ query: URLSearchParams;
26
+ actor: Actor | null;
27
+ /** Access control enforced; the object hooks receive as `ctx.cms`. */
28
+ cms: CmsInstance;
29
+ /**
30
+ * Access-control-bypassing database handle, outside any transaction.
31
+ *
32
+ * Every call opens its own short transaction, because a route is not an
33
+ * operation: there is nothing for a second statement to be atomic with.
34
+ * A route that needs atomicity calls `cms.api`, or opens one itself through
35
+ * `database()`.
36
+ */
37
+ db: ScopedDb;
38
+ /**
39
+ * The adapter, built on first use.
40
+ *
41
+ * A function rather than a resolved value: a route that serves a bundled
42
+ * asset or the OpenAPI document must not open a connection pool, and a D1
43
+ * binding only exists inside a request in the first place.
44
+ */
45
+ database(): Promise<DatabaseAdapter>;
46
+ /** The parsed JSON body. Throws a 400 `CmsError` when it is not JSON. */
47
+ body(): Promise<unknown>;
48
+ /** Shared with the HTTP hooks that run around this request. */
49
+ meta: Record<string, unknown>;
50
+ json(body: unknown, status?: number): Response;
51
+ text(body: string, status?: number): Response;
52
+ }
53
+ export type RouteMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
54
+ /**
55
+ * An OpenAPI fragment carried by a route into the generated document.
56
+ *
57
+ * Attached to the route rather than written in a separate file, which is what
58
+ * makes an undocumented endpoint impossible: the generator reads the router,
59
+ * so a route that forgot its fragment shows up as one in the document.
60
+ */
61
+ export interface OpenApiRouteSpec {
62
+ summary?: string;
63
+ description?: string;
64
+ tags?: string[];
65
+ /** Query and path parameters, as OpenAPI parameter objects. */
66
+ parameters?: JsonObject[];
67
+ requestBody?: JsonObject;
68
+ responses?: JsonObject;
69
+ /** `false` marks a route that needs no credentials, e.g. a sign-in. */
70
+ security?: boolean;
71
+ }
72
+ export interface RouteDefinition {
73
+ method: RouteMethod;
74
+ /** Relative to `basePath`, e.g. `/analytics/pageviews`. */
75
+ path: string;
76
+ handler: (context: RouteContext) => Response | Promise<Response>;
77
+ middleware?: ((context: RouteContext, next: () => Promise<Response>) => Promise<Response>)[];
78
+ openapi?: OpenApiRouteSpec;
79
+ }
80
+ /** Tables and collections a plugin brings with it. */
81
+ export interface PluginSchema {
82
+ collections?: Record<string, CollectionDefinition>;
83
+ tables?: TableSnapshot[];
84
+ }
85
+ /**
86
+ * A plugin migration.
87
+ *
88
+ * Steps, not SQL: a plugin that shipped Postgres DDL would be unusable on
89
+ * MongoDB, and the whole point of the neutral step list is that the adapter
90
+ * decides how a change is expressed.
91
+ */
92
+ export interface PluginMigration {
93
+ id: string;
94
+ steps: MigrationStep[];
95
+ }
96
+ /** Changes a plugin makes to collections the user declared. */
97
+ export interface CollectionPatch {
98
+ collection: string;
99
+ fields?: FieldsConfig;
100
+ hooks?: CollectionDatabaseHooks;
101
+ }
102
+ export interface PluginContext {
103
+ collections: Record<string, CollectionDefinition>;
104
+ basePath: string;
105
+ }
106
+ /**
107
+ * A hook a plugin installs on a collection it does not own.
108
+ *
109
+ * Ordering is explicit rather than registration-dependent: plugin hooks run
110
+ * in `priority` order and the configuration's own hooks always run last, so a
111
+ * user can always override what a plugin decided (section 5).
112
+ */
113
+ export interface HookRegistration {
114
+ collection: string;
115
+ operation: HookOperation;
116
+ timing: "before" | "after";
117
+ /** Lower runs first. Plugin hooks default to 0, user hooks always run last. */
118
+ priority?: number;
119
+ handler: (input: JsonObject, context: HookContext) => MaybePromise<HookResult<JsonObject>>;
120
+ }
121
+ /** Extra methods a plugin adds to the typed client. */
122
+ export type ClientExtension<Ext> = (base: {
123
+ baseUrl: string;
124
+ request: (path: string, init?: RequestInit & {
125
+ query?: Record<string, string>;
126
+ }) => Promise<unknown>;
127
+ }) => Ext;
128
+ /**
129
+ * Panel surfaces a plugin can extend. Rendered by `@heyo-sh/heyo-cms-admin`.
130
+ *
131
+ * `views` and `fields` are components, and a component cannot cross HTTP —
132
+ * the panel is one static bundle, compiled before this plugin existed. They
133
+ * are useful to a deployment that builds its own panel bundle. For the
134
+ * shipped one, `scripts` is the mechanism: the panel loads each URL at boot
135
+ * and the script registers its controls against `window.heyoCmsPanel`.
136
+ */
137
+ export interface AdminExtension {
138
+ navItems?: {
139
+ label: string;
140
+ path: string;
141
+ icon?: string;
142
+ }[];
143
+ views?: Record<string, ComponentType<Record<string, unknown>>>;
144
+ fields?: Record<string, ComponentType<Record<string, unknown>>>;
145
+ /**
146
+ * Scripts the panel loads before it renders.
147
+ *
148
+ * Relative URLs are resolved against `basePath`, so the usual arrangement
149
+ * is a plugin route serving its own bundle: `/analytics/panel.js`.
150
+ */
151
+ scripts?: string[];
152
+ }
153
+ /**
154
+ * A plugin.
155
+ *
156
+ * `Ext` is what the plugin adds to the typed client, and it is only ever in a
157
+ * return position — which is what lets a configuration hold
158
+ * `CmsPlugin<unknown>[]` while `heyoCmsClient({ plugins: [...] })` still
159
+ * recovers the concrete extension types from the tuple it is handed.
160
+ */
161
+ export interface CmsPlugin<Ext = Record<string, never>> {
162
+ id: string;
163
+ schema?: PluginSchema;
164
+ migrations?: PluginMigration[];
165
+ extendCollections?: (context: PluginContext) => CollectionPatch[];
166
+ hooks?: HookRegistration[];
167
+ /** Registered under `basePath` automatically, exactly like core routes. */
168
+ routes?: RouteDefinition[];
169
+ client?: ClientExtension<Ext>;
170
+ admin?: AdminExtension;
171
+ }
172
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACr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AC;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,eAAe,EAAE,CAAC;IAClE,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3B,2EAA2E;IAC3E,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB"}
@@ -0,0 +1,101 @@
1
+ import type { JsonValue } from "./json";
2
+ /**
3
+ * A value as it crosses the adapter boundary.
4
+ *
5
+ * `Date` is kept distinct from its serialisation: Postgres wants a timestamp,
6
+ * SQLite wants an integer, MongoDB wants a `Date`. Deciding that inside the
7
+ * adapter is the only way the engine can stay engine-agnostic.
8
+ */
9
+ export type ColumnValue = JsonValue | Date | Uint8Array;
10
+ export type Row = Record<string, ColumnValue>;
11
+ /**
12
+ * A dotted path into a row: `id`, `created_at`, `data.title`, `data.title.pl`.
13
+ *
14
+ * Field names are validated to exclude dots, so splitting on `.` is lossless.
15
+ * The first segment names a column; the rest, when present, address a path
16
+ * inside that column's JSON document.
17
+ */
18
+ export type FieldPath = string;
19
+ export type Comparator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "nin" | "like" | "ilike" | "contains" | "exists";
20
+ /**
21
+ * The filter AST.
22
+ *
23
+ * This is the hard boundary from section 12: the engine builds `Where`, the
24
+ * adapter turns it into SQL or into a MongoDB filter document. If a feature
25
+ * cannot be expressed here, it cannot be expressed in the engine either —
26
+ * which is the constraint that keeps a third database adapter cheap.
27
+ */
28
+ export type Where = {
29
+ kind: "and";
30
+ conditions: Where[];
31
+ } | {
32
+ kind: "or";
33
+ conditions: Where[];
34
+ } | {
35
+ kind: "not";
36
+ condition: Where;
37
+ } | {
38
+ kind: "compare";
39
+ path: FieldPath;
40
+ operator: Comparator;
41
+ value: ColumnValue | ColumnValue[];
42
+ };
43
+ export interface OrderBy {
44
+ path: FieldPath;
45
+ direction: "asc" | "desc";
46
+ }
47
+ export interface Query {
48
+ table: string;
49
+ /** Omitted means every column. Paths may reach into the document body. */
50
+ select?: FieldPath[];
51
+ where?: Where;
52
+ orderBy?: OrderBy[];
53
+ limit?: number;
54
+ offset?: number;
55
+ /**
56
+ * Returns a single row `{ count }` instead of the matching rows. Counting
57
+ * belongs in the AST rather than in a second adapter method, so pagination
58
+ * never needs a code path the adapter contract does not cover.
59
+ */
60
+ count?: boolean;
61
+ }
62
+ export type Mutation = {
63
+ kind: "insert";
64
+ table: string;
65
+ values: Row;
66
+ returning?: boolean;
67
+ } | {
68
+ kind: "update";
69
+ table: string;
70
+ where: Where;
71
+ set: Row;
72
+ returning?: boolean;
73
+ } | {
74
+ kind: "delete";
75
+ table: string;
76
+ where: Where;
77
+ returning?: boolean;
78
+ };
79
+ /**
80
+ * What a mutation reports back.
81
+ *
82
+ * The plan sketched `Promise<Row>`, which cannot describe a delete or a
83
+ * multi-row update. `count` is always meaningful; `rows` is populated when the
84
+ * mutation asked for `returning`.
85
+ */
86
+ export interface MutationResult {
87
+ rows: Row[];
88
+ count: number;
89
+ }
90
+ /**
91
+ * A transaction handle.
92
+ *
93
+ * `real` is false when the engine could not start a true transaction — MongoDB
94
+ * without a replica set. Hooks and the outbox read it to switch to the
95
+ * compensating path instead of silently losing atomicity (section 12).
96
+ */
97
+ export interface Tx {
98
+ readonly id: string;
99
+ readonly real: boolean;
100
+ }
101
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,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