velocious 1.0.461 → 1.0.462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/application.js +1 -3
- package/build/background-jobs/cron-expression.js +1 -3
- package/build/background-jobs/forked-runner-child.js +1 -3
- package/build/background-jobs/job.js +1 -3
- package/build/background-jobs/scheduler.js +2 -6
- package/build/background-jobs/store.js +2 -6
- package/build/background-jobs/web/controller.js +1 -3
- package/build/background-jobs/worker.js +1 -3
- package/build/beacon/client.js +2 -6
- package/build/cli/tenant-database-command-helper.js +1 -3
- package/build/configuration.js +29 -32
- package/build/controller.js +4 -14
- package/build/database/drivers/mssql/index.js +1 -3
- package/build/database/drivers/mysql/index.js +2 -6
- package/build/database/drivers/pgsql/index.js +1 -3
- package/build/database/drivers/sqlite/base.js +3 -9
- package/build/database/drivers/sqlite/index.js +3 -9
- package/build/database/drivers/sqlite/table.js +1 -3
- package/build/database/migrator.js +1 -3
- package/build/database/pool/async-tracked-multi-connection.js +20 -45
- package/build/database/pool/base-methods-forward.js +2 -10
- package/build/database/pool/base.js +5 -15
- package/build/database/query/index.js +4 -12
- package/build/database/query/join-object.js +3 -9
- package/build/database/query/model-class-query.js +21 -63
- package/build/database/query/preloader/belongs-to.js +9 -27
- package/build/database/query/preloader/has-many.js +7 -21
- package/build/database/query/preloader/has-one.js +3 -9
- package/build/database/query/preloader.js +6 -18
- package/build/database/query/query-data.js +5 -15
- package/build/database/query/where-model-class-hash.js +5 -15
- package/build/database/query/with-count.js +5 -15
- package/build/database/record/acts-as-list.js +10 -38
- package/build/database/record/attachments/normalize-input.js +7 -25
- package/build/database/record/attachments/storage-drivers/s3.js +4 -12
- package/build/database/record/attachments/store.js +2 -6
- package/build/database/record/index.js +55 -171
- package/build/database/record/instance-relationships/base.js +6 -20
- package/build/database/record/instance-relationships/belongs-to.js +2 -6
- package/build/database/record/instance-relationships/has-many.js +4 -12
- package/build/database/record/instance-relationships/has-one.js +4 -12
- package/build/database/record/relationships/base.js +1 -5
- package/build/database/record/validators/presence.js +1 -3
- package/build/database/record/validators/uniqueness.js +4 -12
- package/build/environment-handlers/browser.js +1 -3
- package/build/environment-handlers/node/cli/commands/console.js +2 -6
- package/build/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
- package/build/environment-handlers/node.js +15 -6
- package/build/frontend-model-controller.js +34 -110
- package/build/frontend-models/base.js +45 -151
- package/build/frontend-models/clear-pending-debounced-callback.js +1 -3
- package/build/frontend-models/preloader.js +3 -9
- package/build/frontend-models/query.js +11 -33
- package/build/frontend-models/resource-definition.js +2 -6
- package/build/frontend-models/transport-serialization.js +7 -21
- package/build/frontend-models/use-destroyed-event.js +2 -6
- package/build/frontend-models/use-model-class-event.js +2 -6
- package/build/frontend-models/use-updated-event.js +3 -9
- package/build/frontend-models/websocket-channel.js +9 -27
- package/build/frontend-models/websocket-publishers.js +12 -23
- package/build/http-server/client/index.js +6 -18
- package/build/http-server/client/params-to-object.js +6 -18
- package/build/http-server/client/request-buffer/index.js +1 -3
- package/build/http-server/client/request-parser.js +1 -3
- package/build/http-server/client/request-runner.js +4 -12
- package/build/http-server/client/websocket-session.js +6 -18
- package/build/http-server/development-reloader.js +2 -6
- package/build/http-server/remote-address.js +1 -5
- package/build/http-server/server-client.js +3 -9
- package/build/http-server/server-lock.js +2 -6
- package/build/http-server/websocket-channel-subscribers.js +2 -6
- package/build/http-server/websocket-event-log-store.js +5 -15
- package/build/http-server/websocket-events-host.js +1 -3
- package/build/http-server/worker-handler/in-process.js +3 -11
- package/build/http-server/worker-handler/worker-thread.js +1 -3
- package/build/logger.js +2 -6
- package/build/mailer/backends/smtp.js +1 -5
- package/build/mailer/base.js +4 -16
- package/build/plugins/sqljs-wasm-route-controller.js +1 -3
- package/build/routes/basic-route.js +1 -3
- package/build/routes/resolver.js +4 -14
- package/build/src/application.d.ts.map +1 -1
- package/build/src/application.js +2 -4
- package/build/src/background-jobs/cron-expression.d.ts.map +1 -1
- package/build/src/background-jobs/cron-expression.js +2 -4
- package/build/src/background-jobs/forked-runner-child.js +2 -4
- package/build/src/background-jobs/job.d.ts.map +1 -1
- package/build/src/background-jobs/job.js +2 -4
- package/build/src/background-jobs/scheduler.d.ts.map +1 -1
- package/build/src/background-jobs/scheduler.js +3 -7
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +3 -7
- package/build/src/background-jobs/web/controller.d.ts.map +1 -1
- package/build/src/background-jobs/web/controller.js +2 -5
- package/build/src/background-jobs/worker.d.ts.map +1 -1
- package/build/src/background-jobs/worker.js +2 -4
- package/build/src/beacon/client.d.ts.map +1 -1
- package/build/src/beacon/client.js +3 -7
- package/build/src/cli/tenant-database-command-helper.d.ts.map +1 -1
- package/build/src/cli/tenant-database-command-helper.js +2 -4
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +27 -35
- package/build/src/controller.d.ts.map +1 -1
- package/build/src/controller.js +5 -15
- package/build/src/database/drivers/mssql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/index.js +2 -4
- package/build/src/database/drivers/mysql/index.d.ts.map +1 -1
- package/build/src/database/drivers/mysql/index.js +3 -7
- package/build/src/database/drivers/pgsql/index.d.ts.map +1 -1
- package/build/src/database/drivers/pgsql/index.js +2 -4
- package/build/src/database/drivers/sqlite/base.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/base.js +4 -10
- package/build/src/database/drivers/sqlite/index.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/index.js +4 -10
- package/build/src/database/drivers/sqlite/table.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/table.js +2 -4
- package/build/src/database/migrator.d.ts.map +1 -1
- package/build/src/database/migrator.js +2 -4
- package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
- package/build/src/database/pool/async-tracked-multi-connection.js +21 -47
- package/build/src/database/pool/base-methods-forward.d.ts.map +1 -1
- package/build/src/database/pool/base-methods-forward.js +3 -11
- package/build/src/database/pool/base.d.ts.map +1 -1
- package/build/src/database/pool/base.js +6 -16
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +5 -13
- package/build/src/database/query/join-object.d.ts.map +1 -1
- package/build/src/database/query/join-object.js +4 -10
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +22 -64
- package/build/src/database/query/preloader/belongs-to.d.ts.map +1 -1
- package/build/src/database/query/preloader/belongs-to.js +10 -28
- package/build/src/database/query/preloader/has-many.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-many.js +8 -22
- package/build/src/database/query/preloader/has-one.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-one.js +4 -10
- package/build/src/database/query/preloader.d.ts.map +1 -1
- package/build/src/database/query/preloader.js +7 -20
- package/build/src/database/query/query-data.d.ts.map +1 -1
- package/build/src/database/query/query-data.js +6 -16
- package/build/src/database/query/where-model-class-hash.d.ts.map +1 -1
- package/build/src/database/query/where-model-class-hash.js +6 -16
- package/build/src/database/query/with-count.d.ts.map +1 -1
- package/build/src/database/query/with-count.js +6 -17
- package/build/src/database/record/acts-as-list.d.ts.map +1 -1
- package/build/src/database/record/acts-as-list.js +11 -47
- package/build/src/database/record/attachments/normalize-input.d.ts.map +1 -1
- package/build/src/database/record/attachments/normalize-input.js +8 -30
- package/build/src/database/record/attachments/storage-drivers/s3.d.ts.map +1 -1
- package/build/src/database/record/attachments/storage-drivers/s3.js +5 -13
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +3 -7
- package/build/src/database/record/index.d.ts +4 -9
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +53 -173
- package/build/src/database/record/instance-relationships/base.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/base.js +7 -21
- package/build/src/database/record/instance-relationships/belongs-to.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/belongs-to.js +3 -7
- package/build/src/database/record/instance-relationships/has-many.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-many.js +5 -13
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +5 -13
- package/build/src/database/record/relationships/base.d.ts.map +1 -1
- package/build/src/database/record/relationships/base.js +2 -6
- package/build/src/database/record/validators/presence.d.ts.map +1 -1
- package/build/src/database/record/validators/presence.js +2 -4
- package/build/src/database/record/validators/uniqueness.d.ts.map +1 -1
- package/build/src/database/record/validators/uniqueness.js +5 -14
- package/build/src/environment-handlers/browser.d.ts.map +1 -1
- package/build/src/environment-handlers/browser.js +2 -4
- package/build/src/environment-handlers/node/cli/commands/console.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/console.js +3 -7
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/db/schema/load.js +2 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +38 -0
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +58 -12
- package/build/src/environment-handlers/node.d.ts.map +1 -1
- package/build/src/environment-handlers/node.js +16 -7
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +35 -114
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +46 -158
- package/build/src/frontend-models/clear-pending-debounced-callback.d.ts.map +1 -1
- package/build/src/frontend-models/clear-pending-debounced-callback.js +2 -4
- package/build/src/frontend-models/preloader.d.ts.map +1 -1
- package/build/src/frontend-models/preloader.js +4 -11
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +12 -34
- package/build/src/frontend-models/resource-definition.d.ts.map +1 -1
- package/build/src/frontend-models/resource-definition.js +3 -7
- package/build/src/frontend-models/transport-serialization.d.ts.map +1 -1
- package/build/src/frontend-models/transport-serialization.js +8 -23
- package/build/src/frontend-models/use-destroyed-event.js +3 -7
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +3 -7
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +4 -10
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +10 -32
- package/build/src/frontend-models/websocket-publishers.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-publishers.js +14 -25
- package/build/src/http-server/client/index.d.ts.map +1 -1
- package/build/src/http-server/client/index.js +7 -21
- package/build/src/http-server/client/params-to-object.d.ts.map +1 -1
- package/build/src/http-server/client/params-to-object.js +7 -21
- package/build/src/http-server/client/request-buffer/index.d.ts.map +1 -1
- package/build/src/http-server/client/request-buffer/index.js +2 -4
- package/build/src/http-server/client/request-parser.d.ts.map +1 -1
- package/build/src/http-server/client/request-parser.js +2 -4
- package/build/src/http-server/client/request-runner.d.ts.map +1 -1
- package/build/src/http-server/client/request-runner.js +5 -14
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +7 -20
- package/build/src/http-server/development-reloader.d.ts.map +1 -1
- package/build/src/http-server/development-reloader.js +3 -7
- package/build/src/http-server/remote-address.d.ts.map +1 -1
- package/build/src/http-server/remote-address.js +2 -6
- package/build/src/http-server/server-client.d.ts.map +1 -1
- package/build/src/http-server/server-client.js +4 -10
- package/build/src/http-server/server-lock.d.ts.map +1 -1
- package/build/src/http-server/server-lock.js +3 -7
- package/build/src/http-server/websocket-channel-subscribers.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel-subscribers.js +3 -7
- package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
- package/build/src/http-server/websocket-event-log-store.js +6 -16
- package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
- package/build/src/http-server/websocket-events-host.js +2 -5
- package/build/src/http-server/worker-handler/in-process.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/in-process.js +4 -12
- package/build/src/http-server/worker-handler/worker-thread.d.ts.map +1 -1
- package/build/src/http-server/worker-handler/worker-thread.js +2 -4
- package/build/src/logger.d.ts.map +1 -1
- package/build/src/logger.js +3 -7
- package/build/src/mailer/backends/smtp.d.ts.map +1 -1
- package/build/src/mailer/backends/smtp.js +2 -6
- package/build/src/mailer/base.d.ts.map +1 -1
- package/build/src/mailer/base.js +5 -17
- package/build/src/plugins/sqljs-wasm-route-controller.d.ts.map +1 -1
- package/build/src/plugins/sqljs-wasm-route-controller.js +2 -4
- package/build/src/routes/basic-route.d.ts.map +1 -1
- package/build/src/routes/basic-route.js +2 -4
- package/build/src/routes/resolver.d.ts.map +1 -1
- package/build/src/routes/resolver.js +5 -15
- package/build/src/testing/expect-utils.d.ts.map +1 -1
- package/build/src/testing/expect-utils.js +9 -27
- package/build/src/testing/expect.d.ts.map +1 -1
- package/build/src/testing/expect.js +5 -15
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +4 -10
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +5 -17
- package/build/src/utils/model-scope.d.ts.map +1 -1
- package/build/src/utils/model-scope.js +2 -5
- package/build/src/utils/ransack.d.ts.map +1 -1
- package/build/src/utils/ransack.js +15 -42
- package/build/src/utils/with-tracked-stack-async-hooks.d.ts.map +1 -1
- package/build/src/utils/with-tracked-stack-async-hooks.js +4 -12
- package/build/src/utils/with-tracked-stack.d.ts.map +1 -1
- package/build/src/utils/with-tracked-stack.js +3 -8
- package/build/testing/expect-utils.js +8 -26
- package/build/testing/expect.js +4 -14
- package/build/testing/test-runner.js +3 -9
- package/build/testing/test.js +4 -12
- package/build/utils/model-scope.js +1 -3
- package/build/utils/ransack.js +15 -41
- package/build/utils/with-tracked-stack-async-hooks.js +3 -9
- package/build/utils/with-tracked-stack.js +2 -6
- package/package.json +3 -2
- package/src/application.js +1 -3
- package/src/background-jobs/cron-expression.js +1 -3
- package/src/background-jobs/forked-runner-child.js +1 -3
- package/src/background-jobs/job.js +1 -3
- package/src/background-jobs/scheduler.js +2 -6
- package/src/background-jobs/store.js +2 -6
- package/src/background-jobs/web/controller.js +1 -3
- package/src/background-jobs/worker.js +1 -3
- package/src/beacon/client.js +2 -6
- package/src/cli/tenant-database-command-helper.js +1 -3
- package/src/configuration.js +29 -32
- package/src/controller.js +4 -14
- package/src/database/drivers/mssql/index.js +1 -3
- package/src/database/drivers/mysql/index.js +2 -6
- package/src/database/drivers/pgsql/index.js +1 -3
- package/src/database/drivers/sqlite/base.js +3 -9
- package/src/database/drivers/sqlite/index.js +3 -9
- package/src/database/drivers/sqlite/table.js +1 -3
- package/src/database/migrator.js +1 -3
- package/src/database/pool/async-tracked-multi-connection.js +20 -45
- package/src/database/pool/base-methods-forward.js +2 -10
- package/src/database/pool/base.js +5 -15
- package/src/database/query/index.js +4 -12
- package/src/database/query/join-object.js +3 -9
- package/src/database/query/model-class-query.js +21 -63
- package/src/database/query/preloader/belongs-to.js +9 -27
- package/src/database/query/preloader/has-many.js +7 -21
- package/src/database/query/preloader/has-one.js +3 -9
- package/src/database/query/preloader.js +6 -18
- package/src/database/query/query-data.js +5 -15
- package/src/database/query/where-model-class-hash.js +5 -15
- package/src/database/query/with-count.js +5 -15
- package/src/database/record/acts-as-list.js +10 -38
- package/src/database/record/attachments/normalize-input.js +7 -25
- package/src/database/record/attachments/storage-drivers/s3.js +4 -12
- package/src/database/record/attachments/store.js +2 -6
- package/src/database/record/index.js +55 -171
- package/src/database/record/instance-relationships/base.js +6 -20
- package/src/database/record/instance-relationships/belongs-to.js +2 -6
- package/src/database/record/instance-relationships/has-many.js +4 -12
- package/src/database/record/instance-relationships/has-one.js +4 -12
- package/src/database/record/relationships/base.js +1 -5
- package/src/database/record/validators/presence.js +1 -3
- package/src/database/record/validators/uniqueness.js +4 -12
- package/src/environment-handlers/browser.js +1 -3
- package/src/environment-handlers/node/cli/commands/console.js +2 -6
- package/src/environment-handlers/node/cli/commands/db/schema/load.js +1 -3
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +67 -11
- package/src/environment-handlers/node.js +15 -6
- package/src/frontend-model-controller.js +34 -110
- package/src/frontend-models/base.js +45 -151
- package/src/frontend-models/clear-pending-debounced-callback.js +1 -3
- package/src/frontend-models/preloader.js +3 -9
- package/src/frontend-models/query.js +11 -33
- package/src/frontend-models/resource-definition.js +2 -6
- package/src/frontend-models/transport-serialization.js +7 -21
- package/src/frontend-models/use-destroyed-event.js +2 -6
- package/src/frontend-models/use-model-class-event.js +2 -6
- package/src/frontend-models/use-updated-event.js +3 -9
- package/src/frontend-models/websocket-channel.js +9 -27
- package/src/frontend-models/websocket-publishers.js +12 -23
- package/src/http-server/client/index.js +6 -18
- package/src/http-server/client/params-to-object.js +6 -18
- package/src/http-server/client/request-buffer/index.js +1 -3
- package/src/http-server/client/request-parser.js +1 -3
- package/src/http-server/client/request-runner.js +4 -12
- package/src/http-server/client/websocket-session.js +6 -18
- package/src/http-server/development-reloader.js +2 -6
- package/src/http-server/remote-address.js +1 -5
- package/src/http-server/server-client.js +3 -9
- package/src/http-server/server-lock.js +2 -6
- package/src/http-server/websocket-channel-subscribers.js +2 -6
- package/src/http-server/websocket-event-log-store.js +5 -15
- package/src/http-server/websocket-events-host.js +1 -3
- package/src/http-server/worker-handler/in-process.js +3 -11
- package/src/http-server/worker-handler/worker-thread.js +1 -3
- package/src/logger.js +2 -6
- package/src/mailer/backends/smtp.js +1 -5
- package/src/mailer/base.js +4 -16
- package/src/plugins/sqljs-wasm-route-controller.js +1 -3
- package/src/routes/basic-route.js +1 -3
- package/src/routes/resolver.js +4 -14
- package/src/testing/expect-utils.js +8 -26
- package/src/testing/expect.js +4 -14
- package/src/testing/test-runner.js +3 -9
- package/src/testing/test.js +4 -12
- package/src/utils/model-scope.js +1 -3
- package/src/utils/ransack.js +15 -41
- package/src/utils/with-tracked-stack-async-hooks.js +3 -9
- package/src/utils/with-tracked-stack.js +2 -6
|
@@ -669,9 +669,7 @@ function frontendAttachmentValueIsBytes(value) {
|
|
|
669
669
|
* @returns {value is {arrayBuffer: () => Promise<ArrayBuffer>}} - Whether candidate supports arrayBuffer().
|
|
670
670
|
*/
|
|
671
671
|
function frontendAttachmentValueSupportsArrayBuffer(value) {
|
|
672
|
-
return Boolean(value && typeof value === "object" && typeof /**
|
|
673
|
-
* Narrows the runtime value to the documented type.
|
|
674
|
-
* @type {?} */ (value).arrayBuffer === "function")
|
|
672
|
+
return Boolean(value && typeof value === "object" && typeof /** @type {?} */ (value).arrayBuffer === "function")
|
|
675
673
|
}
|
|
676
674
|
|
|
677
675
|
/**
|
|
@@ -682,12 +680,8 @@ function frontendAttachmentValueSupportsArrayBuffer(value) {
|
|
|
682
680
|
function frontendAttachmentNormalizeBytes(value) {
|
|
683
681
|
if (value instanceof Uint8Array) return value
|
|
684
682
|
if (value instanceof ArrayBuffer) return new Uint8Array(value)
|
|
685
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer(/**
|
|
686
|
-
|
|
687
|
-
* @type {?} */ (value))) {
|
|
688
|
-
return new Uint8Array(/**
|
|
689
|
-
* Narrows the runtime value to the documented type.
|
|
690
|
-
* @type {Buffer} */ (value))
|
|
683
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(/** @type {?} */ (value))) {
|
|
684
|
+
return new Uint8Array(/** @type {Buffer} */ (value))
|
|
691
685
|
}
|
|
692
686
|
|
|
693
687
|
throw new Error("Unsupported attachment bytes value")
|
|
@@ -818,31 +812,17 @@ async function normalizeFrontendAttachmentInput(input) {
|
|
|
818
812
|
|
|
819
813
|
return {
|
|
820
814
|
contentBase64: frontendAttachmentBytesToBase64(bytes),
|
|
821
|
-
contentType: typeof /**
|
|
822
|
-
|
|
823
|
-
* @type {?} */ (input).type === "string" && /**
|
|
824
|
-
* Narrows the runtime value to the documented type.
|
|
825
|
-
* @type {?} */ (input).type.length > 0
|
|
826
|
-
? /**
|
|
827
|
-
* Narrows the runtime value to the documented type.
|
|
828
|
-
* @type {?} */ (input).type
|
|
815
|
+
contentType: typeof /** @type {?} */ (input).type === "string" && /** @type {?} */ (input).type.length > 0
|
|
816
|
+
? /** @type {?} */ (input).type
|
|
829
817
|
: null,
|
|
830
|
-
filename: typeof /**
|
|
831
|
-
|
|
832
|
-
* @type {?} */ (input).name === "string" && /**
|
|
833
|
-
* Narrows the runtime value to the documented type.
|
|
834
|
-
* @type {?} */ (input).name.length > 0
|
|
835
|
-
? /**
|
|
836
|
-
* Narrows the runtime value to the documented type.
|
|
837
|
-
* @type {?} */ (input).name
|
|
818
|
+
filename: typeof /** @type {?} */ (input).name === "string" && /** @type {?} */ (input).name.length > 0
|
|
819
|
+
? /** @type {?} */ (input).name
|
|
838
820
|
: "attachment.bin"
|
|
839
821
|
}
|
|
840
822
|
}
|
|
841
823
|
|
|
842
824
|
if (frontendAttachmentValueIsBytes(input)) {
|
|
843
|
-
const bytes = frontendAttachmentNormalizeBytes(/**
|
|
844
|
-
* Narrows the runtime value to the documented type.
|
|
845
|
-
* @type {Uint8Array | Buffer | ArrayBuffer} */ (input))
|
|
825
|
+
const bytes = frontendAttachmentNormalizeBytes(/** @type {Uint8Array | Buffer | ArrayBuffer} */ (input))
|
|
846
826
|
|
|
847
827
|
return {
|
|
848
828
|
contentBase64: frontendAttachmentBytesToBase64(bytes),
|
|
@@ -1141,12 +1121,8 @@ function mergeFrontendModelEventPreload(target, source) {
|
|
|
1141
1121
|
}
|
|
1142
1122
|
|
|
1143
1123
|
mergeFrontendModelEventPreload(
|
|
1144
|
-
/**
|
|
1145
|
-
|
|
1146
|
-
* @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (target[relationshipName]),
|
|
1147
|
-
/**
|
|
1148
|
-
* Narrows the runtime value to the documented type.
|
|
1149
|
-
* @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (value)
|
|
1124
|
+
/** @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (target[relationshipName]),
|
|
1125
|
+
/** @type {Record<string, import("./query.js").FrontendModelTransportValue>} */ (value)
|
|
1150
1126
|
)
|
|
1151
1127
|
}
|
|
1152
1128
|
}
|
|
@@ -1236,9 +1212,7 @@ function mergeFrontendModelEventProjectionPayload(target, source) {
|
|
|
1236
1212
|
function frontendModelMatchedEventFilterKeys(body) {
|
|
1237
1213
|
if (!body || typeof body !== "object") return new Set()
|
|
1238
1214
|
|
|
1239
|
-
const keys = /**
|
|
1240
|
-
* Narrows the runtime value to the documented type.
|
|
1241
|
-
* @type {{matchedEventFilterKeys?: ?}} */ (body).matchedEventFilterKeys
|
|
1215
|
+
const keys = /** @type {{matchedEventFilterKeys?: ?}} */ (body).matchedEventFilterKeys
|
|
1242
1216
|
|
|
1243
1217
|
if (!Array.isArray(keys)) return new Set()
|
|
1244
1218
|
|
|
@@ -1406,9 +1380,7 @@ class FrontendModelEventSubscription {
|
|
|
1406
1380
|
return
|
|
1407
1381
|
}
|
|
1408
1382
|
|
|
1409
|
-
const client = /**
|
|
1410
|
-
* Narrows the runtime value to the documented type.
|
|
1411
|
-
* @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
1383
|
+
const client = /** @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
1412
1384
|
|
|
1413
1385
|
if (!client || typeof client.subscribeChannel !== "function") {
|
|
1414
1386
|
throw new Error("Frontend model event subscriptions require configureTransport({websocketUrl}) or configureTransport({websocketClient})")
|
|
@@ -1422,9 +1394,7 @@ class FrontendModelEventSubscription {
|
|
|
1422
1394
|
this.subscriptionParamsKey = JSON.stringify(params)
|
|
1423
1395
|
this.channelHandle = client.subscribeChannel(FRONTEND_MODELS_CHANNEL_NAME, {
|
|
1424
1396
|
params,
|
|
1425
|
-
onMessage: (/**
|
|
1426
|
-
* Narrows the runtime value to the documented type.
|
|
1427
|
-
* @type {?} */ body) => this._dispatchEvent(body),
|
|
1397
|
+
onMessage: (/** @type {?} */ body) => this._dispatchEvent(body),
|
|
1428
1398
|
onClose: () => {
|
|
1429
1399
|
this.channelHandle = null
|
|
1430
1400
|
this.readyPromise = null
|
|
@@ -1479,12 +1449,8 @@ class FrontendModelEventSubscription {
|
|
|
1479
1449
|
|
|
1480
1450
|
if (!body.record || typeof body.record !== "object") return
|
|
1481
1451
|
|
|
1482
|
-
const deserializedRecord = /**
|
|
1483
|
-
|
|
1484
|
-
* @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(body.record))
|
|
1485
|
-
const freshModel = /**
|
|
1486
|
-
* Narrows the runtime value to the documented type.
|
|
1487
|
-
* @type {?} */ (this.ModelClass).instantiateFromResponse(deserializedRecord)
|
|
1452
|
+
const deserializedRecord = /** @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(body.record))
|
|
1453
|
+
const freshModel = /** @type {?} */ (this.ModelClass).instantiateFromResponse(deserializedRecord)
|
|
1488
1454
|
const listener = this.instanceListeners.get(id)
|
|
1489
1455
|
|
|
1490
1456
|
if (action === "update" && listener) {
|
|
@@ -1495,9 +1461,7 @@ class FrontendModelEventSubscription {
|
|
|
1495
1461
|
if (matchingUpdateCallbacks.length > 0) {
|
|
1496
1462
|
// Auto-merge into the registered instance so callers reading
|
|
1497
1463
|
// through the same handle see fresh attributes.
|
|
1498
|
-
const instanceAny = /**
|
|
1499
|
-
* Narrows the runtime value to the documented type.
|
|
1500
|
-
* @type {?} */ (listener.instance)
|
|
1464
|
+
const instanceAny = /** @type {?} */ (listener.instance)
|
|
1501
1465
|
|
|
1502
1466
|
instanceAny.assignAttributes(freshModel.attributes())
|
|
1503
1467
|
instanceAny._persistedAttributes = cloneFrontendModelAttributes(listener.instance.attributes())
|
|
@@ -1765,9 +1729,7 @@ async function flushPendingSharedFrontendModelRequests() {
|
|
|
1765
1729
|
continue
|
|
1766
1730
|
}
|
|
1767
1731
|
|
|
1768
|
-
request.resolve(/**
|
|
1769
|
-
* Narrows the runtime value to the documented type.
|
|
1770
|
-
* @type {Record<string, ?>} */ (responsePayload))
|
|
1732
|
+
request.resolve(/** @type {Record<string, ?>} */ (responsePayload))
|
|
1771
1733
|
}
|
|
1772
1734
|
} catch (error) {
|
|
1773
1735
|
for (const request of batchedRequests) {
|
|
@@ -1871,9 +1833,7 @@ function assertDefinedFindByConditionValue(value, keyPath) {
|
|
|
1871
1833
|
return
|
|
1872
1834
|
}
|
|
1873
1835
|
|
|
1874
|
-
const objectValue = /**
|
|
1875
|
-
* Narrows the runtime value to the documented type.
|
|
1876
|
-
* @type {Record<string, ?>} */ (value)
|
|
1836
|
+
const objectValue = /** @type {Record<string, ?>} */ (value)
|
|
1877
1837
|
const prototype = Object.getPrototypeOf(objectValue)
|
|
1878
1838
|
|
|
1879
1839
|
if (prototype !== Object.prototype && prototype !== null) {
|
|
@@ -1886,9 +1846,7 @@ function assertDefinedFindByConditionValue(value, keyPath) {
|
|
|
1886
1846
|
throw new Error(`findBy does not support symbol condition keys (key: ${keyPath})`)
|
|
1887
1847
|
}
|
|
1888
1848
|
|
|
1889
|
-
const valueObject = /**
|
|
1890
|
-
* Narrows the runtime value to the documented type.
|
|
1891
|
-
* @type {Record<string, ?>} */ (value)
|
|
1849
|
+
const valueObject = /** @type {Record<string, ?>} */ (value)
|
|
1892
1850
|
|
|
1893
1851
|
Object.keys(valueObject).forEach((nestedKey) => {
|
|
1894
1852
|
assertDefinedFindByConditionValue(valueObject[nestedKey], `${keyPath}.${nestedKey}`)
|
|
@@ -2001,9 +1959,7 @@ export default class FrontendModelBase {
|
|
|
2001
1959
|
if (this._generatedAttachmentMethods) return
|
|
2002
1960
|
|
|
2003
1961
|
const attachments = this.attachmentDefinitions()
|
|
2004
|
-
const prototype = /**
|
|
2005
|
-
* Narrows the runtime value to the documented type.
|
|
2006
|
-
* @type {Record<string, ?>} */ (this.prototype)
|
|
1962
|
+
const prototype = /** @type {Record<string, ?>} */ (this.prototype)
|
|
2007
1963
|
|
|
2008
1964
|
for (const attachmentName of Object.keys(attachments)) {
|
|
2009
1965
|
if (!(attachmentName in prototype)) {
|
|
@@ -2507,11 +2463,7 @@ export default class FrontendModelBase {
|
|
|
2507
2463
|
* @returns {number}
|
|
2508
2464
|
*/
|
|
2509
2465
|
readCount(attributeName) {
|
|
2510
|
-
return readPayloadAssociationCount(/**
|
|
2511
|
-
* Narrows the runtime value to the documented type.
|
|
2512
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2513
|
-
* Narrows the runtime value to the documented type.
|
|
2514
|
-
* @type {?} */ (this)), attributeName)
|
|
2466
|
+
return readPayloadAssociationCount(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), attributeName)
|
|
2515
2467
|
}
|
|
2516
2468
|
|
|
2517
2469
|
/**
|
|
@@ -2522,11 +2474,7 @@ export default class FrontendModelBase {
|
|
|
2522
2474
|
* @returns {void}
|
|
2523
2475
|
*/
|
|
2524
2476
|
_setAssociationCount(attributeName, value) {
|
|
2525
|
-
setPayloadAssociationCount(/**
|
|
2526
|
-
* Narrows the runtime value to the documented type.
|
|
2527
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2528
|
-
* Narrows the runtime value to the documented type.
|
|
2529
|
-
* @type {?} */ (this)), attributeName, value)
|
|
2477
|
+
setPayloadAssociationCount(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), attributeName, value)
|
|
2530
2478
|
}
|
|
2531
2479
|
|
|
2532
2480
|
/**
|
|
@@ -2541,11 +2489,7 @@ export default class FrontendModelBase {
|
|
|
2541
2489
|
* @returns {boolean}
|
|
2542
2490
|
*/
|
|
2543
2491
|
can(action) {
|
|
2544
|
-
return readPayloadComputedAbility(/**
|
|
2545
|
-
* Narrows the runtime value to the documented type.
|
|
2546
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2547
|
-
* Narrows the runtime value to the documented type.
|
|
2548
|
-
* @type {?} */ (this)), action)
|
|
2492
|
+
return readPayloadComputedAbility(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), action)
|
|
2549
2493
|
}
|
|
2550
2494
|
|
|
2551
2495
|
/**
|
|
@@ -2557,11 +2501,7 @@ export default class FrontendModelBase {
|
|
|
2557
2501
|
* @returns {void}
|
|
2558
2502
|
*/
|
|
2559
2503
|
_setComputedAbility(action, value) {
|
|
2560
|
-
setPayloadComputedAbility(/**
|
|
2561
|
-
* Narrows the runtime value to the documented type.
|
|
2562
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2563
|
-
* Narrows the runtime value to the documented type.
|
|
2564
|
-
* @type {?} */ (this)), action, value)
|
|
2504
|
+
setPayloadComputedAbility(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), action, value)
|
|
2565
2505
|
}
|
|
2566
2506
|
|
|
2567
2507
|
/**
|
|
@@ -2574,11 +2514,7 @@ export default class FrontendModelBase {
|
|
|
2574
2514
|
* @returns {?}
|
|
2575
2515
|
*/
|
|
2576
2516
|
queryData(name) {
|
|
2577
|
-
return readPayloadQueryData(/**
|
|
2578
|
-
* Narrows the runtime value to the documented type.
|
|
2579
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2580
|
-
* Narrows the runtime value to the documented type.
|
|
2581
|
-
* @type {?} */ (this)), name)
|
|
2517
|
+
return readPayloadQueryData(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), name)
|
|
2582
2518
|
}
|
|
2583
2519
|
|
|
2584
2520
|
/**
|
|
@@ -2589,11 +2525,7 @@ export default class FrontendModelBase {
|
|
|
2589
2525
|
* @returns {void}
|
|
2590
2526
|
*/
|
|
2591
2527
|
_setQueryData(name, value) {
|
|
2592
|
-
setPayloadQueryData(/**
|
|
2593
|
-
* Narrows the runtime value to the documented type.
|
|
2594
|
-
* @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/**
|
|
2595
|
-
* Narrows the runtime value to the documented type.
|
|
2596
|
-
* @type {?} */ (this)), name, value)
|
|
2528
|
+
setPayloadQueryData(/** @type {import("../record-payload-values.js").RecordPayloadValuesTarget} */ (/** @type {?} */ (this)), name, value)
|
|
2597
2529
|
}
|
|
2598
2530
|
|
|
2599
2531
|
/**
|
|
@@ -2654,9 +2586,7 @@ export default class FrontendModelBase {
|
|
|
2654
2586
|
const definitions = ModelClass.relationshipDefinitions()
|
|
2655
2587
|
|
|
2656
2588
|
for (const relationshipName of Object.keys(this._relationships)) {
|
|
2657
|
-
const definition = /**
|
|
2658
|
-
* Narrows the runtime value to the documented type.
|
|
2659
|
-
* @type {?} */ (definitions[relationshipName])
|
|
2589
|
+
const definition = /** @type {?} */ (definitions[relationshipName])
|
|
2660
2590
|
|
|
2661
2591
|
if (!definition || definition.type !== "belongsTo") continue
|
|
2662
2592
|
|
|
@@ -2868,9 +2798,7 @@ export default class FrontendModelBase {
|
|
|
2868
2798
|
* @returns {void}
|
|
2869
2799
|
*/
|
|
2870
2800
|
static setWebsocketMetadata(key, value) {
|
|
2871
|
-
const client = /**
|
|
2872
|
-
* Narrows the runtime value to the documented type.
|
|
2873
|
-
* @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2801
|
+
const client = /** @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2874
2802
|
|
|
2875
2803
|
if (!client || typeof client.setMetadata !== "function") return
|
|
2876
2804
|
|
|
@@ -2932,9 +2860,7 @@ export default class FrontendModelBase {
|
|
|
2932
2860
|
// WS client not ready — retry. Check the actual client (which
|
|
2933
2861
|
// may be an injected websocketClient) instead of websocketState()
|
|
2934
2862
|
// which only reflects the internal client.
|
|
2935
|
-
const client = /**
|
|
2936
|
-
* Narrows the runtime value to the documented type.
|
|
2937
|
-
* @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2863
|
+
const client = /** @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2938
2864
|
|
|
2939
2865
|
if (!client || !client.isOpen()) {
|
|
2940
2866
|
if (retryTimer === null) {
|
|
@@ -2982,9 +2908,7 @@ export default class FrontendModelBase {
|
|
|
2982
2908
|
* @returns {{ready: Promise<void>, close: () => void}} - Websocket connection handle.
|
|
2983
2909
|
*/
|
|
2984
2910
|
static openWebsocketConnection(connectionType, options) {
|
|
2985
|
-
const client = /**
|
|
2986
|
-
* Narrows the runtime value to the documented type.
|
|
2987
|
-
* @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2911
|
+
const client = /** @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2988
2912
|
|
|
2989
2913
|
if (!client || typeof client.openConnection !== "function") {
|
|
2990
2914
|
throw new Error("openWebsocketConnection requires configureTransport({websocketUrl})")
|
|
@@ -3001,9 +2925,7 @@ export default class FrontendModelBase {
|
|
|
3001
2925
|
* @returns {{ready: Promise<void>, close: () => void}} - Websocket channel handle from the configured client.
|
|
3002
2926
|
*/
|
|
3003
2927
|
static subscribeWebsocketChannel(channelType, options) {
|
|
3004
|
-
const client = /**
|
|
3005
|
-
* Narrows the runtime value to the documented type.
|
|
3006
|
-
* @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
2928
|
+
const client = /** @type {?} */ (frontendModelTransportConfig.websocketClient || resolveInternalWebsocketClient())
|
|
3007
2929
|
|
|
3008
2930
|
if (!client || typeof client.subscribeChannel !== "function") {
|
|
3009
2931
|
throw new Error("subscribeWebsocketChannel requires configureTransport({websocketUrl})")
|
|
@@ -3074,22 +2996,16 @@ export default class FrontendModelBase {
|
|
|
3074
2996
|
? /** @type {Record<string, FrontendModelAttributeValue>} */ (attributes[PRELOADED_RELATIONSHIPS_KEY])
|
|
3075
2997
|
: {}
|
|
3076
2998
|
const associationCounts = isPlainObject(attributes[ASSOCIATION_COUNTS_KEY])
|
|
3077
|
-
? /**
|
|
3078
|
-
* Narrows the runtime value to the documented type.
|
|
3079
|
-
* @type {Record<string, number>} */ (attributes[ASSOCIATION_COUNTS_KEY])
|
|
2999
|
+
? /** @type {Record<string, number>} */ (attributes[ASSOCIATION_COUNTS_KEY])
|
|
3080
3000
|
: {}
|
|
3081
3001
|
const queryData = isPlainObject(attributes[QUERY_DATA_KEY])
|
|
3082
3002
|
? /** @type {Record<string, FrontendModelAttributeValue>} */ (attributes[QUERY_DATA_KEY])
|
|
3083
3003
|
: {}
|
|
3084
3004
|
const abilities = isPlainObject(attributes[ABILITIES_KEY])
|
|
3085
|
-
? /**
|
|
3086
|
-
* Narrows the runtime value to the documented type.
|
|
3087
|
-
* @type {Record<string, boolean>} */ (attributes[ABILITIES_KEY])
|
|
3005
|
+
? /** @type {Record<string, boolean>} */ (attributes[ABILITIES_KEY])
|
|
3088
3006
|
: {}
|
|
3089
3007
|
const selectedAttributesFromPayload = Array.isArray(attributes[SELECTED_ATTRIBUTES_KEY])
|
|
3090
|
-
? new Set(/**
|
|
3091
|
-
* Narrows the runtime value to the documented type.
|
|
3092
|
-
* @type {string[]} */ (attributes[SELECTED_ATTRIBUTES_KEY]).filter((attributeName) => typeof attributeName === "string"))
|
|
3008
|
+
? new Set(/** @type {string[]} */ (attributes[SELECTED_ATTRIBUTES_KEY]).filter((attributeName) => typeof attributeName === "string"))
|
|
3093
3009
|
: null
|
|
3094
3010
|
|
|
3095
3011
|
delete attributes[PRELOADED_RELATIONSHIPS_KEY]
|
|
@@ -3434,9 +3350,7 @@ export default class FrontendModelBase {
|
|
|
3434
3350
|
* @returns {Promise<() => void>} - Unsubscribe callback.
|
|
3435
3351
|
*/
|
|
3436
3352
|
async onUpdate(callback, options = {}) {
|
|
3437
|
-
const self = /**
|
|
3438
|
-
* Narrows the runtime value to the documented type.
|
|
3439
|
-
* @type {?} */ (this)
|
|
3353
|
+
const self = /** @type {?} */ (this)
|
|
3440
3354
|
const ModelClass = frontendModelClassFor(this)
|
|
3441
3355
|
const sub = ensureFrontendModelEventSubscription(ModelClass)
|
|
3442
3356
|
const id = String(self.id())
|
|
@@ -3466,9 +3380,7 @@ export default class FrontendModelBase {
|
|
|
3466
3380
|
* @returns {Promise<() => void>} - Unsubscribe callback.
|
|
3467
3381
|
*/
|
|
3468
3382
|
async onDestroy(callback, options = {}) {
|
|
3469
|
-
const self = /**
|
|
3470
|
-
* Narrows the runtime value to the documented type.
|
|
3471
|
-
* @type {?} */ (this)
|
|
3383
|
+
const self = /** @type {?} */ (this)
|
|
3472
3384
|
const ModelClass = frontendModelClassFor(this)
|
|
3473
3385
|
|
|
3474
3386
|
assertNoDestroyEventFilter(ModelClass, options)
|
|
@@ -3756,12 +3668,8 @@ export default class FrontendModelBase {
|
|
|
3756
3668
|
return false
|
|
3757
3669
|
}
|
|
3758
3670
|
|
|
3759
|
-
const actualObject = /**
|
|
3760
|
-
|
|
3761
|
-
* @type {Record<string, ?>} */ (actualValue)
|
|
3762
|
-
const expectedObject = /**
|
|
3763
|
-
* Narrows the runtime value to the documented type.
|
|
3764
|
-
* @type {Record<string, ?>} */ (expectedValue)
|
|
3671
|
+
const actualObject = /** @type {Record<string, ?>} */ (actualValue)
|
|
3672
|
+
const expectedObject = /** @type {Record<string, ?>} */ (expectedValue)
|
|
3765
3673
|
const actualKeys = Object.keys(actualObject)
|
|
3766
3674
|
const expectedKeys = Object.keys(expectedObject)
|
|
3767
3675
|
|
|
@@ -4275,9 +4183,7 @@ export default class FrontendModelBase {
|
|
|
4275
4183
|
*/
|
|
4276
4184
|
static async executeCommand(commandType, payload) {
|
|
4277
4185
|
const commandName = this.commandName(commandType)
|
|
4278
|
-
const serializedPayload = /**
|
|
4279
|
-
* Narrows the runtime value to the documented type.
|
|
4280
|
-
* @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
|
|
4186
|
+
const serializedPayload = /** @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
|
|
4281
4187
|
const resourcePath = this.resourcePath()
|
|
4282
4188
|
const containsAttachmentUpload = frontendModelPayloadContainsAttachmentUpload(serializedPayload)
|
|
4283
4189
|
const useSharedTransport = !containsAttachmentUpload
|
|
@@ -4299,9 +4205,7 @@ export default class FrontendModelBase {
|
|
|
4299
4205
|
scheduleSharedFrontendModelRequestFlush()
|
|
4300
4206
|
})
|
|
4301
4207
|
|
|
4302
|
-
const decodedBatchResponse = /**
|
|
4303
|
-
* Narrows the runtime value to the documented type.
|
|
4304
|
-
* @type {Record<string, ?>} */ (batchResponse)
|
|
4208
|
+
const decodedBatchResponse = /** @type {Record<string, ?>} */ (batchResponse)
|
|
4305
4209
|
|
|
4306
4210
|
this.throwOnErrorFrontendModelResponse({
|
|
4307
4211
|
commandType,
|
|
@@ -4330,9 +4234,7 @@ export default class FrontendModelBase {
|
|
|
4330
4234
|
}
|
|
4331
4235
|
|
|
4332
4236
|
const directJson = directResponseText.length > 0 ? JSON.parse(directResponseText) : {}
|
|
4333
|
-
const decodedDirectResponse = /**
|
|
4334
|
-
* Narrows the runtime value to the documented type.
|
|
4335
|
-
* @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(directJson))
|
|
4237
|
+
const decodedDirectResponse = /** @type {Record<string, ?>} */ (deserializeFrontendModelTransportValue(directJson))
|
|
4336
4238
|
|
|
4337
4239
|
this.throwOnErrorFrontendModelResponse({
|
|
4338
4240
|
commandType,
|
|
@@ -4355,9 +4257,7 @@ export default class FrontendModelBase {
|
|
|
4355
4257
|
* @returns {Promise<Record<string, ?>>} - Decoded response payload.
|
|
4356
4258
|
*/
|
|
4357
4259
|
static async executeCustomCommand({commandName, commandType, memberId = null, payload, resourcePath}) {
|
|
4358
|
-
const serializedPayload = /**
|
|
4359
|
-
* Narrows the runtime value to the documented type.
|
|
4360
|
-
* @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
|
|
4260
|
+
const serializedPayload = /** @type {Record<string, ?>} */ (serializeFrontendModelTransportValue(payload))
|
|
4361
4261
|
const customPath = frontendModelCustomCommandPath({
|
|
4362
4262
|
commandName,
|
|
4363
4263
|
memberId,
|
|
@@ -4379,9 +4279,7 @@ export default class FrontendModelBase {
|
|
|
4379
4279
|
scheduleSharedFrontendModelRequestFlush()
|
|
4380
4280
|
})
|
|
4381
4281
|
|
|
4382
|
-
const decodedBatchResponse = /**
|
|
4383
|
-
* Narrows the runtime value to the documented type.
|
|
4384
|
-
* @type {Record<string, ?>} */ (batchResponse)
|
|
4282
|
+
const decodedBatchResponse = /** @type {Record<string, ?>} */ (batchResponse)
|
|
4385
4283
|
|
|
4386
4284
|
this.throwOnErrorFrontendModelResponse({
|
|
4387
4285
|
commandType,
|
|
@@ -4425,9 +4323,7 @@ export default class FrontendModelBase {
|
|
|
4425
4323
|
? response.errorMessage
|
|
4426
4324
|
: `Request failed for ${this.name}#${commandType}`)
|
|
4427
4325
|
|
|
4428
|
-
const error = /**
|
|
4429
|
-
* Narrows the runtime value to the documented type.
|
|
4430
|
-
* @type {Error & {velocious?: Record<string, ?>, errorType?: string, validationErrors?: Record<string, ?>, debugErrorClass?: string, debugBacktrace?: string[]}} */ (new Error(errorMessage))
|
|
4326
|
+
const error = /** @type {Error & {velocious?: Record<string, ?>, errorType?: string, validationErrors?: Record<string, ?>, debugErrorClass?: string, debugBacktrace?: string[]}} */ (new Error(errorMessage))
|
|
4431
4327
|
if (response.velocious && typeof response.velocious === "object") {
|
|
4432
4328
|
error.velocious = response.velocious
|
|
4433
4329
|
}
|
|
@@ -4456,9 +4352,7 @@ export default class FrontendModelBase {
|
|
|
4456
4352
|
* @returns {Set<string>} - Configured frontend model attribute names.
|
|
4457
4353
|
*/
|
|
4458
4354
|
static configuredFrontendModelAttributeNames() {
|
|
4459
|
-
const resourceConfig = /**
|
|
4460
|
-
* Narrows the runtime value to the documented type.
|
|
4461
|
-
* @type {Record<string, ?>} */ (this.resourceConfig())
|
|
4355
|
+
const resourceConfig = /** @type {Record<string, ?>} */ (this.resourceConfig())
|
|
4462
4356
|
const attributes = resourceConfig.attributes
|
|
4463
4357
|
|
|
4464
4358
|
if (Array.isArray(attributes)) {
|
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
* @returns {void}
|
|
7
7
|
*/
|
|
8
8
|
export default function clearPendingDebouncedCallback(callback) {
|
|
9
|
-
const callbackWithClear = /**
|
|
10
|
-
* Narrows the runtime value to the documented type.
|
|
11
|
-
* @type {{clear?: ?}} */ (callback)
|
|
9
|
+
const callbackWithClear = /** @type {{clear?: ?}} */ (callback)
|
|
12
10
|
|
|
13
11
|
if (typeof callbackWithClear.clear === "function") {
|
|
14
12
|
callbackWithClear.clear()
|
|
@@ -22,17 +22,11 @@ export default class FrontendModelPreloader {
|
|
|
22
22
|
static async preload(models, queryOrSpec, {force = false} = {}) {
|
|
23
23
|
if (!models || models.length === 0) return
|
|
24
24
|
|
|
25
|
-
const modelClass = /**
|
|
26
|
-
* Narrows the runtime value to the documented type.
|
|
27
|
-
* @type {import("./base.js").FrontendModelClass} */ (models[0].constructor)
|
|
25
|
+
const modelClass = /** @type {import("./base.js").FrontendModelClass} */ (models[0].constructor)
|
|
28
26
|
const isQuery = Boolean(queryOrSpec) && typeof queryOrSpec === "object" && "_preload" in queryOrSpec
|
|
29
27
|
const query = isQuery
|
|
30
|
-
? /**
|
|
31
|
-
|
|
32
|
-
* @type {import("./query.js").default<import("./base.js").FrontendModelClass>} */ (queryOrSpec)
|
|
33
|
-
: modelClass.preload(/**
|
|
34
|
-
* Narrows the runtime value to the documented type.
|
|
35
|
-
* @type {?} */ (queryOrSpec))
|
|
28
|
+
? /** @type {import("./query.js").default<import("./base.js").FrontendModelClass>} */ (queryOrSpec)
|
|
29
|
+
: modelClass.preload(/** @type {?} */ (queryOrSpec))
|
|
36
30
|
|
|
37
31
|
const topLevelRelationships = Object.keys(query._preload)
|
|
38
32
|
|
|
@@ -179,9 +179,7 @@ function normalizeWithCountFrontend(spec) {
|
|
|
179
179
|
if (value === false) continue
|
|
180
180
|
|
|
181
181
|
if (isPlainObject(value)) {
|
|
182
|
-
const options = /**
|
|
183
|
-
* Narrows the runtime value to the documented type.
|
|
184
|
-
* @type {{relationship?: string, where?: Record<string, ?>}} */ (value)
|
|
182
|
+
const options = /** @type {{relationship?: string, where?: Record<string, ?>}} */ (value)
|
|
185
183
|
entries.push({
|
|
186
184
|
attributeName: key,
|
|
187
185
|
relationshipName: options.relationship || key,
|
|
@@ -280,12 +278,8 @@ function mergePreloadRecord(targetPreload, incomingPreload) {
|
|
|
280
278
|
|
|
281
279
|
if (isPlainObject(existingValue)) {
|
|
282
280
|
mergePreloadRecord(
|
|
283
|
-
/**
|
|
284
|
-
|
|
285
|
-
* @type {import("../database/query/index.js").NestedPreloadRecord} */ (existingValue),
|
|
286
|
-
/**
|
|
287
|
-
* Narrows the runtime value to the documented type.
|
|
288
|
-
* @type {import("../database/query/index.js").NestedPreloadRecord} */ (incomingValue)
|
|
281
|
+
/** @type {import("../database/query/index.js").NestedPreloadRecord} */ (existingValue),
|
|
282
|
+
/** @type {import("../database/query/index.js").NestedPreloadRecord} */ (incomingValue)
|
|
289
283
|
)
|
|
290
284
|
continue
|
|
291
285
|
}
|
|
@@ -378,9 +372,7 @@ export function normalizeSearchOperator(operator) {
|
|
|
378
372
|
">": "gt",
|
|
379
373
|
">=": "gteq"
|
|
380
374
|
}
|
|
381
|
-
const normalizedOperator = operatorAliases[/**
|
|
382
|
-
* Narrows the runtime value to the documented type.
|
|
383
|
-
* @type {"<" | "<=" | ">" | ">="} */ (operator)] || operator
|
|
375
|
+
const normalizedOperator = operatorAliases[/** @type {"<" | "<=" | ">" | ">="} */ (operator)] || operator
|
|
384
376
|
const supportedOperators = new Set(["eq", "like", "notEq", "gt", "gteq", "lt", "lteq"])
|
|
385
377
|
|
|
386
378
|
if (!supportedOperators.has(normalizedOperator)) {
|
|
@@ -961,9 +953,7 @@ export function normalizePluck(pluck) {
|
|
|
961
953
|
* @returns {Set<string>} - Resource attribute names.
|
|
962
954
|
*/
|
|
963
955
|
function frontendModelResourceAttributes(modelClass) {
|
|
964
|
-
const resourceConfig = /**
|
|
965
|
-
* Narrows the runtime value to the documented type.
|
|
966
|
-
* @type {Record<string, ?>} */ (modelClass.resourceConfig())
|
|
956
|
+
const resourceConfig = /** @type {Record<string, ?>} */ (modelClass.resourceConfig())
|
|
967
957
|
const attributes = resourceConfig.attributes
|
|
968
958
|
|
|
969
959
|
if (Array.isArray(attributes)) {
|
|
@@ -1227,9 +1217,7 @@ export default class FrontendModelQuery {
|
|
|
1227
1217
|
queryData(spec) {
|
|
1228
1218
|
if (spec == null) return this
|
|
1229
1219
|
|
|
1230
|
-
this._queryData.push(/**
|
|
1231
|
-
* Narrows the runtime value to the documented type.
|
|
1232
|
-
* @type {?} */ (spec))
|
|
1220
|
+
this._queryData.push(/** @type {?} */ (spec))
|
|
1233
1221
|
|
|
1234
1222
|
return this
|
|
1235
1223
|
}
|
|
@@ -1264,9 +1252,7 @@ export default class FrontendModelQuery {
|
|
|
1264
1252
|
throw new Error(`Cannot apply ${scopeDescriptor.modelClass.name} scope to ${this.modelClass.name} query`)
|
|
1265
1253
|
}
|
|
1266
1254
|
|
|
1267
|
-
const scopedQuery = /**
|
|
1268
|
-
* Narrows the runtime value to the documented type.
|
|
1269
|
-
* @type {this | void} */ (scopeDescriptor.callback({
|
|
1255
|
+
const scopedQuery = /** @type {this | void} */ (scopeDescriptor.callback({
|
|
1270
1256
|
driver: null,
|
|
1271
1257
|
modelClass: this.modelClass,
|
|
1272
1258
|
query: this,
|
|
@@ -1308,9 +1294,7 @@ export default class FrontendModelQuery {
|
|
|
1308
1294
|
*/
|
|
1309
1295
|
selectWithRequiredRootAttributes(requiredAttributes = []) {
|
|
1310
1296
|
const rootModelName = this.modelClass.getModelName()
|
|
1311
|
-
const selectMap = /**
|
|
1312
|
-
* Narrows the runtime value to the documented type.
|
|
1313
|
-
* @type {Record<string, string[]>} */ (this._select)
|
|
1297
|
+
const selectMap = /** @type {Record<string, string[]>} */ (this._select)
|
|
1314
1298
|
const existingRootAttributes = selectMap[rootModelName]
|
|
1315
1299
|
|
|
1316
1300
|
if (!existingRootAttributes) {
|
|
@@ -1516,9 +1500,7 @@ export default class FrontendModelQuery {
|
|
|
1516
1500
|
* @returns {FrontendModelQuery<T>} - Cloned query instance.
|
|
1517
1501
|
*/
|
|
1518
1502
|
clone() {
|
|
1519
|
-
const newQuery = /**
|
|
1520
|
-
* Narrows the runtime value to the documented type.
|
|
1521
|
-
* @type {FrontendModelQuery<T>} */ (new FrontendModelQuery({
|
|
1503
|
+
const newQuery = /** @type {FrontendModelQuery<T>} */ (new FrontendModelQuery({
|
|
1522
1504
|
modelClass: this.modelClass,
|
|
1523
1505
|
preload: normalizePreload(this._preload)
|
|
1524
1506
|
}))
|
|
@@ -1877,9 +1859,7 @@ export default class FrontendModelQuery {
|
|
|
1877
1859
|
// can batch lazy relationship access later. Single-record lookups still flow
|
|
1878
1860
|
// through here (with a cohort of one) and degrade cleanly to per-record load.
|
|
1879
1861
|
for (const model of models) {
|
|
1880
|
-
/**
|
|
1881
|
-
* Narrows the runtime value to the documented type.
|
|
1882
|
-
* @type {?} */ (model)._loadCohort = models
|
|
1862
|
+
/** @type {?} */ (model)._loadCohort = models
|
|
1883
1863
|
}
|
|
1884
1864
|
|
|
1885
1865
|
return models
|
|
@@ -2223,9 +2203,7 @@ function frontendModelEventQuery(modelClass, options = {}) {
|
|
|
2223
2203
|
|
|
2224
2204
|
assertFrontendModelEventOptionsObject(options)
|
|
2225
2205
|
|
|
2226
|
-
const optionsObject = /**
|
|
2227
|
-
* Narrows the runtime value to the documented type.
|
|
2228
|
-
* @type {FrontendModelEventOptionsObject} */ (options)
|
|
2206
|
+
const optionsObject = /** @type {FrontendModelEventOptionsObject} */ (options)
|
|
2229
2207
|
const query = frontendModelEventQueryFromOptionsObject(modelClass, optionsObject)
|
|
2230
2208
|
|
|
2231
2209
|
applyFrontendModelProjectionOptions(query, optionsObject)
|
|
@@ -59,9 +59,7 @@ export function frontendModelResourceConfigurationFromDefinition(resourceDefinit
|
|
|
59
59
|
* @returns {import("../configuration-types.js").NormalizedFrontendModelResourceConfiguration} - Normalized resource configuration.
|
|
60
60
|
*/
|
|
61
61
|
function normalizeFrontendModelResourceConfiguration(resourceConfiguration) {
|
|
62
|
-
const restArgs = /**
|
|
63
|
-
* Narrows the runtime value to the documented type.
|
|
64
|
-
* @type {Record<string, ?>} */ ({...resourceConfiguration})
|
|
62
|
+
const restArgs = /** @type {Record<string, ?>} */ ({...resourceConfiguration})
|
|
65
63
|
|
|
66
64
|
for (const key of [
|
|
67
65
|
"abilities",
|
|
@@ -392,9 +390,7 @@ export function frontendModelActionForCommand({commandName, modelName, resourceD
|
|
|
392
390
|
|
|
393
391
|
const validatedCommandName = validateFrontendModelResourceCommandName({
|
|
394
392
|
commandName: configuredCommandName,
|
|
395
|
-
commandType: /**
|
|
396
|
-
* Narrows the runtime value to the documented type.
|
|
397
|
-
* @type {"attach" | "create" | "destroy" | "download" | "find" | "index" | "update" | "url"} */ (action),
|
|
393
|
+
commandType: /** @type {"attach" | "create" | "destroy" | "download" | "find" | "index" | "update" | "url"} */ (action),
|
|
398
394
|
modelName
|
|
399
395
|
})
|
|
400
396
|
|