@beechcms/api 0.6.0-preview.2 → 0.6.0-preview.3

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 (375) hide show
  1. package/README.md +4 -4
  2. package/assets/dashboard/assets/chart-Cws4Yj6K.js +39 -0
  3. package/assets/dashboard/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  4. package/assets/dashboard/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  5. package/assets/dashboard/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  6. package/assets/dashboard/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  7. package/assets/dashboard/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  8. package/assets/dashboard/assets/index-BjPpppHe.css +1 -0
  9. package/assets/dashboard/assets/index-CrW-zhkA.js +642 -0
  10. package/assets/dashboard/assets/lora-cyrillic-ext-wght-normal-YcVxMP-u.woff2 +0 -0
  11. package/assets/dashboard/assets/lora-cyrillic-wght-normal-UWPuZLjM.woff2 +0 -0
  12. package/assets/dashboard/assets/lora-latin-ext-wght-normal-C2Wlntb9.woff2 +0 -0
  13. package/assets/dashboard/assets/lora-latin-wght-normal-BiLcIKcI.woff2 +0 -0
  14. package/assets/dashboard/assets/lora-math-wght-normal-sOy7rEfW.woff2 +0 -0
  15. package/assets/dashboard/assets/lora-symbols-wght-normal-DQ5VrUkH.woff2 +0 -0
  16. package/assets/dashboard/assets/lora-vietnamese-wght-normal-CfJ7gtf3.woff2 +0 -0
  17. package/assets/dashboard/assets/pie-chart-recharts-CAxoDQp2.js +1 -0
  18. package/assets/dashboard/assets/timeseries-chart-recharts-CixDW-LM.js +1 -0
  19. package/assets/dashboard/index.html +2 -2
  20. package/dist/auth/__fixtures__/in-memory-hash-provider.d.ts +5 -0
  21. package/dist/auth/__fixtures__/static-token-service.d.ts +6 -0
  22. package/dist/auth/bcrypt-hash-provider.d.ts +8 -0
  23. package/dist/auth/constants.d.ts +10 -0
  24. package/dist/auth/jose-token-service.d.ts +14 -0
  25. package/dist/auth/login.d.ts +32 -0
  26. package/dist/auth/refresh.d.ts +1 -0
  27. package/dist/factory.d.ts +39 -0
  28. package/dist/features/automations/action-executors/create-entry.executor.d.ts +7 -0
  29. package/dist/features/automations/action-executors/edit-field.executor.d.ts +7 -0
  30. package/dist/features/automations/action-executors/index.d.ts +13 -0
  31. package/dist/features/automations/action-executors/send-mail.executor.d.ts +7 -0
  32. package/dist/features/automations/action-executors/set-variable.executor.d.ts +15 -0
  33. package/dist/features/automations/action-executors/webhook.executor.d.ts +7 -0
  34. package/dist/features/automations/automation-runner.d.ts +13 -0
  35. package/dist/features/automations/automation-runner.utils.d.ts +3 -0
  36. package/dist/features/automations/automations.handler.d.ts +7 -0
  37. package/dist/features/automations/automations.schema.d.ts +191 -0
  38. package/dist/features/automations/context-resolver.d.ts +8 -0
  39. package/dist/features/automations/cron-runner.d.ts +9 -0
  40. package/dist/features/automations/cron-runner.utils.d.ts +1 -0
  41. package/dist/features/automations/filter-translation.d.ts +9 -0
  42. package/dist/features/automations/index.d.ts +7 -0
  43. package/dist/features/automations/template-grammar.d.ts +73 -0
  44. package/dist/features/automations/var-access-resolver.d.ts +6 -0
  45. package/dist/features/automations/when-evaluator.d.ts +3 -0
  46. package/dist/features/automations/when-pushdown.d.ts +2 -0
  47. package/dist/features/backrefs/backrefs.handler.d.ts +3 -0
  48. package/dist/features/backrefs/d1-backref.repository.d.ts +17 -0
  49. package/dist/features/backrefs/index.d.ts +1 -0
  50. package/dist/features/content/constants.d.ts +12 -0
  51. package/dist/features/content/handlers/bulk.handler.d.ts +3 -0
  52. package/dist/features/content/handlers/create.d.ts +3 -0
  53. package/dist/features/content/handlers/delete.d.ts +3 -0
  54. package/dist/features/content/handlers/facets.d.ts +3 -0
  55. package/dist/features/content/handlers/get.d.ts +4 -0
  56. package/dist/features/content/handlers/helpers.d.ts +12 -0
  57. package/dist/features/content/handlers/list.d.ts +3 -0
  58. package/dist/features/content/handlers/update.d.ts +3 -0
  59. package/dist/features/content/index.d.ts +4 -0
  60. package/dist/features/dashboard-layout/dashboard-layout.handler.d.ts +7 -0
  61. package/dist/features/dashboard-layout/index.d.ts +1 -0
  62. package/dist/features/draft/draft.handler.d.ts +4 -0
  63. package/dist/features/draft/draft.middleware.d.ts +9 -0
  64. package/dist/features/draft/index.d.ts +1 -0
  65. package/{src/features/email/email.provider.ts → dist/features/email/email.provider.d.ts} +19 -24
  66. package/dist/features/email/email.service.d.ts +13 -0
  67. package/dist/features/email/email.types.d.ts +94 -0
  68. package/{src/features/email/index.ts → dist/features/email/index.d.ts} +3 -16
  69. package/dist/features/email/providers/resend.d.ts +36 -0
  70. package/dist/features/email/providers/smtp.d.ts +11 -0
  71. package/dist/features/email/templates/automation-mail.d.ts +8 -0
  72. package/dist/features/email/templates/password-changed.d.ts +15 -0
  73. package/dist/features/email/templates/password-reset.d.ts +18 -0
  74. package/dist/features/email/templates/shell.d.ts +58 -0
  75. package/dist/features/notifications/index.d.ts +1 -0
  76. package/dist/features/notifications/notifications.handler.d.ts +15 -0
  77. package/dist/features/password-reset/index.d.ts +6 -0
  78. package/dist/features/password-reset/request.d.ts +10 -0
  79. package/dist/features/password-reset/reset.d.ts +9 -0
  80. package/dist/features/rotate-field/index.d.ts +1 -0
  81. package/dist/features/rotate-field/rotate-field.handler.d.ts +7 -0
  82. package/dist/features/rotate-field/rotate-field.schema.d.ts +11 -0
  83. package/dist/features/schema/schema.handler.d.ts +7 -0
  84. package/dist/features/seeds/index.d.ts +1 -0
  85. package/dist/features/seeds/seeds.handler.d.ts +6 -0
  86. package/dist/features/settings/settings.handler.d.ts +7 -0
  87. package/dist/features/setup/index.d.ts +7 -0
  88. package/dist/features/stats/index.d.ts +1 -0
  89. package/dist/features/stats/stats.handler.d.ts +7 -0
  90. package/dist/features/webhooks/index.d.ts +3 -0
  91. package/dist/index.d.ts +6 -0
  92. package/dist/index.js +9666 -0
  93. package/dist/media-utils.d.ts +25 -0
  94. package/dist/middleware/auth-providers.middleware.d.ts +8 -0
  95. package/dist/middleware/observability.middleware.d.ts +20 -0
  96. package/dist/middleware/rate-limit.middleware.d.ts +9 -0
  97. package/dist/middleware/repository.middleware.d.ts +34 -0
  98. package/dist/middleware/seed-registry.middleware.d.ts +10 -0
  99. package/dist/middleware/storage.middleware.d.ts +7 -0
  100. package/dist/middleware.d.ts +11 -0
  101. package/dist/public/access-policy.d.ts +12 -0
  102. package/dist/public/api-key-middleware.d.ts +6 -0
  103. package/dist/public/cache-utils.d.ts +10 -0
  104. package/dist/public/entry-projection.d.ts +2 -0
  105. package/dist/public/idempotency.d.ts +9 -0
  106. package/dist/public/index.d.ts +11 -0
  107. package/dist/public/problem-details.d.ts +31 -0
  108. package/dist/public/public-add.d.ts +3 -0
  109. package/dist/public/public-edit.d.ts +5 -0
  110. package/dist/public/public-errors.d.ts +13 -0
  111. package/dist/public/public-read.d.ts +3 -0
  112. package/dist/public/public-routes.d.ts +3 -0
  113. package/dist/public/query-builder.d.ts +28 -0
  114. package/dist/public/rate-limit-middleware.d.ts +3 -0
  115. package/dist/public/read-list.d.ts +26 -0
  116. package/dist/public/read-single.d.ts +22 -0
  117. package/dist/public/response-builder.d.ts +22 -0
  118. package/dist/public/sanitize.d.ts +23 -0
  119. package/{src/public/slug-utils.ts → dist/public/slug-utils.d.ts} +3 -10
  120. package/dist/rate-limit/cloudflare-rate-limiter.d.ts +6 -0
  121. package/dist/rate-limit/in-memory-rate-limiter.d.ts +7 -0
  122. package/dist/rate-limit/no-op-rate-limiter.d.ts +4 -0
  123. package/dist/search-utils.d.ts +54 -0
  124. package/dist/search.d.ts +6 -0
  125. package/dist/shared/apply-policies.d.ts +10 -0
  126. package/dist/shared/automations.repository.d1.d.ts +12 -0
  127. package/dist/shared/background-notification-service.d.ts +18 -0
  128. package/dist/shared/base.repository.d1.d.ts +18 -0
  129. package/dist/shared/content-utils.d.ts +21 -0
  130. package/dist/shared/content.repository.d1.d.ts +68 -0
  131. package/dist/shared/d1-activity-log.repository.d.ts +13 -0
  132. package/dist/shared/d1-activity-logger.d.ts +20 -0
  133. package/dist/shared/d1-analytics.repository.d.ts +20 -0
  134. package/dist/shared/d1-content-scan.repository.d.ts +7 -0
  135. package/dist/shared/d1-notification.repository.d.ts +17 -0
  136. package/dist/shared/d1-password-reset-token.repository.d.ts +10 -0
  137. package/dist/shared/d1-search.repository.d.ts +14 -0
  138. package/dist/shared/d1-session.repository.d.ts +12 -0
  139. package/dist/shared/d1-setup-checklist.repository.d.ts +12 -0
  140. package/dist/shared/d1-user.repository.d.ts +18 -0
  141. package/dist/shared/d1-widget.repository.d.ts +31 -0
  142. package/dist/shared/dashboard-layout.repository.d1.d.ts +9 -0
  143. package/dist/shared/demo-data-sql.d.ts +1 -0
  144. package/dist/shared/demo-data.repository.d1.d.ts +6 -0
  145. package/dist/shared/execution-context-scheduler.d.ts +6 -0
  146. package/dist/shared/fixed-clock.d.ts +13 -0
  147. package/dist/shared/fts-sync.d.ts +1 -0
  148. package/dist/shared/idempotency.repository.d1.d.ts +16 -0
  149. package/dist/shared/in-memory-activity-logger.d.ts +11 -0
  150. package/dist/shared/in-memory-notification-service.d.ts +11 -0
  151. package/dist/shared/in-memory-seed.repository.d.ts +18 -0
  152. package/dist/shared/media.repository.d1.d.ts +35 -0
  153. package/dist/shared/qstash-notification-service.d.ts +18 -0
  154. package/dist/shared/query-utils.d.ts +36 -0
  155. package/dist/shared/request-utils.d.ts +13 -0
  156. package/dist/shared/schema-mutator.d1.d.ts +12 -0
  157. package/dist/shared/seed-layout.repository.d1.d.ts +9 -0
  158. package/dist/shared/seed-registry-cache.d.ts +12 -0
  159. package/dist/shared/seed.repository.d1.d.ts +13 -0
  160. package/dist/shared/sequential-id-generator.d.ts +13 -0
  161. package/dist/shared/site-settings.repository.d1.d.ts +7 -0
  162. package/dist/shared/storage/factory.d.ts +8 -0
  163. package/dist/shared/storage/s3-bucket.d.ts +43 -0
  164. package/dist/shared/storage-utils.d.ts +7 -0
  165. package/dist/shared/system-stats.repository.d1.d.ts +25 -0
  166. package/dist/types.d.ts +85 -0
  167. package/dist/upload.d.ts +16 -0
  168. package/dist/widget.d.ts +7 -0
  169. package/package.json +27 -18
  170. package/assets/dashboard/assets/chart-BrJFdsGZ.js +0 -39
  171. package/assets/dashboard/assets/index-CIaoMxuB.css +0 -1
  172. package/assets/dashboard/assets/index-wTKgygsg.js +0 -636
  173. package/assets/dashboard/assets/pie-chart-recharts-BEaE1FOE.js +0 -1
  174. package/assets/dashboard/assets/timeseries-chart-recharts-DmWM6imF.js +0 -1
  175. package/src/auth/__fixtures__/in-memory-hash-provider.ts +0 -17
  176. package/src/auth/__fixtures__/static-token-service.ts +0 -22
  177. package/src/auth/bcrypt-hash-provider.ts +0 -24
  178. package/src/auth/constants.ts +0 -14
  179. package/src/auth/generate-refresh-token.test.ts +0 -23
  180. package/src/auth/hash-provider.test.ts +0 -55
  181. package/src/auth/jose-token-service.ts +0 -62
  182. package/src/auth/jwt-claims-passthrough.test.ts +0 -87
  183. package/src/auth/login.test.ts +0 -100
  184. package/src/auth/login.ts +0 -78
  185. package/src/auth/refresh.ts +0 -11
  186. package/src/auth/token-service.test.ts +0 -90
  187. package/src/factory.ts +0 -370
  188. package/src/features/automations/__tests__/action-executors.test.ts +0 -255
  189. package/src/features/automations/__tests__/automation-runner.test.ts +0 -196
  190. package/src/features/automations/__tests__/automation-runner.utils.test.ts +0 -60
  191. package/src/features/automations/__tests__/automations.handler.test.ts +0 -264
  192. package/src/features/automations/__tests__/automations.repository.test.ts +0 -163
  193. package/src/features/automations/__tests__/automations.schema.test.ts +0 -224
  194. package/src/features/automations/__tests__/context-resolver.test.ts +0 -126
  195. package/src/features/automations/__tests__/cron-runner.test.ts +0 -267
  196. package/src/features/automations/__tests__/cron-runner.utils.test.ts +0 -144
  197. package/src/features/automations/__tests__/set-variable.executor.test.ts +0 -383
  198. package/src/features/automations/__tests__/template-grammar.test.ts +0 -308
  199. package/src/features/automations/__tests__/webhook.executor.test.ts +0 -142
  200. package/src/features/automations/__tests__/when-evaluator.test.ts +0 -274
  201. package/src/features/automations/__tests__/when-pushdown.test.ts +0 -281
  202. package/src/features/automations/action-executors/create-entry.executor.ts +0 -27
  203. package/src/features/automations/action-executors/edit-field.executor.ts +0 -26
  204. package/src/features/automations/action-executors/index.ts +0 -37
  205. package/src/features/automations/action-executors/send-mail.executor.ts +0 -53
  206. package/src/features/automations/action-executors/set-variable.executor.ts +0 -159
  207. package/src/features/automations/action-executors/webhook.executor.ts +0 -67
  208. package/src/features/automations/automation-runner.ts +0 -85
  209. package/src/features/automations/automation-runner.utils.ts +0 -47
  210. package/src/features/automations/automations.handler.ts +0 -197
  211. package/src/features/automations/automations.schema.ts +0 -177
  212. package/src/features/automations/context-resolver.ts +0 -152
  213. package/src/features/automations/cron-runner.ts +0 -140
  214. package/src/features/automations/cron-runner.utils.ts +0 -44
  215. package/src/features/automations/filter-translation.ts +0 -46
  216. package/src/features/automations/index.ts +0 -16
  217. package/src/features/automations/template-grammar.ts +0 -245
  218. package/src/features/automations/var-access-resolver.ts +0 -140
  219. package/src/features/automations/when-evaluator.ts +0 -87
  220. package/src/features/automations/when-pushdown.ts +0 -57
  221. package/src/features/backrefs/__tests__/backrefs.handler.test.ts +0 -359
  222. package/src/features/backrefs/backrefs.handler.ts +0 -168
  223. package/src/features/backrefs/d1-backref.repository.ts +0 -84
  224. package/src/features/backrefs/index.ts +0 -5
  225. package/src/features/content/constants.ts +0 -16
  226. package/src/features/content/handlers/bulk.handler.ts +0 -185
  227. package/src/features/content/handlers/create.ts +0 -129
  228. package/src/features/content/handlers/delete.ts +0 -62
  229. package/src/features/content/handlers/facets.ts +0 -49
  230. package/src/features/content/handlers/get.ts +0 -120
  231. package/src/features/content/handlers/helpers.test.ts +0 -180
  232. package/src/features/content/handlers/helpers.ts +0 -93
  233. package/src/features/content/handlers/list.ts +0 -174
  234. package/src/features/content/handlers/update.ts +0 -174
  235. package/src/features/content/index.ts +0 -26
  236. package/src/features/dashboard-layout/__tests__/dashboard-layout.handler.test.ts +0 -388
  237. package/src/features/dashboard-layout/dashboard-layout.handler.ts +0 -206
  238. package/src/features/dashboard-layout/index.ts +0 -5
  239. package/src/features/draft/draft.handler.ts +0 -195
  240. package/src/features/draft/draft.middleware.ts +0 -66
  241. package/src/features/draft/index.ts +0 -5
  242. package/src/features/email/email.service.ts +0 -98
  243. package/src/features/email/email.types.ts +0 -119
  244. package/src/features/email/providers/resend.ts +0 -67
  245. package/src/features/email/providers/smtp.ts +0 -55
  246. package/src/features/email/templates/automation-mail.ts +0 -19
  247. package/src/features/email/templates/password-changed.ts +0 -63
  248. package/src/features/email/templates/password-reset.ts +0 -68
  249. package/src/features/email/templates/shell.ts +0 -96
  250. package/src/features/notifications/index.ts +0 -5
  251. package/src/features/notifications/notifications.handler.ts +0 -105
  252. package/src/features/password-reset/index.ts +0 -19
  253. package/src/features/password-reset/request.ts +0 -92
  254. package/src/features/password-reset/reset.ts +0 -102
  255. package/src/features/rotate-field/index.ts +0 -5
  256. package/src/features/rotate-field/rotate-field.handler.ts +0 -132
  257. package/src/features/rotate-field/rotate-field.schema.ts +0 -17
  258. package/src/features/schema/schema.handler.ts +0 -131
  259. package/src/features/seeds/index.ts +0 -5
  260. package/src/features/seeds/seeds.handler.test.ts +0 -1199
  261. package/src/features/seeds/seeds.handler.ts +0 -558
  262. package/src/features/settings/__tests__/settings.handler.test.ts +0 -555
  263. package/src/features/settings/settings.handler.ts +0 -392
  264. package/src/features/setup/index.ts +0 -288
  265. package/src/features/stats/index.ts +0 -5
  266. package/src/features/stats/stats.handler.ts +0 -420
  267. package/src/features/webhooks/index.ts +0 -63
  268. package/src/index.ts +0 -65
  269. package/src/media-utils.ts +0 -82
  270. package/src/middleware/auth-providers.middleware.test.ts +0 -85
  271. package/src/middleware/auth-providers.middleware.ts +0 -45
  272. package/src/middleware/observability.middleware.test.ts +0 -93
  273. package/src/middleware/observability.middleware.ts +0 -70
  274. package/src/middleware/rate-limit.middleware.ts +0 -45
  275. package/src/middleware/repository.middleware.ts +0 -117
  276. package/src/middleware/seed-registry.middleware.test.ts +0 -97
  277. package/src/middleware/seed-registry.middleware.ts +0 -21
  278. package/src/middleware/storage.middleware.ts +0 -25
  279. package/src/middleware.ts +0 -45
  280. package/src/public/access-policy.ts +0 -27
  281. package/src/public/api-key-middleware.ts +0 -57
  282. package/src/public/cache-utils.ts +0 -38
  283. package/src/public/entry-projection.ts +0 -46
  284. package/src/public/idempotency.ts +0 -23
  285. package/src/public/index.ts +0 -16
  286. package/src/public/problem-details.ts +0 -124
  287. package/src/public/public-add.ts +0 -114
  288. package/src/public/public-edit.ts +0 -163
  289. package/src/public/public-errors.ts +0 -19
  290. package/src/public/public-read.ts +0 -63
  291. package/src/public/public-routes.ts +0 -88
  292. package/src/public/query-builder.test.ts +0 -224
  293. package/src/public/query-builder.ts +0 -156
  294. package/src/public/rate-limit-middleware.ts +0 -34
  295. package/src/public/read-list.ts +0 -54
  296. package/src/public/read-single.ts +0 -48
  297. package/src/public/response-builder.ts +0 -30
  298. package/src/public/sanitize.ts +0 -69
  299. package/src/rate-limit/cloudflare-rate-limiter.test.ts +0 -30
  300. package/src/rate-limit/cloudflare-rate-limiter.ts +0 -15
  301. package/src/rate-limit/in-memory-rate-limiter.test.ts +0 -37
  302. package/src/rate-limit/in-memory-rate-limiter.ts +0 -17
  303. package/src/rate-limit/no-op-rate-limiter.test.ts +0 -22
  304. package/src/rate-limit/no-op-rate-limiter.ts +0 -11
  305. package/src/search-utils.test.ts +0 -211
  306. package/src/search-utils.ts +0 -213
  307. package/src/search.ts +0 -65
  308. package/src/shared/apply-policies.test.ts +0 -81
  309. package/src/shared/apply-policies.ts +0 -67
  310. package/src/shared/automations.repository.d1.ts +0 -150
  311. package/src/shared/background-notification-service.test.ts +0 -62
  312. package/src/shared/background-notification-service.ts +0 -52
  313. package/src/shared/base.repository.d1.ts +0 -32
  314. package/src/shared/content-utils.test.ts +0 -165
  315. package/src/shared/content-utils.ts +0 -86
  316. package/src/shared/content.repository.d1.test.ts +0 -507
  317. package/src/shared/content.repository.d1.ts +0 -851
  318. package/src/shared/d1-activity-log.repository.test.ts +0 -140
  319. package/src/shared/d1-activity-log.repository.ts +0 -105
  320. package/src/shared/d1-activity-logger.test.ts +0 -86
  321. package/src/shared/d1-activity-logger.ts +0 -67
  322. package/src/shared/d1-analytics.repository.test.ts +0 -78
  323. package/src/shared/d1-analytics.repository.ts +0 -85
  324. package/src/shared/d1-content-scan.repository.test.ts +0 -80
  325. package/src/shared/d1-content-scan.repository.ts +0 -37
  326. package/src/shared/d1-notification.repository.test.ts +0 -128
  327. package/src/shared/d1-notification.repository.ts +0 -118
  328. package/src/shared/d1-password-reset-token.repository.test.ts +0 -81
  329. package/src/shared/d1-password-reset-token.repository.ts +0 -56
  330. package/src/shared/d1-search.repository.test.ts +0 -87
  331. package/src/shared/d1-search.repository.ts +0 -88
  332. package/src/shared/d1-session.repository.test.ts +0 -125
  333. package/src/shared/d1-session.repository.ts +0 -102
  334. package/src/shared/d1-setup-checklist.repository.ts +0 -36
  335. package/src/shared/d1-user.repository.test.ts +0 -151
  336. package/src/shared/d1-user.repository.ts +0 -119
  337. package/src/shared/d1-widget.repository.test.ts +0 -267
  338. package/src/shared/d1-widget.repository.ts +0 -385
  339. package/src/shared/dashboard-layout.repository.d1.test.ts +0 -135
  340. package/src/shared/dashboard-layout.repository.d1.ts +0 -58
  341. package/src/shared/demo-data-sql.ts +0 -216
  342. package/src/shared/demo-data.repository.d1.ts +0 -20
  343. package/src/shared/execution-context-scheduler.ts +0 -13
  344. package/src/shared/fixed-clock.ts +0 -25
  345. package/src/shared/fts-sync.ts +0 -8
  346. package/src/shared/idempotency.repository.d1.test.ts +0 -83
  347. package/src/shared/idempotency.repository.d1.ts +0 -60
  348. package/src/shared/in-memory-activity-logger.ts +0 -19
  349. package/src/shared/in-memory-notification-service.ts +0 -19
  350. package/src/shared/in-memory-seed.repository.ts +0 -58
  351. package/src/shared/media.repository.d1.test.ts +0 -107
  352. package/src/shared/media.repository.d1.ts +0 -68
  353. package/src/shared/qstash-notification-service.test.ts +0 -67
  354. package/src/shared/qstash-notification-service.ts +0 -55
  355. package/src/shared/query-utils.ts +0 -141
  356. package/src/shared/request-utils.ts +0 -26
  357. package/src/shared/schema-mutator.d1.test.ts +0 -142
  358. package/src/shared/schema-mutator.d1.ts +0 -64
  359. package/src/shared/seed-layout.repository.d1.test.ts +0 -114
  360. package/src/shared/seed-layout.repository.d1.ts +0 -62
  361. package/src/shared/seed-registry-cache.test.ts +0 -68
  362. package/src/shared/seed-registry-cache.ts +0 -49
  363. package/src/shared/seed.repository.d1.test.ts +0 -143
  364. package/src/shared/seed.repository.d1.ts +0 -98
  365. package/src/shared/sequential-id-generator.ts +0 -33
  366. package/src/shared/site-settings.repository.d1.ts +0 -53
  367. package/src/shared/storage/factory.ts +0 -41
  368. package/src/shared/storage/s3-bucket.ts +0 -195
  369. package/src/shared/storage-utils.ts +0 -40
  370. package/src/shared/system-stats.repository.d1.test.ts +0 -58
  371. package/src/shared/system-stats.repository.d1.ts +0 -48
  372. package/src/types.ts +0 -90
  373. package/src/upload.ts +0 -198
  374. package/src/widget.test.ts +0 -85
  375. package/src/widget.ts +0 -251
@@ -1,216 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
-
4
- export const DEMO_DATA_SQL = `
5
- INSERT OR IGNORE INTO content_clienti (id, slug, status, name, email, company, tier, account_status, mrr, created_at, updated_at)
6
- VALUES
7
- ('clt-0001', 'customer-1', 'published', 'Anna Rossi', 'anna.rossi@example.com', 'Beta Systems', 'free', 'active', 0, 1779795635, 1779795635),
8
- ('clt-0002', 'customer-2', 'published', 'Marco Bruno', 'marco.bruno@example.com', 'DataSync', 'enterprise', 'active', 551, 1776454206, 1776454206),
9
- ('clt-0003', 'customer-3', 'published', 'Giulia Rossi', 'giulia.rossi@example.com', 'NextGen IT', 'free', 'active', 0, 1778487018, 1778487018),
10
- ('clt-0004', 'customer-4', 'published', 'Luca Rossi', 'luca.rossi@example.com', 'Beta Systems', 'free', 'active', 0, 1776735015, 1776735015),
11
- ('clt-0005', 'customer-5', 'published', 'Luca Colombo', 'luca.colombo@example.com', 'Nova Labs', 'free', 'active', 0, 1779238418, 1779238418),
12
- ('clt-0006', 'customer-6', 'published', 'Matteo Bruno', 'matteo.bruno@example.com', 'GlobalNet', 'pro', 'active', 94, 1778652671, 1778652671),
13
- ('clt-0007', 'customer-7', 'published', 'Giulia Marino', 'giulia.marino@example.com', 'TechFlow', 'pro', 'churned', 0, 1778533118, 1778533118),
14
- ('clt-0008', 'customer-8', 'published', 'Matteo Esposito', 'matteo.esposito@example.com', 'Innova Solutions', 'free', 'active', 0, 1776239680, 1776239680),
15
- ('clt-0009', 'customer-9', 'published', 'Marco Rossi', 'marco.rossi@example.com', 'Beta Systems', 'pro', 'active', 101, 1777739809, 1777739809),
16
- ('clt-0010', 'customer-10', 'published', 'Luca Gallo', 'luca.gallo@example.com', 'NextGen IT', 'free', 'active', 0, 1776486131, 1776486131),
17
- ('clt-0011', 'customer-11', 'published', 'Giulia Bruno', 'giulia.bruno@example.com', 'CloudBase', 'free', 'active', 0, 1780953641, 1780953641),
18
- ('clt-0012', 'customer-12', 'published', 'Martina Marino', 'martina.marino@example.com', 'GlobalNet', 'free', 'churned', 0, 1778570992, 1778570992),
19
- ('clt-0013', 'customer-13', 'published', 'Matteo Colombo', 'matteo.colombo@example.com', 'NextGen IT', 'free', 'churned', 0, 1780724573, 1780724573),
20
- ('clt-0014', 'customer-14', 'published', 'Alessandro Ricci', 'alessandro.ricci@example.com', 'Alpha Dynamics', 'free', 'active', 0, 1776113837, 1776113837),
21
- ('clt-0015', 'customer-15', 'published', 'Anna Greco', 'anna.greco@example.com', 'Acme Corp', 'pro', 'active', 133, 1780583015, 1780583015),
22
- ('clt-0016', 'customer-16', 'published', 'Anna Gallo', 'anna.gallo@example.com', 'Nova Labs', 'free', 'churned', 0, 1779981685, 1779981685),
23
- ('clt-0017', 'customer-17', 'published', 'Giulia Esposito', 'giulia.esposito@example.com', 'CloudBase', 'free', 'active', 0, 1776530341, 1776530341),
24
- ('clt-0018', 'customer-18', 'published', 'Sofia Romano', 'sofia.romano@example.com', 'Alpha Dynamics', 'pro', 'active', 78, 1778027576, 1778027576),
25
- ('clt-0019', 'customer-19', 'published', 'Luca Ricci', 'luca.ricci@example.com', 'Nova Labs', 'enterprise', 'active', 1883, 1781250380, 1781250380),
26
- ('clt-0020', 'customer-20', 'published', 'Marco Bruno', 'marco.bruno@example.com', 'Innova Solutions', 'pro', 'active', 140, 1776541561, 1776541561),
27
- ('clt-0021', 'customer-21', 'published', 'Giulia Romano', 'giulia.romano@example.com', 'Alpha Dynamics', 'free', 'active', 0, 1781043838, 1781043838),
28
- ('clt-0022', 'customer-22', 'published', 'Sofia Romano', 'sofia.romano@example.com', 'GlobalNet', 'enterprise', 'active', 1212, 1776576892, 1776576892),
29
- ('clt-0023', 'customer-23', 'published', 'Marco Esposito', 'marco.esposito@example.com', 'Innova Solutions', 'pro', 'churned', 0, 1777718792, 1777718792),
30
- ('clt-0024', 'customer-24', 'published', 'Francesca Colombo', 'francesca.colombo@example.com', 'GlobalNet', 'free', 'active', 0, 1778358033, 1778358033),
31
- ('clt-0025', 'customer-25', 'published', 'Sofia Rossi', 'sofia.rossi@example.com', 'Beta Systems', 'free', 'active', 0, 1780759797, 1780759797),
32
- ('clt-0026', 'customer-26', 'published', 'Sofia Romano', 'sofia.romano@example.com', 'DataSync', 'enterprise', 'active', 1212, 1776537213, 1776537213),
33
- ('clt-0027', 'customer-27', 'published', 'Martina Esposito', 'martina.esposito@example.com', 'Beta Systems', 'enterprise', 'active', 809, 1780535965, 1780535965),
34
- ('clt-0028', 'customer-28', 'published', 'Sofia Gallo', 'sofia.gallo@example.com', 'Beta Systems', 'enterprise', 'active', 570, 1777219375, 1777219375),
35
- ('clt-0029', 'customer-29', 'published', 'Alessandro Marino', 'alessandro.marino@example.com', 'Acme Corp', 'pro', 'active', 52, 1776762582, 1776762582),
36
- ('clt-0030', 'customer-30', 'published', 'Anna Gallo', 'anna.gallo@example.com', 'Alpha Dynamics', 'pro', 'active', 143, 1777369926, 1777369926),
37
- ('clt-0031', 'customer-31', 'published', 'Matteo Bruno', 'matteo.bruno@example.com', 'TechFlow', 'free', 'active', 0, 1778360883, 1778360883),
38
- ('clt-0032', 'customer-32', 'published', 'Matteo Ricci', 'matteo.ricci@example.com', 'CloudBase', 'pro', 'active', 142, 1776266895, 1776266895),
39
- ('clt-0033', 'customer-33', 'published', 'Sofia Marino', 'sofia.marino@example.com', 'GlobalNet', 'pro', 'active', 139, 1778387056, 1778387056),
40
- ('clt-0034', 'customer-34', 'published', 'Lorenzo Colombo', 'lorenzo.colombo@example.com', 'DataSync', 'free', 'active', 0, 1779139259, 1779139259),
41
- ('clt-0035', 'customer-35', 'published', 'Giulia Marino', 'giulia.marino@example.com', 'CloudBase', 'pro', 'active', 138, 1780593486, 1780593486),
42
- ('clt-0036', 'customer-36', 'published', 'Sofia Esposito', 'sofia.esposito@example.com', 'GlobalNet', 'enterprise', 'active', 727, 1776372158, 1776372158),
43
- ('clt-0037', 'customer-37', 'published', 'Martina Bruno', 'martina.bruno@example.com', 'Beta Systems', 'enterprise', 'active', 1628, 1778759491, 1778759491),
44
- ('clt-0038', 'customer-38', 'published', 'Luca Bruno', 'luca.bruno@example.com', 'NextGen IT', 'enterprise', 'active', 1388, 1780282199, 1780282199),
45
- ('clt-0039', 'customer-39', 'published', 'Giulia Marino', 'giulia.marino@example.com', 'Beta Systems', 'pro', 'active', 80, 1779589290, 1779589290),
46
- ('clt-0040', 'customer-40', 'published', 'Luca Bruno', 'luca.bruno@example.com', 'NextGen IT', 'free', 'churned', 0, 1776195866, 1776195866),
47
- ('clt-0041', 'customer-41', 'published', 'Anna Bruno', 'anna.bruno@example.com', 'Beta Systems', 'pro', 'active', 150, 1779519119, 1779519119),
48
- ('clt-0042', 'customer-42', 'published', 'Luca Bianchi', 'luca.bianchi@example.com', 'Acme Corp', 'enterprise', 'active', 737, 1780125342, 1780125342),
49
- ('clt-0043', 'customer-43', 'published', 'Sofia Bruno', 'sofia.bruno@example.com', 'NextGen IT', 'pro', 'active', 119, 1780182487, 1780182487),
50
- ('clt-0044', 'customer-44', 'published', 'Lorenzo Bruno', 'lorenzo.bruno@example.com', 'Alpha Dynamics', 'free', 'active', 0, 1779137990, 1779137990),
51
- ('clt-0045', 'customer-45', 'published', 'Matteo Esposito', 'matteo.esposito@example.com', 'DataSync', 'free', 'active', 0, 1780762196, 1780762196),
52
- ('clt-0046', 'customer-46', 'published', 'Marco Gallo', 'marco.gallo@example.com', 'Nova Labs', 'enterprise', 'active', 1453, 1780405154, 1780405154),
53
- ('clt-0047', 'customer-47', 'published', 'Luca Romano', 'luca.romano@example.com', 'DataSync', 'free', 'active', 0, 1780954461, 1780954461),
54
- ('clt-0048', 'customer-48', 'published', 'Marco Ricci', 'marco.ricci@example.com', 'Acme Corp', 'free', 'active', 0, 1778854876, 1778854876),
55
- ('clt-0049', 'customer-49', 'published', 'Lorenzo Ricci', 'lorenzo.ricci@example.com', 'TechFlow', 'enterprise', 'active', 1889, 1778914952, 1778914952),
56
- ('clt-0050', 'customer-50', 'published', 'Giulia Ricci', 'giulia.ricci@example.com', 'Beta Systems', 'pro', 'active', 82, 1779858975, 1779858975);
57
-
58
- INSERT OR IGNORE INTO content_abbonamenti (id, slug, status, customer_id, amount, billing_cycle, payment_status, created_at, updated_at)
59
- VALUES
60
- ('sub-0001', 'sub-1', 'published', 'clt-0050', 142, 'monthly', 'active', 1780216609, 1780216609),
61
- ('sub-0002', 'sub-2', 'published', 'clt-0050', 81, 'monthly', 'active', 1781344231, 1781344231),
62
- ('sub-0003', 'sub-3', 'published', 'clt-0044', 0, 'annual', 'active', 1779906618, 1779906618),
63
- ('sub-0004', 'sub-4', 'published', 'clt-0020', 127, 'monthly', 'active', 1776721859, 1776721859),
64
- ('sub-0005', 'sub-5', 'published', 'clt-0042', 600, 'monthly', 'active', 1780763124, 1780763124),
65
- ('sub-0006', 'sub-6', 'published', 'clt-0032', 67, 'monthly', 'active', 1776865001, 1776865001),
66
- ('sub-0007', 'sub-7', 'published', 'clt-0002', 1078, 'monthly', 'active', 1777936327, 1777936327),
67
- ('sub-0008', 'sub-8', 'published', 'clt-0002', 1757, 'monthly', 'active', 1776735383, 1776735383),
68
- ('sub-0009', 'sub-9', 'published', 'clt-0021', 0, 'monthly', 'active', 1782738413, 1782738413),
69
- ('sub-0010', 'sub-10', 'published', 'clt-0049', 1426, 'annual', 'active', 1779618457, 1779618457),
70
- ('sub-0011', 'sub-11', 'published', 'clt-0038', 1304, 'annual', 'active', 1780843746, 1780843746),
71
- ('sub-0012', 'sub-12', 'published', 'clt-0035', 106, 'monthly', 'active', 1782023174, 1782023174),
72
- ('sub-0013', 'sub-13', 'published', 'clt-0013', 0, 'monthly', 'canceled', 1783068575, 1783068575),
73
- ('sub-0014', 'sub-14', 'published', 'clt-0048', 0, 'monthly', 'active', 1779252007, 1779252007),
74
- ('sub-0015', 'sub-15', 'published', 'clt-0034', 0, 'monthly', 'active', 1781382334, 1781382334),
75
- ('sub-0016', 'sub-16', 'published', 'clt-0028', 625, 'monthly', 'active', 1779346600, 1779346600),
76
- ('sub-0017', 'sub-17', 'published', 'clt-0040', 0, 'monthly', 'canceled', 1777921191, 1777921191),
77
- ('sub-0018', 'sub-18', 'published', 'clt-0034', 0, 'monthly', 'active', 1779909275, 1779909275),
78
- ('sub-0019', 'sub-19', 'published', 'clt-0021', 0, 'monthly', 'active', 1783164658, 1783164658),
79
- ('sub-0020', 'sub-20', 'published', 'clt-0003', 0, 'monthly', 'active', 1779668082, 1779668082),
80
- ('sub-0021', 'sub-21', 'published', 'clt-0038', 1133, 'annual', 'active', 1780677965, 1780677965),
81
- ('sub-0022', 'sub-22', 'published', 'clt-0020', 75, 'monthly', 'active', 1776846702, 1776846702),
82
- ('sub-0023', 'sub-23', 'published', 'clt-0027', 556, 'annual', 'active', 1782404111, 1782404111),
83
- ('sub-0024', 'sub-24', 'published', 'clt-0023', 98, 'monthly', 'canceled', 1779457981, 1779457981),
84
- ('sub-0025', 'sub-25', 'published', 'clt-0034', 0, 'monthly', 'active', 1779355311, 1779355311),
85
- ('sub-0026', 'sub-26', 'published', 'clt-0043', 60, 'annual', 'active', 1782541120, 1782541120),
86
- ('sub-0027', 'sub-27', 'published', 'clt-0021', 0, 'monthly', 'active', 1782468720, 1782468720),
87
- ('sub-0028', 'sub-28', 'published', 'clt-0013', 0, 'annual', 'canceled', 1781775638, 1781775638),
88
- ('sub-0029', 'sub-29', 'published', 'clt-0008', 0, 'monthly', 'active', 1777567668, 1777567668),
89
- ('sub-0030', 'sub-30', 'published', 'clt-0047', 0, 'annual', 'active', 1782178899, 1782178899),
90
- ('sub-0031', 'sub-31', 'published', 'clt-0027', 968, 'annual', 'past_due', 1781009528, 1781009528),
91
- ('sub-0032', 'sub-32', 'published', 'clt-0030', 120, 'monthly', 'active', 1778888661, 1778888661),
92
- ('sub-0033', 'sub-33', 'published', 'clt-0002', 1534, 'monthly', 'active', 1777236737, 1777236737),
93
- ('sub-0034', 'sub-34', 'published', 'clt-0028', 844, 'monthly', 'active', 1778929352, 1778929352),
94
- ('sub-0035', 'sub-35', 'published', 'clt-0021', 0, 'annual', 'active', 1783503541, 1783503541),
95
- ('sub-0036', 'sub-36', 'published', 'clt-0005', 0, 'monthly', 'active', 1779400054, 1779400054),
96
- ('sub-0037', 'sub-37', 'published', 'clt-0037', 1314, 'monthly', 'past_due', 1780839395, 1780839395),
97
- ('sub-0038', 'sub-38', 'published', 'clt-0035', 81, 'monthly', 'active', 1780940050, 1780940050),
98
- ('sub-0039', 'sub-39', 'published', 'clt-0016', 0, 'annual', 'canceled', 1781058329, 1781058329),
99
- ('sub-0040', 'sub-40', 'published', 'clt-0005', 0, 'monthly', 'active', 1781557050, 1781557050),
100
- ('sub-0041', 'sub-41', 'published', 'clt-0012', 0, 'monthly', 'canceled', 1780538305, 1780538305),
101
- ('sub-0042', 'sub-42', 'published', 'clt-0008', 0, 'monthly', 'active', 1777247422, 1777247422),
102
- ('sub-0043', 'sub-43', 'published', 'clt-0011', 0, 'monthly', 'active', 1781538412, 1781538412),
103
- ('sub-0044', 'sub-44', 'published', 'clt-0002', 1450, 'monthly', 'active', 1777735024, 1777735024),
104
- ('sub-0045', 'sub-45', 'published', 'clt-0011', 0, 'monthly', 'active', 1781429208, 1781429208),
105
- ('sub-0046', 'sub-46', 'published', 'clt-0026', 1082, 'monthly', 'active', 1778434591, 1778434591),
106
- ('sub-0047', 'sub-47', 'published', 'clt-0009', 104, 'annual', 'active', 1779420718, 1779420718),
107
- ('sub-0048', 'sub-48', 'published', 'clt-0034', 0, 'annual', 'active', 1781556102, 1781556102),
108
- ('sub-0049', 'sub-49', 'published', 'clt-0034', 0, 'monthly', 'active', 1781203450, 1781203450),
109
- ('sub-0050', 'sub-50', 'published', 'clt-0043', 52, 'monthly', 'active', 1781479399, 1781479399),
110
- ('sub-0051', 'sub-51', 'published', 'clt-0016', 0, 'annual', 'canceled', 1780395612, 1780395612),
111
- ('sub-0052', 'sub-52', 'published', 'clt-0031', 0, 'monthly', 'active', 1780819829, 1780819829),
112
- ('sub-0053', 'sub-53', 'published', 'clt-0016', 0, 'annual', 'canceled', 1780069008, 1780069008),
113
- ('sub-0054', 'sub-54', 'published', 'clt-0034', 0, 'monthly', 'active', 1781183840, 1781183840),
114
- ('sub-0055', 'sub-55', 'published', 'clt-0033', 107, 'annual', 'active', 1779357037, 1779357037),
115
- ('sub-0056', 'sub-56', 'published', 'clt-0012', 0, 'monthly', 'canceled', 1780153989, 1780153989),
116
- ('sub-0057', 'sub-57', 'published', 'clt-0019', 1202, 'monthly', 'active', 1781693473, 1781693473),
117
- ('sub-0058', 'sub-58', 'published', 'clt-0048', 0, 'monthly', 'active', 1779719999, 1779719999),
118
- ('sub-0059', 'sub-59', 'published', 'clt-0043', 134, 'monthly', 'active', 1781338609, 1781338609),
119
- ('sub-0060', 'sub-60', 'published', 'clt-0015', 129, 'monthly', 'active', 1781057283, 1781057283),
120
- ('sub-0061', 'sub-61', 'published', 'clt-0037', 1548, 'annual', 'active', 1779314897, 1779314897),
121
- ('sub-0062', 'sub-62', 'published', 'clt-0014', 0, 'monthly', 'active', 1778027673, 1778027673),
122
- ('sub-0063', 'sub-63', 'published', 'clt-0002', 1099, 'monthly', 'active', 1778331099, 1778331099),
123
- ('sub-0064', 'sub-64', 'published', 'clt-0019', 1866, 'monthly', 'active', 1782682061, 1782682061),
124
- ('sub-0065', 'sub-65', 'published', 'clt-0003', 0, 'annual', 'active', 1778965034, 1778965034),
125
- ('sub-0066', 'sub-66', 'published', 'clt-0050', 136, 'monthly', 'active', 1780348385, 1780348385),
126
- ('sub-0067', 'sub-67', 'published', 'clt-0019', 601, 'monthly', 'active', 1782308022, 1782308022),
127
- ('sub-0068', 'sub-68', 'published', 'clt-0005', 0, 'annual', 'active', 1781034577, 1781034577),
128
- ('sub-0069', 'sub-69', 'published', 'clt-0044', 0, 'annual', 'active', 1781141942, 1781141942),
129
- ('sub-0070', 'sub-70', 'published', 'clt-0005', 0, 'annual', 'active', 1781742879, 1781742879),
130
- ('sub-0071', 'sub-71', 'published', 'clt-0012', 0, 'monthly', 'canceled', 1779159909, 1779159909),
131
- ('sub-0072', 'sub-72', 'published', 'clt-0039', 84, 'monthly', 'active', 1779966573, 1779966573),
132
- ('sub-0073', 'sub-73', 'published', 'clt-0018', 64, 'annual', 'active', 1779025613, 1779025613),
133
- ('sub-0074', 'sub-74', 'published', 'clt-0004', 0, 'monthly', 'active', 1778313010, 1778313010),
134
- ('sub-0075', 'sub-75', 'published', 'clt-0012', 0, 'annual', 'canceled', 1779234346, 1779234346),
135
- ('sub-0076', 'sub-76', 'published', 'clt-0026', 1842, 'monthly', 'active', 1778489634, 1778489634),
136
- ('sub-0077', 'sub-77', 'published', 'clt-0044', 0, 'annual', 'active', 1779293869, 1779293869),
137
- ('sub-0078', 'sub-78', 'published', 'clt-0018', 95, 'monthly', 'active', 1779243009, 1779243009),
138
- ('sub-0079', 'sub-79', 'published', 'clt-0004', 0, 'monthly', 'active', 1777792773, 1777792773),
139
- ('sub-0080', 'sub-80', 'published', 'clt-0034', 0, 'annual', 'active', 1780146104, 1780146104);
140
-
141
- INSERT OR IGNORE INTO content_ticket (id, slug, status, title, customer_id, priority, category, ticket_status, created_at, updated_at)
142
- VALUES
143
- ('tkt-0001', 'tkt-1', 'published', 'Richiesta assistenza billing #1', 'clt-0041', 'medium', 'billing', 'closed', 1778788913, 1778788913),
144
- ('tkt-0002', 'tkt-2', 'published', 'Richiesta assistenza technical #2', 'clt-0040', 'medium', 'technical', 'closed', 1776630524, 1776630524),
145
- ('tkt-0003', 'tkt-3', 'published', 'Richiesta assistenza sales #3', 'clt-0015', 'high', 'sales', 'closed', 1780082450, 1780082450),
146
- ('tkt-0004', 'tkt-4', 'published', 'Richiesta assistenza technical #4', 'clt-0007', 'high', 'technical', 'closed', 1778852958, 1778852958),
147
- ('tkt-0005', 'tkt-5', 'published', 'Richiesta assistenza technical #5', 'clt-0022', 'medium', 'technical', 'closed', 1781006799, 1781006799),
148
- ('tkt-0006', 'tkt-6', 'published', 'Richiesta assistenza sales #6', 'clt-0039', 'medium', 'sales', 'open', 1778599394, 1778599394),
149
- ('tkt-0007', 'tkt-7', 'published', 'Richiesta assistenza billing #7', 'clt-0016', 'high', 'billing', 'closed', 1776731481, 1776731481),
150
- ('tkt-0008', 'tkt-8', 'published', 'Richiesta assistenza technical #8', 'clt-0007', 'low', 'technical', 'closed', 1776564183, 1776564183),
151
- ('tkt-0009', 'tkt-9', 'published', 'Richiesta assistenza billing #9', 'clt-0005', 'high', 'billing', 'closed', 1781170065, 1781170065),
152
- ('tkt-0010', 'tkt-10', 'published', 'Richiesta assistenza technical #10', 'clt-0011', 'medium', 'technical', 'closed', 1779388832, 1779388832),
153
- ('tkt-0011', 'tkt-11', 'published', 'Richiesta assistenza technical #11', 'clt-0028', 'medium', 'technical', 'closed', 1779409871, 1779409871),
154
- ('tkt-0012', 'tkt-12', 'published', 'Richiesta assistenza sales #12', 'clt-0008', 'high', 'sales', 'closed', 1780758683, 1780758683),
155
- ('tkt-0013', 'tkt-13', 'published', 'Richiesta assistenza technical #13', 'clt-0039', 'medium', 'technical', 'closed', 1778168019, 1778168019),
156
- ('tkt-0014', 'tkt-14', 'published', 'Richiesta assistenza billing #14', 'clt-0029', 'low', 'billing', 'closed', 1779224460, 1779224460),
157
- ('tkt-0015', 'tkt-15', 'published', 'Richiesta assistenza technical #15', 'clt-0048', 'high', 'technical', 'closed', 1779690426, 1779690426),
158
- ('tkt-0016', 'tkt-16', 'published', 'Richiesta assistenza billing #16', 'clt-0037', 'low', 'billing', 'closed', 1780087850, 1780087850),
159
- ('tkt-0017', 'tkt-17', 'published', 'Richiesta assistenza technical #17', 'clt-0012', 'medium', 'technical', 'in_progress', 1780773970, 1780773970),
160
- ('tkt-0018', 'tkt-18', 'published', 'Richiesta assistenza technical #18', 'clt-0045', 'low', 'technical', 'closed', 1776322635, 1776322635),
161
- ('tkt-0019', 'tkt-19', 'published', 'Richiesta assistenza billing #19', 'clt-0019', 'high', 'billing', 'closed', 1778531708, 1778531708),
162
- ('tkt-0020', 'tkt-20', 'published', 'Richiesta assistenza billing #20', 'clt-0002', 'low', 'billing', 'open', 1776326907, 1776326907),
163
- ('tkt-0021', 'tkt-21', 'published', 'Richiesta assistenza billing #21', 'clt-0008', 'high', 'billing', 'in_progress', 1778318876, 1778318876),
164
- ('tkt-0022', 'tkt-22', 'published', 'Richiesta assistenza sales #22', 'clt-0040', 'low', 'sales', 'closed', 1778674176, 1778674176),
165
- ('tkt-0023', 'tkt-23', 'published', 'Richiesta assistenza technical #23', 'clt-0018', 'medium', 'technical', 'closed', 1779583743, 1779583743),
166
- ('tkt-0024', 'tkt-24', 'published', 'Richiesta assistenza billing #24', 'clt-0050', 'medium', 'billing', 'in_progress', 1780424161, 1780424161),
167
- ('tkt-0025', 'tkt-25', 'published', 'Richiesta assistenza sales #25', 'clt-0013', 'medium', 'sales', 'open', 1778593601, 1778593601),
168
- ('tkt-0026', 'tkt-26', 'published', 'Richiesta assistenza billing #26', 'clt-0046', 'medium', 'billing', 'in_progress', 1779404215, 1779404215),
169
- ('tkt-0027', 'tkt-27', 'published', 'Richiesta assistenza technical #27', 'clt-0021', 'low', 'technical', 'open', 1779885965, 1779885965),
170
- ('tkt-0028', 'tkt-28', 'published', 'Richiesta assistenza technical #28', 'clt-0030', 'high', 'technical', 'closed', 1779123411, 1779123411),
171
- ('tkt-0029', 'tkt-29', 'published', 'Richiesta assistenza technical #29', 'clt-0014', 'medium', 'technical', 'closed', 1780061617, 1780061617),
172
- ('tkt-0030', 'tkt-30', 'published', 'Richiesta assistenza billing #30', 'clt-0033', 'high', 'billing', 'open', 1779904908, 1779904908),
173
- ('tkt-0031', 'tkt-31', 'published', 'Richiesta assistenza billing #31', 'clt-0012', 'medium', 'billing', 'in_progress', 1781162764, 1781162764),
174
- ('tkt-0032', 'tkt-32', 'published', 'Richiesta assistenza sales #32', 'clt-0034', 'high', 'sales', 'closed', 1777381333, 1777381333),
175
- ('tkt-0033', 'tkt-33', 'published', 'Richiesta assistenza sales #33', 'clt-0002', 'medium', 'sales', 'in_progress', 1778900761, 1778900761),
176
- ('tkt-0034', 'tkt-34', 'published', 'Richiesta assistenza sales #34', 'clt-0004', 'low', 'sales', 'closed', 1778087526, 1778087526),
177
- ('tkt-0035', 'tkt-35', 'published', 'Richiesta assistenza technical #35', 'clt-0023', 'medium', 'technical', 'closed', 1777275857, 1777275857),
178
- ('tkt-0036', 'tkt-36', 'published', 'Richiesta assistenza technical #36', 'clt-0042', 'low', 'technical', 'closed', 1776507245, 1776507245),
179
- ('tkt-0037', 'tkt-37', 'published', 'Richiesta assistenza sales #37', 'clt-0027', 'low', 'sales', 'closed', 1777543170, 1777543170),
180
- ('tkt-0038', 'tkt-38', 'published', 'Richiesta assistenza billing #38', 'clt-0005', 'low', 'billing', 'closed', 1778883240, 1778883240),
181
- ('tkt-0039', 'tkt-39', 'published', 'Richiesta assistenza technical #39', 'clt-0048', 'medium', 'technical', 'closed', 1777519024, 1777519024),
182
- ('tkt-0040', 'tkt-40', 'published', 'Richiesta assistenza billing #40', 'clt-0026', 'high', 'billing', 'closed', 1778062701, 1778062701),
183
- ('tkt-0041', 'tkt-41', 'published', 'Richiesta assistenza sales #41', 'clt-0034', 'low', 'sales', 'closed', 1778697137, 1778697137),
184
- ('tkt-0042', 'tkt-42', 'published', 'Richiesta assistenza billing #42', 'clt-0038', 'medium', 'billing', 'open', 1778882032, 1778882032),
185
- ('tkt-0043', 'tkt-43', 'published', 'Richiesta assistenza billing #43', 'clt-0018', 'low', 'billing', 'closed', 1779110662, 1779110662),
186
- ('tkt-0044', 'tkt-44', 'published', 'Richiesta assistenza technical #44', 'clt-0034', 'high', 'technical', 'closed', 1779482042, 1779482042),
187
- ('tkt-0045', 'tkt-45', 'published', 'Richiesta assistenza sales #45', 'clt-0046', 'high', 'sales', 'closed', 1778127285, 1778127285),
188
- ('tkt-0046', 'tkt-46', 'published', 'Richiesta assistenza technical #46', 'clt-0008', 'low', 'technical', 'in_progress', 1779106002, 1779106002),
189
- ('tkt-0047', 'tkt-47', 'published', 'Richiesta assistenza technical #47', 'clt-0024', 'low', 'technical', 'closed', 1776116714, 1776116714),
190
- ('tkt-0048', 'tkt-48', 'published', 'Richiesta assistenza sales #48', 'clt-0004', 'low', 'sales', 'open', 1777758870, 1777758870),
191
- ('tkt-0049', 'tkt-49', 'published', 'Richiesta assistenza billing #49', 'clt-0038', 'medium', 'billing', 'closed', 1776571565, 1776571565),
192
- ('tkt-0050', 'tkt-50', 'published', 'Richiesta assistenza billing #50', 'clt-0036', 'medium', 'billing', 'closed', 1776297965, 1776297965),
193
- ('tkt-0051', 'tkt-51', 'published', 'Richiesta assistenza technical #51', 'clt-0040', 'low', 'technical', 'closed', 1780652147, 1780652147),
194
- ('tkt-0052', 'tkt-52', 'published', 'Richiesta assistenza sales #52', 'clt-0038', 'high', 'sales', 'closed', 1776108984, 1776108984),
195
- ('tkt-0053', 'tkt-53', 'published', 'Richiesta assistenza sales #53', 'clt-0015', 'medium', 'sales', 'closed', 1781018077, 1781018077),
196
- ('tkt-0054', 'tkt-54', 'published', 'Richiesta assistenza sales #54', 'clt-0004', 'medium', 'sales', 'closed', 1776377860, 1776377860),
197
- ('tkt-0055', 'tkt-55', 'published', 'Richiesta assistenza technical #55', 'clt-0006', 'high', 'technical', 'in_progress', 1780031750, 1780031750),
198
- ('tkt-0056', 'tkt-56', 'published', 'Richiesta assistenza sales #56', 'clt-0027', 'high', 'sales', 'closed', 1780000311, 1780000311),
199
- ('tkt-0057', 'tkt-57', 'published', 'Richiesta assistenza billing #57', 'clt-0014', 'high', 'billing', 'in_progress', 1779618019, 1779618019),
200
- ('tkt-0058', 'tkt-58', 'published', 'Richiesta assistenza technical #58', 'clt-0024', 'low', 'technical', 'closed', 1778045618, 1778045618),
201
- ('tkt-0059', 'tkt-59', 'published', 'Richiesta assistenza billing #59', 'clt-0045', 'low', 'billing', 'closed', 1780438929, 1780438929),
202
- ('tkt-0060', 'tkt-60', 'published', 'Richiesta assistenza sales #60', 'clt-0045', 'low', 'sales', 'open', 1779640034, 1779640034);
203
-
204
- INSERT OR IGNORE INTO content_changelog (id, slug, status, version, release_date, features, created_at, updated_at)
205
- VALUES
206
- ('chg-0001', 'v1-0-0', 'published', 'v1.0.0', 1776070983, '<p>Lancio ufficiale della piattaforma con gestione clienti base.</p>', 1776070983, 1776070983),
207
- ('chg-0002', 'v1-1-0', 'published', 'v1.1.0', 1778662983, '<p>Aggiunti report avanzati e export in CSV.</p>', 1778662983, 1778662983),
208
- ('chg-0003', 'v1-2-0', 'published', 'v1.2.0', 1779958983, '<p>Integrazione con Slack per notifiche ticket.</p>', 1779958983, 1779958983),
209
- ('chg-0004', 'v2-0-0', 'published', 'v2.0.0', 1781082183, '<h2>Major Update</h2><p>Nuova dashboard amministrativa e API pubbliche.</p>', 1781082183, 1781082183);
210
-
211
- INSERT OR IGNORE INTO content_articoli (id, slug, status, title, author, cover_image, body, created_at, updated_at)
212
- VALUES
213
- ('art-0001', 'benvenuti', 'published', 'Come ridurre il Churn Rate', 'Luca Rossi', 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=80', '<p>Analisi delle migliori strategie per mantenere i clienti SaaS nel 2026.</p>', 1779526983, 1779526983),
214
- ('art-0002', 'pricing-strategy', 'published', 'Pricing SaaS: Fremium vs Trial', 'Anna Bianchi', 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=800&q=80', '<p>Cosa scegliere per massimizzare la conversion rate e il Customer Lifetime Value.</p>', 1780822983, 1780822983);
215
-
216
- `
@@ -1,20 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- /// <reference types="@cloudflare/workers-types" />
6
- import type { IDemoDataRepository } from '@beechcms/core'
7
- import { DEMO_DATA_SQL } from './demo-data-sql'
8
-
9
- export class D1DemoDataRepository implements IDemoDataRepository {
10
- constructor(private readonly db: D1Database) {}
11
-
12
- async loadDemoData(): Promise<void> {
13
- const statements = DEMO_DATA_SQL
14
- .split(';')
15
- .map(s => s.trim())
16
- .filter(s => s.length > 0)
17
- .map(s => this.db.prepare(s))
18
- await this.db.batch(statements)
19
- }
20
- }
@@ -1,13 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import type { IScheduler } from '@beechcms/core'
6
-
7
- export class ExecutionContextScheduler implements IScheduler {
8
- constructor(private readonly ctx: ExecutionContext) {}
9
-
10
- waitUntil(promise: Promise<unknown>): void {
11
- this.ctx.waitUntil(promise)
12
- }
13
- }
@@ -1,25 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import type { IClock } from '@beechcms/core'
6
-
7
- const MILLISECONDS_PER_SECOND = 1000
8
-
9
- /**
10
- * Test-only IClock implementation that returns a frozen timestamp on every
11
- * call. Lets specs assert exact values for `createdAt`, `iat`, and
12
- * day-bucket computations without resorting to vi.useFakeTimers or
13
- * patching the global Date constructor.
14
- */
15
- export class FixedClock implements IClock {
16
- constructor(private readonly fixedNowMs: number) {}
17
-
18
- now(): number {
19
- return this.fixedNowMs
20
- }
21
-
22
- nowSeconds(): number {
23
- return Math.floor(this.fixedNowMs / MILLISECONDS_PER_SECOND)
24
- }
25
- }
@@ -1,8 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- // v0.4.0: FTS sync handled automatically by SQL triggers (generateFtsTriggers).
6
- // syncFts/deleteFts eliminated. This file kept as empty module to avoid import errors
7
- // during the Phase 4 → Phase 6 transition.
8
- export {}
@@ -1,83 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import { describe, it, expect, vi } from 'vitest'
6
- import { D1IdempotencyRepository } from './idempotency.repository.d1'
7
-
8
- function makeMockDb(opts: { firstResult?: unknown } = {}) {
9
- const { firstResult = null } = opts
10
- const runMock = vi.fn().mockResolvedValue({ success: true })
11
- const firstMock = vi.fn().mockResolvedValue(firstResult)
12
- const bindMock = vi.fn(() => ({ run: runMock, first: firstMock }))
13
- const prepareMock = vi.fn(() => ({ bind: bindMock }))
14
- return { db: { prepare: prepareMock } as any, prepareMock, bindMock, runMock }
15
- }
16
-
17
- describe('D1IdempotencyRepository', () => {
18
- describe('lookup', () => {
19
- it('returns a mapped IdempotencyRecord when the key is found', async () => {
20
- const row = {
21
- idempotency_key: 'idem-1',
22
- request_fingerprint: 'fp-abc',
23
- response_status: 200,
24
- response_body: '{"ok":true}',
25
- expires_at: 9999,
26
- }
27
- const { db } = makeMockDb({ firstResult: row })
28
- const result = await new D1IdempotencyRepository(db).lookup('idem-1')
29
- expect(result).toEqual({
30
- key: 'idem-1',
31
- fingerprint: 'fp-abc',
32
- responseStatus: 200,
33
- responseBody: '{"ok":true}',
34
- expiresAt: 9999,
35
- })
36
- })
37
-
38
- it('returns null when the key is not found', async () => {
39
- const { db } = makeMockDb({ firstResult: null })
40
- expect(await new D1IdempotencyRepository(db).lookup('missing')).toBeNull()
41
- })
42
-
43
- it('queries the correct table', async () => {
44
- const { db, prepareMock } = makeMockDb()
45
- await new D1IdempotencyRepository(db).lookup('k')
46
- expect(prepareMock).toHaveBeenCalledWith(expect.stringContaining('public_idempotency_keys'))
47
- })
48
- })
49
-
50
- describe('store', () => {
51
- it('calls INSERT INTO public_idempotency_keys with upsert on conflict', async () => {
52
- const { db, prepareMock } = makeMockDb()
53
- await new D1IdempotencyRepository(db).store({
54
- key: 'idem-1', fingerprint: 'fp', responseStatus: 201, responseBody: '{}', expiresAt: 9999,
55
- })
56
- const sql = prepareMock.mock.calls[0][0] as string
57
- expect(sql).toContain('INSERT INTO public_idempotency_keys')
58
- expect(sql).toContain('ON CONFLICT')
59
- })
60
-
61
- it('binds key, fingerprint, status, body, and expiresAt', async () => {
62
- const { db, bindMock } = makeMockDb()
63
- await new D1IdempotencyRepository(db).store({
64
- key: 'idem-1', fingerprint: 'fp-x', responseStatus: 200, responseBody: '{"ok":1}', expiresAt: 8888,
65
- })
66
- const args = bindMock.mock.calls[0] as unknown[]
67
- expect(args).toContain('idem-1')
68
- expect(args).toContain('fp-x')
69
- expect(args).toContain(200)
70
- expect(args).toContain('{"ok":1}')
71
- expect(args).toContain(8888)
72
- })
73
- })
74
-
75
- describe('cleanup', () => {
76
- it('calls DELETE with the expiration timestamp', async () => {
77
- const { db, prepareMock, bindMock } = makeMockDb()
78
- await new D1IdempotencyRepository(db).cleanup(12345)
79
- expect(prepareMock).toHaveBeenCalledWith(expect.stringContaining('DELETE FROM public_idempotency_keys'))
80
- expect(bindMock).toHaveBeenCalledWith(12345)
81
- })
82
- })
83
- })
@@ -1,60 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import { IdempotencyRepository, IdempotencyRecord } from '@beechcms/core'
6
- import { BaseD1Repository } from './base.repository.d1.js'
7
-
8
- export class D1IdempotencyRepository extends BaseD1Repository implements IdempotencyRepository {
9
- /**
10
- * Looks up an idempotency record by its key.
11
- */
12
- async lookup(idempotencyKey: string): Promise<IdempotencyRecord | null> {
13
- const idempotencyRecordResult = await this.database.prepare(
14
- `SELECT idempotency_key, request_fingerprint, response_status, response_body, expires_at
15
- FROM public_idempotency_keys WHERE idempotency_key = ? LIMIT 1`
16
- ).bind(idempotencyKey).first<any>()
17
-
18
- if (!idempotencyRecordResult) {
19
- return null
20
- }
21
-
22
- return {
23
- key: idempotencyRecordResult.idempotency_key,
24
- fingerprint: idempotencyRecordResult.request_fingerprint,
25
- responseStatus: idempotencyRecordResult.response_status,
26
- responseBody: idempotencyRecordResult.response_body,
27
- expiresAt: idempotencyRecordResult.expires_at
28
- }
29
- }
30
-
31
- /**
32
- * Stores or updates an idempotency record.
33
- */
34
- async store(idempotencyData: IdempotencyRecord): Promise<void> {
35
- await this.database.prepare(
36
- `INSERT INTO public_idempotency_keys (idempotency_key, request_fingerprint, response_status, response_body, created_at, expires_at)
37
- VALUES (?, ?, ?, ?, ?, ?)
38
- ON CONFLICT(idempotency_key) DO UPDATE SET
39
- request_fingerprint = excluded.request_fingerprint,
40
- response_status = excluded.response_status,
41
- response_body = excluded.response_body,
42
- created_at = excluded.created_at,
43
- expires_at = excluded.expires_at`
44
- ).bind(
45
- idempotencyData.key,
46
- idempotencyData.fingerprint,
47
- idempotencyData.responseStatus,
48
- idempotencyData.responseBody,
49
- Math.floor(Date.now() / 1000),
50
- idempotencyData.expiresAt
51
- ).run()
52
- }
53
-
54
- /**
55
- * Cleans up expired idempotency records.
56
- */
57
- async cleanup(expirationTimestamp: number): Promise<void> {
58
- await this.database.prepare(`DELETE FROM public_idempotency_keys WHERE expires_at < ?`).bind(expirationTimestamp).run()
59
- }
60
- }
@@ -1,19 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import type { IActivityLogger, ActivityLogEntry } from '@beechcms/core'
6
-
7
- /**
8
- * Test double for {@link IActivityLogger}.
9
- *
10
- * Captures every call into a public array so test assertions can verify
11
- * audit-trail side effects without touching D1. Preserves insertion order.
12
- */
13
- export class InMemoryActivityLogger implements IActivityLogger {
14
- public readonly entries: ActivityLogEntry[] = []
15
-
16
- log(entry: ActivityLogEntry): void {
17
- this.entries.push(entry)
18
- }
19
- }
@@ -1,19 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import type { INotificationService, CreateNotificationInput } from '@beechcms/core'
6
-
7
- /**
8
- * Test double for {@link INotificationService}.
9
- *
10
- * Captures every call into a public array so tests can assert what would have
11
- * been delivered without touching D1.
12
- */
13
- export class InMemoryNotificationService implements INotificationService {
14
- public readonly receivedNotifications: CreateNotificationInput[] = []
15
-
16
- notify(input: CreateNotificationInput): void {
17
- this.receivedNotifications.push(input)
18
- }
19
- }
@@ -1,58 +0,0 @@
1
- // SPDX-License-Identifier: BUSL-1.1
2
- // Copyright (c) 2024–2026 Flavio De Musso. All rights reserved.
3
- // See LICENSE in the repository root for license terms.
4
-
5
- import type { ISeedRepository, Seed, SeedRecord } from '@beechcms/core'
6
-
7
- /**
8
- * In-memory ISeedRepository for testing and for the config.seeds back-compat shim.
9
- * Returns a fixed seed list with a static version token.
10
- */
11
- export class InMemorySeedRepository implements ISeedRepository {
12
- private readonly seeds: Seed[]
13
- private version = 1
14
-
15
- constructor(seeds: Seed[]) {
16
- this.seeds = seeds.filter(s => s && typeof s === 'object' && 'slug' in s)
17
- }
18
-
19
- async listActive(): Promise<Seed[]> {
20
- return this.seeds
21
- }
22
-
23
- async listAll(): Promise<SeedRecord[]> {
24
- return this.seeds.map(s => ({
25
- slug: s.slug,
26
- definition: s,
27
- status: 'active' as const,
28
- source: 'code' as const,
29
- createdAt: 0,
30
- updatedAt: 0,
31
- }))
32
- }
33
-
34
- async get(slug: string): Promise<SeedRecord | null> {
35
- const s = this.seeds.find(s => s.slug === slug)
36
- if (!s) return null
37
- return { slug: s.slug, definition: s, status: 'active', source: 'code', createdAt: 0, updatedAt: 0 }
38
- }
39
- upsert(_slug: string, _definition: Seed, _source?: 'code' | 'runtime'): Promise<void> {
40
- return Promise.resolve()
41
- }
42
-
43
- softDelete(_slug: string): Promise<void> {
44
- return Promise.resolve()
45
- }
46
-
47
- hardDelete(_slug: string): Promise<void> {
48
- return Promise.resolve()
49
- }
50
-
51
- async getRegistryVersion(): Promise<number> {
52
- return this.version
53
- }
54
-
55
- async bumpRegistryVersion(): Promise<number> {
56
- return ++this.version
57
- }
58
- }