velocious 1.0.461 → 1.0.462

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 (361) hide show
  1. package/build/application.js +1 -3
  2. package/build/background-jobs/cron-expression.js +1 -3
  3. package/build/background-jobs/forked-runner-child.js +1 -3
  4. package/build/background-jobs/job.js +1 -3
  5. package/build/background-jobs/scheduler.js +2 -6
  6. package/build/background-jobs/store.js +2 -6
  7. package/build/background-jobs/web/controller.js +1 -3
  8. package/build/background-jobs/worker.js +1 -3
  9. package/build/beacon/client.js +2 -6
  10. package/build/cli/tenant-database-command-helper.js +1 -3
  11. package/build/configuration.js +29 -32
  12. package/build/controller.js +4 -14
  13. package/build/database/drivers/mssql/index.js +1 -3
  14. package/build/database/drivers/mysql/index.js +2 -6
  15. package/build/database/drivers/pgsql/index.js +1 -3
  16. package/build/database/drivers/sqlite/base.js +3 -9
  17. package/build/database/drivers/sqlite/index.js +3 -9
  18. package/build/database/drivers/sqlite/table.js +1 -3
  19. package/build/database/migrator.js +1 -3
  20. package/build/database/pool/async-tracked-multi-connection.js +20 -45
  21. package/build/database/pool/base-methods-forward.js +2 -10
  22. package/build/database/pool/base.js +5 -15
  23. package/build/database/query/index.js +4 -12
  24. package/build/database/query/join-object.js +3 -9
  25. package/build/database/query/model-class-query.js +21 -63
  26. package/build/database/query/preloader/belongs-to.js +9 -27
  27. package/build/database/query/preloader/has-many.js +7 -21
  28. package/build/database/query/preloader/has-one.js +3 -9
  29. package/build/database/query/preloader.js +6 -18
  30. package/build/database/query/query-data.js +5 -15
  31. package/build/database/query/where-model-class-hash.js +5 -15
  32. package/build/database/query/with-count.js +5 -15
  33. package/build/database/record/acts-as-list.js +10 -38
  34. package/build/database/record/attachments/normalize-input.js +7 -25
  35. package/build/database/record/attachments/storage-drivers/s3.js +4 -12
  36. package/build/database/record/attachments/store.js +2 -6
  37. package/build/database/record/index.js +55 -171
  38. package/build/database/record/instance-relationships/base.js +6 -20
  39. package/build/database/record/instance-relationships/belongs-to.js +2 -6
  40. package/build/database/record/instance-relationships/has-many.js +4 -12
  41. package/build/database/record/instance-relationships/has-one.js +4 -12
  42. package/build/database/record/relationships/base.js +1 -5
  43. package/build/database/record/validators/presence.js +1 -3
  44. package/build/database/record/validators/uniqueness.js +4 -12
  45. package/build/environment-handlers/browser.js +1 -3
  46. package/build/environment-handlers/node/cli/commands/console.js +2 -6
  47. package/build/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
  48. package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
  49. package/build/environment-handlers/node.js +15 -6
  50. package/build/frontend-model-controller.js +34 -110
  51. package/build/frontend-models/base.js +45 -151
  52. package/build/frontend-models/clear-pending-debounced-callback.js +1 -3
  53. package/build/frontend-models/preloader.js +3 -9
  54. package/build/frontend-models/query.js +11 -33
  55. package/build/frontend-models/resource-definition.js +2 -6
  56. package/build/frontend-models/transport-serialization.js +7 -21
  57. package/build/frontend-models/use-destroyed-event.js +2 -6
  58. package/build/frontend-models/use-model-class-event.js +2 -6
  59. package/build/frontend-models/use-updated-event.js +3 -9
  60. package/build/frontend-models/websocket-channel.js +9 -27
  61. package/build/frontend-models/websocket-publishers.js +12 -23
  62. package/build/http-server/client/index.js +6 -18
  63. package/build/http-server/client/params-to-object.js +6 -18
  64. package/build/http-server/client/request-buffer/index.js +1 -3
  65. package/build/http-server/client/request-parser.js +1 -3
  66. package/build/http-server/client/request-runner.js +4 -12
  67. package/build/http-server/client/websocket-session.js +6 -18
  68. package/build/http-server/development-reloader.js +2 -6
  69. package/build/http-server/remote-address.js +1 -5
  70. package/build/http-server/server-client.js +3 -9
  71. package/build/http-server/server-lock.js +2 -6
  72. package/build/http-server/websocket-channel-subscribers.js +2 -6
  73. package/build/http-server/websocket-event-log-store.js +5 -15
  74. package/build/http-server/websocket-events-host.js +1 -3
  75. package/build/http-server/worker-handler/in-process.js +3 -11
  76. package/build/http-server/worker-handler/worker-thread.js +1 -3
  77. package/build/logger.js +2 -6
  78. package/build/mailer/backends/smtp.js +1 -5
  79. package/build/mailer/base.js +4 -16
  80. package/build/plugins/sqljs-wasm-route-controller.js +1 -3
  81. package/build/routes/basic-route.js +1 -3
  82. package/build/routes/resolver.js +4 -14
  83. package/build/src/application.d.ts.map +1 -1
  84. package/build/src/application.js +2 -4
  85. package/build/src/background-jobs/cron-expression.d.ts.map +1 -1
  86. package/build/src/background-jobs/cron-expression.js +2 -4
  87. package/build/src/background-jobs/forked-runner-child.js +2 -4
  88. package/build/src/background-jobs/job.d.ts.map +1 -1
  89. package/build/src/background-jobs/job.js +2 -4
  90. package/build/src/background-jobs/scheduler.d.ts.map +1 -1
  91. package/build/src/background-jobs/scheduler.js +3 -7
  92. package/build/src/background-jobs/store.d.ts.map +1 -1
  93. package/build/src/background-jobs/store.js +3 -7
  94. package/build/src/background-jobs/web/controller.d.ts.map +1 -1
  95. package/build/src/background-jobs/web/controller.js +2 -5
  96. package/build/src/background-jobs/worker.d.ts.map +1 -1
  97. package/build/src/background-jobs/worker.js +2 -4
  98. package/build/src/beacon/client.d.ts.map +1 -1
  99. package/build/src/beacon/client.js +3 -7
  100. package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
  101. package/build/src/cli/tenant-database-command-helper.js +2 -4
  102. package/build/src/configuration.d.ts.map +1 -1
  103. package/build/src/configuration.js +27 -35
  104. package/build/src/controller.d.ts.map +1 -1
  105. package/build/src/controller.js +5 -15
  106. package/build/src/database/drivers/mssql/index.d.ts.map +1 -1
  107. package/build/src/database/drivers/mssql/index.js +2 -4
  108. package/build/src/database/drivers/mysql/index.d.ts.map +1 -1
  109. package/build/src/database/drivers/mysql/index.js +3 -7
  110. package/build/src/database/drivers/pgsql/index.d.ts.map +1 -1
  111. package/build/src/database/drivers/pgsql/index.js +2 -4
  112. package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
  113. package/build/src/database/drivers/sqlite/base.js +4 -10
  114. package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
  115. package/build/src/database/drivers/sqlite/index.js +4 -10
  116. package/build/src/database/drivers/sqlite/table.d.ts.map +1 -1
  117. package/build/src/database/drivers/sqlite/table.js +2 -4
  118. package/build/src/database/migrator.d.ts.map +1 -1
  119. package/build/src/database/migrator.js +2 -4
  120. package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
  121. package/build/src/database/pool/async-tracked-multi-connection.js +21 -47
  122. package/build/src/database/pool/base-methods-forward.d.ts.map +1 -1
  123. package/build/src/database/pool/base-methods-forward.js +3 -11
  124. package/build/src/database/pool/base.d.ts.map +1 -1
  125. package/build/src/database/pool/base.js +6 -16
  126. package/build/src/database/query/index.d.ts.map +1 -1
  127. package/build/src/database/query/index.js +5 -13
  128. package/build/src/database/query/join-object.d.ts.map +1 -1
  129. package/build/src/database/query/join-object.js +4 -10
  130. package/build/src/database/query/model-class-query.d.ts.map +1 -1
  131. package/build/src/database/query/model-class-query.js +22 -64
  132. package/build/src/database/query/preloader/belongs-to.d.ts.map +1 -1
  133. package/build/src/database/query/preloader/belongs-to.js +10 -28
  134. package/build/src/database/query/preloader/has-many.d.ts.map +1 -1
  135. package/build/src/database/query/preloader/has-many.js +8 -22
  136. package/build/src/database/query/preloader/has-one.d.ts.map +1 -1
  137. package/build/src/database/query/preloader/has-one.js +4 -10
  138. package/build/src/database/query/preloader.d.ts.map +1 -1
  139. package/build/src/database/query/preloader.js +7 -20
  140. package/build/src/database/query/query-data.d.ts.map +1 -1
  141. package/build/src/database/query/query-data.js +6 -16
  142. package/build/src/database/query/where-model-class-hash.d.ts.map +1 -1
  143. package/build/src/database/query/where-model-class-hash.js +6 -16
  144. package/build/src/database/query/with-count.d.ts.map +1 -1
  145. package/build/src/database/query/with-count.js +6 -17
  146. package/build/src/database/record/acts-as-list.d.ts.map +1 -1
  147. package/build/src/database/record/acts-as-list.js +11 -47
  148. package/build/src/database/record/attachments/normalize-input.d.ts.map +1 -1
  149. package/build/src/database/record/attachments/normalize-input.js +8 -30
  150. package/build/src/database/record/attachments/storage-drivers/s3.d.ts.map +1 -1
  151. package/build/src/database/record/attachments/storage-drivers/s3.js +5 -13
  152. package/build/src/database/record/attachments/store.d.ts.map +1 -1
  153. package/build/src/database/record/attachments/store.js +3 -7
  154. package/build/src/database/record/index.d.ts +4 -9
  155. package/build/src/database/record/index.d.ts.map +1 -1
  156. package/build/src/database/record/index.js +53 -173
  157. package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
  158. package/build/src/database/record/instance-relationships/base.js +7 -21
  159. package/build/src/database/record/instance-relationships/belongs-to.d.ts.map +1 -1
  160. package/build/src/database/record/instance-relationships/belongs-to.js +3 -7
  161. package/build/src/database/record/instance-relationships/has-many.d.ts.map +1 -1
  162. package/build/src/database/record/instance-relationships/has-many.js +5 -13
  163. package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
  164. package/build/src/database/record/instance-relationships/has-one.js +5 -13
  165. package/build/src/database/record/relationships/base.d.ts.map +1 -1
  166. package/build/src/database/record/relationships/base.js +2 -6
  167. package/build/src/database/record/validators/presence.d.ts.map +1 -1
  168. package/build/src/database/record/validators/presence.js +2 -4
  169. package/build/src/database/record/validators/uniqueness.d.ts.map +1 -1
  170. package/build/src/database/record/validators/uniqueness.js +5 -14
  171. package/build/src/environment-handlers/browser.d.ts.map +1 -1
  172. package/build/src/environment-handlers/browser.js +2 -4
  173. package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
  174. package/build/src/environment-handlers/node/cli/commands/console.js +3 -7
  175. package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
  176. package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +2 -4
  177. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +38 -0
  178. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
  179. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +58 -12
  180. package/build/src/environment-handlers/node.d.ts.map +1 -1
  181. package/build/src/environment-handlers/node.js +16 -7
  182. package/build/src/frontend-model-controller.d.ts.map +1 -1
  183. package/build/src/frontend-model-controller.js +35 -114
  184. package/build/src/frontend-models/base.d.ts.map +1 -1
  185. package/build/src/frontend-models/base.js +46 -158
  186. package/build/src/frontend-models/clear-pending-debounced-callback.d.ts.map +1 -1
  187. package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -4
  188. package/build/src/frontend-models/preloader.d.ts.map +1 -1
  189. package/build/src/frontend-models/preloader.js +4 -11
  190. package/build/src/frontend-models/query.d.ts.map +1 -1
  191. package/build/src/frontend-models/query.js +12 -34
  192. package/build/src/frontend-models/resource-definition.d.ts.map +1 -1
  193. package/build/src/frontend-models/resource-definition.js +3 -7
  194. package/build/src/frontend-models/transport-serialization.d.ts.map +1 -1
  195. package/build/src/frontend-models/transport-serialization.js +8 -23
  196. package/build/src/frontend-models/use-destroyed-event.js +3 -7
  197. package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
  198. package/build/src/frontend-models/use-model-class-event.js +3 -7
  199. package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
  200. package/build/src/frontend-models/use-updated-event.js +4 -10
  201. package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
  202. package/build/src/frontend-models/websocket-channel.js +10 -32
  203. package/build/src/frontend-models/websocket-publishers.d.ts.map +1 -1
  204. package/build/src/frontend-models/websocket-publishers.js +14 -25
  205. package/build/src/http-server/client/index.d.ts.map +1 -1
  206. package/build/src/http-server/client/index.js +7 -21
  207. package/build/src/http-server/client/params-to-object.d.ts.map +1 -1
  208. package/build/src/http-server/client/params-to-object.js +7 -21
  209. package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
  210. package/build/src/http-server/client/request-buffer/index.js +2 -4
  211. package/build/src/http-server/client/request-parser.d.ts.map +1 -1
  212. package/build/src/http-server/client/request-parser.js +2 -4
  213. package/build/src/http-server/client/request-runner.d.ts.map +1 -1
  214. package/build/src/http-server/client/request-runner.js +5 -14
  215. package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
  216. package/build/src/http-server/client/websocket-session.js +7 -20
  217. package/build/src/http-server/development-reloader.d.ts.map +1 -1
  218. package/build/src/http-server/development-reloader.js +3 -7
  219. package/build/src/http-server/remote-address.d.ts.map +1 -1
  220. package/build/src/http-server/remote-address.js +2 -6
  221. package/build/src/http-server/server-client.d.ts.map +1 -1
  222. package/build/src/http-server/server-client.js +4 -10
  223. package/build/src/http-server/server-lock.d.ts.map +1 -1
  224. package/build/src/http-server/server-lock.js +3 -7
  225. package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
  226. package/build/src/http-server/websocket-channel-subscribers.js +3 -7
  227. package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
  228. package/build/src/http-server/websocket-event-log-store.js +6 -16
  229. package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
  230. package/build/src/http-server/websocket-events-host.js +2 -5
  231. package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
  232. package/build/src/http-server/worker-handler/in-process.js +4 -12
  233. package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
  234. package/build/src/http-server/worker-handler/worker-thread.js +2 -4
  235. package/build/src/logger.d.ts.map +1 -1
  236. package/build/src/logger.js +3 -7
  237. package/build/src/mailer/backends/smtp.d.ts.map +1 -1
  238. package/build/src/mailer/backends/smtp.js +2 -6
  239. package/build/src/mailer/base.d.ts.map +1 -1
  240. package/build/src/mailer/base.js +5 -17
  241. package/build/src/plugins/sqljs-wasm-route-controller.d.ts.map +1 -1
  242. package/build/src/plugins/sqljs-wasm-route-controller.js +2 -4
  243. package/build/src/routes/basic-route.d.ts.map +1 -1
  244. package/build/src/routes/basic-route.js +2 -4
  245. package/build/src/routes/resolver.d.ts.map +1 -1
  246. package/build/src/routes/resolver.js +5 -15
  247. package/build/src/testing/expect-utils.d.ts.map +1 -1
  248. package/build/src/testing/expect-utils.js +9 -27
  249. package/build/src/testing/expect.d.ts.map +1 -1
  250. package/build/src/testing/expect.js +5 -15
  251. package/build/src/testing/test-runner.d.ts.map +1 -1
  252. package/build/src/testing/test-runner.js +4 -10
  253. package/build/src/testing/test.d.ts.map +1 -1
  254. package/build/src/testing/test.js +5 -17
  255. package/build/src/utils/model-scope.d.ts.map +1 -1
  256. package/build/src/utils/model-scope.js +2 -5
  257. package/build/src/utils/ransack.d.ts.map +1 -1
  258. package/build/src/utils/ransack.js +15 -42
  259. package/build/src/utils/with-tracked-stack-async-hooks.d.ts.map +1 -1
  260. package/build/src/utils/with-tracked-stack-async-hooks.js +4 -12
  261. package/build/src/utils/with-tracked-stack.d.ts.map +1 -1
  262. package/build/src/utils/with-tracked-stack.js +3 -8
  263. package/build/testing/expect-utils.js +8 -26
  264. package/build/testing/expect.js +4 -14
  265. package/build/testing/test-runner.js +3 -9
  266. package/build/testing/test.js +4 -12
  267. package/build/utils/model-scope.js +1 -3
  268. package/build/utils/ransack.js +15 -41
  269. package/build/utils/with-tracked-stack-async-hooks.js +3 -9
  270. package/build/utils/with-tracked-stack.js +2 -6
  271. package/package.json +3 -2
  272. package/src/application.js +1 -3
  273. package/src/background-jobs/cron-expression.js +1 -3
  274. package/src/background-jobs/forked-runner-child.js +1 -3
  275. package/src/background-jobs/job.js +1 -3
  276. package/src/background-jobs/scheduler.js +2 -6
  277. package/src/background-jobs/store.js +2 -6
  278. package/src/background-jobs/web/controller.js +1 -3
  279. package/src/background-jobs/worker.js +1 -3
  280. package/src/beacon/client.js +2 -6
  281. package/src/cli/tenant-database-command-helper.js +1 -3
  282. package/src/configuration.js +29 -32
  283. package/src/controller.js +4 -14
  284. package/src/database/drivers/mssql/index.js +1 -3
  285. package/src/database/drivers/mysql/index.js +2 -6
  286. package/src/database/drivers/pgsql/index.js +1 -3
  287. package/src/database/drivers/sqlite/base.js +3 -9
  288. package/src/database/drivers/sqlite/index.js +3 -9
  289. package/src/database/drivers/sqlite/table.js +1 -3
  290. package/src/database/migrator.js +1 -3
  291. package/src/database/pool/async-tracked-multi-connection.js +20 -45
  292. package/src/database/pool/base-methods-forward.js +2 -10
  293. package/src/database/pool/base.js +5 -15
  294. package/src/database/query/index.js +4 -12
  295. package/src/database/query/join-object.js +3 -9
  296. package/src/database/query/model-class-query.js +21 -63
  297. package/src/database/query/preloader/belongs-to.js +9 -27
  298. package/src/database/query/preloader/has-many.js +7 -21
  299. package/src/database/query/preloader/has-one.js +3 -9
  300. package/src/database/query/preloader.js +6 -18
  301. package/src/database/query/query-data.js +5 -15
  302. package/src/database/query/where-model-class-hash.js +5 -15
  303. package/src/database/query/with-count.js +5 -15
  304. package/src/database/record/acts-as-list.js +10 -38
  305. package/src/database/record/attachments/normalize-input.js +7 -25
  306. package/src/database/record/attachments/storage-drivers/s3.js +4 -12
  307. package/src/database/record/attachments/store.js +2 -6
  308. package/src/database/record/index.js +55 -171
  309. package/src/database/record/instance-relationships/base.js +6 -20
  310. package/src/database/record/instance-relationships/belongs-to.js +2 -6
  311. package/src/database/record/instance-relationships/has-many.js +4 -12
  312. package/src/database/record/instance-relationships/has-one.js +4 -12
  313. package/src/database/record/relationships/base.js +1 -5
  314. package/src/database/record/validators/presence.js +1 -3
  315. package/src/database/record/validators/uniqueness.js +4 -12
  316. package/src/environment-handlers/browser.js +1 -3
  317. package/src/environment-handlers/node/cli/commands/console.js +2 -6
  318. package/src/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
  319. package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
  320. package/src/environment-handlers/node.js +15 -6
  321. package/src/frontend-model-controller.js +34 -110
  322. package/src/frontend-models/base.js +45 -151
  323. package/src/frontend-models/clear-pending-debounced-callback.js +1 -3
  324. package/src/frontend-models/preloader.js +3 -9
  325. package/src/frontend-models/query.js +11 -33
  326. package/src/frontend-models/resource-definition.js +2 -6
  327. package/src/frontend-models/transport-serialization.js +7 -21
  328. package/src/frontend-models/use-destroyed-event.js +2 -6
  329. package/src/frontend-models/use-model-class-event.js +2 -6
  330. package/src/frontend-models/use-updated-event.js +3 -9
  331. package/src/frontend-models/websocket-channel.js +9 -27
  332. package/src/frontend-models/websocket-publishers.js +12 -23
  333. package/src/http-server/client/index.js +6 -18
  334. package/src/http-server/client/params-to-object.js +6 -18
  335. package/src/http-server/client/request-buffer/index.js +1 -3
  336. package/src/http-server/client/request-parser.js +1 -3
  337. package/src/http-server/client/request-runner.js +4 -12
  338. package/src/http-server/client/websocket-session.js +6 -18
  339. package/src/http-server/development-reloader.js +2 -6
  340. package/src/http-server/remote-address.js +1 -5
  341. package/src/http-server/server-client.js +3 -9
  342. package/src/http-server/server-lock.js +2 -6
  343. package/src/http-server/websocket-channel-subscribers.js +2 -6
  344. package/src/http-server/websocket-event-log-store.js +5 -15
  345. package/src/http-server/websocket-events-host.js +1 -3
  346. package/src/http-server/worker-handler/in-process.js +3 -11
  347. package/src/http-server/worker-handler/worker-thread.js +1 -3
  348. package/src/logger.js +2 -6
  349. package/src/mailer/backends/smtp.js +1 -5
  350. package/src/mailer/base.js +4 -16
  351. package/src/plugins/sqljs-wasm-route-controller.js +1 -3
  352. package/src/routes/basic-route.js +1 -3
  353. package/src/routes/resolver.js +4 -14
  354. package/src/testing/expect-utils.js +8 -26
  355. package/src/testing/expect.js +4 -14
  356. package/src/testing/test-runner.js +3 -9
  357. package/src/testing/test.js +4 -12
  358. package/src/utils/model-scope.js +1 -3
  359. package/src/utils/ransack.js +15 -41
  360. package/src/utils/with-tracked-stack-async-hooks.js +3 -9
  361. package/src/utils/with-tracked-stack.js +2 -6
@@ -119,9 +119,7 @@ export default class VelociousApplication {
119
119
  async startLockedHttpServer({configuration, host, httpServerConfiguration, port}) {
120
120
  try {
121
121
  if (!configuration.getWebsocketEvents()) {
122
- configuration.setWebsocketEvents(/**
123
- * Types the following value.
124
- * @type {?} */ (websocketEventsHost))
122
+ configuration.setWebsocketEvents(/** @type {?} */ (websocketEventsHost))
125
123
  }
126
124
 
127
125
  await configuration.connectBeacon({peerType: "server"})
@@ -60,9 +60,7 @@ export function parseCronExpression(expression) {
60
60
  }
61
61
 
62
62
  const trimmed = expression.trim().toLowerCase()
63
- const expanded = SHORTCUTS[/**
64
- * Narrows the runtime value to the documented type.
65
- * @type {keyof typeof SHORTCUTS} */ (trimmed)] || trimmed
63
+ const expanded = SHORTCUTS[/** @type {keyof typeof SHORTCUTS} */ (trimmed)] || trimmed
66
64
  const fields = expanded.split(/\s+/)
67
65
 
68
66
  if (fields.length !== 5) {
@@ -12,9 +12,7 @@ let finishing = false
12
12
  function isJobMessage(message) {
13
13
  if (!message || typeof message !== "object") return false
14
14
 
15
- const messageRecord = /**
16
- * Narrows the runtime value to the documented type.
17
- * @type {{type?: ?, payload?: ?}} */ (message)
15
+ const messageRecord = /** @type {{type?: ?, payload?: ?}} */ (message)
18
16
 
19
17
  return messageRecord.type === "job" && Object.hasOwn(messageRecord, "payload")
20
18
  }
@@ -58,9 +58,7 @@ export default class VelociousJob {
58
58
  const isOptionsArg = lastArg && typeof lastArg === "object" && !Array.isArray(lastArg) && "jobOptions" in lastArg
59
59
 
60
60
  if (isOptionsArg) {
61
- const {jobOptions} = /**
62
- * Narrows the runtime value to the documented type.
63
- * @type {{jobOptions: import("./types.js").BackgroundJobOptions}} */ (lastArg)
61
+ const {jobOptions} = /** @type {{jobOptions: import("./types.js").BackgroundJobOptions}} */ (lastArg)
64
62
  return {jobArgs: args.slice(0, -1), jobOptions: jobOptions || {}}
65
63
  }
66
64
 
@@ -52,9 +52,7 @@ export function parseScheduledDuration(value, fieldName) {
52
52
  }
53
53
 
54
54
  const numericValue = Number(match[1])
55
- const multiplier = DURATION_MULTIPLIERS[/**
56
- * Narrows the runtime value to the documented type.
57
- * @type {DurationUnit} */ (match[2])]
55
+ const multiplier = DURATION_MULTIPLIERS[/** @type {DurationUnit} */ (match[2])]
58
56
 
59
57
  if (!multiplier) {
60
58
  throw new Error(`Invalid scheduled background job ${fieldName}: ${value}`)
@@ -168,9 +166,7 @@ export default class BackgroundJobsScheduler {
168
166
  * @returns {void}
169
167
  */
170
168
  scheduleEveryJob({jobConfiguration, jobKey}) {
171
- const everyConfig = /**
172
- * Narrows the runtime value to the documented type.
173
- * @type {NonNullable<typeof jobConfiguration.every>} */ (jobConfiguration.every)
169
+ const everyConfig = /** @type {NonNullable<typeof jobConfiguration.every>} */ (jobConfiguration.every)
174
170
  const {everyValue, firstInValue} = this.normalizeEvery(everyConfig)
175
171
  const intervalMs = parseScheduledDuration(everyValue, `${jobKey}.every`)
176
172
  const firstInMs = firstInValue !== undefined ? parseScheduledDuration(firstInValue, `${jobKey}.first_in`) : intervalMs
@@ -237,9 +237,7 @@ export default class BackgroundJobsStore {
237
237
  const counts = {}
238
238
 
239
239
  for (const row of rows) {
240
- const typedRow = /**
241
- * Narrows the runtime value to the documented type.
242
- * @type {Record<string, ?>} */ (row)
240
+ const typedRow = /** @type {Record<string, ?>} */ (row)
243
241
 
244
242
  counts[String(typedRow.status)] = this._normalizeNumber(typedRow.count) || 0
245
243
  }
@@ -265,9 +263,7 @@ export default class BackgroundJobsStore {
265
263
  if (jobName) query = query.where({job_name: jobName})
266
264
 
267
265
  const rows = await query.results()
268
- const countRow = /**
269
- * Narrows the runtime value to the documented type.
270
- * @type {Record<string, ?>} */ (rows[0] || {})
266
+ const countRow = /** @type {Record<string, ?>} */ (rows[0] || {})
271
267
 
272
268
  return this._normalizeNumber(countRow.count) || 0
273
269
  })
@@ -222,9 +222,7 @@ export default class VelociousBackgroundJobsWebController extends Controller {
222
222
  const redactArgs = Boolean(this._mountOptions().redactArgs)
223
223
 
224
224
  return Object.keys(jobs).map((name) => {
225
- const entry = jobs[name] || /**
226
- * Narrows the runtime value to the documented type.
227
- * @type {?} */ ({})
225
+ const entry = jobs[name] || /** @type {?} */ ({})
228
226
 
229
227
  return {
230
228
  args: redactArgs ? undefined : (entry.args || []),
@@ -276,9 +276,7 @@ export default class BackgroundJobsWorker {
276
276
  /**
277
277
  * Identified payload.
278
278
  * @type {import("./types.js").BackgroundJobPayload & {id: string}} */
279
- const identifiedPayload = /**
280
- * Narrows the runtime value to the documented type.
281
- * @type {?} */ (payload)
279
+ const identifiedPayload = /** @type {?} */ (payload)
282
280
 
283
281
  const executionMode = this._executionModeForPayload(identifiedPayload)
284
282
 
@@ -116,9 +116,7 @@ export default class BeaconClient extends EventEmitter {
116
116
  this.off("connect-error", onError)
117
117
  resolve()
118
118
  }
119
- const onError = (/**
120
- * Narrows the runtime value to the documented type.
121
- * @type {Error} */ error) => {
119
+ const onError = (/** @type {Error} */ error) => {
122
120
  this.off("connect", onConnect)
123
121
  this.off("connect-error", onError)
124
122
  reject(error)
@@ -271,9 +269,7 @@ export default class BeaconClient extends EventEmitter {
271
269
  this.emit("connect")
272
270
  })
273
271
 
274
- jsonSocket.on("message", (/**
275
- * Narrows the runtime value to the documented type.
276
- * @type {import("./types.js").BeaconSocketMessage} */ message) => {
272
+ jsonSocket.on("message", (/** @type {import("./types.js").BeaconSocketMessage} */ message) => {
277
273
  if (message?.type === "hello-ack" && message.peerId === this.peerId) {
278
274
  this._ready = true
279
275
  this.emit("ready")
@@ -184,9 +184,7 @@ export default class TenantDatabaseCommandHelper {
184
184
  */
185
185
  tenantLabel(tenant) {
186
186
  if (tenant && typeof tenant === "object") {
187
- const tenantObject = /**
188
- * Narrows the runtime value to the documented type.
189
- * @type {{id?: ?, name?: ?, slug?: ?}} */ (tenant)
187
+ const tenantObject = /** @type {{id?: ?, name?: ?, slug?: ?}} */ (tenant)
190
188
 
191
189
  if (tenantObject.slug) return String(tenantObject.slug)
192
190
  if (tenantObject.name) return String(tenantObject.name)
@@ -30,15 +30,34 @@ export {CurrentConfigurationNotSetError}
30
30
  * @returns {string | undefined} - Current working directory when the runtime exposes one.
31
31
  */
32
32
  function currentWorkingDirectory() {
33
- const processObject = /**
34
- * Types the following value.
35
- * @type {{cwd?: ?} | undefined} */ (globalThis.process)
33
+ const processObject = /** @type {{cwd?: ?} | undefined} */ (globalThis.process)
36
34
 
37
35
  if (typeof processObject?.cwd !== "function") return undefined
38
36
 
39
37
  return processObject.cwd()
40
38
  }
41
39
 
40
+ /**
41
+ * Resolves the overloaded with/ensure connections arguments.
42
+ * @template T
43
+ * @param {WithConnectionsOptionsType | WithConnectionsCallbackType<T>} optionsOrCallback - Checkout options or callback function.
44
+ * @param {WithConnectionsCallbackType<T> | undefined} callback - Callback function.
45
+ * @param {string} defaultName - Default checkout name.
46
+ * @returns {{name: string, callback: WithConnectionsCallbackType<T> | undefined}} Resolved checkout name and callback.
47
+ */
48
+ function resolveWithConnectionsArgs(optionsOrCallback, callback, defaultName) {
49
+ if (typeof optionsOrCallback == "function") {
50
+ const actualCallback = /** @type {WithConnectionsCallbackType<T>} */ (optionsOrCallback)
51
+
52
+ return {name: defaultName, callback: actualCallback}
53
+ }
54
+
55
+ return {
56
+ name: optionsOrCallback.name || defaultName,
57
+ callback
58
+ }
59
+ }
60
+
42
61
  /**
43
62
  * Runs canonical debug snapshot value.
44
63
  * @param {?} value - Snapshot value to canonicalize.
@@ -49,13 +68,9 @@ function canonicalDebugSnapshotValue(value) {
49
68
  if (Array.isArray(value)) return value.map((entry) => canonicalDebugSnapshotValue(entry))
50
69
 
51
70
  return Object.keys(value).sort().reduce((result, key) => {
52
- result[key] = canonicalDebugSnapshotValue(/**
53
- * Types the following value.
54
- * @type {Record<string, ?>} */ (value)[key])
71
+ result[key] = canonicalDebugSnapshotValue(/** @type {Record<string, ?>} */ (value)[key])
55
72
  return result
56
- }, /**
57
- * Types the following value.
58
- * @type {Record<string, ?>} */ ({}))
73
+ }, /** @type {Record<string, ?>} */ ({}))
59
74
  }
60
75
 
61
76
  /**
@@ -496,9 +511,7 @@ export default class VelociousConfiguration {
496
511
  * @returns {Promise<Record<string, ?>>} - HTTP server worker diagnostics.
497
512
  */
498
513
  async _debugHttpServerSnapshot() {
499
- const httpServer = /**
500
- * Types the following value.
501
- * @type {{getDebugSnapshot?: () => Promise<Record<string, ?>>} | undefined} */ (this._httpServerInstance)
514
+ const httpServer = /** @type {{getDebugSnapshot?: () => Promise<Record<string, ?>>} | undefined} */ (this._httpServerInstance)
502
515
 
503
516
  if (!httpServer?.getDebugSnapshot) {
504
517
  return {configured: Boolean(this.httpServer), active: false}
@@ -597,9 +610,7 @@ export default class VelociousConfiguration {
597
610
  const detailsBuckets = new Map()
598
611
 
599
612
  for (const subscription of channelSubscriptions) {
600
- const details = /**
601
- * Types the following value.
602
- * @type {Record<string, ?>} */ (canonicalDebugSnapshotValue(subscription.debugSnapshot()))
613
+ const details = /** @type {Record<string, ?>} */ (canonicalDebugSnapshotValue(subscription.debugSnapshot()))
603
614
  const key = JSON.stringify(details)
604
615
  const existingBucket = detailsBuckets.get(key)
605
616
 
@@ -624,9 +635,7 @@ export default class VelociousConfiguration {
624
635
  const channelSubscriptionBuckets = new Map()
625
636
 
626
637
  for (const {channelType, subscription} of session._channelSubscriptions.values()) {
627
- const details = /**
628
- * Types the following value.
629
- * @type {Record<string, ?>} */ (subscription.debugSnapshot())
638
+ const details = /** @type {Record<string, ?>} */ (subscription.debugSnapshot())
630
639
  const model = typeof details.model === "string" ? details.model : null
631
640
  const key = JSON.stringify({channelType, model})
632
641
  const existingBucket = channelSubscriptionBuckets.get(key)
@@ -2422,13 +2431,7 @@ export default class VelociousConfiguration {
2422
2431
  * @returns {Promise<T>} - Resolves with the callback result.
2423
2432
  */
2424
2433
  async withConnections(optionsOrCallback, callback) {
2425
- const name = typeof optionsOrCallback == "function" ? "Configuration.withConnections" : (optionsOrCallback.name || "Configuration.withConnections")
2426
- /**
2427
- * Actual with connections callback.
2428
- * @type {WithConnectionsCallbackType<T> | undefined} */
2429
- const actualWithConnectionsCallback = typeof optionsOrCallback == "function" ? /**
2430
- * Types the following value.
2431
- * @type {WithConnectionsCallbackType<T>} */ (optionsOrCallback) : callback
2434
+ const {name, callback: actualWithConnectionsCallback} = resolveWithConnectionsArgs(optionsOrCallback, callback, "Configuration.withConnections")
2432
2435
 
2433
2436
  if (!actualWithConnectionsCallback) throw new Error("withConnections requires a callback")
2434
2437
 
@@ -2537,13 +2540,7 @@ export default class VelociousConfiguration {
2537
2540
  * @returns {Promise<T>} - Resolves with the callback result.
2538
2541
  */
2539
2542
  async ensureConnections(optionsOrCallback, callback) {
2540
- const name = typeof optionsOrCallback == "function" ? "Configuration.ensureConnections" : (optionsOrCallback.name || "Configuration.ensureConnections")
2541
- /**
2542
- * Actual with connections callback.
2543
- * @type {WithConnectionsCallbackType<T> | undefined} */
2544
- const actualWithConnectionsCallback = typeof optionsOrCallback == "function" ? /**
2545
- * Types the following value.
2546
- * @type {WithConnectionsCallbackType<T>} */ (optionsOrCallback) : callback
2543
+ const {name, callback: actualWithConnectionsCallback} = resolveWithConnectionsArgs(optionsOrCallback, callback, "Configuration.ensureConnections")
2547
2544
 
2548
2545
  if (!actualWithConnectionsCallback) throw new Error("ensureConnections requires a callback")
2549
2546
 
@@ -141,9 +141,7 @@ export default class VelociousController {
141
141
  * @returns {typeof VelociousController} - The controller class.
142
142
  */
143
143
  _getControllerClass() {
144
- const controllerClass = /**
145
- * Types the following value.
146
- * @type {typeof VelociousController} */ (this.constructor)
144
+ const controllerClass = /** @type {typeof VelociousController} */ (this.constructor)
147
145
 
148
146
  return controllerClass
149
147
  }
@@ -159,11 +157,7 @@ export default class VelociousController {
159
157
  const beforeActions = currentControllerClass._beforeActions
160
158
 
161
159
  if (beforeActions) {
162
- const controllerPrototype = /**
163
- * Types the following value.
164
- * @type {Record<string, Function | undefined>} */ (/**
165
- * Types the following value.
166
- * @type {?} */ (currentControllerClass.prototype))
160
+ const controllerPrototype = /** @type {Record<string, Function | undefined>} */ (/** @type {?} */ (currentControllerClass.prototype))
167
161
 
168
162
  for (const beforeActionName of beforeActions) {
169
163
  const beforeAction = controllerPrototype[beforeActionName]
@@ -215,9 +209,7 @@ export default class VelociousController {
215
209
 
216
210
  return paramsToObject.toObject()
217
211
  } catch (error) {
218
- const ensuredError = /**
219
- * Types the following value.
220
- * @type {Error & {velociousContext?: Record<string, ?>}} */ (error)
212
+ const ensuredError = /** @type {Error & {velociousContext?: Record<string, ?>}} */ (error)
221
213
 
222
214
  ensuredError.velociousContext = {
223
215
  ...(ensuredError.velociousContext || {}),
@@ -295,9 +287,7 @@ export default class VelociousController {
295
287
 
296
288
  ejs.renderFile(viewPath, actualViewParams, {}, (err, str) => {
297
289
  if (err) {
298
- const renderError = /**
299
- * Types the following value.
300
- * @type {Error & {code?: string}} */ (err)
290
+ const renderError = /** @type {Error & {code?: string}} */ (err)
301
291
 
302
292
  if (renderError.code === "ENOENT") {
303
293
  this.logger.warn(`Missing view file: ${viewPath}`)
@@ -340,9 +340,7 @@ export default class VelociousDatabaseDriversMssql extends Base{
340
340
  const tables = []
341
341
 
342
342
  for (const row of result) {
343
- const table = new Table(this, /**
344
- * Narrows the runtime value to the documented type.
345
- * @type {Record<string, string>} */ (row))
343
+ const table = new Table(this, /** @type {Record<string, string>} */ (row))
346
344
 
347
345
  tables.push(table)
348
346
  }
@@ -223,9 +223,7 @@ export default class VelociousDatabaseDriversMysql extends Base{
223
223
  * @returns {import("../base.js").RetryableDatabaseErrorResult} - Retry info.
224
224
  */
225
225
  retryableDatabaseError(error) {
226
- const errorCode = /**
227
- * Narrows the runtime value to the documented type.
228
- * @type {?} */ (error).code
226
+ const errorCode = /** @type {?} */ (error).code
229
227
  const message = error.message || ""
230
228
  const shouldRetry = (
231
229
  errorCode == "ECONNREFUSED" ||
@@ -337,9 +335,7 @@ export default class VelociousDatabaseDriversMysql extends Base{
337
335
  const tables = []
338
336
 
339
337
  for (const row of result) {
340
- const table = new Table(this, /**
341
- * Narrows the runtime value to the documented type.
342
- * @type {Record<string, string>} */ (row))
338
+ const table = new Table(this, /** @type {Record<string, string>} */ (row))
343
339
 
344
340
  tables.push(table)
345
341
  }
@@ -292,9 +292,7 @@ export default class VelociousDatabaseDriversPgsql extends Base{
292
292
  const tables = []
293
293
 
294
294
  for (const row of result) {
295
- const table = new Table(this, /**
296
- * Narrows the runtime value to the documented type.
297
- * @type {Record<string, string>} */ (row))
295
+ const table = new Table(this, /** @type {Record<string, string>} */ (row))
298
296
 
299
297
  tables.push(table)
300
298
  }
@@ -87,9 +87,7 @@ export default class VelociousDatabaseDriversSqliteBase extends Base {
87
87
  * @returns {Promise<string[]>} - Resolves with SQL statements.
88
88
  */
89
89
  async dropTableSQLs(tableName, args = {}) {
90
- const driver = /**
91
- * Narrows the runtime value to the documented type.
92
- * @type {import("../base.js").default} */ (this)
90
+ const driver = /** @type {import("../base.js").default} */ (this)
93
91
  const dropArgs = Object.assign({tableName, driver}, args)
94
92
  const dropTable = new DropTable(dropArgs)
95
93
 
@@ -126,9 +124,7 @@ export default class VelociousDatabaseDriversSqliteBase extends Base {
126
124
  const tables = []
127
125
 
128
126
  for (const row of result) {
129
- const table = new Table({driver: this, row: /**
130
- * Narrows the runtime value to the documented type.
131
- * @type {Record<string, string | number | null>} */ (row)})
127
+ const table = new Table({driver: this, row: /** @type {Record<string, string | number | null>} */ (row)})
132
128
 
133
129
  tables.push(table)
134
130
  }
@@ -403,9 +399,7 @@ export default class VelociousDatabaseDriversSqliteBase extends Base {
403
399
  if (timeoutHandle) clearTimeout(timeoutHandle)
404
400
 
405
401
  const current = state.waitersByName.get(name) || []
406
- const index = current.indexOf(/**
407
- * Narrows the runtime value to the documented type.
408
- * @type {() => void} */ (removeAndResolve))
402
+ const index = current.indexOf(/** @type {() => void} */ (removeAndResolve))
409
403
 
410
404
  if (index >= 0) current.splice(index, 1)
411
405
  if (current.length === 0) state.waitersByName.delete(name)
@@ -247,9 +247,7 @@ export default class VelociousDatabaseDriversSqliteNode extends Base {
247
247
 
248
248
  return true
249
249
  } catch (error) {
250
- if (/**
251
- * Narrows the runtime value to the documented type.
252
- * @type {NodeJS.ErrnoException} */ (error)?.code !== "EEXIST") throw error
250
+ if (/** @type {NodeJS.ErrnoException} */ (error)?.code !== "EEXIST") throw error
253
251
 
254
252
  if (await this._isAdvisoryLockStale(lockPath)) {
255
253
  await fs.rm(lockPath, {recursive: true, force: true})
@@ -285,9 +283,7 @@ export default class VelociousDatabaseDriversSqliteNode extends Base {
285
283
 
286
284
  return true
287
285
  } catch (error) {
288
- if (/**
289
- * Narrows the runtime value to the documented type.
290
- * @type {NodeJS.ErrnoException} */ (error)?.code !== "EEXIST") throw error
286
+ if (/** @type {NodeJS.ErrnoException} */ (error)?.code !== "EEXIST") throw error
291
287
 
292
288
  if (await this._isAdvisoryLockStale(lockPath)) {
293
289
  await fs.rm(lockPath, {recursive: true, force: true})
@@ -298,9 +294,7 @@ export default class VelociousDatabaseDriversSqliteNode extends Base {
298
294
 
299
295
  return true
300
296
  } catch (retryError) {
301
- if (/**
302
- * Narrows the runtime value to the documented type.
303
- * @type {NodeJS.ErrnoException} */ (retryError)?.code === "EEXIST") return false
297
+ if (/** @type {NodeJS.ErrnoException} */ (retryError)?.code === "EEXIST") return false
304
298
 
305
299
  throw retryError
306
300
  }
@@ -71,9 +71,7 @@ export default class VelociousDatabaseDriversSqliteTable extends BaseTable {
71
71
 
72
72
  if (!sql) throw new Error(`Could not find SQL for index ${columnsIndex.getName()}`)
73
73
 
74
- const indexData = /**
75
- * Narrows the runtime value to the documented type.
76
- * @type {typeof columnsIndex.data & {columnNames?: string[]}} */ (columnsIndex.data)
74
+ const indexData = /** @type {typeof columnsIndex.data & {columnNames?: string[]}} */ (columnsIndex.data)
77
75
 
78
76
  indexData.columnNames = this._parseColumnsFromSQL(String(sql))
79
77
 
@@ -301,9 +301,7 @@ export default class VelociousDatabaseMigrator {
301
301
  const migrationName = match[2]
302
302
  const migrationClassName = inflection.camelize(migrationName)
303
303
 
304
- const migrationObject = /**
305
- * Narrows the runtime value to the documented type.
306
- * @type {import("./migrator/types.js").MigrationObjectType} */ ({
304
+ const migrationObject = /** @type {import("./migrator/types.js").MigrationObjectType} */ ({
307
305
  file,
308
306
  date,
309
307
  migrationClassName
@@ -99,9 +99,12 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
99
99
  */
100
100
  constructor({configuration, identifier}) {
101
101
  super({configuration, identifier})
102
- this._withoutCurrentConnectionContext = /**
103
- * Narrows the runtime value to the documented type.
104
- * @type {(callback: () => ?) => ?} */ ((callback) => this.asyncLocalStorage.run(undefined, callback))
102
+ /**
103
+ * Runs a callback without the inherited current connection context.
104
+ * @type {(callback: () => ?) => ?}
105
+ */
106
+ const withoutCurrentConnectionContext = (callback) => this.asyncLocalStorage.run(undefined, callback)
107
+ this._withoutCurrentConnectionContext = withoutCurrentConnectionContext
105
108
  }
106
109
 
107
110
  /**
@@ -111,9 +114,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
111
114
  */
112
115
  async checkin(connection) {
113
116
  const id = connection.getIdSeq()
114
- const trackedConnection = /**
115
- * Narrows the runtime value to the documented type.
116
- * @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean, [CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
117
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean, [CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
117
118
 
118
119
  if (trackedConnection[CLOSED_CONNECTION]) {
119
120
  this.untrackConnectionInUse(connection, id)
@@ -243,9 +244,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
243
244
  * @returns {boolean} - Whether the connection matches the reuse key.
244
245
  */
245
246
  connectionMatchesReuseKey(connection, reuseKey) {
246
- const connectionWithPoolKey = /**
247
- * Narrows the runtime value to the documented type.
248
- * @type {import("../drivers/base.js").default & {[POOL_CONFIGURATION_KEY]?: string}} */ (connection)
247
+ const connectionWithPoolKey = /** @type {import("../drivers/base.js").default & {[POOL_CONFIGURATION_KEY]?: string}} */ (connection)
249
248
 
250
249
  return connectionWithPoolKey[POOL_CONFIGURATION_KEY] === reuseKey
251
250
  }
@@ -261,9 +260,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
261
260
 
262
261
  const id = this.idSeq++
263
262
 
264
- const trackedConnection = /**
265
- * Narrows the runtime value to the documented type.
266
- * @type {import("../drivers/base.js").default & {[CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
263
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
267
264
  delete trackedConnection[IDLE_CONNECTION_CHECKED_IN_AT]
268
265
  trackedConnection[CONNECTION_CHECKED_OUT_AT] = Date.now()
269
266
 
@@ -362,9 +359,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
362
359
 
363
360
  try {
364
361
  const connection = await this.spawnConnectionWithConfiguration(databaseConfig)
365
- const connectionWithPoolKey = /**
366
- * Narrows the runtime value to the documented type.
367
- * @type {import("../drivers/base.js").default & {[POOL_CONFIGURATION_KEY]?: string}} */ (connection)
362
+ const connectionWithPoolKey = /** @type {import("../drivers/base.js").default & {[POOL_CONFIGURATION_KEY]?: string}} */ (connection)
368
363
 
369
364
  connectionWithPoolKey[POOL_CONFIGURATION_KEY] = reuseKey
370
365
  connection.setSchemaCacheInvalidator(() => {
@@ -709,9 +704,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
709
704
  * @returns {void} - No return value.
710
705
  */
711
706
  setGlobalConnection(connection) {
712
- const klass = /**
713
- * Narrows the runtime value to the documented type.
714
- * @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
707
+ const klass = /** @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
715
708
  let mapForConfiguration = klass.globalConnections.get(this.configuration)
716
709
 
717
710
  if (!mapForConfiguration) {
@@ -816,9 +809,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
816
809
  */
817
810
  addInUseDebugConnectionSnapshots({connections, now, seenConnections}) {
818
811
  for (const [id, connection] of Object.entries(this.connectionsInUse)) {
819
- const trackedConnection = /**
820
- * Narrows the runtime value to the documented type.
821
- * @type {import("../drivers/base.js").default & {[CONNECTION_CHECKED_OUT_AT]?: number}} */ (connection)
812
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[CONNECTION_CHECKED_OUT_AT]?: number}} */ (connection)
822
813
  const checkedOutAt = trackedConnection[CONNECTION_CHECKED_OUT_AT]
823
814
  const checkedOutForMs = typeof checkedOutAt === "number" ? Math.max(0, now - checkedOutAt) : undefined
824
815
 
@@ -838,9 +829,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
838
829
 
839
830
  seenConnections.add(connection)
840
831
 
841
- const trackedConnection = /**
842
- * Narrows the runtime value to the documented type.
843
- * @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
832
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
844
833
  const checkedInAt = trackedConnection[IDLE_CONNECTION_CHECKED_IN_AT]
845
834
  const idleForMs = typeof checkedInAt === "number" ? Math.max(0, now - checkedInAt) : undefined
846
835
 
@@ -906,9 +895,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
906
895
  * @returns {import("../drivers/base.js").default | undefined} - The global connection for this pool identifier.
907
896
  */
908
897
  getGlobalConnectionForIdentifier() {
909
- const klass = /**
910
- * Narrows the runtime value to the documented type.
911
- * @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
898
+ const klass = /** @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
912
899
  const mapForConfiguration = klass.globalConnections.get(this.configuration)
913
900
 
914
901
  return mapForConfiguration?.[this.identifier]
@@ -919,9 +906,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
919
906
  * @returns {void} - No return value.
920
907
  */
921
908
  clearGlobalConnectionForIdentifier() {
922
- const klass = /**
923
- * Narrows the runtime value to the documented type.
924
- * @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
909
+ const klass = /** @type {typeof VelociousDatabasePoolAsyncTrackedMultiConnection} */ (this.constructor)
925
910
  const mapForConfiguration = klass.globalConnections.get(this.configuration)
926
911
 
927
912
  if (!mapForConfiguration) return
@@ -975,9 +960,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
975
960
  if (this.idleConnectionReaperTimer) return
976
961
  if (!this.hasIdleConnectionsToReap()) return
977
962
 
978
- const delay = this.nextIdleConnectionReapDelay(/**
979
- * Narrows the runtime value to the documented type.
980
- * @type {number} */ (this.idleTimeoutMillis()))
963
+ const delay = this.nextIdleConnectionReapDelay(/** @type {number} */ (this.idleTimeoutMillis()))
981
964
 
982
965
  this.idleConnectionReaperTimer = setTimeout(() => {
983
966
  this.idleConnectionReaperTimer = undefined
@@ -1011,9 +994,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
1011
994
  for (const connection of this.connections) {
1012
995
  if (this.connectionHasOpenTransaction(connection)) continue
1013
996
 
1014
- const trackedConnection = /**
1015
- * Narrows the runtime value to the documented type.
1016
- * @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
997
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
1017
998
  const checkedInAt = trackedConnection[IDLE_CONNECTION_CHECKED_IN_AT]
1018
999
 
1019
1000
  if (typeof checkedInAt !== "number") continue
@@ -1109,9 +1090,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
1109
1090
  * @returns {boolean} - Whether the connection is marked closed.
1110
1091
  */
1111
1092
  connectionIsClosed(connection) {
1112
- const trackedConnection = /**
1113
- * Narrows the runtime value to the documented type.
1114
- * @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean}} */ (connection)
1093
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean}} */ (connection)
1115
1094
 
1116
1095
  return Boolean(trackedConnection[CLOSED_CONNECTION])
1117
1096
  }
@@ -1122,9 +1101,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
1122
1101
  * @returns {boolean} - Whether the idle connection expired.
1123
1102
  */
1124
1103
  idleConnectionExpired({connection, idleTimeoutMillis, now}) {
1125
- const trackedConnection = /**
1126
- * Narrows the runtime value to the documented type.
1127
- * @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
1104
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
1128
1105
  const checkedInAt = trackedConnection[IDLE_CONNECTION_CHECKED_IN_AT]
1129
1106
 
1130
1107
  return typeof checkedInAt === "number" && now - checkedInAt >= idleTimeoutMillis
@@ -1174,9 +1151,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
1174
1151
  return await existingClose
1175
1152
  }
1176
1153
 
1177
- const trackedConnection = /**
1178
- * Narrows the runtime value to the documented type.
1179
- * @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean, [CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
1154
+ const trackedConnection = /** @type {import("../drivers/base.js").default & {[CLOSED_CONNECTION]?: boolean, [CONNECTION_CHECKED_OUT_AT]?: number, [IDLE_CONNECTION_CHECKED_IN_AT]?: number}} */ (connection)
1180
1155
 
1181
1156
  trackedConnection[CLOSED_CONNECTION] = true
1182
1157
  delete trackedConnection[CONNECTION_CHECKED_OUT_AT]
@@ -28,20 +28,12 @@ export default function baseMethodsForward(PoolBase) {
28
28
  "updateSql"
29
29
  ]
30
30
 
31
- const prototype = /**
32
- * Narrows the runtime value to the documented type.
33
- * @type {Record<string, (...args: Array<?>) => ?>} */ (/**
34
- * Narrows the runtime value to the documented type.
35
- * @type {?} */ (PoolBase.prototype))
31
+ const prototype = /** @type {Record<string, (...args: Array<?>) => ?>} */ (/** @type {?} */ (PoolBase.prototype))
36
32
 
37
33
  for (const forwardMethod of forwardMethods) {
38
34
  prototype[forwardMethod] = function(...args) {
39
35
  const connection = this.getCurrentConnection()
40
- const connectionRecord = /**
41
- * Narrows the runtime value to the documented type.
42
- * @type {Record<string, (...args: Array<?>) => ?>} */ (/**
43
- * Narrows the runtime value to the documented type.
44
- * @type {?} */ (connection))
36
+ const connectionRecord = /** @type {Record<string, (...args: Array<?>) => ?>} */ (/** @type {?} */ (connection))
45
37
  const connectionMethod = connectionRecord[forwardMethod]
46
38
 
47
39
  if (!connectionMethod) throw new Error(`${forwardMethod} isn't defined on driver`)