velocious 1.0.562 → 1.0.564

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 (245) hide show
  1. package/README.md +5 -1
  2. package/build/background-jobs/cron-expression.js +12 -13
  3. package/build/background-jobs/main.js +6 -6
  4. package/build/background-jobs/runner-graceful-shutdown.js +2 -3
  5. package/build/background-jobs/scheduler.js +3 -3
  6. package/build/background-jobs/worker.js +8 -9
  7. package/build/beacon/client.js +3 -4
  8. package/build/configuration-types.js +1 -0
  9. package/build/configuration.js +44 -3
  10. package/build/database/drivers/sqlite/web-persistence.js +2 -5
  11. package/build/database/pool/async-tracked-multi-connection.js +65 -15
  12. package/build/database/pool/base.js +23 -7
  13. package/build/database/query/index.js +21 -22
  14. package/build/database/query/model-class-query.js +5 -6
  15. package/build/database/record/attachments/normalize-input.js +9 -10
  16. package/build/database/record/attachments/store.js +2 -2
  17. package/build/database/record/auditing.js +7 -8
  18. package/build/database/record/index.js +4 -5
  19. package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +1 -2
  20. package/build/frontend-model-controller.js +49 -56
  21. package/build/frontend-models/base.js +17 -19
  22. package/build/frontend-models/outgoing-event-buffer.js +3 -4
  23. package/build/frontend-models/query.js +40 -44
  24. package/build/frontend-models/resource-definition.js +7 -8
  25. package/build/frontend-models/transport-serialization.js +10 -12
  26. package/build/frontend-models/websocket-channel.js +12 -13
  27. package/build/http-server/client/websocket-session.js +7 -8
  28. package/build/http-server/client-delivery-queue.js +167 -0
  29. package/build/http-server/server-client.js +9 -0
  30. package/build/http-server/websocket-event-log-store.js +4 -6
  31. package/build/http-server/websocket-events-host.js +42 -12
  32. package/build/http-server/worker-handler/in-process.js +53 -14
  33. package/build/http-server/worker-handler/index.js +88 -18
  34. package/build/http-server/worker-handler/worker-thread.js +2 -2
  35. package/build/plugins/sqljs-wasm-route.js +3 -5
  36. package/build/src/background-jobs/cron-expression.d.ts +0 -12
  37. package/build/src/background-jobs/cron-expression.d.ts.map +1 -1
  38. package/build/src/background-jobs/cron-expression.js +13 -13
  39. package/build/src/background-jobs/main.d.ts.map +1 -1
  40. package/build/src/background-jobs/main.js +7 -7
  41. package/build/src/background-jobs/runner-graceful-shutdown.d.ts +0 -6
  42. package/build/src/background-jobs/runner-graceful-shutdown.d.ts.map +1 -1
  43. package/build/src/background-jobs/runner-graceful-shutdown.js +3 -3
  44. package/build/src/background-jobs/scheduler.d.ts +0 -3
  45. package/build/src/background-jobs/scheduler.d.ts.map +1 -1
  46. package/build/src/background-jobs/scheduler.js +4 -4
  47. package/build/src/background-jobs/worker.d.ts +0 -8
  48. package/build/src/background-jobs/worker.d.ts.map +1 -1
  49. package/build/src/background-jobs/worker.js +9 -9
  50. package/build/src/beacon/client.d.ts +0 -4
  51. package/build/src/beacon/client.d.ts.map +1 -1
  52. package/build/src/beacon/client.js +4 -4
  53. package/build/src/configuration-types.d.ts +8 -0
  54. package/build/src/configuration-types.d.ts.map +1 -1
  55. package/build/src/configuration-types.js +2 -1
  56. package/build/src/configuration.d.ts +34 -1
  57. package/build/src/configuration.d.ts.map +1 -1
  58. package/build/src/configuration.js +40 -4
  59. package/build/src/database/drivers/sqlite/web-persistence.d.ts +0 -14
  60. package/build/src/database/drivers/sqlite/web-persistence.d.ts.map +1 -1
  61. package/build/src/database/drivers/sqlite/web-persistence.js +3 -3
  62. package/build/src/database/pool/async-tracked-multi-connection.d.ts +29 -1
  63. package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
  64. package/build/src/database/pool/async-tracked-multi-connection.js +57 -15
  65. package/build/src/database/pool/base.d.ts +53 -4
  66. package/build/src/database/pool/base.d.ts.map +1 -1
  67. package/build/src/database/pool/base.js +23 -6
  68. package/build/src/database/query/index.d.ts +18 -39
  69. package/build/src/database/query/index.d.ts.map +1 -1
  70. package/build/src/database/query/index.js +22 -22
  71. package/build/src/database/query/model-class-query.d.ts +0 -5
  72. package/build/src/database/query/model-class-query.d.ts.map +1 -1
  73. package/build/src/database/query/model-class-query.js +6 -6
  74. package/build/src/database/record/attachments/normalize-input.d.ts +0 -9
  75. package/build/src/database/record/attachments/normalize-input.d.ts.map +1 -1
  76. package/build/src/database/record/attachments/normalize-input.js +10 -10
  77. package/build/src/database/record/attachments/store.d.ts.map +1 -1
  78. package/build/src/database/record/attachments/store.js +2 -2
  79. package/build/src/database/record/auditing.d.ts +17 -24
  80. package/build/src/database/record/auditing.d.ts.map +1 -1
  81. package/build/src/database/record/auditing.js +8 -8
  82. package/build/src/database/record/index.d.ts +4 -4
  83. package/build/src/database/record/index.d.ts.map +1 -1
  84. package/build/src/database/record/index.js +5 -5
  85. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +0 -39
  86. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
  87. package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +2 -2
  88. package/build/src/frontend-model-controller.d.ts +1 -1
  89. package/build/src/frontend-model-controller.d.ts.map +1 -1
  90. package/build/src/frontend-model-controller.js +50 -50
  91. package/build/src/frontend-models/base.d.ts.map +1 -1
  92. package/build/src/frontend-models/base.js +18 -18
  93. package/build/src/frontend-models/outgoing-event-buffer.d.ts.map +1 -1
  94. package/build/src/frontend-models/outgoing-event-buffer.js +3 -3
  95. package/build/src/frontend-models/query.d.ts +56 -37
  96. package/build/src/frontend-models/query.d.ts.map +1 -1
  97. package/build/src/frontend-models/query.js +39 -39
  98. package/build/src/frontend-models/resource-definition.d.ts +0 -7
  99. package/build/src/frontend-models/resource-definition.d.ts.map +1 -1
  100. package/build/src/frontend-models/resource-definition.js +8 -8
  101. package/build/src/frontend-models/transport-serialization.d.ts +0 -10
  102. package/build/src/frontend-models/transport-serialization.d.ts.map +1 -1
  103. package/build/src/frontend-models/transport-serialization.js +11 -11
  104. package/build/src/frontend-models/websocket-channel.d.ts +0 -12
  105. package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
  106. package/build/src/frontend-models/websocket-channel.js +13 -13
  107. package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
  108. package/build/src/http-server/client/websocket-session.js +8 -8
  109. package/build/src/http-server/client-delivery-queue.d.ts +121 -0
  110. package/build/src/http-server/client-delivery-queue.d.ts.map +1 -0
  111. package/build/src/http-server/client-delivery-queue.js +152 -0
  112. package/build/src/http-server/server-client.d.ts +6 -0
  113. package/build/src/http-server/server-client.d.ts.map +1 -1
  114. package/build/src/http-server/server-client.js +10 -1
  115. package/build/src/http-server/websocket-event-log-store.d.ts +0 -14
  116. package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
  117. package/build/src/http-server/websocket-event-log-store.js +5 -5
  118. package/build/src/http-server/websocket-events-host.d.ts +15 -4
  119. package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
  120. package/build/src/http-server/websocket-events-host.js +39 -13
  121. package/build/src/http-server/worker-handler/in-process.d.ts +19 -1
  122. package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
  123. package/build/src/http-server/worker-handler/in-process.js +50 -14
  124. package/build/src/http-server/worker-handler/index.d.ts +36 -4
  125. package/build/src/http-server/worker-handler/index.d.ts.map +1 -1
  126. package/build/src/http-server/worker-handler/index.js +82 -18
  127. package/build/src/http-server/worker-handler/worker-thread.js +3 -3
  128. package/build/src/plugins/sqljs-wasm-route.d.ts.map +1 -1
  129. package/build/src/plugins/sqljs-wasm-route.js +4 -4
  130. package/build/src/sync/conflict-strategy.d.ts +0 -15
  131. package/build/src/sync/conflict-strategy.d.ts.map +1 -1
  132. package/build/src/sync/conflict-strategy.js +3 -3
  133. package/build/src/sync/device-identity.d.ts +0 -45
  134. package/build/src/sync/device-identity.d.ts.map +1 -1
  135. package/build/src/sync/device-identity.js +4 -4
  136. package/build/src/sync/local-mutation-log.d.ts +0 -41
  137. package/build/src/sync/local-mutation-log.d.ts.map +1 -1
  138. package/build/src/sync/local-mutation-log.js +9 -9
  139. package/build/src/sync/offline-grant.d.ts +0 -26
  140. package/build/src/sync/offline-grant.d.ts.map +1 -1
  141. package/build/src/sync/offline-grant.js +4 -4
  142. package/build/src/sync/peer-mutation-bundle.d.ts +0 -14
  143. package/build/src/sync/peer-mutation-bundle.d.ts.map +1 -1
  144. package/build/src/sync/peer-mutation-bundle.js +3 -3
  145. package/build/src/sync/server-change-feed.d.ts.map +1 -1
  146. package/build/src/sync/server-change-feed.js +33 -33
  147. package/build/src/sync/sync-api-client.d.ts +0 -9
  148. package/build/src/sync/sync-api-client.d.ts.map +1 -1
  149. package/build/src/sync/sync-api-client.js +2 -2
  150. package/build/src/sync/sync-envelope-replay-service.d.ts +38 -21
  151. package/build/src/sync/sync-envelope-replay-service.d.ts.map +1 -1
  152. package/build/src/sync/sync-envelope-replay-service.js +18 -18
  153. package/build/src/sync/sync-resource-base.d.ts +0 -7
  154. package/build/src/sync/sync-resource-base.d.ts.map +1 -1
  155. package/build/src/sync/sync-resource-base.js +2 -2
  156. package/build/src/sync/sync-scope-store.d.ts +0 -9
  157. package/build/src/sync/sync-scope-store.d.ts.map +1 -1
  158. package/build/src/sync/sync-scope-store.js +10 -10
  159. package/build/src/testing/test-filter-parser.d.ts +0 -10
  160. package/build/src/testing/test-filter-parser.d.ts.map +1 -1
  161. package/build/src/testing/test-filter-parser.js +11 -11
  162. package/build/src/testing/test-runner.d.ts +25 -91
  163. package/build/src/testing/test-runner.d.ts.map +1 -1
  164. package/build/src/testing/test-runner.js +113 -98
  165. package/build/src/testing/test.d.ts +8 -0
  166. package/build/src/testing/test.d.ts.map +1 -1
  167. package/build/src/testing/test.js +9 -9
  168. package/build/src/utils/backtrace-cleaner.d.ts.map +1 -1
  169. package/build/src/utils/backtrace-cleaner.js +9 -9
  170. package/build/src/utils/model-scope.d.ts +0 -8
  171. package/build/src/utils/model-scope.d.ts.map +1 -1
  172. package/build/src/utils/model-scope.js +3 -3
  173. package/build/src/utils/ransack.d.ts +52 -19
  174. package/build/src/utils/ransack.d.ts.map +1 -1
  175. package/build/src/utils/ransack.js +26 -26
  176. package/build/sync/conflict-strategy.js +3 -6
  177. package/build/sync/device-identity.js +4 -9
  178. package/build/sync/local-mutation-log.js +9 -14
  179. package/build/sync/offline-grant.js +4 -7
  180. package/build/sync/peer-mutation-bundle.js +2 -4
  181. package/build/sync/server-change-feed.js +32 -34
  182. package/build/sync/sync-api-client.js +1 -2
  183. package/build/sync/sync-envelope-replay-service.js +17 -19
  184. package/build/sync/sync-resource-base.js +1 -2
  185. package/build/sync/sync-scope-store.js +9 -10
  186. package/build/testing/test-filter-parser.js +10 -11
  187. package/build/testing/test-runner.js +116 -108
  188. package/build/testing/test.js +8 -9
  189. package/build/tsconfig.tsbuildinfo +1 -1
  190. package/build/utils/backtrace-cleaner.js +8 -9
  191. package/build/utils/model-scope.js +3 -4
  192. package/build/utils/ransack.js +27 -34
  193. package/package.json +3 -1
  194. package/scripts/eslint-rules/typedefs-first.js +67 -0
  195. package/scripts/prewarm-chromedriver.js +26 -0
  196. package/src/background-jobs/cron-expression.js +12 -13
  197. package/src/background-jobs/main.js +6 -6
  198. package/src/background-jobs/runner-graceful-shutdown.js +2 -3
  199. package/src/background-jobs/scheduler.js +3 -3
  200. package/src/background-jobs/worker.js +8 -9
  201. package/src/beacon/client.js +3 -4
  202. package/src/configuration-types.js +1 -0
  203. package/src/configuration.js +44 -3
  204. package/src/database/drivers/sqlite/web-persistence.js +2 -5
  205. package/src/database/pool/async-tracked-multi-connection.js +65 -15
  206. package/src/database/pool/base.js +23 -7
  207. package/src/database/query/index.js +21 -22
  208. package/src/database/query/model-class-query.js +5 -6
  209. package/src/database/record/attachments/normalize-input.js +9 -10
  210. package/src/database/record/attachments/store.js +2 -2
  211. package/src/database/record/auditing.js +7 -8
  212. package/src/database/record/index.js +4 -5
  213. package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +1 -2
  214. package/src/frontend-model-controller.js +49 -56
  215. package/src/frontend-models/base.js +17 -19
  216. package/src/frontend-models/outgoing-event-buffer.js +3 -4
  217. package/src/frontend-models/query.js +40 -44
  218. package/src/frontend-models/resource-definition.js +7 -8
  219. package/src/frontend-models/transport-serialization.js +10 -12
  220. package/src/frontend-models/websocket-channel.js +12 -13
  221. package/src/http-server/client/websocket-session.js +7 -8
  222. package/src/http-server/client-delivery-queue.js +167 -0
  223. package/src/http-server/server-client.js +9 -0
  224. package/src/http-server/websocket-event-log-store.js +4 -6
  225. package/src/http-server/websocket-events-host.js +42 -12
  226. package/src/http-server/worker-handler/in-process.js +53 -14
  227. package/src/http-server/worker-handler/index.js +88 -18
  228. package/src/http-server/worker-handler/worker-thread.js +2 -2
  229. package/src/plugins/sqljs-wasm-route.js +3 -5
  230. package/src/sync/conflict-strategy.js +3 -6
  231. package/src/sync/device-identity.js +4 -9
  232. package/src/sync/local-mutation-log.js +9 -14
  233. package/src/sync/offline-grant.js +4 -7
  234. package/src/sync/peer-mutation-bundle.js +2 -4
  235. package/src/sync/server-change-feed.js +32 -34
  236. package/src/sync/sync-api-client.js +1 -2
  237. package/src/sync/sync-envelope-replay-service.js +17 -19
  238. package/src/sync/sync-resource-base.js +1 -2
  239. package/src/sync/sync-scope-store.js +9 -10
  240. package/src/testing/test-filter-parser.js +10 -11
  241. package/src/testing/test-runner.js +116 -108
  242. package/src/testing/test.js +8 -9
  243. package/src/utils/backtrace-cleaner.js +8 -9
  244. package/src/utils/model-scope.js +3 -4
  245. package/src/utils/ransack.js +27 -34
package/README.md CHANGED
@@ -1568,7 +1568,9 @@ database: {
1568
1568
 
1569
1569
  Velocious includes a lightweight websocket entry point for API-style calls and server-side events.
1570
1570
 
1571
- Inbound frames remain ordered when TCP splits a frame across reads. Velocious limits a single final client data frame and a reassembled fragmented message to 16 MiB; larger payloads close the connection. See [WebSocket connections](docs/websocket-connections.md) for wire-protocol details.
1571
+ Inbound frames remain ordered when TCP splits a frame across reads. Velocious limits a single final client data frame and a reassembled fragmented message to 16 MiB; larger payloads close the connection.
1572
+
1573
+ Server-to-client WebSocket delivery is bounded independently per client. The defaults retain at most 256 queued/in-flight completed frames or 16 MiB of serialized frame output; the HTTP 101 upgrade response and ordinary HTTP/file output remain outside that budget, while exact FIFO is preserved. A slow client that exceeds either limit is reported through the framework error events and deterministically closed without affecting other clients. V2 channel broadcast delivery and persistence remain isolated to the originating configuration when several applications share a process. Configure positive safe integers with `httpServer.websocketOutboundQueue.maxPendingFrames` and `maxPendingBytes`. See [WebSocket connections](docs/websocket-connections.md) for configuration and wire-protocol details.
1572
1574
 
1573
1575
  ## Connect and call a controller
1574
1576
 
@@ -1871,6 +1873,8 @@ If you are developing on Velocious, you can run the tests with:
1871
1873
 
1872
1874
  Tests default to a 60-second timeout. Override per test with `{timeoutSeconds: 5}` or set a suite-wide default via `configureTests({defaultTimeoutSeconds: 30})`.
1873
1875
 
1876
+ Request tests share transaction-active, non-tenant database connections with their in-process HTTP handlers. Eligibility is evaluated when each request is dispatched, so a hook can start a transaction and issue a request in the same callback. This makes uncommitted setup visible to handlers while preserving rollback isolation. Without an active transaction, handlers use independent pooled connections, so concurrency and locking tests can opt out of transaction cleanup and exercise production-style connections. Shared connection state is scoped to the test lifecycle and cleared around each test. See [docs/testing-guidelines.md](docs/testing-guidelines.md#request-test-database-connections).
1877
+
1874
1878
  # Writing a request test
1875
1879
 
1876
1880
  First create a test file under something like the following path 'src/routes/accounts/create-test.js' with something like the following content:
@@ -1,3 +1,15 @@
1
+ /**
2
+ * ParsedCron type.
3
+ * @typedef {object} ParsedCron
4
+ * @property {Set<number>} minute - Allowed minute values (0-59).
5
+ * @property {Set<number>} hour - Allowed hour values (0-23).
6
+ * @property {Set<number>} dayOfMonth - Allowed day-of-month values (1-31).
7
+ * @property {Set<number>} month - Allowed month values (1-12).
8
+ * @property {Set<number>} dayOfWeek - Allowed day-of-week values (0-6, 0=Sun).
9
+ * @property {boolean} dayOfMonthRestricted - True when the dayOfMonth field is not `?`.
10
+ * @property {boolean} dayOfWeekRestricted - True when the dayOfWeek field is not `?`.
11
+ * @property {string} expression - Original expression for diagnostics.
12
+ */
1
13
  // @ts-check
2
14
 
3
15
  /**
@@ -36,19 +48,6 @@ const FIELDS = [
36
48
  {name: "dayOfWeek", min: 0, max: 7, names: DAY_NAMES}
37
49
  ]
38
50
 
39
- /**
40
- * ParsedCron type.
41
- * @typedef {object} ParsedCron
42
- * @property {Set<number>} minute - Allowed minute values (0-59).
43
- * @property {Set<number>} hour - Allowed hour values (0-23).
44
- * @property {Set<number>} dayOfMonth - Allowed day-of-month values (1-31).
45
- * @property {Set<number>} month - Allowed month values (1-12).
46
- * @property {Set<number>} dayOfWeek - Allowed day-of-week values (0-6, 0=Sun).
47
- * @property {boolean} dayOfMonthRestricted - True when the dayOfMonth field is not `?`.
48
- * @property {boolean} dayOfWeekRestricted - True when the dayOfWeek field is not `?`.
49
- * @property {string} expression - Original expression for diagnostics.
50
- */
51
-
52
51
  /**
53
52
  * Runs the parseCronExpression helper.
54
53
  * @param {string} expression - Cron expression or shortcut.
@@ -9,6 +9,12 @@ import PruneTerminalBackgroundJobsJob from "../jobs/prune-terminal-background-jo
9
9
  import VelociousError from "../velocious-error.js"
10
10
  import shutdownLifecycle from "../utils/shutdown-lifecycle.js"
11
11
 
12
+ /**
13
+ * WorkerExecutionModeCapability type.
14
+ * @typedef {object} WorkerExecutionModeCapability
15
+ * @property {import("./types.js").BackgroundJobExecutionMode} executionMode - Execution mode.
16
+ * @property {(worker: JsonSocket) => boolean} accepts - Whether the worker accepts this mode.
17
+ */
12
18
  /**
13
19
  * Channel used by `background-jobs-main` to coordinate dispatch wake-ups
14
20
  * across processes via Beacon. Workers do NOT subscribe to this channel
@@ -28,12 +34,6 @@ const MAX_TIMER_MS = 2_147_483_647 // ~24.8 days
28
34
  const WORKER_STALE_TIMEOUT_MS = 60000
29
35
  /** How often the main scans workers for staleness. */
30
36
  const WORKER_LIVENESS_SWEEP_MS = 15000
31
- /**
32
- * WorkerExecutionModeCapability type.
33
- * @typedef {object} WorkerExecutionModeCapability
34
- * @property {import("./types.js").BackgroundJobExecutionMode} executionMode - Execution mode.
35
- * @property {(worker: JsonSocket) => boolean} accepts - Whether the worker accepts this mode.
36
- */
37
37
  /**
38
38
  * Worker execution mode capabilities.
39
39
  * @type {WorkerExecutionModeCapability[]} */
@@ -4,15 +4,14 @@ import timeout from "awaitery/build/timeout.js"
4
4
 
5
5
  import Configuration, {CurrentConfigurationNotSetError} from "../configuration.js"
6
6
 
7
- /** Bounded grace for closing framework connections on shutdown before forcing exit. */
8
- const SHUTDOWN_CLOSE_TIMEOUT_MS = 5000
9
-
10
7
  /**
11
8
  * The subset of a configuration a runner closes on shutdown. Typed structurally so
12
9
  * the shutdown path stays typechecked without a broad cast, and a future signature
13
10
  * drift surfaces at the call sites (and in tests) instead of hiding behind `any`.
14
11
  * @typedef {{disconnectBeacon: () => Promise<void>, closeDatabaseConnections: () => Promise<void>}} RunnerCloseableConfiguration
15
12
  */
13
+ /** Bounded grace for closing framework connections on shutdown before forcing exit. */
14
+ const SHUTDOWN_CLOSE_TIMEOUT_MS = 5000
16
15
 
17
16
  /**
18
17
  * Gracefully closes a background-job runner's framework connections (beacon +
@@ -3,6 +3,9 @@
3
3
  import Logger from "../logger.js"
4
4
  import {nextCronFireDate, parseCronExpression} from "./cron-expression.js"
5
5
 
6
+ /**
7
+ * DurationUnit type.
8
+ * @typedef {keyof typeof DURATION_MULTIPLIERS} DurationUnit */
6
9
  const DURATION_MULTIPLIERS = {
7
10
  d: 24 * 60 * 60 * 1000,
8
11
  day: 24 * 60 * 60 * 1000,
@@ -21,9 +24,6 @@ const DURATION_MULTIPLIERS = {
21
24
  week: 7 * 24 * 60 * 60 * 1000,
22
25
  weeks: 7 * 24 * 60 * 60 * 1000
23
26
  }
24
- /**
25
- * DurationUnit type.
26
- * @typedef {keyof typeof DURATION_MULTIPLIERS} DurationUnit */
27
27
 
28
28
  /**
29
29
  * Runs the parseScheduledDuration helper.
@@ -10,6 +10,14 @@ import {randomUUID} from "crypto"
10
10
  import {fileURLToPath} from "node:url"
11
11
  import shutdownLifecycle from "../utils/shutdown-lifecycle.js"
12
12
 
13
+ /**
14
+ * Per-forked-child timeout bookkeeping.
15
+ * @typedef {object} ForkedJobTimeoutState
16
+ * @property {boolean} timedOut - Whether the timeout fired and the child was terminated.
17
+ * @property {number | null} timeoutMs - The armed timeout in ms, or null when disabled.
18
+ * @property {ReturnType<typeof setTimeout> | null} timer - The pending timeout timer, cleared on exit.
19
+ * @property {ReturnType<typeof setTimeout> | null} sigkillTimer - The pending SIGKILL grace timer, cleared on exit.
20
+ */
13
21
  /** Grace period after SIGTERM before a lingering process runner is SIGKILLed. */
14
22
  const FORKED_CHILD_SIGKILL_GRACE_MS = 5000
15
23
  /**
@@ -48,15 +56,6 @@ function positiveNumber(value) {
48
56
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined
49
57
  }
50
58
 
51
- /**
52
- * Per-forked-child timeout bookkeeping.
53
- * @typedef {object} ForkedJobTimeoutState
54
- * @property {boolean} timedOut - Whether the timeout fired and the child was terminated.
55
- * @property {number | null} timeoutMs - The armed timeout in ms, or null when disabled.
56
- * @property {ReturnType<typeof setTimeout> | null} timer - The pending timeout timer, cleared on exit.
57
- * @property {ReturnType<typeof setTimeout> | null} sigkillTimer - The pending SIGKILL grace timer, cleared on exit.
58
- */
59
-
60
59
  export default class BackgroundJobsWorker {
61
60
  /**
62
61
  * Runs constructor.
@@ -7,14 +7,13 @@ import timeout from "awaitery/build/timeout.js"
7
7
  import JsonSocket from "../background-jobs/json-socket.js"
8
8
  import EventEmitter from "../utils/event-emitter.js"
9
9
 
10
- const DEFAULT_RECONNECT_DELAY_MS = 1000
11
- const MAX_RECONNECT_DELAY_MS = 30_000
12
- const DEFAULT_CLOSE_TIMEOUT_MS = 1000
13
-
14
10
  /**
15
11
  * BeaconBroadcastHandler type.
16
12
  * @typedef {function(import("./types.js").BeaconBroadcastMessage): void} BeaconBroadcastHandler
17
13
  */
14
+ const DEFAULT_RECONNECT_DELAY_MS = 1000
15
+ const MAX_RECONNECT_DELAY_MS = 30_000
16
+ const DEFAULT_CLOSE_TIMEOUT_MS = 1000
18
17
 
19
18
  /**
20
19
  * BeaconClient connects to a `velocious beacon` daemon and exchanges
@@ -255,6 +255,7 @@
255
255
  * @property {boolean} [inProcess] - Run HTTP handlers in the main thread instead of worker threads.
256
256
  * @property {number} [maxWorkers] - Backward-compatible alias for workers.
257
257
  * @property {number} [port] - Port to bind the HTTP server to.
258
+ * @property {{maxPendingBytes?: number, maxPendingFrames?: number}} [websocketOutboundQueue] - Per-client retained outbound WebSocket frame limits.
258
259
  * @property {number} [workers] - Worker handlers to start for the HTTP server.
259
260
  */
260
261
 
@@ -114,6 +114,25 @@ function resolveBeaconUnreachableReportMs(value) {
114
114
  return 30_000
115
115
  }
116
116
 
117
+ const DEFAULT_WEBSOCKET_OUTBOUND_MAX_PENDING_BYTES = 16 * 1024 * 1024
118
+ const DEFAULT_WEBSOCKET_OUTBOUND_MAX_PENDING_FRAMES = 256
119
+
120
+ /**
121
+ * Validates a positive safe integer configuration value.
122
+ * @param {?} value - Configured positive safe integer.
123
+ * @param {string} name - Configuration key.
124
+ * @param {number} defaultValue - Default value.
125
+ * @returns {number} - Validated configured or default value.
126
+ */
127
+ function positiveSafeInteger(value, name, defaultValue) {
128
+ if (value === undefined) return defaultValue
129
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
130
+ throw new TypeError(`${name} must be a positive safe integer`)
131
+ }
132
+
133
+ return value
134
+ }
135
+
117
136
  export default class VelociousConfiguration {
118
137
  /**
119
138
  * Close database connections promise.
@@ -209,7 +228,15 @@ export default class VelociousConfiguration {
209
228
  * @type {Promise<void> | undefined}
210
229
  */
211
230
  this._initializePromise = undefined
212
- this.httpServer = httpServer || {}
231
+ const websocketOutboundQueue = httpServer?.websocketOutboundQueue
232
+
233
+ this.httpServer = {
234
+ ...(httpServer || {}),
235
+ websocketOutboundQueue: {
236
+ maxPendingBytes: positiveSafeInteger(websocketOutboundQueue?.maxPendingBytes, "httpServer.websocketOutboundQueue.maxPendingBytes", DEFAULT_WEBSOCKET_OUTBOUND_MAX_PENDING_BYTES),
237
+ maxPendingFrames: positiveSafeInteger(websocketOutboundQueue?.maxPendingFrames, "httpServer.websocketOutboundQueue.maxPendingFrames", DEFAULT_WEBSOCKET_OUTBOUND_MAX_PENDING_FRAMES)
238
+ }
239
+ }
213
240
  /**
214
241
  * Stores the http server instance value.
215
242
  * @type {{getDebugSnapshot: () => Promise<Record<string, ?>>} | undefined} */
@@ -1693,7 +1720,8 @@ export default class VelociousConfiguration {
1693
1720
  websocketEvents.broadcastV2({
1694
1721
  channel: message.channel,
1695
1722
  broadcastParams: message.broadcastParams,
1696
- body: message.body
1723
+ body: message.body,
1724
+ configuration: this
1697
1725
  })
1698
1726
  return
1699
1727
  }
@@ -2342,6 +2370,19 @@ export default class VelociousConfiguration {
2342
2370
  */
2343
2371
  getWebsocketSessionHeartbeatSeconds() { return this._websocketSessionHeartbeatSeconds }
2344
2372
 
2373
+ /**
2374
+ * Gets per-client WebSocket outbound queue limits.
2375
+ * @returns {{maxBytes: number, maxFrames: number}} - Per-client outbound queue high-water marks.
2376
+ */
2377
+ getWebsocketOutboundQueueLimits() {
2378
+ const queue = this.httpServer.websocketOutboundQueue
2379
+
2380
+ return {
2381
+ maxBytes: queue.maxPendingBytes,
2382
+ maxFrames: queue.maxPendingFrames
2383
+ }
2384
+ }
2385
+
2345
2386
  /**
2346
2387
  * Registers a wrapper invoked around every WS-borne request /
2347
2388
  * connection message / channel dispatch. The wrapper receives the
@@ -2537,7 +2578,7 @@ export default class VelociousConfiguration {
2537
2578
  const websocketEvents = this._websocketEvents
2538
2579
 
2539
2580
  if (websocketEvents && typeof websocketEvents.broadcastV2 === "function") {
2540
- websocketEvents.broadcastV2({channel: name, broadcastParams, body})
2581
+ websocketEvents.broadcastV2({channel: name, broadcastParams, body, configuration: this})
2541
2582
  return
2542
2583
  }
2543
2584
 
@@ -2,9 +2,6 @@
2
2
 
3
3
  import BetterLocalStorage from "better-localstorage"
4
4
 
5
- const SUPPORT_CHECK_FILE = ".velocious-opfs-support-check"
6
- const SUPPORT_CHECK_BYTES = new Uint8Array([118, 101, 108, 111, 99, 105, 111, 117, 115])
7
-
8
5
  /**
9
6
  * SQLite web persistence adapter.
10
7
  * @typedef {object} SqliteWebPersistence
@@ -13,13 +10,14 @@ const SUPPORT_CHECK_BYTES = new Uint8Array([118, 101, 108, 111, 99, 105, 111, 11
13
10
  * @property {() => Promise<Uint8Array | undefined>} load - Loads persisted database bytes.
14
11
  * @property {(content: Uint8Array) => Promise<void>} save - Saves persisted database bytes.
15
12
  */
16
-
17
13
  /**
18
14
  * Browser-like environment used for web persistence detection.
19
15
  * @typedef {object} SqliteWebPersistenceEnvironment
20
16
  * @property {unknown} [indexedDB] - IndexedDB global.
21
17
  * @property {unknown} [navigator] - Navigator global.
22
18
  */
19
+ const SUPPORT_CHECK_FILE = ".velocious-opfs-support-check"
20
+ const SUPPORT_CHECK_BYTES = new Uint8Array([118, 101, 108, 111, 99, 105, 111, 117, 115])
23
21
 
24
22
  /**
25
23
  * Creates the best SQLite web persistence adapter supported by the current browser.
@@ -297,7 +295,6 @@ class LocalStoragePersistence {
297
295
  }
298
296
  }
299
297
 
300
-
301
298
  /**
302
299
  * Selects the preferred available SQLite web persistence backend.
303
300
  * @param {object} args - Arguments.
@@ -3,14 +3,6 @@
3
3
  import {AsyncLocalStorage} from "async_hooks"
4
4
  import BasePool, {POOL_CONFIGURATION_KEY} from "./base.js"
5
5
 
6
- export const CLOSED_CONNECTION = Symbol("velociousClosedConnection")
7
- const IDLE_CONNECTION_CHECKED_IN_AT = Symbol("velociousIdleConnectionCheckedInAt")
8
- const CONNECTION_CHECKED_OUT_AT = Symbol("velociousConnectionCheckedOutAt")
9
- const SUPPRESSED_CONNECTION_CONTEXT = Symbol("velociousSuppressedConnectionContext")
10
- const DEFAULT_MAX_CONNECTIONS = 10
11
- const DEFAULT_IDLE_TIMEOUT_MILLIS = 5000
12
- const DEFAULT_CHECKOUT_TIMEOUT_MILLIS = 10000
13
-
14
6
  /**
15
7
  * PendingCheckout type.
16
8
  * @typedef {object} PendingCheckout
@@ -24,6 +16,13 @@ const DEFAULT_CHECKOUT_TIMEOUT_MILLIS = 10000
24
16
  * @property {number | null} timeoutMillis - Milliseconds to wait before rejecting, or null when disabled.
25
17
  * @property {ReturnType<typeof setTimeout> | undefined} timeoutTimer - Timer that rejects the pending checkout.
26
18
  */
19
+ export const CLOSED_CONNECTION = Symbol("velociousClosedConnection")
20
+ const IDLE_CONNECTION_CHECKED_IN_AT = Symbol("velociousIdleConnectionCheckedInAt")
21
+ const CONNECTION_CHECKED_OUT_AT = Symbol("velociousConnectionCheckedOutAt")
22
+ const SUPPRESSED_CONNECTION_CONTEXT = Symbol("velociousSuppressedConnectionContext")
23
+ const DEFAULT_MAX_CONNECTIONS = 10
24
+ const DEFAULT_IDLE_TIMEOUT_MILLIS = 5000
25
+ const DEFAULT_CHECKOUT_TIMEOUT_MILLIS = 10000
27
26
 
28
27
  export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends BasePool {
29
28
  /**
@@ -42,6 +41,18 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
42
41
  */
43
42
  _testSharedConnection = undefined
44
43
 
44
+ /**
45
+ * Dynamically resolves the connection eligible for in-process test request sharing.
46
+ * @type {(() => import("../drivers/base.js").default | undefined) | undefined}
47
+ */
48
+ _testSharedConnectionProvider = undefined
49
+
50
+ /**
51
+ * Identifies the lifecycle that installed the current shared connection or provider.
52
+ * @type {import("./base.js").TestSharedConnectionRegistration | undefined}
53
+ */
54
+ _testSharedConnectionRegistration = undefined
55
+
45
56
  /**
46
57
  * Connections.
47
58
  * @type {import("../drivers/base.js").default[]} */
@@ -797,17 +808,44 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
797
808
  * Set a shared connection for test mode so that HTTP handlers running
798
809
  * in the same process can reuse the test runner's database connection.
799
810
  * @param {import("../drivers/base.js").default} connection - Shared connection.
800
- * @returns {void}
811
+ * @returns {import("./base.js").TestSharedConnectionRegistration} - Opaque registration handle.
801
812
  */
802
813
  setTestSharedConnection(connection) {
814
+ const registration = {owner: Symbol("test-shared-connection")}
815
+
803
816
  this._testSharedConnection = connection
817
+ this._testSharedConnectionProvider = undefined
818
+ this._testSharedConnectionRegistration = registration
819
+
820
+ return registration
804
821
  }
805
822
 
806
823
  /**
807
- * Runs clear test shared connection.
824
+ * Sets a provider that is evaluated when an in-process test request is dispatched.
825
+ * @param {() => import("../drivers/base.js").default | undefined} provider - Shared connection provider.
826
+ * @returns {import("./base.js").TestSharedConnectionRegistration} - Opaque registration handle.
827
+ */
828
+ setTestSharedConnectionProvider(provider) {
829
+ const registration = {owner: Symbol("test-shared-connection-provider")}
830
+
831
+ this._testSharedConnection = undefined
832
+ this._testSharedConnectionProvider = provider
833
+ this._testSharedConnectionRegistration = registration
834
+
835
+ return registration
836
+ }
837
+
838
+ /**
839
+ * Clears the current shared connection registration. A supplied stale registration
840
+ * cannot clear a provider installed by a newer lifecycle.
841
+ * @param {import("./base.js").TestSharedConnectionRegistration} [registration] - Opaque registration handle to clear conditionally.
808
842
  * @returns {void} */
809
- clearTestSharedConnection() {
843
+ clearTestSharedConnection(registration) {
844
+ if (registration && registration !== this._testSharedConnectionRegistration) return
845
+
810
846
  this._testSharedConnection = undefined
847
+ this._testSharedConnectionProvider = undefined
848
+ this._testSharedConnectionRegistration = undefined
811
849
  }
812
850
 
813
851
  /**
@@ -821,9 +859,21 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
821
859
  * @returns {T} - Callback result.
822
860
  */
823
861
  runWithTestSharedConnection(callback) {
824
- if (!this._testSharedConnection) return callback()
862
+ const connection = this.testSharedConnection()
825
863
 
826
- return this.asyncLocalStorage.run(this._testSharedConnection.getIdSeq(), callback)
864
+ if (!connection) return callback()
865
+
866
+ return this.asyncLocalStorage.run(connection.getIdSeq(), callback)
867
+ }
868
+
869
+ /**
870
+ * Resolves the connection currently eligible for in-process test request sharing.
871
+ * @returns {import("../drivers/base.js").default | undefined} - Shared connection.
872
+ */
873
+ testSharedConnection() {
874
+ return this._testSharedConnectionProvider
875
+ ? this._testSharedConnectionProvider()
876
+ : this._testSharedConnection
827
877
  }
828
878
 
829
879
  /**
@@ -835,7 +885,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
835
885
  const id = this.asyncLocalStorage.getStore()
836
886
 
837
887
  if (id === SUPPRESSED_CONNECTION_CONTEXT) return undefined
838
- if (id === undefined) return this._testSharedConnection
888
+ if (id === undefined) return this.testSharedConnection()
839
889
 
840
890
  return this.getCurrentConnection()
841
891
  }
@@ -1285,7 +1335,7 @@ export default class VelociousDatabasePoolAsyncTrackedMultiConnection extends Ba
1285
1335
 
1286
1336
  this.connections = []
1287
1337
  this.connectionsInUse = {}
1288
- this._testSharedConnection = undefined
1338
+ this.clearTestSharedConnection()
1289
1339
  this.clearGlobalConnectionForIdentifier()
1290
1340
 
1291
1341
  for (const connection of connections) {
@@ -4,14 +4,16 @@ import Configuration from "../../configuration.js"
4
4
  import Logger from "../../logger.js"
5
5
  import baseMethodsForward from "./base-methods-forward.js"
6
6
 
7
- export const POOL_CONFIGURATION_KEY = Symbol("velociousPoolConfigurationKey")
7
+ /**
8
+ * Opaque ownership handle for an in-process test shared connection registration.
9
+ * @typedef {{owner: symbol}} TestSharedConnectionRegistration
10
+ */
8
11
 
9
12
  /**
10
13
  * ConnectionCheckoutOptions type.
11
14
  * @typedef {object} ConnectionCheckoutOptions
12
15
  * @property {string} [name] - Human-readable name for the checked-out connection.
13
16
  */
14
-
15
17
  /**
16
18
  * DatabasePoolPendingCheckoutDebugSnapshot type.
17
19
  * @typedef {object} DatabasePoolPendingCheckoutDebugSnapshot
@@ -24,7 +26,6 @@ export const POOL_CONFIGURATION_KEY = Symbol("velociousPoolConfigurationKey")
24
26
  * @property {number | null} timeoutMillis - Timeout configured for the checkout, or null when disabled.
25
27
  * @property {number} waitingForMs - Milliseconds already spent waiting.
26
28
  */
27
-
28
29
  /**
29
30
  * DatabasePoolDebugSnapshot type.
30
31
  * @typedef {object} DatabasePoolDebugSnapshot
@@ -38,6 +39,7 @@ export const POOL_CONFIGURATION_KEY = Symbol("velociousPoolConfigurationKey")
38
39
  * @property {number} pendingCheckoutCount - Number of queued checkout requests.
39
40
  * @property {string} poolClass - Pool class name.
40
41
  */
42
+ export const POOL_CONFIGURATION_KEY = Symbol("velociousPoolConfigurationKey")
41
43
 
42
44
  /**
43
45
  * Shared.
@@ -149,15 +151,29 @@ class VelociousDatabasePoolBase {
149
151
  * pin (used by the test runner to share one connection with in-process HTTP handlers).
150
152
  * Base pools that do not track async context ignore it; async-context pools override.
151
153
  * @param {import("../drivers/base.js").default} _connection - Shared connection.
152
- * @returns {void}
154
+ * @returns {TestSharedConnectionRegistration | undefined} - Opaque registration handle when supported.
153
155
  */
154
- setTestSharedConnection(_connection) {}
156
+ setTestSharedConnection(_connection) {
157
+ return undefined
158
+ }
159
+
160
+ /**
161
+ * Sets a provider that resolves the connection eligible for in-process test request sharing.
162
+ * Base pools that do not track async context ignore it; async-context pools override.
163
+ * @param {() => import("../drivers/base.js").default | undefined} _provider - Shared connection provider.
164
+ * @returns {TestSharedConnectionRegistration | undefined} - Opaque registration handle when supported.
165
+ */
166
+ setTestSharedConnectionProvider(_provider) {
167
+ return undefined
168
+ }
155
169
 
156
170
  /**
157
- * Clears the shared connection set by {@link setTestSharedConnection}. No-op by default.
171
+ * Clears the shared connection or provider set for in-process test requests. No-op by default.
172
+ * When a registration is provided, clears only if it is still the active registration.
173
+ * @param {TestSharedConnectionRegistration} [_registration] - Opaque handle returned when the shared value was set.
158
174
  * @returns {void}
159
175
  */
160
- clearTestSharedConnection() {}
176
+ clearTestSharedConnection(_registration) {}
161
177
 
162
178
  /**
163
179
  * Runs a callback inside the test shared connection's context. Base pools that do not
@@ -14,6 +14,27 @@ import WhereHash from "./where-hash.js"
14
14
  import WhereNot from "./where-not.js"
15
15
  import WherePlain from "./where-plain.js"
16
16
 
17
+ /**
18
+ * QueryArgsType type.
19
+ * @typedef {object} QueryArgsType
20
+ * @property {import("../drivers/base.js").default | (() => import("../drivers/base.js").default)} driver - Driver instance or factory for query execution.
21
+ * @property {Array<import("./from-base.js").default>} [froms] - FROM clauses for the query.
22
+ * @property {string[]} [groups] - GROUP BY columns.
23
+ * @property {Array<import("./join-base.js").default>} [joins] - JOIN clauses for the query.
24
+ * @property {import("../handler.js").default} handler - Handler used for executing and transforming results.
25
+ * @property {number | null} [limit] - LIMIT clause value.
26
+ * @property {number | null} [offset] - OFFSET clause value.
27
+ * @property {Array<import("./order-base.js").default>} [orders] - ORDER BY clauses.
28
+ * @property {number | null} [page] - Page number for pagination.
29
+ * @property {number} [perPage] - Records per page for pagination.
30
+ * @property {NestedPreloadRecord} [preload] - Preload graph for related records.
31
+ * @property {Record<string, string[]>} [preloadSelects] - Attribute names to load for preloaded relationships, keyed by target model name.
32
+ * @property {Record<string, string[]>} [preloadSelectsExtra] - Extra selects to load in addition to the defaults for preloaded relationships, keyed by target model name.
33
+ * @property {Array<import("./select-base.js").default>} [selects] - SELECT clauses for the query.
34
+ * @property {AbortSignal} [signal] - Signal passed to database query execution.
35
+ * @property {boolean} [distinct] - Whether the query should use DISTINCT.
36
+ * @property {Array<import("./where-base.js").default>} [wheres] - WHERE conditions for the query.
37
+ */
17
38
  /**
18
39
  * OrderArgumentType type.
19
40
  * @typedef {{[key: string]: boolean | string | string[] | NestedPreloadRecord }} NestedPreloadRecord
@@ -108,28 +129,6 @@ function mergeJoinValue(existing, incoming) {
108
129
  return incoming
109
130
  }
110
131
 
111
- /**
112
- * QueryArgsType type.
113
- * @typedef {object} QueryArgsType
114
- * @property {import("../drivers/base.js").default | (() => import("../drivers/base.js").default)} driver - Driver instance or factory for query execution.
115
- * @property {Array<import("./from-base.js").default>} [froms] - FROM clauses for the query.
116
- * @property {string[]} [groups] - GROUP BY columns.
117
- * @property {Array<import("./join-base.js").default>} [joins] - JOIN clauses for the query.
118
- * @property {import("../handler.js").default} handler - Handler used for executing and transforming results.
119
- * @property {number | null} [limit] - LIMIT clause value.
120
- * @property {number | null} [offset] - OFFSET clause value.
121
- * @property {Array<import("./order-base.js").default>} [orders] - ORDER BY clauses.
122
- * @property {number | null} [page] - Page number for pagination.
123
- * @property {number} [perPage] - Records per page for pagination.
124
- * @property {NestedPreloadRecord} [preload] - Preload graph for related records.
125
- * @property {Record<string, string[]>} [preloadSelects] - Attribute names to load for preloaded relationships, keyed by target model name.
126
- * @property {Record<string, string[]>} [preloadSelectsExtra] - Extra selects to load in addition to the defaults for preloaded relationships, keyed by target model name.
127
- * @property {Array<import("./select-base.js").default>} [selects] - SELECT clauses for the query.
128
- * @property {AbortSignal} [signal] - Signal passed to database query execution.
129
- * @property {boolean} [distinct] - Whether the query should use DISTINCT.
130
- * @property {Array<import("./where-base.js").default>} [wheres] - WHERE conditions for the query.
131
- */
132
-
133
132
  export default class VelociousDatabaseQuery {
134
133
  /**
135
134
  * Runs constructor.
@@ -21,6 +21,11 @@ import WhereNot from "./where-not.js"
21
21
  import JoinsParser from "../query-parser/joins-parser.js"
22
22
  import WhereParser from "../query-parser/where-parser.js"
23
23
 
24
+ /**
25
+ * Defines this typedef.
26
+ * @template {typeof import("../record/index.js").default} [MC=typeof import("../record/index.js").default]
27
+ * @typedef {import("./index.js").QueryArgsType & {modelClass: MC, joinBasePath?: string[], joinTracker?: import("./join-tracker.js").default, forceQualifyBaseTable?: boolean, withCount?: import("./with-count.js").WithCountEntry[], queryData?: import("./query-data.js").QueryDataEntry[]}} ModelClassQueryArgsType
28
+ */
24
29
  /**
25
30
  * Runs unquote sql identifier.
26
31
  * @param {string} value - Potentially quoted SQL identifier.
@@ -166,11 +171,6 @@ function normalizePreloadRecord(preload) {
166
171
  * Defines this typedef.
167
172
  * @template {typeof import("../record/index.js").default} [MC=typeof import("../record/index.js").default]
168
173
  */
169
- /**
170
- * Defines this typedef.
171
- * @template {typeof import("../record/index.js").default} [MC=typeof import("../record/index.js").default]
172
- * @typedef {import("./index.js").QueryArgsType & {modelClass: MC, joinBasePath?: string[], joinTracker?: import("./join-tracker.js").default, forceQualifyBaseTable?: boolean, withCount?: import("./with-count.js").WithCountEntry[], queryData?: import("./query-data.js").QueryDataEntry[]}} ModelClassQueryArgsType
173
- */
174
174
 
175
175
  /**
176
176
  * A generic query over some model type.
@@ -330,7 +330,6 @@ export default class VelociousDatabaseQueryModelClassQuery extends DatabaseQuery
330
330
 
331
331
  sql += " AS count"
332
332
 
333
-
334
333
  // Clone query and execute count
335
334
  const countQuery = this.clone()
336
335
 
@@ -2,6 +2,15 @@
2
2
 
3
3
  import UploadedFile from "../../../http-server/client/uploaded-file/uploaded-file.js"
4
4
 
5
+ /**
6
+ * NormalizedAttachmentInput type.
7
+ * @typedef {object} NormalizedAttachmentInput
8
+ * @property {number} byteSize - File size in bytes.
9
+ * @property {Buffer} contentBuffer - Raw content bytes.
10
+ * @property {string} contentBase64 - Base64 encoded content.
11
+ * @property {string | null} contentType - Content type.
12
+ * @property {string} filename - Filename.
13
+ */
5
14
  /**
6
15
  * Runs base name.
7
16
  * @param {string} value - Path-like value.
@@ -96,16 +105,6 @@ async function uploadedFileBuffer(uploadedFile, environmentHandler) {
96
105
  throw new Error("Unsupported uploaded file type")
97
106
  }
98
107
 
99
- /**
100
- * NormalizedAttachmentInput type.
101
- * @typedef {object} NormalizedAttachmentInput
102
- * @property {number} byteSize - File size in bytes.
103
- * @property {Buffer} contentBuffer - Raw content bytes.
104
- * @property {string} contentBase64 - Base64 encoded content.
105
- * @property {string | null} contentType - Content type.
106
- * @property {string} filename - Filename.
107
- */
108
-
109
108
  /**
110
109
  * Runs normalize record attachment input.
111
110
  * @param {?} input - Attachment input.
@@ -4,11 +4,11 @@ import UUID from "pure-uuid"
4
4
  import TableData from "../../table-data/index.js"
5
5
  import normalizeRecordAttachmentInput from "./normalize-input.js"
6
6
 
7
- const ATTACHMENTS_TABLE = "velocious_attachments"
8
-
9
7
  /**
10
8
  * AttachmentDriverConstructor type.
11
9
  * @typedef {import("../../../configuration-types.js").AttachmentDriverConstructor} AttachmentDriverConstructor */
10
+ const ATTACHMENTS_TABLE = "velocious_attachments"
11
+
12
12
  /**
13
13
  * Stores by configuration.
14
14
  * @type {WeakMap<import("../../../configuration.js").default, Map<string, RecordAttachmentsStore>>} */