nitrostack 1.0.83 → 1.0.85
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 +1 -1
- package/README.md +42 -137
- package/assets/gif/nitrocli.gif +0 -0
- package/assets/gif/nitrostudio-chat.gif +0 -0
- package/assets/gif/nitrostudio-main.gif +0 -0
- package/assets/gif/nitrostudio-testing.gif +0 -0
- package/package.json +15 -50
- package/dist/auth/__tests__/api-key.test.d.ts +0 -2
- package/dist/auth/__tests__/api-key.test.d.ts.map +0 -1
- package/dist/auth/__tests__/api-key.test.js +0 -156
- package/dist/auth/__tests__/api-key.test.js.map +0 -1
- package/dist/auth/__tests__/client.test.d.ts +0 -2
- package/dist/auth/__tests__/client.test.d.ts.map +0 -1
- package/dist/auth/__tests__/client.test.js +0 -173
- package/dist/auth/__tests__/client.test.js.map +0 -1
- package/dist/auth/__tests__/middleware.test.d.ts +0 -2
- package/dist/auth/__tests__/middleware.test.d.ts.map +0 -1
- package/dist/auth/__tests__/middleware.test.js +0 -232
- package/dist/auth/__tests__/middleware.test.js.map +0 -1
- package/dist/auth/__tests__/pkce.test.d.ts +0 -2
- package/dist/auth/__tests__/pkce.test.d.ts.map +0 -1
- package/dist/auth/__tests__/pkce.test.js +0 -110
- package/dist/auth/__tests__/pkce.test.js.map +0 -1
- package/dist/auth/__tests__/quick-setup.test.d.ts +0 -2
- package/dist/auth/__tests__/quick-setup.test.d.ts.map +0 -1
- package/dist/auth/__tests__/quick-setup.test.js +0 -95
- package/dist/auth/__tests__/quick-setup.test.js.map +0 -1
- package/dist/auth/__tests__/secure-secret.test.d.ts +0 -2
- package/dist/auth/__tests__/secure-secret.test.d.ts.map +0 -1
- package/dist/auth/__tests__/secure-secret.test.js +0 -104
- package/dist/auth/__tests__/secure-secret.test.js.map +0 -1
- package/dist/auth/__tests__/server-integration.test.d.ts +0 -2
- package/dist/auth/__tests__/server-integration.test.d.ts.map +0 -1
- package/dist/auth/__tests__/server-integration.test.js +0 -156
- package/dist/auth/__tests__/server-integration.test.js.map +0 -1
- package/dist/auth/__tests__/server-metadata.test.d.ts +0 -2
- package/dist/auth/__tests__/server-metadata.test.d.ts.map +0 -1
- package/dist/auth/__tests__/server-metadata.test.js +0 -72
- package/dist/auth/__tests__/server-metadata.test.js.map +0 -1
- package/dist/auth/__tests__/simple-jwt.test.d.ts +0 -2
- package/dist/auth/__tests__/simple-jwt.test.d.ts.map +0 -1
- package/dist/auth/__tests__/simple-jwt.test.js +0 -125
- package/dist/auth/__tests__/simple-jwt.test.js.map +0 -1
- package/dist/auth/__tests__/token-store.test.d.ts +0 -2
- package/dist/auth/__tests__/token-store.test.d.ts.map +0 -1
- package/dist/auth/__tests__/token-store.test.js +0 -167
- package/dist/auth/__tests__/token-store.test.js.map +0 -1
- package/dist/auth/__tests__/token-validation.test.d.ts +0 -2
- package/dist/auth/__tests__/token-validation.test.d.ts.map +0 -1
- package/dist/auth/__tests__/token-validation.test.js +0 -219
- package/dist/auth/__tests__/token-validation.test.js.map +0 -1
- package/dist/auth/api-key.d.ts +0 -118
- package/dist/auth/api-key.d.ts.map +0 -1
- package/dist/auth/api-key.js +0 -168
- package/dist/auth/api-key.js.map +0 -1
- package/dist/auth/client.d.ts +0 -151
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/client.js +0 -330
- package/dist/auth/client.js.map +0 -1
- package/dist/auth/index.d.ts +0 -31
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -46
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/middleware.d.ts +0 -95
- package/dist/auth/middleware.d.ts.map +0 -1
- package/dist/auth/middleware.js +0 -260
- package/dist/auth/middleware.js.map +0 -1
- package/dist/auth/pkce.d.ts +0 -53
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js +0 -105
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/quick-setup.d.ts +0 -94
- package/dist/auth/quick-setup.d.ts.map +0 -1
- package/dist/auth/quick-setup.js +0 -210
- package/dist/auth/quick-setup.js.map +0 -1
- package/dist/auth/secure-secret.d.ts +0 -136
- package/dist/auth/secure-secret.d.ts.map +0 -1
- package/dist/auth/secure-secret.js +0 -182
- package/dist/auth/secure-secret.js.map +0 -1
- package/dist/auth/server-integration.d.ts +0 -97
- package/dist/auth/server-integration.d.ts.map +0 -1
- package/dist/auth/server-integration.js +0 -182
- package/dist/auth/server-integration.js.map +0 -1
- package/dist/auth/server-metadata.d.ts +0 -51
- package/dist/auth/server-metadata.d.ts.map +0 -1
- package/dist/auth/server-metadata.js +0 -106
- package/dist/auth/server-metadata.js.map +0 -1
- package/dist/auth/simple-jwt.d.ts +0 -174
- package/dist/auth/simple-jwt.d.ts.map +0 -1
- package/dist/auth/simple-jwt.js +0 -162
- package/dist/auth/simple-jwt.js.map +0 -1
- package/dist/auth/token-store.d.ts +0 -104
- package/dist/auth/token-store.d.ts.map +0 -1
- package/dist/auth/token-store.js +0 -205
- package/dist/auth/token-store.js.map +0 -1
- package/dist/auth/token-validation.d.ts +0 -59
- package/dist/auth/token-validation.d.ts.map +0 -1
- package/dist/auth/token-validation.js +0 -241
- package/dist/auth/token-validation.js.map +0 -1
- package/dist/auth/types.d.ts +0 -215
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -6
- package/dist/auth/types.js.map +0 -1
- package/dist/core/__tests__/app-decorator.test.d.ts +0 -2
- package/dist/core/__tests__/app-decorator.test.d.ts.map +0 -1
- package/dist/core/__tests__/app-decorator.test.js +0 -100
- package/dist/core/__tests__/app-decorator.test.js.map +0 -1
- package/dist/core/__tests__/app-factory.extended.test.d.ts +0 -2
- package/dist/core/__tests__/app-factory.extended.test.d.ts.map +0 -1
- package/dist/core/__tests__/app-factory.extended.test.js +0 -244
- package/dist/core/__tests__/app-factory.extended.test.js.map +0 -1
- package/dist/core/__tests__/builders.test.d.ts +0 -2
- package/dist/core/__tests__/builders.test.d.ts.map +0 -1
- package/dist/core/__tests__/builders.test.js +0 -98
- package/dist/core/__tests__/builders.test.js.map +0 -1
- package/dist/core/__tests__/component.test.d.ts +0 -2
- package/dist/core/__tests__/component.test.d.ts.map +0 -1
- package/dist/core/__tests__/component.test.js +0 -151
- package/dist/core/__tests__/component.test.js.map +0 -1
- package/dist/core/__tests__/config-module.test.d.ts +0 -2
- package/dist/core/__tests__/config-module.test.d.ts.map +0 -1
- package/dist/core/__tests__/config-module.test.js +0 -90
- package/dist/core/__tests__/config-module.test.js.map +0 -1
- package/dist/core/__tests__/core-modules.test.d.ts +0 -2
- package/dist/core/__tests__/core-modules.test.d.ts.map +0 -1
- package/dist/core/__tests__/core-modules.test.js +0 -36
- package/dist/core/__tests__/core-modules.test.js.map +0 -1
- package/dist/core/__tests__/di.test.d.ts +0 -2
- package/dist/core/__tests__/di.test.d.ts.map +0 -1
- package/dist/core/__tests__/di.test.js +0 -101
- package/dist/core/__tests__/di.test.js.map +0 -1
- package/dist/core/__tests__/errors.test.d.ts +0 -2
- package/dist/core/__tests__/errors.test.d.ts.map +0 -1
- package/dist/core/__tests__/errors.test.js +0 -109
- package/dist/core/__tests__/errors.test.js.map +0 -1
- package/dist/core/__tests__/final.blitz.test.d.ts +0 -2
- package/dist/core/__tests__/final.blitz.test.d.ts.map +0 -1
- package/dist/core/__tests__/final.blitz.test.js +0 -327
- package/dist/core/__tests__/final.blitz.test.js.map +0 -1
- package/dist/core/__tests__/jwt-module.test.d.ts +0 -2
- package/dist/core/__tests__/jwt-module.test.d.ts.map +0 -1
- package/dist/core/__tests__/jwt-module.test.js +0 -60
- package/dist/core/__tests__/jwt-module.test.js.map +0 -1
- package/dist/core/__tests__/logger.test.d.ts +0 -2
- package/dist/core/__tests__/logger.test.d.ts.map +0 -1
- package/dist/core/__tests__/logger.test.js +0 -83
- package/dist/core/__tests__/logger.test.js.map +0 -1
- package/dist/core/__tests__/models.test.d.ts +0 -2
- package/dist/core/__tests__/models.test.d.ts.map +0 -1
- package/dist/core/__tests__/models.test.js +0 -142
- package/dist/core/__tests__/models.test.js.map +0 -1
- package/dist/core/__tests__/module.test.d.ts +0 -2
- package/dist/core/__tests__/module.test.d.ts.map +0 -1
- package/dist/core/__tests__/module.test.js +0 -58
- package/dist/core/__tests__/module.test.js.map +0 -1
- package/dist/core/__tests__/oauth-module.test.d.ts +0 -2
- package/dist/core/__tests__/oauth-module.test.d.ts.map +0 -1
- package/dist/core/__tests__/oauth-module.test.js +0 -168
- package/dist/core/__tests__/oauth-module.test.js.map +0 -1
- package/dist/core/__tests__/oauth.extended.test.d.ts +0 -2
- package/dist/core/__tests__/oauth.extended.test.d.ts.map +0 -1
- package/dist/core/__tests__/oauth.extended.test.js +0 -146
- package/dist/core/__tests__/oauth.extended.test.js.map +0 -1
- package/dist/core/__tests__/prompt.test.d.ts +0 -2
- package/dist/core/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/core/__tests__/prompt.test.js +0 -126
- package/dist/core/__tests__/prompt.test.js.map +0 -1
- package/dist/core/__tests__/resource.test.d.ts +0 -2
- package/dist/core/__tests__/resource.test.d.ts.map +0 -1
- package/dist/core/__tests__/resource.test.js +0 -173
- package/dist/core/__tests__/resource.test.js.map +0 -1
- package/dist/core/__tests__/server.extended.test.d.ts +0 -2
- package/dist/core/__tests__/server.extended.test.d.ts.map +0 -1
- package/dist/core/__tests__/server.extended.test.js +0 -242
- package/dist/core/__tests__/server.extended.test.js.map +0 -1
- package/dist/core/__tests__/server.test.d.ts +0 -2
- package/dist/core/__tests__/server.test.d.ts.map +0 -1
- package/dist/core/__tests__/server.test.js +0 -120
- package/dist/core/__tests__/server.test.js.map +0 -1
- package/dist/core/__tests__/transport.http.test.d.ts +0 -2
- package/dist/core/__tests__/transport.http.test.d.ts.map +0 -1
- package/dist/core/__tests__/transport.http.test.js +0 -119
- package/dist/core/__tests__/transport.http.test.js.map +0 -1
- package/dist/core/__tests__/transport.streamable.test.d.ts +0 -2
- package/dist/core/__tests__/transport.streamable.test.d.ts.map +0 -1
- package/dist/core/__tests__/transport.streamable.test.js +0 -168
- package/dist/core/__tests__/transport.streamable.test.js.map +0 -1
- package/dist/core/__tests__/transports.test.d.ts +0 -2
- package/dist/core/__tests__/transports.test.d.ts.map +0 -1
- package/dist/core/__tests__/transports.test.js +0 -12
- package/dist/core/__tests__/transports.test.js.map +0 -1
- package/dist/core/apikey-module.d.ts +0 -69
- package/dist/core/apikey-module.d.ts.map +0 -1
- package/dist/core/apikey-module.js +0 -114
- package/dist/core/apikey-module.js.map +0 -1
- package/dist/core/app-decorator.d.ts +0 -59
- package/dist/core/app-decorator.d.ts.map +0 -1
- package/dist/core/app-decorator.js +0 -322
- package/dist/core/app-decorator.js.map +0 -1
- package/dist/core/builders.d.ts +0 -50
- package/dist/core/builders.d.ts.map +0 -1
- package/dist/core/builders.js +0 -139
- package/dist/core/builders.js.map +0 -1
- package/dist/core/component.d.ts +0 -111
- package/dist/core/component.d.ts.map +0 -1
- package/dist/core/component.js +0 -228
- package/dist/core/component.js.map +0 -1
- package/dist/core/config-module.d.ts +0 -62
- package/dist/core/config-module.d.ts.map +0 -1
- package/dist/core/config-module.js +0 -94
- package/dist/core/config-module.js.map +0 -1
- package/dist/core/decorators/__tests__/decorators.test.d.ts +0 -2
- package/dist/core/decorators/__tests__/decorators.test.d.ts.map +0 -1
- package/dist/core/decorators/__tests__/decorators.test.js +0 -103
- package/dist/core/decorators/__tests__/decorators.test.js.map +0 -1
- package/dist/core/decorators/__tests__/extended-decorators.test.d.ts +0 -2
- package/dist/core/decorators/__tests__/extended-decorators.test.d.ts.map +0 -1
- package/dist/core/decorators/__tests__/extended-decorators.test.js +0 -194
- package/dist/core/decorators/__tests__/extended-decorators.test.js.map +0 -1
- package/dist/core/decorators/__tests__/health-check.test.d.ts +0 -2
- package/dist/core/decorators/__tests__/health-check.test.d.ts.map +0 -1
- package/dist/core/decorators/__tests__/health-check.test.js +0 -119
- package/dist/core/decorators/__tests__/health-check.test.js.map +0 -1
- package/dist/core/decorators/cache.decorator.d.ts +0 -61
- package/dist/core/decorators/cache.decorator.d.ts.map +0 -1
- package/dist/core/decorators/cache.decorator.js +0 -115
- package/dist/core/decorators/cache.decorator.js.map +0 -1
- package/dist/core/decorators/health-check.decorator.d.ts +0 -80
- package/dist/core/decorators/health-check.decorator.d.ts.map +0 -1
- package/dist/core/decorators/health-check.decorator.js +0 -153
- package/dist/core/decorators/health-check.decorator.js.map +0 -1
- package/dist/core/decorators/rate-limit.decorator.d.ts +0 -63
- package/dist/core/decorators/rate-limit.decorator.d.ts.map +0 -1
- package/dist/core/decorators/rate-limit.decorator.js +0 -129
- package/dist/core/decorators/rate-limit.decorator.js.map +0 -1
- package/dist/core/decorators.d.ts +0 -190
- package/dist/core/decorators.d.ts.map +0 -1
- package/dist/core/decorators.js +0 -170
- package/dist/core/decorators.js.map +0 -1
- package/dist/core/di/__tests__/container.test.d.ts +0 -2
- package/dist/core/di/__tests__/container.test.d.ts.map +0 -1
- package/dist/core/di/__tests__/container.test.js +0 -88
- package/dist/core/di/__tests__/container.test.js.map +0 -1
- package/dist/core/di/container.d.ts +0 -64
- package/dist/core/di/container.d.ts.map +0 -1
- package/dist/core/di/container.js +0 -105
- package/dist/core/di/container.js.map +0 -1
- package/dist/core/di/injectable.decorator.d.ts +0 -62
- package/dist/core/di/injectable.decorator.d.ts.map +0 -1
- package/dist/core/di/injectable.decorator.js +0 -66
- package/dist/core/di/injectable.decorator.js.map +0 -1
- package/dist/core/di/metadata-shim.d.ts +0 -31
- package/dist/core/di/metadata-shim.d.ts.map +0 -1
- package/dist/core/di/metadata-shim.js +0 -181
- package/dist/core/di/metadata-shim.js.map +0 -1
- package/dist/core/errors.d.ts +0 -54
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/errors.js +0 -87
- package/dist/core/errors.js.map +0 -1
- package/dist/core/events/__tests__/events.test.d.ts +0 -2
- package/dist/core/events/__tests__/events.test.d.ts.map +0 -1
- package/dist/core/events/__tests__/events.test.js +0 -177
- package/dist/core/events/__tests__/events.test.js.map +0 -1
- package/dist/core/events/event-emitter.d.ts +0 -50
- package/dist/core/events/event-emitter.d.ts.map +0 -1
- package/dist/core/events/event-emitter.js +0 -94
- package/dist/core/events/event-emitter.js.map +0 -1
- package/dist/core/events/event.decorator.d.ts +0 -48
- package/dist/core/events/event.decorator.d.ts.map +0 -1
- package/dist/core/events/event.decorator.js +0 -72
- package/dist/core/events/event.decorator.js.map +0 -1
- package/dist/core/events/log-emitter.d.ts +0 -14
- package/dist/core/events/log-emitter.d.ts.map +0 -1
- package/dist/core/events/log-emitter.js +0 -20
- package/dist/core/events/log-emitter.js.map +0 -1
- package/dist/core/filters/__tests__/filters.test.d.ts +0 -2
- package/dist/core/filters/__tests__/filters.test.d.ts.map +0 -1
- package/dist/core/filters/__tests__/filters.test.js +0 -72
- package/dist/core/filters/__tests__/filters.test.js.map +0 -1
- package/dist/core/filters/exception-filter.decorator.d.ts +0 -40
- package/dist/core/filters/exception-filter.decorator.d.ts.map +0 -1
- package/dist/core/filters/exception-filter.decorator.js +0 -54
- package/dist/core/filters/exception-filter.decorator.js.map +0 -1
- package/dist/core/filters/exception-filter.interface.d.ts +0 -39
- package/dist/core/filters/exception-filter.interface.d.ts.map +0 -1
- package/dist/core/filters/exception-filter.interface.js +0 -2
- package/dist/core/filters/exception-filter.interface.js.map +0 -1
- package/dist/core/guards/__tests__/guards.test.d.ts +0 -2
- package/dist/core/guards/__tests__/guards.test.d.ts.map +0 -1
- package/dist/core/guards/__tests__/guards.test.js +0 -55
- package/dist/core/guards/__tests__/guards.test.js.map +0 -1
- package/dist/core/guards/apikey.guard.d.ts +0 -22
- package/dist/core/guards/apikey.guard.d.ts.map +0 -1
- package/dist/core/guards/apikey.guard.js +0 -11
- package/dist/core/guards/apikey.guard.js.map +0 -1
- package/dist/core/guards/guard.interface.d.ts +0 -18
- package/dist/core/guards/guard.interface.d.ts.map +0 -1
- package/dist/core/guards/guard.interface.js +0 -2
- package/dist/core/guards/guard.interface.js.map +0 -1
- package/dist/core/guards/jwt.guard.d.ts +0 -18
- package/dist/core/guards/jwt.guard.d.ts.map +0 -1
- package/dist/core/guards/jwt.guard.js +0 -2
- package/dist/core/guards/jwt.guard.js.map +0 -1
- package/dist/core/guards/oauth.guard.d.ts +0 -35
- package/dist/core/guards/oauth.guard.d.ts.map +0 -1
- package/dist/core/guards/oauth.guard.js +0 -2
- package/dist/core/guards/oauth.guard.js.map +0 -1
- package/dist/core/guards/use-guards.decorator.d.ts +0 -25
- package/dist/core/guards/use-guards.decorator.d.ts.map +0 -1
- package/dist/core/guards/use-guards.decorator.js +0 -32
- package/dist/core/guards/use-guards.decorator.js.map +0 -1
- package/dist/core/health/__tests__/health.test.d.ts +0 -2
- package/dist/core/health/__tests__/health.test.d.ts.map +0 -1
- package/dist/core/health/__tests__/health.test.js +0 -31
- package/dist/core/health/__tests__/health.test.js.map +0 -1
- package/dist/core/health/health-checks.resource.d.ts +0 -14
- package/dist/core/health/health-checks.resource.d.ts.map +0 -1
- package/dist/core/health/health-checks.resource.js +0 -29
- package/dist/core/health/health-checks.resource.js.map +0 -1
- package/dist/core/index.d.ts +0 -57
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -59
- package/dist/core/index.js.map +0 -1
- package/dist/core/interceptors/__tests__/interceptors.test.d.ts +0 -2
- package/dist/core/interceptors/__tests__/interceptors.test.d.ts.map +0 -1
- package/dist/core/interceptors/__tests__/interceptors.test.js +0 -52
- package/dist/core/interceptors/__tests__/interceptors.test.js.map +0 -1
- package/dist/core/interceptors/interceptor.decorator.d.ts +0 -37
- package/dist/core/interceptors/interceptor.decorator.d.ts.map +0 -1
- package/dist/core/interceptors/interceptor.decorator.js +0 -51
- package/dist/core/interceptors/interceptor.decorator.js.map +0 -1
- package/dist/core/interceptors/interceptor.interface.d.ts +0 -31
- package/dist/core/interceptors/interceptor.interface.d.ts.map +0 -1
- package/dist/core/interceptors/interceptor.interface.js +0 -2
- package/dist/core/interceptors/interceptor.interface.js.map +0 -1
- package/dist/core/jwt-module.d.ts +0 -51
- package/dist/core/jwt-module.d.ts.map +0 -1
- package/dist/core/jwt-module.js +0 -52
- package/dist/core/jwt-module.js.map +0 -1
- package/dist/core/logger.d.ts +0 -18
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js +0 -53
- package/dist/core/logger.js.map +0 -1
- package/dist/core/middleware/__tests__/middleware.test.d.ts +0 -2
- package/dist/core/middleware/__tests__/middleware.test.d.ts.map +0 -1
- package/dist/core/middleware/__tests__/middleware.test.js +0 -105
- package/dist/core/middleware/__tests__/middleware.test.js.map +0 -1
- package/dist/core/middleware/middleware.decorator.d.ts +0 -39
- package/dist/core/middleware/middleware.decorator.d.ts.map +0 -1
- package/dist/core/middleware/middleware.decorator.js +0 -53
- package/dist/core/middleware/middleware.decorator.js.map +0 -1
- package/dist/core/middleware/middleware.interface.d.ts +0 -29
- package/dist/core/middleware/middleware.interface.d.ts.map +0 -1
- package/dist/core/middleware/middleware.interface.js +0 -2
- package/dist/core/middleware/middleware.interface.js.map +0 -1
- package/dist/core/module.d.ts +0 -93
- package/dist/core/module.d.ts.map +0 -1
- package/dist/core/module.js +0 -87
- package/dist/core/module.js.map +0 -1
- package/dist/core/oauth-module.d.ts +0 -123
- package/dist/core/oauth-module.d.ts.map +0 -1
- package/dist/core/oauth-module.js +0 -324
- package/dist/core/oauth-module.js.map +0 -1
- package/dist/core/pipes/__tests__/pipes.test.d.ts +0 -2
- package/dist/core/pipes/__tests__/pipes.test.d.ts.map +0 -1
- package/dist/core/pipes/__tests__/pipes.test.js +0 -164
- package/dist/core/pipes/__tests__/pipes.test.js.map +0 -1
- package/dist/core/pipes/pipe.decorator.d.ts +0 -64
- package/dist/core/pipes/pipe.decorator.d.ts.map +0 -1
- package/dist/core/pipes/pipe.decorator.js +0 -85
- package/dist/core/pipes/pipe.decorator.js.map +0 -1
- package/dist/core/pipes/pipe.interface.d.ts +0 -41
- package/dist/core/pipes/pipe.interface.d.ts.map +0 -1
- package/dist/core/pipes/pipe.interface.js +0 -2
- package/dist/core/pipes/pipe.interface.js.map +0 -1
- package/dist/core/prompt.d.ts +0 -46
- package/dist/core/prompt.d.ts.map +0 -1
- package/dist/core/prompt.js +0 -76
- package/dist/core/prompt.js.map +0 -1
- package/dist/core/resource.d.ts +0 -47
- package/dist/core/resource.d.ts.map +0 -1
- package/dist/core/resource.js +0 -90
- package/dist/core/resource.js.map +0 -1
- package/dist/core/server.d.ts +0 -129
- package/dist/core/server.d.ts.map +0 -1
- package/dist/core/server.js +0 -617
- package/dist/core/server.js.map +0 -1
- package/dist/core/tool.d.ts +0 -108
- package/dist/core/tool.d.ts.map +0 -1
- package/dist/core/tool.js +0 -241
- package/dist/core/tool.js.map +0 -1
- package/dist/core/transports/__tests__/transports.test.d.ts +0 -2
- package/dist/core/transports/__tests__/transports.test.d.ts.map +0 -1
- package/dist/core/transports/__tests__/transports.test.js +0 -249
- package/dist/core/transports/__tests__/transports.test.js.map +0 -1
- package/dist/core/transports/discovery-http-server.d.ts +0 -19
- package/dist/core/transports/discovery-http-server.d.ts.map +0 -1
- package/dist/core/transports/discovery-http-server.js +0 -54
- package/dist/core/transports/discovery-http-server.js.map +0 -1
- package/dist/core/transports/http-server.d.ts +0 -108
- package/dist/core/transports/http-server.d.ts.map +0 -1
- package/dist/core/transports/http-server.js +0 -293
- package/dist/core/transports/http-server.js.map +0 -1
- package/dist/core/transports/streamable-http.d.ts +0 -177
- package/dist/core/transports/streamable-http.d.ts.map +0 -1
- package/dist/core/transports/streamable-http.js +0 -1287
- package/dist/core/transports/streamable-http.js.map +0 -1
- package/dist/core/types.d.ts +0 -195
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
- package/dist/core/widgets/__tests__/registry.test.d.ts +0 -2
- package/dist/core/widgets/__tests__/registry.test.d.ts.map +0 -1
- package/dist/core/widgets/__tests__/registry.test.js +0 -69
- package/dist/core/widgets/__tests__/registry.test.js.map +0 -1
- package/dist/core/widgets/widget-examples.resource.d.ts +0 -17
- package/dist/core/widgets/widget-examples.resource.d.ts.map +0 -1
- package/dist/core/widgets/widget-examples.resource.js +0 -28
- package/dist/core/widgets/widget-examples.resource.js.map +0 -1
- package/dist/core/widgets/widget-registry.d.ts +0 -56
- package/dist/core/widgets/widget-registry.d.ts.map +0 -1
- package/dist/core/widgets/widget-registry.js +0 -75
- package/dist/core/widgets/widget-registry.js.map +0 -1
- package/dist/testing/__tests__/testing.test.d.ts +0 -2
- package/dist/testing/__tests__/testing.test.d.ts.map +0 -1
- package/dist/testing/__tests__/testing.test.js +0 -167
- package/dist/testing/__tests__/testing.test.js.map +0 -1
- package/dist/testing/index.d.ts +0 -103
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js +0 -161
- package/dist/testing/index.js.map +0 -1
- package/dist/ui-next/__tests__/ui-next.test.d.ts +0 -2
- package/dist/ui-next/__tests__/ui-next.test.d.ts.map +0 -1
- package/dist/ui-next/__tests__/ui-next.test.js +0 -74
- package/dist/ui-next/__tests__/ui-next.test.js.map +0 -1
- package/dist/ui-next/index.d.ts +0 -31
- package/dist/ui-next/index.d.ts.map +0 -1
- package/dist/ui-next/index.js +0 -687
- package/dist/ui-next/index.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2025
|
|
189
|
+
Copyright 2025 Nitrostack Inc
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,178 +1,83 @@
|
|
|
1
1
|
# NitroStack ⚡
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The enterprise-grade framework for building production-ready MCP servers with TypeScript.**
|
|
4
4
|
|
|
5
|
-
[](https://nitrostack.ai)
|
|
6
|
+
[](https://docs.nitrostack.ai)
|
|
7
|
+
[](https://blog.nitrostack.ai)
|
|
8
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
9
9
|
|
|
10
|
-
NitroStack is a
|
|
10
|
+
NitroStack is a powerful, decoupled toolkit designed to let you build, test, and ship Model Context Protocol (MCP) servers with minimal ceremony and maximum reliability.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Developers typically struggle with:
|
|
15
|
-
- **Boilerplate and wiring**: scattered logic, ad‑hoc conventions, manual glue code
|
|
16
|
-
- **Auth and security**: JWT, OAuth 2.1 (PKCE), API keys, token validation, scopes, multi‑auth
|
|
17
|
-
- **Testing UX**: no clean way to visually exercise tools, resources, prompts
|
|
18
|
-
- **Performance & reliability**: caching, rate limiting, predictable runtime pipeline
|
|
19
|
-
- **DX & iteration**: hot reload, consistent CLIs, starter templates, type generation
|
|
20
|
-
|
|
21
|
-
NitroStack solves these pain points out of the box.
|
|
22
|
-
|
|
23
|
-
## What you get (inbuilt capabilities)
|
|
12
|
+
---
|
|
24
13
|
|
|
25
|
-
|
|
26
|
-
- `@Tool`, `@Widget`, `@Resource`, `@Prompt`, `@Module`
|
|
27
|
-
- `@UseGuards`, `@UseMiddleware`, `@UseInterceptors`, `@UsePipes`, `@UseFilters`
|
|
28
|
-
- **Authentication modules (drop‑in)**
|
|
29
|
-
- `JWTModule` (simple JWT)
|
|
30
|
-
- `OAuthModule` (OAuth 2.1 with PKCE, discovery, scopes, dual transport ready)
|
|
31
|
-
- `ApiKeyModule` (service‑to‑service keys)
|
|
32
|
-
- Multi‑auth patterns (either/both) supported via guards
|
|
33
|
-
- **Studio (built‑in visual test bench)**
|
|
34
|
-
- Run and debug tools, browse resources, test prompts, preview widgets
|
|
35
|
-
- AI chat integration and auto‑form generation from schemas
|
|
36
|
-
- **Widgets UI system**
|
|
37
|
-
- Attach Next.js pages to tools with `@Widget` for instant interactive demos
|
|
38
|
-
- **Runtime pipeline**
|
|
39
|
-
- Middleware, Interceptors, Pipes, Exception Filters for predictable request flow
|
|
40
|
-
- **Performance controls**
|
|
41
|
-
- `@Cache()` and `@RateLimit()` decorators
|
|
42
|
-
- **Type safety**
|
|
43
|
-
- CLI generates types from tool definitions for use across code and widgets
|
|
44
|
-
- **Dev experience**
|
|
45
|
-
- Hot reload, templates, code generators, **dual transport (STDIO + HTTP)** for flexibility
|
|
14
|
+
## ⚡ Ecosystem Structure
|
|
46
15
|
|
|
47
|
-
|
|
16
|
+
NitroStack is modular. Install only what you need:
|
|
48
17
|
|
|
49
|
-
|
|
50
|
-
|
|
18
|
+
| Package | Purpose | Installation |
|
|
19
|
+
|:---|:---|:---|
|
|
20
|
+
| **[`@nitrostack/core`](./packages/core)** | **The Framework** - Decorators, dependency injection, and server logic. | `npm install @nitrostack/core` |
|
|
21
|
+
| **[`@nitrostack/cli`](./packages/cli)** | **The Tooling** - Scaffolding, dev server, and code generators. | `npm install -g @nitrostack/cli` |
|
|
22
|
+
| **[`@nitrostack/widgets`](./packages/widgets)** | **The UI** - React SDK for building interactive tool outputs. | `npm install @nitrostack/widgets` |
|
|
51
23
|
|
|
52
|
-
|
|
24
|
+
---
|
|
53
25
|
|
|
26
|
+
## 🚀 Quick Start in 30 Seconds
|
|
54
27
|
|
|
55
|
-
|
|
28
|
+
The fastest way to get started is by using the CLI to scaffold a new project.
|
|
56
29
|
|
|
30
|
+
### 1. Install Global CLI
|
|
57
31
|
```bash
|
|
58
|
-
npm
|
|
32
|
+
npm install -g @nitrostack/cli
|
|
59
33
|
```
|
|
60
34
|
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
### 2. Scaffold Your Server
|
|
63
36
|
```bash
|
|
64
|
-
|
|
37
|
+
nitrostack-cli init my-server
|
|
65
38
|
```
|
|
66
39
|
|
|
67
|
-
|
|
40
|
+

|
|
68
41
|
|
|
69
|
-
|
|
42
|
+
### 3. Start Development
|
|
70
43
|
```bash
|
|
71
|
-
nitrostack init my-server --template typescript-starter
|
|
72
44
|
cd my-server
|
|
73
45
|
npm install
|
|
46
|
+
npm run dev
|
|
74
47
|
```
|
|
75
48
|
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
nitrostack dev
|
|
79
|
-
```
|
|
80
|
-
Studio opens at `http://localhost:3000` (widgets at `http://localhost:3001`).
|
|
81
|
-
|
|
82
|
-
3) Add your first tool
|
|
83
|
-
```ts
|
|
84
|
-
// src/modules/hello/hello.tools.ts
|
|
85
|
-
import { Tool, z, ExecutionContext, Module } from 'nitrostack';
|
|
86
|
-
|
|
87
|
-
export class HelloTools {
|
|
88
|
-
@Tool({
|
|
89
|
-
name: 'say_hello',
|
|
90
|
-
description: 'Greets a user',
|
|
91
|
-
inputSchema: z.object({ name: z.string() })
|
|
92
|
-
})
|
|
93
|
-
async sayHello(input: { name: string }, ctx: ExecutionContext) {
|
|
94
|
-
return { message: `Hello, ${input.name}!` };
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@Module({ name: 'hello', controllers: [HelloTools] })
|
|
99
|
-
export class HelloModule {}
|
|
100
|
-
```
|
|
101
|
-
Register the module in `app.module.ts`, save — and call the tool in Studio.
|
|
102
|
-
|
|
103
|
-
## Authentication (inbuilt)
|
|
49
|
+
---
|
|
104
50
|
|
|
105
|
-
|
|
106
|
-
- **OAuthModule**: Full OAuth 2.1 with PKCE, discovery endpoints, scopes, and dual‑transport support (STDIO for MCP + HTTP for OAuth metadata)
|
|
107
|
-
- **ApiKeyModule**: Issue and validate API keys for services and automations
|
|
108
|
-
- **Multi‑auth**: compose guards so a tool can require one or multiple schemes
|
|
51
|
+
## 🎨 NitroStudio
|
|
109
52
|
|
|
110
|
-
|
|
53
|
+
NitroStudio is a desktop application for testing and debugging MCP servers. Simply open your project in the Studio—**it handles running the development server for you internally.**
|
|
111
54
|
|
|
112
|
-
-
|
|
113
|
-
- Auto‑generated forms from schemas
|
|
114
|
-
- Resource browser & prompt explorer
|
|
115
|
-
- Widget previews connected to live tool outputs
|
|
55
|
+

|
|
116
56
|
|
|
117
|
-
|
|
57
|
+
**[Download NitroStudio](https://nitrostack.ai/studio)**
|
|
118
58
|
|
|
119
|
-
|
|
120
|
-
# Create a project from templates
|
|
121
|
-
nitrostack init <name> --template typescript-starter
|
|
122
|
-
nitrostack init <name> --template typescript-oauth
|
|
123
|
-
|
|
124
|
-
# Dev / Build
|
|
125
|
-
nitrostack dev
|
|
126
|
-
nitrostack build
|
|
127
|
-
|
|
128
|
-
# Generators
|
|
129
|
-
nitrostack generate module <name>
|
|
130
|
-
nitrostack generate tool <name> --module <module>
|
|
131
|
-
nitrostack generate guard <name>
|
|
132
|
-
nitrostack generate middleware <name>
|
|
133
|
-
nitrostack generate interceptor <name>
|
|
134
|
-
nitrostack generate pipe <name>
|
|
135
|
-
nitrostack generate filter <name>
|
|
136
|
-
|
|
137
|
-
# Types from tools
|
|
138
|
-
nitrostack generate types --output src/types/generated-tools.ts
|
|
139
|
-
```
|
|
59
|
+
- **Real-time testing**: Execute tools and inspect request/response payloads.
|
|
140
60
|
|
|
141
|
-
|
|
61
|
+

|
|
142
62
|
|
|
143
|
-
-
|
|
144
|
-
- `typescript-auth` — JWT auth flows and end‑to‑end examples
|
|
145
|
-
- `typescript-auth-api-key` — API key auth patterns and multi‑auth
|
|
146
|
-
- `typescript-oauth` — OAuth 2.1 (PKCE, discovery, scopes) with dual transport
|
|
63
|
+
- **AI Chat**: Interact with your MCP server using a built-in AI assistant.
|
|
147
64
|
|
|
148
|
-
|
|
65
|
+

|
|
149
66
|
|
|
150
|
-
|
|
67
|
+
- **Widget Preview**: Instantly visualize your interactive UI components.
|
|
151
68
|
|
|
152
|
-
|
|
153
|
-
npm run build
|
|
154
|
-
NODE_ENV=production node dist/index.js
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Consider enabling caching, rate limits, structured logging, and health checks for production. See the docs for deployment recipes and checklists.
|
|
158
|
-
|
|
159
|
-
## Documentation
|
|
160
|
-
|
|
161
|
-
Full docs: `https://docs.nitrostack.ai/`
|
|
162
|
-
- Getting started, SDK guides, decorators, CLI reference, templates, deployment
|
|
69
|
+
---
|
|
163
70
|
|
|
164
|
-
##
|
|
71
|
+
## 📖 Learn More
|
|
165
72
|
|
|
166
|
-
|
|
73
|
+
- **[Official Documentation](https://docs.nitrostack.ai)** - Deep dives into server concepts, decorators, and implementation guides.
|
|
74
|
+
- **[Tutorials & Blog](https://blog.nitrostack.ai)** - Step-by-step guides for complex integrations and architectural patterns.
|
|
75
|
+
- **[Community & Support](https://nitrostack.ai/support)** - Get help from the team and other developers.
|
|
167
76
|
|
|
168
|
-
##
|
|
77
|
+
## 🤝 Contributing
|
|
169
78
|
|
|
170
|
-
|
|
171
|
-
- Docs: `https://docs.nitrostack.ai/`
|
|
172
|
-
- GitHub: `https://github.com/abhishekpanditofficial/nitrostack`
|
|
173
|
-
- npm: `https://www.npmjs.com/package/nitrostack`
|
|
174
|
-
- Model Context Protocol: `https://modelcontextprotocol.io`
|
|
79
|
+
We love contributions! Whether it's a bug fix, new feature, or documentation improvement, please check out our [Contributing Guide](./CONTRIBUTING.md) and [Architecture Overview](./ARCHITECTURE.md) to get started.
|
|
175
80
|
|
|
176
81
|
---
|
|
177
82
|
|
|
178
|
-
|
|
83
|
+
Built with ⚡ by the **NitroStack Team**.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitrostack",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "NitroStack -
|
|
3
|
+
"version": "1.0.85",
|
|
4
|
+
"description": "NitroStack - Enterprise-grade MCP server framework. Decoupled into @nitrostack/core, @nitrostack/cli, and @nitrostack/widgets.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/core/index.js",
|
|
7
|
-
"types": "dist/core/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/core/index.js",
|
|
11
|
-
"require": "./dist/core/index.js",
|
|
12
|
-
"types": "./dist/core/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./testing": {
|
|
15
|
-
"import": "./dist/testing/index.js",
|
|
16
|
-
"require": "./dist/testing/index.js",
|
|
17
|
-
"types": "./dist/testing/index.d.ts"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
6
|
"files": [
|
|
21
|
-
"dist/",
|
|
22
7
|
"README.md",
|
|
23
|
-
"LICENSE"
|
|
8
|
+
"LICENSE",
|
|
9
|
+
"assets"
|
|
24
10
|
],
|
|
25
11
|
"scripts": {
|
|
26
|
-
"build": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
31
|
-
"link:all": "npm run build:all && npm link && cd packages/widgets && npm link && cd ../cli && npm link",
|
|
32
|
-
"unlink:all": "npm unlink && cd packages/widgets && npm unlink && cd ../cli && npm unlink",
|
|
33
|
-
"prepublishOnly": "npm run build"
|
|
12
|
+
"build": "cd packages/core && npm run build && cd ../widgets && npm run build && cd ../cli && npm run build",
|
|
13
|
+
"test": "cd packages/core && npm run test",
|
|
14
|
+
"test:coverage": "cd packages/core && npm run test:coverage",
|
|
15
|
+
"link:all": "npm run build && cd packages/core && npm link && cd ../widgets && npm link && cd ../cli && npm link"
|
|
34
16
|
},
|
|
35
17
|
"keywords": [
|
|
36
18
|
"mcp",
|
|
@@ -40,28 +22,11 @@
|
|
|
40
22
|
"tools",
|
|
41
23
|
"typescript",
|
|
42
24
|
"server",
|
|
43
|
-
"framework"
|
|
44
|
-
"decorator",
|
|
45
|
-
"nestjs-inspired"
|
|
25
|
+
"framework"
|
|
46
26
|
],
|
|
47
|
-
"author": "
|
|
27
|
+
"author": "Nitrostack Inc <hello@nitrostack.ai>",
|
|
48
28
|
"license": "Apache-2.0",
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
51
|
-
"bcryptjs": "^2.4.3",
|
|
52
|
-
"better-sqlite3": "^11.8.1",
|
|
53
|
-
"cors": "^2.8.5",
|
|
54
|
-
"dotenv": "^17.2.3",
|
|
55
|
-
"express": "^4.21.2",
|
|
56
|
-
"jose": "^6.1.0",
|
|
57
|
-
"jsonwebtoken": "^9.0.2",
|
|
58
|
-
"reflect-metadata": "^0.2.1",
|
|
59
|
-
"uuid": "^11.0.5",
|
|
60
|
-
"winston": "^3.17.0",
|
|
61
|
-
"ws": "^8.18.3",
|
|
62
|
-
"zod": "^3.24.1",
|
|
63
|
-
"zod-to-json-schema": "^3.24.6"
|
|
64
|
-
},
|
|
29
|
+
"dependencies": {},
|
|
65
30
|
"devDependencies": {
|
|
66
31
|
"@types/bcryptjs": "^2.4.6",
|
|
67
32
|
"@types/better-sqlite3": "^7.6.12",
|
|
@@ -82,10 +47,10 @@
|
|
|
82
47
|
},
|
|
83
48
|
"repository": {
|
|
84
49
|
"type": "git",
|
|
85
|
-
"url": "https://github.com/
|
|
50
|
+
"url": "https://github.com/nitrocloudofficial/nitrostack.git"
|
|
86
51
|
},
|
|
87
52
|
"bugs": {
|
|
88
|
-
"url": "https://github.com/
|
|
53
|
+
"url": "https://github.com/nitrocloudofficial/nitrostack/issues"
|
|
89
54
|
},
|
|
90
|
-
"homepage": "https://nitrostack.
|
|
91
|
-
}
|
|
55
|
+
"homepage": "https://nitrostack.ai"
|
|
56
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-key.test.d.ts","sourceRoot":"","sources":["../../../src/auth/__tests__/api-key.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { jest, describe, it, expect, beforeEach } from '@jest/globals';
|
|
2
|
-
import { createAPIKeyAuth, generateAPIKey, hashAPIKey, isValidAPIKeyFormat, validateAPIKeyWithMetadata, generateAPIKeyWithMetadata } from '../api-key.js';
|
|
3
|
-
describe('API Key Auth', () => {
|
|
4
|
-
describe('Utilities', () => {
|
|
5
|
-
it('should generate valid keys', () => {
|
|
6
|
-
const key = generateAPIKey();
|
|
7
|
-
expect(key.startsWith('sk_')).toBe(true);
|
|
8
|
-
expect(isValidAPIKeyFormat(key)).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
it('should hash keys consistently', () => {
|
|
11
|
-
const key = 'test-key';
|
|
12
|
-
const hash1 = hashAPIKey(key);
|
|
13
|
-
const hash2 = hashAPIKey(key);
|
|
14
|
-
expect(hash1).toBe(hash2);
|
|
15
|
-
expect(hash1).not.toBe(key);
|
|
16
|
-
});
|
|
17
|
-
it('should validate format', () => {
|
|
18
|
-
expect(isValidAPIKeyFormat('sk_12345678901234567890123456789012', 'sk')).toBe(true);
|
|
19
|
-
expect(isValidAPIKeyFormat('invalid')).toBe(false);
|
|
20
|
-
expect(isValidAPIKeyFormat('k'.repeat(32))).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
it('should validate metadata', () => {
|
|
23
|
-
const metadata = {
|
|
24
|
-
hashed: 'hash',
|
|
25
|
-
name: 'test',
|
|
26
|
-
createdAt: new Date(),
|
|
27
|
-
scopes: ['read']
|
|
28
|
-
};
|
|
29
|
-
const result = validateAPIKeyWithMetadata('key', metadata, ['read']);
|
|
30
|
-
expect(result.valid).toBe(true);
|
|
31
|
-
const failResult = validateAPIKeyWithMetadata('key', metadata, ['write']);
|
|
32
|
-
expect(failResult.valid).toBe(false);
|
|
33
|
-
const starredResult = validateAPIKeyWithMetadata('key', { ...metadata, scopes: ['*'] }, ['any']);
|
|
34
|
-
expect(starredResult.valid).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('Middleware', () => {
|
|
38
|
-
let req;
|
|
39
|
-
let res;
|
|
40
|
-
let next;
|
|
41
|
-
beforeEach(() => {
|
|
42
|
-
req = { headers: {}, query: {} };
|
|
43
|
-
res = {
|
|
44
|
-
status: jest.fn().mockReturnThis(),
|
|
45
|
-
json: jest.fn()
|
|
46
|
-
};
|
|
47
|
-
next = jest.fn();
|
|
48
|
-
});
|
|
49
|
-
it('should authenticate with valid key in header', async () => {
|
|
50
|
-
const middleware = createAPIKeyAuth({ keys: ['valid-key'] });
|
|
51
|
-
req.headers['x-api-key'] = 'valid-key';
|
|
52
|
-
await middleware(req, res, next);
|
|
53
|
-
expect(next).toHaveBeenCalled();
|
|
54
|
-
expect(req.auth.authenticated).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
it('should reject missing key', async () => {
|
|
57
|
-
const middleware = createAPIKeyAuth({ keys: ['valid-key'], allowQueryParam: true });
|
|
58
|
-
await middleware(req, res, next);
|
|
59
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
60
|
-
expect(res.json).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining('query parameter') }));
|
|
61
|
-
const middlewareNoQuery = createAPIKeyAuth({ keys: ['k'] });
|
|
62
|
-
await middlewareNoQuery(req, res, next);
|
|
63
|
-
expect(res.json).toHaveBeenCalledWith(expect.objectContaining({ message: expect.not.stringContaining('query parameter') }));
|
|
64
|
-
});
|
|
65
|
-
it('should reject invalid key', async () => {
|
|
66
|
-
const middleware = createAPIKeyAuth({ keys: ['valid-key'] });
|
|
67
|
-
req.headers['x-api-key'] = 'invalid-key';
|
|
68
|
-
await middleware(req, res, next);
|
|
69
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
70
|
-
});
|
|
71
|
-
it('should handle runtime errors', async () => {
|
|
72
|
-
const middleware = createAPIKeyAuth({
|
|
73
|
-
keys: ['k'],
|
|
74
|
-
customValidation: () => { throw new Error('Runtime'); }
|
|
75
|
-
});
|
|
76
|
-
req.headers['x-api-key'] = 'k';
|
|
77
|
-
await middleware(req, res, next);
|
|
78
|
-
expect(res.status).toHaveBeenCalledWith(500);
|
|
79
|
-
});
|
|
80
|
-
it('should support hashed keys', async () => {
|
|
81
|
-
const key = 'my-secret-key';
|
|
82
|
-
const hashed = hashAPIKey(key);
|
|
83
|
-
const middleware = createAPIKeyAuth({ keys: [hashed], hashed: true });
|
|
84
|
-
req.headers['x-api-key'] = key;
|
|
85
|
-
await middleware(req, res, next);
|
|
86
|
-
expect(next).toHaveBeenCalled();
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('Extended Features', () => {
|
|
90
|
-
let req;
|
|
91
|
-
let res;
|
|
92
|
-
let next;
|
|
93
|
-
beforeEach(() => {
|
|
94
|
-
req = { headers: {}, query: {} };
|
|
95
|
-
res = {
|
|
96
|
-
status: jest.fn().mockReturnThis(),
|
|
97
|
-
json: jest.fn()
|
|
98
|
-
};
|
|
99
|
-
next = jest.fn();
|
|
100
|
-
});
|
|
101
|
-
it('should accept query parameters if configured', async () => {
|
|
102
|
-
const middleware = createAPIKeyAuth({
|
|
103
|
-
keys: ['k'],
|
|
104
|
-
allowQueryParam: true
|
|
105
|
-
});
|
|
106
|
-
req.query['api_key'] = 'k';
|
|
107
|
-
await middleware(req, res, next);
|
|
108
|
-
expect(next).toHaveBeenCalled();
|
|
109
|
-
});
|
|
110
|
-
it('should use custom query param name', async () => {
|
|
111
|
-
const middleware = createAPIKeyAuth({
|
|
112
|
-
keys: ['k'],
|
|
113
|
-
allowQueryParam: true,
|
|
114
|
-
queryParamName: 'token'
|
|
115
|
-
});
|
|
116
|
-
req.query['token'] = 'k';
|
|
117
|
-
await middleware(req, res, next);
|
|
118
|
-
expect(next).toHaveBeenCalled();
|
|
119
|
-
});
|
|
120
|
-
it('should use custom validation', async () => {
|
|
121
|
-
const middleware = createAPIKeyAuth({
|
|
122
|
-
keys: ['k'],
|
|
123
|
-
customValidation: async (key) => key === 'k'
|
|
124
|
-
});
|
|
125
|
-
req.headers['x-api-key'] = 'k';
|
|
126
|
-
await middleware(req, res, next);
|
|
127
|
-
expect(next).toHaveBeenCalled();
|
|
128
|
-
middleware(req, res.status(0), next); // Reset mock? No, just call again.
|
|
129
|
-
req.headers['x-api-key'] = 'wrong';
|
|
130
|
-
await middleware(req, res, next);
|
|
131
|
-
expect(res.status).toHaveBeenCalledWith(401);
|
|
132
|
-
});
|
|
133
|
-
it('should throw error if config invalid', () => {
|
|
134
|
-
expect(() => createAPIKeyAuth({ keys: [] })).toThrow();
|
|
135
|
-
});
|
|
136
|
-
it('should generate metadata', () => {
|
|
137
|
-
const meta = generateAPIKeyWithMetadata({
|
|
138
|
-
name: 'test',
|
|
139
|
-
prefix: 'test',
|
|
140
|
-
expiresIn: 30,
|
|
141
|
-
scopes: ['read']
|
|
142
|
-
});
|
|
143
|
-
expect(meta.key).toMatch(/^test_/);
|
|
144
|
-
expect(meta.expiresAt).toBeDefined();
|
|
145
|
-
expect(meta.scopes).toContain('read');
|
|
146
|
-
});
|
|
147
|
-
it('should validate expiration', () => {
|
|
148
|
-
const entry = {
|
|
149
|
-
name: 't', hashed: 'h', createdAt: new Date(),
|
|
150
|
-
expiresAt: new Date(Date.now() - 1000) // expired
|
|
151
|
-
};
|
|
152
|
-
expect(validateAPIKeyWithMetadata('k', entry).valid).toBe(false);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=api-key.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-key.test.js","sourceRoot":"","sources":["../../../src/auth/__tests__/api-key.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC7B,MAAM,eAAe,CAAC;AAEvB,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YAClC,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,UAA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