velocious 1.0.449 → 1.0.450
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/application.js +4 -4
- package/build/authorization/ability.js +8 -8
- package/build/authorization/base-resource.js +4 -4
- package/build/background-jobs/cron-expression.js +1 -1
- package/build/background-jobs/forked-runner-child.js +1 -1
- package/build/background-jobs/job-registry.js +1 -1
- package/build/background-jobs/job-runner.js +1 -1
- package/build/background-jobs/job.js +1 -1
- package/build/background-jobs/json-socket.js +4 -4
- package/build/background-jobs/main.js +21 -21
- package/build/background-jobs/scheduler.js +7 -7
- package/build/background-jobs/store.js +7 -7
- package/build/background-jobs/web/controller.js +2 -2
- package/build/background-jobs/worker.js +12 -12
- package/build/beacon/client.js +11 -8
- package/build/beacon/in-process-broker.js +2 -2
- package/build/beacon/in-process-client.js +2 -2
- package/build/beacon/server.js +3 -3
- package/build/cli/browser-cli.js +1 -1
- package/build/cli/commands/db/base-command.js +2 -2
- package/build/cli/index.js +2 -2
- package/build/cli/tenant-database-command-helper.js +3 -3
- package/build/cli/use-browser-cli.js +1 -1
- package/build/configuration.js +38 -38
- package/build/controller.js +8 -8
- package/build/current-configuration.js +1 -1
- package/build/database/annotations-async-hooks.js +2 -2
- package/build/database/annotations.js +3 -3
- package/build/database/drivers/base-column.js +1 -1
- package/build/database/drivers/base-foreign-key.js +1 -1
- package/build/database/drivers/base-table.js +1 -1
- package/build/database/drivers/base.js +10 -10
- package/build/database/drivers/mssql/index.js +1 -1
- package/build/database/drivers/mssql/table.js +1 -1
- package/build/database/drivers/mysql/index.js +3 -3
- package/build/database/drivers/mysql/query.js +1 -1
- package/build/database/drivers/mysql/table.js +1 -1
- package/build/database/drivers/pgsql/index.js +2 -2
- package/build/database/drivers/sqlite/base.js +16 -16
- package/build/database/drivers/sqlite/index.js +11 -11
- package/build/database/drivers/sqlite/index.native.js +1 -1
- package/build/database/drivers/sqlite/index.web.js +3 -3
- package/build/database/drivers/sqlite/query.js +1 -1
- package/build/database/drivers/sqlite/query.web.js +1 -1
- package/build/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/build/database/drivers/sqlite/table.js +1 -1
- package/build/database/migrator/files-finder.js +1 -1
- package/build/database/migrator.js +6 -6
- package/build/database/pool/async-tracked-multi-connection.js +27 -27
- package/build/database/pool/base-methods-forward.js +4 -4
- package/build/database/pool/base.js +8 -8
- package/build/database/query/from-base.js +1 -1
- package/build/database/query/index.js +10 -10
- package/build/database/query/join-object.js +3 -3
- package/build/database/query/model-class-query.js +39 -39
- package/build/database/query/preloader/belongs-to.js +22 -22
- package/build/database/query/preloader/has-many.js +20 -20
- package/build/database/query/preloader/has-one.js +8 -8
- package/build/database/query/preloader/selection.js +3 -3
- package/build/database/query/preloader.js +8 -8
- package/build/database/query/query-data.js +9 -9
- package/build/database/query/where-model-class-hash.js +7 -7
- package/build/database/query/with-count.js +9 -9
- package/build/database/record/acts-as-list.js +15 -15
- package/build/database/record/attachments/handle.js +2 -2
- package/build/database/record/attachments/normalize-input.js +12 -12
- package/build/database/record/attachments/storage-drivers/s3.js +6 -6
- package/build/database/record/attachments/store.js +13 -13
- package/build/database/record/index.js +115 -121
- package/build/database/record/instance-relationships/base.js +11 -11
- package/build/database/record/instance-relationships/belongs-to.js +3 -3
- package/build/database/record/instance-relationships/has-many.js +8 -8
- package/build/database/record/instance-relationships/has-one.js +7 -7
- package/build/database/record/relationships/base.js +2 -2
- package/build/database/record/state-machine.js +7 -7
- package/build/database/record/validators/presence.js +1 -1
- package/build/database/record/validators/uniqueness.js +5 -5
- package/build/database/table-data/index.js +4 -4
- package/build/environment-handlers/base.js +2 -2
- package/build/environment-handlers/browser.js +7 -7
- package/build/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/build/environment-handlers/node/cli/commands/console.js +4 -4
- package/build/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/build/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +55 -17
- package/build/environment-handlers/node.js +6 -6
- package/build/frontend-model-controller.js +81 -82
- package/build/frontend-model-resource/base-resource.js +78 -115
- package/build/frontend-models/base.js +162 -149
- package/build/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/build/frontend-models/event-hook-models.js +2 -2
- package/build/frontend-models/outgoing-event-buffer.js +2 -2
- package/build/frontend-models/preloader.js +5 -5
- package/build/frontend-models/query.js +43 -38
- package/build/frontend-models/resource-definition.js +6 -6
- package/build/frontend-models/transport-serialization.js +11 -11
- package/build/frontend-models/use-destroyed-event.js +10 -10
- package/build/frontend-models/use-model-class-event.js +11 -11
- package/build/frontend-models/use-updated-event.js +11 -11
- package/build/frontend-models/websocket-channel.js +26 -17
- package/build/frontend-models/websocket-publishers.js +9 -9
- package/build/http-client/response.js +2 -2
- package/build/http-server/client/index.js +8 -8
- package/build/http-server/client/params-to-object.js +10 -10
- package/build/http-server/client/request-buffer/form-data-part.js +2 -2
- package/build/http-server/client/request-buffer/index.js +8 -8
- package/build/http-server/client/request-parser.js +3 -3
- package/build/http-server/client/request-runner.js +6 -6
- package/build/http-server/client/request-timing.js +5 -5
- package/build/http-server/client/request.js +1 -1
- package/build/http-server/client/response.js +5 -5
- package/build/http-server/client/websocket-request.js +4 -4
- package/build/http-server/client/websocket-session.js +18 -18
- package/build/http-server/development-reloader.js +5 -5
- package/build/http-server/index.js +12 -12
- package/build/http-server/remote-address.js +4 -4
- package/build/http-server/server-client.js +3 -3
- package/build/http-server/server-lock.js +4 -4
- package/build/http-server/websocket-channel-subscribers.js +3 -3
- package/build/http-server/websocket-channel.js +1 -1
- package/build/http-server/websocket-connection.js +1 -1
- package/build/http-server/websocket-event-log-store.js +6 -6
- package/build/http-server/websocket-events-host.js +2 -2
- package/build/http-server/worker-handler/in-process.js +7 -7
- package/build/http-server/worker-handler/index.js +4 -4
- package/build/http-server/worker-handler/worker-thread.js +3 -3
- package/build/logger/outputs/array-output.js +3 -3
- package/build/logger/outputs/console-output.js +1 -1
- package/build/logger/outputs/file-output.js +4 -4
- package/build/logger/outputs/stdout-output.js +1 -1
- package/build/logger.js +10 -10
- package/build/mailer/backends/smtp.js +3 -3
- package/build/mailer/base.js +8 -8
- package/build/mailer/delivery.js +4 -4
- package/build/plugins/sqljs-wasm-route-controller.js +1 -1
- package/build/routes/base-route.js +6 -6
- package/build/routes/basic-route.js +1 -1
- package/build/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/build/routes/index.js +1 -1
- package/build/routes/plugin-routes.js +1 -1
- package/build/routes/resolver.js +11 -11
- package/build/routes/resource-route.js +1 -1
- package/build/src/application.d.ts +3 -3
- package/build/src/application.d.ts.map +1 -1
- package/build/src/application.js +5 -5
- package/build/src/authorization/ability.d.ts +7 -7
- package/build/src/authorization/ability.d.ts.map +1 -1
- package/build/src/authorization/ability.js +9 -9
- package/build/src/authorization/base-resource.d.ts +1 -1
- package/build/src/authorization/base-resource.d.ts.map +1 -1
- package/build/src/authorization/base-resource.js +5 -5
- package/build/src/background-jobs/cron-expression.js +2 -2
- package/build/src/background-jobs/forked-runner-child.js +2 -2
- package/build/src/background-jobs/job-registry.d.ts +1 -1
- package/build/src/background-jobs/job-registry.d.ts.map +1 -1
- package/build/src/background-jobs/job-registry.js +2 -2
- package/build/src/background-jobs/job-runner.js +2 -2
- package/build/src/background-jobs/job.js +2 -2
- package/build/src/background-jobs/json-socket.d.ts +4 -4
- package/build/src/background-jobs/json-socket.d.ts.map +1 -1
- package/build/src/background-jobs/json-socket.js +5 -5
- package/build/src/background-jobs/main.d.ts +18 -18
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +22 -22
- package/build/src/background-jobs/scheduler.d.ts +5 -5
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +8 -8
- package/build/src/background-jobs/store.js +8 -8
- package/build/src/background-jobs/web/controller.js +3 -3
- package/build/src/background-jobs/worker.d.ts +6 -6
- package/build/src/background-jobs/worker.d.ts.map +1 -1
- package/build/src/background-jobs/worker.js +13 -13
- package/build/src/beacon/client.d.ts +4 -4
- package/build/src/beacon/client.d.ts.map +1 -1
- package/build/src/beacon/client.js +12 -9
- package/build/src/beacon/in-process-broker.d.ts.map +1 -1
- package/build/src/beacon/in-process-broker.js +3 -3
- package/build/src/beacon/in-process-client.d.ts +1 -1
- package/build/src/beacon/in-process-client.d.ts.map +1 -1
- package/build/src/beacon/in-process-client.js +3 -3
- package/build/src/beacon/server.d.ts +2 -2
- package/build/src/beacon/server.d.ts.map +1 -1
- package/build/src/beacon/server.js +4 -4
- package/build/src/cli/browser-cli.js +2 -2
- package/build/src/cli/commands/db/base-command.d.ts +2 -2
- package/build/src/cli/commands/db/base-command.d.ts.map +1 -1
- package/build/src/cli/commands/db/base-command.js +3 -3
- package/build/src/cli/index.js +3 -3
- package/build/src/cli/tenant-database-command-helper.d.ts +1 -1
- package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
- package/build/src/cli/tenant-database-command-helper.js +4 -4
- package/build/src/cli/use-browser-cli.js +2 -2
- package/build/src/configuration.d.ts +14 -14
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +39 -39
- package/build/src/controller.js +10 -10
- package/build/src/current-configuration.js +2 -2
- package/build/src/database/annotations-async-hooks.js +3 -3
- package/build/src/database/annotations.d.ts.map +1 -1
- package/build/src/database/annotations.js +4 -4
- package/build/src/database/drivers/base-column.d.ts +1 -1
- package/build/src/database/drivers/base-column.d.ts.map +1 -1
- package/build/src/database/drivers/base-column.js +2 -2
- package/build/src/database/drivers/base-foreign-key.d.ts +1 -1
- package/build/src/database/drivers/base-foreign-key.d.ts.map +1 -1
- package/build/src/database/drivers/base-foreign-key.js +2 -2
- package/build/src/database/drivers/base-table.d.ts +1 -1
- package/build/src/database/drivers/base-table.d.ts.map +1 -1
- package/build/src/database/drivers/base-table.js +2 -2
- package/build/src/database/drivers/base.d.ts +6 -6
- package/build/src/database/drivers/base.d.ts.map +1 -1
- package/build/src/database/drivers/base.js +11 -11
- package/build/src/database/drivers/mssql/index.js +2 -2
- package/build/src/database/drivers/mssql/table.js +2 -2
- package/build/src/database/drivers/mysql/index.js +4 -4
- package/build/src/database/drivers/mysql/query.js +2 -2
- package/build/src/database/drivers/mysql/table.js +2 -2
- package/build/src/database/drivers/pgsql/index.js +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/base.js +17 -17
- package/build/src/database/drivers/sqlite/index.d.ts +4 -4
- package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.js +12 -12
- package/build/src/database/drivers/sqlite/index.native.js +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.web.js +4 -4
- package/build/src/database/drivers/sqlite/query.js +2 -2
- package/build/src/database/drivers/sqlite/query.web.js +2 -2
- package/build/src/database/drivers/sqlite/sql/alter-table.js +3 -3
- package/build/src/database/drivers/sqlite/table.js +2 -2
- package/build/src/database/migrator/files-finder.js +2 -2
- package/build/src/database/migrator.d.ts +1 -1
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +7 -7
- package/build/src/database/pool/async-tracked-multi-connection.d.ts +9 -9
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +28 -28
- package/build/src/database/pool/base-methods-forward.js +7 -7
- package/build/src/database/pool/base.d.ts +1 -1
- package/build/src/database/pool/base.d.ts.map +1 -1
- package/build/src/database/pool/base.js +9 -9
- package/build/src/database/query/from-base.d.ts +1 -1
- package/build/src/database/query/from-base.d.ts.map +1 -1
- package/build/src/database/query/from-base.js +2 -2
- package/build/src/database/query/index.d.ts +4 -4
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +11 -11
- package/build/src/database/query/join-object.js +4 -4
- package/build/src/database/query/model-class-query.d.ts +4 -4
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +40 -40
- package/build/src/database/query/preloader/belongs-to.js +23 -23
- package/build/src/database/query/preloader/has-many.js +21 -21
- package/build/src/database/query/preloader/has-one.js +9 -9
- package/build/src/database/query/preloader/selection.js +4 -4
- package/build/src/database/query/preloader.js +9 -9
- package/build/src/database/query/query-data.js +10 -10
- package/build/src/database/query/where-model-class-hash.js +8 -8
- package/build/src/database/query/with-count.js +10 -10
- package/build/src/database/record/acts-as-list.js +20 -20
- package/build/src/database/record/attachments/handle.d.ts +1 -1
- package/build/src/database/record/attachments/handle.d.ts.map +1 -1
- package/build/src/database/record/attachments/handle.js +3 -3
- package/build/src/database/record/attachments/normalize-input.js +15 -15
- package/build/src/database/record/attachments/storage-drivers/s3.js +7 -7
- package/build/src/database/record/attachments/store.d.ts +2 -2
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +14 -14
- package/build/src/database/record/index.d.ts +18 -25
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +135 -141
- package/build/src/database/record/instance-relationships/base.d.ts +3 -3
- package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/base.js +13 -13
- package/build/src/database/record/instance-relationships/belongs-to.js +4 -4
- package/build/src/database/record/instance-relationships/has-many.js +9 -9
- package/build/src/database/record/instance-relationships/has-one.d.ts +1 -1
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +8 -8
- package/build/src/database/record/relationships/base.js +4 -4
- package/build/src/database/record/state-machine.js +8 -8
- package/build/src/database/record/validators/presence.js +2 -2
- package/build/src/database/record/validators/uniqueness.js +6 -6
- package/build/src/database/table-data/index.d.ts +4 -4
- package/build/src/database/table-data/index.d.ts.map +1 -1
- package/build/src/database/table-data/index.js +5 -5
- package/build/src/environment-handlers/base.js +3 -3
- package/build/src/environment-handlers/browser.d.ts +3 -3
- package/build/src/environment-handlers/browser.d.ts.map +1 -1
- package/build/src/environment-handlers/browser.js +8 -8
- package/build/src/environment-handlers/node/cli/commands/cli-command-context.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/console.js +5 -5
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +4 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +16 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +51 -17
- package/build/src/environment-handlers/node.d.ts +2 -2
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +7 -7
- package/build/src/frontend-model-controller.d.ts +5 -6
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +88 -89
- package/build/src/frontend-model-resource/base-resource.d.ts +36 -27
- package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/base-resource.js +67 -120
- package/build/src/frontend-models/base.d.ts +66 -58
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +171 -158
- package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -2
- package/build/src/frontend-models/event-hook-models.d.ts.map +1 -1
- package/build/src/frontend-models/event-hook-models.js +3 -3
- package/build/src/frontend-models/outgoing-event-buffer.d.ts +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.d.ts.map +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.js +3 -3
- package/build/src/frontend-models/preloader.js +6 -6
- package/build/src/frontend-models/query.d.ts +16 -8
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +43 -39
- package/build/src/frontend-models/resource-definition.js +7 -7
- package/build/src/frontend-models/transport-serialization.js +12 -12
- package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-destroyed-event.js +11 -11
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +12 -12
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +12 -12
- package/build/src/frontend-models/websocket-channel.d.ts +6 -1
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +26 -18
- package/build/src/frontend-models/websocket-publishers.js +11 -11
- package/build/src/http-client/response.d.ts +2 -2
- package/build/src/http-client/response.d.ts.map +1 -1
- package/build/src/http-client/response.js +3 -3
- package/build/src/http-server/client/index.d.ts +1 -1
- package/build/src/http-server/client/index.d.ts.map +1 -1
- package/build/src/http-server/client/index.js +9 -9
- package/build/src/http-server/client/params-to-object.js +11 -11
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts +2 -2
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/form-data-part.js +3 -3
- package/build/src/http-server/client/request-buffer/index.d.ts +4 -4
- package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/index.js +9 -9
- package/build/src/http-server/client/request-parser.d.ts +1 -1
- package/build/src/http-server/client/request-parser.d.ts.map +1 -1
- package/build/src/http-server/client/request-parser.js +4 -4
- package/build/src/http-server/client/request-runner.js +7 -7
- package/build/src/http-server/client/request-timing.d.ts +5 -5
- package/build/src/http-server/client/request-timing.d.ts.map +1 -1
- package/build/src/http-server/client/request-timing.js +6 -6
- package/build/src/http-server/client/request.js +2 -2
- package/build/src/http-server/client/response.d.ts +3 -3
- package/build/src/http-server/client/response.d.ts.map +1 -1
- package/build/src/http-server/client/response.js +6 -6
- package/build/src/http-server/client/websocket-request.d.ts +3 -3
- package/build/src/http-server/client/websocket-request.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-request.js +5 -5
- package/build/src/http-server/client/websocket-session.d.ts +6 -6
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +19 -19
- package/build/src/http-server/development-reloader.d.ts +3 -3
- package/build/src/http-server/development-reloader.d.ts.map +1 -1
- package/build/src/http-server/development-reloader.js +6 -6
- package/build/src/http-server/index.d.ts +7 -7
- package/build/src/http-server/index.d.ts.map +1 -1
- package/build/src/http-server/index.js +13 -13
- package/build/src/http-server/remote-address.js +6 -6
- package/build/src/http-server/server-client.js +4 -4
- package/build/src/http-server/server-lock.js +5 -5
- package/build/src/http-server/websocket-channel-subscribers.d.ts +1 -1
- package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel-subscribers.js +4 -4
- package/build/src/http-server/websocket-channel.d.ts +1 -1
- package/build/src/http-server/websocket-channel.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel.js +2 -2
- package/build/src/http-server/websocket-connection.d.ts +1 -1
- package/build/src/http-server/websocket-connection.d.ts.map +1 -1
- package/build/src/http-server/websocket-connection.js +2 -2
- package/build/src/http-server/websocket-event-log-store.d.ts +1 -1
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +7 -7
- package/build/src/http-server/websocket-events-host.d.ts +1 -1
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/in-process.js +9 -9
- package/build/src/http-server/worker-handler/index.d.ts +4 -4
- package/build/src/http-server/worker-handler/index.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/index.js +5 -5
- package/build/src/http-server/worker-handler/worker-thread.d.ts +2 -2
- package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/worker-thread.js +4 -4
- package/build/src/logger/outputs/array-output.d.ts +3 -3
- package/build/src/logger/outputs/array-output.d.ts.map +1 -1
- package/build/src/logger/outputs/array-output.js +4 -4
- package/build/src/logger/outputs/console-output.d.ts +1 -1
- package/build/src/logger/outputs/console-output.d.ts.map +1 -1
- package/build/src/logger/outputs/console-output.js +2 -2
- package/build/src/logger/outputs/file-output.d.ts +4 -4
- package/build/src/logger/outputs/file-output.d.ts.map +1 -1
- package/build/src/logger/outputs/file-output.js +5 -5
- package/build/src/logger/outputs/stdout-output.d.ts.map +1 -1
- package/build/src/logger/outputs/stdout-output.js +2 -2
- package/build/src/logger.d.ts.map +1 -1
- package/build/src/logger.js +11 -11
- package/build/src/mailer/backends/smtp.d.ts.map +1 -1
- package/build/src/mailer/backends/smtp.js +5 -5
- package/build/src/mailer/base.js +11 -11
- package/build/src/mailer/delivery.d.ts +3 -3
- package/build/src/mailer/delivery.d.ts.map +1 -1
- package/build/src/mailer/delivery.js +5 -5
- package/build/src/plugins/sqljs-wasm-route-controller.js +2 -2
- package/build/src/routes/base-route.d.ts +6 -6
- package/build/src/routes/base-route.d.ts.map +1 -1
- package/build/src/routes/base-route.js +7 -7
- package/build/src/routes/basic-route.js +2 -2
- package/build/src/routes/hooks/frontend-model-command-route-hook.js +2 -2
- package/build/src/routes/index.js +2 -2
- package/build/src/routes/plugin-routes.js +2 -2
- package/build/src/routes/resolver.d.ts +1 -1
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +13 -13
- package/build/src/routes/resource-route.d.ts +1 -1
- package/build/src/routes/resource-route.d.ts.map +1 -1
- package/build/src/routes/resource-route.js +2 -2
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts.map +1 -1
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.js +8 -8
- package/build/src/testing/expect-utils.js +13 -13
- package/build/src/testing/expect.d.ts +1 -1
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +9 -9
- package/build/src/testing/test-files-finder.d.ts +8 -8
- package/build/src/testing/test-files-finder.d.ts.map +1 -1
- package/build/src/testing/test-files-finder.js +9 -9
- package/build/src/testing/test-filter-parser.js +3 -3
- package/build/src/testing/test-runner.d.ts +2 -2
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +17 -17
- package/build/src/testing/test-suite-splitter.js +2 -2
- package/build/src/testing/test.d.ts +2 -2
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +16 -16
- package/build/src/utils/backtrace-cleaner.d.ts +1 -1
- package/build/src/utils/backtrace-cleaner.d.ts.map +1 -1
- package/build/src/utils/backtrace-cleaner.js +2 -2
- package/build/src/utils/format-value.js +2 -2
- package/build/src/utils/model-scope.js +2 -2
- package/build/src/utils/ransack.js +27 -27
- package/build/src/utils/with-tracked-stack-async-hooks.js +8 -8
- package/build/src/utils/with-tracked-stack.js +4 -4
- package/build/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/build/testing/expect-utils.js +11 -11
- package/build/testing/expect.js +7 -7
- package/build/testing/test-files-finder.js +8 -8
- package/build/testing/test-filter-parser.js +2 -2
- package/build/testing/test-runner.js +16 -16
- package/build/testing/test-suite-splitter.js +1 -1
- package/build/testing/test.js +15 -15
- package/build/utils/backtrace-cleaner.js +1 -1
- package/build/utils/format-value.js +1 -1
- package/build/utils/model-scope.js +1 -1
- package/build/utils/ransack.js +26 -26
- package/build/utils/with-tracked-stack-async-hooks.js +7 -7
- package/build/utils/with-tracked-stack.js +3 -3
- package/package.json +2 -1
- package/src/application.js +4 -4
- package/src/authorization/ability.js +8 -8
- package/src/authorization/base-resource.js +4 -4
- package/src/background-jobs/cron-expression.js +1 -1
- package/src/background-jobs/forked-runner-child.js +1 -1
- package/src/background-jobs/job-registry.js +1 -1
- package/src/background-jobs/job-runner.js +1 -1
- package/src/background-jobs/job.js +1 -1
- package/src/background-jobs/json-socket.js +4 -4
- package/src/background-jobs/main.js +21 -21
- package/src/background-jobs/scheduler.js +7 -7
- package/src/background-jobs/store.js +7 -7
- package/src/background-jobs/web/controller.js +2 -2
- package/src/background-jobs/worker.js +12 -12
- package/src/beacon/client.js +11 -8
- package/src/beacon/in-process-broker.js +2 -2
- package/src/beacon/in-process-client.js +2 -2
- package/src/beacon/server.js +3 -3
- package/src/cli/browser-cli.js +1 -1
- package/src/cli/commands/db/base-command.js +2 -2
- package/src/cli/index.js +2 -2
- package/src/cli/tenant-database-command-helper.js +3 -3
- package/src/cli/use-browser-cli.js +1 -1
- package/src/configuration.js +38 -38
- package/src/controller.js +8 -8
- package/src/current-configuration.js +1 -1
- package/src/database/annotations-async-hooks.js +2 -2
- package/src/database/annotations.js +3 -3
- package/src/database/drivers/base-column.js +1 -1
- package/src/database/drivers/base-foreign-key.js +1 -1
- package/src/database/drivers/base-table.js +1 -1
- package/src/database/drivers/base.js +10 -10
- package/src/database/drivers/mssql/index.js +1 -1
- package/src/database/drivers/mssql/table.js +1 -1
- package/src/database/drivers/mysql/index.js +3 -3
- package/src/database/drivers/mysql/query.js +1 -1
- package/src/database/drivers/mysql/table.js +1 -1
- package/src/database/drivers/pgsql/index.js +2 -2
- package/src/database/drivers/sqlite/base.js +16 -16
- package/src/database/drivers/sqlite/index.js +11 -11
- package/src/database/drivers/sqlite/index.native.js +1 -1
- package/src/database/drivers/sqlite/index.web.js +3 -3
- package/src/database/drivers/sqlite/query.js +1 -1
- package/src/database/drivers/sqlite/query.web.js +1 -1
- package/src/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/src/database/drivers/sqlite/table.js +1 -1
- package/src/database/migrator/files-finder.js +1 -1
- package/src/database/migrator.js +6 -6
- package/src/database/pool/async-tracked-multi-connection.js +27 -27
- package/src/database/pool/base-methods-forward.js +4 -4
- package/src/database/pool/base.js +8 -8
- package/src/database/query/from-base.js +1 -1
- package/src/database/query/index.js +10 -10
- package/src/database/query/join-object.js +3 -3
- package/src/database/query/model-class-query.js +39 -39
- package/src/database/query/preloader/belongs-to.js +22 -22
- package/src/database/query/preloader/has-many.js +20 -20
- package/src/database/query/preloader/has-one.js +8 -8
- package/src/database/query/preloader/selection.js +3 -3
- package/src/database/query/preloader.js +8 -8
- package/src/database/query/query-data.js +9 -9
- package/src/database/query/where-model-class-hash.js +7 -7
- package/src/database/query/with-count.js +9 -9
- package/src/database/record/acts-as-list.js +15 -15
- package/src/database/record/attachments/handle.js +2 -2
- package/src/database/record/attachments/normalize-input.js +12 -12
- package/src/database/record/attachments/storage-drivers/s3.js +6 -6
- package/src/database/record/attachments/store.js +13 -13
- package/src/database/record/index.js +115 -121
- package/src/database/record/instance-relationships/base.js +11 -11
- package/src/database/record/instance-relationships/belongs-to.js +3 -3
- package/src/database/record/instance-relationships/has-many.js +8 -8
- package/src/database/record/instance-relationships/has-one.js +7 -7
- package/src/database/record/relationships/base.js +2 -2
- package/src/database/record/state-machine.js +7 -7
- package/src/database/record/validators/presence.js +1 -1
- package/src/database/record/validators/uniqueness.js +5 -5
- package/src/database/table-data/index.js +4 -4
- package/src/environment-handlers/base.js +2 -2
- package/src/environment-handlers/browser.js +7 -7
- package/src/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/src/environment-handlers/node/cli/commands/console.js +4 -4
- package/src/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/src/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +55 -17
- package/src/environment-handlers/node.js +6 -6
- package/src/frontend-model-controller.js +81 -82
- package/src/frontend-model-resource/base-resource.js +78 -115
- package/src/frontend-models/base.js +162 -149
- package/src/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/src/frontend-models/event-hook-models.js +2 -2
- package/src/frontend-models/outgoing-event-buffer.js +2 -2
- package/src/frontend-models/preloader.js +5 -5
- package/src/frontend-models/query.js +43 -38
- package/src/frontend-models/resource-definition.js +6 -6
- package/src/frontend-models/transport-serialization.js +11 -11
- package/src/frontend-models/use-destroyed-event.js +10 -10
- package/src/frontend-models/use-model-class-event.js +11 -11
- package/src/frontend-models/use-updated-event.js +11 -11
- package/src/frontend-models/websocket-channel.js +26 -17
- package/src/frontend-models/websocket-publishers.js +9 -9
- package/src/http-client/response.js +2 -2
- package/src/http-server/client/index.js +8 -8
- package/src/http-server/client/params-to-object.js +10 -10
- package/src/http-server/client/request-buffer/form-data-part.js +2 -2
- package/src/http-server/client/request-buffer/index.js +8 -8
- package/src/http-server/client/request-parser.js +3 -3
- package/src/http-server/client/request-runner.js +6 -6
- package/src/http-server/client/request-timing.js +5 -5
- package/src/http-server/client/request.js +1 -1
- package/src/http-server/client/response.js +5 -5
- package/src/http-server/client/websocket-request.js +4 -4
- package/src/http-server/client/websocket-session.js +18 -18
- package/src/http-server/development-reloader.js +5 -5
- package/src/http-server/index.js +12 -12
- package/src/http-server/remote-address.js +4 -4
- package/src/http-server/server-client.js +3 -3
- package/src/http-server/server-lock.js +4 -4
- package/src/http-server/websocket-channel-subscribers.js +3 -3
- package/src/http-server/websocket-channel.js +1 -1
- package/src/http-server/websocket-connection.js +1 -1
- package/src/http-server/websocket-event-log-store.js +6 -6
- package/src/http-server/websocket-events-host.js +2 -2
- package/src/http-server/worker-handler/in-process.js +7 -7
- package/src/http-server/worker-handler/index.js +4 -4
- package/src/http-server/worker-handler/worker-thread.js +3 -3
- package/src/logger/outputs/array-output.js +3 -3
- package/src/logger/outputs/console-output.js +1 -1
- package/src/logger/outputs/file-output.js +4 -4
- package/src/logger/outputs/stdout-output.js +1 -1
- package/src/logger.js +10 -10
- package/src/mailer/backends/smtp.js +3 -3
- package/src/mailer/base.js +8 -8
- package/src/mailer/delivery.js +4 -4
- package/src/plugins/sqljs-wasm-route-controller.js +1 -1
- package/src/routes/base-route.js +6 -6
- package/src/routes/basic-route.js +1 -1
- package/src/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/src/routes/index.js +1 -1
- package/src/routes/plugin-routes.js +1 -1
- package/src/routes/resolver.js +11 -11
- package/src/routes/resource-route.js +1 -1
- package/src/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/src/testing/expect-utils.js +11 -11
- package/src/testing/expect.js +7 -7
- package/src/testing/test-files-finder.js +8 -8
- package/src/testing/test-filter-parser.js +2 -2
- package/src/testing/test-runner.js +16 -16
- package/src/testing/test-suite-splitter.js +1 -1
- package/src/testing/test.js +15 -15
- package/src/utils/backtrace-cleaner.js +1 -1
- package/src/utils/format-value.js +1 -1
- package/src/utils/model-scope.js +1 -1
- package/src/utils/ransack.js +26 -26
- package/src/utils/with-tracked-stack-async-hooks.js +7 -7
- package/src/utils/with-tracked-stack.js +3 -3
|
@@ -47,7 +47,7 @@ export function normalizeWithCount(spec) {
|
|
|
47
47
|
if (typeof spec === "object") {
|
|
48
48
|
/**
|
|
49
49
|
* Entries.
|
|
50
|
-
|
|
50
|
+
* @type {WithCountEntry[]} */
|
|
51
51
|
const entries = []
|
|
52
52
|
|
|
53
53
|
for (const [key, value] of Object.entries(spec)) {
|
|
@@ -63,7 +63,7 @@ export function normalizeWithCount(spec) {
|
|
|
63
63
|
if (typeof value === "object" && value !== null) {
|
|
64
64
|
/**
|
|
65
65
|
* Options.
|
|
66
|
-
|
|
66
|
+
* @type {{relationship?: string, where?: Record<string, ?>}} */
|
|
67
67
|
const options = value
|
|
68
68
|
entries.push({
|
|
69
69
|
attributeName: key,
|
|
@@ -112,7 +112,7 @@ export async function runWithCount({models, modelClass, entries}) {
|
|
|
112
112
|
const primaryKey = modelClass.primaryKey()
|
|
113
113
|
const parentIds = models.map((model) => /**
|
|
114
114
|
* Narrows the runtime value to the documented type.
|
|
115
|
-
|
|
115
|
+
* @type {string | number} */ (model.readColumn(primaryKey)))
|
|
116
116
|
|
|
117
117
|
for (const entry of entries) {
|
|
118
118
|
const counts = await countForEntry({entries, entry, modelClass, parentIds})
|
|
@@ -120,14 +120,14 @@ export async function runWithCount({models, modelClass, entries}) {
|
|
|
120
120
|
for (const model of models) {
|
|
121
121
|
const modelPrimaryKeyValue = /**
|
|
122
122
|
* Narrows the runtime value to the documented type.
|
|
123
|
-
|
|
123
|
+
* @type {string | number} */ (model.readColumn(primaryKey))
|
|
124
124
|
// Tolerate driver differences in numeric return types: SQLite
|
|
125
125
|
// returns integers as JS numbers, but MySQL's raw driver can
|
|
126
126
|
// return count primary keys as strings. Try both.
|
|
127
127
|
const resolvedCount = counts.has(modelPrimaryKeyValue)
|
|
128
128
|
? /**
|
|
129
129
|
* Narrows the runtime value to the documented type.
|
|
130
|
-
|
|
130
|
+
* @type {number} */ (counts.get(modelPrimaryKeyValue))
|
|
131
131
|
: Number(counts.get(String(modelPrimaryKeyValue)) ?? 0)
|
|
132
132
|
|
|
133
133
|
// Counts go on the record's dedicated association-count map,
|
|
@@ -170,7 +170,7 @@ async function countForEntry({entries, entry, modelClass, parentIds}) {
|
|
|
170
170
|
const foreignKey = relationship.getForeignKey()
|
|
171
171
|
/**
|
|
172
172
|
* Where conditions.
|
|
173
|
-
|
|
173
|
+
* @type {Record<string, ?>} */
|
|
174
174
|
const whereConditions = {[foreignKey]: parentIds}
|
|
175
175
|
|
|
176
176
|
if (relationship.getPolymorphic && relationship.getPolymorphic()) {
|
|
@@ -198,19 +198,19 @@ async function countForEntry({entries, entry, modelClass, parentIds}) {
|
|
|
198
198
|
|
|
199
199
|
const rows = /**
|
|
200
200
|
* Narrows the runtime value to the documented type.
|
|
201
|
-
|
|
201
|
+
* @type {Array<{parent_id: string | number, count_value: string | number}>} */ (
|
|
202
202
|
await countQuery._executeQuery()
|
|
203
203
|
)
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
206
|
* Counts.
|
|
207
|
-
|
|
207
|
+
* @type {Map<string | number, number>} */
|
|
208
208
|
const counts = new Map()
|
|
209
209
|
|
|
210
210
|
for (const row of rows) {
|
|
211
211
|
const parentId = /**
|
|
212
212
|
* Narrows the runtime value to the documented type.
|
|
213
|
-
|
|
213
|
+
* @type {string | number} */ (row.parent_id)
|
|
214
214
|
const countValue = Number(row.count_value) || 0
|
|
215
215
|
counts.set(parentId, countValue)
|
|
216
216
|
}
|
|
@@ -64,7 +64,7 @@ export default function registerActsAsListCallbacks(modelClass, positionColumn,
|
|
|
64
64
|
|
|
65
65
|
const modelClass = /**
|
|
66
66
|
* Narrows the runtime value to the documented type.
|
|
67
|
-
|
|
67
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
68
68
|
const posColumn = modelClass.getColumnNameForAttributeName(positionColumn)
|
|
69
69
|
const scopeCol = modelClass.getColumnNameForAttributeName(scope)
|
|
70
70
|
/** @type {Record<string, ?>} */
|
|
@@ -81,24 +81,24 @@ export default function registerActsAsListCallbacks(modelClass, positionColumn,
|
|
|
81
81
|
|
|
82
82
|
const oldPosition = posChanged ? /**
|
|
83
83
|
* Narrows the runtime value to the documented type.
|
|
84
|
-
|
|
84
|
+
* @type {number} */ (rawAttributes[posColumn]) : /**
|
|
85
85
|
* Narrows the runtime value to the documented type.
|
|
86
|
-
|
|
86
|
+
* @type {number} */ (record.readAttribute(positionColumn))
|
|
87
87
|
const newPosition = posChanged ? /**
|
|
88
88
|
* Narrows the runtime value to the documented type.
|
|
89
|
-
|
|
89
|
+
* @type {number} */ (changes[posColumn]) : /**
|
|
90
90
|
* Narrows the runtime value to the documented type.
|
|
91
|
-
|
|
91
|
+
* @type {number} */ (record.readAttribute(positionColumn))
|
|
92
92
|
const oldScopeValue = scopeChanged ? /**
|
|
93
93
|
* Narrows the runtime value to the documented type.
|
|
94
|
-
|
|
94
|
+
* @type {number} */ (rawAttributes[scopeCol]) : /**
|
|
95
95
|
* Narrows the runtime value to the documented type.
|
|
96
|
-
|
|
96
|
+
* @type {number} */ (record.readAttribute(scope))
|
|
97
97
|
const newScopeValue = scopeChanged ? /**
|
|
98
98
|
* Narrows the runtime value to the documented type.
|
|
99
|
-
|
|
99
|
+
* @type {number} */ (changes[scopeCol]) : /**
|
|
100
100
|
* Narrows the runtime value to the documented type.
|
|
101
|
-
|
|
101
|
+
* @type {number} */ (record.readAttribute(scope))
|
|
102
102
|
|
|
103
103
|
if (oldPosition == null || newPosition == null) return
|
|
104
104
|
if (newPosition === oldPosition && newScopeValue === oldScopeValue) return
|
|
@@ -212,7 +212,7 @@ function clearBelongsToChangeForScope(record) {
|
|
|
212
212
|
async function shiftPositionsUp({record, positionColumn, scope, fromPosition, toPosition, scopeValue, excludeRecordId}) {
|
|
213
213
|
const modelClass = /**
|
|
214
214
|
* Narrows the runtime value to the documented type.
|
|
215
|
-
|
|
215
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
216
216
|
const connection = modelClass.connection()
|
|
217
217
|
const tableName = modelClass._getTable().getName()
|
|
218
218
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -279,7 +279,7 @@ async function shiftPositionsUp({record, positionColumn, scope, fromPosition, to
|
|
|
279
279
|
async function shiftPositionsDown({record, positionColumn, scope, fromPosition, toPosition, scopeValue}) {
|
|
280
280
|
const modelClass = /**
|
|
281
281
|
* Narrows the runtime value to the documented type.
|
|
282
|
-
|
|
282
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
283
283
|
const connection = modelClass.connection()
|
|
284
284
|
const tableName = modelClass._getTable().getName()
|
|
285
285
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -337,7 +337,7 @@ async function shiftPositionsDown({record, positionColumn, scope, fromPosition,
|
|
|
337
337
|
async function highestPositionInScope({record, positionColumn, scope, scopeValue}) {
|
|
338
338
|
const modelClass = /**
|
|
339
339
|
* Narrows the runtime value to the documented type.
|
|
340
|
-
|
|
340
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
341
341
|
const connection = modelClass.connection()
|
|
342
342
|
const scopeColumnName = modelClass.getColumnNameForAttributeName(scope)
|
|
343
343
|
const positionColumnName = modelClass.getColumnNameForAttributeName(positionColumn)
|
|
@@ -370,11 +370,11 @@ async function highestPositionInScope({record, positionColumn, scope, scopeValue
|
|
|
370
370
|
function resolveScopeValue(record, scope) {
|
|
371
371
|
const attrValue = record.readAttribute(scope)
|
|
372
372
|
|
|
373
|
-
if (attrValue != null) return /**
|
|
373
|
+
if (attrValue != null) return /** @type {string | number} */ (attrValue)
|
|
374
374
|
|
|
375
375
|
const modelClass = /**
|
|
376
376
|
* Narrows the runtime value to the documented type.
|
|
377
|
-
|
|
377
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
378
378
|
const relationships = modelClass.getRelationshipsMap()
|
|
379
379
|
const scopeColumnName = modelClass.getColumnNameForAttributeName(scope)
|
|
380
380
|
|
|
@@ -412,7 +412,7 @@ function resolveScopeValue(record, scope) {
|
|
|
412
412
|
async function moveOutOfWay({record, positionColumn, scope, scopeValue, targetScopeValue}) {
|
|
413
413
|
const modelClass = /**
|
|
414
414
|
* Narrows the runtime value to the documented type.
|
|
415
|
-
|
|
415
|
+
* @type {typeof import("./index.js").default} */ (record.constructor)
|
|
416
416
|
const connection = modelClass.connection()
|
|
417
417
|
const tableName = modelClass._getTable().getName()
|
|
418
418
|
const resolvedScopeValue = scopeValue != null ? scopeValue : resolveScopeValue(record, scope)
|
|
@@ -39,7 +39,7 @@ function isArray(value) {
|
|
|
39
39
|
export default class RecordAttachmentHandle {
|
|
40
40
|
/**
|
|
41
41
|
* Pending inputs.
|
|
42
|
-
|
|
42
|
+
* @type {Array<?>} */
|
|
43
43
|
pendingInputs = []
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -155,7 +155,7 @@ export default class RecordAttachmentHandle {
|
|
|
155
155
|
const rows = await store.findMany({model: this.model, name: this.name})
|
|
156
156
|
/**
|
|
157
157
|
* Downloads.
|
|
158
|
-
|
|
158
|
+
* @type {RecordAttachmentDownload[]} */
|
|
159
159
|
const downloads = []
|
|
160
160
|
|
|
161
161
|
for (const row of rows) {
|
|
@@ -57,7 +57,7 @@ function isArrayBuffer(value) {
|
|
|
57
57
|
function isArrayBufferLike(value) {
|
|
58
58
|
return Boolean(value && typeof value === "object" && typeof /**
|
|
59
59
|
* Narrows the runtime value to the documented type.
|
|
60
|
-
|
|
60
|
+
* @type {?} */ (value).arrayBuffer === "function")
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
@@ -83,13 +83,13 @@ function toBuffer(value) {
|
|
|
83
83
|
async function uploadedFileBuffer(uploadedFile, environmentHandler) {
|
|
84
84
|
const memoryBuffer = /**
|
|
85
85
|
* Narrows the runtime value to the documented type.
|
|
86
|
-
|
|
86
|
+
* @type {{getBuffer?: () => Buffer}} */ (uploadedFile).getBuffer?.()
|
|
87
87
|
|
|
88
88
|
if (Buffer.isBuffer(memoryBuffer)) return memoryBuffer
|
|
89
89
|
|
|
90
90
|
const tempPath = /**
|
|
91
91
|
* Narrows the runtime value to the documented type.
|
|
92
|
-
|
|
92
|
+
* @type {{getPath?: () => string}} */ (uploadedFile).getPath?.()
|
|
93
93
|
|
|
94
94
|
if (typeof tempPath === "string" && tempPath.length > 0) {
|
|
95
95
|
if (!environmentHandler || typeof environmentHandler.readAttachmentInputFile !== "function") {
|
|
@@ -127,15 +127,15 @@ export default async function normalizeRecordAttachmentInput(input, args = {}) {
|
|
|
127
127
|
const environmentHandler = args.environmentHandler
|
|
128
128
|
/**
|
|
129
129
|
* Defines buffer.
|
|
130
|
-
|
|
130
|
+
* @type {Buffer} */
|
|
131
131
|
let buffer
|
|
132
132
|
/**
|
|
133
133
|
* Content type.
|
|
134
|
-
|
|
134
|
+
* @type {string | null} */
|
|
135
135
|
let contentType = null
|
|
136
136
|
/**
|
|
137
137
|
* Defines filename.
|
|
138
|
-
|
|
138
|
+
* @type {string | undefined} */
|
|
139
139
|
let filename
|
|
140
140
|
|
|
141
141
|
if (input instanceof UploadedFile) {
|
|
@@ -176,21 +176,21 @@ export default async function normalizeRecordAttachmentInput(input, args = {}) {
|
|
|
176
176
|
buffer = Buffer.from(arrayBuffer)
|
|
177
177
|
filename = typeof /**
|
|
178
178
|
* Narrows the runtime value to the documented type.
|
|
179
|
-
|
|
179
|
+
* @type {?} */ (input).name === "string" && /**
|
|
180
180
|
* Narrows the runtime value to the documented type.
|
|
181
|
-
|
|
181
|
+
* @type {?} */ (input).name.length > 0
|
|
182
182
|
? /**
|
|
183
183
|
* Narrows the runtime value to the documented type.
|
|
184
|
-
|
|
184
|
+
* @type {?} */ (input).name
|
|
185
185
|
: defaultFilename
|
|
186
186
|
contentType = typeof /**
|
|
187
187
|
* Narrows the runtime value to the documented type.
|
|
188
|
-
|
|
188
|
+
* @type {?} */ (input).type === "string" && /**
|
|
189
189
|
* Narrows the runtime value to the documented type.
|
|
190
|
-
|
|
190
|
+
* @type {?} */ (input).type.length > 0
|
|
191
191
|
? /**
|
|
192
192
|
* Narrows the runtime value to the documented type.
|
|
193
|
-
|
|
193
|
+
* @type {?} */ (input).type
|
|
194
194
|
: null
|
|
195
195
|
} else if (typeof input === "string" || Buffer.isBuffer(input) || isArrayBuffer(input) || isUint8Array(input)) {
|
|
196
196
|
buffer = toBuffer(input)
|
|
@@ -17,7 +17,7 @@ function throwS3ConfigurationError(message) {
|
|
|
17
17
|
function isReadableStream(value) {
|
|
18
18
|
return Boolean(value && typeof value === "object" && typeof /**
|
|
19
19
|
* Narrows the runtime value to the documented type.
|
|
20
|
-
|
|
20
|
+
* @type {?} */ (value).pipe === "function")
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -28,7 +28,7 @@ function isReadableStream(value) {
|
|
|
28
28
|
async function dynamicImport(specifier) {
|
|
29
29
|
const importer = /**
|
|
30
30
|
* Narrows the runtime value to the documented type.
|
|
31
|
-
|
|
31
|
+
* @type {(moduleSpecifier: string) => Promise<?>} */ (
|
|
32
32
|
new Function("moduleSpecifier", "return import(moduleSpecifier)")
|
|
33
33
|
)
|
|
34
34
|
|
|
@@ -51,17 +51,17 @@ async function streamToBuffer(value) {
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Chunks.
|
|
54
|
-
|
|
54
|
+
* @type {Buffer[]} */
|
|
55
55
|
const chunks = []
|
|
56
56
|
|
|
57
57
|
const readableStream = /**
|
|
58
58
|
* Narrows the runtime value to the documented type.
|
|
59
|
-
|
|
59
|
+
* @type {?} */ (value)
|
|
60
60
|
|
|
61
61
|
await new Promise((resolve, reject) => {
|
|
62
62
|
readableStream.on("data", (/**
|
|
63
63
|
* Narrows the runtime value to the documented type.
|
|
64
|
-
|
|
64
|
+
* @type {Buffer | Uint8Array | ArrayBuffer | string} */ chunk) => {
|
|
65
65
|
if (Buffer.isBuffer(chunk)) {
|
|
66
66
|
chunks.push(chunk)
|
|
67
67
|
} else if (chunk instanceof ArrayBuffer) {
|
|
@@ -145,7 +145,7 @@ export default class S3AttachmentStorageDriver {
|
|
|
145
145
|
const {S3Client} = await this.s3Runtime()
|
|
146
146
|
/**
|
|
147
147
|
* Client config.
|
|
148
|
-
|
|
148
|
+
* @type {Record<string, ?>} */
|
|
149
149
|
const clientConfig = {
|
|
150
150
|
region: this.options.region || process.env.VELOCIOUS_ATTACHMENTS_S3_REGION || "us-east-1"
|
|
151
151
|
}
|
|
@@ -8,10 +8,10 @@ const ATTACHMENTS_TABLE = "velocious_attachments"
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* AttachmentDriverConstructor type.
|
|
11
|
-
|
|
11
|
+
* @typedef {import("../../../configuration-types.js").AttachmentDriverConstructor} AttachmentDriverConstructor */
|
|
12
12
|
/**
|
|
13
13
|
* Stores by configuration.
|
|
14
|
-
|
|
14
|
+
* @type {WeakMap<import("../../../configuration.js").default, Map<string, RecordAttachmentsStore>>} */
|
|
15
15
|
const storesByConfiguration = new WeakMap()
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -78,11 +78,11 @@ export default class RecordAttachmentsStore {
|
|
|
78
78
|
this._contentBase64Nullable = true
|
|
79
79
|
/**
|
|
80
80
|
* Narrows the runtime value to the documented type.
|
|
81
|
-
|
|
81
|
+
* @type {Map<string, Record<string, ?>>} */
|
|
82
82
|
this._attachmentDriversByName = new Map()
|
|
83
83
|
/**
|
|
84
84
|
* Narrows the runtime value to the documented type.
|
|
85
|
-
|
|
85
|
+
* @type {Map<AttachmentDriverConstructor | Record<string, ?>, Record<string, ?>>} */
|
|
86
86
|
this._attachmentDriversByReference = new Map()
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -188,7 +188,7 @@ export default class RecordAttachmentsStore {
|
|
|
188
188
|
const position = replace ? 0 : await this._nextPosition({db, name, recordId, recordType})
|
|
189
189
|
/**
|
|
190
190
|
* Insert data.
|
|
191
|
-
|
|
191
|
+
* @type {Record<string, ?>} */
|
|
192
192
|
const insertData = {
|
|
193
193
|
byte_size: normalizedInput.byteSize,
|
|
194
194
|
content_base64: this._contentBase64Nullable ? null : normalizedInput.contentBase64,
|
|
@@ -396,14 +396,14 @@ export default class RecordAttachmentsStore {
|
|
|
396
396
|
*/
|
|
397
397
|
async attachmentDriverByName(driverName) {
|
|
398
398
|
if (this._attachmentDriversByName.has(driverName)) {
|
|
399
|
-
return /**
|
|
399
|
+
return /** @type {Record<string, ?>} */ (this._attachmentDriversByName.get(driverName))
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
const attachmentConfiguration = this.configuration.getAttachmentsConfiguration?.() || {}
|
|
403
403
|
const configuredDriver = attachmentConfiguration.drivers?.[driverName]
|
|
404
404
|
/**
|
|
405
405
|
* Defines attachmentDriver.
|
|
406
|
-
|
|
406
|
+
* @type {Record<string, ?>} */
|
|
407
407
|
let attachmentDriver
|
|
408
408
|
|
|
409
409
|
if (!configuredDriver) {
|
|
@@ -445,18 +445,18 @@ export default class RecordAttachmentsStore {
|
|
|
445
445
|
*/
|
|
446
446
|
attachmentDriverByReference({attachmentName, driverReference, modelClass}) {
|
|
447
447
|
if (this._attachmentDriversByReference.has(driverReference)) {
|
|
448
|
-
return /**
|
|
448
|
+
return /** @type {Record<string, ?>} */ (this._attachmentDriversByReference.get(driverReference))
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
/**
|
|
452
452
|
* Defines attachmentDriver.
|
|
453
|
-
|
|
453
|
+
* @type {Record<string, ?>} */
|
|
454
454
|
let attachmentDriver
|
|
455
455
|
|
|
456
456
|
if (typeof driverReference === "function") {
|
|
457
457
|
const DriverClass = /**
|
|
458
458
|
* Narrows the runtime value to the documented type.
|
|
459
|
-
|
|
459
|
+
* @type {AttachmentDriverConstructor} */ (driverReference)
|
|
460
460
|
|
|
461
461
|
attachmentDriver = new DriverClass({
|
|
462
462
|
attachmentName,
|
|
@@ -561,7 +561,7 @@ export default class RecordAttachmentsStore {
|
|
|
561
561
|
const rows = await query.results()
|
|
562
562
|
const currentRow = /**
|
|
563
563
|
* Narrows the runtime value to the documented type.
|
|
564
|
-
|
|
564
|
+
* @type {{position?: string | number | null} | undefined} */ (rows[0])
|
|
565
565
|
const current = Number(currentRow?.position)
|
|
566
566
|
|
|
567
567
|
if (!Number.isFinite(current)) return 0
|
|
@@ -579,13 +579,13 @@ export default class RecordAttachmentsStore {
|
|
|
579
579
|
const pool = this.configuration.getDatabasePool(this.databaseIdentifier)
|
|
580
580
|
/**
|
|
581
581
|
* Defines result.
|
|
582
|
-
|
|
582
|
+
* @type {T | undefined} */
|
|
583
583
|
let result
|
|
584
584
|
|
|
585
585
|
await pool.withConnection({name: "Record attachment store"}, async (db) => {
|
|
586
586
|
result = await callback(db)
|
|
587
587
|
})
|
|
588
588
|
|
|
589
|
-
return /**
|
|
589
|
+
return /** @type {T} */ (result)
|
|
590
590
|
}
|
|
591
591
|
}
|