exisjs 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +2 -8
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +33 -44
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/exports.d.ts.map +1 -1
- package/dist/cli/commands/exports.js +5 -32
- package/dist/cli/commands/exports.js.map +1 -1
- package/dist/cli/commands/generate.d.ts +2 -13
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +27 -60
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +4 -4
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +2 -6
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/index.js +11 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/routes.d.ts.map +1 -1
- package/dist/cli/routes.js +20 -8
- package/dist/cli/routes.js.map +1 -1
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +7 -5
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +3 -2
- package/dist/config/env.js.map +1 -1
- package/dist/config/types.d.ts +7 -2
- package/dist/config/types.d.ts.map +1 -1
- package/dist/decorators/constants.d.ts +9 -2
- package/dist/decorators/constants.d.ts.map +1 -1
- package/dist/decorators/constants.js +3 -2
- package/dist/decorators/constants.js.map +1 -1
- package/dist/decorators/core/metadata.d.ts +31 -0
- package/dist/decorators/core/metadata.d.ts.map +1 -1
- package/dist/decorators/core/metadata.js +110 -1
- package/dist/decorators/core/metadata.js.map +1 -1
- package/dist/decorators/core.d.ts +19 -4
- package/dist/decorators/core.d.ts.map +1 -1
- package/dist/decorators/core.js +29 -4
- package/dist/decorators/core.js.map +1 -1
- package/dist/decorators/middleware.d.ts +17 -17
- package/dist/decorators/middleware.d.ts.map +1 -1
- package/dist/decorators/middleware.js +111 -208
- package/dist/decorators/middleware.js.map +1 -1
- package/dist/decorators/params.d.ts +54 -12
- package/dist/decorators/params.d.ts.map +1 -1
- package/dist/decorators/params.js +40 -20
- package/dist/decorators/params.js.map +1 -1
- package/dist/decorators/routing.d.ts +0 -2
- package/dist/decorators/routing.d.ts.map +1 -1
- package/dist/decorators/routing.js +3 -4
- package/dist/decorators/routing.js.map +1 -1
- package/dist/di/container.d.ts +5 -1
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +56 -8
- package/dist/di/container.js.map +1 -1
- package/dist/di/decorators.d.ts +30 -0
- package/dist/di/decorators.d.ts.map +1 -0
- package/dist/di/decorators.js +59 -0
- package/dist/di/decorators.js.map +1 -0
- package/dist/di/index.d.ts +1 -0
- package/dist/di/index.d.ts.map +1 -1
- package/dist/di/index.js +4 -1
- package/dist/di/index.js.map +1 -1
- package/dist/docs/ARCHITECTURE.md +46 -285
- package/dist/docs/BENCHMARKS.md +5 -5
- package/dist/docs/README.md +8 -11
- package/dist/docs/content/boundaries.mdx +151 -0
- package/dist/docs/content/cli/commands.mdx +66 -104
- package/dist/docs/content/cli/overview.mdx +37 -47
- package/dist/docs/content/cli/usage.mdx +29 -15
- package/dist/docs/content/decorators.mdx +142 -81
- package/dist/docs/content/installation.mdx +20 -1
- package/dist/docs/content/middleware.mdx +65 -291
- package/dist/docs/content/modules.mdx +22 -1
- package/dist/docs/content/providers.mdx +33 -1
- package/dist/docs/content/security.mdx +44 -246
- package/dist/docs/content/structure.mdx +227 -100
- package/dist/docs/content/validation.mdx +0 -17
- package/dist/docs/reference/decorators.mdx +34 -216
- package/dist/docs/reference/di.mdx +35 -11
- package/dist/docs/reference/logger.mdx +100 -0
- package/dist/docs/reference/middleware.mdx +41 -217
- package/dist/docs/reference/router.mdx +9 -9
- package/dist/docs/reference/validator.mdx +2 -5
- package/dist/error/errors.d.ts.map +1 -1
- package/dist/error/errors.js +19 -5
- package/dist/error/errors.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/start-server.js +10 -0
- package/dist/lib/start-server.js.map +1 -1
- package/dist/logger/index.d.ts +81 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +142 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/middleware/dedupe.d.ts +1 -1
- package/dist/middleware/dedupe.js +1 -1
- package/dist/middleware/middleware.d.ts +3 -5
- package/dist/middleware/middleware.d.ts.map +1 -1
- package/dist/middleware/middleware.js +2 -6
- package/dist/middleware/middleware.js.map +1 -1
- package/dist/middleware/rate-limit.d.ts +0 -2
- package/dist/middleware/rate-limit.d.ts.map +1 -1
- package/dist/middleware/rate-limit.js +2 -14
- package/dist/middleware/rate-limit.js.map +1 -1
- package/dist/module/index.d.ts +2 -0
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +3 -1
- package/dist/module/index.js.map +1 -1
- package/dist/plugin/manager.d.ts +1 -1
- package/dist/plugin/manager.d.ts.map +1 -1
- package/dist/plugin/manager.js +47 -0
- package/dist/plugin/manager.js.map +1 -1
- package/dist/router/{gateway.d.ts → boundary.d.ts} +21 -13
- package/dist/router/boundary.d.ts.map +1 -0
- package/dist/router/boundary.js +11 -0
- package/dist/router/boundary.js.map +1 -0
- package/dist/router/controller-registrar.d.ts.map +1 -1
- package/dist/router/controller-registrar.js +33 -6
- package/dist/router/controller-registrar.js.map +1 -1
- package/dist/router/index.d.ts +3 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +3 -7
- package/dist/router/index.js.map +1 -1
- package/dist/router/route-builder.d.ts +0 -28
- package/dist/router/route-builder.d.ts.map +1 -1
- package/dist/router/route-builder.js +2 -5
- package/dist/router/route-builder.js.map +1 -1
- package/dist/router/route-scanner.d.ts +1 -2
- package/dist/router/route-scanner.d.ts.map +1 -1
- package/dist/router/route-scanner.js +225 -203
- package/dist/router/route-scanner.js.map +1 -1
- package/dist/router/router.d.ts +4 -6
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/router.js +36 -72
- package/dist/router/router.js.map +1 -1
- package/dist/router/types.d.ts +2 -6
- package/dist/router/types.d.ts.map +1 -1
- package/dist/server/{bun-adapter.d.ts → adapters/bun-adapter.d.ts} +1 -1
- package/dist/server/adapters/bun-adapter.d.ts.map +1 -0
- package/dist/server/{bun-adapter.js → adapters/bun-adapter.js} +2 -24
- package/dist/server/adapters/bun-adapter.js.map +1 -0
- package/dist/server/{uws-adapter.d.ts → adapters/uws-adapter.d.ts} +1 -1
- package/dist/server/adapters/uws-adapter.d.ts.map +1 -0
- package/dist/server/{uws-adapter.js → adapters/uws-adapter.js} +1 -28
- package/dist/server/adapters/uws-adapter.js.map +1 -0
- package/dist/server/app.d.ts +10 -31
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/app.js +20 -135
- package/dist/server/app.js.map +1 -1
- package/dist/server/bootstrapper.d.ts +4 -15
- package/dist/server/bootstrapper.d.ts.map +1 -1
- package/dist/server/bootstrapper.js +30 -229
- package/dist/server/bootstrapper.js.map +1 -1
- package/dist/server/define.d.ts +2 -2
- package/dist/server/define.d.ts.map +1 -1
- package/dist/server/define.js +3 -3
- package/dist/server/define.js.map +1 -1
- package/dist/server/engines/bun-engine.d.ts +16 -0
- package/dist/server/engines/bun-engine.d.ts.map +1 -0
- package/dist/server/engines/bun-engine.js +41 -0
- package/dist/server/engines/bun-engine.js.map +1 -0
- package/dist/server/engines/engine.d.ts +16 -0
- package/dist/server/engines/engine.d.ts.map +1 -0
- package/dist/{queue/types.js → server/engines/engine.js} +1 -1
- package/dist/server/engines/engine.js.map +1 -0
- package/dist/server/engines/node-engine.d.ts +22 -0
- package/dist/server/engines/node-engine.d.ts.map +1 -0
- package/dist/server/engines/node-engine.js +130 -0
- package/dist/server/engines/node-engine.js.map +1 -0
- package/dist/server/engines/uws-engine.d.ts +16 -0
- package/dist/server/engines/uws-engine.d.ts.map +1 -0
- package/dist/server/engines/uws-engine.js +48 -0
- package/dist/server/engines/uws-engine.js.map +1 -0
- package/dist/server/request-handler.d.ts +0 -1
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/server/request-handler.js +74 -48
- package/dist/server/request-handler.js.map +1 -1
- package/dist/server/request.d.ts +0 -8
- package/dist/server/request.d.ts.map +1 -1
- package/dist/server/request.js +0 -16
- package/dist/server/request.js.map +1 -1
- package/dist/server/response.d.ts.map +1 -1
- package/dist/server/response.js +2 -1
- package/dist/server/response.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +0 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/time.d.ts +6 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +15 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/validator/index.d.ts +1 -7
- package/dist/validator/index.d.ts.map +1 -1
- package/dist/validator/index.js +1 -5
- package/dist/validator/index.js.map +1 -1
- package/dist/validator/tex-types.d.ts +15 -2
- package/dist/validator/tex-types.d.ts.map +1 -1
- package/dist/validator/tex-types.js +8 -0
- package/dist/validator/tex-types.js.map +1 -1
- package/dist/validator/tex.d.ts.map +1 -1
- package/dist/validator/tex.js +21 -2
- package/dist/validator/tex.js.map +1 -1
- package/package.json +9 -151
- package/dist/adapters/aws-lambda.d.ts +0 -21
- package/dist/adapters/aws-lambda.d.ts.map +0 -1
- package/dist/adapters/aws-lambda.js +0 -125
- package/dist/adapters/aws-lambda.js.map +0 -1
- package/dist/adapters/bun.d.ts +0 -9
- package/dist/adapters/bun.d.ts.map +0 -1
- package/dist/adapters/bun.js +0 -23
- package/dist/adapters/bun.js.map +0 -1
- package/dist/adapters/cloudflare.d.ts +0 -10
- package/dist/adapters/cloudflare.d.ts.map +0 -1
- package/dist/adapters/cloudflare.js +0 -22
- package/dist/adapters/cloudflare.js.map +0 -1
- package/dist/adapters/deno.d.ts +0 -7
- package/dist/adapters/deno.d.ts.map +0 -1
- package/dist/adapters/deno.js +0 -21
- package/dist/adapters/deno.js.map +0 -1
- package/dist/adapters/fastly.d.ts +0 -6
- package/dist/adapters/fastly.d.ts.map +0 -1
- package/dist/adapters/fastly.js +0 -20
- package/dist/adapters/fastly.js.map +0 -1
- package/dist/adapters/fetch.d.ts +0 -30
- package/dist/adapters/fetch.d.ts.map +0 -1
- package/dist/adapters/fetch.js +0 -119
- package/dist/adapters/fetch.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -9
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -28
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/netlify.d.ts +0 -8
- package/dist/adapters/netlify.d.ts.map +0 -1
- package/dist/adapters/netlify.js +0 -20
- package/dist/adapters/netlify.js.map +0 -1
- package/dist/adapters/vercel.d.ts +0 -17
- package/dist/adapters/vercel.d.ts.map +0 -1
- package/dist/adapters/vercel.js +0 -23
- package/dist/adapters/vercel.js.map +0 -1
- package/dist/auth/index.d.ts +0 -8
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -49
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/jwt.d.ts +0 -20
- package/dist/auth/jwt.d.ts.map +0 -1
- package/dist/auth/jwt.js +0 -59
- package/dist/auth/jwt.js.map +0 -1
- package/dist/auth/oauth/core.d.ts +0 -96
- package/dist/auth/oauth/core.d.ts.map +0 -1
- package/dist/auth/oauth/core.js +0 -203
- package/dist/auth/oauth/core.js.map +0 -1
- package/dist/auth/oauth/index.d.ts +0 -45
- package/dist/auth/oauth/index.d.ts.map +0 -1
- package/dist/auth/oauth/index.js +0 -64
- package/dist/auth/oauth/index.js.map +0 -1
- package/dist/auth/oauth/middleware.d.ts +0 -63
- package/dist/auth/oauth/middleware.d.ts.map +0 -1
- package/dist/auth/oauth/middleware.js +0 -164
- package/dist/auth/oauth/middleware.js.map +0 -1
- package/dist/auth/oauth/providers/custom.d.ts +0 -41
- package/dist/auth/oauth/providers/custom.d.ts.map +0 -1
- package/dist/auth/oauth/providers/custom.js +0 -204
- package/dist/auth/oauth/providers/custom.js.map +0 -1
- package/dist/auth/oauth/providers/discord.d.ts +0 -23
- package/dist/auth/oauth/providers/discord.d.ts.map +0 -1
- package/dist/auth/oauth/providers/discord.js +0 -130
- package/dist/auth/oauth/providers/discord.js.map +0 -1
- package/dist/auth/oauth/providers/facebook.d.ts +0 -28
- package/dist/auth/oauth/providers/facebook.d.ts.map +0 -1
- package/dist/auth/oauth/providers/facebook.js +0 -124
- package/dist/auth/oauth/providers/facebook.js.map +0 -1
- package/dist/auth/oauth/providers/github.d.ts +0 -25
- package/dist/auth/oauth/providers/github.d.ts.map +0 -1
- package/dist/auth/oauth/providers/github.js +0 -132
- package/dist/auth/oauth/providers/github.js.map +0 -1
- package/dist/auth/oauth/providers/google.d.ts +0 -23
- package/dist/auth/oauth/providers/google.d.ts.map +0 -1
- package/dist/auth/oauth/providers/google.js +0 -134
- package/dist/auth/oauth/providers/google.js.map +0 -1
- package/dist/auth/oauth/providers/microsoft.d.ts +0 -28
- package/dist/auth/oauth/providers/microsoft.d.ts.map +0 -1
- package/dist/auth/oauth/providers/microsoft.js +0 -136
- package/dist/auth/oauth/providers/microsoft.js.map +0 -1
- package/dist/auth/oauth/types.d.ts +0 -158
- package/dist/auth/oauth/types.d.ts.map +0 -1
- package/dist/auth/oauth/types.js +0 -4
- package/dist/auth/oauth/types.js.map +0 -1
- package/dist/auth/password.d.ts +0 -25
- package/dist/auth/password.d.ts.map +0 -1
- package/dist/auth/password.js +0 -93
- package/dist/auth/password.js.map +0 -1
- package/dist/auth/rbac.d.ts +0 -10
- package/dist/auth/rbac.d.ts.map +0 -1
- package/dist/auth/rbac.js +0 -34
- package/dist/auth/rbac.js.map +0 -1
- package/dist/auth/session.d.ts +0 -26
- package/dist/auth/session.d.ts.map +0 -1
- package/dist/auth/session.js +0 -134
- package/dist/auth/session.js.map +0 -1
- package/dist/cache/index.d.ts +0 -4
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -25
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/store.d.ts +0 -58
- package/dist/cache/store.d.ts.map +0 -1
- package/dist/cache/store.js +0 -298
- package/dist/cache/store.js.map +0 -1
- package/dist/cron/parser.d.ts +0 -2
- package/dist/cron/parser.d.ts.map +0 -1
- package/dist/cron/parser.js +0 -52
- package/dist/cron/parser.js.map +0 -1
- package/dist/cron/scheduler.d.ts +0 -23
- package/dist/cron/scheduler.d.ts.map +0 -1
- package/dist/cron/scheduler.js +0 -114
- package/dist/cron/scheduler.js.map +0 -1
- package/dist/database/adapters/mongodb.d.ts +0 -58
- package/dist/database/adapters/mongodb.d.ts.map +0 -1
- package/dist/database/adapters/mongodb.js +0 -264
- package/dist/database/adapters/mongodb.js.map +0 -1
- package/dist/database/adapters/mysql.d.ts +0 -27
- package/dist/database/adapters/mysql.d.ts.map +0 -1
- package/dist/database/adapters/mysql.js +0 -188
- package/dist/database/adapters/mysql.js.map +0 -1
- package/dist/database/adapters/postgres.d.ts +0 -28
- package/dist/database/adapters/postgres.d.ts.map +0 -1
- package/dist/database/adapters/postgres.js +0 -174
- package/dist/database/adapters/postgres.js.map +0 -1
- package/dist/database/adapters/sqlite.d.ts +0 -27
- package/dist/database/adapters/sqlite.d.ts.map +0 -1
- package/dist/database/adapters/sqlite.js +0 -149
- package/dist/database/adapters/sqlite.js.map +0 -1
- package/dist/database/index.d.ts +0 -42
- package/dist/database/index.d.ts.map +0 -1
- package/dist/database/index.js +0 -58
- package/dist/database/index.js.map +0 -1
- package/dist/database/manager.d.ts +0 -141
- package/dist/database/manager.d.ts.map +0 -1
- package/dist/database/manager.js +0 -337
- package/dist/database/manager.js.map +0 -1
- package/dist/database/migration.d.ts +0 -57
- package/dist/database/migration.d.ts.map +0 -1
- package/dist/database/migration.js +0 -329
- package/dist/database/migration.js.map +0 -1
- package/dist/database/query-builder.d.ts +0 -95
- package/dist/database/query-builder.d.ts.map +0 -1
- package/dist/database/query-builder.js +0 -404
- package/dist/database/query-builder.js.map +0 -1
- package/dist/database/sql/index.d.ts +0 -18
- package/dist/database/sql/index.d.ts.map +0 -1
- package/dist/database/sql/index.js +0 -74
- package/dist/database/sql/index.js.map +0 -1
- package/dist/database/sql/schema.d.ts +0 -38
- package/dist/database/sql/schema.d.ts.map +0 -1
- package/dist/database/sql/schema.js +0 -80
- package/dist/database/sql/schema.js.map +0 -1
- package/dist/database/synchronizer.d.ts +0 -12
- package/dist/database/synchronizer.d.ts.map +0 -1
- package/dist/database/synchronizer.js +0 -82
- package/dist/database/synchronizer.js.map +0 -1
- package/dist/database/types.d.ts +0 -184
- package/dist/database/types.d.ts.map +0 -1
- package/dist/database/types.js +0 -4
- package/dist/database/types.js.map +0 -1
- package/dist/dataloader/dataloader.d.ts +0 -23
- package/dist/dataloader/dataloader.d.ts.map +0 -1
- package/dist/dataloader/dataloader.js +0 -98
- package/dist/dataloader/dataloader.js.map +0 -1
- package/dist/dataloader/index.d.ts +0 -3
- package/dist/dataloader/index.d.ts.map +0 -1
- package/dist/dataloader/index.js +0 -19
- package/dist/dataloader/index.js.map +0 -1
- package/dist/dataloader/registry.d.ts +0 -17
- package/dist/dataloader/registry.d.ts.map +0 -1
- package/dist/dataloader/registry.js +0 -47
- package/dist/dataloader/registry.js.map +0 -1
- package/dist/dev/dep-graph.d.ts +0 -2
- package/dist/dev/dep-graph.d.ts.map +0 -1
- package/dist/dev/dep-graph.js +0 -111
- package/dist/dev/dep-graph.js.map +0 -1
- package/dist/dev/hot-reload.d.ts +0 -30
- package/dist/dev/hot-reload.d.ts.map +0 -1
- package/dist/dev/hot-reload.js +0 -262
- package/dist/dev/hot-reload.js.map +0 -1
- package/dist/docs/content/adapters.mdx +0 -199
- package/dist/docs/content/cache.mdx +0 -239
- package/dist/docs/content/circuit-breaker.mdx +0 -130
- package/dist/docs/content/cron.mdx +0 -109
- package/dist/docs/content/database.mdx +0 -278
- package/dist/docs/content/gateways.mdx +0 -376
- package/dist/docs/content/oauth.mdx +0 -179
- package/dist/docs/content/queues.mdx +0 -177
- package/dist/docs/content/rpc.mdx +0 -146
- package/dist/docs/content/sse.mdx +0 -159
- package/dist/docs/content/websockets.mdx +0 -289
- package/dist/docs/integrations/README.md +0 -23
- package/dist/docs/integrations/jwt.mdx +0 -151
- package/dist/docs/integrations/mongo.mdx +0 -183
- package/dist/docs/integrations/observability.mdx +0 -125
- package/dist/docs/integrations/openai.mdx +0 -108
- package/dist/docs/integrations/postgres.mdx +0 -190
- package/dist/docs/integrations/posthog.mdx +0 -122
- package/dist/docs/integrations/redis.mdx +0 -141
- package/dist/docs/integrations/resend.mdx +0 -117
- package/dist/docs/integrations/s3.mdx +0 -122
- package/dist/docs/integrations/swagger.mdx +0 -113
- package/dist/docs/reference/adapters.mdx +0 -130
- package/dist/docs/reference/auth.mdx +0 -183
- package/dist/docs/reference/cache.mdx +0 -132
- package/dist/docs/reference/circuit-breaker.mdx +0 -71
- package/dist/docs/reference/queue.mdx +0 -155
- package/dist/docs/reference/storage.mdx +0 -116
- package/dist/docs/reference/swagger.mdx +0 -132
- package/dist/integrations/drizzle.d.ts +0 -10
- package/dist/integrations/drizzle.d.ts.map +0 -1
- package/dist/integrations/drizzle.js +0 -34
- package/dist/integrations/drizzle.js.map +0 -1
- package/dist/integrations/jwt.d.ts +0 -12
- package/dist/integrations/jwt.d.ts.map +0 -1
- package/dist/integrations/jwt.js +0 -29
- package/dist/integrations/jwt.js.map +0 -1
- package/dist/integrations/mongodb.d.ts +0 -13
- package/dist/integrations/mongodb.d.ts.map +0 -1
- package/dist/integrations/mongodb.js +0 -48
- package/dist/integrations/mongodb.js.map +0 -1
- package/dist/integrations/mongoose.d.ts +0 -13
- package/dist/integrations/mongoose.d.ts.map +0 -1
- package/dist/integrations/mongoose.js +0 -84
- package/dist/integrations/mongoose.js.map +0 -1
- package/dist/integrations/openai.d.ts +0 -12
- package/dist/integrations/openai.d.ts.map +0 -1
- package/dist/integrations/openai.js +0 -47
- package/dist/integrations/openai.js.map +0 -1
- package/dist/integrations/postgres.d.ts +0 -13
- package/dist/integrations/postgres.d.ts.map +0 -1
- package/dist/integrations/postgres.js +0 -55
- package/dist/integrations/postgres.js.map +0 -1
- package/dist/integrations/posthog.d.ts +0 -13
- package/dist/integrations/posthog.d.ts.map +0 -1
- package/dist/integrations/posthog.js +0 -49
- package/dist/integrations/posthog.js.map +0 -1
- package/dist/integrations/prisma.d.ts +0 -10
- package/dist/integrations/prisma.d.ts.map +0 -1
- package/dist/integrations/prisma.js +0 -39
- package/dist/integrations/prisma.js.map +0 -1
- package/dist/integrations/redis.d.ts +0 -12
- package/dist/integrations/redis.d.ts.map +0 -1
- package/dist/integrations/redis.js +0 -48
- package/dist/integrations/redis.js.map +0 -1
- package/dist/integrations/resend.d.ts +0 -12
- package/dist/integrations/resend.d.ts.map +0 -1
- package/dist/integrations/resend.js +0 -47
- package/dist/integrations/resend.js.map +0 -1
- package/dist/integrations/s3.d.ts +0 -15
- package/dist/integrations/s3.d.ts.map +0 -1
- package/dist/integrations/s3.js +0 -60
- package/dist/integrations/s3.js.map +0 -1
- package/dist/integrations/supabase.d.ts +0 -13
- package/dist/integrations/supabase.d.ts.map +0 -1
- package/dist/integrations/supabase.js +0 -51
- package/dist/integrations/supabase.js.map +0 -1
- package/dist/middleware/cache.d.ts +0 -21
- package/dist/middleware/cache.d.ts.map +0 -1
- package/dist/middleware/cache.js +0 -156
- package/dist/middleware/cache.js.map +0 -1
- package/dist/observability/health.d.ts +0 -23
- package/dist/observability/health.d.ts.map +0 -1
- package/dist/observability/health.js +0 -49
- package/dist/observability/health.js.map +0 -1
- package/dist/observability/index.d.ts +0 -4
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js +0 -10
- package/dist/observability/index.js.map +0 -1
- package/dist/observability/metrics.d.ts +0 -6
- package/dist/observability/metrics.d.ts.map +0 -1
- package/dist/observability/metrics.js +0 -60
- package/dist/observability/metrics.js.map +0 -1
- package/dist/observability/otel.d.ts +0 -27
- package/dist/observability/otel.d.ts.map +0 -1
- package/dist/observability/otel.js +0 -45
- package/dist/observability/otel.js.map +0 -1
- package/dist/observability/prometheus.d.ts +0 -30
- package/dist/observability/prometheus.d.ts.map +0 -1
- package/dist/observability/prometheus.js +0 -31
- package/dist/observability/prometheus.js.map +0 -1
- package/dist/queue/client.d.ts +0 -13
- package/dist/queue/client.d.ts.map +0 -1
- package/dist/queue/client.js +0 -83
- package/dist/queue/client.js.map +0 -1
- package/dist/queue/drivers/MemoryDriver.d.ts +0 -21
- package/dist/queue/drivers/MemoryDriver.d.ts.map +0 -1
- package/dist/queue/drivers/MemoryDriver.js +0 -176
- package/dist/queue/drivers/MemoryDriver.js.map +0 -1
- package/dist/queue/drivers/RedisDriver.d.ts +0 -19
- package/dist/queue/drivers/RedisDriver.d.ts.map +0 -1
- package/dist/queue/drivers/RedisDriver.js +0 -130
- package/dist/queue/drivers/RedisDriver.js.map +0 -1
- package/dist/queue/index.d.ts +0 -18
- package/dist/queue/index.d.ts.map +0 -1
- package/dist/queue/index.js +0 -37
- package/dist/queue/index.js.map +0 -1
- package/dist/queue/manager.d.ts +0 -18
- package/dist/queue/manager.d.ts.map +0 -1
- package/dist/queue/manager.js +0 -59
- package/dist/queue/manager.js.map +0 -1
- package/dist/queue/types.d.ts +0 -55
- package/dist/queue/types.d.ts.map +0 -1
- package/dist/queue/types.js.map +0 -1
- package/dist/queue/worker.d.ts +0 -18
- package/dist/queue/worker.d.ts.map +0 -1
- package/dist/queue/worker.js +0 -176
- package/dist/queue/worker.js.map +0 -1
- package/dist/router/gateway.d.ts.map +0 -1
- package/dist/router/gateway.js +0 -11
- package/dist/router/gateway.js.map +0 -1
- package/dist/server/bun-adapter.d.ts.map +0 -1
- package/dist/server/bun-adapter.js.map +0 -1
- package/dist/server/sse.d.ts +0 -16
- package/dist/server/sse.d.ts.map +0 -1
- package/dist/server/sse.js +0 -51
- package/dist/server/sse.js.map +0 -1
- package/dist/server/uws-adapter.d.ts.map +0 -1
- package/dist/server/uws-adapter.js.map +0 -1
- package/dist/storage/index.d.ts +0 -15
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -7
- package/dist/storage/index.js.map +0 -1
- package/dist/swagger/index.d.ts +0 -9
- package/dist/swagger/index.d.ts.map +0 -1
- package/dist/swagger/index.js +0 -165
- package/dist/swagger/index.js.map +0 -1
- package/dist/threads/pool.d.ts +0 -14
- package/dist/threads/pool.d.ts.map +0 -1
- package/dist/threads/pool.js +0 -93
- package/dist/threads/pool.js.map +0 -1
- package/dist/threads/worker-runner.d.ts +0 -2
- package/dist/threads/worker-runner.d.ts.map +0 -1
- package/dist/threads/worker-runner.js +0 -71
- package/dist/threads/worker-runner.js.map +0 -1
- package/dist/validator/validator.d.ts +0 -360
- package/dist/validator/validator.d.ts.map +0 -1
- package/dist/validator/validator.js +0 -931
- package/dist/validator/validator.js.map +0 -1
- package/dist/websocket/orchestrator.d.ts +0 -11
- package/dist/websocket/orchestrator.d.ts.map +0 -1
- package/dist/websocket/orchestrator.js +0 -238
- package/dist/websocket/orchestrator.js.map +0 -1
- package/dist/websocket/server.d.ts +0 -66
- package/dist/websocket/server.d.ts.map +0 -1
- package/dist/websocket/server.js +0 -158
- package/dist/websocket/server.js.map +0 -1
- package/dist/websocket/socket.d.ts +0 -119
- package/dist/websocket/socket.d.ts.map +0 -1
- package/dist/websocket/socket.js +0 -242
- package/dist/websocket/socket.js.map +0 -1
|
@@ -46,7 +46,7 @@ class RouteScanner {
|
|
|
46
46
|
this.lazyRoutes = new Map();
|
|
47
47
|
this.routeMap = new Map();
|
|
48
48
|
this.apiDir = null;
|
|
49
|
-
this.
|
|
49
|
+
this.hasBoundaries = false;
|
|
50
50
|
this.globalParadigm = null;
|
|
51
51
|
}
|
|
52
52
|
async loadAllRoutes() {
|
|
@@ -98,7 +98,7 @@ class RouteScanner {
|
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
100
|
if (err.code !== 'ENOENT') {
|
|
101
|
-
|
|
101
|
+
this.app.log.warn({ err: err.message }, 'Failed to load routes manifest');
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -118,7 +118,7 @@ class RouteScanner {
|
|
|
118
118
|
const routerInstance = routeMod.router || routeMod.default || routeMod;
|
|
119
119
|
if (functionalControllerObj) {
|
|
120
120
|
if (this.globalParadigm === 'oop') {
|
|
121
|
-
|
|
121
|
+
this.app.log.error(`Mixed Paradigm Error: File ${filePath} uses a Functional controller, but the app is already using Class-Based (OOP) controllers. Please use a single paradigm for the entire project.`);
|
|
122
122
|
process.exit(1);
|
|
123
123
|
}
|
|
124
124
|
this.globalParadigm = 'functional';
|
|
@@ -127,7 +127,7 @@ class RouteScanner {
|
|
|
127
127
|
}
|
|
128
128
|
else if (isClassController(routerInstance)) {
|
|
129
129
|
if (this.globalParadigm === 'functional') {
|
|
130
|
-
|
|
130
|
+
this.app.log.error(`Mixed Paradigm Error: File ${filePath} uses a Class-Based (OOP) controller, but the app is already using Functional controllers. Please use a single paradigm for the entire project.`);
|
|
131
131
|
process.exit(1);
|
|
132
132
|
}
|
|
133
133
|
this.globalParadigm = 'oop';
|
|
@@ -173,18 +173,12 @@ class RouteScanner {
|
|
|
173
173
|
this.apiDir = appDirs[0] // keep property name for backwards compatibility
|
|
174
174
|
;
|
|
175
175
|
this._allApiDirs = appDirs;
|
|
176
|
-
const cc = {
|
|
177
|
-
green: '\x1b[32m',
|
|
178
|
-
cyan: '\x1b[36m',
|
|
179
|
-
gray: '\x1b[90m',
|
|
180
|
-
reset: '\x1b[0m',
|
|
181
|
-
};
|
|
182
176
|
for (const appDir of appDirs) {
|
|
183
177
|
const routes = await this.scanDirectory(appDir);
|
|
184
178
|
for (const { filePath, routePath } of routes) {
|
|
185
|
-
if (filePath.endsWith('
|
|
186
|
-
filePath.endsWith('
|
|
187
|
-
this.
|
|
179
|
+
if (filePath.endsWith('boundary.ts') ||
|
|
180
|
+
filePath.endsWith('boundary.js')) {
|
|
181
|
+
this.hasBoundaries = true;
|
|
188
182
|
}
|
|
189
183
|
if (filePath.endsWith('route.ts') || filePath.endsWith('route.js')) {
|
|
190
184
|
const normalized = path.resolve(filePath);
|
|
@@ -202,14 +196,6 @@ class RouteScanner {
|
|
|
202
196
|
this.app.getRouter().removeRoutesBySource('lazy:' + lazyKey);
|
|
203
197
|
try {
|
|
204
198
|
await this.mountRouteFile(normalized, routePath);
|
|
205
|
-
const relative = path
|
|
206
|
-
.relative(process.cwd(), normalized)
|
|
207
|
-
.replace(/\\/g, '/');
|
|
208
|
-
const now = new Date();
|
|
209
|
-
const h = String(now.getHours()).padStart(2, '0');
|
|
210
|
-
const m = String(now.getMinutes()).padStart(2, '0');
|
|
211
|
-
const s = String(now.getSeconds()).padStart(2, '0');
|
|
212
|
-
console.log(`${cc.gray}[${h}:${m}:${s}]${cc.reset} ${cc.green}HMR:${cc.reset} Lazy loaded ${cc.cyan}${relative}${cc.reset}`);
|
|
213
199
|
}
|
|
214
200
|
catch (err) {
|
|
215
201
|
(0, error_overlay_1.formatDevError)(err, normalized);
|
|
@@ -277,11 +263,10 @@ class RouteScanner {
|
|
|
277
263
|
const formatFiles = (files) => files
|
|
278
264
|
.map((f) => ` → ${path.relative(cwd, f).replace(/\\/g, '/')}`)
|
|
279
265
|
.join('\n');
|
|
280
|
-
|
|
281
|
-
`
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
`\x1b[33mFix: Choose one paradigm and update the files to match.\x1b[0m\n`);
|
|
266
|
+
this.app.log.error(`Mixed Paradigm Error: A project can only use one controller paradigm (OOP or Functional). Mixing them is not supported.\n\n` +
|
|
267
|
+
`Class-Based (OOP) controllers found in:\n${formatFiles(oopFiles)}\n\n` +
|
|
268
|
+
`Functional controllers found in:\n${formatFiles(functionalFiles)}\n\n` +
|
|
269
|
+
`Fix: Choose one paradigm and update the files to match.`);
|
|
285
270
|
process.exit(1);
|
|
286
271
|
}
|
|
287
272
|
if (oopFiles.length > 0)
|
|
@@ -289,78 +274,11 @@ class RouteScanner {
|
|
|
289
274
|
else if (functionalFiles.length > 0)
|
|
290
275
|
this.globalParadigm = 'functional';
|
|
291
276
|
}
|
|
292
|
-
if (!this.
|
|
293
|
-
|
|
277
|
+
if (!this.hasBoundaries && !isProd) {
|
|
278
|
+
this.app.log.warn('No boundary.ts found — applying default security headers.');
|
|
294
279
|
}
|
|
295
280
|
}
|
|
296
281
|
// ─── Route File Mounting (shared by autoMount and HotReloader) ──────────────
|
|
297
|
-
// ─── Auto-Mount File-Based Jobs ──────────────────────────────────────────────
|
|
298
|
-
async autoMountJobs(root) {
|
|
299
|
-
if (!this.app._queueWorker)
|
|
300
|
-
return;
|
|
301
|
-
const fs = await Promise.resolve().then(() => __importStar(require('node:fs/promises')));
|
|
302
|
-
const path = await Promise.resolve().then(() => __importStar(require('node:path')));
|
|
303
|
-
const isProd = process.env.NODE_ENV === 'production';
|
|
304
|
-
const searchDirs = isProd
|
|
305
|
-
? [
|
|
306
|
-
path.join(root, '.exis', 'server', 'src', 'jobs'),
|
|
307
|
-
path.join(root, 'dist', 'src', 'jobs'),
|
|
308
|
-
path.join(root, 'src', 'jobs'),
|
|
309
|
-
]
|
|
310
|
-
: [path.join(root, 'src', 'jobs')];
|
|
311
|
-
let jobsDir = '';
|
|
312
|
-
for (const dir of searchDirs) {
|
|
313
|
-
try {
|
|
314
|
-
const stat = await fs.stat(dir);
|
|
315
|
-
if (stat.isDirectory()) {
|
|
316
|
-
jobsDir = dir;
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
catch {
|
|
321
|
-
/* ignore */
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
if (!jobsDir)
|
|
325
|
-
return;
|
|
326
|
-
try {
|
|
327
|
-
const entries = await fs.readdir(jobsDir, { withFileTypes: true });
|
|
328
|
-
for (const entry of entries) {
|
|
329
|
-
if (entry.isFile() &&
|
|
330
|
-
(entry.name.endsWith('.ts') || entry.name.endsWith('.js'))) {
|
|
331
|
-
const filePath = path.join(jobsDir, entry.name);
|
|
332
|
-
const name = entry.name.replace(/\.(ts|js)$/, '');
|
|
333
|
-
try {
|
|
334
|
-
// Load the definition directly (no compilation needed here just to get the schema)
|
|
335
|
-
const mod = await Promise.resolve(`${filePath}`).then(s => __importStar(require(s)));
|
|
336
|
-
const jobDef = mod.default || mod;
|
|
337
|
-
if (jobDef) {
|
|
338
|
-
const def = {
|
|
339
|
-
name: jobDef.name || name,
|
|
340
|
-
filePath, // Attach filePath for Thread Pool execution
|
|
341
|
-
cron: jobDef.cron,
|
|
342
|
-
schema: jobDef.schema,
|
|
343
|
-
defaultOptions: jobDef.defaultOptions,
|
|
344
|
-
};
|
|
345
|
-
this.app._queueWorker.registerJob(def);
|
|
346
|
-
if (this.app._cronScheduler && jobDef.cron) {
|
|
347
|
-
this.app._cronScheduler.registerJob(def);
|
|
348
|
-
}
|
|
349
|
-
if (!process.env.__EXIS_IS_RESTART) {
|
|
350
|
-
this.app.log.info(`Registered background job: ${name}`);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
catch (err) {
|
|
355
|
-
this.app.log.error(`Failed to load job file ${filePath}: ${err}`);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
catch {
|
|
361
|
-
// Ignore if jobs directory does not exist
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
282
|
async mountRouteFile(filePath, routePath) {
|
|
365
283
|
let mod;
|
|
366
284
|
try {
|
|
@@ -395,7 +313,7 @@ class RouteScanner {
|
|
|
395
313
|
let allMetadata = {};
|
|
396
314
|
let allCors = undefined;
|
|
397
315
|
let allHeaders = {};
|
|
398
|
-
const
|
|
316
|
+
const activeBoundaries = [];
|
|
399
317
|
const dirsToCheck = [apiDir];
|
|
400
318
|
let tempDir = apiDir;
|
|
401
319
|
for (const segment of segments) {
|
|
@@ -404,78 +322,212 @@ class RouteScanner {
|
|
|
404
322
|
}
|
|
405
323
|
for (const dir of dirsToCheck) {
|
|
406
324
|
try {
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
let
|
|
410
|
-
if (await fs.stat(
|
|
411
|
-
|
|
412
|
-
else if (await fs.stat(
|
|
413
|
-
|
|
414
|
-
if (
|
|
415
|
-
|
|
416
|
-
this.
|
|
417
|
-
const
|
|
418
|
-
? (0, node_url_1.pathToFileURL)(
|
|
419
|
-
: (0, node_url_1.pathToFileURL)(
|
|
420
|
-
let
|
|
325
|
+
const boundaryPathTs = path.join(dir, 'boundary.ts');
|
|
326
|
+
const boundaryPathJs = path.join(dir, 'boundary.js');
|
|
327
|
+
let targetBoundary = '';
|
|
328
|
+
if (await fs.stat(boundaryPathTs).catch(() => null))
|
|
329
|
+
targetBoundary = boundaryPathTs;
|
|
330
|
+
else if (await fs.stat(boundaryPathJs).catch(() => null))
|
|
331
|
+
targetBoundary = boundaryPathJs;
|
|
332
|
+
if (targetBoundary) {
|
|
333
|
+
activeBoundaries.push(targetBoundary);
|
|
334
|
+
this.hasBoundaries = true;
|
|
335
|
+
const boundaryUrl = process.env.VITEST || process.env.NODE_ENV === 'test'
|
|
336
|
+
? (0, node_url_1.pathToFileURL)(targetBoundary).href
|
|
337
|
+
: (0, node_url_1.pathToFileURL)(targetBoundary).href + '?t=' + Date.now();
|
|
338
|
+
let boundaryMod;
|
|
421
339
|
try {
|
|
422
340
|
if (process.env.VITEST || process.env.NODE_ENV === 'test') {
|
|
423
|
-
|
|
341
|
+
boundaryMod = await Promise.resolve(`${boundaryUrl}`).then(s => __importStar(require(s)));
|
|
424
342
|
}
|
|
425
343
|
else {
|
|
426
|
-
const
|
|
427
|
-
|
|
344
|
+
const dynamicImportBoundary = new Function('specifier', 'return import(specifier)');
|
|
345
|
+
boundaryMod = await dynamicImportBoundary(boundaryUrl);
|
|
428
346
|
}
|
|
429
347
|
}
|
|
430
348
|
catch {
|
|
431
349
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
432
|
-
|
|
350
|
+
boundaryMod = require(targetBoundary);
|
|
433
351
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
352
|
+
// Extract config: check boundaryMod.config, boundaryMod.default, or boundaryMod itself
|
|
353
|
+
let boundaryConfig = null;
|
|
354
|
+
const BOUNDARY_CONFIG = Symbol.for('exisjs:boundary_config');
|
|
355
|
+
const boundaryDefault = boundaryMod && boundaryMod.default && boundaryMod.default.default
|
|
356
|
+
? boundaryMod.default.default
|
|
357
|
+
: boundaryMod && boundaryMod.default
|
|
358
|
+
? boundaryMod.default
|
|
359
|
+
: null;
|
|
360
|
+
if (boundaryMod &&
|
|
361
|
+
boundaryMod.config &&
|
|
362
|
+
typeof boundaryMod.config === 'object') {
|
|
363
|
+
boundaryConfig = boundaryMod.config;
|
|
364
|
+
}
|
|
365
|
+
else if (boundaryDefault &&
|
|
366
|
+
typeof boundaryDefault === 'function' &&
|
|
367
|
+
boundaryDefault.prototype &&
|
|
368
|
+
boundaryDefault.prototype[BOUNDARY_CONFIG]) {
|
|
369
|
+
// Class-based boundary with @Boundary
|
|
370
|
+
boundaryConfig = boundaryDefault.prototype[BOUNDARY_CONFIG];
|
|
371
|
+
}
|
|
372
|
+
else if (boundaryDefault && typeof boundaryDefault === 'object') {
|
|
373
|
+
boundaryConfig = boundaryDefault;
|
|
374
|
+
}
|
|
375
|
+
else if (boundaryMod && typeof boundaryMod === 'object') {
|
|
376
|
+
boundaryConfig = boundaryMod;
|
|
377
|
+
}
|
|
378
|
+
const isExcluded = (reqPath, reqMethod) => {
|
|
379
|
+
if (!boundaryConfig || !boundaryConfig.exclude)
|
|
380
|
+
return false;
|
|
381
|
+
for (const rule of boundaryConfig.exclude) {
|
|
382
|
+
if (typeof rule === 'string') {
|
|
383
|
+
if (rule.endsWith('/*')) {
|
|
384
|
+
if (reqPath.startsWith(rule.slice(0, -2)))
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
else if (reqPath === rule)
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
const pathMatch = rule.path.endsWith('/*')
|
|
392
|
+
? reqPath.startsWith(rule.path.slice(0, -2))
|
|
393
|
+
: reqPath === rule.path;
|
|
394
|
+
if (pathMatch) {
|
|
395
|
+
const methods = rule.methods || (rule.method ? [rule.method] : undefined);
|
|
396
|
+
if (!methods || methods.includes(reqMethod))
|
|
450
397
|
return true;
|
|
451
398
|
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return false;
|
|
402
|
+
};
|
|
403
|
+
// 1. Auto-detect named middleware functions: (req, res, next)
|
|
404
|
+
if (boundaryMod && typeof boundaryMod === 'object') {
|
|
405
|
+
for (const [exportKey, exportVal] of Object.entries(boundaryMod)) {
|
|
406
|
+
if (exportKey !== 'default' &&
|
|
407
|
+
exportKey !== 'config' &&
|
|
408
|
+
typeof exportVal === 'function' &&
|
|
409
|
+
exportVal.length >= 3 // (req, res, next)
|
|
410
|
+
) {
|
|
411
|
+
const namedMiddleware = (req, res, next) => isExcluded(req.path, req.method)
|
|
412
|
+
? next()
|
|
413
|
+
: exportVal(req, res, next);
|
|
414
|
+
allMiddlewares.push(namedMiddleware);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
// 2. Auto-detect pipeline wrapper function: export default async function(ctx, next)
|
|
419
|
+
// or class method named `handle(ctx, next)`
|
|
420
|
+
let wrapperFn = null;
|
|
421
|
+
if (boundaryDefault &&
|
|
422
|
+
typeof boundaryDefault === 'function' &&
|
|
423
|
+
boundaryDefault.length === 2 &&
|
|
424
|
+
!boundaryDefault.prototype?.[BOUNDARY_CONFIG]) {
|
|
425
|
+
wrapperFn = boundaryDefault;
|
|
426
|
+
}
|
|
427
|
+
else if (boundaryDefault &&
|
|
428
|
+
typeof boundaryDefault === 'function' &&
|
|
429
|
+
boundaryDefault.prototype &&
|
|
430
|
+
boundaryDefault.prototype[BOUNDARY_CONFIG]) {
|
|
431
|
+
const proto = boundaryDefault.prototype;
|
|
432
|
+
if (typeof proto.handle === 'function') {
|
|
433
|
+
const boundaryInstance = new boundaryDefault();
|
|
434
|
+
wrapperFn = proto.handle.bind(boundaryInstance);
|
|
435
|
+
}
|
|
436
|
+
// Also inspect method middlewares on class boundary
|
|
437
|
+
for (const prop of Object.getOwnPropertyNames(proto)) {
|
|
438
|
+
if (prop !== 'constructor' && prop !== 'handle') {
|
|
439
|
+
const methodVal = proto[prop];
|
|
440
|
+
if (typeof methodVal === 'function' && methodVal.length >= 3) {
|
|
441
|
+
const boundaryInstance = new boundaryDefault();
|
|
442
|
+
const namedMiddleware = (req, res, next) => isExcluded(req.path, req.method)
|
|
443
|
+
? next()
|
|
444
|
+
: methodVal.call(boundaryInstance, req, res, next);
|
|
445
|
+
allMiddlewares.push(namedMiddleware);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (wrapperFn) {
|
|
451
|
+
const capturedWrapper = wrapperFn;
|
|
452
|
+
const wrapperMiddleware = (req, res, next) => {
|
|
453
|
+
if (isExcluded(req.path, req.method))
|
|
454
|
+
return next();
|
|
455
|
+
let nextCalled = false;
|
|
456
|
+
let nextResolve;
|
|
457
|
+
let _nextReject;
|
|
458
|
+
const nextPromise = new Promise((resolve, reject) => {
|
|
459
|
+
nextResolve = resolve;
|
|
460
|
+
_nextReject = reject;
|
|
461
|
+
});
|
|
462
|
+
// Intercept response methods to catch handler return values
|
|
463
|
+
const originalJson = res.json.bind(res);
|
|
464
|
+
const originalSend = res.send.bind(res);
|
|
465
|
+
let handledByRoute = false;
|
|
466
|
+
res.json = function (body) {
|
|
467
|
+
if (!handledByRoute) {
|
|
468
|
+
handledByRoute = true;
|
|
469
|
+
nextResolve(body);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
return originalJson(body);
|
|
473
|
+
}
|
|
474
|
+
return this;
|
|
475
|
+
};
|
|
476
|
+
res.send = function (body) {
|
|
477
|
+
if (!handledByRoute) {
|
|
478
|
+
handledByRoute = true;
|
|
479
|
+
nextResolve(body);
|
|
480
|
+
}
|
|
452
481
|
else {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
482
|
+
return originalSend(body);
|
|
483
|
+
}
|
|
484
|
+
return this;
|
|
485
|
+
};
|
|
486
|
+
const ctx = {
|
|
487
|
+
req,
|
|
488
|
+
res,
|
|
489
|
+
app: this.app,
|
|
490
|
+
resolve: (token) => this.app.resolve(token, req._diCache),
|
|
491
|
+
};
|
|
492
|
+
capturedWrapper(ctx, async () => {
|
|
493
|
+
if (!nextCalled) {
|
|
494
|
+
nextCalled = true;
|
|
495
|
+
next();
|
|
496
|
+
}
|
|
497
|
+
return nextPromise;
|
|
498
|
+
})
|
|
499
|
+
.then((wrapperResult) => {
|
|
500
|
+
if (wrapperResult !== undefined && !res.headersSent) {
|
|
501
|
+
if (typeof wrapperResult === 'object' &&
|
|
502
|
+
wrapperResult !== null) {
|
|
503
|
+
originalJson(wrapperResult);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
originalSend(String(wrapperResult));
|
|
460
507
|
}
|
|
461
508
|
}
|
|
462
|
-
}
|
|
463
|
-
|
|
509
|
+
})
|
|
510
|
+
.catch((wrapperErr) => {
|
|
511
|
+
next(wrapperErr);
|
|
512
|
+
});
|
|
464
513
|
};
|
|
465
|
-
|
|
466
|
-
|
|
514
|
+
allMiddlewares.push(wrapperMiddleware);
|
|
515
|
+
}
|
|
516
|
+
if (boundaryConfig) {
|
|
517
|
+
if (boundaryConfig.middleware) {
|
|
518
|
+
const wrapped = boundaryConfig.middleware.map((m) => (req, res, next) => isExcluded(req.path, req.method) ? next() : m(req, res, next));
|
|
467
519
|
allMiddlewares.push(...wrapped);
|
|
468
520
|
}
|
|
469
|
-
if (
|
|
470
|
-
const wrapped =
|
|
521
|
+
if (boundaryConfig.filters) {
|
|
522
|
+
const wrapped = boundaryConfig.filters.map((f) => (err, req, res, next) => isExcluded(req.path, req.method)
|
|
471
523
|
? next(err)
|
|
472
524
|
: f.prototype && f.prototype.catch
|
|
473
525
|
? new f().catch(err, req, res, next)
|
|
474
526
|
: f(err, req, res, next));
|
|
475
527
|
allFilters.push(...wrapped);
|
|
476
528
|
}
|
|
477
|
-
if (
|
|
478
|
-
const wrapped =
|
|
529
|
+
if (boundaryConfig.guards) {
|
|
530
|
+
const wrapped = boundaryConfig.guards.map((g) => {
|
|
479
531
|
return async (req) => {
|
|
480
532
|
if (isExcluded(req.path, req.method))
|
|
481
533
|
return true;
|
|
@@ -488,8 +540,8 @@ class RouteScanner {
|
|
|
488
540
|
});
|
|
489
541
|
allGuards.push(...wrapped);
|
|
490
542
|
}
|
|
491
|
-
if (
|
|
492
|
-
const wrapped =
|
|
543
|
+
if (boundaryConfig.interceptors) {
|
|
544
|
+
const wrapped = boundaryConfig.interceptors.map((i) => {
|
|
493
545
|
return async (req, res) => {
|
|
494
546
|
if (isExcluded(req.path, req.method))
|
|
495
547
|
return;
|
|
@@ -502,8 +554,8 @@ class RouteScanner {
|
|
|
502
554
|
});
|
|
503
555
|
allInterceptors.push(...wrapped);
|
|
504
556
|
}
|
|
505
|
-
if (
|
|
506
|
-
const baseTimeout =
|
|
557
|
+
if (boundaryConfig.timeout !== undefined) {
|
|
558
|
+
const baseTimeout = boundaryConfig.timeout;
|
|
507
559
|
const timeoutMiddleware = (req, res, next) => {
|
|
508
560
|
if (isExcluded(req.path, req.method))
|
|
509
561
|
return next();
|
|
@@ -528,28 +580,28 @@ class RouteScanner {
|
|
|
528
580
|
};
|
|
529
581
|
allMiddlewares.push(timeoutMiddleware);
|
|
530
582
|
}
|
|
531
|
-
if (
|
|
532
|
-
allMetadata = { ...allMetadata, ...
|
|
583
|
+
if (boundaryConfig.metadata) {
|
|
584
|
+
allMetadata = { ...allMetadata, ...boundaryConfig.metadata };
|
|
533
585
|
}
|
|
534
|
-
if (
|
|
535
|
-
allCors =
|
|
536
|
-
if (
|
|
537
|
-
allHeaders = { ...allHeaders, ...
|
|
538
|
-
if (
|
|
539
|
-
for (const plugin of
|
|
586
|
+
if (boundaryConfig.cors !== undefined)
|
|
587
|
+
allCors = boundaryConfig.cors;
|
|
588
|
+
if (boundaryConfig.headers)
|
|
589
|
+
allHeaders = { ...allHeaders, ...boundaryConfig.headers };
|
|
590
|
+
if (boundaryConfig.plugins) {
|
|
591
|
+
for (const plugin of boundaryConfig.plugins) {
|
|
540
592
|
await this.app.pluginManager.register(plugin);
|
|
541
593
|
}
|
|
542
594
|
}
|
|
543
|
-
if (
|
|
544
|
-
for (const mod of
|
|
595
|
+
if (boundaryConfig.imports) {
|
|
596
|
+
for (const mod of boundaryConfig.imports) {
|
|
545
597
|
const name = 'plugin' in mod ? mod.plugin.name : mod.name;
|
|
546
598
|
if (!this.app.pluginManager.hasPlugin(name)) {
|
|
547
599
|
await this.app.pluginManager.register(mod);
|
|
548
600
|
}
|
|
549
601
|
}
|
|
550
602
|
}
|
|
551
|
-
if (
|
|
552
|
-
for (const [token, providerConfig] of
|
|
603
|
+
if (boundaryConfig.providers) {
|
|
604
|
+
for (const [token, providerConfig] of boundaryConfig.providers) {
|
|
553
605
|
this.app.container.provide(token, providerConfig);
|
|
554
606
|
}
|
|
555
607
|
}
|
|
@@ -570,7 +622,7 @@ class RouteScanner {
|
|
|
570
622
|
...(isControllerObj ? currentMod : {}),
|
|
571
623
|
...(mod.config || {}),
|
|
572
624
|
};
|
|
573
|
-
// Fallback to global app.options.cors if neither
|
|
625
|
+
// Fallback to global app.options.cors if neither boundary nor route specify it
|
|
574
626
|
if (routeConfig.cors !== undefined)
|
|
575
627
|
allCors = routeConfig.cors;
|
|
576
628
|
else if (allCors === undefined && this.app.options.cors !== undefined)
|
|
@@ -586,7 +638,7 @@ class RouteScanner {
|
|
|
586
638
|
await this.app.pluginManager.register(plugin);
|
|
587
639
|
}
|
|
588
640
|
}
|
|
589
|
-
// Pass
|
|
641
|
+
// Pass boundary features to controllers via metadata if necessary
|
|
590
642
|
const combinedFilters = [
|
|
591
643
|
...allFilters,
|
|
592
644
|
...(routeConfig.filters
|
|
@@ -640,13 +692,13 @@ class RouteScanner {
|
|
|
640
692
|
const relFile = pathLib
|
|
641
693
|
.relative(process.cwd(), filePath)
|
|
642
694
|
.replace(/\\/g, '/');
|
|
643
|
-
const
|
|
644
|
-
?
|
|
695
|
+
const boundaryStr = activeBoundaries.length > 0
|
|
696
|
+
? activeBoundaries
|
|
645
697
|
.map((g) => pathLib.relative(process.cwd(), g).replace(/\\/g, '/'))
|
|
646
698
|
.join(' -> ') + ' -> '
|
|
647
699
|
: '';
|
|
648
700
|
prefixMiddlewares.push((req, res, next) => {
|
|
649
|
-
this.app.log.debug(`[Request] ${req.method} ${req.path} -> ${
|
|
701
|
+
this.app.log.debug(`[Request] ${req.method} ${req.path} -> ${boundaryStr}${relFile}`);
|
|
650
702
|
next();
|
|
651
703
|
});
|
|
652
704
|
}
|
|
@@ -675,7 +727,7 @@ class RouteScanner {
|
|
|
675
727
|
const functionalControllerObj = unwrappedMod && unwrappedMod.__isController ? unwrappedMod : null;
|
|
676
728
|
if (functionalControllerObj) {
|
|
677
729
|
if (this.globalParadigm === 'oop') {
|
|
678
|
-
|
|
730
|
+
this.app.log.error(`Mixed Paradigm Error: File ${filePath} uses a Functional controller, but the app is already using Class-Based (OOP) controllers. Please use a single paradigm for the entire project.`);
|
|
679
731
|
process.exit(1);
|
|
680
732
|
}
|
|
681
733
|
this.globalParadigm = 'functional';
|
|
@@ -688,7 +740,7 @@ class RouteScanner {
|
|
|
688
740
|
}
|
|
689
741
|
else if (unwrappedMod && isController(unwrappedMod)) {
|
|
690
742
|
if (this.globalParadigm === 'functional') {
|
|
691
|
-
|
|
743
|
+
this.app.log.error(`Mixed Paradigm Error: File ${filePath} uses a Class-Based (OOP) controller, but the app is already using Functional controllers. Please use a single paradigm for the entire project.`);
|
|
692
744
|
process.exit(1);
|
|
693
745
|
}
|
|
694
746
|
this.globalParadigm = 'oop';
|
|
@@ -884,43 +936,13 @@ class RouteScanner {
|
|
|
884
936
|
if (Object.keys(combinedMetadata).length > 0) {
|
|
885
937
|
schema.metadata = combinedMetadata;
|
|
886
938
|
}
|
|
887
|
-
if (
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
const ctx = {
|
|
891
|
-
body: rawReq.body,
|
|
892
|
-
query: rawReq.query,
|
|
893
|
-
params: rawReq.params,
|
|
894
|
-
headers: rawReq.headers,
|
|
895
|
-
req: rawReq,
|
|
896
|
-
res: undefined, // Res is not available in standard SSE after handshake
|
|
897
|
-
app: this.app,
|
|
898
|
-
resolve: (token) => this.app.resolve(token, rawReq._diCache),
|
|
899
|
-
stream,
|
|
900
|
-
...rawReq,
|
|
901
|
-
};
|
|
902
|
-
await rc.handle(ctx);
|
|
903
|
-
}
|
|
904
|
-
catch (err) {
|
|
905
|
-
if (onError) {
|
|
906
|
-
await onError(err, rawReq, {});
|
|
907
|
-
}
|
|
908
|
-
else {
|
|
909
|
-
console.error('[Exis SSE Error]', err);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
router.sse(rc.path, ...routeMiddlewares, sseHandler);
|
|
939
|
+
if (Object.keys(schema).length > 0) {
|
|
940
|
+
;
|
|
941
|
+
router[method](rc.path, ...routeMiddlewares, schema, superHandler);
|
|
914
942
|
}
|
|
915
943
|
else {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
router[method](rc.path, ...routeMiddlewares, schema, superHandler);
|
|
919
|
-
}
|
|
920
|
-
else {
|
|
921
|
-
;
|
|
922
|
-
router[method](rc.path, ...routeMiddlewares, superHandler);
|
|
923
|
-
}
|
|
944
|
+
;
|
|
945
|
+
router[method](rc.path, ...routeMiddlewares, superHandler);
|
|
924
946
|
}
|
|
925
947
|
}
|
|
926
948
|
return router;
|