@opensaas/stack-core 0.44.0-alpha.5 → 0.44.0-alpha.7

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 (402) hide show
  1. package/CHANGELOG.md +1051 -0
  2. package/dist/.build-hash +1 -1
  3. package/dist/access/actor.d.ts +56 -0
  4. package/dist/access/actor.d.ts.map +1 -0
  5. package/dist/access/actor.js +66 -0
  6. package/dist/access/actor.js.map +1 -0
  7. package/dist/access/decide-advertisement.d.ts +55 -0
  8. package/dist/access/decide-advertisement.d.ts.map +1 -0
  9. package/dist/access/decide-advertisement.js +125 -0
  10. package/dist/access/decide-advertisement.js.map +1 -0
  11. package/dist/access/declared-dependencies.d.ts +4 -89
  12. package/dist/access/declared-dependencies.d.ts.map +1 -1
  13. package/dist/access/declared-dependencies.js +14 -84
  14. package/dist/access/declared-dependencies.js.map +1 -1
  15. package/dist/access/depth-limits.d.ts +2 -0
  16. package/dist/access/depth-limits.d.ts.map +1 -1
  17. package/dist/access/depth-limits.js +2 -0
  18. package/dist/access/depth-limits.js.map +1 -1
  19. package/dist/access/engine.d.ts +1 -24
  20. package/dist/access/engine.d.ts.map +1 -1
  21. package/dist/access/engine.js +0 -35
  22. package/dist/access/engine.js.map +1 -1
  23. package/dist/access/field-access.d.ts +43 -19
  24. package/dist/access/field-access.d.ts.map +1 -1
  25. package/dist/access/field-access.js +206 -185
  26. package/dist/access/field-access.js.map +1 -1
  27. package/dist/access/index.d.ts +5 -6
  28. package/dist/access/index.d.ts.map +1 -1
  29. package/dist/access/index.js +6 -7
  30. package/dist/access/index.js.map +1 -1
  31. package/dist/access/rule-item.d.ts +42 -0
  32. package/dist/access/rule-item.d.ts.map +1 -0
  33. package/dist/access/rule-item.js +215 -0
  34. package/dist/access/rule-item.js.map +1 -0
  35. package/dist/access/session-vocabulary.d.ts +124 -0
  36. package/dist/access/session-vocabulary.d.ts.map +1 -0
  37. package/dist/access/session-vocabulary.js +366 -0
  38. package/dist/access/session-vocabulary.js.map +1 -0
  39. package/dist/access/transaction-registry.d.ts +6 -0
  40. package/dist/access/transaction-registry.d.ts.map +1 -1
  41. package/dist/access/transaction-registry.js +19 -2
  42. package/dist/access/transaction-registry.js.map +1 -1
  43. package/dist/access/types.d.ts +66 -0
  44. package/dist/access/types.d.ts.map +1 -1
  45. package/dist/access/vocabulary-filter-specs.d.ts +17 -0
  46. package/dist/access/vocabulary-filter-specs.d.ts.map +1 -0
  47. package/dist/access/vocabulary-filter-specs.js +27 -0
  48. package/dist/access/vocabulary-filter-specs.js.map +1 -0
  49. package/dist/client-safe.d.ts +8 -0
  50. package/dist/client-safe.d.ts.map +1 -0
  51. package/dist/client-safe.js +8 -0
  52. package/dist/client-safe.js.map +1 -0
  53. package/dist/config/field-kind.d.ts +7 -21
  54. package/dist/config/field-kind.d.ts.map +1 -1
  55. package/dist/config/field-kind.js +8 -5
  56. package/dist/config/field-kind.js.map +1 -1
  57. package/dist/config/has-access-gate.d.ts +20 -0
  58. package/dist/config/has-access-gate.d.ts.map +1 -0
  59. package/dist/config/has-access-gate.js +26 -0
  60. package/dist/config/has-access-gate.js.map +1 -0
  61. package/dist/config/index.d.ts +1 -1
  62. package/dist/config/index.d.ts.map +1 -1
  63. package/dist/config/index.js +8 -2
  64. package/dist/config/index.js.map +1 -1
  65. package/dist/config/list-view-keys.d.ts +5 -0
  66. package/dist/config/list-view-keys.d.ts.map +1 -0
  67. package/dist/config/list-view-keys.js +18 -0
  68. package/dist/config/list-view-keys.js.map +1 -0
  69. package/dist/config/mcp-default-tools.d.ts +3 -0
  70. package/dist/config/mcp-default-tools.d.ts.map +1 -0
  71. package/dist/config/mcp-default-tools.js +14 -0
  72. package/dist/config/mcp-default-tools.js.map +1 -0
  73. package/dist/config/mcp-tool-names.d.ts +2 -0
  74. package/dist/config/mcp-tool-names.d.ts.map +1 -1
  75. package/dist/config/mcp-tool-names.js +17 -5
  76. package/dist/config/mcp-tool-names.js.map +1 -1
  77. package/dist/config/nav-count.d.ts +8 -16
  78. package/dist/config/nav-count.d.ts.map +1 -1
  79. package/dist/config/nav-count.js +20 -32
  80. package/dist/config/nav-count.js.map +1 -1
  81. package/dist/config/plugin-engine.d.ts.map +1 -1
  82. package/dist/config/plugin-engine.js +6 -0
  83. package/dist/config/plugin-engine.js.map +1 -1
  84. package/dist/config/preset-views.d.ts +22 -0
  85. package/dist/config/preset-views.d.ts.map +1 -0
  86. package/dist/config/preset-views.js +46 -0
  87. package/dist/config/preset-views.js.map +1 -0
  88. package/dist/config/row-action-availability.d.ts +4 -0
  89. package/dist/config/row-action-availability.d.ts.map +1 -0
  90. package/dist/config/row-action-availability.js +20 -0
  91. package/dist/config/row-action-availability.js.map +1 -0
  92. package/dist/config/types.d.ts +409 -34
  93. package/dist/config/types.d.ts.map +1 -1
  94. package/dist/context/engine-context.d.ts +2 -0
  95. package/dist/context/engine-context.d.ts.map +1 -1
  96. package/dist/context/engine-context.js +8 -0
  97. package/dist/context/engine-context.js.map +1 -1
  98. package/dist/context/hook-pipeline.d.ts +6 -1
  99. package/dist/context/hook-pipeline.d.ts.map +1 -1
  100. package/dist/context/hook-pipeline.js +6 -4
  101. package/dist/context/hook-pipeline.js.map +1 -1
  102. package/dist/context/index.d.ts +10 -1
  103. package/dist/context/index.d.ts.map +1 -1
  104. package/dist/context/index.js +217 -94
  105. package/dist/context/index.js.map +1 -1
  106. package/dist/context/junction.d.ts +28 -21
  107. package/dist/context/junction.d.ts.map +1 -1
  108. package/dist/context/junction.js +74 -69
  109. package/dist/context/junction.js.map +1 -1
  110. package/dist/context/plugin-field-write.d.ts.map +1 -1
  111. package/dist/context/plugin-field-write.js +19 -25
  112. package/dist/context/plugin-field-write.js.map +1 -1
  113. package/dist/context/process-lifetime.d.ts +8 -0
  114. package/dist/context/process-lifetime.d.ts.map +1 -0
  115. package/dist/context/process-lifetime.js +14 -0
  116. package/dist/context/process-lifetime.js.map +1 -0
  117. package/dist/context/relationship-input.d.ts +2 -15
  118. package/dist/context/relationship-input.d.ts.map +1 -1
  119. package/dist/context/relationship-input.js +44 -85
  120. package/dist/context/relationship-input.js.map +1 -1
  121. package/dist/context/transaction-boundary.d.ts +3 -2
  122. package/dist/context/transaction-boundary.d.ts.map +1 -1
  123. package/dist/context/transaction-boundary.js +17 -2
  124. package/dist/context/transaction-boundary.js.map +1 -1
  125. package/dist/context/write-pipeline.d.ts +5 -19
  126. package/dist/context/write-pipeline.d.ts.map +1 -1
  127. package/dist/context/write-pipeline.js +54 -92
  128. package/dist/context/write-pipeline.js.map +1 -1
  129. package/dist/context/write-target.d.ts +52 -0
  130. package/dist/context/write-target.d.ts.map +1 -0
  131. package/dist/context/write-target.js +118 -0
  132. package/dist/context/write-target.js.map +1 -0
  133. package/dist/contract/dependencies.d.ts +24 -10
  134. package/dist/contract/dependencies.d.ts.map +1 -1
  135. package/dist/contract/dependencies.js +120 -80
  136. package/dist/contract/dependencies.js.map +1 -1
  137. package/dist/contract/derive.d.ts +6 -11
  138. package/dist/contract/derive.d.ts.map +1 -1
  139. package/dist/contract/derive.js +256 -211
  140. package/dist/contract/derive.js.map +1 -1
  141. package/dist/contract/fixtures/contract-configs.d.ts +5 -0
  142. package/dist/contract/fixtures/contract-configs.d.ts.map +1 -1
  143. package/dist/contract/fixtures/contract-configs.js +21 -0
  144. package/dist/contract/fixtures/contract-configs.js.map +1 -1
  145. package/dist/contract/id-boundary.js +1 -1
  146. package/dist/contract/id-boundary.js.map +1 -1
  147. package/dist/contract/prisma.js +2 -2
  148. package/dist/contract/prisma.js.map +1 -1
  149. package/dist/contract/strategy.d.ts +13 -0
  150. package/dist/contract/strategy.d.ts.map +1 -0
  151. package/dist/contract/strategy.js +38 -0
  152. package/dist/contract/strategy.js.map +1 -0
  153. package/dist/db/client-alias.d.ts +12 -0
  154. package/dist/db/client-alias.d.ts.map +1 -0
  155. package/dist/db/client-alias.js +8 -0
  156. package/dist/db/client-alias.js.map +1 -0
  157. package/dist/extend.d.ts +2 -2
  158. package/dist/extend.d.ts.map +1 -1
  159. package/dist/extend.js.map +1 -1
  160. package/dist/fields/index.d.ts +12 -14
  161. package/dist/fields/index.d.ts.map +1 -1
  162. package/dist/fields/index.js +217 -67
  163. package/dist/fields/index.js.map +1 -1
  164. package/dist/filter/collect.d.ts +43 -25
  165. package/dist/filter/collect.d.ts.map +1 -1
  166. package/dist/filter/collect.js +107 -38
  167. package/dist/filter/collect.js.map +1 -1
  168. package/dist/filter/index.d.ts +7 -5
  169. package/dist/filter/index.d.ts.map +1 -1
  170. package/dist/filter/index.js +6 -14
  171. package/dist/filter/index.js.map +1 -1
  172. package/dist/filter/map.d.ts +112 -20
  173. package/dist/filter/map.d.ts.map +1 -1
  174. package/dist/filter/map.js +271 -52
  175. package/dist/filter/map.js.map +1 -1
  176. package/dist/filter/parse.d.ts +70 -26
  177. package/dist/filter/parse.d.ts.map +1 -1
  178. package/dist/filter/parse.js +212 -79
  179. package/dist/filter/parse.js.map +1 -1
  180. package/dist/filter/record-id.d.ts +19 -0
  181. package/dist/filter/record-id.d.ts.map +1 -0
  182. package/dist/filter/record-id.js +37 -0
  183. package/dist/filter/record-id.js.map +1 -0
  184. package/dist/filter/serialize.d.ts +45 -19
  185. package/dist/filter/serialize.d.ts.map +1 -1
  186. package/dist/filter/serialize.js +146 -50
  187. package/dist/filter/serialize.js.map +1 -1
  188. package/dist/filter/types.d.ts +132 -21
  189. package/dist/filter/types.d.ts.map +1 -1
  190. package/dist/filter/types.js +2 -11
  191. package/dist/filter/types.js.map +1 -1
  192. package/dist/hooks/index.d.ts +6 -3
  193. package/dist/hooks/index.d.ts.map +1 -1
  194. package/dist/hooks/index.js +38 -8
  195. package/dist/hooks/index.js.map +1 -1
  196. package/dist/index.d.ts +10 -9
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +5 -5
  199. package/dist/index.js.map +1 -1
  200. package/dist/internal.d.ts +11 -2
  201. package/dist/internal.d.ts.map +1 -1
  202. package/dist/internal.js +8 -8
  203. package/dist/internal.js.map +1 -1
  204. package/dist/lib/database-errors.d.ts +2 -1
  205. package/dist/lib/database-errors.d.ts.map +1 -1
  206. package/dist/lib/database-errors.js +5 -4
  207. package/dist/lib/database-errors.js.map +1 -1
  208. package/dist/mcp/advertise.d.ts +5 -13
  209. package/dist/mcp/advertise.d.ts.map +1 -1
  210. package/dist/mcp/advertise.js +7 -22
  211. package/dist/mcp/advertise.js.map +1 -1
  212. package/dist/mcp/arguments.d.ts.map +1 -1
  213. package/dist/mcp/arguments.js +8 -11
  214. package/dist/mcp/arguments.js.map +1 -1
  215. package/dist/mcp/field-schema.d.ts +4 -15
  216. package/dist/mcp/field-schema.d.ts.map +1 -1
  217. package/dist/mcp/field-schema.js +50 -69
  218. package/dist/mcp/field-schema.js.map +1 -1
  219. package/dist/mcp/handler.d.ts +111 -18
  220. package/dist/mcp/handler.d.ts.map +1 -1
  221. package/dist/mcp/handler.js +231 -87
  222. package/dist/mcp/handler.js.map +1 -1
  223. package/dist/mcp/index.d.ts +2 -1
  224. package/dist/mcp/index.d.ts.map +1 -1
  225. package/dist/mcp/index.js +1 -1
  226. package/dist/mcp/index.js.map +1 -1
  227. package/dist/mcp/procedure-tools.d.ts +63 -0
  228. package/dist/mcp/procedure-tools.d.ts.map +1 -0
  229. package/dist/mcp/procedure-tools.js +139 -0
  230. package/dist/mcp/procedure-tools.js.map +1 -0
  231. package/dist/mcp/projection.d.ts +6 -5
  232. package/dist/mcp/projection.d.ts.map +1 -1
  233. package/dist/mcp/projection.js +33 -38
  234. package/dist/mcp/projection.js.map +1 -1
  235. package/dist/mcp/reachability.d.ts +13 -0
  236. package/dist/mcp/reachability.d.ts.map +1 -0
  237. package/dist/mcp/reachability.js +51 -0
  238. package/dist/mcp/reachability.js.map +1 -0
  239. package/dist/mcp/relation-member.d.ts +15 -0
  240. package/dist/mcp/relation-member.d.ts.map +1 -0
  241. package/dist/mcp/relation-member.js +50 -0
  242. package/dist/mcp/relation-member.js.map +1 -0
  243. package/dist/mcp/types.d.ts +12 -0
  244. package/dist/mcp/types.d.ts.map +1 -1
  245. package/dist/mcp/where-id-boundary.d.ts.map +1 -1
  246. package/dist/mcp/where-id-boundary.js +12 -24
  247. package/dist/mcp/where-id-boundary.js.map +1 -1
  248. package/dist/mcp/where-reachability.d.ts +10 -0
  249. package/dist/mcp/where-reachability.d.ts.map +1 -0
  250. package/dist/mcp/where-reachability.js +88 -0
  251. package/dist/mcp/where-reachability.js.map +1 -0
  252. package/dist/members/claims.d.ts +71 -0
  253. package/dist/members/claims.d.ts.map +1 -0
  254. package/dist/members/claims.js +199 -0
  255. package/dist/members/claims.js.map +1 -0
  256. package/dist/members/list-members.d.ts +87 -0
  257. package/dist/members/list-members.d.ts.map +1 -0
  258. package/dist/members/list-members.js +250 -0
  259. package/dist/members/list-members.js.map +1 -0
  260. package/dist/procedures/client.d.ts +163 -0
  261. package/dist/procedures/client.d.ts.map +1 -0
  262. package/dist/procedures/client.js +152 -0
  263. package/dist/procedures/client.js.map +1 -0
  264. package/dist/procedures/codes.d.ts +23 -0
  265. package/dist/procedures/codes.d.ts.map +1 -0
  266. package/dist/procedures/codes.js +46 -0
  267. package/dist/procedures/codes.js.map +1 -0
  268. package/dist/procedures/context-face.d.ts +4 -0
  269. package/dist/procedures/context-face.d.ts.map +1 -0
  270. package/dist/procedures/context-face.js +31 -0
  271. package/dist/procedures/context-face.js.map +1 -0
  272. package/dist/procedures/failures.d.ts +31 -0
  273. package/dist/procedures/failures.d.ts.map +1 -0
  274. package/dist/procedures/failures.js +51 -0
  275. package/dist/procedures/failures.js.map +1 -0
  276. package/dist/procedures/http.d.ts +114 -0
  277. package/dist/procedures/http.d.ts.map +1 -0
  278. package/dist/procedures/http.js +224 -0
  279. package/dist/procedures/http.js.map +1 -0
  280. package/dist/procedures/index.d.ts +7 -0
  281. package/dist/procedures/index.d.ts.map +1 -0
  282. package/dist/procedures/index.js +11 -0
  283. package/dist/procedures/index.js.map +1 -0
  284. package/dist/procedures/procedure.d.ts +204 -0
  285. package/dist/procedures/procedure.d.ts.map +1 -0
  286. package/dist/procedures/procedure.js +123 -0
  287. package/dist/procedures/procedure.js.map +1 -0
  288. package/dist/procedures/result.d.ts +42 -0
  289. package/dist/procedures/result.d.ts.map +1 -0
  290. package/dist/procedures/result.js +51 -0
  291. package/dist/procedures/result.js.map +1 -0
  292. package/dist/procedures/run.d.ts +36 -0
  293. package/dist/procedures/run.d.ts.map +1 -0
  294. package/dist/procedures/run.js +76 -0
  295. package/dist/procedures/run.js.map +1 -0
  296. package/dist/procedures/server.d.ts +131 -0
  297. package/dist/procedures/server.d.ts.map +1 -0
  298. package/dist/procedures/server.js +115 -0
  299. package/dist/procedures/server.js.map +1 -0
  300. package/dist/procedures/validate.d.ts +60 -0
  301. package/dist/procedures/validate.d.ts.map +1 -0
  302. package/dist/procedures/validate.js +254 -0
  303. package/dist/procedures/validate.js.map +1 -0
  304. package/dist/procedures/web-session.d.ts +12 -0
  305. package/dist/procedures/web-session.d.ts.map +1 -0
  306. package/dist/procedures/web-session.js +35 -0
  307. package/dist/procedures/web-session.js.map +1 -0
  308. package/dist/query/relationship-options.d.ts +8 -0
  309. package/dist/query/relationship-options.d.ts.map +1 -1
  310. package/dist/query/relationship-options.js +18 -4
  311. package/dist/query/relationship-options.js.map +1 -1
  312. package/dist/secured/binding.d.ts +84 -0
  313. package/dist/secured/binding.d.ts.map +1 -0
  314. package/dist/secured/binding.js +52 -0
  315. package/dist/secured/binding.js.map +1 -0
  316. package/dist/secured/declared-branch.d.ts +11 -0
  317. package/dist/secured/declared-branch.d.ts.map +1 -0
  318. package/dist/secured/declared-branch.js +17 -0
  319. package/dist/secured/declared-branch.js.map +1 -0
  320. package/dist/secured/field-visibility.d.ts +56 -0
  321. package/dist/secured/field-visibility.d.ts.map +1 -0
  322. package/dist/secured/field-visibility.js +624 -0
  323. package/dist/secured/field-visibility.js.map +1 -0
  324. package/dist/secured/include.d.ts +77 -37
  325. package/dist/secured/include.d.ts.map +1 -1
  326. package/dist/secured/include.js +228 -122
  327. package/dist/secured/include.js.map +1 -1
  328. package/dist/secured/lock.d.ts +8 -2
  329. package/dist/secured/lock.d.ts.map +1 -1
  330. package/dist/secured/lock.js +44 -15
  331. package/dist/secured/lock.js.map +1 -1
  332. package/dist/secured/lower.d.ts.map +1 -1
  333. package/dist/secured/lower.js +15 -4
  334. package/dist/secured/lower.js.map +1 -1
  335. package/dist/secured/read.d.ts +13 -52
  336. package/dist/secured/read.d.ts.map +1 -1
  337. package/dist/secured/read.js +88 -614
  338. package/dist/secured/read.js.map +1 -1
  339. package/dist/secured/select.d.ts +0 -24
  340. package/dist/secured/select.d.ts.map +1 -1
  341. package/dist/secured/select.js +60 -153
  342. package/dist/secured/select.js.map +1 -1
  343. package/dist/secured/vocabulary.d.ts +13 -1
  344. package/dist/secured/vocabulary.d.ts.map +1 -1
  345. package/dist/secured/vocabulary.js +173 -83
  346. package/dist/secured/vocabulary.js.map +1 -1
  347. package/dist/testing/untyped-rule.d.ts +8 -0
  348. package/dist/testing/untyped-rule.d.ts.map +1 -0
  349. package/dist/testing/untyped-rule.js +4 -0
  350. package/dist/testing/untyped-rule.js.map +1 -0
  351. package/dist/types/index.d.ts +1 -1
  352. package/dist/types/index.d.ts.map +1 -1
  353. package/dist/types/rows.d.ts +18 -1
  354. package/dist/types/rows.d.ts.map +1 -1
  355. package/dist/validation/config-refusal.d.ts +3 -1
  356. package/dist/validation/config-refusal.d.ts.map +1 -1
  357. package/dist/validation/database-config.d.ts +1 -15
  358. package/dist/validation/database-config.d.ts.map +1 -1
  359. package/dist/validation/database-config.js +32 -1
  360. package/dist/validation/database-config.js.map +1 -1
  361. package/dist/validation/default-value.d.ts.map +1 -1
  362. package/dist/validation/default-value.js +3 -8
  363. package/dist/validation/default-value.js.map +1 -1
  364. package/dist/validation/extension-packs.d.ts.map +1 -1
  365. package/dist/validation/extension-packs.js +1 -0
  366. package/dist/validation/extension-packs.js.map +1 -1
  367. package/dist/validation/field-config.d.ts +3 -2
  368. package/dist/validation/field-config.d.ts.map +1 -1
  369. package/dist/validation/field-config.js +3 -1
  370. package/dist/validation/field-config.js.map +1 -1
  371. package/dist/validation/field-names.d.ts +2 -1
  372. package/dist/validation/field-names.d.ts.map +1 -1
  373. package/dist/validation/field-names.js +76 -63
  374. package/dist/validation/field-names.js.map +1 -1
  375. package/dist/validation/identifier-names.d.ts +1 -0
  376. package/dist/validation/identifier-names.d.ts.map +1 -1
  377. package/dist/validation/identifier-names.js +17 -9
  378. package/dist/validation/identifier-names.js.map +1 -1
  379. package/dist/validation/needs-closure.d.ts +30 -14
  380. package/dist/validation/needs-closure.d.ts.map +1 -1
  381. package/dist/validation/needs-closure.js +184 -31
  382. package/dist/validation/needs-closure.js.map +1 -1
  383. package/dist/validation/relations.d.ts.map +1 -1
  384. package/dist/validation/relations.js +11 -0
  385. package/dist/validation/relations.js.map +1 -1
  386. package/dist/validation/schema.d.ts +4 -3
  387. package/dist/validation/schema.d.ts.map +1 -1
  388. package/dist/validation/schema.js +8 -6
  389. package/dist/validation/schema.js.map +1 -1
  390. package/package.json +26 -10
  391. package/dist/access/field-visibility.d.ts +0 -58
  392. package/dist/access/field-visibility.d.ts.map +0 -1
  393. package/dist/access/field-visibility.js +0 -383
  394. package/dist/access/field-visibility.js.map +0 -1
  395. package/dist/access/query-validation.d.ts +0 -30
  396. package/dist/access/query-validation.d.ts.map +0 -1
  397. package/dist/access/query-validation.js +0 -49
  398. package/dist/access/query-validation.js.map +0 -1
  399. package/dist/access/system-fields.d.ts +0 -2
  400. package/dist/access/system-fields.d.ts.map +0 -1
  401. package/dist/access/system-fields.js +0 -7
  402. package/dist/access/system-fields.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import type { AccessControlledDB, AccessControl, FieldAccess } from '../access/types.js';
2
2
  import type { GeneratedTables } from '../contract/dependencies.js';
3
+ import type { ListIdValue } from '../contract/id-boundary.js';
3
4
  import type { FilterSpec } from '../filter/types.js';
4
5
  import type { z } from 'zod';
5
6
  import type { PostgresOptionsBase, PostgresOptions } from '@prisma/orm-postgres/runtime';
@@ -394,6 +395,15 @@ export type BaseFieldConfig<TTypeInfo extends TypeInfo, TKey extends FieldKeys<T
394
395
  type: string;
395
396
  access?: FieldAccess<TTypeInfo['item'], TTypeInfo['inputs']['create'], TTypeInfo['inputs']['update']>;
396
397
  defaultValue?: unknown;
398
+ /**
399
+ * Whether this field's column accepts `NULL` — the same answer its
400
+ * {@link getContractField} descriptor gives, readable without a list key or
401
+ * config. The admin reads it to decide whether an emptied control can store
402
+ * `null`, so a field builder that leaves it out keeps the control's non-null
403
+ * behaviour. Set by the field builder, not by an application: core's
404
+ * builders take no such option.
405
+ */
406
+ nullable?: boolean;
397
407
  hooks?: FieldHooks<TTypeInfo, TKey>;
398
408
  /**
399
409
  * Marks this field as virtual — not stored in database, computed via
@@ -543,7 +553,7 @@ export type BaseFieldConfig<TTypeInfo extends TypeInfo, TKey extends FieldKeys<T
543
553
  * @param fieldName - The name of the field (for error messages)
544
554
  * @param operation - Whether this is a create or update operation
545
555
  */
546
- getZodSchema?: (fieldName: string, operation: 'create' | 'update') => z.ZodTypeAny;
556
+ getZodSchema?: (fieldName: string, operation: 'create' | 'update', defaults?: ValidationDefaults) => z.ZodTypeAny;
547
557
  /**
548
558
  * Declare this field's filtering capability — its {@link FilterSpec} — for the
549
559
  * admin UI's Filter builder (ADR-0017). Optional and additive: a field that
@@ -579,6 +589,12 @@ export type BaseFieldConfig<TTypeInfo extends TypeInfo, TKey extends FieldKeys<T
579
589
  * read pipeline before field visibility. Receives the full row so it can read
580
590
  * its sibling columns by name.
581
591
  *
592
+ * **Required on every field whose {@link getContractField} descriptor is
593
+ * `kind: 'columns'`.** Without it the field has no value under its own key:
594
+ * `opensaas generate` refuses the config, and so does building a context
595
+ * over it, naming the list, the field and `assembleColumns`. A single-column
596
+ * field leaves it out.
597
+ *
582
598
  * @param fieldName - The field's config key
583
599
  * @param row - The raw database row (contains the per-part columns)
584
600
  */
@@ -676,11 +692,13 @@ export type BaseFieldConfig<TTypeInfo extends TypeInfo, TKey extends FieldKeys<T
676
692
  * or removing one changes this field's implementation, never the shape of
677
693
  * every read of the list.
678
694
  *
679
- * Names stored columns and immediate relations on the same list only — no
680
- * dotted paths, and never a computed field. A declaration on a field with
681
- * no `resolveOutput` hook is dead config and fails `pnpm generate`.
695
+ * The array form names stored columns and immediate relations on the same
696
+ * list, and reaches one hop. The object form reaches any depth (ADR-0085):
697
+ * see {@link NeedsObject}. Neither names a computed field. A declaration on
698
+ * a field with no `resolveOutput` hook is dead config and fails
699
+ * `pnpm generate`.
682
700
  *
683
- * Typed as a plain `string[]`, not narrowed to this list's own relation
701
+ * Not narrowed to this list's own relation
684
702
  * keys, unlike {@link BaseFieldConfig}'s own `TKey` (issue #1306): a
685
703
  * `needs` entry names a DIFFERENT field on the SAME list, so narrowing it
686
704
  * would require threading that field's key too, for no reader-facing
@@ -700,8 +718,27 @@ export type BaseFieldConfig<TTypeInfo extends TypeInfo, TKey extends FieldKeys<T
700
718
  * }),
701
719
  * ```
702
720
  */
703
- needs?: string[];
721
+ needs?: readonly string[] | NeedsObject;
704
722
  };
723
+ /**
724
+ * The object form of {@link BaseFieldConfig.needs} (ADR-0085). Each key is a
725
+ * stored column, a relationship field or a synthetic back-relation
726
+ * (`from_<List>_<field>`) of the list at that level.
727
+ *
728
+ * - A column takes `true`.
729
+ * - A relation takes `true` for its rows' stored columns, or an array or a
730
+ * nested object for exactly what is named beneath it. Every level also
731
+ * carries its list's system fields and the foreign key of each relation it
732
+ * names.
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * needs: { enrolment: { student: true, classTerm: ['class', 'term'] } }
737
+ * ```
738
+ */
739
+ export interface NeedsObject {
740
+ readonly [key: string]: true | readonly string[] | NeedsObject;
741
+ }
705
742
  /**
706
743
  * A JSON-serialisable literal. What a column default can hold, and the
707
744
  * argument vocabulary of a {@link ColumnTypeDescriptor} — the Contract module
@@ -1039,7 +1076,8 @@ export type RelationshipItemViewConfig = {
1039
1076
  /**
1040
1077
  * How this to-many relationship is presented on the owning record's item
1041
1078
  * view:
1042
- * - `'table'` (default): a read-only Relationship table of related rows.
1079
+ * - `'table'` (default): a Relationship table of related rows, which pages,
1080
+ * edits cells in place, adds, links and removes rows.
1043
1081
  * - `'picker'`: demote it back to the compact relationship picker inside the
1044
1082
  * details card (the pre-#734 behaviour).
1045
1083
  *
@@ -1066,11 +1104,10 @@ export type RelationshipItemViewConfig = {
1066
1104
  */
1067
1105
  columns?: string[];
1068
1106
  /**
1069
- * The maximum number of related rows to fetch and render in this
1070
- * Relationship table (issue #752). The item view fetches related rows
1071
- * through the secured context bounded by this `take`, so a record with many
1072
- * related rows never loads/renders every one on edit-page open. The totals
1073
- * footer still shows the full access-scoped total ("showing N of M").
1107
+ * The number of related rows a page of this Relationship table shows
1108
+ * (issue #752). The item view fetches one page at a time through the secured
1109
+ * context, and the footer shows the range and the full access-scoped total
1110
+ * ("Showing 11–20 of 42 rows") with links to the pages either side.
1074
1111
  *
1075
1112
  * When omitted, a sensible default cap applies (the UI's
1076
1113
  * `DEFAULT_ITEM_VIEW_TAKE`). Must be a positive integer; non-positive or
@@ -1298,6 +1335,10 @@ export type VirtualField<TTypeInfo extends TypeInfo, TKey extends FieldKeys<TTyp
1298
1335
  * Specific field types (TextField, IntegerField, etc.) are used by field builders
1299
1336
  * but at the config level we treat all fields uniformly
1300
1337
  */
1338
+ /** Config-wide column defaults a field's validator reads when the field sets none of its own. */
1339
+ export interface ValidationDefaults {
1340
+ timestampNativeType?: string;
1341
+ }
1301
1342
  export type FieldConfig = BaseFieldConfig<TypeInfo>;
1302
1343
  type WithTypeInfo<TTypeInfo extends TypeInfo, TKey extends FieldKeys<TTypeInfo['fields']> = FieldKeys<TTypeInfo['fields']>> = BaseFieldConfig<TTypeInfo, TKey>;
1303
1344
  /**
@@ -2128,7 +2169,7 @@ export type ListConfig<TTypeInfo extends TypeInfo> = {
2128
2169
  * Mirrors Keystone's list-level `ui` block. Currently only `listView`
2129
2170
  * defaults (columns + sort) are supported.
2130
2171
  */
2131
- ui?: ListUIConfig;
2172
+ ui?: ListUIConfig<TTypeInfo>;
2132
2173
  };
2133
2174
  /**
2134
2175
  * List-level UI configuration for the admin interface.
@@ -2139,12 +2180,12 @@ export type ListConfig<TTypeInfo extends TypeInfo> = {
2139
2180
  * deferred as they cover navigation text rather than list-view or
2140
2181
  * row-labelling defaults.
2141
2182
  */
2142
- export type ListUIConfig = {
2183
+ export type ListUIConfig<TTypeInfo extends TypeInfo = TypeInfo> = {
2143
2184
  /**
2144
2185
  * Default list-view (table) configuration for this list, mirroring
2145
2186
  * Keystone's `ui.listView`.
2146
2187
  */
2147
- listView?: ListViewUIConfig;
2188
+ listView?: ListViewUIConfig<TTypeInfo>;
2148
2189
  /**
2149
2190
  * Item-view (record edit page) configuration for this list — controls the
2150
2191
  * placement/order of the shape-derived Relationship-table sections (issue
@@ -2166,12 +2207,23 @@ export type ListUIConfig = {
2166
2207
  * ```
2167
2208
  */
2168
2209
  labelField?: string;
2210
+ /**
2211
+ * The list's plural, for the admin's confirmations ("Delete 3 people?"). When
2212
+ * omitted the list name is pluralised by English rules (Category →
2213
+ * categories), which suits regular names only.
2214
+ *
2215
+ * @example
2216
+ * ```typescript
2217
+ * ui: { plural: 'People' }
2218
+ * ```
2219
+ */
2220
+ plural?: string;
2169
2221
  /**
2170
2222
  * Opt this list into an access-scoped record count next to its Admin chrome
2171
2223
  * nav item (issue #735). Default `false` — no count query runs for lists that
2172
2224
  * don't opt in. The count is fetched through the secured context, so it only
2173
- * ever reflects what the current session may see; a list whose query access
2174
- * is statically denied renders no count rather than a misleading zero.
2225
+ * ever reflects what the current session may see; a list whose `query` the
2226
+ * session's vocabulary denies renders no count rather than a misleading zero.
2175
2227
  *
2176
2228
  * @example
2177
2229
  * ```typescript
@@ -2323,7 +2375,8 @@ export interface BulkAction {
2323
2375
  /**
2324
2376
  * Optional visibility gate, evaluated server-side against the session before
2325
2377
  * the button is offered (user story 14 — "only see actions I may perform").
2326
- * Returning `false` hides the button.
2378
+ * Only `true` shows the button and runs the action; anything else (or a
2379
+ * throw) hides it and refuses it on dispatch.
2327
2380
  *
2328
2381
  * This ONLY controls visibility; the `handler` always runs through the
2329
2382
  * secured context, so per-row access is enforced regardless. It is also
@@ -2336,11 +2389,191 @@ export interface BulkAction {
2336
2389
  }) => boolean | Promise<boolean>;
2337
2390
  /**
2338
2391
  * The server-side handler. Receives the selected ids and the secured
2339
- * `context`; do all work through `context.db`. Returns an optional
2340
- * `{ message }` shown in the selection bar when the action completes.
2392
+ * `context`, bound to one transaction around the whole handler, so a throw
2393
+ * rolls back every write it made. Do all work through `context.db`, and keep
2394
+ * slow external calls out of it: they hold the transaction open. Returns an
2395
+ * optional `{ message }` shown in the status line when the action completes.
2341
2396
  */
2342
2397
  handler: (args: BulkActionContext) => BulkActionResult | void | Promise<BulkActionResult | void>;
2343
2398
  }
2399
+ /**
2400
+ * The icons a Row action may name. Serialisable — the name crosses to the
2401
+ * client row menu as a plain string and the admin UI maps it to its own icon.
2402
+ */
2403
+ export type RowActionIcon = 'archive' | 'check' | 'copy' | 'download' | 'eye' | 'eye-off' | 'flag' | 'lock' | 'mail' | 'refresh' | 'send' | 'star' | 'trash' | 'undo' | 'unlock' | 'upload';
2404
+ /**
2405
+ * A list's primary key at its own type: the generated item's `id` when the
2406
+ * list is typed through its `TypeInfo`, else {@link ListIdValue}.
2407
+ */
2408
+ export type RowActionId<TTypeInfo extends TypeInfo = TypeInfo> = IsAny<TTypeInfo['item']> extends true ? ListIdValue : TTypeInfo['item'] extends {
2409
+ id: infer TId;
2410
+ } ? TId : ListIdValue;
2411
+ /**
2412
+ * Arguments passed to a Row action's server-side `handler`. The handler runs
2413
+ * entirely on the server and must do its work through the secured `context`.
2414
+ */
2415
+ export interface RowActionContext<TTypeInfo extends TypeInfo = TypeInfo> {
2416
+ /** The list the action was invoked on (PascalCase list key). */
2417
+ listKey: string;
2418
+ /**
2419
+ * The id of the row the action targets, parsed through the list's id type:
2420
+ * a `number` on an `int autoincrement` list, a `string` on a `uuid7` or
2421
+ * `cuid2` one. Pass it straight to `context.db.<List>.update({ where: { id } })`.
2422
+ */
2423
+ id: RowActionId<TTypeInfo>;
2424
+ /**
2425
+ * The row as this session reads it, re-read through the secured context at
2426
+ * dispatch after the row lock is taken: its own columns, foreign keys and
2427
+ * computed fields, with no relations.
2428
+ */
2429
+ item: Record<string, unknown>;
2430
+ /**
2431
+ * The access-scoped context, bound to the dispatch's transaction. All
2432
+ * database work MUST go through `context.db` so the list's access control
2433
+ * and hooks are enforced, and so it commits or rolls back with the check.
2434
+ */
2435
+ context: import('../access/types.js').AccessContext;
2436
+ }
2437
+ /**
2438
+ * The outcome a Row action `handler` returns. The optional `message` is shown
2439
+ * in the list view's status line; returning nothing yields a generic
2440
+ * completion message.
2441
+ */
2442
+ export interface RowActionResult {
2443
+ /** Human-readable outcome shown to the admin (e.g. "Published"). */
2444
+ message?: string;
2445
+ }
2446
+ /**
2447
+ * A list-specific Row action declared in `ui.listView.rowActions`, offered in
2448
+ * each row's menu after the built-in Edit and Copy link, and before Delete.
2449
+ *
2450
+ * Only `key`, `label`, `icon` and `destructive` cross to the client. `hasAccess`,
2451
+ * `isAvailable` and `handler` stay on the server: the client sends `key` and
2452
+ * the row id back through the generic server action, which re-checks
2453
+ * `hasAccess`, then opens a transaction, takes a row lock on the row, re-reads
2454
+ * it through the secured context, re-runs `isAvailable` and only then runs the
2455
+ * handler.
2456
+ */
2457
+ export interface RowAction<TTypeInfo extends TypeInfo = TypeInfo> {
2458
+ /**
2459
+ * Stable identifier the client echoes back to dispatch this action. Must be
2460
+ * unique within the list.
2461
+ */
2462
+ key: string;
2463
+ /** Menu item label. */
2464
+ label: string;
2465
+ /** Optional icon shown beside the label. */
2466
+ icon?: RowActionIcon;
2467
+ /**
2468
+ * When true, the menu item is styled as destructive and the admin is asked
2469
+ * to confirm before the action runs.
2470
+ */
2471
+ destructive?: boolean;
2472
+ /**
2473
+ * Optional visibility gate, resolved once per request against the session.
2474
+ * Only `true` shows the action and runs it; anything else (or a throw) hides
2475
+ * it on every row and refuses it on dispatch. Re-checked on dispatch before
2476
+ * the row is read or locked.
2477
+ */
2478
+ hasAccess?: (args: {
2479
+ session: import('../access/types.js').Session | null;
2480
+ context: import('../access/types.js').AccessContext;
2481
+ listKey: string;
2482
+ }) => boolean | Promise<boolean>;
2483
+ /**
2484
+ * Optional per-row gate, evaluated on the server for every row the list view
2485
+ * renders and again on dispatch against the re-read row. It must be
2486
+ * synchronous, so a page of rows never fans out into queries; a throw or a
2487
+ * non-boolean result (a Promise) counts as unavailable. `item` carries
2488
+ * the row's own columns, foreign keys and computed fields, with no relations.
2489
+ *
2490
+ * @example
2491
+ * ```typescript
2492
+ * isAvailable: ({ item }) => item.status !== 'published'
2493
+ * ```
2494
+ */
2495
+ isAvailable?: (args: {
2496
+ item: Record<string, unknown>;
2497
+ session: import('../access/types.js').Session | null;
2498
+ }) => boolean;
2499
+ /**
2500
+ * The server-side handler. Receives the row and the secured `context`; do all
2501
+ * work through `context.db`. Returns an optional `{ message }` shown in the
2502
+ * list view's status line.
2503
+ *
2504
+ * It runs inside a transaction that holds a row lock on the target row, so
2505
+ * its `context.db` writes commit atomically with the `hasAccess` and
2506
+ * `isAvailable` checks, a throw rolls them back, and a concurrent dispatch on
2507
+ * the same row waits and then re-checks against what this one committed.
2508
+ * The lock is held for as long as the handler runs: keep slow external
2509
+ * calls short, or make them after the handler returns.
2510
+ */
2511
+ handler: (args: RowActionContext<TTypeInfo>) => RowActionResult | void | Promise<RowActionResult | void>;
2512
+ }
2513
+ /**
2514
+ * A Preset view declared in `ui.listView.presets`, shown as a tab above the
2515
+ * list view's Filter builder and opened by `?preset=<key>`.
2516
+ *
2517
+ * Only `key`, `label` and the active preset's `search` cross to the client, and
2518
+ * that `search` has every token naming a field the session can never read
2519
+ * removed first. `search` and `hasAccess` run on
2520
+ * the server for each request, so a shared `?preset=` link resolves against
2521
+ * the recipient's own session. The resolved `search` runs through the same
2522
+ * filter engine and secured context as a typed `?search=`, so a preset can
2523
+ * only narrow what the session may already see.
2524
+ */
2525
+ export interface PresetView<TTypeInfo extends TypeInfo = TypeInfo> {
2526
+ /**
2527
+ * Stable identifier carried in `?preset=<key>`. Must be unique within the
2528
+ * list.
2529
+ */
2530
+ key: string;
2531
+ /** Tab label. */
2532
+ label: string;
2533
+ /**
2534
+ * The preset's filter query in the `?search=` grammar, or a function of the
2535
+ * session returning one. Resolved on the server per request; a throw falls
2536
+ * back to the plain list. `author:#<id>` matches exactly one related record;
2537
+ * any other value built from data goes through `quoteFilterValue`, so it
2538
+ * reads back as exactly one value however it is spelled.
2539
+ *
2540
+ * @example
2541
+ * ```typescript
2542
+ * search: ({ session }) => `status:draft author:#${session?.userId ?? ''}`
2543
+ * ```
2544
+ *
2545
+ * @example
2546
+ * ```typescript
2547
+ * search: ({ session }) => `title:${quoteFilterValue(String(session?.name ?? ''))}`
2548
+ * ```
2549
+ */
2550
+ search: string | ((args: {
2551
+ session: import('../access/types.js').Session | null;
2552
+ context: import('../access/types.js').AccessContext<HookDb<TTypeInfo>>;
2553
+ listKey: string;
2554
+ }) => string | Promise<string>);
2555
+ /**
2556
+ * Optional sort applied while the preset is open. It goes through the same
2557
+ * sort validation as `initialSort` and `?sort=`, so a field this session
2558
+ * cannot order by is ignored. When omitted, `initialSort` applies.
2559
+ */
2560
+ sort?: {
2561
+ /** The field to sort by. */
2562
+ field: string;
2563
+ /** The sort direction. */
2564
+ direction: 'asc' | 'desc';
2565
+ };
2566
+ /**
2567
+ * Optional visibility gate, resolved per request against the session.
2568
+ * Only `true` opens the tab; anything else (or a throw) hides it, and a
2569
+ * `?preset=` link to it opens the plain list instead.
2570
+ */
2571
+ hasAccess?: (args: {
2572
+ session: import('../access/types.js').Session | null;
2573
+ context: import('../access/types.js').AccessContext<HookDb<TTypeInfo>>;
2574
+ listKey: string;
2575
+ }) => boolean | Promise<boolean>;
2576
+ }
2344
2577
  /**
2345
2578
  * Default list-view (table) configuration for a list, mirroring Keystone's
2346
2579
  * `ui.listView`.
@@ -2349,7 +2582,7 @@ export interface BulkAction {
2349
2582
  * field whose own `ui.listView.defaultColumn` declaration holds is shown as
2350
2583
  * a column (see {@link BaseFieldConfig.ui}) and no default sort is applied.
2351
2584
  */
2352
- export type ListViewUIConfig = {
2585
+ export type ListViewUIConfig<TTypeInfo extends TypeInfo = TypeInfo> = {
2353
2586
  /**
2354
2587
  * The fields to show as columns in the list table, in order.
2355
2588
  *
@@ -2412,6 +2645,69 @@ export type ListViewUIConfig = {
2412
2645
  * ```
2413
2646
  */
2414
2647
  bulkActions?: BulkAction[];
2648
+ /**
2649
+ * Custom Row actions offered in each row's menu, in declaration order,
2650
+ * between the built-in Edit / Copy link and Delete. `hasAccess` is resolved
2651
+ * once per request and `isAvailable` per row on the server, so a row only
2652
+ * offers the actions that apply to it. Dispatch re-reads the row through
2653
+ * the secured context and re-runs both checks before the `handler` runs; a
2654
+ * row that is missing, denied or no longer eligible reports the same
2655
+ * "not run" outcome.
2656
+ *
2657
+ * @example
2658
+ * ```typescript
2659
+ * ui: {
2660
+ * listView: {
2661
+ * rowActions: [
2662
+ * {
2663
+ * key: 'publish',
2664
+ * label: 'Publish now',
2665
+ * icon: 'send',
2666
+ * isAvailable: ({ item }) => item.status !== 'published',
2667
+ * handler: async ({ id, context }) => {
2668
+ * const post = await context.db.Post.update({
2669
+ * where: { id },
2670
+ * data: { status: 'published' },
2671
+ * })
2672
+ * return { message: post ? 'Published' : 'Not published' }
2673
+ * },
2674
+ * },
2675
+ * ],
2676
+ * },
2677
+ * }
2678
+ * ```
2679
+ */
2680
+ rowActions?: RowAction<TTypeInfo>[];
2681
+ /**
2682
+ * Preset views offered as tabs above the Filter builder, in declaration
2683
+ * order, after an implicit "All" tab. `?preset=<key>` opens one; the first
2684
+ * change to the filter, sort, columns or page size expands it to the
2685
+ * equivalent `?search=` and leaves the preset. An unknown key, or one whose
2686
+ * `hasAccess` denies the session, opens the plain list.
2687
+ *
2688
+ * @example
2689
+ * ```typescript
2690
+ * ui: {
2691
+ * listView: {
2692
+ * presets: [
2693
+ * {
2694
+ * key: 'my-drafts',
2695
+ * label: 'My drafts',
2696
+ * search: ({ session }) => `status:draft author:#${session?.userId ?? ''}`,
2697
+ * sort: { field: 'title', direction: 'asc' },
2698
+ * hasAccess: ({ session }) => typeof session?.userId === 'string',
2699
+ * },
2700
+ * {
2701
+ * key: 'named-for-me',
2702
+ * label: 'Named for me',
2703
+ * search: ({ session }) => `title:${quoteFilterValue(String(session?.name ?? ''))}`,
2704
+ * },
2705
+ * ],
2706
+ * },
2707
+ * }
2708
+ * ```
2709
+ */
2710
+ presets?: PresetView<TTypeInfo>[];
2415
2711
  };
2416
2712
  /**
2417
2713
  * Input type for the list() function
@@ -2814,6 +3110,19 @@ export type ActionErrorClassification = {
2814
3110
  export type UIConfig = {
2815
3111
  basePath?: string;
2816
3112
  theme?: ThemeConfig;
3113
+ /**
3114
+ * The product name, and an optional logo URL, the admin shows in its sidebar
3115
+ * and narrow-screen top bar in place of "OpenSaas Admin".
3116
+ *
3117
+ * @example
3118
+ * ```typescript
3119
+ * ui: { brand: { name: 'Acme Console', logo: '/acme.svg' } }
3120
+ * ```
3121
+ */
3122
+ brand?: {
3123
+ name: string;
3124
+ logo?: string;
3125
+ };
2817
3126
  /**
2818
3127
  * Maps an error thrown during a server action to a typed failure, applied
2819
3128
  * before the stack's default mapping. When it returns a value, the action
@@ -2841,30 +3150,55 @@ export type UIConfig = {
2841
3150
  * MCP (Model Context Protocol) configuration
2842
3151
  */
2843
3152
  /**
2844
- * Configuration for which CRUD tools to enable for a list
3153
+ * Which generated CRUD tools a list exposes over MCP.
3154
+ *
3155
+ * The query tool is on unless switched off here or by `mcp.defaultTools.read`.
3156
+ * The create, update and delete tools are off unless this list turns each one
3157
+ * on: enabling MCP never exposes a write on its own.
3158
+ *
3159
+ * @example
3160
+ * ```typescript
3161
+ * Post: list({
3162
+ * fields: { title: text() },
3163
+ * mcp: { tools: { create: true, update: true } },
3164
+ * })
3165
+ * ```
2845
3166
  */
2846
3167
  export type McpToolsConfig = {
2847
3168
  /**
2848
- * Enable read/query tool
2849
- * @default true
3169
+ * Enable the `list_<list>_query` tool
3170
+ * @default mcp.defaultTools.read, else true
2850
3171
  */
2851
3172
  read?: boolean;
2852
3173
  /**
2853
- * Enable create tool
2854
- * @default true
3174
+ * Enable the `list_<list>_create` tool
3175
+ * @default false
2855
3176
  */
2856
3177
  create?: boolean;
2857
3178
  /**
2858
- * Enable update tool
2859
- * @default true
3179
+ * Enable the `list_<list>_update` tool
3180
+ * @default false
2860
3181
  */
2861
3182
  update?: boolean;
2862
3183
  /**
2863
- * Enable delete tool
2864
- * @default true
3184
+ * Enable the `list_<list>_delete` tool
3185
+ * @default false
2865
3186
  */
2866
3187
  delete?: boolean;
2867
3188
  };
3189
+ /**
3190
+ * The app-wide default for the generated query tool. There is no app-wide
3191
+ * write default: a list enables `create`, `update` and `delete` itself with
3192
+ * `mcp.tools`, and a config setting one here is refused.
3193
+ */
3194
+ export type McpDefaultToolsConfig = {
3195
+ /**
3196
+ * Enable the `list_<list>_query` tool on every list that does not set
3197
+ * `mcp.tools.read` itself
3198
+ * @default true
3199
+ */
3200
+ read?: boolean;
3201
+ };
2868
3202
  /**
2869
3203
  * Custom MCP tool definition
2870
3204
  * Allows developers to add custom tools for specific lists
@@ -2922,7 +3256,8 @@ export type ListMcpConfig = {
2922
3256
  */
2923
3257
  scopes?: McpScopesConfig;
2924
3258
  /**
2925
- * Configure which CRUD tools to enable
3259
+ * Which generated CRUD tools this list exposes. Create, update and delete
3260
+ * are off unless enabled here.
2926
3261
  */
2927
3262
  tools?: McpToolsConfig;
2928
3263
  /**
@@ -3004,10 +3339,11 @@ export type McpConfig = {
3004
3339
  */
3005
3340
  auth?: McpAuthConfig;
3006
3341
  /**
3007
- * Default tool configuration for all lists
3008
- * Can be overridden per-list
3342
+ * App-wide default for the generated query tool, overridable per list.
3343
+ * Write tools have no app-wide default: enable them per list with
3344
+ * `mcp.tools.create`, `mcp.tools.update` and `mcp.tools.delete`.
3009
3345
  */
3010
- defaultTools?: McpToolsConfig;
3346
+ defaultTools?: McpDefaultToolsConfig;
3011
3347
  /**
3012
3348
  * OAuth scopes the session's token must carry for CRUD tools. Not enforced
3013
3349
  * unless configured. Overridable per list with `list.mcp.scopes`.
@@ -3218,6 +3554,12 @@ export type Plugin = {
3218
3554
  * fields) in a downstream app; passing it as a plain second argument avoids
3219
3555
  * that recursion entirely.
3220
3556
  *
3557
+ * A service closes over the base context, so its writes do not join a
3558
+ * hook's transaction, and a write to the row being written waits on that
3559
+ * row's lock forever. A method a hook calls should take the hook's own
3560
+ * `context` as an argument and use `context.db`, which is bound to the
3561
+ * write's transaction (ADR-0066).
3562
+ *
3221
3563
  * It is a `StackContext`, not the `AccessContext` of the first argument:
3222
3564
  * the two differ, and the difference bites. `StackContext` omits
3223
3565
  * `ormHandle`, `_isSudo`'s internal companions and `_config`, so a core
@@ -3310,6 +3652,39 @@ export interface OpenSaasConfig {
3310
3652
  * ```
3311
3653
  */
3312
3654
  onAfterTransactionError?: (report: AfterTransactionErrorReport) => void | Promise<void>;
3655
+ /**
3656
+ * Recognises a host framework's control flow — a redirect, a not-found, a
3657
+ * dynamic-rendering bailout — thrown from inside an access rule or a nav
3658
+ * count, so it propagates to the framework instead of being folded into a
3659
+ * logged deny. Consulted by the Session vocabulary, MCP's advertised
3660
+ * vocabulary and the admin's nav counts (ADR-0084).
3661
+ *
3662
+ * Added to the built-in recognition, never in place of it: a value is
3663
+ * control flow when this returns `true` **or** the built-in check of
3664
+ * Next.js's control-flow digests and React's postpone recognises it. As
3665
+ * with the built-in check, an `Error` whose `cause` chain reaches a
3666
+ * recognised value has that value rethrown, not the wrapper.
3667
+ *
3668
+ * A predicate that throws recognises nothing: the built-in check still
3669
+ * applies, a rule's own throw still denies and is logged, and the
3670
+ * predicate's failure is reported to `console.error` once per predicate.
3671
+ *
3672
+ * The generated context sets this to Next.js's own `unstable_rethrow` when
3673
+ * the project depends on `next` and `next/navigation` loads, OR'ed with any
3674
+ * predicate declared here.
3675
+ *
3676
+ * @param thrown - Any thrown value, which is why it is `unknown`.
3677
+ *
3678
+ * @example
3679
+ * ```typescript
3680
+ * config({
3681
+ * db: { provider: 'postgresql' },
3682
+ * lists: {},
3683
+ * isFrameworkControlFlow: (thrown) => thrown instanceof Response,
3684
+ * })
3685
+ * ```
3686
+ */
3687
+ isFrameworkControlFlow?: (thrown: unknown) => boolean;
3313
3688
  lists: Record<string, ListConfig<any>>;
3314
3689
  session?: SessionConfig;
3315
3690
  ui?: UIConfig;