dineway 0.1.45 → 0.1.47

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 (387) hide show
  1. package/dist/{activity-events-CpcTzKpF.mjs → activity-events-CNk3clTT.mjs} +1 -1
  2. package/dist/{allowed-origins-3RuuoFjC.mjs → allowed-origins-QirBXiDj.mjs} +1 -1
  3. package/dist/api/route-utils.d.mts +9 -10
  4. package/dist/api/route-utils.mjs +13 -13
  5. package/dist/api/schemas/index.d.mts +2 -2
  6. package/dist/api/schemas/index.mjs +4 -4
  7. package/dist/{api-DkFSCD74.mjs → api-ePsOhL3q.mjs} +101 -56
  8. package/dist/{api-tokens-BFg7tiOQ.mjs → api-tokens-DtvdtIkm.mjs} +1 -1
  9. package/dist/{apply-TIoQ00aH.mjs → apply-BpRBCqUt.mjs} +76 -31
  10. package/dist/astro/index.d.mts +10 -11
  11. package/dist/astro/index.mjs +23 -3
  12. package/dist/astro/middleware/auth.d.mts +9 -10
  13. package/dist/astro/middleware/auth.mjs +5 -5
  14. package/dist/astro/middleware/redirect.mjs +13 -7
  15. package/dist/astro/middleware/request-context.mjs +3 -3
  16. package/dist/astro/middleware/seed.d.mts +1 -1
  17. package/dist/astro/middleware/seed.mjs +2 -2
  18. package/dist/astro/middleware/setup.mjs +1 -1
  19. package/dist/astro/middleware.mjs +120 -82
  20. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  21. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  22. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  23. package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
  24. package/dist/astro/routes/api/admin/briefing.mjs +17 -17
  25. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +7 -0
  26. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +17 -0
  27. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +9 -0
  28. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +38 -0
  29. package/dist/astro/routes/api/admin/byline-fields/index.d.mts +8 -0
  30. package/dist/astro/routes/api/admin/byline-fields/index.mjs +31 -0
  31. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +7 -0
  32. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +24 -0
  33. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +27 -27
  34. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +8 -0
  35. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +57 -0
  36. package/dist/astro/routes/api/admin/bylines/index.mjs +30 -26
  37. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
  38. package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
  39. package/dist/astro/routes/api/admin/comments/bulk.mjs +9 -9
  40. package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
  41. package/dist/astro/routes/api/admin/comments/index.mjs +9 -9
  42. package/dist/astro/routes/api/admin/context/_id_/history.mjs +23 -23
  43. package/dist/astro/routes/api/admin/context/_id_/index.mjs +23 -23
  44. package/dist/astro/routes/api/admin/context/_id_/review.mjs +27 -27
  45. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +27 -27
  46. package/dist/astro/routes/api/admin/context/diff.mjs +26 -26
  47. package/dist/astro/routes/api/admin/context/index.mjs +27 -27
  48. package/dist/astro/routes/api/admin/context/stale.mjs +26 -26
  49. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +23 -23
  50. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +26 -26
  51. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +26 -26
  52. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +24 -24
  53. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
  54. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
  55. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
  56. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +48 -44
  57. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +48 -44
  58. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +42 -38
  59. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +47 -43
  60. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +47 -43
  61. package/dist/astro/routes/api/admin/plugins/index.mjs +42 -38
  62. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  63. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +42 -38
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +47 -43
  65. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +42 -38
  66. package/dist/astro/routes/api/admin/plugins/updates.mjs +42 -38
  67. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +5 -5
  68. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +26 -26
  69. package/dist/astro/routes/api/admin/review-requests/index.mjs +9 -9
  70. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +42 -38
  71. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  72. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +42 -38
  73. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  74. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  75. package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
  76. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
  77. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  78. package/dist/astro/routes/api/auth/dev-bypass.mjs +5 -5
  79. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  80. package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
  81. package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
  82. package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
  83. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  84. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  85. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  86. package/dist/astro/routes/api/auth/me.mjs +20 -11
  87. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  88. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
  89. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  90. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  91. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  92. package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
  93. package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
  94. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
  95. package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
  96. package/dist/astro/routes/api/auth/setup-token/index.mjs +5 -5
  97. package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
  98. package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
  99. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  100. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  101. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +12 -12
  102. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  103. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +5 -5
  104. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +5 -5
  105. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +5 -5
  106. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +11 -11
  107. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +9 -9
  108. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +5 -5
  109. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  110. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +9 -9
  111. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +20 -14
  112. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  113. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +5 -5
  114. package/dist/astro/routes/api/content/_collection_/_id_.mjs +12 -10
  115. package/dist/astro/routes/api/content/_collection_/index.mjs +9 -9
  116. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  117. package/dist/astro/routes/api/dashboard.mjs +8 -8
  118. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  119. package/dist/astro/routes/api/health.mjs +1 -1
  120. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  121. package/dist/astro/routes/api/import/probe.mjs +10 -10
  122. package/dist/astro/routes/api/import/wordpress/analyze.mjs +7 -7
  123. package/dist/astro/routes/api/import/wordpress/execute.mjs +29 -28
  124. package/dist/astro/routes/api/import/wordpress/media.mjs +10 -10
  125. package/dist/astro/routes/api/import/wordpress/prepare.mjs +31 -31
  126. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +5 -1
  127. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +16 -1
  128. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +30 -30
  129. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  130. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +13 -13
  131. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  132. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +31 -30
  133. package/dist/astro/routes/api/manifest.mjs +4 -4
  134. package/dist/astro/routes/api/mcp.mjs +75 -50
  135. package/dist/astro/routes/api/media/_id_/confirm.mjs +8 -8
  136. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  137. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  138. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  139. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  140. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  141. package/dist/astro/routes/api/media/upload-url.mjs +10 -10
  142. package/dist/astro/routes/api/media.mjs +14 -13
  143. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +27 -27
  144. package/dist/astro/routes/api/menus/_name_/items.mjs +27 -27
  145. package/dist/astro/routes/api/menus/_name_/reorder.mjs +27 -27
  146. package/dist/astro/routes/api/menus/_name_/translations.mjs +27 -27
  147. package/dist/astro/routes/api/menus/_name_.mjs +27 -27
  148. package/dist/astro/routes/api/menus/index.mjs +27 -27
  149. package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
  150. package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
  151. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  152. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  153. package/dist/astro/routes/api/oauth/register.mjs +4 -4
  154. package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
  155. package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
  156. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  157. package/dist/astro/routes/api/openapi.json.mjs +10 -7
  158. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  159. package/dist/astro/routes/api/redirects/404s/index.mjs +10 -10
  160. package/dist/astro/routes/api/redirects/404s/summary.mjs +10 -10
  161. package/dist/astro/routes/api/redirects/_id_.mjs +28 -28
  162. package/dist/astro/routes/api/redirects/index.mjs +28 -28
  163. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  164. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  165. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +43 -39
  166. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +43 -39
  167. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +43 -39
  168. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +43 -39
  169. package/dist/astro/routes/api/schema/collections/index.mjs +43 -39
  170. package/dist/astro/routes/api/schema/index.mjs +7 -7
  171. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +42 -38
  172. package/dist/astro/routes/api/schema/orphans/index.mjs +42 -38
  173. package/dist/astro/routes/api/search/enable.mjs +11 -11
  174. package/dist/astro/routes/api/search/index.mjs +10 -10
  175. package/dist/astro/routes/api/search/rebuild.mjs +11 -11
  176. package/dist/astro/routes/api/search/stats.mjs +7 -7
  177. package/dist/astro/routes/api/search/suggest.mjs +10 -10
  178. package/dist/astro/routes/api/sections/_slug_.mjs +27 -27
  179. package/dist/astro/routes/api/sections/index.mjs +27 -27
  180. package/dist/astro/routes/api/settings/email.mjs +3 -3
  181. package/dist/astro/routes/api/settings.mjs +27 -27
  182. package/dist/astro/routes/api/setup/admin-verify.mjs +11 -11
  183. package/dist/astro/routes/api/setup/admin.mjs +9 -9
  184. package/dist/astro/routes/api/setup/dev-bypass.mjs +24 -23
  185. package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
  186. package/dist/astro/routes/api/setup/index.mjs +25 -24
  187. package/dist/astro/routes/api/setup/status.mjs +3 -3
  188. package/dist/astro/routes/api/snapshot.mjs +7 -6
  189. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +30 -29
  190. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +30 -29
  191. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +30 -29
  192. package/dist/astro/routes/api/taxonomies/index.mjs +30 -29
  193. package/dist/astro/routes/api/themes/preview.mjs +4 -4
  194. package/dist/astro/routes/api/typegen.mjs +4 -4
  195. package/dist/astro/routes/api/well-known/auth.mjs +2 -2
  196. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
  197. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
  198. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +26 -26
  199. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +27 -27
  200. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +27 -27
  201. package/dist/astro/routes/api/widget-areas/_name_.mjs +25 -25
  202. package/dist/astro/routes/api/widget-areas/index.mjs +27 -27
  203. package/dist/astro/routes/api/widget-components.mjs +2 -2
  204. package/dist/astro/routes/robots.txt.mjs +7 -7
  205. package/dist/astro/routes/sitemap-_collection_.xml.mjs +59 -15
  206. package/dist/astro/routes/sitemap.xml.mjs +8 -8
  207. package/dist/astro/session-driver.d.mts +1 -1
  208. package/dist/astro/session-driver.mjs +3 -3
  209. package/dist/astro/types.d.mts +16 -14
  210. package/dist/{audit-NgiRzqP9.mjs → audit-DuRbTm8L.mjs} +1 -1
  211. package/dist/auth/providers/github.d.mts +1 -1
  212. package/dist/auth/providers/google.d.mts +1 -1
  213. package/dist/{auth-control-guard-1FHtkDP6.mjs → auth-control-guard-Dr14I98m.mjs} +1 -1
  214. package/dist/{authorize-BbIhZi3a.mjs → authorize-BLO0m7fW.mjs} +1 -1
  215. package/dist/{briefing-Jsxs587i.mjs → briefing-BFEWeJtR.mjs} +6 -6
  216. package/dist/{briefing-DD82WaEy.mjs → briefing-C4fJSVYW.mjs} +1 -1
  217. package/dist/byline-CXQcMsBu.mjs +628 -0
  218. package/dist/{bylines-BU6b8jSi.d.mts → byline-fields-Cuo-JI3B.d.mts} +150 -19
  219. package/dist/{import-Br7aP9yh.mjs → byline-fields-D7TJ_oHF.mjs} +57 -3
  220. package/dist/byline-fields-Dc7L6Yry.mjs +113 -0
  221. package/dist/byline-registry-CL8BxPPp.mjs +287 -0
  222. package/dist/bylines-BgriNlW7.mjs +165 -0
  223. package/dist/bylines-D2vqm1aZ.mjs +163 -0
  224. package/dist/{cache-DQyZ-QaB.mjs → cache-GRK71jOU.mjs} +2 -2
  225. package/dist/{chunks-D8KL0nCY.mjs → chunks-DgEw12Bc.mjs} +1 -1
  226. package/dist/cli/index.mjs +993 -90
  227. package/dist/client/external-auth-headers.d.mts +1 -1
  228. package/dist/client/index.d.mts +2 -1
  229. package/dist/client/index.mjs +5 -2
  230. package/dist/{comment-BmJXz3lc.mjs → comment-ogMaF1gk.mjs} +1 -1
  231. package/dist/{comments-yTbeIYc2.mjs → comments-CTSOKrZq.mjs} +1 -1
  232. package/dist/{connection-BCNICDWN.mjs → connection-CiJWiWya.mjs} +44 -13
  233. package/dist/{content-DvpMad_N.mjs → content-BfyjOiMi.mjs} +24 -4
  234. package/dist/content-index-names-Bbu1FY1r.mjs +26 -0
  235. package/dist/{context-DgqEfcWz.mjs → context-CdsYb1m8.mjs} +2 -2
  236. package/dist/{context-Ufrm1lOv.mjs → context-ZMHhwzkG.mjs} +8 -8
  237. package/dist/{context-route-helpers-Dq5U_AXp.mjs → context-route-helpers-YLWx2N1j.mjs} +1 -1
  238. package/dist/{dashboard-BC9bgPOH.mjs → dashboard-D0gWuzNp.mjs} +4 -4
  239. package/dist/db/index.d.mts +3 -3
  240. package/dist/db/index.mjs +2 -2
  241. package/dist/db/libsql.d.mts +1 -1
  242. package/dist/db/libsql.mjs +1 -1
  243. package/dist/db/postgres.d.mts +1 -1
  244. package/dist/db/sqlite.d.mts +1 -1
  245. package/dist/db/sqlite.mjs +1 -1
  246. package/dist/{device-flow-CTS91g4A.mjs → device-flow-B3_FEoMI.mjs} +4 -4
  247. package/dist/{dialect-helpers-TkdbkFad.mjs → dialect-helpers-fk43GbDb.mjs} +13 -3
  248. package/dist/{fts-manager-DnfOsF4s.mjs → fts-manager-EHY2Kes9.mjs} +2 -2
  249. package/dist/{hitl-requests-DaRuZ7tb.mjs → hitl-requests-B1Zqgut6.mjs} +2 -2
  250. package/dist/{hitl-route-helpers-DcPySbZ3.mjs → hitl-route-helpers-CjpWUMuw.mjs} +4 -4
  251. package/dist/{import-DSXK3aQF.mjs → import-CvHY6sf5.mjs} +3 -3
  252. package/dist/{index-BwOO3vu2.d.mts → index-DJVaYiUV.d.mts} +2 -2
  253. package/dist/index.d.mts +16 -17
  254. package/dist/index.mjs +69 -65
  255. package/dist/{jsonld-CLbYsYYH.d.mts → jsonld-AcPnCEGD.d.mts} +2 -2
  256. package/dist/{load-BCCcmoW9.mjs → load-BdbvtoDb.mjs} +1 -1
  257. package/dist/{loader-p2imNN98.mjs → loader-Y0QvC_QO.mjs} +167 -61
  258. package/dist/media/index.d.mts +1 -2
  259. package/dist/media/index.mjs +2 -2
  260. package/dist/media/local-runtime.d.mts +11 -12
  261. package/dist/media/local-runtime.mjs +2 -2
  262. package/dist/{media-Cg4zc9fq.mjs → media-DhBwiCYR.mjs} +6 -1
  263. package/dist/{media-allowlist-D8gsm8_t.mjs → media-allowlist-BsXkT9RK.mjs} +1 -1
  264. package/dist/{menus-DOaL6NaF.mjs → menus-BzGQpw9d.mjs} +2 -2
  265. package/dist/{menus-DzG3-9tQ.mjs → menus-fqqzXyHd.mjs} +5 -5
  266. package/dist/{oauth-authorization-DyOFXQWq.mjs → oauth-authorization-DsF81vki.mjs} +4 -4
  267. package/dist/{oauth-clients-BMs_bmoz.mjs → oauth-clients-Du-V0fEm.mjs} +2 -2
  268. package/dist/page/index.d.mts +2 -2
  269. package/dist/page/index.mjs +1 -1
  270. package/dist/{parse-D7Tu6ku4.mjs → parse-CneSgl7-.mjs} +1 -1
  271. package/dist/{types-cn-fvYQ1.d.mts → placeholder-CXfoCtCd.d.mts} +38 -1
  272. package/dist/plugin-utils.d.mts +22 -10
  273. package/dist/plugin-utils.mjs +8 -10
  274. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -10
  275. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  276. package/dist/{plugins-DCDVDF4B.mjs → plugins-BQ5Joz6v.mjs} +36 -6
  277. package/dist/{preview-BhgxNRWI.mjs → preview-D5rvDhRt.mjs} +7 -7
  278. package/dist/{provider-loader-B19YyyBp.d.mts → provider-loader-B5PMjpN7.d.mts} +1 -1
  279. package/dist/{query-BnRpB09I.mjs → query-BJuUydtD.mjs} +3 -3
  280. package/dist/{query-DHvNhBhi.mjs → query-CSx0EdSW.mjs} +30 -18
  281. package/dist/{rate-limit-BWP_kKiZ.mjs → rate-limit-i0G3IAOX.mjs} +2 -2
  282. package/dist/{redirect-BaVvo2te.mjs → redirect-BqFMj67n.mjs} +20 -6
  283. package/dist/{redirects-Ba-lJA5j.mjs → redirects-CJwHl_YG.mjs} +3 -3
  284. package/dist/{redirects-x5ol_Qj9.mjs → redirects-q_cToaHv.mjs} +29 -8
  285. package/dist/{registry-i__XP2WV.mjs → registry-Cq3QRBW2.mjs} +14 -5
  286. package/dist/{request-cache-BpwuE2ix.mjs → request-cache-w5cj5itT.mjs} +9 -1
  287. package/dist/{request-meta-DUGfAeXy.mjs → request-meta-DAb6xaP9.mjs} +1 -1
  288. package/dist/resolve-DTuDyYKs.mjs +100 -0
  289. package/dist/{review-requests-DuIxM4YM.mjs → review-requests-GYqjl2jO.mjs} +1 -1
  290. package/dist/{review-requests-CTUU_RJm.mjs → review-requests-tPw8_pAO.mjs} +1 -1
  291. package/dist/{runner-FhUNNaqA.d.mts → runner-Cnz4dl0f.d.mts} +1 -1
  292. package/dist/{runner-DF2DgD_B.mjs → runner-DTfG5v0G.mjs} +574 -196
  293. package/dist/{runtime-1bE80cmL.d.mts → runtime-Cd-kjPfN.d.mts} +1155 -273
  294. package/dist/runtime.d.mts +10 -11
  295. package/dist/runtime.mjs +4 -4
  296. package/dist/schema-DmHMWnSA.mjs +8 -0
  297. package/dist/{search-Cl9preJT.mjs → search-BAiFLz81.mjs} +3 -3
  298. package/dist/{sections-Zx-2q9IH.mjs → sections-DsuIrFDC.mjs} +2 -2
  299. package/dist/seed/index.d.mts +2 -2
  300. package/dist/seed/index.mjs +18 -17
  301. package/dist/seo/index.d.mts +1 -1
  302. package/dist/seo/index.mjs +1 -0
  303. package/dist/{seo-CJBiMDkj.mjs → seo-5lJOtB5J.mjs} +4 -2
  304. package/dist/{seo-BPb_reaG.mjs → seo-uMFBaR8G.mjs} +1 -1
  305. package/dist/{service-wPGgmbUa.mjs → service-CifrxCru.mjs} +2 -2
  306. package/dist/{settings-nr15a8uv.mjs → settings-BYGdocdj.mjs} +2 -2
  307. package/dist/{settings-DORe02PC.mjs → settings-DNRQuX3d.mjs} +3 -3
  308. package/dist/{site-activity-KFZprBZM.mjs → site-activity-6x1JccoR.mjs} +1 -1
  309. package/dist/{site-context-DuBQk6Mp.mjs → site-context-c1ZFa_OF.mjs} +13 -13
  310. package/dist/storage/local.d.mts +1 -1
  311. package/dist/storage/local.mjs +1 -1
  312. package/dist/storage/s3.d.mts +1 -1
  313. package/dist/storage/s3.mjs +1 -1
  314. package/dist/{taxonomies-DGaw_-aU.mjs → taxonomies-CQFmkP5u.mjs} +3 -3
  315. package/dist/{taxonomies-BVBKoXRf.mjs → taxonomies-faQVeMgj.mjs} +7 -32
  316. package/dist/{taxonomy-BvXRL85P.mjs → taxonomy-BnH-6VsX.mjs} +2 -2
  317. package/dist/{types-DvwHUku7.d.mts → types-B7_vSiPD.d.mts} +16 -0
  318. package/dist/{types-D1DjBFA9.mjs → types-Ck7-WoUD.mjs} +1 -1
  319. package/dist/{types-t7_nCCA9.d.mts → types-DEAQG87T.d.mts} +2 -56
  320. package/dist/{types-C-CMfzSl.d.mts → types-DYKtk8f1.d.mts} +31 -0
  321. package/dist/{types-C3Em8xpG.mjs → types-DbZhHtqS.mjs} +23 -1
  322. package/dist/{types-BIM7jwxr.d.mts → types-UGmU5sWx.d.mts} +1 -1
  323. package/dist/types-nP9vGUFq.d.mts +56 -0
  324. package/dist/ui/server-runtime.d.mts +13 -7
  325. package/dist/ui/server-runtime.mjs +18 -17
  326. package/dist/{user-2aI21yV1.mjs → user-CqZwN21P.mjs} +1 -1
  327. package/dist/{validate-CvQ6cvHH.d.mts → validate-BJuG-ISL.d.mts} +21 -3
  328. package/dist/{validate-JE-WfUQ5.mjs → validate-CK4a1sIF.mjs} +22 -2
  329. package/dist/version-Cb1tZ6s_.mjs +6 -0
  330. package/dist/{widgets-Cj6ULpED.mjs → widgets-CdDvF4fV.mjs} +2 -2
  331. package/dist/{wordpress-slugs-hqItqJrQ.mjs → wordpress-slugs-B6Gw9q3Q.mjs} +1 -1
  332. package/dist/{zod-generator-C4BgFBZV.mjs → zod-generator-D1ROBNuC.mjs} +2 -2
  333. package/package.json +7 -8
  334. package/src/components/InlinePortableTextEditor.tsx +66 -0
  335. package/src/components/code-block-languages.ts +76 -0
  336. package/src/components/inline-code-block.tsx +241 -0
  337. package/dist/byline-DpNNSjET.mjs +0 -219
  338. package/dist/bylines-75_STR73.mjs +0 -114
  339. package/dist/chunk-ClPoSABd.mjs +0 -21
  340. package/dist/db-errors-DHJCB_gY.mjs +0 -23
  341. package/dist/index-Ct0pjZwW.d.mts +0 -835
  342. package/dist/placeholder-BZpCpid_.d.mts +0 -40
  343. package/dist/schema-U-SeFWwn.mjs +0 -8
  344. package/dist/version-DTpFm69w.mjs +0 -6
  345. /package/dist/{adapters-kZjS7plb.d.mts → adapters-OQCImOL7.d.mts} +0 -0
  346. /package/dist/{api-tokens-L0o9Bd7v.mjs → api-tokens-CYUoFGo7.mjs} +0 -0
  347. /package/dist/{challenge-store-cJam-E5R.mjs → challenge-store-DFxX0_15.mjs} +0 -0
  348. /package/dist/{components-BJfa-F6n.mjs → components--pg6zBvu.mjs} +0 -0
  349. /package/dist/{config-XW5tMrH8.mjs → config-CVssduLe.mjs} +0 -0
  350. /package/dist/{context-types-BrSQNye5.mjs → context-types-DQh_XKkn.mjs} +0 -0
  351. /package/dist/{cron-D7FDsRu-.mjs → cron-DxCAU_Sn.mjs} +0 -0
  352. /package/dist/{default-5A3XVR7L.mjs → default-BHauvIdG.mjs} +0 -0
  353. /package/dist/{email-console-Bs1qKx59.mjs → email-console-BOVqIYpB.mjs} +0 -0
  354. /package/dist/{error-DLkgOP5m.mjs → error-DCSuUAZW.mjs} +0 -0
  355. /package/dist/{escape-r8_GbEU2.mjs → escape-BDgouFFY.mjs} +0 -0
  356. /package/dist/{experimental-workflows-BbZbIEZp.mjs → experimental-workflows-CSMffP6q.mjs} +0 -0
  357. /package/dist/{hash-DFFrkivP.mjs → hash-BPmX6P8I.mjs} +0 -0
  358. /package/dist/{manifest-schema-C6fzQoWn.mjs → manifest-schema-qh2P7RDX.mjs} +0 -0
  359. /package/dist/{mime-DYP4V5Ks.mjs → mime-8pAB8-77.mjs} +0 -0
  360. /package/dist/{mode-Bd55iLcP.mjs → mode-CZqCF9dZ.mjs} +0 -0
  361. /package/dist/{normalize-BY_EJnd9.mjs → normalize-O-hi3a27.mjs} +0 -0
  362. /package/dist/{oauth-state-store-BRSUEkmx.mjs → oauth-state-store-qncPB_IU.mjs} +0 -0
  363. /package/dist/{oauth-user-lookup-DdcI8ZVL.mjs → oauth-user-lookup-BFjWF8wK.mjs} +0 -0
  364. /package/dist/{parser-egIGEco-.mjs → parser-DxfsARXL.mjs} +0 -0
  365. /package/dist/{passkey-config-AX4sjpQ4.mjs → passkey-config-DzHQK90v.mjs} +0 -0
  366. /package/dist/{patterns-CiyXeDgr.mjs → patterns-D9iDO3j8.mjs} +0 -0
  367. /package/dist/{placeholder-b0Ufu0La.mjs → placeholder-BDo81Is5.mjs} +0 -0
  368. /package/dist/{provider-loader-BdRV01gr.mjs → provider-loader-DzUxejk7.mjs} +0 -0
  369. /package/dist/{public-url-BL2r8dmQ.mjs → public-url-DLUM5OOv.mjs} +0 -0
  370. /package/dist/{redirect-Ce_6Yb6z.mjs → redirect-BjIBtDWY.mjs} +0 -0
  371. /package/dist/{secrets-DfeNNoLa.mjs → secrets-CPoFLJjm.mjs} +0 -0
  372. /package/dist/{seo-contributions-C0LXoWw3.mjs → seo-contributions-CqVvReEj.mjs} +0 -0
  373. /package/dist/{setup-complete-C2ztsNhJ.mjs → setup-complete-4EiBS1E5.mjs} +0 -0
  374. /package/dist/{setup-nonce-BTKq7uBi.mjs → setup-nonce-pyGfc9hV.mjs} +0 -0
  375. /package/dist/{sidecar-client-lrf7ErYJ.mjs → sidecar-client-mJxwayYN.mjs} +0 -0
  376. /package/dist/{site-url-C18yBhtv.mjs → site-url-C-cu8Ff2.mjs} +0 -0
  377. /package/dist/{ssrf-KAIQS48_.mjs → ssrf-DiKqWd3N.mjs} +0 -0
  378. /package/dist/{tokens-CsP8Se8S.mjs → tokens-CjSgb0AC.mjs} +0 -0
  379. /package/dist/{transport-nNEGdHkI.d.mts → transport-DidKKxvW.d.mts} +0 -0
  380. /package/dist/{transport-B7kO-4ee.mjs → transport-LSdZVXHF.mjs} +0 -0
  381. /package/dist/{trusted-proxy-Bbm6PLR6.mjs → trusted-proxy-BgIIcbsN.mjs} +0 -0
  382. /package/dist/{types-CNNQ8l0v.mjs → types-Cg276-3z.mjs} +0 -0
  383. /package/dist/{types-BYjPylrZ.d.mts → types-DZpT-PnG.d.mts} +0 -0
  384. /package/dist/{types-BgE6gMFI.d.mts → types-Dryvv7LH.d.mts} +0 -0
  385. /package/dist/{types-BBETcziA.d.mts → types-GaCtZ1k9.d.mts} +0 -0
  386. /package/dist/{url-BzhfYtRn.mjs → url-w7Mp5qAD.mjs} +0 -0
  387. /package/dist/{utils-FEbQMgB5.mjs → utils-wv-zvC-Y.mjs} +0 -0
@@ -0,0 +1,287 @@
1
+ import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
2
+ import { t as withTransaction } from "./transaction-D0FOsb3X.mjs";
3
+ import { i as RESERVED_BYLINE_FIELD_SLUGS, t as BYLINE_FIELD_TYPES } from "./types-DbZhHtqS.mjs";
4
+ import { sql } from "kysely";
5
+ import { ulid } from "ulidx";
6
+
7
+ //#region src/schema/byline-registry.ts
8
+ const VERSION_KEY = "byline_fields_version";
9
+ const MAX_SELECT_OPTIONS = 200;
10
+ const MAX_SLUG_LENGTH = 63;
11
+ const MAX_LABEL_LENGTH = 200;
12
+ const RESERVED_SET = new Set(RESERVED_BYLINE_FIELD_SLUGS);
13
+ const TYPE_SET = new Set(BYLINE_FIELD_TYPES);
14
+ var BylineSchemaError = class extends Error {
15
+ constructor(message, code, details) {
16
+ super(message);
17
+ this.code = code;
18
+ this.details = details;
19
+ this.name = "BylineSchemaError";
20
+ }
21
+ };
22
+ function mapBylineSchemaError(error) {
23
+ switch (error.code) {
24
+ case "FIELD_NOT_FOUND": return {
25
+ code: "NOT_FOUND",
26
+ message: error.message,
27
+ details: error.details
28
+ };
29
+ case "FIELD_EXISTS":
30
+ case "TRANSLATABLE_LOCKED":
31
+ case "REORDER_MISMATCH":
32
+ case "INVALID_SLUG":
33
+ case "RESERVED_SLUG":
34
+ case "INVALID_TYPE": return {
35
+ code: error.code,
36
+ message: error.message,
37
+ details: error.details
38
+ };
39
+ default: return {
40
+ code: "VALIDATION_ERROR",
41
+ message: error.message,
42
+ details: error.details
43
+ };
44
+ }
45
+ }
46
+ var BylineSchemaRegistry = class {
47
+ constructor(db) {
48
+ this.db = db;
49
+ }
50
+ async listFields() {
51
+ return (await this.db.selectFrom("_dineway_byline_fields").selectAll().orderBy("sort_order", "asc").orderBy("created_at", "asc").execute()).map(mapFieldRow);
52
+ }
53
+ async getField(slug) {
54
+ const row = await this.db.selectFrom("_dineway_byline_fields").selectAll().where("slug", "=", slug).executeTakeFirst();
55
+ return row ? mapFieldRow(row) : null;
56
+ }
57
+ async getFieldById(id) {
58
+ const row = await this.db.selectFrom("_dineway_byline_fields").selectAll().where("id", "=", id).executeTakeFirst();
59
+ return row ? mapFieldRow(row) : null;
60
+ }
61
+ async createField(input) {
62
+ this.validateSlug(input.slug);
63
+ this.validateLabel(input.label);
64
+ this.validateType(input.type);
65
+ const validation = this.normaliseValidation(input.type, input.validation ?? null);
66
+ if (await this.getField(input.slug)) {
67
+ await this.markVersionClean();
68
+ throw new BylineSchemaError(`Byline field "${input.slug}" already exists`, "FIELD_EXISTS", { slug: input.slug });
69
+ }
70
+ const id = ulid();
71
+ const sortOrder = input.sortOrder ?? await this.nextSortOrder();
72
+ await this.markVersionDirty();
73
+ await withTransaction(this.db, async (trx) => {
74
+ await trx.insertInto("_dineway_byline_fields").values({
75
+ id,
76
+ slug: input.slug,
77
+ label: input.label,
78
+ type: input.type,
79
+ required: input.required ? 1 : 0,
80
+ translatable: input.translatable === false ? 0 : 1,
81
+ validation: validation ? JSON.stringify(validation) : null,
82
+ sort_order: sortOrder
83
+ }).execute();
84
+ });
85
+ await this.markVersionClean();
86
+ const created = await this.getFieldById(id);
87
+ if (!created) throw new BylineSchemaError("Failed to load created byline field", "FIELD_NOT_FOUND", { id });
88
+ return created;
89
+ }
90
+ async updateField(slug, input) {
91
+ const field = await this.getField(slug);
92
+ if (!field) {
93
+ await this.markVersionClean();
94
+ throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
95
+ }
96
+ const updates = {};
97
+ if (input.label !== void 0) {
98
+ this.validateLabel(input.label);
99
+ updates.label = input.label;
100
+ }
101
+ if (input.required !== void 0) updates.required = input.required ? 1 : 0;
102
+ if (input.validation !== void 0) {
103
+ const validation = this.normaliseValidation(field.type, input.validation);
104
+ updates.validation = validation ? JSON.stringify(validation) : null;
105
+ }
106
+ if (input.translatable !== void 0 && input.translatable !== field.translatable) {
107
+ const usage = await this.countFieldValues(field.id);
108
+ if (usage > 0) throw new BylineSchemaError(`Cannot change "translatable" on field "${slug}" while ${usage} value row(s) exist`, "TRANSLATABLE_LOCKED", {
109
+ slug,
110
+ valueCount: usage
111
+ });
112
+ updates.translatable = input.translatable ? 1 : 0;
113
+ }
114
+ if (input.sortOrder !== void 0) updates.sort_order = input.sortOrder;
115
+ if (Object.keys(updates).length === 0) {
116
+ await this.markVersionClean();
117
+ return field;
118
+ }
119
+ updates.updated_at = (/* @__PURE__ */ new Date()).toISOString();
120
+ await this.markVersionDirty();
121
+ await withTransaction(this.db, async (trx) => {
122
+ await trx.updateTable("_dineway_byline_fields").set(updates).where("id", "=", field.id).execute();
123
+ });
124
+ await this.markVersionClean();
125
+ const updated = await this.getFieldById(field.id);
126
+ if (!updated) throw new BylineSchemaError("Failed to load updated byline field", "FIELD_NOT_FOUND", { slug });
127
+ return updated;
128
+ }
129
+ async deleteField(slug) {
130
+ const field = await this.getField(slug);
131
+ if (!field) {
132
+ await this.markVersionClean();
133
+ throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
134
+ }
135
+ await this.markVersionDirty();
136
+ await withTransaction(this.db, async (trx) => {
137
+ await trx.deleteFrom("_dineway_byline_field_values").where("field_id", "=", field.id).execute();
138
+ await trx.deleteFrom("_dineway_byline_field_group_values").where("field_id", "=", field.id).execute();
139
+ await trx.deleteFrom("_dineway_byline_fields").where("id", "=", field.id).execute();
140
+ });
141
+ await this.markVersionClean();
142
+ }
143
+ async reorderFields(slugs) {
144
+ if (new Set(slugs).size !== slugs.length) throw new BylineSchemaError("Reorder input contains duplicate slugs", "REORDER_MISMATCH", { slugs });
145
+ const registeredSlugs = (await this.listFields()).map((field) => field.slug).toSorted();
146
+ const inputSlugs = slugs.toSorted();
147
+ if (registeredSlugs.length !== inputSlugs.length || registeredSlugs.some((slug, index) => slug !== inputSlugs[index])) throw new BylineSchemaError("Reorder input does not match the registered byline field set", "REORDER_MISMATCH", {
148
+ registered: registeredSlugs,
149
+ input: inputSlugs
150
+ });
151
+ const now = (/* @__PURE__ */ new Date()).toISOString();
152
+ await this.markVersionDirty();
153
+ await withTransaction(this.db, async (trx) => {
154
+ for (let index = 0; index < slugs.length; index++) {
155
+ const slug = slugs[index];
156
+ if (slug === void 0) continue;
157
+ await trx.updateTable("_dineway_byline_fields").set({
158
+ sort_order: index,
159
+ updated_at: now
160
+ }).where("slug", "=", slug).execute();
161
+ }
162
+ });
163
+ await this.markVersionClean();
164
+ }
165
+ async getFieldUsage(slug) {
166
+ const field = await this.getField(slug);
167
+ if (!field) throw new BylineSchemaError(`Byline field "${slug}" not found`, "FIELD_NOT_FOUND", { slug });
168
+ const translatable = await this.db.selectFrom("_dineway_byline_field_values").select(({ fn }) => [fn.count("field_id").as("count")]).where("field_id", "=", field.id).executeTakeFirst();
169
+ const group = await this.db.selectFrom("_dineway_byline_field_group_values").select(({ fn }) => [fn.count("field_id").as("count")]).where("field_id", "=", field.id).executeTakeFirst();
170
+ const translatableValueCount = Number(translatable?.count ?? 0);
171
+ const groupValueCount = Number(group?.count ?? 0);
172
+ return {
173
+ translatableValueCount,
174
+ groupValueCount,
175
+ totalAffectedRows: translatableValueCount + groupValueCount
176
+ };
177
+ }
178
+ async getVersion() {
179
+ const row = await this.db.selectFrom("options").select("value").where("name", "=", VERSION_KEY).executeTakeFirst();
180
+ if (!row) return 0;
181
+ const parsed = Number.parseInt(row.value, 10);
182
+ return Number.isFinite(parsed) ? parsed : 0;
183
+ }
184
+ async markVersionDirty() {
185
+ await sql`
186
+ INSERT INTO options (name, value)
187
+ VALUES (${VERSION_KEY}, '1')
188
+ ON CONFLICT(name) DO UPDATE SET value = CASE
189
+ WHEN CAST(options.value AS INTEGER) % 2 = 0
190
+ THEN CAST(CAST(options.value AS INTEGER) + 1 AS TEXT)
191
+ ELSE options.value
192
+ END
193
+ `.execute(this.db);
194
+ }
195
+ async markVersionClean() {
196
+ await sql`
197
+ INSERT INTO options (name, value)
198
+ VALUES (${VERSION_KEY}, '2')
199
+ ON CONFLICT(name) DO UPDATE SET value = CASE
200
+ WHEN CAST(options.value AS INTEGER) % 2 = 0
201
+ THEN CAST(CAST(options.value AS INTEGER) + 2 AS TEXT)
202
+ ELSE CAST(CAST(options.value AS INTEGER) + 1 AS TEXT)
203
+ END
204
+ `.execute(this.db);
205
+ }
206
+ async nextSortOrder() {
207
+ const row = await this.db.selectFrom("_dineway_byline_fields").select(({ fn }) => [fn.max("sort_order").as("max")]).executeTakeFirst();
208
+ return row?.max == null ? 0 : row.max + 1;
209
+ }
210
+ async countFieldValues(fieldId) {
211
+ const translatable = await this.db.selectFrom("_dineway_byline_field_values").select(({ fn }) => [fn.count("field_id").as("count")]).where("field_id", "=", fieldId).executeTakeFirst();
212
+ const group = await this.db.selectFrom("_dineway_byline_field_group_values").select(({ fn }) => [fn.count("field_id").as("count")]).where("field_id", "=", fieldId).executeTakeFirst();
213
+ return Number(translatable?.count ?? 0) + Number(group?.count ?? 0);
214
+ }
215
+ validateSlug(slug) {
216
+ if (!slug || typeof slug !== "string") throw new BylineSchemaError("Byline field slug is required", "INVALID_SLUG", { slug });
217
+ if (slug.length > MAX_SLUG_LENGTH) throw new BylineSchemaError(`Byline field slug must be ${MAX_SLUG_LENGTH} characters or less`, "INVALID_SLUG", { slug });
218
+ try {
219
+ validateIdentifier(slug, "byline field slug");
220
+ } catch (error) {
221
+ throw new BylineSchemaError(error instanceof Error ? error.message : "Invalid byline field slug", "INVALID_SLUG", { slug });
222
+ }
223
+ if (RESERVED_SET.has(slug)) throw new BylineSchemaError(`Byline field slug "${slug}" is reserved`, "RESERVED_SLUG", { slug });
224
+ }
225
+ validateLabel(label) {
226
+ if (!label || typeof label !== "string") throw new BylineSchemaError("Byline field label is required", "INVALID_LABEL", { label });
227
+ if (label.length > MAX_LABEL_LENGTH) throw new BylineSchemaError(`Byline field label must be ${MAX_LABEL_LENGTH} characters or less`, "INVALID_LABEL", { length: label.length });
228
+ }
229
+ validateType(type) {
230
+ if (!TYPE_SET.has(type)) throw new BylineSchemaError(`Byline field type "${type}" is not supported`, "INVALID_TYPE", { type });
231
+ }
232
+ normaliseValidation(type, validation) {
233
+ if (type === "select") {
234
+ const options = validation?.options;
235
+ if (!Array.isArray(options) || options.length === 0) throw new BylineSchemaError("Byline field of type \"select\" requires validation.options", "INVALID_VALIDATION", { type });
236
+ if (options.length > MAX_SELECT_OPTIONS) throw new BylineSchemaError(`Byline field "select" cannot have more than ${MAX_SELECT_OPTIONS} options`, "INVALID_VALIDATION", { count: options.length });
237
+ const seen = /* @__PURE__ */ new Set();
238
+ for (const option of options) {
239
+ if (typeof option !== "string" || option.length === 0 || seen.has(option)) throw new BylineSchemaError("Byline field \"select\" options must be unique non-empty strings", "INVALID_VALIDATION", { option });
240
+ seen.add(option);
241
+ }
242
+ return { options };
243
+ }
244
+ return null;
245
+ }
246
+ };
247
+ function mapFieldRow(row) {
248
+ return {
249
+ id: row.id,
250
+ slug: row.slug,
251
+ label: row.label,
252
+ type: parseStoredFieldType(row.type),
253
+ required: row.required === 1,
254
+ translatable: row.translatable === 1,
255
+ validation: parseStoredValidation(row.validation),
256
+ sortOrder: row.sort_order,
257
+ createdAt: row.created_at,
258
+ updatedAt: row.updated_at
259
+ };
260
+ }
261
+ function parseStoredFieldType(value) {
262
+ if (isBylineFieldType(value)) return value;
263
+ throw new BylineSchemaError(`Invalid stored byline field type "${value}"`, "INVALID_TYPE", { type: value });
264
+ }
265
+ function isBylineFieldType(value) {
266
+ return TYPE_SET.has(value);
267
+ }
268
+ function parseStoredValidation(raw) {
269
+ if (!raw) return null;
270
+ let parsed;
271
+ try {
272
+ parsed = JSON.parse(raw);
273
+ } catch {
274
+ throw new BylineSchemaError("Invalid stored byline field validation JSON", "INVALID_VALIDATION");
275
+ }
276
+ if (!isBylineFieldValidation(parsed)) throw new BylineSchemaError("Invalid stored byline field validation", "INVALID_VALIDATION");
277
+ return parsed;
278
+ }
279
+ function isBylineFieldValidation(value) {
280
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
281
+ if (!("options" in value)) return true;
282
+ const options = value.options;
283
+ return Array.isArray(options) && options.every((option) => typeof option === "string");
284
+ }
285
+
286
+ //#endregion
287
+ export { BylineSchemaRegistry as n, mapBylineSchemaError as r, BylineSchemaError as t };
@@ -0,0 +1,165 @@
1
+ import { a as __exportAll } from "./runner-DTfG5v0G.mjs";
2
+ import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
3
+ import { t as BylineRepository } from "./byline-CXQcMsBu.mjs";
4
+ import { a as isMissingTableError, r as getDb } from "./loader-Y0QvC_QO.mjs";
5
+ import { i as resolveLocaleChain } from "./resolve-DTuDyYKs.mjs";
6
+ import { sql } from "kysely";
7
+
8
+ //#region src/bylines/index.ts
9
+ var bylines_exports = /* @__PURE__ */ __exportAll({
10
+ getByline: () => getByline,
11
+ getBylineBySlug: () => getBylineBySlug,
12
+ getBylinesForEntries: () => getBylinesForEntries,
13
+ invalidateBylineCache: () => invalidateBylineCache
14
+ });
15
+ function invalidateBylineCache() {}
16
+ /**
17
+ * Get a byline by ID.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { getByline } from "dineway";
22
+ *
23
+ * const byline = await getByline("01HXYZ...");
24
+ * if (byline) {
25
+ * console.log(byline.displayName);
26
+ * }
27
+ * ```
28
+ */
29
+ async function getByline(id) {
30
+ return new BylineRepository(await getDb()).findById(id);
31
+ }
32
+ /**
33
+ * Get a byline by slug.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { getBylineBySlug } from "dineway";
38
+ *
39
+ * const byline = await getBylineBySlug("jane-doe");
40
+ * if (byline) {
41
+ * console.log(byline.displayName); // "Jane Doe"
42
+ * }
43
+ * ```
44
+ */
45
+ async function getBylineBySlug(slug, options) {
46
+ const repo = new BylineRepository(await getDb());
47
+ const chain = resolveLocaleChain(options?.locale);
48
+ if (chain.length === 0) return repo.findBySlug(slug);
49
+ for (const locale of chain) {
50
+ const byline = await repo.findBySlug(slug, { locale });
51
+ if (byline) return byline;
52
+ }
53
+ return null;
54
+ }
55
+ /**
56
+ * Batch-fetch byline credits for multiple content entries in a single query.
57
+ *
58
+ * This is more efficient than calling getEntryBylines for each entry
59
+ * when you need bylines for a list of entries (e.g., a blog index page).
60
+ *
61
+ * @param collection - The collection slug (e.g., "posts")
62
+ * @param entries - Entry id + authorId pairs; authorId is already on the row
63
+ * @returns Map from entry ID to array of byline credits
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { getBylinesForEntries, getDinewayCollection } from "dineway";
68
+ *
69
+ * const { entries } = await getDinewayCollection("posts");
70
+ * const refs = entries.map((e) => ({ id: e.data.id, authorId: e.data.authorId ?? null }));
71
+ * const bylinesMap = await getBylinesForEntries("posts", refs);
72
+ *
73
+ * for (const entry of entries) {
74
+ * const bylines = bylinesMap.get(entry.data.id) ?? [];
75
+ * // render bylines
76
+ * }
77
+ * ```
78
+ */
79
+ async function getBylinesForEntries(collection, entries) {
80
+ validateIdentifier(collection, "collection");
81
+ const result = /* @__PURE__ */ new Map();
82
+ for (const { id } of entries) result.set(id, []);
83
+ if (entries.length === 0) return result;
84
+ const repo = new BylineRepository(await getDb());
85
+ const hydrationTargets = [];
86
+ const buckets = /* @__PURE__ */ new Map();
87
+ for (const entry of entries) {
88
+ const key = entry.locale ?? null;
89
+ const bucket = buckets.get(key);
90
+ if (bucket) bucket.push(entry);
91
+ else buckets.set(key, [entry]);
92
+ }
93
+ const explicitByEntry = /* @__PURE__ */ new Map();
94
+ const entriesNeedingAuthorCheck = [];
95
+ for (const [locale, bucket] of buckets) {
96
+ const localeOpt = locale ? { locale } : void 0;
97
+ let bylinesMap;
98
+ try {
99
+ bylinesMap = await repo.getContentBylinesMany(collection, bucket.map((entry) => entry.id), {
100
+ ...localeOpt,
101
+ skipHydration: true
102
+ });
103
+ } catch (error) {
104
+ if (isMissingTableError(error)) return result;
105
+ throw error;
106
+ }
107
+ for (const [id, list] of bylinesMap) {
108
+ explicitByEntry.set(id, list);
109
+ for (const credit of list) hydrationTargets.push(credit.byline);
110
+ }
111
+ for (const entry of bucket) {
112
+ const explicit = bylinesMap.get(entry.id);
113
+ if (explicit && explicit.length > 0) continue;
114
+ if (entry.authorId && !entry.primaryBylineId) entriesNeedingAuthorCheck.push(entry);
115
+ }
116
+ }
117
+ const fallbackByEntry = /* @__PURE__ */ new Map();
118
+ const authorBuckets = /* @__PURE__ */ new Map();
119
+ for (const entry of entriesNeedingAuthorCheck) {
120
+ const key = entry.locale ?? null;
121
+ const bucket = authorBuckets.get(key);
122
+ if (bucket) bucket.push(entry);
123
+ else authorBuckets.set(key, [entry]);
124
+ }
125
+ for (const [locale, bucket] of authorBuckets) {
126
+ const localeOpt = locale ? { locale } : void 0;
127
+ const authorIds = bucket.map((entry) => entry.authorId).filter((id) => id !== null);
128
+ const uniqueAuthorIds = [...new Set(authorIds)];
129
+ if (uniqueAuthorIds.length === 0) continue;
130
+ const authorBylineMap = await repo.findByUserIds(uniqueAuthorIds, {
131
+ ...localeOpt,
132
+ skipHydration: true
133
+ });
134
+ for (const entry of bucket) {
135
+ if (!entry.authorId) continue;
136
+ const fallback = authorBylineMap.get(entry.authorId);
137
+ if (fallback) {
138
+ fallbackByEntry.set(entry.id, fallback);
139
+ hydrationTargets.push(fallback);
140
+ }
141
+ }
142
+ }
143
+ await repo.hydrateBylineCustomFields(hydrationTargets);
144
+ for (const { id } of entries) {
145
+ const explicit = explicitByEntry.get(id);
146
+ if (explicit && explicit.length > 0) {
147
+ result.set(id, explicit.map((c) => ({
148
+ ...c,
149
+ source: "explicit"
150
+ })));
151
+ continue;
152
+ }
153
+ const fallback = fallbackByEntry.get(id);
154
+ if (fallback) result.set(id, [{
155
+ byline: fallback,
156
+ sortOrder: 0,
157
+ roleLabel: null,
158
+ source: "inferred"
159
+ }]);
160
+ }
161
+ return result;
162
+ }
163
+
164
+ //#endregion
165
+ export { invalidateBylineCache as i, getByline as n, getBylineBySlug as r, bylines_exports as t };
@@ -0,0 +1,163 @@
1
+ import { n as getI18nConfig } from "./config-CVssduLe.mjs";
2
+ import { t as DinewayValidationError } from "./types-Ck7-WoUD.mjs";
3
+ import { t as BylineRepository } from "./byline-CXQcMsBu.mjs";
4
+
5
+ //#region src/api/handlers/bylines.ts
6
+ const norm = (value) => value ?? null;
7
+ function bylineFixedFieldsMatch(existing, input, effectiveLocale) {
8
+ return existing.displayName === input.displayName && norm(existing.bio) === norm(input.bio) && norm(existing.avatarMediaId) === norm(input.avatarMediaId) && norm(existing.websiteUrl) === norm(input.websiteUrl) && norm(existing.userId) === norm(input.userId) && existing.isGuest === (input.isGuest ?? false) && existing.locale === effectiveLocale;
9
+ }
10
+ function existingCustomFieldsAreSubsetOf(existing, input) {
11
+ if (!input) return Object.keys(existing).length === 0;
12
+ for (const [slug, value] of Object.entries(existing)) {
13
+ if (!Object.hasOwn(input, slug)) return false;
14
+ if (input[slug] !== value) return false;
15
+ }
16
+ return true;
17
+ }
18
+ function rejectUnknownLocale(locale) {
19
+ if (!locale) return null;
20
+ const config = getI18nConfig();
21
+ if (!config) return null;
22
+ if (config.locales.includes(locale)) return null;
23
+ return {
24
+ success: false,
25
+ error: {
26
+ code: "VALIDATION_ERROR",
27
+ message: `Locale "${locale}" is not configured for this site`
28
+ }
29
+ };
30
+ }
31
+ async function handleBylineTranslations(db, id) {
32
+ try {
33
+ const repo = new BylineRepository(db);
34
+ if (!await repo.findById(id)) return {
35
+ success: false,
36
+ error: {
37
+ code: "NOT_FOUND",
38
+ message: "Byline not found"
39
+ }
40
+ };
41
+ return {
42
+ success: true,
43
+ data: { items: await repo.listTranslations(id) }
44
+ };
45
+ } catch {
46
+ return {
47
+ success: false,
48
+ error: {
49
+ code: "BYLINE_TRANSLATIONS_ERROR",
50
+ message: "Failed to list byline translations"
51
+ }
52
+ };
53
+ }
54
+ }
55
+ async function handleBylineCreate(db, input) {
56
+ try {
57
+ if (input.translationOf && !input.locale) return {
58
+ success: false,
59
+ error: {
60
+ code: "VALIDATION_ERROR",
61
+ message: "`locale` is required when `translationOf` is provided"
62
+ }
63
+ };
64
+ const localeErr = rejectUnknownLocale(input.locale);
65
+ if (localeErr) return localeErr;
66
+ const repo = new BylineRepository(db);
67
+ let sourceGroup;
68
+ if (input.translationOf) {
69
+ const source = await repo.findById(input.translationOf);
70
+ if (!source) return {
71
+ success: false,
72
+ error: {
73
+ code: "NOT_FOUND",
74
+ message: "Source byline for translation not found"
75
+ }
76
+ };
77
+ sourceGroup = source.translationGroup ?? source.id;
78
+ }
79
+ const effectiveLocale = input.locale ?? getI18nConfig()?.defaultLocale ?? "en";
80
+ if (sourceGroup) {
81
+ if ((await repo.findByTranslationGroup(sourceGroup)).some((byline) => byline.locale === effectiveLocale)) return {
82
+ success: false,
83
+ error: {
84
+ code: "CONFLICT",
85
+ message: `Translation already exists in locale "${effectiveLocale}" for this byline`
86
+ }
87
+ };
88
+ }
89
+ const existing = await repo.findBySlug(input.slug, { locale: effectiveLocale });
90
+ if (existing) {
91
+ const expectedTranslationGroup = sourceGroup ?? existing.id;
92
+ if (!!input.customFields && Object.keys(input.customFields).length > 0 && bylineFixedFieldsMatch(existing, input, effectiveLocale) && existing.translationGroup === expectedTranslationGroup && existingCustomFieldsAreSubsetOf(existing.customFields ?? {}, input.customFields)) {
93
+ const recovered = await repo.update(existing.id, { customFields: input.customFields });
94
+ if (recovered) return {
95
+ success: true,
96
+ data: recovered
97
+ };
98
+ }
99
+ return {
100
+ success: false,
101
+ error: {
102
+ code: "CONFLICT",
103
+ message: `Byline "${input.slug}" already exists${input.locale ? ` in locale "${input.locale}"` : ""}`
104
+ }
105
+ };
106
+ }
107
+ return {
108
+ success: true,
109
+ data: await repo.create(input)
110
+ };
111
+ } catch (error) {
112
+ if (error instanceof DinewayValidationError) return {
113
+ success: false,
114
+ error: {
115
+ code: "VALIDATION_ERROR",
116
+ message: error.message
117
+ }
118
+ };
119
+ console.error("[BYLINE_CREATE_ERROR]", error);
120
+ return {
121
+ success: false,
122
+ error: {
123
+ code: "BYLINE_CREATE_ERROR",
124
+ message: "Failed to create byline"
125
+ }
126
+ };
127
+ }
128
+ }
129
+ async function handleBylineUpdate(db, id, input) {
130
+ try {
131
+ const byline = await new BylineRepository(db).update(id, input);
132
+ if (!byline) return {
133
+ success: false,
134
+ error: {
135
+ code: "NOT_FOUND",
136
+ message: "Byline not found"
137
+ }
138
+ };
139
+ return {
140
+ success: true,
141
+ data: byline
142
+ };
143
+ } catch (error) {
144
+ if (error instanceof DinewayValidationError) return {
145
+ success: false,
146
+ error: {
147
+ code: "VALIDATION_ERROR",
148
+ message: error.message
149
+ }
150
+ };
151
+ console.error("[BYLINE_UPDATE_ERROR]", error);
152
+ return {
153
+ success: false,
154
+ error: {
155
+ code: "BYLINE_UPDATE_ERROR",
156
+ message: "Failed to update byline"
157
+ }
158
+ };
159
+ }
160
+ }
161
+
162
+ //#endregion
163
+ export { handleBylineTranslations as n, handleBylineUpdate as r, handleBylineCreate as t };
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "./chunk-ClPoSABd.mjs";
2
- import { i as matchPattern, n as interpolateDestination, t as compilePattern } from "./patterns-CiyXeDgr.mjs";
1
+ import { a as __exportAll } from "./runner-DTfG5v0G.mjs";
2
+ import { i as matchPattern, n as interpolateDestination, t as compilePattern } from "./patterns-D9iDO3j8.mjs";
3
3
 
4
4
  //#region src/redirects/cache.ts
5
5
  var cache_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./chunk-ClPoSABd.mjs";
1
+ import { a as __exportAll } from "./runner-DTfG5v0G.mjs";
2
2
 
3
3
  //#region src/utils/chunks.ts
4
4
  var chunks_exports = /* @__PURE__ */ __exportAll({