velocious 1.0.448 → 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 +127 -128
- 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/base-models.js +1 -16
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +179 -89
- package/build/environment-handlers/node.js +6 -6
- package/build/frontend-model-controller.js +90 -82
- package/build/frontend-model-resource/base-resource.js +343 -167
- package/build/frontend-models/base.js +362 -205
- 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 +8 -7
- 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-record.d.ts +2 -1
- package/build/src/background-jobs/job-record.d.ts.map +1 -1
- 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.d.ts +2 -2
- package/build/src/database/query/preloader/belongs-to.d.ts.map +1 -1
- package/build/src/database/query/preloader/belongs-to.js +23 -23
- package/build/src/database/query/preloader/has-many.d.ts +1 -1
- package/build/src/database/query/preloader/has-many.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-many.js +21 -21
- package/build/src/database/query/preloader/has-one.d.ts +2 -2
- package/build/src/database/query/preloader/has-one.d.ts.map +1 -1
- 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.d.ts +1 -1
- package/build/src/database/query/preloader.d.ts.map +1 -1
- 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 +2 -2
- 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 +35 -32
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +147 -148
- 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/base-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/base-models.js +2 -15
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +105 -33
- 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 +172 -87
- 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 +95 -89
- package/build/src/frontend-model-resource/base-resource.d.ts +239 -91
- package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/base-resource.js +302 -172
- package/build/src/frontend-models/base.d.ts +186 -115
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +347 -218
- 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.d.ts.map +1 -1
- package/build/src/frontend-models/preloader.js +9 -8
- 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 +9 -9
- package/build/src/testing/expect-utils.js +13 -13
- package/build/src/testing/expect.d.ts +7 -1
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +17 -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 +8 -8
- package/build/testing/expect-utils.js +11 -11
- package/build/testing/expect.js +16 -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 +127 -128
- 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/base-models.js +1 -16
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +179 -89
- package/src/environment-handlers/node.js +6 -6
- package/src/frontend-model-controller.js +90 -82
- package/src/frontend-model-resource/base-resource.js +343 -167
- package/src/frontend-models/base.js +362 -205
- 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 +8 -7
- 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 +8 -8
- package/src/testing/expect-utils.js +11 -11
- package/src/testing/expect.js +16 -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
|
@@ -149,7 +149,7 @@ function buildRelatedRecordWithInverse(parent, relationshipName, attributes, all
|
|
|
149
149
|
parent,
|
|
150
150
|
record: /**
|
|
151
151
|
* Narrows the runtime value to the documented type.
|
|
152
|
-
|
|
152
|
+
* @type {{getRelationshipByName: VelociousDatabaseRecord["getRelationshipByName"]}} */ (record)
|
|
153
153
|
})
|
|
154
154
|
|
|
155
155
|
return record
|
|
@@ -222,20 +222,24 @@ class TenantDatabaseScopeError extends Error {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Base database record.
|
|
227
|
+
* @template {Record<string, ?>} [WriteAttributes=Record<string, ?>]
|
|
228
|
+
*/
|
|
225
229
|
class VelociousDatabaseRecord {
|
|
226
230
|
/**
|
|
227
231
|
* Narrows the runtime value to the documented type.
|
|
228
|
-
|
|
232
|
+
* @type {string | undefined} */
|
|
229
233
|
static modelName
|
|
230
234
|
|
|
231
235
|
/**
|
|
232
236
|
* Narrows the runtime value to the documented type.
|
|
233
|
-
|
|
237
|
+
* @type {Promise<void> | null | undefined} */
|
|
234
238
|
static _initializeRecordPromise
|
|
235
239
|
|
|
236
240
|
/**
|
|
237
241
|
* Narrows the runtime value to the documented type.
|
|
238
|
-
|
|
242
|
+
* @type {boolean | undefined} */
|
|
239
243
|
static _eagerLoadRecordMetadata
|
|
240
244
|
|
|
241
245
|
/**
|
|
@@ -254,7 +258,7 @@ class VelociousDatabaseRecord {
|
|
|
254
258
|
if (!this._attributeNameToColumnName) {
|
|
255
259
|
/**
|
|
256
260
|
* Narrows the runtime value to the documented type.
|
|
257
|
-
|
|
261
|
+
* @type {Record<string, string>} */
|
|
258
262
|
this._attributeNameToColumnName = {}
|
|
259
263
|
}
|
|
260
264
|
|
|
@@ -355,7 +359,7 @@ class VelociousDatabaseRecord {
|
|
|
355
359
|
if (!this._columnNameToAttributeName) {
|
|
356
360
|
/**
|
|
357
361
|
* Narrows the runtime value to the documented type.
|
|
358
|
-
|
|
362
|
+
* @type {Record<string, string>} */
|
|
359
363
|
this._columnNameToAttributeName = {}
|
|
360
364
|
}
|
|
361
365
|
|
|
@@ -366,7 +370,7 @@ class VelociousDatabaseRecord {
|
|
|
366
370
|
if (!this._translations) {
|
|
367
371
|
/**
|
|
368
372
|
* Narrows the runtime value to the documented type.
|
|
369
|
-
|
|
373
|
+
* @type {Record<string, object>} */
|
|
370
374
|
this._translations = {}
|
|
371
375
|
}
|
|
372
376
|
|
|
@@ -377,7 +381,7 @@ class VelociousDatabaseRecord {
|
|
|
377
381
|
if (!this._validators) {
|
|
378
382
|
/**
|
|
379
383
|
* Narrows the runtime value to the documented type.
|
|
380
|
-
|
|
384
|
+
* @type {Record<string, import("./validators/base.js").default[]>} */
|
|
381
385
|
this._validators = {}
|
|
382
386
|
}
|
|
383
387
|
|
|
@@ -392,7 +396,7 @@ class VelociousDatabaseRecord {
|
|
|
392
396
|
if (!this._lifecycleCallbacks) {
|
|
393
397
|
/**
|
|
394
398
|
* Narrows the runtime value to the documented type.
|
|
395
|
-
|
|
399
|
+
* @type {Record<string, LifecycleCallbackType[]>} */
|
|
396
400
|
this._lifecycleCallbacks = {}
|
|
397
401
|
}
|
|
398
402
|
|
|
@@ -403,7 +407,7 @@ class VelociousDatabaseRecord {
|
|
|
403
407
|
if (!this._validatorTypes) {
|
|
404
408
|
/**
|
|
405
409
|
* Narrows the runtime value to the documented type.
|
|
406
|
-
|
|
410
|
+
* @type {Record<string, typeof import("./validators/base.js").default>} */
|
|
407
411
|
this._validatorTypes = {}
|
|
408
412
|
}
|
|
409
413
|
|
|
@@ -418,7 +422,7 @@ class VelociousDatabaseRecord {
|
|
|
418
422
|
if (!this._attachmentsMap) {
|
|
419
423
|
/**
|
|
420
424
|
* Narrows the runtime value to the documented type.
|
|
421
|
-
|
|
425
|
+
* @type {Record<string, {driver?: string | AttachmentDriverConstructor | Record<string, ?>, type: "hasOne" | "hasMany"}>} */
|
|
422
426
|
this._attachmentsMap = {}
|
|
423
427
|
}
|
|
424
428
|
|
|
@@ -427,37 +431,37 @@ class VelociousDatabaseRecord {
|
|
|
427
431
|
|
|
428
432
|
/**
|
|
429
433
|
* Attributes.
|
|
430
|
-
|
|
434
|
+
* @type {Record<string, ?>} */
|
|
431
435
|
_attributes = {}
|
|
432
436
|
|
|
433
437
|
/**
|
|
434
438
|
* Changes.
|
|
435
|
-
|
|
439
|
+
* @type {Record<string, ?>} */
|
|
436
440
|
_changes = {}
|
|
437
441
|
|
|
438
442
|
/**
|
|
439
443
|
* Attribute names explicitly assigned in the current update call.
|
|
440
|
-
|
|
444
|
+
* @type {Set<string> | undefined}
|
|
441
445
|
*/
|
|
442
446
|
_assignedAttributeNames = undefined
|
|
443
447
|
|
|
444
448
|
/**
|
|
445
449
|
* Columns as hash.
|
|
446
|
-
|
|
450
|
+
* @type {Record<string, import("../drivers/base-column.js").default>} */
|
|
447
451
|
_columnsAsHash = {}
|
|
448
452
|
|
|
449
453
|
/**
|
|
450
454
|
* Connection.
|
|
451
|
-
|
|
455
|
+
* @type {import("../drivers/base.js").default | undefined} */
|
|
452
456
|
__connection = undefined
|
|
453
457
|
|
|
454
458
|
/**
|
|
455
459
|
* Instance relationships.
|
|
456
|
-
|
|
460
|
+
* @type {Record<string, import("./instance-relationships/base.js").default>} */
|
|
457
461
|
_instanceRelationships = {}
|
|
458
462
|
/**
|
|
459
463
|
* Attachments.
|
|
460
|
-
|
|
464
|
+
* @type {Record<string, RecordAttachmentHandle>} */
|
|
461
465
|
_attachments = {}
|
|
462
466
|
|
|
463
467
|
/**
|
|
@@ -468,12 +472,12 @@ class VelociousDatabaseRecord {
|
|
|
468
472
|
|
|
469
473
|
/**
|
|
470
474
|
* Table name.
|
|
471
|
-
|
|
475
|
+
* @type {string | undefined} */
|
|
472
476
|
__tableName = undefined
|
|
473
477
|
|
|
474
478
|
/**
|
|
475
479
|
* Validation errors.
|
|
476
|
-
|
|
480
|
+
* @type {Record<string, ValidationErrorObjectType[]>} */
|
|
477
481
|
_validationErrors = {}
|
|
478
482
|
|
|
479
483
|
static validatorTypes() {
|
|
@@ -667,9 +671,9 @@ class VelociousDatabaseRecord {
|
|
|
667
671
|
let relationship
|
|
668
672
|
const prototype = /**
|
|
669
673
|
* Narrows the runtime value to the documented type.
|
|
670
|
-
|
|
674
|
+
* @type {Record<string, ?>} */ (/**
|
|
671
675
|
* Narrows the runtime value to the documented type.
|
|
672
|
-
|
|
676
|
+
* @type {?} */ (this.prototype))
|
|
673
677
|
|
|
674
678
|
if (actualData.type == "belongsTo") {
|
|
675
679
|
relationship = new BelongsToRelationship(actualData)
|
|
@@ -682,10 +686,10 @@ class VelociousDatabaseRecord {
|
|
|
682
686
|
|
|
683
687
|
prototype[`build${inflection.camelize(relationshipName)}`] = function(/**
|
|
684
688
|
* Narrows the runtime value to the documented type.
|
|
685
|
-
|
|
689
|
+
* @type {Record<string, ?>} */ attributes) {
|
|
686
690
|
return buildRelatedRecordWithInverse(/**
|
|
687
691
|
* Narrows the runtime value to the documented type.
|
|
688
|
-
|
|
692
|
+
* @type {VelociousDatabaseRecord} */ (this), relationshipName, attributes, true)
|
|
689
693
|
}
|
|
690
694
|
|
|
691
695
|
prototype[`load${inflection.camelize(relationshipName)}`] = async function() {
|
|
@@ -698,7 +702,7 @@ class VelociousDatabaseRecord {
|
|
|
698
702
|
|
|
699
703
|
prototype[`set${inflection.camelize(relationshipName)}`] = function(/**
|
|
700
704
|
* Narrows the runtime value to the documented type.
|
|
701
|
-
|
|
705
|
+
* @type {?} */ model) {
|
|
702
706
|
const relationship = this.getRelationshipByName(relationshipName)
|
|
703
707
|
|
|
704
708
|
relationship.setLoaded(model)
|
|
@@ -708,7 +712,7 @@ class VelociousDatabaseRecord {
|
|
|
708
712
|
relationship = new HasManyRelationship(actualData)
|
|
709
713
|
|
|
710
714
|
prototype[relationshipName] = function() {
|
|
711
|
-
return /**
|
|
715
|
+
return /** @type {import("./instance-relationships/has-many.js").default<?, ?>} */ (this.getRelationshipByName(relationshipName))
|
|
712
716
|
}
|
|
713
717
|
|
|
714
718
|
prototype[`${relationshipName}Loaded`] = function() {
|
|
@@ -731,10 +735,10 @@ class VelociousDatabaseRecord {
|
|
|
731
735
|
|
|
732
736
|
prototype[`build${inflection.camelize(relationshipName)}`] = function(/**
|
|
733
737
|
* Narrows the runtime value to the documented type.
|
|
734
|
-
|
|
738
|
+
* @type {Record<string, ?>} */ attributes) {
|
|
735
739
|
return buildRelatedRecordWithInverse(/**
|
|
736
740
|
* Narrows the runtime value to the documented type.
|
|
737
|
-
|
|
741
|
+
* @type {VelociousDatabaseRecord} */ (this), relationshipName, attributes, false)
|
|
738
742
|
}
|
|
739
743
|
|
|
740
744
|
prototype[`load${inflection.camelize(relationshipName)}`] = async function() {
|
|
@@ -762,7 +766,7 @@ class VelociousDatabaseRecord {
|
|
|
762
766
|
return {
|
|
763
767
|
scope: /**
|
|
764
768
|
* Narrows the runtime value to the documented type.
|
|
765
|
-
|
|
769
|
+
* @type {RelationshipScopeCallback} */ (scopeOrOptions),
|
|
766
770
|
relationshipOptions: options || {}
|
|
767
771
|
}
|
|
768
772
|
}
|
|
@@ -835,7 +839,7 @@ class VelociousDatabaseRecord {
|
|
|
835
839
|
ChildModel.beforeSave(async (record) => {
|
|
836
840
|
const model = /**
|
|
837
841
|
* Narrows the runtime value to the documented type.
|
|
838
|
-
|
|
842
|
+
* @type {?} */ (record)
|
|
839
843
|
|
|
840
844
|
if (model.isNewRecord()) return
|
|
841
845
|
|
|
@@ -854,7 +858,7 @@ class VelociousDatabaseRecord {
|
|
|
854
858
|
ChildModel.afterSave(async (record) => {
|
|
855
859
|
const model = /**
|
|
856
860
|
* Narrows the runtime value to the documented type.
|
|
857
|
-
|
|
861
|
+
* @type {?} */ (record)
|
|
858
862
|
const prevKey = `_counterCachePrev_${relationshipName}`
|
|
859
863
|
const previousParentId = model[prevKey]
|
|
860
864
|
|
|
@@ -895,11 +899,11 @@ class VelociousDatabaseRecord {
|
|
|
895
899
|
if (!Object.hasOwn(this, "_relationships")) {
|
|
896
900
|
/**
|
|
897
901
|
* Narrows the runtime value to the documented type.
|
|
898
|
-
|
|
902
|
+
* @type {Record<string, import("./relationships/base.js").default>} */
|
|
899
903
|
this._relationships = {}
|
|
900
904
|
}
|
|
901
905
|
|
|
902
|
-
return /**
|
|
906
|
+
return /** @type {Record<string, import("./relationships/base.js").default>} */ (this._relationships)
|
|
903
907
|
}
|
|
904
908
|
|
|
905
909
|
/**
|
|
@@ -963,11 +967,11 @@ class VelociousDatabaseRecord {
|
|
|
963
967
|
// Object.prototype members.
|
|
964
968
|
/**
|
|
965
969
|
* Narrows the runtime value to the documented type.
|
|
966
|
-
|
|
970
|
+
* @type {Record<string, import("../query/query-data.js").QueryDataFn>} */
|
|
967
971
|
this._queryDataRegistrations = Object.create(null)
|
|
968
972
|
}
|
|
969
973
|
|
|
970
|
-
return /**
|
|
974
|
+
return /** @type {Record<string, import("../query/query-data.js").QueryDataFn>} */ (this._queryDataRegistrations)
|
|
971
975
|
}
|
|
972
976
|
|
|
973
977
|
/**
|
|
@@ -1126,7 +1130,7 @@ class VelociousDatabaseRecord {
|
|
|
1126
1130
|
|
|
1127
1131
|
if (/**
|
|
1128
1132
|
* Narrows the runtime value to the documented type.
|
|
1129
|
-
|
|
1133
|
+
* @type {?} */ (relationshipOptions)?.counterCache) {
|
|
1130
1134
|
this._registerCounterCacheCallbacks(relationshipName)
|
|
1131
1135
|
}
|
|
1132
1136
|
}
|
|
@@ -1150,17 +1154,18 @@ class VelociousDatabaseRecord {
|
|
|
1150
1154
|
|
|
1151
1155
|
/**
|
|
1152
1156
|
* Runs create.
|
|
1153
|
-
* @template {
|
|
1154
|
-
* @
|
|
1155
|
-
* @
|
|
1156
|
-
* @
|
|
1157
|
+
* @template {Record<string, ?>} CreateAttributes
|
|
1158
|
+
* @template {VelociousDatabaseRecord<CreateAttributes>} Model
|
|
1159
|
+
* @this {{new (changes?: CreateAttributes): Model} & typeof VelociousDatabaseRecord}
|
|
1160
|
+
* @param {CreateAttributes} [attributes] - Attributes.
|
|
1161
|
+
* @returns {Promise<Model>} - Resolves with the create.
|
|
1157
1162
|
*/
|
|
1158
1163
|
static async create(attributes) {
|
|
1159
1164
|
await this.ensureInitialized()
|
|
1160
1165
|
|
|
1161
1166
|
const record = /**
|
|
1162
1167
|
* Narrows the runtime value to the documented type.
|
|
1163
|
-
|
|
1168
|
+
* @type {Model} */ (new this(attributes))
|
|
1164
1169
|
|
|
1165
1170
|
await record.save()
|
|
1166
1171
|
|
|
@@ -1231,13 +1236,13 @@ class VelociousDatabaseRecord {
|
|
|
1231
1236
|
if (!Object.prototype.hasOwnProperty.call(this, "_acceptedNestedAttributes")) {
|
|
1232
1237
|
/**
|
|
1233
1238
|
* Narrows the runtime value to the documented type.
|
|
1234
|
-
|
|
1239
|
+
* @type {Record<string, {allowDestroy?: boolean, limit?: number, rejectIf?: (attributes: Record<string, ?>) => boolean}>} */
|
|
1235
1240
|
this._acceptedNestedAttributes = {}
|
|
1236
1241
|
}
|
|
1237
1242
|
|
|
1238
1243
|
/**
|
|
1239
1244
|
* Narrows the runtime value to the documented type.
|
|
1240
|
-
|
|
1245
|
+
* @type {Record<string, {allowDestroy?: boolean, limit?: number, rejectIf?: (attributes: Record<string, ?>) => boolean}>} */ (this._acceptedNestedAttributes)[relationshipName] = {...options}
|
|
1241
1246
|
}
|
|
1242
1247
|
|
|
1243
1248
|
/**
|
|
@@ -1278,9 +1283,9 @@ class VelociousDatabaseRecord {
|
|
|
1278
1283
|
|
|
1279
1284
|
const prototype = /**
|
|
1280
1285
|
* Narrows the runtime value to the documented type.
|
|
1281
|
-
|
|
1286
|
+
* @type {Record<string, ?>} */ (/**
|
|
1282
1287
|
* Narrows the runtime value to the documented type.
|
|
1283
|
-
|
|
1288
|
+
* @type {?} */ (this.prototype))
|
|
1284
1289
|
|
|
1285
1290
|
prototype[attachmentName] = function() {
|
|
1286
1291
|
return this.getAttachmentByName(attachmentName)
|
|
@@ -1288,7 +1293,7 @@ class VelociousDatabaseRecord {
|
|
|
1288
1293
|
|
|
1289
1294
|
prototype[`set${inflection.camelize(attachmentName)}`] = function(/**
|
|
1290
1295
|
* Narrows the runtime value to the documented type.
|
|
1291
|
-
|
|
1296
|
+
* @type {?} */ newValue) {
|
|
1292
1297
|
this.getAttachmentByName(attachmentName).queueAttach(newValue)
|
|
1293
1298
|
return newValue
|
|
1294
1299
|
}
|
|
@@ -1408,16 +1413,16 @@ class VelociousDatabaseRecord {
|
|
|
1408
1413
|
|
|
1409
1414
|
/**
|
|
1410
1415
|
* Narrows the runtime value to the documented type.
|
|
1411
|
-
|
|
1416
|
+
* @type {Record<string, import("../drivers/base-column.js").default>} */
|
|
1412
1417
|
this._columnsAsHash = {}
|
|
1413
1418
|
|
|
1414
1419
|
const columnNameToAttributeName = this.getColumnNameToAttributeNameMap()
|
|
1415
1420
|
const attributeNameToColumnName = this.getAttributeNameToColumnNameMap()
|
|
1416
1421
|
const prototype = /**
|
|
1417
1422
|
* Narrows the runtime value to the documented type.
|
|
1418
|
-
|
|
1423
|
+
* @type {Record<string, ?>} */ (/**
|
|
1419
1424
|
* Narrows the runtime value to the documented type.
|
|
1420
|
-
|
|
1425
|
+
* @type {?} */ (this.prototype))
|
|
1421
1426
|
|
|
1422
1427
|
for (const column of this._columns) {
|
|
1423
1428
|
this._columnsAsHash[column.getName()] = column
|
|
@@ -1438,7 +1443,7 @@ class VelociousDatabaseRecord {
|
|
|
1438
1443
|
if (!(`set${camelizedColumnNameBigFirst}` in prototype)) {
|
|
1439
1444
|
prototype[`set${camelizedColumnNameBigFirst}`] = function(/**
|
|
1440
1445
|
* Narrows the runtime value to the documented type.
|
|
1441
|
-
|
|
1446
|
+
* @type {?} */ newValue) {
|
|
1442
1447
|
return this._setColumnAttribute(camelizedColumnName, newValue)
|
|
1443
1448
|
}
|
|
1444
1449
|
}
|
|
@@ -1447,9 +1452,9 @@ class VelociousDatabaseRecord {
|
|
|
1447
1452
|
prototype[`has${camelizedColumnNameBigFirst}`] = function() {
|
|
1448
1453
|
const dynamicThis = /**
|
|
1449
1454
|
* Narrows the runtime value to the documented type.
|
|
1450
|
-
|
|
1455
|
+
* @type {Record<string, (...args: Array<?>) => ?>} */ (/**
|
|
1451
1456
|
* Narrows the runtime value to the documented type.
|
|
1452
|
-
|
|
1457
|
+
* @type {?} */ (this))
|
|
1453
1458
|
const value = dynamicThis[camelizedColumnName]()
|
|
1454
1459
|
|
|
1455
1460
|
return this._hasAttribute(value)
|
|
@@ -1545,9 +1550,9 @@ class VelociousDatabaseRecord {
|
|
|
1545
1550
|
const setterMethodName = `set${nameCamelized}`
|
|
1546
1551
|
const prototype = /**
|
|
1547
1552
|
* Narrows the runtime value to the documented type.
|
|
1548
|
-
|
|
1553
|
+
* @type {Record<string, ?>} */ (/**
|
|
1549
1554
|
* Narrows the runtime value to the documented type.
|
|
1550
|
-
|
|
1555
|
+
* @type {?} */ (this.prototype))
|
|
1551
1556
|
|
|
1552
1557
|
prototype[name] = function getTranslatedAttribute() {
|
|
1553
1558
|
const locale = this._getConfiguration().getLocale()
|
|
@@ -1558,9 +1563,9 @@ class VelociousDatabaseRecord {
|
|
|
1558
1563
|
prototype[`has${nameCamelized}`] = function hasTranslatedAttribute() {
|
|
1559
1564
|
const dynamicThis = /**
|
|
1560
1565
|
* Narrows the runtime value to the documented type.
|
|
1561
|
-
|
|
1566
|
+
* @type {Record<string, ?>} */ (/**
|
|
1562
1567
|
* Narrows the runtime value to the documented type.
|
|
1563
|
-
|
|
1568
|
+
* @type {?} */ (this))
|
|
1564
1569
|
const candidate = dynamicThis[name]
|
|
1565
1570
|
|
|
1566
1571
|
if (typeof candidate == "function") {
|
|
@@ -1574,7 +1579,7 @@ class VelociousDatabaseRecord {
|
|
|
1574
1579
|
|
|
1575
1580
|
prototype[setterMethodName] = function setTranslatedAttribute(/**
|
|
1576
1581
|
* Narrows the runtime value to the documented type.
|
|
1577
|
-
|
|
1582
|
+
* @type {?} */ newValue) {
|
|
1578
1583
|
const locale = this._getConfiguration().getLocale()
|
|
1579
1584
|
|
|
1580
1585
|
return this._setTranslatedAttribute(name, locale, newValue)
|
|
@@ -1592,16 +1597,16 @@ class VelociousDatabaseRecord {
|
|
|
1592
1597
|
|
|
1593
1598
|
prototype[setterMethodNameLocalized] = function setTranslatedAttributeWithLocale(/**
|
|
1594
1599
|
* Narrows the runtime value to the documented type.
|
|
1595
|
-
|
|
1600
|
+
* @type {?} */ newValue) {
|
|
1596
1601
|
return this._setTranslatedAttribute(name, locale, newValue)
|
|
1597
1602
|
}
|
|
1598
1603
|
|
|
1599
1604
|
prototype[hasMethodNameLocalized] = function hasTranslatedAttribute() {
|
|
1600
1605
|
const dynamicThis = /**
|
|
1601
1606
|
* Narrows the runtime value to the documented type.
|
|
1602
|
-
|
|
1607
|
+
* @type {Record<string, ?>} */ (/**
|
|
1603
1608
|
* Narrows the runtime value to the documented type.
|
|
1604
|
-
|
|
1609
|
+
* @type {?} */ (this))
|
|
1605
1610
|
const candidate = dynamicThis[getterMethodNameLocalized]
|
|
1606
1611
|
|
|
1607
1612
|
if (typeof candidate == "function") {
|
|
@@ -1725,7 +1730,7 @@ class VelociousDatabaseRecord {
|
|
|
1725
1730
|
getModelClass() {
|
|
1726
1731
|
const modelClass = /**
|
|
1727
1732
|
* Narrows the runtime value to the documented type.
|
|
1728
|
-
|
|
1733
|
+
* @type {typeof VelociousDatabaseRecord} */ (this.constructor)
|
|
1729
1734
|
|
|
1730
1735
|
return modelClass
|
|
1731
1736
|
}
|
|
@@ -1744,9 +1749,9 @@ class VelociousDatabaseRecord {
|
|
|
1744
1749
|
const setterName = this.getModelClass().findMemberNameInsensitive(this, requestedSetterName)
|
|
1745
1750
|
const dynamicThis = /**
|
|
1746
1751
|
* Narrows the runtime value to the documented type.
|
|
1747
|
-
|
|
1752
|
+
* @type {Record<string, (value: ?) => void>} */ (/**
|
|
1748
1753
|
* Narrows the runtime value to the documented type.
|
|
1749
|
-
|
|
1754
|
+
* @type {?} */ (this))
|
|
1750
1755
|
|
|
1751
1756
|
this.getModelClass()._assertHasBeenInitialized()
|
|
1752
1757
|
if (!this.getModelClass().isInitialized()) throw new Error(`${this.constructor.name} model isn't initialized yet`)
|
|
@@ -1948,7 +1953,7 @@ class VelociousDatabaseRecord {
|
|
|
1948
1953
|
if (!this._columnsAsHash) {
|
|
1949
1954
|
/**
|
|
1950
1955
|
* Narrows the runtime value to the documented type.
|
|
1951
|
-
|
|
1956
|
+
* @type {Record<string, import("../drivers/base-column.js").default>} */
|
|
1952
1957
|
this._columnsAsHash = {}
|
|
1953
1958
|
|
|
1954
1959
|
for (const column of this.getColumns()) {
|
|
@@ -1968,7 +1973,7 @@ class VelociousDatabaseRecord {
|
|
|
1968
1973
|
if (!this._columnTypeByName) {
|
|
1969
1974
|
/**
|
|
1970
1975
|
* Narrows the runtime value to the documented type.
|
|
1971
|
-
|
|
1976
|
+
* @type {Record<string, string | undefined>} */
|
|
1972
1977
|
this._columnTypeByName = {}
|
|
1973
1978
|
|
|
1974
1979
|
for (const column of this.getColumns()) {
|
|
@@ -2066,7 +2071,7 @@ class VelociousDatabaseRecord {
|
|
|
2066
2071
|
} catch {
|
|
2067
2072
|
/**
|
|
2068
2073
|
* Results.
|
|
2069
|
-
|
|
2074
|
+
* @type {{succeededRows: Array<?>[], failedRows: Array<?>[], errors: Array<{row: Array<?>, error: ?}>}} */
|
|
2070
2075
|
const results = {
|
|
2071
2076
|
succeededRows: [],
|
|
2072
2077
|
failedRows: [],
|
|
@@ -2329,7 +2334,7 @@ class VelociousDatabaseRecord {
|
|
|
2329
2334
|
if (!Object.prototype.hasOwnProperty.call(this, "_attributeCasts") || !this._attributeCasts) {
|
|
2330
2335
|
/**
|
|
2331
2336
|
* Narrows the runtime value to the documented type.
|
|
2332
|
-
|
|
2337
|
+
* @type {Record<string, string>} */
|
|
2333
2338
|
this._attributeCasts = {}
|
|
2334
2339
|
}
|
|
2335
2340
|
|
|
@@ -2480,7 +2485,7 @@ class VelociousDatabaseRecord {
|
|
|
2480
2485
|
|
|
2481
2486
|
/**
|
|
2482
2487
|
* Defines loaded.
|
|
2483
|
-
|
|
2488
|
+
* @type {VelociousDatabaseRecord[]} */
|
|
2484
2489
|
let loaded
|
|
2485
2490
|
|
|
2486
2491
|
const hasManyOrOneLoaded = instanceRelationship.getLoadedOrUndefined()
|
|
@@ -2540,7 +2545,7 @@ class VelociousDatabaseRecord {
|
|
|
2540
2545
|
|
|
2541
2546
|
/**
|
|
2542
2547
|
* Defines loaded.
|
|
2543
|
-
|
|
2548
|
+
* @type {VelociousDatabaseRecord[]} */
|
|
2544
2549
|
let loaded
|
|
2545
2550
|
|
|
2546
2551
|
if (hasManyOrOneLoaded === undefined) {
|
|
@@ -2860,12 +2865,12 @@ class VelociousDatabaseRecord {
|
|
|
2860
2865
|
for (const validatorName in validators) {
|
|
2861
2866
|
/**
|
|
2862
2867
|
* Defines validatorArgs.
|
|
2863
|
-
|
|
2868
|
+
* @type {Record<string, ?>} */
|
|
2864
2869
|
let validatorArgs
|
|
2865
2870
|
|
|
2866
2871
|
/**
|
|
2867
2872
|
* Use validator.
|
|
2868
|
-
|
|
2873
|
+
* @type {boolean} */
|
|
2869
2874
|
let useValidator = true
|
|
2870
2875
|
|
|
2871
2876
|
const validatorArgsCandidate = validators[validatorName]
|
|
@@ -2934,12 +2939,12 @@ class VelociousDatabaseRecord {
|
|
|
2934
2939
|
if (translation) {
|
|
2935
2940
|
/**
|
|
2936
2941
|
* Dict.
|
|
2937
|
-
|
|
2942
|
+
* @type {Record<string, ?>} */
|
|
2938
2943
|
const dict = translation
|
|
2939
2944
|
|
|
2940
2945
|
const attributeMethod = /**
|
|
2941
2946
|
* Narrows the runtime value to the documented type.
|
|
2942
|
-
|
|
2947
|
+
* @type {function() : string | undefined} */ (dict[name])
|
|
2943
2948
|
|
|
2944
2949
|
if (typeof attributeMethod == "function") {
|
|
2945
2950
|
return attributeMethod.bind(translation)()
|
|
@@ -2988,7 +2993,7 @@ class VelociousDatabaseRecord {
|
|
|
2988
2993
|
_setTranslatedAttribute(name, locale, newValue) {
|
|
2989
2994
|
/**
|
|
2990
2995
|
* Defines translation.
|
|
2991
|
-
|
|
2996
|
+
* @type {VelociousDatabaseRecord | TranslationBase | undefined} */
|
|
2992
2997
|
let translation
|
|
2993
2998
|
|
|
2994
2999
|
translation = this.translationsLoaded()?.find((translation) => translation.locale() == locale)
|
|
@@ -3001,7 +3006,7 @@ class VelociousDatabaseRecord {
|
|
|
3001
3006
|
|
|
3002
3007
|
/**
|
|
3003
3008
|
* Assignments.
|
|
3004
|
-
|
|
3009
|
+
* @type {Record<string, ?>} */
|
|
3005
3010
|
const assignments = {}
|
|
3006
3011
|
|
|
3007
3012
|
assignments[name] = newValue
|
|
@@ -3063,7 +3068,7 @@ class VelociousDatabaseRecord {
|
|
|
3063
3068
|
throw new Error(`No ability in context for ${this.name}. Pass an ability or configure ability resolver on the request`)
|
|
3064
3069
|
}
|
|
3065
3070
|
|
|
3066
|
-
return /**
|
|
3071
|
+
return /** @type {ModelClassQuery<MC>} */ (currentAbility.applyToQuery({
|
|
3067
3072
|
action,
|
|
3068
3073
|
modelClass: this,
|
|
3069
3074
|
query
|
|
@@ -3289,7 +3294,7 @@ class VelociousDatabaseRecord {
|
|
|
3289
3294
|
static preload(preload) {
|
|
3290
3295
|
const query = /**
|
|
3291
3296
|
* Narrows the runtime value to the documented type.
|
|
3292
|
-
|
|
3297
|
+
* @type {ModelClassQuery<MC>} */ (this._newQuery().preload(preload))
|
|
3293
3298
|
|
|
3294
3299
|
return query
|
|
3295
3300
|
}
|
|
@@ -3353,9 +3358,9 @@ class VelociousDatabaseRecord {
|
|
|
3353
3358
|
|
|
3354
3359
|
/**
|
|
3355
3360
|
* Runs constructor.
|
|
3356
|
-
* @param {
|
|
3361
|
+
* @param {WriteAttributes} changes - Changes.
|
|
3357
3362
|
*/
|
|
3358
|
-
constructor(changes = {}) {
|
|
3363
|
+
constructor(changes = /** @type {WriteAttributes} */ ({})) {
|
|
3359
3364
|
this.getModelClass()._assertHasBeenInitialized()
|
|
3360
3365
|
this._attributes = {}
|
|
3361
3366
|
this._changes = {}
|
|
@@ -3398,7 +3403,7 @@ class VelociousDatabaseRecord {
|
|
|
3398
3403
|
const columnNameToAttributeName = this.getModelClass().getColumnNameToAttributeNameMap()
|
|
3399
3404
|
/**
|
|
3400
3405
|
* Attributes.
|
|
3401
|
-
|
|
3406
|
+
* @type {Record<string, ?>} */
|
|
3402
3407
|
const attributes = {}
|
|
3403
3408
|
|
|
3404
3409
|
for (const columnName in data) {
|
|
@@ -3439,7 +3444,7 @@ class VelociousDatabaseRecord {
|
|
|
3439
3444
|
if (relationship.getDependent() == "restrict") {
|
|
3440
3445
|
const instanceRelationship = /**
|
|
3441
3446
|
* Narrows the runtime value to the documented type.
|
|
3442
|
-
|
|
3447
|
+
* @type {?} */ (this.getRelationshipByName(relationship.getRelationshipName()))
|
|
3443
3448
|
const count = await instanceRelationship.query().count()
|
|
3444
3449
|
|
|
3445
3450
|
if (count > 0) {
|
|
@@ -3457,7 +3462,7 @@ class VelociousDatabaseRecord {
|
|
|
3457
3462
|
|
|
3458
3463
|
/**
|
|
3459
3464
|
* Defines models.
|
|
3460
|
-
|
|
3465
|
+
* @type {VelociousDatabaseRecord[]} */
|
|
3461
3466
|
let models
|
|
3462
3467
|
|
|
3463
3468
|
if (instanceRelationship.getType() == "belongsTo") {
|
|
@@ -3497,7 +3502,7 @@ class VelociousDatabaseRecord {
|
|
|
3497
3502
|
|
|
3498
3503
|
/**
|
|
3499
3504
|
* Conditions.
|
|
3500
|
-
|
|
3505
|
+
* @type {Record<string, ?>} */
|
|
3501
3506
|
const conditions = {}
|
|
3502
3507
|
|
|
3503
3508
|
conditions[this.getModelClass().primaryKey()] = this.id()
|
|
@@ -3527,9 +3532,9 @@ class VelociousDatabaseRecord {
|
|
|
3527
3532
|
}
|
|
3528
3533
|
const dynamicThis = /**
|
|
3529
3534
|
* Narrows the runtime value to the documented type.
|
|
3530
|
-
|
|
3535
|
+
* @type {Record<string, ?>} */ (/**
|
|
3531
3536
|
* Narrows the runtime value to the documented type.
|
|
3532
|
-
|
|
3537
|
+
* @type {?} */ (this))
|
|
3533
3538
|
const methodCallback = dynamicThis[callback]
|
|
3534
3539
|
|
|
3535
3540
|
if (typeof methodCallback != "function") {
|
|
@@ -3544,9 +3549,9 @@ class VelociousDatabaseRecord {
|
|
|
3544
3549
|
|
|
3545
3550
|
const dynamicThis = /**
|
|
3546
3551
|
* Narrows the runtime value to the documented type.
|
|
3547
|
-
|
|
3552
|
+
* @type {Record<string, ?>} */ (/**
|
|
3548
3553
|
* Narrows the runtime value to the documented type.
|
|
3549
|
-
|
|
3554
|
+
* @type {?} */ (this))
|
|
3550
3555
|
const instanceCallback = dynamicThis[callbackName]
|
|
3551
3556
|
|
|
3552
3557
|
if (!callbackNameRegisteredAsString && typeof instanceCallback === "function") {
|
|
@@ -3600,7 +3605,7 @@ class VelociousDatabaseRecord {
|
|
|
3600
3605
|
changes() {
|
|
3601
3606
|
/**
|
|
3602
3607
|
* Changes.
|
|
3603
|
-
|
|
3608
|
+
* @type {Record<string, Array<?>>} */
|
|
3604
3609
|
const changes = {}
|
|
3605
3610
|
|
|
3606
3611
|
for (const changeKey in this._changes) {
|
|
@@ -3652,9 +3657,9 @@ class VelociousDatabaseRecord {
|
|
|
3652
3657
|
readCount(attributeName) {
|
|
3653
3658
|
return readPayloadAssociationCount(/**
|
|
3654
3659
|
* Narrows the runtime value to the documented type.
|
|
3655
|
-
|
|
3660
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3656
3661
|
* Narrows the runtime value to the documented type.
|
|
3657
|
-
|
|
3662
|
+
* @type {?} */ (this)), attributeName)
|
|
3658
3663
|
}
|
|
3659
3664
|
|
|
3660
3665
|
/**
|
|
@@ -3667,9 +3672,9 @@ class VelociousDatabaseRecord {
|
|
|
3667
3672
|
_setAssociationCount(attributeName, value) {
|
|
3668
3673
|
setPayloadAssociationCount(/**
|
|
3669
3674
|
* Narrows the runtime value to the documented type.
|
|
3670
|
-
|
|
3675
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3671
3676
|
* Narrows the runtime value to the documented type.
|
|
3672
|
-
|
|
3677
|
+
* @type {?} */ (this)), attributeName, value)
|
|
3673
3678
|
}
|
|
3674
3679
|
|
|
3675
3680
|
/**
|
|
@@ -3681,14 +3686,14 @@ class VelociousDatabaseRecord {
|
|
|
3681
3686
|
associationCounts() {
|
|
3682
3687
|
/**
|
|
3683
3688
|
* Result.
|
|
3684
|
-
|
|
3689
|
+
* @type {Record<string, number>} */
|
|
3685
3690
|
const result = {}
|
|
3686
3691
|
|
|
3687
3692
|
const target = /**
|
|
3688
3693
|
* Narrows the runtime value to the documented type.
|
|
3689
|
-
|
|
3694
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3690
3695
|
* Narrows the runtime value to the documented type.
|
|
3691
|
-
|
|
3696
|
+
* @type {?} */ (this))
|
|
3692
3697
|
|
|
3693
3698
|
if (!target._associationCounts) return result
|
|
3694
3699
|
|
|
@@ -3712,9 +3717,9 @@ class VelociousDatabaseRecord {
|
|
|
3712
3717
|
queryData(name) {
|
|
3713
3718
|
return readPayloadQueryData(/**
|
|
3714
3719
|
* Narrows the runtime value to the documented type.
|
|
3715
|
-
|
|
3720
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3716
3721
|
* Narrows the runtime value to the documented type.
|
|
3717
|
-
|
|
3722
|
+
* @type {?} */ (this)), name)
|
|
3718
3723
|
}
|
|
3719
3724
|
|
|
3720
3725
|
/**
|
|
@@ -3728,9 +3733,9 @@ class VelociousDatabaseRecord {
|
|
|
3728
3733
|
_setQueryData(name, value) {
|
|
3729
3734
|
setPayloadQueryData(/**
|
|
3730
3735
|
* Narrows the runtime value to the documented type.
|
|
3731
|
-
|
|
3736
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3732
3737
|
* Narrows the runtime value to the documented type.
|
|
3733
|
-
|
|
3738
|
+
* @type {?} */ (this)), name, value)
|
|
3734
3739
|
}
|
|
3735
3740
|
|
|
3736
3741
|
/**
|
|
@@ -3742,14 +3747,14 @@ class VelociousDatabaseRecord {
|
|
|
3742
3747
|
queryDataValues() {
|
|
3743
3748
|
/**
|
|
3744
3749
|
* Result.
|
|
3745
|
-
|
|
3750
|
+
* @type {Record<string, ?>} */
|
|
3746
3751
|
const result = {}
|
|
3747
3752
|
|
|
3748
3753
|
const target = /**
|
|
3749
3754
|
* Narrows the runtime value to the documented type.
|
|
3750
|
-
|
|
3755
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3751
3756
|
* Narrows the runtime value to the documented type.
|
|
3752
|
-
|
|
3757
|
+
* @type {?} */ (this))
|
|
3753
3758
|
|
|
3754
3759
|
if (!target._queryDataValues) return result
|
|
3755
3760
|
|
|
@@ -3774,9 +3779,9 @@ class VelociousDatabaseRecord {
|
|
|
3774
3779
|
can(action) {
|
|
3775
3780
|
return readPayloadComputedAbility(/**
|
|
3776
3781
|
* Narrows the runtime value to the documented type.
|
|
3777
|
-
|
|
3782
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3778
3783
|
* Narrows the runtime value to the documented type.
|
|
3779
|
-
|
|
3784
|
+
* @type {?} */ (this)), action)
|
|
3780
3785
|
}
|
|
3781
3786
|
|
|
3782
3787
|
/**
|
|
@@ -3790,9 +3795,9 @@ class VelociousDatabaseRecord {
|
|
|
3790
3795
|
_setComputedAbility(action, value) {
|
|
3791
3796
|
setPayloadComputedAbility(/**
|
|
3792
3797
|
* Narrows the runtime value to the documented type.
|
|
3793
|
-
|
|
3798
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3794
3799
|
* Narrows the runtime value to the documented type.
|
|
3795
|
-
|
|
3800
|
+
* @type {?} */ (this)), action, value)
|
|
3796
3801
|
}
|
|
3797
3802
|
|
|
3798
3803
|
/**
|
|
@@ -3804,14 +3809,14 @@ class VelociousDatabaseRecord {
|
|
|
3804
3809
|
computedAbilities() {
|
|
3805
3810
|
/**
|
|
3806
3811
|
* Result.
|
|
3807
|
-
|
|
3812
|
+
* @type {Record<string, boolean>} */
|
|
3808
3813
|
const result = {}
|
|
3809
3814
|
|
|
3810
3815
|
const target = /**
|
|
3811
3816
|
* Narrows the runtime value to the documented type.
|
|
3812
|
-
|
|
3817
|
+
* @type {import("../../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
3813
3818
|
* Narrows the runtime value to the documented type.
|
|
3814
|
-
|
|
3819
|
+
* @type {?} */ (this))
|
|
3815
3820
|
|
|
3816
3821
|
if (!target._computedAbilities) return result
|
|
3817
3822
|
|
|
@@ -3945,7 +3950,7 @@ class VelociousDatabaseRecord {
|
|
|
3945
3950
|
_belongsToChanges() {
|
|
3946
3951
|
/**
|
|
3947
3952
|
* Belongs to changes.
|
|
3948
|
-
|
|
3953
|
+
* @type {Record<string, ?>} */
|
|
3949
3954
|
const belongsToChanges = {}
|
|
3950
3955
|
|
|
3951
3956
|
if (this._instanceRelationships) {
|
|
@@ -4098,7 +4103,7 @@ class VelociousDatabaseRecord {
|
|
|
4098
4103
|
async _updateRecordWithChanges() {
|
|
4099
4104
|
/**
|
|
4100
4105
|
* Conditions.
|
|
4101
|
-
|
|
4106
|
+
* @type {Record<string, ?>} */
|
|
4102
4107
|
const conditions = {}
|
|
4103
4108
|
|
|
4104
4109
|
conditions[this.getModelClass().primaryKey()] = this.id()
|
|
@@ -4139,7 +4144,7 @@ class VelociousDatabaseRecord {
|
|
|
4139
4144
|
throw new Error(`Primary key ${primaryKey} doesn't exist in columns: ${Object.keys(this.getModelClass().getColumnNameToAttributeNameMap()).join(", ")}`)
|
|
4140
4145
|
}
|
|
4141
4146
|
|
|
4142
|
-
return /**
|
|
4147
|
+
return /** @type {number | string} */ (this.readAttribute(attributeName))
|
|
4143
4148
|
}
|
|
4144
4149
|
|
|
4145
4150
|
/**
|
|
@@ -4174,14 +4179,14 @@ class VelociousDatabaseRecord {
|
|
|
4174
4179
|
|
|
4175
4180
|
/**
|
|
4176
4181
|
* Where object.
|
|
4177
|
-
|
|
4182
|
+
* @type {Record<string, ?>} */
|
|
4178
4183
|
const whereObject = {}
|
|
4179
4184
|
|
|
4180
4185
|
whereObject[primaryKey] = id
|
|
4181
4186
|
|
|
4182
4187
|
const query = /**
|
|
4183
4188
|
* Narrows the runtime value to the documented type.
|
|
4184
|
-
|
|
4189
|
+
* @type {import("../query/model-class-query.js").default<MC>} */ (this.getModelClass().where(whereObject))
|
|
4185
4190
|
const reloadedModel = await query.first()
|
|
4186
4191
|
|
|
4187
4192
|
if (!reloadedModel) throw new Error(`${this.constructor.name}#${id} couldn't be reloaded - record didn't exist`)
|
|
@@ -4198,14 +4203,14 @@ class VelociousDatabaseRecord {
|
|
|
4198
4203
|
async reload() {
|
|
4199
4204
|
const recordId = /**
|
|
4200
4205
|
* Narrows the runtime value to the documented type.
|
|
4201
|
-
|
|
4206
|
+
* @type {string | number} */ (this.readAttribute("id"))
|
|
4202
4207
|
await this._reloadWithId(recordId)
|
|
4203
4208
|
}
|
|
4204
4209
|
|
|
4205
4210
|
async _runValidations() {
|
|
4206
4211
|
/**
|
|
4207
4212
|
* Narrows the runtime value to the documented type.
|
|
4208
|
-
|
|
4213
|
+
* @type {Record<string, {type: string, message: string}>} */
|
|
4209
4214
|
this._validationErrors = {}
|
|
4210
4215
|
|
|
4211
4216
|
const validators = this.getModelClass()._validators
|
|
@@ -4238,7 +4243,7 @@ class VelociousDatabaseRecord {
|
|
|
4238
4243
|
fullErrorMessages() {
|
|
4239
4244
|
/**
|
|
4240
4245
|
* Validation error messages.
|
|
4241
|
-
|
|
4246
|
+
* @type {string[]} */
|
|
4242
4247
|
const validationErrorMessages = []
|
|
4243
4248
|
|
|
4244
4249
|
if (this._validationErrors) {
|
|
@@ -4256,7 +4261,7 @@ class VelociousDatabaseRecord {
|
|
|
4256
4261
|
|
|
4257
4262
|
/**
|
|
4258
4263
|
* Assigns the attributes to the record and saves it.
|
|
4259
|
-
* @param {
|
|
4264
|
+
* @param {WriteAttributes} attributesToAssign - The attributes to assign to the record.
|
|
4260
4265
|
*/
|
|
4261
4266
|
async update(attributesToAssign) {
|
|
4262
4267
|
if (attributesToAssign) this.assign(attributesToAssign)
|
|
@@ -4265,16 +4270,10 @@ class VelociousDatabaseRecord {
|
|
|
4265
4270
|
}
|
|
4266
4271
|
}
|
|
4267
4272
|
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
* @returns {string} - The locale.
|
|
4273
|
-
*/
|
|
4274
|
-
locale() {
|
|
4275
|
-
throw new Error("'locale' not implemented")
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4273
|
+
/**
|
|
4274
|
+
* Translation record shape used by translated attributes.
|
|
4275
|
+
* @typedef {VelociousDatabaseRecord & {locale: function(): string}} TranslationBase
|
|
4276
|
+
*/
|
|
4278
4277
|
|
|
4279
4278
|
VelociousDatabaseRecord.registerValidatorType("format", ValidatorsFormat)
|
|
4280
4279
|
VelociousDatabaseRecord.registerValidatorType("presence", ValidatorsPresence)
|