@dyrected/core 2.5.53 → 2.5.55

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 (405) hide show
  1. package/package.json +1 -1
  2. package/dist/__tests__/admin-auth.test.d.ts +0 -2
  3. package/dist/__tests__/admin-auth.test.d.ts.map +0 -1
  4. package/dist/__tests__/admin-auth.test.js +0 -440
  5. package/dist/__tests__/admin-auth.test.js.map +0 -1
  6. package/dist/__tests__/app.test.d.ts +0 -2
  7. package/dist/__tests__/app.test.d.ts.map +0 -1
  8. package/dist/__tests__/app.test.js +0 -27
  9. package/dist/__tests__/app.test.js.map +0 -1
  10. package/dist/__tests__/config.test.d.ts +0 -2
  11. package/dist/__tests__/config.test.d.ts.map +0 -1
  12. package/dist/__tests__/config.test.js +0 -91
  13. package/dist/__tests__/config.test.js.map +0 -1
  14. package/dist/__tests__/deleteMany.test.d.ts +0 -2
  15. package/dist/__tests__/deleteMany.test.d.ts.map +0 -1
  16. package/dist/__tests__/deleteMany.test.js +0 -75
  17. package/dist/__tests__/deleteMany.test.js.map +0 -1
  18. package/dist/__tests__/depth.test.d.ts +0 -2
  19. package/dist/__tests__/depth.test.d.ts.map +0 -1
  20. package/dist/__tests__/depth.test.js +0 -81
  21. package/dist/__tests__/depth.test.js.map +0 -1
  22. package/dist/__tests__/dynamic-options.test.d.ts +0 -2
  23. package/dist/__tests__/dynamic-options.test.d.ts.map +0 -1
  24. package/dist/__tests__/dynamic-options.test.js +0 -132
  25. package/dist/__tests__/dynamic-options.test.js.map +0 -1
  26. package/dist/__tests__/email.service.test.d.ts +0 -2
  27. package/dist/__tests__/email.service.test.d.ts.map +0 -1
  28. package/dist/__tests__/email.service.test.js +0 -46
  29. package/dist/__tests__/email.service.test.js.map +0 -1
  30. package/dist/__tests__/field-inference.test-types.d.ts +0 -24
  31. package/dist/__tests__/field-inference.test-types.d.ts.map +0 -1
  32. package/dist/__tests__/field-inference.test-types.js +0 -87
  33. package/dist/__tests__/field-inference.test-types.js.map +0 -1
  34. package/dist/__tests__/fixtures/editorial-workflow.d.ts +0 -9
  35. package/dist/__tests__/fixtures/editorial-workflow.d.ts.map +0 -1
  36. package/dist/__tests__/fixtures/editorial-workflow.js +0 -12
  37. package/dist/__tests__/fixtures/editorial-workflow.js.map +0 -1
  38. package/dist/__tests__/hooks.test.d.ts +0 -2
  39. package/dist/__tests__/hooks.test.d.ts.map +0 -1
  40. package/dist/__tests__/hooks.test.js +0 -320
  41. package/dist/__tests__/hooks.test.js.map +0 -1
  42. package/dist/__tests__/mocks.d.ts +0 -74
  43. package/dist/__tests__/mocks.d.ts.map +0 -1
  44. package/dist/__tests__/mocks.js +0 -159
  45. package/dist/__tests__/mocks.js.map +0 -1
  46. package/dist/__tests__/openapi.test.d.ts +0 -2
  47. package/dist/__tests__/openapi.test.d.ts.map +0 -1
  48. package/dist/__tests__/openapi.test.js +0 -95
  49. package/dist/__tests__/openapi.test.js.map +0 -1
  50. package/dist/__tests__/parse-sort.test.d.ts +0 -2
  51. package/dist/__tests__/parse-sort.test.d.ts.map +0 -1
  52. package/dist/__tests__/parse-sort.test.js +0 -24
  53. package/dist/__tests__/parse-sort.test.js.map +0 -1
  54. package/dist/__tests__/preferences.test.d.ts +0 -2
  55. package/dist/__tests__/preferences.test.d.ts.map +0 -1
  56. package/dist/__tests__/preferences.test.js +0 -168
  57. package/dist/__tests__/preferences.test.js.map +0 -1
  58. package/dist/__tests__/router.test.d.ts +0 -2
  59. package/dist/__tests__/router.test.d.ts.map +0 -1
  60. package/dist/__tests__/router.test.js +0 -52
  61. package/dist/__tests__/router.test.js.map +0 -1
  62. package/dist/__tests__/where.test.d.ts +0 -2
  63. package/dist/__tests__/where.test.d.ts.map +0 -1
  64. package/dist/__tests__/where.test.js +0 -105
  65. package/dist/__tests__/where.test.js.map +0 -1
  66. package/dist/__tests__/workflow.test.d.ts +0 -2
  67. package/dist/__tests__/workflow.test.d.ts.map +0 -1
  68. package/dist/__tests__/workflow.test.js +0 -497
  69. package/dist/__tests__/workflow.test.js.map +0 -1
  70. package/dist/app-B2tg7Djj.d.cts +0 -1575
  71. package/dist/app-B2tg7Djj.d.ts +0 -1575
  72. package/dist/app-BElen1tP.d.cts +0 -1690
  73. package/dist/app-BElen1tP.d.ts +0 -1690
  74. package/dist/app-BOrsS7Tz.d.cts +0 -1771
  75. package/dist/app-BOrsS7Tz.d.ts +0 -1771
  76. package/dist/app-Bh4_Opv0.d.cts +0 -1522
  77. package/dist/app-Bh4_Opv0.d.ts +0 -1522
  78. package/dist/app-BibuoHQG.d.cts +0 -1764
  79. package/dist/app-BibuoHQG.d.ts +0 -1764
  80. package/dist/app-Bv9gaDAN.d.cts +0 -561
  81. package/dist/app-Bv9gaDAN.d.ts +0 -561
  82. package/dist/app-BvG3bRc8.d.cts +0 -419
  83. package/dist/app-BvG3bRc8.d.ts +0 -419
  84. package/dist/app-C-HgyliB.d.cts +0 -1694
  85. package/dist/app-C-HgyliB.d.ts +0 -1694
  86. package/dist/app-C3B9N1KR.d.cts +0 -1522
  87. package/dist/app-C3B9N1KR.d.ts +0 -1522
  88. package/dist/app-Cc2mG3zi.d.cts +0 -373
  89. package/dist/app-Cc2mG3zi.d.ts +0 -373
  90. package/dist/app-Ctfmo2Re.d.cts +0 -1692
  91. package/dist/app-Ctfmo2Re.d.ts +0 -1692
  92. package/dist/app-D0ffogDd.d.cts +0 -1690
  93. package/dist/app-D0ffogDd.d.ts +0 -1690
  94. package/dist/app-D2uR47gK.d.cts +0 -1690
  95. package/dist/app-D2uR47gK.d.ts +0 -1690
  96. package/dist/app-DDJJa0ep.d.cts +0 -1621
  97. package/dist/app-DDJJa0ep.d.ts +0 -1621
  98. package/dist/app-DO1s9YW1.d.cts +0 -1621
  99. package/dist/app-DO1s9YW1.d.ts +0 -1621
  100. package/dist/app-DTP3-9PJ.d.cts +0 -561
  101. package/dist/app-DTP3-9PJ.d.ts +0 -561
  102. package/dist/app-DZt5nslu.d.cts +0 -374
  103. package/dist/app-DZt5nslu.d.ts +0 -377
  104. package/dist/app-DbKDGYTI.d.cts +0 -566
  105. package/dist/app-DbKDGYTI.d.ts +0 -566
  106. package/dist/app-Dk3SzV1a.d.cts +0 -374
  107. package/dist/app-Dk3SzV1a.d.ts +0 -374
  108. package/dist/app-DnX9mNsh.d.cts +0 -374
  109. package/dist/app-DnX9mNsh.d.ts +0 -374
  110. package/dist/app-DqRO-CMi.d.cts +0 -1457
  111. package/dist/app-DqRO-CMi.d.ts +0 -1457
  112. package/dist/app-DvaFpOtj.d.cts +0 -398
  113. package/dist/app-DvaFpOtj.d.ts +0 -398
  114. package/dist/app-FGzip4XM.d.cts +0 -1563
  115. package/dist/app-FGzip4XM.d.ts +0 -1563
  116. package/dist/app-KApbf4XL.d.cts +0 -362
  117. package/dist/app-KApbf4XL.d.ts +0 -362
  118. package/dist/app-T0alZAE0.d.cts +0 -383
  119. package/dist/app-T0alZAE0.d.ts +0 -383
  120. package/dist/app-aW2FMuYM.d.cts +0 -1759
  121. package/dist/app-aW2FMuYM.d.ts +0 -1759
  122. package/dist/app-config-2vF6W56z.d.cts +0 -1335
  123. package/dist/app-config-2vF6W56z.d.ts +0 -1335
  124. package/dist/app-config-3XBnu9Xz.d.cts +0 -1379
  125. package/dist/app-config-3XBnu9Xz.d.ts +0 -1379
  126. package/dist/app-config-BLMX-9MN.d.cts +0 -1045
  127. package/dist/app-config-BLMX-9MN.d.ts +0 -1045
  128. package/dist/app-config-CaEQH0Kb.d.cts +0 -1383
  129. package/dist/app-config-CaEQH0Kb.d.ts +0 -1383
  130. package/dist/app-config-DLK6bCaP.d.cts +0 -1390
  131. package/dist/app-config-DLK6bCaP.d.ts +0 -1390
  132. package/dist/app-config-oOarB6Fw.d.cts +0 -1411
  133. package/dist/app-config-oOarB6Fw.d.ts +0 -1411
  134. package/dist/app-oQt5-9MU.d.cts +0 -1560
  135. package/dist/app-oQt5-9MU.d.ts +0 -1560
  136. package/dist/app-rZj1VFer.d.cts +0 -1621
  137. package/dist/app-rZj1VFer.d.ts +0 -1621
  138. package/dist/app-wo82JRHl.d.cts +0 -445
  139. package/dist/app-wo82JRHl.d.ts +0 -445
  140. package/dist/app.d.ts +0 -21
  141. package/dist/app.d.ts.map +0 -1
  142. package/dist/app.js +0 -56
  143. package/dist/app.js.map +0 -1
  144. package/dist/auth/jexl.d.ts +0 -10
  145. package/dist/auth/jexl.d.ts.map +0 -1
  146. package/dist/auth/jexl.js +0 -22
  147. package/dist/auth/jexl.js.map +0 -1
  148. package/dist/auth/password.d.ts +0 -10
  149. package/dist/auth/password.d.ts.map +0 -1
  150. package/dist/auth/password.js +0 -28
  151. package/dist/auth/password.js.map +0 -1
  152. package/dist/auth/token.d.ts +0 -22
  153. package/dist/auth/token.d.ts.map +0 -1
  154. package/dist/auth/token.js +0 -40
  155. package/dist/auth/token.js.map +0 -1
  156. package/dist/chunk-22JTWD74.js +0 -1784
  157. package/dist/chunk-23URSKPI.js +0 -2371
  158. package/dist/chunk-2JMA3M5S.js +0 -2475
  159. package/dist/chunk-3FZEUK36.js +0 -2470
  160. package/dist/chunk-3VUH2MNW.js +0 -1903
  161. package/dist/chunk-44O2LDPT.js +0 -1513
  162. package/dist/chunk-45JDQDA2.js +0 -1899
  163. package/dist/chunk-4C4L6SD2.js +0 -1524
  164. package/dist/chunk-4EDMZAM5.js +0 -2692
  165. package/dist/chunk-52T4RCFU.js +0 -1972
  166. package/dist/chunk-6ZXEGKT6.js +0 -619
  167. package/dist/chunk-7GGHK75W.js +0 -1835
  168. package/dist/chunk-ALNQINX7.js +0 -2496
  169. package/dist/chunk-B6KDKYXB.js +0 -2502
  170. package/dist/chunk-BEONZV6M.js +0 -1951
  171. package/dist/chunk-C4GEQ5RP.js +0 -1993
  172. package/dist/chunk-CQDVPMEU.js +0 -613
  173. package/dist/chunk-DOJHZ7XN.js +0 -2394
  174. package/dist/chunk-EH7G3LLL.js +0 -2065
  175. package/dist/chunk-EXXOPW3I.js +0 -2483
  176. package/dist/chunk-F4ZC6TXR.js +0 -2065
  177. package/dist/chunk-FCXE5CVC.js +0 -1528
  178. package/dist/chunk-FDQYPPG3.js +0 -2698
  179. package/dist/chunk-FURYJ254.mjs +0 -33
  180. package/dist/chunk-G2QQLBHW.js +0 -24
  181. package/dist/chunk-GM4WW6IE.js +0 -66
  182. package/dist/chunk-GZODLJ3C.js +0 -1861
  183. package/dist/chunk-IIY3E7Q7.js +0 -1996
  184. package/dist/chunk-JJN4J5NS.js +0 -2069
  185. package/dist/chunk-MRUHCNDM.js +0 -1940
  186. package/dist/chunk-NKDX67AW.js +0 -2698
  187. package/dist/chunk-NYUB4AHZ.js +0 -1951
  188. package/dist/chunk-OD4SLW7H.js +0 -1930
  189. package/dist/chunk-OE5MH3NB.js +0 -2070
  190. package/dist/chunk-PH36WQYS.js +0 -1875
  191. package/dist/chunk-PKNFV7KE.js +0 -2469
  192. package/dist/chunk-SUGK7UYL.js +0 -311
  193. package/dist/chunk-TIJHR54M.js +0 -1879
  194. package/dist/chunk-TUUHGLB5.js +0 -2609
  195. package/dist/chunk-UBTRANFX.js +0 -2476
  196. package/dist/chunk-VJWUG2XK.js +0 -1951
  197. package/dist/chunk-W6KURRMW.js +0 -2471
  198. package/dist/chunk-Y4AYI52W.js +0 -631
  199. package/dist/chunk-YDOBB7MY.js +0 -1457
  200. package/dist/chunk-YNJ3YC4N.js +0 -2483
  201. package/dist/chunk-ZFAOBRHT.js +0 -2709
  202. package/dist/controllers/admin-auth.controller.d.ts +0 -68
  203. package/dist/controllers/admin-auth.controller.d.ts.map +0 -1
  204. package/dist/controllers/admin-auth.controller.js +0 -414
  205. package/dist/controllers/admin-auth.controller.js.map +0 -1
  206. package/dist/controllers/auth.controller.d.ts +0 -125
  207. package/dist/controllers/auth.controller.d.ts.map +0 -1
  208. package/dist/controllers/auth.controller.js +0 -323
  209. package/dist/controllers/auth.controller.js.map +0 -1
  210. package/dist/controllers/collection.controller.d.ts +0 -157
  211. package/dist/controllers/collection.controller.d.ts.map +0 -1
  212. package/dist/controllers/collection.controller.js +0 -779
  213. package/dist/controllers/collection.controller.js.map +0 -1
  214. package/dist/controllers/global.controller.d.ts +0 -17
  215. package/dist/controllers/global.controller.d.ts.map +0 -1
  216. package/dist/controllers/global.controller.js +0 -132
  217. package/dist/controllers/global.controller.js.map +0 -1
  218. package/dist/controllers/media.controller.d.ts +0 -38
  219. package/dist/controllers/media.controller.d.ts.map +0 -1
  220. package/dist/controllers/media.controller.js +0 -162
  221. package/dist/controllers/media.controller.js.map +0 -1
  222. package/dist/controllers/preview.controller.d.ts +0 -37
  223. package/dist/controllers/preview.controller.d.ts.map +0 -1
  224. package/dist/controllers/preview.controller.js +0 -48
  225. package/dist/controllers/preview.controller.js.map +0 -1
  226. package/dist/index-BKYugiYp.d.cts +0 -1988
  227. package/dist/index-BKYugiYp.d.ts +0 -1988
  228. package/dist/index-BSWCiAen.d.cts +0 -1983
  229. package/dist/index-BSWCiAen.d.ts +0 -1983
  230. package/dist/index-BfLDb3b0.d.cts +0 -1467
  231. package/dist/index-BfLDb3b0.d.ts +0 -1467
  232. package/dist/index-Bi4sX_eC.d.cts +0 -1491
  233. package/dist/index-Bi4sX_eC.d.ts +0 -1491
  234. package/dist/index-Bp7PDOYG.d.cts +0 -1750
  235. package/dist/index-Bp7PDOYG.d.ts +0 -1750
  236. package/dist/index-ByXooLy-.d.cts +0 -1762
  237. package/dist/index-ByXooLy-.d.ts +0 -1762
  238. package/dist/index-C9Vp1DCT.d.cts +0 -1563
  239. package/dist/index-C9Vp1DCT.d.ts +0 -1563
  240. package/dist/index-CFezd8p1.d.cts +0 -1986
  241. package/dist/index-CFezd8p1.d.ts +0 -1986
  242. package/dist/index-CdQwnbfh.d.cts +0 -1889
  243. package/dist/index-CdQwnbfh.d.ts +0 -1889
  244. package/dist/index-D38_E0gf.d.cts +0 -336
  245. package/dist/index-D38_E0gf.d.ts +0 -336
  246. package/dist/index-DR2z1rrf.d.cts +0 -1503
  247. package/dist/index-DR2z1rrf.d.ts +0 -1503
  248. package/dist/index-DTrpTru7.d.cts +0 -1881
  249. package/dist/index-DTrpTru7.d.ts +0 -1881
  250. package/dist/index-DfAmTZXk.d.cts +0 -1749
  251. package/dist/index-DfAmTZXk.d.ts +0 -1749
  252. package/dist/index-DfkPT4NR.d.cts +0 -1584
  253. package/dist/index-DfkPT4NR.d.ts +0 -1584
  254. package/dist/index-DzUlE5Hc.d.cts +0 -1751
  255. package/dist/index-DzUlE5Hc.d.ts +0 -1751
  256. package/dist/index-M_m6dXZV.d.cts +0 -1889
  257. package/dist/index-M_m6dXZV.d.ts +0 -1889
  258. package/dist/index-RylhgOwj.d.cts +0 -340
  259. package/dist/index-RylhgOwj.d.ts +0 -340
  260. package/dist/index-qhLus8ZO.d.cts +0 -1881
  261. package/dist/index-qhLus8ZO.d.ts +0 -1881
  262. package/dist/index-xB1lMg79.d.cts +0 -1456
  263. package/dist/index-xB1lMg79.d.ts +0 -1456
  264. package/dist/index.d.mts +0 -417
  265. package/dist/index.d.ts.map +0 -1
  266. package/dist/index.js.map +0 -1
  267. package/dist/index.mjs +0 -1974
  268. package/dist/middleware/auth.d.ts +0 -18
  269. package/dist/middleware/auth.d.ts.map +0 -1
  270. package/dist/middleware/auth.js +0 -45
  271. package/dist/middleware/auth.js.map +0 -1
  272. package/dist/password-ACI2YUGZ.js +0 -8
  273. package/dist/router.d.ts +0 -8
  274. package/dist/router.d.ts.map +0 -1
  275. package/dist/router.js +0 -625
  276. package/dist/router.js.map +0 -1
  277. package/dist/server.d.ts.map +0 -1
  278. package/dist/server.js.map +0 -1
  279. package/dist/services/audit.service.d.ts +0 -23
  280. package/dist/services/audit.service.d.ts.map +0 -1
  281. package/dist/services/audit.service.js +0 -28
  282. package/dist/services/audit.service.js.map +0 -1
  283. package/dist/services/defaults.service.d.ts +0 -8
  284. package/dist/services/defaults.service.d.ts.map +0 -1
  285. package/dist/services/defaults.service.js +0 -55
  286. package/dist/services/defaults.service.js.map +0 -1
  287. package/dist/services/email-template.d.ts +0 -46
  288. package/dist/services/email-template.d.ts.map +0 -1
  289. package/dist/services/email-template.js +0 -88
  290. package/dist/services/email-template.js.map +0 -1
  291. package/dist/services/email.service.d.ts +0 -33
  292. package/dist/services/email.service.d.ts.map +0 -1
  293. package/dist/services/email.service.js +0 -96
  294. package/dist/services/email.service.js.map +0 -1
  295. package/dist/services/media.service.d.ts +0 -20
  296. package/dist/services/media.service.d.ts.map +0 -1
  297. package/dist/services/media.service.js +0 -49
  298. package/dist/services/media.service.js.map +0 -1
  299. package/dist/services/population.service.d.ts +0 -20
  300. package/dist/services/population.service.d.ts.map +0 -1
  301. package/dist/services/population.service.js +0 -194
  302. package/dist/services/population.service.js.map +0 -1
  303. package/dist/token-7QG5DBME.mjs +0 -10
  304. package/dist/types/access.d.ts +0 -38
  305. package/dist/types/access.d.ts.map +0 -1
  306. package/dist/types/access.js +0 -2
  307. package/dist/types/access.js.map +0 -1
  308. package/dist/types/adapters.d.ts +0 -146
  309. package/dist/types/adapters.d.ts.map +0 -1
  310. package/dist/types/adapters.js +0 -2
  311. package/dist/types/adapters.js.map +0 -1
  312. package/dist/types/admin-auth.d.ts +0 -132
  313. package/dist/types/admin-auth.d.ts.map +0 -1
  314. package/dist/types/admin-auth.js +0 -2
  315. package/dist/types/admin-auth.js.map +0 -1
  316. package/dist/types/admin.d.ts +0 -65
  317. package/dist/types/admin.d.ts.map +0 -1
  318. package/dist/types/admin.js +0 -2
  319. package/dist/types/admin.js.map +0 -1
  320. package/dist/types/app-config.d.ts +0 -143
  321. package/dist/types/app-config.d.ts.map +0 -1
  322. package/dist/types/app-config.js +0 -2
  323. package/dist/types/app-config.js.map +0 -1
  324. package/dist/types/documents.d.ts +0 -65
  325. package/dist/types/documents.d.ts.map +0 -1
  326. package/dist/types/documents.js +0 -2
  327. package/dist/types/documents.js.map +0 -1
  328. package/dist/types/hooks.d.ts +0 -122
  329. package/dist/types/hooks.d.ts.map +0 -1
  330. package/dist/types/hooks.js +0 -2
  331. package/dist/types/hooks.js.map +0 -1
  332. package/dist/types/index.d.ts +0 -13
  333. package/dist/types/index.d.ts.map +0 -1
  334. package/dist/types/index.js +0 -13
  335. package/dist/types/index.js.map +0 -1
  336. package/dist/types/request.d.ts +0 -42
  337. package/dist/types/request.d.ts.map +0 -1
  338. package/dist/types/request.js +0 -2
  339. package/dist/types/request.js.map +0 -1
  340. package/dist/types/schema-config.d.ts +0 -303
  341. package/dist/types/schema-config.d.ts.map +0 -1
  342. package/dist/types/schema-config.js +0 -2
  343. package/dist/types/schema-config.js.map +0 -1
  344. package/dist/types/schema-core.d.ts +0 -294
  345. package/dist/types/schema-core.d.ts.map +0 -1
  346. package/dist/types/schema-core.js +0 -2
  347. package/dist/types/schema-core.js.map +0 -1
  348. package/dist/types/schema-inference.d.ts +0 -73
  349. package/dist/types/schema-inference.d.ts.map +0 -1
  350. package/dist/types/schema-inference.js +0 -2
  351. package/dist/types/schema-inference.js.map +0 -1
  352. package/dist/types/workflows.d.ts +0 -84
  353. package/dist/types/workflows.d.ts.map +0 -1
  354. package/dist/types/workflows.js +0 -7
  355. package/dist/types/workflows.js.map +0 -1
  356. package/dist/utils/admin-auth.d.ts +0 -5
  357. package/dist/utils/admin-auth.d.ts.map +0 -1
  358. package/dist/utils/admin-auth.js +0 -39
  359. package/dist/utils/admin-auth.js.map +0 -1
  360. package/dist/utils/config.d.ts +0 -8
  361. package/dist/utils/config.d.ts.map +0 -1
  362. package/dist/utils/config.js +0 -238
  363. package/dist/utils/config.js.map +0 -1
  364. package/dist/utils/hooks.d.ts +0 -41
  365. package/dist/utils/hooks.d.ts.map +0 -1
  366. package/dist/utils/hooks.js +0 -173
  367. package/dist/utils/hooks.js.map +0 -1
  368. package/dist/utils/openapi.d.ts +0 -6
  369. package/dist/utils/openapi.d.ts.map +0 -1
  370. package/dist/utils/openapi.js +0 -842
  371. package/dist/utils/openapi.js.map +0 -1
  372. package/dist/utils/parse-sort.d.ts +0 -7
  373. package/dist/utils/parse-sort.d.ts.map +0 -1
  374. package/dist/utils/parse-sort.js +0 -23
  375. package/dist/utils/parse-sort.js.map +0 -1
  376. package/dist/utils/parse-where.d.ts +0 -63
  377. package/dist/utils/parse-where.d.ts.map +0 -1
  378. package/dist/utils/parse-where.js +0 -196
  379. package/dist/utils/parse-where.js.map +0 -1
  380. package/dist/utils/readonly-db.d.ts +0 -9
  381. package/dist/utils/readonly-db.d.ts.map +0 -1
  382. package/dist/utils/readonly-db.js +0 -21
  383. package/dist/utils/readonly-db.js.map +0 -1
  384. package/dist/utils/setup-prompt.d.ts +0 -11
  385. package/dist/utils/setup-prompt.d.ts.map +0 -1
  386. package/dist/utils/setup-prompt.js +0 -863
  387. package/dist/utils/setup-prompt.js.map +0 -1
  388. package/dist/utils/swagger.d.ts +0 -11
  389. package/dist/utils/swagger.d.ts.map +0 -1
  390. package/dist/utils/swagger.js +0 -62
  391. package/dist/utils/swagger.js.map +0 -1
  392. package/dist/utils/upload-validation.d.ts +0 -23
  393. package/dist/utils/upload-validation.d.ts.map +0 -1
  394. package/dist/utils/upload-validation.js +0 -44
  395. package/dist/utils/upload-validation.js.map +0 -1
  396. package/dist/utils/where-sanitizer.d.ts +0 -10
  397. package/dist/utils/where-sanitizer.d.ts.map +0 -1
  398. package/dist/utils/where-sanitizer.js +0 -67
  399. package/dist/utils/where-sanitizer.js.map +0 -1
  400. package/dist/where-sanitizer-7Q4JXMX6.js +0 -57
  401. package/dist/where-sanitizer-DQIWTQZW.js +0 -50
  402. package/dist/workflows.d.ts +0 -54
  403. package/dist/workflows.d.ts.map +0 -1
  404. package/dist/workflows.js +0 -282
  405. package/dist/workflows.js.map +0 -1
package/dist/router.js DELETED
@@ -1,625 +0,0 @@
1
- import { CollectionController } from "./controllers/collection.controller.js";
2
- import { GlobalController } from "./controllers/global.controller.js";
3
- import { MediaController } from "./controllers/media.controller.js";
4
- import { AuthController } from "./controllers/auth.controller.js";
5
- import { AdminAuthController } from "./controllers/admin-auth.controller.js";
6
- import { PreviewController } from "./controllers/preview.controller.js";
7
- import { requireAuth, optionalAuth } from "./middleware/auth.js";
8
- import { generateOpenApi } from "./utils/openapi.js";
9
- import { getSwaggerHtml } from "./utils/swagger.js";
10
- import { evaluateAccess } from "./auth/jexl.js";
11
- import { getPublicAdminAuthConfig } from "./utils/admin-auth.js";
12
- /**
13
- * Access gate middleware for granular permissions using Jexl.
14
- */
15
- function accessGate(target, action) {
16
- return async (c, next) => {
17
- const user = c.get('user');
18
- const accessExpr = target.access?.[action];
19
- // If no access expression, default to public (true) for now to maintain parity with old behavior.
20
- // However, if we want to be secure by default, we could change this to false.
21
- if (accessExpr === undefined || accessExpr === null) {
22
- return await next();
23
- }
24
- const accessArgs = { user, req: c.req, doc: null };
25
- const allowed = await evaluateAccess(accessExpr, accessArgs);
26
- if (!allowed) {
27
- return c.json({ error: true, message: `Access denied: ${action} on ${target.slug}` }, 403);
28
- }
29
- await next();
30
- };
31
- }
32
- async function checkAccess(access, accessArgs) {
33
- if (access === undefined || access === null)
34
- return true;
35
- if (typeof access === 'function') {
36
- try {
37
- const result = await access(accessArgs);
38
- return typeof result === 'boolean' ? result : !!result;
39
- }
40
- catch (err) {
41
- console.error('[dyrected/core] Functional access check failed:', err);
42
- return false;
43
- }
44
- }
45
- if (typeof access === 'string' || typeof access === 'boolean') {
46
- return evaluateAccess(access, accessArgs);
47
- }
48
- return true;
49
- }
50
- function serializeFieldForApi(f) {
51
- if (!f)
52
- return f;
53
- const serialized = { ...f };
54
- if (serialized.admin?.hooks) {
55
- const hooks = { ...serialized.admin.hooks };
56
- if (typeof hooks.onChange === "function") {
57
- hooks.onChange = hooks.onChange.toString();
58
- }
59
- if (typeof hooks.options === "function") {
60
- hooks.options = hooks.options.toString();
61
- }
62
- serialized.admin = { ...serialized.admin, hooks };
63
- }
64
- if (typeof serialized.options === "function" || (serialized.options && typeof serialized.options === "object" && "resolve" in serialized.options)) {
65
- serialized.options = { _dynamic: true };
66
- }
67
- if (serialized.fields) {
68
- serialized.fields = serialized.fields.map(serializeFieldForApi);
69
- }
70
- if (serialized.blocks) {
71
- serialized.blocks = serialized.blocks.map((b) => ({
72
- ...b,
73
- fields: b.fields?.map(serializeFieldForApi),
74
- }));
75
- }
76
- return serialized;
77
- }
78
- /**
79
- * Register dynamic routes based on the provided configuration.
80
- */
81
- export function registerRoutes(app, config) {
82
- // 1. Schema Endpoints
83
- // Used by the SDK and Admin to understand the content structure
84
- app.get("/api/schemas", optionalAuth(), async (c) => {
85
- const siteId = c.req.header("X-Site-Id");
86
- let collections = [...config.collections];
87
- let globals = [...config.globals];
88
- if (siteId && config.onSchemaFetch) {
89
- const dynamic = await config.onSchemaFetch(siteId);
90
- if (dynamic.collections)
91
- collections = [...collections, ...dynamic.collections];
92
- if (dynamic.globals)
93
- globals = [...globals, ...dynamic.globals];
94
- // Merge dynamic admin config if provided
95
- if (dynamic.admin) {
96
- config.admin = { ...config.admin, ...dynamic.admin };
97
- }
98
- if (dynamic.adminAuth) {
99
- config.adminAuth = { ...config.adminAuth, ...dynamic.adminAuth };
100
- }
101
- }
102
- const user = c.get('user');
103
- const accessArgs = { user, req: c.req, doc: null };
104
- const serializeAccess = async (access) => {
105
- if (typeof access === 'string')
106
- return access;
107
- if (typeof access === 'boolean')
108
- return access;
109
- return checkAccess(access, accessArgs);
110
- };
111
- const filteredCollections = await Promise.all(collections
112
- .filter((col) => !siteId || col.shared || !col.siteId || col.siteId === siteId)
113
- .map(async (col) => ({
114
- slug: col.slug,
115
- labels: col.labels,
116
- access: {
117
- read: await serializeAccess(col.access?.read),
118
- create: await serializeAccess(col.access?.create),
119
- update: await serializeAccess(col.access?.update),
120
- delete: await serializeAccess(col.access?.delete),
121
- },
122
- fields: await Promise.all(col.fields.map(serializeFieldForApi).map(async (f) => ({
123
- name: f.name,
124
- type: f.type,
125
- label: f.label,
126
- required: f.required,
127
- defaultValue: f.defaultValue,
128
- options: f.options,
129
- relationTo: f.relationTo,
130
- hasMany: f.hasMany,
131
- fields: f.fields,
132
- blocks: f.blocks,
133
- collection: f.collection,
134
- on: f.on,
135
- limit: f.limit,
136
- admin: f.admin,
137
- access: {
138
- read: await serializeAccess(f.access?.read),
139
- update: await serializeAccess(f.access?.update),
140
- },
141
- }))),
142
- upload: !!col.upload,
143
- auth: !!col.auth,
144
- admin: col.admin,
145
- workflow: col.workflow
146
- ? {
147
- initialState: col.workflow.initialState,
148
- draftState: col.workflow.draftState,
149
- states: col.workflow.states,
150
- transitions: col.workflow.transitions.map((t) => ({
151
- name: t.name,
152
- label: t.label,
153
- from: t.from,
154
- to: t.to,
155
- requiredCapabilities: t.requiredCapabilities,
156
- requireComment: t.requireComment,
157
- unpublish: t.unpublish,
158
- })),
159
- roles: col.workflow.roles,
160
- }
161
- : undefined,
162
- })));
163
- const filteredGlobals = await Promise.all(globals
164
- .filter((glb) => !siteId || glb.shared || !glb.siteId || glb.siteId === siteId)
165
- .map(async (glb) => ({
166
- slug: glb.slug,
167
- label: glb.label,
168
- access: {
169
- read: await serializeAccess(glb.access?.read),
170
- update: await serializeAccess(glb.access?.update),
171
- },
172
- fields: await Promise.all(glb.fields.map(serializeFieldForApi).map(async (f) => ({
173
- name: f.name,
174
- type: f.type,
175
- label: f.label,
176
- required: f.required,
177
- defaultValue: f.defaultValue,
178
- options: f.options,
179
- relationTo: f.relationTo,
180
- hasMany: f.hasMany,
181
- fields: f.fields,
182
- blocks: f.blocks,
183
- collection: f.collection,
184
- on: f.on,
185
- limit: f.limit,
186
- admin: f.admin,
187
- access: {
188
- read: await serializeAccess(f.access?.read),
189
- update: await serializeAccess(f.access?.update),
190
- },
191
- }))),
192
- admin: glb.admin,
193
- })));
194
- return c.json({
195
- collections: filteredCollections,
196
- globals: filteredGlobals,
197
- admin: config.admin || {},
198
- adminAuth: getPublicAdminAuthConfig(config.adminAuth, collections),
199
- });
200
- });
201
- app.get("/api/dyrected/options/:collection/:field", optionalAuth(), async (c) => {
202
- const { collection: colSlug, field: fieldName } = c.req.param();
203
- const siteId = c.req.header("X-Site-Id");
204
- // Resolve collections
205
- let collections = [...config.collections];
206
- if (siteId && config.onSchemaFetch) {
207
- const dynamic = await config.onSchemaFetch(siteId);
208
- if (dynamic.collections)
209
- collections = [...collections, ...dynamic.collections];
210
- }
211
- const user = c.get('user');
212
- let collection = collections.find((col) => col.slug === colSlug);
213
- let field;
214
- if (collection) {
215
- // Check read access on collection
216
- const accessExpr = collection.access?.read;
217
- if (accessExpr !== undefined && accessExpr !== null) {
218
- const accessArgs = { user, req: c.req, doc: null };
219
- const allowed = await checkAccess(accessExpr, accessArgs);
220
- if (!allowed) {
221
- return c.json({ error: true, message: `Access denied: read on ${colSlug}` }, 403);
222
- }
223
- }
224
- field = collection.fields.find((f) => f.name === fieldName);
225
- }
226
- else {
227
- let globals = [...config.globals];
228
- if (siteId && config.onSchemaFetch) {
229
- const dynamic = await config.onSchemaFetch(siteId);
230
- if (dynamic.globals)
231
- globals = [...globals, ...dynamic.globals];
232
- }
233
- const glb = globals.find((g) => g.slug === colSlug);
234
- if (!glb) {
235
- return c.json({ error: true, message: `${colSlug} not found as collection or global` }, 404);
236
- }
237
- // Check read access on global
238
- const accessExpr = glb.access?.read;
239
- if (accessExpr !== undefined && accessExpr !== null) {
240
- const accessArgs = { user, req: c.req, doc: null };
241
- const allowed = await checkAccess(accessExpr, accessArgs);
242
- if (!allowed) {
243
- return c.json({ error: true, message: `Access denied: read on global ${colSlug}` }, 403);
244
- }
245
- }
246
- field = glb.fields.find((f) => f.name === fieldName);
247
- }
248
- if (!field) {
249
- return c.json({ error: true, message: `Field ${fieldName} not found in ${colSlug}` }, 404);
250
- }
251
- // Get the resolver
252
- let resolver;
253
- if (typeof field.options === "function") {
254
- resolver = field.options;
255
- }
256
- else if (field.options && typeof field.options === "object" && "resolve" in field.options) {
257
- resolver = field.options.resolve;
258
- }
259
- if (!resolver) {
260
- return c.json({ error: true, message: `Field ${fieldName} in ${colSlug} is not dynamic` }, 400);
261
- }
262
- try {
263
- const db = c.get("db") || config.db;
264
- // Construct a request query helper
265
- const queryParams = c.req.query();
266
- const reqContext = {
267
- query: queryParams,
268
- headers: c.req.header(),
269
- raw: c.req.raw,
270
- };
271
- const result = await resolver({
272
- db,
273
- user,
274
- req: reqContext,
275
- });
276
- return c.json(result);
277
- }
278
- catch (err) {
279
- console.error(`[dyrected/core] Failed to resolve dynamic options for field ${fieldName}:`, err);
280
- return c.json({ error: true, message: err.message || "Failed to resolve dynamic options" }, 500);
281
- }
282
- });
283
- app.get("/api/openapi.json", (c) => {
284
- return c.json(generateOpenApi(config));
285
- });
286
- app.get("/api/docs", (c) => {
287
- return c.html(getSwaggerHtml());
288
- });
289
- app.get("/api/preferences/:key", requireAuth(), async (c) => {
290
- const db = config.db;
291
- const user = c.get("user");
292
- const key = c.req.param("key");
293
- const scope = c.req.query("scope");
294
- if (!db)
295
- return c.json({ message: "Database not configured" }, 500);
296
- if (!user?.collection || !user.sub)
297
- return c.json({ error: true, message: "Authentication required." }, 401);
298
- if (!key)
299
- return c.json({ error: true, message: "Preference key is required." }, 400);
300
- const getGlobalPreference = async () => {
301
- const globalDoc = await db.findOne({ collection: "__global_preferences", id: key });
302
- return globalDoc ? globalDoc.value : null;
303
- };
304
- if (scope === "global") {
305
- const globalValue = await getGlobalPreference();
306
- return c.json({ key, value: globalValue });
307
- }
308
- const doc = await db.findOne({ collection: user.collection, id: user.sub });
309
- if (!doc)
310
- return c.json({ error: true, message: "User not found." }, 404);
311
- const preferences = typeof doc.__preferences === "object" && doc.__preferences !== null
312
- ? doc.__preferences
313
- : {};
314
- if (key in preferences) {
315
- return c.json({ key, value: preferences[key] ?? null });
316
- }
317
- const globalValue = await getGlobalPreference();
318
- return c.json({ key, value: globalValue });
319
- });
320
- app.put("/api/preferences/:key", requireAuth(), async (c) => {
321
- const db = config.db;
322
- const user = c.get("user");
323
- const key = c.req.param("key");
324
- const scope = c.req.query("scope");
325
- if (!db)
326
- return c.json({ message: "Database not configured" }, 500);
327
- if (!user?.collection || !user.sub)
328
- return c.json({ error: true, message: "Authentication required." }, 401);
329
- if (!key)
330
- return c.json({ error: true, message: "Preference key is required." }, 400);
331
- const body = await c.req.json().catch(() => ({}));
332
- if (scope === "global") {
333
- const isAdminUser = Array.isArray(user?.roles) && user.roles.includes('admin');
334
- if (!isAdminUser) {
335
- return c.json({ error: true, message: "Only administrators can save global preferences." }, 403);
336
- }
337
- const existing = await db.findOne({ collection: "__global_preferences", id: key });
338
- if (existing) {
339
- await db.update({
340
- collection: "__global_preferences",
341
- id: key,
342
- data: { value: body.value }
343
- });
344
- }
345
- else {
346
- await db.create({
347
- collection: "__global_preferences",
348
- data: { id: key, value: body.value }
349
- });
350
- }
351
- return c.json({ key, value: body.value });
352
- }
353
- const doc = await db.findOne({ collection: user.collection, id: user.sub });
354
- if (!doc)
355
- return c.json({ error: true, message: "User not found." }, 404);
356
- const preferences = typeof doc.__preferences === "object" && doc.__preferences !== null
357
- ? doc.__preferences
358
- : {};
359
- const nextPreferences = { ...preferences, [key]: body.value };
360
- await db.update({
361
- collection: user.collection,
362
- id: user.sub,
363
- data: { __preferences: nextPreferences },
364
- });
365
- return c.json({ key, value: body.value });
366
- });
367
- app.delete("/api/preferences/:key", requireAuth(), async (c) => {
368
- const db = config.db;
369
- const user = c.get("user");
370
- const key = c.req.param("key");
371
- const scope = c.req.query("scope");
372
- if (!db)
373
- return c.json({ message: "Database not configured" }, 500);
374
- if (!user?.collection || !user.sub)
375
- return c.json({ error: true, message: "Authentication required." }, 401);
376
- if (!key)
377
- return c.json({ error: true, message: "Preference key is required." }, 400);
378
- if (scope === "global") {
379
- const isAdminUser = Array.isArray(user?.roles) && user.roles.includes('admin');
380
- if (!isAdminUser) {
381
- return c.json({ error: true, message: "Only administrators can delete global preferences." }, 403);
382
- }
383
- await db.delete({ collection: "__global_preferences", id: key });
384
- return c.json({ success: true });
385
- }
386
- const doc = await db.findOne({ collection: user.collection, id: user.sub });
387
- if (!doc)
388
- return c.json({ error: true, message: "User not found." }, 404);
389
- const preferences = typeof doc.__preferences === "object" && doc.__preferences !== null
390
- ? { ...doc.__preferences }
391
- : {};
392
- delete preferences[key];
393
- await db.update({
394
- collection: user.collection,
395
- id: user.sub,
396
- data: { __preferences: preferences },
397
- });
398
- return c.json({ success: true });
399
- });
400
- // Global Media Fallback (Proxies to the 'media' collection)
401
- app.get("/api/media/:filename{.+$}", async (c) => {
402
- const mediaController = new MediaController("media");
403
- return mediaController.serve(c);
404
- });
405
- app.get("/media/:filename{.+$}", async (c) => {
406
- const mediaController = new MediaController("media");
407
- return mediaController.serve(c);
408
- });
409
- // 2. Media Routes (Conditional & Dynamic)
410
- if (config.storage) {
411
- const uploadCollections = config.collections.filter((c) => c.upload);
412
- // Register routes for each upload-enabled collection
413
- for (const col of uploadCollections) {
414
- const mediaController = new MediaController(col.slug);
415
- const prefix = `/api/collections/${col.slug}`;
416
- app.get(`${prefix}/media`, accessGate(col, 'read'), (c) => mediaController.find(c));
417
- app.get(`${prefix}/media/:filename{.+$}`, (c) => mediaController.serve(c));
418
- app.post(`${prefix}/media`, accessGate(col, 'create'), (c) => mediaController.upload(c));
419
- app.delete(`${prefix}/media/:id`, accessGate(col, 'delete'), (c) => mediaController.delete(c));
420
- }
421
- }
422
- // 2b. Admin Auth Routes
423
- const adminAuthController = new AdminAuthController(config);
424
- app.get("/api/admin/auth/providers", (c) => adminAuthController.providers(c));
425
- app.get("/api/admin/auth/:provider/start", (c) => adminAuthController.start(c));
426
- app.get("/api/admin/auth/:provider/callback", (c) => adminAuthController.callback(c));
427
- app.post("/api/admin/auth/:provider/exchange", (c) => adminAuthController.exchange(c));
428
- app.post("/api/admin/logout", (c) => adminAuthController.logout(c));
429
- // 3. Auth Routes — for collections with auth: true
430
- for (const collection of config.collections) {
431
- if (!collection.auth)
432
- continue;
433
- const path = `/api/collections/${collection.slug}`;
434
- const authController = new AuthController(collection);
435
- app.post(`${path}/login`, (c) => authController.login(c));
436
- app.post(`${path}/logout`, (c) => authController.logout(c));
437
- app.get(`${path}/init`, (c) => authController.init(c));
438
- app.post(`${path}/first-user`, (c) => authController.registerFirstUser(c));
439
- // /me and /refresh-token require a valid token
440
- app.get(`${path}/me`, requireAuth(), (c) => authController.me(c));
441
- app.post(`${path}/refresh-token`, requireAuth(), (c) => authController.refreshToken(c));
442
- app.post(`${path}/forgot-password`, (c) => authController.forgotPassword(c));
443
- app.post(`${path}/reset-password`, (c) => authController.resetPassword(c));
444
- app.post(`${path}/invite`, requireAuth(), (c) => authController.invite(c));
445
- app.post(`${path}/accept-invite`, (c) => authController.acceptInvite(c));
446
- }
447
- // 4. Collection Routes (Static)
448
- for (const collection of config.collections) {
449
- const path = `/api/collections/${collection.slug}`;
450
- const controller = new CollectionController(collection);
451
- app.get(path, accessGate(collection, 'read'), (c) => controller.find(c));
452
- app.post(path, accessGate(collection, 'create'), (c) => controller.create(c));
453
- app.post(`${path}/media`, accessGate(collection, 'create'), (c) => controller.create(c));
454
- // delete-many must be registered before /:id to avoid the wildcard swallowing it
455
- app.delete(`${path}/delete-many`, accessGate(collection, 'delete'), (c) => controller.deleteMany(c));
456
- app.get(`${path}/:id`, accessGate(collection, 'read'), (c) => controller.findOne(c));
457
- app.patch(`${path}/:id`, accessGate(collection, 'update'), (c) => controller.update(c));
458
- app.delete(`${path}/:id`, accessGate(collection, 'delete'), (c) => controller.delete(c));
459
- app.post(`${path}/seed`, (c) => controller.seed(c));
460
- // Dedicated password-change endpoint (auth collections only)
461
- if (collection.auth) {
462
- app.post(`${path}/:id/change-password`, requireAuth(), (c) => controller.changePassword(c));
463
- }
464
- // Workflow routes — only registered when the collection has a workflow configured
465
- if (collection.workflow) {
466
- app.post(`${path}/:id/transitions/:transition`, requireAuth(), (c) => controller.transition(c));
467
- app.get(`${path}/:id/workflow-history`, requireAuth(), (c) => controller.workflowHistory(c));
468
- }
469
- }
470
- // 5. Global Routes (Static)
471
- for (const global of config.globals) {
472
- const path = `/api/globals/${global.slug}`;
473
- const controller = new GlobalController(global);
474
- app.get(path, accessGate(global, 'read'), (c) => controller.get(c));
475
- app.patch(path, accessGate(global, 'update'), (c) => controller.update(c));
476
- app.post(`${path}/seed`, (c) => controller.seed(c));
477
- }
478
- // 6. Preview Routes
479
- const previewController = new PreviewController();
480
- app.post("/api/preview-token", requireAuth(), (c) => previewController.createToken(c));
481
- app.get("/api/preview-data", (c) => previewController.getData(c));
482
- // 7. Dynamic Routes (Tenant-specific)
483
- // This handles collections/globals defined via sync:schema and fetched via onSchemaFetch
484
- // 7a. Workflow sub-routes for dynamic tenant collections.
485
- // Must be registered BEFORE the /:id? catch-all so Hono doesn't swallow deeper paths.
486
- // Pattern: POST /api/collections/:slug/:id/transitions/:transition
487
- // GET /api/collections/:slug/:id/workflow-history
488
- // 7a. Workflow sub-routes for dynamic tenant collections.
489
- // Must be registered BEFORE the /:id? catch-all so Hono doesn't swallow deeper paths.
490
- // Pattern: POST /api/collections/:slug/:id/transitions/:transition
491
- // GET /api/collections/:slug/:id/workflow-history
492
- app.post("/api/collections/:slug/:id/transitions/:transition", requireAuth(), async (c) => {
493
- const slug = c.req.param("slug");
494
- const siteId = c.req.header("X-Site-Id") || c.get("siteId");
495
- const config = c.get("config");
496
- // Skip if static — static workflow routes are registered directly above;
497
- // if this wildcard fires for a static slug it means the sub-path is unknown.
498
- if (config.collections.some((col) => col.slug === slug)) {
499
- return c.json({ message: "Not Found" }, 404);
500
- }
501
- if (!config.onSchemaFetch || !siteId) {
502
- return c.json({ message: `Collection "${slug}" not found` }, 404);
503
- }
504
- const dynamic = await config.onSchemaFetch(siteId);
505
- const collection = dynamic.collections?.find((col) => col.slug === slug);
506
- if (!collection?.workflow) {
507
- return c.json({ message: `Collection "${slug}" not found or has no workflow` }, 404);
508
- }
509
- const controller = new CollectionController(collection);
510
- return controller.transition(c);
511
- });
512
- app.get("/api/collections/:slug/:id/workflow-history", requireAuth(), async (c) => {
513
- const slug = c.req.param("slug");
514
- const siteId = c.req.header("X-Site-Id") || c.get("siteId");
515
- const config = c.get("config");
516
- if (config.collections.some((col) => col.slug === slug)) {
517
- return c.json({ message: "Not Found" }, 404);
518
- }
519
- if (!config.onSchemaFetch || !siteId) {
520
- return c.json({ message: `Collection "${slug}" not found` }, 404);
521
- }
522
- const dynamic = await config.onSchemaFetch(siteId);
523
- const collection = dynamic.collections?.find((col) => col.slug === slug);
524
- if (!collection?.workflow) {
525
- return c.json({ message: `Collection "${slug}" not found or has no workflow` }, 404);
526
- }
527
- const controller = new CollectionController(collection);
528
- return controller.workflowHistory(c);
529
- });
530
- // 7b. Core dynamic catch-all for tenant collections (list, create, findOne, update, delete).
531
- app.all("/api/collections/:slug/:id?", async (c) => {
532
- const slug = c.req.param("slug");
533
- const id = c.req.param("id");
534
- const siteId = c.req.header("X-Site-Id") || c.get("siteId");
535
- const config = c.get("config");
536
- // Skip if static (already handled by routes above)
537
- if (config.collections.some((col) => col.slug === slug)) {
538
- return c.json({ message: "Method Not Allowed" }, 405);
539
- }
540
- if (config.onSchemaFetch && siteId) {
541
- const dynamic = await config.onSchemaFetch(siteId);
542
- let collection = dynamic.collections?.find((col) => col.slug === slug);
543
- if (!collection && slug === "media") {
544
- collection = {
545
- slug: "media",
546
- labels: { singular: "Media", plural: "Media" },
547
- upload: true,
548
- fields: [],
549
- };
550
- }
551
- if (collection) {
552
- // Handle auth sub-routes for dynamic auth collections
553
- if (collection.auth && id) {
554
- const authController = new AuthController(collection);
555
- const method = c.req.method;
556
- if (method === "POST" && id === "login")
557
- return authController.login(c);
558
- if (method === "POST" && id === "logout")
559
- return authController.logout(c);
560
- if (method === "GET" && id === "me")
561
- return authController.me(c);
562
- if (method === "POST" && id === "refresh-token")
563
- return authController.refreshToken(c);
564
- if (method === "POST" && id === "forgot-password")
565
- return authController.forgotPassword(c);
566
- if (method === "POST" && id === "reset-password")
567
- return authController.resetPassword(c);
568
- }
569
- const controller = new CollectionController(collection);
570
- const method = c.req.method;
571
- if (id) {
572
- if (method === "GET")
573
- return controller.findOne(c);
574
- if (method === "PATCH")
575
- return controller.update(c);
576
- if (method === "DELETE" && id === "delete-many")
577
- return controller.deleteMany(c);
578
- if (method === "DELETE")
579
- return controller.delete(c);
580
- if (method === "POST" && id === "media")
581
- return controller.create(c);
582
- if (method === "POST" && id === "seed")
583
- return controller.seed(c);
584
- }
585
- else {
586
- if (method === "GET")
587
- return controller.find(c);
588
- if (method === "POST")
589
- return controller.create(c);
590
- }
591
- }
592
- }
593
- return c.json({ message: `Collection "${slug}" not found` }, 404);
594
- });
595
- app.all("/api/globals/:slug/:id?", async (c) => {
596
- const slug = c.req.param("slug");
597
- const id = c.req.param("id");
598
- const siteId = c.req.header("X-Site-Id") || c.get("siteId");
599
- const config = c.get("config");
600
- // Skip if static
601
- if (config.globals.some((glb) => glb.slug === slug)) {
602
- return c.json({ message: "Method Not Allowed" }, 405);
603
- }
604
- if (config.onSchemaFetch && siteId) {
605
- const dynamic = await config.onSchemaFetch(siteId);
606
- const global = dynamic.globals?.find((glb) => glb.slug === slug);
607
- if (global) {
608
- const controller = new GlobalController(global);
609
- const method = c.req.method;
610
- if (id) {
611
- if (method === "POST" && id === "seed")
612
- return controller.seed(c);
613
- }
614
- else {
615
- if (method === "GET")
616
- return controller.get(c);
617
- if (method === "PATCH")
618
- return controller.update(c);
619
- }
620
- }
621
- }
622
- return c.json({ message: `Global "${slug}" not found` }, 404);
623
- });
624
- }
625
- //# sourceMappingURL=router.js.map