@feathersjs/express 5.0.0-pre.14 → 5.0.0-pre.15

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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * missing express types for Request, Response ([#2498](https://github.com/feathersjs/feathers/issues/2498)) ([ee67131](https://github.com/feathersjs/feathers/commit/ee67131bbaa24c54d3d781bdf8820015759ac488))
12
+ * **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
13
+
14
+
15
+ ### Features
16
+
17
+ * **core:** add `context.http` and move `statusCode` there ([#2496](https://github.com/feathersjs/feathers/issues/2496)) ([b701bf7](https://github.com/feathersjs/feathers/commit/b701bf77fb83048aa1dffa492b3d77dd53f7b72b))
18
+ * **core:** Improve legacy hooks integration ([08c8b40](https://github.com/feathersjs/feathers/commit/08c8b40999bf3889c61a4d4fad97a2c4f78bafc9))
19
+
20
+
21
+
22
+
23
+
6
24
  # [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
7
25
 
8
26
  **Note:** Version bump only for package @feathersjs/express
@@ -1,4 +1,4 @@
1
- import { NextFunction, RequestHandler } from 'express';
1
+ import { NextFunction, RequestHandler, Request, Response } from 'express';
2
2
  declare type StrategyOptions = {
3
3
  service?: string;
4
4
  strategies: string[];
@@ -2,20 +2,20 @@
2
2
  import http from 'http';
3
3
  import express, { Express } from 'express';
4
4
  import { Application as FeathersApplication, Params as FeathersParams, HookContext, ServiceMethods, ServiceInterface } from '@feathersjs/feathers';
5
- interface ExpressUseHandler<T, ServiceTypes> {
6
- <L extends keyof ServiceTypes & string>(path: L, ...middlewareOrService: (Express | express.RequestHandler | (keyof any extends keyof ServiceTypes ? ServiceInterface<any> : ServiceTypes[L]))[]): T;
5
+ interface ExpressUseHandler<T, Services> {
6
+ <L extends keyof Services & string>(path: L, ...middlewareOrService: (Express | express.RequestHandler | (keyof any extends keyof Services ? ServiceInterface : Services[L]))[]): T;
7
7
  (path: string | RegExp, ...expressHandlers: express.RequestHandler[]): T;
8
8
  (...expressHandlers: express.RequestHandler[]): T;
9
9
  (handler: Express | express.ErrorRequestHandler): T;
10
10
  }
11
- export interface ExpressOverrides<ServiceTypes> {
11
+ export interface ExpressOverrides<Services> {
12
12
  listen(port: number, hostname: string, backlog: number, callback?: () => void): Promise<http.Server>;
13
13
  listen(port: number, hostname: string, callback?: () => void): Promise<http.Server>;
14
14
  listen(port: number | string | any, callback?: () => void): Promise<http.Server>;
15
15
  listen(callback?: () => void): Promise<http.Server>;
16
- use: ExpressUseHandler<this, ServiceTypes>;
16
+ use: ExpressUseHandler<this, Services>;
17
17
  }
18
- export declare type Application<ServiceTypes = any, AppSettings = any> = Omit<Express, 'listen' | 'use'> & FeathersApplication<ServiceTypes, AppSettings> & ExpressOverrides<ServiceTypes>;
18
+ export declare type Application<Services = any, Settings = any> = Omit<Express, 'listen' | 'use'> & FeathersApplication<Services, Settings> & ExpressOverrides<Services>;
19
19
  declare module '@feathersjs/feathers/lib/declarations' {
20
20
  interface ServiceOptions {
21
21
  middleware?: {
@@ -33,7 +33,7 @@ declare module 'express-serve-static-core' {
33
33
  hook?: HookContext;
34
34
  }
35
35
  interface IRouterMatcher<T> {
36
- <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods<any, any>> | Application)[]): T;
36
+ <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods> | Application)[]): T;
37
37
  }
38
38
  }
39
39
  export {};
package/lib/rest.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { HookContext } from '@feathersjs/hooks';
2
1
  import { http } from '@feathersjs/transport-commons';
2
+ import { HookContext } from '@feathersjs/feathers';
3
3
  import { Request, Response, NextFunction, RequestHandler } from 'express';
4
- export declare type ServiceCallback = (req: Request, res: Response, options: http.ServiceParams) => Promise<HookContext | any>;
4
+ export declare type ServiceCallback = (req: Request, res: Response, options: http.ServiceParams) => Promise<HookContext>;
5
5
  export declare const feathersParams: (req: Request, _res: Response, next: NextFunction) => void;
6
6
  export declare const formatter: (_req: Request, res: Response, next: NextFunction) => void;
7
7
  export declare const serviceMiddleware: (callback: ServiceCallback) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
package/lib/rest.js CHANGED
@@ -54,7 +54,7 @@ const serviceMethodHandler = (service, methodName, getArgs, headerOverride) => (
54
54
  throw new errors_1.MethodNotAllowed(`Method \`${method}\` is not supported by this endpoint.`);
55
55
  }
56
56
  const args = getArgs(options);
57
- const context = (0, feathers_1.createContext)(service, method);
57
+ const context = (0, feathers_1.createContext)(service, method, { http: {} });
58
58
  res.hook = context;
59
59
  return service[method](...args, context);
60
60
  });
package/lib/rest.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rest.js","sourceRoot":"","sources":["../src/rest.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AAEtD,iDAAkD;AAClD,qEAAqD;AACrD,mDAA+F;AAC/F,qCAAkF;AAElF,qDAAuD;AAEvD,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,0BAA0B,CAAC,CAAC;AAI/C,MAAM,cAAc,GAAG,CAAC,GAAY,EAAE,IAAc,EAAE,IAAkB,EAAE,EAAE;IACjF,GAAG,CAAC,QAAQ,GAAG;QACb,GAAG,GAAG,CAAC,QAAQ;QACf,QAAQ,EAAE,MAAM;QACh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,4BAAoB,EAAC,OAAO,EAAE,QAAQ,EAAE,wBAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAEjF,KAAK,CAAC,sCAAsC,IAAI,sBAAsB,OAAO,IAAI,CAAC,CAAC;YAEnF,MAAM,OAAO,GAAG,gBAAgB,CAAC;YACjC,MAAM,aAAa,GAAG,IAAA,gBAAM,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;iBAChD,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC;iBACd,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;iBACjB,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC;iBACjB,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC;iBAChB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC;iBACpB,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;iBACjB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;iBACrB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;iBACnB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAE3B,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA3CD,oBA2CC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/express",
3
3
  "description": "Feathers Express framework bindings and REST provider",
4
- "version": "5.0.0-pre.14",
4
+ "version": "5.0.0-pre.15",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "keywords": [
@@ -49,26 +49,28 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@feathersjs/commons": "^5.0.0-pre.14",
53
- "@feathersjs/errors": "^5.0.0-pre.14",
54
- "@feathersjs/transport-commons": "^5.0.0-pre.14",
52
+ "@feathersjs/commons": "^5.0.0-pre.15",
53
+ "@feathersjs/errors": "^5.0.0-pre.15",
54
+ "@feathersjs/feathers": "^5.0.0-pre.15",
55
+ "@feathersjs/transport-commons": "^5.0.0-pre.15",
55
56
  "@types/express": "^4.17.13",
57
+ "@types/express-serve-static-core": "^4.17.24",
56
58
  "express": "^4.17.1",
57
59
  "lodash": "^4.17.21"
58
60
  },
59
61
  "devDependencies": {
60
- "@feathersjs/authentication": "^5.0.0-pre.14",
61
- "@feathersjs/authentication-local": "^5.0.0-pre.14",
62
- "@feathersjs/feathers": "^5.0.0-pre.14",
63
- "@feathersjs/tests": "^5.0.0-pre.14",
62
+ "@feathersjs/authentication": "^5.0.0-pre.15",
63
+ "@feathersjs/authentication-local": "^5.0.0-pre.15",
64
+ "@feathersjs/tests": "^5.0.0-pre.15",
65
+ "@types/lodash": "^4.14.176",
64
66
  "@types/mocha": "^9.0.0",
65
- "@types/node": "^16.10.4",
66
- "axios": "^0.23.0",
67
+ "@types/node": "^16.11.6",
68
+ "axios": "^0.24.0",
67
69
  "lodash": "^4.17.21",
68
- "mocha": "^9.1.2",
70
+ "mocha": "^9.1.3",
69
71
  "shx": "^0.3.3",
70
- "ts-node": "^10.3.0",
72
+ "ts-node": "^10.4.0",
71
73
  "typescript": "^4.4.4"
72
74
  },
73
- "gitHead": "9bb26276938aead1f3f582be5517a49a8ce00f09"
75
+ "gitHead": "8008bf4f8529a2a40b6a2f976c1f43ae13675693"
74
76
  }
@@ -1,6 +1,6 @@
1
1
  import { createDebug } from '@feathersjs/commons';
2
2
  import { merge, flatten } from 'lodash';
3
- import { NextFunction, RequestHandler } from 'express';
3
+ import { NextFunction, RequestHandler, Request, Response } from 'express';
4
4
 
5
5
  const debug = createDebug('@feathersjs/express/authentication');
6
6
 
@@ -5,12 +5,12 @@ import {
5
5
  HookContext, ServiceMethods, ServiceInterface
6
6
  } from '@feathersjs/feathers';
7
7
 
8
- interface ExpressUseHandler<T, ServiceTypes> {
9
- <L extends keyof ServiceTypes & string> (
8
+ interface ExpressUseHandler<T, Services> {
9
+ <L extends keyof Services & string> (
10
10
  path: L,
11
11
  ...middlewareOrService: (
12
12
  Express|express.RequestHandler|
13
- (keyof any extends keyof ServiceTypes ? ServiceInterface<any> : ServiceTypes[L])
13
+ (keyof any extends keyof Services ? ServiceInterface : Services[L])
14
14
  )[]
15
15
  ): T;
16
16
  (path: string|RegExp, ...expressHandlers: express.RequestHandler[]): T;
@@ -18,21 +18,21 @@ interface ExpressUseHandler<T, ServiceTypes> {
18
18
  (handler: Express|express.ErrorRequestHandler): T;
19
19
  }
20
20
 
21
- export interface ExpressOverrides<ServiceTypes> {
21
+ export interface ExpressOverrides<Services> {
22
22
  listen(port: number, hostname: string, backlog: number, callback?: () => void): Promise<http.Server>;
23
23
  listen(port: number, hostname: string, callback?: () => void): Promise<http.Server>;
24
24
  listen(port: number|string|any, callback?: () => void): Promise<http.Server>;
25
25
  listen(callback?: () => void): Promise<http.Server>;
26
- use: ExpressUseHandler<this, ServiceTypes>;
26
+ use: ExpressUseHandler<this, Services>;
27
27
  }
28
28
 
29
- export type Application<ServiceTypes = any, AppSettings = any> =
29
+ export type Application<Services = any, Settings = any> =
30
30
  Omit<Express, 'listen'|'use'> &
31
- FeathersApplication<ServiceTypes, AppSettings> &
32
- ExpressOverrides<ServiceTypes>;
31
+ FeathersApplication<Services, Settings> &
32
+ ExpressOverrides<Services>;
33
33
 
34
34
  declare module '@feathersjs/feathers/lib/declarations' {
35
- export interface ServiceOptions {
35
+ interface ServiceOptions {
36
36
  middleware?: {
37
37
  before: express.RequestHandler[],
38
38
  after: express.RequestHandler[]
@@ -54,7 +54,7 @@ declare module 'express-serve-static-core' {
54
54
  // eslint-disable-next-line
55
55
  <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(
56
56
  path: PathParams,
57
- ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods<any, any>> | Application)[]
57
+ ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods> | Application)[]
58
58
  ): T;
59
59
  }
60
60
  }
package/src/rest.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  import { MethodNotAllowed } from '@feathersjs/errors';
2
- import { HookContext } from '@feathersjs/hooks';
3
2
  import { createDebug } from '@feathersjs/commons';
4
3
  import { http } from '@feathersjs/transport-commons';
5
- import { createContext, defaultServiceMethods, getServiceOptions } from '@feathersjs/feathers';
4
+ import { HookContext, createContext, defaultServiceMethods, getServiceOptions } from '@feathersjs/feathers';
6
5
  import { Request, Response, NextFunction, RequestHandler, Router } from 'express';
7
6
 
8
7
  import { parseAuthentication } from './authentication';
9
8
 
10
9
  const debug = createDebug('@feathersjs/express/rest');
11
10
 
12
- export type ServiceCallback = (req: Request, res: Response, options: http.ServiceParams) => Promise<HookContext|any>;
11
+ export type ServiceCallback = (req: Request, res: Response, options: http.ServiceParams) => Promise<HookContext>;
13
12
 
14
13
  export const feathersParams = (req: Request, _res: Response, next: NextFunction) => {
15
14
  req.feathers = {
@@ -67,9 +66,9 @@ export const serviceMethodHandler = (
67
66
  }
68
67
 
69
68
  const args = getArgs(options);
70
- const context = createContext(service, method);
69
+ const context = createContext(service, method, { http: {} });
71
70
 
72
- res.hook = context as any;
71
+ res.hook = context;
73
72
 
74
73
  return service[method](...args, context);
75
74
  });