velocious 1.0.449 → 1.0.451
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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-types.js +3 -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 +836 -60
- 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-types.d.ts +12 -2
- package/build/src/configuration-types.d.ts.map +1 -1
- package/build/src/configuration-types.js +4 -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 +285 -12
- 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 +712 -61
- 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 +67 -59
- 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-types.js +3 -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 +836 -60
- 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
|
@@ -21,15 +21,15 @@ import HasOnePreloader from "../../query/preloader/has-one.js"
|
|
|
21
21
|
export default class VelociousDatabaseRecordBaseInstanceRelationship {
|
|
22
22
|
/**
|
|
23
23
|
* Auto save.
|
|
24
|
-
|
|
24
|
+
* @type {boolean | undefined} */
|
|
25
25
|
_autoSave = undefined
|
|
26
26
|
/**
|
|
27
27
|
* Preloaded.
|
|
28
|
-
|
|
28
|
+
* @type {boolean | undefined} */
|
|
29
29
|
_preloaded = undefined
|
|
30
30
|
/**
|
|
31
31
|
* Loaded.
|
|
32
|
-
|
|
32
|
+
* @type {InstanceType<TMC> | Array<InstanceType<TMC>> | undefined} */
|
|
33
33
|
_loaded = undefined
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -128,9 +128,9 @@ export default class VelociousDatabaseRecordBaseInstanceRelationship {
|
|
|
128
128
|
const configuration = relationshipDef.getConfiguration()
|
|
129
129
|
const cohort = /**
|
|
130
130
|
* Narrows the runtime value to the documented type.
|
|
131
|
-
|
|
131
|
+
* @type {Array<import("../index.js").default> | undefined} */ (/**
|
|
132
132
|
* Narrows the runtime value to the documented type.
|
|
133
|
-
|
|
133
|
+
* @type {?} */ (this.model)._loadCohort)
|
|
134
134
|
|
|
135
135
|
if (!configuration.getAutoload() || !relationshipDef.getAutoload() || !cohort || cohort.length <= 1) {
|
|
136
136
|
return false
|
|
@@ -139,10 +139,10 @@ export default class VelociousDatabaseRecordBaseInstanceRelationship {
|
|
|
139
139
|
const relationshipName = relationshipDef.getRelationshipName()
|
|
140
140
|
const OwnerModelClass = /**
|
|
141
141
|
* Narrows the runtime value to the documented type.
|
|
142
|
-
|
|
142
|
+
* @type {?} */ (this.model).constructor
|
|
143
143
|
/**
|
|
144
144
|
* Batch.
|
|
145
|
-
|
|
145
|
+
* @type {Array<import("../index.js").default>} */
|
|
146
146
|
const batch = []
|
|
147
147
|
|
|
148
148
|
// Exact same class, persisted, no existing in-memory relationship state.
|
|
@@ -168,21 +168,21 @@ export default class VelociousDatabaseRecordBaseInstanceRelationship {
|
|
|
168
168
|
if (type == "belongsTo") {
|
|
169
169
|
const belongsToRelationship = /**
|
|
170
170
|
* Narrows the runtime value to the documented type.
|
|
171
|
-
|
|
171
|
+
* @type {import("../relationships/belongs-to.js").default} */ (relationshipDef)
|
|
172
172
|
const preloader = new BelongsToPreloader({models: batch, relationship: belongsToRelationship})
|
|
173
173
|
|
|
174
174
|
await preloader.run()
|
|
175
175
|
} else if (type == "hasMany") {
|
|
176
176
|
const hasManyRelationship = /**
|
|
177
177
|
* Narrows the runtime value to the documented type.
|
|
178
|
-
|
|
178
|
+
* @type {import("../relationships/has-many.js").default} */ (relationshipDef)
|
|
179
179
|
const preloader = new HasManyPreloader({models: batch, relationship: hasManyRelationship})
|
|
180
180
|
|
|
181
181
|
await preloader.run()
|
|
182
182
|
} else if (type == "hasOne") {
|
|
183
183
|
const hasOneRelationship = /**
|
|
184
184
|
* Narrows the runtime value to the documented type.
|
|
185
|
-
|
|
185
|
+
* @type {import("../relationships/has-one.js").default} */ (relationshipDef)
|
|
186
186
|
const preloader = new HasOnePreloader({models: batch, relationship: hasOneRelationship})
|
|
187
187
|
|
|
188
188
|
await preloader.run()
|
|
@@ -276,7 +276,7 @@ export default class VelociousDatabaseRecordBaseInstanceRelationship {
|
|
|
276
276
|
getTargetModelClass() {
|
|
277
277
|
const TargetModelClass = /**
|
|
278
278
|
* Narrows the runtime value to the documented type.
|
|
279
|
-
|
|
279
|
+
* @type {TMC} */ (this.getRelationship().getTargetModelClass())
|
|
280
280
|
|
|
281
281
|
return TargetModelClass
|
|
282
282
|
}
|
|
@@ -25,13 +25,13 @@ export default class VelociousDatabaseRecordBelongsToInstanceRelationship extend
|
|
|
25
25
|
build(data) {
|
|
26
26
|
const TargetModelClass = /**
|
|
27
27
|
* Narrows the runtime value to the documented type.
|
|
28
|
-
|
|
28
|
+
* @type {TMC} */ (this.getTargetModelClass())
|
|
29
29
|
|
|
30
30
|
if (!TargetModelClass) throw new Error("Can't build a new record without a target model")
|
|
31
31
|
|
|
32
32
|
const newInstance = /**
|
|
33
33
|
* Narrows the runtime value to the documented type.
|
|
34
|
-
|
|
34
|
+
* @type {InstanceType<TMC>} */ (new TargetModelClass(data))
|
|
35
35
|
|
|
36
36
|
this._loaded = newInstance
|
|
37
37
|
|
|
@@ -84,7 +84,7 @@ export default class VelociousDatabaseRecordBelongsToInstanceRelationship extend
|
|
|
84
84
|
const primaryKey = TargetModelClass.primaryKey()
|
|
85
85
|
/**
|
|
86
86
|
* Where args.
|
|
87
|
-
|
|
87
|
+
* @type {Record<string, string | number | null | undefined>} */
|
|
88
88
|
const whereArgs = {}
|
|
89
89
|
|
|
90
90
|
whereArgs[primaryKey] = foreignModelID
|
|
@@ -31,7 +31,7 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
31
31
|
|
|
32
32
|
const newInstance = /**
|
|
33
33
|
* Narrows the runtime value to the documented type.
|
|
34
|
-
|
|
34
|
+
* @type {InstanceType<TMC>} */ (new targetModelClass(data))
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
// Add it to the loaded models of this relationship
|
|
@@ -67,7 +67,7 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
67
67
|
const foreignKeyValue = parentModel.readColumn(primaryKeyName)
|
|
68
68
|
/**
|
|
69
69
|
* Assign data.
|
|
70
|
-
|
|
70
|
+
* @type {Record<string, ?>} */
|
|
71
71
|
const assignData = {}
|
|
72
72
|
|
|
73
73
|
assignData[foreignKeyAttributeName] = foreignKeyValue
|
|
@@ -109,12 +109,12 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
109
109
|
const batched = await this._tryCohortPreload()
|
|
110
110
|
|
|
111
111
|
if (batched) {
|
|
112
|
-
return /**
|
|
112
|
+
return /** @type {InstanceType<TMC>[]} */ (Array.isArray(this._loaded) ? this._loaded : [])
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
const foreignModels = /**
|
|
116
116
|
* Narrows the runtime value to the documented type.
|
|
117
|
-
|
|
117
|
+
* @type {InstanceType<TMC>[]} */ (await this.query().load())
|
|
118
118
|
|
|
119
119
|
this.setLoaded(foreignModels)
|
|
120
120
|
this.setDirty(false)
|
|
@@ -168,7 +168,7 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
168
168
|
* @returns {Promise<InstanceType<TMC>>} - Resolves with the find.
|
|
169
169
|
*/
|
|
170
170
|
async find(modelID) {
|
|
171
|
-
return /**
|
|
171
|
+
return /** @type {Promise<InstanceType<TMC>>} */ (this.query().find(modelID))
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
/**
|
|
@@ -204,7 +204,7 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
204
204
|
const parentPrimaryKey = this.getPrimaryKey()
|
|
205
205
|
const parentId = /**
|
|
206
206
|
* Narrows the runtime value to the documented type.
|
|
207
|
-
|
|
207
|
+
* @type {string | number} */ (this.getModel().readColumn(parentPrimaryKey))
|
|
208
208
|
const joinSql = `LEFT JOIN ${driver.quoteTable(throughTable)} ON ${driver.quoteTable(throughTable)}.${driver.quoteColumn(throughPrimaryKey)} = ${driver.quoteTable(targetTable)}.${driver.quoteColumn(targetForeignKey)}`
|
|
209
209
|
const whereSql = `${driver.quoteTable(throughTable)}.${driver.quoteColumn(throughForeignKey)} = ${driver.options().quote(parentId)}`
|
|
210
210
|
|
|
@@ -217,11 +217,11 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
217
217
|
const primaryKey = this.getPrimaryKey()
|
|
218
218
|
const primaryModelID = /**
|
|
219
219
|
* Narrows the runtime value to the documented type.
|
|
220
|
-
|
|
220
|
+
* @type {string | number} */ (this.getModel().readColumn(primaryKey))
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Where args.
|
|
224
|
-
|
|
224
|
+
* @type {Record<string, string | number>} */
|
|
225
225
|
const whereArgs = {}
|
|
226
226
|
|
|
227
227
|
whereArgs[foreignKey] = primaryModelID
|
|
@@ -19,7 +19,7 @@ export default class VelociousDatabaseRecordHasOneInstanceRelationship extends B
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Loaded.
|
|
22
|
-
|
|
22
|
+
* @type {InstanceType<TMC> | undefined} */
|
|
23
23
|
_loaded = undefined
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -30,13 +30,13 @@ export default class VelociousDatabaseRecordHasOneInstanceRelationship extends B
|
|
|
30
30
|
build(data) {
|
|
31
31
|
const TargetModelClass = /**
|
|
32
32
|
* Narrows the runtime value to the documented type.
|
|
33
|
-
|
|
33
|
+
* @type {TMC} */ (this.getTargetModelClass())
|
|
34
34
|
|
|
35
35
|
if (!TargetModelClass) throw new Error("Can't build a new record without a target model class")
|
|
36
36
|
|
|
37
37
|
const newInstance = /**
|
|
38
38
|
* Narrows the runtime value to the documented type.
|
|
39
|
-
|
|
39
|
+
* @type {InstanceType<TMC>} */ (new TargetModelClass(data))
|
|
40
40
|
|
|
41
41
|
this._loaded = newInstance
|
|
42
42
|
|
|
@@ -58,16 +58,16 @@ export default class VelociousDatabaseRecordHasOneInstanceRelationship extends B
|
|
|
58
58
|
const primaryKey = this.getPrimaryKey()
|
|
59
59
|
const primaryModelID = /**
|
|
60
60
|
* Narrows the runtime value to the documented type.
|
|
61
|
-
|
|
61
|
+
* @type {string | number} */ (this.getModel().readColumn(primaryKey))
|
|
62
62
|
const TargetModelClass = /**
|
|
63
63
|
* Narrows the runtime value to the documented type.
|
|
64
|
-
|
|
64
|
+
* @type {TMC} */ (this.getTargetModelClass())
|
|
65
65
|
|
|
66
66
|
if (!TargetModelClass) throw new Error("Can't load without a target model class")
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Where args.
|
|
70
|
-
|
|
70
|
+
* @type {Record<string, string | number>} */
|
|
71
71
|
const whereArgs = {}
|
|
72
72
|
|
|
73
73
|
whereArgs[foreignKey] = primaryModelID
|
|
@@ -113,5 +113,5 @@ export default class VelociousDatabaseRecordHasOneInstanceRelationship extends B
|
|
|
113
113
|
this._loaded = model
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
getTargetModelClass() { return /**
|
|
116
|
+
getTargetModelClass() { return /** @type {TMC | undefined} */ (this.relationship.getTargetModelClass()) }
|
|
117
117
|
}
|
|
@@ -135,9 +135,9 @@ export default class VelociousDatabaseRecordBaseRelationship {
|
|
|
135
135
|
|
|
136
136
|
const scopedQuery = /**
|
|
137
137
|
* Narrows the runtime value to the documented type.
|
|
138
|
-
|
|
138
|
+
* @type {T | void} */ (scope.call(query, /**
|
|
139
139
|
* Narrows the runtime value to the documented type.
|
|
140
|
-
|
|
140
|
+
* @type {import("../../query/model-class-query.js").default<typeof import("../index.js").default>} */ (query)))
|
|
141
141
|
|
|
142
142
|
return scopedQuery || query
|
|
143
143
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Pending transition key.
|
|
26
|
-
|
|
26
|
+
* @type {string} */
|
|
27
27
|
const PENDING_TRANSITION_KEY = "_stateMachinePendingTransition"
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -65,7 +65,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
65
65
|
// Store definition on the model class for introspection
|
|
66
66
|
/**
|
|
67
67
|
* Dynamic class.
|
|
68
|
-
|
|
68
|
+
* @type {?} */
|
|
69
69
|
const dynamicClass = ModelClass
|
|
70
70
|
|
|
71
71
|
dynamicClass._stateMachineDefinition = definition
|
|
@@ -98,7 +98,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
98
98
|
// Register event methods and guard methods on the prototype
|
|
99
99
|
/**
|
|
100
100
|
* Proto.
|
|
101
|
-
|
|
101
|
+
* @type {?} */
|
|
102
102
|
const proto = ModelClass.prototype
|
|
103
103
|
|
|
104
104
|
for (const [eventName, eventDef] of Object.entries(definition.events)) {
|
|
@@ -147,7 +147,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
147
147
|
proto[eventName] = function () {
|
|
148
148
|
/**
|
|
149
149
|
* Self.
|
|
150
|
-
|
|
150
|
+
* @type {?} */
|
|
151
151
|
const self = this
|
|
152
152
|
const currentState = self.readAttribute(column)
|
|
153
153
|
|
|
@@ -182,7 +182,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
182
182
|
proto[`${eventName}AndSave`] = async function () {
|
|
183
183
|
/**
|
|
184
184
|
* Self.
|
|
185
|
-
|
|
185
|
+
* @type {?} */
|
|
186
186
|
const self = this
|
|
187
187
|
const currentState = self.readAttribute(column)
|
|
188
188
|
|
|
@@ -214,7 +214,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
214
214
|
ModelClass.beforeSave(async function (model) {
|
|
215
215
|
/**
|
|
216
216
|
* Dynamic model.
|
|
217
|
-
|
|
217
|
+
* @type {?} */
|
|
218
218
|
const dynamicModel = model
|
|
219
219
|
const pending = dynamicModel[PENDING_TRANSITION_KEY]
|
|
220
220
|
|
|
@@ -241,7 +241,7 @@ export function stateMachine(ModelClass, definition) {
|
|
|
241
241
|
ModelClass.afterSave(async function (model) {
|
|
242
242
|
/**
|
|
243
243
|
* Dynamic model.
|
|
244
|
-
|
|
244
|
+
* @type {?} */
|
|
245
245
|
const dynamicModel = model
|
|
246
246
|
const pending = dynamicModel[PENDING_TRANSITION_KEY]
|
|
247
247
|
|
|
@@ -12,7 +12,7 @@ export default class VelociousDatabaseRecordValidatorsPresence extends Base {
|
|
|
12
12
|
async validate({model, attributeName}) {
|
|
13
13
|
const rawValue = /**
|
|
14
14
|
* Narrows the runtime value to the documented type.
|
|
15
|
-
|
|
15
|
+
* @type {string | undefined} */ (model.readAttribute(attributeName))
|
|
16
16
|
const attributeValue = rawValue?.trim()
|
|
17
17
|
|
|
18
18
|
if (!attributeValue) {
|
|
@@ -14,18 +14,18 @@ export default class VelociousDatabaseRecordValidatorsUniqueness extends Base {
|
|
|
14
14
|
async validate({model, attributeName}) {
|
|
15
15
|
const modelClass = /**
|
|
16
16
|
* Narrows the runtime value to the documented type.
|
|
17
|
-
|
|
17
|
+
* @type {typeof import("../index.js").default} */ (model.constructor)
|
|
18
18
|
|
|
19
19
|
const connection = modelClass.connection()
|
|
20
20
|
const tableName = modelClass._getTable().getName()
|
|
21
21
|
const attributeValue = /**
|
|
22
22
|
* Narrows the runtime value to the documented type.
|
|
23
|
-
|
|
23
|
+
* @type {string | number} */ (model.readAttribute(attributeName))
|
|
24
24
|
const attributeNameUnderscore = inflection.underscore(attributeName)
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Where args.
|
|
28
|
-
|
|
28
|
+
* @type {Record<string, string | number>} */
|
|
29
29
|
const whereArgs = {}
|
|
30
30
|
|
|
31
31
|
whereArgs[attributeNameUnderscore] = attributeValue
|
|
@@ -51,7 +51,7 @@ export default class VelociousDatabaseRecordValidatorsUniqueness extends Base {
|
|
|
51
51
|
|
|
52
52
|
whereArgs[scopeUnderscore] = /**
|
|
53
53
|
* Narrows the runtime value to the documented type.
|
|
54
|
-
|
|
54
|
+
* @type {string | number} */ (scopeValue)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
let existingRecordQuery = modelClass
|
|
@@ -84,7 +84,7 @@ export default class VelociousDatabaseRecordValidatorsUniqueness extends Base {
|
|
|
84
84
|
_resolveScopeValueFromRelationship(model, scopeColumn) {
|
|
85
85
|
const modelClass = /**
|
|
86
86
|
* Narrows the runtime value to the documented type.
|
|
87
|
-
|
|
87
|
+
* @type {typeof import("../index.js").default} */ (model.constructor)
|
|
88
88
|
const relationships = modelClass.getRelationshipsMap()
|
|
89
89
|
|
|
90
90
|
for (const relationshipName in relationships) {
|
|
@@ -13,22 +13,22 @@ import TableReference from "./table-reference.js"
|
|
|
13
13
|
export default class TableData {
|
|
14
14
|
/**
|
|
15
15
|
* Columns.
|
|
16
|
-
|
|
16
|
+
* @type {TableColumn[]} */
|
|
17
17
|
_columns = []
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Foreign keys.
|
|
21
|
-
|
|
21
|
+
* @type {import("./table-foreign-key.js").default[]} */
|
|
22
22
|
_foreignKeys = []
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Indexes.
|
|
26
|
-
|
|
26
|
+
* @type {TableIndex[]} */
|
|
27
27
|
_indexes = []
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* References.
|
|
31
|
-
|
|
31
|
+
* @type {TableReference[]} */
|
|
32
32
|
_references = []
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -79,7 +79,7 @@ export default class VelociousEnvironmentHandlerBase {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Narrows the runtime value to the documented type.
|
|
82
|
-
|
|
82
|
+
* @type {number} */
|
|
83
83
|
this.configuration._timezoneOffsetMinutes = _offsetMinutes
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -97,7 +97,7 @@ export default class VelociousEnvironmentHandlerBase {
|
|
|
97
97
|
return activeConfiguration._timezoneOffsetMinutes
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return /**
|
|
100
|
+
return /** @type {number} */ (activeConfiguration.getTimezoneOffsetMinutes())
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -42,17 +42,17 @@ function isMigrationObject(migration) {
|
|
|
42
42
|
export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
43
43
|
/**
|
|
44
44
|
* Find commands require context result.
|
|
45
|
-
|
|
45
|
+
* @type {CommandsRequireContextType | undefined} */
|
|
46
46
|
findCommandsRequireContextResult = undefined
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Migrations require context result.
|
|
50
|
-
|
|
50
|
+
* @type {MigrationsRequireContextType | undefined} */
|
|
51
51
|
_migrationsRequireContextResult = undefined
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Test files require context result.
|
|
55
|
-
|
|
55
|
+
* @type {TestFilesRequireContextType | undefined} */
|
|
56
56
|
_testFilesRequireContextResult = undefined
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -117,7 +117,7 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
|
117
117
|
*/
|
|
118
118
|
_findCommandsRequireContext() {
|
|
119
119
|
// @ts-expect-error
|
|
120
|
-
this.findCommandsRequireContextResult ||= /**
|
|
120
|
+
this.findCommandsRequireContextResult ||= /** @type {CommandsRequireContextType} */ (require.context("../cli/commands", true, /\.js$/))
|
|
121
121
|
|
|
122
122
|
return this.findCommandsRequireContextResult
|
|
123
123
|
}
|
|
@@ -195,7 +195,7 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
|
195
195
|
const migrationsRequireContext = await this.migrationsRequireContext()
|
|
196
196
|
/**
|
|
197
197
|
* Migrations.
|
|
198
|
-
|
|
198
|
+
* @type {Array<import("./base.js").MigrationObjectType | null>} */
|
|
199
199
|
const migrations = migrationsRequireContext
|
|
200
200
|
.keys()
|
|
201
201
|
.map((file) => {
|
|
@@ -228,10 +228,10 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
|
228
228
|
.filter(isMigrationObject)
|
|
229
229
|
/**
|
|
230
230
|
* Files.
|
|
231
|
-
|
|
231
|
+
* @type {import("./base.js").MigrationObjectType[]} */
|
|
232
232
|
const files = /**
|
|
233
233
|
* Narrows the runtime value to the documented type.
|
|
234
|
-
|
|
234
|
+
* @type {import("./base.js").MigrationObjectType[]} */ (migrations)
|
|
235
235
|
|
|
236
236
|
files.sort((migration1, migration2) => migration1.date - migration2.date)
|
|
237
237
|
|
|
@@ -5,7 +5,7 @@ import repl from "node:repl"
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Defines this typedef.
|
|
8
|
-
|
|
8
|
+
* @typedef {{application: import("../../../../application.js").default, configuration: import("../../../../configuration.js").default}} ConsoleContextArgs */
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Runs build console context.
|
|
@@ -15,7 +15,7 @@ import repl from "node:repl"
|
|
|
15
15
|
function buildConsoleContext({application, configuration}) {
|
|
16
16
|
/**
|
|
17
17
|
* Dbs.
|
|
18
|
-
|
|
18
|
+
* @type {Record<string, import("../../../../database/drivers/base.js").default>} */
|
|
19
19
|
const dbs = configuration.getCurrentConnections()
|
|
20
20
|
|
|
21
21
|
for (const identifier of configuration.getDatabaseIdentifiers()) {
|
|
@@ -24,7 +24,7 @@ function buildConsoleContext({application, configuration}) {
|
|
|
24
24
|
const pool = configuration.getDatabasePool(identifier)
|
|
25
25
|
const poolWithGlobal = /**
|
|
26
26
|
* Narrows the runtime value to the documented type.
|
|
27
|
-
|
|
27
|
+
* @type {{getGlobalConnection?: () => import("../../../../database/drivers/base.js").default | undefined}} */ (pool)
|
|
28
28
|
const globalConnection = poolWithGlobal.getGlobalConnection?.()
|
|
29
29
|
|
|
30
30
|
if (globalConnection) {
|
|
@@ -67,7 +67,7 @@ function assignConsoleContext({context, replServer}) {
|
|
|
67
67
|
|
|
68
68
|
const modelClasses = /**
|
|
69
69
|
* Narrows the runtime value to the documented type.
|
|
70
|
-
|
|
70
|
+
* @type {Record<string, typeof import("../../../../database/record/index.js").default>} */ (
|
|
71
71
|
context.models || {}
|
|
72
72
|
)
|
|
73
73
|
|
|
@@ -6,7 +6,7 @@ import path from "path"
|
|
|
6
6
|
export default class DbSchemaDump extends BaseCommand {
|
|
7
7
|
/**
|
|
8
8
|
* Runs execute.
|
|
9
|
-
|
|
9
|
+
* @returns {Promise<void>} */
|
|
10
10
|
async execute() {
|
|
11
11
|
await this.getConfiguration().ensureConnections({name: "DB schema dump"}, async (dbs) => {
|
|
12
12
|
const shouldGenerate = await this.shouldGenerateStructureSql({dbs})
|
|
@@ -7,7 +7,7 @@ import splitSqlStatements from "../../../../../../utils/split-sql-statements.js"
|
|
|
7
7
|
export default class DbSchemaLoad extends BaseCommand {
|
|
8
8
|
/**
|
|
9
9
|
* Runs execute.
|
|
10
|
-
|
|
10
|
+
* @returns {Promise<void>} */
|
|
11
11
|
async execute() {
|
|
12
12
|
await this.getConfiguration().ensureConnections({name: "DB schema load"}, async (dbs) => {
|
|
13
13
|
const dbDir = path.join(this.directory(), "db")
|
|
@@ -59,11 +59,11 @@ export default class DbSchemaLoad extends BaseCommand {
|
|
|
59
59
|
executableConnection(db) {
|
|
60
60
|
const dbWithConnection = /**
|
|
61
61
|
* Narrows the runtime value to the documented type.
|
|
62
|
-
|
|
62
|
+
* @type {import("../../../../../../database/drivers/base.js").default & {connection?: ?}} */ (db)
|
|
63
63
|
const connection = dbWithConnection.connection
|
|
64
64
|
|
|
65
65
|
if (connection && typeof connection == "object" && "exec" in connection && typeof connection.exec == "function") {
|
|
66
|
-
return /**
|
|
66
|
+
return /** @type {{exec: (sql: string) => Promise<?>}} */ (connection)
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|