@kayjs/kay 1.108.0 → 1.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/dist/eslint.js +1790 -3751
  2. package/editors/zed/extension.toml +2 -2
  3. package/llms/action-protection.md +1 -1
  4. package/llms/actions-from-islands.md +4 -4
  5. package/llms/actions-refused-fields.md +4 -4
  6. package/llms/api-from-islands.md +6 -6
  7. package/llms/browser-only.md +2 -2
  8. package/llms/cdn-caching.md +1 -1
  9. package/llms/checks.md +1 -1
  10. package/llms/code-lints.md +1 -2
  11. package/llms/component-library-conventions.md +1 -1
  12. package/llms/components.md +4 -4
  13. package/llms/deprecated-lints.md +1 -6
  14. package/llms/effects.md +1 -1
  15. package/llms/errors.md +2 -2
  16. package/llms/events.md +1 -1
  17. package/llms/guards.md +1 -1
  18. package/llms/head.md +1 -1
  19. package/llms/hooks.md +2 -2
  20. package/llms/images.md +1 -1
  21. package/llms/island-and-form-lints.md +2 -1
  22. package/llms/island-sources.md +1 -1
  23. package/llms/islands-state-to-ids.md +2 -2
  24. package/llms/islands.md +4 -2
  25. package/llms/lints.md +1 -1
  26. package/llms/live-values.md +3 -3
  27. package/llms/local-collections.md +1 -1
  28. package/llms/locales.md +1 -1
  29. package/llms/mcp.md +2 -2
  30. package/llms/metrics.md +1 -1
  31. package/llms/navigation-from-code.md +6 -6
  32. package/llms/prerendering.md +1 -0
  33. package/llms/production.md +2 -2
  34. package/llms/project-new-and-add.md +1 -1
  35. package/llms/project.md +4 -4
  36. package/llms/proxy-and-security.md +1 -1
  37. package/llms/queues.md +1 -1
  38. package/llms/rate-limits.md +4 -4
  39. package/llms/rendering.md +1 -1
  40. package/llms/server-islands.md +2 -2
  41. package/llms/server.md +1 -1
  42. package/llms/stores.md +1 -1
  43. package/llms/styles-and-assets.md +1 -1
  44. package/llms/testing-mount.md +49 -0
  45. package/llms/testing.md +4 -45
  46. package/llms/upgrading-1-105-config.md +13 -13
  47. package/llms/upgrading-archive.md +42 -82
  48. package/llms/upgrading.md +91 -63
  49. package/llms/whats-new.md +9 -0
  50. package/llms.txt +5 -6
  51. package/package.json +6 -10
  52. package/src/build/route-sizes.ts +2 -3
  53. package/src/check/browser-global-reads.ts +2 -2
  54. package/src/check/config-objects.ts +1 -1
  55. package/src/check/diagnose.ts +0 -22
  56. package/src/check/export-homes.ts +1 -1
  57. package/src/check/guards.ts +3 -3
  58. package/src/check/index.ts +2 -7
  59. package/src/check/moved-keys.ts +1 -1
  60. package/src/check/project.ts +3 -8
  61. package/src/check/shadow-types.ts +0 -86
  62. package/src/commands/check.ts +2 -2
  63. package/src/commands/env.ts +25 -3
  64. package/src/compiler/ast.ts +18 -16
  65. package/src/compiler/browser.ts +2 -14
  66. package/src/compiler/class-items.ts +16 -0
  67. package/src/compiler/codegen.ts +8 -8
  68. package/src/compiler/deprecated-library.ts +0 -12
  69. package/src/compiler/deprecated-lints.ts +3 -495
  70. package/src/compiler/deprecated-ui-props.ts +5 -5
  71. package/src/compiler/errors.ts +2 -2
  72. package/src/compiler/fence-checks.ts +2 -121
  73. package/src/compiler/hand-parts.ts +55 -0
  74. package/src/compiler/helper-imports.ts +2 -2
  75. package/src/compiler/image-attributes.ts +1 -3
  76. package/src/compiler/index.ts +20 -21
  77. package/src/compiler/island-arguments.ts +8 -95
  78. package/src/compiler/island-cause.ts +7 -7
  79. package/src/compiler/island-declaration.ts +2 -8
  80. package/src/compiler/island-lints.ts +12 -0
  81. package/src/compiler/island-marker.ts +3 -3
  82. package/src/compiler/island-problems.ts +25 -0
  83. package/src/compiler/jsx-class.ts +1 -25
  84. package/src/compiler/jsx.ts +2 -2
  85. package/src/compiler/kay-exports.ts +0 -2
  86. package/src/compiler/link-flags.ts +9 -38
  87. package/src/compiler/lints.ts +7 -14
  88. package/src/compiler/markup.ts +23 -26
  89. package/src/compiler/module-signals.ts +2 -2
  90. package/src/compiler/names.ts +1 -1
  91. package/src/compiler/page-settings.ts +11 -0
  92. package/src/compiler/parser.ts +6 -8
  93. package/src/compiler/plan.ts +1 -3
  94. package/src/compiler/rewrite.ts +3 -18
  95. package/src/compiler/script-server.ts +8 -3
  96. package/src/compiler/validate.ts +3 -8
  97. package/src/config-loader.ts +14 -4
  98. package/src/config-resolve.ts +18 -142
  99. package/src/config-shape.ts +44 -34
  100. package/src/config.ts +10 -114
  101. package/src/dev/preload.ts +4 -1
  102. package/src/lsp/server.ts +4 -0
  103. package/src/migrate/markup.ts +4 -1
  104. package/src/runtime/action-call.ts +0 -8
  105. package/src/runtime/action-encode.ts +26 -0
  106. package/src/runtime/action-error.ts +3 -11
  107. package/src/runtime/action-protection.ts +2 -2
  108. package/src/runtime/action-run.ts +2 -27
  109. package/src/runtime/action-shared.ts +14 -37
  110. package/src/runtime/action-stream.ts +0 -1
  111. package/src/runtime/action.ts +1 -1
  112. package/src/runtime/call-result.ts +2 -10
  113. package/src/runtime/checks.ts +11 -11
  114. package/src/runtime/client.ts +2 -2
  115. package/src/runtime/core.ts +5 -23
  116. package/src/runtime/dom.ts +1 -1
  117. package/src/runtime/html.ts +1 -1
  118. package/src/runtime/i18n.client.ts +1 -4
  119. package/src/runtime/i18n.server.ts +1 -4
  120. package/src/runtime/i18n.ts +3 -3
  121. package/src/runtime/index.ts +2 -2
  122. package/src/runtime/island.server.ts +18 -5
  123. package/src/runtime/live-resource.server.ts +0 -1
  124. package/src/runtime/live-value.server.ts +2 -2
  125. package/src/runtime/live-value.shared.ts +7 -20
  126. package/src/runtime/live.ts +1 -12
  127. package/src/runtime/local-types.ts +1 -11
  128. package/src/runtime/local.ts +4 -14
  129. package/src/runtime/navigate-api.ts +2 -5
  130. package/src/runtime/navigation-state.ts +0 -12
  131. package/src/runtime/page-swap.ts +6 -6
  132. package/src/runtime/persist.ts +11 -3
  133. package/src/runtime/persisted.ts +4 -30
  134. package/src/runtime/presence.ts +6 -7
  135. package/src/runtime/query-param.ts +20 -12
  136. package/src/runtime/reactive.ts +3 -1
  137. package/src/runtime/refuse.ts +3 -17
  138. package/src/runtime/store-base.ts +4 -6
  139. package/src/runtime/swap-fetch.ts +1 -1
  140. package/src/runtime/values.ts +40 -23
  141. package/src/runtime/with-query.ts +9 -0
  142. package/src/server/action-hooks.ts +8 -8
  143. package/src/server/actions.ts +13 -14
  144. package/src/server/api-modules.ts +2 -3
  145. package/src/server/app-stages.ts +15 -33
  146. package/src/server/app.ts +10 -5
  147. package/src/server/auth-mails.ts +0 -2
  148. package/src/server/env-state.ts +40 -10
  149. package/src/server/flash.ts +1 -1
  150. package/src/server/guard-requirement.ts +4 -4
  151. package/src/server/image.ts +2 -2
  152. package/src/server/index.ts +0 -2
  153. package/src/server/job-context.ts +3 -3
  154. package/src/server/jobs-page.ts +1 -1
  155. package/src/server/jobs.ts +5 -9
  156. package/src/server/kept-exports.ts +0 -2
  157. package/src/server/kv.ts +11 -14
  158. package/src/server/library.ts +1 -3
  159. package/src/server/live.ts +2 -2
  160. package/src/server/mcp.ts +3 -9
  161. package/src/server/metrics.ts +2 -4
  162. package/src/server/page-settings.ts +10 -19
  163. package/src/server/prerender.ts +19 -2
  164. package/src/server/protection.ts +15 -18
  165. package/src/server/queue.ts +3 -6
  166. package/src/server/rate-limit.ts +0 -3
  167. package/src/server/render-document.ts +1 -1
  168. package/src/server/routes.ts +7 -3
  169. package/src/server/scope.ts +3 -2
  170. package/src/server/session.ts +5 -6
  171. package/src/server/setup.ts +1 -1
  172. package/src/server/signals.ts +17 -7
  173. package/src/server/signed.ts +1 -3
  174. package/src/server/source.ts +20 -4
  175. package/src/server/speculation.ts +1 -1
  176. package/src/server/storage.ts +3 -8
  177. package/src/server/validate.ts +1 -1
  178. package/src/server/vitals.ts +1 -3
  179. package/src/server/work-scope.ts +2 -4
  180. package/src/server/work.ts +1 -1
  181. package/src/server/workflow.ts +1 -1
  182. package/src/test/index.ts +2 -1
  183. package/src/test/site-actions.ts +16 -6
  184. package/src/test/site-keys.ts +10 -15
  185. package/src/test/site-socket.ts +1 -2
  186. package/src/test/site-types.ts +0 -8
  187. package/types/build/route-sizes.d.ts.map +1 -1
  188. package/types/check/diagnose.d.ts.map +1 -1
  189. package/types/check/index.d.ts +1 -2
  190. package/types/check/index.d.ts.map +1 -1
  191. package/types/check/project.d.ts.map +1 -1
  192. package/types/check/shadow-types.d.ts.map +1 -1
  193. package/types/commands/env.d.ts.map +1 -1
  194. package/types/compiler/ast.d.ts +1 -2
  195. package/types/compiler/ast.d.ts.map +1 -1
  196. package/types/compiler/browser.d.ts.map +1 -1
  197. package/types/compiler/class-items.d.ts +7 -0
  198. package/types/compiler/class-items.d.ts.map +1 -0
  199. package/types/compiler/deprecated-library.d.ts.map +1 -1
  200. package/types/compiler/deprecated-lints.d.ts +0 -551
  201. package/types/compiler/deprecated-lints.d.ts.map +1 -1
  202. package/types/compiler/deprecated-ui-props.d.ts +1 -8
  203. package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
  204. package/types/compiler/errors.d.ts +2 -2
  205. package/types/compiler/errors.d.ts.map +1 -1
  206. package/types/compiler/fence-checks.d.ts +0 -1
  207. package/types/compiler/fence-checks.d.ts.map +1 -1
  208. package/types/compiler/hand-parts.d.ts +7 -0
  209. package/types/compiler/hand-parts.d.ts.map +1 -0
  210. package/types/compiler/image-attributes.d.ts +0 -1
  211. package/types/compiler/image-attributes.d.ts.map +1 -1
  212. package/types/compiler/index.d.ts.map +1 -1
  213. package/types/compiler/island-arguments.d.ts +2 -11
  214. package/types/compiler/island-arguments.d.ts.map +1 -1
  215. package/types/compiler/island-cause.d.ts +1 -1
  216. package/types/compiler/island-cause.d.ts.map +1 -1
  217. package/types/compiler/island-declaration.d.ts +1 -3
  218. package/types/compiler/island-declaration.d.ts.map +1 -1
  219. package/types/compiler/island-lints.d.ts +10 -0
  220. package/types/compiler/island-lints.d.ts.map +1 -0
  221. package/types/compiler/island-problems.d.ts +7 -0
  222. package/types/compiler/island-problems.d.ts.map +1 -0
  223. package/types/compiler/jsx-class.d.ts +1 -2
  224. package/types/compiler/jsx-class.d.ts.map +1 -1
  225. package/types/compiler/kay-exports.d.ts.map +1 -1
  226. package/types/compiler/link-flags.d.ts +0 -6
  227. package/types/compiler/link-flags.d.ts.map +1 -1
  228. package/types/compiler/lints.d.ts +11 -563
  229. package/types/compiler/lints.d.ts.map +1 -1
  230. package/types/compiler/markup.d.ts +1 -1
  231. package/types/compiler/markup.d.ts.map +1 -1
  232. package/types/compiler/module-signals.d.ts.map +1 -1
  233. package/types/compiler/names.d.ts.map +1 -1
  234. package/types/compiler/page-settings.d.ts +4 -0
  235. package/types/compiler/page-settings.d.ts.map +1 -1
  236. package/types/compiler/parser.d.ts.map +1 -1
  237. package/types/compiler/plan.d.ts.map +1 -1
  238. package/types/compiler/script-server.d.ts.map +1 -1
  239. package/types/compiler/validate.d.ts.map +1 -1
  240. package/types/config-loader.d.ts.map +1 -1
  241. package/types/config-resolve.d.ts.map +1 -1
  242. package/types/config-shape.d.ts +1 -1
  243. package/types/config-shape.d.ts.map +1 -1
  244. package/types/config.d.ts +5 -105
  245. package/types/config.d.ts.map +1 -1
  246. package/types/dev/preload.d.ts.map +1 -1
  247. package/types/lsp/server.d.ts.map +1 -1
  248. package/types/migrate/markup.d.ts.map +1 -1
  249. package/types/runtime/action-call.d.ts.map +1 -1
  250. package/types/runtime/action-encode.d.ts +1 -0
  251. package/types/runtime/action-encode.d.ts.map +1 -1
  252. package/types/runtime/action-error.d.ts +1 -2
  253. package/types/runtime/action-error.d.ts.map +1 -1
  254. package/types/runtime/action-run.d.ts.map +1 -1
  255. package/types/runtime/action-shared.d.ts +1 -27
  256. package/types/runtime/action-shared.d.ts.map +1 -1
  257. package/types/runtime/action-stream.d.ts.map +1 -1
  258. package/types/runtime/action.d.ts +1 -1
  259. package/types/runtime/action.d.ts.map +1 -1
  260. package/types/runtime/call-result.d.ts +0 -10
  261. package/types/runtime/call-result.d.ts.map +1 -1
  262. package/types/runtime/checks.d.ts +6 -9
  263. package/types/runtime/checks.d.ts.map +1 -1
  264. package/types/runtime/core.d.ts +2 -20
  265. package/types/runtime/core.d.ts.map +1 -1
  266. package/types/runtime/dom.d.ts +1 -1
  267. package/types/runtime/dom.d.ts.map +1 -1
  268. package/types/runtime/html.d.ts +1 -1
  269. package/types/runtime/html.d.ts.map +1 -1
  270. package/types/runtime/i18n.client.d.ts +0 -1
  271. package/types/runtime/i18n.client.d.ts.map +1 -1
  272. package/types/runtime/i18n.d.ts +1 -1
  273. package/types/runtime/i18n.d.ts.map +1 -1
  274. package/types/runtime/i18n.server.d.ts +0 -1
  275. package/types/runtime/i18n.server.d.ts.map +1 -1
  276. package/types/runtime/index.d.ts +2 -2
  277. package/types/runtime/index.d.ts.map +1 -1
  278. package/types/runtime/island.server.d.ts +1 -0
  279. package/types/runtime/island.server.d.ts.map +1 -1
  280. package/types/runtime/live-resource.server.d.ts.map +1 -1
  281. package/types/runtime/live-value.shared.d.ts +7 -15
  282. package/types/runtime/live-value.shared.d.ts.map +1 -1
  283. package/types/runtime/live.d.ts +0 -11
  284. package/types/runtime/live.d.ts.map +1 -1
  285. package/types/runtime/local-types.d.ts +0 -14
  286. package/types/runtime/local-types.d.ts.map +1 -1
  287. package/types/runtime/navigate-api.d.ts +0 -4
  288. package/types/runtime/navigate-api.d.ts.map +1 -1
  289. package/types/runtime/navigation-state.d.ts +0 -4
  290. package/types/runtime/navigation-state.d.ts.map +1 -1
  291. package/types/runtime/page-swap.d.ts.map +1 -1
  292. package/types/runtime/persist.d.ts +1 -0
  293. package/types/runtime/persist.d.ts.map +1 -1
  294. package/types/runtime/persisted.d.ts +0 -15
  295. package/types/runtime/persisted.d.ts.map +1 -1
  296. package/types/runtime/presence.d.ts +0 -2
  297. package/types/runtime/presence.d.ts.map +1 -1
  298. package/types/runtime/query-param.d.ts.map +1 -1
  299. package/types/runtime/reactive.d.ts +2 -1
  300. package/types/runtime/reactive.d.ts.map +1 -1
  301. package/types/runtime/refuse.d.ts +0 -7
  302. package/types/runtime/refuse.d.ts.map +1 -1
  303. package/types/runtime/store-base.d.ts +1 -2
  304. package/types/runtime/store-base.d.ts.map +1 -1
  305. package/types/runtime/values.d.ts +2 -1
  306. package/types/runtime/values.d.ts.map +1 -1
  307. package/types/runtime/with-query.d.ts +2 -0
  308. package/types/runtime/with-query.d.ts.map +1 -1
  309. package/types/server/action-hooks.d.ts +4 -4
  310. package/types/server/action-hooks.d.ts.map +1 -1
  311. package/types/server/actions.d.ts.map +1 -1
  312. package/types/server/api-modules.d.ts +0 -1
  313. package/types/server/api-modules.d.ts.map +1 -1
  314. package/types/server/app-stages.d.ts +5 -13
  315. package/types/server/app-stages.d.ts.map +1 -1
  316. package/types/server/app.d.ts +3 -8
  317. package/types/server/app.d.ts.map +1 -1
  318. package/types/server/auth-mails.d.ts +0 -5
  319. package/types/server/auth-mails.d.ts.map +1 -1
  320. package/types/server/env-state.d.ts +1 -0
  321. package/types/server/env-state.d.ts.map +1 -1
  322. package/types/server/guard-requirement.d.ts +0 -1
  323. package/types/server/guard-requirement.d.ts.map +1 -1
  324. package/types/server/image.d.ts +0 -1
  325. package/types/server/image.d.ts.map +1 -1
  326. package/types/server/index.d.ts +0 -2
  327. package/types/server/index.d.ts.map +1 -1
  328. package/types/server/job-context.d.ts +1 -1
  329. package/types/server/job-context.d.ts.map +1 -1
  330. package/types/server/jobs.d.ts +0 -4
  331. package/types/server/jobs.d.ts.map +1 -1
  332. package/types/server/kept-exports.d.ts.map +1 -1
  333. package/types/server/kv.d.ts +4 -4
  334. package/types/server/kv.d.ts.map +1 -1
  335. package/types/server/library.d.ts +1 -3
  336. package/types/server/library.d.ts.map +1 -1
  337. package/types/server/mcp.d.ts +0 -1
  338. package/types/server/mcp.d.ts.map +1 -1
  339. package/types/server/metrics.d.ts +0 -5
  340. package/types/server/metrics.d.ts.map +1 -1
  341. package/types/server/page-settings.d.ts +3 -3
  342. package/types/server/page-settings.d.ts.map +1 -1
  343. package/types/server/prerender.d.ts.map +1 -1
  344. package/types/server/protection.d.ts +6 -6
  345. package/types/server/protection.d.ts.map +1 -1
  346. package/types/server/queue.d.ts +1 -3
  347. package/types/server/queue.d.ts.map +1 -1
  348. package/types/server/rate-limit.d.ts +0 -2
  349. package/types/server/rate-limit.d.ts.map +1 -1
  350. package/types/server/routes.d.ts +1 -1
  351. package/types/server/routes.d.ts.map +1 -1
  352. package/types/server/scope.d.ts.map +1 -1
  353. package/types/server/session.d.ts +1 -1
  354. package/types/server/session.d.ts.map +1 -1
  355. package/types/server/signals.d.ts.map +1 -1
  356. package/types/server/signed.d.ts +0 -2
  357. package/types/server/signed.d.ts.map +1 -1
  358. package/types/server/source.d.ts +1 -1
  359. package/types/server/source.d.ts.map +1 -1
  360. package/types/server/storage.d.ts +0 -4
  361. package/types/server/storage.d.ts.map +1 -1
  362. package/types/server/vitals.d.ts +0 -1
  363. package/types/server/vitals.d.ts.map +1 -1
  364. package/types/server/work-scope.d.ts +0 -2
  365. package/types/server/work-scope.d.ts.map +1 -1
  366. package/types/server/workflow.d.ts +1 -1
  367. package/types/server/workflow.d.ts.map +1 -1
  368. package/types/test/index.d.ts.map +1 -1
  369. package/types/test/site-actions.d.ts +1 -1
  370. package/types/test/site-actions.d.ts.map +1 -1
  371. package/types/test/site-keys.d.ts +1 -1
  372. package/types/test/site-keys.d.ts.map +1 -1
  373. package/types/test/site-socket.d.ts +1 -1
  374. package/types/test/site-socket.d.ts.map +1 -1
  375. package/types/test/site-types.d.ts +0 -8
  376. package/types/test/site-types.d.ts.map +1 -1
  377. package/llms/deprecated-lints-1-105-libraries.md +0 -32
  378. package/llms/deprecated-lints-1-105.md +0 -58
  379. package/src/check/action-readers.ts +0 -115
  380. package/src/check/action-type.ts +0 -44
  381. package/src/check/ai-language.ts +0 -56
  382. package/src/check/app-hooks.ts +0 -90
  383. package/src/check/auth-methods.ts +0 -85
  384. package/src/check/auth-rate-limits.ts +0 -99
  385. package/src/check/call-result.ts +0 -242
  386. package/src/check/client-keys.ts +0 -10
  387. package/src/check/cms-options.ts +0 -81
  388. package/src/check/config-groups.ts +0 -22
  389. package/src/check/config-switches.ts +0 -38
  390. package/src/check/context-import.ts +0 -51
  391. package/src/check/env-files.ts +0 -31
  392. package/src/check/format-duration.ts +0 -75
  393. package/src/check/guard-options.ts +0 -58
  394. package/src/check/handler-events.ts +0 -149
  395. package/src/check/hook-context.ts +0 -94
  396. package/src/check/hook-names.ts +0 -104
  397. package/src/check/i18n-keys.ts +0 -50
  398. package/src/check/images-keys.ts +0 -54
  399. package/src/check/job-shapes.ts +0 -273
  400. package/src/check/link-flag-tests.ts +0 -130
  401. package/src/check/live-api.ts +0 -137
  402. package/src/check/mail-api.ts +0 -67
  403. package/src/check/one-state-api.ts +0 -357
  404. package/src/check/pages-options.ts +0 -35
  405. package/src/check/rate-enforce.ts +0 -53
  406. package/src/check/refusal-calls.ts +0 -185
  407. package/src/check/retired-lints.ts +0 -49
  408. package/src/check/route-keys.ts +0 -166
  409. package/src/check/secret-keys.ts +0 -83
  410. package/src/check/socket-frames.ts +0 -102
  411. package/src/check/source-readers.ts +0 -257
  412. package/src/check/store-ms.ts +0 -72
  413. package/src/check/store-names.ts +0 -88
  414. package/src/check/test-helpers.ts +0 -98
  415. package/src/check/ttl-names.ts +0 -142
  416. package/src/compiler/deprecated-ai-labels.ts +0 -97
  417. package/src/compiler/deprecated-ai-links.ts +0 -63
  418. package/src/compiler/deprecated-allow.ts +0 -50
  419. package/src/compiler/deprecated-auth-lints.ts +0 -14
  420. package/src/compiler/deprecated-auth-signed.ts +0 -29
  421. package/src/compiler/deprecated-children.ts +0 -66
  422. package/src/compiler/deprecated-image.ts +0 -116
  423. package/src/compiler/deprecated-island.ts +0 -155
  424. package/src/compiler/deprecated-lints-1-105.ts +0 -41
  425. package/src/compiler/deprecated-page.ts +0 -125
  426. package/src/compiler/deprecated-parts.ts +0 -22
  427. package/src/compiler/deprecated-typed-lints.ts +0 -23
  428. package/src/compiler/deprecated-ui-callbacks.ts +0 -66
  429. package/src/compiler/deprecated-ui-input.ts +0 -97
  430. package/src/compiler/deprecated-ui-items.ts +0 -47
  431. package/src/compiler/old-parts.ts +0 -84
  432. package/src/runtime/mount.compat.ts +0 -8
  433. package/src/server/moved-exports.ts +0 -17
  434. package/types/check/action-readers.d.ts +0 -3
  435. package/types/check/action-readers.d.ts.map +0 -1
  436. package/types/check/action-type.d.ts +0 -3
  437. package/types/check/action-type.d.ts.map +0 -1
  438. package/types/check/ai-language.d.ts +0 -3
  439. package/types/check/ai-language.d.ts.map +0 -1
  440. package/types/check/app-hooks.d.ts +0 -3
  441. package/types/check/app-hooks.d.ts.map +0 -1
  442. package/types/check/auth-methods.d.ts +0 -3
  443. package/types/check/auth-methods.d.ts.map +0 -1
  444. package/types/check/auth-rate-limits.d.ts +0 -3
  445. package/types/check/auth-rate-limits.d.ts.map +0 -1
  446. package/types/check/call-result.d.ts +0 -7
  447. package/types/check/call-result.d.ts.map +0 -1
  448. package/types/check/client-keys.d.ts +0 -3
  449. package/types/check/client-keys.d.ts.map +0 -1
  450. package/types/check/cms-options.d.ts +0 -3
  451. package/types/check/cms-options.d.ts.map +0 -1
  452. package/types/check/config-groups.d.ts +0 -3
  453. package/types/check/config-groups.d.ts.map +0 -1
  454. package/types/check/config-switches.d.ts +0 -3
  455. package/types/check/config-switches.d.ts.map +0 -1
  456. package/types/check/context-import.d.ts +0 -3
  457. package/types/check/context-import.d.ts.map +0 -1
  458. package/types/check/env-files.d.ts +0 -3
  459. package/types/check/env-files.d.ts.map +0 -1
  460. package/types/check/format-duration.d.ts +0 -5
  461. package/types/check/format-duration.d.ts.map +0 -1
  462. package/types/check/guard-options.d.ts +0 -3
  463. package/types/check/guard-options.d.ts.map +0 -1
  464. package/types/check/handler-events.d.ts +0 -9
  465. package/types/check/handler-events.d.ts.map +0 -1
  466. package/types/check/hook-context.d.ts +0 -3
  467. package/types/check/hook-context.d.ts.map +0 -1
  468. package/types/check/hook-names.d.ts +0 -3
  469. package/types/check/hook-names.d.ts.map +0 -1
  470. package/types/check/i18n-keys.d.ts +0 -3
  471. package/types/check/i18n-keys.d.ts.map +0 -1
  472. package/types/check/images-keys.d.ts +0 -3
  473. package/types/check/images-keys.d.ts.map +0 -1
  474. package/types/check/job-shapes.d.ts +0 -6
  475. package/types/check/job-shapes.d.ts.map +0 -1
  476. package/types/check/link-flag-tests.d.ts +0 -4
  477. package/types/check/link-flag-tests.d.ts.map +0 -1
  478. package/types/check/live-api.d.ts +0 -3
  479. package/types/check/live-api.d.ts.map +0 -1
  480. package/types/check/mail-api.d.ts +0 -3
  481. package/types/check/mail-api.d.ts.map +0 -1
  482. package/types/check/one-state-api.d.ts +0 -9
  483. package/types/check/one-state-api.d.ts.map +0 -1
  484. package/types/check/pages-options.d.ts +0 -3
  485. package/types/check/pages-options.d.ts.map +0 -1
  486. package/types/check/rate-enforce.d.ts +0 -3
  487. package/types/check/rate-enforce.d.ts.map +0 -1
  488. package/types/check/refusal-calls.d.ts +0 -3
  489. package/types/check/refusal-calls.d.ts.map +0 -1
  490. package/types/check/retired-lints.d.ts +0 -3
  491. package/types/check/retired-lints.d.ts.map +0 -1
  492. package/types/check/route-keys.d.ts +0 -3
  493. package/types/check/route-keys.d.ts.map +0 -1
  494. package/types/check/secret-keys.d.ts +0 -3
  495. package/types/check/secret-keys.d.ts.map +0 -1
  496. package/types/check/socket-frames.d.ts +0 -3
  497. package/types/check/socket-frames.d.ts.map +0 -1
  498. package/types/check/source-readers.d.ts +0 -3
  499. package/types/check/source-readers.d.ts.map +0 -1
  500. package/types/check/store-ms.d.ts +0 -3
  501. package/types/check/store-ms.d.ts.map +0 -1
  502. package/types/check/store-names.d.ts +0 -3
  503. package/types/check/store-names.d.ts.map +0 -1
  504. package/types/check/test-helpers.d.ts +0 -3
  505. package/types/check/test-helpers.d.ts.map +0 -1
  506. package/types/check/ttl-names.d.ts +0 -3
  507. package/types/check/ttl-names.d.ts.map +0 -1
  508. package/types/compiler/deprecated-ai-labels.d.ts +0 -5
  509. package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
  510. package/types/compiler/deprecated-ai-links.d.ts +0 -5
  511. package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
  512. package/types/compiler/deprecated-allow.d.ts +0 -5
  513. package/types/compiler/deprecated-allow.d.ts.map +0 -1
  514. package/types/compiler/deprecated-auth-lints.d.ts +0 -12
  515. package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
  516. package/types/compiler/deprecated-auth-signed.d.ts +0 -5
  517. package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
  518. package/types/compiler/deprecated-children.d.ts +0 -4
  519. package/types/compiler/deprecated-children.d.ts.map +0 -1
  520. package/types/compiler/deprecated-image.d.ts +0 -5
  521. package/types/compiler/deprecated-image.d.ts.map +0 -1
  522. package/types/compiler/deprecated-island.d.ts +0 -9
  523. package/types/compiler/deprecated-island.d.ts.map +0 -1
  524. package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
  525. package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
  526. package/types/compiler/deprecated-page.d.ts +0 -4
  527. package/types/compiler/deprecated-page.d.ts.map +0 -1
  528. package/types/compiler/deprecated-parts.d.ts +0 -3
  529. package/types/compiler/deprecated-parts.d.ts.map +0 -1
  530. package/types/compiler/deprecated-typed-lints.d.ts +0 -21
  531. package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
  532. package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
  533. package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
  534. package/types/compiler/deprecated-ui-input.d.ts +0 -5
  535. package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
  536. package/types/compiler/deprecated-ui-items.d.ts +0 -5
  537. package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
  538. package/types/compiler/old-parts.d.ts +0 -9
  539. package/types/compiler/old-parts.d.ts.map +0 -1
  540. package/types/runtime/mount.compat.d.ts +0 -7
  541. package/types/runtime/mount.compat.d.ts.map +0 -1
  542. package/types/server/moved-exports.d.ts +0 -12
  543. package/types/server/moved-exports.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { TSchema } from 'elysia'
2
2
  import type { ActionsConfig } from '../config'
3
- import type { ActionDone, ActionFailed, ActionHookContext, ActionHooks, ActionRun, ServerAction } from '../runtime/action'
3
+ import type { ActionContext, ActionDone, ActionFailed, ActionHookContext, ActionHooks, ActionRun, ServerAction } from '../runtime/action'
4
4
  import type { ErrorShape } from '../runtime/api-error'
5
5
  import type { BeforeHook, Hook } from './hooks'
6
6
  import { resolveProtection } from '../runtime/action-protection'
@@ -31,30 +31,30 @@ export function hasHooks(lists: ActionHookLists): boolean {
31
31
  }
32
32
 
33
33
  // The `context` of an action's hooks: the action's own, read through it as it is lazy, with who asks.
34
- async function contextOf({ ctx }: ActionRun): Promise<ActionHookContext> {
34
+ async function contextOf(ctx: ActionContext): Promise<ActionHookContext> {
35
35
  const { ip, userAgent, userId } = await hookContext()
36
36
 
37
37
  return Object.create(ctx, { ip: { value: ip, enumerable: true }, userAgent: { value: userAgent, enumerable: true }, userId: { value: userId, enumerable: true } }) as ActionHookContext
38
38
  }
39
39
 
40
40
  // The `beforeRun` hooks of a run: the refusal when one stops it.
41
- export async function refusedBeforeRun(lists: ActionHookLists, event: ActionRun): Promise<(ErrorShape & { retryAfter?: number | undefined }) | undefined> {
41
+ export async function refusedBeforeRun(lists: ActionHookLists, event: ActionRun, ctx: ActionContext): Promise<(ErrorShape & { retryAfter?: number | undefined }) | undefined> {
42
42
  if (lists.before.length === 0)
43
43
  return undefined
44
44
 
45
- const answer = await decide('actions.beforeRun', lists.before, event, await contextOf(event))
45
+ const answer = await decide('actions.beforeRun', lists.before, event, await contextOf(ctx))
46
46
 
47
47
  return 'refused' in answer ? answer.refused : undefined
48
48
  }
49
49
 
50
- export async function tellSuccess(lists: ActionHookLists, event: ActionRun, result: unknown): Promise<void> {
50
+ export async function tellSuccess(lists: ActionHookLists, event: ActionRun, ctx: ActionContext, result: unknown): Promise<void> {
51
51
  if (lists.success.length > 0)
52
- await dispatch('actions.onSuccess', lists.success, { ...event, result }, { context: await contextOf(event) })
52
+ await dispatch('actions.onSuccess', lists.success, { ...event, result }, { context: await contextOf(ctx) })
53
53
  }
54
54
 
55
- export async function tellError(lists: ActionHookLists, event: ActionRun, failure: Pick<ActionFailed, 'status' | 'message' | 'errors' | 'data' | 'error'>): Promise<void> {
55
+ export async function tellError(lists: ActionHookLists, event: ActionRun, ctx: ActionContext, failure: Pick<ActionFailed, 'status' | 'message' | 'errors' | 'data' | 'error'>): Promise<void> {
56
56
  if (lists.error.length > 0)
57
- await dispatch('actions.onError', lists.error, { ...event, ...failure }, { context: await contextOf(event) })
57
+ await dispatch('actions.onError', lists.error, { ...event, ...failure }, { context: await contextOf(ctx) })
58
58
  }
59
59
 
60
60
  // The action as one app serves it, with the app's `actions` defaults laid under its own options key by key: a check the action names replaces the app's, `messages` merge one level, and `protect: false` keeps the app's checks out (its `maxSize` and `messages` still apply). The action itself is left as declared, so two apps in one process (a test site after another) each read their own defaults.
@@ -3,7 +3,7 @@ import type { Elysia, TSchema } from 'elysia'
3
3
  import type { Server } from 'elysia/universal'
4
4
  import type { ActionsConfig } from '../config'
5
5
  import type { GuardContext, Locals, RouteParams } from '../runtime'
6
- import type { ActionContext, ActionRun, FieldErrors, RateKeyContext, ServerAction } from '../runtime/action'
6
+ import type { ActionContext, ActionRun, RateKeyContext, ServerAction } from '../runtime/action'
7
7
  import type { Locale } from '../runtime/i18n'
8
8
  import type { LocaleState } from '../runtime/locale-state'
9
9
  import type { ActionHookLists } from './action-hooks'
@@ -21,7 +21,7 @@ import type { ToolOutputs } from './tool-outputs'
21
21
  import type { Source } from './validate'
22
22
  import { relative } from 'node:path'
23
23
  import { KayError } from '../compiler/errors'
24
- import { decodeCall, failure, FORM_CALL, FORM_FIELD, honeypotField, isAction, isFailure, protectionFields, STAMP_FIELD } from '../runtime/action'
24
+ import { decodeCall, FORM_CALL, FORM_FIELD, honeypotField, isAction, isFailure, protectionFields, STAMP_FIELD } from '../runtime/action'
25
25
  import { joinBase } from '../runtime/base'
26
26
  import { escapeAttribute } from '../runtime/escape'
27
27
  import { localeState, runInLocale } from '../runtime/locale-state'
@@ -602,14 +602,13 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
602
602
  status = code
603
603
  },
604
604
  ...actionStoppers(request),
605
- fail: <Data>(code: number, data?: Data, errors?: FieldErrors) => failure(code, data as Data, errors),
606
605
  }
607
606
 
608
607
  const { lists } = named
609
- const run: ActionRun = { action: named.name, file: named.file, input: context.body, ctx }
608
+ const run: ActionRun = { action: named.name, file: named.file, input: context.body }
610
609
 
611
610
  try {
612
- const stopping = await refusedBeforeRun(lists, run)
611
+ const stopping = await refusedBeforeRun(lists, run, ctx)
613
612
 
614
613
  if (stopping !== undefined) {
615
614
  if (stopping.retryAfter !== undefined)
@@ -630,9 +629,9 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
630
629
  // What `ctx.once` loaded before the handler changed things is stale for the page rendered again after a failure.
631
630
  forgetOnces(request)
632
631
 
633
- // A string passed to `ctx.fail` is the form's message, read where a rate limit's is.
632
+ // A library's failed result, such as kayjs-auth's, returned as it is: its status and `data` refuse the call, a string `data` being the form's message.
634
633
  if (isFailure(result)) {
635
- await tellError(lists, run, { status: result.status, message: typeof result.data === 'string' ? result.data : result.errors?.[''] ?? '', errors: result.errors ?? {}, data: result.data, error: undefined })
634
+ await tellError(lists, run, ctx, { status: result.status, message: typeof result.data === 'string' ? result.data : result.errors?.[''] ?? '', errors: result.errors ?? {}, data: result.data, error: undefined })
636
635
 
637
636
  return await failed(request, headers, jar.cookies, { action: action.url, status: result.status, values: submittedValues(context.body), errors: { ...typeof result.data === 'string' ? { '': result.data } : {}, ...result.errors }, data: result.data }, context.server, back)
638
637
  }
@@ -642,7 +641,7 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
642
641
  const answer = isAsyncIterable(result) ? await (streams ? started : lastOf)(gathering(result, invalidated, askedKeys(request)), requestSignal(request)) : result
643
642
 
644
643
  await countGoneThrough(action, request, context.server, options)
645
- await tellSuccess(lists, run, answer)
644
+ await tellSuccess(lists, run, ctx, answer)
646
645
 
647
646
  // A stream names its keys on its end event, as the handler goes on invalidating until then.
648
647
  invalidatedHeader(invalidated, headers, isCall(request) && !streams)
@@ -655,11 +654,11 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
655
654
  // Sent on after it went through, as to a thank-you page.
656
655
  if (error instanceof Redirect) {
657
656
  await countGoneThrough(action, request, context.server, options)
658
- await tellSuccess(lists, run, undefined)
657
+ await tellSuccess(lists, run, ctx, undefined)
659
658
  }
660
659
 
661
660
  if (error instanceof Denied || error instanceof NotFound)
662
- await tellError(lists, run, { status: error instanceof Denied ? error.status : 404, message: error instanceof Denied ? error.message : 'Not Found', errors: {}, data: undefined, error })
661
+ await tellError(lists, run, ctx, { status: error instanceof Denied ? error.status : 404, message: error instanceof Denied ? error.message : 'Not Found', errors: {}, data: undefined, error })
663
662
 
664
663
  if (error instanceof Redirect || error instanceof Denied || error instanceof NotFound)
665
664
  return stopped(error, request, state, options)
@@ -672,7 +671,7 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
672
671
 
673
672
  // A library's limit, such as kayjs-ai's, answers like the action's own rate limit.
674
673
  if (refused !== undefined) {
675
- await tellError(lists, run, { status: refused.status, message: refused.message, errors: refused.errors, data: refused.data, error })
674
+ await tellError(lists, run, ctx, { status: refused.status, message: refused.message, errors: refused.errors, data: refused.data, error })
676
675
 
677
676
  if (refused.retryAfter !== undefined)
678
677
  headers.set('retry-after', String(refused.retryAfter))
@@ -682,7 +681,7 @@ async function runAction(action: ServerAction<TSchema, unknown>, context: { body
682
681
 
683
682
  // A mistake, or a service the handler relies on gone down: logged as any server error, and told the visitor beside the form they keep, as a refusal is.
684
683
  reportServerError(error, request, options.onError)
685
- await tellError(lists, run, { status: 500, message: 'Internal server error', errors: {}, data: undefined, error })
684
+ await tellError(lists, run, ctx, { status: 500, message: 'Internal server error', errors: {}, data: undefined, error })
686
685
 
687
686
  return failed(request, headers, jar.cookies, { action: action.url, status: 500, values: submittedValues(context.body), errors: { '': await serverErrorMessage(action, error, ctx, request, options.onError) } }, context.server, back)
688
687
  }
@@ -719,7 +718,7 @@ async function countGoneThrough(action: ServerAction<TSchema, unknown>, request:
719
718
  }
720
719
  }
721
720
 
722
- // A call gets the result; a plain form post goes back to the page it came from, which reads the result through `succeeded()`.
721
+ // A call gets the result; a plain form post goes back to the page it came from, which reads the result through `data()`.
723
722
  function succeeded(action: ServerAction<TSchema, unknown>, request: Request, jar: CookieJar, headers: Headers, result: unknown, status: number, base = ''): Response {
724
723
  if (!isCall(request))
725
724
  writeSuccess(jar.cookies, { action: action.url, succeeded: true, data: result, page: new URL(backTo(request, base), 'http://kay').pathname }, overHttps(request), base)
@@ -791,7 +790,7 @@ async function failed(request: Request, headers: Headers, cookies: CookieMap, fl
791
790
  headers.set('content-type', 'application/json')
792
791
  headers.set(FAILURE_HEADER, '1')
793
792
 
794
- return new Response(encodeOrExplain({ errors: flash.errors, data: flash.data }, `what ${flash.action} passed to ctx.fail`), { status: flash.status, headers })
793
+ return new Response(encodeOrExplain({ errors: flash.errors, data: flash.data }, `what ${flash.action} passed to ctx.deny`), { status: flash.status, headers })
795
794
  }
796
795
 
797
796
  // The page renders as for a visit, through the app, its guards and hooks included, and the failure reaches `form.failed()` in memory, so all the visitor typed comes back whatever its length.
@@ -22,7 +22,7 @@ export interface ApiModule {
22
22
  mount: string
23
23
  // The `_guard.ts` files of its directory and above, outermost first.
24
24
  guards: ApiGuard[]
25
- // No guard is asked of it on a site with `requireGuards`: it sets `api({ guards: false })`, or a library serves it.
25
+ // No guard is asked of it on a site with `guards.default` closed: it sets `api({ guards: false })`, or a library serves it.
26
26
  open?: true | undefined
27
27
  // The extension whose `api` directory holds it, whose `ExtensionApp` a module exporting a function is called with.
28
28
  extension?: string | undefined
@@ -46,9 +46,8 @@ export const REFERENCE_PATH = `${API_PREFIX}/reference`
46
46
  export function apiPathOf(value: string | undefined): string {
47
47
  return value === undefined ? API_PREFIX : servedPath(value, 'endpoints.api')
48
48
  }
49
- // Where `mcp` serves the app's tools, and where it did before 1.105, which is answered in place until 2.0.
49
+ // Where `mcp` serves the app's tools.
50
50
  export const MCP_PATH = '/_kay/mcp'
51
- export const FORMER_MCP_PATH = '/mcp'
52
51
  // Where an MCP client finds how to sign in, which the endpoint's 401 points to.
53
52
  export const RESOURCE_METADATA = '/.well-known/oauth-protected-resource'
54
53
  const SERVED_PATH = /^\/[\w.~-]+(?:\/[\w.~-]+)*$/
@@ -35,7 +35,7 @@ import { kayLog } from '../runtime/log'
35
35
  import { BUILD_HEADER, DRAFT_ROUTE } from '../runtime/swap'
36
36
  import { registerActionRoutes } from './actions'
37
37
  import { serveApi } from './api'
38
- import { apiPathOf, FORMER_MCP_PATH, mcpInstructions, mcpRateLimit, RESOURCE_METADATA, sharedGuards } from './api-modules'
38
+ import { apiPathOf, mcpInstructions, mcpRateLimit, RESOURCE_METADATA, sharedGuards } from './api-modules'
39
39
  import { hookLifecycle, hookRequests } from './app-hooks'
40
40
  import { rebaseCss, rebaseRedirects } from './base'
41
41
  import { DEFAULT_BODY_LIMIT, limitBodies, mountLimits } from './body'
@@ -66,7 +66,7 @@ import { liveConnections, serveLive } from './live'
66
66
  import { warnOfLocalFiles } from './local-files'
67
67
  import { announceStart, loggerOf, logRequests, pathOf, requestRefusalLogger, useLogger } from './log'
68
68
  import { mcpBodyLimit, receiveDispatched, serveMcp, serveToolCallsThrough } from './mcp'
69
- import { FORMER_METRICS_PATH, METRICS_PATH, metricsOf, serveMetrics } from './metrics'
69
+ import { METRICS_PATH, metricsOf, serveMetrics } from './metrics'
70
70
  import { newTabStyles } from './new-tab'
71
71
  import { countMissing, knowRedirects } from './not-found'
72
72
  import { INSTALL_OFFER, serveServiceWorker } from './offline'
@@ -178,15 +178,10 @@ interface BootInput {
178
178
  late: LateApp
179
179
  mcpAt: string | undefined
180
180
  mcpKey: string | false | undefined
181
- // What `requireGuards` came to once the routes were scanned.
181
+ // What `guards.default` came to once the routes were scanned.
182
182
  required: GuardRequirement
183
183
  }
184
184
 
185
- // The paths a request for the MCP endpoint may come in at: its own, and the former one while it redirects.
186
- function mcpEndpoints(at: string | undefined, former: Claim | undefined, served: ServedPaths): string[] {
187
- return [...at === undefined ? [] : [at], ...former !== undefined && served.holds(former) ? [former.path] : []]
188
- }
189
-
190
185
  // What every stage shares, worked out from the setup before the first hook.
191
186
  export function bootOf(input: BootInput) {
192
187
  const { env, project: { config: options }, setup: { client, scripts, styles, locales } } = input
@@ -199,10 +194,6 @@ export function bootOf(input: BootInput) {
199
194
  // Offered, so an app file at the path keeps it; only a running server counts, as `kay dev` restarts on every change and an export serves nothing.
200
195
  const metricsConfig = env.serving ? metricsOf(options.ops?.metrics) : undefined
201
196
  const metrics: Claim | undefined = metricsConfig && { path: options.endpoints?.metrics ?? METRICS_PATH, owner: 'the metrics route', kind: 'kay' }
202
- // Where the MCP endpoint was served before 1.105, answered in place until 2.0 by an app that did not move it, unless an app file serves something there.
203
- const formerMcp: Claim | undefined = input.mcpAt !== undefined && options.endpoints?.mcp === undefined ? { path: FORMER_MCP_PATH, owner: '`mcp`', kind: 'kay', method: 'ALL' } : undefined
204
- // Where the metrics were served before 1.105, answered as well until 1.108 by an app that did not move them, unless an app file serves something there.
205
- const formerMetrics: Claim | undefined = metrics && options.endpoints?.metrics === undefined ? { path: FORMER_METRICS_PATH, owner: 'the metrics route', kind: 'kay' } : undefined
206
197
  // Offered, so an app file at the path keeps it; the check is served once every claim is in, and only where it still holds the path.
207
198
  const health: Claim | undefined = options.ops?.health === false ? undefined : { path: options.endpoints?.health ?? HEALTH_PATH, owner: 'the health check', kind: 'kay' }
208
199
  const log = loggerOf(options.ops?.observe?.log, env.production)
@@ -222,9 +213,6 @@ export function bootOf(input: BootInput) {
222
213
  lifecycle: { draining: false },
223
214
  hasPreview: options.preview !== undefined && options.preview !== false,
224
215
  metrics,
225
- formerMetrics,
226
- // Where the MCP endpoint was served before 1.105, answered as the endpoint is until 2.0 by an app that did not move it, unless an app file serves something there.
227
- formerMcp,
228
216
  health,
229
217
  registered,
230
218
  // Maps a browser's stack back to the source, for the error reports and the dev tool.
@@ -270,9 +258,8 @@ export function knowPages({ app, env, options, setup: { matchers }, routes, tabl
270
258
  }
271
259
 
272
260
  // Only a kept page reads the count, so a build keeping none registers no hook for it.
273
- export function keptPageWrites({ app, setup: { client }, mcpAt, formerMcp, served }: Boot): Writes {
274
- // The former path is exempt only where kay serves it: a route of the app at `/mcp` keeps counting.
275
- const own = () => [...mcpAt === undefined ? [] : [mcpAt], ...formerMcp !== undefined && served.holds(formerMcp) ? [formerMcp.path] : []]
261
+ export function keptPageWrites({ app, setup: { client }, mcpAt }: Boot): Writes {
262
+ const own = () => mcpAt === undefined ? [] : [mcpAt]
276
263
 
277
264
  return [...client.pages.values()].some(page => page.kept === true) ? countWrites(app, own) : NO_WRITES
278
265
  }
@@ -310,7 +297,7 @@ function hostsToAnswer(setting: SecurityConfig | boolean | undefined, site: stri
310
297
 
311
298
  // Who the request is from and whether it may come, as the steps of `receive`: the proxy it came through, the server's own mark, the proxy key, the dev hosts, the hosts; then the security headers on every answer.
312
299
  // The steps run in kay's pipeline, which Elysia's first `onRequest` hook hands every request to while the routes are not on kay's table.
313
- export function trustRequests({ app, kay, env, options, project, served, security, filePaths, setup, mcpAt, mcpKey, metrics, formerMetrics, formerMcp, log, health }: Boot): void {
300
+ export function trustRequests({ app, kay, env, options, project, served, security, filePaths, setup, mcpAt, mcpKey, metrics, log, health }: Boot): void {
314
301
  const { receive } = kay.pipeline.phases
315
302
 
316
303
  setRequestIdHeader(options.ops?.observe?.requestIdHeader)
@@ -321,7 +308,7 @@ export function trustRequests({ app, kay, env, options, project, served, securit
321
308
  receiveInternal(request)
322
309
  })
323
310
 
324
- const key = requireProxyKey(checkProxy(options.proxy), { root: setup.source.runtimeRoot(project.root), dev: env.dev, exported: env.exported, base: env.base, health: health?.path, endpoint: mcpKey === undefined ? undefined : () => mcpEndpoints(mcpAt, formerMcp, served), metrics: () => [metrics, formerMetrics].flatMap(claim => claim !== undefined && served.holds(claim) ? [claim.path] : []), logRefused: requestRefusalLogger(log), security })
311
+ const key = requireProxyKey(checkProxy(options.proxy), { root: setup.source.runtimeRoot(project.root), dev: env.dev, exported: env.exported, base: env.base, health: health?.path, endpoint: mcpKey === undefined ? undefined : () => mcpAt === undefined ? [] : [mcpAt], metrics: () => metrics !== undefined && served.holds(metrics) ? [metrics.path] : [], logRefused: requestRefusalLogger(log), security })
325
312
  const foreign = refuseForeignHosts(setup.site, security)
326
313
  const hosts = hostsToAnswer(options.security, setup.site, env)
327
314
 
@@ -407,7 +394,7 @@ export function identifyRequests({ app, env, setup: { client } }: Boot): void {
407
394
  }
408
395
 
409
396
  // kay's endpoints answered ahead of the extensions: the health check, the metrics and the public env, with the jobs page's path claimed. Returns the jobs page, served after the extensions whose values its guard reads.
410
- export function kayEndpoints({ app, env, options, project, setup, served, lifecycle, health, metrics, formerMetrics, security }: Boot, publicModules: string[]) {
397
+ export function kayEndpoints({ app, env, options, project, setup, served, lifecycle, health, metrics, security }: Boot, publicModules: string[]) {
411
398
  if (health) {
412
399
  served.offer(health)
413
400
  // Before the extension servers, whose hooks it answers ahead of; it answers only where the claims, known once all are in, leave it the path.
@@ -423,10 +410,7 @@ export function kayEndpoints({ app, env, options, project, setup, served, lifecy
423
410
  if (metrics) {
424
411
  served.offer(metrics)
425
412
 
426
- if (formerMetrics)
427
- served.offer(formerMetrics)
428
-
429
- serveMetrics(app, { root: setup.source.runtimeRoot(project.root), path: metrics.path, base: env.base, proxy: checkProxy(options.proxy), token: metricsOf(options.ops?.metrics)?.token, health: health?.path, holds: () => served.holds(metrics), former: formerMetrics && { path: formerMetrics.path, holds: () => served.holds(formerMetrics) }, connections: liveConnections })
413
+ serveMetrics(app, { root: setup.source.runtimeRoot(project.root), path: metrics.path, base: env.base, proxy: checkProxy(options.proxy), token: metricsOf(options.ops?.metrics)?.token, health: health?.path, holds: () => served.holds(metrics), connections: liveConnections })
430
414
  }
431
415
 
432
416
  if (options.publicEnv)
@@ -591,7 +575,7 @@ type Served = Awaited<ReturnType<typeof appRoutes>>
591
575
  // The rules a redirect added while the site runs is checked against, the API's claims and the body limits of every route. Returns where the OpenAPI document and the MCP metadata go.
592
576
  // Not async, as the closures the runtime redirects keep past the app would hold an async function's parameters, the app among them.
593
577
  export function limitBodiesAndClaimApi(boot: Boot, { actionLimits, api, endpointLimits }: Served, servers: unknown[]) {
594
- const { app, env, options, served, setup: { client }, table, hasPreview, mcpAt, formerMcp } = boot
578
+ const { app, env, options, served, setup: { client }, table, hasPreview, mcpAt } = boot
595
579
  // Claimed before kay's own files, which give way to them.
596
580
  const openapi = openApiSettings(options.openapi)
597
581
  const apiAt = apiPathOf(options.endpoints?.api)
@@ -618,15 +602,13 @@ export function limitBodiesAndClaimApi(boot: Boot, { actionLimits, api, endpoint
618
602
  }
619
603
  }
620
604
 
621
- const formerAt = formerMcp && served.offer(formerMcp) ? formerMcp.path : undefined
622
-
623
- limitBodies(app, options.limits?.body ?? DEFAULT_BODY_LIMIT, new Map([...actionLimits, ...hasPreview ? [[DRAFT_ROUTE, DRAFT_BODY_LIMIT] as const] : [], ...mcpAt === undefined ? [] : [[mcpAt, mcpBodyLimit] as const], ...formerAt === undefined ? [] : [[formerAt, mcpBodyLimit] as const]]), mountLimits(api.limits, options.extensions, options.limits?.byPath, servers), [...api.routeLimits, ...endpointLimits])
605
+ limitBodies(app, options.limits?.body ?? DEFAULT_BODY_LIMIT, new Map([...actionLimits, ...hasPreview ? [[DRAFT_ROUTE, DRAFT_BODY_LIMIT] as const] : [], ...mcpAt === undefined ? [] : [[mcpAt, mcpBodyLimit] as const]]), mountLimits(api.limits, options.extensions, options.limits?.byPath, servers), [...api.routeLimits, ...endpointLimits])
624
606
 
625
- return { openapi, apiAt, servesOpenApi, metadataPaths, formerAt }
607
+ return { openapi, apiAt, servesOpenApi, metadataPaths }
626
608
  }
627
609
 
628
610
  // The OpenAPI document and the MCP endpoint, registered last before the pages.
629
- export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }: Served, actionOptions: ActionOptions, { openapi, apiAt, servesOpenApi, metadataPaths, formerAt }: ReturnType<typeof limitBodiesAndClaimApi>): Promise<void> {
611
+ export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }: Served, actionOptions: ActionOptions, { openapi, apiAt, servesOpenApi, metadataPaths }: ReturnType<typeof limitBodiesAndClaimApi>): Promise<void> {
630
612
  const { app, env, options, required, setup: { locales }, project: { paths }, mcpAt, mcpKey } = boot
631
613
 
632
614
  // The actions that opted in to being tools are in the document beside the routes, and the MCP endpoint reads its tools from it.
@@ -642,7 +624,7 @@ export async function apiDocuments(boot: Boot, { toolActions, apiModules, api }:
642
624
  serveOpenApi(app, document, openapi, await covering(false), actionOptions, apiAt, options.endpoints?.openapi)
643
625
 
644
626
  if (mcpAt !== undefined && document) {
645
- serveMcp(app, document, { title: (document.info as { title: string }).title, version: (document.info as { version: string }).version, base: env.base, guards: await covering(true), actions: actionOptions, metadataPaths, path: mcpAt, former: formerAt, rateLimit: mcpRateLimit(options.mcp), instructions: mcpInstructions(options.mcp), key: mcpKey, dev: env.dev, outputs: actionOptions.toolOutputs })
627
+ serveMcp(app, document, { title: (document.info as { title: string }).title, version: (document.info as { version: string }).version, base: env.base, guards: await covering(true), actions: actionOptions, metadataPaths, path: mcpAt, rateLimit: mcpRateLimit(options.mcp), instructions: mcpInstructions(options.mcp), key: mcpKey, dev: env.dev, outputs: actionOptions.toolOutputs })
646
628
  }
647
629
  }
648
630
 
@@ -665,7 +647,7 @@ export function reports({ app, options, setup: { i18n, site, collections }, hasP
665
647
  // The paths the config names resolve where the server runs, and development serves WebP, so a page's first load does not wait on AVIF encoding.
666
648
  // What `images.resolve` runs behind: the `guards` given, none when they are `false`, and a refusal when the app gave none, as every feature reading private files closes.
667
649
  function imageGuard(images: NonNullable<KayConfig['assets']>['images']): Guard | undefined {
668
- const given = images?.guards ?? images?.guard
650
+ const given = images?.guards
669
651
 
670
652
  if (given === false)
671
653
  return undefined
package/src/server/app.ts CHANGED
@@ -12,6 +12,7 @@ import type { Scanned } from './setup'
12
12
  import { join } from 'node:path'
13
13
  import { Elysia } from 'elysia'
14
14
  import { KayError } from '../compiler/errors'
15
+ import { CONFIG_KEYS } from '../config-shape'
15
16
  import { refuseFeedsWithoutSite } from '../content/server'
16
17
  import { mcpInstructions, mcpPath, mcpRateLimit } from './api-modules'
17
18
  import { actionOptionsOf, apiDocuments, appRoutes, bootOf, bootWarnings, buildFiles, compressAnswers, files, hookLifecycleOf, hookRequestsOf, identifyRequests, kayEndpoints, keptPageWrites, knowPages, lateApp, limitBodiesAndClaimApi, logAnswers, pageRoutes, reports, rewriteAnswers, serveDevRoutes, serverMode, siteFiles, stopOnSignals, trustRequests, useExtensions } from './app-stages'
@@ -38,8 +39,8 @@ import { ServedPaths } from './served-paths'
38
39
  import { setupPages } from './setup'
39
40
  import { projectSource } from './source'
40
41
 
41
- // The options of `pages()` and `testSite()`: `config` holds what wins over the project's `kay.config.ts`, key by key, one bag level deep. The config's keys written beside `root` instead work until 1.108, as `deprecated-pages-options` rewrites them.
42
- export interface PagesOptions extends ConfigInput {
42
+ // The options of `pages()` and `testSite()`: `config` holds what wins over the project's `kay.config.ts`, key by key, one bag level deep.
43
+ export interface PagesOptions {
43
44
  // Config laid over the project's `kay.config.ts`, as `kay.config.ts` writes it: `pages({ config: { client: { navigation: false } } })`.
44
45
  config?: ConfigInput | undefined
45
46
  // Project root: island ids and `.kay/` output are relative to it. Defaults to the working directory.
@@ -50,9 +51,13 @@ export interface PagesOptions extends ConfigInput {
50
51
  prebuilt?: boolean | undefined
51
52
  }
52
53
 
53
- // The options with the keys of `config` laid over those written beside it, the way an app wrote them before 1.105, so what reads the options sees the config's keys at one level; a key given in both is the one of `config`.
54
- export function flatOptions<Options extends PagesOptions>(options: Options): Omit<Options, 'config'> {
54
+ // The options with the keys of `config` laid at one level beside the others, so what reads the options sees the config's keys together. A config key written beside `root` is refused.
55
+ export function flatOptions<Options extends PagesOptions>(options: Options): Omit<Options, 'config'> & ConfigInput {
55
56
  const { config, ...rest } = options
57
+ const beside = Object.keys(rest).filter(key => CONFIG_KEYS.has(key))
58
+
59
+ if (beside.length > 0)
60
+ throw new KayError('config-invalid', `kay: the options have config keys beside \`root\`: ${beside.map(key => `\`${key}\``).join(', ')}; write them in \`config\``)
56
61
 
57
62
  return config === undefined ? rest : { ...rest, ...Object.fromEntries(Object.entries(config).filter(([, value]) => value !== undefined)) }
58
63
  }
@@ -182,7 +187,7 @@ export async function pagesApp(project: Project<ServedOptions>, loadClient: () =
182
187
  const setup = await setupPages(project, loadClient, false, late.spell, scanned => refuseScanned(project, scanned), exported)
183
188
  const { served, table, publicServed, redirects, mcpAt } = setup.claimed
184
189
 
185
- // The API modules are read here, as an unset `requireGuards` comes to what the app's own routes, endpoints and API modules guard.
190
+ // The API modules are read here, as an unset `guards.default` comes to what the app's own routes, endpoints and API modules guard.
186
191
  const required = guardRequirement(requiredBy(options), setup.routes, setup.endpoints, await setup.api)
187
192
  const routes = await servedRoutes(setup.routes, setup.claimed.routes, required)
188
193
  const app = new Elysia({ name: 'kay/pages', seed: root })
@@ -21,8 +21,6 @@ export interface AuthMailData {
21
21
  locale: string
22
22
  // How long the mail's link and its code work, for the ones it carries, as durations: `{ link: '24h', code: '10m' }`. `lifetime(duration, locale)` words them.
23
23
  ttl?: { link?: Duration, code?: Duration } | undefined
24
- /** @deprecated Written `ttl`; `deprecated-ttl-names` rewrites it. Removed in 1.108. */
25
- maxAge?: { link?: Duration, code?: Duration } | undefined
26
24
  }
27
25
 
28
26
  const LINK = 'https://example.com/auth?token=sample'
@@ -1,13 +1,18 @@
1
- import { existsSync, readFileSync, statSync } from 'node:fs'
2
- import { dirname, join } from 'node:path'
1
+ import { existsSync, readFileSync, realpathSync, statSync } from 'node:fs'
2
+ import { dirname, join, sep } from 'node:path'
3
3
 
4
4
  // What the environment loader and the commands that run without it share, apart from `./env` so `kay check` and the editor load no Elysia.
5
5
  // On the global object, so a copy of kay the app loads beside the CLI's sees it too.
6
6
  const BUILDING = Symbol.for('kay.building')
7
+ const LISTED = Symbol.for('kay.envListed')
7
8
 
8
9
  // `kay build` renders pages, and `kay check` reads content and messages, without the server's environment: from then on a variable missing or refused fails the page reading it rather than the module declaring it.
9
10
  export function buildingWithoutEnv(): void {
10
- (globalThis as { [BUILDING]?: boolean })[BUILDING] = true
11
+ const holder = globalThis as { [BUILDING]?: boolean, [LISTED]?: DeclaredEnv[] }
12
+
13
+ holder[BUILDING] = true
14
+ // The calls of `defineEnv` from here on are kept, so a module the config imports, which `kay env` cannot import again, still lists.
15
+ holder[LISTED] ??= []
11
16
  }
12
17
 
13
18
  const LOADING = Symbol.for('kay.loading')
@@ -22,9 +27,10 @@ export function loading(): boolean {
22
27
  return (globalThis as { [LOADING]?: boolean })[LOADING] === true
23
28
  }
24
29
 
25
- const LISTED = Symbol.for('kay.envListed')
26
30
  // The caller's file in a stack frame such as `at /app/src/env.ts:3:20` or `at env (file:///app/src/env.ts:3:20)`.
27
31
  const FRAME_FILE = /^at (?:.*? \()?(?:file:\/\/)?(\/[^():]+):\d+:\d+\)?$/
32
+ // A module imported under a query to read it again is the file before it.
33
+ const QUERY = /\?.*$/
28
34
  // A library of kay declares its variables for the app that builds it, so the app's module is the one to list them under.
29
35
  const KAY_LIBRARY = /^@kayjs\/(?!kay(?:\/|$))/
30
36
  const libraries = new Map<string, boolean>()
@@ -38,13 +44,11 @@ export interface DeclaredEnv {
38
44
  file?: string | undefined
39
45
  }
40
46
 
41
- // `kay env` loads the modules calling `defineEnv` and takes each schema as it is declared: from then on every call is recorded.
47
+ // Every call of `defineEnv` since a command began building without the environment, the config's own imports included, as `kay env` cannot import a module the config already loaded again. The listing takes the calls of its project and reads the modules calling `defineEnv` that are left.
42
48
  export function listingEnv(): DeclaredEnv[] {
43
- const found: DeclaredEnv[] = []
49
+ const holder = globalThis as { [LISTED]?: DeclaredEnv[] }
44
50
 
45
- ;(globalThis as { [LISTED]?: DeclaredEnv[] })[LISTED] = found
46
-
47
- return found
51
+ return holder[LISTED] ??= []
48
52
  }
49
53
 
50
54
  export function recordEnv(schema: EnvSchemaRecord, declaredBy: (...args: never[]) => unknown): void {
@@ -56,6 +60,32 @@ export function recordEnv(schema: EnvSchemaRecord, declaredBy: (...args: never[]
56
60
  found.push({ schema, file: callerFile(declaredBy) })
57
61
  }
58
62
 
63
+ function realOf(path: string): string {
64
+ try {
65
+ return realpathSync(path)
66
+ }
67
+ catch {
68
+ return path
69
+ }
70
+ }
71
+
72
+ // A module read again declares afresh: what it declared before is dropped, whatever the stack of each load. A folder drops every module under it, a path through a link matches the file it leads to, and a file that no longer loads or exists is dropped all the same.
73
+ export function forgetEnvCalls(path: string): void {
74
+ const found = (globalThis as { [LISTED]?: DeclaredEnv[] })[LISTED]
75
+
76
+ if (found === undefined)
77
+ return
78
+
79
+ const target = realOf(path.replace(QUERY, ''))
80
+
81
+ for (let index = found.length - 1; index >= 0; index--) {
82
+ const file = found[index]!.file
83
+
84
+ if (file !== undefined && (realOf(file) === target || realOf(file).startsWith(`${target}${sep}`)))
85
+ found.splice(index, 1)
86
+ }
87
+ }
88
+
59
89
  // The file that called `declaredBy`, a library of kay's call counted as its caller's: the frames above `declaredBy` are left out, so the first one left is whoever called it.
60
90
  export function callerFile(declaredBy: (...args: never[]) => unknown): string | undefined {
61
91
  const holder: { stack?: string } = {}
@@ -64,7 +94,7 @@ export function callerFile(declaredBy: (...args: never[]) => unknown): string |
64
94
 
65
95
  const files = (holder.stack ?? '').split('\n').map(line => FRAME_FILE.exec(line.trim())?.[1])
66
96
 
67
- return files.find(file => file !== undefined && !inLibrary(file))
97
+ return files.find(file => file !== undefined && !inLibrary(file))?.replace(QUERY, '')
68
98
  }
69
99
 
70
100
  // Whether `file` belongs to a package of kay's libraries, by the name in the nearest package.json.
@@ -48,7 +48,7 @@ export function handedOverFlash(request: Request): Flash | undefined {
48
48
  return id === null ? undefined : handedOver.get(id)
49
49
  }
50
50
 
51
- // The page the browser goes back to reads it through `succeeded()`, unless it cannot be carried there.
51
+ // The page the browser goes back to reads it through `data()`, unless it cannot be carried there.
52
52
  export function writeSuccess(cookies: CookieMap, success: SuccessFlash, secure = false, base = ''): void {
53
53
  const refusal = setFlash(cookies, success, secure, base)
54
54
 
@@ -1,11 +1,11 @@
1
1
  // What a start does with a route no guard covers: `true` refuses every page, layout with actions, endpoint and API module of the app, `'routes'` only its pages, endpoints and API modules, `false` none.
2
2
  export type GuardRequirement = boolean | 'routes'
3
3
 
4
- // What `guards: { default }` says of the app's routes, `'closed'` being `requireGuards: true` and `'open'` `requireGuards: false`; `requireGuards` stays until 1.108, and `guards.default` wins when both are set. Undefined leaves it to what the routes guard.
5
- export function requiredBy(config: { guards?: { default?: 'open' | 'closed' | undefined } | undefined, requireGuards?: boolean | undefined }): boolean | undefined {
4
+ // What `guards: { default }` says of the app's routes, `'closed'` refusing every route no guard covers and `'open'` none. Undefined leaves it to what the routes guard.
5
+ export function requiredBy(config: { guards?: { default?: 'open' | 'closed' | undefined } | undefined }): boolean | undefined {
6
6
  const given = config.guards?.default
7
7
 
8
- return given === undefined ? config.requireGuards : given === 'closed'
8
+ return given === undefined ? undefined : given === 'closed'
9
9
  }
10
10
 
11
11
  interface Access {
@@ -13,7 +13,7 @@ interface Access {
13
13
  guards: readonly unknown[]
14
14
  }
15
15
 
16
- // What `requireGuards` comes to once the routes are scanned: a setting is taken as it is, and an unset one refuses the routes no guard covers on a site that guards some of its own, which a site with no guard at all (a brochure) leaves open.
16
+ // What `guards.default` comes to once the routes are scanned: a setting is taken as it is, and an unset one refuses the routes no guard covers on a site that guards some of its own, which a site with no guard at all (a brochure) leaves open.
17
17
  // Guards a library mounts on its own routes say nothing of the app's: those routes are `open`, and only the app's own guarded routes mark a site that has started to guard.
18
18
  export function guardRequirement(configured: boolean | undefined, ...routes: Iterable<Access>[]): GuardRequirement {
19
19
  if (configured !== undefined)
@@ -732,10 +732,10 @@ export function sourceFile(whole: string, options: ImageRouteOptions): { path: s
732
732
  }
733
733
 
734
734
  // `images.maxDensity`, `images.widths`, `images.aspects`, `images.remote`, `images.placeholder` and whether `images.resolve` is set, checked and set for every image this process renders, served or prerendered; `inlineStyles` is whether the site's CSP lets an element carry a `style` attribute. Returns the density.
735
- export async function applyImageConfig(images: { maxDensity?: number | undefined, widths?: number[] | undefined, aspects?: string[] | undefined, remote?: { hosts?: string[] | undefined } | undefined, placeholder?: boolean | undefined, resolve?: unknown, guards?: unknown, guard?: unknown } | undefined, inlineStyles = true): Promise<number> {
735
+ export async function applyImageConfig(images: { maxDensity?: number | undefined, widths?: number[] | undefined, aspects?: string[] | undefined, remote?: { hosts?: string[] | undefined } | undefined, placeholder?: boolean | undefined, resolve?: unknown, guards?: unknown } | undefined, inlineStyles = true): Promise<number> {
736
736
  const maxDensity = images?.maxDensity ?? DEFAULT_MAX_DENSITY
737
737
 
738
- if ((images?.guards ?? images?.guard) !== undefined && images?.resolve === undefined)
738
+ if (images?.guards !== undefined && images?.resolve === undefined)
739
739
  throw new KayError('image-invalid', 'kay: images.guards admits the images images.resolve looks up, and images.resolve is not set')
740
740
 
741
741
  if (!(maxDensity >= 1))
@@ -53,8 +53,6 @@ export { shutdown } from './lifecycle'
53
53
  export type { LogEntry, Logger, MessageEntry, RequestEntry } from './log'
54
54
  export type { ToolCall } from './mcp'
55
55
  export { toolCall } from './mcp'
56
- export type { RateLimit, RateLimitRefusal } from './moved-exports'
57
- export { s, sqliteCache } from './moved-exports'
58
56
  export type { Inbox, Notification, NotificationRow, NotificationStore, NotifyOptions, StoredNotification } from './notifications'
59
57
  export { memoryNotifications, notifications, notify, sqliteNotifications } from './notifications'
60
58
  export type { PageHook, RenderedPage } from './page-hook'
@@ -22,11 +22,11 @@ export interface JobContext<Progress = unknown> {
22
22
  locale: Locale
23
23
  }
24
24
 
25
- // The context of a run as the handler is handed it: the run's own signal carrying the fields, so a handler written `(payload, signal, job)` before 1.105 still reads a signal in its second argument.
26
- export function runContext<Progress>(signal: AbortSignal, job: JobRef<Progress>, log: Log): JobContext<Progress> & AbortSignal {
25
+ // The context of a run as the handler is handed it.
26
+ export function runContext<Progress>(signal: AbortSignal, job: JobRef<Progress>, log: Log): JobContext<Progress> {
27
27
  // `Locale` is the app's registered locales where the app declares them, which `siteDefaultLocale()`'s string is not.
28
28
  // eslint-disable-next-line ts/no-unnecessary-type-assertion
29
- return Object.assign(signal, { signal, job, log, locale: siteDefaultLocale() as Locale })
29
+ return { signal, job, log, locale: siteDefaultLocale() as Locale }
30
30
  }
31
31
 
32
32
  // What a run that outlasted its `timeout` fails with, in milliseconds below a second.
@@ -30,7 +30,7 @@ export function jobsPageOf(setting: JobsConfig | undefined, at?: string): JobsPa
30
30
  return undefined
31
31
 
32
32
  const object = typeof setting === 'object' && setting !== null
33
- const given = object ? (setting.guards ?? setting.guard) as unknown : undefined
33
+ const given = object ? setting.guards as unknown : undefined
34
34
 
35
35
  if (given !== undefined && given !== false && !isGuardOption(given))
36
36
  throw new KayError('config-invalid', 'kay: `jobs.guards` takes a guard function, a list of them, `{ load }` returning one, or `false`, such as `jobs: { guards: ctx => ctx.locals.auth.admin.require() }`')
@@ -133,12 +133,8 @@ export type ScheduleCron<Cron extends string = string> = { cron: Cron & CronSche
133
133
  export function schedule<const Every extends Duration>(options: ScheduleEvery<Every>, jobs: Jobs): KayPlugin
134
134
  export function schedule<const Cron extends string>(options: ScheduleCron<Cron>, jobs: Jobs): KayPlugin
135
135
  export function schedule<const Table extends Record<string, Jobs>>(table: Table & { readonly [Key in keyof Table & string]: WhenOf<Key> }, options?: ScheduleOptions): KayPlugin
136
- /** @deprecated `schedule({ cron }, job)` or `schedule({ every }, job)`. Removed in 1.108; `deprecated-schedule-call` rewrites it. */
137
- export function schedule<const Every extends Duration>(every: Every & PositiveDuration<Every>, jobs: Jobs, options?: ScheduleEveryOptions): KayPlugin
138
- /** @deprecated `schedule({ cron }, job)` or `schedule({ every }, job)`. Removed in 1.108; `deprecated-schedule-call` rewrites it. */
139
- export function schedule<const Cron extends string>(cron: Cron & CronSchedule<Cron>, jobs: Jobs, options?: ScheduleOptions): KayPlugin
140
- export function schedule(first: Duration | string | Record<string, Jobs> | ScheduleEvery | ScheduleCron, second?: Jobs | ScheduleOptions, third?: ScheduleOptions) {
141
- const { entries, options } = scheduled(first, second, third)
136
+ export function schedule(first: Record<string, Jobs> | ScheduleEvery | ScheduleCron, second?: Jobs | ScheduleOptions) {
137
+ const { entries, options } = scheduled(first, second)
142
138
 
143
139
  if ('tz' in options)
144
140
  throw new KayError('config-invalid', 'kay: schedule takes timeZone, not tz, which 1.102 dropped')
@@ -164,10 +160,10 @@ export function schedule(first: Duration | string | Record<string, Jobs> | Sched
164
160
  return kayPlugin(plugins.length === 1 ? plugins[0]! : plugins.reduce((app, plugin) => app.use(plugin), new Elysia()))
165
161
  }
166
162
 
167
- // The schedules and the options of a call, whichever of its three shapes it is: an options object with `every` or `cron` and the jobs, a table of schedules to jobs and its options, or, before 1.105, the schedule, the jobs and the options.
168
- function scheduled(first: unknown, second: unknown, third: unknown): { entries: (readonly [Duration | string, Jobs])[], options: ScheduleOptions } {
163
+ // The schedules and the options of a call, whichever of its two shapes it is: an options object with `every` or `cron` and the jobs, or a table of schedules to jobs and its options.
164
+ function scheduled(first: unknown, second: unknown): { entries: (readonly [Duration | string, Jobs])[], options: ScheduleOptions } {
169
165
  if (typeof first !== 'object' || first === null)
170
- return { entries: [[first as Duration | string, second as Jobs]], options: third as ScheduleOptions | undefined ?? {} }
166
+ throw new KayError('config-invalid', 'kay: schedule takes `{ every }`, `{ cron }` or a table of schedules to jobs')
171
167
 
172
168
  if (!('every' in first || 'cron' in first))
173
169
  return { entries: Object.entries(first as Record<string, Jobs>), options: second as ScheduleOptions | undefined ?? {} }
@@ -51,10 +51,8 @@ export const KAY_EXPORTS: Record<string, 'free' | 'request' | 'local'> = {
51
51
  mount: 'free',
52
52
  navigate: 'free',
53
53
  navigation: 'free',
54
- onBeforeNavigate: 'free',
55
54
  onCleanup: 'free',
56
55
  onMount: 'free',
57
- onNavigate: 'free',
58
56
  online: 'free',
59
57
  optimistic: 'free',
60
58
  pageVisible: 'free',