velocious 1.0.461 → 1.0.462
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 +1 -3
- package/build/background-jobs/cron-expression.js +1 -3
- package/build/background-jobs/forked-runner-child.js +1 -3
- package/build/background-jobs/job.js +1 -3
- package/build/background-jobs/scheduler.js +2 -6
- package/build/background-jobs/store.js +2 -6
- package/build/background-jobs/web/controller.js +1 -3
- package/build/background-jobs/worker.js +1 -3
- package/build/beacon/client.js +2 -6
- package/build/cli/tenant-database-command-helper.js +1 -3
- package/build/configuration.js +29 -32
- package/build/controller.js +4 -14
- package/build/database/drivers/mssql/index.js +1 -3
- package/build/database/drivers/mysql/index.js +2 -6
- package/build/database/drivers/pgsql/index.js +1 -3
- package/build/database/drivers/sqlite/base.js +3 -9
- package/build/database/drivers/sqlite/index.js +3 -9
- package/build/database/drivers/sqlite/table.js +1 -3
- package/build/database/migrator.js +1 -3
- package/build/database/pool/async-tracked-multi-connection.js +20 -45
- package/build/database/pool/base-methods-forward.js +2 -10
- package/build/database/pool/base.js +5 -15
- package/build/database/query/index.js +4 -12
- package/build/database/query/join-object.js +3 -9
- package/build/database/query/model-class-query.js +21 -63
- package/build/database/query/preloader/belongs-to.js +9 -27
- package/build/database/query/preloader/has-many.js +7 -21
- package/build/database/query/preloader/has-one.js +3 -9
- package/build/database/query/preloader.js +6 -18
- package/build/database/query/query-data.js +5 -15
- package/build/database/query/where-model-class-hash.js +5 -15
- package/build/database/query/with-count.js +5 -15
- package/build/database/record/acts-as-list.js +10 -38
- package/build/database/record/attachments/normalize-input.js +7 -25
- package/build/database/record/attachments/storage-drivers/s3.js +4 -12
- package/build/database/record/attachments/store.js +2 -6
- package/build/database/record/index.js +55 -171
- package/build/database/record/instance-relationships/base.js +6 -20
- package/build/database/record/instance-relationships/belongs-to.js +2 -6
- package/build/database/record/instance-relationships/has-many.js +4 -12
- package/build/database/record/instance-relationships/has-one.js +4 -12
- package/build/database/record/relationships/base.js +1 -5
- package/build/database/record/validators/presence.js +1 -3
- package/build/database/record/validators/uniqueness.js +4 -12
- package/build/environment-handlers/browser.js +1 -3
- package/build/environment-handlers/node/cli/commands/console.js +2 -6
- package/build/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
- package/build/environment-handlers/node.js +15 -6
- package/build/frontend-model-controller.js +34 -110
- package/build/frontend-models/base.js +45 -151
- package/build/frontend-models/clear-pending-debounced-callback.js +1 -3
- package/build/frontend-models/preloader.js +3 -9
- package/build/frontend-models/query.js +11 -33
- package/build/frontend-models/resource-definition.js +2 -6
- package/build/frontend-models/transport-serialization.js +7 -21
- package/build/frontend-models/use-destroyed-event.js +2 -6
- package/build/frontend-models/use-model-class-event.js +2 -6
- package/build/frontend-models/use-updated-event.js +3 -9
- package/build/frontend-models/websocket-channel.js +9 -27
- package/build/frontend-models/websocket-publishers.js +12 -23
- package/build/http-server/client/index.js +6 -18
- package/build/http-server/client/params-to-object.js +6 -18
- package/build/http-server/client/request-buffer/index.js +1 -3
- package/build/http-server/client/request-parser.js +1 -3
- package/build/http-server/client/request-runner.js +4 -12
- package/build/http-server/client/websocket-session.js +6 -18
- package/build/http-server/development-reloader.js +2 -6
- package/build/http-server/remote-address.js +1 -5
- package/build/http-server/server-client.js +3 -9
- package/build/http-server/server-lock.js +2 -6
- package/build/http-server/websocket-channel-subscribers.js +2 -6
- package/build/http-server/websocket-event-log-store.js +5 -15
- package/build/http-server/websocket-events-host.js +1 -3
- package/build/http-server/worker-handler/in-process.js +3 -11
- package/build/http-server/worker-handler/worker-thread.js +1 -3
- package/build/logger.js +2 -6
- package/build/mailer/backends/smtp.js +1 -5
- package/build/mailer/base.js +4 -16
- package/build/plugins/sqljs-wasm-route-controller.js +1 -3
- package/build/routes/basic-route.js +1 -3
- package/build/routes/resolver.js +4 -14
- package/build/src/application.d.ts.map +1 -1
- package/build/src/application.js +2 -4
- package/build/src/background-jobs/cron-expression.d.ts.map +1 -1
- package/build/src/background-jobs/cron-expression.js +2 -4
- package/build/src/background-jobs/forked-runner-child.js +2 -4
- package/build/src/background-jobs/job.d.ts.map +1 -1
- package/build/src/background-jobs/job.js +2 -4
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +3 -7
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +3 -7
- package/build/src/background-jobs/web/controller.d.ts.map +1 -1
- package/build/src/background-jobs/web/controller.js +2 -5
- package/build/src/background-jobs/worker.d.ts.map +1 -1
- package/build/src/background-jobs/worker.js +2 -4
- package/build/src/beacon/client.d.ts.map +1 -1
- package/build/src/beacon/client.js +3 -7
- package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
- package/build/src/cli/tenant-database-command-helper.js +2 -4
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +27 -35
- package/build/src/controller.d.ts.map +1 -1
- package/build/src/controller.js +5 -15
- package/build/src/database/drivers/mssql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/index.js +2 -4
- package/build/src/database/drivers/mysql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mysql/index.js +3 -7
- package/build/src/database/drivers/pgsql/index.d.ts.map +1 -1
- package/build/src/database/drivers/pgsql/index.js +2 -4
- package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/base.js +4 -10
- package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.js +4 -10
- package/build/src/database/drivers/sqlite/table.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/table.js +2 -4
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +2 -4
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +21 -47
- package/build/src/database/pool/base-methods-forward.d.ts.map +1 -1
- package/build/src/database/pool/base-methods-forward.js +3 -11
- package/build/src/database/pool/base.d.ts.map +1 -1
- package/build/src/database/pool/base.js +6 -16
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +5 -13
- package/build/src/database/query/join-object.d.ts.map +1 -1
- package/build/src/database/query/join-object.js +4 -10
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +22 -64
- package/build/src/database/query/preloader/belongs-to.d.ts.map +1 -1
- package/build/src/database/query/preloader/belongs-to.js +10 -28
- package/build/src/database/query/preloader/has-many.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-many.js +8 -22
- package/build/src/database/query/preloader/has-one.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-one.js +4 -10
- package/build/src/database/query/preloader.d.ts.map +1 -1
- package/build/src/database/query/preloader.js +7 -20
- package/build/src/database/query/query-data.d.ts.map +1 -1
- package/build/src/database/query/query-data.js +6 -16
- package/build/src/database/query/where-model-class-hash.d.ts.map +1 -1
- package/build/src/database/query/where-model-class-hash.js +6 -16
- package/build/src/database/query/with-count.d.ts.map +1 -1
- package/build/src/database/query/with-count.js +6 -17
- package/build/src/database/record/acts-as-list.d.ts.map +1 -1
- package/build/src/database/record/acts-as-list.js +11 -47
- package/build/src/database/record/attachments/normalize-input.d.ts.map +1 -1
- package/build/src/database/record/attachments/normalize-input.js +8 -30
- package/build/src/database/record/attachments/storage-drivers/s3.d.ts.map +1 -1
- package/build/src/database/record/attachments/storage-drivers/s3.js +5 -13
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +3 -7
- package/build/src/database/record/index.d.ts +4 -9
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +53 -173
- package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/base.js +7 -21
- package/build/src/database/record/instance-relationships/belongs-to.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/belongs-to.js +3 -7
- package/build/src/database/record/instance-relationships/has-many.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-many.js +5 -13
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +5 -13
- package/build/src/database/record/relationships/base.d.ts.map +1 -1
- package/build/src/database/record/relationships/base.js +2 -6
- package/build/src/database/record/validators/presence.d.ts.map +1 -1
- package/build/src/database/record/validators/presence.js +2 -4
- package/build/src/database/record/validators/uniqueness.d.ts.map +1 -1
- package/build/src/database/record/validators/uniqueness.js +5 -14
- package/build/src/environment-handlers/browser.d.ts.map +1 -1
- package/build/src/environment-handlers/browser.js +2 -4
- package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/console.js +3 -7
- 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 +2 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +38 -0
- 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 +58 -12
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +16 -7
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +35 -114
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +46 -158
- package/build/src/frontend-models/clear-pending-debounced-callback.d.ts.map +1 -1
- package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -4
- package/build/src/frontend-models/preloader.d.ts.map +1 -1
- package/build/src/frontend-models/preloader.js +4 -11
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +12 -34
- package/build/src/frontend-models/resource-definition.d.ts.map +1 -1
- package/build/src/frontend-models/resource-definition.js +3 -7
- package/build/src/frontend-models/transport-serialization.d.ts.map +1 -1
- package/build/src/frontend-models/transport-serialization.js +8 -23
- package/build/src/frontend-models/use-destroyed-event.js +3 -7
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +3 -7
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +4 -10
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +10 -32
- package/build/src/frontend-models/websocket-publishers.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-publishers.js +14 -25
- package/build/src/http-server/client/index.d.ts.map +1 -1
- package/build/src/http-server/client/index.js +7 -21
- package/build/src/http-server/client/params-to-object.d.ts.map +1 -1
- package/build/src/http-server/client/params-to-object.js +7 -21
- package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/index.js +2 -4
- package/build/src/http-server/client/request-parser.d.ts.map +1 -1
- package/build/src/http-server/client/request-parser.js +2 -4
- package/build/src/http-server/client/request-runner.d.ts.map +1 -1
- package/build/src/http-server/client/request-runner.js +5 -14
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +7 -20
- package/build/src/http-server/development-reloader.d.ts.map +1 -1
- package/build/src/http-server/development-reloader.js +3 -7
- package/build/src/http-server/remote-address.d.ts.map +1 -1
- package/build/src/http-server/remote-address.js +2 -6
- package/build/src/http-server/server-client.d.ts.map +1 -1
- package/build/src/http-server/server-client.js +4 -10
- package/build/src/http-server/server-lock.d.ts.map +1 -1
- package/build/src/http-server/server-lock.js +3 -7
- package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel-subscribers.js +3 -7
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +6 -16
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +2 -5
- package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/in-process.js +4 -12
- package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/worker-thread.js +2 -4
- package/build/src/logger.d.ts.map +1 -1
- package/build/src/logger.js +3 -7
- package/build/src/mailer/backends/smtp.d.ts.map +1 -1
- package/build/src/mailer/backends/smtp.js +2 -6
- package/build/src/mailer/base.d.ts.map +1 -1
- package/build/src/mailer/base.js +5 -17
- package/build/src/plugins/sqljs-wasm-route-controller.d.ts.map +1 -1
- package/build/src/plugins/sqljs-wasm-route-controller.js +2 -4
- package/build/src/routes/basic-route.d.ts.map +1 -1
- package/build/src/routes/basic-route.js +2 -4
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +5 -15
- package/build/src/testing/expect-utils.d.ts.map +1 -1
- package/build/src/testing/expect-utils.js +9 -27
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +5 -15
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +4 -10
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +5 -17
- package/build/src/utils/model-scope.d.ts.map +1 -1
- package/build/src/utils/model-scope.js +2 -5
- package/build/src/utils/ransack.d.ts.map +1 -1
- package/build/src/utils/ransack.js +15 -42
- package/build/src/utils/with-tracked-stack-async-hooks.d.ts.map +1 -1
- package/build/src/utils/with-tracked-stack-async-hooks.js +4 -12
- package/build/src/utils/with-tracked-stack.d.ts.map +1 -1
- package/build/src/utils/with-tracked-stack.js +3 -8
- package/build/testing/expect-utils.js +8 -26
- package/build/testing/expect.js +4 -14
- package/build/testing/test-runner.js +3 -9
- package/build/testing/test.js +4 -12
- package/build/utils/model-scope.js +1 -3
- package/build/utils/ransack.js +15 -41
- package/build/utils/with-tracked-stack-async-hooks.js +3 -9
- package/build/utils/with-tracked-stack.js +2 -6
- package/package.json +3 -2
- package/src/application.js +1 -3
- package/src/background-jobs/cron-expression.js +1 -3
- package/src/background-jobs/forked-runner-child.js +1 -3
- package/src/background-jobs/job.js +1 -3
- package/src/background-jobs/scheduler.js +2 -6
- package/src/background-jobs/store.js +2 -6
- package/src/background-jobs/web/controller.js +1 -3
- package/src/background-jobs/worker.js +1 -3
- package/src/beacon/client.js +2 -6
- package/src/cli/tenant-database-command-helper.js +1 -3
- package/src/configuration.js +29 -32
- package/src/controller.js +4 -14
- package/src/database/drivers/mssql/index.js +1 -3
- package/src/database/drivers/mysql/index.js +2 -6
- package/src/database/drivers/pgsql/index.js +1 -3
- package/src/database/drivers/sqlite/base.js +3 -9
- package/src/database/drivers/sqlite/index.js +3 -9
- package/src/database/drivers/sqlite/table.js +1 -3
- package/src/database/migrator.js +1 -3
- package/src/database/pool/async-tracked-multi-connection.js +20 -45
- package/src/database/pool/base-methods-forward.js +2 -10
- package/src/database/pool/base.js +5 -15
- package/src/database/query/index.js +4 -12
- package/src/database/query/join-object.js +3 -9
- package/src/database/query/model-class-query.js +21 -63
- package/src/database/query/preloader/belongs-to.js +9 -27
- package/src/database/query/preloader/has-many.js +7 -21
- package/src/database/query/preloader/has-one.js +3 -9
- package/src/database/query/preloader.js +6 -18
- package/src/database/query/query-data.js +5 -15
- package/src/database/query/where-model-class-hash.js +5 -15
- package/src/database/query/with-count.js +5 -15
- package/src/database/record/acts-as-list.js +10 -38
- package/src/database/record/attachments/normalize-input.js +7 -25
- package/src/database/record/attachments/storage-drivers/s3.js +4 -12
- package/src/database/record/attachments/store.js +2 -6
- package/src/database/record/index.js +55 -171
- package/src/database/record/instance-relationships/base.js +6 -20
- package/src/database/record/instance-relationships/belongs-to.js +2 -6
- package/src/database/record/instance-relationships/has-many.js +4 -12
- package/src/database/record/instance-relationships/has-one.js +4 -12
- package/src/database/record/relationships/base.js +1 -5
- package/src/database/record/validators/presence.js +1 -3
- package/src/database/record/validators/uniqueness.js +4 -12
- package/src/environment-handlers/browser.js +1 -3
- package/src/environment-handlers/node/cli/commands/console.js +2 -6
- package/src/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
- package/src/environment-handlers/node.js +15 -6
- package/src/frontend-model-controller.js +34 -110
- package/src/frontend-models/base.js +45 -151
- package/src/frontend-models/clear-pending-debounced-callback.js +1 -3
- package/src/frontend-models/preloader.js +3 -9
- package/src/frontend-models/query.js +11 -33
- package/src/frontend-models/resource-definition.js +2 -6
- package/src/frontend-models/transport-serialization.js +7 -21
- package/src/frontend-models/use-destroyed-event.js +2 -6
- package/src/frontend-models/use-model-class-event.js +2 -6
- package/src/frontend-models/use-updated-event.js +3 -9
- package/src/frontend-models/websocket-channel.js +9 -27
- package/src/frontend-models/websocket-publishers.js +12 -23
- package/src/http-server/client/index.js +6 -18
- package/src/http-server/client/params-to-object.js +6 -18
- package/src/http-server/client/request-buffer/index.js +1 -3
- package/src/http-server/client/request-parser.js +1 -3
- package/src/http-server/client/request-runner.js +4 -12
- package/src/http-server/client/websocket-session.js +6 -18
- package/src/http-server/development-reloader.js +2 -6
- package/src/http-server/remote-address.js +1 -5
- package/src/http-server/server-client.js +3 -9
- package/src/http-server/server-lock.js +2 -6
- package/src/http-server/websocket-channel-subscribers.js +2 -6
- package/src/http-server/websocket-event-log-store.js +5 -15
- package/src/http-server/websocket-events-host.js +1 -3
- package/src/http-server/worker-handler/in-process.js +3 -11
- package/src/http-server/worker-handler/worker-thread.js +1 -3
- package/src/logger.js +2 -6
- package/src/mailer/backends/smtp.js +1 -5
- package/src/mailer/base.js +4 -16
- package/src/plugins/sqljs-wasm-route-controller.js +1 -3
- package/src/routes/basic-route.js +1 -3
- package/src/routes/resolver.js +4 -14
- package/src/testing/expect-utils.js +8 -26
- package/src/testing/expect.js +4 -14
- package/src/testing/test-runner.js +3 -9
- package/src/testing/test.js +4 -12
- package/src/utils/model-scope.js +1 -3
- package/src/utils/ransack.js +15 -41
- package/src/utils/with-tracked-stack-async-hooks.js +3 -9
- package/src/utils/with-tracked-stack.js +2 -6
|
@@ -26,9 +26,7 @@ function normalizeRelationshipWhereOperator(operator) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return /** @type {"eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like"} */ (
|
|
29
|
-
operatorAliases[/**
|
|
30
|
-
* Narrows the runtime value to the documented type.
|
|
31
|
-
* @type {"<" | "<=" | ">" | ">="} */ (operator)] || operator
|
|
29
|
+
operatorAliases[/** @type {"<" | "<=" | ">" | ">="} */ (operator)] || operator
|
|
32
30
|
)
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -66,9 +64,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
66
64
|
toSql() {
|
|
67
65
|
let sql = "("
|
|
68
66
|
|
|
69
|
-
const modelQuery = /**
|
|
70
|
-
* Narrows the runtime value to the documented type.
|
|
71
|
-
* @type {import("./model-class-query.js").default} */ (this.query)
|
|
67
|
+
const modelQuery = /** @type {import("./model-class-query.js").default} */ (this.query)
|
|
72
68
|
const baseTableName = this.qualifyBaseTable
|
|
73
69
|
? modelQuery.getTableReferenceForJoin()
|
|
74
70
|
: undefined
|
|
@@ -144,9 +140,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
144
140
|
*/
|
|
145
141
|
const addCondition = (conditionValue) => {
|
|
146
142
|
if (this._isRelationshipWhereOperatorTuple(conditionValue)) {
|
|
147
|
-
const tuple = /**
|
|
148
|
-
* Narrows the runtime value to the documented type.
|
|
149
|
-
* @type {[string, "eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like" | ">" | ">=" | "<" | "<=", unknown, ...Array<unknown>]} */ (conditionValue)
|
|
143
|
+
const tuple = /** @type {[string, "eq" | "notEq" | "gt" | "gteq" | "lt" | "lteq" | "like" | ">" | ">=" | "<" | "<=", unknown, ...Array<unknown>]} */ (conditionValue)
|
|
150
144
|
const normalizedOperator = normalizeRelationshipWhereOperator(tuple[1])
|
|
151
145
|
|
|
152
146
|
normalized.push([
|
|
@@ -393,9 +387,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
393
387
|
*/
|
|
394
388
|
_whereSQLFromHash(hash, modelClass, path, tableName, index = 0) {
|
|
395
389
|
const options = this.getOptions()
|
|
396
|
-
const modelQuery = /**
|
|
397
|
-
* Narrows the runtime value to the documented type.
|
|
398
|
-
* @type {import("./model-class-query.js").default} */ (this.query)
|
|
390
|
+
const modelQuery = /** @type {import("./model-class-query.js").default} */ (this.query)
|
|
399
391
|
let sql = ""
|
|
400
392
|
|
|
401
393
|
for (const whereKey in hash) {
|
|
@@ -441,9 +433,7 @@ export default class VelociousDatabaseQueryWhereModelClassHash extends WhereBase
|
|
|
441
433
|
|
|
442
434
|
if (!targetModelClass) throw new Error(`Relationship "${whereKey}" for ${modelClass.name} has no target model class`)
|
|
443
435
|
|
|
444
|
-
const nestedHash = /**
|
|
445
|
-
* Narrows the runtime value to the documented type.
|
|
446
|
-
* @type {WhereHash} */ (whereValue)
|
|
436
|
+
const nestedHash = /** @type {WhereHash} */ (whereValue)
|
|
447
437
|
const nestedPath = path.concat([whereKey])
|
|
448
438
|
const nestedTableName = modelQuery.getTableReferenceForJoin(...nestedPath)
|
|
449
439
|
|
|
@@ -110,24 +110,18 @@ export async function runWithCount({models, modelClass, entries}) {
|
|
|
110
110
|
if (models.length === 0 || entries.length === 0) return
|
|
111
111
|
|
|
112
112
|
const primaryKey = modelClass.primaryKey()
|
|
113
|
-
const parentIds = models.map((model) => /**
|
|
114
|
-
* Narrows the runtime value to the documented type.
|
|
115
|
-
* @type {string | number} */ (model.readColumn(primaryKey)))
|
|
113
|
+
const parentIds = models.map((model) => /** @type {string | number} */ (model.readColumn(primaryKey)))
|
|
116
114
|
|
|
117
115
|
for (const entry of entries) {
|
|
118
116
|
const counts = await countForEntry({entries, entry, modelClass, parentIds})
|
|
119
117
|
|
|
120
118
|
for (const model of models) {
|
|
121
|
-
const modelPrimaryKeyValue = /**
|
|
122
|
-
* Narrows the runtime value to the documented type.
|
|
123
|
-
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
119
|
+
const modelPrimaryKeyValue = /** @type {string | number} */ (model.readColumn(primaryKey))
|
|
124
120
|
// Tolerate driver differences in numeric return types: SQLite
|
|
125
121
|
// returns integers as JS numbers, but MySQL's raw driver can
|
|
126
122
|
// return count primary keys as strings. Try both.
|
|
127
123
|
const resolvedCount = counts.has(modelPrimaryKeyValue)
|
|
128
|
-
? /**
|
|
129
|
-
* Narrows the runtime value to the documented type.
|
|
130
|
-
* @type {number} */ (counts.get(modelPrimaryKeyValue))
|
|
124
|
+
? /** @type {number} */ (counts.get(modelPrimaryKeyValue))
|
|
131
125
|
: Number(counts.get(String(modelPrimaryKeyValue)) ?? 0)
|
|
132
126
|
|
|
133
127
|
// Counts go on the record's dedicated association-count map,
|
|
@@ -196,9 +190,7 @@ async function countForEntry({entries, entry, modelClass, parentIds}) {
|
|
|
196
190
|
countQuery.select(`${quotedTable}.${quotedFk} AS parent_id`)
|
|
197
191
|
countQuery.select("COUNT(*) AS count_value")
|
|
198
192
|
|
|
199
|
-
const rows = /**
|
|
200
|
-
* Narrows the runtime value to the documented type.
|
|
201
|
-
* @type {Array<{parent_id: string | number, count_value: string | number}>} */ (
|
|
193
|
+
const rows = /** @type {Array<{parent_id: string | number, count_value: string | number}>} */ (
|
|
202
194
|
await countQuery._executeQuery()
|
|
203
195
|
)
|
|
204
196
|
|
|
@@ -208,9 +200,7 @@ async function countForEntry({entries, entry, modelClass, parentIds}) {
|
|
|
208
200
|
const counts = new Map()
|
|
209
201
|
|
|
210
202
|
for (const row of rows) {
|
|
211
|
-
const parentId = /**
|
|
212
|
-
* Narrows the runtime value to the documented type.
|
|
213
|
-
* @type {string | number} */ (row.parent_id)
|
|
203
|
+
const parentId = /** @type {string | number} */ (row.parent_id)
|
|
214
204
|
const countValue = Number(row.count_value) || 0
|
|
215
205
|
counts.set(parentId, countValue)
|
|
216
206
|
}
|
|
@@ -62,9 +62,7 @@ export default function registerActsAsListCallbacks(modelClass, positionColumn,
|
|
|
62
62
|
if (isShifting(record)) return
|
|
63
63
|
if (!record.isPersisted()) return
|
|
64
64
|
|
|
65
|
-
const modelClass = /**
|
|
66
|
-
* Narrows the runtime value to the documented type.
|
|
67
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
65
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
68
66
|
const posColumn = modelClass.getColumnNameForAttributeName(positionColumn)
|
|
69
67
|
const scopeCol = modelClass.getColumnNameForAttributeName(scope)
|
|
70
68
|
/** @type {Record<string, ?>} */
|
|
@@ -79,26 +77,10 @@ export default function registerActsAsListCallbacks(modelClass, positionColumn,
|
|
|
79
77
|
|
|
80
78
|
if (!posChanged && !scopeChanged) return
|
|
81
79
|
|
|
82
|
-
const oldPosition = posChanged ? /**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
* @type {number} */ (record.readAttribute(positionColumn))
|
|
87
|
-
const newPosition = posChanged ? /**
|
|
88
|
-
* Narrows the runtime value to the documented type.
|
|
89
|
-
* @type {number} */ (changes[posColumn]) : /**
|
|
90
|
-
* Narrows the runtime value to the documented type.
|
|
91
|
-
* @type {number} */ (record.readAttribute(positionColumn))
|
|
92
|
-
const oldScopeValue = scopeChanged ? /**
|
|
93
|
-
* Narrows the runtime value to the documented type.
|
|
94
|
-
* @type {number} */ (rawAttributes[scopeCol]) : /**
|
|
95
|
-
* Narrows the runtime value to the documented type.
|
|
96
|
-
* @type {number} */ (record.readAttribute(scope))
|
|
97
|
-
const newScopeValue = scopeChanged ? /**
|
|
98
|
-
* Narrows the runtime value to the documented type.
|
|
99
|
-
* @type {number} */ (changes[scopeCol]) : /**
|
|
100
|
-
* Narrows the runtime value to the documented type.
|
|
101
|
-
* @type {number} */ (record.readAttribute(scope))
|
|
80
|
+
const oldPosition = posChanged ? /** @type {number} */ (rawAttributes[posColumn]) : /** @type {number} */ (record.readAttribute(positionColumn))
|
|
81
|
+
const newPosition = posChanged ? /** @type {number} */ (changes[posColumn]) : /** @type {number} */ (record.readAttribute(positionColumn))
|
|
82
|
+
const oldScopeValue = scopeChanged ? /** @type {number} */ (rawAttributes[scopeCol]) : /** @type {number} */ (record.readAttribute(scope))
|
|
83
|
+
const newScopeValue = scopeChanged ? /** @type {number} */ (changes[scopeCol]) : /** @type {number} */ (record.readAttribute(scope))
|
|
102
84
|
|
|
103
85
|
if (oldPosition == null || newPosition == null) return
|
|
104
86
|
if (newPosition === oldPosition && newScopeValue === oldScopeValue) return
|
|
@@ -210,9 +192,7 @@ function clearBelongsToChangeForScope(record) {
|
|
|
210
192
|
* @returns {Promise<void>}
|
|
211
193
|
*/
|
|
212
194
|
async function shiftPositionsUp({record, positionColumn, scope, fromPosition, toPosition, scopeValue, excludeRecordId}) {
|
|
213
|
-
const modelClass = /**
|
|
214
|
-
* Narrows the runtime value to the documented type.
|
|
215
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
195
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
216
196
|
const connection = modelClass.connection()
|
|
217
197
|
const tableName = modelClass._getTable().getName()
|
|
218
198
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -277,9 +257,7 @@ async function shiftPositionsUp({record, positionColumn, scope, fromPosition, to
|
|
|
277
257
|
* @returns {Promise<void>}
|
|
278
258
|
*/
|
|
279
259
|
async function shiftPositionsDown({record, positionColumn, scope, fromPosition, toPosition, scopeValue}) {
|
|
280
|
-
const modelClass = /**
|
|
281
|
-
* Narrows the runtime value to the documented type.
|
|
282
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
260
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
283
261
|
const connection = modelClass.connection()
|
|
284
262
|
const tableName = modelClass._getTable().getName()
|
|
285
263
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -335,9 +313,7 @@ async function shiftPositionsDown({record, positionColumn, scope, fromPosition,
|
|
|
335
313
|
* @returns {Promise<number>} - Highest position in scope, or 0 when scope is empty.
|
|
336
314
|
*/
|
|
337
315
|
async function highestPositionInScope({record, positionColumn, scope, scopeValue}) {
|
|
338
|
-
const modelClass = /**
|
|
339
|
-
* Narrows the runtime value to the documented type.
|
|
340
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
316
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
341
317
|
const connection = modelClass.connection()
|
|
342
318
|
const scopeColumnName = modelClass.getColumnNameForAttributeName(scope)
|
|
343
319
|
const positionColumnName = modelClass.getColumnNameForAttributeName(positionColumn)
|
|
@@ -372,9 +348,7 @@ function resolveScopeValue(record, scope) {
|
|
|
372
348
|
|
|
373
349
|
if (attrValue != null) return /** @type {string | number} */ (attrValue)
|
|
374
350
|
|
|
375
|
-
const modelClass = /**
|
|
376
|
-
* Narrows the runtime value to the documented type.
|
|
377
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
351
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
378
352
|
const relationships = modelClass.getRelationshipsMap()
|
|
379
353
|
const scopeColumnName = modelClass.getColumnNameForAttributeName(scope)
|
|
380
354
|
|
|
@@ -410,9 +384,7 @@ function resolveScopeValue(record, scope) {
|
|
|
410
384
|
* @returns {Promise<void>}
|
|
411
385
|
*/
|
|
412
386
|
async function moveOutOfWay({record, positionColumn, scope, scopeValue, targetScopeValue}) {
|
|
413
|
-
const modelClass = /**
|
|
414
|
-
* Narrows the runtime value to the documented type.
|
|
415
|
-
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
387
|
+
const modelClass = /** @type {typeof import("./index.js").default} */ (record.constructor)
|
|
416
388
|
const connection = modelClass.connection()
|
|
417
389
|
const tableName = modelClass._getTable().getName()
|
|
418
390
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -55,9 +55,7 @@ function isArrayBuffer(value) {
|
|
|
55
55
|
* @returns {value is {arrayBuffer: () => Promise<ArrayBuffer>}} - Whether value supports arrayBuffer().
|
|
56
56
|
*/
|
|
57
57
|
function isArrayBufferLike(value) {
|
|
58
|
-
return Boolean(value && typeof value === "object" && typeof /**
|
|
59
|
-
* Narrows the runtime value to the documented type.
|
|
60
|
-
* @type {?} */ (value).arrayBuffer === "function")
|
|
58
|
+
return Boolean(value && typeof value === "object" && typeof /** @type {?} */ (value).arrayBuffer === "function")
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
/**
|
|
@@ -81,15 +79,11 @@ function toBuffer(value) {
|
|
|
81
79
|
* @returns {Promise<Buffer>} - File content buffer.
|
|
82
80
|
*/
|
|
83
81
|
async function uploadedFileBuffer(uploadedFile, environmentHandler) {
|
|
84
|
-
const memoryBuffer = /**
|
|
85
|
-
* Narrows the runtime value to the documented type.
|
|
86
|
-
* @type {{getBuffer?: () => Buffer}} */ (uploadedFile).getBuffer?.()
|
|
82
|
+
const memoryBuffer = /** @type {{getBuffer?: () => Buffer}} */ (uploadedFile).getBuffer?.()
|
|
87
83
|
|
|
88
84
|
if (Buffer.isBuffer(memoryBuffer)) return memoryBuffer
|
|
89
85
|
|
|
90
|
-
const tempPath = /**
|
|
91
|
-
* Narrows the runtime value to the documented type.
|
|
92
|
-
* @type {{getPath?: () => string}} */ (uploadedFile).getPath?.()
|
|
86
|
+
const tempPath = /** @type {{getPath?: () => string}} */ (uploadedFile).getPath?.()
|
|
93
87
|
|
|
94
88
|
if (typeof tempPath === "string" && tempPath.length > 0) {
|
|
95
89
|
if (!environmentHandler || typeof environmentHandler.readAttachmentInputFile !== "function") {
|
|
@@ -174,23 +168,11 @@ export default async function normalizeRecordAttachmentInput(input, args = {}) {
|
|
|
174
168
|
const arrayBuffer = await input.arrayBuffer()
|
|
175
169
|
|
|
176
170
|
buffer = Buffer.from(arrayBuffer)
|
|
177
|
-
filename = typeof /**
|
|
178
|
-
|
|
179
|
-
* @type {?} */ (input).name === "string" && /**
|
|
180
|
-
* Narrows the runtime value to the documented type.
|
|
181
|
-
* @type {?} */ (input).name.length > 0
|
|
182
|
-
? /**
|
|
183
|
-
* Narrows the runtime value to the documented type.
|
|
184
|
-
* @type {?} */ (input).name
|
|
171
|
+
filename = typeof /** @type {?} */ (input).name === "string" && /** @type {?} */ (input).name.length > 0
|
|
172
|
+
? /** @type {?} */ (input).name
|
|
185
173
|
: defaultFilename
|
|
186
|
-
contentType = typeof /**
|
|
187
|
-
|
|
188
|
-
* @type {?} */ (input).type === "string" && /**
|
|
189
|
-
* Narrows the runtime value to the documented type.
|
|
190
|
-
* @type {?} */ (input).type.length > 0
|
|
191
|
-
? /**
|
|
192
|
-
* Narrows the runtime value to the documented type.
|
|
193
|
-
* @type {?} */ (input).type
|
|
174
|
+
contentType = typeof /** @type {?} */ (input).type === "string" && /** @type {?} */ (input).type.length > 0
|
|
175
|
+
? /** @type {?} */ (input).type
|
|
194
176
|
: null
|
|
195
177
|
} else if (typeof input === "string" || Buffer.isBuffer(input) || isArrayBuffer(input) || isUint8Array(input)) {
|
|
196
178
|
buffer = toBuffer(input)
|
|
@@ -15,9 +15,7 @@ function throwS3ConfigurationError(message) {
|
|
|
15
15
|
* @returns {boolean} - Whether value is a readable stream.
|
|
16
16
|
*/
|
|
17
17
|
function isReadableStream(value) {
|
|
18
|
-
return Boolean(value && typeof value === "object" && typeof /**
|
|
19
|
-
* Narrows the runtime value to the documented type.
|
|
20
|
-
* @type {?} */ (value).pipe === "function")
|
|
18
|
+
return Boolean(value && typeof value === "object" && typeof /** @type {?} */ (value).pipe === "function")
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
/**
|
|
@@ -26,9 +24,7 @@ function isReadableStream(value) {
|
|
|
26
24
|
* @returns {Promise<?>} - Imported module.
|
|
27
25
|
*/
|
|
28
26
|
async function dynamicImport(specifier) {
|
|
29
|
-
const importer = /**
|
|
30
|
-
* Narrows the runtime value to the documented type.
|
|
31
|
-
* @type {(moduleSpecifier: string) => Promise<?>} */ (
|
|
27
|
+
const importer = /** @type {(moduleSpecifier: string) => Promise<?>} */ (
|
|
32
28
|
new Function("moduleSpecifier", "return import(moduleSpecifier)")
|
|
33
29
|
)
|
|
34
30
|
|
|
@@ -54,14 +50,10 @@ async function streamToBuffer(value) {
|
|
|
54
50
|
* @type {Buffer[]} */
|
|
55
51
|
const chunks = []
|
|
56
52
|
|
|
57
|
-
const readableStream = /**
|
|
58
|
-
* Narrows the runtime value to the documented type.
|
|
59
|
-
* @type {?} */ (value)
|
|
53
|
+
const readableStream = /** @type {?} */ (value)
|
|
60
54
|
|
|
61
55
|
await new Promise((resolve, reject) => {
|
|
62
|
-
readableStream.on("data", (/**
|
|
63
|
-
* Narrows the runtime value to the documented type.
|
|
64
|
-
* @type {Buffer | Uint8Array | ArrayBuffer | string} */ chunk) => {
|
|
56
|
+
readableStream.on("data", (/** @type {Buffer | Uint8Array | ArrayBuffer | string} */ chunk) => {
|
|
65
57
|
if (Buffer.isBuffer(chunk)) {
|
|
66
58
|
chunks.push(chunk)
|
|
67
59
|
} else if (chunk instanceof ArrayBuffer) {
|
|
@@ -456,9 +456,7 @@ export default class RecordAttachmentsStore {
|
|
|
456
456
|
let attachmentDriver
|
|
457
457
|
|
|
458
458
|
if (typeof driverReference === "function") {
|
|
459
|
-
const DriverClass = /**
|
|
460
|
-
* Narrows the runtime value to the documented type.
|
|
461
|
-
* @type {AttachmentDriverConstructor} */ (driverReference)
|
|
459
|
+
const DriverClass = /** @type {AttachmentDriverConstructor} */ (driverReference)
|
|
462
460
|
|
|
463
461
|
attachmentDriver = new DriverClass({
|
|
464
462
|
attachmentName,
|
|
@@ -561,9 +559,7 @@ export default class RecordAttachmentsStore {
|
|
|
561
559
|
.order("position DESC")
|
|
562
560
|
.limit(1)
|
|
563
561
|
const rows = await query.results()
|
|
564
|
-
const currentRow = /**
|
|
565
|
-
* Narrows the runtime value to the documented type.
|
|
566
|
-
* @type {{position?: string | number | null} | undefined} */ (rows[0])
|
|
562
|
+
const currentRow = /** @type {{position?: string | number | null} | undefined} */ (rows[0])
|
|
567
563
|
const current = Number(currentRow?.position)
|
|
568
564
|
|
|
569
565
|
if (!Number.isFinite(current)) return 0
|