velocious 1.0.449 → 1.0.450
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.
- package/build/application.js +4 -4
- package/build/authorization/ability.js +8 -8
- package/build/authorization/base-resource.js +4 -4
- package/build/background-jobs/cron-expression.js +1 -1
- package/build/background-jobs/forked-runner-child.js +1 -1
- package/build/background-jobs/job-registry.js +1 -1
- package/build/background-jobs/job-runner.js +1 -1
- package/build/background-jobs/job.js +1 -1
- package/build/background-jobs/json-socket.js +4 -4
- package/build/background-jobs/main.js +21 -21
- package/build/background-jobs/scheduler.js +7 -7
- package/build/background-jobs/store.js +7 -7
- package/build/background-jobs/web/controller.js +2 -2
- package/build/background-jobs/worker.js +12 -12
- package/build/beacon/client.js +11 -8
- package/build/beacon/in-process-broker.js +2 -2
- package/build/beacon/in-process-client.js +2 -2
- package/build/beacon/server.js +3 -3
- package/build/cli/browser-cli.js +1 -1
- package/build/cli/commands/db/base-command.js +2 -2
- package/build/cli/index.js +2 -2
- package/build/cli/tenant-database-command-helper.js +3 -3
- package/build/cli/use-browser-cli.js +1 -1
- package/build/configuration.js +38 -38
- package/build/controller.js +8 -8
- package/build/current-configuration.js +1 -1
- package/build/database/annotations-async-hooks.js +2 -2
- package/build/database/annotations.js +3 -3
- package/build/database/drivers/base-column.js +1 -1
- package/build/database/drivers/base-foreign-key.js +1 -1
- package/build/database/drivers/base-table.js +1 -1
- package/build/database/drivers/base.js +10 -10
- package/build/database/drivers/mssql/index.js +1 -1
- package/build/database/drivers/mssql/table.js +1 -1
- package/build/database/drivers/mysql/index.js +3 -3
- package/build/database/drivers/mysql/query.js +1 -1
- package/build/database/drivers/mysql/table.js +1 -1
- package/build/database/drivers/pgsql/index.js +2 -2
- package/build/database/drivers/sqlite/base.js +16 -16
- package/build/database/drivers/sqlite/index.js +11 -11
- package/build/database/drivers/sqlite/index.native.js +1 -1
- package/build/database/drivers/sqlite/index.web.js +3 -3
- package/build/database/drivers/sqlite/query.js +1 -1
- package/build/database/drivers/sqlite/query.web.js +1 -1
- package/build/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/build/database/drivers/sqlite/table.js +1 -1
- package/build/database/migrator/files-finder.js +1 -1
- package/build/database/migrator.js +6 -6
- package/build/database/pool/async-tracked-multi-connection.js +27 -27
- package/build/database/pool/base-methods-forward.js +4 -4
- package/build/database/pool/base.js +8 -8
- package/build/database/query/from-base.js +1 -1
- package/build/database/query/index.js +10 -10
- package/build/database/query/join-object.js +3 -3
- package/build/database/query/model-class-query.js +39 -39
- package/build/database/query/preloader/belongs-to.js +22 -22
- package/build/database/query/preloader/has-many.js +20 -20
- package/build/database/query/preloader/has-one.js +8 -8
- package/build/database/query/preloader/selection.js +3 -3
- package/build/database/query/preloader.js +8 -8
- package/build/database/query/query-data.js +9 -9
- package/build/database/query/where-model-class-hash.js +7 -7
- package/build/database/query/with-count.js +9 -9
- package/build/database/record/acts-as-list.js +15 -15
- package/build/database/record/attachments/handle.js +2 -2
- package/build/database/record/attachments/normalize-input.js +12 -12
- package/build/database/record/attachments/storage-drivers/s3.js +6 -6
- package/build/database/record/attachments/store.js +13 -13
- package/build/database/record/index.js +115 -121
- package/build/database/record/instance-relationships/base.js +11 -11
- package/build/database/record/instance-relationships/belongs-to.js +3 -3
- package/build/database/record/instance-relationships/has-many.js +8 -8
- package/build/database/record/instance-relationships/has-one.js +7 -7
- package/build/database/record/relationships/base.js +2 -2
- package/build/database/record/state-machine.js +7 -7
- package/build/database/record/validators/presence.js +1 -1
- package/build/database/record/validators/uniqueness.js +5 -5
- package/build/database/table-data/index.js +4 -4
- package/build/environment-handlers/base.js +2 -2
- package/build/environment-handlers/browser.js +7 -7
- package/build/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/build/environment-handlers/node/cli/commands/console.js +4 -4
- package/build/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/build/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +55 -17
- package/build/environment-handlers/node.js +6 -6
- package/build/frontend-model-controller.js +81 -82
- package/build/frontend-model-resource/base-resource.js +78 -115
- package/build/frontend-models/base.js +162 -149
- package/build/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/build/frontend-models/event-hook-models.js +2 -2
- package/build/frontend-models/outgoing-event-buffer.js +2 -2
- package/build/frontend-models/preloader.js +5 -5
- package/build/frontend-models/query.js +43 -38
- package/build/frontend-models/resource-definition.js +6 -6
- package/build/frontend-models/transport-serialization.js +11 -11
- package/build/frontend-models/use-destroyed-event.js +10 -10
- package/build/frontend-models/use-model-class-event.js +11 -11
- package/build/frontend-models/use-updated-event.js +11 -11
- package/build/frontend-models/websocket-channel.js +26 -17
- package/build/frontend-models/websocket-publishers.js +9 -9
- package/build/http-client/response.js +2 -2
- package/build/http-server/client/index.js +8 -8
- package/build/http-server/client/params-to-object.js +10 -10
- package/build/http-server/client/request-buffer/form-data-part.js +2 -2
- package/build/http-server/client/request-buffer/index.js +8 -8
- package/build/http-server/client/request-parser.js +3 -3
- package/build/http-server/client/request-runner.js +6 -6
- package/build/http-server/client/request-timing.js +5 -5
- package/build/http-server/client/request.js +1 -1
- package/build/http-server/client/response.js +5 -5
- package/build/http-server/client/websocket-request.js +4 -4
- package/build/http-server/client/websocket-session.js +18 -18
- package/build/http-server/development-reloader.js +5 -5
- package/build/http-server/index.js +12 -12
- package/build/http-server/remote-address.js +4 -4
- package/build/http-server/server-client.js +3 -3
- package/build/http-server/server-lock.js +4 -4
- package/build/http-server/websocket-channel-subscribers.js +3 -3
- package/build/http-server/websocket-channel.js +1 -1
- package/build/http-server/websocket-connection.js +1 -1
- package/build/http-server/websocket-event-log-store.js +6 -6
- package/build/http-server/websocket-events-host.js +2 -2
- package/build/http-server/worker-handler/in-process.js +7 -7
- package/build/http-server/worker-handler/index.js +4 -4
- package/build/http-server/worker-handler/worker-thread.js +3 -3
- package/build/logger/outputs/array-output.js +3 -3
- package/build/logger/outputs/console-output.js +1 -1
- package/build/logger/outputs/file-output.js +4 -4
- package/build/logger/outputs/stdout-output.js +1 -1
- package/build/logger.js +10 -10
- package/build/mailer/backends/smtp.js +3 -3
- package/build/mailer/base.js +8 -8
- package/build/mailer/delivery.js +4 -4
- package/build/plugins/sqljs-wasm-route-controller.js +1 -1
- package/build/routes/base-route.js +6 -6
- package/build/routes/basic-route.js +1 -1
- package/build/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/build/routes/index.js +1 -1
- package/build/routes/plugin-routes.js +1 -1
- package/build/routes/resolver.js +11 -11
- package/build/routes/resource-route.js +1 -1
- package/build/src/application.d.ts +3 -3
- package/build/src/application.d.ts.map +1 -1
- package/build/src/application.js +5 -5
- package/build/src/authorization/ability.d.ts +7 -7
- package/build/src/authorization/ability.d.ts.map +1 -1
- package/build/src/authorization/ability.js +9 -9
- package/build/src/authorization/base-resource.d.ts +1 -1
- package/build/src/authorization/base-resource.d.ts.map +1 -1
- package/build/src/authorization/base-resource.js +5 -5
- package/build/src/background-jobs/cron-expression.js +2 -2
- package/build/src/background-jobs/forked-runner-child.js +2 -2
- package/build/src/background-jobs/job-registry.d.ts +1 -1
- package/build/src/background-jobs/job-registry.d.ts.map +1 -1
- package/build/src/background-jobs/job-registry.js +2 -2
- package/build/src/background-jobs/job-runner.js +2 -2
- package/build/src/background-jobs/job.js +2 -2
- package/build/src/background-jobs/json-socket.d.ts +4 -4
- package/build/src/background-jobs/json-socket.d.ts.map +1 -1
- package/build/src/background-jobs/json-socket.js +5 -5
- package/build/src/background-jobs/main.d.ts +18 -18
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +22 -22
- package/build/src/background-jobs/scheduler.d.ts +5 -5
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +8 -8
- package/build/src/background-jobs/store.js +8 -8
- package/build/src/background-jobs/web/controller.js +3 -3
- package/build/src/background-jobs/worker.d.ts +6 -6
- package/build/src/background-jobs/worker.d.ts.map +1 -1
- package/build/src/background-jobs/worker.js +13 -13
- package/build/src/beacon/client.d.ts +4 -4
- package/build/src/beacon/client.d.ts.map +1 -1
- package/build/src/beacon/client.js +12 -9
- package/build/src/beacon/in-process-broker.d.ts.map +1 -1
- package/build/src/beacon/in-process-broker.js +3 -3
- package/build/src/beacon/in-process-client.d.ts +1 -1
- package/build/src/beacon/in-process-client.d.ts.map +1 -1
- package/build/src/beacon/in-process-client.js +3 -3
- package/build/src/beacon/server.d.ts +2 -2
- package/build/src/beacon/server.d.ts.map +1 -1
- package/build/src/beacon/server.js +4 -4
- package/build/src/cli/browser-cli.js +2 -2
- package/build/src/cli/commands/db/base-command.d.ts +2 -2
- package/build/src/cli/commands/db/base-command.d.ts.map +1 -1
- package/build/src/cli/commands/db/base-command.js +3 -3
- package/build/src/cli/index.js +3 -3
- package/build/src/cli/tenant-database-command-helper.d.ts +1 -1
- package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
- package/build/src/cli/tenant-database-command-helper.js +4 -4
- package/build/src/cli/use-browser-cli.js +2 -2
- package/build/src/configuration.d.ts +14 -14
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +39 -39
- package/build/src/controller.js +10 -10
- package/build/src/current-configuration.js +2 -2
- package/build/src/database/annotations-async-hooks.js +3 -3
- package/build/src/database/annotations.d.ts.map +1 -1
- package/build/src/database/annotations.js +4 -4
- package/build/src/database/drivers/base-column.d.ts +1 -1
- package/build/src/database/drivers/base-column.d.ts.map +1 -1
- package/build/src/database/drivers/base-column.js +2 -2
- package/build/src/database/drivers/base-foreign-key.d.ts +1 -1
- package/build/src/database/drivers/base-foreign-key.d.ts.map +1 -1
- package/build/src/database/drivers/base-foreign-key.js +2 -2
- package/build/src/database/drivers/base-table.d.ts +1 -1
- package/build/src/database/drivers/base-table.d.ts.map +1 -1
- package/build/src/database/drivers/base-table.js +2 -2
- package/build/src/database/drivers/base.d.ts +6 -6
- package/build/src/database/drivers/base.d.ts.map +1 -1
- package/build/src/database/drivers/base.js +11 -11
- package/build/src/database/drivers/mssql/index.js +2 -2
- package/build/src/database/drivers/mssql/table.js +2 -2
- package/build/src/database/drivers/mysql/index.js +4 -4
- package/build/src/database/drivers/mysql/query.js +2 -2
- package/build/src/database/drivers/mysql/table.js +2 -2
- package/build/src/database/drivers/pgsql/index.js +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/base.js +17 -17
- package/build/src/database/drivers/sqlite/index.d.ts +4 -4
- package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.js +12 -12
- package/build/src/database/drivers/sqlite/index.native.js +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.web.js +4 -4
- package/build/src/database/drivers/sqlite/query.js +2 -2
- package/build/src/database/drivers/sqlite/query.web.js +2 -2
- package/build/src/database/drivers/sqlite/sql/alter-table.js +3 -3
- package/build/src/database/drivers/sqlite/table.js +2 -2
- package/build/src/database/migrator/files-finder.js +2 -2
- package/build/src/database/migrator.d.ts +1 -1
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +7 -7
- package/build/src/database/pool/async-tracked-multi-connection.d.ts +9 -9
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +28 -28
- package/build/src/database/pool/base-methods-forward.js +7 -7
- package/build/src/database/pool/base.d.ts +1 -1
- package/build/src/database/pool/base.d.ts.map +1 -1
- package/build/src/database/pool/base.js +9 -9
- package/build/src/database/query/from-base.d.ts +1 -1
- package/build/src/database/query/from-base.d.ts.map +1 -1
- package/build/src/database/query/from-base.js +2 -2
- package/build/src/database/query/index.d.ts +4 -4
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +11 -11
- package/build/src/database/query/join-object.js +4 -4
- package/build/src/database/query/model-class-query.d.ts +4 -4
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +40 -40
- package/build/src/database/query/preloader/belongs-to.js +23 -23
- package/build/src/database/query/preloader/has-many.js +21 -21
- package/build/src/database/query/preloader/has-one.js +9 -9
- package/build/src/database/query/preloader/selection.js +4 -4
- package/build/src/database/query/preloader.js +9 -9
- package/build/src/database/query/query-data.js +10 -10
- package/build/src/database/query/where-model-class-hash.js +8 -8
- package/build/src/database/query/with-count.js +10 -10
- package/build/src/database/record/acts-as-list.js +20 -20
- package/build/src/database/record/attachments/handle.d.ts +1 -1
- package/build/src/database/record/attachments/handle.d.ts.map +1 -1
- package/build/src/database/record/attachments/handle.js +3 -3
- package/build/src/database/record/attachments/normalize-input.js +15 -15
- package/build/src/database/record/attachments/storage-drivers/s3.js +7 -7
- package/build/src/database/record/attachments/store.d.ts +2 -2
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +14 -14
- package/build/src/database/record/index.d.ts +18 -25
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +135 -141
- package/build/src/database/record/instance-relationships/base.d.ts +3 -3
- package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/base.js +13 -13
- package/build/src/database/record/instance-relationships/belongs-to.js +4 -4
- package/build/src/database/record/instance-relationships/has-many.js +9 -9
- package/build/src/database/record/instance-relationships/has-one.d.ts +1 -1
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +8 -8
- package/build/src/database/record/relationships/base.js +4 -4
- package/build/src/database/record/state-machine.js +8 -8
- package/build/src/database/record/validators/presence.js +2 -2
- package/build/src/database/record/validators/uniqueness.js +6 -6
- package/build/src/database/table-data/index.d.ts +4 -4
- package/build/src/database/table-data/index.d.ts.map +1 -1
- package/build/src/database/table-data/index.js +5 -5
- package/build/src/environment-handlers/base.js +3 -3
- package/build/src/environment-handlers/browser.d.ts +3 -3
- package/build/src/environment-handlers/browser.d.ts.map +1 -1
- package/build/src/environment-handlers/browser.js +8 -8
- package/build/src/environment-handlers/node/cli/commands/cli-command-context.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/console.js +5 -5
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +4 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +16 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +51 -17
- package/build/src/environment-handlers/node.d.ts +2 -2
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +7 -7
- package/build/src/frontend-model-controller.d.ts +5 -6
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +88 -89
- package/build/src/frontend-model-resource/base-resource.d.ts +36 -27
- package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/base-resource.js +67 -120
- package/build/src/frontend-models/base.d.ts +66 -58
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +171 -158
- package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -2
- package/build/src/frontend-models/event-hook-models.d.ts.map +1 -1
- package/build/src/frontend-models/event-hook-models.js +3 -3
- package/build/src/frontend-models/outgoing-event-buffer.d.ts +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.d.ts.map +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.js +3 -3
- package/build/src/frontend-models/preloader.js +6 -6
- package/build/src/frontend-models/query.d.ts +16 -8
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +43 -39
- package/build/src/frontend-models/resource-definition.js +7 -7
- package/build/src/frontend-models/transport-serialization.js +12 -12
- package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-destroyed-event.js +11 -11
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +12 -12
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +12 -12
- package/build/src/frontend-models/websocket-channel.d.ts +6 -1
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +26 -18
- package/build/src/frontend-models/websocket-publishers.js +11 -11
- package/build/src/http-client/response.d.ts +2 -2
- package/build/src/http-client/response.d.ts.map +1 -1
- package/build/src/http-client/response.js +3 -3
- package/build/src/http-server/client/index.d.ts +1 -1
- package/build/src/http-server/client/index.d.ts.map +1 -1
- package/build/src/http-server/client/index.js +9 -9
- package/build/src/http-server/client/params-to-object.js +11 -11
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts +2 -2
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/form-data-part.js +3 -3
- package/build/src/http-server/client/request-buffer/index.d.ts +4 -4
- package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/index.js +9 -9
- package/build/src/http-server/client/request-parser.d.ts +1 -1
- package/build/src/http-server/client/request-parser.d.ts.map +1 -1
- package/build/src/http-server/client/request-parser.js +4 -4
- package/build/src/http-server/client/request-runner.js +7 -7
- package/build/src/http-server/client/request-timing.d.ts +5 -5
- package/build/src/http-server/client/request-timing.d.ts.map +1 -1
- package/build/src/http-server/client/request-timing.js +6 -6
- package/build/src/http-server/client/request.js +2 -2
- package/build/src/http-server/client/response.d.ts +3 -3
- package/build/src/http-server/client/response.d.ts.map +1 -1
- package/build/src/http-server/client/response.js +6 -6
- package/build/src/http-server/client/websocket-request.d.ts +3 -3
- package/build/src/http-server/client/websocket-request.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-request.js +5 -5
- package/build/src/http-server/client/websocket-session.d.ts +6 -6
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +19 -19
- package/build/src/http-server/development-reloader.d.ts +3 -3
- package/build/src/http-server/development-reloader.d.ts.map +1 -1
- package/build/src/http-server/development-reloader.js +6 -6
- package/build/src/http-server/index.d.ts +7 -7
- package/build/src/http-server/index.d.ts.map +1 -1
- package/build/src/http-server/index.js +13 -13
- package/build/src/http-server/remote-address.js +6 -6
- package/build/src/http-server/server-client.js +4 -4
- package/build/src/http-server/server-lock.js +5 -5
- package/build/src/http-server/websocket-channel-subscribers.d.ts +1 -1
- package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel-subscribers.js +4 -4
- package/build/src/http-server/websocket-channel.d.ts +1 -1
- package/build/src/http-server/websocket-channel.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel.js +2 -2
- package/build/src/http-server/websocket-connection.d.ts +1 -1
- package/build/src/http-server/websocket-connection.d.ts.map +1 -1
- package/build/src/http-server/websocket-connection.js +2 -2
- package/build/src/http-server/websocket-event-log-store.d.ts +1 -1
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +7 -7
- package/build/src/http-server/websocket-events-host.d.ts +1 -1
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/in-process.js +9 -9
- package/build/src/http-server/worker-handler/index.d.ts +4 -4
- package/build/src/http-server/worker-handler/index.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/index.js +5 -5
- package/build/src/http-server/worker-handler/worker-thread.d.ts +2 -2
- package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/worker-thread.js +4 -4
- package/build/src/logger/outputs/array-output.d.ts +3 -3
- package/build/src/logger/outputs/array-output.d.ts.map +1 -1
- package/build/src/logger/outputs/array-output.js +4 -4
- package/build/src/logger/outputs/console-output.d.ts +1 -1
- package/build/src/logger/outputs/console-output.d.ts.map +1 -1
- package/build/src/logger/outputs/console-output.js +2 -2
- package/build/src/logger/outputs/file-output.d.ts +4 -4
- package/build/src/logger/outputs/file-output.d.ts.map +1 -1
- package/build/src/logger/outputs/file-output.js +5 -5
- package/build/src/logger/outputs/stdout-output.d.ts.map +1 -1
- package/build/src/logger/outputs/stdout-output.js +2 -2
- package/build/src/logger.d.ts.map +1 -1
- package/build/src/logger.js +11 -11
- package/build/src/mailer/backends/smtp.d.ts.map +1 -1
- package/build/src/mailer/backends/smtp.js +5 -5
- package/build/src/mailer/base.js +11 -11
- package/build/src/mailer/delivery.d.ts +3 -3
- package/build/src/mailer/delivery.d.ts.map +1 -1
- package/build/src/mailer/delivery.js +5 -5
- package/build/src/plugins/sqljs-wasm-route-controller.js +2 -2
- package/build/src/routes/base-route.d.ts +6 -6
- package/build/src/routes/base-route.d.ts.map +1 -1
- package/build/src/routes/base-route.js +7 -7
- package/build/src/routes/basic-route.js +2 -2
- package/build/src/routes/hooks/frontend-model-command-route-hook.js +2 -2
- package/build/src/routes/index.js +2 -2
- package/build/src/routes/plugin-routes.js +2 -2
- package/build/src/routes/resolver.d.ts +1 -1
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +13 -13
- package/build/src/routes/resource-route.d.ts +1 -1
- package/build/src/routes/resource-route.d.ts.map +1 -1
- package/build/src/routes/resource-route.js +2 -2
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts.map +1 -1
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.js +8 -8
- package/build/src/testing/expect-utils.js +13 -13
- package/build/src/testing/expect.d.ts +1 -1
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +9 -9
- package/build/src/testing/test-files-finder.d.ts +8 -8
- package/build/src/testing/test-files-finder.d.ts.map +1 -1
- package/build/src/testing/test-files-finder.js +9 -9
- package/build/src/testing/test-filter-parser.js +3 -3
- package/build/src/testing/test-runner.d.ts +2 -2
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +17 -17
- package/build/src/testing/test-suite-splitter.js +2 -2
- package/build/src/testing/test.d.ts +2 -2
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +16 -16
- package/build/src/utils/backtrace-cleaner.d.ts +1 -1
- package/build/src/utils/backtrace-cleaner.d.ts.map +1 -1
- package/build/src/utils/backtrace-cleaner.js +2 -2
- package/build/src/utils/format-value.js +2 -2
- package/build/src/utils/model-scope.js +2 -2
- package/build/src/utils/ransack.js +27 -27
- package/build/src/utils/with-tracked-stack-async-hooks.js +8 -8
- package/build/src/utils/with-tracked-stack.js +4 -4
- package/build/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/build/testing/expect-utils.js +11 -11
- package/build/testing/expect.js +7 -7
- package/build/testing/test-files-finder.js +8 -8
- package/build/testing/test-filter-parser.js +2 -2
- package/build/testing/test-runner.js +16 -16
- package/build/testing/test-suite-splitter.js +1 -1
- package/build/testing/test.js +15 -15
- package/build/utils/backtrace-cleaner.js +1 -1
- package/build/utils/format-value.js +1 -1
- package/build/utils/model-scope.js +1 -1
- package/build/utils/ransack.js +26 -26
- package/build/utils/with-tracked-stack-async-hooks.js +7 -7
- package/build/utils/with-tracked-stack.js +3 -3
- package/package.json +2 -1
- package/src/application.js +4 -4
- package/src/authorization/ability.js +8 -8
- package/src/authorization/base-resource.js +4 -4
- package/src/background-jobs/cron-expression.js +1 -1
- package/src/background-jobs/forked-runner-child.js +1 -1
- package/src/background-jobs/job-registry.js +1 -1
- package/src/background-jobs/job-runner.js +1 -1
- package/src/background-jobs/job.js +1 -1
- package/src/background-jobs/json-socket.js +4 -4
- package/src/background-jobs/main.js +21 -21
- package/src/background-jobs/scheduler.js +7 -7
- package/src/background-jobs/store.js +7 -7
- package/src/background-jobs/web/controller.js +2 -2
- package/src/background-jobs/worker.js +12 -12
- package/src/beacon/client.js +11 -8
- package/src/beacon/in-process-broker.js +2 -2
- package/src/beacon/in-process-client.js +2 -2
- package/src/beacon/server.js +3 -3
- package/src/cli/browser-cli.js +1 -1
- package/src/cli/commands/db/base-command.js +2 -2
- package/src/cli/index.js +2 -2
- package/src/cli/tenant-database-command-helper.js +3 -3
- package/src/cli/use-browser-cli.js +1 -1
- package/src/configuration.js +38 -38
- package/src/controller.js +8 -8
- package/src/current-configuration.js +1 -1
- package/src/database/annotations-async-hooks.js +2 -2
- package/src/database/annotations.js +3 -3
- package/src/database/drivers/base-column.js +1 -1
- package/src/database/drivers/base-foreign-key.js +1 -1
- package/src/database/drivers/base-table.js +1 -1
- package/src/database/drivers/base.js +10 -10
- package/src/database/drivers/mssql/index.js +1 -1
- package/src/database/drivers/mssql/table.js +1 -1
- package/src/database/drivers/mysql/index.js +3 -3
- package/src/database/drivers/mysql/query.js +1 -1
- package/src/database/drivers/mysql/table.js +1 -1
- package/src/database/drivers/pgsql/index.js +2 -2
- package/src/database/drivers/sqlite/base.js +16 -16
- package/src/database/drivers/sqlite/index.js +11 -11
- package/src/database/drivers/sqlite/index.native.js +1 -1
- package/src/database/drivers/sqlite/index.web.js +3 -3
- package/src/database/drivers/sqlite/query.js +1 -1
- package/src/database/drivers/sqlite/query.web.js +1 -1
- package/src/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/src/database/drivers/sqlite/table.js +1 -1
- package/src/database/migrator/files-finder.js +1 -1
- package/src/database/migrator.js +6 -6
- package/src/database/pool/async-tracked-multi-connection.js +27 -27
- package/src/database/pool/base-methods-forward.js +4 -4
- package/src/database/pool/base.js +8 -8
- package/src/database/query/from-base.js +1 -1
- package/src/database/query/index.js +10 -10
- package/src/database/query/join-object.js +3 -3
- package/src/database/query/model-class-query.js +39 -39
- package/src/database/query/preloader/belongs-to.js +22 -22
- package/src/database/query/preloader/has-many.js +20 -20
- package/src/database/query/preloader/has-one.js +8 -8
- package/src/database/query/preloader/selection.js +3 -3
- package/src/database/query/preloader.js +8 -8
- package/src/database/query/query-data.js +9 -9
- package/src/database/query/where-model-class-hash.js +7 -7
- package/src/database/query/with-count.js +9 -9
- package/src/database/record/acts-as-list.js +15 -15
- package/src/database/record/attachments/handle.js +2 -2
- package/src/database/record/attachments/normalize-input.js +12 -12
- package/src/database/record/attachments/storage-drivers/s3.js +6 -6
- package/src/database/record/attachments/store.js +13 -13
- package/src/database/record/index.js +115 -121
- package/src/database/record/instance-relationships/base.js +11 -11
- package/src/database/record/instance-relationships/belongs-to.js +3 -3
- package/src/database/record/instance-relationships/has-many.js +8 -8
- package/src/database/record/instance-relationships/has-one.js +7 -7
- package/src/database/record/relationships/base.js +2 -2
- package/src/database/record/state-machine.js +7 -7
- package/src/database/record/validators/presence.js +1 -1
- package/src/database/record/validators/uniqueness.js +5 -5
- package/src/database/table-data/index.js +4 -4
- package/src/environment-handlers/base.js +2 -2
- package/src/environment-handlers/browser.js +7 -7
- package/src/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/src/environment-handlers/node/cli/commands/console.js +4 -4
- package/src/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/src/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +55 -17
- package/src/environment-handlers/node.js +6 -6
- package/src/frontend-model-controller.js +81 -82
- package/src/frontend-model-resource/base-resource.js +78 -115
- package/src/frontend-models/base.js +162 -149
- package/src/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/src/frontend-models/event-hook-models.js +2 -2
- package/src/frontend-models/outgoing-event-buffer.js +2 -2
- package/src/frontend-models/preloader.js +5 -5
- package/src/frontend-models/query.js +43 -38
- package/src/frontend-models/resource-definition.js +6 -6
- package/src/frontend-models/transport-serialization.js +11 -11
- package/src/frontend-models/use-destroyed-event.js +10 -10
- package/src/frontend-models/use-model-class-event.js +11 -11
- package/src/frontend-models/use-updated-event.js +11 -11
- package/src/frontend-models/websocket-channel.js +26 -17
- package/src/frontend-models/websocket-publishers.js +9 -9
- package/src/http-client/response.js +2 -2
- package/src/http-server/client/index.js +8 -8
- package/src/http-server/client/params-to-object.js +10 -10
- package/src/http-server/client/request-buffer/form-data-part.js +2 -2
- package/src/http-server/client/request-buffer/index.js +8 -8
- package/src/http-server/client/request-parser.js +3 -3
- package/src/http-server/client/request-runner.js +6 -6
- package/src/http-server/client/request-timing.js +5 -5
- package/src/http-server/client/request.js +1 -1
- package/src/http-server/client/response.js +5 -5
- package/src/http-server/client/websocket-request.js +4 -4
- package/src/http-server/client/websocket-session.js +18 -18
- package/src/http-server/development-reloader.js +5 -5
- package/src/http-server/index.js +12 -12
- package/src/http-server/remote-address.js +4 -4
- package/src/http-server/server-client.js +3 -3
- package/src/http-server/server-lock.js +4 -4
- package/src/http-server/websocket-channel-subscribers.js +3 -3
- package/src/http-server/websocket-channel.js +1 -1
- package/src/http-server/websocket-connection.js +1 -1
- package/src/http-server/websocket-event-log-store.js +6 -6
- package/src/http-server/websocket-events-host.js +2 -2
- package/src/http-server/worker-handler/in-process.js +7 -7
- package/src/http-server/worker-handler/index.js +4 -4
- package/src/http-server/worker-handler/worker-thread.js +3 -3
- package/src/logger/outputs/array-output.js +3 -3
- package/src/logger/outputs/console-output.js +1 -1
- package/src/logger/outputs/file-output.js +4 -4
- package/src/logger/outputs/stdout-output.js +1 -1
- package/src/logger.js +10 -10
- package/src/mailer/backends/smtp.js +3 -3
- package/src/mailer/base.js +8 -8
- package/src/mailer/delivery.js +4 -4
- package/src/plugins/sqljs-wasm-route-controller.js +1 -1
- package/src/routes/base-route.js +6 -6
- package/src/routes/basic-route.js +1 -1
- package/src/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/src/routes/index.js +1 -1
- package/src/routes/plugin-routes.js +1 -1
- package/src/routes/resolver.js +11 -11
- package/src/routes/resource-route.js +1 -1
- package/src/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/src/testing/expect-utils.js +11 -11
- package/src/testing/expect.js +7 -7
- package/src/testing/test-files-finder.js +8 -8
- package/src/testing/test-filter-parser.js +2 -2
- package/src/testing/test-runner.js +16 -16
- package/src/testing/test-suite-splitter.js +1 -1
- package/src/testing/test.js +15 -15
- package/src/utils/backtrace-cleaner.js +1 -1
- package/src/utils/format-value.js +1 -1
- package/src/utils/model-scope.js +1 -1
- package/src/utils/ransack.js +26 -26
- package/src/utils/with-tracked-stack-async-hooks.js +7 -7
- package/src/utils/with-tracked-stack.js +3 -3
|
@@ -35,11 +35,11 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Satisfied targets.
|
|
38
|
-
|
|
38
|
+
* @type {import("../../record/index.js").default[]} */
|
|
39
39
|
const satisfiedTargets = []
|
|
40
40
|
/**
|
|
41
41
|
* Models to load.
|
|
42
|
-
|
|
42
|
+
* @type {import("../../record/index.js").default[]} */
|
|
43
43
|
const modelsToLoad = []
|
|
44
44
|
|
|
45
45
|
for (const model of this.models) {
|
|
@@ -48,7 +48,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
48
48
|
if (this.selection.isSatisfied({instanceRelationship, targetModelClass, mappingColumns: [primaryKey]})) {
|
|
49
49
|
const loaded = /**
|
|
50
50
|
* Narrows the runtime value to the documented type.
|
|
51
|
-
|
|
51
|
+
* @type {import("../../record/index.js").default | undefined} */ (instanceRelationship.getLoadedOrUndefined())
|
|
52
52
|
|
|
53
53
|
if (loaded) satisfiedTargets.push(loaded)
|
|
54
54
|
} else {
|
|
@@ -60,13 +60,13 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Foreign key values.
|
|
63
|
-
|
|
63
|
+
* @type {Array<number | string>} */
|
|
64
64
|
const foreignKeyValues = []
|
|
65
65
|
|
|
66
66
|
for (const model of modelsToLoad) {
|
|
67
67
|
const foreignKeyValue = /**
|
|
68
68
|
* Narrows the runtime value to the documented type.
|
|
69
|
-
|
|
69
|
+
* @type {string | number | null | undefined} */ (model.readColumn(foreignKey))
|
|
70
70
|
|
|
71
71
|
// Skip null/undefined foreign keys: a belongsTo with no foreign key has no
|
|
72
72
|
// target, and including them would serialize to e.g. `IN (null)` which
|
|
@@ -78,12 +78,12 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Target models by id.
|
|
81
|
-
|
|
81
|
+
* @type {Record<string, import("../../record/index.js").default>} */
|
|
82
82
|
const targetModelsById = {}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Target models.
|
|
86
|
-
|
|
86
|
+
* @type {import("../../record/index.js").default[]} */
|
|
87
87
|
let targetModels = []
|
|
88
88
|
|
|
89
89
|
// Only query when at least one model has a non-null foreign key.
|
|
@@ -92,7 +92,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* Where args.
|
|
95
|
-
|
|
95
|
+
* @type {Record<string, string | number | Array<string | number>>} */
|
|
96
96
|
const whereArgs = {}
|
|
97
97
|
|
|
98
98
|
whereArgs[primaryKey] = foreignKeyValues
|
|
@@ -108,7 +108,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
108
108
|
for (const targetModel of targetModels) {
|
|
109
109
|
const primaryKeyValue = /**
|
|
110
110
|
* Narrows the runtime value to the documented type.
|
|
111
|
-
|
|
111
|
+
* @type {string | number} */ (targetModel.readColumn(primaryKey))
|
|
112
112
|
|
|
113
113
|
targetModelsById[primaryKeyValue] = targetModel
|
|
114
114
|
}
|
|
@@ -118,7 +118,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
118
118
|
for (const model of modelsToLoad) {
|
|
119
119
|
const foreignKeyValue = /**
|
|
120
120
|
* Narrows the runtime value to the documented type.
|
|
121
|
-
|
|
121
|
+
* @type {string | number} */ (model.readColumn(foreignKey))
|
|
122
122
|
const targetModel = targetModelsById[foreignKeyValue]
|
|
123
123
|
const modelRelationship = model.getRelationshipByName(relationshipName)
|
|
124
124
|
|
|
@@ -144,37 +144,37 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Model meta.
|
|
147
|
-
|
|
147
|
+
* @type {{foreignKeyValue: number | string | undefined, model: import("../../record/index.js").default, targetType: string | undefined}[]} */
|
|
148
148
|
const modelMeta = []
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* Satisfied targets.
|
|
152
|
-
|
|
152
|
+
* @type {import("../../record/index.js").default[]} */
|
|
153
153
|
const satisfiedTargets = []
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Target models by class name.
|
|
157
|
-
|
|
157
|
+
* @type {Record<string, import("../../record/index.js").default[]>} */
|
|
158
158
|
const targetModelsByClassName = {}
|
|
159
159
|
|
|
160
160
|
for (const model of this.models) {
|
|
161
161
|
const targetType = /**
|
|
162
162
|
* Narrows the runtime value to the documented type.
|
|
163
|
-
|
|
163
|
+
* @type {string | undefined} */ (model.readColumn(typeColumn))
|
|
164
164
|
const instanceRelationship = model.getRelationshipByName(relationshipName)
|
|
165
165
|
const targetModelClass = targetType ? configuration.getModelClass(targetType) : undefined
|
|
166
166
|
|
|
167
167
|
if (targetModelClass && this.selection.isSatisfied({instanceRelationship, targetModelClass, mappingColumns: [primaryKey]})) {
|
|
168
168
|
const loaded = /**
|
|
169
169
|
* Narrows the runtime value to the documented type.
|
|
170
|
-
|
|
170
|
+
* @type {import("../../record/index.js").default | undefined} */ (instanceRelationship.getLoadedOrUndefined())
|
|
171
171
|
|
|
172
172
|
if (loaded) {
|
|
173
173
|
satisfiedTargets.push(loaded)
|
|
174
174
|
|
|
175
175
|
const className = /**
|
|
176
176
|
* Narrows the runtime value to the documented type.
|
|
177
|
-
|
|
177
|
+
* @type {typeof import("../../record/index.js").default} */ (loaded.constructor).getModelName()
|
|
178
178
|
|
|
179
179
|
if (!targetModelsByClassName[className]) targetModelsByClassName[className] = []
|
|
180
180
|
targetModelsByClassName[className].push(loaded)
|
|
@@ -186,7 +186,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
186
186
|
modelMeta.push({
|
|
187
187
|
foreignKeyValue: /**
|
|
188
188
|
* Narrows the runtime value to the documented type.
|
|
189
|
-
|
|
189
|
+
* @type {string | number | undefined} */ (model.readColumn(foreignKey)),
|
|
190
190
|
model,
|
|
191
191
|
targetType
|
|
192
192
|
})
|
|
@@ -194,7 +194,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* Foreign key values by type.
|
|
197
|
-
|
|
197
|
+
* @type {Record<string, Array<number | string>>} */
|
|
198
198
|
const foreignKeyValuesByType = {}
|
|
199
199
|
|
|
200
200
|
for (const meta of modelMeta) {
|
|
@@ -207,12 +207,12 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* Target models by type and id.
|
|
210
|
-
|
|
210
|
+
* @type {Record<string, Record<number | string, import("../../record/index.js").default>>} */
|
|
211
211
|
const targetModelsByTypeAndId = {}
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* Target models.
|
|
215
|
-
|
|
215
|
+
* @type {import("../../record/index.js").default[]} */
|
|
216
216
|
const targetModels = []
|
|
217
217
|
|
|
218
218
|
for (const targetType in foreignKeyValuesByType) {
|
|
@@ -222,7 +222,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
224
|
* Where args.
|
|
225
|
-
|
|
225
|
+
* @type {Record<string, string | number | Array<string | number>>} */
|
|
226
226
|
const whereArgs = {}
|
|
227
227
|
|
|
228
228
|
whereArgs[primaryKey] = foreignKeyValuesByType[targetType]
|
|
@@ -246,7 +246,7 @@ export default class VelociousDatabaseQueryPreloaderBelongsTo {
|
|
|
246
246
|
for (const targetModel of foundTargetModels) {
|
|
247
247
|
const primaryKeyValue = /**
|
|
248
248
|
* Narrows the runtime value to the documented type.
|
|
249
|
-
|
|
249
|
+
* @type {string | number} */ (targetModel.readColumn(primaryKey))
|
|
250
250
|
|
|
251
251
|
targetModelsByTypeAndId[targetType][primaryKeyValue] = targetModel
|
|
252
252
|
}
|
|
@@ -72,11 +72,11 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
72
72
|
const relationshipName = this.relationship.getRelationshipName()
|
|
73
73
|
/**
|
|
74
74
|
* Models to load.
|
|
75
|
-
|
|
75
|
+
* @type {import("../../record/index.js").default[]} */
|
|
76
76
|
const modelsToLoad = []
|
|
77
77
|
/**
|
|
78
78
|
* Satisfied targets.
|
|
79
|
-
|
|
79
|
+
* @type {import("../../record/index.js").default[]} */
|
|
80
80
|
const satisfiedTargets = []
|
|
81
81
|
|
|
82
82
|
for (const model of this.models) {
|
|
@@ -107,7 +107,7 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
107
107
|
|
|
108
108
|
const throughRelationshipName = /**
|
|
109
109
|
* Narrows the runtime value to the documented type.
|
|
110
|
-
|
|
110
|
+
* @type {string} */ (this.relationship.through)
|
|
111
111
|
const parentModelClass = this.relationship.getModelClass()
|
|
112
112
|
const throughRelationship = parentModelClass.getRelationshipByName(throughRelationshipName)
|
|
113
113
|
const throughModelClass = throughRelationship.getTargetModelClass()
|
|
@@ -132,23 +132,23 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Models primary key values.
|
|
135
|
-
|
|
135
|
+
* @type {Array<number | string>} */
|
|
136
136
|
const modelsPrimaryKeyValues = []
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Models by primary key value.
|
|
140
|
-
|
|
140
|
+
* @type {Record<number | string, Array<import("../../record/index.js").default>>} */
|
|
141
141
|
const modelsByPrimaryKeyValue = {}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* Preload collections.
|
|
145
|
-
|
|
145
|
+
* @type {Record<number | string, Array<import("../../record/index.js").default>>} */
|
|
146
146
|
const preloadCollections = {}
|
|
147
147
|
|
|
148
148
|
for (const model of modelsToLoad) {
|
|
149
149
|
const primaryKeyValue = /**
|
|
150
150
|
* Narrows the runtime value to the documented type.
|
|
151
|
-
|
|
151
|
+
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
152
152
|
|
|
153
153
|
preloadCollections[primaryKeyValue] = []
|
|
154
154
|
|
|
@@ -165,21 +165,21 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* Parent to target ids.
|
|
168
|
-
|
|
168
|
+
* @type {Record<string | number, Array<string | number>>} */
|
|
169
169
|
const parentToTargetIds = {}
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* All target ids.
|
|
173
|
-
|
|
173
|
+
* @type {Set<string | number>} */
|
|
174
174
|
const allTargetIds = new Set()
|
|
175
175
|
|
|
176
176
|
for (const throughModel of throughModels) {
|
|
177
177
|
const parentId = /**
|
|
178
178
|
* Narrows the runtime value to the documented type.
|
|
179
|
-
|
|
179
|
+
* @type {string | number} */ (throughModel.readColumn(throughForeignKey))
|
|
180
180
|
const throughId = /**
|
|
181
181
|
* Narrows the runtime value to the documented type.
|
|
182
|
-
|
|
182
|
+
* @type {string | number} */ (throughModel.readColumn(throughModelClass.primaryKey()))
|
|
183
183
|
|
|
184
184
|
if (!(parentId in parentToTargetIds)) parentToTargetIds[parentId] = []
|
|
185
185
|
|
|
@@ -190,7 +190,7 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
190
190
|
// Step 2: Load target models by the foreign key that points to the through table
|
|
191
191
|
/**
|
|
192
192
|
* Target models.
|
|
193
|
-
|
|
193
|
+
* @type {import("../../record/index.js").default[]} */
|
|
194
194
|
let targetModels = []
|
|
195
195
|
|
|
196
196
|
if (allTargetIds.size > 0) {
|
|
@@ -204,13 +204,13 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
204
204
|
// Step 3: Index target models by their foreign key (maps to through model ID)
|
|
205
205
|
/**
|
|
206
206
|
* Target models by foreign key.
|
|
207
|
-
|
|
207
|
+
* @type {Record<string | number, Array<import("../../record/index.js").default>>} */
|
|
208
208
|
const targetModelsByForeignKey = {}
|
|
209
209
|
|
|
210
210
|
for (const targetModel of targetModels) {
|
|
211
211
|
const fkValue = /**
|
|
212
212
|
* Narrows the runtime value to the documented type.
|
|
213
|
-
|
|
213
|
+
* @type {string | number} */ (targetModel.readColumn(targetForeignKey))
|
|
214
214
|
|
|
215
215
|
if (!(fkValue in targetModelsByForeignKey)) targetModelsByForeignKey[fkValue] = []
|
|
216
216
|
|
|
@@ -270,23 +270,23 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
272
|
* Models primary key values.
|
|
273
|
-
|
|
273
|
+
* @type {Array<number | string>} */
|
|
274
274
|
const modelsPrimaryKeyValues = []
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Models by primary key value.
|
|
278
|
-
|
|
278
|
+
* @type {Record<number | string, Array<import("../../record/index.js").default>>} */
|
|
279
279
|
const modelsByPrimaryKeyValue = {}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
282
|
* Preload collections.
|
|
283
|
-
|
|
283
|
+
* @type {Record<number | string, Array<import("../../record/index.js").default>>} */
|
|
284
284
|
const preloadCollections = {}
|
|
285
285
|
|
|
286
286
|
for (const model of modelsToLoad) {
|
|
287
287
|
const primaryKeyValue = /**
|
|
288
288
|
* Narrows the runtime value to the documented type.
|
|
289
|
-
|
|
289
|
+
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
290
290
|
|
|
291
291
|
preloadCollections[primaryKeyValue] = []
|
|
292
292
|
|
|
@@ -298,7 +298,7 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
298
298
|
|
|
299
299
|
/**
|
|
300
300
|
* Where args.
|
|
301
|
-
|
|
301
|
+
* @type {Record<string, string | number | Array<string | number>>} */
|
|
302
302
|
const whereArgs = {}
|
|
303
303
|
|
|
304
304
|
whereArgs[foreignKey] = modelsPrimaryKeyValues
|
|
@@ -321,7 +321,7 @@ export default class VelociousDatabaseQueryPreloaderHasMany {
|
|
|
321
321
|
for (const targetModel of targetModels) {
|
|
322
322
|
const foreignKeyValue = /**
|
|
323
323
|
* Narrows the runtime value to the documented type.
|
|
324
|
-
|
|
324
|
+
* @type {string | number} */ (targetModel.readColumn(foreignKey))
|
|
325
325
|
|
|
326
326
|
preloadCollections[foreignKeyValue].push(targetModel)
|
|
327
327
|
}
|
|
@@ -23,12 +23,12 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
23
23
|
async run() {
|
|
24
24
|
/**
|
|
25
25
|
* Models primary key values.
|
|
26
|
-
|
|
26
|
+
* @type {Array<number | string>} */
|
|
27
27
|
const modelsPrimaryKeyValues = []
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Models by primary key value.
|
|
31
|
-
|
|
31
|
+
* @type {Record<number | string, Array<import("../../record/index.js").default>>} */
|
|
32
32
|
const modelsByPrimaryKeyValue = {}
|
|
33
33
|
|
|
34
34
|
const foreignKey = this.relationship.getForeignKey()
|
|
@@ -41,12 +41,12 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Preload collections.
|
|
44
|
-
|
|
44
|
+
* @type {Record<number | string, import("../../record/index.js").default | undefined>} */
|
|
45
45
|
const preloadCollections = {}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Satisfied targets.
|
|
49
|
-
|
|
49
|
+
* @type {import("../../record/index.js").default[]} */
|
|
50
50
|
const satisfiedTargets = []
|
|
51
51
|
|
|
52
52
|
for (const model of this.models) {
|
|
@@ -55,7 +55,7 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
55
55
|
if (this.selection.isSatisfied({instanceRelationship, targetModelClass, mappingColumns: [foreignKey]})) {
|
|
56
56
|
const loaded = /**
|
|
57
57
|
* Narrows the runtime value to the documented type.
|
|
58
|
-
|
|
58
|
+
* @type {import("../../record/index.js").default | undefined} */ (instanceRelationship.getLoadedOrUndefined())
|
|
59
59
|
|
|
60
60
|
if (loaded) satisfiedTargets.push(loaded)
|
|
61
61
|
continue
|
|
@@ -63,7 +63,7 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
63
63
|
|
|
64
64
|
const primaryKeyValue = /**
|
|
65
65
|
* Narrows the runtime value to the documented type.
|
|
66
|
-
|
|
66
|
+
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
67
67
|
|
|
68
68
|
preloadCollections[primaryKeyValue] = undefined
|
|
69
69
|
|
|
@@ -77,7 +77,7 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Where args.
|
|
80
|
-
|
|
80
|
+
* @type {Record<string, string | number | Array<string | number>>} */
|
|
81
81
|
const whereArgs = {}
|
|
82
82
|
|
|
83
83
|
whereArgs[foreignKey] = modelsPrimaryKeyValues
|
|
@@ -101,7 +101,7 @@ export default class VelociousDatabaseQueryPreloaderHasOne {
|
|
|
101
101
|
for (const targetModel of targetModels) {
|
|
102
102
|
const foreignKeyValue = /**
|
|
103
103
|
* Narrows the runtime value to the documented type.
|
|
104
|
-
|
|
104
|
+
* @type {string | number} */ (targetModel.readColumn(foreignKey))
|
|
105
105
|
|
|
106
106
|
preloadCollections[foreignKeyValue] = targetModel
|
|
107
107
|
}
|
|
@@ -70,13 +70,13 @@ export default class VelociousDatabaseQueryPreloaderSelection {
|
|
|
70
70
|
if (narrowing) {
|
|
71
71
|
const selects = [...new Set([...narrowing, ...mappingColumns, ...(extra || [])])]
|
|
72
72
|
|
|
73
|
-
return /**
|
|
73
|
+
return /** @type {T} */ (query.select(selects))
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (extra) {
|
|
77
77
|
const allColumns = `${query.driver.quoteTable(targetModelClass.tableName())}.*`
|
|
78
78
|
|
|
79
|
-
return /**
|
|
79
|
+
return /** @type {T} */ (query.select([allColumns, ...extra]))
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return query
|
|
@@ -129,7 +129,7 @@ export default class VelociousDatabaseQueryPreloaderSelection {
|
|
|
129
129
|
const extra = this._extraFor(targetModelClass)
|
|
130
130
|
/**
|
|
131
131
|
* Columns.
|
|
132
|
-
|
|
132
|
+
* @type {string[]} */
|
|
133
133
|
const columns = []
|
|
134
134
|
|
|
135
135
|
if (narrowing) {
|
|
@@ -21,7 +21,7 @@ function normalizeNestedPreload(preload) {
|
|
|
21
21
|
if (Array.isArray(preload)) {
|
|
22
22
|
/**
|
|
23
23
|
* Result.
|
|
24
|
-
|
|
24
|
+
* @type {import("../query/index.js").NestedPreloadRecord} */
|
|
25
25
|
const result = {}
|
|
26
26
|
|
|
27
27
|
for (const entry of preload) {
|
|
@@ -50,7 +50,7 @@ function normalizeNestedPreload(preload) {
|
|
|
50
50
|
if (preload && typeof preload == "object") {
|
|
51
51
|
/**
|
|
52
52
|
* Result.
|
|
53
|
-
|
|
53
|
+
* @type {import("../query/index.js").NestedPreloadRecord} */
|
|
54
54
|
const result = {}
|
|
55
55
|
|
|
56
56
|
for (const [key, value] of Object.entries(preload)) {
|
|
@@ -90,17 +90,17 @@ export default class VelociousDatabaseQueryPreloader {
|
|
|
90
90
|
|
|
91
91
|
const modelClass = /**
|
|
92
92
|
* Narrows the runtime value to the documented type.
|
|
93
|
-
|
|
93
|
+
* @type {typeof import("../record/index.js").default} */ (models[0].constructor)
|
|
94
94
|
const isQuery = Boolean(queryOrSpec) && typeof queryOrSpec == "object" && "_preload" in queryOrSpec
|
|
95
95
|
// Reuse the query builder's preload/select normalization for raw specs
|
|
96
96
|
// instead of duplicating it here.
|
|
97
97
|
const query = isQuery
|
|
98
98
|
? /**
|
|
99
99
|
* Narrows the runtime value to the documented type.
|
|
100
|
-
|
|
100
|
+
* @type {import("./model-class-query.js").default} */ (queryOrSpec)
|
|
101
101
|
: modelClass.preload(/**
|
|
102
102
|
* Narrows the runtime value to the documented type.
|
|
103
|
-
|
|
103
|
+
* @type {?} */ (queryOrSpec))
|
|
104
104
|
|
|
105
105
|
const preloader = new VelociousDatabaseQueryPreloader({
|
|
106
106
|
modelClass,
|
|
@@ -143,21 +143,21 @@ export default class VelociousDatabaseQueryPreloader {
|
|
|
143
143
|
if (relationship.getType() == "belongsTo") {
|
|
144
144
|
const belongsToRelationship = /**
|
|
145
145
|
* Narrows the runtime value to the documented type.
|
|
146
|
-
|
|
146
|
+
* @type {import("../record/relationships/belongs-to.js").default} */ (relationship)
|
|
147
147
|
const hasManyPreloader = new BelongsToPreloader({models: this.models, relationship: belongsToRelationship, selection: this.selection})
|
|
148
148
|
|
|
149
149
|
preloadResult = await hasManyPreloader.run()
|
|
150
150
|
} else if (relationship.getType() == "hasMany") {
|
|
151
151
|
const hasManyRelationship = /**
|
|
152
152
|
* Narrows the runtime value to the documented type.
|
|
153
|
-
|
|
153
|
+
* @type {import("../record/relationships/has-many.js").default} */ (relationship)
|
|
154
154
|
const hasManyPreloader = new HasManyPreloader({models: this.models, relationship: hasManyRelationship, selection: this.selection})
|
|
155
155
|
|
|
156
156
|
preloadResult = await hasManyPreloader.run()
|
|
157
157
|
} else if (relationship.getType() == "hasOne") {
|
|
158
158
|
const hasOneRelationship = /**
|
|
159
159
|
* Narrows the runtime value to the documented type.
|
|
160
|
-
|
|
160
|
+
* @type {import("../record/relationships/has-one.js").default} */ (relationship)
|
|
161
161
|
const hasOnePreloader = new HasOnePreloader({models: this.models, relationship: hasOneRelationship, selection: this.selection})
|
|
162
162
|
|
|
163
163
|
preloadResult = await hasOnePreloader.run()
|
|
@@ -59,7 +59,7 @@ export function normalizeQueryDataSpec(spec, chain = []) {
|
|
|
59
59
|
if (Array.isArray(spec)) {
|
|
60
60
|
/**
|
|
61
61
|
* Entries.
|
|
62
|
-
|
|
62
|
+
* @type {QueryDataEntry[]} */
|
|
63
63
|
const entries = []
|
|
64
64
|
|
|
65
65
|
for (const item of spec) {
|
|
@@ -71,7 +71,7 @@ export function normalizeQueryDataSpec(spec, chain = []) {
|
|
|
71
71
|
if (isPlainObject(item)) {
|
|
72
72
|
for (const nested of normalizeQueryDataSpec(/**
|
|
73
73
|
* Narrows the runtime value to the documented type.
|
|
74
|
-
|
|
74
|
+
* @type {?} */ (item), chain)) {
|
|
75
75
|
entries.push(nested)
|
|
76
76
|
}
|
|
77
77
|
continue
|
|
@@ -86,7 +86,7 @@ export function normalizeQueryDataSpec(spec, chain = []) {
|
|
|
86
86
|
if (isPlainObject(spec)) {
|
|
87
87
|
/**
|
|
88
88
|
* Entries.
|
|
89
|
-
|
|
89
|
+
* @type {QueryDataEntry[]} */
|
|
90
90
|
const entries = []
|
|
91
91
|
|
|
92
92
|
for (const [key, value] of Object.entries(spec)) {
|
|
@@ -100,7 +100,7 @@ export function normalizeQueryDataSpec(spec, chain = []) {
|
|
|
100
100
|
if (typeof value === "string" || Array.isArray(value) || isPlainObject(value)) {
|
|
101
101
|
for (const nested of normalizeQueryDataSpec(/**
|
|
102
102
|
* Narrows the runtime value to the documented type.
|
|
103
|
-
|
|
103
|
+
* @type {?} */ (value), [...chain, key])) {
|
|
104
104
|
entries.push(nested)
|
|
105
105
|
}
|
|
106
106
|
continue
|
|
@@ -128,7 +128,7 @@ function buildNestedJoinDescriptor(chain) {
|
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Obj.
|
|
131
|
-
|
|
131
|
+
* @type {Record<string, ?>} */
|
|
132
132
|
const obj = {}
|
|
133
133
|
let cursor = obj
|
|
134
134
|
|
|
@@ -195,7 +195,7 @@ export async function runQueryData({rootModelClass, rootModels, entries}) {
|
|
|
195
195
|
const primaryKey = rootModelClass.primaryKey()
|
|
196
196
|
const rootIds = rootModels.map((model) => /**
|
|
197
197
|
* Narrows the runtime value to the documented type.
|
|
198
|
-
|
|
198
|
+
* @type {string | number} */ (model.readColumn(primaryKey)))
|
|
199
199
|
|
|
200
200
|
for (const entry of entries) {
|
|
201
201
|
await runEntry({entry, primaryKey, rootIds, rootModelClass, rootModels})
|
|
@@ -239,7 +239,7 @@ async function runEntry({entry, primaryKey, rootIds, rootModelClass, rootModels}
|
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Root where.
|
|
242
|
-
|
|
242
|
+
* @type {Record<string, ?>} */
|
|
243
243
|
const rootWhere = {}
|
|
244
244
|
rootWhere[primaryKey] = rootIds
|
|
245
245
|
query.where(rootWhere)
|
|
@@ -272,7 +272,7 @@ async function runEntry({entry, primaryKey, rootIds, rootModelClass, rootModels}
|
|
|
272
272
|
|
|
273
273
|
const rows = /**
|
|
274
274
|
* Narrows the runtime value to the documented type.
|
|
275
|
-
|
|
275
|
+
* @type {Array<Record<string, ?>>} */ (await query._executeQuery())
|
|
276
276
|
const byParent = new Map()
|
|
277
277
|
|
|
278
278
|
for (const row of rows) {
|
|
@@ -286,7 +286,7 @@ async function runEntry({entry, primaryKey, rootIds, rootModelClass, rootModels}
|
|
|
286
286
|
for (const model of rootModels) {
|
|
287
287
|
const modelId = /**
|
|
288
288
|
* Narrows the runtime value to the documented type.
|
|
289
|
-
|
|
289
|
+
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
290
290
|
// Driver-type tolerance: MySQL can return PKs as strings even when
|
|
291
291
|
// the column is numeric. Fall back to a string lookup so results
|
|
292
292
|
// still land on the right model.
|
|
@@ -25,10 +25,10 @@ function normalizeRelationshipWhereOperator(operator) {
|
|
|
25
25
|
">=": "gteq"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return /**
|
|
28
|
+
return /** @type {"eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like"} */ (
|
|
29
29
|
operatorAliases[/**
|
|
30
30
|
* Narrows the runtime value to the documented type.
|
|
31
|
-
|
|
31
|
+
* @type {"<" | "<=" | ">" | ">="} */ (operator)] || operator
|
|
32
32
|
)
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -68,7 +68,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
68
68
|
|
|
69
69
|
const modelQuery = /**
|
|
70
70
|
* Narrows the runtime value to the documented type.
|
|
71
|
-
|
|
71
|
+
* @type {import("./model-class-query.js").default} */ (this.query)
|
|
72
72
|
const baseTableName = this.qualifyBaseTable
|
|
73
73
|
? modelQuery.getTableReferenceForJoin()
|
|
74
74
|
: undefined
|
|
@@ -136,7 +136,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Normalized.
|
|
139
|
-
|
|
139
|
+
* @type {Array<[string, "eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like", unknown]>} */
|
|
140
140
|
const normalized = []
|
|
141
141
|
/**
|
|
142
142
|
* Add condition.
|
|
@@ -146,7 +146,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
146
146
|
if (this._isRelationshipWhereOperatorTuple(conditionValue)) {
|
|
147
147
|
const tuple = /**
|
|
148
148
|
* Narrows the runtime value to the documented type.
|
|
149
|
-
|
|
149
|
+
* @type {[string, "eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like" | ">" | ">=" | "<" | "<=", unknown, ...Array<unknown>]} */ (conditionValue)
|
|
150
150
|
const normalizedOperator = normalizeRelationshipWhereOperator(tuple[1])
|
|
151
151
|
|
|
152
152
|
normalized.push([
|
|
@@ -395,7 +395,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
395
395
|
const options = this.getOptions()
|
|
396
396
|
const modelQuery = /**
|
|
397
397
|
* Narrows the runtime value to the documented type.
|
|
398
|
-
|
|
398
|
+
* @type {import("./model-class-query.js").default} */ (this.query)
|
|
399
399
|
let sql = ""
|
|
400
400
|
|
|
401
401
|
for (const whereKey in hash) {
|
|
@@ -443,7 +443,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
443
443
|
|
|
444
444
|
const nestedHash = /**
|
|
445
445
|
* Narrows the runtime value to the documented type.
|
|
446
|
-
|
|
446
|
+
* @type {WhereHash} */ (whereValue)
|
|
447
447
|
const nestedPath = path.concat([whereKey])
|
|
448
448
|
const nestedTableName = modelQuery.getTableReferenceForJoin(...nestedPath)
|
|
449
449
|
|