@dyrected/core 2.5.53 → 2.5.56

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 (409) hide show
  1. package/dist/{app-config-oOarB6Fw.d.cts → app-config-Bxg_DVxv.d.cts} +3 -1
  2. package/dist/{app-config-oOarB6Fw.d.ts → app-config-Bxg_DVxv.d.ts} +3 -1
  3. package/dist/index.d.cts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/server.d.cts +1 -1
  6. package/dist/server.d.ts +1 -1
  7. package/package.json +1 -1
  8. package/dist/__tests__/admin-auth.test.d.ts +0 -2
  9. package/dist/__tests__/admin-auth.test.d.ts.map +0 -1
  10. package/dist/__tests__/admin-auth.test.js +0 -440
  11. package/dist/__tests__/admin-auth.test.js.map +0 -1
  12. package/dist/__tests__/app.test.d.ts +0 -2
  13. package/dist/__tests__/app.test.d.ts.map +0 -1
  14. package/dist/__tests__/app.test.js +0 -27
  15. package/dist/__tests__/app.test.js.map +0 -1
  16. package/dist/__tests__/config.test.d.ts +0 -2
  17. package/dist/__tests__/config.test.d.ts.map +0 -1
  18. package/dist/__tests__/config.test.js +0 -91
  19. package/dist/__tests__/config.test.js.map +0 -1
  20. package/dist/__tests__/deleteMany.test.d.ts +0 -2
  21. package/dist/__tests__/deleteMany.test.d.ts.map +0 -1
  22. package/dist/__tests__/deleteMany.test.js +0 -75
  23. package/dist/__tests__/deleteMany.test.js.map +0 -1
  24. package/dist/__tests__/depth.test.d.ts +0 -2
  25. package/dist/__tests__/depth.test.d.ts.map +0 -1
  26. package/dist/__tests__/depth.test.js +0 -81
  27. package/dist/__tests__/depth.test.js.map +0 -1
  28. package/dist/__tests__/dynamic-options.test.d.ts +0 -2
  29. package/dist/__tests__/dynamic-options.test.d.ts.map +0 -1
  30. package/dist/__tests__/dynamic-options.test.js +0 -132
  31. package/dist/__tests__/dynamic-options.test.js.map +0 -1
  32. package/dist/__tests__/email.service.test.d.ts +0 -2
  33. package/dist/__tests__/email.service.test.d.ts.map +0 -1
  34. package/dist/__tests__/email.service.test.js +0 -46
  35. package/dist/__tests__/email.service.test.js.map +0 -1
  36. package/dist/__tests__/field-inference.test-types.d.ts +0 -24
  37. package/dist/__tests__/field-inference.test-types.d.ts.map +0 -1
  38. package/dist/__tests__/field-inference.test-types.js +0 -87
  39. package/dist/__tests__/field-inference.test-types.js.map +0 -1
  40. package/dist/__tests__/fixtures/editorial-workflow.d.ts +0 -9
  41. package/dist/__tests__/fixtures/editorial-workflow.d.ts.map +0 -1
  42. package/dist/__tests__/fixtures/editorial-workflow.js +0 -12
  43. package/dist/__tests__/fixtures/editorial-workflow.js.map +0 -1
  44. package/dist/__tests__/hooks.test.d.ts +0 -2
  45. package/dist/__tests__/hooks.test.d.ts.map +0 -1
  46. package/dist/__tests__/hooks.test.js +0 -320
  47. package/dist/__tests__/hooks.test.js.map +0 -1
  48. package/dist/__tests__/mocks.d.ts +0 -74
  49. package/dist/__tests__/mocks.d.ts.map +0 -1
  50. package/dist/__tests__/mocks.js +0 -159
  51. package/dist/__tests__/mocks.js.map +0 -1
  52. package/dist/__tests__/openapi.test.d.ts +0 -2
  53. package/dist/__tests__/openapi.test.d.ts.map +0 -1
  54. package/dist/__tests__/openapi.test.js +0 -95
  55. package/dist/__tests__/openapi.test.js.map +0 -1
  56. package/dist/__tests__/parse-sort.test.d.ts +0 -2
  57. package/dist/__tests__/parse-sort.test.d.ts.map +0 -1
  58. package/dist/__tests__/parse-sort.test.js +0 -24
  59. package/dist/__tests__/parse-sort.test.js.map +0 -1
  60. package/dist/__tests__/preferences.test.d.ts +0 -2
  61. package/dist/__tests__/preferences.test.d.ts.map +0 -1
  62. package/dist/__tests__/preferences.test.js +0 -168
  63. package/dist/__tests__/preferences.test.js.map +0 -1
  64. package/dist/__tests__/router.test.d.ts +0 -2
  65. package/dist/__tests__/router.test.d.ts.map +0 -1
  66. package/dist/__tests__/router.test.js +0 -52
  67. package/dist/__tests__/router.test.js.map +0 -1
  68. package/dist/__tests__/where.test.d.ts +0 -2
  69. package/dist/__tests__/where.test.d.ts.map +0 -1
  70. package/dist/__tests__/where.test.js +0 -105
  71. package/dist/__tests__/where.test.js.map +0 -1
  72. package/dist/__tests__/workflow.test.d.ts +0 -2
  73. package/dist/__tests__/workflow.test.d.ts.map +0 -1
  74. package/dist/__tests__/workflow.test.js +0 -497
  75. package/dist/__tests__/workflow.test.js.map +0 -1
  76. package/dist/app-B2tg7Djj.d.cts +0 -1575
  77. package/dist/app-B2tg7Djj.d.ts +0 -1575
  78. package/dist/app-BElen1tP.d.cts +0 -1690
  79. package/dist/app-BElen1tP.d.ts +0 -1690
  80. package/dist/app-BOrsS7Tz.d.cts +0 -1771
  81. package/dist/app-BOrsS7Tz.d.ts +0 -1771
  82. package/dist/app-Bh4_Opv0.d.cts +0 -1522
  83. package/dist/app-Bh4_Opv0.d.ts +0 -1522
  84. package/dist/app-BibuoHQG.d.cts +0 -1764
  85. package/dist/app-BibuoHQG.d.ts +0 -1764
  86. package/dist/app-Bv9gaDAN.d.cts +0 -561
  87. package/dist/app-Bv9gaDAN.d.ts +0 -561
  88. package/dist/app-BvG3bRc8.d.cts +0 -419
  89. package/dist/app-BvG3bRc8.d.ts +0 -419
  90. package/dist/app-C-HgyliB.d.cts +0 -1694
  91. package/dist/app-C-HgyliB.d.ts +0 -1694
  92. package/dist/app-C3B9N1KR.d.cts +0 -1522
  93. package/dist/app-C3B9N1KR.d.ts +0 -1522
  94. package/dist/app-Cc2mG3zi.d.cts +0 -373
  95. package/dist/app-Cc2mG3zi.d.ts +0 -373
  96. package/dist/app-Ctfmo2Re.d.cts +0 -1692
  97. package/dist/app-Ctfmo2Re.d.ts +0 -1692
  98. package/dist/app-D0ffogDd.d.cts +0 -1690
  99. package/dist/app-D0ffogDd.d.ts +0 -1690
  100. package/dist/app-D2uR47gK.d.cts +0 -1690
  101. package/dist/app-D2uR47gK.d.ts +0 -1690
  102. package/dist/app-DDJJa0ep.d.cts +0 -1621
  103. package/dist/app-DDJJa0ep.d.ts +0 -1621
  104. package/dist/app-DO1s9YW1.d.cts +0 -1621
  105. package/dist/app-DO1s9YW1.d.ts +0 -1621
  106. package/dist/app-DTP3-9PJ.d.cts +0 -561
  107. package/dist/app-DTP3-9PJ.d.ts +0 -561
  108. package/dist/app-DZt5nslu.d.cts +0 -374
  109. package/dist/app-DZt5nslu.d.ts +0 -377
  110. package/dist/app-DbKDGYTI.d.cts +0 -566
  111. package/dist/app-DbKDGYTI.d.ts +0 -566
  112. package/dist/app-Dk3SzV1a.d.cts +0 -374
  113. package/dist/app-Dk3SzV1a.d.ts +0 -374
  114. package/dist/app-DnX9mNsh.d.cts +0 -374
  115. package/dist/app-DnX9mNsh.d.ts +0 -374
  116. package/dist/app-DqRO-CMi.d.cts +0 -1457
  117. package/dist/app-DqRO-CMi.d.ts +0 -1457
  118. package/dist/app-DvaFpOtj.d.cts +0 -398
  119. package/dist/app-DvaFpOtj.d.ts +0 -398
  120. package/dist/app-FGzip4XM.d.cts +0 -1563
  121. package/dist/app-FGzip4XM.d.ts +0 -1563
  122. package/dist/app-KApbf4XL.d.cts +0 -362
  123. package/dist/app-KApbf4XL.d.ts +0 -362
  124. package/dist/app-T0alZAE0.d.cts +0 -383
  125. package/dist/app-T0alZAE0.d.ts +0 -383
  126. package/dist/app-aW2FMuYM.d.cts +0 -1759
  127. package/dist/app-aW2FMuYM.d.ts +0 -1759
  128. package/dist/app-config-2vF6W56z.d.cts +0 -1335
  129. package/dist/app-config-2vF6W56z.d.ts +0 -1335
  130. package/dist/app-config-3XBnu9Xz.d.cts +0 -1379
  131. package/dist/app-config-3XBnu9Xz.d.ts +0 -1379
  132. package/dist/app-config-BLMX-9MN.d.cts +0 -1045
  133. package/dist/app-config-BLMX-9MN.d.ts +0 -1045
  134. package/dist/app-config-CaEQH0Kb.d.cts +0 -1383
  135. package/dist/app-config-CaEQH0Kb.d.ts +0 -1383
  136. package/dist/app-config-DLK6bCaP.d.cts +0 -1390
  137. package/dist/app-config-DLK6bCaP.d.ts +0 -1390
  138. package/dist/app-oQt5-9MU.d.cts +0 -1560
  139. package/dist/app-oQt5-9MU.d.ts +0 -1560
  140. package/dist/app-rZj1VFer.d.cts +0 -1621
  141. package/dist/app-rZj1VFer.d.ts +0 -1621
  142. package/dist/app-wo82JRHl.d.cts +0 -445
  143. package/dist/app-wo82JRHl.d.ts +0 -445
  144. package/dist/app.d.ts +0 -21
  145. package/dist/app.d.ts.map +0 -1
  146. package/dist/app.js +0 -56
  147. package/dist/app.js.map +0 -1
  148. package/dist/auth/jexl.d.ts +0 -10
  149. package/dist/auth/jexl.d.ts.map +0 -1
  150. package/dist/auth/jexl.js +0 -22
  151. package/dist/auth/jexl.js.map +0 -1
  152. package/dist/auth/password.d.ts +0 -10
  153. package/dist/auth/password.d.ts.map +0 -1
  154. package/dist/auth/password.js +0 -28
  155. package/dist/auth/password.js.map +0 -1
  156. package/dist/auth/token.d.ts +0 -22
  157. package/dist/auth/token.d.ts.map +0 -1
  158. package/dist/auth/token.js +0 -40
  159. package/dist/auth/token.js.map +0 -1
  160. package/dist/chunk-22JTWD74.js +0 -1784
  161. package/dist/chunk-23URSKPI.js +0 -2371
  162. package/dist/chunk-2JMA3M5S.js +0 -2475
  163. package/dist/chunk-3FZEUK36.js +0 -2470
  164. package/dist/chunk-3VUH2MNW.js +0 -1903
  165. package/dist/chunk-44O2LDPT.js +0 -1513
  166. package/dist/chunk-45JDQDA2.js +0 -1899
  167. package/dist/chunk-4C4L6SD2.js +0 -1524
  168. package/dist/chunk-4EDMZAM5.js +0 -2692
  169. package/dist/chunk-52T4RCFU.js +0 -1972
  170. package/dist/chunk-6ZXEGKT6.js +0 -619
  171. package/dist/chunk-7GGHK75W.js +0 -1835
  172. package/dist/chunk-ALNQINX7.js +0 -2496
  173. package/dist/chunk-B6KDKYXB.js +0 -2502
  174. package/dist/chunk-BEONZV6M.js +0 -1951
  175. package/dist/chunk-C4GEQ5RP.js +0 -1993
  176. package/dist/chunk-CQDVPMEU.js +0 -613
  177. package/dist/chunk-DOJHZ7XN.js +0 -2394
  178. package/dist/chunk-EH7G3LLL.js +0 -2065
  179. package/dist/chunk-EXXOPW3I.js +0 -2483
  180. package/dist/chunk-F4ZC6TXR.js +0 -2065
  181. package/dist/chunk-FCXE5CVC.js +0 -1528
  182. package/dist/chunk-FDQYPPG3.js +0 -2698
  183. package/dist/chunk-FURYJ254.mjs +0 -33
  184. package/dist/chunk-G2QQLBHW.js +0 -24
  185. package/dist/chunk-GM4WW6IE.js +0 -66
  186. package/dist/chunk-GZODLJ3C.js +0 -1861
  187. package/dist/chunk-IIY3E7Q7.js +0 -1996
  188. package/dist/chunk-JJN4J5NS.js +0 -2069
  189. package/dist/chunk-MRUHCNDM.js +0 -1940
  190. package/dist/chunk-NKDX67AW.js +0 -2698
  191. package/dist/chunk-NYUB4AHZ.js +0 -1951
  192. package/dist/chunk-OD4SLW7H.js +0 -1930
  193. package/dist/chunk-OE5MH3NB.js +0 -2070
  194. package/dist/chunk-PH36WQYS.js +0 -1875
  195. package/dist/chunk-PKNFV7KE.js +0 -2469
  196. package/dist/chunk-SUGK7UYL.js +0 -311
  197. package/dist/chunk-TIJHR54M.js +0 -1879
  198. package/dist/chunk-TUUHGLB5.js +0 -2609
  199. package/dist/chunk-UBTRANFX.js +0 -2476
  200. package/dist/chunk-VJWUG2XK.js +0 -1951
  201. package/dist/chunk-W6KURRMW.js +0 -2471
  202. package/dist/chunk-Y4AYI52W.js +0 -631
  203. package/dist/chunk-YDOBB7MY.js +0 -1457
  204. package/dist/chunk-YNJ3YC4N.js +0 -2483
  205. package/dist/chunk-ZFAOBRHT.js +0 -2709
  206. package/dist/controllers/admin-auth.controller.d.ts +0 -68
  207. package/dist/controllers/admin-auth.controller.d.ts.map +0 -1
  208. package/dist/controllers/admin-auth.controller.js +0 -414
  209. package/dist/controllers/admin-auth.controller.js.map +0 -1
  210. package/dist/controllers/auth.controller.d.ts +0 -125
  211. package/dist/controllers/auth.controller.d.ts.map +0 -1
  212. package/dist/controllers/auth.controller.js +0 -323
  213. package/dist/controllers/auth.controller.js.map +0 -1
  214. package/dist/controllers/collection.controller.d.ts +0 -157
  215. package/dist/controllers/collection.controller.d.ts.map +0 -1
  216. package/dist/controllers/collection.controller.js +0 -779
  217. package/dist/controllers/collection.controller.js.map +0 -1
  218. package/dist/controllers/global.controller.d.ts +0 -17
  219. package/dist/controllers/global.controller.d.ts.map +0 -1
  220. package/dist/controllers/global.controller.js +0 -132
  221. package/dist/controllers/global.controller.js.map +0 -1
  222. package/dist/controllers/media.controller.d.ts +0 -38
  223. package/dist/controllers/media.controller.d.ts.map +0 -1
  224. package/dist/controllers/media.controller.js +0 -162
  225. package/dist/controllers/media.controller.js.map +0 -1
  226. package/dist/controllers/preview.controller.d.ts +0 -37
  227. package/dist/controllers/preview.controller.d.ts.map +0 -1
  228. package/dist/controllers/preview.controller.js +0 -48
  229. package/dist/controllers/preview.controller.js.map +0 -1
  230. package/dist/index-BKYugiYp.d.cts +0 -1988
  231. package/dist/index-BKYugiYp.d.ts +0 -1988
  232. package/dist/index-BSWCiAen.d.cts +0 -1983
  233. package/dist/index-BSWCiAen.d.ts +0 -1983
  234. package/dist/index-BfLDb3b0.d.cts +0 -1467
  235. package/dist/index-BfLDb3b0.d.ts +0 -1467
  236. package/dist/index-Bi4sX_eC.d.cts +0 -1491
  237. package/dist/index-Bi4sX_eC.d.ts +0 -1491
  238. package/dist/index-Bp7PDOYG.d.cts +0 -1750
  239. package/dist/index-Bp7PDOYG.d.ts +0 -1750
  240. package/dist/index-ByXooLy-.d.cts +0 -1762
  241. package/dist/index-ByXooLy-.d.ts +0 -1762
  242. package/dist/index-C9Vp1DCT.d.cts +0 -1563
  243. package/dist/index-C9Vp1DCT.d.ts +0 -1563
  244. package/dist/index-CFezd8p1.d.cts +0 -1986
  245. package/dist/index-CFezd8p1.d.ts +0 -1986
  246. package/dist/index-CdQwnbfh.d.cts +0 -1889
  247. package/dist/index-CdQwnbfh.d.ts +0 -1889
  248. package/dist/index-D38_E0gf.d.cts +0 -336
  249. package/dist/index-D38_E0gf.d.ts +0 -336
  250. package/dist/index-DR2z1rrf.d.cts +0 -1503
  251. package/dist/index-DR2z1rrf.d.ts +0 -1503
  252. package/dist/index-DTrpTru7.d.cts +0 -1881
  253. package/dist/index-DTrpTru7.d.ts +0 -1881
  254. package/dist/index-DfAmTZXk.d.cts +0 -1749
  255. package/dist/index-DfAmTZXk.d.ts +0 -1749
  256. package/dist/index-DfkPT4NR.d.cts +0 -1584
  257. package/dist/index-DfkPT4NR.d.ts +0 -1584
  258. package/dist/index-DzUlE5Hc.d.cts +0 -1751
  259. package/dist/index-DzUlE5Hc.d.ts +0 -1751
  260. package/dist/index-M_m6dXZV.d.cts +0 -1889
  261. package/dist/index-M_m6dXZV.d.ts +0 -1889
  262. package/dist/index-RylhgOwj.d.cts +0 -340
  263. package/dist/index-RylhgOwj.d.ts +0 -340
  264. package/dist/index-qhLus8ZO.d.cts +0 -1881
  265. package/dist/index-qhLus8ZO.d.ts +0 -1881
  266. package/dist/index-xB1lMg79.d.cts +0 -1456
  267. package/dist/index-xB1lMg79.d.ts +0 -1456
  268. package/dist/index.d.mts +0 -417
  269. package/dist/index.d.ts.map +0 -1
  270. package/dist/index.js.map +0 -1
  271. package/dist/index.mjs +0 -1974
  272. package/dist/middleware/auth.d.ts +0 -18
  273. package/dist/middleware/auth.d.ts.map +0 -1
  274. package/dist/middleware/auth.js +0 -45
  275. package/dist/middleware/auth.js.map +0 -1
  276. package/dist/password-ACI2YUGZ.js +0 -8
  277. package/dist/router.d.ts +0 -8
  278. package/dist/router.d.ts.map +0 -1
  279. package/dist/router.js +0 -625
  280. package/dist/router.js.map +0 -1
  281. package/dist/server.d.ts.map +0 -1
  282. package/dist/server.js.map +0 -1
  283. package/dist/services/audit.service.d.ts +0 -23
  284. package/dist/services/audit.service.d.ts.map +0 -1
  285. package/dist/services/audit.service.js +0 -28
  286. package/dist/services/audit.service.js.map +0 -1
  287. package/dist/services/defaults.service.d.ts +0 -8
  288. package/dist/services/defaults.service.d.ts.map +0 -1
  289. package/dist/services/defaults.service.js +0 -55
  290. package/dist/services/defaults.service.js.map +0 -1
  291. package/dist/services/email-template.d.ts +0 -46
  292. package/dist/services/email-template.d.ts.map +0 -1
  293. package/dist/services/email-template.js +0 -88
  294. package/dist/services/email-template.js.map +0 -1
  295. package/dist/services/email.service.d.ts +0 -33
  296. package/dist/services/email.service.d.ts.map +0 -1
  297. package/dist/services/email.service.js +0 -96
  298. package/dist/services/email.service.js.map +0 -1
  299. package/dist/services/media.service.d.ts +0 -20
  300. package/dist/services/media.service.d.ts.map +0 -1
  301. package/dist/services/media.service.js +0 -49
  302. package/dist/services/media.service.js.map +0 -1
  303. package/dist/services/population.service.d.ts +0 -20
  304. package/dist/services/population.service.d.ts.map +0 -1
  305. package/dist/services/population.service.js +0 -194
  306. package/dist/services/population.service.js.map +0 -1
  307. package/dist/token-7QG5DBME.mjs +0 -10
  308. package/dist/types/access.d.ts +0 -38
  309. package/dist/types/access.d.ts.map +0 -1
  310. package/dist/types/access.js +0 -2
  311. package/dist/types/access.js.map +0 -1
  312. package/dist/types/adapters.d.ts +0 -146
  313. package/dist/types/adapters.d.ts.map +0 -1
  314. package/dist/types/adapters.js +0 -2
  315. package/dist/types/adapters.js.map +0 -1
  316. package/dist/types/admin-auth.d.ts +0 -132
  317. package/dist/types/admin-auth.d.ts.map +0 -1
  318. package/dist/types/admin-auth.js +0 -2
  319. package/dist/types/admin-auth.js.map +0 -1
  320. package/dist/types/admin.d.ts +0 -65
  321. package/dist/types/admin.d.ts.map +0 -1
  322. package/dist/types/admin.js +0 -2
  323. package/dist/types/admin.js.map +0 -1
  324. package/dist/types/app-config.d.ts +0 -143
  325. package/dist/types/app-config.d.ts.map +0 -1
  326. package/dist/types/app-config.js +0 -2
  327. package/dist/types/app-config.js.map +0 -1
  328. package/dist/types/documents.d.ts +0 -65
  329. package/dist/types/documents.d.ts.map +0 -1
  330. package/dist/types/documents.js +0 -2
  331. package/dist/types/documents.js.map +0 -1
  332. package/dist/types/hooks.d.ts +0 -122
  333. package/dist/types/hooks.d.ts.map +0 -1
  334. package/dist/types/hooks.js +0 -2
  335. package/dist/types/hooks.js.map +0 -1
  336. package/dist/types/index.d.ts +0 -13
  337. package/dist/types/index.d.ts.map +0 -1
  338. package/dist/types/index.js +0 -13
  339. package/dist/types/index.js.map +0 -1
  340. package/dist/types/request.d.ts +0 -42
  341. package/dist/types/request.d.ts.map +0 -1
  342. package/dist/types/request.js +0 -2
  343. package/dist/types/request.js.map +0 -1
  344. package/dist/types/schema-config.d.ts +0 -303
  345. package/dist/types/schema-config.d.ts.map +0 -1
  346. package/dist/types/schema-config.js +0 -2
  347. package/dist/types/schema-config.js.map +0 -1
  348. package/dist/types/schema-core.d.ts +0 -294
  349. package/dist/types/schema-core.d.ts.map +0 -1
  350. package/dist/types/schema-core.js +0 -2
  351. package/dist/types/schema-core.js.map +0 -1
  352. package/dist/types/schema-inference.d.ts +0 -73
  353. package/dist/types/schema-inference.d.ts.map +0 -1
  354. package/dist/types/schema-inference.js +0 -2
  355. package/dist/types/schema-inference.js.map +0 -1
  356. package/dist/types/workflows.d.ts +0 -84
  357. package/dist/types/workflows.d.ts.map +0 -1
  358. package/dist/types/workflows.js +0 -7
  359. package/dist/types/workflows.js.map +0 -1
  360. package/dist/utils/admin-auth.d.ts +0 -5
  361. package/dist/utils/admin-auth.d.ts.map +0 -1
  362. package/dist/utils/admin-auth.js +0 -39
  363. package/dist/utils/admin-auth.js.map +0 -1
  364. package/dist/utils/config.d.ts +0 -8
  365. package/dist/utils/config.d.ts.map +0 -1
  366. package/dist/utils/config.js +0 -238
  367. package/dist/utils/config.js.map +0 -1
  368. package/dist/utils/hooks.d.ts +0 -41
  369. package/dist/utils/hooks.d.ts.map +0 -1
  370. package/dist/utils/hooks.js +0 -173
  371. package/dist/utils/hooks.js.map +0 -1
  372. package/dist/utils/openapi.d.ts +0 -6
  373. package/dist/utils/openapi.d.ts.map +0 -1
  374. package/dist/utils/openapi.js +0 -842
  375. package/dist/utils/openapi.js.map +0 -1
  376. package/dist/utils/parse-sort.d.ts +0 -7
  377. package/dist/utils/parse-sort.d.ts.map +0 -1
  378. package/dist/utils/parse-sort.js +0 -23
  379. package/dist/utils/parse-sort.js.map +0 -1
  380. package/dist/utils/parse-where.d.ts +0 -63
  381. package/dist/utils/parse-where.d.ts.map +0 -1
  382. package/dist/utils/parse-where.js +0 -196
  383. package/dist/utils/parse-where.js.map +0 -1
  384. package/dist/utils/readonly-db.d.ts +0 -9
  385. package/dist/utils/readonly-db.d.ts.map +0 -1
  386. package/dist/utils/readonly-db.js +0 -21
  387. package/dist/utils/readonly-db.js.map +0 -1
  388. package/dist/utils/setup-prompt.d.ts +0 -11
  389. package/dist/utils/setup-prompt.d.ts.map +0 -1
  390. package/dist/utils/setup-prompt.js +0 -863
  391. package/dist/utils/setup-prompt.js.map +0 -1
  392. package/dist/utils/swagger.d.ts +0 -11
  393. package/dist/utils/swagger.d.ts.map +0 -1
  394. package/dist/utils/swagger.js +0 -62
  395. package/dist/utils/swagger.js.map +0 -1
  396. package/dist/utils/upload-validation.d.ts +0 -23
  397. package/dist/utils/upload-validation.d.ts.map +0 -1
  398. package/dist/utils/upload-validation.js +0 -44
  399. package/dist/utils/upload-validation.js.map +0 -1
  400. package/dist/utils/where-sanitizer.d.ts +0 -10
  401. package/dist/utils/where-sanitizer.d.ts.map +0 -1
  402. package/dist/utils/where-sanitizer.js +0 -67
  403. package/dist/utils/where-sanitizer.js.map +0 -1
  404. package/dist/where-sanitizer-7Q4JXMX6.js +0 -57
  405. package/dist/where-sanitizer-DQIWTQZW.js +0 -50
  406. package/dist/workflows.d.ts +0 -54
  407. package/dist/workflows.d.ts.map +0 -1
  408. package/dist/workflows.js +0 -282
  409. package/dist/workflows.js.map +0 -1
@@ -1,1383 +0,0 @@
1
- import { icons } from 'lucide-react';
2
-
3
- /**
4
- * Minimum HTTP request context passed to every server-side hook and resolver.
5
- *
6
- * The full Web Standard `Request` is available as `raw` when you need it, but
7
- * most hooks only need `query` (URL search parameters).
8
- */
9
- interface HookRequestContext {
10
- /** Parsed URL query-string parameters, e.g. `{ page: '2', search: 'hello' }`. */
11
- query: Record<string, string>;
12
- /** Incoming HTTP headers, lowercased. */
13
- headers: Record<string, string>;
14
- /** The raw Web Standard `Request` object. Useful for streaming or advanced header inspection. */
15
- raw?: Request;
16
- }
17
- /**
18
- * Base shape of an authenticated user as decoded from the JWT.
19
- *
20
- * The actual shape will include every field on your auth collection — this
21
- * interface only guarantees the properties that Dyrected always stamps on the
22
- * token. Extend it in your own codebase for stronger typing:
23
- *
24
- * @example
25
- * declare module '@dyrected/core' {
26
- * interface AuthenticatedUser {
27
- * role: 'admin' | 'editor'
28
- * organizationId: string
29
- * }
30
- * }
31
- */
32
- interface AuthenticatedUser {
33
- /** The user's document ID in the database. */
34
- sub: string;
35
- /** The user's email address. */
36
- email?: string;
37
- /** Slug of the collection this user was authenticated against. */
38
- collection: string;
39
- /** Array of role strings, if your auth collection has a `roles` field. */
40
- roles?: string[];
41
- /** Any additional fields from the auth collection document. */
42
- [key: string]: unknown;
43
- }
44
-
45
- /**
46
- * A function that determines whether the current user can perform an operation.
47
- *
48
- * Return `true` to allow, `false` to deny.
49
- * Return a `where`-style object to allow access only to matching documents
50
- * (useful for multi-tenant setups where users can only see their own data).
51
- *
52
- * Can also be expressed as a Jexl expression **string** for simple role checks
53
- * that need to be serialised (e.g. stored in the database or sent to the Admin UI).
54
- *
55
- * @template TDoc The shape of the collection's document.
56
- *
57
- * @example
58
- * // Simple role check
59
- * access: {
60
- * delete: ({ user }) => user?.roles?.includes('admin') ?? false,
61
- * }
62
- *
63
- * @example
64
- * // Row-level: users can only read their own documents
65
- * access: {
66
- * read: ({ user }) => ({ owner: { equals: user?.sub } }),
67
- * }
68
- *
69
- * @example
70
- * // Jexl string — evaluated server-side
71
- * access: {
72
- * update: "user.roles contains 'editor'",
73
- * }
74
- */
75
- type AccessFunction<TDoc extends object = Record<string, unknown>> = (args: {
76
- user: AuthenticatedUser | undefined;
77
- doc?: TDoc;
78
- data?: Partial<TDoc>;
79
- req: HookRequestContext;
80
- }) => boolean | Record<string, unknown> | Promise<boolean | Record<string, unknown>>;
81
-
82
- /**
83
- * The minimum shape of every document returned by the database layer.
84
- *
85
- * All documents have an `id` field assigned by the adapter. Additional fields
86
- * are stored as `unknown` until you narrow them with your own interface.
87
- *
88
- * Use this as the base when declaring your collection document types:
89
- * ```ts
90
- * interface Post extends BaseDocument {
91
- * title: string
92
- * slug: string
93
- * }
94
- * ```
95
- */
96
- interface BaseDocument {
97
- /** The document's unique identifier, assigned by the database adapter. */
98
- id: string;
99
- [key: string]: any;
100
- }
101
- /**
102
- * The envelope returned by collection list endpoints (`GET /api/collections/:slug`).
103
- *
104
- * @template T The document type.
105
- */
106
- interface PaginatedResult<T = Record<string, any>> {
107
- /** The documents on the current page. */
108
- docs: T[];
109
- /** Total number of documents matching the query (across all pages). */
110
- total: number;
111
- /** Maximum number of documents per page as requested. */
112
- limit: number;
113
- /** The current page number (1-indexed). */
114
- page: number;
115
- /** Total number of pages given the current `limit`. */
116
- totalPages: number;
117
- /** Whether a next page exists. */
118
- hasNextPage: boolean;
119
- /** Whether a previous page exists. */
120
- hasPrevPage: boolean;
121
- }
122
- /**
123
- * Metadata returned after a file is uploaded and stored.
124
- * Stored on the document in upload collections.
125
- */
126
- interface FileData {
127
- filename: string;
128
- filesize?: number;
129
- mimeType: string;
130
- /** Public URL of the stored file. */
131
- url: string;
132
- width?: number;
133
- height?: number;
134
- focalPoint?: {
135
- x: number;
136
- y: number;
137
- };
138
- /** Base64-encoded BlurHash string for progressive image loading. */
139
- blurhash?: string;
140
- /** `'upload'` for server-stored files; `'external'` for provider-managed files. */
141
- type?: "upload" | "external";
142
- provider?: string;
143
- provider_metadata?: unknown;
144
- [key: string]: unknown;
145
- }
146
-
147
- /** A valid icon component name from the Lucide icon set bundled with Dyrected Admin. */
148
- type AdminIconName = keyof typeof icons;
149
- /** Ordered custom component keys rendered around the built-in Admin dashboard. */
150
- interface AdminDashboardComponentSlots {
151
- beforeDashboard?: string[];
152
- afterDashboard?: string[];
153
- }
154
- /** Ordered custom component keys rendered around a collection's list content. */
155
- interface CollectionListComponentSlots {
156
- beforeList?: string[];
157
- beforeListTable?: string[];
158
- afterListTable?: string[];
159
- afterList?: string[];
160
- }
161
- /**
162
- * Branding and metadata options for the Dyrected Admin UI.
163
- *
164
- * @example
165
- * admin: {
166
- * branding: {
167
- * logo: '/logo.svg',
168
- * primaryColor: '#6366f1',
169
- * },
170
- * meta: {
171
- * titleSuffix: '- My App',
172
- * },
173
- * }
174
- */
175
- interface AdminConfig {
176
- /** Custom component slots around the built-in dashboard. */
177
- components?: AdminDashboardComponentSlots;
178
- branding?: {
179
- /** Full logo image shown in the expanded sidebar. URL or imported image asset. */
180
- logo?: string;
181
- /** Compact logo mark used in the collapsed sidebar state. */
182
- logoMark?: string;
183
- /** Text alternative or addition to the logo image. */
184
- logoText?: string;
185
- /**
186
- * Primary accent colour as any CSS colour value.
187
- * @example '#6366f1'
188
- * @example 'hsl(240 50% 60%)'
189
- */
190
- primaryColor?: string;
191
- /** Browser tab favicon URL. */
192
- favicon?: string;
193
- /** Font family for body and UI text. Must be loaded separately. */
194
- fontSans?: string;
195
- /** Font family for headings. Must be loaded separately. */
196
- fontSerif?: string;
197
- };
198
- meta?: {
199
- /**
200
- * String appended to every Admin page's `<title>`.
201
- * @default '- Dyrected'
202
- */
203
- titleSuffix?: string;
204
- };
205
- /**
206
- * The canonical/base URL of the frontend website for links and iframe live previews.
207
- */
208
- siteUrl?: string;
209
- }
210
-
211
- type FieldType = "text" | "textarea" | "richText" | "number" | "boolean" | "date" | "datetime" | "time" | "select" | "multiSelect" | "radio" | "relationship" | "array" | "object" | "json" | "blocks" | "image" | "email" | "url" | "icon" | "join" | "row";
212
- interface DynamicOptionsResolverArgs {
213
- /** Database adapter available to server-side option resolvers. */
214
- db?: DatabaseAdapter;
215
- /** Authenticated user making the request, if any. */
216
- user?: AuthenticatedUser;
217
- /** Current HTTP request context, including query parameters. */
218
- req: HookRequestContext;
219
- }
220
- type DynamicOptionsResolver = (args: DynamicOptionsResolverArgs) => Promise<DynamicOptionItem[]> | DynamicOptionItem[];
221
- interface DynamicOptionsConfig {
222
- /** Resolver function executed on the server to produce option items. */
223
- resolve: DynamicOptionsResolver;
224
- /** Cache duration in seconds for identical resolver calls. */
225
- cacheTTL?: number;
226
- }
227
- type DynamicOptionItem = string | {
228
- label: string;
229
- value: unknown;
230
- };
231
- interface Block {
232
- /** Stable identifier stored in each block row as `blockType`. */
233
- slug: string;
234
- /** Human-readable labels shown in the Admin block picker. */
235
- labels?: {
236
- /** Singular label, for example `Hero`. */
237
- singular: string;
238
- /** Plural label, for example `Heroes`. */
239
- plural: string;
240
- };
241
- /** Fields that make up this block's payload. */
242
- fields: Field[];
243
- }
244
- interface FieldBase {
245
- /** Stored key for this field. Omit only for layout-only fields such as `row` or `join`. */
246
- name?: string;
247
- /** Human-readable label shown in the Admin UI. */
248
- label?: string;
249
- /** Whether the field must have a value when saving. */
250
- required?: boolean;
251
- /** Whether values for this field must be unique across the collection. */
252
- unique?: boolean;
253
- /** Default value used when a new document omits this field. */
254
- defaultValue?: unknown;
255
- /** Static or dynamic option source for supported selection fields. */
256
- options?: string[] | {
257
- label: string;
258
- value: unknown;
259
- }[] | DynamicOptionsResolver | DynamicOptionsConfig;
260
- /** Target collection slug for `relationship` fields. */
261
- relationTo?: string;
262
- /** Whether the field stores multiple values instead of one. */
263
- hasMany?: boolean;
264
- /** Child fields for `object` and `array` field types. */
265
- fields?: Field[];
266
- /** Allowed block definitions for a `blocks` field. */
267
- blocks?: Block[];
268
- /** Target collection slug for `join` fields. */
269
- collection?: string;
270
- /** Back-reference field name on the joined collection. */
271
- on?: string;
272
- /** Maximum number of joined documents returned by a `join` field. */
273
- limit?: number;
274
- /** Field-level read and update access rules. */
275
- access?: {
276
- /** Controls whether this field is returned in API responses. */
277
- read?: AccessFunction | string;
278
- /** Controls whether incoming writes may change this field. */
279
- update?: AccessFunction | string;
280
- };
281
- /** Admin-only presentation options for this field. */
282
- admin?: BaseFieldAdmin;
283
- /** Previous storage key to migrate from during schema sync. */
284
- renameTo?: string;
285
- /** Whether SQL adapters should promote this field into a first-class column. */
286
- promoted?: boolean;
287
- }
288
- interface BaseFieldAdmin {
289
- /** Placeholder text shown when the input has no value. */
290
- placeholder?: string;
291
- /** Custom component key registered in the Admin UI. */
292
- component?: string;
293
- /** Help text rendered below the field. */
294
- description?: string;
295
- /** Hides the field from the Admin form without deleting stored data. */
296
- hidden?: boolean;
297
- /** Excludes the field from Admin list filtering. */
298
- filterable?: boolean;
299
- /** Renders the field as non-editable in the Admin UI. */
300
- readOnly?: boolean;
301
- /** Reactive condition controlling whether the field is visible in the Admin UI. */
302
- condition?: ((data: Record<string, unknown>, siblingData: Record<string, unknown>) => boolean) | string;
303
- /** Tab name used when the edit form is rendered as tabs. */
304
- tab?: string;
305
- /** CSS width hint used when the field appears inside a `row`. */
306
- width?: string;
307
- }
308
- interface FieldBeforeChangeHookArgs<TValue = unknown, TDoc extends object = Record<string, unknown>> {
309
- /** Current field value after previous hooks in the chain. */
310
- value: TValue;
311
- /** Existing stored document before the write, if this is an update. */
312
- originalDoc?: TDoc;
313
- /** Full incoming payload being written. */
314
- data: Record<string, unknown>;
315
- /** Authenticated user performing the write, if any. */
316
- user?: AuthenticatedUser;
317
- /** Read-only database adapter for related lookups. */
318
- db: ReadonlyDatabaseAdapter;
319
- }
320
- type FieldBeforeChangeHook<TValue = unknown, TDoc extends object = Record<string, unknown>> = (args: FieldBeforeChangeHookArgs<TValue, TDoc>) => unknown;
321
- interface FieldAfterReadHookArgs<TValue = unknown, TDoc extends object = Record<string, unknown>> {
322
- /** Raw stored field value before this hook transforms it. */
323
- value: TValue;
324
- /** Full document currently being returned to the caller. */
325
- doc: TDoc;
326
- /** Authenticated user requesting the document, if any. */
327
- user?: AuthenticatedUser;
328
- /** Read-only database adapter for related lookups. */
329
- db: ReadonlyDatabaseAdapter;
330
- }
331
- type FieldAfterReadHook<TValue = unknown, TDoc extends object = Record<string, unknown>> = (args: FieldAfterReadHookArgs<TValue, TDoc>) => unknown;
332
- type FieldHooks<TValue> = {
333
- hooks?: {
334
- beforeChange?: Array<FieldBeforeChangeHook<TValue>>;
335
- afterRead?: Array<FieldAfterReadHook<TValue>>;
336
- };
337
- };
338
- interface FieldAdminOnChangeHookArgs<TValue = unknown> {
339
- /** Current field value in the form state. */
340
- value: TValue;
341
- /** Current values for sibling fields at the same nesting level. */
342
- siblingData: Record<string, unknown>;
343
- /** Current values for the entire form. */
344
- data: Record<string, unknown>;
345
- /** Imperative setter for async or derived updates. */
346
- setValue: (value: unknown) => void;
347
- }
348
- type FieldAdminOnChangeHook<TValue = unknown> = (args: FieldAdminOnChangeHookArgs<TValue>) => unknown;
349
- type FieldAdminHooks<TValue> = {
350
- admin?: {
351
- hooks?: {
352
- onChange?: FieldAdminOnChangeHook<TValue>;
353
- };
354
- };
355
- };
356
- interface FieldAdminOptionsHookArgs {
357
- /** Current values for sibling fields at the same nesting level. */
358
- siblingData: Record<string, unknown>;
359
- /** Current values for the entire form. */
360
- data: Record<string, unknown>;
361
- }
362
- type FieldAdminOptionsHookResult = Array<string | {
363
- label: string;
364
- value: unknown;
365
- }>;
366
- type FieldAdminOptionsHook = (args: FieldAdminOptionsHookArgs) => FieldAdminOptionsHookResult | Promise<FieldAdminOptionsHookResult>;
367
- type TypedField<TType extends FieldType, TValue, TAdminExtra = Record<never, never>> = Omit<FieldBase, "admin"> & {
368
- type: TType;
369
- admin?: BaseFieldAdmin & TAdminExtra;
370
- } & FieldHooks<TValue> & FieldAdminHooks<TValue>;
371
- type BooleanFieldAdmin = {
372
- /** Boolean presentation style. */
373
- layout?: "checkbox" | "switch";
374
- };
375
- type SelectFieldAdmin = {
376
- /** Select presentation style. */
377
- layout?: "radio" | "select";
378
- /** Radio orientation when `layout: 'radio'` is used. */
379
- direction?: "horizontal" | "vertical";
380
- hooks?: {
381
- /** Client-side option recalculation for dependent dropdowns or radios. */
382
- options?: FieldAdminOptionsHook;
383
- };
384
- };
385
- type RadioFieldAdmin = {
386
- /** Radio group orientation. */
387
- direction?: "horizontal" | "vertical";
388
- hooks?: {
389
- /** Client-side option recalculation for dependent radio groups. */
390
- options?: FieldAdminOptionsHook;
391
- };
392
- };
393
- type MultiSelectFieldAdmin = {
394
- hooks?: {
395
- /** Client-side option recalculation for dependent multi-select fields. */
396
- options?: FieldAdminOptionsHook;
397
- };
398
- };
399
- interface CharacterLimitFieldConfig {
400
- /** Advisory maximum character count exposed to editors and client tooling. */
401
- maxLength?: number;
402
- }
403
- interface WordLimitFieldConfig {
404
- /** Advisory maximum word count exposed to editors and client tooling. */
405
- maxWords?: number;
406
- }
407
- type CharacterLimitFieldAdmin = {
408
- /** Admin-only compatibility alias for `field.maxLength`. Prefer the top-level field property. */
409
- maxLength?: number;
410
- };
411
- type WordLimitFieldAdmin = {
412
- /** Admin-only compatibility alias for `field.maxWords`. Prefer the top-level field property. */
413
- maxWords?: number;
414
- };
415
- type TextFieldAdmin = CharacterLimitFieldAdmin & WordLimitFieldAdmin;
416
- type TextareaFieldAdmin = CharacterLimitFieldAdmin & WordLimitFieldAdmin;
417
- type EmailFieldAdmin = CharacterLimitFieldAdmin;
418
- type UrlFieldAdmin = CharacterLimitFieldAdmin;
419
- type IconFieldAdmin = CharacterLimitFieldAdmin;
420
- type TextField = TypedField<"text", string, TextFieldAdmin> & CharacterLimitFieldConfig & WordLimitFieldConfig;
421
- type TextareaField = TypedField<"textarea", string, TextareaFieldAdmin> & CharacterLimitFieldConfig & WordLimitFieldConfig;
422
- type EmailField = TypedField<"email", string, EmailFieldAdmin> & CharacterLimitFieldConfig;
423
- type UrlField = TypedField<"url", string, UrlFieldAdmin> & CharacterLimitFieldConfig;
424
- type IconField = TypedField<"icon", string, IconFieldAdmin> & CharacterLimitFieldConfig;
425
- type DateField = TypedField<"date", string>;
426
- type DateTimeField = TypedField<"datetime", string>;
427
- type TimeField = TypedField<"time", string>;
428
- type SelectField = TypedField<"select", string, SelectFieldAdmin>;
429
- type RadioField = TypedField<"radio", string, RadioFieldAdmin>;
430
- type NumberField = TypedField<"number", number>;
431
- type BooleanField = TypedField<"boolean", boolean, BooleanFieldAdmin>;
432
- type MultiSelectField = TypedField<"multiSelect", string[], MultiSelectFieldAdmin>;
433
- type RelationshipField = TypedField<"relationship", string | string[]>;
434
- type ImageField = TypedField<"image", string | string[]>;
435
- type RichTextField = TypedField<"richText", Record<string, unknown>>;
436
- type JsonField = TypedField<"json", Record<string, unknown>>;
437
- type ObjectField = TypedField<"object", unknown>;
438
- type ArrayField = TypedField<"array", unknown>;
439
- type BlocksField = TypedField<"blocks", unknown>;
440
- type JoinField = TypedField<"join", unknown>;
441
- type RowField = TypedField<"row", unknown>;
442
- type Field = TextField | TextareaField | EmailField | UrlField | IconField | DateField | DateTimeField | TimeField | SelectField | RadioField | NumberField | BooleanField | MultiSelectField | RelationshipField | ImageField | RichTextField | JsonField | ObjectField | ArrayField | BlocksField | JoinField | RowField;
443
- interface UploadConfig {
444
- /** Allowed MIME types for uploaded files. */
445
- allowedMimeTypes?: string[];
446
- /** Maximum upload size in bytes. */
447
- maxFileSize?: number;
448
- /** Local filesystem destination used by disk-based storage adapters. */
449
- staticDir?: string;
450
- /** Public URL prefix for disk-based uploads. */
451
- staticURL?: string;
452
- /** Generated image size name used as the Admin media thumbnail. */
453
- adminThumbnail?: string;
454
- imageSizes?: {
455
- /** Stable name used to reference this generated size. */
456
- name: string;
457
- /** Target width in pixels. */
458
- width?: number;
459
- /** Target height in pixels. */
460
- height?: number;
461
- /** Crop strategy forwarded to the image processor. */
462
- crop?: string;
463
- /** Resize fit strategy forwarded to the image processor. */
464
- fit?: string;
465
- /** Prevents upscaling smaller source images. */
466
- withoutEnlargement?: boolean;
467
- /** Format-specific options forwarded to the image processor. */
468
- formatOptions?: Record<string, unknown>;
469
- }[];
470
- }
471
-
472
- /**
473
- * @deprecated Use {@link FieldBeforeChangeHook} or `FieldAfterReadHook` instead.
474
- * This alias remains for backwards compatibility.
475
- */
476
- type FieldHook<TDoc extends object = Record<string, unknown>, TValue = unknown> = FieldBeforeChangeHook<TValue, TDoc>;
477
- /**
478
- * Runs before Dyrected queries the database for a list or single-document fetch.
479
- *
480
- * Return a new `where` query object to override or extend the current filter.
481
- * Return `undefined` (or nothing) to leave the query unchanged.
482
- */
483
- type CollectionBeforeReadHook = (args: {
484
- req: HookRequestContext;
485
- query?: Record<string, unknown>;
486
- user?: AuthenticatedUser;
487
- db: ReadonlyDatabaseAdapter;
488
- }) => Record<string, unknown> | void | Promise<Record<string, unknown> | void>;
489
- /**
490
- * Runs after a document (or list of documents) is fetched from the database,
491
- * before the response is sent to the client.
492
- */
493
- type CollectionAfterReadHook<TDoc extends object = Record<string, unknown>> = (args: {
494
- doc: TDoc;
495
- req: HookRequestContext;
496
- user?: AuthenticatedUser;
497
- db: ReadonlyDatabaseAdapter;
498
- }) => TDoc | Promise<TDoc>;
499
- /**
500
- * Runs **before** a document is created or updated in the database.
501
- */
502
- type CollectionBeforeChangeHook<TDoc extends object = Record<string, unknown>> = (args: {
503
- data: Partial<TDoc>;
504
- doc?: TDoc;
505
- req: HookRequestContext;
506
- user?: AuthenticatedUser;
507
- operation: "create" | "update";
508
- db: ReadonlyDatabaseAdapter;
509
- }) => Partial<TDoc> | void | Promise<Partial<TDoc> | void>;
510
- /**
511
- * Runs **after** a document is created or updated in the database.
512
- */
513
- type CollectionAfterChangeHook<TDoc extends object = Record<string, unknown>> = (args: {
514
- doc: TDoc;
515
- previousDoc?: TDoc;
516
- req: HookRequestContext;
517
- user?: AuthenticatedUser;
518
- operation: "create" | "update";
519
- db: DatabaseAdapter;
520
- }) => void | Promise<void>;
521
- /**
522
- * Runs **before** a document is deleted from the database.
523
- */
524
- type CollectionBeforeDeleteHook<TDoc extends object = Record<string, unknown>> = (args: {
525
- id: string;
526
- doc: TDoc;
527
- req: HookRequestContext;
528
- user?: AuthenticatedUser;
529
- db: ReadonlyDatabaseAdapter;
530
- }) => void | Promise<void>;
531
- /**
532
- * Runs **after** a document has been deleted from the database.
533
- */
534
- type CollectionAfterDeleteHook<TDoc extends object = Record<string, unknown>> = (args: {
535
- id: string;
536
- doc: TDoc;
537
- req: HookRequestContext;
538
- user?: AuthenticatedUser;
539
- db: DatabaseAdapter;
540
- }) => void | Promise<void>;
541
- /** @see {@link CollectionBeforeReadHook} */
542
- type GlobalBeforeReadHook = CollectionBeforeReadHook;
543
- /**
544
- * Runs after the global document is fetched, before the response is sent.
545
- */
546
- type GlobalAfterReadHook<TDoc extends object = Record<string, unknown>> = (args: {
547
- doc: TDoc;
548
- req: HookRequestContext;
549
- user?: AuthenticatedUser;
550
- db: ReadonlyDatabaseAdapter;
551
- }) => TDoc | Promise<TDoc>;
552
- /**
553
- * Runs before the global document is updated.
554
- * Operation is always `'update'` (globals cannot be created or deleted).
555
- */
556
- type GlobalBeforeChangeHook<TDoc extends object = Record<string, unknown>> = (args: {
557
- data: Partial<TDoc>;
558
- doc?: TDoc;
559
- req: HookRequestContext;
560
- user?: AuthenticatedUser;
561
- operation: "update";
562
- db: ReadonlyDatabaseAdapter;
563
- }) => Partial<TDoc> | void | Promise<Partial<TDoc> | void>;
564
- /**
565
- * Runs after the global document is updated. Side-effects only.
566
- */
567
- type GlobalAfterChangeHook<TDoc extends object = Record<string, unknown>> = (args: {
568
- doc: TDoc;
569
- previousDoc?: TDoc;
570
- req: HookRequestContext;
571
- user?: AuthenticatedUser;
572
- operation: "update";
573
- db: DatabaseAdapter;
574
- }) => void | Promise<void>;
575
- /**
576
- * @deprecated Use the specific hook types instead:
577
- * `CollectionBeforeChangeHook`, `CollectionAfterReadHook`, etc.
578
- *
579
- * This broad type remains for backwards compatibility with the internal hook runner.
580
- */
581
- type HookFunction<TDoc extends object = Record<string, unknown>> = (args: {
582
- data?: Partial<TDoc>;
583
- doc?: TDoc;
584
- user?: AuthenticatedUser;
585
- req?: HookRequestContext;
586
- operation?: "create" | "update" | "delete";
587
- db?: DatabaseAdapter;
588
- [key: string]: unknown;
589
- }) => unknown | Promise<unknown>;
590
-
591
- declare const LIFECYCLE_EVENT_NAMES: readonly ["revision.created", "workflow.transitioned", "entry.published", "entry.unpublished"];
592
- type LifecycleEventName = (typeof LIFECYCLE_EVENT_NAMES)[number];
593
- interface WorkflowState {
594
- /** Stable machine-readable state key. */
595
- name: string;
596
- /** Label rendered in the Admin UI. */
597
- label: string;
598
- /** Marks the state whose revision is visible to public readers. */
599
- published?: boolean;
600
- /** Optional visual tone used by the Admin UI. */
601
- color?: "neutral" | "warning" | "success" | "danger" | "info";
602
- }
603
- interface WorkflowTransition {
604
- /** Stable transition key used by the REST and SDK APIs. */
605
- name: string;
606
- label: string;
607
- from: string | string[];
608
- to: string;
609
- /** Every listed capability is required. */
610
- requiredCapabilities?: string[];
611
- /** Require a non-empty comment when performing the transition. */
612
- requireComment?: boolean;
613
- /** Remove the public snapshot after this transition commits. */
614
- unpublish?: boolean;
615
- }
616
- interface WorkflowRole {
617
- /** Existing user role value, for example `editor` or `publisher`. */
618
- role: string;
619
- capabilities: string[];
620
- }
621
- interface WorkflowConfig<TDoc extends object = Record<string, unknown>> {
622
- initialState: string;
623
- /** State used for a new working revision created from published content. */
624
- draftState?: string;
625
- states: WorkflowState[];
626
- transitions: WorkflowTransition[];
627
- /** Maps values in `user.roles` to workflow capabilities. */
628
- roles?: WorkflowRole[];
629
- hooks?: {
630
- beforeTransition?: CollectionBeforeTransitionHook<TDoc>[];
631
- afterTransition?: CollectionAfterTransitionHook<TDoc>[];
632
- };
633
- }
634
- interface WorkflowMetadata {
635
- state: string;
636
- revision: number;
637
- publishedRevision?: number;
638
- publishedAt?: string;
639
- publishedBy?: string;
640
- /** Transitions currently allowed for the requesting user. Response-only. */
641
- availableTransitions?: string[];
642
- }
643
- interface WorkflowTransitionContext<TDoc extends object = Record<string, unknown>> {
644
- transition: WorkflowTransition;
645
- from: string;
646
- to: string;
647
- doc: TDoc;
648
- user?: AuthenticatedUser;
649
- comment?: string;
650
- req: HookRequestContext;
651
- db: DatabaseAdapter;
652
- }
653
- type CollectionBeforeTransitionHook<TDoc extends object = Record<string, unknown>> = (args: WorkflowTransitionContext<TDoc>) => void | Promise<void>;
654
- type CollectionAfterTransitionHook<TDoc extends object = Record<string, unknown>> = (args: WorkflowTransitionContext<TDoc> & {
655
- event: LifecycleEvent;
656
- }) => void | Promise<void>;
657
- interface LifecycleEvent<TPayload = Record<string, unknown>> {
658
- id: string;
659
- name: LifecycleEventName;
660
- collection: string;
661
- documentId: string;
662
- occurredAt: string;
663
- actorId?: string;
664
- payload: TPayload;
665
- attempts: number;
666
- status: "pending" | "processing" | "delivered" | "failed";
667
- nextAttemptAt?: string;
668
- deliveredAt?: string;
669
- lastError?: string;
670
- }
671
- type LifecycleEventHandler = (event: LifecycleEvent) => void | Promise<void>;
672
-
673
- /**
674
- * Defines a Dyrected collection — a named set of documents with a shared schema.
675
- *
676
- * Pass your document's TypeScript type as the generic parameter `TDoc` to get
677
- * fully typed hooks and access functions.
678
- *
679
- * @example
680
- * ```ts
681
- * interface Post {
682
- * id: string
683
- * title: string
684
- * slug: string
685
- * status: 'draft' | 'published'
686
- * publishedAt?: string
687
- * }
688
- *
689
- * export const Posts = defineCollection<Post>({
690
- * slug: 'posts',
691
- * hooks: {
692
- * beforeChange: [({ data, operation }) => {
693
- * // `data` is typed as Partial<Post>
694
- * if (operation === 'create') return { ...data, status: 'draft' }
695
- * return data
696
- * }],
697
- * afterChange: [({ doc, previousDoc }) => {
698
- * // `doc` and `previousDoc` are typed as Post
699
- * if (doc.status !== previousDoc?.status) notifySubscribers(doc)
700
- * }],
701
- * },
702
- * fields: [...],
703
- * })
704
- * ```
705
- *
706
- * @template TDoc The TypeScript shape of a document in this collection.
707
- * Defaults to `Record<string, unknown>` for untyped usage.
708
- */
709
- interface CollectionConfig<TDoc extends object = Record<string, unknown>> {
710
- /**
711
- * Unique identifier for this collection.
712
- * Used as the URL segment (`/api/collections/:slug`) and the database table/collection name.
713
- * Use kebab-case, e.g. `'blog-posts'`.
714
- */
715
- slug: string;
716
- /**
717
- * Restricts this collection to a specific site in a multi-tenant deployment.
718
- * When set, only requests bearing a matching `X-Site-Id` header can access it.
719
- */
720
- siteId?: string;
721
- /**
722
- * If `true`, this collection is shared across all sites in a multi-tenant
723
- * deployment and accessible regardless of the `X-Site-Id` header.
724
- */
725
- shared?: boolean;
726
- /** Human-readable names for documents in this collection, shown in the Admin UI. */
727
- labels?: {
728
- singular: string;
729
- plural: string;
730
- };
731
- /**
732
- * If `true`, this collection is an auth collection. It gains
733
- * `POST /api/collections/:slug/login` and `POST /api/collections/:slug/logout`
734
- * endpoints, and documents are expected to have a `password` field.
735
- */
736
- auth?: boolean;
737
- /**
738
- * If `true` or a config object, this collection supports file uploads.
739
- * Documents gain file-related fields (`url`, `filename`, `mimeType`, etc.)
740
- * and the create endpoint accepts `multipart/form-data`.
741
- */
742
- upload?: boolean | UploadConfig;
743
- /** Field definitions that make up the document schema for this collection. */
744
- fields: Field[];
745
- /**
746
- * If `true`, Dyrected automatically adds `createdAt` and `updatedAt`
747
- * timestamp fields to every document. Defaults to `true`.
748
- */
749
- timestamps?: boolean;
750
- /**
751
- * Initial documents to seed into this collection the first time it is
752
- * fetched and found to be empty, for example demo data or defaults.
753
- */
754
- initialData?: Partial<TDoc>[];
755
- /**
756
- * If `true`, every create, update, and delete operation on this collection
757
- * is logged to the `__audit` collection with before/after snapshots and the
758
- * acting user's identity.
759
- */
760
- audit?: boolean;
761
- /**
762
- * Optional state-machine workflow for this collection. Workflow-enabled
763
- * entries keep an editable working revision and an independent public
764
- * snapshot, so editing published content never changes the live response.
765
- */
766
- workflow?: WorkflowConfig<TDoc>;
767
- /**
768
- * Collection-level access control.
769
- *
770
- * Each key is an operation; the value is a function or Jexl string that
771
- * returns `true` to allow or `false` to deny. Returning a `where`-style
772
- * object grants access only to matching documents.
773
- *
774
- * @example
775
- * access: {
776
- * read: () => true,
777
- * create: ({ user }) => !!user,
778
- * update: ({ user }) => user?.roles?.includes('editor') ?? false,
779
- * delete: ({ user }) => user?.roles?.includes('admin') ?? false,
780
- * }
781
- */
782
- access?: {
783
- read?: AccessFunction<TDoc> | string;
784
- create?: AccessFunction<TDoc> | string;
785
- update?: AccessFunction<TDoc> | string;
786
- delete?: AccessFunction<TDoc> | string;
787
- };
788
- /**
789
- * Collection-level lifecycle hooks.
790
- *
791
- * Hooks run in the order they appear in the array. The return value of each
792
- * hook is passed as the input to the next. Throwing inside any hook aborts
793
- * the operation and returns a `500` error.
794
- *
795
- * See the Hooks reference for the full lifecycle diagram.
796
- */
797
- hooks?: {
798
- /**
799
- * Runs before the database is queried. Return a modified `where` object
800
- * to override the query filter.
801
- */
802
- beforeRead?: CollectionBeforeReadHook[];
803
- /**
804
- * Runs after documents are fetched. Return a modified doc to change what
805
- * the client receives. Runs on every document in a list response.
806
- */
807
- afterRead?: CollectionAfterReadHook<TDoc>[];
808
- /**
809
- * Runs before create or update. Return modified data to change what is
810
- * written to the database. Throw to abort the write entirely.
811
- */
812
- beforeChange?: CollectionBeforeChangeHook<TDoc>[];
813
- /**
814
- * Runs after create or update is committed. For side-effects only:
815
- * webhooks, cache busting, and notifications. Return value is ignored.
816
- *
817
- * Errors are isolated: caught, logged, and discarded so a failing
818
- * side-effect never turns a successful write into an HTTP 500.
819
- * See `CollectionAfterChangeHook` for await-vs-fire-and-forget guidance.
820
- */
821
- afterChange?: CollectionAfterChangeHook<TDoc>[];
822
- /** Runs before a document is deleted. Throw to cancel the deletion. */
823
- beforeDelete?: CollectionBeforeDeleteHook<TDoc>[];
824
- /**
825
- * Runs after a document has been deleted. For cleanup side-effects only.
826
- *
827
- * Errors are isolated: caught, logged, and discarded. The deletion is
828
- * already committed and will not be undone.
829
- */
830
- afterDelete?: CollectionAfterDeleteHook<TDoc>[];
831
- };
832
- /** Admin UI configuration for this collection. */
833
- admin?: {
834
- /**
835
- * Lucide icon displayed beside this collection in the Admin sidebar.
836
- * Uses Lucide component names, e.g. `'Newspaper'` or `'ShoppingBag'`.
837
- */
838
- icon?: AdminIconName;
839
- /** Custom component slots for this collection's list view. */
840
- components?: CollectionListComponentSlots;
841
- /**
842
- * The field name used as the document's display title in the Admin list
843
- * view and breadcrumbs. Defaults to `'title'` if the field exists.
844
- */
845
- useAsTitle?: string;
846
- /**
847
- * Field names to show as columns in the Admin list view.
848
- * Defaults to a sensible set of the first few non-structural fields.
849
- */
850
- defaultColumns?: string[];
851
- /**
852
- * Groups this collection under a named section in the Admin sidebar.
853
- * Collections with the same `group` are visually grouped together.
854
- */
855
- group?: string;
856
- /** If `true`, this collection is not shown in the Admin UI sidebar. */
857
- hidden?: boolean;
858
- /** If `false`, disables the filter UI entirely for this collection. Defaults to `true`. */
859
- filterable?: boolean;
860
- /**
861
- * URL to open in the Live Preview pane when editing a document.
862
- * Pass a function to derive the URL from the document's fields.
863
- *
864
- * @example
865
- * previewUrl: (doc) => `https://mysite.com/blog/${doc.slug}`
866
- */
867
- previewUrl?: string | ((doc: TDoc, opts: {
868
- locale?: string;
869
- }) => string | null);
870
- /**
871
- * How the Live Preview pane communicates with the frontend.
872
- * - `postMessage` sends a `postMessage` with the current doc data.
873
- * - `token` passes a short-lived preview token as a query parameter.
874
- */
875
- previewMode?: "postMessage" | "token";
876
- /**
877
- * Frontend URL pattern for this collection, used by `url` fields to
878
- * resolve internal links. Use `{fieldName}` placeholders.
879
- *
880
- * @example
881
- * urlPattern: '/blog/{slug}' // /blog/my-post
882
- * urlPattern: '/{slug}' // /about
883
- */
884
- urlPattern?: string;
885
- };
886
- }
887
- /**
888
- * Defines a Dyrected global — a singleton document without pagination or IDs.
889
- *
890
- * Globals are ideal for site-wide settings, feature flags, or any data where
891
- * there is always exactly one record, such as `site-settings`, `navigation`,
892
- * or `theme`.
893
- *
894
- * Pass your document's TypeScript type as the generic parameter `TDoc` to get
895
- * fully typed hooks.
896
- *
897
- * @example
898
- * ```ts
899
- * interface SiteSettings {
900
- * siteName: string
901
- * tagline: string
902
- * maintenanceMode: boolean
903
- * }
904
- *
905
- * export const Settings = defineGlobal<SiteSettings>({
906
- * slug: 'site-settings',
907
- * hooks: {
908
- * afterChange: [({ doc }) => {
909
- * // `doc` is typed as SiteSettings
910
- * if (doc.maintenanceMode) alertOnCall()
911
- * }],
912
- * },
913
- * fields: [...],
914
- * })
915
- * ```
916
- *
917
- * @template TDoc The TypeScript shape of this global's document.
918
- */
919
- interface GlobalConfig<TDoc extends object = Record<string, unknown>> {
920
- /**
921
- * Unique identifier for this global.
922
- * Used as the URL segment (`/api/globals/:slug`) and the storage key.
923
- */
924
- slug: string;
925
- /** Restricts this global to a specific site in a multi-tenant deployment. */
926
- siteId?: string;
927
- /**
928
- * If `true`, this global is shared across all sites in a multi-tenant
929
- * deployment.
930
- */
931
- shared?: boolean;
932
- /** Human-readable label shown in the Admin UI sidebar. */
933
- label?: string;
934
- /** Field definitions for this global's document schema. */
935
- fields: Field[];
936
- /** Access control for reading and updating this global. */
937
- access?: {
938
- read?: AccessFunction<TDoc>;
939
- update?: AccessFunction<TDoc>;
940
- };
941
- /**
942
- * Global-level lifecycle hooks.
943
- * Globals support `beforeRead`, `afterRead`, `beforeChange`, and `afterChange`.
944
- * There are no delete hooks since globals cannot be deleted.
945
- */
946
- hooks?: {
947
- beforeRead?: GlobalBeforeReadHook[];
948
- afterRead?: GlobalAfterReadHook<TDoc>[];
949
- beforeChange?: GlobalBeforeChangeHook<TDoc>[];
950
- afterChange?: GlobalAfterChangeHook<TDoc>[];
951
- };
952
- /** Admin UI configuration for this global. */
953
- admin?: {
954
- /**
955
- * Lucide icon displayed beside this global in the Admin sidebar.
956
- * Uses Lucide component names, e.g. `'Settings2'` or `'Palette'`.
957
- */
958
- icon?: AdminIconName;
959
- /** Groups this global under a named section in the Admin sidebar. */
960
- group?: string;
961
- /** If `true`, this global is not shown in the Admin UI sidebar. */
962
- hidden?: boolean;
963
- };
964
- /**
965
- * Initial data to seed this global with the first time it is fetched and
966
- * found to be empty.
967
- */
968
- initialData?: Partial<TDoc>;
969
- }
970
-
971
- /**
972
- * The interface every database adapter must implement.
973
- *
974
- * Dyrected ships adapters for PostgreSQL, MySQL, SQLite, and MongoDB.
975
- * Implement this interface to connect any other database.
976
- */
977
- interface DatabaseAdapter {
978
- /** Find a paginated list of documents in a collection. */
979
- find(args: {
980
- collection: string;
981
- where?: Record<string, unknown>;
982
- limit?: number;
983
- page?: number;
984
- sort?: string;
985
- }): Promise<PaginatedResult>;
986
- /** Find a single document by its ID. Returns `null` if not found. */
987
- findOne(args: {
988
- collection: string;
989
- id: string;
990
- }): Promise<BaseDocument | null>;
991
- /** Insert a new document and return it with its generated `id`. */
992
- create(args: {
993
- collection: string;
994
- data: Record<string, unknown>;
995
- }): Promise<BaseDocument>;
996
- /** Update a document by ID and return the updated document. */
997
- update(args: {
998
- collection: string;
999
- id: string;
1000
- data: Record<string, unknown>;
1001
- }): Promise<BaseDocument>;
1002
- /** Delete a document by ID. Return value is intentionally untyped — callers do not use it. */
1003
- delete(args: {
1004
- collection: string;
1005
- id: string;
1006
- }): Promise<unknown>;
1007
- /** Fetch the singleton document for a global. Returns an empty object if not yet initialised. */
1008
- getGlobal(args: {
1009
- slug: string;
1010
- }): Promise<Record<string, unknown>>;
1011
- /** Create or replace the singleton document for a global. */
1012
- updateGlobal(args: {
1013
- slug: string;
1014
- data: Record<string, unknown>;
1015
- }): Promise<Record<string, unknown>>;
1016
- /**
1017
- * Sync the database schema with the current collection and global configs.
1018
- * Called on startup to create tables/collections that don't exist yet.
1019
- * Not all adapters implement this (e.g. MongoDB is schema-less).
1020
- */
1021
- sync?(collections: CollectionConfig[], globals: GlobalConfig[]): Promise<void>;
1022
- /**
1023
- * Execute a raw SQL query or database command.
1024
- * Optional — not all adapters support raw access.
1025
- */
1026
- execute?(query: string, params?: unknown[]): Promise<unknown>;
1027
- /**
1028
- * Run all adapter operations in `callback` as one atomic transaction.
1029
- * Shipped adapters implement this; workflow transitions require it.
1030
- */
1031
- transaction?<T>(callback: (db: DatabaseAdapter) => Promise<T>): Promise<T>;
1032
- }
1033
- /**
1034
- * Read-only view of the database adapter. Exposes only `find`, `findOne`,
1035
- * and `getGlobal` — no write operations.
1036
- *
1037
- * Passed to `beforeChange`, `beforeDelete`, `beforeRead`, `afterRead`,
1038
- * and field-level hooks. Write operations are available in `afterChange`
1039
- * and `afterDelete` hooks where the full {@link DatabaseAdapter} is provided.
1040
- */
1041
- type ReadonlyDatabaseAdapter = Pick<DatabaseAdapter, "find" | "findOne" | "getGlobal">;
1042
- /**
1043
- * The interface every storage adapter must implement.
1044
- *
1045
- * Dyrected ships adapters for local disk, S3, Cloudflare R2, Cloudinary, and
1046
- * Backblaze B2. Implement this interface to use any other storage provider.
1047
- */
1048
- interface StorageAdapter {
1049
- /**
1050
- * Upload a file and return its metadata (URL, dimensions, etc.).
1051
- * The `prefix` is a path prefix used for multi-tenant setups.
1052
- */
1053
- upload(args: {
1054
- filename: string;
1055
- buffer: Uint8Array;
1056
- mimeType: string;
1057
- prefix?: string;
1058
- }): Promise<FileData>;
1059
- /** Delete a file by its stored filename. */
1060
- delete(args: {
1061
- filename: string;
1062
- }): Promise<void>;
1063
- /** Return the public URL for a stored file. */
1064
- getURL(args: {
1065
- filename: string;
1066
- }): string;
1067
- /**
1068
- * Retrieve the file's raw bytes and MIME type for serving via the API.
1069
- * Only needed by adapters that serve files through the Dyrected API
1070
- * (e.g. `LocalStorage`). Cloud adapters return `null` here and rely on
1071
- * direct CDN URLs instead.
1072
- */
1073
- resolve?(args: {
1074
- filename: string;
1075
- }): Promise<{
1076
- buffer: Uint8Array;
1077
- mimeType: string;
1078
- } | null>;
1079
- }
1080
- /**
1081
- * Processes uploaded images — generates metadata (dimensions, BlurHash) and
1082
- * produces resized variants defined in `UploadConfig.imageSizes`.
1083
- *
1084
- * @example
1085
- * import { SharpImageService } from '@dyrected/image-sharp'
1086
- * defineConfig({ image: new SharpImageService(), ... })
1087
- */
1088
- interface ImageService {
1089
- process(args: {
1090
- buffer: Uint8Array;
1091
- mimeType: string;
1092
- config?: boolean | UploadConfig;
1093
- focalPoint?: {
1094
- x: number;
1095
- y: number;
1096
- };
1097
- }): Promise<{
1098
- metadata: {
1099
- width?: number;
1100
- height?: number;
1101
- /** Base64-encoded BlurHash for progressive loading. */
1102
- blurhash?: string;
1103
- };
1104
- /** Generated image sizes keyed by their `name`. */
1105
- sizes?: Record<string, {
1106
- buffer: Uint8Array;
1107
- width: number;
1108
- height: number;
1109
- filename: string;
1110
- }>;
1111
- }>;
1112
- }
1113
-
1114
- interface AdminAuthMember {
1115
- id: string;
1116
- email: string;
1117
- name?: string;
1118
- roles: string[];
1119
- siteAccess?: string[];
1120
- status?: "active" | "pending";
1121
- [key: string]: any;
1122
- }
1123
- type AdminAuthProvisioningMode = "jit_only" | "jit_plus_membership_management" | "preprovisioned_only";
1124
- interface AdminAuthClaimMapping {
1125
- sub?: string;
1126
- email?: string;
1127
- name?: string;
1128
- roles?: string;
1129
- groups?: string;
1130
- siteIds?: string;
1131
- workspaceIds?: string;
1132
- }
1133
- interface AdminAuthResolvedIdentity {
1134
- sub: string;
1135
- email?: string;
1136
- name?: string;
1137
- roles?: string[];
1138
- groups?: string[];
1139
- siteIds?: string[];
1140
- workspaceIds?: string[];
1141
- rawClaims?: Record<string, unknown>;
1142
- }
1143
- interface AdminAuthAccessResolution {
1144
- allowed: boolean;
1145
- roles?: string[];
1146
- data?: Record<string, unknown>;
1147
- }
1148
- interface AdminAuthResolveAccessArgs {
1149
- identity: AdminAuthResolvedIdentity;
1150
- providerId: string;
1151
- siteId?: string;
1152
- workspaceId?: string;
1153
- req: {
1154
- method: string;
1155
- path: string;
1156
- url: string;
1157
- headers: Record<string, string | undefined>;
1158
- };
1159
- user: Record<string, unknown> | null;
1160
- }
1161
- interface AdminAuthProviderMembersConfig {
1162
- list?: (args: {
1163
- limit?: number;
1164
- page?: number;
1165
- sort?: string;
1166
- where?: Record<string, any>;
1167
- req: HookRequestContext;
1168
- }) => Promise<{
1169
- docs: AdminAuthMember[];
1170
- totalDocs: number;
1171
- limit: number;
1172
- page: number;
1173
- totalPages: number;
1174
- hasNextPage: boolean;
1175
- hasPrevPage: boolean;
1176
- }>;
1177
- get?: (args: {
1178
- externalSubject: string;
1179
- req: HookRequestContext;
1180
- }) => Promise<AdminAuthMember | null>;
1181
- create?: (args: {
1182
- data: Record<string, any>;
1183
- req: HookRequestContext;
1184
- }) => Promise<AdminAuthMember>;
1185
- update?: (args: {
1186
- externalSubject: string;
1187
- data: Record<string, any>;
1188
- req: HookRequestContext;
1189
- }) => Promise<AdminAuthMember>;
1190
- delete?: (args: {
1191
- externalSubject: string;
1192
- req: HookRequestContext;
1193
- }) => Promise<void>;
1194
- }
1195
- interface BaseAdminAuthProvider {
1196
- id: string;
1197
- type: "oidc" | "custom" | "cloud";
1198
- displayName?: string;
1199
- autoRedirect?: boolean;
1200
- allowJitProvisioning?: boolean;
1201
- claimMapping?: AdminAuthClaimMapping;
1202
- members?: AdminAuthProviderMembersConfig;
1203
- }
1204
- interface OIDCAdminAuthProvider extends BaseAdminAuthProvider {
1205
- type: "oidc";
1206
- issuer: string;
1207
- clientId: string;
1208
- clientSecret: string;
1209
- redirectUri?: string;
1210
- scopes?: string[];
1211
- authorizationEndpoint?: string;
1212
- tokenEndpoint?: string;
1213
- userInfoEndpoint?: string;
1214
- }
1215
- interface CustomAdminAuthProvider extends BaseAdminAuthProvider {
1216
- type: "custom" | "cloud";
1217
- startUrl?: string;
1218
- issuer?: string;
1219
- audience?: string;
1220
- secret?: string;
1221
- jwksUri?: string;
1222
- tokenParam?: string;
1223
- }
1224
- type AdminAuthProvider = OIDCAdminAuthProvider | CustomAdminAuthProvider;
1225
- interface PublicAdminAuthProvider {
1226
- id: string;
1227
- type: AdminAuthProvider["type"];
1228
- displayName: string;
1229
- autoRedirect?: boolean;
1230
- }
1231
- interface PublicAdminAuthConfig {
1232
- mode: "local" | "external";
1233
- collectionSlug?: string;
1234
- provisioningMode?: AdminAuthProvisioningMode;
1235
- providers: PublicAdminAuthProvider[];
1236
- }
1237
- interface AdminAuthConfig {
1238
- mode: "local" | "external";
1239
- collectionSlug?: string;
1240
- provisioningMode?: AdminAuthProvisioningMode;
1241
- providers: AdminAuthProvider[];
1242
- resolveAccess?: (args: AdminAuthResolveAccessArgs) => Promise<AdminAuthAccessResolution> | AdminAuthAccessResolution;
1243
- }
1244
-
1245
- /**
1246
- * The root configuration object passed to `createDyrectedApp`.
1247
- *
1248
- * This is the single source of truth for your entire Dyrected instance —
1249
- * collections, globals, database adapter, storage, email, and more.
1250
- *
1251
- * @example
1252
- * import { defineConfig } from '@dyrected/core'
1253
- * import { SQLiteAdapter } from '@dyrected/db-sqlite'
1254
- *
1255
- * export default defineConfig({
1256
- * db: new SQLiteAdapter({ filename: './db.sqlite' }),
1257
- * collections: [Posts, Users],
1258
- * globals: [SiteSettings],
1259
- * })
1260
- */
1261
- interface DyrectedConfig {
1262
- /** Collection definitions. Each collection maps to a database table/collection. */
1263
- collections: CollectionConfig<any>[];
1264
- /** Global (singleton) definitions. Each global maps to a single document. */
1265
- globals: GlobalConfig<any>[];
1266
- /**
1267
- * The database adapter. Required for all data operations.
1268
- * @see DatabaseAdapter
1269
- */
1270
- db?: DatabaseAdapter;
1271
- /**
1272
- * The storage adapter for file uploads.
1273
- * Required when any collection has `upload: true`.
1274
- * @see StorageAdapter
1275
- */
1276
- storage?: StorageAdapter;
1277
- /**
1278
- * The image processing service. Required when any upload collection
1279
- * defines `imageSizes`.
1280
- * @see ImageService
1281
- */
1282
- image?: ImageService;
1283
- /** Admin UI branding and metadata. */
1284
- admin?: AdminConfig;
1285
- /**
1286
- * Deployment-level authentication strategy for the CMS dashboard (`/admin`).
1287
- * This is separate from collection-level `auth: true`, which continues to
1288
- * power application/customer auth independently.
1289
- */
1290
- adminAuth?: AdminAuthConfig;
1291
- /**
1292
- * Email transport configuration. Required for welcome emails, password
1293
- * resets, and invite links.
1294
- *
1295
- * @example
1296
- * email: {
1297
- * from: 'no-reply@myapp.com',
1298
- * send: async ({ to, subject, html }) => {
1299
- * await resend.emails.send({ from, to, subject, html })
1300
- * },
1301
- * }
1302
- */
1303
- email?: {
1304
- /** The `From` address for all outbound emails. */
1305
- from: string;
1306
- /** The send function. Wire in any email provider (Resend, SendGrid, SES, etc.). */
1307
- send: (args: {
1308
- to: string;
1309
- subject: string;
1310
- html: string;
1311
- }) => Promise<void>;
1312
- /** Override the default email templates. */
1313
- templates?: {
1314
- welcome?: (args: {
1315
- email: string;
1316
- }) => {
1317
- subject?: string;
1318
- html: string;
1319
- };
1320
- invite?: (args: {
1321
- token: string;
1322
- invitedByEmail?: string;
1323
- }) => {
1324
- subject?: string;
1325
- html: string;
1326
- };
1327
- resetPassword?: (args: {
1328
- token: string;
1329
- url?: string;
1330
- }) => {
1331
- subject?: string;
1332
- html: string;
1333
- };
1334
- passwordChanged?: (args: {
1335
- email: string;
1336
- }) => {
1337
- subject?: string;
1338
- html: string;
1339
- };
1340
- };
1341
- };
1342
- /**
1343
- * Redis connection URL. Required for distributed caching of dynamic option
1344
- * resolvers and other server-side caches in multi-instance deployments.
1345
- *
1346
- * @example
1347
- * redis: { url: process.env.REDIS_URL }
1348
- */
1349
- redis?: {
1350
- url: string;
1351
- };
1352
- /** Durable lifecycle-event delivery configuration. */
1353
- events?: {
1354
- handlers: LifecycleEventHandler[];
1355
- /** Maximum delivery attempts before an event remains failed. Defaults to 8. */
1356
- maxAttempts?: number;
1357
- /** Initial exponential-backoff delay in milliseconds. Defaults to 1000. */
1358
- retryDelayMs?: number;
1359
- };
1360
- /**
1361
- * Cross-Origin Resource Sharing (CORS) configuration.
1362
- * List all origins that are allowed to call the Dyrected API.
1363
- *
1364
- * @example
1365
- * cors: { origins: ['https://myapp.com', 'https://www.myapp.com'] }
1366
- */
1367
- cors?: {
1368
- origins: string[];
1369
- };
1370
- /**
1371
- * Callback to dynamically fetch additional collections and globals for a
1372
- * given site ID at request time. Used in multi-tenant deployments where each
1373
- * site has its own schema stored in the database.
1374
- */
1375
- onSchemaFetch?: (siteId: string) => Promise<{
1376
- collections?: CollectionConfig<any>[];
1377
- globals?: GlobalConfig<any>[];
1378
- admin?: AdminConfig;
1379
- adminAuth?: AdminAuthConfig;
1380
- }>;
1381
- }
1382
-
1383
- export { type FieldAdminOptionsHookResult as $, type AdminAuthConfig as A, type Block as B, type CollectionConfig as C, type DyrectedConfig as D, type CollectionBeforeDeleteHook as E, type Field as F, type GlobalConfig as G, type HookRequestContext as H, type CollectionBeforeReadHook as I, type CollectionBeforeTransitionHook as J, type CollectionListComponentSlots as K, type LifecycleEventName as L, type CustomAdminAuthProvider as M, type DatabaseAdapter as N, type DateField as O, type PublicAdminAuthConfig as P, type DateTimeField as Q, type DynamicOptionItem as R, type DynamicOptionsConfig as S, type DynamicOptionsResolver as T, type DynamicOptionsResolverArgs as U, type EmailField as V, type WorkflowConfig as W, type FieldAdminOnChangeHook as X, type FieldAdminOnChangeHookArgs as Y, type FieldAdminOptionsHook as Z, type FieldAdminOptionsHookArgs as _, type AuthenticatedUser as a, type FieldAfterReadHook as a0, type FieldAfterReadHookArgs as a1, type FieldBeforeChangeHook as a2, type FieldBeforeChangeHookArgs as a3, type FieldHook as a4, type FieldType as a5, type FileData as a6, type GlobalAfterChangeHook as a7, type GlobalAfterReadHook as a8, type GlobalBeforeChangeHook as a9, type UrlField as aA, type WordLimitFieldConfig as aB, type WorkflowMetadata as aC, type WorkflowRole as aD, type WorkflowState as aE, type WorkflowTransitionContext as aF, type GlobalBeforeReadHook as aa, type HookFunction as ab, type IconField as ac, type ImageField as ad, type ImageService as ae, type JoinField as af, type JsonField as ag, LIFECYCLE_EVENT_NAMES as ah, type LifecycleEventHandler as ai, type MultiSelectField as aj, type NumberField as ak, type OIDCAdminAuthProvider as al, type ObjectField as am, type PaginatedResult as an, type PublicAdminAuthProvider as ao, type RadioField as ap, type ReadonlyDatabaseAdapter as aq, type RelationshipField as ar, type RichTextField as as, type RowField as at, type SelectField as au, type StorageAdapter as av, type TextField as aw, type TextareaField as ax, type TimeField as ay, type UploadConfig as az, type WorkflowTransition as b, type LifecycleEvent as c, type BaseDocument as d, type AccessFunction as e, type AdminAuthAccessResolution as f, type AdminAuthClaimMapping as g, type AdminAuthMember as h, type AdminAuthProvider as i, type AdminAuthProviderMembersConfig as j, type AdminAuthProvisioningMode as k, type AdminAuthResolveAccessArgs as l, type AdminAuthResolvedIdentity as m, type AdminConfig as n, type AdminDashboardComponentSlots as o, type AdminIconName as p, type ArrayField as q, type BaseAdminAuthProvider as r, type BlocksField as s, type BooleanField as t, type CharacterLimitFieldConfig as u, type CollectionAfterChangeHook as v, type CollectionAfterDeleteHook as w, type CollectionAfterReadHook as x, type CollectionAfterTransitionHook as y, type CollectionBeforeChangeHook as z };