mimarjs 0.0.1-alpha.0 → 0.0.1-alpha.1
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/LICENSE +21 -0
- package/README.md +49 -3
- package/bin/mimar.js +32 -0
- package/dist/auth/auth.d.ts +86 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.js +212 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/auth/errors.d.ts +44 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/errors.js +66 -0
- package/dist/auth/errors.js.map +1 -0
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +9 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/manager.d.ts +109 -0
- package/dist/auth/manager.d.ts.map +1 -0
- package/dist/auth/manager.js +113 -0
- package/dist/auth/manager.js.map +1 -0
- package/dist/auth/middleware.d.ts +26 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +152 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/passwords.d.ts +45 -0
- package/dist/auth/passwords.d.ts.map +1 -0
- package/dist/auth/passwords.js +104 -0
- package/dist/auth/passwords.js.map +1 -0
- package/dist/auth/policy.d.ts +57 -0
- package/dist/auth/policy.d.ts.map +1 -0
- package/dist/auth/policy.js +115 -0
- package/dist/auth/policy.js.map +1 -0
- package/dist/auth/setup.d.ts +55 -0
- package/dist/auth/setup.d.ts.map +1 -0
- package/dist/auth/setup.js +50 -0
- package/dist/auth/setup.js.map +1 -0
- package/dist/auth/state.d.ts +19 -0
- package/dist/auth/state.d.ts.map +1 -0
- package/dist/auth/state.js +19 -0
- package/dist/auth/state.js.map +1 -0
- package/dist/auth/tokens.d.ts +22 -0
- package/dist/auth/tokens.d.ts.map +1 -0
- package/dist/auth/tokens.js +51 -0
- package/dist/auth/tokens.js.map +1 -0
- package/dist/auth/verification.d.ts +31 -0
- package/dist/auth/verification.d.ts.map +1 -0
- package/dist/auth/verification.js +77 -0
- package/dist/auth/verification.js.map +1 -0
- package/dist/aws/index.d.ts +2 -0
- package/dist/aws/index.d.ts.map +1 -0
- package/dist/aws/index.js +2 -0
- package/dist/aws/index.js.map +1 -0
- package/dist/aws/signer.d.ts +47 -0
- package/dist/aws/signer.d.ts.map +1 -0
- package/dist/aws/signer.js +130 -0
- package/dist/aws/signer.js.map +1 -0
- package/dist/broadcast/index.d.ts +2 -0
- package/dist/broadcast/index.d.ts.map +1 -0
- package/dist/broadcast/index.js +2 -0
- package/dist/broadcast/index.js.map +1 -0
- package/dist/cache/cache.d.ts +129 -0
- package/dist/cache/cache.d.ts.map +1 -0
- package/dist/cache/cache.js +407 -0
- package/dist/cache/cache.js.map +1 -0
- package/dist/cache/database.d.ts +38 -0
- package/dist/cache/database.d.ts.map +1 -0
- package/dist/cache/database.js +210 -0
- package/dist/cache/database.js.map +1 -0
- package/dist/cache/file.d.ts +18 -0
- package/dist/cache/file.d.ts.map +1 -0
- package/dist/cache/file.js +237 -0
- package/dist/cache/file.js.map +1 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +9 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/manager.d.ts +42 -0
- package/dist/cache/manager.d.ts.map +1 -0
- package/dist/cache/manager.js +107 -0
- package/dist/cache/manager.js.map +1 -0
- package/dist/cache/module.d.ts +41 -0
- package/dist/cache/module.d.ts.map +1 -0
- package/dist/cache/module.js +49 -0
- package/dist/cache/module.js.map +1 -0
- package/dist/cache/rate-limiter.d.ts +76 -0
- package/dist/cache/rate-limiter.d.ts.map +1 -0
- package/dist/cache/rate-limiter.js +119 -0
- package/dist/cache/rate-limiter.js.map +1 -0
- package/dist/cache/redis.d.ts +19 -0
- package/dist/cache/redis.d.ts.map +1 -0
- package/dist/cache/redis.js +99 -0
- package/dist/cache/redis.js.map +1 -0
- package/dist/cache/store.d.ts +78 -0
- package/dist/cache/store.d.ts.map +1 -0
- package/dist/cache/store.js +162 -0
- package/dist/cache/store.js.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/pages.d.ts +51 -0
- package/dist/client/pages.d.ts.map +1 -0
- package/dist/client/pages.js +2 -0
- package/dist/client/pages.js.map +1 -0
- package/dist/client/routes.d.ts +22 -0
- package/dist/client/routes.d.ts.map +1 -0
- package/dist/client/routes.js +66 -0
- package/dist/client/routes.js.map +1 -0
- package/dist/client/wire.d.ts +44 -0
- package/dist/client/wire.d.ts.map +1 -0
- package/dist/client/wire.js +2 -0
- package/dist/client/wire.js.map +1 -0
- package/dist/config/config.d.ts +39 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +44 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/sections.d.ts +243 -0
- package/dist/config/sections.d.ts.map +1 -0
- package/dist/config/sections.js +250 -0
- package/dist/config/sections.js.map +1 -0
- package/dist/console/command.d.ts +82 -0
- package/dist/console/command.d.ts.map +1 -0
- package/dist/console/command.js +82 -0
- package/dist/console/command.js.map +1 -0
- package/dist/console/index.d.ts +4 -0
- package/dist/console/index.d.ts.map +1 -0
- package/dist/console/index.js +4 -0
- package/dist/console/index.js.map +1 -0
- package/dist/console/io.d.ts +79 -0
- package/dist/console/io.d.ts.map +1 -0
- package/dist/console/io.js +214 -0
- package/dist/console/io.js.map +1 -0
- package/dist/console/kernel.d.ts +38 -0
- package/dist/console/kernel.d.ts.map +1 -0
- package/dist/console/kernel.js +279 -0
- package/dist/console/kernel.js.map +1 -0
- package/dist/container/container.d.ts +47 -0
- package/dist/container/container.d.ts.map +1 -0
- package/dist/container/container.js +130 -0
- package/dist/container/container.js.map +1 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +2 -0
- package/dist/container/index.js.map +1 -0
- package/dist/cookie/index.d.ts +2 -0
- package/dist/cookie/index.d.ts.map +1 -0
- package/dist/cookie/index.js +2 -0
- package/dist/cookie/index.js.map +1 -0
- package/dist/crypt/crypt.d.ts +48 -0
- package/dist/crypt/crypt.d.ts.map +1 -0
- package/dist/crypt/crypt.js +151 -0
- package/dist/crypt/crypt.js.map +1 -0
- package/dist/crypt/index.d.ts +2 -0
- package/dist/crypt/index.d.ts.map +1 -0
- package/dist/crypt/index.js +2 -0
- package/dist/crypt/index.js.map +1 -0
- package/dist/db/codec.d.ts +36 -0
- package/dist/db/codec.d.ts.map +1 -0
- package/dist/db/codec.js +129 -0
- package/dist/db/codec.js.map +1 -0
- package/dist/db/contract.d.ts +103 -0
- package/dist/db/contract.d.ts.map +1 -0
- package/dist/db/contract.js +2 -0
- package/dist/db/contract.js.map +1 -0
- package/dist/db/db.d.ts +41 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +48 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/drivers/better-sqlite3.d.ts +4 -0
- package/dist/db/drivers/better-sqlite3.d.ts.map +1 -0
- package/dist/db/drivers/better-sqlite3.js +49 -0
- package/dist/db/drivers/better-sqlite3.js.map +1 -0
- package/dist/db/drivers/mysql.d.ts +5 -0
- package/dist/db/drivers/mysql.d.ts.map +1 -0
- package/dist/db/drivers/mysql.js +318 -0
- package/dist/db/drivers/mysql.js.map +1 -0
- package/dist/db/drivers/pgsql.d.ts +5 -0
- package/dist/db/drivers/pgsql.d.ts.map +1 -0
- package/dist/db/drivers/pgsql.js +261 -0
- package/dist/db/drivers/pgsql.js.map +1 -0
- package/dist/db/drivers/sqlite.d.ts +51 -0
- package/dist/db/drivers/sqlite.d.ts.map +1 -0
- package/dist/db/drivers/sqlite.js +251 -0
- package/dist/db/drivers/sqlite.js.map +1 -0
- package/dist/db/errors.d.ts +65 -0
- package/dist/db/errors.d.ts.map +1 -0
- package/dist/db/errors.js +101 -0
- package/dist/db/errors.js.map +1 -0
- package/dist/db/grammars/grammar.d.ts +77 -0
- package/dist/db/grammars/grammar.d.ts.map +1 -0
- package/dist/db/grammars/grammar.js +345 -0
- package/dist/db/grammars/grammar.js.map +1 -0
- package/dist/db/grammars/mysql.d.ts +45 -0
- package/dist/db/grammars/mysql.d.ts.map +1 -0
- package/dist/db/grammars/mysql.js +147 -0
- package/dist/db/grammars/mysql.js.map +1 -0
- package/dist/db/grammars/pgsql.d.ts +20 -0
- package/dist/db/grammars/pgsql.d.ts.map +1 -0
- package/dist/db/grammars/pgsql.js +66 -0
- package/dist/db/grammars/pgsql.js.map +1 -0
- package/dist/db/grammars/sqlite.d.ts +27 -0
- package/dist/db/grammars/sqlite.d.ts.map +1 -0
- package/dist/db/grammars/sqlite.js +95 -0
- package/dist/db/grammars/sqlite.js.map +1 -0
- package/dist/db/index.d.ts +18 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +17 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/kysely/index.d.ts +2 -0
- package/dist/db/kysely/index.d.ts.map +1 -0
- package/dist/db/kysely/index.js +2 -0
- package/dist/db/kysely/index.js.map +1 -0
- package/dist/db/kysely/kysely.d.ts +15 -0
- package/dist/db/kysely/kysely.d.ts.map +1 -0
- package/dist/db/kysely/kysely.js +127 -0
- package/dist/db/kysely/kysely.js.map +1 -0
- package/dist/db/manager.d.ts +138 -0
- package/dist/db/manager.d.ts.map +1 -0
- package/dist/db/manager.js +776 -0
- package/dist/db/manager.js.map +1 -0
- package/dist/db/pool.d.ts +28 -0
- package/dist/db/pool.d.ts.map +1 -0
- package/dist/db/pool.js +114 -0
- package/dist/db/pool.js.map +1 -0
- package/dist/db/query/builder.d.ts +290 -0
- package/dist/db/query/builder.d.ts.map +1 -0
- package/dist/db/query/builder.js +957 -0
- package/dist/db/query/builder.js.map +1 -0
- package/dist/db/query/state.d.ts +183 -0
- package/dist/db/query/state.d.ts.map +1 -0
- package/dist/db/query/state.js +48 -0
- package/dist/db/query/state.js.map +1 -0
- package/dist/db/sql.d.ts +82 -0
- package/dist/db/sql.d.ts.map +1 -0
- package/dist/db/sql.js +143 -0
- package/dist/db/sql.js.map +1 -0
- package/dist/env/env.d.ts +61 -0
- package/dist/env/env.d.ts.map +1 -0
- package/dist/env/env.js +184 -0
- package/dist/env/env.js.map +1 -0
- package/dist/env/index.d.ts +2 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/env/index.js +2 -0
- package/dist/env/index.js.map +1 -0
- package/dist/errors/errors.d.ts +42 -0
- package/dist/errors/errors.d.ts.map +1 -0
- package/dist/errors/errors.js +60 -0
- package/dist/errors/errors.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/events/event.d.ts +52 -0
- package/dist/events/event.d.ts.map +1 -0
- package/dist/events/event.js +77 -0
- package/dist/events/event.js.map +1 -0
- package/dist/events/fake.d.ts +22 -0
- package/dist/events/fake.d.ts.map +1 -0
- package/dist/events/fake.js +53 -0
- package/dist/events/fake.js.map +1 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +6 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/listener.d.ts +49 -0
- package/dist/events/listener.d.ts.map +1 -0
- package/dist/events/listener.js +31 -0
- package/dist/events/listener.js.map +1 -0
- package/dist/events/manager.d.ts +54 -0
- package/dist/events/manager.d.ts.map +1 -0
- package/dist/events/manager.js +166 -0
- package/dist/events/manager.js.map +1 -0
- package/dist/events/module.d.ts +10 -0
- package/dist/events/module.d.ts.map +1 -0
- package/dist/events/module.js +12 -0
- package/dist/events/module.js.map +1 -0
- package/dist/factory/factory.d.ts +93 -0
- package/dist/factory/factory.d.ts.map +1 -0
- package/dist/factory/factory.js +261 -0
- package/dist/factory/factory.js.map +1 -0
- package/dist/factory/fake.d.ts +92 -0
- package/dist/factory/fake.d.ts.map +1 -0
- package/dist/factory/fake.js +328 -0
- package/dist/factory/fake.js.map +1 -0
- package/dist/factory/index.d.ts +4 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory/index.js +4 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/factory/seed.d.ts +21 -0
- package/dist/factory/seed.d.ts.map +1 -0
- package/dist/factory/seed.js +55 -0
- package/dist/factory/seed.js.map +1 -0
- package/dist/feature/index.d.ts +2 -0
- package/dist/feature/index.d.ts.map +1 -0
- package/dist/feature/index.js +2 -0
- package/dist/feature/index.js.map +1 -0
- package/dist/foundation/application.d.ts +156 -0
- package/dist/foundation/application.d.ts.map +1 -0
- package/dist/foundation/application.js +1258 -0
- package/dist/foundation/application.js.map +1 -0
- package/dist/foundation/cache-commands.d.ts +7 -0
- package/dist/foundation/cache-commands.d.ts.map +1 -0
- package/dist/foundation/cache-commands.js +48 -0
- package/dist/foundation/cache-commands.js.map +1 -0
- package/dist/foundation/command-result.d.ts +14 -0
- package/dist/foundation/command-result.d.ts.map +1 -0
- package/dist/foundation/command-result.js +43 -0
- package/dist/foundation/command-result.js.map +1 -0
- package/dist/foundation/commands.d.ts +159 -0
- package/dist/foundation/commands.d.ts.map +1 -0
- package/dist/foundation/commands.js +404 -0
- package/dist/foundation/commands.js.map +1 -0
- package/dist/foundation/database-commands.d.ts +24 -0
- package/dist/foundation/database-commands.d.ts.map +1 -0
- package/dist/foundation/database-commands.js +304 -0
- package/dist/foundation/database-commands.js.map +1 -0
- package/dist/foundation/debug-page.d.ts +11 -0
- package/dist/foundation/debug-page.d.ts.map +1 -0
- package/dist/foundation/debug-page.js +112 -0
- package/dist/foundation/debug-page.js.map +1 -0
- package/dist/foundation/dev-vite.d.ts +2 -0
- package/dist/foundation/dev-vite.d.ts.map +1 -0
- package/dist/foundation/dev-vite.js +39 -0
- package/dist/foundation/dev-vite.js.map +1 -0
- package/dist/foundation/dev.d.ts +31 -0
- package/dist/foundation/dev.d.ts.map +1 -0
- package/dist/foundation/dev.js +430 -0
- package/dist/foundation/dev.js.map +1 -0
- package/dist/foundation/discovery.d.ts +41 -0
- package/dist/foundation/discovery.d.ts.map +1 -0
- package/dist/foundation/discovery.js +69 -0
- package/dist/foundation/discovery.js.map +1 -0
- package/dist/foundation/error-pages.d.ts +10 -0
- package/dist/foundation/error-pages.d.ts.map +1 -0
- package/dist/foundation/error-pages.js +38 -0
- package/dist/foundation/error-pages.js.map +1 -0
- package/dist/foundation/exceptions.d.ts +20 -0
- package/dist/foundation/exceptions.d.ts.map +1 -0
- package/dist/foundation/exceptions.js +36 -0
- package/dist/foundation/exceptions.js.map +1 -0
- package/dist/foundation/generators.d.ts +71 -0
- package/dist/foundation/generators.d.ts.map +1 -0
- package/dist/foundation/generators.js +577 -0
- package/dist/foundation/generators.js.map +1 -0
- package/dist/foundation/helpers.d.ts +7 -0
- package/dist/foundation/helpers.d.ts.map +1 -0
- package/dist/foundation/helpers.js +12 -0
- package/dist/foundation/helpers.js.map +1 -0
- package/dist/foundation/index.d.ts +8 -0
- package/dist/foundation/index.d.ts.map +1 -0
- package/dist/foundation/index.js +8 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/foundation/install-api.d.ts +4 -0
- package/dist/foundation/install-api.d.ts.map +1 -0
- package/dist/foundation/install-api.js +91 -0
- package/dist/foundation/install-api.js.map +1 -0
- package/dist/foundation/provider.d.ts +83 -0
- package/dist/foundation/provider.d.ts.map +1 -0
- package/dist/foundation/provider.js +13 -0
- package/dist/foundation/provider.js.map +1 -0
- package/dist/foundation/queue-commands.d.ts +38 -0
- package/dist/foundation/queue-commands.d.ts.map +1 -0
- package/dist/foundation/queue-commands.js +279 -0
- package/dist/foundation/queue-commands.js.map +1 -0
- package/dist/foundation/route-types.d.ts +22 -0
- package/dist/foundation/route-types.d.ts.map +1 -0
- package/dist/foundation/route-types.js +158 -0
- package/dist/foundation/route-types.js.map +1 -0
- package/dist/foundation/schedule-commands.d.ts +4 -0
- package/dist/foundation/schedule-commands.d.ts.map +1 -0
- package/dist/foundation/schedule-commands.js +128 -0
- package/dist/foundation/schedule-commands.js.map +1 -0
- package/dist/foundation/stubs/api.d.ts +9 -0
- package/dist/foundation/stubs/api.d.ts.map +1 -0
- package/dist/foundation/stubs/api.js +225 -0
- package/dist/foundation/stubs/api.js.map +1 -0
- package/dist/foundation/stubs/handler.d.ts +15 -0
- package/dist/foundation/stubs/handler.d.ts.map +1 -0
- package/dist/foundation/stubs/handler.js +54 -0
- package/dist/foundation/stubs/handler.js.map +1 -0
- package/dist/foundation/stubs/others.d.ts +53 -0
- package/dist/foundation/stubs/others.d.ts.map +1 -0
- package/dist/foundation/stubs/others.js +159 -0
- package/dist/foundation/stubs/others.js.map +1 -0
- package/dist/foundation/test-command.d.ts +9 -0
- package/dist/foundation/test-command.d.ts.map +1 -0
- package/dist/foundation/test-command.js +43 -0
- package/dist/foundation/test-command.js.map +1 -0
- package/dist/hash/hash.d.ts +44 -0
- package/dist/hash/hash.d.ts.map +1 -0
- package/dist/hash/hash.js +94 -0
- package/dist/hash/hash.js.map +1 -0
- package/dist/hash/index.d.ts +2 -0
- package/dist/hash/index.d.ts.map +1 -0
- package/dist/hash/index.js +2 -0
- package/dist/hash/index.js.map +1 -0
- package/dist/http/cookies.d.ts +37 -0
- package/dist/http/cookies.d.ts.map +1 -0
- package/dist/http/cookies.js +86 -0
- package/dist/http/cookies.js.map +1 -0
- package/dist/http/csrf.d.ts +24 -0
- package/dist/http/csrf.d.ts.map +1 -0
- package/dist/http/csrf.js +93 -0
- package/dist/http/csrf.js.map +1 -0
- package/dist/http/form.d.ts +11 -0
- package/dist/http/form.d.ts.map +1 -0
- package/dist/http/form.js +57 -0
- package/dist/http/form.js.map +1 -0
- package/dist/http/index.d.ts +18 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +18 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/kernel.d.ts +82 -0
- package/dist/http/kernel.d.ts.map +1 -0
- package/dist/http/kernel.js +454 -0
- package/dist/http/kernel.js.map +1 -0
- package/dist/http/maintenance.d.ts +25 -0
- package/dist/http/maintenance.d.ts.map +1 -0
- package/dist/http/maintenance.js +70 -0
- package/dist/http/maintenance.js.map +1 -0
- package/dist/http/middleware.d.ts +75 -0
- package/dist/http/middleware.d.ts.map +1 -0
- package/dist/http/middleware.js +169 -0
- package/dist/http/middleware.js.map +1 -0
- package/dist/http/multipart.d.ts +4 -0
- package/dist/http/multipart.d.ts.map +1 -0
- package/dist/http/multipart.js +95 -0
- package/dist/http/multipart.js.map +1 -0
- package/dist/http/render.d.ts +19 -0
- package/dist/http/render.d.ts.map +1 -0
- package/dist/http/render.js +65 -0
- package/dist/http/render.js.map +1 -0
- package/dist/http/request.d.ts +106 -0
- package/dist/http/request.d.ts.map +1 -0
- package/dist/http/request.js +313 -0
- package/dist/http/request.js.map +1 -0
- package/dist/http/response.d.ts +128 -0
- package/dist/http/response.d.ts.map +1 -0
- package/dist/http/response.js +217 -0
- package/dist/http/response.js.map +1 -0
- package/dist/http/server.d.ts +27 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +76 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/signature.d.ts +10 -0
- package/dist/http/signature.d.ts.map +1 -0
- package/dist/http/signature.js +42 -0
- package/dist/http/signature.js.map +1 -0
- package/dist/http/throttle.d.ts +26 -0
- package/dist/http/throttle.d.ts.map +1 -0
- package/dist/http/throttle.js +52 -0
- package/dist/http/throttle.js.map +1 -0
- package/dist/http/types.d.ts +66 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +5 -0
- package/dist/http/types.js.map +1 -0
- package/dist/http/uploads.d.ts +46 -0
- package/dist/http/uploads.d.ts.map +1 -0
- package/dist/http/uploads.js +130 -0
- package/dist/http/uploads.js.map +1 -0
- package/dist/http/wire.d.ts +15 -0
- package/dist/http/wire.d.ts.map +1 -0
- package/dist/http/wire.js +114 -0
- package/dist/http/wire.js.map +1 -0
- package/dist/http/write.d.ts +13 -0
- package/dist/http/write.d.ts.map +1 -0
- package/dist/http/write.js +161 -0
- package/dist/http/write.js.map +1 -0
- package/dist/http-client/index.d.ts +2 -0
- package/dist/http-client/index.d.ts.map +1 -0
- package/dist/http-client/index.js +2 -0
- package/dist/http-client/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/inertia/index.d.ts +5 -0
- package/dist/inertia/index.d.ts.map +1 -0
- package/dist/inertia/index.js +4 -0
- package/dist/inertia/index.js.map +1 -0
- package/dist/inertia/inertia.d.ts +159 -0
- package/dist/inertia/inertia.d.ts.map +1 -0
- package/dist/inertia/inertia.js +406 -0
- package/dist/inertia/inertia.js.map +1 -0
- package/dist/inertia/props.d.ts +138 -0
- package/dist/inertia/props.d.ts.map +1 -0
- package/dist/inertia/props.js +138 -0
- package/dist/inertia/props.js.map +1 -0
- package/dist/inertia/resolve.d.ts +51 -0
- package/dist/inertia/resolve.d.ts.map +1 -0
- package/dist/inertia/resolve.js +289 -0
- package/dist/inertia/resolve.js.map +1 -0
- package/dist/inertia/response.d.ts +24 -0
- package/dist/inertia/response.d.ts.map +1 -0
- package/dist/inertia/response.js +49 -0
- package/dist/inertia/response.js.map +1 -0
- package/dist/inertia/ssr-worker.d.ts +25 -0
- package/dist/inertia/ssr-worker.d.ts.map +1 -0
- package/dist/inertia/ssr-worker.js +55 -0
- package/dist/inertia/ssr-worker.js.map +1 -0
- package/dist/inertia/ssr.d.ts +49 -0
- package/dist/inertia/ssr.d.ts.map +1 -0
- package/dist/inertia/ssr.js +273 -0
- package/dist/inertia/ssr.js.map +1 -0
- package/dist/log/channels.d.ts +27 -0
- package/dist/log/channels.d.ts.map +1 -0
- package/dist/log/channels.js +95 -0
- package/dist/log/channels.js.map +1 -0
- package/dist/log/index.d.ts +4 -0
- package/dist/log/index.d.ts.map +1 -0
- package/dist/log/index.js +4 -0
- package/dist/log/index.js.map +1 -0
- package/dist/log/log.d.ts +69 -0
- package/dist/log/log.d.ts.map +1 -0
- package/dist/log/log.js +173 -0
- package/dist/log/log.js.map +1 -0
- package/dist/log/record.d.ts +26 -0
- package/dist/log/record.d.ts.map +1 -0
- package/dist/log/record.js +89 -0
- package/dist/log/record.js.map +1 -0
- package/dist/mail/address.d.ts +27 -0
- package/dist/mail/address.d.ts.map +1 -0
- package/dist/mail/address.js +44 -0
- package/dist/mail/address.js.map +1 -0
- package/dist/mail/auth.d.ts +6 -0
- package/dist/mail/auth.d.ts.map +1 -0
- package/dist/mail/auth.js +39 -0
- package/dist/mail/auth.js.map +1 -0
- package/dist/mail/components.d.ts +29 -0
- package/dist/mail/components.d.ts.map +1 -0
- package/dist/mail/components.js +87 -0
- package/dist/mail/components.js.map +1 -0
- package/dist/mail/fake.d.ts +42 -0
- package/dist/mail/fake.d.ts.map +1 -0
- package/dist/mail/fake.js +111 -0
- package/dist/mail/fake.js.map +1 -0
- package/dist/mail/index.d.ts +9 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +9 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/mail.d.ts +56 -0
- package/dist/mail/mail.d.ts.map +1 -0
- package/dist/mail/mail.js +68 -0
- package/dist/mail/mail.js.map +1 -0
- package/dist/mail/manager.d.ts +77 -0
- package/dist/mail/manager.d.ts.map +1 -0
- package/dist/mail/manager.js +160 -0
- package/dist/mail/manager.js.map +1 -0
- package/dist/mail/text.d.ts +3 -0
- package/dist/mail/text.d.ts.map +1 -0
- package/dist/mail/text.js +161 -0
- package/dist/mail/text.js.map +1 -0
- package/dist/mail/transport.d.ts +57 -0
- package/dist/mail/transport.d.ts.map +1 -0
- package/dist/mail/transport.js +41 -0
- package/dist/mail/transport.js.map +1 -0
- package/dist/migrations/create-database.d.ts +6 -0
- package/dist/migrations/create-database.d.ts.map +1 -0
- package/dist/migrations/create-database.js +23 -0
- package/dist/migrations/create-database.js.map +1 -0
- package/dist/migrations/dump.d.ts +27 -0
- package/dist/migrations/dump.d.ts.map +1 -0
- package/dist/migrations/dump.js +258 -0
- package/dist/migrations/dump.js.map +1 -0
- package/dist/migrations/files.d.ts +40 -0
- package/dist/migrations/files.d.ts.map +1 -0
- package/dist/migrations/files.js +101 -0
- package/dist/migrations/files.js.map +1 -0
- package/dist/migrations/index.d.ts +5 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +5 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migrator.d.ts +97 -0
- package/dist/migrations/migrator.d.ts.map +1 -0
- package/dist/migrations/migrator.js +383 -0
- package/dist/migrations/migrator.js.map +1 -0
- package/dist/model/checks.d.ts +10 -0
- package/dist/model/checks.d.ts.map +1 -0
- package/dist/model/checks.js +171 -0
- package/dist/model/checks.js.map +1 -0
- package/dist/model/columns.d.ts +153 -0
- package/dist/model/columns.d.ts.map +1 -0
- package/dist/model/columns.js +96 -0
- package/dist/model/columns.js.map +1 -0
- package/dist/model/describe.d.ts +36 -0
- package/dist/model/describe.d.ts.map +1 -0
- package/dist/model/describe.js +57 -0
- package/dist/model/describe.js.map +1 -0
- package/dist/model/drift.d.ts +15 -0
- package/dist/model/drift.d.ts.map +1 -0
- package/dist/model/drift.js +123 -0
- package/dist/model/drift.js.map +1 -0
- package/dist/model/errors.d.ts +33 -0
- package/dist/model/errors.d.ts.map +1 -0
- package/dist/model/errors.js +55 -0
- package/dist/model/errors.js.map +1 -0
- package/dist/model/index.d.ts +14 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +13 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/keys.d.ts +37 -0
- package/dist/model/keys.d.ts.map +1 -0
- package/dist/model/keys.js +39 -0
- package/dist/model/keys.js.map +1 -0
- package/dist/model/loading.d.ts +8 -0
- package/dist/model/loading.d.ts.map +1 -0
- package/dist/model/loading.js +201 -0
- package/dist/model/loading.js.map +1 -0
- package/dist/model/meta.d.ts +27 -0
- package/dist/model/meta.d.ts.map +1 -0
- package/dist/model/meta.js +110 -0
- package/dist/model/meta.js.map +1 -0
- package/dist/model/model.d.ts +107 -0
- package/dist/model/model.d.ts.map +1 -0
- package/dist/model/model.js +667 -0
- package/dist/model/model.js.map +1 -0
- package/dist/model/query.d.ts +214 -0
- package/dist/model/query.d.ts.map +1 -0
- package/dist/model/query.js +869 -0
- package/dist/model/query.js.map +1 -0
- package/dist/model/related.d.ts +40 -0
- package/dist/model/related.d.ts.map +1 -0
- package/dist/model/related.js +274 -0
- package/dist/model/related.js.map +1 -0
- package/dist/model/relations.d.ts +160 -0
- package/dist/model/relations.d.ts.map +1 -0
- package/dist/model/relations.js +44 -0
- package/dist/model/relations.js.map +1 -0
- package/dist/model/types.d.ts +461 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +2 -0
- package/dist/model/types.js.map +1 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +2 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/pagination/index.d.ts +2 -0
- package/dist/pagination/index.d.ts.map +1 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/paginator.d.ts +174 -0
- package/dist/pagination/paginator.d.ts.map +1 -0
- package/dist/pagination/paginator.js +413 -0
- package/dist/pagination/paginator.js.map +1 -0
- package/dist/queue/batches.d.ts +152 -0
- package/dist/queue/batches.d.ts.map +1 -0
- package/dist/queue/batches.js +344 -0
- package/dist/queue/batches.js.map +1 -0
- package/dist/queue/database.d.ts +35 -0
- package/dist/queue/database.d.ts.map +1 -0
- package/dist/queue/database.js +137 -0
- package/dist/queue/database.js.map +1 -0
- package/dist/queue/driver.d.ts +72 -0
- package/dist/queue/driver.d.ts.map +1 -0
- package/dist/queue/driver.js +17 -0
- package/dist/queue/driver.js.map +1 -0
- package/dist/queue/envelope.d.ts +66 -0
- package/dist/queue/envelope.d.ts.map +1 -0
- package/dist/queue/envelope.js +81 -0
- package/dist/queue/envelope.js.map +1 -0
- package/dist/queue/failed.d.ts +43 -0
- package/dist/queue/failed.d.ts.map +1 -0
- package/dist/queue/failed.js +76 -0
- package/dist/queue/failed.js.map +1 -0
- package/dist/queue/fake.d.ts +68 -0
- package/dist/queue/fake.d.ts.map +1 -0
- package/dist/queue/fake.js +93 -0
- package/dist/queue/fake.js.map +1 -0
- package/dist/queue/index.d.ts +15 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +15 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/job.d.ts +137 -0
- package/dist/queue/job.d.ts.map +1 -0
- package/dist/queue/job.js +154 -0
- package/dist/queue/job.js.map +1 -0
- package/dist/queue/manager.d.ts +116 -0
- package/dist/queue/manager.d.ts.map +1 -0
- package/dist/queue/manager.js +545 -0
- package/dist/queue/manager.js.map +1 -0
- package/dist/queue/middleware.d.ts +33 -0
- package/dist/queue/middleware.d.ts.map +1 -0
- package/dist/queue/middleware.js +88 -0
- package/dist/queue/middleware.js.map +1 -0
- package/dist/queue/module.d.ts +42 -0
- package/dist/queue/module.d.ts.map +1 -0
- package/dist/queue/module.js +68 -0
- package/dist/queue/module.js.map +1 -0
- package/dist/queue/redis.d.ts +27 -0
- package/dist/queue/redis.d.ts.map +1 -0
- package/dist/queue/redis.js +189 -0
- package/dist/queue/redis.js.map +1 -0
- package/dist/queue/runner.d.ts +79 -0
- package/dist/queue/runner.d.ts.map +1 -0
- package/dist/queue/runner.js +129 -0
- package/dist/queue/runner.js.map +1 -0
- package/dist/queue/sqs.d.ts +59 -0
- package/dist/queue/sqs.d.ts.map +1 -0
- package/dist/queue/sqs.js +323 -0
- package/dist/queue/sqs.js.map +1 -0
- package/dist/queue/worker.d.ts +59 -0
- package/dist/queue/worker.d.ts.map +1 -0
- package/dist/queue/worker.js +466 -0
- package/dist/queue/worker.js.map +1 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +2 -0
- package/dist/redis/index.js.map +1 -0
- package/dist/redis/redis.d.ts +41 -0
- package/dist/redis/redis.d.ts.map +1 -0
- package/dist/redis/redis.js +140 -0
- package/dist/redis/redis.js.map +1 -0
- package/dist/reverb/index.d.ts +2 -0
- package/dist/reverb/index.d.ts.map +1 -0
- package/dist/reverb/index.js +2 -0
- package/dist/reverb/index.js.map +1 -0
- package/dist/routing/index.d.ts +6 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +6 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/paths.d.ts +27 -0
- package/dist/routing/paths.d.ts.map +1 -0
- package/dist/routing/paths.js +45 -0
- package/dist/routing/paths.js.map +1 -0
- package/dist/routing/router.d.ts +137 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/routing/router.js +236 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/routing/routing.d.ts +34 -0
- package/dist/routing/routing.d.ts.map +1 -0
- package/dist/routing/routing.js +57 -0
- package/dist/routing/routing.js.map +1 -0
- package/dist/routing/table.d.ts +35 -0
- package/dist/routing/table.d.ts.map +1 -0
- package/dist/routing/table.js +247 -0
- package/dist/routing/table.js.map +1 -0
- package/dist/routing/urls.d.ts +34 -0
- package/dist/routing/urls.d.ts.map +1 -0
- package/dist/routing/urls.js +116 -0
- package/dist/routing/urls.js.map +1 -0
- package/dist/schedule/cron.d.ts +35 -0
- package/dist/schedule/cron.d.ts.map +1 -0
- package/dist/schedule/cron.js +212 -0
- package/dist/schedule/cron.js.map +1 -0
- package/dist/schedule/index.d.ts +5 -0
- package/dist/schedule/index.d.ts.map +1 -0
- package/dist/schedule/index.js +5 -0
- package/dist/schedule/index.js.map +1 -0
- package/dist/schedule/schedule.d.ts +38 -0
- package/dist/schedule/schedule.d.ts.map +1 -0
- package/dist/schedule/schedule.js +70 -0
- package/dist/schedule/schedule.js.map +1 -0
- package/dist/schedule/scheduler.d.ts +89 -0
- package/dist/schedule/scheduler.d.ts.map +1 -0
- package/dist/schedule/scheduler.js +404 -0
- package/dist/schedule/scheduler.js.map +1 -0
- package/dist/schedule/task.d.ts +150 -0
- package/dist/schedule/task.d.ts.map +1 -0
- package/dist/schedule/task.js +323 -0
- package/dist/schedule/task.js.map +1 -0
- package/dist/schema/blueprint.d.ts +256 -0
- package/dist/schema/blueprint.d.ts.map +1 -0
- package/dist/schema/blueprint.js +458 -0
- package/dist/schema/blueprint.js.map +1 -0
- package/dist/schema/builder.d.ts +40 -0
- package/dist/schema/builder.d.ts.map +1 -0
- package/dist/schema/builder.js +153 -0
- package/dist/schema/builder.js.map +1 -0
- package/dist/schema/grammars/grammar.d.ts +112 -0
- package/dist/schema/grammars/grammar.d.ts.map +1 -0
- package/dist/schema/grammars/grammar.js +231 -0
- package/dist/schema/grammars/grammar.js.map +1 -0
- package/dist/schema/grammars/mysql.d.ts +43 -0
- package/dist/schema/grammars/mysql.d.ts.map +1 -0
- package/dist/schema/grammars/mysql.js +220 -0
- package/dist/schema/grammars/mysql.js.map +1 -0
- package/dist/schema/grammars/pgsql.d.ts +33 -0
- package/dist/schema/grammars/pgsql.d.ts.map +1 -0
- package/dist/schema/grammars/pgsql.js +218 -0
- package/dist/schema/grammars/pgsql.js.map +1 -0
- package/dist/schema/grammars/sqlite-text.d.ts +24 -0
- package/dist/schema/grammars/sqlite-text.d.ts.map +1 -0
- package/dist/schema/grammars/sqlite-text.js +174 -0
- package/dist/schema/grammars/sqlite-text.js.map +1 -0
- package/dist/schema/grammars/sqlite.d.ts +39 -0
- package/dist/schema/grammars/sqlite.d.ts.map +1 -0
- package/dist/schema/grammars/sqlite.js +484 -0
- package/dist/schema/grammars/sqlite.js.map +1 -0
- package/dist/schema/index.d.ts +9 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +9 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/schema.d.ts +48 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/schema.js +47 -0
- package/dist/schema/schema.js.map +1 -0
- package/dist/scope/context.d.ts +39 -0
- package/dist/scope/context.d.ts.map +1 -0
- package/dist/scope/context.js +113 -0
- package/dist/scope/context.js.map +1 -0
- package/dist/scope/index.d.ts +3 -0
- package/dist/scope/index.d.ts.map +1 -0
- package/dist/scope/index.js +3 -0
- package/dist/scope/index.js.map +1 -0
- package/dist/scope/scope.d.ts +116 -0
- package/dist/scope/scope.d.ts.map +1 -0
- package/dist/scope/scope.js +148 -0
- package/dist/scope/scope.js.map +1 -0
- package/dist/session/cache-store.d.ts +17 -0
- package/dist/session/cache-store.d.ts.map +1 -0
- package/dist/session/cache-store.js +45 -0
- package/dist/session/cache-store.js.map +1 -0
- package/dist/session/database.d.ts +32 -0
- package/dist/session/database.d.ts.map +1 -0
- package/dist/session/database.js +98 -0
- package/dist/session/database.js.map +1 -0
- package/dist/session/index.d.ts +7 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +7 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +61 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +217 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/middleware.d.ts +6 -0
- package/dist/session/middleware.d.ts.map +1 -0
- package/dist/session/middleware.js +76 -0
- package/dist/session/middleware.js.map +1 -0
- package/dist/session/session.d.ts +118 -0
- package/dist/session/session.d.ts.map +1 -0
- package/dist/session/session.js +223 -0
- package/dist/session/session.js.map +1 -0
- package/dist/session/stores.d.ts +36 -0
- package/dist/session/stores.d.ts.map +1 -0
- package/dist/session/stores.js +151 -0
- package/dist/session/stores.js.map +1 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/str/index.d.ts +2 -0
- package/dist/str/index.d.ts.map +1 -0
- package/dist/str/index.js +2 -0
- package/dist/str/index.js.map +1 -0
- package/dist/str/str.d.ts +27 -0
- package/dist/str/str.d.ts.map +1 -0
- package/dist/str/str.js +102 -0
- package/dist/str/str.js.map +1 -0
- package/dist/support/clock.d.ts +6 -0
- package/dist/support/clock.d.ts.map +1 -0
- package/dist/support/clock.js +7 -0
- package/dist/support/clock.js.map +1 -0
- package/dist/support/data.d.ts +29 -0
- package/dist/support/data.d.ts.map +1 -0
- package/dist/support/data.js +160 -0
- package/dist/support/data.js.map +1 -0
- package/dist/support/index.d.ts +8 -0
- package/dist/support/index.d.ts.map +1 -0
- package/dist/support/index.js +7 -0
- package/dist/support/index.js.map +1 -0
- package/dist/support/register.d.ts +14 -0
- package/dist/support/register.d.ts.map +1 -0
- package/dist/support/register.js +2 -0
- package/dist/support/register.js.map +1 -0
- package/dist/support/text.d.ts +8 -0
- package/dist/support/text.d.ts.map +1 -0
- package/dist/support/text.js +19 -0
- package/dist/support/text.js.map +1 -0
- package/dist/support/type-assertions.d.ts +7 -0
- package/dist/support/type-assertions.d.ts.map +1 -0
- package/dist/support/type-assertions.js +10 -0
- package/dist/support/type-assertions.js.map +1 -0
- package/dist/support/types.d.ts +34 -0
- package/dist/support/types.d.ts.map +1 -0
- package/dist/support/types.js +31 -0
- package/dist/support/types.js.map +1 -0
- package/dist/support/units.d.ts +17 -0
- package/dist/support/units.d.ts.map +1 -0
- package/dist/support/units.js +54 -0
- package/dist/support/units.js.map +1 -0
- package/dist/task/index.d.ts +2 -0
- package/dist/task/index.d.ts.map +1 -0
- package/dist/task/index.js +2 -0
- package/dist/task/index.js.map +1 -0
- package/dist/task/task.d.ts +68 -0
- package/dist/task/task.d.ts.map +1 -0
- package/dist/task/task.js +162 -0
- package/dist/task/task.js.map +1 -0
- package/dist/testing/assert-database.d.ts +10 -0
- package/dist/testing/assert-database.d.ts.map +1 -0
- package/dist/testing/assert-database.js +125 -0
- package/dist/testing/assert-database.js.map +1 -0
- package/dist/testing/conformance/cache.d.ts +24 -0
- package/dist/testing/conformance/cache.d.ts.map +1 -0
- package/dist/testing/conformance/cache.js +397 -0
- package/dist/testing/conformance/cache.js.map +1 -0
- package/dist/testing/conformance/column-types.d.ts +44 -0
- package/dist/testing/conformance/column-types.d.ts.map +1 -0
- package/dist/testing/conformance/column-types.js +47 -0
- package/dist/testing/conformance/column-types.js.map +1 -0
- package/dist/testing/conformance/database.d.ts +11 -0
- package/dist/testing/conformance/database.d.ts.map +1 -0
- package/dist/testing/conformance/database.js +410 -0
- package/dist/testing/conformance/database.js.map +1 -0
- package/dist/testing/conformance/factories.d.ts +4 -0
- package/dist/testing/conformance/factories.d.ts.map +1 -0
- package/dist/testing/conformance/factories.js +313 -0
- package/dist/testing/conformance/factories.js.map +1 -0
- package/dist/testing/conformance/harness.d.ts +30 -0
- package/dist/testing/conformance/harness.d.ts.map +1 -0
- package/dist/testing/conformance/harness.js +85 -0
- package/dist/testing/conformance/harness.js.map +1 -0
- package/dist/testing/conformance/index.d.ts +13 -0
- package/dist/testing/conformance/index.d.ts.map +1 -0
- package/dist/testing/conformance/index.js +12 -0
- package/dist/testing/conformance/index.js.map +1 -0
- package/dist/testing/conformance/migrations.d.ts +4 -0
- package/dist/testing/conformance/migrations.d.ts.map +1 -0
- package/dist/testing/conformance/migrations.js +313 -0
- package/dist/testing/conformance/migrations.js.map +1 -0
- package/dist/testing/conformance/models.d.ts +4 -0
- package/dist/testing/conformance/models.d.ts.map +1 -0
- package/dist/testing/conformance/models.js +715 -0
- package/dist/testing/conformance/models.js.map +1 -0
- package/dist/testing/conformance/pagination.d.ts +4 -0
- package/dist/testing/conformance/pagination.d.ts.map +1 -0
- package/dist/testing/conformance/pagination.js +283 -0
- package/dist/testing/conformance/pagination.js.map +1 -0
- package/dist/testing/conformance/query-builder.d.ts +4 -0
- package/dist/testing/conformance/query-builder.d.ts.map +1 -0
- package/dist/testing/conformance/query-builder.js +725 -0
- package/dist/testing/conformance/query-builder.js.map +1 -0
- package/dist/testing/conformance/queue.d.ts +29 -0
- package/dist/testing/conformance/queue.d.ts.map +1 -0
- package/dist/testing/conformance/queue.js +203 -0
- package/dist/testing/conformance/queue.js.map +1 -0
- package/dist/testing/conformance/relationships.d.ts +4 -0
- package/dist/testing/conformance/relationships.d.ts.map +1 -0
- package/dist/testing/conformance/relationships.js +737 -0
- package/dist/testing/conformance/relationships.js.map +1 -0
- package/dist/testing/conformance/schema.d.ts +4 -0
- package/dist/testing/conformance/schema.d.ts.map +1 -0
- package/dist/testing/conformance/schema.js +320 -0
- package/dist/testing/conformance/schema.js.map +1 -0
- package/dist/testing/conformance/session.d.ts +22 -0
- package/dist/testing/conformance/session.d.ts.map +1 -0
- package/dist/testing/conformance/session.js +162 -0
- package/dist/testing/conformance/session.js.map +1 -0
- package/dist/testing/database.d.ts +28 -0
- package/dist/testing/database.d.ts.map +1 -0
- package/dist/testing/database.js +213 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/files.d.ts +11 -0
- package/dist/testing/files.d.ts.map +1 -0
- package/dist/testing/files.js +44 -0
- package/dist/testing/files.js.map +1 -0
- package/dist/testing/index.d.ts +7 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/inertia.d.ts +35 -0
- package/dist/testing/inertia.d.ts.map +1 -0
- package/dist/testing/inertia.js +127 -0
- package/dist/testing/inertia.js.map +1 -0
- package/dist/testing/query-log.d.ts +10 -0
- package/dist/testing/query-log.d.ts.map +1 -0
- package/dist/testing/query-log.js +31 -0
- package/dist/testing/query-log.js.map +1 -0
- package/dist/testing/response.d.ts +100 -0
- package/dist/testing/response.d.ts.map +1 -0
- package/dist/testing/response.js +329 -0
- package/dist/testing/response.js.map +1 -0
- package/dist/testing/testing.d.ts +191 -0
- package/dist/testing/testing.d.ts.map +1 -0
- package/dist/testing/testing.js +449 -0
- package/dist/testing/testing.js.map +1 -0
- package/dist/time/index.d.ts +3 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/time/index.js +2 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/time.d.ts +39 -0
- package/dist/time/time.d.ts.map +1 -0
- package/dist/time/time.js +130 -0
- package/dist/time/time.js.map +1 -0
- package/dist/tracing/index.d.ts +2 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +2 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/validation/index.d.ts +6 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +6 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/input.d.ts +89 -0
- package/dist/validation/input.d.ts.map +1 -0
- package/dist/validation/input.js +241 -0
- package/dist/validation/input.js.map +1 -0
- package/dist/validation/messages.d.ts +7 -0
- package/dist/validation/messages.d.ts.map +1 -0
- package/dist/validation/messages.js +93 -0
- package/dist/validation/messages.js.map +1 -0
- package/dist/validation/presence.d.ts +32 -0
- package/dist/validation/presence.d.ts.map +1 -0
- package/dist/validation/presence.js +17 -0
- package/dist/validation/presence.js.map +1 -0
- package/dist/validation/rules.d.ts +321 -0
- package/dist/validation/rules.d.ts.map +1 -0
- package/dist/validation/rules.js +603 -0
- package/dist/validation/rules.js.map +1 -0
- package/dist/validation/standard.d.ts +33 -0
- package/dist/validation/standard.d.ts.map +1 -0
- package/dist/validation/standard.js +10 -0
- package/dist/validation/standard.js.map +1 -0
- package/dist/view/channel.d.ts +13 -0
- package/dist/view/channel.d.ts.map +1 -0
- package/dist/view/channel.js +6 -0
- package/dist/view/channel.js.map +1 -0
- package/dist/view/head.d.ts +60 -0
- package/dist/view/head.d.ts.map +1 -0
- package/dist/view/head.js +122 -0
- package/dist/view/head.js.map +1 -0
- package/dist/view/helpers.d.ts +17 -0
- package/dist/view/helpers.d.ts.map +1 -0
- package/dist/view/helpers.js +19 -0
- package/dist/view/helpers.js.map +1 -0
- package/dist/view/html.d.ts +25 -0
- package/dist/view/html.d.ts.map +1 -0
- package/dist/view/html.js +291 -0
- package/dist/view/html.js.map +1 -0
- package/dist/view/index.d.ts +7 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +7 -0
- package/dist/view/index.js.map +1 -0
- package/dist/view/translate.d.ts +14 -0
- package/dist/view/translate.d.ts.map +1 -0
- package/dist/view/translate.js +42 -0
- package/dist/view/translate.js.map +1 -0
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +3 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/plugin.d.ts +51 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/plugin.js +273 -0
- package/dist/vite/plugin.js.map +1 -0
- package/dist/vite/vite.d.ts +68 -0
- package/dist/vite/vite.d.ts.map +1 -0
- package/dist/vite/vite.js +228 -0
- package/dist/vite/vite.js.map +1 -0
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +2 -0
- package/dist/workflow/index.js.map +1 -0
- package/docs/authentication.md +428 -0
- package/docs/authorization.md +203 -0
- package/docs/cache.md +215 -0
- package/docs/configuration.md +86 -0
- package/docs/console.md +99 -0
- package/docs/container.md +58 -0
- package/docs/csrf.md +54 -0
- package/docs/database-testing.md +121 -0
- package/docs/database.md +314 -0
- package/docs/documentation.md +49 -0
- package/docs/encryption.md +104 -0
- package/docs/errors.md +85 -0
- package/docs/events.md +136 -0
- package/docs/factories.md +144 -0
- package/docs/hashing.md +78 -0
- package/docs/inertia.md +469 -0
- package/docs/installation.md +87 -0
- package/docs/lifecycle.md +84 -0
- package/docs/logging.md +49 -0
- package/docs/middleware.md +64 -0
- package/docs/migrations.md +192 -0
- package/docs/models.md +301 -0
- package/docs/pagination.md +129 -0
- package/docs/passwords.md +151 -0
- package/docs/providers.md +51 -0
- package/docs/queries.md +239 -0
- package/docs/queues.md +407 -0
- package/docs/rate-limiting.md +64 -0
- package/docs/redis.md +76 -0
- package/docs/relationships.md +251 -0
- package/docs/requests.md +53 -0
- package/docs/responses.md +71 -0
- package/docs/routing.md +84 -0
- package/docs/scheduling.md +177 -0
- package/docs/seeding.md +96 -0
- package/docs/session.md +138 -0
- package/docs/structure.md +45 -0
- package/docs/testing.md +134 -0
- package/docs/upgrade.md +42 -0
- package/docs/uploads.md +74 -0
- package/docs/validation.md +105 -0
- package/docs/verification.md +125 -0
- package/docs/views.md +94 -0
- package/docs/vite.md +193 -0
- package/package.json +272 -11
- package/src/auth/auth.ts +260 -0
- package/src/auth/errors.ts +69 -0
- package/src/auth/index.ts +34 -0
- package/src/auth/manager.ts +205 -0
- package/src/auth/middleware.ts +169 -0
- package/src/auth/passwords.ts +117 -0
- package/src/auth/policy.ts +184 -0
- package/src/auth/setup.ts +96 -0
- package/src/auth/state.ts +24 -0
- package/src/auth/tokens.ts +66 -0
- package/src/auth/verification.ts +85 -0
- package/src/aws/index.ts +10 -0
- package/src/aws/signer.ts +170 -0
- package/src/broadcast/index.ts +1 -0
- package/src/cache/cache.ts +495 -0
- package/src/cache/database.ts +243 -0
- package/src/cache/file.ts +262 -0
- package/src/cache/index.ts +26 -0
- package/src/cache/manager.ts +138 -0
- package/src/cache/module.ts +59 -0
- package/src/cache/rate-limiter.ts +183 -0
- package/src/cache/redis.ts +122 -0
- package/src/cache/store.ts +239 -0
- package/src/client/index.ts +3 -0
- package/src/client/pages.ts +90 -0
- package/src/client/routes.ts +90 -0
- package/src/client/wire.ts +93 -0
- package/src/config/config.ts +83 -0
- package/src/config/index.ts +27 -0
- package/src/config/sections.ts +501 -0
- package/src/console/command.ts +171 -0
- package/src/console/index.ts +13 -0
- package/src/console/io.ts +285 -0
- package/src/console/kernel.ts +309 -0
- package/src/container/container.ts +174 -0
- package/src/container/index.ts +1 -0
- package/src/cookie/index.ts +1 -0
- package/src/crypt/crypt.ts +185 -0
- package/src/crypt/index.ts +1 -0
- package/src/db/codec.ts +143 -0
- package/src/db/contract.ts +128 -0
- package/src/db/db.ts +72 -0
- package/src/db/drivers/better-sqlite3.ts +62 -0
- package/src/db/drivers/mysql.ts +379 -0
- package/src/db/drivers/pgsql.ts +293 -0
- package/src/db/drivers/sqlite.ts +321 -0
- package/src/db/errors.ts +149 -0
- package/src/db/grammars/grammar.ts +429 -0
- package/src/db/grammars/mysql.ts +181 -0
- package/src/db/grammars/pgsql.ts +83 -0
- package/src/db/grammars/sqlite.ts +109 -0
- package/src/db/index.ts +107 -0
- package/src/db/kysely/index.ts +1 -0
- package/src/db/kysely/kysely.ts +182 -0
- package/src/db/manager.ts +891 -0
- package/src/db/pool.ts +127 -0
- package/src/db/query/builder.ts +1245 -0
- package/src/db/query/state.ts +210 -0
- package/src/db/sql.ts +196 -0
- package/src/env/env.ts +224 -0
- package/src/env/index.ts +11 -0
- package/src/errors/errors.ts +83 -0
- package/src/errors/index.ts +1 -0
- package/src/events/event.ts +113 -0
- package/src/events/fake.ts +73 -0
- package/src/events/index.ts +16 -0
- package/src/events/listener.ts +86 -0
- package/src/events/manager.ts +192 -0
- package/src/events/module.ts +14 -0
- package/src/factory/factory.ts +394 -0
- package/src/factory/fake.ts +431 -0
- package/src/factory/index.ts +14 -0
- package/src/factory/seed.ts +72 -0
- package/src/feature/index.ts +1 -0
- package/src/foundation/application.ts +1419 -0
- package/src/foundation/cache-commands.ts +49 -0
- package/src/foundation/command-result.ts +46 -0
- package/src/foundation/commands.ts +432 -0
- package/src/foundation/database-commands.ts +321 -0
- package/src/foundation/debug-page.ts +142 -0
- package/src/foundation/dev-vite.ts +32 -0
- package/src/foundation/dev.ts +464 -0
- package/src/foundation/discovery.ts +96 -0
- package/src/foundation/error-pages.ts +32 -0
- package/src/foundation/exceptions.ts +56 -0
- package/src/foundation/generators.ts +642 -0
- package/src/foundation/helpers.ts +15 -0
- package/src/foundation/index.ts +16 -0
- package/src/foundation/install-api.ts +109 -0
- package/src/foundation/provider.ts +98 -0
- package/src/foundation/queue-commands.ts +301 -0
- package/src/foundation/route-types.ts +199 -0
- package/src/foundation/schedule-commands.ts +139 -0
- package/src/foundation/stubs/api.ts +232 -0
- package/src/foundation/stubs/handler.ts +76 -0
- package/src/foundation/stubs/others.ts +188 -0
- package/src/foundation/test-command.ts +40 -0
- package/src/hash/hash.ts +138 -0
- package/src/hash/index.ts +1 -0
- package/src/http/busboy.d.ts +31 -0
- package/src/http/cookies.ts +104 -0
- package/src/http/csrf.ts +102 -0
- package/src/http/form.ts +60 -0
- package/src/http/index.ts +87 -0
- package/src/http/kernel.ts +509 -0
- package/src/http/maintenance.ts +85 -0
- package/src/http/middleware.ts +229 -0
- package/src/http/multipart.ts +105 -0
- package/src/http/render.ts +77 -0
- package/src/http/request.ts +368 -0
- package/src/http/response.ts +301 -0
- package/src/http/server.ts +95 -0
- package/src/http/signature.ts +42 -0
- package/src/http/throttle.ts +67 -0
- package/src/http/types.ts +71 -0
- package/src/http/uploads.ts +139 -0
- package/src/http/wire.ts +104 -0
- package/src/http/write.ts +158 -0
- package/src/http-client/index.ts +1 -0
- package/src/index.ts +20 -0
- package/src/inertia/index.ts +26 -0
- package/src/inertia/inertia.ts +590 -0
- package/src/inertia/props.ts +237 -0
- package/src/inertia/resolve.ts +326 -0
- package/src/inertia/response.ts +66 -0
- package/src/inertia/ssr-worker.ts +66 -0
- package/src/inertia/ssr.ts +369 -0
- package/src/log/channels.ts +101 -0
- package/src/log/index.ts +3 -0
- package/src/log/log.ts +216 -0
- package/src/log/record.ts +107 -0
- package/src/mail/address.ts +60 -0
- package/src/mail/auth.ts +54 -0
- package/src/mail/components.ts +98 -0
- package/src/mail/fake.ts +131 -0
- package/src/mail/index.ts +38 -0
- package/src/mail/mail.ts +124 -0
- package/src/mail/manager.ts +212 -0
- package/src/mail/text.ts +150 -0
- package/src/mail/transport.ts +88 -0
- package/src/migrations/create-database.ts +27 -0
- package/src/migrations/dump.ts +317 -0
- package/src/migrations/files.ts +118 -0
- package/src/migrations/index.ts +21 -0
- package/src/migrations/migrator.ts +499 -0
- package/src/model/checks.ts +189 -0
- package/src/model/columns.ts +221 -0
- package/src/model/describe.ts +95 -0
- package/src/model/drift.ts +150 -0
- package/src/model/errors.ts +69 -0
- package/src/model/index.ts +96 -0
- package/src/model/keys.ts +73 -0
- package/src/model/loading.ts +226 -0
- package/src/model/meta.ts +120 -0
- package/src/model/model.ts +788 -0
- package/src/model/query.ts +1100 -0
- package/src/model/related.ts +336 -0
- package/src/model/relations.ts +211 -0
- package/src/model/types.ts +557 -0
- package/src/notification/index.ts +1 -0
- package/src/pagination/index.ts +21 -0
- package/src/pagination/paginator.ts +545 -0
- package/src/queue/batches.ts +481 -0
- package/src/queue/database.ts +177 -0
- package/src/queue/driver.ts +85 -0
- package/src/queue/envelope.ts +133 -0
- package/src/queue/failed.ts +119 -0
- package/src/queue/fake.ts +145 -0
- package/src/queue/index.ts +88 -0
- package/src/queue/job.ts +295 -0
- package/src/queue/manager.ts +636 -0
- package/src/queue/middleware.ts +111 -0
- package/src/queue/module.ts +74 -0
- package/src/queue/redis.ts +223 -0
- package/src/queue/runner.ts +185 -0
- package/src/queue/sqs.ts +381 -0
- package/src/queue/worker.ts +519 -0
- package/src/redis/index.ts +1 -0
- package/src/redis/redis.ts +158 -0
- package/src/reverb/index.ts +1 -0
- package/src/routing/index.ts +15 -0
- package/src/routing/paths.ts +67 -0
- package/src/routing/router.ts +346 -0
- package/src/routing/routing.ts +80 -0
- package/src/routing/table.ts +281 -0
- package/src/routing/urls.ts +139 -0
- package/src/schedule/cron.ts +221 -0
- package/src/schedule/index.ts +11 -0
- package/src/schedule/schedule.ts +99 -0
- package/src/schedule/scheduler.ts +455 -0
- package/src/schedule/task.ts +381 -0
- package/src/schema/blueprint.ts +684 -0
- package/src/schema/builder.ts +178 -0
- package/src/schema/grammars/grammar.ts +348 -0
- package/src/schema/grammars/mysql.ts +241 -0
- package/src/schema/grammars/pgsql.ts +248 -0
- package/src/schema/grammars/sqlite-text.ts +177 -0
- package/src/schema/grammars/sqlite.ts +540 -0
- package/src/schema/index.ts +25 -0
- package/src/schema/schema.ts +87 -0
- package/src/scope/context.ts +124 -0
- package/src/scope/index.ts +26 -0
- package/src/scope/scope.ts +250 -0
- package/src/session/cache-store.ts +57 -0
- package/src/session/database.ts +121 -0
- package/src/session/index.ts +24 -0
- package/src/session/manager.ts +251 -0
- package/src/session/middleware.ts +79 -0
- package/src/session/session.ts +282 -0
- package/src/session/stores.ts +173 -0
- package/src/storage/index.ts +1 -0
- package/src/str/index.ts +1 -0
- package/src/str/str.ts +115 -0
- package/src/support/clock.ts +11 -0
- package/src/support/data.ts +156 -0
- package/src/support/index.ts +26 -0
- package/src/support/register.ts +13 -0
- package/src/support/text.ts +17 -0
- package/src/support/type-assertions.ts +14 -0
- package/src/support/types.ts +80 -0
- package/src/support/units.ts +67 -0
- package/src/task/index.ts +14 -0
- package/src/task/task.ts +199 -0
- package/src/testing/assert-database.ts +145 -0
- package/src/testing/conformance/cache.ts +453 -0
- package/src/testing/conformance/column-types.ts +47 -0
- package/src/testing/conformance/database.ts +512 -0
- package/src/testing/conformance/factories.ts +350 -0
- package/src/testing/conformance/harness.ts +107 -0
- package/src/testing/conformance/index.ts +12 -0
- package/src/testing/conformance/migrations.ts +400 -0
- package/src/testing/conformance/models.ts +810 -0
- package/src/testing/conformance/pagination.ts +324 -0
- package/src/testing/conformance/query-builder.ts +900 -0
- package/src/testing/conformance/queue.ts +239 -0
- package/src/testing/conformance/relationships.ts +948 -0
- package/src/testing/conformance/schema.ts +373 -0
- package/src/testing/conformance/session.ts +190 -0
- package/src/testing/database.ts +245 -0
- package/src/testing/files.ts +46 -0
- package/src/testing/index.ts +15 -0
- package/src/testing/inertia.ts +151 -0
- package/src/testing/query-log.ts +34 -0
- package/src/testing/response.ts +391 -0
- package/src/testing/testing.ts +593 -0
- package/src/time/index.ts +2 -0
- package/src/time/time.ts +143 -0
- package/src/tracing/index.ts +1 -0
- package/src/validation/index.ts +38 -0
- package/src/validation/input.ts +334 -0
- package/src/validation/messages.ts +96 -0
- package/src/validation/presence.ts +52 -0
- package/src/validation/rules.ts +839 -0
- package/src/validation/standard.ts +45 -0
- package/src/view/channel.ts +16 -0
- package/src/view/head.ts +165 -0
- package/src/view/helpers.ts +29 -0
- package/src/view/html.ts +303 -0
- package/src/view/index.ts +6 -0
- package/src/view/translate.ts +48 -0
- package/src/vite/index.ts +2 -0
- package/src/vite/plugin.ts +311 -0
- package/src/vite/vite.ts +302 -0
- package/src/workflow/index.ts +1 -0
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
// The model conformance suite: rows read as instances of their class, every write on the class and on the row, the
|
|
2
|
+
// values of each column type, defaults read back after an insert, `updatedAt`, hooks and their transaction. Each test
|
|
3
|
+
// runs against the database under test; the models are declared here, over tables the suite creates.
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import { after, before, beforeEach, describe, test } from 'node:test';
|
|
6
|
+
import { inspect } from 'node:util';
|
|
7
|
+
import { db, sql } from '../../db/index.js';
|
|
8
|
+
import { Password } from '../../hash/index.js';
|
|
9
|
+
import { toWire } from '../../http/index.js';
|
|
10
|
+
import { formatJson, formatText, redact } from '../../log/index.js';
|
|
11
|
+
import { anyone, input, v, ValidationError } from '../../validation/index.js';
|
|
12
|
+
import { column, compareModels, InvalidModelValueError, Model, ModelNotFoundError, UnknownModelColumnError, } from '../../model/index.js';
|
|
13
|
+
import { schema } from '../../schema/index.js';
|
|
14
|
+
import { openHarness } from './harness.js';
|
|
15
|
+
const start = Temporal.Instant.from('2026-12-10T09:30:00.123456Z');
|
|
16
|
+
/** Runs the model conformance suite: `testModels('postgres', { connection: { url } })`. */
|
|
17
|
+
export function testModels(name, options) {
|
|
18
|
+
describe(`models: ${name}`, () => {
|
|
19
|
+
class Author extends Model('model_authors', {
|
|
20
|
+
id: column.id(),
|
|
21
|
+
name: column.string(),
|
|
22
|
+
email: column.string(),
|
|
23
|
+
password: column.password(),
|
|
24
|
+
secret: column.encrypted().nullable(),
|
|
25
|
+
balance: column.bigint().asBigInt().default(),
|
|
26
|
+
...column.timestamps(),
|
|
27
|
+
}) {
|
|
28
|
+
greeting() {
|
|
29
|
+
return `Hello, ${this.name}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** What the hooks of `Article` do in the current test. */
|
|
33
|
+
const behaviour = { creating: undefined, updating: undefined, deleting: undefined, calls: [] };
|
|
34
|
+
class Article extends Model('model_articles', {
|
|
35
|
+
id: column.id(),
|
|
36
|
+
authorId: column.foreignId(),
|
|
37
|
+
title: column.string(),
|
|
38
|
+
slug: column.string(),
|
|
39
|
+
body: column.text().nullable(),
|
|
40
|
+
status: column.enum(['draft', 'published']).default(),
|
|
41
|
+
votes: column.integer().default(),
|
|
42
|
+
rating: column.decimal().nullable(),
|
|
43
|
+
featured: column.boolean().default(),
|
|
44
|
+
meta: column.json().nullable(),
|
|
45
|
+
publishedOn: column.date().nullable(),
|
|
46
|
+
publishedAt: column.timestamp().nullable(),
|
|
47
|
+
...column.timestamps(),
|
|
48
|
+
}) {
|
|
49
|
+
static hooks = {
|
|
50
|
+
creating: (values) => {
|
|
51
|
+
behaviour.calls.push('creating');
|
|
52
|
+
return behaviour.creating?.(values);
|
|
53
|
+
},
|
|
54
|
+
updating: (row, values) => {
|
|
55
|
+
behaviour.calls.push('updating');
|
|
56
|
+
return behaviour.updating?.(row, values);
|
|
57
|
+
},
|
|
58
|
+
deleting: (row) => {
|
|
59
|
+
behaviour.calls.push('deleting');
|
|
60
|
+
return behaviour.deleting?.(row);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
isPublished() {
|
|
64
|
+
return this.publishedAt !== null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class Badge extends Model('model_badges', {
|
|
68
|
+
uuid: column.uuid().generated(),
|
|
69
|
+
label: column.string(),
|
|
70
|
+
}) {
|
|
71
|
+
static primaryKey = 'uuid';
|
|
72
|
+
}
|
|
73
|
+
/** The same table, found in routes by its label. */
|
|
74
|
+
class LabelledBadge extends Model('model_badges', {
|
|
75
|
+
uuid: column.uuid().generated(),
|
|
76
|
+
label: column.string(),
|
|
77
|
+
}) {
|
|
78
|
+
static primaryKey = 'uuid';
|
|
79
|
+
static routeKey = 'label';
|
|
80
|
+
}
|
|
81
|
+
/** A request as fromRoute() reads it: its route parameters. */
|
|
82
|
+
const routed = (params) => ({ params });
|
|
83
|
+
const published = (query) => query.where('status', 'published');
|
|
84
|
+
const byAuthor = (query, authorId) => query.where('authorId', authorId);
|
|
85
|
+
let harness;
|
|
86
|
+
const unit = (work) => harness.unit(work);
|
|
87
|
+
const author = () => Author.create({ name: 'Ada', email: 'ada@example.com', password: new Password('secret') });
|
|
88
|
+
const article = (authorId, values = {}) => Article.create({
|
|
89
|
+
authorId,
|
|
90
|
+
title: values.title ?? 'Hello',
|
|
91
|
+
slug: values.slug ?? 'hello',
|
|
92
|
+
...(values.votes === undefined ? {} : { votes: values.votes }),
|
|
93
|
+
});
|
|
94
|
+
before(async () => {
|
|
95
|
+
harness = await openHarness(options, 'models');
|
|
96
|
+
await unit(async () => {
|
|
97
|
+
for (const table of ['model_articles', 'model_authors', 'model_badges'])
|
|
98
|
+
await schema.dropIfExists(table);
|
|
99
|
+
await schema.create('model_authors', (table) => {
|
|
100
|
+
table.id();
|
|
101
|
+
table.string('name');
|
|
102
|
+
table.string('email').unique();
|
|
103
|
+
table.string('password');
|
|
104
|
+
table.text('secret').nullable();
|
|
105
|
+
table.bigInteger('balance').default(0);
|
|
106
|
+
table.timestamps();
|
|
107
|
+
});
|
|
108
|
+
await schema.create('model_articles', (table) => {
|
|
109
|
+
table.id();
|
|
110
|
+
table.foreignId('author_id');
|
|
111
|
+
table.string('title');
|
|
112
|
+
table.string('slug').unique();
|
|
113
|
+
table.text('body').nullable();
|
|
114
|
+
table.enum('status', ['draft', 'published']).default('draft');
|
|
115
|
+
table.integer('votes').default(0);
|
|
116
|
+
table.decimal('rating', 8, 2).nullable();
|
|
117
|
+
table.boolean('featured').default(false);
|
|
118
|
+
table.json('meta').nullable();
|
|
119
|
+
table.date('published_on').nullable();
|
|
120
|
+
table.timestamp('published_at').nullable();
|
|
121
|
+
table.timestamps();
|
|
122
|
+
});
|
|
123
|
+
await schema.create('model_badges', (table) => {
|
|
124
|
+
table.uuid('uuid').primary();
|
|
125
|
+
table.string('label');
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
beforeEach(async () => {
|
|
130
|
+
behaviour.creating = undefined;
|
|
131
|
+
behaviour.updating = undefined;
|
|
132
|
+
behaviour.deleting = undefined;
|
|
133
|
+
behaviour.calls = [];
|
|
134
|
+
harness.clock.travelBack();
|
|
135
|
+
harness.clock.freeze(start);
|
|
136
|
+
await unit(async () => {
|
|
137
|
+
for (const table of ['model_articles', 'model_authors', 'model_badges'])
|
|
138
|
+
await db.table(table).all().delete();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
after(async () => {
|
|
142
|
+
await unit(async () => {
|
|
143
|
+
for (const table of ['model_articles', 'model_authors', 'model_badges'])
|
|
144
|
+
await schema.dropIfExists(table);
|
|
145
|
+
});
|
|
146
|
+
assert.deepEqual(harness.reported, []);
|
|
147
|
+
await harness.close();
|
|
148
|
+
});
|
|
149
|
+
test('rows are instances of their class, with its methods; JSON leaves out hidden columns', async () => {
|
|
150
|
+
await unit(async () => {
|
|
151
|
+
const created = await author();
|
|
152
|
+
const found = await Author.findOrFail(created.id);
|
|
153
|
+
assert.ok(found instanceof Author);
|
|
154
|
+
assert.equal(found.greeting(), 'Hello, Ada');
|
|
155
|
+
assert.equal(found.email, 'ada@example.com');
|
|
156
|
+
const json = JSON.parse(JSON.stringify(found));
|
|
157
|
+
assert.deepEqual(Object.keys(json).sort(), ['balance', 'createdAt', 'email', 'id', 'name', 'updatedAt']);
|
|
158
|
+
assert.equal(json.balance, '0', 'a bigint is written to JSON as a string');
|
|
159
|
+
const written = await article(created.id);
|
|
160
|
+
assert.ok((await Article.query().where('authorId', created.id).firstOrFail()) instanceof Article);
|
|
161
|
+
assert.equal(written.isPublished(), false);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
test('create fills the timestamps and reads back the database defaults', async () => {
|
|
165
|
+
await unit(async () => {
|
|
166
|
+
const ada = await author();
|
|
167
|
+
const created = await article(ada.id);
|
|
168
|
+
assert.equal(typeof created.id, 'number');
|
|
169
|
+
assert.equal(created.status, 'draft');
|
|
170
|
+
assert.equal(created.votes, 0);
|
|
171
|
+
assert.equal(created.featured, false);
|
|
172
|
+
assert.equal(created.body, null);
|
|
173
|
+
assert.equal(created.rating, null);
|
|
174
|
+
assert.equal(created.publishedAt, null);
|
|
175
|
+
assert.ok(created.createdAt.equals(start));
|
|
176
|
+
assert.ok(created.updatedAt.equals(start));
|
|
177
|
+
assert.equal(ada.balance, 0n);
|
|
178
|
+
const stored = await Article.findOrFail(created.id);
|
|
179
|
+
assert.deepEqual({ ...stored }, { ...created });
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
test('each column type round-trips as its declared type', async () => {
|
|
183
|
+
await unit(async () => {
|
|
184
|
+
const ada = await Author.create({
|
|
185
|
+
name: 'Ada',
|
|
186
|
+
email: 'ada@example.com',
|
|
187
|
+
password: new Password('secret'),
|
|
188
|
+
secret: { pin: '1234' },
|
|
189
|
+
balance: 2n ** 60n,
|
|
190
|
+
});
|
|
191
|
+
const created = await Article.create({
|
|
192
|
+
authorId: ada.id,
|
|
193
|
+
title: 'Types',
|
|
194
|
+
slug: 'types',
|
|
195
|
+
status: 'published',
|
|
196
|
+
rating: '12.50',
|
|
197
|
+
featured: true,
|
|
198
|
+
meta: { canonical: '/types', tags: ['a', 'b'] },
|
|
199
|
+
publishedOn: Temporal.PlainDate.from('2026-03-01'),
|
|
200
|
+
publishedAt: Temporal.Instant.from('2026-03-01T12:00:00.654321Z'),
|
|
201
|
+
});
|
|
202
|
+
const found = await Article.findOrFail(created.id);
|
|
203
|
+
assert.equal(found.status, 'published');
|
|
204
|
+
// SQLite keeps a decimal as a number, so trailing zeros are lost there.
|
|
205
|
+
assert.equal(found.rating, harness.connection.grammar.name === 'sqlite' ? '12.5' : '12.50');
|
|
206
|
+
assert.equal(found.featured, true);
|
|
207
|
+
assert.deepEqual(found.meta, { canonical: '/types', tags: ['a', 'b'] });
|
|
208
|
+
assert.ok(found.publishedOn?.equals('2026-03-01'));
|
|
209
|
+
assert.ok(found.publishedAt?.equals('2026-03-01T12:00:00.654321Z'));
|
|
210
|
+
const reread = await Author.findOrFail(ada.id);
|
|
211
|
+
assert.equal(reread.balance, 2n ** 60n);
|
|
212
|
+
assert.deepEqual(reread.secret, { pin: '1234' });
|
|
213
|
+
const raw = await db.selectOne(sql `select password, secret from model_authors`);
|
|
214
|
+
assert.match(raw?.password ?? '', /^\$argon2id\$/, 'the password is stored hashed');
|
|
215
|
+
assert.doesNotMatch(raw?.secret ?? '', /1234/, 'the secret is stored encrypted');
|
|
216
|
+
assert.equal(reread.password, raw?.password);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
test('a generated key is filled on create and finds the row', async () => {
|
|
220
|
+
await unit(async () => {
|
|
221
|
+
const badge = await Badge.create({ label: 'First' });
|
|
222
|
+
assert.match(badge.uuid, /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
223
|
+
assert.equal((await Badge.findOrFail(badge.uuid)).label, 'First');
|
|
224
|
+
const updated = await badge.update({ label: 'Second' });
|
|
225
|
+
assert.equal(updated, badge);
|
|
226
|
+
assert.equal((await Badge.findOrFail(badge.uuid)).label, 'Second');
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
test('update writes the keys given, changes the row in place, and maintains updatedAt', async () => {
|
|
230
|
+
await unit(async () => {
|
|
231
|
+
const created = await article((await author()).id);
|
|
232
|
+
harness.clock.travel('1 minute');
|
|
233
|
+
const returned = await created.update({ title: 'New title', publishedAt: start });
|
|
234
|
+
assert.equal(returned, created, 'the same object');
|
|
235
|
+
assert.equal(created.title, 'New title');
|
|
236
|
+
assert.ok(created.publishedAt?.equals(start));
|
|
237
|
+
assert.ok(created.updatedAt.equals(start.add({ minutes: 1 })));
|
|
238
|
+
assert.ok(created.createdAt.equals(start));
|
|
239
|
+
const stored = await Article.findOrFail(created.id);
|
|
240
|
+
assert.equal(stored.title, 'New title');
|
|
241
|
+
assert.equal(stored.slug, 'hello');
|
|
242
|
+
assert.ok(stored.updatedAt.equals(start.add({ minutes: 1 })));
|
|
243
|
+
harness.clock.travel('1 minute');
|
|
244
|
+
await created.update({});
|
|
245
|
+
assert.ok(created.updatedAt.equals(start.add({ minutes: 1 })), 'nothing to write: nothing written');
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
test('a row keeps what was added to it when it is written', async () => {
|
|
249
|
+
await unit(async () => {
|
|
250
|
+
const created = await article((await author()).id);
|
|
251
|
+
Object.defineProperty(created, 'comments', { value: ['loaded'], enumerable: true, writable: true });
|
|
252
|
+
await created.update({ title: 'Kept' });
|
|
253
|
+
await created.increment('votes');
|
|
254
|
+
await created.refresh();
|
|
255
|
+
assert.deepEqual(created.comments, ['loaded']);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
test('increment and decrement run in the database and read the new value back', async () => {
|
|
259
|
+
await unit(async () => {
|
|
260
|
+
const created = await article((await author()).id);
|
|
261
|
+
await Article.query().where('id', created.id).update({ votes: 10 });
|
|
262
|
+
harness.clock.travel('1 minute');
|
|
263
|
+
assert.equal(await created.increment('votes'), created);
|
|
264
|
+
assert.equal(created.votes, 11, 'the value is read back, not added in memory');
|
|
265
|
+
assert.ok(created.updatedAt.equals(start.add({ minutes: 1 })));
|
|
266
|
+
await created.decrement('votes', 3);
|
|
267
|
+
assert.equal(created.votes, 8);
|
|
268
|
+
assert.equal((await Article.findOrFail(created.id)).votes, 8);
|
|
269
|
+
await assert.rejects(created.increment('title'), (error) => {
|
|
270
|
+
assert.ok(error instanceof InvalidModelValueError);
|
|
271
|
+
assert.equal(error.message, 'Article.increment() takes a numeric column, and title is not one. The numeric columns are: id, authorId, votes, rating');
|
|
272
|
+
return true;
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
test('refresh reads the row again', async () => {
|
|
277
|
+
await unit(async () => {
|
|
278
|
+
const created = await article((await author()).id);
|
|
279
|
+
await Article.query().where('id', created.id).update({ title: 'Changed elsewhere' });
|
|
280
|
+
assert.equal(await created.refresh(), created);
|
|
281
|
+
assert.equal(created.title, 'Changed elsewhere');
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
test('delete removes the row; the object stays readable, and refuses later writes', async () => {
|
|
285
|
+
await unit(async () => {
|
|
286
|
+
const created = await article((await author()).id);
|
|
287
|
+
await created.delete();
|
|
288
|
+
assert.equal(await Article.find(created.id), null);
|
|
289
|
+
assert.equal(created.title, 'Hello');
|
|
290
|
+
await assert.rejects(created.update({ title: 'Again' }), (error) => {
|
|
291
|
+
assert.ok(error instanceof ModelNotFoundError);
|
|
292
|
+
assert.equal(error.status, 404);
|
|
293
|
+
assert.equal(error.message, `Article ${created.id} was deleted by delete(), so update() cannot write it.`);
|
|
294
|
+
return true;
|
|
295
|
+
});
|
|
296
|
+
await assert.rejects(created.refresh(), ModelNotFoundError);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
test('a write on a row deleted elsewhere is ModelNotFoundError', async () => {
|
|
300
|
+
await unit(async () => {
|
|
301
|
+
const created = await article((await author()).id);
|
|
302
|
+
await Article.query().where('id', created.id).delete();
|
|
303
|
+
await assert.rejects(created.update({ title: 'Gone' }), (error) => {
|
|
304
|
+
assert.ok(error instanceof ModelNotFoundError);
|
|
305
|
+
assert.equal(error.message, `No Article has the key ${created.id}.`);
|
|
306
|
+
return true;
|
|
307
|
+
});
|
|
308
|
+
await assert.rejects(created.increment('votes'), ModelNotFoundError);
|
|
309
|
+
await assert.rejects(created.refresh(), ModelNotFoundError);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
test('reading: find, findMany, firstOrFail, sole, pluck, value, scopes and chosen columns', async () => {
|
|
313
|
+
await unit(async () => {
|
|
314
|
+
const ada = await author();
|
|
315
|
+
const one = await article(ada.id, { title: 'One', slug: 'one', votes: 5 });
|
|
316
|
+
const two = await article(ada.id, { title: 'Two', slug: 'two', votes: 50 });
|
|
317
|
+
await two.update({ status: 'published' });
|
|
318
|
+
assert.equal((await Article.find(one.id))?.title, 'One');
|
|
319
|
+
assert.equal(await Article.find(one.id + two.id + 1000), null);
|
|
320
|
+
await assert.rejects(Article.findOrFail(0), (error) => {
|
|
321
|
+
assert.ok(error instanceof ModelNotFoundError);
|
|
322
|
+
assert.equal(error.message, 'No Article has the key 0.');
|
|
323
|
+
return true;
|
|
324
|
+
});
|
|
325
|
+
assert.deepEqual((await Article.findMany([one.id, two.id])).map((row) => row.title).sort(), ['One', 'Two']);
|
|
326
|
+
assert.deepEqual(await Article.findMany([]), []);
|
|
327
|
+
assert.equal((await Article.all()).length, 2);
|
|
328
|
+
assert.equal((await Article.query().scope(published).scope(byAuthor, ada.id).sole()).title, 'Two');
|
|
329
|
+
await assert.rejects(Article.query().where('votes', '>', 1000).firstOrFail(), (error) => {
|
|
330
|
+
assert.ok(error instanceof ModelNotFoundError);
|
|
331
|
+
assert.equal(error.message, 'No Article matches the query.');
|
|
332
|
+
return true;
|
|
333
|
+
});
|
|
334
|
+
await assert.rejects(Article.query().where('votes', '>', 1000).sole(), ModelNotFoundError);
|
|
335
|
+
assert.deepEqual(await Article.query().orderBy('votes').pluck('title'), ['One', 'Two']);
|
|
336
|
+
assert.ok((await Article.query().latest('votes').value('createdAt')).equals(start));
|
|
337
|
+
assert.equal(await Article.query().max('votes'), 50);
|
|
338
|
+
assert.equal(await Article.query().whereNull('publishedAt').count(), 2);
|
|
339
|
+
const picked = await Article.query().select('id', 'title').orderBy('id').get();
|
|
340
|
+
assert.deepEqual(picked, [
|
|
341
|
+
{ id: one.id, title: 'One' },
|
|
342
|
+
{ id: two.id, title: 'Two' },
|
|
343
|
+
]);
|
|
344
|
+
assert.ok(!(picked[0] instanceof Article), 'chosen columns are plain objects');
|
|
345
|
+
const rows = [];
|
|
346
|
+
for await (const row of Article.query().orderBy('id').cursor())
|
|
347
|
+
rows.push(row.title);
|
|
348
|
+
assert.deepEqual(rows, ['One', 'Two']);
|
|
349
|
+
await Article.query().chunkById(1, (page) => {
|
|
350
|
+
assert.ok(page[0] instanceof Article);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
test('an unknown column or an invalid value is refused before any statement runs', async () => {
|
|
355
|
+
await unit(async () => {
|
|
356
|
+
const ada = await author();
|
|
357
|
+
await assert.rejects(Article.create({ authorId: ada.id, title: 'x', slug: 'x', isAdmin: true }), (error) => {
|
|
358
|
+
assert.ok(error instanceof UnknownModelColumnError);
|
|
359
|
+
assert.equal(error.message, 'Article has no column "isAdmin". Its columns are: id, authorId, title, slug, body, status, votes, rating, featured, meta, publishedOn, publishedAt, createdAt, updatedAt');
|
|
360
|
+
return true;
|
|
361
|
+
});
|
|
362
|
+
await assert.rejects(ada.update({ admin: true }), UnknownModelColumnError);
|
|
363
|
+
await assert.rejects(Article.create({ authorId: ada.id, title: 'x', slug: 'x', status: 'archived' }), {
|
|
364
|
+
message: 'Article.status is one of "draft", "published", not "archived".',
|
|
365
|
+
});
|
|
366
|
+
await assert.rejects(Author.create({ name: 'B', email: 'b@example.com', password: 'plain' }), {
|
|
367
|
+
message: 'Author.password takes a Password, which is hashed before it is stored, or a password hash. Wrap the text: new Password(text). A plain string is refused so that no password is stored as it was typed.',
|
|
368
|
+
});
|
|
369
|
+
await assert.rejects(Article.create({ authorId: ada.id, title: null, slug: 'x' }), {
|
|
370
|
+
message: 'Article.title cannot be null: the column is not nullable. If it may be empty, declare it with .nullable().',
|
|
371
|
+
});
|
|
372
|
+
assert.equal(await Article.query().count(), 0);
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
test('firstOrCreate and updateOrCreate find by their attributes, or create', async () => {
|
|
376
|
+
await unit(async () => {
|
|
377
|
+
const ada = await author();
|
|
378
|
+
const [created, isNew] = await Article.firstOrCreate({ slug: 'hello' }, { authorId: ada.id, title: 'Hello' });
|
|
379
|
+
assert.equal(isNew, true);
|
|
380
|
+
const [found, again] = await Article.firstOrCreate({ slug: 'hello' }, { authorId: ada.id, title: 'Other' });
|
|
381
|
+
assert.equal(again, false);
|
|
382
|
+
assert.equal(found.id, created.id);
|
|
383
|
+
assert.equal(found.title, 'Hello');
|
|
384
|
+
const updated = await Article.updateOrCreate({ slug: 'hello' }, { authorId: ada.id, title: 'Updated' });
|
|
385
|
+
assert.equal(updated.id, created.id);
|
|
386
|
+
assert.equal(updated.title, 'Updated');
|
|
387
|
+
const fresh = await Article.updateOrCreate({ slug: 'fresh' }, { authorId: ada.id, title: 'Fresh' });
|
|
388
|
+
assert.notEqual(fresh.id, created.id);
|
|
389
|
+
assert.equal(await Article.query().count(), 2);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
test('destroy deletes by key, one row at a time so that hooks run', async () => {
|
|
393
|
+
await unit(async () => {
|
|
394
|
+
const ada = await author();
|
|
395
|
+
const one = await article(ada.id, { slug: 'one' });
|
|
396
|
+
const two = await article(ada.id, { slug: 'two' });
|
|
397
|
+
behaviour.calls = [];
|
|
398
|
+
assert.equal(await Article.destroy([one.id, two.id, 0]), 2);
|
|
399
|
+
assert.deepEqual(behaviour.calls, ['deleting', 'deleting']);
|
|
400
|
+
assert.equal(await Article.query().count(), 0);
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
test('insertMany and upsert write many rows without hooks; upsert keeps createdAt', async () => {
|
|
404
|
+
await unit(async () => {
|
|
405
|
+
const ada = await author();
|
|
406
|
+
behaviour.calls = [];
|
|
407
|
+
assert.equal(await Article.insertMany([
|
|
408
|
+
{ authorId: ada.id, title: 'One', slug: 'one' },
|
|
409
|
+
{ authorId: ada.id, title: 'Two', slug: 'two' },
|
|
410
|
+
]), 2);
|
|
411
|
+
assert.deepEqual(behaviour.calls, []);
|
|
412
|
+
const one = await Article.query().where('slug', 'one').firstOrFail();
|
|
413
|
+
assert.ok(one.createdAt.equals(start));
|
|
414
|
+
harness.clock.travel('1 hour');
|
|
415
|
+
await Article.upsert([
|
|
416
|
+
{ authorId: ada.id, title: 'One again', slug: 'one' },
|
|
417
|
+
{ authorId: ada.id, title: 'Three', slug: 'three' },
|
|
418
|
+
], 'slug');
|
|
419
|
+
const again = await Article.query().where('slug', 'one').firstOrFail();
|
|
420
|
+
assert.equal(again.title, 'One again');
|
|
421
|
+
assert.ok(again.createdAt.equals(start), 'createdAt is not overwritten');
|
|
422
|
+
assert.ok(again.updatedAt.equals(start.add({ hours: 1 })));
|
|
423
|
+
assert.deepEqual(await Article.query().orderBy('slug').pluck('slug'), ['one', 'three', 'two']);
|
|
424
|
+
await Article.upsert([{ authorId: ada.id, title: 'Ignored', slug: 'two', votes: 7 }], ['slug'], ['votes']);
|
|
425
|
+
const two = await Article.query().where('slug', 'two').firstOrFail();
|
|
426
|
+
assert.equal(two.title, 'Two', 'only the columns named are updated');
|
|
427
|
+
assert.equal(two.votes, 7);
|
|
428
|
+
assert.deepEqual(behaviour.calls, []);
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
test('hooks change the values, refuse writes, and run inside the write’s transaction', async () => {
|
|
432
|
+
await unit(async () => {
|
|
433
|
+
const ada = await author();
|
|
434
|
+
behaviour.creating = (values) => {
|
|
435
|
+
assert.equal(db.inTransaction(), true);
|
|
436
|
+
return { ...values, title: String(values.title).toUpperCase() };
|
|
437
|
+
};
|
|
438
|
+
const created = await article(ada.id);
|
|
439
|
+
assert.equal(created.title, 'HELLO');
|
|
440
|
+
assert.equal((await Article.findOrFail(created.id)).title, 'HELLO');
|
|
441
|
+
behaviour.updating = (_row, values) => ({ ...values, body: 'from the hook' });
|
|
442
|
+
await created.update({ title: 'Changed' });
|
|
443
|
+
assert.equal(created.body, 'from the hook');
|
|
444
|
+
behaviour.updating = () => {
|
|
445
|
+
throw new Error('Refused.');
|
|
446
|
+
};
|
|
447
|
+
await assert.rejects(created.update({ title: 'Never' }), { message: 'Refused.' });
|
|
448
|
+
assert.equal(created.title, 'Changed');
|
|
449
|
+
assert.equal((await Article.findOrFail(created.id)).title, 'Changed');
|
|
450
|
+
behaviour.deleting = () => {
|
|
451
|
+
throw new Error('Unpublish it first.');
|
|
452
|
+
};
|
|
453
|
+
await assert.rejects(created.delete(), { message: 'Unpublish it first.' });
|
|
454
|
+
assert.notEqual(await Article.find(created.id), null);
|
|
455
|
+
// The hook's own writes roll back with the insert.
|
|
456
|
+
behaviour.creating = async (values) => {
|
|
457
|
+
await db.table('model_authors').insert({
|
|
458
|
+
name: 'From the hook',
|
|
459
|
+
email: 'hook@example.com',
|
|
460
|
+
password: '$argon2id$x',
|
|
461
|
+
created_at: start,
|
|
462
|
+
updated_at: start,
|
|
463
|
+
});
|
|
464
|
+
return values;
|
|
465
|
+
};
|
|
466
|
+
await assert.rejects(article(ada.id, { slug: 'hello' }));
|
|
467
|
+
assert.equal(await db.table('model_authors').where('email', 'hook@example.com').count(), 0);
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
test('query writes skip the hooks, but convert values and maintain updatedAt', async () => {
|
|
471
|
+
await unit(async () => {
|
|
472
|
+
const ada = await author();
|
|
473
|
+
const created = await article(ada.id);
|
|
474
|
+
behaviour.updating = () => {
|
|
475
|
+
throw new Error('Not called.');
|
|
476
|
+
};
|
|
477
|
+
harness.clock.travel('1 minute');
|
|
478
|
+
assert.equal(await Article.query()
|
|
479
|
+
.where('id', created.id)
|
|
480
|
+
.update({ title: 'Bulk', meta: { canonical: '/bulk' } }), 1);
|
|
481
|
+
const stored = await Article.findOrFail(created.id);
|
|
482
|
+
assert.equal(stored.title, 'Bulk');
|
|
483
|
+
assert.deepEqual(stored.meta, { canonical: '/bulk' });
|
|
484
|
+
assert.ok(stored.updatedAt.equals(start.add({ minutes: 1 })));
|
|
485
|
+
await Author.query()
|
|
486
|
+
.where('id', ada.id)
|
|
487
|
+
.update({ password: new Password('changed') });
|
|
488
|
+
assert.match((await Author.findOrFail(ada.id)).password, /^\$argon2id\$/);
|
|
489
|
+
await assert.rejects(Article.query().update({ title: 'All' }), { code: 'E_UNSCOPED_WRITE' });
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
test('hidden columns are not enumerable: JSON, toWire, spreading, log lines and inspect leave them out', async () => {
|
|
493
|
+
await unit(async () => {
|
|
494
|
+
const created = await Author.create({
|
|
495
|
+
name: 'Ada',
|
|
496
|
+
email: 'ada@example.com',
|
|
497
|
+
password: new Password('secret'),
|
|
498
|
+
secret: { pin: '4321' },
|
|
499
|
+
});
|
|
500
|
+
const found = await Author.findOrFail(created.id);
|
|
501
|
+
const changed = await (await Author.findOrFail(created.id)).update({
|
|
502
|
+
password: new Password('other'),
|
|
503
|
+
secret: { pin: '8765' },
|
|
504
|
+
});
|
|
505
|
+
const partial = await Author.query().select('id', 'name').firstOrFail();
|
|
506
|
+
const chosen = await Author.query().select('id', 'password', 'secret').firstOrFail();
|
|
507
|
+
assert.match(found.password, /^\$argon2id\$/, 'the row still reads a hidden column');
|
|
508
|
+
assert.deepEqual(found.secret, { pin: '4321' });
|
|
509
|
+
assert.deepEqual(chosen.secret, { pin: '8765' });
|
|
510
|
+
const visible = ['balance', 'createdAt', 'email', 'id', 'name', 'updatedAt'];
|
|
511
|
+
for (const [label, row] of [
|
|
512
|
+
['created', created],
|
|
513
|
+
['found', found],
|
|
514
|
+
['updated', changed],
|
|
515
|
+
['chosen columns', chosen],
|
|
516
|
+
]) {
|
|
517
|
+
const leaks = (text) => /argon2id|4321|8765/.test(text);
|
|
518
|
+
assert.equal(leaks(JSON.stringify(row)), false, `${label}: JSON`);
|
|
519
|
+
assert.equal(leaks(JSON.stringify(toWire({ author: row, list: [row] }))), false, `${label}: toWire`);
|
|
520
|
+
const spread = JSON.stringify({ ...row }, (_key, value) => (typeof value === 'bigint' ? String(value) : value));
|
|
521
|
+
assert.equal(leaks(spread), false, `${label}: spread`);
|
|
522
|
+
assert.equal(leaks(inspect(row, { depth: 5 })), false, `${label}: inspect`);
|
|
523
|
+
const record = {
|
|
524
|
+
time: start,
|
|
525
|
+
level: 'info',
|
|
526
|
+
message: 'signed in',
|
|
527
|
+
context: redact({ author: row }, new Set()),
|
|
528
|
+
scope: {},
|
|
529
|
+
channel: 'test',
|
|
530
|
+
};
|
|
531
|
+
assert.equal(leaks(formatJson(record)) || leaks(formatText(record, false)), false, `${label}: log line`);
|
|
532
|
+
assert.deepEqual(Object.keys(row).filter((key) => key === 'password' || key === 'secret'), [], `${label}: keys`);
|
|
533
|
+
}
|
|
534
|
+
assert.deepEqual(Object.keys(toWire(found)).sort(), visible);
|
|
535
|
+
assert.deepEqual(Object.keys(found.toJSON()).sort(), visible);
|
|
536
|
+
// Refreshing reads the hidden columns again, still hidden.
|
|
537
|
+
const refreshed = await found.refresh();
|
|
538
|
+
assert.deepEqual(refreshed.secret, { pin: '8765' });
|
|
539
|
+
assert.equal(Object.keys(refreshed).includes('secret'), false);
|
|
540
|
+
assert.deepEqual(Object.keys(partial).sort(), ['id', 'name']);
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
test('fromRoute() finds the row a route parameter names, and anything else is a 404', async () => {
|
|
544
|
+
await unit(async () => {
|
|
545
|
+
const ada = await author();
|
|
546
|
+
const hello = await article(ada.id);
|
|
547
|
+
await Article.query().where('id', hello.id).update({ status: 'published' });
|
|
548
|
+
const draft = await article(ada.id, { title: 'Draft', slug: 'draft' });
|
|
549
|
+
const found = await Article.fromRoute(routed({ article: String(hello.id) }), 'article');
|
|
550
|
+
assert.ok(found instanceof Article);
|
|
551
|
+
assert.equal(found.id, hello.id);
|
|
552
|
+
assert.equal((await Article.fromRoute(routed({ article: 'draft' }), 'article', 'slug')).id, draft.id);
|
|
553
|
+
assert.equal((await Article.query()
|
|
554
|
+
.scope(published)
|
|
555
|
+
.fromRoute(routed({ article: 'hello' }), 'article', 'slug')).id, hello.id);
|
|
556
|
+
await assert.rejects(Article.query()
|
|
557
|
+
.scope(published)
|
|
558
|
+
.fromRoute(routed({ article: 'draft' }), 'article', 'slug'), {
|
|
559
|
+
code: 'E_MODEL_NOT_FOUND',
|
|
560
|
+
status: 404,
|
|
561
|
+
message: 'No Article has slug "draft".',
|
|
562
|
+
});
|
|
563
|
+
await assert.rejects(Article.fromRoute(routed({ article: '987654' }), 'article'), {
|
|
564
|
+
status: 404,
|
|
565
|
+
message: 'No Article has the key 987654.',
|
|
566
|
+
});
|
|
567
|
+
for (const value of ['abc', '1.5', '99999999999999999999', ''])
|
|
568
|
+
await assert.rejects(Article.fromRoute(routed({ article: value }), 'article'), { status: 404 }, value);
|
|
569
|
+
// A UUID key, malformed or not.
|
|
570
|
+
const gold = await Badge.create({ label: 'gold' });
|
|
571
|
+
assert.equal((await Badge.fromRoute(routed({ badge: gold.uuid }), 'badge')).label, 'gold');
|
|
572
|
+
await assert.rejects(Badge.fromRoute(routed({ badge: 'not-a-uuid' }), 'badge'), { status: 404 });
|
|
573
|
+
// routeKey changes the default column.
|
|
574
|
+
assert.equal((await LabelledBadge.fromRoute(routed({ badge: 'gold' }), 'badge')).uuid, gold.uuid);
|
|
575
|
+
await assert.rejects(LabelledBadge.fromRoute(routed({ badge: gold.uuid }), 'badge'), {
|
|
576
|
+
message: `No LabelledBadge has label "${gold.uuid}".`,
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
});
|
|
580
|
+
test('fromRoute() names the mistakes', async () => {
|
|
581
|
+
await unit(async () => {
|
|
582
|
+
await assert.rejects(Article.fromRoute(routed({ post: '1', comment: '2' }), 'article'), {
|
|
583
|
+
code: 'E_INVALID_MODEL_VALUE',
|
|
584
|
+
message: 'Article.fromRoute(): the request has no route parameter "article". Its parameters are: post, comment.',
|
|
585
|
+
});
|
|
586
|
+
await assert.rejects(Article.fromRoute(routed({}), 'article'), {
|
|
587
|
+
message: 'Article.fromRoute(): the request has no route parameter "article". Its route has none.',
|
|
588
|
+
});
|
|
589
|
+
await assert.rejects(Article.fromRoute(null, 'article'), {
|
|
590
|
+
message: "Article.fromRoute() takes the request first, then the parameter's name: Article.fromRoute(request, 'article').",
|
|
591
|
+
});
|
|
592
|
+
await assert.rejects(Article.fromRoute(routed({ article: '1' }), 'article', 'nope'), UnknownModelColumnError);
|
|
593
|
+
await assert.rejects(Article.fromRoute(routed({ article: '1' }), 'article', 'publishedAt'), {
|
|
594
|
+
message: 'Article.fromRoute() finds a row by a key or a text column, and publishedAt is a timestamp column.',
|
|
595
|
+
});
|
|
596
|
+
await assert.rejects(Author.fromRoute(routed({ author: 'x' }), 'author', 'password'), {
|
|
597
|
+
message: 'Author.fromRoute() finds a row by a key or a text column, and password is hidden.',
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
});
|
|
601
|
+
test('unique() and exists() ask the database, inside the ambient transaction', async () => {
|
|
602
|
+
await unit(async () => {
|
|
603
|
+
const errors = async (form, data) => {
|
|
604
|
+
try {
|
|
605
|
+
await form.validate(data);
|
|
606
|
+
return {};
|
|
607
|
+
}
|
|
608
|
+
catch (error) {
|
|
609
|
+
if (error instanceof ValidationError)
|
|
610
|
+
return { ...error.errors };
|
|
611
|
+
throw error;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
const ada = await author();
|
|
615
|
+
const grace = await Author.create({ name: 'Grace', email: 'grace@example.com', password: new Password('x') });
|
|
616
|
+
await article(ada.id, { slug: 'ada-post' });
|
|
617
|
+
const signUp = input({ email: v.string().required().unique(Author, 'email'), mentor: v.number().exists(Author) }).authorize(anyone);
|
|
618
|
+
assert.deepEqual(await errors(signUp, { email: 'linus@example.com', mentor: ada.id }), {});
|
|
619
|
+
assert.deepEqual(await errors(signUp, { email: 'ada@example.com', mentor: 987654 }), {
|
|
620
|
+
email: ['The email has already been taken.'],
|
|
621
|
+
mentor: ['The selected mentor is invalid.'],
|
|
622
|
+
});
|
|
623
|
+
// The row being updated may keep its value; another row may not take it.
|
|
624
|
+
const profile = (row) => input({ email: v.string().unique(Author, 'email', { ignore: row }) }).authorize(anyone);
|
|
625
|
+
assert.deepEqual(await errors(profile(ada), { email: 'ada@example.com' }), {});
|
|
626
|
+
assert.deepEqual(await errors(profile(grace), { email: 'ada@example.com' }), {
|
|
627
|
+
email: ['The email has already been taken.'],
|
|
628
|
+
});
|
|
629
|
+
const byKey = input({ email: v.string().unique(Author, 'email', { ignore: grace.id }) }).authorize(anyone);
|
|
630
|
+
assert.deepEqual(await errors(byKey, { email: 'grace@example.com' }), {});
|
|
631
|
+
// A constraint narrows the rows; a value that cannot be the column's fails without a database error.
|
|
632
|
+
const own = (authorId) => input({ slug: v.string().exists(Article, 'slug', (query) => query.where('authorId', authorId)) }).authorize(anyone);
|
|
633
|
+
assert.deepEqual(await errors(own(ada.id), { slug: 'ada-post' }), {});
|
|
634
|
+
assert.deepEqual(await errors(own(grace.id), { slug: 'ada-post' }), { slug: ['The selected slug is invalid.'] });
|
|
635
|
+
const anyKey = input({ author: v.string().exists(Author) }).authorize(anyone);
|
|
636
|
+
assert.deepEqual(await errors(anyKey, { author: String(ada.id) }), {});
|
|
637
|
+
assert.deepEqual(await errors(anyKey, { author: 'abc' }), { author: ['The selected author is invalid.'] });
|
|
638
|
+
const badge = await Badge.create({ label: 'gold' });
|
|
639
|
+
const badges = input({ badge: v.string().exists(Badge) }).authorize(anyone);
|
|
640
|
+
assert.deepEqual(await errors(badges, { badge: badge.uuid }), {});
|
|
641
|
+
assert.deepEqual(await errors(badges, { badge: 'not-a-uuid' }), { badge: ['The selected badge is invalid.'] });
|
|
642
|
+
// A row created in the transaction counts inside it, and not once it is rolled back.
|
|
643
|
+
const fresh = input({ email: v.string().unique(Author, 'email') }).authorize(anyone);
|
|
644
|
+
await assert.rejects(db.transaction(async () => {
|
|
645
|
+
await Author.create({ name: 'Linus', email: 'linus@example.com', password: new Password('x') });
|
|
646
|
+
assert.deepEqual(await errors(fresh, { email: 'linus@example.com' }), {
|
|
647
|
+
email: ['The email has already been taken.'],
|
|
648
|
+
});
|
|
649
|
+
throw new Error('roll back');
|
|
650
|
+
}), { message: 'roll back' });
|
|
651
|
+
assert.deepEqual(await errors(fresh, { email: 'linus@example.com' }), {});
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
test('a database rule names a column of the model, and never a hashed or encrypted one', () => {
|
|
655
|
+
assert.throws(() => v.string().unique(Author, 'mail'), UnknownModelColumnError);
|
|
656
|
+
assert.throws(() => v.string().unique(Author, 'password'), {
|
|
657
|
+
code: 'E_INVALID_MODEL_VALUE',
|
|
658
|
+
message: 'unique() compares stored values, and Author.password is hashed.',
|
|
659
|
+
});
|
|
660
|
+
assert.throws(() => v.string().exists(Author, 'secret'), {
|
|
661
|
+
code: 'E_INVALID_MODEL_VALUE',
|
|
662
|
+
message: 'exists() compares stored values, and Author.secret is encrypted.',
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
test('the models match their tables, and each difference from a table is named', async () => {
|
|
666
|
+
class Drifted extends Model('model_drifted', {
|
|
667
|
+
id: column.id(),
|
|
668
|
+
title: column.string(),
|
|
669
|
+
note: column.string().nullable(),
|
|
670
|
+
views: column.integer(),
|
|
671
|
+
flag: column.boolean(),
|
|
672
|
+
}) {
|
|
673
|
+
}
|
|
674
|
+
class Ghost extends Model('model_ghosts', { id: column.id() }) {
|
|
675
|
+
}
|
|
676
|
+
await unit(async () => {
|
|
677
|
+
assert.deepEqual(await compareModels([Author, Article, Badge, LabelledBadge]), []);
|
|
678
|
+
await schema.dropIfExists('model_drifted');
|
|
679
|
+
await schema.create('model_drifted', (table) => {
|
|
680
|
+
table.id();
|
|
681
|
+
table.string('note');
|
|
682
|
+
table.integer('views').nullable();
|
|
683
|
+
table.string('flag');
|
|
684
|
+
});
|
|
685
|
+
try {
|
|
686
|
+
const drift = await compareModels([Drifted, Ghost]);
|
|
687
|
+
assert.deepEqual(drift.map(({ model, table, property }) => `${model} ${table} ${property}`), [
|
|
688
|
+
'Drifted model_drifted title',
|
|
689
|
+
'Drifted model_drifted note',
|
|
690
|
+
'Drifted model_drifted views',
|
|
691
|
+
'Drifted model_drifted flag',
|
|
692
|
+
'Ghost model_ghosts null',
|
|
693
|
+
]);
|
|
694
|
+
assert.deepEqual(drift.map((difference) => difference.message), [
|
|
695
|
+
'Drifted.title: the table "model_drifted" has no column "title".',
|
|
696
|
+
'Drifted.note is nullable() in the model, and the column "note" is NOT NULL: writing null fails.',
|
|
697
|
+
'Drifted.views is not nullable in the model, and the column "views" accepts NULL: a null read from it breaks the type. Add .nullable(), or make the column NOT NULL.',
|
|
698
|
+
drift[3]?.message,
|
|
699
|
+
'Ghost: the table "model_ghosts" does not exist. Create it in a migration, or name the model\'s table.',
|
|
700
|
+
]);
|
|
701
|
+
assert.match(drift[3]?.message ?? '', /^Drifted\.flag is declared column\.boolean\(\), which reads a boolean, and the column "flag" is \S.*\.$/);
|
|
702
|
+
}
|
|
703
|
+
finally {
|
|
704
|
+
await schema.dropIfExists('model_drifted');
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
test('new Model() is refused: rows come from the database', () => {
|
|
709
|
+
assert.throws(() => new Article(), {
|
|
710
|
+
message: 'Article rows come from the database: Article.create({ … }) inserts one and Article.find(id) reads one. new Article() is not supported.',
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
//# sourceMappingURL=models.js.map
|