@loopback/core 1.9.0 → 1.10.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 +43 -0
- package/dist/application.d.ts +12 -2
- package/dist/application.js +6 -4
- package/dist/application.js.map +1 -1
- package/dist/extension-point.d.ts +1 -1
- package/dist/keys.d.ts +2 -2
- package/dist/keys.js.map +1 -1
- package/package.json +8 -8
- package/src/application.ts +23 -3
- package/src/keys.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
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.10.1](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.10.0...@loopback/core@1.10.1) (2019-09-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.10.0](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.9.3...@loopback/core@1.10.0) (2019-09-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **core:** allow application to accept a parent context ([ee50007](https://github.com/strongloop/loopback-next/commit/ee50007))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.9.3](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.9.2...@loopback/core@1.9.3) (2019-08-19)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @loopback/core
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [1.9.2](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.9.1...@loopback/core@1.9.2) (2019-08-15)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @loopback/core
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [1.9.1](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.9.0...@loopback/core@1.9.1) (2019-08-15)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @loopback/core
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
# [1.9.0](https://github.com/strongloop/loopback-next/compare/@loopback/core@1.8.7...@loopback/core@1.9.0) (2019-07-31)
|
|
7
50
|
|
|
8
51
|
|
package/dist/application.d.ts
CHANGED
|
@@ -8,8 +8,18 @@ import { Server } from './server';
|
|
|
8
8
|
* and models.
|
|
9
9
|
*/
|
|
10
10
|
export declare class Application extends Context implements LifeCycleObserver {
|
|
11
|
-
options: ApplicationConfig;
|
|
12
|
-
|
|
11
|
+
readonly options: ApplicationConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Create an application with the given parent context
|
|
14
|
+
* @param parent - Parent context
|
|
15
|
+
*/
|
|
16
|
+
constructor(parent: Context);
|
|
17
|
+
/**
|
|
18
|
+
* Create an application with the given configuration and parent context
|
|
19
|
+
* @param config - Application configuration
|
|
20
|
+
* @param parent - Parent context
|
|
21
|
+
*/
|
|
22
|
+
constructor(config?: ApplicationConfig, parent?: Context);
|
|
13
23
|
/**
|
|
14
24
|
* Register a controller class with this application.
|
|
15
25
|
*
|
package/dist/application.js
CHANGED
|
@@ -17,9 +17,11 @@ const debug = debugFactory('loopback:core:application');
|
|
|
17
17
|
* and models.
|
|
18
18
|
*/
|
|
19
19
|
class Application extends context_1.Context {
|
|
20
|
-
constructor(
|
|
21
|
-
super('application');
|
|
22
|
-
|
|
20
|
+
constructor(configOrParent, parent) {
|
|
21
|
+
super(configOrParent instanceof context_1.Context ? configOrParent : parent, 'application');
|
|
22
|
+
if (configOrParent instanceof context_1.Context)
|
|
23
|
+
configOrParent = {};
|
|
24
|
+
this.options = configOrParent || {};
|
|
23
25
|
// Bind the life cycle observer registry
|
|
24
26
|
this.bind(keys_1.CoreBindings.LIFE_CYCLE_OBSERVER_REGISTRY)
|
|
25
27
|
.toClass(lifecycle_registry_1.LifeCycleObserverRegistry)
|
|
@@ -27,7 +29,7 @@ class Application extends context_1.Context {
|
|
|
27
29
|
// Bind to self to allow injection of application context in other modules.
|
|
28
30
|
this.bind(keys_1.CoreBindings.APPLICATION_INSTANCE).to(this);
|
|
29
31
|
// Make options available to other modules as well.
|
|
30
|
-
this.bind(keys_1.CoreBindings.APPLICATION_CONFIG).to(options);
|
|
32
|
+
this.bind(keys_1.CoreBindings.APPLICATION_CONFIG).to(this.options);
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Register a controller class with this application.
|
package/dist/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;AAEhE,+CAU2B;AAC3B,sCAAsC;AACtC,2CAAsD;AACtD,iCAA8C;AAC9C,2CAIqB;AACrB,6DAA+D;AAE/D,MAAM,KAAK,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,iBAAO;
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;AAEhE,+CAU2B;AAC3B,sCAAsC;AACtC,2CAAsD;AACtD,iCAA8C;AAC9C,2CAIqB;AACrB,6DAA+D;AAE/D,MAAM,KAAK,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAa,WAAY,SAAQ,iBAAO;IAetC,YAAY,cAA4C,EAAE,MAAgB;QACxE,KAAK,CACH,cAAc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,OAAO,CAAC,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACI,OAAO,CACZ,GAA8C,EAC9C,IAAa;QAEb,IAAI,CAAC,IAAI,IAAI,yBAAe,CAAC,GAAG,CAAC,EAAE;YACjC,gDAAgD;YAChD,gDAAgD;YAChD,MAAM,UAAU,GAAG,4BAAkB,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,iBAAO,CAAC,IAAI,CAAI,UAAU,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAC/D,IACE,QAAQ,CAAC,MAAM,CAAC,qBAAW,CAAC,QAAQ,CAAC;gBACrC,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAW,CAAC,IAAI,CAAC,EAClC;gBACA,qDAAqD;gBACrD,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;aAC1C;SACF;QACD,MAAM,OAAO,GAAG,gCAAsB,CAAC,GAAG,EAAE;YAC1C,IAAI;YACJ,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA7SD,kCA6SC"}
|
|
@@ -41,7 +41,7 @@ export declare function extensionPoint(name: string, ...specs: BindingSpec[]): C
|
|
|
41
41
|
* extension points, use different `extensionPointName` for different types of
|
|
42
42
|
* extensions.
|
|
43
43
|
*/
|
|
44
|
-
export declare function extensions(extensionPointName?: string): (target: Object, member: string, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void;
|
|
44
|
+
export declare function extensions(extensionPointName?: string): (target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void;
|
|
45
45
|
/**
|
|
46
46
|
* A factory function to create binding filter for extensions of a named
|
|
47
47
|
* extension point
|
package/dist/keys.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BindingKey } from '@loopback/context';
|
|
2
|
-
import { Application, ApplicationMetadata } from './application';
|
|
2
|
+
import { Application, ApplicationConfig, ApplicationMetadata } from './application';
|
|
3
3
|
import { LifeCycleObserverOptions, LifeCycleObserverRegistry } from './lifecycle-registry';
|
|
4
4
|
/**
|
|
5
5
|
* Namespace for core binding keys
|
|
@@ -12,7 +12,7 @@ export declare namespace CoreBindings {
|
|
|
12
12
|
/**
|
|
13
13
|
* Binding key for application configuration
|
|
14
14
|
*/
|
|
15
|
-
const APPLICATION_CONFIG: BindingKey<
|
|
15
|
+
const APPLICATION_CONFIG: BindingKey<ApplicationConfig>;
|
|
16
16
|
/**
|
|
17
17
|
* Binding key for the content of `package.json`
|
|
18
18
|
*/
|
package/dist/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;AAEhE,+CAA6C;
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,8BAA8B;AAC9B,+CAA+C;AAC/C,gEAAgE;;AAEhE,+CAA6C;AAY7C;;GAEG;AACH,IAAiB,YAAY,CAgF5B;AAhFD,WAAiB,YAAY;IAC3B,cAAc;IACd;;OAEG;IACU,iCAAoB,GAAG,oBAAU,CAAC,MAAM,CACnD,sBAAsB,CACvB,CAAC;IAEF;;OAEG;IACU,+BAAkB,GAAG,oBAAU,CAAC,MAAM,CACjD,oBAAoB,CACrB,CAAC;IAEF;;OAEG;IACU,iCAAoB,GAAG,oBAAU,CAAC,MAAM,CACnD,sBAAsB,CACvB,CAAC;IAEF,SAAS;IACT;;OAEG;IACU,oBAAO,GAA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
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "LoopBack 4 core",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.9"
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"copyright.owner": "IBM Corp.",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@loopback/context": "^1.
|
|
22
|
+
"@loopback/context": "^1.22.1",
|
|
23
23
|
"debug": "^4.1.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@loopback/build": "^2.0.
|
|
27
|
-
"@loopback/eslint-config": "^
|
|
28
|
-
"@loopback/testlab": "^1.
|
|
29
|
-
"@types/debug": "^4.1.
|
|
30
|
-
"@types/node": "^10.14.
|
|
26
|
+
"@loopback/build": "^2.0.10",
|
|
27
|
+
"@loopback/eslint-config": "^4.0.2",
|
|
28
|
+
"@loopback/testlab": "^1.8.0",
|
|
29
|
+
"@types/debug": "^4.1.5",
|
|
30
|
+
"@types/node": "^10.14.17"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"README.md",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"url": "https://github.com/strongloop/loopback-next.git",
|
|
43
43
|
"directory": "packages/core"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "4e653bbff797b26437bd1b0817ed9b8c91f3477b"
|
|
46
46
|
}
|
package/src/application.ts
CHANGED
|
@@ -32,8 +32,28 @@ const debug = debugFactory('loopback:core:application');
|
|
|
32
32
|
* and models.
|
|
33
33
|
*/
|
|
34
34
|
export class Application extends Context implements LifeCycleObserver {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
public readonly options: ApplicationConfig;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create an application with the given parent context
|
|
39
|
+
* @param parent - Parent context
|
|
40
|
+
*/
|
|
41
|
+
constructor(parent: Context);
|
|
42
|
+
/**
|
|
43
|
+
* Create an application with the given configuration and parent context
|
|
44
|
+
* @param config - Application configuration
|
|
45
|
+
* @param parent - Parent context
|
|
46
|
+
*/
|
|
47
|
+
constructor(config?: ApplicationConfig, parent?: Context);
|
|
48
|
+
|
|
49
|
+
constructor(configOrParent?: ApplicationConfig | Context, parent?: Context) {
|
|
50
|
+
super(
|
|
51
|
+
configOrParent instanceof Context ? configOrParent : parent,
|
|
52
|
+
'application',
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (configOrParent instanceof Context) configOrParent = {};
|
|
56
|
+
this.options = configOrParent || {};
|
|
37
57
|
|
|
38
58
|
// Bind the life cycle observer registry
|
|
39
59
|
this.bind(CoreBindings.LIFE_CYCLE_OBSERVER_REGISTRY)
|
|
@@ -42,7 +62,7 @@ export class Application extends Context implements LifeCycleObserver {
|
|
|
42
62
|
// Bind to self to allow injection of application context in other modules.
|
|
43
63
|
this.bind(CoreBindings.APPLICATION_INSTANCE).to(this);
|
|
44
64
|
// Make options available to other modules as well.
|
|
45
|
-
this.bind(CoreBindings.APPLICATION_CONFIG).to(options);
|
|
65
|
+
this.bind(CoreBindings.APPLICATION_CONFIG).to(this.options);
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
/**
|
package/src/keys.ts
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
// License text available at https://opensource.org/licenses/MIT
|
|
5
5
|
|
|
6
6
|
import {BindingKey} from '@loopback/context';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Application,
|
|
9
|
+
ApplicationConfig,
|
|
10
|
+
ApplicationMetadata,
|
|
11
|
+
ControllerClass,
|
|
12
|
+
} from './application';
|
|
8
13
|
import {
|
|
9
14
|
LifeCycleObserverOptions,
|
|
10
15
|
LifeCycleObserverRegistry,
|
|
@@ -25,7 +30,7 @@ export namespace CoreBindings {
|
|
|
25
30
|
/**
|
|
26
31
|
* Binding key for application configuration
|
|
27
32
|
*/
|
|
28
|
-
export const APPLICATION_CONFIG = BindingKey.create<
|
|
33
|
+
export const APPLICATION_CONFIG = BindingKey.create<ApplicationConfig>(
|
|
29
34
|
'application.config',
|
|
30
35
|
);
|
|
31
36
|
|