@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 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;;;;;;GASG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM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CAAC;CAChC;AAED,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,CAAC,YAAY,SAAS,iBAAiB,IAAI;KACrE,CAAC,IAAI,MAAM,YAAY,GAAG,gBAAgB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,aAAa,IAAI;KACzD,CAAC,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,IACxB,IAAI,SAAS,WAAW,CAAC,MAAM,YAAY,EAAE,MAAM,QAAQ,CAAC,GACxD,UAAU,GACR,iBAAiB,CAAC,YAAY,CAAC,GAAG;IAAE,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;CAAE,GACxE,KAAK,CAAC;AAEZ,4EAA4E;AAC5E,MAAM,MAAM,gBAAgB,CAAC,QAAQ,SAAS,SAAS,SAAS,CAAC,OAAO,CAAC,EAAE,IACzE,mBAAmB,CACjB;KACG,CAAC,IAAI,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,GAAG,CAAC,GAC3D,GAAG,GACH,KAAK;CACV,CAAC,MAAM,CAAC,CACV,CAAC;AAEJ,KAAK,mBAAmB,CAAC,MAAM,IAAI,CACjC,MAAM,SAAS,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,CACzD,SAAS,CAAC,KAAK,EAAE,MAAM,aAAa,KAAK,IAAI,GAC1C,aAAa,GACb,KAAK,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { CmsClientOptions } from "./client/index";
2
+ import type { CmsClient, PluginExtensions } from "./client/types";
3
+ import type { CmsInstance } from "./types/instance";
4
+ import type { CmsPlugin } from "./types/plugin";
5
+ /**
6
+ * `@heyo-sh/heyo-cms/client`.
7
+ *
8
+ * The typed client. Separate from the main entry point because this is the
9
+ * half that ships to a browser: importing it must not pull in the engine, the
10
+ * field registry or a database adapter.
11
+ *
12
+ * A generated project registers its `typeof cms` here through declaration
13
+ * merging. That is a type-only link — the server configuration is never
14
+ * imported into a browser bundle — and lets the ordinary call stay small:
15
+ *
16
+ * ```ts
17
+ * import { heyoCmsClient } from "@heyo-sh/heyo-cms/client";
18
+ *
19
+ * const client = heyoCmsClient();
20
+ * await client.posts.find();
21
+ * ```
22
+ *
23
+ * Registering one CMS is the normal application case. The explicit generic
24
+ * remains the escape hatch for a library or a TypeScript program with more
25
+ * than one CMS:
26
+ *
27
+ * ```ts
28
+ * const client = heyoCmsClient<typeof cms>({ baseUrl: "https://cms.acme.dev/api/heyo-cms" });
29
+ * ```
30
+ */
31
+ export interface HeyoCmsClientRegistry {
32
+ }
33
+ type RegisteredCms = HeyoCmsClientRegistry extends {
34
+ cms: infer TCms;
35
+ } ? TCms : CmsInstance;
36
+ /**
37
+ * Creates the browser client.
38
+ *
39
+ * With no options it calls the same-origin `/api/heyo-cms` mount. A generated
40
+ * `heyo-cms.client.d.ts` supplies the document types; without one, the client
41
+ * remains usable with the broad fallback types.
42
+ */
43
+ export declare function heyoCmsClient<TCms = RegisteredCms, const TPlugins extends readonly CmsPlugin<unknown>[] = []>(options?: CmsClientOptions<TPlugins>): CmsClient<TCms> & PluginExtensions<TPlugins>;
44
+ export type { CmsClientOptions } from "./client/index";
45
+ export type * from "./client/types";
46
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,qBAAqB;CAAG;AAEzC,KAAK,aAAa,GAAG,qBAAqB,SAAS;IAAE,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,GAClE,IAAI,GACJ,WAAW,CAAC;AAEhB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,GAAG,aAAa,EACpB,KAAK,CAAC,QAAQ,SAAS,SAAS,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAEzD,OAAO,GAAE,gBAAgB,CAAC,QAAQ,CAAM,GACvC,SAAS,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAE9C;AAED,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,mBAAmB,gBAAgB,CAAC"}
package/dist/client.js ADDED
@@ -0,0 +1 @@
1
+ import{me}from"./index-2757kej5.js";import{O}from"./index-m82a0shw.js";import{e}from"./index-x72d1hzh.js";function U(n={}){let o=O(n.baseUrl??me),s=n.fetch??((...i)=>fetch(...i)),t=async(i,l={})=>{let{query:c,headers:f,...x}=l,T=E(o,i);for(let[v,h]of Object.entries(c??{})){if(h===void 0||h===null)continue;T.searchParams.set(v,String(h))}let C=new Headers(f);for(let[v,h]of Object.entries(await D(n)))if(!C.has(v))C.set(v,h);let R=await B(n);if(R&&!C.has("authorization"))C.set("authorization",`Bearer ${R}`);let g=await s(T,{...x,headers:C,credentials:n.credentials??"same-origin"});if(g.status===204)return null;let b=await F(g);if(!g.ok)throw H(g,b);return b},a={baseUrl:o,request:t,media:q(t,o),auth:{signIn:(i)=>t("/auth/sign-in",u(i)),claimFirstAccount:(i)=>t("/auth/setup",u(i)),signOut:async()=>{await t("/auth/sign-out",{method:"POST"})},session:()=>t("/auth/session"),magicLink:(i)=>t("/auth/magic-link",u(i)),verifyMagicLink:(i)=>t("/auth/magic-link/verify",u(i)),forgotPassword:(i)=>t("/auth/password/forgot",u(i)),resetPassword:(i)=>t("/auth/password/reset",u(i)),acceptInvite:(i)=>t("/auth/invite/accept",u(i)),verifyTwoFactor:(i)=>t("/auth/2fa/verify",u(i)),beginTwoFactor:()=>t("/auth/2fa/begin",{method:"POST"}),enableTwoFactor:(i)=>t("/auth/2fa/enable",u(i)),disableTwoFactor:()=>t("/auth/2fa/disable",{method:"POST"}),apiKeys:{list:async()=>y(await t("/auth/api-keys"),"keys"),create:(i)=>t("/auth/api-keys",u(i)),revoke:async(i)=>{await t(`/auth/api-keys/${encodeURIComponent(i)}`,{method:"DELETE"})}},oauthUrl:(i,l)=>{let c=E(o,`/auth/oauth/${encodeURIComponent(i)}`);if(l)c.searchParams.set("redirectTo",l);return c.toString()}},users:{list:(i)=>t("/users",{query:i}),get:async(i)=>y(await t(`/users/${encodeURIComponent(i)}`),"user"),update:async(i,l)=>y(await t(`/users/${encodeURIComponent(i)}`,u(l,"PATCH")),"user"),invite:(i)=>t("/users/invite",u(i)),remove:async(i)=>{await t(`/users/${encodeURIComponent(i)}`,{method:"DELETE"})}},roles:{list:async()=>y(await t("/roles"),"roles"),create:async(i)=>y(await t("/roles",u(i)),"role"),update:async(i,l)=>y(await t(`/roles/${encodeURIComponent(i)}`,u(l,"PATCH")),"role"),remove:async(i)=>{await t(`/roles/${encodeURIComponent(i)}`,{method:"DELETE"})}},trash:{list:(i)=>t("/trash",{query:i}),restore:(i)=>t(`/trash/${encodeURIComponent(i.collection)}/${encodeURIComponent(i.id)}/restore`,{method:"POST"}),purge:(i)=>t(`/trash/${encodeURIComponent(i.collection)}/${encodeURIComponent(i.id)}`,{method:"DELETE"})},locales:{list:()=>t("/locales")},activity:{list:(i)=>t("/activity",{query:i})},jobs:{run:(i)=>t("/jobs/run",{method:"POST",query:{...i?.limit===void 0?{}:{limit:i.limit},...i?.only===void 0?{}:{only:i.only.join(",")}}}),failures:async(i)=>y(await t("/jobs/failures",{query:i}),"failures")},openapi:()=>t("/openapi.json")},m=new Map,P=new Proxy(a,{get(i,l){if(typeof l!=="string"||l in i)return i[l];let c=m.get(l);if(c)return c;let f=S(t,l);return m.set(l,f),f},has(i,l){return typeof l==="string"?!0:Reflect.has(i,l)}}),k=new Map;a.globals=new Proxy({},{get(i,l){if(typeof l!=="string")return;let c=k.get(l);if(c)return c;let f=j(t,l);return k.set(l,f),f}});for(let i of n.plugins??[]){let l=i.client?.({baseUrl:o,request:t});if(!l)continue;for(let[c,f]of Object.entries(l)){if(c in a)throw new e(`The "${i.id}" plugin's client extension would overwrite "${c}".`,{status:500,code:"client_extension_conflict"});a[c]=f}}return P}function S(n,o){let s=`/${o}`,t=(r)=>`${s}/${encodeURIComponent(r)}`;return{find:(r={})=>n(s,{query:A(r),...p(r)}),findById:(r,a={})=>n(t(r),{query:d(a),...p(a)}),create:({data:r,...a})=>n(s,{...u({data:r}),query:d(a),...p(a)}),update:({id:r,data:a,...m})=>n(t(r),{...u({data:a},"PATCH"),query:d(m),...p(m)}),delete:({id:r,permanent:a,...m})=>n(t(r),{method:"DELETE",query:{...d(m),...a===!0?{permanent:!0}:{}},...p(m)}),restore:({id:r,...a})=>n(`${t(r)}/restore`,{method:"POST",query:d(a),...p(a)}),schedule:({id:r,at:a,data:m,...P})=>n(`${t(r)}/schedule`,{...u({at:a instanceof Date?a.toISOString():a,data:m}),query:d(P),...p(P)}),unschedule:({id:r,...a})=>n(`${t(r)}/schedule`,{method:"DELETE",query:d(a),...p(a)})}}function j(n,o){let s=`/globals/${o}`;return{get:(t={})=>n(s,{query:d(t),...p(t)}),update:({data:t,...r})=>n(s,{...u({data:t},"PATCH"),query:d(r)}),schedule:({at:t,data:r,...a})=>n(`${s}/schedule`,{...u({at:t instanceof Date?t.toISOString():t,data:r}),query:d(a)}),unschedule:(t={})=>n(`${s}/schedule`,{method:"DELETE",query:d(t)})}}function q(n,o){return{async upload(s){let t=new FormData;if(typeof File<"u"&&s instanceof File)t.set("file",s);else{let r=s,a=r.file instanceof Blob?r.file:new Blob([r.file],{...r.contentType?{type:r.contentType}:{}});if(t.set("file",a,r.filename??"upload"),r.filename)t.set("filename",r.filename);if(r.alt!==void 0)t.set("alt",r.alt);if(r.locale!==void 0)t.set("locale",r.locale);if(r.metadata!==void 0)t.set("metadata",JSON.stringify(r.metadata))}return n("/media/upload",{method:"POST",body:t})},list:(s)=>n("/media",{query:s}),get:(s)=>n(`/media/${encodeURIComponent(s)}`),update:({id:s,...t})=>n(`/media/${encodeURIComponent(s)}`,u(t,"PATCH")),delete:({id:s,force:t})=>n(`/media/${encodeURIComponent(s)}`,{method:"DELETE",...t===!0?{query:{force:!0}}:{}}),keep:({id:s})=>n(`/media/${encodeURIComponent(s)}/keep`,{method:"POST"}),usages:async(s)=>y(await n(`/media/${encodeURIComponent(s)}/usages`),"usages"),url:(s,t="original")=>`${o}/media/${encodeURIComponent(s)}/${encodeURIComponent(t)}`}}function u(n,o="POST"){return{method:o,body:JSON.stringify(n),headers:{"content-type":"application/json"}}}function p(n){return{...n.headers===void 0?{}:{headers:n.headers},...n.signal===void 0?{}:{signal:n.signal}}}function d(n){return{...n.locale===void 0?{}:{locale:n.locale},...n.fallbackLocale===void 0?{}:{fallbackLocale:String(n.fallbackLocale)},...n.depth===void 0?{}:{depth:n.depth},...n.includeTrashed===void 0?{}:{includeTrashed:n.includeTrashed}}}function A(n){return{...d(n),...n.where===void 0?{}:{where:JSON.stringify(w(n.where))},...n.orderBy===void 0?{}:{sort:L(n.orderBy)},...n.limit===void 0?{}:{limit:n.limit},...n.offset===void 0?{}:{offset:n.offset},...n.cursor===void 0?{}:{cursor:n.cursor},...n.count===void 0?{}:{count:n.count}}}function w(n){if(n.kind==="and"||n.kind==="or")return{kind:n.kind,conditions:n.conditions.map(w)};if(n.kind==="not")return{kind:"not",condition:w(n.condition)};let o=Array.isArray(n.value)?n.value.map(I):I(n.value);return{kind:"compare",path:n.path,operator:n.operator,value:o}}function I(n){return n instanceof Date?n.toISOString():n}function L(n){return n.map((o)=>o.direction==="desc"?`-${o.path}`:o.path).join(",")}function E(n,o){let s=`${n}${o}`;try{return new URL(s)}catch{let t=globalThis.location?.origin;if(t)return new URL(s,t);throw new e('heyoCmsClient() needs "baseUrl" outside a browser.',{status:500,code:"client_base_url_required"})}}async function D(n){let o=n.headers;if(!o)return{};return typeof o==="function"?o():o}async function B(n){let o=n.token;if(!o)return null;return(typeof o==="function"?await o():o)??null}async function F(n){if((n.headers.get("content-type")??"").includes("application/json"))return await n.json();let s=await n.text();return s.length===0?null:s}function H(n,o){let s=typeof o==="object"&&o!==null?o.error??{}:{},t=typeof s.message==="string"?s.message:`The CMS answered ${n.status}.`;return new e(t,{status:n.status,code:typeof s.code==="string"?s.code:"request_failed",...s.details===void 0?{}:{details:s.details}})}function y(n,o){if(typeof n!=="object"||n===null)return n;return n[o]}function z(n={}){return U(n)}export{z as heyoCmsClient};
@@ -0,0 +1,31 @@
1
+ import type { Actor } from "./types/actor";
2
+ import type { CollectionDefinition, CollectionDefinitionInput, CollectionsConfig, GlobalDefinition, GlobalsConfig, HeyoCmsConfig } from "./types/config";
3
+ import type { FieldsConfig } from "./types/fields";
4
+ import type { CmsInstance } from "./types/instance";
5
+ export { defaultAdminPath, defaultBasePath, defaultMigrationsDirectory, } from "./defaults";
6
+ /**
7
+ * Declares a collection.
8
+ *
9
+ * Returns the definition unchanged apart from a tag: the work happens in
10
+ * `heyoCms()`, which is the only place that can see collections, globals and
11
+ * plugins at once and therefore the only place that can validate them against
12
+ * each other.
13
+ */
14
+ export declare function defineCollection<TFields extends FieldsConfig>(definition: CollectionDefinitionInput<TFields>): CollectionDefinition<TFields>;
15
+ /** Declares a singleton. Same machinery, one row. */
16
+ export declare function defineGlobal<TFields extends FieldsConfig>(definition: Omit<CollectionDefinitionInput<TFields>, "access"> & {
17
+ access?: GlobalDefinition<TFields>["access"];
18
+ }): GlobalDefinition<TFields>;
19
+ /**
20
+ * Builds the CMS.
21
+ *
22
+ * Everything that can be decided without a database is decided here: names,
23
+ * defaults, the schema the configuration implies, the order hooks will run
24
+ * in. A misconfiguration should fail while the module is loading, with the
25
+ * path to the offending key — not on the first request that happens to touch
26
+ * it.
27
+ */
28
+ export declare function heyoCms<const TCollections extends CollectionsConfig, const TGlobals extends GlobalsConfig = Record<string, never>>(config: HeyoCmsConfig<TCollections, TGlobals>): CmsInstance<TCollections, TGlobals>;
29
+ /** Convenience for tests and tooling that need an actor without a session. */
30
+ export declare function systemActor(id?: string): Actor;
31
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EAKd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAGV,WAAW,EAIZ,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AA4CpB;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,YAAY,EAC3D,UAAU,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAC7C,oBAAoB,CAAC,OAAO,CAAC,CAE/B;AAED,qDAAqD;AACrD,wBAAgB,YAAY,CAAC,OAAO,SAAS,YAAY,EACvD,UAAU,EAAE,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GAAG;IAC/D,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC9C,GACA,gBAAgB,CAAC,OAAO,CAAC,CAE3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,KAAK,CAAC,YAAY,SAAS,iBAAiB,EAC5C,KAAK,CAAC,QAAQ,SAAS,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAE5D,MAAM,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,GAC5C,WAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,CA2PrC;AAg5BD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,EAAE,SAAW,GAAG,KAAK,CAEhD"}
package/dist/config.js ADDED
@@ -0,0 +1 @@
1
+ import{Wn,Hn,Bn,it}from"./index-ty698y02.js";import"./index-wj8y1xcj.js";import"./index-hq05mc1n.js";import"./index-nvgwyykk.js";import"./index-vq2978e7.js";import"./index-9zqnf6gx.js";import{me,He,Be}from"./index-2757kej5.js";import"./index-5ngtc7gy.js";import"./index-2z1qe5mw.js";import"./index-vxw0a03g.js";export{He as defaultAdminPath,me as defaultBasePath,Be as defaultMigrationsDirectory,Wn as defineCollection,Hn as defineGlobal,Bn as heyoCms,it as systemActor};
@@ -0,0 +1,28 @@
1
+ import type { CmsInstance } from "../types/instance";
2
+ import { type ContentRecord } from "./records";
3
+ export interface ExportOptions {
4
+ /** Collection names. Defaults to every collection in the configuration. */
5
+ collections?: string[];
6
+ /** Global names. Defaults to every global. */
7
+ globals?: string[];
8
+ /** Includes documents that are in the trash. Off by default. */
9
+ includeTrashed?: boolean;
10
+ /** Rows per query. Paging keeps a large dump off the heap. */
11
+ batchSize?: number;
12
+ }
13
+ /**
14
+ * Reads the content out, one record at a time.
15
+ *
16
+ * This is the one operation in the package that reads rows rather than
17
+ * documents, and it has a reason: a read resolves a locale, and an export
18
+ * that resolved a locale would drop every translation it did not pick. So the
19
+ * export takes the storage shape — locale maps and all — and the importer
20
+ * writes it back through the ordinary API, which is what keeps the single
21
+ * write path the engine is built around (stage 3) intact in both directions.
22
+ *
23
+ * It yields instead of returning an array because the caller is a CLI writing
24
+ * to a file descriptor: a collection with a hundred thousand documents must
25
+ * cost a constant amount of memory to export.
26
+ */
27
+ export declare function exportContent(cms: CmsInstance, options?: ExportOptions): AsyncGenerator<ContentRecord>;
28
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/content/export.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAGL,KAAK,aAAa,EAInB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAuB,aAAa,CAClC,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,aAAkB,GAC1B,cAAc,CAAC,aAAa,CAAC,CA4D/B"}
@@ -0,0 +1,65 @@
1
+ import type { Actor } from "../types/actor";
2
+ import type { ResolvedCollection } from "../types/config";
3
+ import type { CmsInstance } from "../types/instance";
4
+ import type { JsonObject } from "../types/json";
5
+ import { type ContentRecord } from "./records";
6
+ export interface ImportOptions {
7
+ /**
8
+ * What to do with a document whose id is already there.
9
+ *
10
+ * `skip` is the default because an import is usually a restore into an
11
+ * empty deployment, and the destructive reading of "merge these two
12
+ * environments" should have to be asked for by name.
13
+ */
14
+ onConflict?: "skip" | "update" | "fail";
15
+ /** Who the writes are attributed to. Defaults to the system actor. */
16
+ actor?: Actor | null;
17
+ /** Parses and reports without writing anything. */
18
+ dryRun?: boolean;
19
+ }
20
+ export interface ImportReport {
21
+ documents: {
22
+ created: number;
23
+ updated: number;
24
+ skipped: number;
25
+ };
26
+ globals: {
27
+ updated: number;
28
+ skipped: number;
29
+ };
30
+ /** Everything that was refused, with the reason, in the order it happened. */
31
+ errors: string[];
32
+ }
33
+ /**
34
+ * Writes an export back, through the ordinary API.
35
+ *
36
+ * Every document goes through `create`/`update`, which means access control,
37
+ * validation, hooks, the activity log and the outbox all run — an import is
38
+ * an ordinary set of writes performed quickly, not a second way into the
39
+ * database. The cost is that `createdAt` and `updatedAt` are the import's own
40
+ * timestamps; a publication date that matters belongs in a field, where a
41
+ * reader can see it.
42
+ *
43
+ * Ids are preserved. That is what keeps a relation pointing at the document
44
+ * it pointed at, and a rich-text image pointing at the file it was, without
45
+ * a rewriting pass that would have to understand every field type a plugin
46
+ * ever adds.
47
+ */
48
+ export declare function importContent(cms: CmsInstance, records: AsyncIterable<ContentRecord> | Iterable<ContentRecord>, options?: ImportOptions): Promise<ImportReport>;
49
+ interface SplitData {
50
+ /** Everything that can be written in one call, in the default locale. */
51
+ base: JsonObject;
52
+ /** One patch per further locale, written after the document exists. */
53
+ translations: Record<string, JsonObject>;
54
+ }
55
+ /**
56
+ * Turns the storage shape back into a sequence of ordinary writes.
57
+ *
58
+ * A localized field is stored as `{ en: ..., pl: ... }` and written one
59
+ * language at a time, because that is what the API offers and inventing a
60
+ * multi-locale write for the importer alone would be a second write path with
61
+ * its own hooks problem.
62
+ */
63
+ export declare function splitLocales(collection: ResolvedCollection, data: JsonObject, defaultLocale: string): SplitData;
64
+ export {};
65
+ //# sourceMappingURL=import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../src/content/import.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAC3D,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACxC,sEAAsE;IACtE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,8EAA8E;IAC9E,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,EAC/D,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CA6CvB;AA2HD,UAAU,SAAS;IACjB,yEAAyE;IACzE,IAAI,EAAE,UAAU,CAAC;IACjB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAC1C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,kBAAkB,EAC9B,IAAI,EAAE,UAAU,EAChB,aAAa,EAAE,MAAM,GACpB,SAAS,CAkCX"}
@@ -0,0 +1,73 @@
1
+ import type { JsonObject, JsonValue } from "../types/json";
2
+ /**
3
+ * The on-disk format of an export: newline-delimited JSON.
4
+ *
5
+ * One record per line, header first. The choice is not cosmetic: a content
6
+ * dump is the one file in a CMS that routinely outgrows memory, and NDJSON is
7
+ * the only JSON shape that can be written and read a record at a time. It also
8
+ * diffs, greps and `tail`s, which a single array wrapped in two brackets does
9
+ * not.
10
+ */
11
+ export declare const exportFormat = "heyo-cms/export";
12
+ export declare const exportVersion = 1;
13
+ /**
14
+ * The first line of every file.
15
+ *
16
+ * It carries what the importer has to check before it writes anything — the
17
+ * format and its version — and what a human has to know a year later: when it
18
+ * was taken, from which engine, and what is in it.
19
+ */
20
+ export interface ExportHeader {
21
+ kind: "header";
22
+ format: typeof exportFormat;
23
+ version: number;
24
+ exportedAt: string;
25
+ /** `postgres`, `sqlite`, `d1`, `mongodb`. Informational. */
26
+ database: string;
27
+ /** The default locale at the time of export; the importer writes into it. */
28
+ defaultLocale: string;
29
+ collections: string[];
30
+ globals: string[];
31
+ }
32
+ /**
33
+ * One document, in storage shape.
34
+ *
35
+ * `data` is what the row holds, not what a read returns: a localized field is
36
+ * a `{ [locale]: value }` map here, because an export that resolved one
37
+ * language would silently drop every translation. The importer takes the maps
38
+ * apart again and writes each locale through the ordinary API.
39
+ */
40
+ export interface DocumentRecord {
41
+ kind: "document";
42
+ collection: string;
43
+ id: string;
44
+ data: JsonObject;
45
+ createdAt: string | null;
46
+ updatedAt: string | null;
47
+ /** Set only on an export that asked for the trash. */
48
+ deletedAt?: string | null;
49
+ scheduledAt?: string | null;
50
+ scheduledPatch?: JsonValue;
51
+ }
52
+ /** A singleton. Same shape, no id: its row id is derived from the slug. */
53
+ export interface GlobalRecord {
54
+ kind: "global";
55
+ global: string;
56
+ data: JsonObject;
57
+ updatedAt: string | null;
58
+ }
59
+ export type ContentRecord = ExportHeader | DocumentRecord | GlobalRecord;
60
+ /** Parses one line. Throws with the line number, which is what a reader needs. */
61
+ export declare function parseRecord(line: string, lineNumber: number): ContentRecord;
62
+ /**
63
+ * Reads an NDJSON stream into records.
64
+ *
65
+ * Blank lines are skipped rather than refused: a file that was concatenated,
66
+ * edited or produced by a shell redirect is still a valid export, and failing
67
+ * on a trailing newline would be a rule nobody could guess.
68
+ */
69
+ export declare function readRecords(lines: AsyncIterable<string>): AsyncGenerator<ContentRecord>;
70
+ /** Splits a chunked stream into lines, so a reader never buffers the file. */
71
+ export declare function toLines(chunks: AsyncIterable<string>): AsyncGenerator<string>;
72
+ export declare function serializeRecord(record: ContentRecord): string;
73
+ //# sourceMappingURL=records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/content/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAC9C,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,OAAO,YAAY,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;AAEzE,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa,CAuC3E;AAED;;;;;;GAMG;AACH,wBAAuB,WAAW,CAChC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,GAC3B,cAAc,CAAC,aAAa,CAAC,CAQ/B;AAED,8EAA8E;AAC9E,wBAAuB,OAAO,CAC5B,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAC5B,cAAc,CAAC,MAAM,CAAC,CAYxB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@heyo-sh/heyo-cms/content` — content import and export.
3
+ *
4
+ * The CLI spells this as `heyo-cms export` and `heyo-cms import`; the module
5
+ * exists because the interesting uses are not interactive: seeding a preview
6
+ * deployment from production, moving a site between databases, or writing the
7
+ * importer's input from a converter for somebody else's CMS.
8
+ */
9
+ export { exportContent, type ExportOptions } from "./content/export";
10
+ export { importContent, splitLocales, type ImportOptions, type ImportReport, } from "./content/import";
11
+ export { exportFormat, exportVersion, parseRecord, readRecords, serializeRecord, toLines, type ContentRecord, type DocumentRecord, type ExportHeader, type GlobalRecord, } from "./content/records";
12
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,eAAe,EACf,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ import"./index-2z1qe5mw.js";import"./index-vxw0a03g.js";import"./index-ty698y02.js";import"./index-9zqnf6gx.js";import"./index-vq2978e7.js";import"./index-nvgwyykk.js";import"./index-wj8y1xcj.js";import{Ze,Ee,Un,Pt,$t,jt,It,Et,cn}from"./index-md79xr6h.js";import"./index-hq05mc1n.js";import"./index-5ngtc7gy.js";export{It as exportContent,Ze as exportFormat,Ee as exportVersion,Et as importContent,Un as parseRecord,Pt as readRecords,jt as serializeRecord,cn as splitLocales,$t as toLines};
@@ -0,0 +1,29 @@
1
+ import type { DatabaseAdapter } from "../types/database";
2
+ /** The Cloudflare D1 binding, typed structurally so no SDK is imported. */
3
+ export interface D1Database {
4
+ prepare(sql: string): D1PreparedStatement;
5
+ exec?(sql: string): Promise<unknown>;
6
+ batch?(statements: D1PreparedStatement[]): Promise<unknown>;
7
+ }
8
+ export interface D1PreparedStatement {
9
+ bind(...values: unknown[]): D1PreparedStatement;
10
+ all<T = Record<string, unknown>>(): Promise<{
11
+ results?: T[];
12
+ }>;
13
+ run(): Promise<{
14
+ meta?: {
15
+ changes?: number;
16
+ };
17
+ }>;
18
+ }
19
+ /**
20
+ * Creates the D1 adapter.
21
+ *
22
+ * D1 has no interactive transactions — only batches — so the adapter declares
23
+ * `transactions: false` and the engine switches to the compensating path:
24
+ * the outbox row is written with the document in one statement, and the
25
+ * worker that delivers it is idempotent (section 12). Pretending otherwise
26
+ * would mean a rollback that silently did not roll back.
27
+ */
28
+ export declare function d1(binding: D1Database): DatabaseAdapter;
29
+ //# sourceMappingURL=d1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d1.d.ts","sourceRoot":"","sources":["../../src/db/d1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;IAC1C,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,KAAK,CAAC,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,mBAAmB,CAAC;IAChD,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;IAC/D,GAAG,IAAI,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CACjD;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,eAAe,CAIvD"}
package/dist/db/d1.js ADDED
@@ -0,0 +1 @@
1
+ import{_t,re,Ye}from"../index-b2ecggck.js";class n{binding;id="d1";constructor(e){this.binding=e}async all(e,t){return(await this.bind(e,t).all()).results??[]}async run(e,t){return{rowsAffected:(await this.bind(e,t).run()).meta?.changes??0}}async exec(e){for(let t of _t(e))await this.binding.prepare(t).run()}bind(e,t){let r=this.binding.prepare(e);return t.length>0?r.bind(...t):r}}function o(e){return new re(new n(e),Ye,{capabilities:{transactions:!1}})}export{o as d1};
@@ -0,0 +1,128 @@
1
+ import type { AppliedMigration, DatabaseAdapter, DatabaseAdapterFactory, DatabaseCapabilities } from "../types/database";
2
+ import type { Mutation, MutationResult, Query, Row, Tx } from "../types/query";
3
+ import type { MigrationArtifact, MigrationStep, SchemaSnapshot } from "../types/schema";
4
+ export type MongoDocument = Record<string, unknown>;
5
+ export type MongoFilter = Record<string, unknown>;
6
+ export interface MongoCursor<T> {
7
+ toArray(): Promise<T[]>;
8
+ }
9
+ export interface MongoIndexInfo {
10
+ name: string;
11
+ key: Record<string, number>;
12
+ unique?: boolean;
13
+ }
14
+ export interface MongoLikeCollection {
15
+ find(filter: MongoFilter, options?: {
16
+ sort?: Record<string, 1 | -1>;
17
+ limit?: number;
18
+ skip?: number;
19
+ projection?: Record<string, 1>;
20
+ }): MongoCursor<MongoDocument>;
21
+ countDocuments(filter: MongoFilter): Promise<number>;
22
+ insertOne(document: MongoDocument): Promise<unknown>;
23
+ updateMany(filter: MongoFilter, update: Record<string, unknown>): Promise<{
24
+ modifiedCount?: number;
25
+ matchedCount?: number;
26
+ }>;
27
+ deleteMany(filter: MongoFilter): Promise<{
28
+ deletedCount?: number;
29
+ }>;
30
+ createIndex(keys: Record<string, 1 | -1>, options?: {
31
+ name?: string;
32
+ unique?: boolean;
33
+ partialFilterExpression?: MongoFilter;
34
+ }): Promise<unknown>;
35
+ dropIndex(name: string): Promise<unknown>;
36
+ listIndexes(): MongoCursor<MongoIndexInfo>;
37
+ }
38
+ /** The subset of a `Db` the adapter uses. The official driver satisfies it. */
39
+ export interface MongoLikeDatabase {
40
+ collection(name: string): MongoLikeCollection;
41
+ listCollections(): MongoCursor<{
42
+ name: string;
43
+ }>;
44
+ createCollection(name: string): Promise<unknown>;
45
+ dropCollection(name: string): Promise<unknown>;
46
+ }
47
+ export interface MongoOptions {
48
+ /**
49
+ * Transactions need a replica set. Left unset, the adapter reports `false`
50
+ * and the engine uses the compensating path — which is the correct answer
51
+ * for a standalone `mongod`, and a stated one rather than a surprise.
52
+ */
53
+ transactions?: boolean;
54
+ /** Database name, when it is not part of the connection string. */
55
+ database?: string;
56
+ }
57
+ /**
58
+ * MongoDB behind the same contract as Postgres.
59
+ *
60
+ * Everything that would normally leak — DDL, SQL, column types — was already
61
+ * removed from the engine by the neutral `Query`/`Mutation` AST and the
62
+ * neutral migration steps, so this adapter is a translator rather than a
63
+ * second implementation of the CMS.
64
+ */
65
+ export declare class MongoDatabaseAdapter implements DatabaseAdapter {
66
+ private readonly database;
67
+ readonly id = "mongodb";
68
+ readonly capabilities: DatabaseCapabilities;
69
+ private schema;
70
+ private documentColumns;
71
+ private columnNames;
72
+ constructor(database: MongoLikeDatabase, options?: MongoOptions);
73
+ useSchema(schema: SchemaSnapshot): void;
74
+ /**
75
+ * Lists collections and their indexes.
76
+ *
77
+ * A document database has no columns to report, so the snapshot carries
78
+ * tables without them. That is enough for drift detection — a missing
79
+ * collection or a missing index is what breaks a deployment.
80
+ */
81
+ introspect(): Promise<SchemaSnapshot>;
82
+ plan(from: SchemaSnapshot, to: SchemaSnapshot): MigrationStep[];
83
+ /**
84
+ * Renders the steps themselves.
85
+ *
86
+ * There is no SQL to write, and a hand-written script would not survive a
87
+ * review as well as the step list the planner already produced. The file is
88
+ * numbered, committed and applied exactly like a `.sql` one; only its
89
+ * contents differ.
90
+ */
91
+ render(steps: MigrationStep[], id: string): MigrationArtifact;
92
+ applyMigration(artifact: MigrationArtifact): Promise<void>;
93
+ listAppliedMigrations(): Promise<AppliedMigration[]>;
94
+ recordMigration(id: string, checksum: string): Promise<void>;
95
+ /**
96
+ * Transactions exist only on a replica set.
97
+ *
98
+ * Rather than emulate them, the adapter reports the capability honestly and
99
+ * runs the function without one. The engine is written to that flag: the
100
+ * outbox row goes in with the document, and delivery is idempotent.
101
+ */
102
+ transaction<T>(fn: (tx: Tx) => Promise<T>): Promise<T>;
103
+ query(_tx: Tx, query: Query): Promise<Row[]>;
104
+ mutate(_tx: Tx, mutation: Mutation): Promise<MutationResult>;
105
+ private applyStep;
106
+ private filter;
107
+ private condition;
108
+ /**
109
+ * `title` means `data.title` on a table that stores a document body.
110
+ *
111
+ * Identical to the SQL compiler's rule, which is what keeps a query written
112
+ * against one engine working against another.
113
+ */
114
+ private path;
115
+ /** `id` is the primary key, so it is `_id` in storage and nowhere else. */
116
+ private encode;
117
+ private decode;
118
+ }
119
+ /**
120
+ * Creates the MongoDB adapter.
121
+ *
122
+ * A connection string is accepted as well as a `Db`, and loads the official
123
+ * driver on demand: it is a peer dependency, because a project on Postgres
124
+ * must not ship a MongoDB client.
125
+ */
126
+ export declare function mongodb(url: string, options?: MongoOptions): DatabaseAdapterFactory;
127
+ export declare function mongodb(database: MongoLikeDatabase, options?: MongoOptions): DatabaseAdapter;
128
+ //# sourceMappingURL=mongodb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongodb.d.ts","sourceRoot":"","sources":["../../src/db/mongodb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAGV,QAAQ,EACR,cAAc,EACd,KAAK,EACL,GAAG,EACH,EAAE,EAEH,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAMzB,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACpD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;C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AAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjE;IAED;;;;;;OAMG;IACG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE3D;IAEK,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CA4BjD;IAEK,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA0DjE;YAMa,SAAS;IAyFvB,OAAO,CAAC,MAAM;IAiCd,OAAO,CAAC,SAAS;IAoCjB;;;;;OAKG;IACH,OAAO,CAAC,IAAI;IAiBZ,2EAA2E;IAC3E,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,MAAM;CAsBf;AAkCD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,sBAAsB,CAAC;AACrF,wBAAgB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{Ae,xe}from"../index-gpwcmmvr.js";import{N}from"../index-y5mwknr9.js";import{e,n}from"../index-x72d1hzh.js";class b{id;real;constructor(o,t){this.id=o;this.real=t}}class h{database;id="mongodb";capabilities;schema={version:1,tables:[],collections:[]};documentColumns=new Map;columnNames=new Map;constructor(o,t={}){this.database=o;this.capabilities={transactions:t.transactions===!0,sqlMigrations:!1,jsonQuery:!0}}useSchema(o){this.schema=o,this.documentColumns=new Map(o.tables.filter((t)=>t.documentColumn!==void 0).map((t)=>[t.name,t.documentColumn])),this.columnNames=new Map(o.tables.map((t)=>[t.name,new Set(t.columns.map((i)=>i.name))]))}async introspect(){let o=(await this.database.listCollections().toArray()).map((i)=>i.name).filter((i)=>i!==N).sort(),t=[];for(let i of o){let r=await this.database.collection(i).listIndexes().toArray();t.push({name:i,columns:[],primaryKey:["id"],indexes:r.filter((a)=>a.name!=="_id_").map((a)=>({name:a.name,table:i,targets:Object.keys(a.key).map((c)=>({kind:"column",column:c})),unique:a.unique===!0})).sort((a,c)=>a.name.localeCompare(c.name))})}return{version:1,tables:t,collections:[]}}plan(o,t){return Ae(o,t)}render(o,t){let i=o.map(xe);return{id:t,extension:"json",content:`${JSON.stringify({id:t,summary:i,steps:o},null,2)}
2
+ `,summary:i}}async applyMigration(o){let t=JSON.parse(o.content);for(let i of t.steps)await this.applyStep(i)}async listAppliedMigrations(){return(await this.database.collection(N).find({},{sort:{_id:1}}).toArray()).map((t)=>({id:String(t._id),checksum:String(t.checksum),appliedAt:new Date(String(t.applied_at))}))}async recordMigration(o,t){await this.database.collection(N).insertOne({_id:o,checksum:t,applied_at:new Date().toISOString()})}async transaction(o){return o(new b(x(),this.capabilities.transactions))}async query(o,t){let i=this.database.collection(t.table),r=this.filter(t.table,t.where);if(t.count===!0)return[{count:await i.countDocuments(r)}];let a={};if(t.orderBy&&t.orderBy.length>0)a.sort=Object.fromEntries(t.orderBy.map((s)=>[this.path(t.table,s.path),s.direction==="desc"?-1:1]));if(t.limit!==void 0)a.limit=t.limit;if(t.offset!==void 0)a.skip=t.offset;return(await i.find(r,a).toArray()).map((s)=>this.decode(t.table,s,t.select,t.table))}async mutate(o,t){let i=this.database.collection(t.table);if(t.kind==="insert"){let s=this.encode(t.values);return await i.insertOne(s),{rows:t.returning===!1?[]:[this.decode(t.table,s)],count:1}}if(t.kind==="update"){let s=this.filter(t.table,t.where),l=this.encode(t.set),u=t.returning===!1?[]:await i.find(s,{projection:{_id:1}}).toArray(),m=await i.updateMany(s,{$set:l}),p=m.modifiedCount??m.matchedCount??0;if(t.returning===!1)return{rows:[],count:p};let g=u.length===0?[]:await i.find({_id:{$in:u.map((d)=>d._id)}}).toArray();return{rows:g.map((d)=>this.decode(t.table,d)),count:Math.max(p,g.length)}}let r=this.filter(t.table,t.where),a=t.returning===!0?await i.find(r).toArray():[],c=await i.deleteMany(r);return{rows:a.map((s)=>this.decode(t.table,s)),count:c.deletedCount??a.length}}async applyStep(o){switch(o.kind){case"create_table":{if(!(await this.database.listCollections().toArray()).map((i)=>i.name).includes(o.table.name))await this.database.createCollection(o.table.name);return}case"drop_table":await this.database.dropCollection(o.table).catch(()=>{return});return;case"add_column":{if(o.column.default===void 0)return;await this.database.collection(o.table).updateMany({[o.column.name]:{$exists:!1}},{$set:{[o.column.name]:o.column.default}});return}case"drop_column":await this.database.collection(o.table).updateMany({},{$unset:{[o.column]:""}});return;case"alter_column":return;case"create_index":{let t={};for(let i of o.index.targets)t[i.kind==="column"?i.column:[i.column,...i.path].join(".")]=1;await this.database.collection(o.index.table).createIndex(t,{name:o.index.name,unique:o.index.unique,...o.index.where?{partialFilterExpression:{[o.index.where.column]:o.index.where.equals}}:{}});return}case"drop_index":await this.database.collection(o.table).dropIndex(o.index).catch(()=>{return});return;case"set_document_field":{let t=[o.documentColumn,...o.path].join(".");await this.database.collection(o.table).updateMany({collection:o.collection,[t]:{$exists:!1}},{$set:{[t]:o.value}});return}case"unset_document_field":{let t=[o.documentColumn,...o.path].join(".");await this.database.collection(o.table).updateMany({collection:o.collection},{$unset:{[t]:""}});return}}}filter(o,t){if(!t)return{};if(t.kind==="and"){if(t.conditions.length===0)return{};return{$and:t.conditions.map((c)=>this.filter(o,c))}}if(t.kind==="or"){if(t.conditions.length===0)return{_id:{$exists:!1}};return{$or:t.conditions.map((c)=>this.filter(o,c))}}if(t.kind==="not")return{$nor:[this.filter(o,t.condition)]};let i=this.path(o,t.path),r=this.documentColumns.get(o),a=r!==void 0&&i.startsWith(`${r}.`)?w(t.value):t.value;return{[i]:this.condition(t.operator,a)}}condition(o,t){switch(o){case"eq":return{$eq:t};case"ne":return{$ne:t};case"gt":return{$gt:t};case"gte":return{$gte:t};case"lt":return{$lt:t};case"lte":return{$lte:t};case"in":return{$in:Array.isArray(t)?t:[t]};case"nin":return{$nin:Array.isArray(t)?t:[t]};case"like":case"ilike":return{$regex:y(String(t)),...o==="ilike"?{$options:"i"}:{}};case"contains":return{$eq:t};case"exists":return t===!1?{$in:[null]}:{$nin:[null]}}}path(o,t){let[i,...r]=t.split("."),a=i;if(this.columnNames.get(o)?.has(a))return[a==="id"?"_id":a,...r].join(".");let c=this.documentColumns.get(o);if(!c)throw new e(`Unknown column ${o}.${t}`,{status:400,code:"unknown_column"});return[c,...t.split(".")].join(".")}encode(o){let t={};for(let[i,r]of Object.entries(o))t[i==="id"?"_id":i]=r;return t}decode(o,t,i,r){let a={};for(let[s,l]of Object.entries(t))a[s==="_id"?"id":s]=l;if(!i||i.length===0||r===void 0)return a;let c={};for(let s of i){let l=this.path(r,s).replace(/^_id\b/,"id");c[s]=M(a,l.split("."))}return c}}function M(o,t){let i=o;for(let r of t){if(i===null||typeof i!=="object")return null;i=i[r]}return i??null}function w(o){if(o instanceof Date)return o.toISOString();return Array.isArray(o)?o.map((t)=>t instanceof Date?t.toISOString():t):o}function y(o){return`^${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replaceAll("%",".*").replaceAll("_",".")}$`}var f=0;function x(){return f+=1,`mongo_tx_${f}`}function k(o,t={}){if(typeof o==="string")return async()=>k(await C(o,t),t);return new h(o,t)}async function C(o,t){let r;try{r=await import("mongodb")}catch{throw new n("database",'mongodb(url) needs the "mongodb" package; install it, or pass a Db you built yourself')}let a=new r.MongoClient(o);return await a.connect(),t.database?a.db(t.database):a.db()}export{h as MongoDatabaseAdapter,k as mongodb};
@@ -0,0 +1,37 @@
1
+ import type { DatabaseAdapter, DatabaseAdapterFactory } from "../types/database";
2
+ /**
3
+ * The shape `pg`, Neon, Supabase and PGlite all already have.
4
+ *
5
+ * No driver is bundled: the dependency belongs to the application, which knows
6
+ * whether it is deploying to a Node server with a pool, a serverless function
7
+ * with an HTTP driver, or a test with Postgres compiled to WebAssembly.
8
+ */
9
+ export interface PostgresClient {
10
+ query<T extends Record<string, unknown> = Record<string, unknown>>(text: string, values?: unknown[]): Promise<{
11
+ rows: T[];
12
+ rowCount?: number | null;
13
+ }>;
14
+ /** Pools expose this; a single connection does not. */
15
+ connect?(): Promise<PostgresConnection>;
16
+ end?(): Promise<void>;
17
+ }
18
+ export interface PostgresConnection extends PostgresClient {
19
+ release?(): void;
20
+ }
21
+ export interface PostgresOptions {
22
+ /** Overrides the adapter id reported by `cms.inspect()`. */
23
+ id?: string;
24
+ }
25
+ /**
26
+ * Creates the Postgres adapter.
27
+ *
28
+ * A connection string is accepted as well as a client, because
29
+ * `postgres(env.DATABASE_URL)` is what a developer wants to write. It returns
30
+ * a factory in that case: the pool is built on first use, so a module that is
31
+ * merely imported — by the CLI, by a page that never queries — does not open
32
+ * a connection, and a missing secret surfaces as a request error rather than
33
+ * an unhandled module error.
34
+ */
35
+ export declare function postgres(url: string, options?: PostgresOptions): DatabaseAdapterFactory;
36
+ export declare function postgres(client: PostgresClient, options?: PostgresOptions): DatabaseAdapter;
37
+ //# sourceMappingURL=postgres.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/db/postgres.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAK3B;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,OAAO,EAAE,GACjB,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACpD,uDAAuD;IACvD,OAAO,CAAC,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AA6CD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,sBAAsB,CAAC;AACzF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ import{re,Nn}from"../index-b2ecggck.js";import{n}from"../index-x72d1hzh.js";class a{client;id;constructor(t,e="postgres"){this.client=t;this.id=e}async all(t,e){return(await this.client.query(t,e)).rows}async run(t,e){return{rowsAffected:(await this.client.query(t,e)).rowCount??0}}async exec(t){await this.client.query(t)}async close(){await this.client.end?.()}}function u(t,e={}){if(typeof t==="string")return async()=>u(await g(t),e);let r=t,o=new a(r,e.id??"postgres");if(r.connect){let l=r.connect.bind(r);o.transaction=async(p)=>{let c=await l(),s=new a(c,o.id);try{await s.exec("BEGIN");let i=await p(s);return await s.exec("COMMIT"),i}catch(i){throw await s.exec("ROLLBACK").catch(()=>{return}),i}finally{c.release?.()}}}return new re(o,Nn)}async function g(t){let r;try{r=await import("pg")}catch{throw new n("database",'postgres(url) needs the "pg" package; install it, or pass a client you built yourself')}return new r.Pool({connectionString:t})}export{u as postgres};