emdash 0.7.0 → 0.9.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 (354) hide show
  1. package/dist/{adapters-Di31kZ28.d.mts → adapters-DoNJiveC.d.mts} +1 -1
  2. package/dist/{adapters-Di31kZ28.d.mts.map → adapters-DoNJiveC.d.mts.map} +1 -1
  3. package/dist/{apply-5uslYdUu.mjs → apply-BzltprvY.mjs} +90 -139
  4. package/dist/apply-BzltprvY.mjs.map +1 -0
  5. package/dist/astro/index.d.mts +6 -6
  6. package/dist/astro/index.d.mts.map +1 -1
  7. package/dist/astro/index.mjs +194 -17
  8. package/dist/astro/index.mjs.map +1 -1
  9. package/dist/astro/middleware/auth.d.mts +6 -7
  10. package/dist/astro/middleware/auth.d.mts.map +1 -1
  11. package/dist/astro/middleware/auth.mjs +34 -57
  12. package/dist/astro/middleware/auth.mjs.map +1 -1
  13. package/dist/astro/middleware/redirect.d.mts.map +1 -1
  14. package/dist/astro/middleware/redirect.mjs +17 -12
  15. package/dist/astro/middleware/redirect.mjs.map +1 -1
  16. package/dist/astro/middleware/request-context.d.mts.map +1 -1
  17. package/dist/astro/middleware/request-context.mjs +9 -6
  18. package/dist/astro/middleware/request-context.mjs.map +1 -1
  19. package/dist/astro/middleware/setup.mjs +1 -1
  20. package/dist/astro/middleware.d.mts.map +1 -1
  21. package/dist/astro/middleware.mjs +301 -165
  22. package/dist/astro/middleware.mjs.map +1 -1
  23. package/dist/astro/types.d.mts +34 -10
  24. package/dist/astro/types.d.mts.map +1 -1
  25. package/dist/{base64-MBPo9ozB.mjs → base64-BRICGH2l.mjs} +1 -1
  26. package/dist/{base64-MBPo9ozB.mjs.map → base64-BRICGH2l.mjs.map} +1 -1
  27. package/dist/{byline-C4OVd8b3.mjs → byline-BSaNL1w7.mjs} +5 -5
  28. package/dist/byline-BSaNL1w7.mjs.map +1 -0
  29. package/dist/bylines-CvJ3PYz2.mjs +113 -0
  30. package/dist/bylines-CvJ3PYz2.mjs.map +1 -0
  31. package/dist/cache-C6N_hhN7.mjs +65 -0
  32. package/dist/cache-C6N_hhN7.mjs.map +1 -0
  33. package/dist/{chunks-HGz06Soa.mjs → chunks-NBQVDOci.mjs} +8 -2
  34. package/dist/{chunks-HGz06Soa.mjs.map → chunks-NBQVDOci.mjs.map} +1 -1
  35. package/dist/cli/index.mjs +229 -31
  36. package/dist/cli/index.mjs.map +1 -1
  37. package/dist/client/cf-access.d.mts +1 -1
  38. package/dist/client/index.d.mts +1 -1
  39. package/dist/client/index.mjs +3 -3
  40. package/dist/client/index.mjs.map +1 -1
  41. package/dist/{config-BXwuX8Bx.mjs → config-BI0V3ICQ.mjs} +1 -1
  42. package/dist/{config-BXwuX8Bx.mjs.map → config-BI0V3ICQ.mjs.map} +1 -1
  43. package/dist/{content-D7J5y73J.mjs → content-8lOYF0pr.mjs} +43 -28
  44. package/dist/content-8lOYF0pr.mjs.map +1 -0
  45. package/dist/db/index.d.mts +3 -3
  46. package/dist/db/index.mjs +2 -2
  47. package/dist/db/libsql.d.mts +1 -1
  48. package/dist/db/libsql.d.mts.map +1 -1
  49. package/dist/db/libsql.mjs +7 -2
  50. package/dist/db/libsql.mjs.map +1 -1
  51. package/dist/db/postgres.d.mts +1 -1
  52. package/dist/db/sqlite.d.mts +1 -1
  53. package/dist/db/sqlite.d.mts.map +1 -1
  54. package/dist/db/sqlite.mjs +8 -3
  55. package/dist/db/sqlite.mjs.map +1 -1
  56. package/dist/{db-errors-D0UT85nC.mjs → db-errors-WRezodiz.mjs} +1 -1
  57. package/dist/{db-errors-D0UT85nC.mjs.map → db-errors-WRezodiz.mjs.map} +1 -1
  58. package/dist/{default-CME5YdZ3.mjs → default-D8ksjWhO.mjs} +1 -1
  59. package/dist/{default-CME5YdZ3.mjs.map → default-D8ksjWhO.mjs.map} +1 -1
  60. package/dist/{dialect-helpers-DhTzaUxP.mjs → dialect-helpers-BKCvISIQ.mjs} +19 -2
  61. package/dist/dialect-helpers-BKCvISIQ.mjs.map +1 -0
  62. package/dist/{error-CiYn9yDu.mjs → error-D_-tqP-I.mjs} +1 -1
  63. package/dist/error-D_-tqP-I.mjs.map +1 -0
  64. package/dist/{index-De6_Xv3v.d.mts → index-BFRaVcD6.d.mts} +243 -40
  65. package/dist/index-BFRaVcD6.d.mts.map +1 -0
  66. package/dist/index.d.mts +11 -11
  67. package/dist/index.mjs +29 -25
  68. package/dist/{load-CBcmDIot.mjs → load-DDqMMvZL.mjs} +2 -2
  69. package/dist/{load-CBcmDIot.mjs.map → load-DDqMMvZL.mjs.map} +1 -1
  70. package/dist/{loader-DeiBJEMe.mjs → loader-CKLbBnhK.mjs} +32 -10
  71. package/dist/loader-CKLbBnhK.mjs.map +1 -0
  72. package/dist/{manifest-schema-V30qsMft.mjs → manifest-schema-DqWNC3lM.mjs} +45 -3
  73. package/dist/manifest-schema-DqWNC3lM.mjs.map +1 -0
  74. package/dist/media/index.d.mts +1 -1
  75. package/dist/media/index.mjs +1 -1
  76. package/dist/media/local-runtime.d.mts +7 -7
  77. package/dist/media/local-runtime.mjs +3 -3
  78. package/dist/{media-DqHVh136.mjs → media-BW32b4gi.mjs} +4 -7
  79. package/dist/media-BW32b4gi.mjs.map +1 -0
  80. package/dist/{mode-CpNnGkPz.mjs → mode-ier8jbBk.mjs} +1 -1
  81. package/dist/mode-ier8jbBk.mjs.map +1 -0
  82. package/dist/options-BVp3UsTS.mjs +117 -0
  83. package/dist/options-BVp3UsTS.mjs.map +1 -0
  84. package/dist/page/index.d.mts +2 -2
  85. package/dist/{placeholder-tzpqGWII.d.mts → placeholder-BE4o_2dc.d.mts} +1 -1
  86. package/dist/{placeholder-tzpqGWII.d.mts.map → placeholder-BE4o_2dc.d.mts.map} +1 -1
  87. package/dist/{placeholder-C-fk5hYI.mjs → placeholder-CIJejMlK.mjs} +1 -1
  88. package/dist/placeholder-CIJejMlK.mjs.map +1 -0
  89. package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
  90. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  91. package/dist/plugins/adapt-sandbox-entry.mjs +6 -5
  92. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
  93. package/dist/public-url-DByxYjUw.mjs +51 -0
  94. package/dist/public-url-DByxYjUw.mjs.map +1 -0
  95. package/dist/{query-g4Ug-9j9.mjs → query-Cg9ZKRQ0.mjs} +114 -16
  96. package/dist/query-Cg9ZKRQ0.mjs.map +1 -0
  97. package/dist/{redirect-CN0Rt9Ob.mjs → redirect-BhUBKRc1.mjs} +13 -8
  98. package/dist/redirect-BhUBKRc1.mjs.map +1 -0
  99. package/dist/{registry-Ci3WxVAr.mjs → registry-Dw70ChxB.mjs} +69 -11
  100. package/dist/registry-Dw70ChxB.mjs.map +1 -0
  101. package/dist/{request-cache-DiR961CV.mjs → request-cache-B-bmkipQ.mjs} +1 -1
  102. package/dist/request-cache-B-bmkipQ.mjs.map +1 -0
  103. package/dist/runner-Bnoj7vjK.d.mts +44 -0
  104. package/dist/runner-Bnoj7vjK.d.mts.map +1 -0
  105. package/dist/{runner-tQ7BJ4T7.mjs → runner-C7ADox5q.mjs} +185 -55
  106. package/dist/{runner-tQ7BJ4T7.mjs.map → runner-C7ADox5q.mjs.map} +1 -1
  107. package/dist/runtime.d.mts +6 -6
  108. package/dist/runtime.mjs +4 -4
  109. package/dist/{search-B0effn3j.mjs → search-dOGEccMa.mjs} +341 -152
  110. package/dist/search-dOGEccMa.mjs.map +1 -0
  111. package/dist/secrets-CW3reAnU.mjs +314 -0
  112. package/dist/secrets-CW3reAnU.mjs.map +1 -0
  113. package/dist/seed/index.d.mts +2 -2
  114. package/dist/seed/index.mjs +15 -14
  115. package/dist/seo/index.d.mts +1 -1
  116. package/dist/storage/local.d.mts +1 -1
  117. package/dist/storage/local.mjs +1 -1
  118. package/dist/storage/s3.d.mts +1 -1
  119. package/dist/storage/s3.d.mts.map +1 -1
  120. package/dist/storage/s3.mjs +4 -4
  121. package/dist/storage/s3.mjs.map +1 -1
  122. package/dist/{taxonomies-K2z0Uhnj.mjs → taxonomies-ZlRtD6AG.mjs} +14 -7
  123. package/dist/taxonomies-ZlRtD6AG.mjs.map +1 -0
  124. package/dist/{tokens-BFPFx3CA.mjs → tokens-D7zMmWi2.mjs} +2 -2
  125. package/dist/{tokens-BFPFx3CA.mjs.map → tokens-D7zMmWi2.mjs.map} +1 -1
  126. package/dist/{transport-BykRfpyy.mjs → transport-BeMCmin1.mjs} +6 -5
  127. package/dist/{transport-BykRfpyy.mjs.map → transport-BeMCmin1.mjs.map} +1 -1
  128. package/dist/{transport-H4Iwx7tC.d.mts → transport-DNEfeMaU.d.mts} +1 -1
  129. package/dist/{transport-H4Iwx7tC.d.mts.map → transport-DNEfeMaU.d.mts.map} +1 -1
  130. package/dist/types-4fVtCIm0.mjs +68 -0
  131. package/dist/types-4fVtCIm0.mjs.map +1 -0
  132. package/dist/{types-CnZYHyLW.d.mts → types-BSyXeCFW.d.mts} +24 -2
  133. package/dist/{types-CnZYHyLW.d.mts.map → types-BSyXeCFW.d.mts.map} +1 -1
  134. package/dist/{types-DgrIP0tF.d.mts → types-BuBIptGk.d.mts} +80 -106
  135. package/dist/types-BuBIptGk.d.mts.map +1 -0
  136. package/dist/{types-BH2L167P.mjs → types-CDbKp7ND.mjs} +1 -1
  137. package/dist/{types-BH2L167P.mjs.map → types-CDbKp7ND.mjs.map} +1 -1
  138. package/dist/{types-DDS4MxsT.mjs → types-CIOg5AR8.mjs} +1 -1
  139. package/dist/{types-DDS4MxsT.mjs.map → types-CIOg5AR8.mjs.map} +1 -1
  140. package/dist/{types-6CUZRrZP.d.mts → types-CJsYGpco.d.mts} +24 -2
  141. package/dist/{types-6CUZRrZP.d.mts.map → types-CJsYGpco.d.mts.map} +1 -1
  142. package/dist/types-CRxNbK-Z.mjs +68 -0
  143. package/dist/types-CRxNbK-Z.mjs.map +1 -0
  144. package/dist/{types-C2v0c34j.d.mts → types-CrtWgIvl.d.mts} +1 -1
  145. package/dist/{types-C2v0c34j.d.mts.map → types-CrtWgIvl.d.mts.map} +1 -1
  146. package/dist/{types-CFWjXmus.d.mts → types-M78DQ1lx.d.mts} +1 -1
  147. package/dist/{types-CFWjXmus.d.mts.map → types-M78DQ1lx.d.mts.map} +1 -1
  148. package/dist/{validate-CqsNItbt.mjs → validate-Baqf0slj.mjs} +3 -3
  149. package/dist/{validate-CqsNItbt.mjs.map → validate-Baqf0slj.mjs.map} +1 -1
  150. package/dist/{validate-kM8Pjuf7.d.mts → validate-BfQh_C_y.d.mts} +4 -4
  151. package/dist/{validate-kM8Pjuf7.d.mts.map → validate-BfQh_C_y.d.mts.map} +1 -1
  152. package/dist/validation-BfEI7tNe.mjs +144 -0
  153. package/dist/validation-BfEI7tNe.mjs.map +1 -0
  154. package/dist/version-DoxrVdYf.mjs +7 -0
  155. package/dist/{version-BnTKdfam.mjs.map → version-DoxrVdYf.mjs.map} +1 -1
  156. package/dist/zod-generator-CC0xNe_K.mjs +132 -0
  157. package/dist/zod-generator-CC0xNe_K.mjs.map +1 -0
  158. package/locals.d.ts +1 -6
  159. package/package.json +21 -7
  160. package/src/api/auth-storage.ts +37 -0
  161. package/src/api/error.ts +6 -0
  162. package/src/api/errors.ts +8 -0
  163. package/src/api/handlers/comments.ts +19 -4
  164. package/src/api/handlers/content.ts +151 -4
  165. package/src/api/handlers/device-flow.ts +5 -0
  166. package/src/api/handlers/index.ts +2 -0
  167. package/src/api/handlers/marketplace.ts +11 -4
  168. package/src/api/handlers/media.ts +8 -1
  169. package/src/api/handlers/menus.ts +160 -21
  170. package/src/api/handlers/oauth-authorization.ts +72 -33
  171. package/src/api/handlers/redirects.ts +16 -3
  172. package/src/api/handlers/revision.ts +23 -14
  173. package/src/api/handlers/sections.ts +8 -1
  174. package/src/api/handlers/taxonomies.ts +131 -22
  175. package/src/api/handlers/validation.ts +212 -0
  176. package/src/api/openapi/document.ts +4 -1
  177. package/src/api/public-url.ts +54 -5
  178. package/src/api/route-utils.ts +14 -0
  179. package/src/api/schemas/comments.ts +2 -2
  180. package/src/api/schemas/common.ts +1 -1
  181. package/src/api/schemas/content.ts +17 -0
  182. package/src/api/schemas/sections.ts +3 -3
  183. package/src/api/schemas/setup.ts +8 -0
  184. package/src/api/schemas/users.ts +1 -1
  185. package/src/api/schemas/widgets.ts +12 -10
  186. package/src/api/setup-complete.ts +40 -0
  187. package/src/api/types.ts +5 -1
  188. package/src/astro/integration/index.ts +30 -2
  189. package/src/astro/integration/routes.ts +28 -0
  190. package/src/astro/integration/runtime.ts +49 -1
  191. package/src/astro/integration/virtual-modules.ts +73 -2
  192. package/src/astro/integration/vite-config.ts +49 -13
  193. package/src/astro/middleware/auth.ts +34 -6
  194. package/src/astro/middleware/redirect.ts +29 -16
  195. package/src/astro/middleware/request-context.ts +15 -5
  196. package/src/astro/middleware.ts +41 -10
  197. package/src/astro/routes/PluginRegistry.tsx +10 -1
  198. package/src/astro/routes/api/auth/invite/complete.ts +6 -1
  199. package/src/astro/routes/api/auth/mode.ts +57 -0
  200. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +23 -3
  201. package/src/astro/routes/api/auth/oauth/[provider].ts +10 -4
  202. package/src/astro/routes/api/auth/passkey/register/verify.ts +6 -1
  203. package/src/astro/routes/api/auth/passkey/verify.ts +6 -1
  204. package/src/astro/routes/api/auth/signup/complete.ts +6 -1
  205. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +2 -2
  206. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +4 -2
  207. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +34 -12
  208. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +32 -2
  209. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +4 -2
  210. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +3 -2
  211. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +8 -4
  212. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +1 -1
  213. package/src/astro/routes/api/content/[collection]/[id].ts +12 -0
  214. package/src/astro/routes/api/content/[collection]/index.ts +1 -9
  215. package/src/astro/routes/api/import/wordpress/execute.ts +3 -1
  216. package/src/astro/routes/api/import/wordpress/media.ts +2 -7
  217. package/src/astro/routes/api/import/wordpress/prepare.ts +9 -0
  218. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +3 -1
  219. package/src/astro/routes/api/manifest.ts +62 -45
  220. package/src/astro/routes/api/media/[id]/confirm.ts +10 -1
  221. package/src/astro/routes/api/media/providers/[providerId]/index.ts +12 -3
  222. package/src/astro/routes/api/openapi.json.ts +27 -10
  223. package/src/astro/routes/api/redirects/404s/index.ts +10 -4
  224. package/src/astro/routes/api/redirects/404s/summary.ts +4 -2
  225. package/src/astro/routes/api/redirects/[id].ts +10 -4
  226. package/src/astro/routes/api/redirects/index.ts +7 -3
  227. package/src/astro/routes/api/revisions/[revisionId]/index.ts +1 -1
  228. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -2
  229. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -1
  230. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -1
  231. package/src/astro/routes/api/schema/collections/[slug]/index.ts +2 -2
  232. package/src/astro/routes/api/schema/collections/index.ts +1 -1
  233. package/src/astro/routes/api/search/index.ts +10 -2
  234. package/src/astro/routes/api/sections/[slug].ts +10 -4
  235. package/src/astro/routes/api/sections/index.ts +7 -3
  236. package/src/astro/routes/api/settings/email.ts +4 -9
  237. package/src/astro/routes/api/setup/admin-verify.ts +6 -1
  238. package/src/astro/routes/api/setup/admin.ts +8 -2
  239. package/src/astro/routes/api/setup/index.ts +2 -2
  240. package/src/astro/routes/api/setup/status.ts +3 -1
  241. package/src/astro/routes/api/snapshot.ts +44 -18
  242. package/src/astro/routes/api/taxonomies/index.ts +0 -1
  243. package/src/astro/routes/api/themes/preview.ts +11 -5
  244. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +4 -1
  245. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +4 -1
  246. package/src/astro/routes/api/widget-areas/[name].ts +4 -1
  247. package/src/astro/routes/api/widget-areas/index.ts +4 -1
  248. package/src/astro/types.ts +32 -3
  249. package/src/auth/allowed-origins.ts +168 -0
  250. package/src/auth/mode.ts +15 -3
  251. package/src/auth/passkey-config.ts +35 -13
  252. package/src/auth/providers/github-admin.tsx +29 -0
  253. package/src/auth/providers/github.ts +31 -0
  254. package/src/auth/providers/google-admin.tsx +44 -0
  255. package/src/auth/providers/google.ts +31 -0
  256. package/src/auth/types.ts +114 -4
  257. package/src/bylines/index.ts +37 -88
  258. package/src/cli/commands/auth.ts +28 -6
  259. package/src/cli/commands/bundle-utils.ts +11 -2
  260. package/src/cli/commands/bundle.ts +31 -9
  261. package/src/cli/commands/content.ts +13 -0
  262. package/src/cli/commands/login.ts +8 -1
  263. package/src/cli/commands/publish.ts +24 -0
  264. package/src/cli/commands/secrets.ts +183 -0
  265. package/src/cli/credentials.ts +1 -1
  266. package/src/cli/index.ts +5 -1
  267. package/src/client/index.ts +4 -4
  268. package/src/client/transport.ts +17 -7
  269. package/src/components/Break.astro +2 -2
  270. package/src/components/EmDashHead.astro +18 -13
  271. package/src/components/EmDashImage.astro +7 -6
  272. package/src/components/Embed.astro +1 -1
  273. package/src/components/Gallery.astro +6 -4
  274. package/src/components/Image.astro +9 -4
  275. package/src/components/InlinePortableTextEditor.tsx +106 -19
  276. package/src/components/LiveSearch.astro +5 -14
  277. package/src/config/secrets.ts +528 -0
  278. package/src/database/dialect-helpers.ts +50 -0
  279. package/src/database/migrations/034_published_at_index.ts +1 -1
  280. package/src/database/migrations/035_bounded_404_log.ts +56 -39
  281. package/src/database/migrations/runner.ts +156 -23
  282. package/src/database/repositories/audit.ts +6 -8
  283. package/src/database/repositories/byline.ts +6 -8
  284. package/src/database/repositories/comment.ts +12 -16
  285. package/src/database/repositories/content.ts +76 -52
  286. package/src/database/repositories/index.ts +1 -1
  287. package/src/database/repositories/media.ts +10 -13
  288. package/src/database/repositories/plugin-storage.ts +4 -6
  289. package/src/database/repositories/redirect.ts +26 -19
  290. package/src/database/repositories/taxonomy.ts +40 -3
  291. package/src/database/repositories/types.ts +57 -8
  292. package/src/database/repositories/user.ts +6 -8
  293. package/src/db/libsql.ts +1 -3
  294. package/src/db/sqlite.ts +2 -5
  295. package/src/emdash-runtime.ts +388 -247
  296. package/src/index.ts +14 -1
  297. package/src/loader.ts +30 -6
  298. package/src/mcp/server.ts +781 -141
  299. package/src/media/normalize.ts +1 -1
  300. package/src/media/url.ts +78 -0
  301. package/src/page/site-identity.ts +58 -0
  302. package/src/plugins/adapt-sandbox-entry.ts +22 -10
  303. package/src/plugins/context.ts +13 -10
  304. package/src/plugins/define-plugin.ts +40 -12
  305. package/src/plugins/email-console.ts +10 -3
  306. package/src/plugins/hooks.ts +34 -19
  307. package/src/plugins/index.ts +9 -0
  308. package/src/plugins/manifest-schema.ts +49 -2
  309. package/src/plugins/types.ts +174 -13
  310. package/src/preview/urls.ts +23 -3
  311. package/src/query.ts +149 -6
  312. package/src/redirects/cache.ts +38 -18
  313. package/src/request-cache.ts +3 -0
  314. package/src/schema/registry.ts +97 -5
  315. package/src/schema/zod-generator.ts +27 -5
  316. package/src/search/fts-manager.ts +0 -2
  317. package/src/search/query.ts +111 -26
  318. package/src/search/types.ts +8 -1
  319. package/src/sections/index.ts +7 -9
  320. package/src/seed/apply.ts +2 -0
  321. package/src/settings/index.ts +80 -6
  322. package/src/settings/types.ts +23 -1
  323. package/src/storage/s3.ts +12 -6
  324. package/src/taxonomies/index.ts +11 -1
  325. package/src/virtual-modules.d.ts +21 -1
  326. package/src/widgets/index.ts +1 -1
  327. package/dist/apply-5uslYdUu.mjs.map +0 -1
  328. package/dist/byline-C4OVd8b3.mjs.map +0 -1
  329. package/dist/bylines-hPTW79hw.mjs +0 -157
  330. package/dist/bylines-hPTW79hw.mjs.map +0 -1
  331. package/dist/cache-BkKBuIvS.mjs +0 -56
  332. package/dist/cache-BkKBuIvS.mjs.map +0 -1
  333. package/dist/chunk-ClPoSABd.mjs +0 -21
  334. package/dist/content-D7J5y73J.mjs.map +0 -1
  335. package/dist/dialect-helpers-DhTzaUxP.mjs.map +0 -1
  336. package/dist/error-CiYn9yDu.mjs.map +0 -1
  337. package/dist/index-De6_Xv3v.d.mts.map +0 -1
  338. package/dist/loader-DeiBJEMe.mjs.map +0 -1
  339. package/dist/manifest-schema-V30qsMft.mjs.map +0 -1
  340. package/dist/media-DqHVh136.mjs.map +0 -1
  341. package/dist/mode-CpNnGkPz.mjs.map +0 -1
  342. package/dist/placeholder-C-fk5hYI.mjs.map +0 -1
  343. package/dist/query-g4Ug-9j9.mjs.map +0 -1
  344. package/dist/redirect-CN0Rt9Ob.mjs.map +0 -1
  345. package/dist/registry-Ci3WxVAr.mjs.map +0 -1
  346. package/dist/request-cache-DiR961CV.mjs.map +0 -1
  347. package/dist/runner-BR2xKwhn.d.mts +0 -34
  348. package/dist/runner-BR2xKwhn.d.mts.map +0 -1
  349. package/dist/search-B0effn3j.mjs.map +0 -1
  350. package/dist/taxonomies-K2z0Uhnj.mjs.map +0 -1
  351. package/dist/types-CMMN0pNg.mjs +0 -31
  352. package/dist/types-CMMN0pNg.mjs.map +0 -1
  353. package/dist/types-DgrIP0tF.d.mts.map +0 -1
  354. package/dist/version-BnTKdfam.mjs +0 -7
package/src/cli/index.ts CHANGED
@@ -11,7 +11,8 @@
11
11
  * - dev: Run dev server with local D1
12
12
  * - seed: Apply a seed file to the database
13
13
  * - export-seed: Export database schema and content as a seed file
14
- * - auth: Authentication utilities (secret generation)
14
+ * - secrets: Generate and inspect EmDash secrets (encryption keys, etc.)
15
+ * - auth: [DEPRECATED] Generate auth secret (use `secrets` instead)
15
16
  * - login/logout/whoami: Session management
16
17
  * - content: Create, read, update, delete content
17
18
  * - schema: Manage collections and fields
@@ -36,6 +37,7 @@ import { menuCommand } from "./commands/menu.js";
36
37
  import { pluginCommand } from "./commands/plugin.js";
37
38
  import { schemaCommand } from "./commands/schema.js";
38
39
  import { searchCommand } from "./commands/search-cmd.js";
40
+ import { secretsCommand } from "./commands/secrets.js";
39
41
  import { seedCommand } from "./commands/seed.js";
40
42
  import { taxonomyCommand } from "./commands/taxonomy.js";
41
43
  import { typesCommand } from "./commands/types.js";
@@ -53,6 +55,8 @@ const main = defineCommand({
53
55
  doctor: doctorCommand,
54
56
  seed: seedCommand,
55
57
  "export-seed": exportSeedCommand,
58
+ secrets: secretsCommand,
59
+ // Deprecated alias kept for backwards compat; will be removed in a future minor.
56
60
  auth: authCommand,
57
61
  login: loginCommand,
58
62
  logout: logoutCommand,
@@ -723,8 +723,8 @@ export class EmDashClient {
723
723
 
724
724
  /** List taxonomies */
725
725
  async taxonomies(): Promise<Taxonomy[]> {
726
- const data = await this.request<{ items: Taxonomy[] }>("GET", "/taxonomies");
727
- return data.items;
726
+ const data = await this.request<{ taxonomies: Taxonomy[] }>("GET", "/taxonomies");
727
+ return data.taxonomies;
728
728
  }
729
729
 
730
730
  /** List terms in a taxonomy */
@@ -757,8 +757,8 @@ export class EmDashClient {
757
757
 
758
758
  /** List menus */
759
759
  async menus(): Promise<Menu[]> {
760
- const data = await this.request<{ items: Menu[] }>("GET", "/menus");
761
- return data.items;
760
+ // Handler returns a bare array, not { items: [...] }
761
+ return this.request<Menu[]>("GET", "/menus");
762
762
  }
763
763
 
764
764
  /** Get a menu with its items */
@@ -155,24 +155,34 @@ export function refreshInterceptor(options: {
155
155
 
156
156
  if (!res.ok) return null;
157
157
 
158
- const data = (await res.json()) as {
158
+ interface TokenFields {
159
159
  access_token: string;
160
160
  refresh_token?: string;
161
161
  expires_in?: number;
162
- };
163
- const expiresAt = data.expires_in
164
- ? new Date(Date.now() + data.expires_in * 1000).toISOString()
162
+ }
163
+
164
+ const json = (await res.json()) as Record<string, unknown>;
165
+
166
+ // The token endpoint wraps the response in { data: ... } via apiSuccess.
167
+ // Handle both wrapped and bare shapes for robustness.
168
+ const tokenData: TokenFields =
169
+ json.data && typeof json.data === "object" && "access_token" in json.data
170
+ ? (json.data as TokenFields)
171
+ : (json as unknown as TokenFields);
172
+
173
+ const expiresAt = tokenData.expires_in
174
+ ? new Date(Date.now() + tokenData.expires_in * 1000).toISOString()
165
175
  : new Date(Date.now() + 3600_000).toISOString();
166
176
 
167
177
  if (options.onTokenRefreshed) {
168
178
  options.onTokenRefreshed(
169
- data.access_token,
170
- data.refresh_token ?? options.refreshToken,
179
+ tokenData.access_token,
180
+ tokenData.refresh_token ?? options.refreshToken,
171
181
  expiresAt,
172
182
  );
173
183
  }
174
184
 
175
- return data.access_token;
185
+ return tokenData.access_token;
176
186
  }
177
187
 
178
188
  return async (request, next) => {
@@ -32,11 +32,11 @@ const style = node?.style || "line";
32
32
  }
33
33
  .emdash-break-line {
34
34
  border: none;
35
- border-top: 1px solid #e0e0e0;
35
+ border-top: 1px solid var(--emdash-break-color, var(--color-border, #e0e0e0));
36
36
  }
37
37
  .emdash-break-dots {
38
38
  text-align: center;
39
- color: #999;
39
+ color: var(--emdash-break-dots-color, var(--color-muted, #999));
40
40
  letter-spacing: 0.5em;
41
41
  }
42
42
  .emdash-break-space {
@@ -20,8 +20,9 @@ import {
20
20
  generateBaseSeoContributions,
21
21
  generateSiteSeoContributions,
22
22
  } from "../page/seo-contributions.js";
23
+ import { renderSiteIdentity } from "../page/site-identity.js";
23
24
  import { getPageRuntime } from "../page/index.js";
24
- import { getSiteSetting } from "../settings/index.js";
25
+ import { getSiteSettings } from "../settings/index.js";
25
26
 
26
27
  interface Props {
27
28
  page: PublicPageContext;
@@ -34,29 +35,32 @@ const runtime = getPageRuntime(Astro.locals as Record<string, unknown>);
34
35
  const baseContributions: PageMetadataContribution[] = generateBaseSeoContributions(page);
35
36
 
36
37
  let metadataHtml = "";
38
+ let siteIdentityHtml = "";
37
39
  let fragmentsHtml = "";
38
40
 
39
41
  if (runtime) {
40
- // Run independent async loads in parallel: site SEO settings (for
41
- // search engine verification meta tags) and plugin page-metadata
42
- // contributions. Plugin contributions come BEFORE site/base in the
43
- // array, so resolvePageMetadata's first-wins dedup lets plugins
44
- // override defaults.
42
+ // Run independent async loads in parallel: site settings (SEO meta
43
+ // tags + favicon) and plugin page-metadata contributions. Plugin
44
+ // contributions come BEFORE site/base in the contribution array,
45
+ // so resolvePageMetadata's first-wins dedup lets plugins override
46
+ // defaults.
45
47
  //
46
- // `getSiteSetting("seo")` is request-cached and crucially — reads
47
- // from `getSiteSettings()`'s cached batch when a parent template has
48
- // already called it. So this is either a single-key query or free,
49
- // not a second round-trip.
50
- const [seoSettings, pluginContributions, fragments] = await Promise.all([
51
- getSiteSetting("seo"),
48
+ // `getSiteSettings()` is request-cached and worker-cached, so when
49
+ // a parent template has already called it (the standard pattern in
50
+ // `Base.astro`), this is free. Otherwise it's a single batched
51
+ // query that supersedes any per-key fetch this component would
52
+ // otherwise have done.
53
+ const [siteSettings, pluginContributions, fragments] = await Promise.all([
54
+ getSiteSettings(),
52
55
  runtime.collectPageMetadata(page),
53
56
  runtime.collectPageFragments(page),
54
57
  ]);
55
58
 
56
- const siteContributions = generateSiteSeoContributions(seoSettings);
59
+ const siteContributions = generateSiteSeoContributions(siteSettings.seo);
57
60
  const allContributions = [...pluginContributions, ...siteContributions, ...baseContributions];
58
61
  const resolved = resolvePageMetadata(allContributions);
59
62
  metadataHtml = renderPageMetadata(resolved);
63
+ siteIdentityHtml = renderSiteIdentity({ favicon: siteSettings.favicon });
60
64
  fragmentsHtml = renderFragments(fragments, "head");
61
65
  } else {
62
66
  // No runtime (EmDash not initialized) — still render base SEO
@@ -66,4 +70,5 @@ if (runtime) {
66
70
  ---
67
71
 
68
72
  <Fragment set:html={metadataHtml} />
73
+ <Fragment set:html={siteIdentityHtml} />
69
74
  <Fragment set:html={fragmentsHtml} />
@@ -20,6 +20,7 @@ import type { MediaValue } from "../fields/types.js";
20
20
  import type { HTMLAttributes } from "astro/types";
21
21
  import type { ImageEmbed } from "../media/types.js";
22
22
  import { getMediaProvider } from "../media/provider-loader.js";
23
+ import { buildRenderMediaUrl } from "../media/url.js";
23
24
  // Standard responsive breakpoints
24
25
  const BREAKPOINTS = [640, 750, 828, 960, 1080, 1280, 1600, 1920];
25
26
 
@@ -53,14 +54,14 @@ function normalizeImage(
53
54
  }
54
55
 
55
56
  /**
56
- * Build the URL for a local image
57
+ * Build the URL for a local image. Prefers `meta.storageKey`; falls back to
58
+ * the internal proxy with `img.id` when no storage key is available.
57
59
  */
58
60
  function buildLocalImageUrl(img: MediaValue): string {
59
- const storageKey = (img.meta?.storageKey as string) || img.id;
60
- if (storageKey) {
61
- return `/_emdash/api/media/file/${storageKey}`;
62
- }
63
- return "";
61
+ return buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
62
+ storageKey: img.meta?.storageKey as string | undefined,
63
+ id: img.id,
64
+ });
64
65
  }
65
66
 
66
67
  /**
@@ -121,7 +121,7 @@ const isSelfHostedAudio = provider === "audio";
121
121
  }
122
122
  .emdash-embed figcaption {
123
123
  font-size: 0.875rem;
124
- color: #666;
124
+ color: var(--emdash-caption-color, var(--color-muted, #666));
125
125
  margin-top: 0.5rem;
126
126
  text-align: center;
127
127
  }
@@ -6,6 +6,7 @@
6
6
  * Uses Astro's Image component for optimization when dimensions are available.
7
7
  */
8
8
  import { Image as AstroImage } from "astro:assets";
9
+ import { buildRenderMediaUrl } from "../media/url.js";
9
10
 
10
11
  export interface Props {
11
12
  node: {
@@ -39,9 +40,10 @@ if (!images.length) {
39
40
  <div class="emdash-gallery" style={`--columns: ${columns}`}>
40
41
  {
41
42
  images.map((image) => {
42
- const src =
43
- image.asset.url ||
44
- `/_emdash/api/media/file/${image.asset._ref}`;
43
+ const src = buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
44
+ url: image.asset.url,
45
+ id: image.asset._ref,
46
+ });
45
47
  const hasSize = image.width && image.height;
46
48
  return (
47
49
  <figure class="emdash-gallery-item">
@@ -81,7 +83,7 @@ if (!images.length) {
81
83
  }
82
84
  .emdash-gallery-item figcaption {
83
85
  font-size: 0.75rem;
84
- color: #666;
86
+ color: var(--emdash-caption-color, var(--color-muted, #666));
85
87
  margin-top: 0.25rem;
86
88
  text-align: center;
87
89
  }
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import type { ImageEmbed } from "../media/types.js";
9
9
  import { getMediaProvider } from "../media/provider-loader.js";
10
+ import { buildRenderMediaUrl } from "../media/url.js";
10
11
  // Standard responsive breakpoints
11
12
  const BREAKPOINTS = [640, 750, 828, 960, 1080, 1280, 1600, 1920];
12
13
 
@@ -122,10 +123,14 @@ if (providerId && providerId !== "local") {
122
123
  }
123
124
  }
124
125
 
125
- // Fallback for local provider prefer stored URL (includes storage key with extension),
126
- // fall back to _ref (bare ULID, works if media file endpoint supports ID lookup)
126
+ // Fallback for local provider. `asset.url` carries the storage key with
127
+ // extension when present; `asset._ref` is a bare ULID that only the internal
128
+ // `/file/{id}` route can resolve. `buildRenderMediaUrl` picks the right shape.
127
129
  if (!src) {
128
- src = asset.url || `/_emdash/api/media/file/${asset._ref}`;
130
+ src = buildRenderMediaUrl(Astro.locals.emdash?.getPublicMediaUrl, {
131
+ url: asset.url,
132
+ id: asset._ref,
133
+ });
129
134
  }
130
135
 
131
136
  // Build placeholder background style
@@ -171,7 +176,7 @@ const imgStyle = placeholderStyle ? `${baseStyle} ${placeholderStyle}` : baseSty
171
176
  }
172
177
  .emdash-image figcaption {
173
178
  font-size: 0.875rem;
174
- color: #666;
179
+ color: var(--emdash-caption-color, var(--color-muted, #666));
175
180
  margin-top: 0.5rem;
176
181
  text-align: center;
177
182
  }
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import { autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react";
13
- import { Extension, type JSONContent, type Range } from "@tiptap/core";
13
+ import { Extension, Node, mergeAttributes, type JSONContent, type Range } from "@tiptap/core";
14
14
  import Focus from "@tiptap/extension-focus";
15
15
  import Image from "@tiptap/extension-image";
16
16
  import Link from "@tiptap/extension-link";
@@ -202,12 +202,18 @@ function convertPMNode(node: PMNode): PTBlock | PTBlock[] | null {
202
202
  }
203
203
  case "horizontalRule":
204
204
  return { _type: "break", _key: k(), style: "lineBreak" };
205
- case "pluginBlock":
205
+ case "pluginBlock": {
206
+ // Spread the captured data back out so the block round-trips losslessly.
207
+ // `data` holds every field except _type / _key / id (which live on
208
+ // dedicated attrs).
209
+ const { blockType, id, data } = node.attrs ?? {};
206
210
  return {
207
- _type: attrStr(node.attrs, "blockType") || "embed",
211
+ ...(data && typeof data === "object" ? data : {}),
212
+ _type: typeof blockType === "string" ? blockType : "embed",
208
213
  _key: k(),
209
- id: attrStr(node.attrs, "id"),
214
+ id: typeof id === "string" ? id : "",
210
215
  };
216
+ }
211
217
  default:
212
218
  return null;
213
219
  }
@@ -412,21 +418,23 @@ function convertPTBlock(block: PTBlock): JSONContent | null {
412
418
  },
413
419
  };
414
420
  }
415
- // Unknown block types — treat as plugin blocks if they have an id
416
- const embedBlock = block as { _type: string; url?: string; id?: string };
417
- if (embedBlock.id || embedBlock.url) {
418
- return {
419
- type: "pluginBlock",
420
- attrs: {
421
- blockType: block._type,
422
- id: embedBlock.id || embedBlock.url || "",
423
- },
424
- };
425
- }
426
- // Truly unknown — render as code-marked text
421
+ // Unknown block types — treat as plugin blocks. Capture every field other
422
+ // than the well-known ones into `data` so the block round-trips losslessly,
423
+ // even if no plugin currently registers this type. Matches the admin
424
+ // editor's behaviour at PortableTextEditor.tsx:572-588.
425
+ const { _type, _key, id, url, ...rest } = block as { _type: string; _key: string } & Record<
426
+ string,
427
+ unknown
428
+ >;
429
+ // Filter out _-prefixed keys to prevent accumulation across edit cycles.
430
+ const data = Object.fromEntries(Object.entries(rest).filter(([key]) => !key.startsWith("_")));
427
431
  return {
428
- type: "paragraph",
429
- content: [{ type: "text", text: `[${block._type}]`, marks: [{ type: "code" }] }],
432
+ type: "pluginBlock",
433
+ attrs: {
434
+ blockType: typeof _type === "string" ? _type : "embed",
435
+ id: typeof id === "string" ? id : typeof url === "string" ? url : "",
436
+ data,
437
+ },
430
438
  };
431
439
  }
432
440
 
@@ -762,6 +770,61 @@ const initialSlashMenuState: SlashMenuState = {
762
770
  range: null,
763
771
  };
764
772
 
773
+ /**
774
+ * Minimal `pluginBlock` TipTap node for the inline (visual-editing) editor.
775
+ *
776
+ * Plugin-contributed Portable Text block types (e.g. `marketing.hero`) are
777
+ * editable in the admin via a Block Kit modal. The visual-editing surface
778
+ * deliberately does NOT offer that UX — it would need to fetch the manifest,
779
+ * mount the modal, and round-trip through plugin-block plumbing that lives in
780
+ * `@emdash-cms/admin`. Instead, the inline editor renders these blocks as a
781
+ * read-only placeholder so editors can see they exist and edit the surrounding
782
+ * content without losing the block's data.
783
+ *
784
+ * The full block payload is preserved on `data` and round-tripped losslessly
785
+ * through PT ↔ PM conversion (see convertPTBlock/convertPMNode). Without this
786
+ * extension, ProseMirror's schema would silently filter unknown nodes on load
787
+ * and the next save would persist the block's disappearance.
788
+ */
789
+ const PluginBlockNode = Node.create({
790
+ name: "pluginBlock",
791
+ group: "block",
792
+ atom: true,
793
+ selectable: true,
794
+ draggable: true,
795
+
796
+ addAttributes() {
797
+ // All three attributes are stored on the ProseMirror node but not
798
+ // rendered as DOM attributes — they're metadata for the round-trip,
799
+ // not styling or behaviour the placeholder DOM needs to expose.
800
+ const noDom = { rendered: false, parseHTML: () => null };
801
+ return {
802
+ blockType: { default: "", ...noDom },
803
+ id: { default: "", ...noDom },
804
+ data: { default: {}, ...noDom },
805
+ };
806
+ },
807
+
808
+ parseHTML() {
809
+ return [{ tag: 'div[data-emdash-plugin-block="true"]' }];
810
+ },
811
+
812
+ renderHTML({ HTMLAttributes, node }) {
813
+ const blockType = typeof node.attrs.blockType === "string" ? node.attrs.blockType : "";
814
+ const label = blockType || "Block";
815
+ return [
816
+ "div",
817
+ mergeAttributes(HTMLAttributes, {
818
+ "data-emdash-plugin-block": "true",
819
+ "data-block-type": blockType,
820
+ class: "emdash-plugin-block-placeholder",
821
+ contenteditable: "false",
822
+ }),
823
+ `Plugin block: ${label} (edit in admin)`,
824
+ ];
825
+ },
826
+ });
827
+
765
828
  function createSlashCommandsExtension(options: {
766
829
  filterCommands: (query: string) => SlashCommandItem[];
767
830
  onStateChange: React.Dispatch<React.SetStateAction<SlashMenuState>>;
@@ -1734,6 +1797,7 @@ export function InlinePortableTextEditor({
1734
1797
  mode: "all",
1735
1798
  }),
1736
1799
  Typography,
1800
+ PluginBlockNode,
1737
1801
  slashCommandsExtension,
1738
1802
  ],
1739
1803
  content: initialContent,
@@ -1741,6 +1805,7 @@ export function InlinePortableTextEditor({
1741
1805
  editorProps: {
1742
1806
  attributes: {
1743
1807
  class: "prose prose-sm sm:prose-base dark:prose-invert max-w-none emdash-inline-editor",
1808
+ dir: "auto",
1744
1809
  },
1745
1810
  },
1746
1811
  onUpdate: () => {
@@ -1795,7 +1860,7 @@ export function InlinePortableTextEditor({
1795
1860
  // Don't save if focus moved to the slash menu (portalled to body)
1796
1861
  if (related?.closest(".emdash-slash-menu")) return;
1797
1862
  if (related?.closest(".emdash-media-picker")) return;
1798
- save();
1863
+ void save();
1799
1864
  },
1800
1865
  [save, mediaPickerOpen],
1801
1866
  );
@@ -1931,7 +1996,29 @@ export function InlinePortableTextEditor({
1931
1996
  .emdash-inline-editor:focus {
1932
1997
  outline: none;
1933
1998
  }
1999
+ .emdash-plugin-block-placeholder {
2000
+ margin: 0.75rem 0;
2001
+ padding: 0.625rem 0.875rem;
2002
+ border: 1px dashed #d1d5db;
2003
+ border-radius: 0.5rem;
2004
+ background: #f9fafb;
2005
+ color: #4b5563;
2006
+ font-size: 0.875rem;
2007
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
2008
+ user-select: none;
2009
+ }
2010
+ @media (prefers-color-scheme: dark) {
2011
+ .emdash-plugin-block-placeholder {
2012
+ border-color: #374151;
2013
+ background: #111827;
2014
+ color: #9ca3af;
2015
+ }
2016
+ }
1934
2017
  `}</style>
1935
2018
  </div>
1936
2019
  );
1937
2020
  }
2021
+
2022
+ // Test-only exports for unit tests of the conversion functions.
2023
+ export { pmToPortableText as _pmToPortableText };
2024
+ export { portableTextToPM as _portableTextToPM };
@@ -109,13 +109,6 @@ const config = {
109
109
  </emdash-live-search>
110
110
 
111
111
  <script>
112
- // Sanitization patterns for search snippets (allow only <mark> tags from FTS5)
113
- const SNIPPET_AMP_RE = /&/g;
114
- const SNIPPET_LT_RE = /</g;
115
- const SNIPPET_GT_RE = />/g;
116
- const SNIPPET_MARK_OPEN_RE = /&lt;mark&gt;/g;
117
- const SNIPPET_MARK_CLOSE_RE = /&lt;\/mark&gt;/g;
118
-
119
112
  interface SearchResult {
120
113
  collection: string;
121
114
  id: string;
@@ -396,17 +389,15 @@ const config = {
396
389
  collectionEl.textContent = result.collection;
397
390
  }
398
391
 
399
- // Fill in snippet (sanitize to allow only <mark> tags from FTS5 highlighting)
392
+ // Snippets returned by /api/search are already sanitised
393
+ // server-side by sanitizeSnippet() — they contain only
394
+ // HTML-escaped text plus literal <mark>...</mark> tags
395
+ // around matched terms.
400
396
  const snippetEl = link.querySelector(
401
397
  ".emdash-live-search-result-snippet"
402
398
  );
403
399
  if (snippetEl && this.config.showSnippets && result.snippet) {
404
- snippetEl.innerHTML = result.snippet
405
- .replace(SNIPPET_AMP_RE, "&amp;")
406
- .replace(SNIPPET_LT_RE, "&lt;")
407
- .replace(SNIPPET_GT_RE, "&gt;")
408
- .replace(SNIPPET_MARK_OPEN_RE, "<mark>")
409
- .replace(SNIPPET_MARK_CLOSE_RE, "</mark>");
400
+ snippetEl.innerHTML = result.snippet;
410
401
  } else if (snippetEl) {
411
402
  snippetEl.remove();
412
403
  }