@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,19 @@
1
+ import type { DatabaseAdapter } from "../types/database";
2
+ import type { ScopedDb } from "../types/hooks";
3
+ /**
4
+ * `ctx.db` for a route rather than for a hook.
5
+ *
6
+ * A hook runs inside the operation's transaction, so its `db` joins it. A
7
+ * route is not an operation: there is nothing for a second statement to be
8
+ * atomic with, and holding a transaction open across an `await fetch()` in
9
+ * somebody's plugin would pin a pool connection for as long as the slowest
10
+ * third party takes to answer. So every call here gets its own short
11
+ * transaction, and a route that genuinely needs two statements to agree asks
12
+ * for the adapter and opens one itself.
13
+ *
14
+ * Lazy on purpose: resolving the adapter is what opens a pool or reads a
15
+ * binding, and most requests — a bundled asset, the OpenAPI document, a 404 —
16
+ * never touch the database at all.
17
+ */
18
+ export declare function requestDb(database: () => Promise<DatabaseAdapter>): ScopedDb;
19
+ //# sourceMappingURL=request-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-db.d.ts","sourceRoot":"","sources":["../../src/http/request-db.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,GAAG,QAAQ,CAuB5E"}
@@ -0,0 +1,48 @@
1
+ import type { JsonObject } from "../types/json";
2
+ /**
3
+ * Every response the handler produces, in one place.
4
+ *
5
+ * The shape matters more than it looks: a client written against this has to
6
+ * be able to tell "the hook stopped it" from "the document is not there" from
7
+ * "your filter is nonsense" without parsing prose, which is why errors carry
8
+ * `code` and why a stopped write is a status rather than a body.
9
+ */
10
+ export declare const jsonContentType = "application/json; charset=utf-8";
11
+ export declare function json(body: unknown, status?: number, headers?: Record<string, string>): Response;
12
+ export declare function text(body: string, status?: number): Response;
13
+ export declare function noContent(headers?: Record<string, string>): Response;
14
+ /**
15
+ * A write a `before` hook stopped.
16
+ *
17
+ * `null` is the local API's answer (section 5) and HTTP has no `null`, so this
18
+ * is the translation: nothing happened, nothing to return, and a header that
19
+ * says which of the two reasons for a 204 this is. The typed client turns it
20
+ * back into `null`.
21
+ */
22
+ export declare function stopped(): Response;
23
+ /**
24
+ * The one error shape.
25
+ *
26
+ * A `CmsError` already carries the status and the code — a hook that threw, a
27
+ * refused access rule and a failed field validation all arrive here as one
28
+ * type — so this function never has to guess. Anything else is a bug in the
29
+ * CMS and is reported as a 500 whose message is not forwarded: an exception
30
+ * from a database driver routinely contains a connection string.
31
+ */
32
+ export declare function errorResponse(error: unknown): Response;
33
+ /**
34
+ * The JSON body of a request.
35
+ *
36
+ * An empty body reads as `{}` because `PATCH /posts/:id` with nothing to say
37
+ * is a legal, if pointless, request — and answering it with a parse error
38
+ * would be a worse description of what happened.
39
+ */
40
+ export declare function readJson(request: Request): Promise<unknown>;
41
+ /** The body as an object, which is what every write route wants. */
42
+ export declare function readJsonObject(request: Request): Promise<JsonObject>;
43
+ /** `data` out of a write body, refusing the shapes that cannot be a patch. */
44
+ export declare function requireData(body: JsonObject, key?: string): JsonObject;
45
+ export declare function requireString(body: JsonObject, key: string): string;
46
+ export declare function optionalString(body: JsonObject, key: string): string | undefined;
47
+ export declare function optionalStringArray(body: JsonObject, key: string): string[] | undefined;
48
+ //# sourceMappingURL=respond.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"respond.d.ts","sourceRoot":"","sources":["../../src/http/respond.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;GAOG;AAEH,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,wBAAgB,IAAI,CAClB,IAAI,EAAE,OAAO,EACb,MAAM,SAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,QAAQ,CAKV;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAM,GAAG,QAAQ,CAKzD;AAED,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,IAAI,QAAQ,CAElC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CA4BtD;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAWjE;AAED,oEAAoE;AACpE,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAS1E;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,SAAS,GAAG,UAAU,CAStE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAOpB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,GAAG,SAAS,CAStB"}
@@ -0,0 +1,30 @@
1
+ import type { ResolvedCollection } from "../types/config";
2
+ import type { RichTextFormat } from "../types/editor";
3
+ import type { JsonObject } from "../types/json";
4
+ /**
5
+ * `?richText=html` on a read.
6
+ *
7
+ * The reason this exists is the one `defineEditorNode()` enforces: a
8
+ * ProseMirror document is useless to a consumer that has no ProseMirror. A
9
+ * static site generator, an RSS feed, a mail template and a search index all
10
+ * want the same thing, and without this each of them writes its own
11
+ * half-correct renderer against a tree they do not control.
12
+ *
13
+ * It is opt-in and not the default, because the document *is* the stored
14
+ * value: a client that writes back what it read must get back what is
15
+ * stored, and a response that silently replaced a document with a string
16
+ * would make `GET` then `PATCH` destructive.
17
+ */
18
+ export declare function richTextFormat(value: string | null): RichTextFormat | undefined;
19
+ export interface RenderOptions {
20
+ collection: ResolvedCollection;
21
+ format: RichTextFormat;
22
+ /** Resolves a `mediaId` on an image node to a URL this deployment serves. */
23
+ mediaUrl: (id: string) => string;
24
+ }
25
+ /** Renders every rich-text field of one document, in place. */
26
+ export declare function renderDocumentRichText(document: JsonObject, options: RenderOptions): JsonObject;
27
+ export declare function renderPageRichText(documents: JsonObject[], options: RenderOptions): void;
28
+ /** The URL the CMS itself serves a file from, for an image inside prose. */
29
+ export declare function mediaUrlResolver(basePath: string): (id: string) => string;
30
+ //# sourceMappingURL=rich-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/http/rich-text.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,cAAc,GAAG,SAAS,CAQ5B;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAClC;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,aAAa,GACrB,UAAU,CAYZ;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,UAAU,EAAE,EACvB,OAAO,EAAE,aAAa,GACrB,IAAI,CAEN;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAEzE"}
@@ -0,0 +1,55 @@
1
+ import type { RouteInspection } from "../types/instance";
2
+ import type { OpenApiRouteSpec, RouteContext, RouteMethod } from "../types/plugin";
3
+ /**
4
+ * The router.
5
+ *
6
+ * Written here rather than taken from a package, and that is a decision worth
7
+ * defending. The plan points at Better Auth's arrangement (section 10) and
8
+ * Better Auth does exactly this: its own matcher, because the router ends up
9
+ * in the public contract. Ours is in `RouteContext`, which a plugin author
10
+ * types against — and a plugin ecosystem pinned to somebody else's router
11
+ * major version is the framework coupling this project exists to avoid.
12
+ *
13
+ * What it owes: `:param` and a trailing `*`, static-before-dynamic
14
+ * precedence, 405 with an `Allow` header, and collisions detected while the
15
+ * configuration is still loading.
16
+ */
17
+ export type RouteHandler = (context: RouteContext) => Response | Promise<Response>;
18
+ export type RouteMiddleware = (context: RouteContext, next: () => Promise<Response>) => Promise<Response>;
19
+ export interface RouteRecord {
20
+ method: RouteMethod;
21
+ /** Relative to `basePath`: `/posts/:id`, `/admin/*`. */
22
+ path: string;
23
+ /** `core`, or the id of the plugin that registered it. */
24
+ source: string;
25
+ handler: RouteHandler;
26
+ middleware?: RouteMiddleware[];
27
+ openapi?: OpenApiRouteSpec;
28
+ }
29
+ export type RouteMatch = {
30
+ kind: "found";
31
+ route: RouteRecord;
32
+ params: Record<string, string>;
33
+ } | {
34
+ kind: "method-not-allowed";
35
+ allowed: RouteMethod[];
36
+ } | {
37
+ kind: "not-found";
38
+ };
39
+ export declare class Router {
40
+ private readonly compiled;
41
+ private readonly signatures;
42
+ add(route: RouteRecord): void;
43
+ /** Registration order is not match order; this is match order. */
44
+ list(): RouteRecord[];
45
+ /**
46
+ * What `cms.inspect().routes` prints.
47
+ *
48
+ * Paths carry `basePath`, because the question somebody has when they print
49
+ * this is "what do I call", and the answer to that is a URL rather than a
50
+ * pattern the router happens to store.
51
+ */
52
+ routes(basePath: string): RouteInspection[];
53
+ match(method: string, path: string): RouteMatch;
54
+ }
55
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/http/router.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,YAAY,KAClB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,KAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAeD,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1B,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAExD,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAuC5B;IAED,kEAAkE;IAClE,IAAI,IAAI,WAAW,EAAE,CAEpB;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CAO1C;IAED,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAkB9C;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * Who may edit, and what each role means.
5
+ *
6
+ * These are the endpoints with no collection behind them, so the permission
7
+ * check is explicit — `users:read`, `roles:create` — and an authenticated
8
+ * caller is required even when `rbac` is absent (see `guard.ts`). Everything
9
+ * else is `cms.auth`, unchanged: the panel and a provisioning script get the
10
+ * same invitations, the same hashed secrets and the same events.
11
+ */
12
+ export declare function accessRoutes(cms: CmsInstance): RouteRecord[];
13
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../src/http/routes/access.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAyT5D"}
@@ -0,0 +1,28 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { JsonObject } from "../../types/json";
3
+ import type { RouteRecord } from "../router";
4
+ /**
5
+ * The panel, served from the same handler as the API.
6
+ *
7
+ * No separate deployment, no CORS, no second origin to configure: the bundle
8
+ * is files, the handler serves files, and the panel talks to the API through
9
+ * relative URLs (section 10). `admin.assets` is where the files come from —
10
+ * an interface rather than a directory, because the bundle has to be readable
11
+ * from a Worker, where there is no filesystem.
12
+ *
13
+ * Without one — `admin.assets` unset — this answers with a page that says
14
+ * what is missing and links to the generated OpenAPI document.
15
+ * Deliberately not a 404: a mount point that answers nothing is
16
+ * indistinguishable from a mount point that is wrong, and the first thing
17
+ * somebody does after wiring the catch-all route is open this URL.
18
+ */
19
+ export declare function adminRoutes(cms: CmsInstance): RouteRecord[];
20
+ /**
21
+ * `GET /openapi.json`: the canonical description of this deployment.
22
+ *
23
+ * Takes a function rather than the document because the document describes
24
+ * this route too: the router has to be complete before it can be generated,
25
+ * and generating it on first request also keeps it off the cold-start path.
26
+ */
27
+ export declare function openApiRoute(document: () => JsonObject): RouteRecord;
28
+ //# sourceMappingURL=admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/http/routes/admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAyF3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,UAAU,GAAG,WAAW,CAepE"}
@@ -0,0 +1,26 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * The AI endpoints, generated from the configuration like everything else.
5
+ *
6
+ * Two shapes per field action, and the reason there are two is that a document
7
+ * being written for the first time has no id. The panel asks about what is on
8
+ * the screen, which for a new document is only in the browser, so the draft
9
+ * travels in the body and the stored document — when there is one — is read
10
+ * through `cms.api` and merged underneath it.
11
+ *
12
+ * POST /posts/:id/ai/:field/:action
13
+ * POST /posts/ai/:field/:action (an unsaved draft)
14
+ *
15
+ * Then the panel-wide assistant, which is addressed by nothing in particular
16
+ * because it is not about one collection:
17
+ *
18
+ * POST /ai/assistant (SSE)
19
+ * POST /ai/assistant/plans/:id/approve
20
+ *
21
+ * The per-field routes exist only when a field declares `aiGenerate` or a legacy `ai` action.
22
+ * A deployment with no AI has no AI endpoints, which is what
23
+ * `cms.inspect().routes` should say (section 8).
24
+ */
25
+ export declare function aiRoutes(cms: CmsInstance): RouteRecord[];
26
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/http/routes/ai.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA+JxD"}
@@ -0,0 +1,13 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * Editor authentication over HTTP.
5
+ *
6
+ * Every handler is a call into `cms.auth` plus a cookie, and the routes that
7
+ * exist are decided by `admin.auth.methods`: a deployment that never enabled
8
+ * magic links does not answer `POST /auth/magic-link` with "not configured",
9
+ * it does not have the endpoint. `cms.inspect().routes` is then a true
10
+ * statement about the doors this deployment has.
11
+ */
12
+ export declare function authRoutes(cms: CmsInstance): RouteRecord[];
13
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/http/routes/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAkpB1D"}
@@ -0,0 +1,24 @@
1
+ import type { ResolvedCollection } from "../../types/config";
2
+ import type { CmsInstance } from "../../types/instance";
3
+ import type { RouteRecord } from "../router";
4
+ /**
5
+ * CRUD, generated from the configuration.
6
+ *
7
+ * Every handler here is three lines around a call into `cms.api`, and that is
8
+ * the whole design: the REST layer parses a URL and serialises a result, and
9
+ * knows nothing about access control, hooks, locales, the trash or events.
10
+ * A second implementation of any of those — the usual outcome of writing
11
+ * route handlers by hand — is a second set of bugs (section 10).
12
+ */
13
+ export declare function documentRoutes(cms: CmsInstance): RouteRecord[];
14
+ /**
15
+ * Singletons.
16
+ *
17
+ * Mounted under `/globals/` rather than at the root: a global and a
18
+ * collection are the same machinery, but a URL that could be either would
19
+ * make `/settings` ambiguous the day somebody adds a `settings` collection.
20
+ */
21
+ export declare function globalRoutes(cms: CmsInstance): RouteRecord[];
22
+ export declare function schemaName(collection: ResolvedCollection): string;
23
+ export declare function inputName(collection: ResolvedCollection): string;
24
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../src/http/routes/documents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiBxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkE7C;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAmS9D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAuI5D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEjE;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEhE"}
@@ -0,0 +1,5 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /** Deterministic field generation: server functions stay on the server. */
4
+ export declare function generateRoutes(cms: CmsInstance): RouteRecord[];
5
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/http/routes/generate.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA6J9D"}
@@ -0,0 +1,28 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * The media library over HTTP.
5
+ *
6
+ * Registered only when `uploads` is configured. A deployment with no storage
7
+ * adapter has no library, and routes that exist in order to answer "add an
8
+ * uploads section" would put that sentence in `cms.inspect().routes` as if it
9
+ * were a feature.
10
+ *
11
+ * Reading is not gated by RBAC and writing is: a file's URL is public the
12
+ * moment it is on a page, so gating reads would break anonymous rendering and
13
+ * protect nothing that a private bucket and a signed URL do not already
14
+ * protect (stage 6).
15
+ */
16
+ export declare function mediaRoutes(cms: CmsInstance): RouteRecord[];
17
+ /**
18
+ * The orphan sweep, as an endpoint.
19
+ *
20
+ * Here rather than in the jobs module because it is the media lifecycle's
21
+ * only destructive step and reads better next to the library it collects
22
+ * from. It is also registered in `cms.jobs`, so a deployment with a cron
23
+ * never needs this route.
24
+ */
25
+ export declare function mediaCollectRoute(cms: CmsInstance): RouteRecord[];
26
+ /** The two names a declared size may not take; see the variant route. */
27
+ export declare const reservedMediaSubRoutes: string[];
28
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/http/routes/media.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAW7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAoT3D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAsCjE;AAED,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,UAA0C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * `GET /panel`: the configuration, as data.
5
+ *
6
+ * The panel is one static bundle that has to render every deployment, so the
7
+ * first thing it does is ask what this one is: which collections exist, what
8
+ * fields they carry, which languages are registered, whether there is a
9
+ * trash, what the caller is allowed to press. All of it is derived from the
10
+ * configuration — there is no second place to maintain it, which is the same
11
+ * argument that produced the auto-router and the generated OpenAPI document.
12
+ *
13
+ * Open to anonymous callers on purpose. It describes the shape of the
14
+ * deployment, never its content and never a secret, and the sign-in screen
15
+ * needs the title and the enabled methods *before* anybody is signed in. The
16
+ * per-actor parts — `can`, and field-level access — simply answer for
17
+ * "nobody" then, which is the correct answer for nobody.
18
+ */
19
+ export declare function panelRoutes(cms: CmsInstance): RouteRecord[];
20
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../../src/http/routes/panel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA8B3D"}
@@ -0,0 +1,25 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * The endpoints that are about the CMS rather than about content: the trash,
5
+ * the language registry, the audit trail and the sweeps.
6
+ *
7
+ * All four are read through an instance method rather than a query written
8
+ * here, for the same reason the document routes are three lines each. The
9
+ * trash list in particular has to be one paged query across collections —
10
+ * assembling it per collection would page wrongly the moment two collections
11
+ * have entries.
12
+ */
13
+ export declare function trashRoutes(cms: CmsInstance): RouteRecord[];
14
+ export declare function localeRoutes(cms: CmsInstance): RouteRecord[];
15
+ export declare function activityRoutes(cms: CmsInstance): RouteRecord[];
16
+ /**
17
+ * The sweeps, as endpoints.
18
+ *
19
+ * The package deliberately starts no timer (`cms.jobs` is not a daemon,
20
+ * because it has to run on Workers and on Lambda), so something has to call
21
+ * this: a Vercel cron with an API key, `wrangler`'s scheduled handler calling
22
+ * `cms.jobs.run()` directly, or a developer with curl.
23
+ */
24
+ export declare function jobRoutes(cms: CmsInstance): RouteRecord[];
25
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/http/routes/system.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAkH3D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAmC5D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA4D9D;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CAqEzD"}
@@ -0,0 +1,17 @@
1
+ import type { CmsInstance } from "../../types/instance";
2
+ import type { RouteRecord } from "../router";
3
+ /**
4
+ * Subscriptions, deliveries, replay.
5
+ *
6
+ * Registered only when `webhooks.enabled` is true, so a deployment that does
7
+ * not use them does not answer on these paths at all — and the panel, which
8
+ * reads `cms.inspect()`-shaped data from `/panel`, hides the screen rather
9
+ * than showing one that 501s.
10
+ *
11
+ * Every endpoint needs a permission in the `resource:action` grammar the
12
+ * rest of the product uses: `webhooks:read`, `webhooks:create`,
13
+ * `webhooks:update`, `webhooks:delete`. Managing where this CMS sends its
14
+ * content is an administrative act, not an editorial one.
15
+ */
16
+ export declare function webhookRoutes(cms: CmsInstance): RouteRecord[];
17
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/http/routes/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,EAAE,CA2N7D"}
@@ -0,0 +1,28 @@
1
+ import type { JsonObject } from "../types/json";
2
+ /**
3
+ * The small vocabulary the route modules use to document themselves.
4
+ *
5
+ * Keeping it here rather than inline is not tidiness: a response envelope
6
+ * described slightly differently on forty endpoints produces a generated
7
+ * document nobody can code-generate a client from.
8
+ */
9
+ export declare function ref(schema: string): JsonObject;
10
+ export declare function pathParam(name: string, description: string): JsonObject;
11
+ export declare function queryParam(name: string, type: "string" | "integer" | "boolean", description: string, extra?: JsonObject): JsonObject;
12
+ /** Locale and fallback: every read takes them, so they are written once. */
13
+ export declare const localeParams: JsonObject[];
14
+ export declare const depthParam: JsonObject;
15
+ /** The filter, sort and paging parameters of a list endpoint. */
16
+ export declare function listParams(collection: string): JsonObject[];
17
+ export declare function jsonBody(schema: JsonObject, required?: boolean): JsonObject;
18
+ export declare function okJson(schema: JsonObject, description: string): JsonObject;
19
+ /**
20
+ * The responses every write shares.
21
+ *
22
+ * `204` is in here on purpose: a `before` hook returning `false` stops the
23
+ * operation without an error (section 5), and a client that does not know
24
+ * that will read an empty body as a broken endpoint.
25
+ */
26
+ export declare function writeResponses(schema: JsonObject, description: string, status?: number): JsonObject;
27
+ export declare function readResponses(schema: JsonObject, description: string): JsonObject;
28
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/http/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;GAMG;AAEH,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAE9C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAQvE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,EACtC,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,UAAe,GACrB,UAAU,CAQZ;AAED,4EAA4E;AAC5E,eAAO,MAAM,YAAY,EAAE,UAAU,EAGpC,CAAC;AAEF,eAAO,MAAM,UAAU,YAKtB,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAoB3D;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,UAAO,GAAG,UAAU,CAKxE;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAK1E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,MAAM,EACnB,MAAM,SAAM,GACX,UAAU,CAaZ;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,MAAM,GAClB,UAAU,CAKZ"}
package/dist/http.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `@heyo-sh/heyo-cms/http`.
3
+ *
4
+ * The HTTP layer, for the two callers who need it directly: a plugin writing
5
+ * route handlers, and a test or tool that wants the router without a request.
6
+ * An application mounts `cms.handler` through a framework adapter and never
7
+ * imports this.
8
+ */
9
+ export { createCmsHttp, type CmsHttp } from "./http/handler";
10
+ export { buildOpenApi } from "./http/openapi";
11
+ export { Router, type RouteHandler, type RouteMatch, type RouteMiddleware, type RouteRecord, } from "./http/router";
12
+ export { errorResponse, json, noContent, optionalString, optionalStringArray, readJson, readJsonObject, requireData, requireString, stopped, text, } from "./http/respond";
13
+ export { requestSource, requireActor, requirePermission, requireSession, } from "./http/guard";
14
+ export { boolean as booleanParam, findArgs, integer as integerParam, parseSort, parseWhere, readArgs, } from "./http/params";
15
+ export { requestDb } from "./http/request-db";
16
+ export { jsonBody, listParams, localeParams, okJson, pathParam, queryParam, readResponses, ref, writeResponses, } from "./http/spec";
17
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,IAAI,EACJ,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,OAAO,EACP,IAAI,GACL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,QAAQ,EACR,OAAO,IAAI,YAAY,EACvB,SAAS,EACT,UAAU,EACV,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,MAAM,EACN,SAAS,EACT,UAAU,EACV,aAAa,EACb,GAAG,EACH,cAAc,GACf,MAAM,aAAa,CAAC"}
package/dist/http.js ADDED
@@ -0,0 +1 @@
1
+ import"./index-vxw0a03g.js";import"./index-2z1qe5mw.js";import"./index-9zqnf6gx.js";import{Fe,m,Je,y,E,vn,Kn,Yn,R,H,i,An,G,B,Gt,Kt,f,Oe,v,F,ve,o,l,a,K,xn,h,r,M,yt,kn,Rn,_e,Pe}from"./index-nvgwyykk.js";import"./index-vq2978e7.js";import"./index-5ngtc7gy.js";export{_e as Router,H as booleanParam,kn as buildOpenApi,Pe as createCmsHttp,Gt as errorResponse,vn as findArgs,R as integerParam,i as json,h as jsonBody,xn as listParams,K as localeParams,G as noContent,r as okJson,F as optionalString,ve as optionalStringArray,Yn as parseSort,Kn as parseWhere,l as pathParam,a as queryParam,E as readArgs,Kt as readJson,f as readJsonObject,yt as readResponses,o as ref,Rn as requestDb,y as requestSource,Fe as requireActor,Oe as requireData,m as requirePermission,Je as requireSession,v as requireString,B as stopped,An as text,M as writeResponses};
@@ -0,0 +1,12 @@
1
+ import type { ResolvedCmsConfig } from "../types/config";
2
+ import type { LocaleRecord } from "../types/locales";
3
+ export { isRtlLocale, localeName, LOCALE_NAMES } from "./names";
4
+ /**
5
+ * The configured languages, named.
6
+ *
7
+ * In the order they were configured: a switcher that reorders what somebody
8
+ * typed is a switcher whose order nobody can control. The default locale is
9
+ * flagged rather than hoisted, for the same reason.
10
+ */
11
+ export declare function localeRecords(config: ResolvedCmsConfig): LocaleRecord[];
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,YAAY,EAAE,CAOvE"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What a locale code is called, in English.
3
+ *
4
+ * The configuration is a list of codes — `["en", "pl"]` — because that is all
5
+ * a deployment should have to type. A panel cannot put `pl` in a language
6
+ * switcher and call it a language, so the display name is looked up here
7
+ * rather than asked for: one table, filled in once, instead of a `name` on
8
+ * every entry of every configuration.
9
+ *
10
+ * English names rather than endonyms ("Polish", not "Polski"): the panel's
11
+ * chrome is English, and a switcher that mixes the two is a list nobody can
12
+ * scan.
13
+ */
14
+ export declare const LOCALE_NAMES: Record<string, string>;
15
+ /**
16
+ * `"pl"` → `"Polish"`, `"pt-BR"` → `"Portuguese (Brazil)"`.
17
+ *
18
+ * An unknown code is returned as it was written rather than guessed at: a
19
+ * switcher reading `"kw"` is a configuration to fix, and inventing a name for
20
+ * it would hide that.
21
+ */
22
+ export declare function localeName(code: string): string;
23
+ /** Whether a code names a right-to-left language, region tag included. */
24
+ export declare function isRtlLocale(code: string): boolean;
25
+ //# sourceMappingURL=names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/i18n/names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqF/C,CAAC;AAkDF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW/C;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGjD"}
package/dist/ids.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Identifiers and checksums.
3
+ *
4
+ * Ids are generated in the engine rather than by the database: MongoDB,
5
+ * Postgres and D1 would otherwise each produce a different shape, and the
6
+ * value has to exist before the insert so hooks and events can reference the
7
+ * document they are about.
8
+ */
9
+ /**
10
+ * A sortable, prefixed id: `doc_01jq8z4m2k7xqf3h`.
11
+ *
12
+ * Time-ordered like a ULID, because an id that sorts by creation turns
13
+ * "newest first" into an index scan instead of a sort, and makes a log of
14
+ * ids readable. Randomness is eight base-36 characters — about 41 bits —
15
+ * which is far more than a single millisecond of inserts needs.
16
+ */
17
+ export declare function createId(prefix: string): string;
18
+ export declare function createOrderedId(prefix: string): string;
19
+ /**
20
+ * A fingerprint of a migration file.
21
+ *
22
+ * FNV-1a, not a cryptographic hash: this answers "has this file changed since
23
+ * it was applied", which is a question about accidents, not attackers. A
24
+ * 64-bit digest makes an accidental collision impossible in a directory that
25
+ * will hold hundreds of files, not billions.
26
+ */
27
+ export declare function checksum(content: string): string;
28
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0BH;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG/C;AAaD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUhD"}
@@ -0,0 +1,2 @@
1
+ var me="/api/heyo-cms",He="/admin",Be="./migrations";
2
+ export{me,He,Be};
@@ -0,0 +1,2 @@
1
+ function i(t){let e="";while(e.length<t){let o=crypto.getRandomValues(new Uint8Array(t*2));for(let r of o){if(r>=252)continue;if(e+="0123456789abcdefghijklmnopqrstuvwxyz"[r%36],e.length===t)break}}return e}function w(t){let n=Date.now().toString(36).padStart(9,"0");return`${t}_${n}${i(8)}`}var f=0;function ge(t){f=(f+1)%60466175;let n=Date.now().toString(36).padStart(9,"0"),e=f.toString(36).padStart(5,"0");return`${t}_${n}${e}${i(3)}`}function lo(t){let n=0xcbf29ce484222325n,e=0x100000001b3n,o=0xffffffffffffffffn,r=new TextEncoder().encode(t);for(let c of r)n=(n^BigInt(c))*e&o;return n.toString(16).padStart(16,"0")}
2
+ export{w,ge,lo};
@@ -0,0 +1,2 @@
1
+ import{e}from"./index-x72d1hzh.js";var so="*";function Rt(t,n){return`${t}:${n}`}function m(t){if(t==="*")return["*","*"];let n=t.indexOf(":");if(n===-1)return[t,"*"];return[t.slice(0,n),t.slice(n+1)]}function y(t,n){return t==="*"||t===n}function Ln(t,n){let[o,r]=m(t),[i,s]=m(n);return y(o,i)&&y(r,s)}function P(t,n){if(!t)return!1;return t.permissions.some((o)=>Ln(o,n))}function Ge(t,n){let o=new Set;for(let r of t)for(let i of n[r]??[])o.add(i);return[...o].sort()}function Ct(t,n){let o=new Set;for(let r of t){let[i,s]=m(r);for(let a of n){let[l,u]=m(a),f=j(i,l),d=j(s,u);if(f===null||d===null)continue;o.add(f==="*"&&d==="*"?"*":`${f}:${d}`)}}return[...o].sort()}function j(t,n){if(t==="*")return n;if(n==="*")return t;return t===n?t:null}function Tt(t){let n=new Set;for(let o of t){if(o==="*"||o.includes(":")){n.add(o);continue}switch(o){case"read":n.add("*:read");break;case"write":n.add("*:read"),n.add("*:create"),n.add("*:update");break;case"delete":n.add("*:delete");break;default:break}}return[...n].sort()}function Re(t){if(t==="*")return!0;if(["read","write","delete"].includes(t))return!0;return/^[a-z0-9_*-]+:[a-z0-9_*-]+$/.test(t)}function S(t,n={}){let o=n.locale??t.i18n.defaultLocale;return{locale:o,chain:[o,...h(t,o,n)]}}function h(t,n,o){if(o.fallbackLocale===!1)return[];if(typeof o.fallbackLocale==="string")return o.fallbackLocale===n?[]:[o.fallbackLocale];let r=t.i18n.defaultLocale;return r===n?[]:[r]}function rn(t,n){let o=O(t)?t:{};for(let r of n.chain){let i=o[r];if(i!==void 0&&i!==null)return{value:i,from:r}}return{value:null,from:null}}function J(t,n,o){let r=O(t)?{...t}:{};return r[n]=o,r}function O(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)}var C=["id","revision","createdAt","updatedAt","updatedBy","deletedAt","purgeAfter","scheduledAt","scheduledPatch","_fallback","_localeFields"],V=new Set(C);function A(t,n,o){let r=p(t.data),i={},s={},a=[];for(let[l,u]of Object.entries(n.fields)){if(u.localized){let d=r[l];if(d&&typeof d==="object"&&!Array.isArray(d)&&Object.hasOwn(d,o.locale))a.push(l);let g=rn(d,o);if(i[l]=g.value??b(u),g.from!==null&&g.from!==o.locale)s[l]=g.from;continue}let f=r[l];i[l]=f===void 0?b(u):f}if(Object.values(n.fields).some((l)=>l.localized))i._localeFields=a;if(i.id=String(t.id),i.revision=sn(t.revision),i.createdAt=c(t.created_at),i.updatedAt=c(t.updated_at),i.updatedBy=t.updated_by===void 0?null:t.updated_by,i.deletedAt=c(t.deleted_at),i.purgeAfter=c(t.purge_after),i.scheduledAt=c(t.scheduled_at),i.scheduledPatch=Te(t)?.data??null,Object.keys(s).length>0)i._fallback=s;return i}function Ce(t,n,o,r){v(t,n);let i=r===void 0,s={...r??{}},a=[];for(let[l,u]of Object.entries(t.fields)){let f=n[l];if(f!==void 0){s[l]=u.localized?J(s[l],o.locale,f):f,a.push(l);continue}if(!i)continue;let d=b(u);if(s[l]=u.localized?d===null?{}:{[o.locale]:d}:d,d!==null)a.push(l)}return{data:s,touched:a}}function Ie(t,n,o,r){let i={};for(let s of r){let a=t.fields[s];if(!a)continue;let l=a.localized?p(n[s])[o.locale]??null:n[s]??null;if(l===null&&a.required){i[s]="is required";continue}let u=a.schema.safeParse(l);if(!u.success)i[s]=u.error.issues[0]?.message??"is invalid"}if(Object.keys(i).length>0)throw e.validation(`${t.name}: ${Object.entries(i).map(([s,a])=>`${s} ${a}`).join(", ")}`,{fields:i})}function ao(t,n,o){return Object.keys(t.fields).filter((r)=>!L(n[r],o[r]))}function co(t){let n={};for(let[o,r]of Object.entries(t))n[R(o)]=r instanceof Date?r.toISOString():r instanceof Uint8Array?null:r;return n}function Te(t){let n=t.scheduled_patch;if(n===null||n===void 0)return null;let o=p(n),r=p(o.data),i=typeof o.locale==="string"?o.locale:null;if(i===null)return null;return{data:r,locale:i,actor:w(o.actor)}}function w(t){if(typeof t!=="object"||t===null||Array.isArray(t))return null;let n=t;if(typeof n.id!=="string")return null;return{id:n.id,source:n.source==="api-key"?"api-key":"session",roles:x(n.roles),permissions:x(n.permissions)}}function x(t){return Array.isArray(t)?t.filter((n)=>typeof n==="string"):[]}function sn(t){let n=Number(t??1);return Number.isFinite(n)&&n>0?Math.trunc(n):1}function c(t){if(t===void 0||t===null)return null;if(t instanceof Date)return t.toISOString();return String(t)}function p(t){return typeof t==="object"&&t!==null&&!Array.isArray(t)?t:{}}function b(t){let n=t.defaultValue??t.column.default;return n===void 0?null:n}function v(t,n){let o=Object.keys(n).filter((r)=>!(r in t.fields)&&!V.has(r));if(o.length>0)throw e.validation(`${t.name} has no field ${o.map((r)=>`"${r}"`).join(", ")}`,{unknown:o})}function L(t,n){if(t===n)return!0;if(t===void 0||n===void 0)return!1;if(typeof t!=="object"||typeof n!=="object")return!1;return JSON.stringify(t)===JSON.stringify(n)}function R(t){return t.replace(/_([a-z0-9])/g,(n,o)=>o.toUpperCase())}
2
+ export{so,Rt,Ln,P,Ge,Ct,Tt,Re,S,rn,A,Ce,Ie,ao,co,Te,sn,c,p};
@@ -0,0 +1,2 @@
1
+ import{createHash as u}from"node:crypto";import{arch as f,platform as m,release as p}from"node:os";var uo="https://telemetry.heyo.sh/v1/cms";function St(e,n=process.env){if(e?.enabled===!1)return{enabled:!1,reason:"telemetry: { enabled: false } in the configuration"};if(l(n.HEYO_TELEMETRY_DISABLED))return{enabled:!1,reason:"HEYO_TELEMETRY_DISABLED is set"};if(l(n.DO_NOT_TRACK))return{enabled:!1,reason:"DO_NOT_TRACK is set"};if(l(n.CI))return{enabled:!1,reason:"this is CI"};if(n.NODE_ENV==="test")return{enabled:!1,reason:"NODE_ENV is test"};return{enabled:!0,reason:"on by default; see `heyo-cms telemetry`"}}function Ot(e,n,o){let t=n._config,r=Object.values(t.collections),i=Object.values(t.globals),c=r.reduce((s,a)=>s+Object.keys(a.fields).length,0)+i.reduce((s,a)=>s+Object.keys(a.fields).length,0),d=typeof t.database==="function"?"lazy":t.database.id;return{event:e,version:o,project:y([t.basePath,d,...r.map((s)=>s.slug).sort(),...i.map((s)=>s.slug).sort()]),runtime:b(),system:{platform:m(),arch:f(),release:p()},database:d,usage:{collections:r.length,globals:i.length,fields:c,plugins:t.plugins.length,locales:t.i18n.locales.length},features:{panel:t.admin.assets!==void 0,auth:t.admin.auth!==void 0,uploads:g(t.uploads?.storage),ai:t.ai!==void 0,webhooks:t.webhooks?.enabled===!0,trash:t.trash.enabled}}}async function po(e,n={}){let o=n.fetch??globalThis.fetch;try{return(await o(n.endpoint??uo,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(n.timeout??2000)})).ok?"sent":"failed"}catch{return"failed"}}async function an(e){let n=St(e.config,e.environment);if(!n.enabled)return{decision:n,result:"skipped"};let o=Ot(e.event,e.cms,e.version),t=await po(o,{...e.send,...e.config?.endpoint?{endpoint:e.config.endpoint}:{}});return{decision:n,result:t}}function g(e){if(e===void 0)return null;return typeof e==="function"?"lazy":e.id}function y(e){return u("sha256").update(e.join("|")).digest("hex").slice(0,16)}function b(){let e=globalThis.Bun;if(e)return{name:"bun",version:e.version};let n=globalThis.Deno;if(n)return{name:"deno",version:n.version.deno};return{name:"node",version:process.versions.node}}function l(e){return e!==void 0&&e!==""&&e!=="0"&&e!=="false"}
2
+ export{uo,St,Ot,po,an};