emdash 0.5.0 → 0.7.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 (252) hide show
  1. package/dist/{adapters-C2BzVy0p.d.mts → adapters-Di31kZ28.d.mts} +16 -1
  2. package/dist/adapters-Di31kZ28.d.mts.map +1 -0
  3. package/dist/{apply-Cma_PiF6.mjs → apply-5uslYdUu.mjs} +197 -25
  4. package/dist/apply-5uslYdUu.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 +203 -33
  8. package/dist/astro/index.mjs.map +1 -1
  9. package/dist/astro/middleware/auth.d.mts +5 -5
  10. package/dist/astro/middleware/auth.d.mts.map +1 -1
  11. package/dist/astro/middleware/auth.mjs +30 -4
  12. package/dist/astro/middleware/auth.mjs.map +1 -1
  13. package/dist/astro/middleware/redirect.mjs +2 -2
  14. package/dist/astro/middleware/request-context.d.mts.map +1 -1
  15. package/dist/astro/middleware/request-context.mjs +11 -4
  16. package/dist/astro/middleware/request-context.mjs.map +1 -1
  17. package/dist/astro/middleware/setup.mjs +1 -1
  18. package/dist/astro/middleware.d.mts.map +1 -1
  19. package/dist/astro/middleware.mjs +467 -186
  20. package/dist/astro/middleware.mjs.map +1 -1
  21. package/dist/astro/types.d.mts +17 -9
  22. package/dist/astro/types.d.mts.map +1 -1
  23. package/dist/{byline-WuOq9MFJ.mjs → byline-C4OVd8b3.mjs} +3 -19
  24. package/dist/byline-C4OVd8b3.mjs.map +1 -0
  25. package/dist/{bylines-C_Wsnz4L.mjs → bylines-hPTW79hw.mjs} +20 -33
  26. package/dist/bylines-hPTW79hw.mjs.map +1 -0
  27. package/dist/{cache-E3Dts-yT.mjs → cache-BkKBuIvS.mjs} +1 -1
  28. package/dist/{cache-E3Dts-yT.mjs.map → cache-BkKBuIvS.mjs.map} +1 -1
  29. package/dist/chunks-HGz06Soa.mjs +19 -0
  30. package/dist/chunks-HGz06Soa.mjs.map +1 -0
  31. package/dist/cli/index.mjs +12 -11
  32. package/dist/cli/index.mjs.map +1 -1
  33. package/dist/client/cf-access.d.mts +1 -1
  34. package/dist/client/index.d.mts +1 -1
  35. package/dist/client/index.mjs +1 -1
  36. package/dist/{config-DkxPrM9l.mjs → config-BXwuX8Bx.mjs} +1 -1
  37. package/dist/{config-DkxPrM9l.mjs.map → config-BXwuX8Bx.mjs.map} +1 -1
  38. package/dist/{connection-B4zVnQIa.mjs → connection-2igzM-AT.mjs} +19 -2
  39. package/dist/connection-2igzM-AT.mjs.map +1 -0
  40. package/dist/{content-BsBoyj8G.mjs → content-D7J5y73J.mjs} +27 -1
  41. package/dist/{content-BsBoyj8G.mjs.map → content-D7J5y73J.mjs.map} +1 -1
  42. package/dist/database/instrumentation.d.mts +45 -0
  43. package/dist/database/instrumentation.d.mts.map +1 -0
  44. package/dist/database/instrumentation.mjs +61 -0
  45. package/dist/database/instrumentation.mjs.map +1 -0
  46. package/dist/db/index.d.mts +3 -3
  47. package/dist/db/index.mjs +1 -1
  48. package/dist/db/index.mjs.map +1 -1
  49. package/dist/db/libsql.d.mts +1 -1
  50. package/dist/db/postgres.d.mts +1 -1
  51. package/dist/db/sqlite.d.mts +1 -1
  52. package/dist/db-errors-D0UT85nC.mjs +41 -0
  53. package/dist/db-errors-D0UT85nC.mjs.map +1 -0
  54. package/dist/{default-PUx9RK6u.mjs → default-CME5YdZ3.mjs} +1 -1
  55. package/dist/{default-PUx9RK6u.mjs.map → default-CME5YdZ3.mjs.map} +1 -1
  56. package/dist/{error-HBeQbVhV.mjs → error-CiYn9yDu.mjs} +1 -1
  57. package/dist/{error-HBeQbVhV.mjs.map → error-CiYn9yDu.mjs.map} +1 -1
  58. package/dist/{index-CCWzlriB.d.mts → index-De6_Xv3v.d.mts} +209 -19
  59. package/dist/index-De6_Xv3v.d.mts.map +1 -0
  60. package/dist/index.d.mts +11 -11
  61. package/dist/index.mjs +23 -21
  62. package/dist/{load-BhSSm-TS.mjs → load-CBcmDIot.mjs} +1 -1
  63. package/dist/{load-BhSSm-TS.mjs.map → load-CBcmDIot.mjs.map} +1 -1
  64. package/dist/{loader-BYzwzORf.mjs → loader-DeiBJEMe.mjs} +18 -12
  65. package/dist/loader-DeiBJEMe.mjs.map +1 -0
  66. package/dist/{manifest-schema-BsXINkQD.mjs → manifest-schema-V30qsMft.mjs} +1 -1
  67. package/dist/{manifest-schema-BsXINkQD.mjs.map → manifest-schema-V30qsMft.mjs.map} +1 -1
  68. package/dist/media/index.d.mts +1 -1
  69. package/dist/media/index.mjs +1 -1
  70. package/dist/media/local-runtime.d.mts +7 -7
  71. package/dist/{mode-CyPLdO3C.mjs → mode-CpNnGkPz.mjs} +1 -1
  72. package/dist/{mode-CyPLdO3C.mjs.map → mode-CpNnGkPz.mjs.map} +1 -1
  73. package/dist/page/index.d.mts +11 -2
  74. package/dist/page/index.d.mts.map +1 -1
  75. package/dist/page/index.mjs +23 -1
  76. package/dist/page/index.mjs.map +1 -1
  77. package/dist/{placeholder-DntBEQo7.mjs → placeholder-C-fk5hYI.mjs} +1 -1
  78. package/dist/{placeholder-DntBEQo7.mjs.map → placeholder-C-fk5hYI.mjs.map} +1 -1
  79. package/dist/{placeholder-BBCtpTES.d.mts → placeholder-tzpqGWII.d.mts} +1 -1
  80. package/dist/{placeholder-BBCtpTES.d.mts.map → placeholder-tzpqGWII.d.mts.map} +1 -1
  81. package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
  82. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  83. package/dist/{query-B6Vu0d2i.mjs → query-g4Ug-9j9.mjs} +79 -12
  84. package/dist/query-g4Ug-9j9.mjs.map +1 -0
  85. package/dist/{redirect-7lGhLBNZ.mjs → redirect-CN0Rt9Ob.mjs} +66 -10
  86. package/dist/redirect-CN0Rt9Ob.mjs.map +1 -0
  87. package/dist/{registry-BgnP3ysR.mjs → registry-Ci3WxVAr.mjs} +133 -97
  88. package/dist/registry-Ci3WxVAr.mjs.map +1 -0
  89. package/dist/request-cache-DiR961CV.mjs +79 -0
  90. package/dist/request-cache-DiR961CV.mjs.map +1 -0
  91. package/dist/request-context.d.mts +19 -16
  92. package/dist/request-context.d.mts.map +1 -1
  93. package/dist/request-context.mjs.map +1 -1
  94. package/dist/{runner-DYv3rX8P.d.mts → runner-BR2xKwhn.d.mts} +2 -2
  95. package/dist/{runner-DYv3rX8P.d.mts.map → runner-BR2xKwhn.d.mts.map} +1 -1
  96. package/dist/{runner-Cd-_WyDo.mjs → runner-tQ7BJ4T7.mjs} +211 -134
  97. package/dist/runner-tQ7BJ4T7.mjs.map +1 -0
  98. package/dist/runtime.d.mts +6 -6
  99. package/dist/runtime.mjs +1 -1
  100. package/dist/{search-Cn1SYvYF.mjs → search-B0effn3j.mjs} +210 -226
  101. package/dist/search-B0effn3j.mjs.map +1 -0
  102. package/dist/seed/index.d.mts +2 -2
  103. package/dist/seed/index.mjs +10 -9
  104. package/dist/seo/index.d.mts +1 -1
  105. package/dist/storage/local.d.mts +1 -1
  106. package/dist/storage/local.mjs +1 -1
  107. package/dist/storage/s3.d.mts +1 -1
  108. package/dist/storage/s3.mjs +1 -1
  109. package/dist/taxonomies-K2z0Uhnj.mjs +308 -0
  110. package/dist/taxonomies-K2z0Uhnj.mjs.map +1 -0
  111. package/dist/{tokens-DKHiCYCB.mjs → tokens-BFPFx3CA.mjs} +1 -1
  112. package/dist/{tokens-DKHiCYCB.mjs.map → tokens-BFPFx3CA.mjs.map} +1 -1
  113. package/dist/{transport-BtcQ-Z7T.mjs → transport-BykRfpyy.mjs} +1 -1
  114. package/dist/{transport-BtcQ-Z7T.mjs.map → transport-BykRfpyy.mjs.map} +1 -1
  115. package/dist/{transport-CKQA_G44.d.mts → transport-H4Iwx7tC.d.mts} +1 -1
  116. package/dist/{transport-CKQA_G44.d.mts.map → transport-H4Iwx7tC.d.mts.map} +1 -1
  117. package/dist/{types-BmkQR1En.d.mts → types-6CUZRrZP.d.mts} +1 -1
  118. package/dist/{types-BmkQR1En.d.mts.map → types-6CUZRrZP.d.mts.map} +1 -1
  119. package/dist/{types-Dz9_WMS6.mjs → types-BH2L167P.mjs} +1 -1
  120. package/dist/{types-Dz9_WMS6.mjs.map → types-BH2L167P.mjs.map} +1 -1
  121. package/dist/{types-B6BzlZxx.d.mts → types-C2v0c34j.d.mts} +10 -1
  122. package/dist/{types-B6BzlZxx.d.mts.map → types-C2v0c34j.d.mts.map} +1 -1
  123. package/dist/{types-DNZpaCBk.d.mts → types-CFWjXmus.d.mts} +1 -1
  124. package/dist/{types-DNZpaCBk.d.mts.map → types-CFWjXmus.d.mts.map} +1 -1
  125. package/dist/{types-DeG21anB.d.mts → types-CnZYHyLW.d.mts} +55 -5
  126. package/dist/types-CnZYHyLW.d.mts.map +1 -0
  127. package/dist/{types-xxCWI3j0.mjs → types-DDS4MxsT.mjs} +11 -3
  128. package/dist/types-DDS4MxsT.mjs.map +1 -0
  129. package/dist/{types-C3ronwXb.d.mts → types-DgrIP0tF.d.mts} +102 -4
  130. package/dist/types-DgrIP0tF.d.mts.map +1 -0
  131. package/dist/{validate-DuZDIxfy.mjs → validate-CqsNItbt.mjs} +2 -2
  132. package/dist/{validate-DuZDIxfy.mjs.map → validate-CqsNItbt.mjs.map} +1 -1
  133. package/dist/{validate-Db1yNL3i.d.mts → validate-kM8Pjuf7.d.mts} +5 -52
  134. package/dist/validate-kM8Pjuf7.d.mts.map +1 -0
  135. package/dist/version-BnTKdfam.mjs +7 -0
  136. package/dist/{version-CMMjTuqu.mjs.map → version-BnTKdfam.mjs.map} +1 -1
  137. package/package.json +10 -5
  138. package/src/after.ts +62 -0
  139. package/src/api/handlers/content.ts +2 -0
  140. package/src/api/handlers/oauth-authorization.ts +2 -32
  141. package/src/api/handlers/oauth-clients.ts +40 -4
  142. package/src/api/handlers/taxonomies.ts +13 -0
  143. package/src/api/oauth/redirect-uri.ts +34 -0
  144. package/src/api/openapi/document.ts +126 -118
  145. package/src/api/schemas/content.ts +8 -0
  146. package/src/api/schemas/media.ts +26 -15
  147. package/src/api/schemas/schema.ts +1 -0
  148. package/src/astro/integration/font-provider.ts +178 -0
  149. package/src/astro/integration/index.ts +44 -0
  150. package/src/astro/integration/routes.ts +6 -0
  151. package/src/astro/integration/runtime.ts +117 -0
  152. package/src/astro/integration/virtual-modules.ts +41 -39
  153. package/src/astro/integration/vite-config.ts +16 -5
  154. package/src/astro/middleware/auth.ts +33 -1
  155. package/src/astro/middleware/request-context.ts +15 -3
  156. package/src/astro/middleware.ts +340 -263
  157. package/src/astro/routes/admin.astro +21 -10
  158. package/src/astro/routes/api/auth/magic-link/send.ts +2 -1
  159. package/src/astro/routes/api/auth/passkey/options.ts +2 -1
  160. package/src/astro/routes/api/auth/passkey/verify.ts +5 -1
  161. package/src/astro/routes/api/auth/signup/request.ts +26 -8
  162. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +10 -6
  163. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +1 -1
  164. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +1 -1
  165. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +1 -1
  166. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +5 -0
  167. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +26 -0
  168. package/src/astro/routes/api/content/[collection]/[id].ts +30 -2
  169. package/src/astro/routes/api/content/[collection]/index.ts +19 -1
  170. package/src/astro/routes/api/content/[collection]/trash.ts +1 -1
  171. package/src/astro/routes/api/import/wordpress/execute.ts +1 -1
  172. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +4 -3
  173. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +5 -4
  174. package/src/astro/routes/api/manifest.ts +7 -0
  175. package/src/astro/routes/api/media/upload-url.ts +10 -2
  176. package/src/astro/routes/api/media.ts +10 -7
  177. package/src/astro/routes/api/oauth/device/code.ts +2 -1
  178. package/src/astro/routes/api/oauth/device/token.ts +2 -1
  179. package/src/astro/routes/api/oauth/register.ts +178 -0
  180. package/src/astro/routes/api/oauth/token.ts +15 -0
  181. package/src/astro/routes/api/openapi.json.ts +15 -5
  182. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +2 -0
  183. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +1 -0
  184. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +1 -0
  185. package/src/astro/routes/api/search/index.ts +5 -0
  186. package/src/astro/routes/api/search/suggest.ts +3 -0
  187. package/src/astro/routes/api/setup/admin-verify.ts +30 -5
  188. package/src/astro/routes/api/setup/admin.ts +32 -8
  189. package/src/astro/routes/api/setup/index.ts +5 -2
  190. package/src/astro/routes/api/taxonomies/index.ts +1 -0
  191. package/src/astro/routes/api/well-known/oauth-authorization-server.ts +1 -1
  192. package/src/astro/types.ts +9 -0
  193. package/src/auth/rate-limit.ts +50 -22
  194. package/src/auth/setup-nonce.ts +22 -0
  195. package/src/auth/trusted-proxy.ts +92 -0
  196. package/src/bylines/index.ts +22 -45
  197. package/src/components/EmDashHead.astro +23 -7
  198. package/src/database/connection.ts +23 -1
  199. package/src/database/instrumentation.ts +98 -0
  200. package/src/database/migrations/035_bounded_404_log.ts +112 -0
  201. package/src/database/migrations/runner.ts +2 -0
  202. package/src/database/repositories/content.ts +39 -0
  203. package/src/database/repositories/options.ts +25 -0
  204. package/src/database/repositories/redirect.ts +111 -8
  205. package/src/database/types.ts +9 -0
  206. package/src/db/adapters.ts +15 -0
  207. package/src/emdash-runtime.ts +312 -92
  208. package/src/import/registry.ts +4 -3
  209. package/src/import/ssrf.ts +253 -12
  210. package/src/index.ts +6 -0
  211. package/src/loader.ts +19 -24
  212. package/src/mcp/server.ts +76 -3
  213. package/src/menus/index.ts +6 -3
  214. package/src/page/index.ts +1 -1
  215. package/src/page/seo-contributions.ts +36 -0
  216. package/src/plugins/context.ts +15 -3
  217. package/src/plugins/manager.ts +6 -0
  218. package/src/plugins/request-meta.ts +66 -15
  219. package/src/plugins/routes.ts +3 -1
  220. package/src/query.ts +104 -7
  221. package/src/request-cache.ts +106 -0
  222. package/src/request-context.ts +19 -0
  223. package/src/schema/query.ts +5 -2
  224. package/src/schema/registry.ts +243 -166
  225. package/src/schema/types.ts +13 -2
  226. package/src/schema/zod-generator.ts +4 -0
  227. package/src/search/fts-manager.ts +19 -5
  228. package/src/search/query.ts +4 -3
  229. package/src/seed/apply.ts +41 -1
  230. package/src/settings/index.ts +24 -5
  231. package/src/taxonomies/index.ts +324 -124
  232. package/src/utils/db-errors.ts +46 -0
  233. package/src/virtual-modules.d.ts +31 -10
  234. package/src/visual-editing/toolbar.ts +6 -1
  235. package/src/widgets/index.ts +54 -25
  236. package/dist/adapters-C2BzVy0p.d.mts.map +0 -1
  237. package/dist/apply-Cma_PiF6.mjs.map +0 -1
  238. package/dist/byline-WuOq9MFJ.mjs.map +0 -1
  239. package/dist/bylines-C_Wsnz4L.mjs.map +0 -1
  240. package/dist/connection-B4zVnQIa.mjs.map +0 -1
  241. package/dist/index-CCWzlriB.d.mts.map +0 -1
  242. package/dist/loader-BYzwzORf.mjs.map +0 -1
  243. package/dist/query-B6Vu0d2i.mjs.map +0 -1
  244. package/dist/redirect-7lGhLBNZ.mjs.map +0 -1
  245. package/dist/registry-BgnP3ysR.mjs.map +0 -1
  246. package/dist/runner-Cd-_WyDo.mjs.map +0 -1
  247. package/dist/search-Cn1SYvYF.mjs.map +0 -1
  248. package/dist/types-C3ronwXb.d.mts.map +0 -1
  249. package/dist/types-DeG21anB.d.mts.map +0 -1
  250. package/dist/types-xxCWI3j0.mjs.map +0 -1
  251. package/dist/validate-Db1yNL3i.d.mts.map +0 -1
  252. package/dist/version-CMMjTuqu.mjs +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"validate-DuZDIxfy.mjs","names":[],"sources":["../src/seed/validate.ts"],"sourcesContent":["/**\n * Seed file validation\n *\n * Validates a seed file structure before applying it.\n */\n\nimport { FIELD_TYPES } from \"../schema/types.js\";\nimport type { SeedFile, SeedMenuItem, ValidationResult } from \"./types.js\";\n\nconst COLLECTION_FIELD_SLUG_PATTERN = /^[a-z][a-z0-9_]*$/;\nconst SLUG_PATTERN = /^[a-z0-9-]+$/;\nconst REDIRECT_TYPES = new Set([301, 302, 307, 308]);\nconst CRLF_PATTERN = /[\\r\\n]/;\n\n/** Type guard for Record<string, unknown> */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isValidRedirectPath(path: string): boolean {\n\tif (!path.startsWith(\"/\") || path.startsWith(\"//\") || CRLF_PATTERN.test(path)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn !decodeURIComponent(path).split(\"/\").includes(\"..\");\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Validate a seed file\n *\n * @param data - Unknown data to validate as a seed file\n * @returns Validation result with errors and warnings\n */\nexport function validateSeed(data: unknown): ValidationResult {\n\tconst errors: string[] = [];\n\tconst warnings: string[] = [];\n\n\t// Basic type check\n\tif (!data || typeof data !== \"object\") {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [\"Seed must be an object\"],\n\t\t\twarnings: [],\n\t\t};\n\t}\n\n\tconst seed = data as Partial<SeedFile>;\n\n\t// Required fields\n\tif (!seed.version) {\n\t\terrors.push(\"Seed must have a version field\");\n\t} else if (seed.version !== \"1\") {\n\t\terrors.push(`Unsupported seed version: ${String(seed.version)}`);\n\t}\n\n\t// Validate collections\n\tif (seed.collections) {\n\t\tif (!Array.isArray(seed.collections)) {\n\t\t\terrors.push(\"collections must be an array\");\n\t\t} else {\n\t\t\tconst collectionSlugs = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.collections.length; i++) {\n\t\t\t\tconst collection = seed.collections[i];\n\t\t\t\tconst prefix = `collections[${i}]`;\n\n\t\t\t\tif (!collection.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for valid slug format\n\t\t\t\t\tif (!COLLECTION_FIELD_SLUG_PATTERN.test(collection.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must start with a letter and contain only lowercase letters, numbers, and underscores`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for duplicate slugs\n\t\t\t\t\tif (collectionSlugs.has(collection.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate collection slug \"${collection.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tcollectionSlugs.add(collection.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!collection.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\t// Validate fields\n\t\t\t\tif (!Array.isArray(collection.fields)) {\n\t\t\t\t\terrors.push(`${prefix}.fields: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tconst fieldSlugs = new Set<string>();\n\n\t\t\t\t\tfor (let j = 0; j < collection.fields.length; j++) {\n\t\t\t\t\t\tconst field = collection.fields[j];\n\t\t\t\t\t\tconst fieldPrefix = `${prefix}.fields[${j}]`;\n\n\t\t\t\t\t\tif (!field.slug) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: slug is required`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Check for valid slug format\n\t\t\t\t\t\t\tif (!COLLECTION_FIELD_SLUG_PATTERN.test(field.slug)) {\n\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t`${fieldPrefix}.slug: must start with a letter and contain only lowercase letters, numbers, and underscores`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Check for duplicate field slugs\n\t\t\t\t\t\t\tif (fieldSlugs.has(field.slug)) {\n\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t`${fieldPrefix}.slug: duplicate field slug \"${field.slug}\" in collection \"${collection.slug}\"`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfieldSlugs.add(field.slug);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!field.label) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: label is required`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!field.type) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: type is required`);\n\t\t\t\t\t\t} else if (!(FIELD_TYPES as readonly string[]).includes(field.type)) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}.type: unsupported field type \"${field.type}\"`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate taxonomies\n\tif (seed.taxonomies) {\n\t\tif (!Array.isArray(seed.taxonomies)) {\n\t\t\terrors.push(\"taxonomies must be an array\");\n\t\t} else {\n\t\t\tconst taxonomyNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.taxonomies.length; i++) {\n\t\t\t\tconst taxonomy = seed.taxonomies[i];\n\t\t\t\tconst prefix = `taxonomies[${i}]`;\n\n\t\t\t\tif (!taxonomy.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate taxonomy names\n\t\t\t\t\tif (taxonomyNames.has(taxonomy.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate taxonomy name \"${taxonomy.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\ttaxonomyNames.add(taxonomy.name);\n\t\t\t\t}\n\n\t\t\t\tif (!taxonomy.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (taxonomy.hierarchical === undefined) {\n\t\t\t\t\terrors.push(`${prefix}: hierarchical is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(taxonomy.collections)) {\n\t\t\t\t\terrors.push(`${prefix}.collections: must be an array`);\n\t\t\t\t} else if (taxonomy.collections.length === 0) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t`${prefix}.collections: taxonomy \"${taxonomy.name}\" is not assigned to any collections`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Validate terms if present\n\t\t\t\tif (taxonomy.terms) {\n\t\t\t\t\tif (!Array.isArray(taxonomy.terms)) {\n\t\t\t\t\t\terrors.push(`${prefix}.terms: must be an array`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst termSlugs = new Set<string>();\n\n\t\t\t\t\t\tfor (let j = 0; j < taxonomy.terms.length; j++) {\n\t\t\t\t\t\t\tconst term = taxonomy.terms[j];\n\t\t\t\t\t\t\tconst termPrefix = `${prefix}.terms[${j}]`;\n\n\t\t\t\t\t\t\tif (!term.slug) {\n\t\t\t\t\t\t\t\terrors.push(`${termPrefix}: slug is required`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Check for duplicate term slugs\n\t\t\t\t\t\t\t\tif (termSlugs.has(term.slug)) {\n\t\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t\t`${termPrefix}.slug: duplicate term slug \"${term.slug}\" in taxonomy \"${taxonomy.name}\"`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttermSlugs.add(term.slug);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!term.label) {\n\t\t\t\t\t\t\t\terrors.push(`${termPrefix}: label is required`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Check parent reference validity (for hierarchical taxonomies)\n\t\t\t\t\t\t\tif (term.parent && taxonomy.hierarchical) {\n\t\t\t\t\t\t\t\t// Parent will be validated in a second pass\n\t\t\t\t\t\t\t} else if (term.parent && !taxonomy.hierarchical) {\n\t\t\t\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t\t\t\t`${termPrefix}.parent: taxonomy \"${taxonomy.name}\" is not hierarchical, parent will be ignored`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Second pass: validate parent references\n\t\t\t\t\t\tif (taxonomy.hierarchical && taxonomy.terms) {\n\t\t\t\t\t\t\tfor (let j = 0; j < taxonomy.terms.length; j++) {\n\t\t\t\t\t\t\t\tconst term = taxonomy.terms[j];\n\t\t\t\t\t\t\t\tif (term.parent && !termSlugs.has(term.parent)) {\n\t\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t\t`${prefix}.terms[${j}].parent: parent term \"${term.parent}\" not found in taxonomy`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Check for circular references\n\t\t\t\t\t\t\t\tif (term.parent === term.slug) {\n\t\t\t\t\t\t\t\t\terrors.push(`${prefix}.terms[${j}].parent: term cannot be its own parent`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate menus\n\tif (seed.menus) {\n\t\tif (!Array.isArray(seed.menus)) {\n\t\t\terrors.push(\"menus must be an array\");\n\t\t} else {\n\t\t\tconst menuNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.menus.length; i++) {\n\t\t\t\tconst menu = seed.menus[i];\n\t\t\t\tconst prefix = `menus[${i}]`;\n\n\t\t\t\tif (!menu.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate menu names\n\t\t\t\t\tif (menuNames.has(menu.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate menu name \"${menu.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tmenuNames.add(menu.name);\n\t\t\t\t}\n\n\t\t\t\tif (!menu.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(menu.items)) {\n\t\t\t\t\terrors.push(`${prefix}.items: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tvalidateMenuItems(menu.items, prefix, errors, warnings);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate redirects\n\tif (seed.redirects) {\n\t\tif (!Array.isArray(seed.redirects)) {\n\t\t\terrors.push(\"redirects must be an array\");\n\t\t} else {\n\t\t\tconst redirectSources = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.redirects.length; i++) {\n\t\t\t\tconst redirect = seed.redirects[i];\n\t\t\t\tconst prefix = `redirects[${i}]`;\n\n\t\t\t\tif (!isRecord(redirect)) {\n\t\t\t\t\terrors.push(`${prefix}: must be an object`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst source = typeof redirect.source === \"string\" ? redirect.source : undefined;\n\t\t\t\tconst destination =\n\t\t\t\t\ttypeof redirect.destination === \"string\" ? redirect.destination : undefined;\n\n\t\t\t\tif (!source) {\n\t\t\t\t\terrors.push(`${prefix}: source is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!isValidRedirectPath(source)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.source: must be a path starting with / (no protocol-relative URLs, path traversal, or newlines)`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (redirectSources.has(source)) {\n\t\t\t\t\t\terrors.push(`${prefix}.source: duplicate redirect source \"${source}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tredirectSources.add(source);\n\t\t\t\t}\n\n\t\t\t\tif (!destination) {\n\t\t\t\t\terrors.push(`${prefix}: destination is required`);\n\t\t\t\t} else if (!isValidRedirectPath(destination)) {\n\t\t\t\t\terrors.push(\n\t\t\t\t\t\t`${prefix}.destination: must be a path starting with / (no protocol-relative URLs, path traversal, or newlines)`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (redirect.type !== undefined) {\n\t\t\t\t\tif (typeof redirect.type !== \"number\" || !REDIRECT_TYPES.has(redirect.type)) {\n\t\t\t\t\t\terrors.push(`${prefix}.type: must be 301, 302, 307, or 308`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (redirect.enabled !== undefined && typeof redirect.enabled !== \"boolean\") {\n\t\t\t\t\terrors.push(`${prefix}.enabled: must be a boolean`);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tredirect.groupName !== undefined &&\n\t\t\t\t\ttypeof redirect.groupName !== \"string\" &&\n\t\t\t\t\tredirect.groupName !== null\n\t\t\t\t) {\n\t\t\t\t\terrors.push(`${prefix}.groupName: must be a string or null`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate widget areas\n\tif (seed.widgetAreas) {\n\t\tif (!Array.isArray(seed.widgetAreas)) {\n\t\t\terrors.push(\"widgetAreas must be an array\");\n\t\t} else {\n\t\t\tconst areaNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.widgetAreas.length; i++) {\n\t\t\t\tconst area = seed.widgetAreas[i];\n\t\t\t\tconst prefix = `widgetAreas[${i}]`;\n\n\t\t\t\tif (!area.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate area names\n\t\t\t\t\tif (areaNames.has(area.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate widget area name \"${area.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tareaNames.add(area.name);\n\t\t\t\t}\n\n\t\t\t\tif (!area.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(area.widgets)) {\n\t\t\t\t\terrors.push(`${prefix}.widgets: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tfor (let j = 0; j < area.widgets.length; j++) {\n\t\t\t\t\t\tconst widget = area.widgets[j];\n\t\t\t\t\t\tconst widgetPrefix = `${prefix}.widgets[${j}]`;\n\n\t\t\t\t\t\tif (!widget.type) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: type is required`);\n\t\t\t\t\t\t} else if (![\"content\", \"menu\", \"component\"].includes(widget.type)) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}.type: must be \"content\", \"menu\", or \"component\"`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Type-specific validation\n\t\t\t\t\t\tif (widget.type === \"menu\" && !widget.menuName) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: menuName is required for menu widgets`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (widget.type === \"component\" && !widget.componentId) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: componentId is required for component widgets`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate sections\n\tif (seed.sections) {\n\t\tif (!Array.isArray(seed.sections)) {\n\t\t\terrors.push(\"sections must be an array\");\n\t\t} else {\n\t\t\tconst sectionSlugs = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.sections.length; i++) {\n\t\t\t\tconst section = seed.sections[i];\n\t\t\t\tconst prefix = `sections[${i}]`;\n\n\t\t\t\tif (!section.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!SLUG_PATTERN.test(section.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must contain only lowercase letters, numbers, and hyphens`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (sectionSlugs.has(section.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate section slug \"${section.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tsectionSlugs.add(section.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!section.title) {\n\t\t\t\t\terrors.push(`${prefix}: title is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(section.content)) {\n\t\t\t\t\terrors.push(`${prefix}.content: must be an array`);\n\t\t\t\t}\n\n\t\t\t\t// Validate source\n\t\t\t\tif (section.source && ![\"theme\", \"import\"].includes(section.source)) {\n\t\t\t\t\terrors.push(`${prefix}.source: must be \"theme\" or \"import\"`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate bylines\n\tif (seed.bylines) {\n\t\tif (!Array.isArray(seed.bylines)) {\n\t\t\terrors.push(\"bylines must be an array\");\n\t\t} else {\n\t\t\tconst bylineIds = new Set<string>();\n\t\t\tconst bylineSlugs = new Set<string>();\n\t\t\tfor (let i = 0; i < seed.bylines.length; i++) {\n\t\t\t\tconst byline = seed.bylines[i];\n\t\t\t\tconst prefix = `bylines[${i}]`;\n\n\t\t\t\tif (!byline.id) {\n\t\t\t\t\terrors.push(`${prefix}: id is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (bylineIds.has(byline.id)) {\n\t\t\t\t\t\terrors.push(`${prefix}.id: duplicate byline id \"${byline.id}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tbylineIds.add(byline.id);\n\t\t\t\t}\n\n\t\t\t\tif (!byline.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!SLUG_PATTERN.test(byline.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must contain only lowercase letters, numbers, and hyphens`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (bylineSlugs.has(byline.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate byline slug \"${byline.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tbylineSlugs.add(byline.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!byline.displayName) {\n\t\t\t\t\terrors.push(`${prefix}: displayName is required`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate content\n\tif (seed.content) {\n\t\tif (typeof seed.content !== \"object\" || Array.isArray(seed.content)) {\n\t\t\terrors.push(\"content must be an object (collection -> entries)\");\n\t\t} else {\n\t\t\tfor (const [collectionSlug, entries] of Object.entries(seed.content)) {\n\t\t\t\tif (!Array.isArray(entries)) {\n\t\t\t\t\terrors.push(`content.${collectionSlug}: must be an array`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst entryIds = new Set<string>();\n\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tconst prefix = `content.${collectionSlug}[${i}]`;\n\n\t\t\t\t\tif (!entry.id) {\n\t\t\t\t\t\terrors.push(`${prefix}: id is required`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Check for duplicate entry IDs\n\t\t\t\t\t\tif (entryIds.has(entry.id)) {\n\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t`${prefix}.id: duplicate entry id \"${entry.id}\" in collection \"${collectionSlug}\"`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tentryIds.add(entry.id);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!entry.slug) {\n\t\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!entry.data || typeof entry.data !== \"object\") {\n\t\t\t\t\t\terrors.push(`${prefix}: data must be an object`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Validate i18n fields\n\t\t\t\t\tif (entry.translationOf) {\n\t\t\t\t\t\tif (!entry.locale) {\n\t\t\t\t\t\t\terrors.push(`${prefix}: locale is required when translationOf is set`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Second pass: validate translationOf references within this collection\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.translationOf && !entryIds.has(entry.translationOf)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`content.${collectionSlug}[${i}].translationOf: references \"${entry.translationOf}\" which is not in this collection`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate cross-references (content refs in menus)\n\tif (seed.menus && seed.content) {\n\t\tconst allContentIds = new Set<string>();\n\t\tfor (const entries of Object.values(seed.content)) {\n\t\t\tif (Array.isArray(entries)) {\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tif (entry.id) {\n\t\t\t\t\t\tallContentIds.add(entry.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check menu item refs\n\t\tfor (const menu of seed.menus) {\n\t\t\tif (Array.isArray(menu.items)) {\n\t\t\t\tvalidateMenuItemRefs(menu.items, allContentIds, warnings);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate byline refs in content\n\tif (seed.content) {\n\t\tconst seedBylineIds = new Set<string>((seed.bylines ?? []).map((byline) => byline.id));\n\t\tfor (const [collectionSlug, entries] of Object.entries(seed.content)) {\n\t\t\tif (!Array.isArray(entries)) continue;\n\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\tconst entry = entries[i];\n\t\t\t\tif (!entry.bylines) continue;\n\t\t\t\tif (!Array.isArray(entry.bylines)) {\n\t\t\t\t\terrors.push(`content.${collectionSlug}[${i}].bylines: must be an array`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (let j = 0; j < entry.bylines.length; j++) {\n\t\t\t\t\tconst credit = entry.bylines[j];\n\t\t\t\t\tconst prefix = `content.${collectionSlug}[${i}].bylines[${j}]`;\n\t\t\t\t\tif (!credit.byline) {\n\t\t\t\t\t\terrors.push(`${prefix}.byline: is required`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!seedBylineIds.has(credit.byline)) {\n\t\t\t\t\t\terrors.push(`${prefix}.byline: references unknown byline \"${credit.byline}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: errors.length === 0,\n\t\terrors,\n\t\twarnings,\n\t};\n}\n\n/**\n * Validate menu items recursively\n */\nfunction validateMenuItems(\n\titems: unknown[],\n\tprefix: string,\n\terrors: string[],\n\twarnings: string[],\n): void {\n\tfor (let i = 0; i < items.length; i++) {\n\t\tconst raw = items[i];\n\t\tconst itemPrefix = `${prefix}.items[${i}]`;\n\n\t\tif (!isRecord(raw)) {\n\t\t\terrors.push(`${itemPrefix}: must be an object`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst item = raw;\n\n\t\tconst itemType = typeof item.type === \"string\" ? item.type : undefined;\n\n\t\tif (!itemType) {\n\t\t\terrors.push(`${itemPrefix}: type is required`);\n\t\t} else if (![\"custom\", \"page\", \"post\", \"taxonomy\", \"collection\"].includes(itemType)) {\n\t\t\terrors.push(\n\t\t\t\t`${itemPrefix}.type: must be \"custom\", \"page\", \"post\", \"taxonomy\", or \"collection\"`,\n\t\t\t);\n\t\t}\n\n\t\t// Type-specific validation\n\t\tif (itemType === \"custom\" && !item.url) {\n\t\t\terrors.push(`${itemPrefix}: url is required for custom menu items`);\n\t\t}\n\n\t\tif ((itemType === \"page\" || itemType === \"post\") && !item.ref) {\n\t\t\terrors.push(`${itemPrefix}: ref is required for page/post menu items`);\n\t\t}\n\n\t\t// Validate children recursively\n\t\tif (Array.isArray(item.children)) {\n\t\t\tvalidateMenuItems(item.children, itemPrefix, errors, warnings);\n\t\t}\n\t}\n}\n\n/**\n * Validate menu item references exist in content\n */\nfunction validateMenuItemRefs(\n\titems: SeedMenuItem[],\n\tcontentIds: Set<string>,\n\twarnings: string[],\n): void {\n\tfor (const item of items) {\n\t\tif ((item.type === \"page\" || item.type === \"post\") && item.ref) {\n\t\t\tif (!contentIds.has(item.ref)) {\n\t\t\t\twarnings.push(`Menu item references content \"${item.ref}\" which is not in the seed file`);\n\t\t\t}\n\t\t}\n\n\t\tif (item.children) {\n\t\t\tvalidateMenuItemRefs(item.children, contentIds, warnings);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;AASA,MAAM,gCAAgC;AACtC,MAAM,eAAe;AACrB,MAAM,iBAAiB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAI,CAAC;AACpD,MAAM,eAAe;;AAGrB,SAAS,SAAS,OAAkD;AACnE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG5E,SAAS,oBAAoB,MAAuB;AACnD,KAAI,CAAC,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,KAAK,IAAI,aAAa,KAAK,KAAK,CAC5E,QAAO;AAGR,KAAI;AACH,SAAO,CAAC,mBAAmB,KAAK,CAAC,MAAM,IAAI,CAAC,SAAS,KAAK;SACnD;AACP,SAAO;;;;;;;;;AAUT,SAAgB,aAAa,MAAiC;CAC7D,MAAM,SAAmB,EAAE;CAC3B,MAAM,WAAqB,EAAE;AAG7B,KAAI,CAAC,QAAQ,OAAO,SAAS,SAC5B,QAAO;EACN,OAAO;EACP,QAAQ,CAAC,yBAAyB;EAClC,UAAU,EAAE;EACZ;CAGF,MAAM,OAAO;AAGb,KAAI,CAAC,KAAK,QACT,QAAO,KAAK,iCAAiC;UACnC,KAAK,YAAY,IAC3B,QAAO,KAAK,6BAA6B,OAAO,KAAK,QAAQ,GAAG;AAIjE,KAAI,KAAK,YACR,KAAI,CAAC,MAAM,QAAQ,KAAK,YAAY,CACnC,QAAO,KAAK,+BAA+B;MACrC;EACN,MAAM,kCAAkB,IAAI,KAAa;AAEzC,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,YAAY,QAAQ,KAAK;GACjD,MAAM,aAAa,KAAK,YAAY;GACpC,MAAM,SAAS,eAAe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SAAS,WAAW,KAAK,OAAO;AAE7D,MAAI,CAAC,SACJ,QAAO,KAAK,GAAG,WAAW,oBAAoB;WACpC,CAAC;GAAC;GAAU;GAAQ;GAAQ;GAAY;GAAa,CAAC,SAAS,SAAS,CAClF,QAAO,KACN,GAAG,WAAW,sEACd;AAIF,MAAI,aAAa,YAAY,CAAC,KAAK,IAClC,QAAO,KAAK,GAAG,WAAW,yCAAyC;AAGpE,OAAK,aAAa,UAAU,aAAa,WAAW,CAAC,KAAK,IACzD,QAAO,KAAK,GAAG,WAAW,4CAA4C;AAIvE,MAAI,MAAM,QAAQ,KAAK,SAAS,CAC/B,mBAAkB,KAAK,UAAU,YAAY,QAAQ,SAAS;;;;;;AAQjE,SAAS,qBACR,OACA,YACA,UACO;AACP,MAAK,MAAM,QAAQ,OAAO;AACzB,OAAK,KAAK,SAAS,UAAU,KAAK,SAAS,WAAW,KAAK,KAC1D;OAAI,CAAC,WAAW,IAAI,KAAK,IAAI,CAC5B,UAAS,KAAK,iCAAiC,KAAK,IAAI,iCAAiC;;AAI3F,MAAI,KAAK,SACR,sBAAqB,KAAK,UAAU,YAAY,SAAS"}
1
+ {"version":3,"file":"validate-CqsNItbt.mjs","names":[],"sources":["../src/seed/validate.ts"],"sourcesContent":["/**\n * Seed file validation\n *\n * Validates a seed file structure before applying it.\n */\n\nimport { FIELD_TYPES } from \"../schema/types.js\";\nimport type { SeedFile, SeedMenuItem, ValidationResult } from \"./types.js\";\n\nconst COLLECTION_FIELD_SLUG_PATTERN = /^[a-z][a-z0-9_]*$/;\nconst SLUG_PATTERN = /^[a-z0-9-]+$/;\nconst REDIRECT_TYPES = new Set([301, 302, 307, 308]);\nconst CRLF_PATTERN = /[\\r\\n]/;\n\n/** Type guard for Record<string, unknown> */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isValidRedirectPath(path: string): boolean {\n\tif (!path.startsWith(\"/\") || path.startsWith(\"//\") || CRLF_PATTERN.test(path)) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn !decodeURIComponent(path).split(\"/\").includes(\"..\");\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Validate a seed file\n *\n * @param data - Unknown data to validate as a seed file\n * @returns Validation result with errors and warnings\n */\nexport function validateSeed(data: unknown): ValidationResult {\n\tconst errors: string[] = [];\n\tconst warnings: string[] = [];\n\n\t// Basic type check\n\tif (!data || typeof data !== \"object\") {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [\"Seed must be an object\"],\n\t\t\twarnings: [],\n\t\t};\n\t}\n\n\tconst seed = data as Partial<SeedFile>;\n\n\t// Required fields\n\tif (!seed.version) {\n\t\terrors.push(\"Seed must have a version field\");\n\t} else if (seed.version !== \"1\") {\n\t\terrors.push(`Unsupported seed version: ${String(seed.version)}`);\n\t}\n\n\t// Validate collections\n\tif (seed.collections) {\n\t\tif (!Array.isArray(seed.collections)) {\n\t\t\terrors.push(\"collections must be an array\");\n\t\t} else {\n\t\t\tconst collectionSlugs = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.collections.length; i++) {\n\t\t\t\tconst collection = seed.collections[i];\n\t\t\t\tconst prefix = `collections[${i}]`;\n\n\t\t\t\tif (!collection.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for valid slug format\n\t\t\t\t\tif (!COLLECTION_FIELD_SLUG_PATTERN.test(collection.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must start with a letter and contain only lowercase letters, numbers, and underscores`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for duplicate slugs\n\t\t\t\t\tif (collectionSlugs.has(collection.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate collection slug \"${collection.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tcollectionSlugs.add(collection.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!collection.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\t// Validate fields\n\t\t\t\tif (!Array.isArray(collection.fields)) {\n\t\t\t\t\terrors.push(`${prefix}.fields: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tconst fieldSlugs = new Set<string>();\n\n\t\t\t\t\tfor (let j = 0; j < collection.fields.length; j++) {\n\t\t\t\t\t\tconst field = collection.fields[j];\n\t\t\t\t\t\tconst fieldPrefix = `${prefix}.fields[${j}]`;\n\n\t\t\t\t\t\tif (!field.slug) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: slug is required`);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Check for valid slug format\n\t\t\t\t\t\t\tif (!COLLECTION_FIELD_SLUG_PATTERN.test(field.slug)) {\n\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t`${fieldPrefix}.slug: must start with a letter and contain only lowercase letters, numbers, and underscores`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Check for duplicate field slugs\n\t\t\t\t\t\t\tif (fieldSlugs.has(field.slug)) {\n\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t`${fieldPrefix}.slug: duplicate field slug \"${field.slug}\" in collection \"${collection.slug}\"`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfieldSlugs.add(field.slug);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!field.label) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: label is required`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!field.type) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}: type is required`);\n\t\t\t\t\t\t} else if (!(FIELD_TYPES as readonly string[]).includes(field.type)) {\n\t\t\t\t\t\t\terrors.push(`${fieldPrefix}.type: unsupported field type \"${field.type}\"`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate taxonomies\n\tif (seed.taxonomies) {\n\t\tif (!Array.isArray(seed.taxonomies)) {\n\t\t\terrors.push(\"taxonomies must be an array\");\n\t\t} else {\n\t\t\tconst taxonomyNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.taxonomies.length; i++) {\n\t\t\t\tconst taxonomy = seed.taxonomies[i];\n\t\t\t\tconst prefix = `taxonomies[${i}]`;\n\n\t\t\t\tif (!taxonomy.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate taxonomy names\n\t\t\t\t\tif (taxonomyNames.has(taxonomy.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate taxonomy name \"${taxonomy.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\ttaxonomyNames.add(taxonomy.name);\n\t\t\t\t}\n\n\t\t\t\tif (!taxonomy.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (taxonomy.hierarchical === undefined) {\n\t\t\t\t\terrors.push(`${prefix}: hierarchical is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(taxonomy.collections)) {\n\t\t\t\t\terrors.push(`${prefix}.collections: must be an array`);\n\t\t\t\t} else if (taxonomy.collections.length === 0) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t`${prefix}.collections: taxonomy \"${taxonomy.name}\" is not assigned to any collections`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Validate terms if present\n\t\t\t\tif (taxonomy.terms) {\n\t\t\t\t\tif (!Array.isArray(taxonomy.terms)) {\n\t\t\t\t\t\terrors.push(`${prefix}.terms: must be an array`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst termSlugs = new Set<string>();\n\n\t\t\t\t\t\tfor (let j = 0; j < taxonomy.terms.length; j++) {\n\t\t\t\t\t\t\tconst term = taxonomy.terms[j];\n\t\t\t\t\t\t\tconst termPrefix = `${prefix}.terms[${j}]`;\n\n\t\t\t\t\t\t\tif (!term.slug) {\n\t\t\t\t\t\t\t\terrors.push(`${termPrefix}: slug is required`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Check for duplicate term slugs\n\t\t\t\t\t\t\t\tif (termSlugs.has(term.slug)) {\n\t\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t\t`${termPrefix}.slug: duplicate term slug \"${term.slug}\" in taxonomy \"${taxonomy.name}\"`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttermSlugs.add(term.slug);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!term.label) {\n\t\t\t\t\t\t\t\terrors.push(`${termPrefix}: label is required`);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Check parent reference validity (for hierarchical taxonomies)\n\t\t\t\t\t\t\tif (term.parent && taxonomy.hierarchical) {\n\t\t\t\t\t\t\t\t// Parent will be validated in a second pass\n\t\t\t\t\t\t\t} else if (term.parent && !taxonomy.hierarchical) {\n\t\t\t\t\t\t\t\twarnings.push(\n\t\t\t\t\t\t\t\t\t`${termPrefix}.parent: taxonomy \"${taxonomy.name}\" is not hierarchical, parent will be ignored`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Second pass: validate parent references\n\t\t\t\t\t\tif (taxonomy.hierarchical && taxonomy.terms) {\n\t\t\t\t\t\t\tfor (let j = 0; j < taxonomy.terms.length; j++) {\n\t\t\t\t\t\t\t\tconst term = taxonomy.terms[j];\n\t\t\t\t\t\t\t\tif (term.parent && !termSlugs.has(term.parent)) {\n\t\t\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t\t\t`${prefix}.terms[${j}].parent: parent term \"${term.parent}\" not found in taxonomy`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Check for circular references\n\t\t\t\t\t\t\t\tif (term.parent === term.slug) {\n\t\t\t\t\t\t\t\t\terrors.push(`${prefix}.terms[${j}].parent: term cannot be its own parent`);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate menus\n\tif (seed.menus) {\n\t\tif (!Array.isArray(seed.menus)) {\n\t\t\terrors.push(\"menus must be an array\");\n\t\t} else {\n\t\t\tconst menuNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.menus.length; i++) {\n\t\t\t\tconst menu = seed.menus[i];\n\t\t\t\tconst prefix = `menus[${i}]`;\n\n\t\t\t\tif (!menu.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate menu names\n\t\t\t\t\tif (menuNames.has(menu.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate menu name \"${menu.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tmenuNames.add(menu.name);\n\t\t\t\t}\n\n\t\t\t\tif (!menu.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(menu.items)) {\n\t\t\t\t\terrors.push(`${prefix}.items: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tvalidateMenuItems(menu.items, prefix, errors, warnings);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate redirects\n\tif (seed.redirects) {\n\t\tif (!Array.isArray(seed.redirects)) {\n\t\t\terrors.push(\"redirects must be an array\");\n\t\t} else {\n\t\t\tconst redirectSources = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.redirects.length; i++) {\n\t\t\t\tconst redirect = seed.redirects[i];\n\t\t\t\tconst prefix = `redirects[${i}]`;\n\n\t\t\t\tif (!isRecord(redirect)) {\n\t\t\t\t\terrors.push(`${prefix}: must be an object`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst source = typeof redirect.source === \"string\" ? redirect.source : undefined;\n\t\t\t\tconst destination =\n\t\t\t\t\ttypeof redirect.destination === \"string\" ? redirect.destination : undefined;\n\n\t\t\t\tif (!source) {\n\t\t\t\t\terrors.push(`${prefix}: source is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!isValidRedirectPath(source)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.source: must be a path starting with / (no protocol-relative URLs, path traversal, or newlines)`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (redirectSources.has(source)) {\n\t\t\t\t\t\terrors.push(`${prefix}.source: duplicate redirect source \"${source}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tredirectSources.add(source);\n\t\t\t\t}\n\n\t\t\t\tif (!destination) {\n\t\t\t\t\terrors.push(`${prefix}: destination is required`);\n\t\t\t\t} else if (!isValidRedirectPath(destination)) {\n\t\t\t\t\terrors.push(\n\t\t\t\t\t\t`${prefix}.destination: must be a path starting with / (no protocol-relative URLs, path traversal, or newlines)`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (redirect.type !== undefined) {\n\t\t\t\t\tif (typeof redirect.type !== \"number\" || !REDIRECT_TYPES.has(redirect.type)) {\n\t\t\t\t\t\terrors.push(`${prefix}.type: must be 301, 302, 307, or 308`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (redirect.enabled !== undefined && typeof redirect.enabled !== \"boolean\") {\n\t\t\t\t\terrors.push(`${prefix}.enabled: must be a boolean`);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tredirect.groupName !== undefined &&\n\t\t\t\t\ttypeof redirect.groupName !== \"string\" &&\n\t\t\t\t\tredirect.groupName !== null\n\t\t\t\t) {\n\t\t\t\t\terrors.push(`${prefix}.groupName: must be a string or null`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate widget areas\n\tif (seed.widgetAreas) {\n\t\tif (!Array.isArray(seed.widgetAreas)) {\n\t\t\terrors.push(\"widgetAreas must be an array\");\n\t\t} else {\n\t\t\tconst areaNames = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.widgetAreas.length; i++) {\n\t\t\t\tconst area = seed.widgetAreas[i];\n\t\t\t\tconst prefix = `widgetAreas[${i}]`;\n\n\t\t\t\tif (!area.name) {\n\t\t\t\t\terrors.push(`${prefix}: name is required`);\n\t\t\t\t} else {\n\t\t\t\t\t// Check for duplicate area names\n\t\t\t\t\tif (areaNames.has(area.name)) {\n\t\t\t\t\t\terrors.push(`${prefix}.name: duplicate widget area name \"${area.name}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tareaNames.add(area.name);\n\t\t\t\t}\n\n\t\t\t\tif (!area.label) {\n\t\t\t\t\terrors.push(`${prefix}: label is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(area.widgets)) {\n\t\t\t\t\terrors.push(`${prefix}.widgets: must be an array`);\n\t\t\t\t} else {\n\t\t\t\t\tfor (let j = 0; j < area.widgets.length; j++) {\n\t\t\t\t\t\tconst widget = area.widgets[j];\n\t\t\t\t\t\tconst widgetPrefix = `${prefix}.widgets[${j}]`;\n\n\t\t\t\t\t\tif (!widget.type) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: type is required`);\n\t\t\t\t\t\t} else if (![\"content\", \"menu\", \"component\"].includes(widget.type)) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}.type: must be \"content\", \"menu\", or \"component\"`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Type-specific validation\n\t\t\t\t\t\tif (widget.type === \"menu\" && !widget.menuName) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: menuName is required for menu widgets`);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (widget.type === \"component\" && !widget.componentId) {\n\t\t\t\t\t\t\terrors.push(`${widgetPrefix}: componentId is required for component widgets`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate sections\n\tif (seed.sections) {\n\t\tif (!Array.isArray(seed.sections)) {\n\t\t\terrors.push(\"sections must be an array\");\n\t\t} else {\n\t\t\tconst sectionSlugs = new Set<string>();\n\n\t\t\tfor (let i = 0; i < seed.sections.length; i++) {\n\t\t\t\tconst section = seed.sections[i];\n\t\t\t\tconst prefix = `sections[${i}]`;\n\n\t\t\t\tif (!section.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!SLUG_PATTERN.test(section.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must contain only lowercase letters, numbers, and hyphens`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (sectionSlugs.has(section.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate section slug \"${section.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tsectionSlugs.add(section.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!section.title) {\n\t\t\t\t\terrors.push(`${prefix}: title is required`);\n\t\t\t\t}\n\n\t\t\t\tif (!Array.isArray(section.content)) {\n\t\t\t\t\terrors.push(`${prefix}.content: must be an array`);\n\t\t\t\t}\n\n\t\t\t\t// Validate source\n\t\t\t\tif (section.source && ![\"theme\", \"import\"].includes(section.source)) {\n\t\t\t\t\terrors.push(`${prefix}.source: must be \"theme\" or \"import\"`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate bylines\n\tif (seed.bylines) {\n\t\tif (!Array.isArray(seed.bylines)) {\n\t\t\terrors.push(\"bylines must be an array\");\n\t\t} else {\n\t\t\tconst bylineIds = new Set<string>();\n\t\t\tconst bylineSlugs = new Set<string>();\n\t\t\tfor (let i = 0; i < seed.bylines.length; i++) {\n\t\t\t\tconst byline = seed.bylines[i];\n\t\t\t\tconst prefix = `bylines[${i}]`;\n\n\t\t\t\tif (!byline.id) {\n\t\t\t\t\terrors.push(`${prefix}: id is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (bylineIds.has(byline.id)) {\n\t\t\t\t\t\terrors.push(`${prefix}.id: duplicate byline id \"${byline.id}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tbylineIds.add(byline.id);\n\t\t\t\t}\n\n\t\t\t\tif (!byline.slug) {\n\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t} else {\n\t\t\t\t\tif (!SLUG_PATTERN.test(byline.slug)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`${prefix}.slug: must contain only lowercase letters, numbers, and hyphens`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (bylineSlugs.has(byline.slug)) {\n\t\t\t\t\t\terrors.push(`${prefix}.slug: duplicate byline slug \"${byline.slug}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tbylineSlugs.add(byline.slug);\n\t\t\t\t}\n\n\t\t\t\tif (!byline.displayName) {\n\t\t\t\t\terrors.push(`${prefix}: displayName is required`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate content\n\tif (seed.content) {\n\t\tif (typeof seed.content !== \"object\" || Array.isArray(seed.content)) {\n\t\t\terrors.push(\"content must be an object (collection -> entries)\");\n\t\t} else {\n\t\t\tfor (const [collectionSlug, entries] of Object.entries(seed.content)) {\n\t\t\t\tif (!Array.isArray(entries)) {\n\t\t\t\t\terrors.push(`content.${collectionSlug}: must be an array`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst entryIds = new Set<string>();\n\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tconst prefix = `content.${collectionSlug}[${i}]`;\n\n\t\t\t\t\tif (!entry.id) {\n\t\t\t\t\t\terrors.push(`${prefix}: id is required`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Check for duplicate entry IDs\n\t\t\t\t\t\tif (entryIds.has(entry.id)) {\n\t\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t\t`${prefix}.id: duplicate entry id \"${entry.id}\" in collection \"${collectionSlug}\"`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tentryIds.add(entry.id);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!entry.slug) {\n\t\t\t\t\t\terrors.push(`${prefix}: slug is required`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!entry.data || typeof entry.data !== \"object\") {\n\t\t\t\t\t\terrors.push(`${prefix}: data must be an object`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Validate i18n fields\n\t\t\t\t\tif (entry.translationOf) {\n\t\t\t\t\t\tif (!entry.locale) {\n\t\t\t\t\t\t\terrors.push(`${prefix}: locale is required when translationOf is set`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Second pass: validate translationOf references within this collection\n\t\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\t\tconst entry = entries[i];\n\t\t\t\t\tif (entry.translationOf && !entryIds.has(entry.translationOf)) {\n\t\t\t\t\t\terrors.push(\n\t\t\t\t\t\t\t`content.${collectionSlug}[${i}].translationOf: references \"${entry.translationOf}\" which is not in this collection`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate cross-references (content refs in menus)\n\tif (seed.menus && seed.content) {\n\t\tconst allContentIds = new Set<string>();\n\t\tfor (const entries of Object.values(seed.content)) {\n\t\t\tif (Array.isArray(entries)) {\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tif (entry.id) {\n\t\t\t\t\t\tallContentIds.add(entry.id);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check menu item refs\n\t\tfor (const menu of seed.menus) {\n\t\t\tif (Array.isArray(menu.items)) {\n\t\t\t\tvalidateMenuItemRefs(menu.items, allContentIds, warnings);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate byline refs in content\n\tif (seed.content) {\n\t\tconst seedBylineIds = new Set<string>((seed.bylines ?? []).map((byline) => byline.id));\n\t\tfor (const [collectionSlug, entries] of Object.entries(seed.content)) {\n\t\t\tif (!Array.isArray(entries)) continue;\n\t\t\tfor (let i = 0; i < entries.length; i++) {\n\t\t\t\tconst entry = entries[i];\n\t\t\t\tif (!entry.bylines) continue;\n\t\t\t\tif (!Array.isArray(entry.bylines)) {\n\t\t\t\t\terrors.push(`content.${collectionSlug}[${i}].bylines: must be an array`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (let j = 0; j < entry.bylines.length; j++) {\n\t\t\t\t\tconst credit = entry.bylines[j];\n\t\t\t\t\tconst prefix = `content.${collectionSlug}[${i}].bylines[${j}]`;\n\t\t\t\t\tif (!credit.byline) {\n\t\t\t\t\t\terrors.push(`${prefix}.byline: is required`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!seedBylineIds.has(credit.byline)) {\n\t\t\t\t\t\terrors.push(`${prefix}.byline: references unknown byline \"${credit.byline}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tvalid: errors.length === 0,\n\t\terrors,\n\t\twarnings,\n\t};\n}\n\n/**\n * Validate menu items recursively\n */\nfunction validateMenuItems(\n\titems: unknown[],\n\tprefix: string,\n\terrors: string[],\n\twarnings: string[],\n): void {\n\tfor (let i = 0; i < items.length; i++) {\n\t\tconst raw = items[i];\n\t\tconst itemPrefix = `${prefix}.items[${i}]`;\n\n\t\tif (!isRecord(raw)) {\n\t\t\terrors.push(`${itemPrefix}: must be an object`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst item = raw;\n\n\t\tconst itemType = typeof item.type === \"string\" ? item.type : undefined;\n\n\t\tif (!itemType) {\n\t\t\terrors.push(`${itemPrefix}: type is required`);\n\t\t} else if (![\"custom\", \"page\", \"post\", \"taxonomy\", \"collection\"].includes(itemType)) {\n\t\t\terrors.push(\n\t\t\t\t`${itemPrefix}.type: must be \"custom\", \"page\", \"post\", \"taxonomy\", or \"collection\"`,\n\t\t\t);\n\t\t}\n\n\t\t// Type-specific validation\n\t\tif (itemType === \"custom\" && !item.url) {\n\t\t\terrors.push(`${itemPrefix}: url is required for custom menu items`);\n\t\t}\n\n\t\tif ((itemType === \"page\" || itemType === \"post\") && !item.ref) {\n\t\t\terrors.push(`${itemPrefix}: ref is required for page/post menu items`);\n\t\t}\n\n\t\t// Validate children recursively\n\t\tif (Array.isArray(item.children)) {\n\t\t\tvalidateMenuItems(item.children, itemPrefix, errors, warnings);\n\t\t}\n\t}\n}\n\n/**\n * Validate menu item references exist in content\n */\nfunction validateMenuItemRefs(\n\titems: SeedMenuItem[],\n\tcontentIds: Set<string>,\n\twarnings: string[],\n): void {\n\tfor (const item of items) {\n\t\tif ((item.type === \"page\" || item.type === \"post\") && item.ref) {\n\t\t\tif (!contentIds.has(item.ref)) {\n\t\t\t\twarnings.push(`Menu item references content \"${item.ref}\" which is not in the seed file`);\n\t\t\t}\n\t\t}\n\n\t\tif (item.children) {\n\t\t\tvalidateMenuItemRefs(item.children, contentIds, warnings);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;AASA,MAAM,gCAAgC;AACtC,MAAM,eAAe;AACrB,MAAM,iBAAiB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAI,CAAC;AACpD,MAAM,eAAe;;AAGrB,SAAS,SAAS,OAAkD;AACnE,QAAO,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Q,KAAK,SAAS,CAC/B,mBAAkB,KAAK,UAAU,YAAY,QAAQ,SAAS;;;;;;AAQjE,SAAS,qBACR,OACA,YACA,UACO;AACP,MAAK,MAAM,QAAQ,OAAO;AACzB,OAAK,KAAK,SAAS,UAAU,KAAK,SAAS,WAAW,KAAK,KAC1D;OAAI,CAAC,WAAW,IAAI,KAAK,IAAI,CAC5B,UAAS,KAAK,iCAAiC,KAAK,IAAI,iCAAiC;;AAI3F,MAAI,KAAK,SACR,sBAAqB,KAAK,UAAU,YAAY,SAAS"}
@@ -1,55 +1,8 @@
1
- import { t as Database } from "./types-B6BzlZxx.mjs";
2
- import { u as FieldType } from "./types-DeG21anB.mjs";
3
- import { d as Storage } from "./types-DNZpaCBk.mjs";
1
+ import { t as Database } from "./types-C2v0c34j.mjs";
2
+ import { i as SiteSettings, m as FieldType } from "./types-CnZYHyLW.mjs";
3
+ import { d as Storage } from "./types-CFWjXmus.mjs";
4
4
  import { Kysely } from "kysely";
5
5
 
6
- //#region src/settings/types.d.ts
7
- /**
8
- * Site Settings Types
9
- *
10
- * Global configuration for the site (title, logo, social links, etc.)
11
- */
12
- /** Media reference for logo/favicon */
13
- interface MediaReference {
14
- mediaId: string;
15
- alt?: string;
16
- }
17
- /** Site-level SEO settings */
18
- interface SeoSettings {
19
- /** Separator between page title and site title (e.g., " | ", " — ") */
20
- titleSeparator?: string;
21
- /** Default OG image when content has no seo_image */
22
- defaultOgImage?: MediaReference;
23
- /** Custom robots.txt content. If unset, a default is generated. */
24
- robotsTxt?: string;
25
- /** Google Search Console verification meta tag content */
26
- googleVerification?: string;
27
- /** Bing Webmaster Tools verification meta tag content */
28
- bingVerification?: string;
29
- }
30
- /** Site settings schema */
31
- interface SiteSettings {
32
- title: string;
33
- tagline?: string;
34
- logo?: MediaReference;
35
- favicon?: MediaReference;
36
- url?: string;
37
- postsPerPage: number;
38
- dateFormat: string;
39
- timezone: string;
40
- social?: {
41
- twitter?: string;
42
- github?: string;
43
- facebook?: string;
44
- instagram?: string;
45
- linkedin?: string;
46
- youtube?: string;
47
- };
48
- seo?: SeoSettings;
49
- }
50
- /** Keys that are valid site settings */
51
- type SiteSettingKey = keyof SiteSettings;
52
- //#endregion
53
6
  //#region src/seed/types.d.ts
54
7
  /**
55
8
  * Root seed file structure
@@ -374,5 +327,5 @@ declare function loadUserSeed(): Promise<SeedFile | null>;
374
327
  */
375
328
  declare function validateSeed(data: unknown): ValidationResult;
376
329
  //#endregion
377
- export { SiteSettingKey as C, SeoSettings as S, SeedTaxonomyTerm as _, applySeed as a, ValidationResult as b, SeedCollection as c, SeedFile as d, SeedMenu as f, SeedTaxonomy as g, SeedSection as h, defaultSeed as i, SeedContentEntry as l, SeedRedirect as m, loadSeed as n, SeedApplyOptions as o, SeedMenuItem as p, loadUserSeed as r, SeedApplyResult as s, validateSeed as t, SeedField as u, SeedWidget as v, SiteSettings as w, MediaReference as x, SeedWidgetArea as y };
378
- //# sourceMappingURL=validate-Db1yNL3i.d.mts.map
330
+ export { SeedTaxonomyTerm as _, applySeed as a, ValidationResult as b, SeedCollection as c, SeedFile as d, SeedMenu as f, SeedTaxonomy as g, SeedSection as h, defaultSeed as i, SeedContentEntry as l, SeedRedirect as m, loadSeed as n, SeedApplyOptions as o, SeedMenuItem as p, loadUserSeed as r, SeedApplyResult as s, validateSeed as t, SeedField as u, SeedWidget as v, SeedWidgetArea as y };
331
+ //# sourceMappingURL=validate-kM8Pjuf7.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-kM8Pjuf7.d.mts","names":[],"sources":["../src/seed/types.ts","../src/seed/apply.ts","../src/seed/default.ts","../src/seed/load.ts","../src/seed/validate.ts"],"mappings":";;;;;;;;;UAciB,QAAA;EAwBR;EAtBR,OAAA;EA4Bc;EAzBd,OAAA;EA+BU;EA5BV,IAAA;IACC,IAAA;IACA,WAAA;IACA,MAAA;EAAA;EAND;EAUA,QAAA,GAAW,OAAA,CAAQ,YAAA;EANlB;EASD,WAAA,GAAc,cAA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IAAiB,OAAA;IAAiB,OAAA;EAAA;EAC7C,KAAA;IAAS,OAAA;IAAiB,OAAA;EAAA;AAAA;;;;UAMV,gBAAA;EAChB,KAAA;EACA,MAAA;EACA,QAAA;AAAA;;;;;;;;;;;;;iBCzOqB,SAAA,CACrB,EAAA,EAAI,MAAA,CAAO,QAAA,GACX,IAAA,EAAM,QAAA,EACN,OAAA,GAAS,gBAAA,GACP,OAAA,CAAQ,eAAA;;;cCxDE,WAAA,EAAa,QAAA;;;;;;iBCcJ,QAAA,CAAA,GAAY,OAAA,CAAQ,QAAA;;;;iBAQpB,YAAA,CAAA,GAAgB,OAAA,CAAQ,QAAA;;;AHjB9C;;;;;;AAAA,iBIuBgB,YAAA,CAAa,IAAA,YAAgB,gBAAA"}
@@ -0,0 +1,7 @@
1
+ //#region src/version.ts
2
+ const VERSION = "0.7.0";
3
+ const COMMIT = "8a86aab";
4
+
5
+ //#endregion
6
+ export { VERSION as n, COMMIT as t };
7
+ //# sourceMappingURL=version-BnTKdfam.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-CMMjTuqu.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["/**\n * Build-time version constants, replaced by tsdown/Vite `define`.\n * Falls back to \"dev\" when running uncompiled (tests, dev).\n */\n\ndeclare const __EMDASH_VERSION__: string;\ndeclare const __EMDASH_COMMIT__: string;\n\nexport const VERSION: string =\n\ttypeof __EMDASH_VERSION__ !== \"undefined\" ? __EMDASH_VERSION__ : \"dev\";\n\nexport const COMMIT: string = typeof __EMDASH_COMMIT__ !== \"undefined\" ? __EMDASH_COMMIT__ : \"dev\";\n"],"mappings":";AAQA,MAAa;AAGb,MAAa"}
1
+ {"version":3,"file":"version-BnTKdfam.mjs","names":[],"sources":["../src/version.ts"],"sourcesContent":["/**\n * Build-time version constants, replaced by tsdown/Vite `define`.\n * Falls back to \"dev\" when running uncompiled (tests, dev).\n */\n\ndeclare const __EMDASH_VERSION__: string;\ndeclare const __EMDASH_COMMIT__: string;\n\nexport const VERSION: string =\n\ttypeof __EMDASH_VERSION__ !== \"undefined\" ? __EMDASH_VERSION__ : \"dev\";\n\nexport const COMMIT: string = typeof __EMDASH_COMMIT__ !== \"undefined\" ? __EMDASH_COMMIT__ : \"dev\";\n"],"mappings":";AAQA,MAAa;AAGb,MAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emdash",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Astro-native CMS with WordPress migration support",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -61,6 +61,10 @@
61
61
  "types": "./dist/db/postgres.d.mts",
62
62
  "default": "./dist/db/postgres.mjs"
63
63
  },
64
+ "./database/instrumentation": {
65
+ "types": "./dist/database/instrumentation.d.mts",
66
+ "default": "./dist/database/instrumentation.mjs"
67
+ },
64
68
  "./storage/local": {
65
69
  "types": "./dist/storage/local.d.mts",
66
70
  "default": "./dist/storage/local.mjs"
@@ -142,6 +146,7 @@
142
146
  "#mcp/*": "./src/mcp/*",
143
147
  "#comments/*": "./src/comments/*",
144
148
  "#bylines/*": "./src/bylines/*",
149
+ "#taxonomies/*": "./src/taxonomies/*",
145
150
  "#redirects/*": "./src/redirects/*",
146
151
  "#types": "./src/astro/types.js"
147
152
  },
@@ -180,9 +185,9 @@
180
185
  "ulidx": "^2.4.1",
181
186
  "upng-js": "^2.1.0",
182
187
  "zod": "^4.3.5",
183
- "@emdash-cms/auth": "0.5.0",
184
- "@emdash-cms/gutenberg-to-portable-text": "0.5.0",
185
- "@emdash-cms/admin": "0.5.0"
188
+ "@emdash-cms/admin": "0.7.0",
189
+ "@emdash-cms/auth": "0.7.0",
190
+ "@emdash-cms/gutenberg-to-portable-text": "0.7.0"
186
191
  },
187
192
  "optionalDependencies": {
188
193
  "@libsql/kysely-libsql": "^0.4.0",
@@ -210,7 +215,7 @@
210
215
  "vite": "^6.0.0",
211
216
  "vitest": "^4.0.18",
212
217
  "zod-openapi": "^5.4.6",
213
- "@emdash-cms/blocks": "0.5.0"
218
+ "@emdash-cms/blocks": "0.7.0"
214
219
  },
215
220
  "repository": {
216
221
  "type": "git",
package/src/after.ts ADDED
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Defer work past the HTTP response.
3
+ *
4
+ * Use for bookkeeping that doesn't need to complete before the client
5
+ * gets bytes — writes that record state, maintenance queries, cache
6
+ * refreshes. `after()` hands the promise to the host's lifetime
7
+ * extender when one is available (Cloudflare's `waitUntil` under
8
+ * workerd), or fires-and-forgets on Node (the process lives for the
9
+ * next request anyway).
10
+ *
11
+ * Host binding is resolved lazily via a dynamic import of the
12
+ * `virtual:emdash/wait-until` virtual module. Lazy — rather than a
13
+ * static top-level import — so tools that walk the dist in a plain
14
+ * Node loader (`astro check`, Vitest, etc.) don't trip over the
15
+ * `virtual:` scheme: they'd only fail if they actually called
16
+ * `after()`, which they don't during type-checking.
17
+ */
18
+
19
+ export type WaitUntilFn = (promise: Promise<unknown>) => void;
20
+
21
+ // Resolves to the host's waitUntil if the adapter provided one, or
22
+ // null otherwise. Kicked off once at module load; subsequent `after()`
23
+ // calls see the cached result without re-importing.
24
+ const waitUntilReady: Promise<WaitUntilFn | null> = (async () => {
25
+ try {
26
+ // @ts-ignore - virtual module, generated by the Astro integration
27
+ const mod = (await import("virtual:emdash/wait-until")) as {
28
+ waitUntil?: WaitUntilFn;
29
+ };
30
+ return mod.waitUntil ?? null;
31
+ } catch {
32
+ // No virtual module available (Node-side tooling, tests without the
33
+ // integration in scope). Fire-and-forget is the safe fallback.
34
+ return null;
35
+ }
36
+ })();
37
+ // Surface rejections without making the module-load fail.
38
+ waitUntilReady.catch(() => {});
39
+
40
+ /**
41
+ * Schedule `fn` to run without blocking the response.
42
+ *
43
+ * Errors are caught and logged — a deferred task should never surface
44
+ * as an unhandled rejection because the response is long gone. Callers
45
+ * that care about errors should handle them inside `fn`.
46
+ */
47
+ export function after(fn: () => void | Promise<void>): void {
48
+ const promise = Promise.resolve()
49
+ .then(fn)
50
+ .catch((error) => {
51
+ console.error("[emdash] deferred task failed:", error);
52
+ });
53
+
54
+ // Defer the lifetime-extender handoff to the microtask that resolves
55
+ // waitUntilReady. On workerd this is effectively instant (the virtual
56
+ // module is already loaded in the bundle); on Node the promise
57
+ // resolves to null, so this is just one extra microtask and no-op.
58
+ void waitUntilReady.then((waitUntil) => {
59
+ if (waitUntil) waitUntil(promise);
60
+ return null;
61
+ });
62
+ }
@@ -483,6 +483,7 @@ export async function handleContentUpdate(
483
483
  bylines?: ContentBylineInput[];
484
484
  _rev?: string;
485
485
  seo?: ContentSeoInput;
486
+ publishedAt?: string | null;
486
487
  },
487
488
  ): Promise<ApiResult<ContentResponse>> {
488
489
  try {
@@ -542,6 +543,7 @@ export async function handleContentUpdate(
542
543
  slug: body.slug,
543
544
  status: body.status,
544
545
  authorId: body.authorId,
546
+ publishedAt: body.publishedAt,
545
547
  });
546
548
 
547
549
  if (body.bylines !== undefined) {
@@ -20,6 +20,7 @@ import {
20
20
  VALID_SCOPES,
21
21
  } from "../../auth/api-tokens.js";
22
22
  import type { Database } from "../../database/types.js";
23
+ import { validateRedirectUri } from "../oauth/redirect-uri.js";
23
24
  import type { ApiResult } from "../types.js";
24
25
  import { lookupOAuthClient, validateClientRedirectUri } from "./oauth-clients.js";
25
26
 
@@ -76,38 +77,7 @@ function expiresAt(seconds: number): string {
76
77
  return new Date(Date.now() + seconds * 1000).toISOString();
77
78
  }
78
79
 
79
- /**
80
- * Validate a redirect URI per OAuth 2.1 security requirements.
81
- * Allows localhost (loopback) over HTTP, and any HTTPS URL.
82
- */
83
- export function validateRedirectUri(uri: string): string | null {
84
- try {
85
- const url = new URL(uri);
86
-
87
- // Reject protocol-relative URLs
88
- if (uri.startsWith("//")) {
89
- return "Protocol-relative redirect URIs are not allowed";
90
- }
91
-
92
- // Allow localhost/loopback over HTTP (for desktop MCP clients)
93
- if (url.protocol === "http:") {
94
- const host = url.hostname;
95
- if (host === "127.0.0.1" || host === "localhost" || host === "[::1]") {
96
- return null; // OK
97
- }
98
- return "HTTP redirect URIs are only allowed for localhost";
99
- }
100
-
101
- // Allow HTTPS
102
- if (url.protocol === "https:") {
103
- return null; // OK
104
- }
105
-
106
- return `Unsupported redirect URI scheme: ${url.protocol}`;
107
- } catch {
108
- return "Invalid redirect URI";
109
- }
110
- }
80
+ export { validateRedirectUri };
111
81
 
112
82
  /**
113
83
  * Validate and normalize scopes. Returns validated scope list.
@@ -9,6 +9,7 @@
9
9
  import type { Kysely } from "kysely";
10
10
 
11
11
  import type { Database } from "../../database/types.js";
12
+ import { validateRedirectUri } from "../oauth/redirect-uri.js";
12
13
  import type { ApiResult } from "../types.js";
13
14
 
14
15
  // ---------------------------------------------------------------------------
@@ -21,6 +22,16 @@ function parseJsonColumn<T>(value: string): T {
21
22
  return JSON.parse(value) as T;
22
23
  }
23
24
 
25
+ function validateRegisteredRedirectUris(redirectUris: string[]): string | null {
26
+ for (const redirectUri of redirectUris) {
27
+ const error = validateRedirectUri(redirectUri);
28
+ if (error) {
29
+ return `Invalid redirect URI: ${error}`;
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+
24
35
  // ---------------------------------------------------------------------------
25
36
  // Types
26
37
  // ---------------------------------------------------------------------------
@@ -61,6 +72,17 @@ export async function handleOAuthClientCreate(
61
72
  };
62
73
  }
63
74
 
75
+ const redirectUriError = validateRegisteredRedirectUris(input.redirectUris);
76
+ if (redirectUriError) {
77
+ return {
78
+ success: false,
79
+ error: {
80
+ code: "VALIDATION_ERROR",
81
+ message: redirectUriError,
82
+ },
83
+ };
84
+ }
85
+
64
86
  // Check for duplicate client ID
65
87
  const existing = await db
66
88
  .selectFrom("_emdash_oauth_clients")
@@ -83,7 +105,7 @@ export async function handleOAuthClientCreate(
83
105
  id: input.id,
84
106
  name: input.name,
85
107
  redirect_uris: JSON.stringify(input.redirectUris),
86
- scopes: input.scopes ? JSON.stringify(input.scopes) : null,
108
+ scopes: input.scopes && input.scopes.length > 0 ? JSON.stringify(input.scopes) : null,
87
109
  })
88
110
  .execute();
89
111
 
@@ -93,7 +115,7 @@ export async function handleOAuthClientCreate(
93
115
  id: input.id,
94
116
  name: input.name,
95
117
  redirectUris: input.redirectUris,
96
- scopes: input.scopes ?? null,
118
+ scopes: input.scopes && input.scopes.length > 0 ? input.scopes : null,
97
119
  createdAt: now,
98
120
  updatedAt: now,
99
121
  },
@@ -222,7 +244,20 @@ export async function handleOAuthClientUpdate(
222
244
  };
223
245
  }
224
246
 
225
- const updates: Record<string, string> = {
247
+ if (input.redirectUris !== undefined) {
248
+ const redirectUriError = validateRegisteredRedirectUris(input.redirectUris);
249
+ if (redirectUriError) {
250
+ return {
251
+ success: false,
252
+ error: {
253
+ code: "VALIDATION_ERROR",
254
+ message: redirectUriError,
255
+ },
256
+ };
257
+ }
258
+ }
259
+
260
+ const updates: Record<string, string | null> = {
226
261
  updated_at: new Date().toISOString(),
227
262
  };
228
263
 
@@ -233,7 +268,8 @@ export async function handleOAuthClientUpdate(
233
268
  updates.redirect_uris = JSON.stringify(input.redirectUris);
234
269
  }
235
270
  if (input.scopes !== undefined) {
236
- updates.scopes = input.scopes ? JSON.stringify(input.scopes) : "";
271
+ updates.scopes =
272
+ input.scopes && input.scopes.length > 0 ? JSON.stringify(input.scopes) : null;
237
273
  }
238
274
 
239
275
  await db.updateTable("_emdash_oauth_clients").set(updates).where("id", "=", clientId).execute();
@@ -7,6 +7,7 @@ import { ulid } from "ulidx";
7
7
 
8
8
  import { TaxonomyRepository } from "../../database/repositories/taxonomy.js";
9
9
  import type { Database } from "../../database/types.js";
10
+ import { invalidateTermCache } from "../../taxonomies/index.js";
10
11
  import type { ApiResult } from "../types.js";
11
12
 
12
13
  /** Taxonomy name validation pattern: lowercase alphanumeric + underscores, starts with letter */
@@ -323,6 +324,10 @@ export async function handleTermCreate(
323
324
  data: input.description ? { description: input.description } : undefined,
324
325
  });
325
326
 
327
+ // New term means `hasAnyTermAssignments` may flip from false->true next
328
+ // time an entry is tagged. Clear the cache so the next read re-probes.
329
+ invalidateTermCache();
330
+
326
331
  return {
327
332
  success: true,
328
333
  data: {
@@ -442,6 +447,10 @@ export async function handleTermUpdate(
442
447
  data: input.description !== undefined ? { description: input.description } : undefined,
443
448
  });
444
449
 
450
+ // Term label/slug changes are reflected in hydrated entry.data.terms —
451
+ // invalidate so the next read doesn't short-circuit on a stale probe.
452
+ invalidateTermCache();
453
+
445
454
  if (!updated) {
446
455
  return {
447
456
  success: false,
@@ -513,6 +522,10 @@ export async function handleTermDelete(
513
522
  };
514
523
  }
515
524
 
525
+ // Deleting a term cascades to content_taxonomies; invalidate so
526
+ // hydration no longer sees the stale assignments.
527
+ invalidateTermCache();
528
+
516
529
  return { success: true, data: { deleted: true } };
517
530
  } catch {
518
531
  return {
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Validate a redirect URI per OAuth 2.1 security requirements.
3
+ *
4
+ * Allows localhost / loopback redirect URIs over HTTP for native clients,
5
+ * and any HTTPS URL for web-based flows.
6
+ */
7
+ export function validateRedirectUri(uri: string): string | null {
8
+ try {
9
+ const url = new URL(uri);
10
+
11
+ // Reject protocol-relative URLs
12
+ if (uri.startsWith("//")) {
13
+ return "Protocol-relative redirect URIs are not allowed";
14
+ }
15
+
16
+ // Allow localhost/loopback over HTTP (for desktop MCP clients)
17
+ if (url.protocol === "http:") {
18
+ const host = url.hostname;
19
+ if (host === "127.0.0.1" || host === "localhost" || host === "[::1]") {
20
+ return null;
21
+ }
22
+ return "HTTP redirect URIs are only allowed for localhost";
23
+ }
24
+
25
+ // Allow HTTPS
26
+ if (url.protocol === "https:") {
27
+ return null;
28
+ }
29
+
30
+ return `Unsupported redirect URI scheme: ${url.protocol}`;
31
+ } catch {
32
+ return "Invalid redirect URI";
33
+ }
34
+ }