@expressots/core 1.6.0 → 1.7.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/lib/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
 
2
2
 
3
+ ## [1.7.0](https://github.com/expressots/expressots/compare/1.6.0...1.7.0) (2023-08-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * bump @release-it/conventional-changelog from 5.1.1 to 6.0.0 ([#61](https://github.com/expressots/expressots/issues/61)) ([634304b](https://github.com/expressots/expressots/commit/634304b8228a0c6f4a4e8298961f46e4bd5c9b7c))
9
+ * bump @types/node from 18.17.4 to 20.4.9 ([#72](https://github.com/expressots/expressots/issues/72)) ([31a887d](https://github.com/expressots/expressots/commit/31a887d3a33923dba4c8d952ec60046e21f08361))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add `options` parameter to `AppContainer` ([#73](https://github.com/expressots/expressots/issues/73)) ([804d5cd](https://github.com/expressots/expressots/commit/804d5cd568830584322d877b91dffaed8c952e56))
15
+
3
16
  ## [1.6.0](https://github.com/expressots/expressots/compare/1.5.1...1.6.0) (2023-08-07)
4
17
 
5
18
 
@@ -5,6 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
8
11
  var AppContainer_1;
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
10
13
  exports.AppContainer = void 0;
@@ -12,20 +15,33 @@ const inversify_1 = require("inversify");
12
15
  const inversify_binding_decorators_1 = require("inversify-binding-decorators");
13
16
  /**
14
17
  * The AppContainer class provides a container for managing dependency injection.
18
+ * It allows the creation of a container with custom options, including default binding scope
19
+ * and the ability to skip base class checks. The container can be loaded with multiple
20
+ * ContainerModule instances, facilitating modular and organized code.
21
+ *
22
+ * Usage:
23
+ * const appContainer = new AppContainer(options);
24
+ * const container = appContainer.create(modules);
25
+ *
15
26
  * @provide AppContainer
16
27
  */
17
28
  let AppContainer = AppContainer_1 = class AppContainer {
29
+ /**
30
+ * Constructs the AppContainer instance.
31
+ * @param options - The options for creating the container. Can include custom default scope and skip base class checks setting.
32
+ */
33
+ constructor(options) {
34
+ this.options = Object.assign({ defaultScope: inversify_1.BindingScopeEnum.Request }, options);
35
+ }
18
36
  /**
19
37
  * Creates and configures a new dependency injection container.
20
38
  * @param modules - An array of ContainerModule instances to load into the container.
21
39
  * @param defaultScope - The default scope to use for bindings. Scoped (Request) by default, but offers Singleton and Transient as well.
22
40
  * @returns The configured dependency injection container.
23
41
  */
24
- create(modules, defaultScope = inversify_1.BindingScopeEnum.Request) {
25
- this.container = new inversify_1.Container({
26
- autoBindInjectable: true,
27
- defaultScope,
28
- });
42
+ create(modules) {
43
+ const containerOptions = Object.assign({ autoBindInjectable: true }, this.options);
44
+ this.container = new inversify_1.Container(containerOptions);
29
45
  this.container.load((0, inversify_binding_decorators_1.buildProviderModule)(), ...modules);
30
46
  return this.container;
31
47
  }
@@ -41,7 +57,7 @@ let AppContainer = AppContainer_1 = class AppContainer {
41
57
  * @returns The container options.
42
58
  */
43
59
  getContainerOptions() {
44
- return this.container["options"];
60
+ return this.container.options;
45
61
  }
46
62
  /**
47
63
  * Retrieves the container.
@@ -53,5 +69,6 @@ let AppContainer = AppContainer_1 = class AppContainer {
53
69
  };
54
70
  exports.AppContainer = AppContainer;
55
71
  exports.AppContainer = AppContainer = AppContainer_1 = __decorate([
56
- (0, inversify_binding_decorators_1.provide)(AppContainer_1)
72
+ (0, inversify_binding_decorators_1.provide)(AppContainer_1),
73
+ __metadata("design:paramtypes", [Object])
57
74
  ], AppContainer);
@@ -1,17 +1,45 @@
1
1
  import { Container, ContainerModule, interfaces } from "inversify";
2
+ /**
3
+ * Interface for container options that can be passed to the AppContainer class.
4
+ */
5
+ interface ContainerOptions {
6
+ /**
7
+ * The default scope for bindings in the container.
8
+ * It can be set to Request (default), Singleton, or Transient.
9
+ */
10
+ defaultScope?: interfaces.BindingScope;
11
+ /**
12
+ * Allows skipping of base class checks when working with derived classes.
13
+ */
14
+ skipBaseClassChecks?: boolean;
15
+ }
2
16
  /**
3
17
  * The AppContainer class provides a container for managing dependency injection.
18
+ * It allows the creation of a container with custom options, including default binding scope
19
+ * and the ability to skip base class checks. The container can be loaded with multiple
20
+ * ContainerModule instances, facilitating modular and organized code.
21
+ *
22
+ * Usage:
23
+ * const appContainer = new AppContainer(options);
24
+ * const container = appContainer.create(modules);
25
+ *
4
26
  * @provide AppContainer
5
27
  */
6
28
  declare class AppContainer {
7
29
  private container;
30
+ private options;
31
+ /**
32
+ * Constructs the AppContainer instance.
33
+ * @param options - The options for creating the container. Can include custom default scope and skip base class checks setting.
34
+ */
35
+ constructor(options?: ContainerOptions);
8
36
  /**
9
37
  * Creates and configures a new dependency injection container.
10
38
  * @param modules - An array of ContainerModule instances to load into the container.
11
39
  * @param defaultScope - The default scope to use for bindings. Scoped (Request) by default, but offers Singleton and Transient as well.
12
40
  * @returns The configured dependency injection container.
13
41
  */
14
- create(modules: ContainerModule[], defaultScope?: interfaces.BindingScope): Container;
42
+ create(modules: ContainerModule[]): Container;
15
43
  /**
16
44
  * Retrieves the binding dictionary of the container.
17
45
  * @returns The binding dictionary of the container.
@@ -1 +1 @@
1
- {"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACX,MAAM,WAAW,CAAC;AAGnB;;;GAGG;AACH,cACM,YAAY;IAChB,OAAO,CAAC,SAAS,CAAa;IAC9B;;;;;OAKG;IACI,MAAM,CACX,OAAO,EAAE,eAAe,EAAE,EAC1B,YAAY,GAAE,UAAU,CAAC,YAAuC,GAC/D,SAAS;IAWZ;;;OAGG;IACI,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAI5C;;;OAGG;IACI,mBAAmB,IAAI,UAAU,CAAC,gBAAgB;IAIzD;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACX,MAAM,WAAW,CAAC;AAGnB;;GAEG;AACH,UAAU,gBAAgB;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC;IAEvC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD;;;;;;;;;;;GAWG;AACH,cACM,YAAY;IAChB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,OAAO,CAAmB;IAEjC;;;MAGE;gBACS,OAAO,CAAC,EAAE,gBAAgB;IAOtC;;;;;OAKG;IACI,MAAM,CACX,OAAO,EAAE,eAAe,EAAE,GACzB,SAAS;IAYZ;;;OAGG;IACI,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAI5C;;;OAGG;IACI,mBAAmB,IAAI,UAAU,CAAC,gBAAgB;IAIzD;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -4,26 +4,49 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
7
10
  var AppContainer_1;
8
11
  import { BindingScopeEnum, Container, } from "inversify";
9
12
  import { buildProviderModule, provide } from "inversify-binding-decorators";
10
13
  /**
11
14
  * The AppContainer class provides a container for managing dependency injection.
15
+ * It allows the creation of a container with custom options, including default binding scope
16
+ * and the ability to skip base class checks. The container can be loaded with multiple
17
+ * ContainerModule instances, facilitating modular and organized code.
18
+ *
19
+ * Usage:
20
+ * const appContainer = new AppContainer(options);
21
+ * const container = appContainer.create(modules);
22
+ *
12
23
  * @provide AppContainer
13
24
  */
14
25
  let AppContainer = AppContainer_1 = class AppContainer {
15
26
  container;
27
+ options;
28
+ /**
29
+ * Constructs the AppContainer instance.
30
+ * @param options - The options for creating the container. Can include custom default scope and skip base class checks setting.
31
+ */
32
+ constructor(options) {
33
+ this.options = {
34
+ defaultScope: BindingScopeEnum.Request,
35
+ ...options,
36
+ };
37
+ }
16
38
  /**
17
39
  * Creates and configures a new dependency injection container.
18
40
  * @param modules - An array of ContainerModule instances to load into the container.
19
41
  * @param defaultScope - The default scope to use for bindings. Scoped (Request) by default, but offers Singleton and Transient as well.
20
42
  * @returns The configured dependency injection container.
21
43
  */
22
- create(modules, defaultScope = BindingScopeEnum.Request) {
23
- this.container = new Container({
44
+ create(modules) {
45
+ const containerOptions = {
24
46
  autoBindInjectable: true,
25
- defaultScope,
26
- });
47
+ ...this.options,
48
+ };
49
+ this.container = new Container(containerOptions);
27
50
  this.container.load(buildProviderModule(), ...modules);
28
51
  return this.container;
29
52
  }
@@ -39,7 +62,7 @@ let AppContainer = AppContainer_1 = class AppContainer {
39
62
  * @returns The container options.
40
63
  */
41
64
  getContainerOptions() {
42
- return this.container["options"];
65
+ return this.container.options;
43
66
  }
44
67
  /**
45
68
  * Retrieves the container.
@@ -50,6 +73,7 @@ let AppContainer = AppContainer_1 = class AppContainer {
50
73
  }
51
74
  };
52
75
  AppContainer = AppContainer_1 = __decorate([
53
- provide(AppContainer_1)
76
+ provide(AppContainer_1),
77
+ __metadata("design:paramtypes", [Object])
54
78
  ], AppContainer);
55
79
  export { AppContainer };
@@ -1,17 +1,45 @@
1
1
  import { Container, ContainerModule, interfaces } from "inversify";
2
+ /**
3
+ * Interface for container options that can be passed to the AppContainer class.
4
+ */
5
+ interface ContainerOptions {
6
+ /**
7
+ * The default scope for bindings in the container.
8
+ * It can be set to Request (default), Singleton, or Transient.
9
+ */
10
+ defaultScope?: interfaces.BindingScope;
11
+ /**
12
+ * Allows skipping of base class checks when working with derived classes.
13
+ */
14
+ skipBaseClassChecks?: boolean;
15
+ }
2
16
  /**
3
17
  * The AppContainer class provides a container for managing dependency injection.
18
+ * It allows the creation of a container with custom options, including default binding scope
19
+ * and the ability to skip base class checks. The container can be loaded with multiple
20
+ * ContainerModule instances, facilitating modular and organized code.
21
+ *
22
+ * Usage:
23
+ * const appContainer = new AppContainer(options);
24
+ * const container = appContainer.create(modules);
25
+ *
4
26
  * @provide AppContainer
5
27
  */
6
28
  declare class AppContainer {
7
29
  private container;
30
+ private options;
31
+ /**
32
+ * Constructs the AppContainer instance.
33
+ * @param options - The options for creating the container. Can include custom default scope and skip base class checks setting.
34
+ */
35
+ constructor(options?: ContainerOptions);
8
36
  /**
9
37
  * Creates and configures a new dependency injection container.
10
38
  * @param modules - An array of ContainerModule instances to load into the container.
11
39
  * @param defaultScope - The default scope to use for bindings. Scoped (Request) by default, but offers Singleton and Transient as well.
12
40
  * @returns The configured dependency injection container.
13
41
  */
14
- create(modules: ContainerModule[], defaultScope?: interfaces.BindingScope): Container;
42
+ create(modules: ContainerModule[]): Container;
15
43
  /**
16
44
  * Retrieves the binding dictionary of the container.
17
45
  * @returns The binding dictionary of the container.
@@ -1 +1 @@
1
- {"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACX,MAAM,WAAW,CAAC;AAGnB;;;GAGG;AACH,cACM,YAAY;IAChB,OAAO,CAAC,SAAS,CAAa;IAC9B;;;;;OAKG;IACI,MAAM,CACX,OAAO,EAAE,eAAe,EAAE,EAC1B,YAAY,GAAE,UAAU,CAAC,YAAuC,GAC/D,SAAS;IAWZ;;;OAGG;IACI,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAI5C;;;OAGG;IACI,mBAAmB,IAAI,UAAU,CAAC,gBAAgB;IAIzD;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"app-container.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/application/app-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,eAAe,EACf,UAAU,EACX,MAAM,WAAW,CAAC;AAGnB;;GAEG;AACH,UAAU,gBAAgB;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC;IAEvC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD;;;;;;;;;;;GAWG;AACH,cACM,YAAY;IAChB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,OAAO,CAAmB;IAEjC;;;MAGE;gBACS,OAAO,CAAC,EAAE,gBAAgB;IAOtC;;;;;OAKG;IACI,MAAM,CACX,OAAO,EAAE,eAAe,EAAE,GACzB,SAAS;IAYZ;;;OAGG;IACI,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC;IAI5C;;;OAGG;IACI,mBAAmB,IAAI,UAAU,CAAC,gBAAgB;IAIzD;;;OAGG;IACH,IAAW,SAAS,IAAI,SAAS,CAEhC;CACF;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@commitlint/cli": "^17.5.1",
68
68
  "@commitlint/config-conventional": "^17.4.4",
69
- "@release-it/conventional-changelog": "^5.1.1",
69
+ "@release-it/conventional-changelog": "^6.0.0",
70
70
  "chalk": "^4.1.2",
71
71
  "dotenv": "^16.0.3",
72
72
  "express": "^4.18.2",
@@ -83,7 +83,7 @@
83
83
  "devDependencies": {
84
84
  "@types/express": "^4.17.17",
85
85
  "@types/jest": "^29.5.0",
86
- "@types/node": "^18.15.11",
86
+ "@types/node": "^20.4.9",
87
87
  "prettier": "3.0.1",
88
88
  "ts-jest": "^29.0.5",
89
89
  "typescript": "^5.0.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressots/core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
5
5
  "author": "Richard Zampieri",
6
6
  "main": "./lib/cjs/index.js",
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@commitlint/cli": "^17.5.1",
68
68
  "@commitlint/config-conventional": "^17.4.4",
69
- "@release-it/conventional-changelog": "^5.1.1",
69
+ "@release-it/conventional-changelog": "^6.0.0",
70
70
  "chalk": "^4.1.2",
71
71
  "dotenv": "^16.0.3",
72
72
  "express": "^4.18.2",
@@ -83,7 +83,7 @@
83
83
  "devDependencies": {
84
84
  "@types/express": "^4.17.17",
85
85
  "@types/jest": "^29.5.0",
86
- "@types/node": "^18.15.11",
86
+ "@types/node": "^20.4.9",
87
87
  "prettier": "3.0.1",
88
88
  "ts-jest": "^29.0.5",
89
89
  "typescript": "^5.0.3"