@beechcms/core 0.8.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 (389) hide show
  1. package/dist/auth/account-email.d.ts +3 -0
  2. package/dist/auth/account-email.d.ts.map +1 -0
  3. package/dist/auth/account-email.js +9 -0
  4. package/dist/auth/password-reset-token.repository.d.ts +13 -2
  5. package/dist/auth/password-reset-token.repository.d.ts.map +1 -1
  6. package/dist/auth/user.repository.d.ts +69 -4
  7. package/dist/auth/user.repository.d.ts.map +1 -1
  8. package/dist/automations-grammar-words.d.ts +2 -0
  9. package/dist/automations-grammar-words.d.ts.map +1 -0
  10. package/dist/automations-grammar-words.js +8 -0
  11. package/dist/automations.repository.interface.d.ts +19 -0
  12. package/dist/automations.repository.interface.d.ts.map +1 -0
  13. package/dist/automations.repository.interface.js +3 -0
  14. package/dist/automations.runner.interface.d.ts +10 -0
  15. package/dist/automations.runner.interface.d.ts.map +1 -0
  16. package/dist/automations.runner.interface.js +3 -0
  17. package/dist/automations.runner.stub.d.ts +5 -0
  18. package/dist/automations.runner.stub.d.ts.map +1 -0
  19. package/dist/automations.runner.stub.js +7 -0
  20. package/dist/automations.types.d.ts +75 -0
  21. package/dist/automations.types.d.ts.map +1 -0
  22. package/dist/automations.types.js +3 -0
  23. package/dist/clock.d.ts +25 -0
  24. package/dist/clock.d.ts.map +1 -0
  25. package/dist/clock.js +11 -0
  26. package/dist/common/canonical-json.d.ts +31 -0
  27. package/dist/common/canonical-json.d.ts.map +1 -0
  28. package/dist/common/canonical-json.js +91 -0
  29. package/dist/content/content-scan.repository.d.ts +1 -1
  30. package/dist/content/content.repository.d.ts +154 -3
  31. package/dist/content/content.repository.d.ts.map +1 -1
  32. package/dist/content/content.repository.js +62 -0
  33. package/dist/content/deletion-ledger.d.ts +39 -0
  34. package/dist/content/deletion-ledger.d.ts.map +1 -0
  35. package/dist/content/deletion-ledger.js +3 -0
  36. package/dist/content/seed-media-purge.repository.d.ts +34 -0
  37. package/dist/content/seed-media-purge.repository.d.ts.map +1 -0
  38. package/dist/content/seed-media-purge.repository.js +3 -0
  39. package/dist/content/seed.repository.d.ts +14 -0
  40. package/dist/content/seed.repository.d.ts.map +1 -1
  41. package/dist/content-scan.repository.d.ts +9 -0
  42. package/dist/content-scan.repository.d.ts.map +1 -0
  43. package/dist/content-scan.repository.js +3 -0
  44. package/dist/content.repository.d.ts +247 -0
  45. package/dist/content.repository.d.ts.map +1 -0
  46. package/dist/content.repository.js +59 -0
  47. package/dist/dashboard-layout/content-view.d.ts +757 -0
  48. package/dist/dashboard-layout/content-view.d.ts.map +1 -0
  49. package/dist/dashboard-layout/content-view.js +285 -0
  50. package/dist/dashboard-layout/content-view.repository.d.ts +39 -0
  51. package/dist/dashboard-layout/content-view.repository.d.ts.map +1 -0
  52. package/dist/dashboard-layout/content-view.repository.js +3 -0
  53. package/dist/dashboard-layout/dashboard-layout.d.ts +5 -0
  54. package/dist/dashboard-layout/dashboard-layout.d.ts.map +1 -1
  55. package/dist/dashboard-layout/dashboard-layout.js +17 -9
  56. package/dist/dashboard-layout/kanban/kanban.d.ts +32 -18
  57. package/dist/dashboard-layout/kanban/kanban.d.ts.map +1 -1
  58. package/dist/dashboard-layout/kanban/kanban.js +45 -21
  59. package/dist/dashboard-layout/seed-layout.d.ts +22 -31
  60. package/dist/dashboard-layout/seed-layout.d.ts.map +1 -1
  61. package/dist/dashboard-layout/seed-layout.js +93 -18
  62. package/dist/dashboard-layout/seed-layout.repository.d.ts +1 -5
  63. package/dist/dashboard-layout/seed-layout.repository.d.ts.map +1 -1
  64. package/dist/dashboard-layout.d.ts +154 -0
  65. package/dist/dashboard-layout.d.ts.map +1 -0
  66. package/dist/dashboard-layout.js +186 -0
  67. package/dist/dashboard-layout.repository.d.ts +18 -0
  68. package/dist/dashboard-layout.repository.d.ts.map +1 -0
  69. package/dist/dashboard-layout.repository.js +3 -0
  70. package/dist/dashboard-permissions.d.ts +3 -0
  71. package/dist/dashboard-permissions.d.ts.map +1 -0
  72. package/dist/dashboard-permissions.js +11 -0
  73. package/dist/dashboard-scopes.d.ts +12 -0
  74. package/dist/dashboard-scopes.d.ts.map +1 -0
  75. package/dist/dashboard-scopes.js +30 -0
  76. package/dist/define-seed.d.ts +3 -0
  77. package/dist/define-seed.d.ts.map +1 -0
  78. package/dist/define-seed.js +5 -0
  79. package/dist/demo-data.repository.d.ts +5 -0
  80. package/dist/demo-data.repository.d.ts.map +1 -0
  81. package/dist/demo-data.repository.js +3 -0
  82. package/dist/email.provider.d.ts +32 -0
  83. package/dist/email.provider.d.ts.map +1 -0
  84. package/dist/email.provider.js +4 -0
  85. package/dist/engine/ddl/ddl.d.ts +247 -0
  86. package/dist/engine/ddl/ddl.d.ts.map +1 -0
  87. package/dist/engine/ddl/ddl.js +653 -0
  88. package/dist/engine/ddl/schema-mutator.d.ts +29 -0
  89. package/dist/engine/ddl/schema-mutator.d.ts.map +1 -0
  90. package/dist/engine/ddl/schema-mutator.js +3 -0
  91. package/dist/engine/ddl/seed-ddl-destructive.d.ts +40 -0
  92. package/dist/engine/ddl/seed-ddl-destructive.d.ts.map +1 -0
  93. package/dist/engine/ddl/seed-ddl-destructive.js +149 -0
  94. package/dist/engine/ddl/seed-ddl.d.ts +43 -0
  95. package/dist/engine/ddl/seed-ddl.d.ts.map +1 -0
  96. package/dist/engine/ddl/seed-ddl.js +115 -0
  97. package/dist/engine/ddl/seed-purge-guards.d.ts +7 -0
  98. package/dist/engine/ddl/seed-purge-guards.d.ts.map +1 -0
  99. package/dist/engine/ddl/seed-purge-guards.js +19 -0
  100. package/dist/engine/engine.d.ts +4 -3
  101. package/dist/engine/engine.d.ts.map +1 -1
  102. package/dist/engine/engine.js +4 -3
  103. package/dist/engine/introspection/introspection.d.ts +101 -0
  104. package/dist/engine/introspection/introspection.d.ts.map +1 -0
  105. package/dist/engine/introspection/introspection.js +127 -0
  106. package/dist/engine/introspection/relation-audit.d.ts +46 -0
  107. package/dist/engine/introspection/relation-audit.d.ts.map +1 -0
  108. package/dist/engine/introspection/relation-audit.js +103 -0
  109. package/dist/engine/introspection/schema-fingerprint.d.ts +74 -0
  110. package/dist/engine/introspection/schema-fingerprint.d.ts.map +1 -0
  111. package/dist/engine/introspection/schema-fingerprint.js +102 -0
  112. package/dist/engine/introspection.d.ts +101 -0
  113. package/dist/engine/introspection.d.ts.map +1 -0
  114. package/dist/engine/introspection.js +127 -0
  115. package/dist/engine/localization/localization.d.ts +127 -0
  116. package/dist/engine/localization/localization.d.ts.map +1 -0
  117. package/dist/engine/localization/localization.js +212 -0
  118. package/dist/engine/localization.d.ts +127 -0
  119. package/dist/engine/localization.d.ts.map +1 -0
  120. package/dist/engine/localization.js +212 -0
  121. package/dist/engine/privacy/policies.d.ts +58 -0
  122. package/dist/engine/privacy/policies.d.ts.map +1 -0
  123. package/dist/engine/privacy/policies.js +191 -0
  124. package/dist/engine/privacy/privacy.service.d.ts +78 -0
  125. package/dist/engine/privacy/privacy.service.d.ts.map +1 -0
  126. package/dist/engine/privacy/privacy.service.js +138 -0
  127. package/dist/engine/privacy.service.d.ts.map +1 -1
  128. package/dist/engine/query/active-clause.d.ts +19 -0
  129. package/dist/engine/query/active-clause.d.ts.map +1 -0
  130. package/dist/engine/query/active-clause.js +27 -0
  131. package/dist/engine/query/query.d.ts +36 -0
  132. package/dist/engine/query/query.d.ts.map +1 -0
  133. package/dist/engine/query/query.js +393 -0
  134. package/dist/engine/query/relations.d.ts +28 -0
  135. package/dist/engine/query/relations.d.ts.map +1 -0
  136. package/dist/engine/query/relations.js +25 -0
  137. package/dist/engine/query/serialize.d.ts +22 -0
  138. package/dist/engine/query/serialize.d.ts.map +1 -0
  139. package/dist/engine/query/serialize.js +175 -0
  140. package/dist/engine/schema-fingerprint.d.ts +73 -0
  141. package/dist/engine/schema-fingerprint.d.ts.map +1 -0
  142. package/dist/engine/schema-fingerprint.js +97 -0
  143. package/dist/engine/seed-registry.d.ts.map +1 -1
  144. package/dist/engine/seeds/candidate-ids.d.ts +14 -0
  145. package/dist/engine/seeds/candidate-ids.d.ts.map +1 -0
  146. package/dist/engine/seeds/candidate-ids.js +40 -0
  147. package/dist/engine/seeds/define-seed.d.ts +3 -0
  148. package/dist/engine/seeds/define-seed.d.ts.map +1 -0
  149. package/dist/engine/seeds/define-seed.js +5 -0
  150. package/dist/engine/seeds/seed-definition-diff.d.ts +38 -0
  151. package/dist/engine/seeds/seed-definition-diff.d.ts.map +1 -0
  152. package/dist/engine/seeds/seed-definition-diff.js +51 -0
  153. package/dist/engine/seeds/seed-registry.d.ts +88 -0
  154. package/dist/engine/seeds/seed-registry.d.ts.map +1 -0
  155. package/dist/engine/seeds/seed-registry.js +194 -0
  156. package/dist/engine/seeds/seed-types-generator.d.ts +25 -0
  157. package/dist/engine/seeds/seed-types-generator.d.ts.map +1 -0
  158. package/dist/engine/seeds/seed-types-generator.js +116 -0
  159. package/dist/engine/seeds/seed-validation.d.ts +35 -0
  160. package/dist/engine/seeds/seed-validation.d.ts.map +1 -0
  161. package/dist/engine/seeds/seed-validation.js +384 -0
  162. package/dist/engine/seeds/seeds.d.ts +20 -0
  163. package/dist/engine/seeds/seeds.d.ts.map +1 -0
  164. package/dist/engine/seeds/seeds.js +21 -0
  165. package/dist/engine/seeds/tag-migration.d.ts +73 -0
  166. package/dist/engine/seeds/tag-migration.d.ts.map +1 -0
  167. package/dist/engine/seeds/tag-migration.js +212 -0
  168. package/dist/engine/seeds/tag-options.d.ts +15 -0
  169. package/dist/engine/seeds/tag-options.d.ts.map +1 -0
  170. package/dist/engine/seeds/tag-options.js +111 -0
  171. package/dist/engine/seeds/tag-value.d.ts +31 -0
  172. package/dist/engine/seeds/tag-value.d.ts.map +1 -0
  173. package/dist/engine/seeds/tag-value.js +51 -0
  174. package/dist/engine/types.d.ts +59 -7
  175. package/dist/engine/types.d.ts.map +1 -1
  176. package/dist/engine/validation/cache.d.ts.map +1 -1
  177. package/dist/engine/validation/cache.js +20 -4
  178. package/dist/engine/validation/emptiness.d.ts +12 -0
  179. package/dist/engine/validation/emptiness.d.ts.map +1 -0
  180. package/dist/engine/validation/emptiness.js +33 -0
  181. package/dist/engine/validation/index.d.ts +11 -0
  182. package/dist/engine/validation/index.d.ts.map +1 -1
  183. package/dist/engine/validation/index.js +29 -33
  184. package/dist/engine/validation/primitives.d.ts +12 -0
  185. package/dist/engine/validation/primitives.d.ts.map +1 -1
  186. package/dist/engine/validation/primitives.js +22 -0
  187. package/dist/engine/validation/richtext-sanitizer.d.ts +9 -1
  188. package/dist/engine/validation/richtext-sanitizer.d.ts.map +1 -1
  189. package/dist/engine/validation/richtext-sanitizer.js +36 -7
  190. package/dist/engine/validation/schema-builders.d.ts +16 -0
  191. package/dist/engine/validation/schema-builders.d.ts.map +1 -1
  192. package/dist/engine/validation/schema-builders.js +125 -18
  193. package/dist/engine.d.ts +144 -0
  194. package/dist/engine.d.ts.map +1 -0
  195. package/dist/engine.js +741 -0
  196. package/dist/file-types.d.ts +13 -0
  197. package/dist/file-types.d.ts.map +1 -0
  198. package/dist/file-types.js +85 -0
  199. package/dist/hooks.d.ts +29 -0
  200. package/dist/hooks.d.ts.map +1 -0
  201. package/dist/hooks.js +3 -0
  202. package/dist/id-generator.d.ts +26 -0
  203. package/dist/id-generator.d.ts.map +1 -0
  204. package/dist/id-generator.js +12 -0
  205. package/dist/idempotency.repository.d.ts +13 -0
  206. package/dist/idempotency.repository.d.ts.map +1 -0
  207. package/dist/idempotency.repository.js +3 -0
  208. package/dist/index.d.ts +34 -11
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +34 -11
  211. package/dist/kanban-position.repository.d.ts +19 -0
  212. package/dist/kanban-position.repository.d.ts.map +1 -0
  213. package/dist/kanban-position.repository.js +3 -0
  214. package/dist/kanban.d.ts +75 -0
  215. package/dist/kanban.d.ts.map +1 -0
  216. package/dist/kanban.js +82 -0
  217. package/dist/layout-permissions.d.ts +3 -0
  218. package/dist/layout-permissions.d.ts.map +1 -0
  219. package/dist/layout-permissions.js +11 -0
  220. package/dist/media/file-types.d.ts +12 -0
  221. package/dist/media/file-types.d.ts.map +1 -1
  222. package/dist/media/file-types.js +24 -4
  223. package/dist/media/image-transformer.d.ts +34 -0
  224. package/dist/media/image-transformer.d.ts.map +1 -0
  225. package/dist/media/image-transformer.js +3 -0
  226. package/dist/media/magic-bytes.d.ts.map +1 -1
  227. package/dist/media/magic-bytes.js +19 -9
  228. package/dist/media/media-transform.d.ts +92 -0
  229. package/dist/media/media-transform.d.ts.map +1 -0
  230. package/dist/media/media-transform.js +197 -0
  231. package/dist/media/media.repository.d.ts +5 -0
  232. package/dist/media/media.repository.d.ts.map +1 -1
  233. package/dist/media.repository.d.ts +61 -0
  234. package/dist/media.repository.d.ts.map +1 -0
  235. package/dist/media.repository.js +3 -0
  236. package/dist/notifications/notification.repository.d.ts +11 -2
  237. package/dist/notifications/notification.repository.d.ts.map +1 -1
  238. package/dist/oauth/authorization-code.repository.d.ts +10 -5
  239. package/dist/oauth/authorization-code.repository.d.ts.map +1 -1
  240. package/dist/oauth/role-guard.d.ts +30 -11
  241. package/dist/oauth/role-guard.d.ts.map +1 -1
  242. package/dist/oauth/role-guard.js +27 -5
  243. package/dist/oauth/token.repository.d.ts +2 -0
  244. package/dist/oauth/token.repository.d.ts.map +1 -1
  245. package/dist/policies.d.ts +10 -0
  246. package/dist/policies.d.ts.map +1 -0
  247. package/dist/policies.js +33 -0
  248. package/dist/queue/queue.interface.d.ts +9 -1
  249. package/dist/queue/queue.interface.d.ts.map +1 -1
  250. package/dist/queue/queue.stub.d.ts +1 -1
  251. package/dist/queue/queue.stub.d.ts.map +1 -1
  252. package/dist/queue/queue.stub.js +2 -3
  253. package/dist/queue.interface.d.ts +39 -0
  254. package/dist/queue.interface.d.ts.map +1 -0
  255. package/dist/queue.interface.js +3 -0
  256. package/dist/queue.stub.d.ts +6 -0
  257. package/dist/queue.stub.d.ts.map +1 -0
  258. package/dist/queue.stub.js +8 -0
  259. package/dist/rate-limit/token-bucket-rate-limiter.d.ts +7 -0
  260. package/dist/rate-limit/token-bucket-rate-limiter.d.ts.map +1 -1
  261. package/dist/rate-limit/token-bucket-rate-limiter.js +66 -0
  262. package/dist/rbac/evaluate.d.ts +57 -0
  263. package/dist/rbac/evaluate.d.ts.map +1 -0
  264. package/dist/rbac/evaluate.js +113 -0
  265. package/dist/rbac/invitation.repository.d.ts +84 -0
  266. package/dist/rbac/invitation.repository.d.ts.map +1 -0
  267. package/dist/rbac/invitation.repository.js +3 -0
  268. package/dist/rbac/permissions.d.ts +39 -0
  269. package/dist/rbac/permissions.d.ts.map +1 -0
  270. package/dist/rbac/permissions.js +43 -0
  271. package/dist/rbac/types.d.ts +130 -0
  272. package/dist/rbac/types.d.ts.map +1 -0
  273. package/dist/rbac/types.js +4 -0
  274. package/dist/relations.d.ts +28 -0
  275. package/dist/relations.d.ts.map +1 -0
  276. package/dist/relations.js +25 -0
  277. package/dist/richtext-render.d.ts +11 -0
  278. package/dist/richtext-render.d.ts.map +1 -0
  279. package/dist/richtext-render.js +87 -0
  280. package/dist/richtext.d.ts +11 -0
  281. package/dist/richtext.d.ts.map +1 -0
  282. package/dist/richtext.js +13 -0
  283. package/dist/scheduler.interface.d.ts +4 -0
  284. package/dist/scheduler.interface.d.ts.map +1 -0
  285. package/dist/scheduler.interface.js +3 -0
  286. package/dist/scheduler.stub.d.ts +5 -0
  287. package/dist/scheduler.stub.d.ts.map +1 -0
  288. package/dist/scheduler.stub.js +7 -0
  289. package/dist/schema/canonical.d.ts +15 -0
  290. package/dist/schema/canonical.d.ts.map +1 -0
  291. package/dist/schema/canonical.js +37 -0
  292. package/dist/schema/define.d.ts +42 -0
  293. package/dist/schema/define.d.ts.map +1 -0
  294. package/dist/schema/define.js +56 -0
  295. package/dist/schema/emit.d.ts +14 -0
  296. package/dist/schema/emit.d.ts.map +1 -0
  297. package/dist/schema/emit.js +43 -0
  298. package/dist/schema/index.d.ts +12 -0
  299. package/dist/schema/index.d.ts.map +1 -0
  300. package/dist/schema/index.js +13 -0
  301. package/dist/schema/manifest-seeds.d.ts +12 -0
  302. package/dist/schema/manifest-seeds.d.ts.map +1 -0
  303. package/dist/schema/manifest-seeds.js +48 -0
  304. package/dist/schema/manifest-validation.d.ts +13 -0
  305. package/dist/schema/manifest-validation.d.ts.map +1 -0
  306. package/dist/schema/manifest-validation.js +41 -0
  307. package/dist/schema/manifest.types.d.ts +54 -0
  308. package/dist/schema/manifest.types.d.ts.map +1 -0
  309. package/dist/schema/manifest.types.js +7 -0
  310. package/dist/schema-mutator.d.ts +26 -0
  311. package/dist/schema-mutator.d.ts.map +1 -0
  312. package/dist/schema-mutator.js +3 -0
  313. package/dist/search/search.repository.d.ts +5 -4
  314. package/dist/search/search.repository.d.ts.map +1 -1
  315. package/dist/search/vector-extractor.d.ts.map +1 -1
  316. package/dist/search/vector-extractor.js +23 -2
  317. package/dist/search/vector.repository.d.ts +2 -1
  318. package/dist/search/vector.repository.d.ts.map +1 -1
  319. package/dist/security/time-trap-token.repository.d.ts +5 -3
  320. package/dist/security/time-trap-token.repository.d.ts.map +1 -1
  321. package/dist/seed-ddl-destructive.d.ts +40 -0
  322. package/dist/seed-ddl-destructive.d.ts.map +1 -0
  323. package/dist/seed-ddl-destructive.js +149 -0
  324. package/dist/seed-ddl.d.ts +40 -0
  325. package/dist/seed-ddl.d.ts.map +1 -0
  326. package/dist/seed-ddl.js +100 -0
  327. package/dist/seed-layout.d.ts +145 -0
  328. package/dist/seed-layout.d.ts.map +1 -0
  329. package/dist/seed-layout.js +192 -0
  330. package/dist/seed-layout.repository.d.ts +22 -0
  331. package/dist/seed-layout.repository.d.ts.map +1 -0
  332. package/dist/seed-layout.repository.js +3 -0
  333. package/dist/seed-registry.d.ts +71 -0
  334. package/dist/seed-registry.d.ts.map +1 -0
  335. package/dist/seed-registry.js +143 -0
  336. package/dist/seed-types-generator.d.ts +1 -1
  337. package/dist/seed-types-generator.d.ts.map +1 -1
  338. package/dist/seed-validation.d.ts +23 -0
  339. package/dist/seed-validation.d.ts.map +1 -0
  340. package/dist/seed-validation.js +224 -0
  341. package/dist/seed.repository.d.ts +37 -0
  342. package/dist/seed.repository.d.ts.map +1 -0
  343. package/dist/seed.repository.js +3 -0
  344. package/dist/seeds.d.ts +20 -0
  345. package/dist/seeds.d.ts.map +1 -0
  346. package/dist/seeds.js +21 -0
  347. package/dist/settings/site-settings.repository.d.ts +8 -0
  348. package/dist/settings/site-settings.repository.d.ts.map +1 -1
  349. package/dist/site-settings.repository.d.ts +16 -0
  350. package/dist/site-settings.repository.d.ts.map +1 -0
  351. package/dist/site-settings.repository.js +3 -0
  352. package/dist/slug-utils.d.ts +18 -0
  353. package/dist/slug-utils.d.ts.map +1 -0
  354. package/dist/slug-utils.js +32 -0
  355. package/dist/storage.d.ts +46 -0
  356. package/dist/storage.d.ts.map +1 -0
  357. package/dist/storage.js +3 -0
  358. package/dist/transfer/csv.d.ts +34 -0
  359. package/dist/transfer/csv.d.ts.map +1 -0
  360. package/dist/transfer/csv.js +135 -0
  361. package/dist/transfer/flat-seed.d.ts +13 -0
  362. package/dist/transfer/flat-seed.d.ts.map +1 -0
  363. package/dist/transfer/flat-seed.js +50 -0
  364. package/dist/transfer/index.d.ts +7 -0
  365. package/dist/transfer/index.d.ts.map +1 -0
  366. package/dist/transfer/index.js +8 -0
  367. package/dist/transfer/ndjson.d.ts +25 -0
  368. package/dist/transfer/ndjson.d.ts.map +1 -0
  369. package/dist/transfer/ndjson.js +62 -0
  370. package/dist/transfer/row-mapping.d.ts +36 -0
  371. package/dist/transfer/row-mapping.d.ts.map +1 -0
  372. package/dist/transfer/row-mapping.js +97 -0
  373. package/dist/transfer/transfer.constants.d.ts +20 -0
  374. package/dist/transfer/transfer.constants.d.ts.map +1 -0
  375. package/dist/transfer/transfer.constants.js +21 -0
  376. package/dist/transfer/transfer.types.d.ts +46 -0
  377. package/dist/transfer/transfer.types.d.ts.map +1 -0
  378. package/dist/transfer/transfer.types.js +6 -0
  379. package/dist/types.d.ts +243 -0
  380. package/dist/types.d.ts.map +1 -0
  381. package/dist/types.js +3 -0
  382. package/dist/validation.d.ts +50 -0
  383. package/dist/validation.d.ts.map +1 -0
  384. package/dist/validation.js +660 -0
  385. package/dist/webhook-validation.d.ts +3 -0
  386. package/dist/webhook-validation.d.ts.map +1 -0
  387. package/dist/webhook-validation.js +6 -0
  388. package/package.json +11 -6
  389. package/dist/.tsbuildinfo +0 -1
@@ -0,0 +1,88 @@
1
+ import type { Seed, Branch } from '../types.js';
2
+ export interface ISeedRegistry {
3
+ /**
4
+ * Returns all seeds as a flat array, preserving insertion order.
5
+ * Decouples callers from the internal storage shape so the registry
6
+ * implementation can change without touching every route handler.
7
+ */
8
+ all(): Seed[];
9
+ /**
10
+ * Returns the seed with the given slug, or null if not found.
11
+ * Provides a single lookup point that can be overridden in tests
12
+ * without rebuilding the full registry object.
13
+ */
14
+ get(slug: string): Seed | null;
15
+ /**
16
+ * Returns seeds that are visible in the dashboard sidebar.
17
+ * A seed is visible when dashboard.hidden is not explicitly true.
18
+ * Eliminates the seeds.filter(s => !s.dashboard?.hidden) pattern
19
+ * that would otherwise be duplicated across route handlers.
20
+ */
21
+ visibleInDashboard(): Seed[];
22
+ /**
23
+ * Returns seeds that have allowPublicRead enabled.
24
+ * Eliminates the seeds.filter(s => s.allowPublicRead) pattern.
25
+ */
26
+ publicReadable(): Seed[];
27
+ /**
28
+ * Returns seeds that have the draft workflow enabled.
29
+ * Eliminates the seeds.filter(s => s.allowDrafts) pattern.
30
+ */
31
+ draftEnabled(): Seed[];
32
+ }
33
+ export declare class SeedRegistry implements ISeedRegistry {
34
+ private readonly seedMap;
35
+ private readonly orderedSeeds;
36
+ constructor(seeds: Seed[]);
37
+ all(): Seed[];
38
+ get(slug: string): Seed | null;
39
+ visibleInDashboard(): Seed[];
40
+ publicReadable(): Seed[];
41
+ draftEnabled(): Seed[];
42
+ }
43
+ /** A seed the registry refused to serve, with the validation failure that excluded it. */
44
+ export interface QuarantinedSeed {
45
+ slug: string;
46
+ reason: string;
47
+ }
48
+ /**
49
+ * Builds a registry from every seed that validates and sets aside the ones that do not.
50
+ *
51
+ * `new SeedRegistry(seeds)` is all-or-nothing: one seed holding a legacy shape (say pre-0.9 tag
52
+ * options) throws and takes the whole API down. Validation is per seed and independent, so this
53
+ * validates each seed alone and leaves the failing ones out. Callers log `quarantined`; the rest of
54
+ * the system keeps serving.
55
+ */
56
+ export declare function createTolerantSeedRegistry(seeds: ReadonlyArray<Seed>): {
57
+ registry: SeedRegistry;
58
+ quarantined: QuarantinedSeed[];
59
+ };
60
+ /**
61
+ * Named subclass of SeedRegistry for use in test suites.
62
+ * Gives tests a semantic name without requiring any dependency on factory.ts.
63
+ */
64
+ export declare class InMemorySeedRegistry extends SeedRegistry {
65
+ }
66
+ /** Finds a branch by its stable id within a Seed. Returns null if not found. */
67
+ export declare function findBranchById(seed: Seed, id: string): Branch | null;
68
+ /**
69
+ * Returns the next free branch id for a seed in the form `br_NN` (zero-padded to 2,
70
+ * growing as needed). Scans existing ids, never reuses a number already present —
71
+ * even if a branch was removed, its id is not recycled (ids must be globally stable
72
+ * for the life of the seed so layouts/automations/FTS triggers never collide).
73
+ */
74
+ export declare function nextBranchId(seed: Pick<Seed, 'branches'>): string;
75
+ /**
76
+ * Returns the input seeds reordered so that every seed appears AFTER all the
77
+ * seeds it depends on (its `relation` branch targets). Pure function — does
78
+ * not read from any global registry.
79
+ *
80
+ * Uses Kahn's algorithm (BFS on in-degree) for cycle detection and topological
81
+ * ordering. Sprint 3 (CLI / migration runner) consumes this to create tables in
82
+ * the correct order without disabling SQLite FK constraints.
83
+ *
84
+ * @throws {Error} When a relation targets an unknown slug not in `seeds`.
85
+ * @throws {Error} When a cyclic dependency is detected, listing involved slugs.
86
+ */
87
+ export declare function sortSeedsByDependencies(seeds: ReadonlyArray<Seed>): Seed[];
88
+ //# sourceMappingURL=seed-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-registry.d.ts","sourceRoot":"","sources":["../../../src/engine/seeds/seed-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAK/C,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,GAAG,IAAI,IAAI,EAAE,CAAA;IAEb;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAE9B;;;;;OAKG;IACH,kBAAkB,IAAI,IAAI,EAAE,CAAA;IAE5B;;;OAGG;IACH,cAAc,IAAI,IAAI,EAAE,CAAA;IAExB;;;OAGG;IACH,YAAY,IAAI,IAAI,EAAE,CAAA;CACvB;AAID,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;gBAEzB,KAAK,EAAE,IAAI,EAAE;IAsCzB,GAAG,IAAI,IAAI,EAAE;IAIb,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI9B,kBAAkB,IAAI,IAAI,EAAE;IAI5B,cAAc,IAAI,IAAI,EAAE;IAIxB,YAAY,IAAI,IAAI,EAAE;CAGvB;AAED,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG;IACtE,QAAQ,EAAE,YAAY,CAAA;IACtB,WAAW,EAAE,eAAe,EAAE,CAAA;CAC/B,CAYA;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;CAAG;AAEzD,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,MAAM,CAQjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CA0F1E"}
@@ -0,0 +1,194 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2024–2026 Flavio De Musso
3
+ import { AUTOMATION_RESERVED_WORDS } from '../../automations/automations-grammar-words.js';
4
+ import { SQL_RESERVED_WORDS } from '../sql-reserved-words.js';
5
+ import { tagOptionsIssues } from './tag-options.js';
6
+ const BRANCH_ID_RE = /^br_[A-Za-z0-9]+$/;
7
+ export class SeedRegistry {
8
+ seedMap;
9
+ orderedSeeds;
10
+ constructor(seeds) {
11
+ for (const seed of seeds) {
12
+ const idsInSeed = new Set();
13
+ for (const branch of seed.branches) {
14
+ if (AUTOMATION_RESERVED_WORDS.has(branch.alias)) {
15
+ throw new Error(`Seed "${seed.slug}" uses reserved alias "${branch.alias}". `
16
+ + `Pick a different alias — this word is used by the automation template grammar.`);
17
+ }
18
+ if (SQL_RESERVED_WORDS.has(branch.alias.toLowerCase())) {
19
+ throw new Error(`Seed "${seed.slug}" uses SQL reserved keyword "${branch.alias}". `
20
+ + `Please pick a different alias to prevent database errors.`);
21
+ }
22
+ if (!branch.id || !BRANCH_ID_RE.test(branch.id)) {
23
+ throw new Error(`Seed "${seed.slug}" branch "${branch.alias}" has invalid id "${branch.id}". `
24
+ + `Expected format ^br_[A-Za-z0-9]+$.`);
25
+ }
26
+ if (idsInSeed.has(branch.id)) {
27
+ throw new Error(`Seed "${seed.slug}" has duplicate branch id "${branch.id}".`);
28
+ }
29
+ idsInSeed.add(branch.id);
30
+ const optionIssues = tagOptionsIssues(branch);
31
+ if (optionIssues.length > 0) {
32
+ throw new Error(`Seed "${seed.slug}": ${optionIssues[0]}`);
33
+ }
34
+ }
35
+ }
36
+ this.orderedSeeds = seeds;
37
+ this.seedMap = new Map(seeds.map(seed => [seed.slug, seed]));
38
+ }
39
+ all() {
40
+ return this.orderedSeeds;
41
+ }
42
+ get(slug) {
43
+ return this.seedMap.get(slug) ?? null;
44
+ }
45
+ visibleInDashboard() {
46
+ return this.orderedSeeds.filter(seed => seed.dashboard?.hidden !== true);
47
+ }
48
+ publicReadable() {
49
+ return this.orderedSeeds.filter(seed => seed.allowPublicRead === true);
50
+ }
51
+ draftEnabled() {
52
+ return this.orderedSeeds.filter(seed => seed.allowDrafts === true);
53
+ }
54
+ }
55
+ /**
56
+ * Builds a registry from every seed that validates and sets aside the ones that do not.
57
+ *
58
+ * `new SeedRegistry(seeds)` is all-or-nothing: one seed holding a legacy shape (say pre-0.9 tag
59
+ * options) throws and takes the whole API down. Validation is per seed and independent, so this
60
+ * validates each seed alone and leaves the failing ones out. Callers log `quarantined`; the rest of
61
+ * the system keeps serving.
62
+ */
63
+ export function createTolerantSeedRegistry(seeds) {
64
+ const valid = [];
65
+ const quarantined = [];
66
+ for (const seed of seeds) {
67
+ try {
68
+ new SeedRegistry([seed]);
69
+ valid.push(seed);
70
+ }
71
+ catch (error) {
72
+ quarantined.push({ slug: seed.slug, reason: error instanceof Error ? error.message : String(error) });
73
+ }
74
+ }
75
+ return { registry: new SeedRegistry(valid), quarantined };
76
+ }
77
+ /**
78
+ * Named subclass of SeedRegistry for use in test suites.
79
+ * Gives tests a semantic name without requiring any dependency on factory.ts.
80
+ */
81
+ export class InMemorySeedRegistry extends SeedRegistry {
82
+ }
83
+ /** Finds a branch by its stable id within a Seed. Returns null if not found. */
84
+ export function findBranchById(seed, id) {
85
+ return seed.branches.find(b => b.id === id) ?? null;
86
+ }
87
+ /**
88
+ * Returns the next free branch id for a seed in the form `br_NN` (zero-padded to 2,
89
+ * growing as needed). Scans existing ids, never reuses a number already present —
90
+ * even if a branch was removed, its id is not recycled (ids must be globally stable
91
+ * for the life of the seed so layouts/automations/FTS triggers never collide).
92
+ */
93
+ export function nextBranchId(seed) {
94
+ let max = 0;
95
+ for (const b of seed.branches) {
96
+ const m = /^br_0*([0-9]+)$/.exec(b.id);
97
+ if (m)
98
+ max = Math.max(max, parseInt(m[1], 10));
99
+ }
100
+ const n = max + 1;
101
+ return `br_${String(n).padStart(2, '0')}`;
102
+ }
103
+ /**
104
+ * Returns the input seeds reordered so that every seed appears AFTER all the
105
+ * seeds it depends on (its `relation` branch targets). Pure function — does
106
+ * not read from any global registry.
107
+ *
108
+ * Uses Kahn's algorithm (BFS on in-degree) for cycle detection and topological
109
+ * ordering. Sprint 3 (CLI / migration runner) consumes this to create tables in
110
+ * the correct order without disabling SQLite FK constraints.
111
+ *
112
+ * @throws {Error} When a relation targets an unknown slug not in `seeds`.
113
+ * @throws {Error} When a cyclic dependency is detected, listing involved slugs.
114
+ */
115
+ export function sortSeedsByDependencies(seeds) {
116
+ const slugSet = new Set(seeds.map(s => s.slug));
117
+ // Validate all relation targets exist in the input array
118
+ for (const seed of seeds) {
119
+ for (const branch of seed.branches) {
120
+ if (branch.type === 'relation' && branch.targetSeed) {
121
+ if (!slugSet.has(branch.targetSeed)) {
122
+ throw new Error(`Seed '${seed.slug}' relates to unknown target '${branch.targetSeed}'`);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ // Build adjacency: inDegree[slug] = number of dependencies
128
+ // dependents[slug] = slugs that depend on slug
129
+ const inDegree = new Map();
130
+ const dependents = new Map();
131
+ for (const seed of seeds) {
132
+ if (!inDegree.has(seed.slug))
133
+ inDegree.set(seed.slug, 0);
134
+ if (!dependents.has(seed.slug))
135
+ dependents.set(seed.slug, []);
136
+ }
137
+ for (const seed of seeds) {
138
+ // Deduplicate targets to avoid inflating inDegree on multi-branch refs to same seed
139
+ const targets = new Set(seed.branches
140
+ .filter(b => b.type === 'relation' && b.targetSeed)
141
+ .map(b => b.targetSeed));
142
+ for (const target of targets) {
143
+ if (target === seed.slug)
144
+ continue; // self-reference needs no ordering
145
+ // seed depends on target → increment seed's in-degree
146
+ inDegree.set(seed.slug, (inDegree.get(seed.slug) ?? 0) + 1);
147
+ dependents.get(target).push(seed.slug);
148
+ }
149
+ }
150
+ // Kahn's BFS: start with seeds that have no dependencies
151
+ const seedBySlug = new Map(seeds.map(s => [s.slug, s]));
152
+ const queue = [];
153
+ for (const [slug, deg] of inDegree) {
154
+ if (deg === 0)
155
+ queue.push(slug);
156
+ }
157
+ const result = [];
158
+ while (queue.length > 0) {
159
+ const slug = queue.shift();
160
+ result.push(seedBySlug.get(slug));
161
+ for (const dependent of dependents.get(slug) ?? []) {
162
+ const newDeg = (inDegree.get(dependent) ?? 0) - 1;
163
+ inDegree.set(dependent, newDeg);
164
+ if (newDeg === 0)
165
+ queue.push(dependent);
166
+ }
167
+ }
168
+ if (result.length !== seeds.length) {
169
+ // Isolate true cycle members
170
+ const stuck = new Set([...inDegree.entries()]
171
+ .filter(([, deg]) => deg > 0)
172
+ .map(([slug]) => slug));
173
+ const cycleNodes = [...stuck].filter(slug => {
174
+ const visited = new Set();
175
+ const queue = [...(dependents.get(slug) ?? [])].filter(s => stuck.has(s));
176
+ while (queue.length > 0) {
177
+ const curr = queue.shift();
178
+ if (curr === slug)
179
+ return true;
180
+ if (!visited.has(curr)) {
181
+ visited.add(curr);
182
+ for (const next of dependents.get(curr) ?? []) {
183
+ if (stuck.has(next))
184
+ queue.push(next);
185
+ }
186
+ }
187
+ }
188
+ return false;
189
+ });
190
+ const cycle = (cycleNodes.length > 0 ? cycleNodes : [...stuck]).sort();
191
+ throw new Error(`Cyclic dependency detected among seeds: ${cycle.join(', ')}`);
192
+ }
193
+ return result;
194
+ }
@@ -0,0 +1,25 @@
1
+ import type { Seed, Branch } from '../types.js';
2
+ /** slug/alias → PascalCase identifier. 'blog-posts' → 'BlogPosts'. */
3
+ export declare function pascalCase(input: string): string;
4
+ /** Maps a single Branch to its TypeScript type expression (no optional marker). */
5
+ export declare function tsTypeForBranch(branch: Branch): string;
6
+ /** Emits one exported interface for a single Seed. */
7
+ export declare function interfaceForSeed(seed: Seed): string;
8
+ /** Options that affect the emitted module beyond the seed interfaces themselves. */
9
+ export interface SeedTypesOptions {
10
+ /**
11
+ * Schema fingerprint to embed as `SCHEMA_FINGERPRINT`, from `computeSchemaFingerprint`.
12
+ * Omitted ⇒ no constant is emitted and the output is byte-identical to a pre-fingerprint build,
13
+ * which is what keeps the legacy `beech gen-types` aliases non-breaking.
14
+ */
15
+ fingerprint?: string;
16
+ }
17
+ /**
18
+ * Pure entry point. Deterministic: sorts seeds by slug for stable diffs.
19
+ *
20
+ * The embedded fingerprint is the client's half of the drift check: `@beechcms/client` compares it
21
+ * against the `X-Schema-Revision` header the API returns and raises an actionable error on a
22
+ * mismatch, instead of trusting a stale response shape.
23
+ */
24
+ export declare function generateSeedTypes(seeds: Seed[], options?: SeedTypesOptions): string;
25
+ //# sourceMappingURL=seed-types-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-types-generator.d.ts","sourceRoot":"","sources":["../../../src/engine/seeds/seed-types-generator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAgB/C,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAMD,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiCtD;AAWD,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAYnD;AAKD,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAcvF"}
@@ -0,0 +1,116 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2024–2026 Flavio De Musso
3
+ import { tagOptionValues } from './tag-options.js';
4
+ const HEADER = '// Questo file è generato automaticamente da BeechCMS CLI. Non modificarlo direttamente.\n';
5
+ /** System columns emitted by generateCreateTable — always present, never optional. */
6
+ const SYSTEM_FIELDS = ` id: string\n` +
7
+ ` slug: string\n` +
8
+ ` status: 'draft' | 'review' | 'published' | 'archived'\n`;
9
+ const SYSTEM_TIMESTAMPS = ` created_at: number\n` +
10
+ ` updated_at: number\n`;
11
+ /** slug/alias → PascalCase identifier. 'blog-posts' → 'BlogPosts'. */
12
+ export function pascalCase(input) {
13
+ return input
14
+ .split(/[^A-Za-z0-9]+/)
15
+ .filter(Boolean)
16
+ .map(w => w.charAt(0).toUpperCase() + w.slice(1))
17
+ .join('');
18
+ }
19
+ function literalUnion(options) {
20
+ return options.map(o => `'${o.replace(/'/g, "\\'")}'`).join(' | ');
21
+ }
22
+ /** Maps a single Branch to its TypeScript type expression (no optional marker). */
23
+ export function tsTypeForBranch(branch) {
24
+ switch (branch.type) {
25
+ case 'number':
26
+ case 'date':
27
+ return 'number';
28
+ case 'boolean':
29
+ return 'boolean';
30
+ case 'json':
31
+ return 'unknown';
32
+ case 'text':
33
+ case 'richtext':
34
+ case 'file': {
35
+ return branch.type === 'file' && branch.multiple ? 'string[]' : 'string';
36
+ }
37
+ case 'tags': {
38
+ const values = tagOptionValues(branch);
39
+ const base = values.length > 0 ? `(${literalUnion(values)})` : 'string';
40
+ return `${base}[]`;
41
+ }
42
+ case 'relation':
43
+ return branch.multiple ? 'string[]' : 'string';
44
+ case 'repeater': {
45
+ const inner = (branch.fields ?? [])
46
+ .map(f => `${propName(f)}${optional(f)}: ${tsTypeForBranch(f)}`)
47
+ .join('; ');
48
+ return `Array<{ ${inner} }>`;
49
+ }
50
+ default: {
51
+ // Exhaustiveness guard — fails the build if BranchType gains a member.
52
+ const _never = branch.type;
53
+ return _never;
54
+ }
55
+ }
56
+ }
57
+ function optional(branch) {
58
+ return branch.requiredOnCreate ? '' : '?';
59
+ }
60
+ function propName(branch) {
61
+ // alias is a valid SQL column; quote only if not a plain identifier.
62
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(branch.alias) ? branch.alias : `'${branch.alias}'`;
63
+ }
64
+ /** Emits one exported interface for a single Seed. */
65
+ export function interfaceForSeed(seed) {
66
+ const name = pascalCase(seed.slug);
67
+ const props = seed.branches
68
+ .map(b => ` ${propName(b)}${optional(b)}: ${tsTypeForBranch(b)}`)
69
+ .join('\n');
70
+ return (`export interface ${name} {\n` +
71
+ SYSTEM_FIELDS +
72
+ (props ? props + '\n' : '') +
73
+ SYSTEM_TIMESTAMPS +
74
+ `}\n`);
75
+ }
76
+ /** `v{version}:{32 hex}` — the exact shape `computeSchemaFingerprint` returns. */
77
+ const FINGERPRINT_RE = /^v\d+:[0-9a-f]{32}$/;
78
+ /**
79
+ * Pure entry point. Deterministic: sorts seeds by slug for stable diffs.
80
+ *
81
+ * The embedded fingerprint is the client's half of the drift check: `@beechcms/client` compares it
82
+ * against the `X-Schema-Revision` header the API returns and raises an actionable error on a
83
+ * mismatch, instead of trusting a stale response shape.
84
+ */
85
+ export function generateSeedTypes(seeds, options = {}) {
86
+ const sorted = [...seeds].sort((a, b) => a.slug.localeCompare(b.slug));
87
+ const interfaces = sorted.map(interfaceForSeed).join('\n');
88
+ const registryProps = sorted
89
+ .map(s => ` ${propName({ alias: s.slug })}: ${pascalCase(s.slug)}`)
90
+ .join('\n');
91
+ const databaseRegistry = `export interface BeechDatabase {\n` +
92
+ (registryProps ? registryProps + '\n' : '') +
93
+ `}\n\n` +
94
+ `export type SeedRegistryTypes = BeechDatabase\n`;
95
+ return `${HEADER}\n${fingerprintBlock(options.fingerprint)}${interfaces}\n${databaseRegistry}`;
96
+ }
97
+ /**
98
+ * Emits the fingerprint constant, or nothing.
99
+ *
100
+ * The value is interpolated into source, so its shape is verified first: a fingerprint carrying a
101
+ * quote or a newline would emit a file that does not parse, and the failure would surface in the
102
+ * consumer's build rather than here.
103
+ */
104
+ function fingerprintBlock(fingerprint) {
105
+ if (fingerprint === undefined)
106
+ return '';
107
+ if (!FINGERPRINT_RE.test(fingerprint)) {
108
+ throw new Error(`Refusing to embed '${fingerprint}' as a schema fingerprint: expected the v{n}:{32 hex} form produced by computeSchemaFingerprint().`);
109
+ }
110
+ return (`/**\n` +
111
+ ` * Schema revision these types were generated from. \`@beechcms/client\` compares it against the\n` +
112
+ ` * \`X-Schema-Revision\` response header; a mismatch means the backend schema moved and this file\n` +
113
+ ` * must be regenerated with \`beech types generate\`.\n` +
114
+ ` */\n` +
115
+ `export const SCHEMA_FINGERPRINT = '${fingerprint}'\n\n`);
116
+ }
@@ -0,0 +1,35 @@
1
+ import type { Seed } from '../types.js';
2
+ /**
3
+ * Allowed charset for a branch alias. An alias becomes a raw SQL column name in
4
+ * CREATE TABLE / ADD COLUMN / CREATE INDEX and in SELECT/WHERE/ORDER BY clauses
5
+ * (see engine.ts), so it MUST be restricted to a safe identifier charset to
6
+ * prevent DDL/query injection. Exported so the seeds API rename route reuses the
7
+ * exact same guard — do not inline a divergent copy.
8
+ */
9
+ export declare const BRANCH_ALIAS_RE: RegExp;
10
+ /**
11
+ * Reason a branch alias is reserved, or `null` when free to use.
12
+ * Single source for seed validation and the branch rename route.
13
+ */
14
+ export declare function reservedBranchAliasReason(alias: string): string | null;
15
+ /**
16
+ * Allowed charset for a seed slug identifier.
17
+ * Must consist solely of lowercase ASCII letters, digits, and underscores.
18
+ * Exported so route handlers and validation functions reuse the exact same guard.
19
+ */
20
+ export declare const SEED_SLUG_RE: RegExp;
21
+ export declare const SLUG_RE: RegExp;
22
+ export interface SeedValidationIssue {
23
+ slug: string;
24
+ messages: string[];
25
+ fatal: boolean;
26
+ }
27
+ /**
28
+ * Pure, console-free, throw-free validation of a seed set.
29
+ * The single seed being created/edited should be validated in the context of
30
+ * the full active set: call validateSeedDefinitions([...otherActiveSeeds, edited]).
31
+ */
32
+ export declare function validateSeedDefinitions(seeds: Seed[]): SeedValidationIssue[];
33
+ /** Convenience: true iff no fatal issues. */
34
+ export declare function isSeedSetValid(seeds: Seed[]): boolean;
35
+ //# sourceMappingURL=seed-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-validation.d.ts","sourceRoot":"","sources":["../../../src/engine/seeds/seed-validation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAWvC;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,QAAyB,CAAA;AAErD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CActE;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAiB,CAAA;AAC1C,eAAO,MAAM,OAAO,QAAe,CAAA;AAGnC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,mBAAmB,EAAE,CA2V5E;AAED,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAErD"}