@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,81 @@
1
+ import type { Actor } from "../types/actor";
2
+ import type { DatabaseAdapter } from "../types/database";
3
+ import type { AnyEventType, CmsEvent, HookEventEmitter } from "../types/events";
4
+ import type { JsonObject } from "../types/json";
5
+ import type { Tx } from "../types/query";
6
+ export declare const outboxTable = "outbox";
7
+ export interface BufferedEvent {
8
+ type: AnyEventType;
9
+ data: JsonObject;
10
+ previous: JsonObject | null;
11
+ }
12
+ /**
13
+ * `ctx.events`: the only way a hook causes a side effect.
14
+ *
15
+ * Emitting queues; it never sends. A mail or a webhook fired inside the
16
+ * transaction would go out even when the write is rolled back, and a mail
17
+ * fired after the commit without a record would be lost when the process
18
+ * dies between the two. The queue is drained into the outbox table by the
19
+ * engine, inside the same transaction as the write (section 5).
20
+ */
21
+ export declare class EventBuffer implements HookEventEmitter {
22
+ private readonly queued;
23
+ emit(type: AnyEventType, data: JsonObject, previous?: JsonObject | null): void;
24
+ /** Empties the queue; the caller is now responsible for the events. */
25
+ take(): BufferedEvent[];
26
+ }
27
+ export interface OutboxEntryMeta {
28
+ actor: Actor | null;
29
+ collection?: string;
30
+ documentId?: string;
31
+ }
32
+ export interface OutboxOptions {
33
+ /** Section 7: five attempts, then the delivery is dead. */
34
+ maxAttempts?: number;
35
+ /** Exponential by default: 1s, 2s, 4s, 8s. */
36
+ backoff?: (attempt: number) => number;
37
+ /** Abandoned deliveries become claimable again. Subscribers must deduplicate event.id. */
38
+ leaseMs?: number;
39
+ now?: () => Date;
40
+ }
41
+ export type EventDispatch = (event: CmsEvent) => Promise<void>;
42
+ /**
43
+ * The transactional outbox.
44
+ *
45
+ * Rows are written inside the transaction that produced them and delivered
46
+ * afterwards. That is the whole mechanism behind two promises the plan makes:
47
+ * a rolled back write sends nothing, and a committed one sends even if the
48
+ * process dies one line later (sections 5 and 7). It also means an engine
49
+ * without real transactions still has a defined behaviour — the row lands in
50
+ * the same operation sequence as the document, and the worker is idempotent
51
+ * because it claims a row before delivering it.
52
+ */
53
+ export declare class Outbox {
54
+ private readonly adapter;
55
+ private readonly dispatch;
56
+ private readonly maxAttempts;
57
+ private readonly backoff;
58
+ private readonly leaseMs;
59
+ private readonly now;
60
+ constructor(adapter: DatabaseAdapter, dispatch: EventDispatch, options?: OutboxOptions);
61
+ append(tx: Tx, events: BufferedEvent[], meta: OutboxEntryMeta): Promise<void>;
62
+ /**
63
+ * Delivers what is due and reports how much it delivered.
64
+ *
65
+ * Claim, deliver, settle — three short transactions rather than one long
66
+ * one, because a delivery is an HTTP call and holding a row lock across it
67
+ * is how an outbox turns into an outage.
68
+ */
69
+ drain(limit?: number): Promise<number>;
70
+ /**
71
+ * Takes ownership of a row, or finds out somebody else already has.
72
+ *
73
+ * A conditional update is the portable claim: it works on all three
74
+ * engines, needs no row locking and makes a second worker — or a retried
75
+ * request on serverless — harmless.
76
+ */
77
+ private hasPredecessor;
78
+ private claim;
79
+ private settle;
80
+ }
81
+ //# sourceMappingURL=outbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../src/engine/outbox.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAO,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAG9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mB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,aAAa,EACxC,OAAO,GAAE,aAAkB,EAM5B;IAEK,MAAM,CACV,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,aAAa,EAAE,EACvB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,IAAI,CAAC,CA2Bf;IAED;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAmCvC;IAED;;;;;;OAMG;YACW,cAAc;YAoBd,KAAK;YAuBL,MAAM;CAmCrB"}
@@ -0,0 +1,60 @@
1
+ import type { Actor } from "../types/actor";
2
+ import type { RbacConfig, ResolvedCollection } from "../types/config";
3
+ import type { DatabaseAdapter } from "../types/database";
4
+ import type { FieldDefinition } from "../types/fields";
5
+ import type { JsonObject } from "../types/json";
6
+ import type { Tx } from "../types/query";
7
+ import type { LocaleContext } from "./locales";
8
+ export interface RelationLoaderOptions {
9
+ adapter: DatabaseAdapter;
10
+ tx: Tx;
11
+ locale: LocaleContext;
12
+ /** Every declared collection and global, keyed by name. */
13
+ collections: Record<string, ResolvedCollection>;
14
+ includeTrashed?: boolean;
15
+ /**
16
+ * Whose read this is.
17
+ *
18
+ * A related document is filtered by the rules of the collection it belongs
19
+ * to, not by the one that pointed at it: `depth` must not be a way to read
20
+ * a field through a relation that cannot be read directly.
21
+ */
22
+ actor?: Actor | null;
23
+ rbac?: RbacConfig | undefined;
24
+ }
25
+ /**
26
+ * `depth`, resolved by batching instead of by joining.
27
+ *
28
+ * Collect the ids at this level, run one query per target collection, then
29
+ * recurse. The query count depends on the shape of the schema, never on the
30
+ * number of documents — which is the N+1 problem Payload users hit with
31
+ * `depth`, and the reason section 12 rules joins out: one batching strategy
32
+ * works identically on Postgres, SQLite and MongoDB.
33
+ */
34
+ export declare class RelationLoader {
35
+ private readonly options;
36
+ /** Shared across levels, so a document fetched once is never fetched again. */
37
+ private readonly cache;
38
+ /** Counted so a test can assert the absence of N+1 rather than infer it. */
39
+ private queries;
40
+ constructor(options: RelationLoaderOptions);
41
+ get queryCount(): number;
42
+ expand(documents: JsonObject[], collection: ResolvedCollection, depth: number): Promise<void>;
43
+ private load;
44
+ /**
45
+ * Replaces ids with documents, remembering what was replaced so the next
46
+ * level can be batched. A reference that no longer resolves stays an id
47
+ * rather than becoming `null`: losing the value would hide the dangling
48
+ * reference instead of reporting it.
49
+ */
50
+ private substitute;
51
+ }
52
+ /**
53
+ * What a field points at.
54
+ *
55
+ * `media` is a relation that does not spell it out: the value is an id in the
56
+ * `media` table, which is what makes the usage counting in section 6
57
+ * possible. Treating it as one here means `depth` resolves a cover image.
58
+ */
59
+ export declare function relationTarget(field: FieldDefinition): string | undefined;
60
+ //# sourceMappingURL=relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/engine/relations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAIzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,eAAe,CAAC;IACzB,EAAE,EAAE,EAAE,CAAC;IACP,MAAM,EAAE,aAAa,CAAC;IACtB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAMb,OAAO,CAAC,QAAQ,CAAC,OAAO;IALpC,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;IAC9D,4EAA4E;IAC5E,OAAO,CAAC,OAAO,CAAK;IAEpB,YAA6B,OAAO,EAAE,qBAAqB,EAAI;IAE/D,IAAI,UAAU,IAAI,MAAM,CAEvB;IAEK,MAAM,CACV,SAAS,EAAE,UAAU,EAAE,EACvB,UAAU,EAAE,kBAAkB,EAC9B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA8Cf;YAEa,IAAI;IAiElB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CA4BnB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAGzE"}
@@ -0,0 +1,13 @@
1
+ import type { DatabaseAdapter } from "../types/database";
2
+ import type { ScopedDb } from "../types/hooks";
3
+ import type { Tx } from "../types/query";
4
+ /**
5
+ * `ctx.db`: the handle that bypasses access control, by name.
6
+ *
7
+ * Everything it does happens inside the caller's transaction, so a hook that
8
+ * writes an audit row and then throws leaves nothing behind. The alternative
9
+ * — a pooled connection of its own — would commit independently of the
10
+ * operation that triggered it.
11
+ */
12
+ export declare function scopedDb(adapter: DatabaseAdapter, tx: Tx): ScopedDb;
13
+ //# sourceMappingURL=scoped-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoped-db.d.ts","sourceRoot":"","sources":["../../src/engine/scoped-db.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAwB,EAAE,EAAS,MAAM,gBAAgB,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CA6CnE"}
@@ -0,0 +1,25 @@
1
+ import type { ResolvedCmsConfig, ResolvedCollection } from "../types/config";
2
+ import type { DatabaseAdapter } from "../types/database";
3
+ import type { TrashListArgs, TrashPage } from "../types/trash";
4
+ export interface ListTrashedOptions {
5
+ adapter: DatabaseAdapter;
6
+ config: ResolvedCmsConfig;
7
+ /** Collections and globals, by name. */
8
+ collections: Record<string, ResolvedCollection>;
9
+ args: TrashListArgs;
10
+ }
11
+ /**
12
+ * The trash across collections.
13
+ *
14
+ * One query, not one per collection: the panel shows a single list ordered by
15
+ * when things were deleted, and assembling that from per-collection pages
16
+ * would page wrongly the moment two collections have entries.
17
+ *
18
+ * Access control is folded into the filter rather than applied afterwards —
19
+ * the same rule as everywhere else (stage 4). Each collection contributes one
20
+ * branch of an `OR`, carrying its own `read` filter; a collection the actor
21
+ * may not read contributes nothing and is therefore invisible rather than
22
+ * forbidden.
23
+ */
24
+ export declare function listTrashed(options: ListTrashedOptions): Promise<TrashPage>;
25
+ //# sourceMappingURL=trash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../../src/engine/trash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAa/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,SAAS,CAAC,CAuFpB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * One error type for everything a caller can provoke.
3
+ *
4
+ * A hook that throws, an access rule that refuses and a field that fails
5
+ * validation all end up in the same HTTP response builder, so they all carry
6
+ * the status and a machine-readable code instead of leaving the transport
7
+ * layer to guess from the message.
8
+ */
9
+ export declare class CmsError extends Error {
10
+ readonly status: number;
11
+ readonly code: string;
12
+ readonly details?: unknown;
13
+ constructor(message: string, options?: {
14
+ status?: number;
15
+ code?: string;
16
+ details?: unknown;
17
+ /**
18
+ * The error this one replaces, for the operator's log.
19
+ *
20
+ * `details` is part of the response and `cause` never is: when a
21
+ * provider or a driver fails, the caller gets a sentence and a code
22
+ * while the original stack stays where somebody debugging can reach it.
23
+ */
24
+ cause?: unknown;
25
+ });
26
+ static notFound(message?: string): CmsError;
27
+ static forbidden(message?: string): CmsError;
28
+ static unauthorized(message?: string): CmsError;
29
+ static conflict(message: string): CmsError;
30
+ static validation(message: string, details?: unknown): CmsError;
31
+ }
32
+ /**
33
+ * A mistake in the configuration, not in a request.
34
+ *
35
+ * These are thrown while `heyoCms()` is still building, so they must read like
36
+ * a compiler diagnostic: what is wrong, where, and what to write instead.
37
+ */
38
+ export declare class CmsConfigError extends Error {
39
+ readonly path: string;
40
+ constructor(path: string, message: string);
41
+ }
42
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B,YACE,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;;;;;WAMG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;KACZ,EAOP;IAED,MAAM,CAAC,QAAQ,CAAC,OAAO,SAAc,GAAG,QAAQ,CAE/C;IAED,MAAM,CAAC,SAAS,CAAC,OAAO,SAAc,GAAG,QAAQ,CAEhD;IAED,MAAM,CAAC,YAAY,CAAC,OAAO,SAAiB,GAAG,QAAQ,CAEtD;IAED,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAEzC;IAED,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAM9D;CACF;AAED;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;CACF"}
@@ -0,0 +1,142 @@
1
+ import type { FieldDefinition, FieldOptions } from "../types/fields";
2
+ import type { JsonObject, JsonValue } from "../types/json";
3
+ import { type FieldValue } from "./registry";
4
+ export interface TextOptions extends FieldOptions {
5
+ default?: string;
6
+ minLength?: number;
7
+ maxLength?: number;
8
+ /** Source string for the pattern; kept serialisable for the snapshot. */
9
+ pattern?: string;
10
+ }
11
+ export declare const text: import("./registry").FieldBuilder<string, TextOptions>;
12
+ export interface TextareaOptions extends TextOptions {
13
+ rows?: number;
14
+ }
15
+ export declare const textarea: import("./registry").FieldBuilder<string, TextareaOptions>;
16
+ /** A ProseMirror document. TipTap writes it, the serialisers read it. */
17
+ export type RichTextValue = JsonObject;
18
+ export interface RichTextOptions extends FieldOptions {
19
+ /** Editor nodes allowed in this field; the panel hides the rest. */
20
+ nodes?: string[];
21
+ default?: RichTextValue;
22
+ }
23
+ export declare const richText: import("./registry").FieldBuilder<JsonObject, RichTextOptions>;
24
+ export interface NumberOptions extends FieldOptions {
25
+ default?: number;
26
+ min?: number;
27
+ max?: number;
28
+ integer?: boolean;
29
+ }
30
+ export declare const number: import("./registry").FieldBuilder<number, NumberOptions>;
31
+ export interface BooleanOptions extends FieldOptions {
32
+ default?: boolean;
33
+ }
34
+ export declare const boolean: import("./registry").FieldBuilder<boolean, BooleanOptions>;
35
+ export interface DateOptions extends FieldOptions {
36
+ default?: string;
37
+ /** `date` hides the clock in the panel; storage is identical. */
38
+ mode?: "date" | "datetime";
39
+ }
40
+ /**
41
+ * Dates are ISO strings, not `Date` objects.
42
+ *
43
+ * The value travels through JSON on every path the engine has — storage, REST,
44
+ * webhook payloads — and a string survives all of them unchanged. Converting
45
+ * at the edges would mean three places that can disagree about time zones.
46
+ */
47
+ export declare const date: import("./registry").FieldBuilder<string, DateOptions>;
48
+ export type SelectChoice = string | {
49
+ label: string;
50
+ value: string;
51
+ };
52
+ export interface SelectOptions extends FieldOptions {
53
+ options: readonly SelectChoice[];
54
+ default?: string;
55
+ }
56
+ /** Literal choices become a union in the document type. */
57
+ export type SelectValue<TOptions extends {
58
+ options: readonly SelectChoice[];
59
+ }> = TOptions["options"][number] extends infer TChoice ? TChoice extends string ? TChoice : TChoice extends {
60
+ value: infer TValue;
61
+ } ? TValue : never : never;
62
+ /**
63
+ * A plain choice field.
64
+ *
65
+ * `status` is one of its uses and nothing more: the engine attaches no meaning
66
+ * to it, which is what removed the whole publish/unpublish lifecycle from the
67
+ * core (sections 3 and 11).
68
+ */
69
+ export declare function select<const TOptions extends SelectOptions>(options: TOptions): FieldDefinition<FieldValue<SelectValue<TOptions>, TOptions>>;
70
+ export interface MultiselectOptions extends FieldOptions {
71
+ options: readonly SelectChoice[];
72
+ default?: string[];
73
+ minItems?: number;
74
+ maxItems?: number;
75
+ }
76
+ export declare function multiselect<const TOptions extends MultiselectOptions>(options: TOptions): FieldDefinition<FieldValue<SelectValue<TOptions>[], TOptions>>;
77
+ export interface JsonFieldOptions extends FieldOptions {
78
+ default?: JsonValue;
79
+ }
80
+ export declare const json: import("./registry").FieldBuilder<JsonValue, JsonFieldOptions>;
81
+ export interface MediaOptions extends FieldOptions {
82
+ /** MIME whitelist for the picker, e.g. `image/*`. */
83
+ accept?: string;
84
+ }
85
+ /**
86
+ * A reference to a row in `media`.
87
+ *
88
+ * Storing the id rather than a URL is what makes the media lifecycle work:
89
+ * `media_usages` can count references, and a file that loses its last one is
90
+ * orphaned rather than deleted (section 6).
91
+ */
92
+ export declare const media: import("./registry").FieldBuilder<string, MediaOptions>;
93
+ export interface RelationOptions extends FieldOptions {
94
+ relationTo?: string;
95
+ /** Many-to-many: the value is an array of ids. */
96
+ many?: boolean;
97
+ }
98
+ /**
99
+ * A reference to another collection.
100
+ *
101
+ * Resolved by a batch loader rather than a join: one query per collection per
102
+ * depth level works the same on all three engines and removes the N+1 problem
103
+ * that Payload users hit with `depth` (section 12).
104
+ */
105
+ export declare function relation<const TOptions extends RelationOptions>(to: string, options?: TOptions): FieldDefinition<FieldValue<string, TOptions>>;
106
+ /**
107
+ * There is no `slug` type, and that is deliberate.
108
+ *
109
+ * It was one of these for a while, and it earned its keep by being `text`
110
+ * with `unique`, `index` and a hyphen pattern already set — plus a `from`
111
+ * option that promised the value would be derived from another field and
112
+ * never did it, because nothing in the engine generates one field out of
113
+ * another. A type whose only feature is a default and a promise is a type
114
+ * that teaches the wrong thing. A URL handle is a `text` field:
115
+ *
116
+ * ```ts
117
+ * handle: text({
118
+ * unique: true,
119
+ * index: true,
120
+ * pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
121
+ * })
122
+ * ```
123
+ *
124
+ * and generating it from the title is a `create.before` hook, which runs
125
+ * before validation precisely so that it can fill a required field.
126
+ */
127
+ export declare const email: import("./registry").FieldBuilder<string, TextOptions>;
128
+ export declare const url: import("./registry").FieldBuilder<string, TextOptions>;
129
+ /**
130
+ * SEO as fields, not as a plugin.
131
+ *
132
+ * A plugin would own the fields, the prompts and the panel section; a preset
133
+ * spreads into `fields` and stays editable (`...seoFields()`), which is the
134
+ * decision recorded in section 11.
135
+ */
136
+ export declare function seoFields(): {
137
+ seoTitle: FieldDefinition<string | null>;
138
+ seoDescription: FieldDefinition<string | null>;
139
+ ogImage: FieldDefinition<string | null>;
140
+ canonical: FieldDefinition<string | null>;
141
+ };
142
+ //# sourceMappingURL=builtin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/fields/builtin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsC1D,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,IAAI,wDAsBf,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,QAAQ,4DAanB,CAAC;AAMH,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ,gEASnB,CAAC;AAMH,MAAM,WAAW,aA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AAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC/C,OAAO,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C,CAuBA"}
@@ -0,0 +1,3 @@
1
+ export { defineField, getFieldType, registeredFieldTypes, registerFieldType, type FieldBuilder, type FieldValue, } from "./registry";
2
+ export * from "./builtin";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { FieldDefinition, FieldOptions, FieldType } from "../types/fields";
2
+ import type { JsonValue } from "../types/json";
3
+ /**
4
+ * Nullability is a property of the options, not of the field type.
5
+ *
6
+ * `text()` holds `string | null` and `text({ required: true })` holds
7
+ * `string`, and both facts are visible in the inferred document type instead
8
+ * of being discovered at runtime.
9
+ */
10
+ export type FieldValue<TValue, TOptions> = TOptions extends {
11
+ required: true;
12
+ } ? TValue : TValue | null;
13
+ export interface FieldBuilderOptions extends FieldOptions {
14
+ default?: JsonValue;
15
+ }
16
+ /**
17
+ * A field builder: what `text`, `select` or a third-party `rating` is.
18
+ *
19
+ * `const TOptions` captures literal option values, which is what lets
20
+ * `select({ options: ["draft", "published"] })` infer a union rather than
21
+ * `string`.
22
+ */
23
+ export type FieldBuilder<TValue, TOptions extends FieldOptions> = <const TGiven extends TOptions>(options?: TGiven) => FieldDefinition<FieldValue<TValue, TGiven>>;
24
+ export declare function registerFieldType<TValue, TOptions extends FieldOptions>(type: FieldType<TValue, TOptions>): void;
25
+ export declare function getFieldType<TValue = unknown>(name: string): FieldType<TValue, FieldOptions> | undefined;
26
+ export declare function registeredFieldTypes(): string[];
27
+ /**
28
+ * Declares a field type and returns its builder.
29
+ *
30
+ * Every built-in field goes through this function. A shortcut for built-ins
31
+ * would mean the public extension API is the one nobody uses, which is how
32
+ * extension points rot (stage 9).
33
+ */
34
+ export declare function defineField<TValue, TOptions extends FieldOptions>(type: FieldType<TValue, TOptions>): FieldBuilder<TValue, TOptions>;
35
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/fields/registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACZ,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,QAAQ,IAAI,QAAQ,SAAS;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAC1E,MAAM,GACN,MAAM,GAAG,IAAI,CAAC;AAElB,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,IAAI,CAChE,KAAK,CAAC,MAAM,SAAS,QAAQ,EAE7B,OAAO,CAAC,EAAE,MAAM,KACb,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAUjD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,EACrE,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,GAChC,IAAI,CASN;AAED,wBAAgB,YAAY,CAAC,MAAM,GAAG,OAAO,EAC3C,IAAI,EAAE,MAAM,GACX,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAE7C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,EAC/D,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,GAChC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAkGhC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The field registry and every built-in type.
3
+ *
4
+ * Built-ins are declared with the same `defineField()` a third-party package
5
+ * uses, so there is no privileged path into the registry (stage 9).
6
+ */
7
+ export * from "./fields/index";
8
+ //# sourceMappingURL=fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,gBAAgB,CAAC"}
package/dist/fields.js ADDED
@@ -0,0 +1 @@
1
+ import{ro,Jo,No,T}from"./index-k8wbg1dw.js";import{z as e}from"zod";var i=e.looseObject({label:e.string().optional(),description:e.string().optional(),localized:e.boolean().optional(),required:e.boolean().optional(),unique:e.boolean().optional(),index:e.boolean().optional(),readOnly:e.boolean().optional()}),o=e.lazy(()=>e.union([e.string(),e.number(),e.boolean(),e.null(),e.array(o),e.record(e.string(),o)])),l=T({name:"text",optionsSchema:i.extend({default:e.string().optional(),minLength:e.number().int().nonnegative().optional(),maxLength:e.number().int().positive().optional(),pattern:e.string().optional()}),schema:(n)=>{let t=e.string();if(n.minLength!==void 0)t=t.min(n.minLength);if(n.maxLength!==void 0)t=t.max(n.maxLength);if(n.pattern!==void 0)t=t.regex(new RegExp(n.pattern));return t},column:(n)=>({type:"text",...n.default===void 0?{}:{default:n.default}}),aiActions:["generate","improve","summarize","translate"]}),r=T({name:"textarea",optionsSchema:i.extend({default:e.string().optional(),maxLength:e.number().int().positive().optional(),rows:e.number().int().positive().optional()}),schema:(n)=>n.maxLength===void 0?e.string():e.string().max(n.maxLength),column:()=>({type:"text"}),aiActions:["generate","improve","summarize","translate"]}),f=T({name:"richText",optionsSchema:i.extend({nodes:e.array(e.string()).optional()}),schema:()=>e.looseObject({type:e.string()}),column:()=>({type:"json"}),aiActions:["generate","improve","summarize","translate"]}),O=T({name:"number",optionsSchema:i.extend({default:e.number().optional(),min:e.number().optional(),max:e.number().optional(),integer:e.boolean().optional()}),schema:(n)=>{let t=n.integer===!0?e.number().int():e.number();if(n.min!==void 0)t=t.min(n.min);if(n.max!==void 0)t=t.max(n.max);return t},column:(n)=>({type:n.integer===!0?"integer":"real",...n.default===void 0?{}:{default:n.default}})}),h=T({name:"boolean",optionsSchema:i.extend({default:e.boolean().optional()}),schema:()=>e.boolean(),column:(n)=>({type:"boolean",...n.default===void 0?{}:{default:n.default}})}),y=T({name:"date",optionsSchema:i.extend({default:e.string().optional(),mode:e.enum(["date","datetime"]).optional()}),schema:()=>e.string().refine((n)=>!Number.isNaN(Date.parse(n)),"must be an ISO 8601 date"),column:()=>({type:"timestamp"})}),a=(n)=>n.map((t)=>typeof t==="string"?t:t.value),s=i.extend({options:e.array(e.union([e.string(),e.strictObject({label:e.string(),value:e.string()})])).min(1),default:e.string().optional()}),p=T({name:"select",optionsSchema:s,schema:(n)=>e.enum(a(n.options)),column:(n)=>({type:"text",...n.default===void 0?{}:{default:n.default}})});function b(n){return p(n)}var m=T({name:"multiselect",optionsSchema:s.extend({default:e.array(e.string()).optional(),minItems:e.number().int().nonnegative().optional(),maxItems:e.number().int().positive().optional()}),schema:(n)=>{let t=e.array(e.enum(a(n.options)));if(n.minItems!==void 0)t=t.min(n.minItems);if(n.maxItems!==void 0)t=t.max(n.maxItems);return t},column:()=>({type:"json",array:!0}),aiActions:["tags"]});function F(n){return m(n)}var S=T({name:"json",optionsSchema:i,schema:()=>o,column:()=>({type:"json"})}),u=T({name:"media",optionsSchema:i.extend({accept:e.string().optional()}),schema:()=>e.string().min(1),column:()=>({type:"text"}),aiActions:["alt"]}),d=T({name:"relation",optionsSchema:i.extend({relationTo:e.string().min(1),many:e.boolean().optional()}),schema:()=>e.string().min(1),column:(n)=>({type:"text",...n.many===!0?{type:"json",array:!0}:{}}),aiActions:["tags"]});function V(n,t){return d({...t??{},relationTo:n})}var z=T({name:"email",optionsSchema:i,schema:()=>e.string().email(),column:()=>({type:"text"})}),c=T({name:"url",optionsSchema:i,schema:()=>e.string().url(),column:()=>({type:"text"})});function w(){return{seoTitle:l({label:"SEO title",localized:!0,maxLength:70,aiGenerate:{label:"Suggest an SEO title",prompt:"Write a search-friendly title under 60 characters."}}),seoDescription:r({label:"SEO description",localized:!0,maxLength:160,aiGenerate:{label:"Suggest an SEO description",prompt:"Summarise the article in one sentence under 155 characters."}}),ogImage:u({label:"Social image",accept:"image/*"}),canonical:c({label:"Canonical URL"})}}export{h as boolean,y as date,T as defineField,z as email,Jo as getFieldType,S as json,u as media,F as multiselect,O as number,ro as registerFieldType,No as registeredFieldTypes,V as relation,f as richText,b as select,w as seoFields,l as text,r as textarea,c as url};
@@ -0,0 +1,45 @@
1
+ import type { Actor, OperationSource } from "../types/actor";
2
+ import type { ResolvedCmsConfig } from "../types/config";
3
+ /**
4
+ * Who may call the administrative endpoints.
5
+ *
6
+ * Document and media routes need nothing from this file: the engine already
7
+ * answers "may this actor do this" for them, including the anonymous case —
8
+ * a collection with `read: () => true` is a public API and that is the point.
9
+ *
10
+ * The endpoints that manage the CMS itself are different. `GET /users` has no
11
+ * collection to carry an `access` rule, so the rule is here, and it has two
12
+ * parts:
13
+ *
14
+ * 1. **Always an authenticated caller.** Without `rbac` a collection defaults
15
+ * to open, which is a sensible default for content and a catastrophic one
16
+ * for user management.
17
+ * 2. **With `rbac`, also the permission.** Declaring roles is the statement
18
+ * that this deployment distinguishes between editors, so the distinction
19
+ * is applied here too.
20
+ *
21
+ * The permission names follow the same `resource:action` grammar as
22
+ * everything else — `users:invite`, `roles:create`, `webhooks:create`,
23
+ * `activity:read`, `jobs:run` — so an administrator writes them in `rbac`
24
+ * without learning a second vocabulary.
25
+ */
26
+ export declare function requireActor(actor: Actor | null): Actor;
27
+ export declare function requirePermission(config: ResolvedCmsConfig, actor: Actor | null, permission: string): Actor;
28
+ /**
29
+ * A session, specifically.
30
+ *
31
+ * Used by the endpoints that mint credentials: an API key that can create
32
+ * another API key turns a leaked read-only key into a permanent foothold,
33
+ * and the same argument applies to enrolling a second factor.
34
+ */
35
+ export declare function requireSession(actor: Actor | null): Actor;
36
+ /**
37
+ * Where the call came from, for hooks, events and the activity log.
38
+ *
39
+ * Everything over HTTP is `rest` unless the panel says otherwise with a
40
+ * header. Trusting a client header is fine precisely because it grants
41
+ * nothing: it is a label on a log line, and the panel is the only thing that
42
+ * sends it.
43
+ */
44
+ export declare function requestSource(request: Request): OperationSource;
45
+ //# sourceMappingURL=guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/http/guard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAKvD;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,UAAU,EAAE,MAAM,GACjB,KAAK,CAOP;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAQzD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAI/D"}
@@ -0,0 +1,31 @@
1
+ import type { CmsHandler, CmsInstance, RouteInspection } from "../types/instance";
2
+ import type { JsonObject } from "../types/json";
3
+ /**
4
+ * `cms.handler`: the only HTTP contract in the product.
5
+ *
6
+ * `basePath` is stripped and the rest is matched, which is the whole of the
7
+ * Better Auth arrangement the plan asks for (section 10): one catch-all route
8
+ * in any framework mounts the API, the panel and every plugin route, and a
9
+ * route added to the core or to a plugin tomorrow needs no change in the
10
+ * application.
11
+ *
12
+ * The order inside a request is fixed and worth knowing:
13
+ *
14
+ * 1. the path is resolved against `basePath`,
15
+ * 2. the caller is resolved from the cookie or the `Authorization` header,
16
+ * 3. `hooks.before` run, and may answer instead of the route,
17
+ * 4. the route's own middleware wrap the handler,
18
+ * 5. `hooks.after` see the response and may add to it.
19
+ *
20
+ * Authentication is resolved before the hooks because a rate limiter that
21
+ * cannot tell an editor from a stranger is a rate limiter on the wrong thing.
22
+ */
23
+ export interface CmsHttp {
24
+ handler: CmsHandler;
25
+ /** What `cms.inspect().routes` prints. */
26
+ routes(): RouteInspection[];
27
+ /** The generated document, memoised. */
28
+ openapi(): JsonObject;
29
+ }
30
+ export declare function createCmsHttp(cms: CmsInstance): CmsHttp;
31
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/http/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAsBhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,UAAU,CAAC;IACpB,0CAA0C;IAC1C,MAAM,IAAI,eAAe,EAAE,CAAC;IAC5B,wCAAwC;IACxC,OAAO,IAAI,UAAU,CAAC;CACvB;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAsFvD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The HTTP layer.
3
+ *
4
+ * Nothing here knows how a document is stored, who may read it or what a
5
+ * hook does: every handler parses a URL, calls one method on the instance and
6
+ * serialises the answer. That is what keeps `cms.api.posts.find()` and
7
+ * `GET /api/heyo-cms/posts` the same operation rather than two implementations
8
+ * of the same intention (section 10).
9
+ */
10
+ export { createCmsHttp, type CmsHttp } from "./handler";
11
+ export { buildOpenApi } from "./openapi";
12
+ export { Router, type RouteHandler, type RouteMatch, type RouteMiddleware, type RouteRecord, } from "./router";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { CmsInstance } from "../types/instance";
2
+ import type { JsonObject } from "../types/json";
3
+ import type { RouteRecord } from "./router";
4
+ export declare function buildOpenApi(cms: CmsInstance, routes: RouteRecord[]): JsonObject;
5
+ //# sourceMappingURL=openapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/http/openapi.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAgD5C,wBAAgB,YAAY,CAC1B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,WAAW,EAAE,GACpB,UAAU,CAiEZ"}
@@ -0,0 +1,32 @@
1
+ import type { Actor } from "../types/actor";
2
+ import type { FindArgs, ReadArgs } from "../types/api";
3
+ import type { ResolvedCollection } from "../types/config";
4
+ import type { OrderBy, Where } from "../types/query";
5
+ export interface ReadQueryOptions {
6
+ actor: Actor | null;
7
+ /** `rest` for everything over HTTP; the panel is marked by a header. */
8
+ source: ReadArgs["source"];
9
+ }
10
+ /** Locale, depth and the trash flag: what every read takes. */
11
+ export declare function readArgs(query: URLSearchParams, options: ReadQueryOptions): ReadArgs;
12
+ /** The whole of `GET /posts`: filters, sort, paging. */
13
+ export declare function findArgs(query: URLSearchParams, collection: ResolvedCollection, options: ReadQueryOptions): FindArgs;
14
+ /**
15
+ * The filter, from either syntax.
16
+ *
17
+ * Both are resolved through the same path resolver, which is what makes a
18
+ * localized field filterable without the caller knowing it is stored as a map:
19
+ * `?title=Hello` with `?locale=de` becomes `data.title.de`, because that is
20
+ * where the German title lives (section 9).
21
+ */
22
+ export declare function parseWhere(query: URLSearchParams, collection: ResolvedCollection, locale: string | null): Where | undefined;
23
+ export declare function parseSort(raw: string | null, collection: ResolvedCollection, locale: string | null): OrderBy[] | undefined;
24
+ export declare function integer(raw: string | null, name: string, min: number, max: number): number | undefined;
25
+ /**
26
+ * `?flag`, `?flag=true` and `?flag=1` all mean yes.
27
+ *
28
+ * A bare `?permanent` with no value is what somebody types, and reading it as
29
+ * "false" would make a destructive flag silently do nothing.
30
+ */
31
+ export declare function boolean(raw: string | null, name: string): boolean | undefined;
32
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/http/params.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAA2B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAg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