@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,1498 @@
|
|
|
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/session/backends/drizzle.ts
|
|
58
|
+
var exports_drizzle = {};
|
|
59
|
+
__export(exports_drizzle, {
|
|
60
|
+
DrizzleSessionStorage: () => DrizzleSessionStorage
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
class DrizzleSessionStorage {
|
|
64
|
+
name = "database";
|
|
65
|
+
db;
|
|
66
|
+
tableName;
|
|
67
|
+
cols;
|
|
68
|
+
constructor(options) {
|
|
69
|
+
this.db = options.db;
|
|
70
|
+
this.tableName = options.tableName ?? "nexus_sessions";
|
|
71
|
+
this.cols = {
|
|
72
|
+
id: options.columns?.id ?? "id",
|
|
73
|
+
userId: options.columns?.userId ?? "user_id",
|
|
74
|
+
data: options.columns?.data ?? "data",
|
|
75
|
+
createdAt: options.columns?.createdAt ?? "created_at",
|
|
76
|
+
lastSeenAt: options.columns?.lastSeenAt ?? "last_seen_at",
|
|
77
|
+
expiresAt: options.columns?.expiresAt ?? "expires_at",
|
|
78
|
+
absoluteExpiresAt: options.columns?.absoluteExpiresAt ?? "absolute_expires_at",
|
|
79
|
+
metadata: options.columns?.metadata ?? "metadata"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async create(opts) {
|
|
83
|
+
const now = new Date;
|
|
84
|
+
const record = {
|
|
85
|
+
id: opts.id ?? randomId3(),
|
|
86
|
+
userId: null,
|
|
87
|
+
data: opts.data ?? {},
|
|
88
|
+
createdAt: now,
|
|
89
|
+
lastSeenAt: now,
|
|
90
|
+
expiresAt: new Date(now.getTime() + (opts.ttlSeconds ?? 60 * 60 * 24 * 7) * 1000)
|
|
91
|
+
};
|
|
92
|
+
if (opts.absoluteTtlSeconds) {
|
|
93
|
+
record.absoluteExpiresAt = new Date(now.getTime() + opts.absoluteTtlSeconds * 1000);
|
|
94
|
+
}
|
|
95
|
+
if (opts.metadata)
|
|
96
|
+
record.metadata = opts.metadata;
|
|
97
|
+
await this.db.rawQuery(`INSERT INTO ${this.tableName} (${this.cols.id}, ${this.cols.userId}, ${this.cols.data}, ${this.cols.createdAt}, ${this.cols.lastSeenAt}, ${this.cols.expiresAt}, ${this.cols.absoluteExpiresAt}, ${this.cols.metadata})
|
|
98
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
99
|
+
record.id,
|
|
100
|
+
record.userId,
|
|
101
|
+
JSON.stringify(record.data),
|
|
102
|
+
toTimestamp(record.createdAt),
|
|
103
|
+
toTimestamp(record.lastSeenAt),
|
|
104
|
+
toTimestamp(record.expiresAt),
|
|
105
|
+
record.absoluteExpiresAt ? toTimestamp(record.absoluteExpiresAt) : null,
|
|
106
|
+
record.metadata ? JSON.stringify(record.metadata) : null
|
|
107
|
+
]);
|
|
108
|
+
return record;
|
|
109
|
+
}
|
|
110
|
+
async read(id) {
|
|
111
|
+
const rows = await this.db.rawQuery(`SELECT * FROM ${this.tableName} WHERE ${this.cols.id} = ? LIMIT 1`, [id]);
|
|
112
|
+
return rows[0] ? this.rowToRecord(rows[0]) : null;
|
|
113
|
+
}
|
|
114
|
+
async readMany(query = {}) {
|
|
115
|
+
const where = [];
|
|
116
|
+
const params = [];
|
|
117
|
+
if (query.userId !== undefined) {
|
|
118
|
+
where.push(`${this.cols.userId} = ?`);
|
|
119
|
+
params.push(query.userId);
|
|
120
|
+
}
|
|
121
|
+
const whereSql = where.length > 0 ? `WHERE ${where.join(" AND ")}` : "";
|
|
122
|
+
const limit = query.limit ?? 1000;
|
|
123
|
+
const rows = await this.db.rawQuery(`SELECT * FROM ${this.tableName} ${whereSql} ORDER BY ${this.cols.createdAt} DESC LIMIT ?`, [...params, limit]);
|
|
124
|
+
return rows.map((r) => this.rowToRecord(r));
|
|
125
|
+
}
|
|
126
|
+
async update(id, opts) {
|
|
127
|
+
const sets = [];
|
|
128
|
+
const params = [];
|
|
129
|
+
if (opts.dataPatch !== undefined) {
|
|
130
|
+
sets.push(`${this.cols.data} = ?`);
|
|
131
|
+
params.push(JSON.stringify(opts.dataPatch));
|
|
132
|
+
}
|
|
133
|
+
if (opts.extendSeconds !== undefined) {
|
|
134
|
+
sets.push(`${this.cols.expiresAt} = ?`);
|
|
135
|
+
params.push(toTimestamp(new Date(Date.now() + opts.extendSeconds * 1000)));
|
|
136
|
+
}
|
|
137
|
+
if (sets.length === 0)
|
|
138
|
+
return this.read(id);
|
|
139
|
+
sets.push(`${this.cols.lastSeenAt} = ?`);
|
|
140
|
+
params.push(toTimestamp(new Date));
|
|
141
|
+
params.push(id);
|
|
142
|
+
await this.db.rawQuery(`UPDATE ${this.tableName} SET ${sets.join(", ")} WHERE ${this.cols.id} = ?`, params);
|
|
143
|
+
return this.read(id);
|
|
144
|
+
}
|
|
145
|
+
async touch(id) {
|
|
146
|
+
await this.db.rawQuery(`UPDATE ${this.tableName} SET ${this.cols.lastSeenAt} = ? WHERE ${this.cols.id} = ?`, [toTimestamp(new Date), id]);
|
|
147
|
+
return this.read(id);
|
|
148
|
+
}
|
|
149
|
+
async destroy(id) {
|
|
150
|
+
const existing = await this.read(id);
|
|
151
|
+
if (!existing)
|
|
152
|
+
return false;
|
|
153
|
+
await this.db.rawQuery(`DELETE FROM ${this.tableName} WHERE ${this.cols.id} = ?`, [id]);
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
async destroyMany(query = {}) {
|
|
157
|
+
const where = [];
|
|
158
|
+
const params = [];
|
|
159
|
+
if (query.userId !== undefined) {
|
|
160
|
+
where.push(`${this.cols.userId} = ?`);
|
|
161
|
+
params.push(query.userId);
|
|
162
|
+
}
|
|
163
|
+
const whereSql = where.length > 0 ? `WHERE ${where.join(" AND ")}` : "";
|
|
164
|
+
await this.db.rawQuery(`DELETE FROM ${this.tableName} ${whereSql}`, params);
|
|
165
|
+
return 0;
|
|
166
|
+
}
|
|
167
|
+
async gc() {
|
|
168
|
+
await this.db.rawQuery(`DELETE FROM ${this.tableName} WHERE ${this.cols.expiresAt} < ?`, [toTimestamp(new Date)]);
|
|
169
|
+
return 0;
|
|
170
|
+
}
|
|
171
|
+
async clear() {
|
|
172
|
+
await this.db.rawQuery(`DELETE FROM ${this.tableName}`);
|
|
173
|
+
}
|
|
174
|
+
async start() {}
|
|
175
|
+
async stop() {}
|
|
176
|
+
rowToRecord(row) {
|
|
177
|
+
const r = {
|
|
178
|
+
id: String(row[this.cols.id]),
|
|
179
|
+
userId: row[this.cols.userId],
|
|
180
|
+
data: parseJson(row[this.cols.data]) ?? {},
|
|
181
|
+
createdAt: fromTimestamp(row[this.cols.createdAt]),
|
|
182
|
+
lastSeenAt: fromTimestamp(row[this.cols.lastSeenAt]),
|
|
183
|
+
expiresAt: fromTimestamp(row[this.cols.expiresAt])
|
|
184
|
+
};
|
|
185
|
+
const abs = row[this.cols.absoluteExpiresAt];
|
|
186
|
+
if (abs)
|
|
187
|
+
r.absoluteExpiresAt = fromTimestamp(abs);
|
|
188
|
+
const meta = row[this.cols.metadata];
|
|
189
|
+
if (meta)
|
|
190
|
+
r.metadata = parseJson(meta);
|
|
191
|
+
return r;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function toTimestamp(d) {
|
|
195
|
+
return d.toISOString();
|
|
196
|
+
}
|
|
197
|
+
function fromTimestamp(v) {
|
|
198
|
+
if (v instanceof Date)
|
|
199
|
+
return v;
|
|
200
|
+
if (typeof v === "string")
|
|
201
|
+
return new Date(v);
|
|
202
|
+
if (typeof v === "number")
|
|
203
|
+
return new Date(v);
|
|
204
|
+
return new Date;
|
|
205
|
+
}
|
|
206
|
+
function parseJson(v) {
|
|
207
|
+
if (typeof v !== "string")
|
|
208
|
+
return v;
|
|
209
|
+
try {
|
|
210
|
+
return JSON.parse(v);
|
|
211
|
+
} catch {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function randomId3(bytes = 24) {
|
|
216
|
+
const arr = new Uint8Array(bytes);
|
|
217
|
+
crypto.getRandomValues(arr);
|
|
218
|
+
return Buffer.from(arr).toString("base64url");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/core/constants.ts
|
|
222
|
+
var METADATA_KEY, PARAM_TYPES, HTTP_METHODS;
|
|
223
|
+
var init_constants = __esm(() => {
|
|
224
|
+
METADATA_KEY = {
|
|
225
|
+
CONTROLLER: "nexus:controller",
|
|
226
|
+
INJECTABLE: "nexus:injectable",
|
|
227
|
+
REPOSITORY: "nexus:repository",
|
|
228
|
+
MODULE: "nexus:module",
|
|
229
|
+
ROUTES: "nexus:routes",
|
|
230
|
+
PARAMS: "nexus:params",
|
|
231
|
+
VALIDATE: "nexus:validate",
|
|
232
|
+
PARAMTYPES: "design:paramtypes",
|
|
233
|
+
TYPE: "design:type",
|
|
234
|
+
RETURNTYPE: "design:returntype",
|
|
235
|
+
INJECT: "nexus:inject"
|
|
236
|
+
};
|
|
237
|
+
PARAM_TYPES = {
|
|
238
|
+
REQUEST: 0,
|
|
239
|
+
RESPONSE: 1,
|
|
240
|
+
NEXT: 2,
|
|
241
|
+
BODY: 3,
|
|
242
|
+
QUERY: 4,
|
|
243
|
+
PARAM: 5,
|
|
244
|
+
HEADERS: 6,
|
|
245
|
+
CTX: 7,
|
|
246
|
+
USER: 8
|
|
247
|
+
};
|
|
248
|
+
HTTP_METHODS = [
|
|
249
|
+
"GET",
|
|
250
|
+
"POST",
|
|
251
|
+
"PUT",
|
|
252
|
+
"DELETE",
|
|
253
|
+
"PATCH",
|
|
254
|
+
"OPTIONS",
|
|
255
|
+
"HEAD"
|
|
256
|
+
];
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// src/core/decorators/controller.ts
|
|
260
|
+
import"reflect-metadata";
|
|
261
|
+
function Controller(prefix = "/") {
|
|
262
|
+
return (target) => {
|
|
263
|
+
const normalized = normalizePrefix(prefix);
|
|
264
|
+
const meta = { prefix: normalized };
|
|
265
|
+
Reflect.defineMetadata(METADATA_KEY.CONTROLLER, meta, target);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
function getControllerMetadata(target) {
|
|
269
|
+
return Reflect.getMetadata(METADATA_KEY.CONTROLLER, target) ?? { prefix: "/" };
|
|
270
|
+
}
|
|
271
|
+
function isController(target) {
|
|
272
|
+
return Reflect.hasMetadata(METADATA_KEY.CONTROLLER, target);
|
|
273
|
+
}
|
|
274
|
+
function normalizePrefix(prefix) {
|
|
275
|
+
if (!prefix)
|
|
276
|
+
return "";
|
|
277
|
+
if (prefix !== "/" && prefix.endsWith("/")) {
|
|
278
|
+
return prefix.slice(0, -1);
|
|
279
|
+
}
|
|
280
|
+
return prefix;
|
|
281
|
+
}
|
|
282
|
+
var init_controller = __esm(() => {
|
|
283
|
+
init_constants();
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// src/core/decorators/http-methods.ts
|
|
287
|
+
import"reflect-metadata";
|
|
288
|
+
function defineRoute(method, path) {
|
|
289
|
+
return (target, propertyKey, descriptor) => {
|
|
290
|
+
const routes = Reflect.getMetadata(METADATA_KEY.ROUTES, target.constructor) ?? [];
|
|
291
|
+
routes.push({
|
|
292
|
+
method,
|
|
293
|
+
path: normalizePath(path),
|
|
294
|
+
propertyKey,
|
|
295
|
+
handler: descriptor.value
|
|
296
|
+
});
|
|
297
|
+
Reflect.defineMetadata(METADATA_KEY.ROUTES, routes, target.constructor);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function normalizePath(path) {
|
|
301
|
+
if (!path || path === "/")
|
|
302
|
+
return "/";
|
|
303
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
304
|
+
}
|
|
305
|
+
function getRoutes(target) {
|
|
306
|
+
return Reflect.getMetadata(METADATA_KEY.ROUTES, target) ?? [];
|
|
307
|
+
}
|
|
308
|
+
var Get = (path = "/") => defineRoute("GET", path), Post = (path = "/") => defineRoute("POST", path), Put = (path = "/") => defineRoute("PUT", path), Delete = (path = "/") => defineRoute("DELETE", path), Patch = (path = "/") => defineRoute("PATCH", path), Options = (path = "/") => defineRoute("OPTIONS", path), Head = (path = "/") => defineRoute("HEAD", path);
|
|
309
|
+
var init_http_methods = __esm(() => {
|
|
310
|
+
init_constants();
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// src/core/decorators/params.ts
|
|
314
|
+
import"reflect-metadata";
|
|
315
|
+
function createParamDecorator(type, data) {
|
|
316
|
+
return (target, propertyKey, parameterIndex) => {
|
|
317
|
+
if (propertyKey !== undefined) {
|
|
318
|
+
const params = Reflect.getMetadata(METADATA_KEY.PARAMS, target, propertyKey) ?? [];
|
|
319
|
+
params.push({
|
|
320
|
+
index: parameterIndex,
|
|
321
|
+
type,
|
|
322
|
+
name: typeof data === "string" ? data : undefined,
|
|
323
|
+
data: typeof data === "object" ? data : undefined
|
|
324
|
+
});
|
|
325
|
+
Reflect.defineMetadata(METADATA_KEY.PARAMS, params, target, propertyKey);
|
|
326
|
+
} else {
|
|
327
|
+
const params = Reflect.getMetadata(METADATA_KEY.PARAMS, target) ?? [];
|
|
328
|
+
params.push({
|
|
329
|
+
index: parameterIndex,
|
|
330
|
+
type,
|
|
331
|
+
name: typeof data === "string" ? data : undefined,
|
|
332
|
+
data: typeof data === "object" ? data : undefined
|
|
333
|
+
});
|
|
334
|
+
Reflect.defineMetadata(METADATA_KEY.PARAMS, params, target);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function getParamMetadata(target, propertyKey) {
|
|
339
|
+
return Reflect.getMetadata(METADATA_KEY.PARAMS, target, propertyKey) ?? [];
|
|
340
|
+
}
|
|
341
|
+
var Req = () => createParamDecorator(PARAM_TYPES.REQUEST), Res = () => createParamDecorator(PARAM_TYPES.RESPONSE), Next = () => createParamDecorator(PARAM_TYPES.NEXT), Body = (key) => createParamDecorator(PARAM_TYPES.BODY, key), Query = (key) => createParamDecorator(PARAM_TYPES.QUERY, key), Param = (key) => createParamDecorator(PARAM_TYPES.PARAM, key), Headers = (key) => createParamDecorator(PARAM_TYPES.HEADERS, key), Ctx = () => createParamDecorator(PARAM_TYPES.CTX), User = () => createParamDecorator(PARAM_TYPES.USER);
|
|
342
|
+
var init_params = __esm(() => {
|
|
343
|
+
init_constants();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
// src/core/decorators/validate.ts
|
|
347
|
+
import"reflect-metadata";
|
|
348
|
+
function Validate(options) {
|
|
349
|
+
return (target, propertyKey, descriptor) => {
|
|
350
|
+
Reflect.defineMetadata(METADATA_KEY.VALIDATE, options, target.constructor, propertyKey);
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function getValidationMetadata(target, propertyKey) {
|
|
354
|
+
return Reflect.getMetadata(METADATA_KEY.VALIDATE, target, propertyKey);
|
|
355
|
+
}
|
|
356
|
+
var init_validate = __esm(() => {
|
|
357
|
+
init_constants();
|
|
358
|
+
});
|
|
359
|
+
// src/session/backends/memory.ts
|
|
360
|
+
function randomId(bytes = 24) {
|
|
361
|
+
const arr = new Uint8Array(bytes);
|
|
362
|
+
crypto.getRandomValues(arr);
|
|
363
|
+
return Buffer.from(arr).toString("base64url");
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
class MemorySessionStorage {
|
|
367
|
+
name = "memory";
|
|
368
|
+
#sessions = new Map;
|
|
369
|
+
#gcHandle = null;
|
|
370
|
+
#maxSessions;
|
|
371
|
+
#gcIntervalMs;
|
|
372
|
+
constructor(options = {}) {
|
|
373
|
+
this.#maxSessions = options.maxSessions ?? 1e5;
|
|
374
|
+
this.#gcIntervalMs = options.gcIntervalMs ?? 60000;
|
|
375
|
+
}
|
|
376
|
+
start() {
|
|
377
|
+
if (this.#gcHandle)
|
|
378
|
+
return;
|
|
379
|
+
this.#gcHandle = setInterval(() => void this.gc(), this.#gcIntervalMs);
|
|
380
|
+
const h = this.#gcHandle;
|
|
381
|
+
if (typeof h.unref === "function")
|
|
382
|
+
h.unref();
|
|
383
|
+
}
|
|
384
|
+
async stop() {
|
|
385
|
+
if (this.#gcHandle)
|
|
386
|
+
clearInterval(this.#gcHandle);
|
|
387
|
+
this.#gcHandle = null;
|
|
388
|
+
}
|
|
389
|
+
async create(opts) {
|
|
390
|
+
const now = new Date;
|
|
391
|
+
const ttl = (opts.ttlSeconds ?? 60 * 60 * 24 * 7) * 1000;
|
|
392
|
+
const record = {
|
|
393
|
+
id: opts.id ?? randomId(),
|
|
394
|
+
userId: null,
|
|
395
|
+
data: opts.data ?? {},
|
|
396
|
+
createdAt: now,
|
|
397
|
+
lastSeenAt: now,
|
|
398
|
+
expiresAt: new Date(now.getTime() + ttl)
|
|
399
|
+
};
|
|
400
|
+
if (opts.absoluteTtlSeconds) {
|
|
401
|
+
record.absoluteExpiresAt = new Date(now.getTime() + opts.absoluteTtlSeconds * 1000);
|
|
402
|
+
}
|
|
403
|
+
if (opts.metadata)
|
|
404
|
+
record.metadata = opts.metadata;
|
|
405
|
+
this.#sessions.set(record.id, record);
|
|
406
|
+
this.#evictIfFull();
|
|
407
|
+
return record;
|
|
408
|
+
}
|
|
409
|
+
async read(id) {
|
|
410
|
+
const r = this.#sessions.get(id);
|
|
411
|
+
if (!r)
|
|
412
|
+
return null;
|
|
413
|
+
if (this.#isExpired(r)) {
|
|
414
|
+
this.#sessions.delete(id);
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
const now = new Date;
|
|
418
|
+
r.lastSeenAt = now;
|
|
419
|
+
r.expiresAt = new Date(now.getTime() + Math.max(60000, r.expiresAt.getTime() - r.lastSeenAt.getTime()));
|
|
420
|
+
this.#sessions.set(id, r);
|
|
421
|
+
return r;
|
|
422
|
+
}
|
|
423
|
+
async readMany(query = {}) {
|
|
424
|
+
const now = Date.now();
|
|
425
|
+
const list = [];
|
|
426
|
+
for (const r of this.#sessions.values()) {
|
|
427
|
+
if (this.#isExpired(r))
|
|
428
|
+
continue;
|
|
429
|
+
if (query.userId !== undefined && r.userId !== query.userId)
|
|
430
|
+
continue;
|
|
431
|
+
if (query.metadata) {
|
|
432
|
+
if (query.metadata.ipAddress && r.metadata?.ipAddress !== query.metadata.ipAddress)
|
|
433
|
+
continue;
|
|
434
|
+
if (query.metadata.userAgent && r.metadata?.userAgent !== query.metadata.userAgent)
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
list.push(r);
|
|
438
|
+
if (query.limit && list.length >= (query.offset ?? 0) + query.limit)
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
const offset = query.offset ?? 0;
|
|
442
|
+
const limit = query.limit ?? list.length;
|
|
443
|
+
return list.slice(offset, offset + limit);
|
|
444
|
+
}
|
|
445
|
+
async update(id, opts) {
|
|
446
|
+
const r = this.#sessions.get(id);
|
|
447
|
+
if (!r)
|
|
448
|
+
return null;
|
|
449
|
+
if (this.#isExpired(r)) {
|
|
450
|
+
this.#sessions.delete(id);
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
if (opts.dataPatch) {
|
|
454
|
+
r.data = { ...r.data, ...opts.dataPatch };
|
|
455
|
+
}
|
|
456
|
+
if (opts.extendSeconds !== undefined) {
|
|
457
|
+
const newExpiry = Date.now() + opts.extendSeconds * 1000;
|
|
458
|
+
if (!r.absoluteExpiresAt || newExpiry < r.absoluteExpiresAt.getTime()) {
|
|
459
|
+
r.expiresAt = new Date(newExpiry);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
r.lastSeenAt = new Date;
|
|
463
|
+
this.#sessions.set(id, r);
|
|
464
|
+
return r;
|
|
465
|
+
}
|
|
466
|
+
async destroy(id) {
|
|
467
|
+
return this.#sessions.delete(id);
|
|
468
|
+
}
|
|
469
|
+
async destroyMany(query) {
|
|
470
|
+
const ids = [];
|
|
471
|
+
for (const [id, r] of this.#sessions) {
|
|
472
|
+
if (query.userId !== undefined && r.userId !== query.userId)
|
|
473
|
+
continue;
|
|
474
|
+
ids.push(id);
|
|
475
|
+
}
|
|
476
|
+
for (const id of ids)
|
|
477
|
+
this.#sessions.delete(id);
|
|
478
|
+
return ids.length;
|
|
479
|
+
}
|
|
480
|
+
async touch(id) {
|
|
481
|
+
return this.read(id);
|
|
482
|
+
}
|
|
483
|
+
async gc() {
|
|
484
|
+
const now = Date.now();
|
|
485
|
+
let removed = 0;
|
|
486
|
+
for (const [id, r] of this.#sessions) {
|
|
487
|
+
if (this.#isExpired(r, now)) {
|
|
488
|
+
this.#sessions.delete(id);
|
|
489
|
+
removed++;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return removed;
|
|
493
|
+
}
|
|
494
|
+
async clear() {
|
|
495
|
+
this.#sessions.clear();
|
|
496
|
+
}
|
|
497
|
+
#isExpired(r, now = Date.now()) {
|
|
498
|
+
if (r.expiresAt.getTime() <= now)
|
|
499
|
+
return true;
|
|
500
|
+
if (r.absoluteExpiresAt && r.absoluteExpiresAt.getTime() <= now)
|
|
501
|
+
return true;
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
#evictIfFull() {
|
|
505
|
+
if (this.#sessions.size <= this.#maxSessions)
|
|
506
|
+
return;
|
|
507
|
+
const oldest = this.#sessions.keys().next().value;
|
|
508
|
+
if (oldest)
|
|
509
|
+
this.#sessions.delete(oldest);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
// src/crypto/encryption.ts
|
|
513
|
+
import {
|
|
514
|
+
createCipheriv,
|
|
515
|
+
createDecipheriv,
|
|
516
|
+
createHmac,
|
|
517
|
+
hkdfSync,
|
|
518
|
+
randomBytes,
|
|
519
|
+
timingSafeEqual
|
|
520
|
+
} from "crypto";
|
|
521
|
+
var VERSION = "v1";
|
|
522
|
+
var IV_BYTES = 12;
|
|
523
|
+
var TAG_BYTES = 16;
|
|
524
|
+
|
|
525
|
+
class EncryptionService {
|
|
526
|
+
aesKey;
|
|
527
|
+
hmacKey;
|
|
528
|
+
constructor(masterKey) {
|
|
529
|
+
const derived = deriveKeys(masterKey);
|
|
530
|
+
this.aesKey = derived.aes;
|
|
531
|
+
this.hmacKey = derived.hmac;
|
|
532
|
+
}
|
|
533
|
+
encrypt(value, options = {}) {
|
|
534
|
+
const iv = randomBytes(IV_BYTES);
|
|
535
|
+
const cipher = createCipheriv("aes-256-gcm", this.aesKey, iv);
|
|
536
|
+
const plaintext = Buffer.from(value, "utf8");
|
|
537
|
+
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
538
|
+
const tag = cipher.getAuthTag();
|
|
539
|
+
const expiry = encodeExpiry(options.expiresAt);
|
|
540
|
+
const purposeBuf = Buffer.from(options.purpose ?? "", "utf8");
|
|
541
|
+
const mac = this.macOver([VERSION, iv, tag, ciphertext, expiry, purposeBuf]);
|
|
542
|
+
return [
|
|
543
|
+
VERSION,
|
|
544
|
+
b64(iv),
|
|
545
|
+
b64(tag),
|
|
546
|
+
b64(ciphertext),
|
|
547
|
+
b64(expiry),
|
|
548
|
+
b64(purposeBuf),
|
|
549
|
+
b64(mac)
|
|
550
|
+
].join(".");
|
|
551
|
+
}
|
|
552
|
+
decrypt(payload) {
|
|
553
|
+
const parsed = parseV1(payload);
|
|
554
|
+
if (!parsed)
|
|
555
|
+
throw new Error("Encrypted payload is malformed");
|
|
556
|
+
const expectedMac = this.macOver([
|
|
557
|
+
VERSION,
|
|
558
|
+
parsed.iv,
|
|
559
|
+
parsed.tag,
|
|
560
|
+
parsed.ciphertext,
|
|
561
|
+
parsed.expiry,
|
|
562
|
+
parsed.purpose
|
|
563
|
+
]);
|
|
564
|
+
if (!constantTimeEqual(expectedMac, parsed.mac)) {
|
|
565
|
+
throw new Error("Encrypted payload failed integrity check");
|
|
566
|
+
}
|
|
567
|
+
if (parsed.expiry.length > 0) {
|
|
568
|
+
const expiryMs = parseExpiry(parsed.expiry.toString("utf8"));
|
|
569
|
+
if (expiryMs > 0 && Date.now() > expiryMs) {
|
|
570
|
+
throw new Error("Encrypted payload has expired");
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const decipher = createDecipheriv("aes-256-gcm", this.aesKey, parsed.iv);
|
|
574
|
+
decipher.setAuthTag(parsed.tag);
|
|
575
|
+
const plaintext = Buffer.concat([
|
|
576
|
+
decipher.update(parsed.ciphertext),
|
|
577
|
+
decipher.final()
|
|
578
|
+
]);
|
|
579
|
+
return plaintext.toString("utf8");
|
|
580
|
+
}
|
|
581
|
+
isEncrypted(value) {
|
|
582
|
+
if (typeof value !== "string")
|
|
583
|
+
return false;
|
|
584
|
+
return value.startsWith(VERSION + ".");
|
|
585
|
+
}
|
|
586
|
+
sign(value, purpose = "") {
|
|
587
|
+
const mac = createHmac("sha256", this.hmacKey).update(purpose).update("|").update(value).digest();
|
|
588
|
+
return `${b64(Buffer.from(value, "utf8"))}.${b64(mac)}`;
|
|
589
|
+
}
|
|
590
|
+
signRaw(value, purpose = "") {
|
|
591
|
+
const mac = createHmac("sha256", this.hmacKey).update(purpose).update("|").update(value).digest();
|
|
592
|
+
return b64(mac);
|
|
593
|
+
}
|
|
594
|
+
verifyRaw(value, signature, purpose = "") {
|
|
595
|
+
const expected = createHmac("sha256", this.hmacKey).update(purpose).update("|").update(value).digest();
|
|
596
|
+
const given = fromB64(signature);
|
|
597
|
+
if (!given)
|
|
598
|
+
return false;
|
|
599
|
+
return constantTimeEqual(given, expected);
|
|
600
|
+
}
|
|
601
|
+
unsign(signed, purpose = "") {
|
|
602
|
+
const dot = signed.lastIndexOf(".");
|
|
603
|
+
if (dot < 1 || dot === signed.length - 1)
|
|
604
|
+
return null;
|
|
605
|
+
const valueB64 = signed.slice(0, dot);
|
|
606
|
+
const macB64 = signed.slice(dot + 1);
|
|
607
|
+
const value = fromB64(valueB64);
|
|
608
|
+
const mac = fromB64(macB64);
|
|
609
|
+
if (!value || !mac)
|
|
610
|
+
return null;
|
|
611
|
+
const expected = createHmac("sha256", this.hmacKey).update(purpose).update("|").update(value).digest();
|
|
612
|
+
if (!constantTimeEqual(mac, expected))
|
|
613
|
+
return null;
|
|
614
|
+
return value.toString("utf8");
|
|
615
|
+
}
|
|
616
|
+
macOver(parts) {
|
|
617
|
+
const h = createHmac("sha256", this.hmacKey);
|
|
618
|
+
for (const p of parts) {
|
|
619
|
+
h.update("|");
|
|
620
|
+
h.update(p);
|
|
621
|
+
}
|
|
622
|
+
return h.digest();
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
function b64(buf) {
|
|
626
|
+
return buf.toString("base64url");
|
|
627
|
+
}
|
|
628
|
+
function fromB64(s) {
|
|
629
|
+
try {
|
|
630
|
+
return Buffer.from(s, "base64url");
|
|
631
|
+
} catch {
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function constantTimeEqual(a, b) {
|
|
636
|
+
if (a.length !== b.length)
|
|
637
|
+
return false;
|
|
638
|
+
return timingSafeEqual(a, b);
|
|
639
|
+
}
|
|
640
|
+
function encodeExpiry(expiresAt) {
|
|
641
|
+
if (expiresAt === undefined)
|
|
642
|
+
return Buffer.alloc(0);
|
|
643
|
+
let ms;
|
|
644
|
+
if (typeof expiresAt === "number") {
|
|
645
|
+
ms = expiresAt > 1000000000000 ? expiresAt : Date.now() + expiresAt * 1000;
|
|
646
|
+
} else if (typeof expiresAt === "string") {
|
|
647
|
+
const asNum = Number(expiresAt);
|
|
648
|
+
if (!isNaN(asNum) && asNum > 0) {
|
|
649
|
+
ms = asNum > 1000000000000 ? asNum : Date.now() + asNum * 1000;
|
|
650
|
+
} else {
|
|
651
|
+
ms = Date.parse(expiresAt);
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
ms = expiresAt.getTime();
|
|
655
|
+
}
|
|
656
|
+
if (!isFinite(ms))
|
|
657
|
+
return Buffer.alloc(0);
|
|
658
|
+
return Buffer.from(String(ms), "utf8");
|
|
659
|
+
}
|
|
660
|
+
function parseExpiry(s) {
|
|
661
|
+
const n = Number(s);
|
|
662
|
+
return isFinite(n) ? n : 0;
|
|
663
|
+
}
|
|
664
|
+
function parseV1(s) {
|
|
665
|
+
if (typeof s !== "string" || !s.startsWith(VERSION + "."))
|
|
666
|
+
return null;
|
|
667
|
+
const parts = s.split(".");
|
|
668
|
+
if (parts.length !== 7)
|
|
669
|
+
return null;
|
|
670
|
+
const [, ivB64, tagB64, ctB64, expB64, purposeB64, macB64] = parts;
|
|
671
|
+
const iv = fromB64(ivB64);
|
|
672
|
+
const tag = fromB64(tagB64);
|
|
673
|
+
const ct = fromB64(ctB64);
|
|
674
|
+
const exp = fromB64(expB64);
|
|
675
|
+
const purpose = fromB64(purposeB64);
|
|
676
|
+
const mac = fromB64(macB64);
|
|
677
|
+
if (!iv || !tag || !ct || !exp || !purpose || !mac)
|
|
678
|
+
return null;
|
|
679
|
+
if (iv.length !== IV_BYTES)
|
|
680
|
+
return null;
|
|
681
|
+
if (tag.length !== TAG_BYTES)
|
|
682
|
+
return null;
|
|
683
|
+
return { iv, tag, ciphertext: ct, expiry: exp, purpose, mac };
|
|
684
|
+
}
|
|
685
|
+
function deriveKeys(masterKey) {
|
|
686
|
+
let input;
|
|
687
|
+
try {
|
|
688
|
+
const decoded = Buffer.from(masterKey, "base64");
|
|
689
|
+
if (decoded.length >= 32 && masterKey.length % 4 === 0) {
|
|
690
|
+
input = decoded;
|
|
691
|
+
} else {
|
|
692
|
+
input = Buffer.from(masterKey, "utf8");
|
|
693
|
+
}
|
|
694
|
+
} catch {
|
|
695
|
+
input = Buffer.from(masterKey, "utf8");
|
|
696
|
+
}
|
|
697
|
+
const ikm = input.length < 32 ? padKey(input) : input;
|
|
698
|
+
const out = hkdfSync("sha256", ikm, Buffer.alloc(0), "nexus:crypto:v1", 64);
|
|
699
|
+
const outBuf = Buffer.from(out);
|
|
700
|
+
return {
|
|
701
|
+
aes: Buffer.from(outBuf.subarray(0, 32)),
|
|
702
|
+
hmac: Buffer.from(outBuf.subarray(32, 64))
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function padKey(input) {
|
|
706
|
+
const hash = createHmac("sha256", "nexus:crypto:pad").update(input).digest();
|
|
707
|
+
const out = Buffer.alloc(32);
|
|
708
|
+
input.copy(out, 0, 0, Math.min(input.length, 32));
|
|
709
|
+
hash.copy(out, input.length < 32 ? input.length : 0, 0, 32 - Math.min(input.length, 32));
|
|
710
|
+
return out;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
// src/session/backends/cookie.ts
|
|
714
|
+
function b64urlEncode(buf) {
|
|
715
|
+
const b = typeof buf === "string" ? Buffer.from(buf, "utf8") : buf;
|
|
716
|
+
return b.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
717
|
+
}
|
|
718
|
+
function b64urlDecode(s) {
|
|
719
|
+
const padded = s + "=".repeat((4 - s.length % 4) % 4);
|
|
720
|
+
return Buffer.from(padded.replace(/-/g, "+").replace(/_/g, "/"), "base64");
|
|
721
|
+
}
|
|
722
|
+
function randomId2(bytes = 24) {
|
|
723
|
+
const arr = new Uint8Array(bytes);
|
|
724
|
+
crypto.getRandomValues(arr);
|
|
725
|
+
return b64urlEncode(Buffer.from(arr));
|
|
726
|
+
}
|
|
727
|
+
function encodeSessionCookie(record, secret) {
|
|
728
|
+
const enc = new EncryptionService(secret);
|
|
729
|
+
const payload = b64urlEncode(JSON.stringify({
|
|
730
|
+
id: record.id,
|
|
731
|
+
userId: record.userId,
|
|
732
|
+
data: record.data,
|
|
733
|
+
createdAt: record.createdAt.toISOString(),
|
|
734
|
+
lastSeenAt: record.lastSeenAt.toISOString(),
|
|
735
|
+
expiresAt: record.expiresAt.toISOString(),
|
|
736
|
+
...record.absoluteExpiresAt ? { absoluteExpiresAt: record.absoluteExpiresAt.toISOString() } : {},
|
|
737
|
+
...record.metadata ? { metadata: record.metadata } : {}
|
|
738
|
+
}));
|
|
739
|
+
const sig = enc.signRaw(payload, "session");
|
|
740
|
+
return `${payload}.${sig}`;
|
|
741
|
+
}
|
|
742
|
+
function decodeSessionCookie(cookieValue, secret) {
|
|
743
|
+
const enc = new EncryptionService(secret);
|
|
744
|
+
const lastDot = cookieValue.lastIndexOf(".");
|
|
745
|
+
if (lastDot < 1)
|
|
746
|
+
return null;
|
|
747
|
+
const payload = cookieValue.slice(0, lastDot);
|
|
748
|
+
const sig = cookieValue.slice(lastDot + 1);
|
|
749
|
+
if (!enc.verifyRaw(payload, sig, "session"))
|
|
750
|
+
return null;
|
|
751
|
+
try {
|
|
752
|
+
const obj = JSON.parse(b64urlDecode(payload).toString("utf8"));
|
|
753
|
+
const record = {
|
|
754
|
+
id: String(obj["id"]),
|
|
755
|
+
userId: obj["userId"] ?? null,
|
|
756
|
+
data: obj["data"] ?? {},
|
|
757
|
+
createdAt: new Date(String(obj["createdAt"])),
|
|
758
|
+
lastSeenAt: new Date(String(obj["lastSeenAt"])),
|
|
759
|
+
expiresAt: new Date(String(obj["expiresAt"]))
|
|
760
|
+
};
|
|
761
|
+
const abs = obj["absoluteExpiresAt"];
|
|
762
|
+
if (typeof abs === "string")
|
|
763
|
+
record.absoluteExpiresAt = new Date(abs);
|
|
764
|
+
const meta = obj["metadata"];
|
|
765
|
+
if (meta && typeof meta === "object") {
|
|
766
|
+
record.metadata = meta;
|
|
767
|
+
}
|
|
768
|
+
return record;
|
|
769
|
+
} catch {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
class CookieSessionStorage {
|
|
775
|
+
name = "cookie";
|
|
776
|
+
#secret;
|
|
777
|
+
#cookieName;
|
|
778
|
+
#defaultTtl;
|
|
779
|
+
#cookieOptions;
|
|
780
|
+
constructor(options) {
|
|
781
|
+
if (!options.secret || options.secret.length < 16) {
|
|
782
|
+
throw new Error("[session/cookie] secret must be at least 16 chars");
|
|
783
|
+
}
|
|
784
|
+
this.#secret = options.secret;
|
|
785
|
+
this.#cookieName = options.cookieName ?? "nexus.sess";
|
|
786
|
+
this.#defaultTtl = options.defaultTtlSeconds ?? 60 * 60 * 24 * 7;
|
|
787
|
+
this.#cookieOptions = options.cookieOptions ?? {};
|
|
788
|
+
}
|
|
789
|
+
get cookieName() {
|
|
790
|
+
return this.#cookieName;
|
|
791
|
+
}
|
|
792
|
+
get cookieOptions() {
|
|
793
|
+
return this.#cookieOptions;
|
|
794
|
+
}
|
|
795
|
+
buildSetCookie(record) {
|
|
796
|
+
const value = encodeSessionCookie(record, this.#secret);
|
|
797
|
+
const opts = this.#cookieOptions;
|
|
798
|
+
const parts = [`${this.#cookieName}=${value}`];
|
|
799
|
+
parts.push(`Path=${opts.path ?? "/"}`);
|
|
800
|
+
if (opts.domain)
|
|
801
|
+
parts.push(`Domain=${opts.domain}`);
|
|
802
|
+
if (opts.httpOnly ?? true)
|
|
803
|
+
parts.push("HttpOnly");
|
|
804
|
+
if (opts.secure ?? process.env["NODE_ENV"] === "production")
|
|
805
|
+
parts.push("Secure");
|
|
806
|
+
parts.push(`SameSite=${(opts.sameSite ?? "lax").toUpperCase()}`);
|
|
807
|
+
const maxAge = opts.maxAgeSeconds ?? Math.max(1, Math.floor((record.expiresAt.getTime() - Date.now()) / 1000));
|
|
808
|
+
parts.push(`Max-Age=${maxAge}`);
|
|
809
|
+
if (opts.partitioned)
|
|
810
|
+
parts.push("Partitioned");
|
|
811
|
+
return parts.join("; ");
|
|
812
|
+
}
|
|
813
|
+
buildClearCookie() {
|
|
814
|
+
const opts = this.#cookieOptions;
|
|
815
|
+
return [
|
|
816
|
+
`${this.#cookieName}=`,
|
|
817
|
+
`Path=${opts.path ?? "/"}`,
|
|
818
|
+
`Max-Age=0`,
|
|
819
|
+
opts.domain ? `Domain=${opts.domain}` : ""
|
|
820
|
+
].filter(Boolean).join("; ");
|
|
821
|
+
}
|
|
822
|
+
async create(opts) {
|
|
823
|
+
const now = new Date;
|
|
824
|
+
const ttl = (opts.ttlSeconds ?? this.#defaultTtl) * 1000;
|
|
825
|
+
const record = {
|
|
826
|
+
id: opts.id ?? randomId2(),
|
|
827
|
+
userId: null,
|
|
828
|
+
data: opts.data ?? {},
|
|
829
|
+
createdAt: now,
|
|
830
|
+
lastSeenAt: now,
|
|
831
|
+
expiresAt: new Date(now.getTime() + ttl)
|
|
832
|
+
};
|
|
833
|
+
if (opts.absoluteTtlSeconds) {
|
|
834
|
+
record.absoluteExpiresAt = new Date(now.getTime() + opts.absoluteTtlSeconds * 1000);
|
|
835
|
+
}
|
|
836
|
+
if (opts.metadata)
|
|
837
|
+
record.metadata = opts.metadata;
|
|
838
|
+
return record;
|
|
839
|
+
}
|
|
840
|
+
async read() {
|
|
841
|
+
return null;
|
|
842
|
+
}
|
|
843
|
+
async readMany(query) {
|
|
844
|
+
return [];
|
|
845
|
+
}
|
|
846
|
+
async update(_id, opts) {
|
|
847
|
+
return null;
|
|
848
|
+
}
|
|
849
|
+
async destroy() {
|
|
850
|
+
return true;
|
|
851
|
+
}
|
|
852
|
+
async destroyMany() {
|
|
853
|
+
return 0;
|
|
854
|
+
}
|
|
855
|
+
async touch() {
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
async gc() {
|
|
859
|
+
return 0;
|
|
860
|
+
}
|
|
861
|
+
async clear() {}
|
|
862
|
+
decode(cookieValue) {
|
|
863
|
+
return decodeSessionCookie(cookieValue, this.#secret);
|
|
864
|
+
}
|
|
865
|
+
encode(record) {
|
|
866
|
+
return encodeSessionCookie(record, this.#secret);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
// src/session/backends/redis.ts
|
|
870
|
+
var DEFAULT_KEY_PREFIX = "session:";
|
|
871
|
+
|
|
872
|
+
class RedisSessionStorage {
|
|
873
|
+
name = "redis";
|
|
874
|
+
#client;
|
|
875
|
+
#keyPrefix;
|
|
876
|
+
constructor(client, options = {}) {
|
|
877
|
+
this.#client = client;
|
|
878
|
+
this.#keyPrefix = options.keyPrefix ?? DEFAULT_KEY_PREFIX;
|
|
879
|
+
}
|
|
880
|
+
#key(id) {
|
|
881
|
+
return `${this.#keyPrefix}${id}`;
|
|
882
|
+
}
|
|
883
|
+
#indexKey(userId) {
|
|
884
|
+
return `${this.#keyPrefix}user:${crc32(userId)}`;
|
|
885
|
+
}
|
|
886
|
+
#recordToJSON(record) {
|
|
887
|
+
return JSON.stringify({
|
|
888
|
+
id: record.id,
|
|
889
|
+
userId: record.userId,
|
|
890
|
+
data: record.data,
|
|
891
|
+
createdAt: record.createdAt.toISOString(),
|
|
892
|
+
lastSeenAt: record.lastSeenAt.toISOString(),
|
|
893
|
+
expiresAt: record.expiresAt.toISOString(),
|
|
894
|
+
...record.absoluteExpiresAt ? { absoluteExpiresAt: record.absoluteExpiresAt.toISOString() } : {},
|
|
895
|
+
...record.metadata ? { metadata: record.metadata } : {}
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
#recordFromJSON(s) {
|
|
899
|
+
try {
|
|
900
|
+
const obj = JSON.parse(s);
|
|
901
|
+
const record = {
|
|
902
|
+
id: String(obj["id"]),
|
|
903
|
+
userId: obj["userId"] ?? null,
|
|
904
|
+
data: obj["data"] ?? {},
|
|
905
|
+
createdAt: new Date(String(obj["createdAt"])),
|
|
906
|
+
lastSeenAt: new Date(String(obj["lastSeenAt"])),
|
|
907
|
+
expiresAt: new Date(String(obj["expiresAt"]))
|
|
908
|
+
};
|
|
909
|
+
const abs = obj["absoluteExpiresAt"];
|
|
910
|
+
if (typeof abs === "string")
|
|
911
|
+
record.absoluteExpiresAt = new Date(abs);
|
|
912
|
+
const meta = obj["metadata"];
|
|
913
|
+
if (meta && typeof meta === "object") {
|
|
914
|
+
record.metadata = meta;
|
|
915
|
+
}
|
|
916
|
+
return record;
|
|
917
|
+
} catch {
|
|
918
|
+
return null;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
#ttlSeconds(record) {
|
|
922
|
+
const now = Date.now();
|
|
923
|
+
const exp = record.expiresAt.getTime();
|
|
924
|
+
return Math.max(1, Math.floor((exp - now) / 1000));
|
|
925
|
+
}
|
|
926
|
+
async create(opts) {
|
|
927
|
+
const now = new Date;
|
|
928
|
+
const ttl = (opts.ttlSeconds ?? 60 * 60 * 24 * 7) * 1000;
|
|
929
|
+
const record = {
|
|
930
|
+
id: opts.id ?? randomId4(),
|
|
931
|
+
userId: null,
|
|
932
|
+
data: opts.data ?? {},
|
|
933
|
+
createdAt: now,
|
|
934
|
+
lastSeenAt: now,
|
|
935
|
+
expiresAt: new Date(now.getTime() + ttl)
|
|
936
|
+
};
|
|
937
|
+
if (opts.absoluteTtlSeconds) {
|
|
938
|
+
record.absoluteExpiresAt = new Date(now.getTime() + opts.absoluteTtlSeconds * 1000);
|
|
939
|
+
}
|
|
940
|
+
if (opts.userId !== undefined)
|
|
941
|
+
record.userId = opts.userId;
|
|
942
|
+
if (opts.metadata)
|
|
943
|
+
record.metadata = opts.metadata;
|
|
944
|
+
await this.#client.set(this.#key(record.id), this.#recordToJSON(record), {
|
|
945
|
+
ex: Math.max(1, Math.floor((record.expiresAt.getTime() - Date.now()) / 1000))
|
|
946
|
+
});
|
|
947
|
+
if (record.userId)
|
|
948
|
+
await this.#addToIndex(record.userId, record.id);
|
|
949
|
+
return record;
|
|
950
|
+
}
|
|
951
|
+
async read(id) {
|
|
952
|
+
const raw = await this.#client.get(this.#key(id));
|
|
953
|
+
if (raw === null)
|
|
954
|
+
return null;
|
|
955
|
+
const record = this.#recordFromJSON(raw);
|
|
956
|
+
if (!record)
|
|
957
|
+
return null;
|
|
958
|
+
if (record.absoluteExpiresAt && record.absoluteExpiresAt.getTime() <= Date.now()) {
|
|
959
|
+
await this.#client.del(this.#key(id));
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
return record;
|
|
963
|
+
}
|
|
964
|
+
async readMany(query) {
|
|
965
|
+
if (query?.userId) {
|
|
966
|
+
const idxKey = this.#indexKey(query.userId);
|
|
967
|
+
const idx = await this.#client.get(idxKey);
|
|
968
|
+
const ids = idx ? safeParseStringArray(idx) : [];
|
|
969
|
+
const out2 = [];
|
|
970
|
+
for (const id of ids) {
|
|
971
|
+
const r = await this.read(id);
|
|
972
|
+
if (r)
|
|
973
|
+
out2.push(r);
|
|
974
|
+
else if (query.metadata === undefined) {
|
|
975
|
+
await this.#removeFromIndex(query.userId, id);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
return applyPagination(out2, query);
|
|
979
|
+
}
|
|
980
|
+
const out = [];
|
|
981
|
+
let cursor = "0";
|
|
982
|
+
do {
|
|
983
|
+
const res = await this.#client.scan({
|
|
984
|
+
match: `${this.#keyPrefix}*`,
|
|
985
|
+
cursor,
|
|
986
|
+
count: 100
|
|
987
|
+
});
|
|
988
|
+
for (const k of res.keys) {
|
|
989
|
+
if (k.startsWith(`${this.#keyPrefix}user:`))
|
|
990
|
+
continue;
|
|
991
|
+
const id = k.startsWith(this.#keyPrefix) ? k.slice(this.#keyPrefix.length) : k;
|
|
992
|
+
const r = await this.read(id);
|
|
993
|
+
if (r)
|
|
994
|
+
out.push(r);
|
|
995
|
+
}
|
|
996
|
+
cursor = res.cursor;
|
|
997
|
+
} while (cursor !== "0" && cursor !== 0);
|
|
998
|
+
return applyPagination(out, query);
|
|
999
|
+
}
|
|
1000
|
+
async update(id, opts) {
|
|
1001
|
+
const existing = await this.read(id);
|
|
1002
|
+
if (!existing)
|
|
1003
|
+
return null;
|
|
1004
|
+
const next = {
|
|
1005
|
+
...existing,
|
|
1006
|
+
lastSeenAt: new Date
|
|
1007
|
+
};
|
|
1008
|
+
if (opts.dataPatch) {
|
|
1009
|
+
next.data = { ...existing.data, ...opts.dataPatch };
|
|
1010
|
+
}
|
|
1011
|
+
if (opts.extendSeconds !== undefined) {
|
|
1012
|
+
const newExpiry = Date.now() + opts.extendSeconds * 1000;
|
|
1013
|
+
if (!next.absoluteExpiresAt || newExpiry < next.absoluteExpiresAt.getTime()) {
|
|
1014
|
+
next.expiresAt = new Date(newExpiry);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
const userIdChanged = opts.userId !== undefined && opts.userId !== existing.userId;
|
|
1018
|
+
if (opts.userId !== undefined)
|
|
1019
|
+
next.userId = opts.userId;
|
|
1020
|
+
await this.#client.set(this.#key(id), this.#recordToJSON(next), {
|
|
1021
|
+
ex: this.#ttlSeconds(next)
|
|
1022
|
+
});
|
|
1023
|
+
if (userIdChanged) {
|
|
1024
|
+
await this.#removeFromIndex(existing.userId, id);
|
|
1025
|
+
}
|
|
1026
|
+
if (next.userId)
|
|
1027
|
+
await this.#addToIndex(next.userId, id);
|
|
1028
|
+
return next;
|
|
1029
|
+
}
|
|
1030
|
+
async destroy(id) {
|
|
1031
|
+
const existing = await this.read(id);
|
|
1032
|
+
if (!existing)
|
|
1033
|
+
return false;
|
|
1034
|
+
if (existing.userId)
|
|
1035
|
+
await this.#removeFromIndex(existing.userId, id);
|
|
1036
|
+
await this.#client.del(this.#key(id));
|
|
1037
|
+
return true;
|
|
1038
|
+
}
|
|
1039
|
+
async destroyMany(query) {
|
|
1040
|
+
const sessions = await this.readMany(query);
|
|
1041
|
+
for (const s of sessions)
|
|
1042
|
+
await this.destroy(s.id);
|
|
1043
|
+
return sessions.length;
|
|
1044
|
+
}
|
|
1045
|
+
async touch(id) {
|
|
1046
|
+
const existing = await this.read(id);
|
|
1047
|
+
if (!existing)
|
|
1048
|
+
return null;
|
|
1049
|
+
const next = {
|
|
1050
|
+
...existing,
|
|
1051
|
+
lastSeenAt: new Date,
|
|
1052
|
+
expiresAt: new Date(Date.now() + 60 * 60 * 24 * 7 * 1000)
|
|
1053
|
+
};
|
|
1054
|
+
await this.#client.set(this.#key(id), this.#recordToJSON(next), {
|
|
1055
|
+
ex: this.#ttlSeconds(next)
|
|
1056
|
+
});
|
|
1057
|
+
return next;
|
|
1058
|
+
}
|
|
1059
|
+
async gc() {
|
|
1060
|
+
let cursor = "0";
|
|
1061
|
+
let removed = 0;
|
|
1062
|
+
do {
|
|
1063
|
+
const res = await this.#client.scan({
|
|
1064
|
+
match: `${this.#keyPrefix}user:*`,
|
|
1065
|
+
cursor,
|
|
1066
|
+
count: 100
|
|
1067
|
+
});
|
|
1068
|
+
for (const k of res.keys) {
|
|
1069
|
+
const raw = await this.#client.get(this.#keyPrefix + k);
|
|
1070
|
+
const ids = raw ? safeParseStringArray(raw) : [];
|
|
1071
|
+
const live = [];
|
|
1072
|
+
for (const id of ids) {
|
|
1073
|
+
if (await this.read(id))
|
|
1074
|
+
live.push(id);
|
|
1075
|
+
}
|
|
1076
|
+
if (live.length === 0) {
|
|
1077
|
+
await this.#client.del(this.#keyPrefix + k);
|
|
1078
|
+
removed++;
|
|
1079
|
+
} else if (live.length !== ids.length) {
|
|
1080
|
+
await this.#client.set(this.#keyPrefix + k, JSON.stringify(live));
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
cursor = res.cursor;
|
|
1084
|
+
} while (cursor !== "0" && cursor !== 0);
|
|
1085
|
+
return removed;
|
|
1086
|
+
}
|
|
1087
|
+
async clear() {
|
|
1088
|
+
let cursor = "0";
|
|
1089
|
+
do {
|
|
1090
|
+
const res = await this.#client.scan({
|
|
1091
|
+
match: `${this.#keyPrefix}*`,
|
|
1092
|
+
cursor,
|
|
1093
|
+
count: 100
|
|
1094
|
+
});
|
|
1095
|
+
for (const k of res.keys) {
|
|
1096
|
+
await this.#client.del(this.#keyPrefix + k);
|
|
1097
|
+
}
|
|
1098
|
+
cursor = res.cursor;
|
|
1099
|
+
} while (cursor !== "0" && cursor !== 0);
|
|
1100
|
+
}
|
|
1101
|
+
async stop() {
|
|
1102
|
+
await this.#client.close();
|
|
1103
|
+
}
|
|
1104
|
+
async#addToIndex(userId, sessionId) {
|
|
1105
|
+
const k = this.#indexKey(userId);
|
|
1106
|
+
const raw = await this.#client.get(k);
|
|
1107
|
+
const ids = raw ? safeParseStringArray(raw) : [];
|
|
1108
|
+
if (!ids.includes(sessionId))
|
|
1109
|
+
ids.push(sessionId);
|
|
1110
|
+
await this.#client.set(k, JSON.stringify(ids));
|
|
1111
|
+
}
|
|
1112
|
+
async#removeFromIndex(userId, sessionId) {
|
|
1113
|
+
if (!userId)
|
|
1114
|
+
return;
|
|
1115
|
+
const k = this.#indexKey(userId);
|
|
1116
|
+
const raw = await this.#client.get(k);
|
|
1117
|
+
if (!raw)
|
|
1118
|
+
return;
|
|
1119
|
+
const ids = safeParseStringArray(raw).filter((id) => id !== sessionId);
|
|
1120
|
+
if (ids.length === 0) {
|
|
1121
|
+
await this.#client.del(k);
|
|
1122
|
+
} else {
|
|
1123
|
+
await this.#client.set(k, JSON.stringify(ids));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
class CloudflareKVSessionStorage extends RedisSessionStorage {
|
|
1129
|
+
name = "cloudflare-kv";
|
|
1130
|
+
}
|
|
1131
|
+
function randomId4(bytes = 24) {
|
|
1132
|
+
const arr = new Uint8Array(bytes);
|
|
1133
|
+
crypto.getRandomValues(arr);
|
|
1134
|
+
let s = "";
|
|
1135
|
+
for (const b of arr)
|
|
1136
|
+
s += String.fromCharCode(b);
|
|
1137
|
+
return btoa(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1138
|
+
}
|
|
1139
|
+
function safeParseStringArray(raw) {
|
|
1140
|
+
try {
|
|
1141
|
+
const v = JSON.parse(raw);
|
|
1142
|
+
return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
1143
|
+
} catch {
|
|
1144
|
+
return [];
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
function applyPagination(list, query) {
|
|
1148
|
+
if (!query)
|
|
1149
|
+
return list;
|
|
1150
|
+
const offset = query.offset ?? 0;
|
|
1151
|
+
const limit = query.limit ?? list.length;
|
|
1152
|
+
return list.slice(offset, offset + limit);
|
|
1153
|
+
}
|
|
1154
|
+
function crc32(s) {
|
|
1155
|
+
let c = 4294967295;
|
|
1156
|
+
for (let i = 0;i < s.length; i++) {
|
|
1157
|
+
c ^= s.charCodeAt(i);
|
|
1158
|
+
for (let k = 0;k < 8; k++) {
|
|
1159
|
+
c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return (c ^ 4294967295).toString(16);
|
|
1163
|
+
}
|
|
1164
|
+
// src/core/decorators/module.ts
|
|
1165
|
+
init_constants();
|
|
1166
|
+
import"reflect-metadata";
|
|
1167
|
+
function Module(options = {}) {
|
|
1168
|
+
return (target) => {
|
|
1169
|
+
Reflect.defineMetadata(METADATA_KEY.MODULE, options, target);
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function getModuleOptions(target) {
|
|
1173
|
+
return Reflect.getMetadata(METADATA_KEY.MODULE, target) ?? {};
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// src/core/decorators/index.ts
|
|
1177
|
+
init_controller();
|
|
1178
|
+
|
|
1179
|
+
// src/core/decorators/injectable.ts
|
|
1180
|
+
init_constants();
|
|
1181
|
+
import"reflect-metadata";
|
|
1182
|
+
function Injectable(options = {}) {
|
|
1183
|
+
return (target) => {
|
|
1184
|
+
Reflect.defineMetadata(METADATA_KEY.INJECTABLE, true, target);
|
|
1185
|
+
if (options.scope) {
|
|
1186
|
+
Reflect.defineMetadata("nexus:di:scope", options.scope, target);
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
function isInjectable(target) {
|
|
1191
|
+
return Reflect.hasMetadata(METADATA_KEY.INJECTABLE, target);
|
|
1192
|
+
}
|
|
1193
|
+
function getScope(target) {
|
|
1194
|
+
return Reflect.getMetadata("nexus:di:scope", target);
|
|
1195
|
+
}
|
|
1196
|
+
function Inject(token) {
|
|
1197
|
+
return (target, propertyKey, parameterIndex) => {
|
|
1198
|
+
const existing = Reflect.getMetadata(METADATA_KEY.INJECT, target) ?? new Map;
|
|
1199
|
+
existing.set(parameterIndex, token);
|
|
1200
|
+
Reflect.defineMetadata(METADATA_KEY.INJECT, existing, target);
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// src/core/decorators/index.ts
|
|
1205
|
+
init_http_methods();
|
|
1206
|
+
init_params();
|
|
1207
|
+
init_validate();
|
|
1208
|
+
|
|
1209
|
+
// src/core/decorators/repository.ts
|
|
1210
|
+
init_constants();
|
|
1211
|
+
import"reflect-metadata";
|
|
1212
|
+
function Repository(entityToken) {
|
|
1213
|
+
return (target) => {
|
|
1214
|
+
Reflect.defineMetadata(METADATA_KEY.REPOSITORY, { entity: entityToken }, target);
|
|
1215
|
+
Reflect.defineMetadata(METADATA_KEY.INJECTABLE, true, target);
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
function getRepositoryMetadata(target) {
|
|
1219
|
+
return Reflect.getMetadata(METADATA_KEY.REPOSITORY, target);
|
|
1220
|
+
}
|
|
1221
|
+
function isRepository(target) {
|
|
1222
|
+
return Reflect.hasMetadata(METADATA_KEY.REPOSITORY, target);
|
|
1223
|
+
}
|
|
1224
|
+
// src/core/decorators/metadata.ts
|
|
1225
|
+
init_constants();
|
|
1226
|
+
// src/session/session.service.ts
|
|
1227
|
+
class SessionService {
|
|
1228
|
+
config;
|
|
1229
|
+
static TOKEN = Symbol.for("nexus:SessionService");
|
|
1230
|
+
storage;
|
|
1231
|
+
#listeners = new Set;
|
|
1232
|
+
#memory = null;
|
|
1233
|
+
#cookie = null;
|
|
1234
|
+
constructor(config = {}) {
|
|
1235
|
+
this.config = config;
|
|
1236
|
+
this.storage = this.#createBackend(config);
|
|
1237
|
+
}
|
|
1238
|
+
async start() {
|
|
1239
|
+
if (this.#memory)
|
|
1240
|
+
this.#memory.start();
|
|
1241
|
+
}
|
|
1242
|
+
async stop() {
|
|
1243
|
+
if (this.#memory)
|
|
1244
|
+
await this.#memory.stop();
|
|
1245
|
+
if (this.storage.stop)
|
|
1246
|
+
await this.storage.stop();
|
|
1247
|
+
}
|
|
1248
|
+
async create(opts = {}) {
|
|
1249
|
+
const merged = {
|
|
1250
|
+
ttlSeconds: this.config.defaults?.ttlSeconds,
|
|
1251
|
+
absoluteTtlSeconds: this.config.defaults?.absoluteTtlSeconds,
|
|
1252
|
+
...opts
|
|
1253
|
+
};
|
|
1254
|
+
const record = await this.storage.create(merged);
|
|
1255
|
+
this.#emit({ kind: "session:created", id: record.id, userId: record.userId });
|
|
1256
|
+
return record;
|
|
1257
|
+
}
|
|
1258
|
+
async read(id) {
|
|
1259
|
+
const record = await this.storage.read(id);
|
|
1260
|
+
this.#emit({ kind: "session:read", id });
|
|
1261
|
+
return record;
|
|
1262
|
+
}
|
|
1263
|
+
async readMany(query) {
|
|
1264
|
+
return this.storage.readMany(query);
|
|
1265
|
+
}
|
|
1266
|
+
async update(id, opts) {
|
|
1267
|
+
const updated = await this.storage.update(id, opts);
|
|
1268
|
+
if (updated)
|
|
1269
|
+
this.#emit({ kind: "session:updated", id });
|
|
1270
|
+
return updated;
|
|
1271
|
+
}
|
|
1272
|
+
async destroy(id, reason = "logout") {
|
|
1273
|
+
const record = await this.storage.read(id);
|
|
1274
|
+
const ok = await this.storage.destroy(id);
|
|
1275
|
+
if (ok) {
|
|
1276
|
+
this.#emit({
|
|
1277
|
+
kind: "session:destroyed",
|
|
1278
|
+
id,
|
|
1279
|
+
userId: record?.userId ?? null,
|
|
1280
|
+
reason
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
return ok;
|
|
1284
|
+
}
|
|
1285
|
+
async destroyMany(query) {
|
|
1286
|
+
return this.storage.destroyMany(query);
|
|
1287
|
+
}
|
|
1288
|
+
async gc() {
|
|
1289
|
+
return this.storage.gc();
|
|
1290
|
+
}
|
|
1291
|
+
async clear() {
|
|
1292
|
+
await this.storage.clear();
|
|
1293
|
+
}
|
|
1294
|
+
buildSetCookie(record) {
|
|
1295
|
+
if (!this.#cookie)
|
|
1296
|
+
return null;
|
|
1297
|
+
return this.#cookie.buildSetCookie(record);
|
|
1298
|
+
}
|
|
1299
|
+
buildClearCookie() {
|
|
1300
|
+
if (!this.#cookie)
|
|
1301
|
+
return null;
|
|
1302
|
+
return this.#cookie.buildClearCookie();
|
|
1303
|
+
}
|
|
1304
|
+
get cookieName() {
|
|
1305
|
+
return this.#cookie?.cookieName ?? null;
|
|
1306
|
+
}
|
|
1307
|
+
decodeCookie(cookieValue) {
|
|
1308
|
+
if (!this.#cookie)
|
|
1309
|
+
return null;
|
|
1310
|
+
const record = this.#cookie.decode(cookieValue);
|
|
1311
|
+
if (!record)
|
|
1312
|
+
return null;
|
|
1313
|
+
if (record.expiresAt.getTime() <= Date.now()) {
|
|
1314
|
+
this.#emit({
|
|
1315
|
+
kind: "session:destroyed",
|
|
1316
|
+
id: record.id,
|
|
1317
|
+
userId: record.userId,
|
|
1318
|
+
reason: "expired"
|
|
1319
|
+
});
|
|
1320
|
+
return null;
|
|
1321
|
+
}
|
|
1322
|
+
return record;
|
|
1323
|
+
}
|
|
1324
|
+
static encodeCookie(record, secret) {
|
|
1325
|
+
return encodeSessionCookie(record, secret);
|
|
1326
|
+
}
|
|
1327
|
+
static decodeCookie(cookieValue, secret) {
|
|
1328
|
+
return decodeSessionCookie(cookieValue, secret);
|
|
1329
|
+
}
|
|
1330
|
+
on(listener) {
|
|
1331
|
+
this.#listeners.add(listener);
|
|
1332
|
+
return () => this.#listeners.delete(listener);
|
|
1333
|
+
}
|
|
1334
|
+
async rotate(id) {
|
|
1335
|
+
const old = await this.storage.read(id);
|
|
1336
|
+
if (!old)
|
|
1337
|
+
return null;
|
|
1338
|
+
const fresh = await this.storage.create({
|
|
1339
|
+
ttlSeconds: Math.max(60, Math.floor((old.expiresAt.getTime() - Date.now()) / 1000)),
|
|
1340
|
+
absoluteTtlSeconds: old.absoluteExpiresAt ? Math.max(60, Math.floor((old.absoluteExpiresAt.getTime() - Date.now()) / 1000)) : undefined,
|
|
1341
|
+
data: old.data,
|
|
1342
|
+
metadata: old.metadata
|
|
1343
|
+
});
|
|
1344
|
+
fresh.userId = old.userId;
|
|
1345
|
+
await this.storage.destroy(id);
|
|
1346
|
+
this.#emit({ kind: "session:rotated", oldId: id, newId: fresh.id });
|
|
1347
|
+
return fresh;
|
|
1348
|
+
}
|
|
1349
|
+
#createBackend(config) {
|
|
1350
|
+
switch (config.backend ?? "cookie") {
|
|
1351
|
+
case "memory": {
|
|
1352
|
+
const backend = new MemorySessionStorage({
|
|
1353
|
+
gcIntervalMs: config.memory?.gcIntervalMs,
|
|
1354
|
+
maxSessions: config.memory?.maxSessions
|
|
1355
|
+
});
|
|
1356
|
+
this.#memory = backend;
|
|
1357
|
+
return backend;
|
|
1358
|
+
}
|
|
1359
|
+
case "cookie": {
|
|
1360
|
+
if (!config.cookie) {
|
|
1361
|
+
throw new Error("[session] backend=cookie requires `cookie.secret` in config.");
|
|
1362
|
+
}
|
|
1363
|
+
const backend = new CookieSessionStorage(config.cookie);
|
|
1364
|
+
this.#cookie = backend;
|
|
1365
|
+
return backend;
|
|
1366
|
+
}
|
|
1367
|
+
case "redis": {
|
|
1368
|
+
if (!config.redis) {
|
|
1369
|
+
throw new Error("[session] backend=redis requires `redis` in config. " + "Provide `{ client: RedisClient, keyPrefix?: string }`. " + "Use `createRedisClient({ ... })` from `nexusjs/redis`.");
|
|
1370
|
+
}
|
|
1371
|
+
return new RedisSessionStorage(config.redis.client, {
|
|
1372
|
+
keyPrefix: config.redis.keyPrefix
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
case "cloudflare-kv": {
|
|
1376
|
+
if (!config.cloudflareKv) {
|
|
1377
|
+
throw new Error("[session] backend=cloudflare-kv requires `cloudflareKv` in config. " + "Provide `{ client: RedisClient, keyPrefix?: string }` where " + "`client` is a `CloudflareKVAdapter` from `nexusjs/redis`.");
|
|
1378
|
+
}
|
|
1379
|
+
return new CloudflareKVSessionStorage(config.cloudflareKv.client, {
|
|
1380
|
+
keyPrefix: config.cloudflareKv.keyPrefix
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
case "database": {
|
|
1384
|
+
if (!config.database) {
|
|
1385
|
+
throw new Error("[session] backend=database requires `database` in config. " + "Provide `{ db: DrizzleService, tableName?: string }`.");
|
|
1386
|
+
}
|
|
1387
|
+
const { DrizzleSessionStorage: DrizzleSessionStorage2 } = __toCommonJS(exports_drizzle);
|
|
1388
|
+
const backend = new DrizzleSessionStorage2({
|
|
1389
|
+
db: config.database.db,
|
|
1390
|
+
tableName: config.database.tableName
|
|
1391
|
+
});
|
|
1392
|
+
return backend;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
#emit(event) {
|
|
1397
|
+
for (const l of this.#listeners) {
|
|
1398
|
+
Promise.resolve(l(event));
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
SessionService = __legacyDecorateClassTS([
|
|
1403
|
+
Injectable(),
|
|
1404
|
+
__legacyDecorateParamTS(0, Inject("SESSION_CONFIG")),
|
|
1405
|
+
__legacyMetadataTS("design:paramtypes", [
|
|
1406
|
+
typeof SessionConfig === "undefined" ? Object : SessionConfig
|
|
1407
|
+
])
|
|
1408
|
+
], SessionService);
|
|
1409
|
+
// src/session/session.module.ts
|
|
1410
|
+
import"reflect-metadata";
|
|
1411
|
+
class SessionModule {
|
|
1412
|
+
static forRoot(config = {}) {
|
|
1413
|
+
class ConfiguredSessionModule {
|
|
1414
|
+
}
|
|
1415
|
+
ConfiguredSessionModule = __legacyDecorateClassTS([
|
|
1416
|
+
Module({
|
|
1417
|
+
providers: [
|
|
1418
|
+
SessionService,
|
|
1419
|
+
{ provide: SessionService.TOKEN, useExisting: SessionService },
|
|
1420
|
+
{ provide: "SESSION_CONFIG", useValue: config }
|
|
1421
|
+
],
|
|
1422
|
+
exports: [SessionService, SessionService.TOKEN]
|
|
1423
|
+
})
|
|
1424
|
+
], ConfiguredSessionModule);
|
|
1425
|
+
Object.defineProperty(ConfiguredSessionModule, "name", {
|
|
1426
|
+
value: "ConfiguredSessionModule"
|
|
1427
|
+
});
|
|
1428
|
+
return ConfiguredSessionModule;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
SessionModule = __legacyDecorateClassTS([
|
|
1432
|
+
Module({
|
|
1433
|
+
providers: [
|
|
1434
|
+
SessionService,
|
|
1435
|
+
{ provide: SessionService.TOKEN, useExisting: SessionService }
|
|
1436
|
+
],
|
|
1437
|
+
exports: [SessionService, SessionService.TOKEN]
|
|
1438
|
+
})
|
|
1439
|
+
], SessionModule);
|
|
1440
|
+
// src/session/decorators/current-session.ts
|
|
1441
|
+
init_params();
|
|
1442
|
+
init_constants();
|
|
1443
|
+
import"reflect-metadata";
|
|
1444
|
+
function Session(options = {}) {
|
|
1445
|
+
return createParamDecorator(PARAM_TYPES.USER, options);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
class UnauthenticatedError extends Error {
|
|
1449
|
+
status = 401;
|
|
1450
|
+
constructor(message = "Authentication required.") {
|
|
1451
|
+
super(message);
|
|
1452
|
+
this.name = "UnauthenticatedError";
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
class SessionForbiddenError extends Error {
|
|
1457
|
+
status = 403;
|
|
1458
|
+
constructor(message = "Insufficient permissions.") {
|
|
1459
|
+
super(message);
|
|
1460
|
+
this.name = "SessionForbiddenError";
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
// src/session/session-middleware.ts
|
|
1464
|
+
function sessionMiddleware(sessions, options = {}) {
|
|
1465
|
+
const cookieName = options.cookieName ?? "sid";
|
|
1466
|
+
return async (c, next) => {
|
|
1467
|
+
const cookie = c.req.header("cookie") ?? "";
|
|
1468
|
+
const escaped = cookieName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1469
|
+
const re = new RegExp(`(?:^|;\\s*)${escaped}=([^;]+)`);
|
|
1470
|
+
const match = cookie.match(re);
|
|
1471
|
+
if (match) {
|
|
1472
|
+
try {
|
|
1473
|
+
const record = sessions.decodeCookie(decodeURIComponent(match[1]));
|
|
1474
|
+
if (record) {
|
|
1475
|
+
c.set("nexus", { user: record });
|
|
1476
|
+
}
|
|
1477
|
+
} catch {}
|
|
1478
|
+
}
|
|
1479
|
+
await next();
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
export {
|
|
1483
|
+
sessionMiddleware,
|
|
1484
|
+
encodeSessionCookie,
|
|
1485
|
+
decodeSessionCookie,
|
|
1486
|
+
UnauthenticatedError,
|
|
1487
|
+
SessionService,
|
|
1488
|
+
SessionModule,
|
|
1489
|
+
SessionForbiddenError,
|
|
1490
|
+
Session,
|
|
1491
|
+
RedisSessionStorage,
|
|
1492
|
+
MemorySessionStorage,
|
|
1493
|
+
CookieSessionStorage,
|
|
1494
|
+
CloudflareKVSessionStorage
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
//# debugId=78B3D5568F05BB1064756E2164756E21
|
|
1498
|
+
//# sourceMappingURL=index.js.map
|