velocious 1.0.449 → 1.0.451

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 (636) hide show
  1. package/README.md +1 -1
  2. package/build/application.js +4 -4
  3. package/build/authorization/ability.js +8 -8
  4. package/build/authorization/base-resource.js +4 -4
  5. package/build/background-jobs/cron-expression.js +1 -1
  6. package/build/background-jobs/forked-runner-child.js +1 -1
  7. package/build/background-jobs/job-registry.js +1 -1
  8. package/build/background-jobs/job-runner.js +1 -1
  9. package/build/background-jobs/job.js +1 -1
  10. package/build/background-jobs/json-socket.js +4 -4
  11. package/build/background-jobs/main.js +21 -21
  12. package/build/background-jobs/scheduler.js +7 -7
  13. package/build/background-jobs/store.js +7 -7
  14. package/build/background-jobs/web/controller.js +2 -2
  15. package/build/background-jobs/worker.js +12 -12
  16. package/build/beacon/client.js +11 -8
  17. package/build/beacon/in-process-broker.js +2 -2
  18. package/build/beacon/in-process-client.js +2 -2
  19. package/build/beacon/server.js +3 -3
  20. package/build/cli/browser-cli.js +1 -1
  21. package/build/cli/commands/db/base-command.js +2 -2
  22. package/build/cli/index.js +2 -2
  23. package/build/cli/tenant-database-command-helper.js +3 -3
  24. package/build/cli/use-browser-cli.js +1 -1
  25. package/build/configuration-types.js +3 -1
  26. package/build/configuration.js +38 -38
  27. package/build/controller.js +8 -8
  28. package/build/current-configuration.js +1 -1
  29. package/build/database/annotations-async-hooks.js +2 -2
  30. package/build/database/annotations.js +3 -3
  31. package/build/database/drivers/base-column.js +1 -1
  32. package/build/database/drivers/base-foreign-key.js +1 -1
  33. package/build/database/drivers/base-table.js +1 -1
  34. package/build/database/drivers/base.js +10 -10
  35. package/build/database/drivers/mssql/index.js +1 -1
  36. package/build/database/drivers/mssql/table.js +1 -1
  37. package/build/database/drivers/mysql/index.js +3 -3
  38. package/build/database/drivers/mysql/query.js +1 -1
  39. package/build/database/drivers/mysql/table.js +1 -1
  40. package/build/database/drivers/pgsql/index.js +2 -2
  41. package/build/database/drivers/sqlite/base.js +16 -16
  42. package/build/database/drivers/sqlite/index.js +11 -11
  43. package/build/database/drivers/sqlite/index.native.js +1 -1
  44. package/build/database/drivers/sqlite/index.web.js +3 -3
  45. package/build/database/drivers/sqlite/query.js +1 -1
  46. package/build/database/drivers/sqlite/query.web.js +1 -1
  47. package/build/database/drivers/sqlite/sql/alter-table.js +2 -2
  48. package/build/database/drivers/sqlite/table.js +1 -1
  49. package/build/database/migrator/files-finder.js +1 -1
  50. package/build/database/migrator.js +6 -6
  51. package/build/database/pool/async-tracked-multi-connection.js +27 -27
  52. package/build/database/pool/base-methods-forward.js +4 -4
  53. package/build/database/pool/base.js +8 -8
  54. package/build/database/query/from-base.js +1 -1
  55. package/build/database/query/index.js +10 -10
  56. package/build/database/query/join-object.js +3 -3
  57. package/build/database/query/model-class-query.js +39 -39
  58. package/build/database/query/preloader/belongs-to.js +22 -22
  59. package/build/database/query/preloader/has-many.js +20 -20
  60. package/build/database/query/preloader/has-one.js +8 -8
  61. package/build/database/query/preloader/selection.js +3 -3
  62. package/build/database/query/preloader.js +8 -8
  63. package/build/database/query/query-data.js +9 -9
  64. package/build/database/query/where-model-class-hash.js +7 -7
  65. package/build/database/query/with-count.js +9 -9
  66. package/build/database/record/acts-as-list.js +15 -15
  67. package/build/database/record/attachments/handle.js +2 -2
  68. package/build/database/record/attachments/normalize-input.js +12 -12
  69. package/build/database/record/attachments/storage-drivers/s3.js +6 -6
  70. package/build/database/record/attachments/store.js +13 -13
  71. package/build/database/record/index.js +115 -121
  72. package/build/database/record/instance-relationships/base.js +11 -11
  73. package/build/database/record/instance-relationships/belongs-to.js +3 -3
  74. package/build/database/record/instance-relationships/has-many.js +8 -8
  75. package/build/database/record/instance-relationships/has-one.js +7 -7
  76. package/build/database/record/relationships/base.js +2 -2
  77. package/build/database/record/state-machine.js +7 -7
  78. package/build/database/record/validators/presence.js +1 -1
  79. package/build/database/record/validators/uniqueness.js +5 -5
  80. package/build/database/table-data/index.js +4 -4
  81. package/build/environment-handlers/base.js +2 -2
  82. package/build/environment-handlers/browser.js +7 -7
  83. package/build/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
  84. package/build/environment-handlers/node/cli/commands/console.js +4 -4
  85. package/build/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
  86. package/build/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
  87. package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +836 -60
  88. package/build/environment-handlers/node.js +6 -6
  89. package/build/frontend-model-controller.js +81 -82
  90. package/build/frontend-model-resource/base-resource.js +78 -115
  91. package/build/frontend-models/base.js +162 -149
  92. package/build/frontend-models/clear-pending-debounced-callback.js +1 -1
  93. package/build/frontend-models/event-hook-models.js +2 -2
  94. package/build/frontend-models/outgoing-event-buffer.js +2 -2
  95. package/build/frontend-models/preloader.js +5 -5
  96. package/build/frontend-models/query.js +43 -38
  97. package/build/frontend-models/resource-definition.js +6 -6
  98. package/build/frontend-models/transport-serialization.js +11 -11
  99. package/build/frontend-models/use-destroyed-event.js +10 -10
  100. package/build/frontend-models/use-model-class-event.js +11 -11
  101. package/build/frontend-models/use-updated-event.js +11 -11
  102. package/build/frontend-models/websocket-channel.js +26 -17
  103. package/build/frontend-models/websocket-publishers.js +9 -9
  104. package/build/http-client/response.js +2 -2
  105. package/build/http-server/client/index.js +8 -8
  106. package/build/http-server/client/params-to-object.js +10 -10
  107. package/build/http-server/client/request-buffer/form-data-part.js +2 -2
  108. package/build/http-server/client/request-buffer/index.js +8 -8
  109. package/build/http-server/client/request-parser.js +3 -3
  110. package/build/http-server/client/request-runner.js +6 -6
  111. package/build/http-server/client/request-timing.js +5 -5
  112. package/build/http-server/client/request.js +1 -1
  113. package/build/http-server/client/response.js +5 -5
  114. package/build/http-server/client/websocket-request.js +4 -4
  115. package/build/http-server/client/websocket-session.js +18 -18
  116. package/build/http-server/development-reloader.js +5 -5
  117. package/build/http-server/index.js +12 -12
  118. package/build/http-server/remote-address.js +4 -4
  119. package/build/http-server/server-client.js +3 -3
  120. package/build/http-server/server-lock.js +4 -4
  121. package/build/http-server/websocket-channel-subscribers.js +3 -3
  122. package/build/http-server/websocket-channel.js +1 -1
  123. package/build/http-server/websocket-connection.js +1 -1
  124. package/build/http-server/websocket-event-log-store.js +6 -6
  125. package/build/http-server/websocket-events-host.js +2 -2
  126. package/build/http-server/worker-handler/in-process.js +7 -7
  127. package/build/http-server/worker-handler/index.js +4 -4
  128. package/build/http-server/worker-handler/worker-thread.js +3 -3
  129. package/build/logger/outputs/array-output.js +3 -3
  130. package/build/logger/outputs/console-output.js +1 -1
  131. package/build/logger/outputs/file-output.js +4 -4
  132. package/build/logger/outputs/stdout-output.js +1 -1
  133. package/build/logger.js +10 -10
  134. package/build/mailer/backends/smtp.js +3 -3
  135. package/build/mailer/base.js +8 -8
  136. package/build/mailer/delivery.js +4 -4
  137. package/build/plugins/sqljs-wasm-route-controller.js +1 -1
  138. package/build/routes/base-route.js +6 -6
  139. package/build/routes/basic-route.js +1 -1
  140. package/build/routes/hooks/frontend-model-command-route-hook.js +1 -1
  141. package/build/routes/index.js +1 -1
  142. package/build/routes/plugin-routes.js +1 -1
  143. package/build/routes/resolver.js +11 -11
  144. package/build/routes/resource-route.js +1 -1
  145. package/build/src/application.d.ts +3 -3
  146. package/build/src/application.d.ts.map +1 -1
  147. package/build/src/application.js +5 -5
  148. package/build/src/authorization/ability.d.ts +7 -7
  149. package/build/src/authorization/ability.d.ts.map +1 -1
  150. package/build/src/authorization/ability.js +9 -9
  151. package/build/src/authorization/base-resource.d.ts +1 -1
  152. package/build/src/authorization/base-resource.d.ts.map +1 -1
  153. package/build/src/authorization/base-resource.js +5 -5
  154. package/build/src/background-jobs/cron-expression.js +2 -2
  155. package/build/src/background-jobs/forked-runner-child.js +2 -2
  156. package/build/src/background-jobs/job-registry.d.ts +1 -1
  157. package/build/src/background-jobs/job-registry.d.ts.map +1 -1
  158. package/build/src/background-jobs/job-registry.js +2 -2
  159. package/build/src/background-jobs/job-runner.js +2 -2
  160. package/build/src/background-jobs/job.js +2 -2
  161. package/build/src/background-jobs/json-socket.d.ts +4 -4
  162. package/build/src/background-jobs/json-socket.d.ts.map +1 -1
  163. package/build/src/background-jobs/json-socket.js +5 -5
  164. package/build/src/background-jobs/main.d.ts +18 -18
  165. package/build/src/background-jobs/main.d.ts.map +1 -1
  166. package/build/src/background-jobs/main.js +22 -22
  167. package/build/src/background-jobs/scheduler.d.ts +5 -5
  168. package/build/src/background-jobs/scheduler.d.ts.map +1 -1
  169. package/build/src/background-jobs/scheduler.js +8 -8
  170. package/build/src/background-jobs/store.js +8 -8
  171. package/build/src/background-jobs/web/controller.js +3 -3
  172. package/build/src/background-jobs/worker.d.ts +6 -6
  173. package/build/src/background-jobs/worker.d.ts.map +1 -1
  174. package/build/src/background-jobs/worker.js +13 -13
  175. package/build/src/beacon/client.d.ts +4 -4
  176. package/build/src/beacon/client.d.ts.map +1 -1
  177. package/build/src/beacon/client.js +12 -9
  178. package/build/src/beacon/in-process-broker.d.ts.map +1 -1
  179. package/build/src/beacon/in-process-broker.js +3 -3
  180. package/build/src/beacon/in-process-client.d.ts +1 -1
  181. package/build/src/beacon/in-process-client.d.ts.map +1 -1
  182. package/build/src/beacon/in-process-client.js +3 -3
  183. package/build/src/beacon/server.d.ts +2 -2
  184. package/build/src/beacon/server.d.ts.map +1 -1
  185. package/build/src/beacon/server.js +4 -4
  186. package/build/src/cli/browser-cli.js +2 -2
  187. package/build/src/cli/commands/db/base-command.d.ts +2 -2
  188. package/build/src/cli/commands/db/base-command.d.ts.map +1 -1
  189. package/build/src/cli/commands/db/base-command.js +3 -3
  190. package/build/src/cli/index.js +3 -3
  191. package/build/src/cli/tenant-database-command-helper.d.ts +1 -1
  192. package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
  193. package/build/src/cli/tenant-database-command-helper.js +4 -4
  194. package/build/src/cli/use-browser-cli.js +2 -2
  195. package/build/src/configuration-types.d.ts +12 -2
  196. package/build/src/configuration-types.d.ts.map +1 -1
  197. package/build/src/configuration-types.js +4 -2
  198. package/build/src/configuration.d.ts +14 -14
  199. package/build/src/configuration.d.ts.map +1 -1
  200. package/build/src/configuration.js +39 -39
  201. package/build/src/controller.js +10 -10
  202. package/build/src/current-configuration.js +2 -2
  203. package/build/src/database/annotations-async-hooks.js +3 -3
  204. package/build/src/database/annotations.d.ts.map +1 -1
  205. package/build/src/database/annotations.js +4 -4
  206. package/build/src/database/drivers/base-column.d.ts +1 -1
  207. package/build/src/database/drivers/base-column.d.ts.map +1 -1
  208. package/build/src/database/drivers/base-column.js +2 -2
  209. package/build/src/database/drivers/base-foreign-key.d.ts +1 -1
  210. package/build/src/database/drivers/base-foreign-key.d.ts.map +1 -1
  211. package/build/src/database/drivers/base-foreign-key.js +2 -2
  212. package/build/src/database/drivers/base-table.d.ts +1 -1
  213. package/build/src/database/drivers/base-table.d.ts.map +1 -1
  214. package/build/src/database/drivers/base-table.js +2 -2
  215. package/build/src/database/drivers/base.d.ts +6 -6
  216. package/build/src/database/drivers/base.d.ts.map +1 -1
  217. package/build/src/database/drivers/base.js +11 -11
  218. package/build/src/database/drivers/mssql/index.js +2 -2
  219. package/build/src/database/drivers/mssql/table.js +2 -2
  220. package/build/src/database/drivers/mysql/index.js +4 -4
  221. package/build/src/database/drivers/mysql/query.js +2 -2
  222. package/build/src/database/drivers/mysql/table.js +2 -2
  223. package/build/src/database/drivers/pgsql/index.js +3 -3
  224. package/build/src/database/drivers/sqlite/base.d.ts +3 -3
  225. package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
  226. package/build/src/database/drivers/sqlite/base.js +17 -17
  227. package/build/src/database/drivers/sqlite/index.d.ts +4 -4
  228. package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
  229. package/build/src/database/drivers/sqlite/index.js +12 -12
  230. package/build/src/database/drivers/sqlite/index.native.js +2 -2
  231. package/build/src/database/drivers/sqlite/index.web.d.ts +2 -2
  232. package/build/src/database/drivers/sqlite/index.web.d.ts.map +1 -1
  233. package/build/src/database/drivers/sqlite/index.web.js +4 -4
  234. package/build/src/database/drivers/sqlite/query.js +2 -2
  235. package/build/src/database/drivers/sqlite/query.web.js +2 -2
  236. package/build/src/database/drivers/sqlite/sql/alter-table.js +3 -3
  237. package/build/src/database/drivers/sqlite/table.js +2 -2
  238. package/build/src/database/migrator/files-finder.js +2 -2
  239. package/build/src/database/migrator.d.ts +1 -1
  240. package/build/src/database/migrator.d.ts.map +1 -1
  241. package/build/src/database/migrator.js +7 -7
  242. package/build/src/database/pool/async-tracked-multi-connection.d.ts +9 -9
  243. package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
  244. package/build/src/database/pool/async-tracked-multi-connection.js +28 -28
  245. package/build/src/database/pool/base-methods-forward.js +7 -7
  246. package/build/src/database/pool/base.d.ts +1 -1
  247. package/build/src/database/pool/base.d.ts.map +1 -1
  248. package/build/src/database/pool/base.js +9 -9
  249. package/build/src/database/query/from-base.d.ts +1 -1
  250. package/build/src/database/query/from-base.d.ts.map +1 -1
  251. package/build/src/database/query/from-base.js +2 -2
  252. package/build/src/database/query/index.d.ts +4 -4
  253. package/build/src/database/query/index.d.ts.map +1 -1
  254. package/build/src/database/query/index.js +11 -11
  255. package/build/src/database/query/join-object.js +4 -4
  256. package/build/src/database/query/model-class-query.d.ts +4 -4
  257. package/build/src/database/query/model-class-query.d.ts.map +1 -1
  258. package/build/src/database/query/model-class-query.js +40 -40
  259. package/build/src/database/query/preloader/belongs-to.js +23 -23
  260. package/build/src/database/query/preloader/has-many.js +21 -21
  261. package/build/src/database/query/preloader/has-one.js +9 -9
  262. package/build/src/database/query/preloader/selection.js +4 -4
  263. package/build/src/database/query/preloader.js +9 -9
  264. package/build/src/database/query/query-data.js +10 -10
  265. package/build/src/database/query/where-model-class-hash.js +8 -8
  266. package/build/src/database/query/with-count.js +10 -10
  267. package/build/src/database/record/acts-as-list.js +20 -20
  268. package/build/src/database/record/attachments/handle.d.ts +1 -1
  269. package/build/src/database/record/attachments/handle.d.ts.map +1 -1
  270. package/build/src/database/record/attachments/handle.js +3 -3
  271. package/build/src/database/record/attachments/normalize-input.js +15 -15
  272. package/build/src/database/record/attachments/storage-drivers/s3.js +7 -7
  273. package/build/src/database/record/attachments/store.d.ts +2 -2
  274. package/build/src/database/record/attachments/store.d.ts.map +1 -1
  275. package/build/src/database/record/attachments/store.js +14 -14
  276. package/build/src/database/record/index.d.ts +18 -25
  277. package/build/src/database/record/index.d.ts.map +1 -1
  278. package/build/src/database/record/index.js +135 -141
  279. package/build/src/database/record/instance-relationships/base.d.ts +3 -3
  280. package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
  281. package/build/src/database/record/instance-relationships/base.js +13 -13
  282. package/build/src/database/record/instance-relationships/belongs-to.js +4 -4
  283. package/build/src/database/record/instance-relationships/has-many.js +9 -9
  284. package/build/src/database/record/instance-relationships/has-one.d.ts +1 -1
  285. package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
  286. package/build/src/database/record/instance-relationships/has-one.js +8 -8
  287. package/build/src/database/record/relationships/base.js +4 -4
  288. package/build/src/database/record/state-machine.js +8 -8
  289. package/build/src/database/record/validators/presence.js +2 -2
  290. package/build/src/database/record/validators/uniqueness.js +6 -6
  291. package/build/src/database/table-data/index.d.ts +4 -4
  292. package/build/src/database/table-data/index.d.ts.map +1 -1
  293. package/build/src/database/table-data/index.js +5 -5
  294. package/build/src/environment-handlers/base.js +3 -3
  295. package/build/src/environment-handlers/browser.d.ts +3 -3
  296. package/build/src/environment-handlers/browser.d.ts.map +1 -1
  297. package/build/src/environment-handlers/browser.js +8 -8
  298. package/build/src/environment-handlers/node/cli/commands/cli-command-context.js +2 -2
  299. package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
  300. package/build/src/environment-handlers/node/cli/commands/console.js +5 -5
  301. package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts +1 -1
  302. package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts.map +1 -1
  303. package/build/src/environment-handlers/node/cli/commands/db/schema/dump.js +2 -2
  304. package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts +1 -1
  305. package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
  306. package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +4 -4
  307. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +285 -12
  308. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
  309. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +712 -61
  310. package/build/src/environment-handlers/node.d.ts +2 -2
  311. package/build/src/environment-handlers/node.d.ts.map +1 -1
  312. package/build/src/environment-handlers/node.js +7 -7
  313. package/build/src/frontend-model-controller.d.ts +5 -6
  314. package/build/src/frontend-model-controller.d.ts.map +1 -1
  315. package/build/src/frontend-model-controller.js +88 -89
  316. package/build/src/frontend-model-resource/base-resource.d.ts +36 -27
  317. package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
  318. package/build/src/frontend-model-resource/base-resource.js +67 -120
  319. package/build/src/frontend-models/base.d.ts +67 -59
  320. package/build/src/frontend-models/base.d.ts.map +1 -1
  321. package/build/src/frontend-models/base.js +171 -158
  322. package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -2
  323. package/build/src/frontend-models/event-hook-models.d.ts.map +1 -1
  324. package/build/src/frontend-models/event-hook-models.js +3 -3
  325. package/build/src/frontend-models/outgoing-event-buffer.d.ts +1 -1
  326. package/build/src/frontend-models/outgoing-event-buffer.d.ts.map +1 -1
  327. package/build/src/frontend-models/outgoing-event-buffer.js +3 -3
  328. package/build/src/frontend-models/preloader.js +6 -6
  329. package/build/src/frontend-models/query.d.ts +16 -8
  330. package/build/src/frontend-models/query.d.ts.map +1 -1
  331. package/build/src/frontend-models/query.js +43 -39
  332. package/build/src/frontend-models/resource-definition.js +7 -7
  333. package/build/src/frontend-models/transport-serialization.js +12 -12
  334. package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
  335. package/build/src/frontend-models/use-destroyed-event.js +11 -11
  336. package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
  337. package/build/src/frontend-models/use-model-class-event.js +12 -12
  338. package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
  339. package/build/src/frontend-models/use-updated-event.js +12 -12
  340. package/build/src/frontend-models/websocket-channel.d.ts +6 -1
  341. package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
  342. package/build/src/frontend-models/websocket-channel.js +26 -18
  343. package/build/src/frontend-models/websocket-publishers.js +11 -11
  344. package/build/src/http-client/response.d.ts +2 -2
  345. package/build/src/http-client/response.d.ts.map +1 -1
  346. package/build/src/http-client/response.js +3 -3
  347. package/build/src/http-server/client/index.d.ts +1 -1
  348. package/build/src/http-server/client/index.d.ts.map +1 -1
  349. package/build/src/http-server/client/index.js +9 -9
  350. package/build/src/http-server/client/params-to-object.js +11 -11
  351. package/build/src/http-server/client/request-buffer/form-data-part.d.ts +2 -2
  352. package/build/src/http-server/client/request-buffer/form-data-part.d.ts.map +1 -1
  353. package/build/src/http-server/client/request-buffer/form-data-part.js +3 -3
  354. package/build/src/http-server/client/request-buffer/index.d.ts +4 -4
  355. package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
  356. package/build/src/http-server/client/request-buffer/index.js +9 -9
  357. package/build/src/http-server/client/request-parser.d.ts +1 -1
  358. package/build/src/http-server/client/request-parser.d.ts.map +1 -1
  359. package/build/src/http-server/client/request-parser.js +4 -4
  360. package/build/src/http-server/client/request-runner.js +7 -7
  361. package/build/src/http-server/client/request-timing.d.ts +5 -5
  362. package/build/src/http-server/client/request-timing.d.ts.map +1 -1
  363. package/build/src/http-server/client/request-timing.js +6 -6
  364. package/build/src/http-server/client/request.js +2 -2
  365. package/build/src/http-server/client/response.d.ts +3 -3
  366. package/build/src/http-server/client/response.d.ts.map +1 -1
  367. package/build/src/http-server/client/response.js +6 -6
  368. package/build/src/http-server/client/websocket-request.d.ts +3 -3
  369. package/build/src/http-server/client/websocket-request.d.ts.map +1 -1
  370. package/build/src/http-server/client/websocket-request.js +5 -5
  371. package/build/src/http-server/client/websocket-session.d.ts +6 -6
  372. package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
  373. package/build/src/http-server/client/websocket-session.js +19 -19
  374. package/build/src/http-server/development-reloader.d.ts +3 -3
  375. package/build/src/http-server/development-reloader.d.ts.map +1 -1
  376. package/build/src/http-server/development-reloader.js +6 -6
  377. package/build/src/http-server/index.d.ts +7 -7
  378. package/build/src/http-server/index.d.ts.map +1 -1
  379. package/build/src/http-server/index.js +13 -13
  380. package/build/src/http-server/remote-address.js +6 -6
  381. package/build/src/http-server/server-client.js +4 -4
  382. package/build/src/http-server/server-lock.js +5 -5
  383. package/build/src/http-server/websocket-channel-subscribers.d.ts +1 -1
  384. package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
  385. package/build/src/http-server/websocket-channel-subscribers.js +4 -4
  386. package/build/src/http-server/websocket-channel.d.ts +1 -1
  387. package/build/src/http-server/websocket-channel.d.ts.map +1 -1
  388. package/build/src/http-server/websocket-channel.js +2 -2
  389. package/build/src/http-server/websocket-connection.d.ts +1 -1
  390. package/build/src/http-server/websocket-connection.d.ts.map +1 -1
  391. package/build/src/http-server/websocket-connection.js +2 -2
  392. package/build/src/http-server/websocket-event-log-store.d.ts +1 -1
  393. package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
  394. package/build/src/http-server/websocket-event-log-store.js +7 -7
  395. package/build/src/http-server/websocket-events-host.d.ts +1 -1
  396. package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
  397. package/build/src/http-server/websocket-events-host.js +3 -3
  398. package/build/src/http-server/worker-handler/in-process.d.ts +3 -3
  399. package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
  400. package/build/src/http-server/worker-handler/in-process.js +9 -9
  401. package/build/src/http-server/worker-handler/index.d.ts +4 -4
  402. package/build/src/http-server/worker-handler/index.d.ts.map +1 -1
  403. package/build/src/http-server/worker-handler/index.js +5 -5
  404. package/build/src/http-server/worker-handler/worker-thread.d.ts +2 -2
  405. package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
  406. package/build/src/http-server/worker-handler/worker-thread.js +4 -4
  407. package/build/src/logger/outputs/array-output.d.ts +3 -3
  408. package/build/src/logger/outputs/array-output.d.ts.map +1 -1
  409. package/build/src/logger/outputs/array-output.js +4 -4
  410. package/build/src/logger/outputs/console-output.d.ts +1 -1
  411. package/build/src/logger/outputs/console-output.d.ts.map +1 -1
  412. package/build/src/logger/outputs/console-output.js +2 -2
  413. package/build/src/logger/outputs/file-output.d.ts +4 -4
  414. package/build/src/logger/outputs/file-output.d.ts.map +1 -1
  415. package/build/src/logger/outputs/file-output.js +5 -5
  416. package/build/src/logger/outputs/stdout-output.d.ts.map +1 -1
  417. package/build/src/logger/outputs/stdout-output.js +2 -2
  418. package/build/src/logger.d.ts.map +1 -1
  419. package/build/src/logger.js +11 -11
  420. package/build/src/mailer/backends/smtp.d.ts.map +1 -1
  421. package/build/src/mailer/backends/smtp.js +5 -5
  422. package/build/src/mailer/base.js +11 -11
  423. package/build/src/mailer/delivery.d.ts +3 -3
  424. package/build/src/mailer/delivery.d.ts.map +1 -1
  425. package/build/src/mailer/delivery.js +5 -5
  426. package/build/src/plugins/sqljs-wasm-route-controller.js +2 -2
  427. package/build/src/routes/base-route.d.ts +6 -6
  428. package/build/src/routes/base-route.d.ts.map +1 -1
  429. package/build/src/routes/base-route.js +7 -7
  430. package/build/src/routes/basic-route.js +2 -2
  431. package/build/src/routes/hooks/frontend-model-command-route-hook.js +2 -2
  432. package/build/src/routes/index.js +2 -2
  433. package/build/src/routes/plugin-routes.js +2 -2
  434. package/build/src/routes/resolver.d.ts +1 -1
  435. package/build/src/routes/resolver.d.ts.map +1 -1
  436. package/build/src/routes/resolver.js +13 -13
  437. package/build/src/routes/resource-route.d.ts +1 -1
  438. package/build/src/routes/resource-route.d.ts.map +1 -1
  439. package/build/src/routes/resource-route.js +2 -2
  440. package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts.map +1 -1
  441. package/build/src/testing/browser-frontend-model-event-hook-scenarios.js +8 -8
  442. package/build/src/testing/expect-utils.js +13 -13
  443. package/build/src/testing/expect.d.ts +1 -1
  444. package/build/src/testing/expect.d.ts.map +1 -1
  445. package/build/src/testing/expect.js +9 -9
  446. package/build/src/testing/test-files-finder.d.ts +8 -8
  447. package/build/src/testing/test-files-finder.d.ts.map +1 -1
  448. package/build/src/testing/test-files-finder.js +9 -9
  449. package/build/src/testing/test-filter-parser.js +3 -3
  450. package/build/src/testing/test-runner.d.ts +2 -2
  451. package/build/src/testing/test-runner.d.ts.map +1 -1
  452. package/build/src/testing/test-runner.js +17 -17
  453. package/build/src/testing/test-suite-splitter.js +2 -2
  454. package/build/src/testing/test.d.ts +2 -2
  455. package/build/src/testing/test.d.ts.map +1 -1
  456. package/build/src/testing/test.js +16 -16
  457. package/build/src/utils/backtrace-cleaner.d.ts +1 -1
  458. package/build/src/utils/backtrace-cleaner.d.ts.map +1 -1
  459. package/build/src/utils/backtrace-cleaner.js +2 -2
  460. package/build/src/utils/format-value.js +2 -2
  461. package/build/src/utils/model-scope.js +2 -2
  462. package/build/src/utils/ransack.js +27 -27
  463. package/build/src/utils/with-tracked-stack-async-hooks.js +8 -8
  464. package/build/src/utils/with-tracked-stack.js +4 -4
  465. package/build/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
  466. package/build/testing/expect-utils.js +11 -11
  467. package/build/testing/expect.js +7 -7
  468. package/build/testing/test-files-finder.js +8 -8
  469. package/build/testing/test-filter-parser.js +2 -2
  470. package/build/testing/test-runner.js +16 -16
  471. package/build/testing/test-suite-splitter.js +1 -1
  472. package/build/testing/test.js +15 -15
  473. package/build/utils/backtrace-cleaner.js +1 -1
  474. package/build/utils/format-value.js +1 -1
  475. package/build/utils/model-scope.js +1 -1
  476. package/build/utils/ransack.js +26 -26
  477. package/build/utils/with-tracked-stack-async-hooks.js +7 -7
  478. package/build/utils/with-tracked-stack.js +3 -3
  479. package/package.json +2 -1
  480. package/src/application.js +4 -4
  481. package/src/authorization/ability.js +8 -8
  482. package/src/authorization/base-resource.js +4 -4
  483. package/src/background-jobs/cron-expression.js +1 -1
  484. package/src/background-jobs/forked-runner-child.js +1 -1
  485. package/src/background-jobs/job-registry.js +1 -1
  486. package/src/background-jobs/job-runner.js +1 -1
  487. package/src/background-jobs/job.js +1 -1
  488. package/src/background-jobs/json-socket.js +4 -4
  489. package/src/background-jobs/main.js +21 -21
  490. package/src/background-jobs/scheduler.js +7 -7
  491. package/src/background-jobs/store.js +7 -7
  492. package/src/background-jobs/web/controller.js +2 -2
  493. package/src/background-jobs/worker.js +12 -12
  494. package/src/beacon/client.js +11 -8
  495. package/src/beacon/in-process-broker.js +2 -2
  496. package/src/beacon/in-process-client.js +2 -2
  497. package/src/beacon/server.js +3 -3
  498. package/src/cli/browser-cli.js +1 -1
  499. package/src/cli/commands/db/base-command.js +2 -2
  500. package/src/cli/index.js +2 -2
  501. package/src/cli/tenant-database-command-helper.js +3 -3
  502. package/src/cli/use-browser-cli.js +1 -1
  503. package/src/configuration-types.js +3 -1
  504. package/src/configuration.js +38 -38
  505. package/src/controller.js +8 -8
  506. package/src/current-configuration.js +1 -1
  507. package/src/database/annotations-async-hooks.js +2 -2
  508. package/src/database/annotations.js +3 -3
  509. package/src/database/drivers/base-column.js +1 -1
  510. package/src/database/drivers/base-foreign-key.js +1 -1
  511. package/src/database/drivers/base-table.js +1 -1
  512. package/src/database/drivers/base.js +10 -10
  513. package/src/database/drivers/mssql/index.js +1 -1
  514. package/src/database/drivers/mssql/table.js +1 -1
  515. package/src/database/drivers/mysql/index.js +3 -3
  516. package/src/database/drivers/mysql/query.js +1 -1
  517. package/src/database/drivers/mysql/table.js +1 -1
  518. package/src/database/drivers/pgsql/index.js +2 -2
  519. package/src/database/drivers/sqlite/base.js +16 -16
  520. package/src/database/drivers/sqlite/index.js +11 -11
  521. package/src/database/drivers/sqlite/index.native.js +1 -1
  522. package/src/database/drivers/sqlite/index.web.js +3 -3
  523. package/src/database/drivers/sqlite/query.js +1 -1
  524. package/src/database/drivers/sqlite/query.web.js +1 -1
  525. package/src/database/drivers/sqlite/sql/alter-table.js +2 -2
  526. package/src/database/drivers/sqlite/table.js +1 -1
  527. package/src/database/migrator/files-finder.js +1 -1
  528. package/src/database/migrator.js +6 -6
  529. package/src/database/pool/async-tracked-multi-connection.js +27 -27
  530. package/src/database/pool/base-methods-forward.js +4 -4
  531. package/src/database/pool/base.js +8 -8
  532. package/src/database/query/from-base.js +1 -1
  533. package/src/database/query/index.js +10 -10
  534. package/src/database/query/join-object.js +3 -3
  535. package/src/database/query/model-class-query.js +39 -39
  536. package/src/database/query/preloader/belongs-to.js +22 -22
  537. package/src/database/query/preloader/has-many.js +20 -20
  538. package/src/database/query/preloader/has-one.js +8 -8
  539. package/src/database/query/preloader/selection.js +3 -3
  540. package/src/database/query/preloader.js +8 -8
  541. package/src/database/query/query-data.js +9 -9
  542. package/src/database/query/where-model-class-hash.js +7 -7
  543. package/src/database/query/with-count.js +9 -9
  544. package/src/database/record/acts-as-list.js +15 -15
  545. package/src/database/record/attachments/handle.js +2 -2
  546. package/src/database/record/attachments/normalize-input.js +12 -12
  547. package/src/database/record/attachments/storage-drivers/s3.js +6 -6
  548. package/src/database/record/attachments/store.js +13 -13
  549. package/src/database/record/index.js +115 -121
  550. package/src/database/record/instance-relationships/base.js +11 -11
  551. package/src/database/record/instance-relationships/belongs-to.js +3 -3
  552. package/src/database/record/instance-relationships/has-many.js +8 -8
  553. package/src/database/record/instance-relationships/has-one.js +7 -7
  554. package/src/database/record/relationships/base.js +2 -2
  555. package/src/database/record/state-machine.js +7 -7
  556. package/src/database/record/validators/presence.js +1 -1
  557. package/src/database/record/validators/uniqueness.js +5 -5
  558. package/src/database/table-data/index.js +4 -4
  559. package/src/environment-handlers/base.js +2 -2
  560. package/src/environment-handlers/browser.js +7 -7
  561. package/src/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
  562. package/src/environment-handlers/node/cli/commands/console.js +4 -4
  563. package/src/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
  564. package/src/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
  565. package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +836 -60
  566. package/src/environment-handlers/node.js +6 -6
  567. package/src/frontend-model-controller.js +81 -82
  568. package/src/frontend-model-resource/base-resource.js +78 -115
  569. package/src/frontend-models/base.js +162 -149
  570. package/src/frontend-models/clear-pending-debounced-callback.js +1 -1
  571. package/src/frontend-models/event-hook-models.js +2 -2
  572. package/src/frontend-models/outgoing-event-buffer.js +2 -2
  573. package/src/frontend-models/preloader.js +5 -5
  574. package/src/frontend-models/query.js +43 -38
  575. package/src/frontend-models/resource-definition.js +6 -6
  576. package/src/frontend-models/transport-serialization.js +11 -11
  577. package/src/frontend-models/use-destroyed-event.js +10 -10
  578. package/src/frontend-models/use-model-class-event.js +11 -11
  579. package/src/frontend-models/use-updated-event.js +11 -11
  580. package/src/frontend-models/websocket-channel.js +26 -17
  581. package/src/frontend-models/websocket-publishers.js +9 -9
  582. package/src/http-client/response.js +2 -2
  583. package/src/http-server/client/index.js +8 -8
  584. package/src/http-server/client/params-to-object.js +10 -10
  585. package/src/http-server/client/request-buffer/form-data-part.js +2 -2
  586. package/src/http-server/client/request-buffer/index.js +8 -8
  587. package/src/http-server/client/request-parser.js +3 -3
  588. package/src/http-server/client/request-runner.js +6 -6
  589. package/src/http-server/client/request-timing.js +5 -5
  590. package/src/http-server/client/request.js +1 -1
  591. package/src/http-server/client/response.js +5 -5
  592. package/src/http-server/client/websocket-request.js +4 -4
  593. package/src/http-server/client/websocket-session.js +18 -18
  594. package/src/http-server/development-reloader.js +5 -5
  595. package/src/http-server/index.js +12 -12
  596. package/src/http-server/remote-address.js +4 -4
  597. package/src/http-server/server-client.js +3 -3
  598. package/src/http-server/server-lock.js +4 -4
  599. package/src/http-server/websocket-channel-subscribers.js +3 -3
  600. package/src/http-server/websocket-channel.js +1 -1
  601. package/src/http-server/websocket-connection.js +1 -1
  602. package/src/http-server/websocket-event-log-store.js +6 -6
  603. package/src/http-server/websocket-events-host.js +2 -2
  604. package/src/http-server/worker-handler/in-process.js +7 -7
  605. package/src/http-server/worker-handler/index.js +4 -4
  606. package/src/http-server/worker-handler/worker-thread.js +3 -3
  607. package/src/logger/outputs/array-output.js +3 -3
  608. package/src/logger/outputs/console-output.js +1 -1
  609. package/src/logger/outputs/file-output.js +4 -4
  610. package/src/logger/outputs/stdout-output.js +1 -1
  611. package/src/logger.js +10 -10
  612. package/src/mailer/backends/smtp.js +3 -3
  613. package/src/mailer/base.js +8 -8
  614. package/src/mailer/delivery.js +4 -4
  615. package/src/plugins/sqljs-wasm-route-controller.js +1 -1
  616. package/src/routes/base-route.js +6 -6
  617. package/src/routes/basic-route.js +1 -1
  618. package/src/routes/hooks/frontend-model-command-route-hook.js +1 -1
  619. package/src/routes/index.js +1 -1
  620. package/src/routes/plugin-routes.js +1 -1
  621. package/src/routes/resolver.js +11 -11
  622. package/src/routes/resource-route.js +1 -1
  623. package/src/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
  624. package/src/testing/expect-utils.js +11 -11
  625. package/src/testing/expect.js +7 -7
  626. package/src/testing/test-files-finder.js +8 -8
  627. package/src/testing/test-filter-parser.js +2 -2
  628. package/src/testing/test-runner.js +16 -16
  629. package/src/testing/test-suite-splitter.js +1 -1
  630. package/src/testing/test.js +15 -15
  631. package/src/utils/backtrace-cleaner.js +1 -1
  632. package/src/utils/format-value.js +1 -1
  633. package/src/utils/model-scope.js +1 -1
  634. package/src/utils/ransack.js +26 -26
  635. package/src/utils/with-tracked-stack-async-hooks.js +7 -7
  636. package/src/utils/with-tracked-stack.js +3 -3
@@ -16,10 +16,10 @@ import {readPayloadAssociationCount, readPayloadComputedAbility, readPayloadQuer
16
16
 
17
17
  /**
18
18
  * FrontendModelCommandType type.
19
- @typedef {"create" | "find" | "index" | "update" | "destroy" | "attach" | "download" | "url"} FrontendModelCommandType */
19
+ * @typedef {"create" | "find" | "index" | "update" | "destroy" | "attach" | "download" | "url"} FrontendModelCommandType */
20
20
  /**
21
21
  * FrontendModelRequestCommandType type.
22
- @typedef {FrontendModelCommandType | string} FrontendModelRequestCommandType */
22
+ * @typedef {FrontendModelCommandType | string} FrontendModelRequestCommandType */
23
23
  /**
24
24
  * Model-like instance value supported by frontend-model transport.
25
25
  * @typedef {{attributes: () => Record<string, unknown>}} FrontendModelTransportModelValue
@@ -64,7 +64,19 @@ import {readPayloadAssociationCount, readPayloadComputedAbility, readPayloadQuer
64
64
  * @template {FrontendModelBase} [T=FrontendModelBase]
65
65
  * @template {Record<string, FrontendModelAttributeValue>} [Attributes=Record<string, FrontendModelAttributeValue>]
66
66
  * @template {Record<string, FrontendModelAttributeValue>} [CreateAttributes=Record<string, FrontendModelAttributeValue>]
67
- * @typedef {{new (attributes?: Attributes | CreateAttributes): T, create(attributes?: CreateAttributes): Promise<T>} & Omit<typeof FrontendModelBase, "create">} FrontendModelClass
67
+ * @typedef {{new (): T, create(attributes?: CreateAttributes): Promise<T>} & Omit<typeof FrontendModelBase, "create" | "prototype">} FrontendModelClass
68
+ */
69
+ /**
70
+ * Create attributes accepted by a frontend model instance.
71
+ * @template {FrontendModelBase} T
72
+ * @typedef {T extends FrontendModelBase<Record<string, FrontendModelAttributeValue>, infer CreateAttributes, infer _UpdateAttributes> ? CreateAttributes : Record<string, FrontendModelAttributeValue>} FrontendModelCreateAttributesFor
73
+ */
74
+ /**
75
+ * Loaded instance type for relationship helper generics. Older generated
76
+ * frontend models passed model classes into relationship helpers, while newer
77
+ * generated models pass instance types.
78
+ * @template {FrontendModelBase | typeof FrontendModelBase} T
79
+ * @typedef {T extends new (...args: any[]) => infer Instance ? Instance : T} FrontendModelRelationshipModel
68
80
  */
69
81
  /**
70
82
  * FrontendModelTransportConfig type.
@@ -85,7 +97,7 @@ import {readPayloadAssociationCount, readPayloadComputedAbility, readPayloadQuer
85
97
 
86
98
  /**
87
99
  * Frontend model transport config.
88
- @type {FrontendModelTransportConfig} */
100
+ * @type {FrontendModelTransportConfig} */
89
101
  const frontendModelTransportConfig = {}
90
102
  const SHARED_FRONTEND_MODEL_API_PATH = "/frontend-models"
91
103
  const PRELOADED_RELATIONSHIPS_KEY = "__preloadedRelationships"
@@ -95,19 +107,19 @@ const QUERY_DATA_KEY = "__queryData"
95
107
  const ABILITIES_KEY = "__abilities"
96
108
  /**
97
109
  * Pending shared frontend model requests.
98
- @type {Array<{commandName?: string, commandType: FrontendModelRequestCommandType, customPath?: string, modelClass: FrontendModelClass, payload: Record<string, ?>, requestId: string, resolve: (response: Record<string, ?>) => void, reject: (error: ?) => void, resourcePath?: string | null}>} */
110
+ * @type {Array<{commandName?: string, commandType: FrontendModelRequestCommandType, customPath?: string, modelClass: FrontendModelClass, payload: Record<string, ?>, requestId: string, resolve: (response: Record<string, ?>) => void, reject: (error: ?) => void, resourcePath?: string | null}>} */
99
111
  let pendingSharedFrontendModelRequests = []
100
112
  let sharedFrontendModelRequestId = 0
101
113
  let sharedFrontendModelFlushScheduled = false
102
114
  let activeFrontendModelTransportRequestCount = 0
103
115
  /**
104
116
  * Frontend model idle resolvers.
105
- @type {Array<() => void>} */
117
+ * @type {Array<() => void>} */
106
118
  let frontendModelIdleResolvers = []
107
119
 
108
120
  /**
109
121
  * Internal websocket client.
110
- @type {VelociousWebsocketClient | null} */
122
+ * @type {VelociousWebsocketClient | null} */
111
123
  let internalWebsocketClient = null
112
124
 
113
125
  /**
@@ -122,7 +134,7 @@ function frontendModelTransportIsIdle() {
122
134
 
123
135
  /**
124
136
  * Runs resolve frontend model idle waiters.
125
- @returns {void} */
137
+ * @returns {void} */
126
138
  function resolveFrontendModelIdleWaiters() {
127
139
  if (!frontendModelTransportIsIdle()) return
128
140
 
@@ -215,7 +227,7 @@ function resolveInternalWebsocketClient() {
215
227
 
216
228
  /**
217
229
  * Runs flush buffered outgoing events after reconnect.
218
- @returns {Promise<void>} */
230
+ * @returns {Promise<void>} */
219
231
  async function flushBufferedOutgoingEventsAfterReconnect() {
220
232
  if (!internalWebsocketClient) return
221
233
 
@@ -264,29 +276,29 @@ export class AttributeNotSelectedError extends Error {
264
276
 
265
277
  /**
266
278
  * Lightweight singular relationship state holder for frontend model instances.
267
- * @template {FrontendModelBase} S
268
- * @template {FrontendModelBase} T
279
+ * @template {FrontendModelBase | typeof FrontendModelBase} S
280
+ * @template {FrontendModelBase | typeof FrontendModelBase} T
269
281
  * @template {Record<string, FrontendModelAttributeValue>} [TargetCreateAttributes=Record<string, FrontendModelAttributeValue>]
270
282
  */
271
283
  export class FrontendModelSingularRelationship {
272
284
  /**
273
285
  * Runs constructor.
274
- * @param {S} model - Parent model.
286
+ * @param {FrontendModelBase} model - Parent model.
275
287
  * @param {string} relationshipName - Relationship name.
276
- * @param {FrontendModelClass<T, Record<string, FrontendModelAttributeValue>, TargetCreateAttributes> | null} targetModelClass - Target model class.
288
+ * @param {FrontendModelClass<FrontendModelRelationshipModel<T>, Record<string, FrontendModelAttributeValue>, TargetCreateAttributes> | null} targetModelClass - Target model class.
277
289
  */
278
290
  constructor(model, relationshipName, targetModelClass) {
279
291
  this.model = model
280
292
  this.relationshipName = relationshipName
281
293
  this.targetModelClass = targetModelClass
282
294
  this._preloaded = false
283
- /** @type {T | null} */
295
+ /** @type {FrontendModelRelationshipModel<T> | null} */
284
296
  this._loadedValue = null
285
297
  }
286
298
 
287
299
  /**
288
300
  * Runs set loaded.
289
- * @param {T | null | undefined} loadedValue - Loaded relationship value.
301
+ * @param {FrontendModelRelationshipModel<T> | null | undefined} loadedValue - Loaded relationship value.
290
302
  * @returns {void}
291
303
  */
292
304
  setLoaded(loadedValue) {
@@ -304,7 +316,7 @@ export class FrontendModelSingularRelationship {
304
316
 
305
317
  /**
306
318
  * Runs loaded.
307
- * @returns {T | null} - Loaded relationship value.
319
+ * @returns {FrontendModelRelationshipModel<T> | null} - Loaded relationship value.
308
320
  */
309
321
  loaded() {
310
322
  if (!this._preloaded) {
@@ -325,7 +337,7 @@ export class FrontendModelSingularRelationship {
325
337
  }
326
338
 
327
339
  // Narrows the runtime value to the target relationship's documented model type.
328
- const loadedValue = /** @type {T | null} */ (sourceRelationship.loaded())
340
+ const loadedValue = /** @type {FrontendModelRelationshipModel<T> | null} */ (sourceRelationship.loaded())
329
341
 
330
342
  this.setLoaded(loadedValue)
331
343
  }
@@ -333,15 +345,15 @@ export class FrontendModelSingularRelationship {
333
345
  /**
334
346
  * Runs build.
335
347
  * @param {TargetCreateAttributes} [attributes] - New model attributes.
336
- * @returns {T} - Built model.
348
+ * @returns {FrontendModelRelationshipModel<T>} - Built model.
337
349
  */
338
350
  build(attributes = /** @type {TargetCreateAttributes} */ ({})) {
339
351
  if (!this.targetModelClass) {
340
352
  throw new Error(`No target model class configured for ${this.model.constructor.name}#${this.relationshipName}`)
341
353
  }
342
354
 
343
- // Narrows the runtime value to the documented relationship model type.
344
- const model = /** @type {T} */ (new this.targetModelClass(attributes))
355
+ const ModelClass = /** @type {new (attributes?: TargetCreateAttributes) => FrontendModelRelationshipModel<T>} */ (this.targetModelClass)
356
+ const model = new ModelClass(attributes)
345
357
 
346
358
  this.setLoaded(model)
347
359
 
@@ -350,7 +362,7 @@ export class FrontendModelSingularRelationship {
350
362
 
351
363
  /**
352
364
  * Force-reload the relationship.
353
- * @returns {Promise<T | null>} - Loaded relationship model.
365
+ * @returns {Promise<FrontendModelRelationshipModel<T> | null>} - Loaded relationship model.
354
366
  */
355
367
  async load() {
356
368
  this._preloaded = false
@@ -367,7 +379,7 @@ export class FrontendModelSingularRelationship {
367
379
 
368
380
  /**
369
381
  * Returns the loaded relationship or loads it.
370
- * @returns {Promise<T | null>} - Loaded relationship model.
382
+ * @returns {Promise<FrontendModelRelationshipModel<T> | null>} - Loaded relationship model.
371
383
  */
372
384
  async orLoad() {
373
385
  if (this.getPreloaded()) return this.loaded()
@@ -384,21 +396,21 @@ export class FrontendModelSingularRelationship {
384
396
 
385
397
  /**
386
398
  * Lightweight has-many relationship state holder for frontend model instances.
387
- * @template {FrontendModelBase} S
388
- * @template {FrontendModelBase} T
399
+ * @template {FrontendModelBase | typeof FrontendModelBase} S
400
+ * @template {FrontendModelBase | typeof FrontendModelBase} T
389
401
  * @template {Record<string, FrontendModelAttributeValue>} [TargetCreateAttributes=Record<string, FrontendModelAttributeValue>]
390
402
  */
391
403
  export class FrontendModelHasManyRelationship {
392
404
  /**
393
405
  * Narrows the runtime value to the documented type.
394
- @type {Array<T>} */
406
+ * @type {Array<FrontendModelRelationshipModel<T>>} */
395
407
  _loadedValue
396
408
 
397
409
  /**
398
410
  * Runs constructor.
399
- * @param {S} model - Parent model.
411
+ * @param {FrontendModelBase} model - Parent model.
400
412
  * @param {string} relationshipName - Relationship name.
401
- * @param {FrontendModelClass<T, Record<string, FrontendModelAttributeValue>, TargetCreateAttributes> | null} targetModelClass - Target model class.
413
+ * @param {FrontendModelClass<FrontendModelRelationshipModel<T>, Record<string, FrontendModelAttributeValue>, TargetCreateAttributes> | null} targetModelClass - Target model class.
402
414
  */
403
415
  constructor(model, relationshipName, targetModelClass) {
404
416
  this.model = model
@@ -410,7 +422,7 @@ export class FrontendModelHasManyRelationship {
410
422
 
411
423
  /**
412
424
  * Runs set loaded.
413
- * @param {Array<T>} loadedValue - Loaded relationship value.
425
+ * @param {Array<FrontendModelRelationshipModel<T>>} loadedValue - Loaded relationship value.
414
426
  * @returns {void}
415
427
  */
416
428
  setLoaded(loadedValue) {
@@ -432,7 +444,7 @@ export class FrontendModelHasManyRelationship {
432
444
 
433
445
  /**
434
446
  * Runs loaded.
435
- * @returns {Array<T>} - Loaded relationship values.
447
+ * @returns {Array<FrontendModelRelationshipModel<T>>} - Loaded relationship values.
436
448
  */
437
449
  loaded() {
438
450
  if (!this._preloaded) {
@@ -453,14 +465,14 @@ export class FrontendModelHasManyRelationship {
453
465
  }
454
466
 
455
467
  // Narrows the runtime value to the target relationship's documented model type.
456
- const loadedValue = /** @type {Array<T>} */ (sourceRelationship.loaded())
468
+ const loadedValue = /** @type {Array<FrontendModelRelationshipModel<T>>} */ (sourceRelationship.loaded())
457
469
 
458
470
  this.setLoaded(loadedValue)
459
471
  }
460
472
 
461
473
  /**
462
474
  * Runs add to loaded.
463
- * @param {Array<T>} models - Models to append.
475
+ * @param {Array<FrontendModelRelationshipModel<T>>} models - Models to append.
464
476
  * @returns {void}
465
477
  */
466
478
  addToLoaded(models) {
@@ -472,15 +484,15 @@ export class FrontendModelHasManyRelationship {
472
484
  /**
473
485
  * Runs build.
474
486
  * @param {TargetCreateAttributes} [attributes] - New model attributes.
475
- * @returns {T} - Built model.
487
+ * @returns {FrontendModelRelationshipModel<T>} - Built model.
476
488
  */
477
489
  build(attributes = /** @type {TargetCreateAttributes} */ ({})) {
478
490
  if (!this.targetModelClass) {
479
491
  throw new Error(`No target model class configured for ${this.model.constructor.name}#${this.relationshipName}`)
480
492
  }
481
493
 
482
- // Narrows the runtime value to the documented relationship model type.
483
- const model = /** @type {T} */ (new this.targetModelClass(attributes))
494
+ const ModelClass = /** @type {new (attributes?: TargetCreateAttributes) => FrontendModelRelationshipModel<T>} */ (this.targetModelClass)
495
+ const model = new ModelClass(attributes)
484
496
 
485
497
  this.addToLoaded([model])
486
498
 
@@ -493,7 +505,7 @@ export class FrontendModelHasManyRelationship {
493
505
  * batched into one request via the cohort preloader. The scoped query path
494
506
  * (`Model.where(...).preload([name]).toArray()` directly from user code)
495
507
  * bypasses cohort batching by design.
496
- * @returns {Promise<Array<T>>} - Loaded relationship models.
508
+ * @returns {Promise<Array<FrontendModelRelationshipModel<T>>>} - Loaded relationship models.
497
509
  */
498
510
  async load() {
499
511
  // Reset so the cohort preloader (or single-record fallback) repopulates.
@@ -511,7 +523,7 @@ export class FrontendModelHasManyRelationship {
511
523
 
512
524
  /**
513
525
  * Runs to array.
514
- * @returns {Promise<Array<T>>} - Loaded relationship models.
526
+ * @returns {Promise<Array<FrontendModelRelationshipModel<T>>>} - Loaded relationship models.
515
527
  */
516
528
  async toArray() {
517
529
  if (this.getPreloaded() || this._loadedValue.length > 0) {
@@ -611,7 +623,7 @@ export class FrontendModelAttachmentDownload {
611
623
  function frontendModelAttachmentCommandPayload(attachment, attachmentId) {
612
624
  /**
613
625
  * Payload.
614
- @type {Record<string, ?>} */
626
+ * @type {Record<string, ?>} */
615
627
  const payload = {
616
628
  attachmentName: attachment.attachmentName,
617
629
  id: attachment.model.primaryKeyValue()
@@ -639,7 +651,7 @@ function frontendAttachmentValueIsBytes(value) {
639
651
  function frontendAttachmentValueSupportsArrayBuffer(value) {
640
652
  return Boolean(value && typeof value === "object" && typeof /**
641
653
  * Narrows the runtime value to the documented type.
642
- @type {?} */ (value).arrayBuffer === "function")
654
+ * @type {?} */ (value).arrayBuffer === "function")
643
655
  }
644
656
 
645
657
  /**
@@ -652,10 +664,10 @@ function frontendAttachmentNormalizeBytes(value) {
652
664
  if (value instanceof ArrayBuffer) return new Uint8Array(value)
653
665
  if (typeof Buffer !== "undefined" && Buffer.isBuffer(/**
654
666
  * Narrows the runtime value to the documented type.
655
- @type {?} */ (value))) {
667
+ * @type {?} */ (value))) {
656
668
  return new Uint8Array(/**
657
669
  * Narrows the runtime value to the documented type.
658
- @type {Buffer} */ (value))
670
+ * @type {Buffer} */ (value))
659
671
  }
660
672
 
661
673
  throw new Error("Unsupported attachment bytes value")
@@ -788,21 +800,21 @@ async function normalizeFrontendAttachmentInput(input) {
788
800
  contentBase64: frontendAttachmentBytesToBase64(bytes),
789
801
  contentType: typeof /**
790
802
  * Narrows the runtime value to the documented type.
791
- @type {?} */ (input).type === "string" && /**
803
+ * @type {?} */ (input).type === "string" && /**
792
804
  * Narrows the runtime value to the documented type.
793
- @type {?} */ (input).type.length > 0
805
+ * @type {?} */ (input).type.length > 0
794
806
  ? /**
795
807
  * Narrows the runtime value to the documented type.
796
- @type {?} */ (input).type
808
+ * @type {?} */ (input).type
797
809
  : null,
798
810
  filename: typeof /**
799
811
  * Narrows the runtime value to the documented type.
800
- @type {?} */ (input).name === "string" && /**
812
+ * @type {?} */ (input).name === "string" && /**
801
813
  * Narrows the runtime value to the documented type.
802
- @type {?} */ (input).name.length > 0
814
+ * @type {?} */ (input).name.length > 0
803
815
  ? /**
804
816
  * Narrows the runtime value to the documented type.
805
- @type {?} */ (input).name
817
+ * @type {?} */ (input).name
806
818
  : "attachment.bin"
807
819
  }
808
820
  }
@@ -810,7 +822,7 @@ async function normalizeFrontendAttachmentInput(input) {
810
822
  if (frontendAttachmentValueIsBytes(input)) {
811
823
  const bytes = frontendAttachmentNormalizeBytes(/**
812
824
  * Narrows the runtime value to the documented type.
813
- @type {Uint8Array | Buffer | ArrayBuffer} */ (input))
825
+ * @type {Uint8Array | Buffer | ArrayBuffer} */ (input))
814
826
 
815
827
  return {
816
828
  contentBase64: frontendAttachmentBytesToBase64(bytes),
@@ -1010,7 +1022,7 @@ function frontendModelTransportUrl() {
1010
1022
  * @returns {Record<string, ?>} - Cloned attributes hash.
1011
1023
  */
1012
1024
  function cloneFrontendModelAttributes(value) {
1013
- return /** Narrows the runtime value to the documented type. @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(serializeFrontendModelTransportValue(value)))
1025
+ return /** @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(serializeFrontendModelTransportValue(value)))
1014
1026
  }
1015
1027
 
1016
1028
  /**
@@ -1055,10 +1067,10 @@ function mergeFrontendModelEventPreload(target, source) {
1055
1067
  mergeFrontendModelEventPreload(
1056
1068
  /**
1057
1069
  * Narrows the runtime value to the documented type.
1058
- @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (target[relationshipName]),
1070
+ * @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (target[relationshipName]),
1059
1071
  /**
1060
1072
  * Narrows the runtime value to the documented type.
1061
- @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (value)
1073
+ * @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (value)
1062
1074
  )
1063
1075
  }
1064
1076
  }
@@ -1150,7 +1162,7 @@ function frontendModelMatchedEventFilterKeys(body) {
1150
1162
 
1151
1163
  const keys = /**
1152
1164
  * Narrows the runtime value to the documented type.
1153
- @type {{matchedEventFilterKeys?: ?}} */ (body).matchedEventFilterKeys
1165
+ * @type {{matchedEventFilterKeys?: ?}} */ (body).matchedEventFilterKeys
1154
1166
 
1155
1167
  if (!Array.isArray(keys)) return new Set()
1156
1168
 
@@ -1203,56 +1215,57 @@ class FrontendModelEventSubscription {
1203
1215
  this.ModelClass = ModelClass
1204
1216
  /**
1205
1217
  * Narrows the runtime value to the documented type.
1206
- @type {Set<FrontendModelModelEventCallbackEntry>} */
1218
+ * @type {Set<FrontendModelModelEventCallbackEntry>} */
1207
1219
  this.classCreateCallbacks = new Set()
1208
1220
  /**
1209
1221
  * Narrows the runtime value to the documented type.
1210
- @type {Set<FrontendModelModelEventCallbackEntry>} */
1222
+ * @type {Set<FrontendModelModelEventCallbackEntry>} */
1211
1223
  this.classUpdateCallbacks = new Set()
1212
1224
  /**
1213
1225
  * Narrows the runtime value to the documented type.
1214
- @type {Set<FrontendModelDestroyEventCallbackEntry>} */
1226
+ * @type {Set<FrontendModelDestroyEventCallbackEntry>} */
1215
1227
  this.classDestroyCallbacks = new Set()
1216
1228
  /**
1217
1229
  * Narrows the runtime value to the documented type.
1218
- @type {Map<string, {instance: FrontendModelBase, updateCallbacks: Set<FrontendModelModelEventCallbackEntry>, destroyCallbacks: Set<FrontendModelDestroyEventCallbackEntry>}>} */
1230
+ * @type {Map<string, {instance: FrontendModelBase, updateCallbacks: Set<FrontendModelModelEventCallbackEntry>, destroyCallbacks: Set<FrontendModelDestroyEventCallbackEntry>}>} */
1219
1231
  this.instanceListeners = new Map()
1220
1232
  /**
1221
1233
  * Narrows the runtime value to the documented type.
1222
- @type {?} */
1234
+ * @type {?} */
1223
1235
  this.channelHandle = null
1224
1236
  /**
1225
1237
  * Narrows the runtime value to the documented type.
1226
- @type {Promise<void> | null} */
1238
+ * @type {Promise<void> | null} */
1227
1239
  this.readyPromise = null
1228
1240
  /**
1229
1241
  * Narrows the runtime value to the documented type.
1230
- @type {string | null} */
1242
+ * @type {string | null} */
1231
1243
  this.subscriptionParamsKey = null
1232
1244
  }
1233
1245
 
1234
1246
  /**
1235
1247
  * Runs subscription params.
1236
- * @returns {{model: string, eventFilters?: import("./query.js").FrontendModelEventFilterPayloadEntry[], unfilteredEventDelivery?: boolean} & import("./query.js").FrontendModelProjectionPayload} - Current websocket subscription params.
1248
+ * @returns {{model: string, destroyEventDelivery?: boolean, eventFilters?: import("./query.js").FrontendModelEventFilterPayloadEntry[], unfilteredEventDelivery?: boolean} & import("./query.js").FrontendModelProjectionPayload} - Current websocket subscription params.
1237
1249
  */
1238
1250
  subscriptionParams() {
1239
1251
  /**
1240
1252
  * Projection payload.
1241
- @type {import("./query.js").FrontendModelProjectionPayload} */
1253
+ * @type {import("./query.js").FrontendModelProjectionPayload} */
1242
1254
  const projectionPayload = {}
1243
1255
  /**
1244
1256
  * Event filters by key.
1245
- @type {Record<string, import("./query.js").FrontendModelEventFilterPayloadEntry>} */
1257
+ * @type {Record<string, import("./query.js").FrontendModelEventFilterPayloadEntry>} */
1246
1258
  const eventFiltersByKey = {}
1247
1259
  const projectionEntries = []
1248
- let hasUnfilteredEventDelivery = this.classDestroyCallbacks.size > 0
1260
+ let hasDestroyEventDelivery = this.classDestroyCallbacks.size > 0
1261
+ let hasUnfilteredEventDelivery = false
1249
1262
 
1250
1263
  for (const entry of this.classCreateCallbacks) projectionEntries.push(entry)
1251
1264
  for (const entry of this.classUpdateCallbacks) projectionEntries.push(entry)
1252
1265
 
1253
1266
  for (const listener of this.instanceListeners.values()) {
1254
1267
  for (const entry of listener.updateCallbacks) projectionEntries.push(entry)
1255
- if (listener.destroyCallbacks.size > 0) hasUnfilteredEventDelivery = true
1268
+ if (listener.destroyCallbacks.size > 0) hasDestroyEventDelivery = true
1256
1269
  }
1257
1270
 
1258
1271
  for (const entry of projectionEntries) {
@@ -1272,6 +1285,7 @@ class FrontendModelEventSubscription {
1272
1285
  const eventFilterParams = eventFilters.length > 0
1273
1286
  ? {
1274
1287
  eventFilters,
1288
+ ...(hasDestroyEventDelivery ? {destroyEventDelivery: true} : {}),
1275
1289
  ...(hasUnfilteredEventDelivery ? {unfilteredEventDelivery: true} : {})
1276
1290
  }
1277
1291
  : {}
@@ -1293,7 +1307,7 @@ class FrontendModelEventSubscription {
1293
1307
 
1294
1308
  /**
1295
1309
  * Runs ensure subscribed.
1296
- @returns {Promise<void>} */
1310
+ * @returns {Promise<void>} */
1297
1311
  async ensureSubscribed() {
1298
1312
  const paramsJson = this.subscriptionParamsJson()
1299
1313
 
@@ -1318,7 +1332,7 @@ class FrontendModelEventSubscription {
1318
1332
 
1319
1333
  const client = /**
1320
1334
  * Narrows the runtime value to the documented type.
1321
- @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
1335
+ * @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
1322
1336
 
1323
1337
  if (!client || typeof client.subscribeChannel !== "function") {
1324
1338
  throw new Error("Frontend model event subscriptions require configureTransport({websocketUrl}) or configureTransport({websocketClient})")
@@ -1334,7 +1348,7 @@ class FrontendModelEventSubscription {
1334
1348
  params,
1335
1349
  onMessage: (/**
1336
1350
  * Narrows the runtime value to the documented type.
1337
- @type {?} */ body) => this._dispatchEvent(body),
1351
+ * @type {?} */ body) => this._dispatchEvent(body),
1338
1352
  onClose: () => {
1339
1353
  this.channelHandle = null
1340
1354
  this.readyPromise = null
@@ -1391,10 +1405,10 @@ class FrontendModelEventSubscription {
1391
1405
 
1392
1406
  const deserializedRecord = /**
1393
1407
  * Narrows the runtime value to the documented type.
1394
- @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(body.record))
1408
+ * @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(body.record))
1395
1409
  const freshModel = /**
1396
1410
  * Narrows the runtime value to the documented type.
1397
- @type {?} */ (this.ModelClass).instantiateFromResponse(deserializedRecord)
1411
+ * @type {?} */ (this.ModelClass).instantiateFromResponse(deserializedRecord)
1398
1412
  const listener = this.instanceListeners.get(id)
1399
1413
 
1400
1414
  if (action === "update" && listener) {
@@ -1407,7 +1421,7 @@ class FrontendModelEventSubscription {
1407
1421
  // through the same handle see fresh attributes.
1408
1422
  const instanceAny = /**
1409
1423
  * Narrows the runtime value to the documented type.
1410
- @type {?} */ (listener.instance)
1424
+ * @type {?} */ (listener.instance)
1411
1425
 
1412
1426
  instanceAny.assignAttributes(freshModel.attributes())
1413
1427
  instanceAny._persistedAttributes = cloneFrontendModelAttributes(listener.instance.attributes())
@@ -1429,7 +1443,7 @@ class FrontendModelEventSubscription {
1429
1443
 
1430
1444
  /**
1431
1445
  * Runs maybe teardown.
1432
- @returns {void} */
1446
+ * @returns {void} */
1433
1447
  maybeTeardown() {
1434
1448
  const hasAnyListener = this.classCreateCallbacks.size > 0
1435
1449
  || this.classUpdateCallbacks.size > 0
@@ -1453,7 +1467,7 @@ class FrontendModelEventSubscription {
1453
1467
 
1454
1468
  /**
1455
1469
  * Frontend model event subscriptions.
1456
- @type {WeakMap<FrontendModelClass, FrontendModelEventSubscription>} */
1470
+ * @type {WeakMap<FrontendModelClass, FrontendModelEventSubscription>} */
1457
1471
  const frontendModelEventSubscriptions = new WeakMap()
1458
1472
 
1459
1473
  /**
@@ -1565,7 +1579,7 @@ async function performSharedFrontendModelApiRequest(requestPayload) {
1565
1579
  })
1566
1580
  const responseJson = response.json()
1567
1581
 
1568
- return /** Narrows the runtime value to the documented type. @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(responseJson))
1582
+ return /** @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(responseJson))
1569
1583
  }
1570
1584
 
1571
1585
  const response = await fetch(url, {
@@ -1587,7 +1601,7 @@ async function performSharedFrontendModelApiRequest(requestPayload) {
1587
1601
 
1588
1602
  const json = responseText.length > 0 ? JSON.parse(responseText) : {}
1589
1603
 
1590
- return /** Narrows the runtime value to the documented type. @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(json))
1604
+ return /** @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(json))
1591
1605
  }
1592
1606
 
1593
1607
  /**
@@ -1606,7 +1620,7 @@ function throwFrontendModelHttpError({commandLabel, response, responseText}) {
1606
1620
  if (responseContentType && responseContentType.includes("application/json") && responseText.length > 0) {
1607
1621
  /**
1608
1622
  * Defines errorBody.
1609
- @type {Record<string, ?> | null} */
1623
+ * @type {Record<string, ?> | null} */
1610
1624
  let errorBody
1611
1625
 
1612
1626
  try {
@@ -1677,7 +1691,7 @@ async function flushPendingSharedFrontendModelRequests() {
1677
1691
 
1678
1692
  request.resolve(/**
1679
1693
  * Narrows the runtime value to the documented type.
1680
- @type {Record<string, ?>} */ (responsePayload))
1694
+ * @type {Record<string, ?>} */ (responsePayload))
1681
1695
  }
1682
1696
  } catch (error) {
1683
1697
  for (const request of batchedRequests) {
@@ -1689,7 +1703,7 @@ async function flushPendingSharedFrontendModelRequests() {
1689
1703
 
1690
1704
  /**
1691
1705
  * Runs schedule shared frontend model request flush.
1692
- @returns {void} */
1706
+ * @returns {void} */
1693
1707
  function scheduleSharedFrontendModelRequestFlush() {
1694
1708
  if (sharedFrontendModelFlushScheduled) return
1695
1709
 
@@ -1783,7 +1797,7 @@ function assertDefinedFindByConditionValue(value, keyPath) {
1783
1797
 
1784
1798
  const objectValue = /**
1785
1799
  * Narrows the runtime value to the documented type.
1786
- @type {Record<string, ?>} */ (value)
1800
+ * @type {Record<string, ?>} */ (value)
1787
1801
  const prototype = Object.getPrototypeOf(objectValue)
1788
1802
 
1789
1803
  if (prototype !== Object.prototype && prototype !== null) {
@@ -1798,7 +1812,7 @@ function assertDefinedFindByConditionValue(value, keyPath) {
1798
1812
 
1799
1813
  const valueObject = /**
1800
1814
  * Narrows the runtime value to the documented type.
1801
- @type {Record<string, ?>} */ (value)
1815
+ * @type {Record<string, ?>} */ (value)
1802
1816
 
1803
1817
  Object.keys(valueObject).forEach((nestedKey) => {
1804
1818
  assertDefinedFindByConditionValue(valueObject[nestedKey], `${keyPath}.${nestedKey}`)
@@ -1815,7 +1829,7 @@ function assertDefinedFindByConditionValue(value, keyPath) {
1815
1829
  export default class FrontendModelBase {
1816
1830
  /**
1817
1831
  * Narrows the runtime value to the documented type.
1818
- @type {string | undefined} */
1832
+ * @type {string | undefined} */
1819
1833
  static modelName
1820
1834
 
1821
1835
  /**
@@ -1839,15 +1853,15 @@ export default class FrontendModelBase {
1839
1853
 
1840
1854
  /**
1841
1855
  * Narrows the runtime value to the documented type.
1842
- @type {Record<string, FrontendModelAttributeValue>} */
1856
+ * @type {Record<string, FrontendModelAttributeValue>} */
1843
1857
  _attributes
1844
1858
  /**
1845
1859
  * Narrows the runtime value to the documented type.
1846
- @type {Record<string, FrontendModelHasManyRelationship<FrontendModelBase, FrontendModelBase, Record<string, FrontendModelAttributeValue>> | FrontendModelSingularRelationship<FrontendModelBase, FrontendModelBase, Record<string, FrontendModelAttributeValue>>>} */
1860
+ * @type {Record<string, FrontendModelHasManyRelationship<FrontendModelBase, FrontendModelBase, Record<string, FrontendModelAttributeValue>> | FrontendModelSingularRelationship<FrontendModelBase, FrontendModelBase, Record<string, FrontendModelAttributeValue>>>} */
1847
1861
  _relationships
1848
1862
  /**
1849
1863
  * Narrows the runtime value to the documented type.
1850
- @type {Record<string, FrontendModelAttachmentHandle>} */
1864
+ * @type {Record<string, FrontendModelAttachmentHandle>} */
1851
1865
  _attachments
1852
1866
  /**
1853
1867
  * Rails-style nested attribute payloads queued for the next save.
@@ -1856,19 +1870,19 @@ export default class FrontendModelBase {
1856
1870
  _pendingNestedAttributes
1857
1871
  /**
1858
1872
  * Narrows the runtime value to the documented type.
1859
- @type {Set<string> | null} */
1873
+ * @type {Set<string> | null} */
1860
1874
  _selectedAttributes
1861
1875
  /**
1862
1876
  * Narrows the runtime value to the documented type.
1863
- @type {boolean} */
1877
+ * @type {boolean} */
1864
1878
  _isNewRecord
1865
1879
  /**
1866
1880
  * Narrows the runtime value to the documented type.
1867
- @type {boolean} */
1881
+ * @type {boolean} */
1868
1882
  _markedForDestruction
1869
1883
  /**
1870
1884
  * Narrows the runtime value to the documented type.
1871
- @type {Record<string, FrontendModelAttributeValue>} */
1885
+ * @type {Record<string, FrontendModelAttributeValue>} */
1872
1886
  _persistedAttributes
1873
1887
  /**
1874
1888
  * Narrows the runtime value to the documented type.
@@ -1906,7 +1920,7 @@ export default class FrontendModelBase {
1906
1920
  const attachments = this.attachmentDefinitions()
1907
1921
  const prototype = /**
1908
1922
  * Narrows the runtime value to the documented type.
1909
- @type {Record<string, ?>} */ (this.prototype)
1923
+ * @type {Record<string, ?>} */ (this.prototype)
1910
1924
 
1911
1925
  for (const attachmentName of Object.keys(attachments)) {
1912
1926
  if (!(attachmentName in prototype)) {
@@ -2097,7 +2111,7 @@ export default class FrontendModelBase {
2097
2111
  changes() {
2098
2112
  /**
2099
2113
  * Changed attributes.
2100
- @type {Record<string, Array<?>>} */
2114
+ * @type {Record<string, Array<?>>} */
2101
2115
  const changedAttributes = {}
2102
2116
  const attributeNames = new Set([
2103
2117
  ...Object.keys(this._persistedAttributes),
@@ -2247,7 +2261,7 @@ export default class FrontendModelBase {
2247
2261
 
2248
2262
  /**
2249
2263
  * Batch.
2250
- @type {Array<FrontendModelBase>} */
2264
+ * @type {Array<FrontendModelBase>} */
2251
2265
  const batch = []
2252
2266
 
2253
2267
  // Exact same class, persisted, no existing in-memory relationship state.
@@ -2276,7 +2290,7 @@ export default class FrontendModelBase {
2276
2290
 
2277
2291
  /**
2278
2292
  * Reloaded by id.
2279
- @type {Map<string, FrontendModelBase>} */
2293
+ * @type {Map<string, FrontendModelBase>} */
2280
2294
  const reloadedById = new Map()
2281
2295
 
2282
2296
  for (const reloaded of reloadedBatch) {
@@ -2412,9 +2426,9 @@ export default class FrontendModelBase {
2412
2426
  readCount(attributeName) {
2413
2427
  return readPayloadAssociationCount(/**
2414
2428
  * Narrows the runtime value to the documented type.
2415
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2429
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2416
2430
  * Narrows the runtime value to the documented type.
2417
- @type {?} */ (this)), attributeName)
2431
+ * @type {?} */ (this)), attributeName)
2418
2432
  }
2419
2433
 
2420
2434
  /**
@@ -2427,9 +2441,9 @@ export default class FrontendModelBase {
2427
2441
  _setAssociationCount(attributeName, value) {
2428
2442
  setPayloadAssociationCount(/**
2429
2443
  * Narrows the runtime value to the documented type.
2430
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2444
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2431
2445
  * Narrows the runtime value to the documented type.
2432
- @type {?} */ (this)), attributeName, value)
2446
+ * @type {?} */ (this)), attributeName, value)
2433
2447
  }
2434
2448
 
2435
2449
  /**
@@ -2446,9 +2460,9 @@ export default class FrontendModelBase {
2446
2460
  can(action) {
2447
2461
  return readPayloadComputedAbility(/**
2448
2462
  * Narrows the runtime value to the documented type.
2449
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2463
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2450
2464
  * Narrows the runtime value to the documented type.
2451
- @type {?} */ (this)), action)
2465
+ * @type {?} */ (this)), action)
2452
2466
  }
2453
2467
 
2454
2468
  /**
@@ -2462,9 +2476,9 @@ export default class FrontendModelBase {
2462
2476
  _setComputedAbility(action, value) {
2463
2477
  setPayloadComputedAbility(/**
2464
2478
  * Narrows the runtime value to the documented type.
2465
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2479
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2466
2480
  * Narrows the runtime value to the documented type.
2467
- @type {?} */ (this)), action, value)
2481
+ * @type {?} */ (this)), action, value)
2468
2482
  }
2469
2483
 
2470
2484
  /**
@@ -2479,9 +2493,9 @@ export default class FrontendModelBase {
2479
2493
  queryData(name) {
2480
2494
  return readPayloadQueryData(/**
2481
2495
  * Narrows the runtime value to the documented type.
2482
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2496
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2483
2497
  * Narrows the runtime value to the documented type.
2484
- @type {?} */ (this)), name)
2498
+ * @type {?} */ (this)), name)
2485
2499
  }
2486
2500
 
2487
2501
  /**
@@ -2494,9 +2508,9 @@ export default class FrontendModelBase {
2494
2508
  _setQueryData(name, value) {
2495
2509
  setPayloadQueryData(/**
2496
2510
  * Narrows the runtime value to the documented type.
2497
- @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2511
+ * @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
2498
2512
  * Narrows the runtime value to the documented type.
2499
- @type {?} */ (this)), name, value)
2513
+ * @type {?} */ (this)), name, value)
2500
2514
  }
2501
2515
 
2502
2516
  /**
@@ -2559,7 +2573,7 @@ export default class FrontendModelBase {
2559
2573
  for (const relationshipName of Object.keys(this._relationships)) {
2560
2574
  const definition = /**
2561
2575
  * Narrows the runtime value to the documented type.
2562
- @type {?} */ (definitions[relationshipName])
2576
+ * @type {?} */ (definitions[relationshipName])
2563
2577
 
2564
2578
  if (!definition || definition.type !== "belongsTo") continue
2565
2579
 
@@ -2622,12 +2636,12 @@ export default class FrontendModelBase {
2622
2636
  return {arg1: payload}
2623
2637
  }
2624
2638
 
2625
- return /** Narrows the runtime value to the documented type. @type {Record<string, ?>} */ (payload)
2639
+ return /** @type {Record<string, ?>} */ (payload)
2626
2640
  }
2627
2641
 
2628
2642
  /**
2629
2643
  * Payload.
2630
- @type {Record<string, number | string | Array<?>>} */
2644
+ * @type {Record<string, number | string | Array<?>>} */
2631
2645
  const payload = {}
2632
2646
 
2633
2647
  for (let index = 0; index < args.length; index += 1) {
@@ -2773,7 +2787,7 @@ export default class FrontendModelBase {
2773
2787
  static setWebsocketMetadata(key, value) {
2774
2788
  const client = /**
2775
2789
  * Narrows the runtime value to the documented type.
2776
- @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2790
+ * @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2777
2791
 
2778
2792
  if (!client || typeof client.setMetadata !== "function") return
2779
2793
 
@@ -2793,12 +2807,12 @@ export default class FrontendModelBase {
2793
2807
  static openManagedConnection(connectionType, options) {
2794
2808
  /**
2795
2809
  * Connection.
2796
- @type {?} */
2810
+ * @type {?} */
2797
2811
  let connection = null
2798
2812
  let closed = false
2799
2813
  /**
2800
2814
  * Retry timer.
2801
- @type {ReturnType<typeof setTimeout> | null} */
2815
+ * @type {ReturnType<typeof setTimeout> | null} */
2802
2816
  let retryTimer = null
2803
2817
  let lastParamsJson = ""
2804
2818
 
@@ -2837,7 +2851,7 @@ export default class FrontendModelBase {
2837
2851
  // which only reflects the internal client.
2838
2852
  const client = /**
2839
2853
  * Narrows the runtime value to the documented type.
2840
- @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2854
+ * @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2841
2855
 
2842
2856
  if (!client || !client.isOpen()) {
2843
2857
  if (retryTimer === null) {
@@ -2887,7 +2901,7 @@ export default class FrontendModelBase {
2887
2901
  static openWebsocketConnection(connectionType, options) {
2888
2902
  const client = /**
2889
2903
  * Narrows the runtime value to the documented type.
2890
- @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2904
+ * @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2891
2905
 
2892
2906
  if (!client || typeof client.openConnection !== "function") {
2893
2907
  throw new Error("openWebsocketConnection requires configureTransport({websocketUrl})")
@@ -2906,7 +2920,7 @@ export default class FrontendModelBase {
2906
2920
  static subscribeWebsocketChannel(channelType, options) {
2907
2921
  const client = /**
2908
2922
  * Narrows the runtime value to the documented type.
2909
- @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2923
+ * @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
2910
2924
 
2911
2925
  if (!client || typeof client.subscribeChannel !== "function") {
2912
2926
  throw new Error("subscribeWebsocketChannel requires configureTransport({websocketUrl})")
@@ -2923,7 +2937,7 @@ export default class FrontendModelBase {
2923
2937
  static installWebsocketTestHooks() {
2924
2938
  if (typeof globalThis === "undefined") return
2925
2939
 
2926
- /** Narrows the runtime value to the documented type. @type {?} */ (globalThis).__velocious_websocket_hooks = {
2940
+ /** @type {?} */ (globalThis).__velocious_websocket_hooks = {
2927
2941
  connect: () => this.connectWebsocket(),
2928
2942
  disconnect: () => this.disconnectWebsocket(),
2929
2943
  drop: () => this.dropWebsocket(),
@@ -2959,7 +2973,7 @@ export default class FrontendModelBase {
2959
2973
 
2960
2974
  /**
2961
2975
  * Defines modelData.
2962
- @type {Record<string, FrontendModelAttributeValue>} */
2976
+ * @type {Record<string, FrontendModelAttributeValue>} */
2963
2977
  let modelData
2964
2978
 
2965
2979
  if (responseObject.model && typeof responseObject.model === "object") {
@@ -2979,7 +2993,7 @@ export default class FrontendModelBase {
2979
2993
  const associationCounts = isPlainObject(attributes[ASSOCIATION_COUNTS_KEY])
2980
2994
  ? /**
2981
2995
  * Narrows the runtime value to the documented type.
2982
- @type {Record<string, number>} */ (attributes[ASSOCIATION_COUNTS_KEY])
2996
+ * @type {Record<string, number>} */ (attributes[ASSOCIATION_COUNTS_KEY])
2983
2997
  : {}
2984
2998
  const queryData = isPlainObject(attributes[QUERY_DATA_KEY])
2985
2999
  ? /** @type {Record<string, FrontendModelAttributeValue>} */ (attributes[QUERY_DATA_KEY])
@@ -2987,12 +3001,12 @@ export default class FrontendModelBase {
2987
3001
  const abilities = isPlainObject(attributes[ABILITIES_KEY])
2988
3002
  ? /**
2989
3003
  * Narrows the runtime value to the documented type.
2990
- @type {Record<string, boolean>} */ (attributes[ABILITIES_KEY])
3004
+ * @type {Record<string, boolean>} */ (attributes[ABILITIES_KEY])
2991
3005
  : {}
2992
3006
  const selectedAttributesFromPayload = Array.isArray(attributes[SELECTED_ATTRIBUTES_KEY])
2993
3007
  ? new Set(/**
2994
3008
  * Narrows the runtime value to the documented type.
2995
- @type {string[]} */ (attributes[SELECTED_ATTRIBUTES_KEY]).filter((attributeName) => typeof attributeName === "string"))
3009
+ * @type {string[]} */ (attributes[SELECTED_ATTRIBUTES_KEY]).filter((attributeName) => typeof attributeName === "string"))
2996
3010
  : null
2997
3011
 
2998
3012
  delete attributes[PRELOADED_RELATIONSHIPS_KEY]
@@ -3087,7 +3101,7 @@ export default class FrontendModelBase {
3087
3101
  // model instance into a new constructor call and produce a broken model
3088
3102
  // with internal state keys promoted to attributes.
3089
3103
  if (response instanceof this) {
3090
- return /** Narrows the runtime value to the documented type. @type {InstanceType<T>} */ (response)
3104
+ return /** @type {InstanceType<T>} */ (response)
3091
3105
  }
3092
3106
 
3093
3107
  const modelData = this.modelDataFromResponse(response)
@@ -3097,9 +3111,9 @@ export default class FrontendModelBase {
3097
3111
  const queryData = modelData.queryData
3098
3112
  const abilities = modelData.abilities
3099
3113
  const selectedAttributes = modelData.selectedAttributes
3100
- const model = /**
3101
- * Narrows the runtime value to the documented type.
3102
- @type {InstanceType<T>} */ (new this(attributes))
3114
+ const receiver = /** @type {unknown} */ (this)
3115
+ const ModelClass = /** @type {new (attributes?: Record<string, FrontendModelAttributeValue>) => InstanceType<T>} */ (receiver)
3116
+ const model = new ModelClass(attributes)
3103
3117
  model._selectedAttributes = selectedAttributes ? new Set(selectedAttributes) : null
3104
3118
 
3105
3119
  this.applyPreloadedRelationships(model, preloadedRelationships)
@@ -3339,7 +3353,7 @@ export default class FrontendModelBase {
3339
3353
  async onUpdate(callback, options = {}) {
3340
3354
  const self = /**
3341
3355
  * Narrows the runtime value to the documented type.
3342
- @type {?} */ (this)
3356
+ * @type {?} */ (this)
3343
3357
  const ModelClass = frontendModelClassFor(this)
3344
3358
  const sub = ensureFrontendModelEventSubscription(ModelClass)
3345
3359
  const id = String(self.id())
@@ -3371,7 +3385,7 @@ export default class FrontendModelBase {
3371
3385
  async onDestroy(callback, options = {}) {
3372
3386
  const self = /**
3373
3387
  * Narrows the runtime value to the documented type.
3374
- @type {?} */ (this)
3388
+ * @type {?} */ (this)
3375
3389
  const ModelClass = frontendModelClassFor(this)
3376
3390
 
3377
3391
  assertNoDestroyEventFilter(ModelClass, options)
@@ -3484,7 +3498,7 @@ export default class FrontendModelBase {
3484
3498
  * @returns {FrontendModelQuery<T>} - Query builder.
3485
3499
  */
3486
3500
  static query() {
3487
- return /** Narrows the runtime value to the documented type. @type {FrontendModelQuery<T>} */ (new FrontendModelQuery({modelClass: this}))
3501
+ return /** @type {FrontendModelQuery<T>} */ (new FrontendModelQuery({modelClass: this}))
3488
3502
  }
3489
3503
 
3490
3504
  /**
@@ -3495,7 +3509,7 @@ export default class FrontendModelBase {
3495
3509
  * @returns {FrontendModelQuery<T>} - Query with preload.
3496
3510
  */
3497
3511
  static preload(preload) {
3498
- return /** Narrows the runtime value to the documented type. @type {FrontendModelQuery<T>} */ (this.query().preload(preload))
3512
+ return /** @type {FrontendModelQuery<T>} */ (this.query().preload(preload))
3499
3513
  }
3500
3514
 
3501
3515
  /**
@@ -3506,7 +3520,7 @@ export default class FrontendModelBase {
3506
3520
  * @returns {FrontendModelQuery<T>} - Query with selected attributes.
3507
3521
  */
3508
3522
  static select(select) {
3509
- return /** Narrows the runtime value to the documented type. @type {FrontendModelQuery<T>} */ (this.query().select(select))
3523
+ return /** @type {FrontendModelQuery<T>} */ (this.query().select(select))
3510
3524
  }
3511
3525
 
3512
3526
  /**
@@ -3517,7 +3531,7 @@ export default class FrontendModelBase {
3517
3531
  * @returns {FrontendModelQuery<T>} - Query with extra selected attributes.
3518
3532
  */
3519
3533
  static selectsExtra(select) {
3520
- return /** Narrows the runtime value to the documented type. @type {FrontendModelQuery<T>} */ (this.query().selectsExtra(select))
3534
+ return /** @type {FrontendModelQuery<T>} */ (this.query().selectsExtra(select))
3521
3535
  }
3522
3536
 
3523
3537
  /**
@@ -3565,16 +3579,15 @@ export default class FrontendModelBase {
3565
3579
 
3566
3580
  /**
3567
3581
  * Runs create.
3568
- * @template {FrontendModelBase} Model
3569
- * @template {Record<string, FrontendModelAttributeValue>} ModelAttributes
3570
- * @template {Record<string, FrontendModelAttributeValue>} ModelCreateAttributes
3571
- * @this {FrontendModelClass<Model, ModelAttributes, ModelCreateAttributes>}
3572
- * @param {ModelCreateAttributes} [attributes] - Initial attributes.
3573
- * @returns {Promise<Model>} - Persisted model.
3582
+ * @template {FrontendModelClass} ModelClass
3583
+ * @this {ModelClass}
3584
+ * @param {FrontendModelCreateAttributesFor<InstanceType<ModelClass>>} [attributes] - Initial attributes.
3585
+ * @returns {Promise<InstanceType<ModelClass>>} - Persisted model.
3574
3586
  */
3575
3587
  static async create(attributes) {
3576
- // Narrows the constructed instance to the receiver's documented model type.
3577
- const model = /** @type {Model} */ (new this(attributes))
3588
+ const receiver = /** @type {unknown} */ (this)
3589
+ const ModelClass = /** @type {new (attributes?: FrontendModelCreateAttributesFor<InstanceType<ModelClass>>) => InstanceType<ModelClass>} */ (receiver)
3590
+ const model = new ModelClass(attributes)
3578
3591
 
3579
3592
  await model.save()
3580
3593
 
@@ -3662,10 +3675,10 @@ export default class FrontendModelBase {
3662
3675
 
3663
3676
  const actualObject = /**
3664
3677
  * Narrows the runtime value to the documented type.
3665
- @type {Record<string, ?>} */ (actualValue)
3678
+ * @type {Record<string, ?>} */ (actualValue)
3666
3679
  const expectedObject = /**
3667
3680
  * Narrows the runtime value to the documented type.
3668
- @type {Record<string, ?>} */ (expectedValue)
3681
+ * @type {Record<string, ?>} */ (expectedValue)
3669
3682
  const actualKeys = Object.keys(actualObject)
3670
3683
  const expectedKeys = Object.keys(expectedObject)
3671
3684
 
@@ -3797,7 +3810,7 @@ export default class FrontendModelBase {
3797
3810
  const commandType = isNew ? "create" : "update"
3798
3811
  /**
3799
3812
  * Payload.
3800
- @type {Record<string, ?>} */
3813
+ * @type {Record<string, ?>} */
3801
3814
  const payload = {
3802
3815
  attributes: this._changedAttributesForSave()
3803
3816
  }
@@ -3842,7 +3855,7 @@ export default class FrontendModelBase {
3842
3855
  _changedAttributesForSave() {
3843
3856
  /**
3844
3857
  * Changed attributes.
3845
- @type {Record<string, FrontendModelAttributeValue>} */
3858
+ * @type {Record<string, FrontendModelAttributeValue>} */
3846
3859
  const changedAttributes = {}
3847
3860
 
3848
3861
  for (const [attributeName, [previousValue, currentValue]] of Object.entries(this.changes())) {
@@ -3925,7 +3938,7 @@ export default class FrontendModelBase {
3925
3938
 
3926
3939
  /**
3927
3940
  * Payload.
3928
- @type {Record<string, Array<Record<string, ?>>>} */
3941
+ * @type {Record<string, Array<Record<string, ?>>>} */
3929
3942
  const payload = {}
3930
3943
 
3931
3944
  for (const relationshipName of Object.keys(nestedAttributesConfig)) {
@@ -3987,7 +4000,7 @@ export default class FrontendModelBase {
3987
4000
  if (this.isNewRecord()) {
3988
4001
  /**
3989
4002
  * Entry.
3990
- @type {Record<string, ?>} */
4003
+ * @type {Record<string, ?>} */
3991
4004
  const entry = {}
3992
4005
  const attributes = this._changedAttributesForSave()
3993
4006
 
@@ -4002,7 +4015,7 @@ export default class FrontendModelBase {
4002
4015
 
4003
4016
  /**
4004
4017
  * Entry.
4005
- @type {Record<string, ?>} */
4018
+ * @type {Record<string, ?>} */
4006
4019
  const entry = {id: this.primaryKeyValue()}
4007
4020
 
4008
4021
  if (this.isChanged()) entry.attributes = this._changedAttributesForSave()
@@ -4150,7 +4163,7 @@ export default class FrontendModelBase {
4150
4163
 
4151
4164
  /**
4152
4165
  * Relevant preloads.
4153
- @type {Record<string, ?>} */
4166
+ * @type {Record<string, ?>} */
4154
4167
  const relevantPreloads = {}
4155
4168
 
4156
4169
  for (const relationshipName of Object.keys(nestedAttributesConfig)) {
@@ -4175,7 +4188,7 @@ export default class FrontendModelBase {
4175
4188
  const commandName = this.commandName(commandType)
4176
4189
  const serializedPayload = /**
4177
4190
  * Narrows the runtime value to the documented type.
4178
- @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
4191
+ * @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
4179
4192
  const resourcePath = this.resourcePath()
4180
4193
  const containsAttachmentUpload = frontendModelPayloadContainsAttachmentUpload(serializedPayload)
4181
4194
  const useSharedTransport = !containsAttachmentUpload
@@ -4199,7 +4212,7 @@ export default class FrontendModelBase {
4199
4212
 
4200
4213
  const decodedBatchResponse = /**
4201
4214
  * Narrows the runtime value to the documented type.
4202
- @type {Record<string, ?>} */ (batchResponse)
4215
+ * @type {Record<string, ?>} */ (batchResponse)
4203
4216
 
4204
4217
  this.throwOnErrorFrontendModelResponse({
4205
4218
  commandType,
@@ -4230,7 +4243,7 @@ export default class FrontendModelBase {
4230
4243
  const directJson = directResponseText.length > 0 ? JSON.parse(directResponseText) : {}
4231
4244
  const decodedDirectResponse = /**
4232
4245
  * Narrows the runtime value to the documented type.
4233
- @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(directJson))
4246
+ * @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(directJson))
4234
4247
 
4235
4248
  this.throwOnErrorFrontendModelResponse({
4236
4249
  commandType,
@@ -4255,7 +4268,7 @@ export default class FrontendModelBase {
4255
4268
  static async executeCustomCommand({commandName, commandType, memberId = null, payload, resourcePath}) {
4256
4269
  const serializedPayload = /**
4257
4270
  * Narrows the runtime value to the documented type.
4258
- @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
4271
+ * @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
4259
4272
  const customPath = frontendModelCustomCommandPath({
4260
4273
  commandName,
4261
4274
  memberId,
@@ -4279,7 +4292,7 @@ export default class FrontendModelBase {
4279
4292
 
4280
4293
  const decodedBatchResponse = /**
4281
4294
  * Narrows the runtime value to the documented type.
4282
- @type {Record<string, ?>} */ (batchResponse)
4295
+ * @type {Record<string, ?>} */ (batchResponse)
4283
4296
 
4284
4297
  this.throwOnErrorFrontendModelResponse({
4285
4298
  commandType,
@@ -4325,7 +4338,7 @@ export default class FrontendModelBase {
4325
4338
 
4326
4339
  const error = /**
4327
4340
  * Narrows the runtime value to the documented type.
4328
- @type {Error & {velocious?: Record<string, ?>, errorType?: string, validationErrors?: Record<string, ?>, debugErrorClass?: string, debugBacktrace?: string[]}} */ (new Error(errorMessage))
4341
+ * @type {Error & {velocious?: Record<string, ?>, errorType?: string, validationErrors?: Record<string, ?>, debugErrorClass?: string, debugBacktrace?: string[]}} */ (new Error(errorMessage))
4329
4342
  if (response.velocious && typeof response.velocious === "object") {
4330
4343
  error.velocious = response.velocious
4331
4344
  }
@@ -4356,7 +4369,7 @@ export default class FrontendModelBase {
4356
4369
  static configuredFrontendModelAttributeNames() {
4357
4370
  const resourceConfig = /**
4358
4371
  * Narrows the runtime value to the documented type.
4359
- @type {Record<string, ?>} */ (this.resourceConfig())
4372
+ * @type {Record<string, ?>} */ (this.resourceConfig())
4360
4373
  const attributes = resourceConfig.attributes
4361
4374
 
4362
4375
  if (Array.isArray(attributes)) {