@feathersjs/express 5.0.0-pre.6 → 5.0.0
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 +197 -219
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/lib/authentication.d.ts +5 -6
- package/lib/authentication.js +27 -38
- package/lib/authentication.js.map +1 -1
- package/lib/declarations.d.ts +16 -11
- package/lib/handlers.d.ts +1 -1
- package/lib/handlers.js +5 -3
- package/lib/handlers.js.map +1 -1
- package/lib/index.d.ts +9 -7
- package/lib/index.js +77 -47
- package/lib/index.js.map +1 -1
- package/lib/rest.d.ts +9 -9
- package/lib/rest.js +60 -90
- package/lib/rest.js.map +1 -1
- package/package.json +28 -21
- package/src/authentication.ts +48 -53
- package/src/declarations.ts +43 -35
- package/src/handlers.ts +52 -50
- package/src/index.ts +113 -64
- package/src/rest.ts +91 -98
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @feathersjs/express
|
|
2
2
|
|
|
3
3
|
[](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
|
|
4
|
-
[](https://david-dm.org/feathersjs/feathers?path=packages/express)
|
|
5
4
|
[](https://www.npmjs.com/package/@feathersjs/express)
|
|
5
|
+
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
7
|
> Feathers Express framework bindings and REST provider
|
|
8
8
|
|
|
@@ -18,6 +18,6 @@ Refer to the [Feathers Express API documentation](https://docs.feathersjs.com/ap
|
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
21
|
-
Copyright (c)
|
|
21
|
+
Copyright (c) 2023 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
22
|
|
|
23
23
|
Licensed under the [MIT license](LICENSE).
|
package/lib/authentication.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { RequestHandler } from 'express';
|
|
2
|
+
export type AuthenticationSettings = {
|
|
3
3
|
service?: string;
|
|
4
|
-
strategies
|
|
4
|
+
strategies?: string[];
|
|
5
5
|
};
|
|
6
|
-
export declare function parseAuthentication(settings?:
|
|
7
|
-
export declare function authenticate(
|
|
8
|
-
export {};
|
|
6
|
+
export declare function parseAuthentication(settings?: AuthenticationSettings): RequestHandler;
|
|
7
|
+
export declare function authenticate(settings: string | AuthenticationSettings, ...strategies: string[]): RequestHandler;
|
package/lib/authentication.js
CHANGED
|
@@ -2,55 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authenticate = exports.parseAuthentication = void 0;
|
|
4
4
|
const commons_1 = require("@feathersjs/commons");
|
|
5
|
-
const
|
|
6
|
-
const debug = commons_1.createDebug('@feathersjs/express/authentication');
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const authentication_1 = require("@feathersjs/authentication");
|
|
6
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/express/authentication');
|
|
7
|
+
const toHandler = (func) => {
|
|
8
|
+
return (req, res, next) => func(req, res, next).catch((error) => next(error));
|
|
9
|
+
};
|
|
10
10
|
function parseAuthentication(settings = {}) {
|
|
11
|
-
return
|
|
11
|
+
return toHandler(async (req, res, next) => {
|
|
12
|
+
var _a;
|
|
12
13
|
const app = req.app;
|
|
13
|
-
const service = app.defaultAuthentication ?
|
|
14
|
-
if (service
|
|
14
|
+
const service = (_a = app.defaultAuthentication) === null || _a === void 0 ? void 0 : _a.call(app, settings.service);
|
|
15
|
+
if (!service) {
|
|
15
16
|
return next();
|
|
16
17
|
}
|
|
17
18
|
const config = service.configuration;
|
|
18
|
-
const authStrategies = config.parseStrategies || config.authStrategies || [];
|
|
19
|
+
const authStrategies = settings.strategies || config.parseStrategies || config.authStrategies || [];
|
|
19
20
|
if (authStrategies.length === 0) {
|
|
20
21
|
debug('No `authStrategies` or `parseStrategies` found in authentication configuration');
|
|
21
22
|
return next();
|
|
22
23
|
}
|
|
23
|
-
service.parse(req, res, ...authStrategies)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
next();
|
|
33
|
-
}).catch(next);
|
|
34
|
-
};
|
|
24
|
+
const authentication = await service.parse(req, res, ...authStrategies);
|
|
25
|
+
if (authentication) {
|
|
26
|
+
debug('Parsed authentication from HTTP header', authentication);
|
|
27
|
+
req.feathers = { ...req.feathers, authentication };
|
|
28
|
+
}
|
|
29
|
+
return next();
|
|
30
|
+
});
|
|
35
31
|
}
|
|
36
32
|
exports.parseAuthentication = parseAuthentication;
|
|
37
|
-
function authenticate(
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
service.authenticate(authentication, req.feathers, ...settings.strategies)
|
|
48
|
-
.then((authResult) => {
|
|
49
|
-
debug('Merging request with', authResult);
|
|
50
|
-
lodash_1.merge(req, authResult);
|
|
51
|
-
next();
|
|
52
|
-
}).catch(next);
|
|
53
|
-
};
|
|
33
|
+
function authenticate(settings, ...strategies) {
|
|
34
|
+
const hook = (0, authentication_1.authenticate)(settings, ...strategies);
|
|
35
|
+
return toHandler(async (req, _res, next) => {
|
|
36
|
+
const app = req.app;
|
|
37
|
+
const params = req.feathers;
|
|
38
|
+
const context = { app, params };
|
|
39
|
+
await hook(context);
|
|
40
|
+
req.feathers = context.params;
|
|
41
|
+
return next();
|
|
42
|
+
});
|
|
54
43
|
}
|
|
55
44
|
exports.authenticate = authenticate;
|
|
56
45
|
//# sourceMappingURL=authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRo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,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAA;SACnD;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC;AA1BD,kDA0BC;AAED,SAAgB,YAAY,CAC1B,QAAyC,EACzC,GAAG,UAAoB;IAEvB,MAAM,IAAI,GAAG,IAAA,6BAAgB,EAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;IAEtD,OAAO,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QACzC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAyB,CAAA;QACzC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC3B,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,MAAM,EAAwB,CAAA;QAErD,MAAM,IAAI,CAAC,OAAO,CAAC,CAAA;QAEnB,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAA;QAE7B,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC;AAjBD,oCAiBC"}
|
package/lib/declarations.d.ts
CHANGED
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http from 'http';
|
|
3
3
|
import express, { Express } from 'express';
|
|
4
|
-
import { Application as FeathersApplication, Params as FeathersParams, HookContext, ServiceMethods, ServiceInterface } from '@feathersjs/feathers';
|
|
5
|
-
interface ExpressUseHandler<T,
|
|
6
|
-
<L extends keyof
|
|
4
|
+
import { Application as FeathersApplication, Params as FeathersParams, HookContext, ServiceMethods, ServiceInterface, RouteLookup } from '@feathersjs/feathers';
|
|
5
|
+
interface ExpressUseHandler<T, Services> {
|
|
6
|
+
<L extends keyof Services & string>(path: L, ...middlewareOrService: (Express | express.RequestHandler | 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<
|
|
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,
|
|
16
|
+
use: ExpressUseHandler<this, Services>;
|
|
17
|
+
server?: http.Server;
|
|
17
18
|
}
|
|
18
|
-
export
|
|
19
|
+
export type Application<Services = any, Settings = any> = Omit<Express, 'listen' | 'use' | 'get' | 'set'> & FeathersApplication<Services, Settings> & ExpressOverrides<Services>;
|
|
19
20
|
declare module '@feathersjs/feathers/lib/declarations' {
|
|
20
21
|
interface ServiceOptions {
|
|
21
|
-
|
|
22
|
-
before
|
|
23
|
-
after
|
|
22
|
+
express?: {
|
|
23
|
+
before?: express.RequestHandler[];
|
|
24
|
+
after?: express.RequestHandler[];
|
|
25
|
+
composed?: express.RequestHandler;
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
declare module 'express-serve-static-core' {
|
|
28
30
|
interface Request {
|
|
29
|
-
feathers
|
|
31
|
+
feathers: Partial<FeathersParams> & {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
lookup?: RouteLookup;
|
|
30
35
|
}
|
|
31
36
|
interface Response {
|
|
32
37
|
data?: any;
|
|
33
38
|
hook?: HookContext;
|
|
34
39
|
}
|
|
35
40
|
interface IRouterMatcher<T> {
|
|
36
|
-
<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods
|
|
41
|
+
<P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods> | Application)[]): T;
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
export {};
|
package/lib/handlers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ErrorRequestHandler, RequestHandler } from 'express';
|
|
|
2
2
|
export declare function notFound({ verbose }?: {
|
|
3
3
|
verbose?: boolean;
|
|
4
4
|
}): RequestHandler;
|
|
5
|
-
export
|
|
5
|
+
export type ErrorHandlerOptions = {
|
|
6
6
|
public?: string;
|
|
7
7
|
logger?: boolean | {
|
|
8
8
|
error?: (msg: any) => void;
|
package/lib/handlers.js
CHANGED
|
@@ -45,9 +45,11 @@ function errorHandler(_options = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
if (error.type !== 'FeathersError') {
|
|
47
47
|
const oldError = error;
|
|
48
|
-
error = oldError.errors
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
error = oldError.errors
|
|
49
|
+
? new errors_1.GeneralError(oldError.message, {
|
|
50
|
+
errors: oldError.errors
|
|
51
|
+
})
|
|
52
|
+
: new errors_1.GeneralError(oldError.message);
|
|
51
53
|
if (oldError.stack) {
|
|
52
54
|
error.stack = oldError.stack;
|
|
53
55
|
}
|
package/lib/handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,+CAA2D;AAG3D,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC;IAC/C,MAAM,EAAE,OAAO;CAChB,CAAA;AACD,MAAM,gBAAgB,GAAG,cAAI,CAAC,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A;QACrD,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAA;QAExC,iCAAiC;QACjC,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;YACxE,SAAS,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;SACrD;aAAM,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACjG,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;SAC9C;aAAM;YACL,0CAA0C;YAC1C,SAAS,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;SACrD;IACH,CAAC,CAAA;AACH,CAAC;AAzGD,oCAyGC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Express } from 'express';
|
|
2
2
|
import { Application as FeathersApplication } from '@feathersjs/feathers';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
import compression from 'compression';
|
|
5
|
+
import { rest, RestOptions, formatter } from './rest';
|
|
6
|
+
import { errorHandler, notFound, ErrorHandlerOptions } from './handlers';
|
|
7
|
+
import { Application, ExpressOverrides } from './declarations';
|
|
8
|
+
import { AuthenticationSettings, authenticate, parseAuthentication } from './authentication';
|
|
9
|
+
import { default as original, static as serveStatic, json, raw, text, urlencoded, query } from 'express';
|
|
10
|
+
export { original, serveStatic, serveStatic as static, json, raw, text, urlencoded, query, rest, RestOptions, formatter, errorHandler, notFound, Application, ErrorHandlerOptions, ExpressOverrides, AuthenticationSettings, parseAuthentication, authenticate, cors, compression };
|
|
9
11
|
export default function feathersExpress<S = any, C = any>(feathersApp?: FeathersApplication<S, C>, expressApp?: Express): Application<S, C>;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -18,49 +22,49 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
25
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
26
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
28
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
29
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
|
-
});
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
27
|
};
|
|
33
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.
|
|
35
|
-
const express_1 =
|
|
36
|
-
exports.original = express_1.default;
|
|
37
|
-
Object.defineProperty(exports, "static", { enumerable: true, get: function () { return express_1.static; } });
|
|
38
|
-
Object.defineProperty(exports, "json", { enumerable: true, get: function () { return express_1.json; } });
|
|
39
|
-
Object.defineProperty(exports, "raw", { enumerable: true, get: function () { return express_1.raw; } });
|
|
40
|
-
Object.defineProperty(exports, "text", { enumerable: true, get: function () { return express_1.text; } });
|
|
41
|
-
Object.defineProperty(exports, "urlencoded", { enumerable: true, get: function () { return express_1.urlencoded; } });
|
|
42
|
-
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return express_1.query; } });
|
|
29
|
+
exports.compression = exports.cors = exports.authenticate = exports.parseAuthentication = exports.notFound = exports.errorHandler = exports.formatter = exports.rest = exports.query = exports.urlencoded = exports.text = exports.raw = exports.json = exports.static = exports.serveStatic = exports.original = void 0;
|
|
30
|
+
const express_1 = __importDefault(require("express"));
|
|
43
31
|
const feathers_1 = require("@feathersjs/feathers");
|
|
32
|
+
const transport_commons_1 = require("@feathersjs/transport-commons");
|
|
44
33
|
const commons_1 = require("@feathersjs/commons");
|
|
34
|
+
const cors_1 = __importDefault(require("cors"));
|
|
35
|
+
exports.cors = cors_1.default;
|
|
36
|
+
const compression_1 = __importDefault(require("compression"));
|
|
37
|
+
exports.compression = compression_1.default;
|
|
38
|
+
const rest_1 = require("./rest");
|
|
39
|
+
Object.defineProperty(exports, "rest", { enumerable: true, get: function () { return rest_1.rest; } });
|
|
40
|
+
Object.defineProperty(exports, "formatter", { enumerable: true, get: function () { return rest_1.formatter; } });
|
|
45
41
|
const handlers_1 = require("./handlers");
|
|
46
42
|
Object.defineProperty(exports, "errorHandler", { enumerable: true, get: function () { return handlers_1.errorHandler; } });
|
|
47
43
|
Object.defineProperty(exports, "notFound", { enumerable: true, get: function () { return handlers_1.notFound; } });
|
|
48
44
|
const authentication_1 = require("./authentication");
|
|
49
|
-
Object.defineProperty(exports, "parseAuthentication", { enumerable: true, get: function () { return authentication_1.parseAuthentication; } });
|
|
50
45
|
Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return authentication_1.authenticate; } });
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
Object.defineProperty(exports, "parseAuthentication", { enumerable: true, get: function () { return authentication_1.parseAuthentication; } });
|
|
47
|
+
const express_2 = __importStar(require("express"));
|
|
48
|
+
Object.defineProperty(exports, "original", { enumerable: true, get: function () { return express_2.default; } });
|
|
49
|
+
Object.defineProperty(exports, "serveStatic", { enumerable: true, get: function () { return express_2.static; } });
|
|
50
|
+
Object.defineProperty(exports, "static", { enumerable: true, get: function () { return express_2.static; } });
|
|
51
|
+
Object.defineProperty(exports, "json", { enumerable: true, get: function () { return express_2.json; } });
|
|
52
|
+
Object.defineProperty(exports, "raw", { enumerable: true, get: function () { return express_2.raw; } });
|
|
53
|
+
Object.defineProperty(exports, "text", { enumerable: true, get: function () { return express_2.text; } });
|
|
54
|
+
Object.defineProperty(exports, "urlencoded", { enumerable: true, get: function () { return express_2.urlencoded; } });
|
|
55
|
+
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return express_2.query; } });
|
|
56
|
+
const debug = (0, commons_1.createDebug)('@feathersjs/express');
|
|
57
|
+
function feathersExpress(feathersApp, expressApp = (0, express_1.default)()) {
|
|
55
58
|
if (!feathersApp) {
|
|
56
59
|
return expressApp;
|
|
57
60
|
}
|
|
58
61
|
if (typeof feathersApp.setup !== 'function') {
|
|
59
62
|
throw new Error('@feathersjs/express requires a valid Feathers application instance');
|
|
60
63
|
}
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
+
const app = expressApp;
|
|
65
|
+
const { use: expressUse, listen: expressListen } = expressApp;
|
|
66
|
+
const { use: feathersUse, teardown: feathersTeardown } = feathersApp;
|
|
67
|
+
Object.assign(app, {
|
|
64
68
|
use(location, ...rest) {
|
|
65
69
|
let service;
|
|
66
70
|
let options = {};
|
|
@@ -71,7 +75,7 @@ function feathersExpress(feathersApp, expressApp = express_1.default()) {
|
|
|
71
75
|
else if (!service) {
|
|
72
76
|
service = arg;
|
|
73
77
|
}
|
|
74
|
-
else if (arg.methods || arg.events) {
|
|
78
|
+
else if (arg.methods || arg.events || arg.express || arg.koa) {
|
|
75
79
|
options = arg;
|
|
76
80
|
}
|
|
77
81
|
else {
|
|
@@ -82,37 +86,63 @@ function feathersExpress(feathersApp, expressApp = express_1.default()) {
|
|
|
82
86
|
before: [],
|
|
83
87
|
after: []
|
|
84
88
|
});
|
|
85
|
-
const hasMethod = (methods) => methods.some(name =>
|
|
89
|
+
const hasMethod = (methods) => methods.some((name) => service && typeof service[name] === 'function');
|
|
86
90
|
// Check for service (any object with at least one service method)
|
|
87
91
|
if (hasMethod(['handle', 'set']) || !hasMethod(feathers_1.defaultServiceMethods)) {
|
|
88
92
|
debug('Passing app.use call to Express app');
|
|
89
|
-
return
|
|
93
|
+
return expressUse.call(this, location, ...rest);
|
|
90
94
|
}
|
|
91
95
|
debug('Registering service with middleware', middleware);
|
|
92
96
|
// Since this is a service, call Feathers `.use`
|
|
93
|
-
|
|
97
|
+
feathersUse.call(this, location, service, {
|
|
98
|
+
express: middleware,
|
|
99
|
+
...options
|
|
100
|
+
});
|
|
94
101
|
return this;
|
|
95
102
|
},
|
|
96
|
-
listen(...args) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
+
async listen(...args) {
|
|
104
|
+
const server = expressListen.call(this, ...args);
|
|
105
|
+
this.server = server;
|
|
106
|
+
await this.setup(server);
|
|
107
|
+
debug('Feathers application listening');
|
|
108
|
+
return server;
|
|
103
109
|
}
|
|
110
|
+
});
|
|
111
|
+
const appDescriptors = {
|
|
112
|
+
...Object.getOwnPropertyDescriptors(Object.getPrototypeOf(app)),
|
|
113
|
+
...Object.getOwnPropertyDescriptors(app)
|
|
114
|
+
};
|
|
115
|
+
const newDescriptors = {
|
|
116
|
+
...Object.getOwnPropertyDescriptors(Object.getPrototypeOf(feathersApp)),
|
|
117
|
+
...Object.getOwnPropertyDescriptors(feathersApp)
|
|
104
118
|
};
|
|
105
|
-
const feathersDescriptors = Object.assign(Object.assign({}, Object.getOwnPropertyDescriptors(Object.getPrototypeOf(feathersApp))), Object.getOwnPropertyDescriptors(feathersApp));
|
|
106
119
|
// Copy all non-existing properties (including non-enumerables)
|
|
107
120
|
// that don't already exist on the Express app
|
|
108
|
-
Object.keys(
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
Object.defineProperty(expressApp, prop,
|
|
121
|
+
Object.keys(newDescriptors).forEach((prop) => {
|
|
122
|
+
const appProp = appDescriptors[prop];
|
|
123
|
+
const newProp = newDescriptors[prop];
|
|
124
|
+
if (appProp === undefined && newProp !== undefined) {
|
|
125
|
+
Object.defineProperty(expressApp, prop, newProp);
|
|
113
126
|
}
|
|
114
127
|
});
|
|
115
|
-
|
|
128
|
+
// Assign teardown and setup which will also make sure that hooks are initialized
|
|
129
|
+
app.setup = feathersApp.setup;
|
|
130
|
+
app.teardown = async function teardown(server) {
|
|
131
|
+
return feathersTeardown.call(this, server).then(() => new Promise((resolve, reject) => {
|
|
132
|
+
if (this.server) {
|
|
133
|
+
this.server.close((e) => (e ? reject(e) : resolve(this)));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
resolve(this);
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
};
|
|
140
|
+
app.configure((0, transport_commons_1.routing)());
|
|
141
|
+
app.use((req, _res, next) => {
|
|
142
|
+
req.feathers = { ...req.feathers, provider: 'rest' };
|
|
143
|
+
return next();
|
|
144
|
+
});
|
|
145
|
+
return app;
|
|
116
146
|
}
|
|
117
147
|
exports.default = feathersExpress;
|
|
118
148
|
if (typeof module !== 'undefined') {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA0C;AAC1C,mDAAgG;AAChG,qEAAuD;AACvD,iDAAiD;AACjD,gDAAuB;AA6BrB,eA7BK,cAAI,CA6BL;AA5BN,8DAAqC;AA6BnC,sBA7BK,qBAAW,CA6BL;AA3Bb,iCAAqD;AAenD,qFAfO,WAAI,OAeP;AAEJ,0FAjB0B,gBAAS,OAiB1B;AAhBX,yCAAwE;AAiBtE,6FAjBO,uBAAY,OAiBP;AACZ,yFAlBqB,mBAAQ,OAkBrB;AAhBV,qDAA4F;AAsB1F,6FAtB+B,6BAAY,OAsB/B;AADZ,oGArB6C,oCAAmB,OAqB7C;AApBrB,mDAAwG;AAGtG,yFAHkB,iBAAQ,OAGlB;AACR,4FAJsC,gBAAW,OAItC;AACI,uFALuB,gBAAW,OAK5B;AACrB,qFANmD,cAAI,OAMnD;AACJ,oFAPyD,aAAG,OAOzD;AACH,qFAR8D,cAAI,OAQ9D;AACJ,2FAToE,oBAAU,OASpE;AACV,sFAVgF,eAAK,OAUhF;AAgBP,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,qBAAqB,CAAC,CAAA;AAEhD,SAAwB,eAAe,CACrC,WAAuC,EACvC,aAAsB,IAAA,iBAAO,GAAE;IAE/B,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,UAAiB,CAAA;KACzB;IAED,IAAI,OAAO,WAAW,CAAC,KAAK,KAAK,UAAU,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;KACtF;IA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AK,WAAW,EAAE;IACjC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;CAChE"}
|
package/lib/rest.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare
|
|
1
|
+
import { RequestHandler } from 'express';
|
|
2
|
+
import { AuthenticationSettings } from './authentication';
|
|
3
|
+
import { Application } from './declarations';
|
|
4
|
+
export declare const formatter: RequestHandler;
|
|
5
|
+
export type RestOptions = {
|
|
6
|
+
formatter?: RequestHandler;
|
|
7
|
+
authentication?: AuthenticationSettings;
|
|
8
|
+
};
|
|
9
|
+
export declare const rest: (options?: RestOptions | RequestHandler) => (app: Application) => void;
|