@kabyeon/nexusjs 0.6.5
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 +860 -0
- package/dist/auth/auth.controller.d.ts +175 -0
- package/dist/auth/auth.controller.d.ts.map +1 -0
- package/dist/auth/auth.d.ts +47 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.module.d.ts +34 -0
- package/dist/auth/auth.module.d.ts.map +1 -0
- package/dist/auth/auth.service.d.ts +192 -0
- package/dist/auth/auth.service.d.ts.map +1 -0
- package/dist/auth/decorators/current-user.d.ts +58 -0
- package/dist/auth/decorators/current-user.d.ts.map +1 -0
- package/dist/auth/index.d.ts +43 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +730 -0
- package/dist/auth/index.js.map +25 -0
- package/dist/auth/middleware.d.ts +50 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/types.d.ts +135 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/cache/cache.module.d.ts +22 -0
- package/dist/cache/cache.module.d.ts.map +1 -0
- package/dist/cache/cache.service.d.ts +37 -0
- package/dist/cache/cache.service.d.ts.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 +814 -0
- package/dist/cache/index.js.map +25 -0
- package/dist/cache/stores/drizzle.d.ts +76 -0
- package/dist/cache/stores/drizzle.d.ts.map +1 -0
- package/dist/cache/stores/index.d.ts +10 -0
- package/dist/cache/stores/index.d.ts.map +1 -0
- package/dist/cache/stores/memory.d.ts +34 -0
- package/dist/cache/stores/memory.d.ts.map +1 -0
- package/dist/cache/stores/redis.d.ts +46 -0
- package/dist/cache/stores/redis.d.ts.map +1 -0
- package/dist/cache/types.d.ts +88 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cli/commands/config.d.ts +44 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/db-generate.d.ts +20 -0
- package/dist/cli/commands/db-generate.d.ts.map +1 -0
- package/dist/cli/commands/db-migrate.d.ts +33 -0
- package/dist/cli/commands/db-migrate.d.ts.map +1 -0
- package/dist/cli/commands/db-seed.d.ts +43 -0
- package/dist/cli/commands/db-seed.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +11 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/info.d.ts +11 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +38 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/make-auth.d.ts +17 -0
- package/dist/cli/commands/make-auth.d.ts.map +1 -0
- package/dist/cli/commands/make-controller.d.ts +16 -0
- package/dist/cli/commands/make-controller.d.ts.map +1 -0
- package/dist/cli/commands/make-crud.d.ts +28 -0
- package/dist/cli/commands/make-crud.d.ts.map +1 -0
- package/dist/cli/commands/make-listener.d.ts +15 -0
- package/dist/cli/commands/make-listener.d.ts.map +1 -0
- package/dist/cli/commands/make-middleware.d.ts +7 -0
- package/dist/cli/commands/make-middleware.d.ts.map +1 -0
- package/dist/cli/commands/make-migration.d.ts +21 -0
- package/dist/cli/commands/make-migration.d.ts.map +1 -0
- package/dist/cli/commands/make-model.d.ts +22 -0
- package/dist/cli/commands/make-model.d.ts.map +1 -0
- package/dist/cli/commands/make-module.d.ts +11 -0
- package/dist/cli/commands/make-module.d.ts.map +1 -0
- package/dist/cli/commands/make-queue.d.ts +17 -0
- package/dist/cli/commands/make-queue.d.ts.map +1 -0
- package/dist/cli/commands/make-schedule.d.ts +17 -0
- package/dist/cli/commands/make-schedule.d.ts.map +1 -0
- package/dist/cli/commands/make-service.d.ts +7 -0
- package/dist/cli/commands/make-service.d.ts.map +1 -0
- package/dist/cli/commands/make-session.d.ts +15 -0
- package/dist/cli/commands/make-session.d.ts.map +1 -0
- package/dist/cli/commands/make-validator.d.ts +7 -0
- package/dist/cli/commands/make-validator.d.ts.map +1 -0
- package/dist/cli/commands/new.d.ts +14 -0
- package/dist/cli/commands/new.d.ts.map +1 -0
- package/dist/cli/commands/repl.d.ts +42 -0
- package/dist/cli/commands/repl.d.ts.map +1 -0
- package/dist/cli/commands/route-list.d.ts +12 -0
- package/dist/cli/commands/route-list.d.ts.map +1 -0
- package/dist/cli/core/args.d.ts +29 -0
- package/dist/cli/core/args.d.ts.map +1 -0
- package/dist/cli/core/config.d.ts +137 -0
- package/dist/cli/core/config.d.ts.map +1 -0
- package/dist/cli/core/fs.d.ts +38 -0
- package/dist/cli/core/fs.d.ts.map +1 -0
- package/dist/cli/core/index.d.ts +42 -0
- package/dist/cli/core/index.d.ts.map +1 -0
- package/dist/cli/core/logger.d.ts +46 -0
- package/dist/cli/core/logger.d.ts.map +1 -0
- package/dist/cli/core/loose-json.d.ts +26 -0
- package/dist/cli/core/loose-json.d.ts.map +1 -0
- package/dist/cli/core/prompts.d.ts +22 -0
- package/dist/cli/core/prompts.d.ts.map +1 -0
- package/dist/cli/core/template.d.ts +26 -0
- package/dist/cli/core/template.d.ts.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +6136 -0
- package/dist/cli/index.js.map +91 -0
- package/dist/cli/templates/controller/adonis.d.ts +10 -0
- package/dist/cli/templates/controller/adonis.d.ts.map +1 -0
- package/dist/cli/templates/controller/functional.d.ts +9 -0
- package/dist/cli/templates/controller/functional.d.ts.map +1 -0
- package/dist/cli/templates/controller/nest.d.ts +17 -0
- package/dist/cli/templates/controller/nest.d.ts.map +1 -0
- package/dist/cli/templates/crud/controller.d.ts +8 -0
- package/dist/cli/templates/crud/controller.d.ts.map +1 -0
- package/dist/cli/templates/crud/dto.d.ts +8 -0
- package/dist/cli/templates/crud/dto.d.ts.map +1 -0
- package/dist/cli/templates/crud/index.d.ts +33 -0
- package/dist/cli/templates/crud/index.d.ts.map +1 -0
- package/dist/cli/templates/crud/module.d.ts +6 -0
- package/dist/cli/templates/crud/module.d.ts.map +1 -0
- package/dist/cli/templates/crud/test.d.ts +10 -0
- package/dist/cli/templates/crud/test.d.ts.map +1 -0
- package/dist/cli/templates/index.d.ts +39 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/cli/templates/middleware/middleware.d.ts +8 -0
- package/dist/cli/templates/middleware/middleware.d.ts.map +1 -0
- package/dist/cli/templates/migration/drizzle.d.ts +12 -0
- package/dist/cli/templates/migration/drizzle.d.ts.map +1 -0
- package/dist/cli/templates/migration/sql.d.ts +10 -0
- package/dist/cli/templates/migration/sql.d.ts.map +1 -0
- package/dist/cli/templates/model/drizzle-dialect.d.ts +29 -0
- package/dist/cli/templates/model/drizzle-dialect.d.ts.map +1 -0
- package/dist/cli/templates/model/drizzle.d.ts +14 -0
- package/dist/cli/templates/model/drizzle.d.ts.map +1 -0
- package/dist/cli/templates/model/kysely.d.ts +12 -0
- package/dist/cli/templates/model/kysely.d.ts.map +1 -0
- package/dist/cli/templates/model/prisma.d.ts +12 -0
- package/dist/cli/templates/model/prisma.d.ts.map +1 -0
- package/dist/cli/templates/module/module.d.ts +16 -0
- package/dist/cli/templates/module/module.d.ts.map +1 -0
- package/dist/cli/templates/project/drizzle.config.d.ts +12 -0
- package/dist/cli/templates/project/drizzle.config.d.ts.map +1 -0
- package/dist/cli/templates/project/nx.config.d.ts +7 -0
- package/dist/cli/templates/project/nx.config.d.ts.map +1 -0
- package/dist/cli/templates/repository/repository.d.ts +13 -0
- package/dist/cli/templates/repository/repository.d.ts.map +1 -0
- package/dist/cli/templates/service/service.d.ts +12 -0
- package/dist/cli/templates/service/service.d.ts.map +1 -0
- package/dist/cli/templates/validator/validator.d.ts +8 -0
- package/dist/cli/templates/validator/validator.d.ts.map +1 -0
- package/dist/config/config.module.d.ts +39 -0
- package/dist/config/config.module.d.ts.map +1 -0
- package/dist/config/config.service.d.ts +47 -0
- package/dist/config/config.service.d.ts.map +1 -0
- package/dist/config/index.d.ts +39 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +436 -0
- package/dist/config/index.js.map +21 -0
- package/dist/config/types.d.ts +78 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/application.d.ts +77 -0
- package/dist/core/application.d.ts.map +1 -0
- package/dist/core/constants.d.ts +48 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/decorators/controller.d.ts +21 -0
- package/dist/core/decorators/controller.d.ts.map +1 -0
- package/dist/core/decorators/http-methods.d.ts +33 -0
- package/dist/core/decorators/http-methods.d.ts.map +1 -0
- package/dist/core/decorators/index.d.ts +12 -0
- package/dist/core/decorators/index.d.ts.map +1 -0
- package/dist/core/decorators/injectable.d.ts +42 -0
- package/dist/core/decorators/injectable.d.ts.map +1 -0
- package/dist/core/decorators/metadata.d.ts +7 -0
- package/dist/core/decorators/metadata.d.ts.map +1 -0
- package/dist/core/decorators/module.d.ts +23 -0
- package/dist/core/decorators/module.d.ts.map +1 -0
- package/dist/core/decorators/params.d.ts +33 -0
- package/dist/core/decorators/params.d.ts.map +1 -0
- package/dist/core/decorators/repository.d.ts +24 -0
- package/dist/core/decorators/repository.d.ts.map +1 -0
- package/dist/core/decorators/validate.d.ts +21 -0
- package/dist/core/decorators/validate.d.ts.map +1 -0
- package/dist/core/di/container.d.ts +70 -0
- package/dist/core/di/container.d.ts.map +1 -0
- package/dist/core/di/index.d.ts +9 -0
- package/dist/core/di/index.d.ts.map +1 -0
- package/dist/core/di/request-middleware.d.ts +36 -0
- package/dist/core/di/request-middleware.d.ts.map +1 -0
- package/dist/core/di/request-scope.d.ts +45 -0
- package/dist/core/di/request-scope.d.ts.map +1 -0
- package/dist/core/di/scanner.d.ts +36 -0
- package/dist/core/di/scanner.d.ts.map +1 -0
- package/dist/core/di/tokens.d.ts +98 -0
- package/dist/core/di/tokens.d.ts.map +1 -0
- package/dist/core/http/context.d.ts +30 -0
- package/dist/core/http/context.d.ts.map +1 -0
- package/dist/core/http/index.d.ts +8 -0
- package/dist/core/http/index.d.ts.map +1 -0
- package/dist/core/http/middleware.d.ts +31 -0
- package/dist/core/http/middleware.d.ts.map +1 -0
- package/dist/core/http/router.d.ts +46 -0
- package/dist/core/http/router.d.ts.map +1 -0
- package/dist/core/http/server.d.ts +58 -0
- package/dist/core/http/server.d.ts.map +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/orm/drizzle-adapter.d.ts +73 -0
- package/dist/core/orm/drizzle-adapter.d.ts.map +1 -0
- package/dist/core/orm/index.d.ts +5 -0
- package/dist/core/orm/index.d.ts.map +1 -0
- package/dist/core/runtime/bun.d.ts +13 -0
- package/dist/core/runtime/bun.d.ts.map +1 -0
- package/dist/core/runtime/cloudflare.d.ts +18 -0
- package/dist/core/runtime/cloudflare.d.ts.map +1 -0
- package/dist/core/runtime/index.d.ts +11 -0
- package/dist/core/runtime/index.d.ts.map +1 -0
- package/dist/core/runtime/node.d.ts +10 -0
- package/dist/core/runtime/node.d.ts.map +1 -0
- package/dist/core/validation/index.d.ts +5 -0
- package/dist/core/validation/index.d.ts.map +1 -0
- package/dist/core/validation/validator.d.ts +46 -0
- package/dist/core/validation/validator.d.ts.map +1 -0
- package/dist/crypto/encryption.d.ts +71 -0
- package/dist/crypto/encryption.d.ts.map +1 -0
- package/dist/crypto/hash.d.ts +52 -0
- package/dist/crypto/hash.d.ts.map +1 -0
- package/dist/crypto/index.d.ts +49 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +533 -0
- package/dist/crypto/index.js.map +14 -0
- package/dist/crypto/module.d.ts +28 -0
- package/dist/crypto/module.d.ts.map +1 -0
- package/dist/crypto/types.d.ts +81 -0
- package/dist/crypto/types.d.ts.map +1 -0
- package/dist/drive/drive.module.d.ts +20 -0
- package/dist/drive/drive.module.d.ts.map +1 -0
- package/dist/drive/drive.service.d.ts +21 -0
- package/dist/drive/drive.service.d.ts.map +1 -0
- package/dist/drive/drivers/index.d.ts +9 -0
- package/dist/drive/drivers/index.d.ts.map +1 -0
- package/dist/drive/drivers/local.d.ts +24 -0
- package/dist/drive/drivers/local.d.ts.map +1 -0
- package/dist/drive/drivers/memory.d.ts +19 -0
- package/dist/drive/drivers/memory.d.ts.map +1 -0
- package/dist/drive/drivers/s3.d.ts +44 -0
- package/dist/drive/drivers/s3.d.ts.map +1 -0
- package/dist/drive/index.d.ts +9 -0
- package/dist/drive/index.d.ts.map +1 -0
- package/dist/drive/index.js +714 -0
- package/dist/drive/index.js.map +25 -0
- package/dist/drive/types.d.ts +97 -0
- package/dist/drive/types.d.ts.map +1 -0
- package/dist/drizzle/decorators/columns.d.ts +16 -0
- package/dist/drizzle/decorators/columns.d.ts.map +1 -0
- package/dist/drizzle/decorators/index.d.ts +6 -0
- package/dist/drizzle/decorators/index.d.ts.map +1 -0
- package/dist/drizzle/drivers/base.d.ts +32 -0
- package/dist/drizzle/drivers/base.d.ts.map +1 -0
- package/dist/drizzle/drivers/bun-sqlite.d.ts +6 -0
- package/dist/drizzle/drivers/bun-sqlite.d.ts.map +1 -0
- package/dist/drizzle/drivers/d1.d.ts +7 -0
- package/dist/drizzle/drivers/d1.d.ts.map +1 -0
- package/dist/drizzle/drivers/index.d.ts +14 -0
- package/dist/drizzle/drivers/index.d.ts.map +1 -0
- package/dist/drizzle/drivers/mysql.d.ts +6 -0
- package/dist/drizzle/drivers/mysql.d.ts.map +1 -0
- package/dist/drizzle/drivers/postgres.d.ts +12 -0
- package/dist/drizzle/drivers/postgres.d.ts.map +1 -0
- package/dist/drizzle/drivers/sqlite.d.ts +8 -0
- package/dist/drizzle/drivers/sqlite.d.ts.map +1 -0
- package/dist/drizzle/drizzle.module.d.ts +29 -0
- package/dist/drizzle/drizzle.module.d.ts.map +1 -0
- package/dist/drizzle/drizzle.service.d.ts +52 -0
- package/dist/drizzle/drizzle.service.d.ts.map +1 -0
- package/dist/drizzle/index.d.ts +13 -0
- package/dist/drizzle/index.d.ts.map +1 -0
- package/dist/drizzle/index.js +979 -0
- package/dist/drizzle/index.js.map +32 -0
- package/dist/drizzle/model.d.ts +26 -0
- package/dist/drizzle/model.d.ts.map +1 -0
- package/dist/drizzle/raw-query.d.ts +41 -0
- package/dist/drizzle/raw-query.d.ts.map +1 -0
- package/dist/drizzle/repository/index.d.ts +6 -0
- package/dist/drizzle/repository/index.d.ts.map +1 -0
- package/dist/drizzle/repository/repository.d.ts +60 -0
- package/dist/drizzle/repository/repository.d.ts.map +1 -0
- package/dist/drizzle/types.d.ts +160 -0
- package/dist/drizzle/types.d.ts.map +1 -0
- package/dist/events/decorators/on-event.d.ts +49 -0
- package/dist/events/decorators/on-event.d.ts.map +1 -0
- package/dist/events/emitter.d.ts +52 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/event.service.d.ts +27 -0
- package/dist/events/event.service.d.ts.map +1 -0
- package/dist/events/events.module.d.ts +35 -0
- package/dist/events/events.module.d.ts.map +1 -0
- package/dist/events/index.d.ts +43 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +646 -0
- package/dist/events/index.js.map +23 -0
- package/dist/events/types.d.ts +120 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/grpc/decorators.d.ts +34 -0
- package/dist/grpc/decorators.d.ts.map +1 -0
- package/dist/grpc/index.d.ts +70 -0
- package/dist/grpc/index.d.ts.map +1 -0
- package/dist/grpc/index.js +528 -0
- package/dist/grpc/index.js.map +22 -0
- package/dist/grpc/module.d.ts +32 -0
- package/dist/grpc/module.d.ts.map +1 -0
- package/dist/grpc/service.d.ts +60 -0
- package/dist/grpc/service.d.ts.map +1 -0
- package/dist/grpc/types.d.ts +79 -0
- package/dist/grpc/types.d.ts.map +1 -0
- package/dist/health/health.controller.d.ts +61 -0
- package/dist/health/health.controller.d.ts.map +1 -0
- package/dist/health/health.module.d.ts +29 -0
- package/dist/health/health.module.d.ts.map +1 -0
- package/dist/health/health.service.d.ts +34 -0
- package/dist/health/health.service.d.ts.map +1 -0
- package/dist/health/index.d.ts +38 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +599 -0
- package/dist/health/index.js.map +25 -0
- package/dist/health/indicators/drizzle.d.ts +18 -0
- package/dist/health/indicators/drizzle.d.ts.map +1 -0
- package/dist/health/indicators/index.d.ts +59 -0
- package/dist/health/indicators/index.d.ts.map +1 -0
- package/dist/health/types.d.ts +105 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/i18n/decorators.d.ts +14 -0
- package/dist/i18n/decorators.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +48 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +589 -0
- package/dist/i18n/index.js.map +17 -0
- package/dist/i18n/middleware.d.ts +26 -0
- package/dist/i18n/middleware.d.ts.map +1 -0
- package/dist/i18n/module.d.ts +39 -0
- package/dist/i18n/module.d.ts.map +1 -0
- package/dist/i18n/service.d.ts +130 -0
- package/dist/i18n/service.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +65 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2056 -0
- package/dist/index.js.map +53 -0
- package/dist/limiter/backends/drizzle.d.ts +40 -0
- package/dist/limiter/backends/drizzle.d.ts.map +1 -0
- package/dist/limiter/backends/index.d.ts +6 -0
- package/dist/limiter/backends/index.d.ts.map +1 -0
- package/dist/limiter/backends/memory.d.ts +28 -0
- package/dist/limiter/backends/memory.d.ts.map +1 -0
- package/dist/limiter/index.d.ts +9 -0
- package/dist/limiter/index.d.ts.map +1 -0
- package/dist/limiter/index.js +640 -0
- package/dist/limiter/index.js.map +25 -0
- package/dist/limiter/limiter.middleware.d.ts +11 -0
- package/dist/limiter/limiter.middleware.d.ts.map +1 -0
- package/dist/limiter/limiter.module.d.ts +23 -0
- package/dist/limiter/limiter.module.d.ts.map +1 -0
- package/dist/limiter/limiter.service.d.ts +18 -0
- package/dist/limiter/limiter.service.d.ts.map +1 -0
- package/dist/limiter/types.d.ts +99 -0
- package/dist/limiter/types.d.ts.map +1 -0
- package/dist/logger/index.d.ts +36 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +538 -0
- package/dist/logger/index.js.map +22 -0
- package/dist/logger/logger.module.d.ts +35 -0
- package/dist/logger/logger.module.d.ts.map +1 -0
- package/dist/logger/logger.service.d.ts +55 -0
- package/dist/logger/logger.service.d.ts.map +1 -0
- package/dist/logger/transports/index.d.ts +35 -0
- package/dist/logger/transports/index.d.ts.map +1 -0
- package/dist/logger/types.d.ts +58 -0
- package/dist/logger/types.d.ts.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 +479 -0
- package/dist/mail/index.js.map +25 -0
- package/dist/mail/mail.module.d.ts +21 -0
- package/dist/mail/mail.module.d.ts.map +1 -0
- package/dist/mail/mail.service.d.ts +18 -0
- package/dist/mail/mail.service.d.ts.map +1 -0
- package/dist/mail/transports/file.d.ts +19 -0
- package/dist/mail/transports/file.d.ts.map +1 -0
- package/dist/mail/transports/index.d.ts +9 -0
- package/dist/mail/transports/index.d.ts.map +1 -0
- package/dist/mail/transports/null.d.ts +11 -0
- package/dist/mail/transports/null.d.ts.map +1 -0
- package/dist/mail/transports/smtp.d.ts +40 -0
- package/dist/mail/transports/smtp.d.ts.map +1 -0
- package/dist/mail/types.d.ts +73 -0
- package/dist/mail/types.d.ts.map +1 -0
- package/dist/metrics/controller.d.ts +27 -0
- package/dist/metrics/controller.d.ts.map +1 -0
- package/dist/metrics/counter.d.ts +36 -0
- package/dist/metrics/counter.d.ts.map +1 -0
- package/dist/metrics/decorators/counted.d.ts +26 -0
- package/dist/metrics/decorators/counted.d.ts.map +1 -0
- package/dist/metrics/decorators/index.d.ts +3 -0
- package/dist/metrics/decorators/index.d.ts.map +1 -0
- package/dist/metrics/decorators/timed.d.ts +25 -0
- package/dist/metrics/decorators/timed.d.ts.map +1 -0
- package/dist/metrics/gauge.d.ts +38 -0
- package/dist/metrics/gauge.d.ts.map +1 -0
- package/dist/metrics/histogram.d.ts +52 -0
- package/dist/metrics/histogram.d.ts.map +1 -0
- package/dist/metrics/index.d.ts +35 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +1033 -0
- package/dist/metrics/index.js.map +21 -0
- package/dist/metrics/module.d.ts +33 -0
- package/dist/metrics/module.d.ts.map +1 -0
- package/dist/metrics/registry.d.ts +52 -0
- package/dist/metrics/registry.d.ts.map +1 -0
- package/dist/metrics/service.d.ts +42 -0
- package/dist/metrics/service.d.ts.map +1 -0
- package/dist/metrics/summary.d.ts +50 -0
- package/dist/metrics/summary.d.ts.map +1 -0
- package/dist/metrics/types.d.ts +115 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/openapi/decorators/body.d.ts +9 -0
- package/dist/openapi/decorators/body.d.ts.map +1 -0
- package/dist/openapi/decorators/index.d.ts +11 -0
- package/dist/openapi/decorators/index.d.ts.map +1 -0
- package/dist/openapi/decorators/operation.d.ts +9 -0
- package/dist/openapi/decorators/operation.d.ts.map +1 -0
- package/dist/openapi/decorators/param.d.ts +17 -0
- package/dist/openapi/decorators/param.d.ts.map +1 -0
- package/dist/openapi/decorators/property.d.ts +24 -0
- package/dist/openapi/decorators/property.d.ts.map +1 -0
- package/dist/openapi/decorators/response.d.ts +10 -0
- package/dist/openapi/decorators/response.d.ts.map +1 -0
- package/dist/openapi/decorators/security.d.ts +9 -0
- package/dist/openapi/decorators/security.d.ts.map +1 -0
- package/dist/openapi/decorators/tags.d.ts +2 -0
- package/dist/openapi/decorators/tags.d.ts.map +1 -0
- package/dist/openapi/index.d.ts +10 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/index.js +974 -0
- package/dist/openapi/index.js.map +31 -0
- package/dist/openapi/openapi.module.d.ts +46 -0
- package/dist/openapi/openapi.module.d.ts.map +1 -0
- package/dist/openapi/openapi.service.d.ts +55 -0
- package/dist/openapi/openapi.service.d.ts.map +1 -0
- package/dist/openapi/scalar.d.ts +16 -0
- package/dist/openapi/scalar.d.ts.map +1 -0
- package/dist/openapi/types.d.ts +266 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/openapi/zod-to-json-schema.d.ts +34 -0
- package/dist/openapi/zod-to-json-schema.d.ts.map +1 -0
- package/dist/package.json +59 -0
- package/dist/queue/backends/bullmq.d.ts +41 -0
- package/dist/queue/backends/bullmq.d.ts.map +1 -0
- package/dist/queue/backends/cloudflare.d.ts +84 -0
- package/dist/queue/backends/cloudflare.d.ts.map +1 -0
- package/dist/queue/backends/index.d.ts +7 -0
- package/dist/queue/backends/index.d.ts.map +1 -0
- package/dist/queue/backends/memory.d.ts +24 -0
- package/dist/queue/backends/memory.d.ts.map +1 -0
- package/dist/queue/decorators/on-queue-ready.d.ts +43 -0
- package/dist/queue/decorators/on-queue-ready.d.ts.map +1 -0
- package/dist/queue/index.d.ts +57 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +961 -0
- package/dist/queue/index.js.map +25 -0
- package/dist/queue/queue.module.d.ts +46 -0
- package/dist/queue/queue.module.d.ts.map +1 -0
- package/dist/queue/queue.service.d.ts +61 -0
- package/dist/queue/queue.service.d.ts.map +1 -0
- package/dist/queue/types.d.ts +204 -0
- package/dist/queue/types.d.ts.map +1 -0
- package/dist/redis/adapters/bun.d.ts +27 -0
- package/dist/redis/adapters/bun.d.ts.map +1 -0
- package/dist/redis/adapters/cloudflare.d.ts +51 -0
- package/dist/redis/adapters/cloudflare.d.ts.map +1 -0
- package/dist/redis/adapters/index.d.ts +29 -0
- package/dist/redis/adapters/index.d.ts.map +1 -0
- package/dist/redis/adapters/memory.d.ts +28 -0
- package/dist/redis/adapters/memory.d.ts.map +1 -0
- package/dist/redis/adapters/node.d.ts +36 -0
- package/dist/redis/adapters/node.d.ts.map +1 -0
- package/dist/redis/index.d.ts +33 -0
- package/dist/redis/index.d.ts.map +1 -0
- package/dist/redis/index.js +667 -0
- package/dist/redis/index.js.map +25 -0
- package/dist/redis/module.d.ts +32 -0
- package/dist/redis/module.d.ts.map +1 -0
- package/dist/redis/types.d.ts +146 -0
- package/dist/redis/types.d.ts.map +1 -0
- package/dist/schedule/backends/cloudflare.d.ts +55 -0
- package/dist/schedule/backends/cloudflare.d.ts.map +1 -0
- package/dist/schedule/backends/index.d.ts +3 -0
- package/dist/schedule/backends/index.d.ts.map +1 -0
- package/dist/schedule/backends/memory.d.ts +39 -0
- package/dist/schedule/backends/memory.d.ts.map +1 -0
- package/dist/schedule/cron-parser.d.ts +48 -0
- package/dist/schedule/cron-parser.d.ts.map +1 -0
- package/dist/schedule/decorators/cron.d.ts +71 -0
- package/dist/schedule/decorators/cron.d.ts.map +1 -0
- package/dist/schedule/index.d.ts +51 -0
- package/dist/schedule/index.d.ts.map +1 -0
- package/dist/schedule/index.js +1108 -0
- package/dist/schedule/index.js.map +25 -0
- package/dist/schedule/schedule.module.d.ts +44 -0
- package/dist/schedule/schedule.module.d.ts.map +1 -0
- package/dist/schedule/schedule.service.d.ts +51 -0
- package/dist/schedule/schedule.service.d.ts.map +1 -0
- package/dist/schedule/types.d.ts +150 -0
- package/dist/schedule/types.d.ts.map +1 -0
- package/dist/session/backends/cookie.d.ts +56 -0
- package/dist/session/backends/cookie.d.ts.map +1 -0
- package/dist/session/backends/drizzle.d.ts +65 -0
- package/dist/session/backends/drizzle.d.ts.map +1 -0
- package/dist/session/backends/index.d.ts +6 -0
- package/dist/session/backends/index.d.ts.map +1 -0
- package/dist/session/backends/memory.d.ts +32 -0
- package/dist/session/backends/memory.d.ts.map +1 -0
- package/dist/session/backends/redis.d.ts +53 -0
- package/dist/session/backends/redis.d.ts.map +1 -0
- package/dist/session/decorators/current-session.d.ts +56 -0
- package/dist/session/decorators/current-session.d.ts.map +1 -0
- package/dist/session/index.d.ts +42 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +1498 -0
- package/dist/session/index.js.map +28 -0
- package/dist/session/session-middleware.d.ts +29 -0
- package/dist/session/session-middleware.d.ts.map +1 -0
- package/dist/session/session.module.d.ts +35 -0
- package/dist/session/session.module.d.ts.map +1 -0
- package/dist/session/session.service.d.ts +49 -0
- package/dist/session/session.service.d.ts.map +1 -0
- package/dist/session/types.d.ts +201 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/shield/guards/csrf.d.ts +33 -0
- package/dist/shield/guards/csrf.d.ts.map +1 -0
- package/dist/shield/guards/headers.d.ts +22 -0
- package/dist/shield/guards/headers.d.ts.map +1 -0
- package/dist/shield/guards/index.d.ts +6 -0
- package/dist/shield/guards/index.d.ts.map +1 -0
- package/dist/shield/index.d.ts +8 -0
- package/dist/shield/index.d.ts.map +1 -0
- package/dist/shield/index.js +728 -0
- package/dist/shield/index.js.map +25 -0
- package/dist/shield/shield.module.d.ts +25 -0
- package/dist/shield/shield.module.d.ts.map +1 -0
- package/dist/shield/shield.service.d.ts +21 -0
- package/dist/shield/shield.service.d.ts.map +1 -0
- package/dist/shield/types.d.ts +95 -0
- package/dist/shield/types.d.ts.map +1 -0
- package/dist/sse/index.d.ts +7 -0
- package/dist/sse/index.d.ts.map +1 -0
- package/dist/sse/index.js +214 -0
- package/dist/sse/index.js.map +13 -0
- package/dist/sse/sse-stream.d.ts +46 -0
- package/dist/sse/sse-stream.d.ts.map +1 -0
- package/dist/sse/sse.d.ts +24 -0
- package/dist/sse/sse.d.ts.map +1 -0
- package/dist/sse/types.d.ts +84 -0
- package/dist/sse/types.d.ts.map +1 -0
- package/dist/static/index.d.ts +41 -0
- package/dist/static/index.d.ts.map +1 -0
- package/dist/static/index.js +313 -0
- package/dist/static/index.js.map +13 -0
- package/dist/static/static.module.d.ts +41 -0
- package/dist/static/static.module.d.ts.map +1 -0
- package/dist/static/static.service.d.ts +38 -0
- package/dist/static/static.service.d.ts.map +1 -0
- package/dist/tracing/decorators/index.d.ts +2 -0
- package/dist/tracing/decorators/index.d.ts.map +1 -0
- package/dist/tracing/decorators/trace.d.ts +37 -0
- package/dist/tracing/decorators/trace.d.ts.map +1 -0
- package/dist/tracing/hono-instrumentation.d.ts +21 -0
- package/dist/tracing/hono-instrumentation.d.ts.map +1 -0
- package/dist/tracing/index.d.ts +29 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +782 -0
- package/dist/tracing/index.js.map +24 -0
- package/dist/tracing/module.d.ts +45 -0
- package/dist/tracing/module.d.ts.map +1 -0
- package/dist/tracing/propagation.d.ts +53 -0
- package/dist/tracing/propagation.d.ts.map +1 -0
- package/dist/tracing/service.d.ts +95 -0
- package/dist/tracing/service.d.ts.map +1 -0
- package/dist/tracing/types.d.ts +90 -0
- package/dist/tracing/types.d.ts.map +1 -0
- package/dist/upload/decorators/index.d.ts +6 -0
- package/dist/upload/decorators/index.d.ts.map +1 -0
- package/dist/upload/decorators/upload.d.ts +16 -0
- package/dist/upload/decorators/upload.d.ts.map +1 -0
- package/dist/upload/decorators/uploaded-file.d.ts +10 -0
- package/dist/upload/decorators/uploaded-file.d.ts.map +1 -0
- package/dist/upload/index.d.ts +9 -0
- package/dist/upload/index.d.ts.map +1 -0
- package/dist/upload/index.js +553 -0
- package/dist/upload/index.js.map +25 -0
- package/dist/upload/types.d.ts +103 -0
- package/dist/upload/types.d.ts.map +1 -0
- package/dist/upload/upload.middleware.d.ts +15 -0
- package/dist/upload/upload.middleware.d.ts.map +1 -0
- package/dist/upload/upload.module.d.ts +33 -0
- package/dist/upload/upload.module.d.ts.map +1 -0
- package/dist/upload/upload.service.d.ts +29 -0
- package/dist/upload/upload.service.d.ts.map +1 -0
- package/dist/view/edge.d.ts +23 -0
- package/dist/view/edge.d.ts.map +1 -0
- package/dist/view/eta.d.ts +30 -0
- package/dist/view/eta.d.ts.map +1 -0
- package/dist/view/index.d.ts +34 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +240 -0
- package/dist/view/index.js.map +14 -0
- package/dist/view/inertia/default-ssr.d.ts +15 -0
- package/dist/view/inertia/default-ssr.d.ts.map +1 -0
- package/dist/view/inertia/form-helper.d.ts +102 -0
- package/dist/view/inertia/form-helper.d.ts.map +1 -0
- package/dist/view/inertia/form-middleware.d.ts +53 -0
- package/dist/view/inertia/form-middleware.d.ts.map +1 -0
- package/dist/view/inertia/helpers.d.ts +149 -0
- package/dist/view/inertia/helpers.d.ts.map +1 -0
- package/dist/view/inertia/index.d.ts +18 -0
- package/dist/view/inertia/index.d.ts.map +1 -0
- package/dist/view/inertia/inertia-adapter.d.ts +93 -0
- package/dist/view/inertia/inertia-adapter.d.ts.map +1 -0
- package/dist/view/inertia/inertia-response.d.ts +51 -0
- package/dist/view/inertia/inertia-response.d.ts.map +1 -0
- package/dist/view/inertia/ssr/index.d.ts +13 -0
- package/dist/view/inertia/ssr/index.d.ts.map +1 -0
- package/dist/view/inertia/ssr/react-adapter.d.ts +33 -0
- package/dist/view/inertia/ssr/react-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/registry.d.ts +42 -0
- package/dist/view/inertia/ssr/registry.d.ts.map +1 -0
- package/dist/view/inertia/ssr/solid-adapter.d.ts +31 -0
- package/dist/view/inertia/ssr/solid-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/svelte-adapter.d.ts +31 -0
- package/dist/view/inertia/ssr/svelte-adapter.d.ts.map +1 -0
- package/dist/view/inertia/ssr/vue-adapter.d.ts +26 -0
- package/dist/view/inertia/ssr/vue-adapter.d.ts.map +1 -0
- package/dist/view/inertia/types.d.ts +131 -0
- package/dist/view/inertia/types.d.ts.map +1 -0
- package/dist/view/rendu.d.ts +11 -0
- package/dist/view/rendu.d.ts.map +1 -0
- package/dist/view/types.d.ts +52 -0
- package/dist/view/types.d.ts.map +1 -0
- package/dist/view/view-engine.d.ts +28 -0
- package/dist/view/view-engine.d.ts.map +1 -0
- package/dist/ws/client.d.ts +42 -0
- package/dist/ws/client.d.ts.map +1 -0
- package/dist/ws/decorators.d.ts +44 -0
- package/dist/ws/decorators.d.ts.map +1 -0
- package/dist/ws/index.d.ts +57 -0
- package/dist/ws/index.d.ts.map +1 -0
- package/dist/ws/index.js +796 -0
- package/dist/ws/index.js.map +26 -0
- package/dist/ws/module.d.ts +48 -0
- package/dist/ws/module.d.ts.map +1 -0
- package/dist/ws/runtime/bun.d.ts +41 -0
- package/dist/ws/runtime/bun.d.ts.map +1 -0
- package/dist/ws/runtime/index.d.ts +14 -0
- package/dist/ws/runtime/index.d.ts.map +1 -0
- package/dist/ws/runtime/node.d.ts +46 -0
- package/dist/ws/runtime/node.d.ts.map +1 -0
- package/dist/ws/runtime/types.d.ts +18 -0
- package/dist/ws/runtime/types.d.ts.map +1 -0
- package/dist/ws/service.d.ts +65 -0
- package/dist/ws/service.d.ts.map +1 -0
- package/dist/ws/types.d.ts +77 -0
- package/dist/ws/types.d.ts.map +1 -0
- package/package.json +262 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toCommonJS = (from) => {
|
|
10
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
|
+
if (entry)
|
|
12
|
+
return entry;
|
|
13
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (var key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(entry, key))
|
|
17
|
+
__defProp(entry, key, {
|
|
18
|
+
get: __accessProp.bind(from, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
__moduleCache.set(from, entry);
|
|
23
|
+
return entry;
|
|
24
|
+
};
|
|
25
|
+
var __moduleCache;
|
|
26
|
+
var __returnValue = (v) => v;
|
|
27
|
+
function __exportSetter(name, newValue) {
|
|
28
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
29
|
+
}
|
|
30
|
+
var __export = (target, all) => {
|
|
31
|
+
for (var name in all)
|
|
32
|
+
__defProp(target, name, {
|
|
33
|
+
get: all[name],
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
set: __exportSetter.bind(all, name)
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
40
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
41
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
42
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
43
|
+
else
|
|
44
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
45
|
+
if (d = decorators[i])
|
|
46
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
47
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
48
|
+
};
|
|
49
|
+
var __legacyDecorateParamTS = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
50
|
+
var __legacyMetadataTS = (k, v) => {
|
|
51
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
52
|
+
return Reflect.metadata(k, v);
|
|
53
|
+
};
|
|
54
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
55
|
+
var __require = import.meta.require;
|
|
56
|
+
|
|
57
|
+
// src/view/rendu.ts
|
|
58
|
+
import { compileTemplate } from "rendu";
|
|
59
|
+
|
|
60
|
+
class RenduAdapter {
|
|
61
|
+
name = "rendu";
|
|
62
|
+
cache = new Map;
|
|
63
|
+
render(template, data, context, options) {
|
|
64
|
+
const safe = {};
|
|
65
|
+
for (const [k, v] of Object.entries(data)) {
|
|
66
|
+
safe[k] = typeof v === "string" ? v : v == null ? "" : String(v);
|
|
67
|
+
}
|
|
68
|
+
const merged = this.mergeData(safe, context, options);
|
|
69
|
+
return this.getCompiled(template, options)(merged);
|
|
70
|
+
}
|
|
71
|
+
compile(template, options) {
|
|
72
|
+
const compiled = this.getCompiled(template, options);
|
|
73
|
+
return (data) => compiled(data);
|
|
74
|
+
}
|
|
75
|
+
getCompiled(template, options) {
|
|
76
|
+
const cacheKey = options ? `${options.stream ? "s" : ""}` : "";
|
|
77
|
+
let compiled = this.cache.get(cacheKey);
|
|
78
|
+
if (!compiled) {
|
|
79
|
+
compiled = compileTemplate(template, {
|
|
80
|
+
stream: options?.stream ?? false
|
|
81
|
+
});
|
|
82
|
+
this.cache.set(cacheKey, compiled);
|
|
83
|
+
}
|
|
84
|
+
return compiled;
|
|
85
|
+
}
|
|
86
|
+
mergeData(data, context, options) {
|
|
87
|
+
const merged = { ...data };
|
|
88
|
+
if (context) {
|
|
89
|
+
if (context.request)
|
|
90
|
+
merged.$REQUEST = context.request;
|
|
91
|
+
if (context.response)
|
|
92
|
+
merged.$RESPONSE = context.response;
|
|
93
|
+
if (context.globals)
|
|
94
|
+
Object.assign(merged, context.globals);
|
|
95
|
+
}
|
|
96
|
+
if (options?.layout)
|
|
97
|
+
merged.$LAYOUT = options.layout;
|
|
98
|
+
return merged;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var init_rendu = () => {};
|
|
102
|
+
|
|
103
|
+
// src/view/edge.ts
|
|
104
|
+
class EdgeAdapter {
|
|
105
|
+
edge;
|
|
106
|
+
name = "edge";
|
|
107
|
+
constructor(edge) {
|
|
108
|
+
this.edge = edge;
|
|
109
|
+
}
|
|
110
|
+
async render(template, data, context, options) {
|
|
111
|
+
if (!this.edge) {
|
|
112
|
+
throw new Error("EdgeAdapter requires an Edge instance. " + "Install `edge.js` and pass it to `new EdgeAdapter(edge)`, " + "or use the default RenduAdapter instead.");
|
|
113
|
+
}
|
|
114
|
+
const fn = this.edge.renderRaw ?? this.edge.renderString;
|
|
115
|
+
if (!fn) {
|
|
116
|
+
throw new Error("Provided Edge instance does not implement renderRaw/renderString.");
|
|
117
|
+
}
|
|
118
|
+
return fn.call(this.edge, template, { ...data, $OPTIONS: options });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/view/eta.ts
|
|
123
|
+
class EtaAdapter {
|
|
124
|
+
name = "eta";
|
|
125
|
+
cache = new Map;
|
|
126
|
+
async render(template, data, _context, _options) {
|
|
127
|
+
const compiled = this.getCompiled(template);
|
|
128
|
+
return compiled(data);
|
|
129
|
+
}
|
|
130
|
+
compile(template, _options) {
|
|
131
|
+
const compiled = this.getCompiled(template);
|
|
132
|
+
return (data) => Promise.resolve(compiled(data));
|
|
133
|
+
}
|
|
134
|
+
getCompiled(template) {
|
|
135
|
+
let fn = this.cache.get(template);
|
|
136
|
+
if (!fn) {
|
|
137
|
+
let Eta;
|
|
138
|
+
try {
|
|
139
|
+
Eta = __require("eta").Eta;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
throw new Error(`[nexus] EtaAdapter: the "eta" package is not installed. ` + `Run \`bun add eta\` (or \`npm install eta\`) to use .eta templates.`);
|
|
142
|
+
}
|
|
143
|
+
const eta = new Eta;
|
|
144
|
+
fn = (data) => eta.renderString(template, data);
|
|
145
|
+
this.cache.set(template, fn);
|
|
146
|
+
}
|
|
147
|
+
return fn;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/view/view-engine.ts
|
|
152
|
+
var exports_view_engine = {};
|
|
153
|
+
__export(exports_view_engine, {
|
|
154
|
+
setViewPaths: () => setViewPaths,
|
|
155
|
+
renderView: () => renderView,
|
|
156
|
+
loadTemplate: () => loadTemplate,
|
|
157
|
+
getViewPaths: () => getViewPaths
|
|
158
|
+
});
|
|
159
|
+
function setViewPaths(path) {
|
|
160
|
+
viewPath = path ? path.endsWith("/") || path.endsWith("\\") ? path : `${path}/` : "";
|
|
161
|
+
}
|
|
162
|
+
function getViewPaths() {
|
|
163
|
+
return viewPath;
|
|
164
|
+
}
|
|
165
|
+
function isViewFilePath(name) {
|
|
166
|
+
const lower = name.toLowerCase();
|
|
167
|
+
return VIEW_FILE_EXTS.some((ext) => lower.endsWith(ext));
|
|
168
|
+
}
|
|
169
|
+
function selectAdapter(template) {
|
|
170
|
+
const lower = template.toLowerCase();
|
|
171
|
+
if (lower.endsWith(".edge"))
|
|
172
|
+
return new EdgeAdapter;
|
|
173
|
+
if (lower.endsWith(".eta"))
|
|
174
|
+
return new EtaAdapter;
|
|
175
|
+
return new RenduAdapter;
|
|
176
|
+
}
|
|
177
|
+
async function renderView(template, data, context) {
|
|
178
|
+
let source = template;
|
|
179
|
+
if (isViewFilePath(template) && viewPath.length > 0) {
|
|
180
|
+
const loaded = await loadTemplate(viewPath, template);
|
|
181
|
+
if (loaded === null) {
|
|
182
|
+
throw new Error(`[nexus] View file not found: "${template}" (searched: ${viewPath})`);
|
|
183
|
+
}
|
|
184
|
+
source = loaded;
|
|
185
|
+
}
|
|
186
|
+
const adapter = selectAdapter(source);
|
|
187
|
+
return adapter.render(source, data, context);
|
|
188
|
+
}
|
|
189
|
+
async function loadTemplate(dir, name) {
|
|
190
|
+
if (!dir)
|
|
191
|
+
return null;
|
|
192
|
+
const full = joinPath(dir, name);
|
|
193
|
+
try {
|
|
194
|
+
const file = await readFile(full);
|
|
195
|
+
if (file !== null)
|
|
196
|
+
return file;
|
|
197
|
+
} catch {}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
function joinPath(dir, name) {
|
|
201
|
+
if (!dir.endsWith("/") && !dir.endsWith("\\"))
|
|
202
|
+
return `${dir}/${name}`;
|
|
203
|
+
return `${dir}${name}`;
|
|
204
|
+
}
|
|
205
|
+
async function readFile(path) {
|
|
206
|
+
if (typeof globalThis.Bun !== "undefined") {
|
|
207
|
+
try {
|
|
208
|
+
const file = globalThis.Bun.file(path);
|
|
209
|
+
if (await file.exists())
|
|
210
|
+
return file.text();
|
|
211
|
+
} catch {}
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const fs = await import("fs/promises");
|
|
215
|
+
return await fs.readFile(path, "utf8");
|
|
216
|
+
} catch {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
var viewPath = "", VIEW_FILE_EXTS;
|
|
221
|
+
var init_view_engine = __esm(() => {
|
|
222
|
+
init_rendu();
|
|
223
|
+
VIEW_FILE_EXTS = [".html", ".edge", ".rendu", ".eta"];
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// src/view/index.ts
|
|
227
|
+
init_rendu();
|
|
228
|
+
init_view_engine();
|
|
229
|
+
export {
|
|
230
|
+
setViewPaths,
|
|
231
|
+
renderView,
|
|
232
|
+
loadTemplate,
|
|
233
|
+
getViewPaths,
|
|
234
|
+
RenduAdapter,
|
|
235
|
+
EtaAdapter,
|
|
236
|
+
EdgeAdapter
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
//# debugId=8CC13EEB69A7C3E164756E2164756E21
|
|
240
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/view/rendu.ts", "../src/view/edge.ts", "../src/view/eta.ts", "../src/view/view-engine.ts", "../src/view/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Rendu template engine adapter.\n *\n * Rendu is a PHP-style templating library that compiles templates into\n * render functions, which makes it fast and edge-friendly (no eval, no\n * file-system access at render time). It is the default adapter because\n * it works on every runtime the framework supports.\n *\n * See: https://github.com/h3js/rendu\n */\nimport { compileTemplate } from \"rendu\";\nimport type { ViewAdapter, ViewContext, ViewOptions } from \"./types.js\";\n\nexport class RenduAdapter implements ViewAdapter {\n\treadonly name = \"rendu\";\n\tprivate cache = new Map<string, ReturnType<typeof compileTemplate>>();\n\n\trender(\n\t\ttemplate: string,\n\t\tdata: Record<string, any>,\n\t\tcontext?: ViewContext,\n\t\toptions?: ViewOptions,\n\t): Promise<string> {\n\t\t// Workaround for a Rendu 0.1.0 bug: its generated runtime\n\t\t// does `typeof chunk === \"string\" ? chunk : new TextDecoder()\n\t\t// .decode(chunk)`, so any non-string chunk (a number from\n\t\t// `<?= year ?>`, a boolean, etc.) throws. We shallow-coerce\n\t\t// top-level values to strings here. The framework's contract\n\t\t// is that view templates render output — arithmetic in\n\t\t// templates is rare and users who need it can wrap with\n\t\t// `Number(...)` explicitly.\n\t\tconst safe: Record<string, any> = {};\n\t\tfor (const [k, v] of Object.entries(data)) {\n\t\t\tsafe[k] = typeof v === \"string\" ? v : v == null ? \"\" : String(v);\n\t\t}\n\t\tconst merged = this.mergeData(safe, context, options);\n\t\treturn this.getCompiled(template, options)(merged);\n\t}\n\n\tcompile(template: string, options?: ViewOptions) {\n\t\tconst compiled = this.getCompiled(template, options);\n\t\treturn (data: Record<string, any>) => compiled(data);\n\t}\n\n\tprivate getCompiled(template: string, options?: ViewOptions) {\n\t\tconst cacheKey = options ? `${options.stream ? \"s\" : \"\"}` : \"\";\n\t\tlet compiled = this.cache.get(cacheKey);\n\t\tif (!compiled) {\n\t\t\tcompiled = compileTemplate(template, {\n\t\t\t\tstream: options?.stream ?? false,\n\t\t\t});\n\t\t\tthis.cache.set(cacheKey, compiled);\n\t\t}\n\t\treturn compiled;\n\t}\n\n\t/** Merge user data with view context globals. */\n\tprivate mergeData(\n\t\tdata: Record<string, any>,\n\t\tcontext?: ViewContext,\n\t\toptions?: ViewOptions,\n\t): Record<string, any> {\n\t\tconst merged: Record<string, any> = { ...data };\n\t\tif (context) {\n\t\t\tif (context.request) merged.$REQUEST = context.request;\n\t\t\tif (context.response) merged.$RESPONSE = context.response;\n\t\t\tif (context.globals) Object.assign(merged, context.globals);\n\t\t}\n\t\tif (options?.layout) merged.$LAYOUT = options.layout;\n\t\treturn merged;\n\t}\n}\n",
|
|
6
|
+
"/**\n * Edge-style template engine adapter (Adonis-style).\n *\n * Edge is the templating engine built for AdonisJS with a mustache-like\n * syntax (`{{ }}`, `@if`, `@each`). It is bundled here as a placeholder\n * for users who prefer that style.\n *\n * The adapter does not bundle Edge directly — it expects the user to\n * provide an `Edge` instance via the constructor so the dependency\n * stays optional.\n */\nimport type { ViewAdapter, ViewContext, ViewOptions } from \"./types.js\";\n\nexport interface EdgeLike {\n\trenderRaw?: (template: string, data: Record<string, any>) => Promise<string>;\n\trenderString?: (\n\t\ttemplate: string,\n\t\tdata: Record<string, any>,\n\t) => Promise<string>;\n}\n\nexport class EdgeAdapter implements ViewAdapter {\n\treadonly name = \"edge\";\n\tconstructor(private edge?: EdgeLike) {}\n\n\tasync render(\n\t\ttemplate: string,\n\t\tdata: Record<string, any>,\n\t\tcontext?: ViewContext,\n\t\toptions?: ViewOptions,\n\t): Promise<string> {\n\t\tif (!this.edge) {\n\t\t\tthrow new Error(\n\t\t\t\t\"EdgeAdapter requires an Edge instance. \" +\n\t\t\t\t\t\"Install `edge.js` and pass it to `new EdgeAdapter(edge)`, \" +\n\t\t\t\t\t\"or use the default RenduAdapter instead.\",\n\t\t\t);\n\t\t}\n\t\tconst fn = this.edge.renderRaw ?? this.edge.renderString;\n\t\tif (!fn) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Provided Edge instance does not implement renderRaw/renderString.\",\n\t\t\t);\n\t\t}\n\t\treturn fn.call(this.edge, template, { ...data, $OPTIONS: options });\n\t}\n}\n",
|
|
7
|
+
"/**\n * Eta template engine adapter.\n *\n * Eta is a lightweight, high-performance templating engine with\n * EJS-like syntax (`<%= expr %>`, `<% code %>`). It works on every\n * runtime (Bun, Node, Deno, Cloudflare Workers) because templates\n * are compiled to JavaScript render functions — no eval, no\n * filesystem access at render time.\n *\n * Install (optional peer dep): `bun add eta`\n *\n * import { EtaAdapter } from \"nexusjs/view\";\n * const eta = new EtaAdapter();\n * const html = await eta.render(\"<h1><%= it.title %></h1>\", { title: \"Hi\" });\n *\n * Or just use a file with a `.eta` extension — `renderView` picks\n * the Eta adapter automatically:\n *\n * setViewPaths(\"views\");\n * return { view: \"about.eta\", data: { title: \"Hi\" } };\n */\nimport type { ViewAdapter, ViewContext, ViewOptions } from \"./types.js\";\n\nexport class EtaAdapter implements ViewAdapter {\n\treadonly name = \"eta\";\n\tprivate cache = new Map<string, (data: Record<string, any>) => string>();\n\n\tasync render(\n\t\ttemplate: string,\n\t\tdata: Record<string, any>,\n\t\t_context?: ViewContext,\n\t\t_options?: ViewOptions,\n\t): Promise<string> {\n\t\tconst compiled = this.getCompiled(template);\n\t\treturn compiled(data);\n\t}\n\n\tcompile(template: string, _options?: ViewOptions) {\n\t\tconst compiled = this.getCompiled(template);\n\t\treturn (data: Record<string, any>) => Promise.resolve(compiled(data));\n\t}\n\n\tprivate getCompiled(template: string) {\n\t\tlet fn = this.cache.get(template);\n\t\tif (!fn) {\n\t\t\t// Lazy require so `eta` is truly optional. If the\n\t\t\t// user never uses `.eta` files, Eta isn't loaded.\n\t\t\tlet Eta: any;\n\t\t\ttry {\n\t\t\t\t// @ts-ignore — eta is an optional peer dep\n\t\t\t\tEta = require(\"eta\").Eta;\n\t\t\t} catch (e) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[nexus] EtaAdapter: the \"eta\" package is not installed. ` +\n\t\t\t\t\t\t`Run \\`bun add eta\\` (or \\`npm install eta\\`) to use .eta templates.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst eta = new Eta();\n\t\t\tfn = (data: Record<string, any>) =>\n\t\t\t\teta.renderString(template, data) as string;\n\t\t\tthis.cache.set(template, fn);\n\t\t}\n\t\treturn fn;\n\t}\n}\n",
|
|
8
|
+
"/**\n * View engine abstraction.\n *\n * The framework can render templates using any installed engine. Built-in\n * adapters ship for Rendu (PHP-style templates), Edge (Adonis-style),\n * and Eta (EJS-style).\n *\n * The default adapter is Rendu because it works on every runtime —\n * Cloudflare Workers, Bun, Deno, and Node — without extra dependencies.\n */\nimport { RenduAdapter } from \"./rendu.js\";\nimport { EdgeAdapter } from \"./edge.js\";\nimport { EtaAdapter } from \"./eta.js\";\nimport type { ViewAdapter, ViewContext } from \"./types.js\";\n\nexport type { ViewAdapter, ViewContext, ViewOptions } from \"./types.js\";\n\n/**\n * A single directory to search when the `view` value looks like a file path\n * (e.g. `\"about.html\"` or `\"emails/welcome.html\"`). Configured via\n * `setViewPaths()` or `Application.setViewPaths()`. Empty by default\n * — leave it empty (the default) to require inline templates,\n * or set it once at boot to enable file-based views.\n */\nlet viewPath: string = \"\";\n\n/** Set the directory searched for view files. Pass `\"\"` to disable. */\nexport function setViewPaths(path: string): void {\n\tviewPath = path ? (path.endsWith(\"/\") || path.endsWith(\"\\\\\") ? path : `${path}/`) : \"\";\n}\n\n/** Return the current view path (empty string means disabled). */\nexport function getViewPaths(): string {\n\treturn viewPath;\n}\n\n/** File extensions that indicate the `view` value is a file path. */\nconst VIEW_FILE_EXTS = [\".html\", \".edge\", \".rendu\", \".eta\"] as const;\n\n/**\n * Is the given string a file path (i.e. has one of the known view\n * file extensions)? Used to decide whether `renderView` should\n * load the file from disk or treat the string as inline source.\n */\nfunction isViewFilePath(name: string): boolean {\n\tconst lower = name.toLowerCase();\n\treturn VIEW_FILE_EXTS.some((ext) => lower.endsWith(ext));\n}\n\n/**\n * Pick the right adapter for a given template source. Selection\n * is by file extension:\n * `.edge` → EdgeAdapter\n * `.eta` → EtaAdapter\n * `.html` / `.rendu` / no extension → RenduAdapter (default)\n */\nfunction selectAdapter(template: string): ViewAdapter {\n\tconst lower = template.toLowerCase();\n\tif (lower.endsWith(\".edge\")) return new EdgeAdapter();\n\tif (lower.endsWith(\".eta\")) return new EtaAdapter();\n\treturn new RenduAdapter();\n}\n\n/**\n * Render a view.\n *\n * - If `template` ends in a known view file extension (`.html`,\n * `.edge`, `.rendu`, `.eta`) and `viewPaths` is non-empty, the\n * file is loaded from the first matching directory and used\n * as the template source. The adapter is picked by extension.\n * - Otherwise `template` is treated as inline template source\n * with the default (Rendu) adapter.\n *\n * Override the default adapter globally with\n * `app.setViewAdapter()`.\n */\nexport async function renderView(\n\ttemplate: string,\n\tdata: Record<string, any>,\n\tcontext?: ViewContext,\n): Promise<string> {\n\tlet source = template;\n\tif (isViewFilePath(template) && viewPath.length > 0) {\n\t\tconst loaded = await loadTemplate(viewPath, template);\n\t\tif (loaded === null) {\n\t\t\tthrow new Error(\n\t\t\t\t`[nexus] View file not found: \"${template}\" (searched: ${viewPath})`,\n\t\t\t);\n\t\t}\n\t\tsource = loaded;\n\t}\n\tconst adapter = selectAdapter(source);\n\treturn adapter.render(source, data, context);\n}\n\n/**\n * Try to locate a template file inside the given directory. Returns the\n * file contents or `null` if not found. This is intentionally\n * filesystem-based and only used on serverful runtimes; edge adapters\n * should pass inline strings instead.\n */\nexport async function loadTemplate(\n\tdir: string,\n\tname: string,\n): Promise<string | null> {\n\tif (!dir) return null;\n\tconst full = joinPath(dir, name);\n\ttry {\n\t\tconst file = await readFile(full);\n\t\tif (file !== null) return file;\n\t} catch {\n\t\t// ignore\n\t}\n\treturn null;\n}\n\n/**\n * Path join that works on both POSIX and Windows. Node/Bun provide path,\n * but Cloudflare Workers do not, so we re-implement minimally.\n */\nfunction joinPath(dir: string, name: string): string {\n\tif (!dir.endsWith(\"/\") && !dir.endsWith(\"\\\\\")) return `${dir}/${name}`;\n\treturn `${dir}${name}`;\n}\n\nasync function readFile(path: string): Promise<string | null> {\n\t// Node/Bun.\n\tif (typeof globalThis.Bun !== \"undefined\") {\n\t\ttry {\n\t\t\tconst file = (globalThis as any).Bun.file(path);\n\t\t\tif (await file.exists()) return file.text();\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t}\n\t// Node-style (also works in Bun).\n\ttry {\n\t\tconst fs = await import(\"node:fs/promises\");\n\t\treturn await fs.readFile(path, \"utf8\");\n\t} catch {\n\t\treturn null;\n\t}\n}\n",
|
|
9
|
+
"/**\n * `nexusjs/view` — view engine adapter + file-based view loader.\n *\n * Public API:\n * - `renderView(template, data, context?)` — render a view.\n * If `template` ends in a known file extension (`.html`, `.edge`,\n * `.rendu`, `.eta`) AND `setViewPaths()` has been called, the\n * file is loaded from the first matching directory and used\n * as the template source. Otherwise the string is treated as\n * inline source.\n * The adapter is selected by file extension (or Rendu for\n * inline / non-extension values).\n * - `setViewPaths(path)` — configure the directory searched for\n * view files. Pass `\"\"` to disable.\n * - `getViewPaths()` — return the current path (empty = disabled).\n * - `loadTemplate(dir, name)` — low-level: load a file from\n * the given directory.\n * - `Application.setViewPaths(path)` — same as the module\n * function, but chainable.\n *\n * Adapters:\n * - RenduAdapter (default for `.html`/`.rendu`/inline)\n * - EdgeAdapter (for `.edge`)\n * - EtaAdapter (for `.eta`)\n *\n * Override with `app.setViewAdapter(new MyAdapter())` to install\n * a different engine globally.\n */\n\nexport type {\n\tViewAdapter,\n\tViewContext,\n\tViewOptions,\n} from \"./types.js\";\nexport { RenduAdapter } from \"./rendu.js\";\nexport { EdgeAdapter } from \"./edge.js\";\nexport { EtaAdapter } from \"./eta.js\";\nexport {\n\trenderView,\n\tloadTemplate,\n\tsetViewPaths,\n\tgetViewPaths,\n} from \"./view-engine.js\";\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;AAAA;AAGO,MAAM,aAAoC;AAAA,EACvC,OAAO;AAAA,EACR,QAAQ,IAAI;AAAA,EAEpB,MAAM,CACL,UACA,MACA,SACA,SACkB;AAAA,IASlB,MAAM,OAA4B,CAAC;AAAA,IACnC,YAAY,GAAG,MAAM,OAAO,QAAQ,IAAI,GAAG;AAAA,MAC1C,KAAK,KAAK,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,CAAC;AAAA,IAChE;AAAA,IACA,MAAM,SAAS,KAAK,UAAU,MAAM,SAAS,OAAO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OAAO;AAAA,QAAG,OAAO,KAAK,KAAK;AAAA,MACzC,MAAM;AAAA,EAGT;AAAA,EAEA,IAAI;AAAA,IACH,MAAM,KAAK,MAAa;AAAA,IACxB,OAAO,MAAM,GAAG,SAAS,MAAM,MAAM;AAAA,IACpC,MAAM;AAAA,IACP,OAAO;AAAA;AAAA;AAAA,IApHL,WAAmB,IAajB;AAAA;AAAA,EA3BN;AAAA,EA2BM,iBAAiB,CAAC,SAAS,SAAS,UAAU,MAAM;AAAA;;;ACH1D;AAGA;",
|
|
12
|
+
"debugId": "8CC13EEB69A7C3E164756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Inertia HTML shell renderer.
|
|
3
|
+
*
|
|
4
|
+
* When no SSR adapter is configured (the most common case for getting
|
|
5
|
+
* started), we ship a minimal HTML page with the page object embedded
|
|
6
|
+
* as a `data-page` attribute. The client picks it up and hydrates from
|
|
7
|
+
* there.
|
|
8
|
+
*
|
|
9
|
+
* When an SSR adapter is configured, we render the page tree and
|
|
10
|
+
* inject the resulting HTML into `<div id="app">` before sending.
|
|
11
|
+
*/
|
|
12
|
+
import type { Context } from "hono";
|
|
13
|
+
import type { InertiaAdapter, InertiaPage, SsrAdapter } from "./types.js";
|
|
14
|
+
export declare function renderDefaultRoot(adapter: InertiaAdapter, ssr: SsrAdapter | null, component: string, page: InertiaPage, c: Context): Promise<Response>;
|
|
15
|
+
//# sourceMappingURL=default-ssr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-ssr.d.ts","sourceRoot":"","sources":["../../../src/view/inertia/default-ssr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1E,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,cAAc,EACvB,GAAG,EAAE,UAAU,GAAG,IAAI,EACtB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,WAAW,EACjB,CAAC,EAAE,OAAO,GACR,OAAO,CAAC,QAAQ,CAAC,CA8CnB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inertia `<Form>` server-side helper.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Inertia v3 client-side `<Form>` component behaviour:
|
|
5
|
+
*
|
|
6
|
+
* 1. Controllers wrap form actions with `inertia.form(...)`.
|
|
7
|
+
* 2. They validate input (typically with Zod). On failure they call
|
|
8
|
+
* `.withErrors(...).render()` and the page re-renders with the
|
|
9
|
+
* `errors` and (optionally) `errorBag` props injected.
|
|
10
|
+
* 3. On success they call `.redirect(url)` which emits a 303 — the
|
|
11
|
+
* PRG (Post-Redirect-Get) pattern that prevents double-submits.
|
|
12
|
+
* 4. `.withValues(input)` re-populates the form after a validation
|
|
13
|
+
* failure so the user does not have to retype everything.
|
|
14
|
+
*
|
|
15
|
+
* The `errors` prop is special-cased by the Inertia client: it surfaces
|
|
16
|
+
* validation errors to form fields automatically when you wire up the
|
|
17
|
+
* matching `useForm` hook. `errorBag` lets multiple forms on the same
|
|
18
|
+
* page coexist (each form has its own error namespace).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* @Post('/users')
|
|
23
|
+
* async store(@Body() input: any) {
|
|
24
|
+
* const form = this.inertia.form('Users/Create');
|
|
25
|
+
* const result = UserSchema.safeParse(input);
|
|
26
|
+
* if (!result.success) {
|
|
27
|
+
* return form
|
|
28
|
+
* .withErrorBag('createUser')
|
|
29
|
+
* .withErrors(result.error.flatten().fieldErrors)
|
|
30
|
+
* .withValues(input)
|
|
31
|
+
* .render();
|
|
32
|
+
* }
|
|
33
|
+
* await this.userService.create(result.data);
|
|
34
|
+
* return form.redirect('/users');
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import type { Inertia } from "./inertia-adapter.js";
|
|
39
|
+
import type { InertiaResponse } from "./inertia-response.js";
|
|
40
|
+
/**
|
|
41
|
+
* Value shape for `withErrors`. Each field maps to a string (single
|
|
42
|
+
* error) or an array of strings (multiple errors).
|
|
43
|
+
*/
|
|
44
|
+
export type ErrorMap = Record<string, string | string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Builder for an Inertia form response. Fluent API — every method
|
|
47
|
+
* returns `this` so calls can be chained.
|
|
48
|
+
*/
|
|
49
|
+
export declare class InertiaFormBuilder {
|
|
50
|
+
private readonly adapter;
|
|
51
|
+
private readonly component;
|
|
52
|
+
private props;
|
|
53
|
+
private errorMap;
|
|
54
|
+
private errorBagName?;
|
|
55
|
+
constructor(adapter: Inertia, component: string, initialProps?: Record<string, any>);
|
|
56
|
+
/** Merge a batch of props at once. */
|
|
57
|
+
withProps(extra: Record<string, any>): this;
|
|
58
|
+
/** Set a single prop. */
|
|
59
|
+
with(key: string, value: any): this;
|
|
60
|
+
/**
|
|
61
|
+
* Attach validation errors. Each field maps to a string (single
|
|
62
|
+
* error) or string[] (multiple). Strings are wrapped in arrays
|
|
63
|
+
* internally to keep the shape uniform.
|
|
64
|
+
*/
|
|
65
|
+
withErrors(errors: ErrorMap): this;
|
|
66
|
+
/** Add a single error to a field. */
|
|
67
|
+
withError(field: string, message: string): this;
|
|
68
|
+
/**
|
|
69
|
+
* Name the form's error namespace. Useful when multiple forms share
|
|
70
|
+
* a page; each `useForm` hook on the client can read its own bag.
|
|
71
|
+
*/
|
|
72
|
+
withErrorBag(name: string): this;
|
|
73
|
+
/**
|
|
74
|
+
* Re-populate the form with the originally submitted values so
|
|
75
|
+
* users don't have to retype them after a validation failure.
|
|
76
|
+
*/
|
|
77
|
+
withValues(values: Record<string, any>): this;
|
|
78
|
+
/**
|
|
79
|
+
* Render the page with the (possibly error-laden) props. If any
|
|
80
|
+
* errors were attached, they are automatically injected as the
|
|
81
|
+
* `errors` prop (and `errorBag` if a bag name was set).
|
|
82
|
+
*/
|
|
83
|
+
render(): InertiaResponse;
|
|
84
|
+
/**
|
|
85
|
+
* Issue a 303 redirect. 303 is the right status for non-GET methods
|
|
86
|
+
* (POST/PUT/PATCH/DELETE) because it forces the client to follow up
|
|
87
|
+
* with a GET — i.e. the PRG pattern. This prevents the browser from
|
|
88
|
+
* resubmitting the form on refresh.
|
|
89
|
+
*/
|
|
90
|
+
redirect(url: string): Response;
|
|
91
|
+
/**
|
|
92
|
+
* Navigate back to the previous page (the Inertia client interprets
|
|
93
|
+
* `Location: back` and steps one entry in its history). If `to` is
|
|
94
|
+
* provided, redirect there instead.
|
|
95
|
+
*/
|
|
96
|
+
back(to?: string): Response;
|
|
97
|
+
/** Read the currently-accumulated errors (without rendering). */
|
|
98
|
+
getErrors(): Record<string, string[]>;
|
|
99
|
+
/** Read the current prop draft. */
|
|
100
|
+
getProps(): Record<string, any>;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=form-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-helper.d.ts","sourceRoot":"","sources":["../../../src/view/inertia/form-helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEzD;;;GAGG;AACH,qBAAa,kBAAkB;IAM7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN3B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,QAAQ,CAAgC;IAChD,OAAO,CAAC,YAAY,CAAC,CAAS;gBAGZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EAClC,YAAY,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IASvC,sCAAsC;IACtC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAK3C,yBAAyB;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAKnC;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI;IASlC,qCAAqC;IACrC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAK/C;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKhC;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAS7C;;;;OAIG;IACH,MAAM,IAAI,eAAe;IAUzB;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ;IAO/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,QAAQ;IAW3B,iEAAiE;IACjE,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAIrC,mCAAmC;IACnC,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inertia form middleware.
|
|
3
|
+
*
|
|
4
|
+
* Hooks into the request lifecycle for form actions (POST/PUT/PATCH/
|
|
5
|
+
* DELETE) to do two things:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Pre-parse form bodies.** When the client posts URL-encoded or
|
|
8
|
+
* multipart data, parsing the body consumes the request stream.
|
|
9
|
+
* The framework's `@Body()` parameter decorator parses JSON bodies
|
|
10
|
+
* by default; this middleware additionally caches the parsed form
|
|
11
|
+
* under `c.var.nexus.formBody` so controllers can read it via
|
|
12
|
+
* `c.get('formBody')` without re-parsing.
|
|
13
|
+
*
|
|
14
|
+
* 2. **CSRF token validation.** If `validateCsrf` is enabled the
|
|
15
|
+
* middleware looks for a token either in a header (`csrfHeader`) or
|
|
16
|
+
* a form field (`csrfField`), compares it to the token registered
|
|
17
|
+
* in shared props (`csrfSharedKey`), and returns 419 on mismatch.
|
|
18
|
+
*
|
|
19
|
+
* The middleware does NOT enforce a specific redirect strategy — the
|
|
20
|
+
* `InertiaFormBuilder` handles that at the action level (303 + PRG).
|
|
21
|
+
*/
|
|
22
|
+
import type { Context } from "hono";
|
|
23
|
+
import type { Middleware } from "../../core/http/middleware.js";
|
|
24
|
+
export interface InertiaFormMiddlewareOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Whether to enforce CSRF validation. Off by default; turn on for
|
|
27
|
+
* any deployment that exposes session-cookie auth.
|
|
28
|
+
*/
|
|
29
|
+
validateCsrf?: boolean;
|
|
30
|
+
/** Header name carrying the CSRF token. Default: `X-CSRF-Token`. */
|
|
31
|
+
csrfHeader?: string;
|
|
32
|
+
/** Form field name carrying the CSRF token. Default: `_token`. */
|
|
33
|
+
csrfField?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Key under `sharedProps` where the canonical CSRF token lives.
|
|
36
|
+
* Default: `csrfToken`. The middleware reads this from
|
|
37
|
+
* `c.var.nexus?.shared` (populated by `inertia.share(...)`).
|
|
38
|
+
*/
|
|
39
|
+
csrfSharedKey?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Provide a custom CSRF resolver. Overrides the default shared-prop
|
|
42
|
+
* lookup. Useful when the token is rotated per request via a
|
|
43
|
+
* dedicated provider.
|
|
44
|
+
*/
|
|
45
|
+
getCsrfToken?: (c: Context) => string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Status code to return on CSRF mismatch. Default: 419 (Laravel's
|
|
48
|
+
* "Page Expired" convention).
|
|
49
|
+
*/
|
|
50
|
+
csrfFailureStatus?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function inertiaFormMiddleware(options?: InertiaFormMiddlewareOptions): Middleware;
|
|
53
|
+
//# sourceMappingURL=form-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-middleware.d.ts","sourceRoot":"","sources":["../../../src/view/inertia/form-middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IAElD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAKD,wBAAgB,qBAAqB,CACpC,OAAO,GAAE,4BAAiC,GACxC,UAAU,CAyDZ"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inertia.js lazy-evaluation helpers.
|
|
3
|
+
*
|
|
4
|
+
* These wrap a callback so the framework can decide *when* to resolve
|
|
5
|
+
* it:
|
|
6
|
+
*
|
|
7
|
+
* - `defer()` → resolved on a follow-up partial reload only.
|
|
8
|
+
* - `always()` → included in every partial reload, never trimmed.
|
|
9
|
+
* - `optional()` → skipped on partial reloads when empty.
|
|
10
|
+
* - `merge()` → client merges new value with previous.
|
|
11
|
+
* - `deepMerge()` → client deep-merges new value with previous.
|
|
12
|
+
* - `once()` → included only on first page load.
|
|
13
|
+
*
|
|
14
|
+
* Each helper is a thin wrapper class with a discriminator tag. The
|
|
15
|
+
* adapter inspects the tag to decide the correct serialization behaviour.
|
|
16
|
+
*/
|
|
17
|
+
/** Common shape for all Inertia helper wrappers. */
|
|
18
|
+
export interface InertiaHelper<T = any> {
|
|
19
|
+
/** Discriminator tag — read by the adapter, never sent to the client. */
|
|
20
|
+
readonly __inertiaKind: string;
|
|
21
|
+
/** Resolve the wrapped callback. */
|
|
22
|
+
resolve(): T | Promise<T>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Deferred prop. The client receives a `null` placeholder initially and
|
|
26
|
+
* issues a follow-up request to fetch the real value. Use for expensive
|
|
27
|
+
* data that shouldn't block the initial render.
|
|
28
|
+
*/
|
|
29
|
+
export declare class DeferredProp<T = any> implements InertiaHelper<T> {
|
|
30
|
+
private readonly callback;
|
|
31
|
+
/** Group name. Props in the same group resolve in one request. */
|
|
32
|
+
readonly group: string;
|
|
33
|
+
readonly __inertiaKind = "deferred";
|
|
34
|
+
constructor(callback: () => T | Promise<T>,
|
|
35
|
+
/** Group name. Props in the same group resolve in one request. */
|
|
36
|
+
group?: string);
|
|
37
|
+
resolve(): T | Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
/** Build a deferred prop. */
|
|
40
|
+
export declare function defer<T>(callback: () => T | Promise<T>, group?: string): DeferredProp<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Always-on prop. Included in *every* partial reload, regardless of the
|
|
43
|
+
* client's `only` / `except` filter. Useful for data that nearly every
|
|
44
|
+
* page needs (e.g. notification counts, current user).
|
|
45
|
+
*/
|
|
46
|
+
export declare class AlwaysProp<T = any> implements InertiaHelper<T> {
|
|
47
|
+
private readonly callback;
|
|
48
|
+
readonly __inertiaKind = "always";
|
|
49
|
+
constructor(callback: () => T | Promise<T>);
|
|
50
|
+
resolve(): T | Promise<T>;
|
|
51
|
+
}
|
|
52
|
+
export declare function always<T>(callback: () => T | Promise<T>): AlwaysProp<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Optional prop. On partial reloads, omitted when the resolved value is
|
|
55
|
+
* an array shorter than or equal to `threshold` (default 0). Helps
|
|
56
|
+
* reduce response size when the user is filtering down to zero results.
|
|
57
|
+
*/
|
|
58
|
+
export declare class OptionalProp<T = any> implements InertiaHelper<T> {
|
|
59
|
+
private readonly callback;
|
|
60
|
+
readonly threshold: number;
|
|
61
|
+
readonly __inertiaKind = "optional";
|
|
62
|
+
constructor(callback: () => T | Promise<T>, threshold?: number);
|
|
63
|
+
resolve(): T | Promise<T>;
|
|
64
|
+
}
|
|
65
|
+
export declare function optional<T>(callback: () => T | Promise<T>, threshold?: number): OptionalProp<T>;
|
|
66
|
+
/**
|
|
67
|
+
* Merge prop. The client merges the new value with its previous value,
|
|
68
|
+
* which is essential for infinite-scroll pagination (append rather
|
|
69
|
+
* than replace).
|
|
70
|
+
*/
|
|
71
|
+
export declare class MergeProp<T = any> implements InertiaHelper<T> {
|
|
72
|
+
readonly __inertiaKind = "merge";
|
|
73
|
+
/**
|
|
74
|
+
* When provided, the client uses these paths to identify matching
|
|
75
|
+
* items between the old and new arrays. Each inner array is a list of
|
|
76
|
+
* property names whose combined values are compared.
|
|
77
|
+
*/
|
|
78
|
+
readonly matchPropsOn: string[][];
|
|
79
|
+
constructor(callback: () => T | Promise<T>, matchPropsOn?: string[][]);
|
|
80
|
+
private callback;
|
|
81
|
+
resolve(): T | Promise<T>;
|
|
82
|
+
}
|
|
83
|
+
export declare function merge<T>(callback: () => T | Promise<T>, matchPropsOn?: string[][]): MergeProp<T>;
|
|
84
|
+
/**
|
|
85
|
+
* Deep-merge prop. Like `merge`, but the client performs a recursive
|
|
86
|
+
* object merge instead of array deduplication.
|
|
87
|
+
*/
|
|
88
|
+
export declare class DeepMergeProp<T = any> implements InertiaHelper<T> {
|
|
89
|
+
private readonly callback;
|
|
90
|
+
readonly __inertiaKind = "deepMerge";
|
|
91
|
+
constructor(callback: () => T | Promise<T>);
|
|
92
|
+
resolve(): T | Promise<T>;
|
|
93
|
+
}
|
|
94
|
+
export declare function deepMerge<T>(callback: () => T | Promise<T>): DeepMergeProp<T>;
|
|
95
|
+
/**
|
|
96
|
+
* Once prop. Resolved and included only on the very first page load;
|
|
97
|
+
* subsequent partial reloads never include it.
|
|
98
|
+
*/
|
|
99
|
+
export declare class OnceProp<T = any> implements InertiaHelper<T> {
|
|
100
|
+
private readonly callback;
|
|
101
|
+
readonly __inertiaKind = "once";
|
|
102
|
+
constructor(callback: () => T | Promise<T>);
|
|
103
|
+
resolve(): T | Promise<T>;
|
|
104
|
+
}
|
|
105
|
+
export declare function once<T>(callback: () => T | Promise<T>): OnceProp<T>;
|
|
106
|
+
/**
|
|
107
|
+
* Lazy prop. Resolved on every response (just like a plain prop), but
|
|
108
|
+
* with two important differences:
|
|
109
|
+
*
|
|
110
|
+
* 1. The factory is invoked only once per request — even if multiple
|
|
111
|
+
* keys point at the same factory or the same prop is referenced
|
|
112
|
+
* elsewhere on the page. The adapter keys the cache on
|
|
113
|
+
* `LazyProp.tag`, so two `lazy()` calls with the same tag share
|
|
114
|
+
* their resolved value.
|
|
115
|
+
* 2. Resolutions run alongside other lazy props so independent work
|
|
116
|
+
* can overlap.
|
|
117
|
+
*
|
|
118
|
+
* Use this for any expensive computation you don't want to repeat
|
|
119
|
+
* within a single request, but that should not be deferred to a
|
|
120
|
+
* follow-up partial reload.
|
|
121
|
+
*/
|
|
122
|
+
export declare class LazyProp<T = any> implements InertiaHelper<T> {
|
|
123
|
+
private readonly callback;
|
|
124
|
+
readonly __inertiaKind = "lazy";
|
|
125
|
+
/** Cache key used by the adapter to deduplicate. */
|
|
126
|
+
readonly tag: string;
|
|
127
|
+
/** Increments on every resolve() — useful for tests / observability. */
|
|
128
|
+
invocations: number;
|
|
129
|
+
constructor(callback: () => T | Promise<T>, tag?: string);
|
|
130
|
+
resolve(): T | Promise<T>;
|
|
131
|
+
}
|
|
132
|
+
/** Build a lazy prop. Two calls with the same `tag` share their value. */
|
|
133
|
+
export declare function lazy<T>(callback: () => T | Promise<T>, tag?: string): LazyProp<T>;
|
|
134
|
+
/**
|
|
135
|
+
* Type guard: check whether a value is any Inertia helper wrapper.
|
|
136
|
+
*/
|
|
137
|
+
export declare function isInertiaHelper(value: unknown): value is InertiaHelper;
|
|
138
|
+
/**
|
|
139
|
+
* Strip helper wrappers from a props object, returning a plain
|
|
140
|
+
* `{ [helperKind]: string[] }` map of which keys were wrapped and how.
|
|
141
|
+
*/
|
|
142
|
+
export interface PropAnnotation {
|
|
143
|
+
/** Map of helperKind → array of prop keys. */
|
|
144
|
+
byKind: Record<string, string[]>;
|
|
145
|
+
/** Optional config extracted per prop (e.g. merge matchPropsOn). */
|
|
146
|
+
configs: Record<string, InertiaHelper>;
|
|
147
|
+
}
|
|
148
|
+
export declare function annotateProps(props: Record<string, any>): PropAnnotation;
|
|
149
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/view/inertia/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,oDAAoD;AACpD,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,GAAG;IACrC,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,oCAAoC;IACpC,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1B;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAI5D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,kEAAkE;aAClD,KAAK,EAAE,MAAM;IAL9B,QAAQ,CAAC,aAAa,cAAc;gBAGlB,QAAQ,EAAE,MA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for the server-side Inertia.js v2/v3 adapter. The
|
|
5
|
+
* adapter implements the Inertia protocol: JSON responses for XHR,
|
|
6
|
+
* HTML shell with embedded page data for first-page loads, deferred /
|
|
7
|
+
* merge / always / once / lazy prop helpers, asset versioning, shared
|
|
8
|
+
* data, form helpers, and a pluggable SSR adapter interface.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./types.js";
|
|
11
|
+
export * from "./helpers.js";
|
|
12
|
+
export * from "./inertia-response.js";
|
|
13
|
+
export * from "./form-helper.js";
|
|
14
|
+
export * from "./form-middleware.js";
|
|
15
|
+
export * from "./inertia-adapter.js";
|
|
16
|
+
export * from "./default-ssr.js";
|
|
17
|
+
export * from "./ssr/index.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/view/inertia/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|