Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix middleware interface #422

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 6 additions & 54 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,25 @@ logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

build
bower_components
docs
bundled

typings
.typingsrc
dts
dist
lib
es
es6

type_definitions/inversify/*.js

#src/*.js
src/**/*.js

#src/*.js.map
src/**/*.js.map

src/*.d.ts
src/decorator/*.d.ts
src/factory/*.d.ts
src/syntax/*.d.ts

#test/*.js
test/**/*.js
test/**/*.js.map

type_definitions/**/*.js
type_definitions/*.js

# JetBrains IDE
.idea
.iml
inversify-express-utils.iml

# OS folders
.DS_Store

# Typescript build info
tsconfig.cjs.tsbuildinfo

# Typescript compiled file
lib
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Updated `BaseMiddleware.handler` to allow async handlers.
- Updated `Middleware` to allow include any `ServiceIdentifier`.

### Fixed

## [6.4.10]

### Added

### Changed

### Fixed
- Fixed `Controller` without wrong constraints (#417).

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type DecoratorTarget<T = unknown> =
| ConstructorFunction<T>
| Prototype<T>;

export type Middleware = string | symbol | RequestHandler;
export type Middleware = inversifyInterfaces.ServiceIdentifier | RequestHandler;

export interface MiddlewareMetaData {
[identifier: string]: Middleware[];
Expand Down
3 changes: 2 additions & 1 deletion src/test/framework.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import express, {
Application,
NextFunction,
Request,
RequestHandler,
Response,
Router,
} from 'express';
Expand Down Expand Up @@ -31,7 +32,7 @@ describe('Unit Test: InversifyExpressServer', () => {
});

it('should call the configFn before the errorConfigFn', () => {
const middleware: Middleware = (
const middleware: Middleware & RequestHandler = (
_req: Request,
_res: Response,
_next: NextFunction,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.cjs.tsbuildinfo

This file was deleted.