@loopback/express 1.2.0 → 1.2.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/CHANGELOG.md +8 -0
- package/dist/express.server.d.ts +6 -6
- package/dist/express.server.js.map +1 -1
- package/dist/middleware-registry.d.ts +21 -20
- package/dist/middleware-registry.js.map +1 -1
- package/dist/mixins/middleware.mixin.d.ts +21 -20
- package/dist/mixins/middleware.mixin.js.map +1 -1
- package/package.json +9 -9
- package/src/express.server.ts +2 -2
- package/src/middleware-registry.ts +22 -0
- package/src/mixins/middleware.mixin.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [1.2.1](https://github.com/strongloop/loopback-next/compare/@loopback/express@1.2.0...@loopback/express@1.2.1) (2020-05-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/express
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [1.2.0](https://github.com/strongloop/loopback-next/compare/@loopback/express@1.1.0...@loopback/express@1.2.0) (2020-05-19)
|
|
7
15
|
|
|
8
16
|
|
package/dist/express.server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Context, Server } from '@loopback/core';
|
|
2
|
-
import { HttpServer,
|
|
2
|
+
import { HttpOptions, HttpServer, HttpsOptions } from '@loopback/http-server';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { BaseMiddlewareRegistry } from './middleware-registry';
|
|
5
5
|
import { MiddlewareContext, Request } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for a LoopBack based Express server
|
|
8
8
|
*/
|
|
9
|
-
export declare type ExpressServerConfig =
|
|
9
|
+
export declare type ExpressServerConfig = (HttpOptions | HttpsOptions) & {
|
|
10
10
|
/**
|
|
11
11
|
* Base path to mount the LoopBack middleware chain
|
|
12
12
|
*/
|
|
@@ -20,7 +20,7 @@ export declare type ExpressServerConfig = HttpServerOptions & {
|
|
|
20
20
|
* An Express server that provides middleware composition and injection
|
|
21
21
|
*/
|
|
22
22
|
export declare class ExpressServer extends BaseMiddlewareRegistry implements Server {
|
|
23
|
-
protected readonly config?: (
|
|
23
|
+
protected readonly config?: (HttpOptions & {
|
|
24
24
|
/**
|
|
25
25
|
* Base path to mount the LoopBack middleware chain
|
|
26
26
|
*/
|
|
@@ -29,7 +29,7 @@ export declare class ExpressServer extends BaseMiddlewareRegistry implements Ser
|
|
|
29
29
|
* Express settings
|
|
30
30
|
*/
|
|
31
31
|
settings?: Record<string, unknown> | undefined;
|
|
32
|
-
}) | (
|
|
32
|
+
}) | (HttpsOptions & {
|
|
33
33
|
/**
|
|
34
34
|
* Base path to mount the LoopBack middleware chain
|
|
35
35
|
*/
|
|
@@ -51,7 +51,7 @@ export declare class ExpressServer extends BaseMiddlewareRegistry implements Ser
|
|
|
51
51
|
* HTTP/HTTPS server
|
|
52
52
|
*/
|
|
53
53
|
protected httpServer: HttpServer;
|
|
54
|
-
constructor(config?: (
|
|
54
|
+
constructor(config?: (HttpOptions & {
|
|
55
55
|
/**
|
|
56
56
|
* Base path to mount the LoopBack middleware chain
|
|
57
57
|
*/
|
|
@@ -60,7 +60,7 @@ export declare class ExpressServer extends BaseMiddlewareRegistry implements Ser
|
|
|
60
60
|
* Express settings
|
|
61
61
|
*/
|
|
62
62
|
settings?: Record<string, unknown> | undefined;
|
|
63
|
-
}) | (
|
|
63
|
+
}) | (HttpsOptions & {
|
|
64
64
|
/**
|
|
65
65
|
* Base path to mount the LoopBack middleware chain
|
|
66
66
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.server.js","sourceRoot":"","sources":["../src/express.server.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,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@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Binding, BindingAddress, Constructor, Context, Provider } from '@loopback/core';
|
|
2
2
|
import { ExpressMiddlewareFactory, ExpressRequestHandler, Middleware, MiddlewareBindingOptions } from './types';
|
|
3
|
+
import { JSONObject, ContextSubscriptionManager, ContextEvent, ResolutionOptions, BindingKey, BindingFilter, ValueOrPromise, ContextEventObserver, ContextObserver, Subscription, BindingComparator, ContextView, ResolutionSession, BindingCreationPolicy, ContextInspectOptions } from '@loopback/context';
|
|
3
4
|
/**
|
|
4
5
|
* A context that allows middleware registration
|
|
5
6
|
*/
|
|
@@ -57,37 +58,37 @@ declare const BaseMiddlewareRegistry_base: {
|
|
|
57
58
|
new (...args: any[]): {
|
|
58
59
|
expressMiddleware(key: BindingAddress<unknown>, middleware: ExpressRequestHandler | ExpressRequestHandler[], options?: MiddlewareBindingOptions | undefined): Binding<Middleware>;
|
|
59
60
|
expressMiddleware<CFG>(middlewareFactory: ExpressMiddlewareFactory<CFG>, middlewareConfig?: CFG | undefined, options?: MiddlewareBindingOptions | undefined): Binding<Middleware>;
|
|
60
|
-
expressMiddleware<CFG_1>(factoryOrKey: string |
|
|
61
|
+
expressMiddleware<CFG_1>(factoryOrKey: string | BindingKey<Middleware> | ExpressMiddlewareFactory<CFG_1>, configOrHandler: ExpressRequestHandler | ExpressRequestHandler[] | CFG_1, options?: MiddlewareBindingOptions | undefined): Binding<Middleware>;
|
|
61
62
|
middleware(middleware: Middleware | Constructor<Provider<Middleware>>, options?: MiddlewareBindingOptions): Binding<Middleware>;
|
|
62
63
|
readonly name: string;
|
|
63
|
-
readonly subscriptionManager:
|
|
64
|
+
readonly subscriptionManager: ContextSubscriptionManager;
|
|
64
65
|
readonly parent: Context | undefined;
|
|
65
|
-
emitEvent: <T extends
|
|
66
|
+
emitEvent: <T extends ContextEvent>(type: string, event: T) => void;
|
|
66
67
|
emitError: (err: unknown) => void;
|
|
67
68
|
bind: <ValueType = any>(key: BindingAddress<ValueType>) => Binding<ValueType>;
|
|
68
69
|
add: (binding: Binding<unknown>) => Context;
|
|
69
|
-
configure: <ConfigValueType = any>(key?: string |
|
|
70
|
-
getConfigAsValueOrPromise: <ConfigValueType_1>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
71
|
-
getConfig: <ConfigValueType_2>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
72
|
-
getConfigSync: <ConfigValueType_3>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
70
|
+
configure: <ConfigValueType = any>(key?: string | BindingKey<unknown> | undefined) => Binding<ConfigValueType>;
|
|
71
|
+
getConfigAsValueOrPromise: <ConfigValueType_1>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ValueOrPromise<ConfigValueType_1 | undefined>;
|
|
72
|
+
getConfig: <ConfigValueType_2>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>;
|
|
73
|
+
getConfigSync: <ConfigValueType_3>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ConfigValueType_3 | undefined;
|
|
73
74
|
unbind: (key: BindingAddress<unknown>) => boolean;
|
|
74
|
-
subscribe: (observer:
|
|
75
|
-
unsubscribe: (observer:
|
|
75
|
+
subscribe: (observer: ContextEventObserver) => Subscription;
|
|
76
|
+
unsubscribe: (observer: ContextEventObserver) => boolean;
|
|
76
77
|
close: () => void;
|
|
77
|
-
isSubscribed: (observer:
|
|
78
|
-
createView: <T_1 = unknown>(filter:
|
|
78
|
+
isSubscribed: (observer: ContextObserver) => boolean;
|
|
79
|
+
createView: <T_1 = unknown>(filter: BindingFilter, comparator?: BindingComparator | undefined) => ContextView<T_1>;
|
|
79
80
|
contains: (key: BindingAddress<unknown>) => boolean;
|
|
80
81
|
isBound: (key: BindingAddress<unknown>) => boolean;
|
|
81
82
|
getOwnerContext: (key: BindingAddress<unknown>) => Context | undefined;
|
|
82
|
-
find: <ValueType_1 = any>(pattern?: string | RegExp |
|
|
83
|
+
find: <ValueType_1 = any>(pattern?: string | RegExp | BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[];
|
|
83
84
|
findByTag: <ValueType_2 = any>(tagFilter: string | RegExp | Record<string, any>) => Readonly<Binding<ValueType_2>>[];
|
|
84
85
|
get: {
|
|
85
|
-
<ValueType_3>(keyWithPath: BindingAddress<ValueType_3>, session?:
|
|
86
|
-
<ValueType_4>(keyWithPath: BindingAddress<ValueType_4>, options:
|
|
86
|
+
<ValueType_3>(keyWithPath: BindingAddress<ValueType_3>, session?: ResolutionSession | undefined): Promise<ValueType_3>;
|
|
87
|
+
<ValueType_4>(keyWithPath: BindingAddress<ValueType_4>, options: ResolutionOptions): Promise<ValueType_4 | undefined>;
|
|
87
88
|
};
|
|
88
89
|
getSync: {
|
|
89
|
-
<ValueType_5>(keyWithPath: BindingAddress<ValueType_5>, session?:
|
|
90
|
-
<ValueType_6>(keyWithPath: BindingAddress<ValueType_6>, options?:
|
|
90
|
+
<ValueType_5>(keyWithPath: BindingAddress<ValueType_5>, session?: ResolutionSession | undefined): ValueType_5;
|
|
91
|
+
<ValueType_6>(keyWithPath: BindingAddress<ValueType_6>, options?: ResolutionOptions | undefined): ValueType_6 | undefined;
|
|
91
92
|
};
|
|
92
93
|
getBinding: {
|
|
93
94
|
<ValueType_7 = any>(key: BindingAddress<ValueType_7>): Binding<ValueType_7>;
|
|
@@ -95,10 +96,10 @@ declare const BaseMiddlewareRegistry_base: {
|
|
|
95
96
|
optional?: boolean | undefined;
|
|
96
97
|
} | undefined): Binding<ValueType_8> | undefined;
|
|
97
98
|
};
|
|
98
|
-
findOrCreateBinding: <T_2>(key: BindingAddress<T_2>, policy?:
|
|
99
|
-
getValueOrPromise: <ValueType_9>(keyWithPath: BindingAddress<ValueType_9>, optionsOrSession?:
|
|
100
|
-
toJSON: () =>
|
|
101
|
-
inspect: (options?:
|
|
99
|
+
findOrCreateBinding: <T_2>(key: BindingAddress<T_2>, policy?: BindingCreationPolicy | undefined) => Binding<T_2>;
|
|
100
|
+
getValueOrPromise: <ValueType_9>(keyWithPath: BindingAddress<ValueType_9>, optionsOrSession?: ResolutionOptions | ResolutionSession | undefined) => ValueOrPromise<ValueType_9 | undefined>;
|
|
101
|
+
toJSON: () => JSONObject;
|
|
102
|
+
inspect: (options?: ContextInspectOptions | undefined) => JSONObject;
|
|
102
103
|
addListener: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
103
104
|
on: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
104
105
|
once: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-registry.js","sourceRoot":"","sources":["../src/middleware-registry.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAMwB;AACxB,gEAA0D;
|
|
1
|
+
{"version":3,"file":"middleware-registry.js","sourceRoot":"","sources":["../src/middleware-registry.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAMwB;AACxB,gEAA0D;AAiG1D;;GAEG;AACH,MAAsB,sBAAuB,SAAQ,kCAAe,CAAC,cAAO,CAAC;CAAG;AAAhF,wDAAgF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Binding, BindingAddress, Constructor, Context, MixinTarget, Provider } from '@loopback/core';
|
|
2
2
|
import { ExpressMiddlewareFactory, ExpressRequestHandler, Middleware, MiddlewareBindingOptions } from '../types';
|
|
3
|
+
import { JSONObject, ContextSubscriptionManager, ContextEvent, ResolutionOptions, BindingKey, BindingFilter, ValueOrPromise, ContextEventObserver, ContextObserver, Subscription, BindingComparator, ContextView, ResolutionSession, BindingCreationPolicy, ContextInspectOptions } from '@loopback/context';
|
|
3
4
|
export declare function MiddlewareMixin<T extends MixinTarget<Context>>(superClass: T): {
|
|
4
5
|
new (...args: any[]): {
|
|
5
6
|
/**
|
|
@@ -52,7 +53,7 @@ export declare function MiddlewareMixin<T extends MixinTarget<Context>>(superCla
|
|
|
52
53
|
* @param middleware - Express middleware handler function(s)
|
|
53
54
|
*
|
|
54
55
|
*/
|
|
55
|
-
expressMiddleware<CFG_1>(factoryOrKey: string |
|
|
56
|
+
expressMiddleware<CFG_1>(factoryOrKey: string | BindingKey<Middleware> | ExpressMiddlewareFactory<CFG_1>, configOrHandler: ExpressRequestHandler | ExpressRequestHandler[] | CFG_1, options?: MiddlewareBindingOptions | undefined): Binding<Middleware>;
|
|
56
57
|
/**
|
|
57
58
|
* Register a middleware function or provider class
|
|
58
59
|
*
|
|
@@ -69,34 +70,34 @@ export declare function MiddlewareMixin<T extends MixinTarget<Context>>(superCla
|
|
|
69
70
|
*/
|
|
70
71
|
middleware(middleware: Middleware | Constructor<Provider<Middleware>>, options?: MiddlewareBindingOptions): Binding<Middleware>;
|
|
71
72
|
readonly name: string;
|
|
72
|
-
readonly subscriptionManager:
|
|
73
|
+
readonly subscriptionManager: ContextSubscriptionManager;
|
|
73
74
|
readonly parent: Context | undefined;
|
|
74
|
-
emitEvent: <T_1 extends
|
|
75
|
+
emitEvent: <T_1 extends ContextEvent>(type: string, event: T_1) => void;
|
|
75
76
|
emitError: (err: unknown) => void;
|
|
76
77
|
bind: <ValueType = any>(key: BindingAddress<ValueType>) => Binding<ValueType>;
|
|
77
78
|
add: (binding: Binding<unknown>) => Context;
|
|
78
|
-
configure: <ConfigValueType = any>(key?: string |
|
|
79
|
-
getConfigAsValueOrPromise: <ConfigValueType_1>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
80
|
-
getConfig: <ConfigValueType_2>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
81
|
-
getConfigSync: <ConfigValueType_3>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?:
|
|
79
|
+
configure: <ConfigValueType = any>(key?: string | BindingKey<unknown> | undefined) => Binding<ConfigValueType>;
|
|
80
|
+
getConfigAsValueOrPromise: <ConfigValueType_1>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ValueOrPromise<ConfigValueType_1 | undefined>;
|
|
81
|
+
getConfig: <ConfigValueType_2>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>;
|
|
82
|
+
getConfigSync: <ConfigValueType_3>(key: BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: ResolutionOptions | undefined) => ConfigValueType_3 | undefined;
|
|
82
83
|
unbind: (key: BindingAddress<unknown>) => boolean;
|
|
83
|
-
subscribe: (observer:
|
|
84
|
-
unsubscribe: (observer:
|
|
84
|
+
subscribe: (observer: ContextEventObserver) => Subscription;
|
|
85
|
+
unsubscribe: (observer: ContextEventObserver) => boolean;
|
|
85
86
|
close: () => void;
|
|
86
|
-
isSubscribed: (observer:
|
|
87
|
-
createView: <T_2 = unknown>(filter:
|
|
87
|
+
isSubscribed: (observer: ContextObserver) => boolean;
|
|
88
|
+
createView: <T_2 = unknown>(filter: BindingFilter, comparator?: BindingComparator | undefined) => ContextView<T_2>;
|
|
88
89
|
contains: (key: BindingAddress<unknown>) => boolean;
|
|
89
90
|
isBound: (key: BindingAddress<unknown>) => boolean;
|
|
90
91
|
getOwnerContext: (key: BindingAddress<unknown>) => Context | undefined;
|
|
91
|
-
find: <ValueType_1 = any>(pattern?: string | RegExp |
|
|
92
|
+
find: <ValueType_1 = any>(pattern?: string | RegExp | BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[];
|
|
92
93
|
findByTag: <ValueType_2 = any>(tagFilter: string | RegExp | Record<string, any>) => Readonly<Binding<ValueType_2>>[];
|
|
93
94
|
get: {
|
|
94
|
-
<ValueType_3>(keyWithPath: BindingAddress<ValueType_3>, session?:
|
|
95
|
-
<ValueType_4>(keyWithPath: BindingAddress<ValueType_4>, options:
|
|
95
|
+
<ValueType_3>(keyWithPath: BindingAddress<ValueType_3>, session?: ResolutionSession | undefined): Promise<ValueType_3>;
|
|
96
|
+
<ValueType_4>(keyWithPath: BindingAddress<ValueType_4>, options: ResolutionOptions): Promise<ValueType_4 | undefined>;
|
|
96
97
|
};
|
|
97
98
|
getSync: {
|
|
98
|
-
<ValueType_5>(keyWithPath: BindingAddress<ValueType_5>, session?:
|
|
99
|
-
<ValueType_6>(keyWithPath: BindingAddress<ValueType_6>, options?:
|
|
99
|
+
<ValueType_5>(keyWithPath: BindingAddress<ValueType_5>, session?: ResolutionSession | undefined): ValueType_5;
|
|
100
|
+
<ValueType_6>(keyWithPath: BindingAddress<ValueType_6>, options?: ResolutionOptions | undefined): ValueType_6 | undefined;
|
|
100
101
|
};
|
|
101
102
|
getBinding: {
|
|
102
103
|
<ValueType_7 = any>(key: BindingAddress<ValueType_7>): Binding<ValueType_7>;
|
|
@@ -104,10 +105,10 @@ export declare function MiddlewareMixin<T extends MixinTarget<Context>>(superCla
|
|
|
104
105
|
optional?: boolean | undefined;
|
|
105
106
|
} | undefined): Binding<ValueType_8> | undefined;
|
|
106
107
|
};
|
|
107
|
-
findOrCreateBinding: <T_3>(key: BindingAddress<T_3>, policy?:
|
|
108
|
-
getValueOrPromise: <ValueType_9>(keyWithPath: BindingAddress<ValueType_9>, optionsOrSession?:
|
|
109
|
-
toJSON: () =>
|
|
110
|
-
inspect: (options?:
|
|
108
|
+
findOrCreateBinding: <T_3>(key: BindingAddress<T_3>, policy?: BindingCreationPolicy | undefined) => Binding<T_3>;
|
|
109
|
+
getValueOrPromise: <ValueType_9>(keyWithPath: BindingAddress<ValueType_9>, optionsOrSession?: ResolutionOptions | ResolutionSession | undefined) => ValueOrPromise<ValueType_9 | undefined>;
|
|
110
|
+
toJSON: () => JSONObject;
|
|
111
|
+
inspect: (options?: ContextInspectOptions | undefined) => JSONObject;
|
|
111
112
|
addListener: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
112
113
|
on: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
113
114
|
once: (event: string | symbol, listener: (...args: any[]) => void) => Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.mixin.js","sourceRoot":"","sources":["../../src/mixins/middleware.mixin.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAQwB;AACxB,8CAIuB;
|
|
1
|
+
{"version":3,"file":"middleware.mixin.js","sourceRoot":"","sources":["../../src/mixins/middleware.mixin.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iCAAiC;AACjC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAQwB;AACxB,8CAIuB;AA+BvB,SAAS,WAAW,CAClB,QAA8B,EAC9B,SAA+B;IAE/B,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACnC,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;KAClC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,eAAe,CAAiC,UAAa;IAC3E,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,cAAO,CAAC,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;KACrE;IACD,OAAO,KAAM,SAAQ,UAAU;QAuD7B;;;WAGG;QACH,iBAAiB,CACf,YAAwE,EACxE,gBAAuE,EACvE,UAAoC,EAAE;YAEtC,MAAM,GAAG,GAAG,YAA0C,CAAC;YACvD,IAAI,uBAAgB,CAAC,GAAG,CAAC,EAAE;gBACzB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;oBAC9C,CAAC,CAAC,gBAAgB;oBAClB,CAAC,CAAC,CAAC,gBAAyC,CAAC,CAAC;gBAChD,oDAAoD;gBACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;oBACzB,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;iBACH;gBACD,OAAO,+BAAkB,CACtB,IAA2B,EAC5B,yBAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC/C;oBACE,GAAG,OAAO;oBACV,GAAG;iBACJ,CACF,CAAC;aACH;iBAAM;gBACL,OAAO,sCAAyB,CAC7B,IAA2B,EAC5B,YAA6C,EAC7C,gBAAuB,EACvB,OAAO,CACR,CAAC;aACH;QACH,CAAC;QAED;;;;;;;;;;;;;WAaG;QACH,UAAU,CACR,UAA0D,EAC1D,UAAoC,EAAE;YAEtC,OAAO,+BAAkB,CACtB,IAA2B,EAC5B,UAAU,EACV,OAAO,CACR,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA1HD,0CA0HC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/express",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "@loopback/express",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"!*/__tests__"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loopback/context": "^3.8.
|
|
37
|
-
"@loopback/core": "^2.
|
|
38
|
-
"@loopback/http-server": "^2.1.
|
|
36
|
+
"@loopback/context": "^3.8.1",
|
|
37
|
+
"@loopback/core": "^2.7.0",
|
|
38
|
+
"@loopback/http-server": "^2.1.5",
|
|
39
39
|
"@types/body-parser": "^1.19.0",
|
|
40
40
|
"@types/express": "^4.17.6",
|
|
41
41
|
"@types/express-serve-static-core": "^4.17.6",
|
|
@@ -48,18 +48,18 @@
|
|
|
48
48
|
"tslib": "^2.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@loopback/build": "^5.4.
|
|
52
|
-
"@loopback/testlab": "^3.1.
|
|
51
|
+
"@loopback/build": "^5.4.1",
|
|
52
|
+
"@loopback/testlab": "^3.1.5",
|
|
53
53
|
"@types/debug": "^4.1.5",
|
|
54
|
-
"@types/node": "^10.17.
|
|
54
|
+
"@types/node": "^10.17.24",
|
|
55
55
|
"@types/on-finished": "^2.3.1",
|
|
56
56
|
"http-errors": "^1.7.3",
|
|
57
57
|
"source-map-support": "^0.5.19",
|
|
58
|
-
"typescript": "~3.9.
|
|
58
|
+
"typescript": "~3.9.3"
|
|
59
59
|
},
|
|
60
60
|
"copyright.owner": "IBM Corp.",
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "62aea854bf85c5a5995b59e6908fe5409f7eea96"
|
|
65
65
|
}
|
package/src/express.server.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// License text available at https://opensource.org/licenses/MIT
|
|
5
5
|
|
|
6
6
|
import {Context, CoreBindings, inject, Server} from '@loopback/core';
|
|
7
|
-
import {HttpServer,
|
|
7
|
+
import {HttpOptions, HttpServer, HttpsOptions} from '@loopback/http-server';
|
|
8
8
|
import debugFactory from 'debug';
|
|
9
9
|
import express from 'express';
|
|
10
10
|
import {toExpressMiddleware} from './middleware';
|
|
@@ -16,7 +16,7 @@ const debug = debugFactory('loopback:middleware');
|
|
|
16
16
|
/**
|
|
17
17
|
* Configuration for a LoopBack based Express server
|
|
18
18
|
*/
|
|
19
|
-
export type ExpressServerConfig =
|
|
19
|
+
export type ExpressServerConfig = (HttpOptions | HttpsOptions) & {
|
|
20
20
|
/**
|
|
21
21
|
* Base path to mount the LoopBack middleware chain
|
|
22
22
|
*/
|
|
@@ -18,6 +18,28 @@ import {
|
|
|
18
18
|
MiddlewareBindingOptions,
|
|
19
19
|
} from './types';
|
|
20
20
|
|
|
21
|
+
// FIXME(rfeng): Workaround for https://github.com/microsoft/rushstack/pull/1867
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
23
|
+
import {
|
|
24
|
+
JSONObject,
|
|
25
|
+
ContextSubscriptionManager,
|
|
26
|
+
ContextEvent,
|
|
27
|
+
Interceptor,
|
|
28
|
+
InterceptorBindingOptions,
|
|
29
|
+
ResolutionOptions,
|
|
30
|
+
BindingKey,
|
|
31
|
+
BindingFilter,
|
|
32
|
+
ValueOrPromise,
|
|
33
|
+
ContextEventObserver,
|
|
34
|
+
ContextObserver,
|
|
35
|
+
Subscription,
|
|
36
|
+
BindingComparator,
|
|
37
|
+
ContextView,
|
|
38
|
+
ResolutionSession,
|
|
39
|
+
BindingCreationPolicy,
|
|
40
|
+
ContextInspectOptions,
|
|
41
|
+
} from '@loopback/context';
|
|
42
|
+
|
|
21
43
|
/**
|
|
22
44
|
* A context that allows middleware registration
|
|
23
45
|
*/
|
|
@@ -25,6 +25,28 @@ import {
|
|
|
25
25
|
MiddlewareBindingOptions,
|
|
26
26
|
} from '../types';
|
|
27
27
|
|
|
28
|
+
// FIXME(rfeng): Workaround for https://github.com/microsoft/rushstack/pull/1867
|
|
29
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
30
|
+
import {
|
|
31
|
+
JSONObject,
|
|
32
|
+
ContextSubscriptionManager,
|
|
33
|
+
ContextEvent,
|
|
34
|
+
Interceptor,
|
|
35
|
+
InterceptorBindingOptions,
|
|
36
|
+
ResolutionOptions,
|
|
37
|
+
BindingKey,
|
|
38
|
+
BindingFilter,
|
|
39
|
+
ValueOrPromise,
|
|
40
|
+
ContextEventObserver,
|
|
41
|
+
ContextObserver,
|
|
42
|
+
Subscription,
|
|
43
|
+
BindingComparator,
|
|
44
|
+
ContextView,
|
|
45
|
+
ResolutionSession,
|
|
46
|
+
BindingCreationPolicy,
|
|
47
|
+
ContextInspectOptions,
|
|
48
|
+
} from '@loopback/context';
|
|
49
|
+
|
|
28
50
|
function extendsFrom(
|
|
29
51
|
subClass: Constructor<unknown>,
|
|
30
52
|
baseClass: Constructor<unknown>,
|