velocious 1.0.449 → 1.0.451
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/application.js +4 -4
- package/build/authorization/ability.js +8 -8
- package/build/authorization/base-resource.js +4 -4
- package/build/background-jobs/cron-expression.js +1 -1
- package/build/background-jobs/forked-runner-child.js +1 -1
- package/build/background-jobs/job-registry.js +1 -1
- package/build/background-jobs/job-runner.js +1 -1
- package/build/background-jobs/job.js +1 -1
- package/build/background-jobs/json-socket.js +4 -4
- package/build/background-jobs/main.js +21 -21
- package/build/background-jobs/scheduler.js +7 -7
- package/build/background-jobs/store.js +7 -7
- package/build/background-jobs/web/controller.js +2 -2
- package/build/background-jobs/worker.js +12 -12
- package/build/beacon/client.js +11 -8
- package/build/beacon/in-process-broker.js +2 -2
- package/build/beacon/in-process-client.js +2 -2
- package/build/beacon/server.js +3 -3
- package/build/cli/browser-cli.js +1 -1
- package/build/cli/commands/db/base-command.js +2 -2
- package/build/cli/index.js +2 -2
- package/build/cli/tenant-database-command-helper.js +3 -3
- package/build/cli/use-browser-cli.js +1 -1
- package/build/configuration-types.js +3 -1
- package/build/configuration.js +38 -38
- package/build/controller.js +8 -8
- package/build/current-configuration.js +1 -1
- package/build/database/annotations-async-hooks.js +2 -2
- package/build/database/annotations.js +3 -3
- package/build/database/drivers/base-column.js +1 -1
- package/build/database/drivers/base-foreign-key.js +1 -1
- package/build/database/drivers/base-table.js +1 -1
- package/build/database/drivers/base.js +10 -10
- package/build/database/drivers/mssql/index.js +1 -1
- package/build/database/drivers/mssql/table.js +1 -1
- package/build/database/drivers/mysql/index.js +3 -3
- package/build/database/drivers/mysql/query.js +1 -1
- package/build/database/drivers/mysql/table.js +1 -1
- package/build/database/drivers/pgsql/index.js +2 -2
- package/build/database/drivers/sqlite/base.js +16 -16
- package/build/database/drivers/sqlite/index.js +11 -11
- package/build/database/drivers/sqlite/index.native.js +1 -1
- package/build/database/drivers/sqlite/index.web.js +3 -3
- package/build/database/drivers/sqlite/query.js +1 -1
- package/build/database/drivers/sqlite/query.web.js +1 -1
- package/build/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/build/database/drivers/sqlite/table.js +1 -1
- package/build/database/migrator/files-finder.js +1 -1
- package/build/database/migrator.js +6 -6
- package/build/database/pool/async-tracked-multi-connection.js +27 -27
- package/build/database/pool/base-methods-forward.js +4 -4
- package/build/database/pool/base.js +8 -8
- package/build/database/query/from-base.js +1 -1
- package/build/database/query/index.js +10 -10
- package/build/database/query/join-object.js +3 -3
- package/build/database/query/model-class-query.js +39 -39
- package/build/database/query/preloader/belongs-to.js +22 -22
- package/build/database/query/preloader/has-many.js +20 -20
- package/build/database/query/preloader/has-one.js +8 -8
- package/build/database/query/preloader/selection.js +3 -3
- package/build/database/query/preloader.js +8 -8
- package/build/database/query/query-data.js +9 -9
- package/build/database/query/where-model-class-hash.js +7 -7
- package/build/database/query/with-count.js +9 -9
- package/build/database/record/acts-as-list.js +15 -15
- package/build/database/record/attachments/handle.js +2 -2
- package/build/database/record/attachments/normalize-input.js +12 -12
- package/build/database/record/attachments/storage-drivers/s3.js +6 -6
- package/build/database/record/attachments/store.js +13 -13
- package/build/database/record/index.js +115 -121
- package/build/database/record/instance-relationships/base.js +11 -11
- package/build/database/record/instance-relationships/belongs-to.js +3 -3
- package/build/database/record/instance-relationships/has-many.js +8 -8
- package/build/database/record/instance-relationships/has-one.js +7 -7
- package/build/database/record/relationships/base.js +2 -2
- package/build/database/record/state-machine.js +7 -7
- package/build/database/record/validators/presence.js +1 -1
- package/build/database/record/validators/uniqueness.js +5 -5
- package/build/database/table-data/index.js +4 -4
- package/build/environment-handlers/base.js +2 -2
- package/build/environment-handlers/browser.js +7 -7
- package/build/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/build/environment-handlers/node/cli/commands/console.js +4 -4
- package/build/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/build/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +836 -60
- package/build/environment-handlers/node.js +6 -6
- package/build/frontend-model-controller.js +81 -82
- package/build/frontend-model-resource/base-resource.js +78 -115
- package/build/frontend-models/base.js +162 -149
- package/build/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/build/frontend-models/event-hook-models.js +2 -2
- package/build/frontend-models/outgoing-event-buffer.js +2 -2
- package/build/frontend-models/preloader.js +5 -5
- package/build/frontend-models/query.js +43 -38
- package/build/frontend-models/resource-definition.js +6 -6
- package/build/frontend-models/transport-serialization.js +11 -11
- package/build/frontend-models/use-destroyed-event.js +10 -10
- package/build/frontend-models/use-model-class-event.js +11 -11
- package/build/frontend-models/use-updated-event.js +11 -11
- package/build/frontend-models/websocket-channel.js +26 -17
- package/build/frontend-models/websocket-publishers.js +9 -9
- package/build/http-client/response.js +2 -2
- package/build/http-server/client/index.js +8 -8
- package/build/http-server/client/params-to-object.js +10 -10
- package/build/http-server/client/request-buffer/form-data-part.js +2 -2
- package/build/http-server/client/request-buffer/index.js +8 -8
- package/build/http-server/client/request-parser.js +3 -3
- package/build/http-server/client/request-runner.js +6 -6
- package/build/http-server/client/request-timing.js +5 -5
- package/build/http-server/client/request.js +1 -1
- package/build/http-server/client/response.js +5 -5
- package/build/http-server/client/websocket-request.js +4 -4
- package/build/http-server/client/websocket-session.js +18 -18
- package/build/http-server/development-reloader.js +5 -5
- package/build/http-server/index.js +12 -12
- package/build/http-server/remote-address.js +4 -4
- package/build/http-server/server-client.js +3 -3
- package/build/http-server/server-lock.js +4 -4
- package/build/http-server/websocket-channel-subscribers.js +3 -3
- package/build/http-server/websocket-channel.js +1 -1
- package/build/http-server/websocket-connection.js +1 -1
- package/build/http-server/websocket-event-log-store.js +6 -6
- package/build/http-server/websocket-events-host.js +2 -2
- package/build/http-server/worker-handler/in-process.js +7 -7
- package/build/http-server/worker-handler/index.js +4 -4
- package/build/http-server/worker-handler/worker-thread.js +3 -3
- package/build/logger/outputs/array-output.js +3 -3
- package/build/logger/outputs/console-output.js +1 -1
- package/build/logger/outputs/file-output.js +4 -4
- package/build/logger/outputs/stdout-output.js +1 -1
- package/build/logger.js +10 -10
- package/build/mailer/backends/smtp.js +3 -3
- package/build/mailer/base.js +8 -8
- package/build/mailer/delivery.js +4 -4
- package/build/plugins/sqljs-wasm-route-controller.js +1 -1
- package/build/routes/base-route.js +6 -6
- package/build/routes/basic-route.js +1 -1
- package/build/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/build/routes/index.js +1 -1
- package/build/routes/plugin-routes.js +1 -1
- package/build/routes/resolver.js +11 -11
- package/build/routes/resource-route.js +1 -1
- package/build/src/application.d.ts +3 -3
- package/build/src/application.d.ts.map +1 -1
- package/build/src/application.js +5 -5
- package/build/src/authorization/ability.d.ts +7 -7
- package/build/src/authorization/ability.d.ts.map +1 -1
- package/build/src/authorization/ability.js +9 -9
- package/build/src/authorization/base-resource.d.ts +1 -1
- package/build/src/authorization/base-resource.d.ts.map +1 -1
- package/build/src/authorization/base-resource.js +5 -5
- package/build/src/background-jobs/cron-expression.js +2 -2
- package/build/src/background-jobs/forked-runner-child.js +2 -2
- package/build/src/background-jobs/job-registry.d.ts +1 -1
- package/build/src/background-jobs/job-registry.d.ts.map +1 -1
- package/build/src/background-jobs/job-registry.js +2 -2
- package/build/src/background-jobs/job-runner.js +2 -2
- package/build/src/background-jobs/job.js +2 -2
- package/build/src/background-jobs/json-socket.d.ts +4 -4
- package/build/src/background-jobs/json-socket.d.ts.map +1 -1
- package/build/src/background-jobs/json-socket.js +5 -5
- package/build/src/background-jobs/main.d.ts +18 -18
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +22 -22
- package/build/src/background-jobs/scheduler.d.ts +5 -5
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +8 -8
- package/build/src/background-jobs/store.js +8 -8
- package/build/src/background-jobs/web/controller.js +3 -3
- package/build/src/background-jobs/worker.d.ts +6 -6
- package/build/src/background-jobs/worker.d.ts.map +1 -1
- package/build/src/background-jobs/worker.js +13 -13
- package/build/src/beacon/client.d.ts +4 -4
- package/build/src/beacon/client.d.ts.map +1 -1
- package/build/src/beacon/client.js +12 -9
- package/build/src/beacon/in-process-broker.d.ts.map +1 -1
- package/build/src/beacon/in-process-broker.js +3 -3
- package/build/src/beacon/in-process-client.d.ts +1 -1
- package/build/src/beacon/in-process-client.d.ts.map +1 -1
- package/build/src/beacon/in-process-client.js +3 -3
- package/build/src/beacon/server.d.ts +2 -2
- package/build/src/beacon/server.d.ts.map +1 -1
- package/build/src/beacon/server.js +4 -4
- package/build/src/cli/browser-cli.js +2 -2
- package/build/src/cli/commands/db/base-command.d.ts +2 -2
- package/build/src/cli/commands/db/base-command.d.ts.map +1 -1
- package/build/src/cli/commands/db/base-command.js +3 -3
- package/build/src/cli/index.js +3 -3
- package/build/src/cli/tenant-database-command-helper.d.ts +1 -1
- package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
- package/build/src/cli/tenant-database-command-helper.js +4 -4
- package/build/src/cli/use-browser-cli.js +2 -2
- package/build/src/configuration-types.d.ts +12 -2
- package/build/src/configuration-types.d.ts.map +1 -1
- package/build/src/configuration-types.js +4 -2
- package/build/src/configuration.d.ts +14 -14
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +39 -39
- package/build/src/controller.js +10 -10
- package/build/src/current-configuration.js +2 -2
- package/build/src/database/annotations-async-hooks.js +3 -3
- package/build/src/database/annotations.d.ts.map +1 -1
- package/build/src/database/annotations.js +4 -4
- package/build/src/database/drivers/base-column.d.ts +1 -1
- package/build/src/database/drivers/base-column.d.ts.map +1 -1
- package/build/src/database/drivers/base-column.js +2 -2
- package/build/src/database/drivers/base-foreign-key.d.ts +1 -1
- package/build/src/database/drivers/base-foreign-key.d.ts.map +1 -1
- package/build/src/database/drivers/base-foreign-key.js +2 -2
- package/build/src/database/drivers/base-table.d.ts +1 -1
- package/build/src/database/drivers/base-table.d.ts.map +1 -1
- package/build/src/database/drivers/base-table.js +2 -2
- package/build/src/database/drivers/base.d.ts +6 -6
- package/build/src/database/drivers/base.d.ts.map +1 -1
- package/build/src/database/drivers/base.js +11 -11
- package/build/src/database/drivers/mssql/index.js +2 -2
- package/build/src/database/drivers/mssql/table.js +2 -2
- package/build/src/database/drivers/mysql/index.js +4 -4
- package/build/src/database/drivers/mysql/query.js +2 -2
- package/build/src/database/drivers/mysql/table.js +2 -2
- package/build/src/database/drivers/pgsql/index.js +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts +3 -3
- package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/base.js +17 -17
- package/build/src/database/drivers/sqlite/index.d.ts +4 -4
- package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.js +12 -12
- package/build/src/database/drivers/sqlite/index.native.js +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts +2 -2
- package/build/src/database/drivers/sqlite/index.web.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.web.js +4 -4
- package/build/src/database/drivers/sqlite/query.js +2 -2
- package/build/src/database/drivers/sqlite/query.web.js +2 -2
- package/build/src/database/drivers/sqlite/sql/alter-table.js +3 -3
- package/build/src/database/drivers/sqlite/table.js +2 -2
- package/build/src/database/migrator/files-finder.js +2 -2
- package/build/src/database/migrator.d.ts +1 -1
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +7 -7
- package/build/src/database/pool/async-tracked-multi-connection.d.ts +9 -9
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +28 -28
- package/build/src/database/pool/base-methods-forward.js +7 -7
- package/build/src/database/pool/base.d.ts +1 -1
- package/build/src/database/pool/base.d.ts.map +1 -1
- package/build/src/database/pool/base.js +9 -9
- package/build/src/database/query/from-base.d.ts +1 -1
- package/build/src/database/query/from-base.d.ts.map +1 -1
- package/build/src/database/query/from-base.js +2 -2
- package/build/src/database/query/index.d.ts +4 -4
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +11 -11
- package/build/src/database/query/join-object.js +4 -4
- package/build/src/database/query/model-class-query.d.ts +4 -4
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +40 -40
- package/build/src/database/query/preloader/belongs-to.js +23 -23
- package/build/src/database/query/preloader/has-many.js +21 -21
- package/build/src/database/query/preloader/has-one.js +9 -9
- package/build/src/database/query/preloader/selection.js +4 -4
- package/build/src/database/query/preloader.js +9 -9
- package/build/src/database/query/query-data.js +10 -10
- package/build/src/database/query/where-model-class-hash.js +8 -8
- package/build/src/database/query/with-count.js +10 -10
- package/build/src/database/record/acts-as-list.js +20 -20
- package/build/src/database/record/attachments/handle.d.ts +1 -1
- package/build/src/database/record/attachments/handle.d.ts.map +1 -1
- package/build/src/database/record/attachments/handle.js +3 -3
- package/build/src/database/record/attachments/normalize-input.js +15 -15
- package/build/src/database/record/attachments/storage-drivers/s3.js +7 -7
- package/build/src/database/record/attachments/store.d.ts +2 -2
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +14 -14
- package/build/src/database/record/index.d.ts +18 -25
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +135 -141
- package/build/src/database/record/instance-relationships/base.d.ts +3 -3
- package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/base.js +13 -13
- package/build/src/database/record/instance-relationships/belongs-to.js +4 -4
- package/build/src/database/record/instance-relationships/has-many.js +9 -9
- package/build/src/database/record/instance-relationships/has-one.d.ts +1 -1
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +8 -8
- package/build/src/database/record/relationships/base.js +4 -4
- package/build/src/database/record/state-machine.js +8 -8
- package/build/src/database/record/validators/presence.js +2 -2
- package/build/src/database/record/validators/uniqueness.js +6 -6
- package/build/src/database/table-data/index.d.ts +4 -4
- package/build/src/database/table-data/index.d.ts.map +1 -1
- package/build/src/database/table-data/index.js +5 -5
- package/build/src/environment-handlers/base.js +3 -3
- package/build/src/environment-handlers/browser.d.ts +3 -3
- package/build/src/environment-handlers/browser.d.ts.map +1 -1
- package/build/src/environment-handlers/browser.js +8 -8
- package/build/src/environment-handlers/node/cli/commands/cli-command-context.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/console.js +5 -5
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/dump.js +2 -2
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +4 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +285 -12
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +712 -61
- package/build/src/environment-handlers/node.d.ts +2 -2
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +7 -7
- package/build/src/frontend-model-controller.d.ts +5 -6
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +88 -89
- package/build/src/frontend-model-resource/base-resource.d.ts +36 -27
- package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/base-resource.js +67 -120
- package/build/src/frontend-models/base.d.ts +67 -59
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +171 -158
- package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -2
- package/build/src/frontend-models/event-hook-models.d.ts.map +1 -1
- package/build/src/frontend-models/event-hook-models.js +3 -3
- package/build/src/frontend-models/outgoing-event-buffer.d.ts +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.d.ts.map +1 -1
- package/build/src/frontend-models/outgoing-event-buffer.js +3 -3
- package/build/src/frontend-models/preloader.js +6 -6
- package/build/src/frontend-models/query.d.ts +16 -8
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +43 -39
- package/build/src/frontend-models/resource-definition.js +7 -7
- package/build/src/frontend-models/transport-serialization.js +12 -12
- package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-destroyed-event.js +11 -11
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +12 -12
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +12 -12
- package/build/src/frontend-models/websocket-channel.d.ts +6 -1
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +26 -18
- package/build/src/frontend-models/websocket-publishers.js +11 -11
- package/build/src/http-client/response.d.ts +2 -2
- package/build/src/http-client/response.d.ts.map +1 -1
- package/build/src/http-client/response.js +3 -3
- package/build/src/http-server/client/index.d.ts +1 -1
- package/build/src/http-server/client/index.d.ts.map +1 -1
- package/build/src/http-server/client/index.js +9 -9
- package/build/src/http-server/client/params-to-object.js +11 -11
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts +2 -2
- package/build/src/http-server/client/request-buffer/form-data-part.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/form-data-part.js +3 -3
- package/build/src/http-server/client/request-buffer/index.d.ts +4 -4
- package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/index.js +9 -9
- package/build/src/http-server/client/request-parser.d.ts +1 -1
- package/build/src/http-server/client/request-parser.d.ts.map +1 -1
- package/build/src/http-server/client/request-parser.js +4 -4
- package/build/src/http-server/client/request-runner.js +7 -7
- package/build/src/http-server/client/request-timing.d.ts +5 -5
- package/build/src/http-server/client/request-timing.d.ts.map +1 -1
- package/build/src/http-server/client/request-timing.js +6 -6
- package/build/src/http-server/client/request.js +2 -2
- package/build/src/http-server/client/response.d.ts +3 -3
- package/build/src/http-server/client/response.d.ts.map +1 -1
- package/build/src/http-server/client/response.js +6 -6
- package/build/src/http-server/client/websocket-request.d.ts +3 -3
- package/build/src/http-server/client/websocket-request.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-request.js +5 -5
- package/build/src/http-server/client/websocket-session.d.ts +6 -6
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +19 -19
- package/build/src/http-server/development-reloader.d.ts +3 -3
- package/build/src/http-server/development-reloader.d.ts.map +1 -1
- package/build/src/http-server/development-reloader.js +6 -6
- package/build/src/http-server/index.d.ts +7 -7
- package/build/src/http-server/index.d.ts.map +1 -1
- package/build/src/http-server/index.js +13 -13
- package/build/src/http-server/remote-address.js +6 -6
- package/build/src/http-server/server-client.js +4 -4
- package/build/src/http-server/server-lock.js +5 -5
- package/build/src/http-server/websocket-channel-subscribers.d.ts +1 -1
- package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel-subscribers.js +4 -4
- package/build/src/http-server/websocket-channel.d.ts +1 -1
- package/build/src/http-server/websocket-channel.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel.js +2 -2
- package/build/src/http-server/websocket-connection.d.ts +1 -1
- package/build/src/http-server/websocket-connection.d.ts.map +1 -1
- package/build/src/http-server/websocket-connection.js +2 -2
- package/build/src/http-server/websocket-event-log-store.d.ts +1 -1
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +7 -7
- package/build/src/http-server/websocket-events-host.d.ts +1 -1
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts +3 -3
- package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/in-process.js +9 -9
- package/build/src/http-server/worker-handler/index.d.ts +4 -4
- package/build/src/http-server/worker-handler/index.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/index.js +5 -5
- package/build/src/http-server/worker-handler/worker-thread.d.ts +2 -2
- package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/worker-thread.js +4 -4
- package/build/src/logger/outputs/array-output.d.ts +3 -3
- package/build/src/logger/outputs/array-output.d.ts.map +1 -1
- package/build/src/logger/outputs/array-output.js +4 -4
- package/build/src/logger/outputs/console-output.d.ts +1 -1
- package/build/src/logger/outputs/console-output.d.ts.map +1 -1
- package/build/src/logger/outputs/console-output.js +2 -2
- package/build/src/logger/outputs/file-output.d.ts +4 -4
- package/build/src/logger/outputs/file-output.d.ts.map +1 -1
- package/build/src/logger/outputs/file-output.js +5 -5
- package/build/src/logger/outputs/stdout-output.d.ts.map +1 -1
- package/build/src/logger/outputs/stdout-output.js +2 -2
- package/build/src/logger.d.ts.map +1 -1
- package/build/src/logger.js +11 -11
- package/build/src/mailer/backends/smtp.d.ts.map +1 -1
- package/build/src/mailer/backends/smtp.js +5 -5
- package/build/src/mailer/base.js +11 -11
- package/build/src/mailer/delivery.d.ts +3 -3
- package/build/src/mailer/delivery.d.ts.map +1 -1
- package/build/src/mailer/delivery.js +5 -5
- package/build/src/plugins/sqljs-wasm-route-controller.js +2 -2
- package/build/src/routes/base-route.d.ts +6 -6
- package/build/src/routes/base-route.d.ts.map +1 -1
- package/build/src/routes/base-route.js +7 -7
- package/build/src/routes/basic-route.js +2 -2
- package/build/src/routes/hooks/frontend-model-command-route-hook.js +2 -2
- package/build/src/routes/index.js +2 -2
- package/build/src/routes/plugin-routes.js +2 -2
- package/build/src/routes/resolver.d.ts +1 -1
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +13 -13
- package/build/src/routes/resource-route.d.ts +1 -1
- package/build/src/routes/resource-route.d.ts.map +1 -1
- package/build/src/routes/resource-route.js +2 -2
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts.map +1 -1
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.js +8 -8
- package/build/src/testing/expect-utils.js +13 -13
- package/build/src/testing/expect.d.ts +1 -1
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +9 -9
- package/build/src/testing/test-files-finder.d.ts +8 -8
- package/build/src/testing/test-files-finder.d.ts.map +1 -1
- package/build/src/testing/test-files-finder.js +9 -9
- package/build/src/testing/test-filter-parser.js +3 -3
- package/build/src/testing/test-runner.d.ts +2 -2
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +17 -17
- package/build/src/testing/test-suite-splitter.js +2 -2
- package/build/src/testing/test.d.ts +2 -2
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +16 -16
- package/build/src/utils/backtrace-cleaner.d.ts +1 -1
- package/build/src/utils/backtrace-cleaner.d.ts.map +1 -1
- package/build/src/utils/backtrace-cleaner.js +2 -2
- package/build/src/utils/format-value.js +2 -2
- package/build/src/utils/model-scope.js +2 -2
- package/build/src/utils/ransack.js +27 -27
- package/build/src/utils/with-tracked-stack-async-hooks.js +8 -8
- package/build/src/utils/with-tracked-stack.js +4 -4
- package/build/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/build/testing/expect-utils.js +11 -11
- package/build/testing/expect.js +7 -7
- package/build/testing/test-files-finder.js +8 -8
- package/build/testing/test-filter-parser.js +2 -2
- package/build/testing/test-runner.js +16 -16
- package/build/testing/test-suite-splitter.js +1 -1
- package/build/testing/test.js +15 -15
- package/build/utils/backtrace-cleaner.js +1 -1
- package/build/utils/format-value.js +1 -1
- package/build/utils/model-scope.js +1 -1
- package/build/utils/ransack.js +26 -26
- package/build/utils/with-tracked-stack-async-hooks.js +7 -7
- package/build/utils/with-tracked-stack.js +3 -3
- package/package.json +2 -1
- package/src/application.js +4 -4
- package/src/authorization/ability.js +8 -8
- package/src/authorization/base-resource.js +4 -4
- package/src/background-jobs/cron-expression.js +1 -1
- package/src/background-jobs/forked-runner-child.js +1 -1
- package/src/background-jobs/job-registry.js +1 -1
- package/src/background-jobs/job-runner.js +1 -1
- package/src/background-jobs/job.js +1 -1
- package/src/background-jobs/json-socket.js +4 -4
- package/src/background-jobs/main.js +21 -21
- package/src/background-jobs/scheduler.js +7 -7
- package/src/background-jobs/store.js +7 -7
- package/src/background-jobs/web/controller.js +2 -2
- package/src/background-jobs/worker.js +12 -12
- package/src/beacon/client.js +11 -8
- package/src/beacon/in-process-broker.js +2 -2
- package/src/beacon/in-process-client.js +2 -2
- package/src/beacon/server.js +3 -3
- package/src/cli/browser-cli.js +1 -1
- package/src/cli/commands/db/base-command.js +2 -2
- package/src/cli/index.js +2 -2
- package/src/cli/tenant-database-command-helper.js +3 -3
- package/src/cli/use-browser-cli.js +1 -1
- package/src/configuration-types.js +3 -1
- package/src/configuration.js +38 -38
- package/src/controller.js +8 -8
- package/src/current-configuration.js +1 -1
- package/src/database/annotations-async-hooks.js +2 -2
- package/src/database/annotations.js +3 -3
- package/src/database/drivers/base-column.js +1 -1
- package/src/database/drivers/base-foreign-key.js +1 -1
- package/src/database/drivers/base-table.js +1 -1
- package/src/database/drivers/base.js +10 -10
- package/src/database/drivers/mssql/index.js +1 -1
- package/src/database/drivers/mssql/table.js +1 -1
- package/src/database/drivers/mysql/index.js +3 -3
- package/src/database/drivers/mysql/query.js +1 -1
- package/src/database/drivers/mysql/table.js +1 -1
- package/src/database/drivers/pgsql/index.js +2 -2
- package/src/database/drivers/sqlite/base.js +16 -16
- package/src/database/drivers/sqlite/index.js +11 -11
- package/src/database/drivers/sqlite/index.native.js +1 -1
- package/src/database/drivers/sqlite/index.web.js +3 -3
- package/src/database/drivers/sqlite/query.js +1 -1
- package/src/database/drivers/sqlite/query.web.js +1 -1
- package/src/database/drivers/sqlite/sql/alter-table.js +2 -2
- package/src/database/drivers/sqlite/table.js +1 -1
- package/src/database/migrator/files-finder.js +1 -1
- package/src/database/migrator.js +6 -6
- package/src/database/pool/async-tracked-multi-connection.js +27 -27
- package/src/database/pool/base-methods-forward.js +4 -4
- package/src/database/pool/base.js +8 -8
- package/src/database/query/from-base.js +1 -1
- package/src/database/query/index.js +10 -10
- package/src/database/query/join-object.js +3 -3
- package/src/database/query/model-class-query.js +39 -39
- package/src/database/query/preloader/belongs-to.js +22 -22
- package/src/database/query/preloader/has-many.js +20 -20
- package/src/database/query/preloader/has-one.js +8 -8
- package/src/database/query/preloader/selection.js +3 -3
- package/src/database/query/preloader.js +8 -8
- package/src/database/query/query-data.js +9 -9
- package/src/database/query/where-model-class-hash.js +7 -7
- package/src/database/query/with-count.js +9 -9
- package/src/database/record/acts-as-list.js +15 -15
- package/src/database/record/attachments/handle.js +2 -2
- package/src/database/record/attachments/normalize-input.js +12 -12
- package/src/database/record/attachments/storage-drivers/s3.js +6 -6
- package/src/database/record/attachments/store.js +13 -13
- package/src/database/record/index.js +115 -121
- package/src/database/record/instance-relationships/base.js +11 -11
- package/src/database/record/instance-relationships/belongs-to.js +3 -3
- package/src/database/record/instance-relationships/has-many.js +8 -8
- package/src/database/record/instance-relationships/has-one.js +7 -7
- package/src/database/record/relationships/base.js +2 -2
- package/src/database/record/state-machine.js +7 -7
- package/src/database/record/validators/presence.js +1 -1
- package/src/database/record/validators/uniqueness.js +5 -5
- package/src/database/table-data/index.js +4 -4
- package/src/environment-handlers/base.js +2 -2
- package/src/environment-handlers/browser.js +7 -7
- package/src/environment-handlers/node/cli/commands/cli-command-context.js +1 -1
- package/src/environment-handlers/node/cli/commands/console.js +4 -4
- package/src/environment-handlers/node/cli/commands/db/schema/dump.js +1 -1
- package/src/environment-handlers/node/cli/commands/db/schema/load.js +3 -3
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +836 -60
- package/src/environment-handlers/node.js +6 -6
- package/src/frontend-model-controller.js +81 -82
- package/src/frontend-model-resource/base-resource.js +78 -115
- package/src/frontend-models/base.js +162 -149
- package/src/frontend-models/clear-pending-debounced-callback.js +1 -1
- package/src/frontend-models/event-hook-models.js +2 -2
- package/src/frontend-models/outgoing-event-buffer.js +2 -2
- package/src/frontend-models/preloader.js +5 -5
- package/src/frontend-models/query.js +43 -38
- package/src/frontend-models/resource-definition.js +6 -6
- package/src/frontend-models/transport-serialization.js +11 -11
- package/src/frontend-models/use-destroyed-event.js +10 -10
- package/src/frontend-models/use-model-class-event.js +11 -11
- package/src/frontend-models/use-updated-event.js +11 -11
- package/src/frontend-models/websocket-channel.js +26 -17
- package/src/frontend-models/websocket-publishers.js +9 -9
- package/src/http-client/response.js +2 -2
- package/src/http-server/client/index.js +8 -8
- package/src/http-server/client/params-to-object.js +10 -10
- package/src/http-server/client/request-buffer/form-data-part.js +2 -2
- package/src/http-server/client/request-buffer/index.js +8 -8
- package/src/http-server/client/request-parser.js +3 -3
- package/src/http-server/client/request-runner.js +6 -6
- package/src/http-server/client/request-timing.js +5 -5
- package/src/http-server/client/request.js +1 -1
- package/src/http-server/client/response.js +5 -5
- package/src/http-server/client/websocket-request.js +4 -4
- package/src/http-server/client/websocket-session.js +18 -18
- package/src/http-server/development-reloader.js +5 -5
- package/src/http-server/index.js +12 -12
- package/src/http-server/remote-address.js +4 -4
- package/src/http-server/server-client.js +3 -3
- package/src/http-server/server-lock.js +4 -4
- package/src/http-server/websocket-channel-subscribers.js +3 -3
- package/src/http-server/websocket-channel.js +1 -1
- package/src/http-server/websocket-connection.js +1 -1
- package/src/http-server/websocket-event-log-store.js +6 -6
- package/src/http-server/websocket-events-host.js +2 -2
- package/src/http-server/worker-handler/in-process.js +7 -7
- package/src/http-server/worker-handler/index.js +4 -4
- package/src/http-server/worker-handler/worker-thread.js +3 -3
- package/src/logger/outputs/array-output.js +3 -3
- package/src/logger/outputs/console-output.js +1 -1
- package/src/logger/outputs/file-output.js +4 -4
- package/src/logger/outputs/stdout-output.js +1 -1
- package/src/logger.js +10 -10
- package/src/mailer/backends/smtp.js +3 -3
- package/src/mailer/base.js +8 -8
- package/src/mailer/delivery.js +4 -4
- package/src/plugins/sqljs-wasm-route-controller.js +1 -1
- package/src/routes/base-route.js +6 -6
- package/src/routes/basic-route.js +1 -1
- package/src/routes/hooks/frontend-model-command-route-hook.js +1 -1
- package/src/routes/index.js +1 -1
- package/src/routes/plugin-routes.js +1 -1
- package/src/routes/resolver.js +11 -11
- package/src/routes/resource-route.js +1 -1
- package/src/testing/browser-frontend-model-event-hook-scenarios.js +7 -7
- package/src/testing/expect-utils.js +11 -11
- package/src/testing/expect.js +7 -7
- package/src/testing/test-files-finder.js +8 -8
- package/src/testing/test-filter-parser.js +2 -2
- package/src/testing/test-runner.js +16 -16
- package/src/testing/test-suite-splitter.js +1 -1
- package/src/testing/test.js +15 -15
- package/src/utils/backtrace-cleaner.js +1 -1
- package/src/utils/format-value.js +1 -1
- package/src/utils/model-scope.js +1 -1
- package/src/utils/ransack.js +26 -26
- package/src/utils/with-tracked-stack-async-hooks.js +7 -7
- package/src/utils/with-tracked-stack.js +3 -3
|
@@ -66,6 +66,18 @@ import isPlainObject from "../utils/plain-object.js"
|
|
|
66
66
|
* @typedef {Record<string, FrontendModelResourcePayloadValue>} FrontendModelResourceAttributePayload
|
|
67
67
|
*/
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Virtual setter method on a frontend-model resource.
|
|
71
|
+
* @typedef {function(import("../database/record/index.js").default, FrontendModelResourcePayloadValue): (void | Promise<void>)} FrontendModelResourceVirtualSetter
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Static helpers used when checking whether a model-like receiver accepts an attribute.
|
|
76
|
+
* @typedef {object} WritableAttributeReceiverClass
|
|
77
|
+
* @property {function(string): string} [resolveAttributeName] - Resolves aliases to canonical attribute names.
|
|
78
|
+
* @property {function(Record<string, ?>, string): string} [findMemberNameInsensitive] - Locates a setter method on the receiver.
|
|
79
|
+
*/
|
|
80
|
+
|
|
69
81
|
/**
|
|
70
82
|
* Options passed while saving frontend-model resource mutations.
|
|
71
83
|
* @typedef {object} FrontendModelResourceSaveOptions
|
|
@@ -84,46 +96,26 @@ import isPlainObject from "../utils/plain-object.js"
|
|
|
84
96
|
* @template {typeof import("../database/record/index.js").default} [TModelClass=typeof import("../database/record/index.js").default]
|
|
85
97
|
*/
|
|
86
98
|
export default class FrontendModelBaseResource extends AuthorizationBaseResource {
|
|
87
|
-
/**
|
|
88
|
-
* Backing model class.
|
|
89
|
-
@type {typeof import("../database/record/index.js").default | undefined} */
|
|
99
|
+
/** @type {typeof import("../database/record/index.js").default | undefined} */
|
|
90
100
|
static ModelClass = undefined
|
|
91
101
|
|
|
92
|
-
/**
|
|
93
|
-
* Attributes.
|
|
94
|
-
@type {Record<string, ?> | string[] | undefined} */
|
|
102
|
+
/** @type {Record<string, ?> | string[] | undefined} */
|
|
95
103
|
static attributes = undefined
|
|
96
|
-
/**
|
|
97
|
-
* Abilities.
|
|
98
|
-
@type {string[] | undefined} */
|
|
104
|
+
/** @type {string[] | undefined} */
|
|
99
105
|
static abilities = undefined
|
|
100
|
-
/**
|
|
101
|
-
* Attachments.
|
|
102
|
-
@type {Record<string, ?> | undefined} */
|
|
106
|
+
/** @type {Record<string, ?> | undefined} */
|
|
103
107
|
static attachments = undefined
|
|
104
|
-
/**
|
|
105
|
-
* Collection commands.
|
|
106
|
-
@type {string[] | undefined} */
|
|
108
|
+
/** @type {string[] | undefined} */
|
|
107
109
|
static collectionCommands = undefined
|
|
108
|
-
/**
|
|
109
|
-
* Built in collection commands.
|
|
110
|
-
@type {string[] | undefined} */
|
|
110
|
+
/** @type {string[] | undefined} */
|
|
111
111
|
static builtInCollectionCommands = undefined
|
|
112
|
-
/**
|
|
113
|
-
* Member commands.
|
|
114
|
-
@type {string[] | undefined} */
|
|
112
|
+
/** @type {string[] | undefined} */
|
|
115
113
|
static memberCommands = undefined
|
|
116
|
-
/**
|
|
117
|
-
* Built in member commands.
|
|
118
|
-
@type {string[] | undefined} */
|
|
114
|
+
/** @type {string[] | undefined} */
|
|
119
115
|
static builtInMemberCommands = undefined
|
|
120
|
-
/**
|
|
121
|
-
* Relationships.
|
|
122
|
-
@type {string[] | undefined} */
|
|
116
|
+
/** @type {string[] | undefined} */
|
|
123
117
|
static relationships = undefined
|
|
124
|
-
/**
|
|
125
|
-
* Translated attributes.
|
|
126
|
-
@type {string[] | undefined} */
|
|
118
|
+
/** @type {string[] | undefined} */
|
|
127
119
|
static translatedAttributes = undefined
|
|
128
120
|
|
|
129
121
|
/**
|
|
@@ -137,17 +129,14 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
137
129
|
locals: "locals" in args ? args.locals || {} : {}
|
|
138
130
|
})
|
|
139
131
|
|
|
132
|
+
const ResourceClass = /** @type {typeof FrontendModelBaseResource} */ (this.constructor)
|
|
133
|
+
const defaultResourceConfiguration = /** @type {import("../configuration-types.js").FrontendModelResourceConfiguration} */ ({attributes: []})
|
|
134
|
+
|
|
140
135
|
this.controller = "controller" in args ? args.controller : undefined
|
|
141
|
-
this.modelClassValue = "modelClass" in args ? args.modelClass :
|
|
142
|
-
* Narrows the runtime value to the documented type.
|
|
143
|
-
@type {typeof import("../database/record/index.js").default | undefined} */ (/**
|
|
144
|
-
* Narrows the runtime value to the documented type.
|
|
145
|
-
@type {typeof FrontendModelBaseResource} */ (this.constructor).modelClass())
|
|
136
|
+
this.modelClassValue = "modelClass" in args ? args.modelClass : ResourceClass.modelClass()
|
|
146
137
|
this.modelNameValue = "modelName" in args ? args.modelName : (this.modelClassValue?.getModelName ? this.modelClassValue.getModelName() : this.modelClassValue?.name || "")
|
|
147
138
|
this.paramsValue = "params" in args ? args.params : undefined
|
|
148
|
-
this.resourceConfigurationValue = "resourceConfiguration" in args ? args.resourceConfiguration :
|
|
149
|
-
* Narrows the runtime value to the documented type.
|
|
150
|
-
@type {import("../configuration-types.js").FrontendModelResourceConfiguration} */ ({attributes: []})
|
|
139
|
+
this.resourceConfigurationValue = "resourceConfiguration" in args ? args.resourceConfiguration : defaultResourceConfiguration
|
|
151
140
|
}
|
|
152
141
|
|
|
153
142
|
/**
|
|
@@ -155,7 +144,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
155
144
|
* @returns {FrontendModelResourceController} - Controller instance with frontend-model helpers.
|
|
156
145
|
*/
|
|
157
146
|
typedControllerInstance() {
|
|
158
|
-
return /**
|
|
147
|
+
return /** @type {FrontendModelResourceController} */ (this.controller)
|
|
159
148
|
}
|
|
160
149
|
|
|
161
150
|
/**
|
|
@@ -163,9 +152,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
163
152
|
* @returns {import("../configuration-types.js").FrontendModelResourceConfiguration} - Static resource config (raw user input shape; consumers normalize).
|
|
164
153
|
*/
|
|
165
154
|
static resourceConfig() {
|
|
166
|
-
/**
|
|
167
|
-
* Config.
|
|
168
|
-
@type {import("../configuration-types.js").FrontendModelResourceConfiguration} */
|
|
155
|
+
/** @type {import("../configuration-types.js").FrontendModelResourceConfiguration} */
|
|
169
156
|
const config = {
|
|
170
157
|
attributes: this.attributes || []
|
|
171
158
|
}
|
|
@@ -574,27 +561,17 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
574
561
|
* @returns {Promise<void>}
|
|
575
562
|
*/
|
|
576
563
|
async _assignWithVirtualSetters(model, attributes) {
|
|
577
|
-
/**
|
|
578
|
-
* Direct attributes.
|
|
579
|
-
@type {Record<string, ?>} */
|
|
564
|
+
/** @type {Record<string, ?>} */
|
|
580
565
|
const directAttributes = {}
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
@type {typeof FrontendModelBaseResource} */ (this.constructor).translatedAttributes || [])
|
|
566
|
+
const ResourceClass = /** @type {typeof FrontendModelBaseResource} */ (this.constructor)
|
|
567
|
+
const translatedSet = new Set(ResourceClass.translatedAttributes || [])
|
|
584
568
|
|
|
585
569
|
for (const [name, value] of Object.entries(attributes)) {
|
|
586
570
|
const resourceSetterName = `set${inflection.camelize(name)}Attribute`
|
|
571
|
+
const resourceSetter = virtualSetterLookup(this)[resourceSetterName]
|
|
587
572
|
|
|
588
|
-
if (typeof
|
|
589
|
-
|
|
590
|
-
@type {Record<string, ?>} */ (/**
|
|
591
|
-
* Narrows the runtime value to the documented type.
|
|
592
|
-
@type {?} */ (this))[resourceSetterName] === "function") {
|
|
593
|
-
await /**
|
|
594
|
-
* Narrows the runtime value to the documented type.
|
|
595
|
-
@type {Record<string, ?>} */ (/**
|
|
596
|
-
* Narrows the runtime value to the documented type.
|
|
597
|
-
@type {?} */ (this))[resourceSetterName](model, value)
|
|
573
|
+
if (typeof resourceSetter === "function") {
|
|
574
|
+
await resourceSetter.call(this, model, value)
|
|
598
575
|
} else if (translatedSet.has(name)) {
|
|
599
576
|
await this._setTranslatedAttributeOnModel(model, name, value)
|
|
600
577
|
} else {
|
|
@@ -697,18 +674,14 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
697
674
|
const locale = this.context?.configuration?.getLocale?.() || "en"
|
|
698
675
|
const instanceRelationship = model.getRelationshipByName("translations")
|
|
699
676
|
|
|
700
|
-
/**
|
|
701
|
-
* Defines translation.
|
|
702
|
-
@type {import("../database/record/index.js").default | undefined} */
|
|
677
|
+
/** @type {import("../database/record/index.js").default | undefined} */
|
|
703
678
|
let translation
|
|
704
679
|
|
|
705
680
|
if (model.isNewRecord()) {
|
|
706
681
|
const loaded = instanceRelationship.loaded()
|
|
707
682
|
|
|
708
683
|
if (Array.isArray(loaded)) {
|
|
709
|
-
translation = loaded.find((/**
|
|
710
|
-
* Narrows the runtime value to the documented type.
|
|
711
|
-
@type {Record<string, ?>} */ t) => t.locale() === locale)
|
|
684
|
+
translation = loaded.find((t) => /** @type {Record<string, ?>} */ (t).locale() === locale)
|
|
712
685
|
}
|
|
713
686
|
} else {
|
|
714
687
|
if (!instanceRelationship.getPreloaded()) {
|
|
@@ -718,9 +691,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
718
691
|
const loaded = instanceRelationship.loaded()
|
|
719
692
|
|
|
720
693
|
if (Array.isArray(loaded)) {
|
|
721
|
-
translation = loaded.find((/**
|
|
722
|
-
* Narrows the runtime value to the documented type.
|
|
723
|
-
@type {Record<string, ?>} */ t) => t.locale() === locale)
|
|
694
|
+
translation = loaded.find((t) => /** @type {Record<string, ?>} */ (t).locale() === locale)
|
|
724
695
|
}
|
|
725
696
|
}
|
|
726
697
|
|
|
@@ -728,9 +699,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
728
699
|
translation = instanceRelationship.build({locale})
|
|
729
700
|
}
|
|
730
701
|
|
|
731
|
-
/**
|
|
732
|
-
* Assignments.
|
|
733
|
-
@type {Record<string, ?>} */
|
|
702
|
+
/** @type {Record<string, ?>} */
|
|
734
703
|
const assignments = {}
|
|
735
704
|
|
|
736
705
|
assignments[name] = value
|
|
@@ -1311,9 +1280,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
1311
1280
|
throw new Error(`Nested child resource must define an 'abilities' object to authorize nested ${action}.`)
|
|
1312
1281
|
}
|
|
1313
1282
|
|
|
1314
|
-
const abilityAction = /**
|
|
1315
|
-
* Narrows the runtime value to the documented type.
|
|
1316
|
-
@type {Record<string, string>} */ (abilities)[action]
|
|
1283
|
+
const abilityAction = /** @type {Record<string, string>} */ (abilities)[action]
|
|
1317
1284
|
|
|
1318
1285
|
if (typeof abilityAction !== "string" || abilityAction.length < 1) {
|
|
1319
1286
|
throw new Error(`Nested child resource must define abilities.${action}.`)
|
|
@@ -1343,12 +1310,8 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
1343
1310
|
const primaryKey = targetModelClass.primaryKey()
|
|
1344
1311
|
const lookup = {[primaryKey]: id, ...parentLinkAttributes}
|
|
1345
1312
|
const query = ability
|
|
1346
|
-
?
|
|
1347
|
-
|
|
1348
|
-
@type {?} */ (targetModelClass).accessibleFor(this._resolveChildAbilityAction(childResourceConfiguration, action), ability)
|
|
1349
|
-
: /**
|
|
1350
|
-
* Narrows the runtime value to the documented type.
|
|
1351
|
-
@type {?} */ (targetModelClass).where({})
|
|
1313
|
+
? targetModelClass.accessibleFor(this._resolveChildAbilityAction(childResourceConfiguration, action), ability)
|
|
1314
|
+
: targetModelClass.where({})
|
|
1352
1315
|
|
|
1353
1316
|
const existing = await query.findBy(lookup)
|
|
1354
1317
|
|
|
@@ -1376,9 +1339,7 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
1376
1339
|
|
|
1377
1340
|
const abilityAction = this._resolveChildAbilityAction(childResourceConfiguration, "create")
|
|
1378
1341
|
const primaryKey = targetModelClass.primaryKey()
|
|
1379
|
-
const authorizedIds = await
|
|
1380
|
-
* Narrows the runtime value to the documented type.
|
|
1381
|
-
@type {?} */ (targetModelClass)
|
|
1342
|
+
const authorizedIds = await targetModelClass
|
|
1382
1343
|
.accessibleFor(abilityAction, ability)
|
|
1383
1344
|
.where({[primaryKey]: child.readAttribute(primaryKey)})
|
|
1384
1345
|
.pluck(primaryKey)
|
|
@@ -1402,12 +1363,8 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
1402
1363
|
if (relationshipNames.length === 0) return
|
|
1403
1364
|
|
|
1404
1365
|
for (const relationshipName of relationshipNames) {
|
|
1405
|
-
if (typeof
|
|
1406
|
-
|
|
1407
|
-
@type {?} */ (model).loadRelationship === "function") {
|
|
1408
|
-
await /**
|
|
1409
|
-
* Narrows the runtime value to the documented type.
|
|
1410
|
-
@type {?} */ (model).loadRelationship(relationshipName)
|
|
1366
|
+
if (typeof model.loadRelationship === "function") {
|
|
1367
|
+
await model.loadRelationship(relationshipName)
|
|
1411
1368
|
}
|
|
1412
1369
|
}
|
|
1413
1370
|
}
|
|
@@ -1433,13 +1390,9 @@ export default class FrontendModelBaseResource extends AuthorizationBaseResource
|
|
|
1433
1390
|
* @returns {{attributes: string[], nested: Record<string, {attributes: string[], nested: Record<string, ?>}>}} - Parsed structure.
|
|
1434
1391
|
*/
|
|
1435
1392
|
function parsePermittedParams(permitSpec) {
|
|
1436
|
-
/**
|
|
1437
|
-
* Attributes.
|
|
1438
|
-
@type {string[]} */
|
|
1393
|
+
/** @type {string[]} */
|
|
1439
1394
|
const attributes = []
|
|
1440
|
-
/**
|
|
1441
|
-
* Nested.
|
|
1442
|
-
@type {Record<string, {attributes: string[], nested: Record<string, ?>}>} */
|
|
1395
|
+
/** @type {Record<string, {attributes: string[], nested: Record<string, ?>}>} */
|
|
1443
1396
|
const nested = {}
|
|
1444
1397
|
|
|
1445
1398
|
if (!Array.isArray(permitSpec)) return {attributes, nested}
|
|
@@ -1471,6 +1424,15 @@ function parsePermittedParams(permitSpec) {
|
|
|
1471
1424
|
return {attributes, nested}
|
|
1472
1425
|
}
|
|
1473
1426
|
|
|
1427
|
+
/**
|
|
1428
|
+
* Narrows a resource to its dynamic virtual setter lookup surface.
|
|
1429
|
+
* @param {FrontendModelBaseResource} resource - Resource instance.
|
|
1430
|
+
* @returns {Record<string, FrontendModelResourceVirtualSetter>} Dynamic virtual setter lookup.
|
|
1431
|
+
*/
|
|
1432
|
+
function virtualSetterLookup(resource) {
|
|
1433
|
+
return /** @type {Record<string, FrontendModelResourceVirtualSetter>} */ (/** @type {unknown} */ (resource))
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1474
1436
|
/**
|
|
1475
1437
|
* Runs filter writable frontend model attributes.
|
|
1476
1438
|
* @param {Record<string, ?>} receiver - Model instance or prototype.
|
|
@@ -1479,28 +1441,32 @@ function parsePermittedParams(permitSpec) {
|
|
|
1479
1441
|
* @param {string[] | null} [permittedAttributeNames] - Optional explicit permit list. `null` falls back to setter-existence checks only.
|
|
1480
1442
|
* @returns {Record<string, ?>} - Writable attributes only.
|
|
1481
1443
|
*/
|
|
1482
|
-
function filterWritableFrontendModelAttributes(
|
|
1483
|
-
|
|
1484
|
-
|
|
1444
|
+
function filterWritableFrontendModelAttributes(
|
|
1445
|
+
receiver,
|
|
1446
|
+
attributes,
|
|
1447
|
+
resource = /** @type {FrontendModelBaseResource | null} */ (null),
|
|
1448
|
+
permittedAttributeNames = null
|
|
1449
|
+
) {
|
|
1485
1450
|
// Frontend-model writes should fail fast when callers submit read-only or unknown attrs.
|
|
1486
1451
|
// Silent drops hide contract mistakes in generated models and app-side wrapper code.
|
|
1487
|
-
/**
|
|
1488
|
-
* Writable attributes.
|
|
1489
|
-
@type {Record<string, ?>} */
|
|
1452
|
+
/** @type {Record<string, ?>} */
|
|
1490
1453
|
const writableAttributes = {}
|
|
1491
|
-
/**
|
|
1492
|
-
* Invalid attributes.
|
|
1493
|
-
@type {string[]} */
|
|
1454
|
+
/** @type {string[]} */
|
|
1494
1455
|
const invalidAttributes = []
|
|
1495
|
-
/**
|
|
1496
|
-
* Not permitted attributes.
|
|
1497
|
-
@type {string[]} */
|
|
1456
|
+
/** @type {string[]} */
|
|
1498
1457
|
const notPermittedAttributes = []
|
|
1499
1458
|
|
|
1500
1459
|
const permitSet = Array.isArray(permittedAttributeNames) ? new Set(permittedAttributeNames) : null
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1460
|
+
/** @type {string[]} */
|
|
1461
|
+
let translatedAttributes = []
|
|
1462
|
+
|
|
1463
|
+
if (resource) {
|
|
1464
|
+
const ResourceClass = /** @type {typeof FrontendModelBaseResource} */ (resource.constructor)
|
|
1465
|
+
|
|
1466
|
+
translatedAttributes = ResourceClass.translatedAttributes || []
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
const translatedSet = new Set(translatedAttributes)
|
|
1504
1470
|
|
|
1505
1471
|
for (const [attributeName, value] of Object.entries(attributes)) {
|
|
1506
1472
|
if (permitSet && !permitSet.has(attributeName)) {
|
|
@@ -1508,19 +1474,16 @@ function filterWritableFrontendModelAttributes(receiver, attributes, resource =
|
|
|
1508
1474
|
continue
|
|
1509
1475
|
}
|
|
1510
1476
|
|
|
1511
|
-
const modelClass = /**
|
|
1477
|
+
const modelClass = /** @type {WritableAttributeReceiverClass} */ (receiver.constructor)
|
|
1512
1478
|
const resolvedAttributeName = (modelClass && typeof modelClass.resolveAttributeName === "function" && modelClass.resolveAttributeName(attributeName)) || attributeName
|
|
1513
1479
|
const requestedSetterName = `set${inflection.camelize(resolvedAttributeName)}`
|
|
1514
1480
|
const setterName = (modelClass && typeof modelClass.findMemberNameInsensitive === "function" && modelClass.findMemberNameInsensitive(receiver, requestedSetterName)) || requestedSetterName
|
|
1515
1481
|
const resourceSetterName = `set${inflection.camelize(attributeName)}Attribute`
|
|
1482
|
+
const resourceSetter = resource ? virtualSetterLookup(resource)[resourceSetterName] : undefined
|
|
1516
1483
|
|
|
1517
1484
|
if (setterName in receiver) {
|
|
1518
1485
|
writableAttributes[attributeName] = value
|
|
1519
|
-
} else if (
|
|
1520
|
-
* Narrows the runtime value to the documented type.
|
|
1521
|
-
@type {Record<string, ?>} */ (/**
|
|
1522
|
-
* Narrows the runtime value to the documented type.
|
|
1523
|
-
@type {?} */ (resource))[resourceSetterName] === "function") {
|
|
1486
|
+
} else if (typeof resourceSetter === "function") {
|
|
1524
1487
|
writableAttributes[attributeName] = value
|
|
1525
1488
|
} else if (translatedSet.has(attributeName)) {
|
|
1526
1489
|
writableAttributes[attributeName] = value
|