@nx-ddd/core 4.0.0 → 4.1.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/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './di';
2
2
  export * from './nx-module';
3
+ export * from './test-bed';
package/index.js CHANGED
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./di"), exports);
5
5
  tslib_1.__exportStar(require("./nx-module"), exports);
6
+ tslib_1.__exportStar(require("./test-bed"), exports);
6
7
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/core/src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAqB;AACrB,sDAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/core/src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAqB;AACrB,sDAA4B;AAC5B,qDAA2B"}
@@ -1,5 +1,6 @@
1
+ import { Provider } from '../di/interface/provider';
1
2
  export interface NxModule {
2
3
  imports?: any[];
3
- providers?: any[];
4
+ providers?: Provider[];
4
5
  }
5
6
  export declare function NxModule(nxModule: NxModule): (target: any) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"nx-module.js","sourceRoot":"","sources":["../../../../libs/core/src/nx-module/nx-module.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAOlD,SAAgB,QAAQ,CAAC,QAAkB;IACzC,OAAO,UAAU,MAAM;;QACrB,MAAM,CAAC,iBAAU,CAAC,GAAG;YACnB,OAAO,EAAE,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC;YACtC,SAAS,EAAE,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC;SAC3C,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AARD,4BAQC"}
1
+ {"version":3,"file":"nx-module.js","sourceRoot":"","sources":["../../../../libs/core/src/nx-module/nx-module.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAQlD,SAAgB,QAAQ,CAAC,QAAkB;IACzC,OAAO,UAAU,MAAM;;QACrB,MAAM,CAAC,iBAAU,CAAC,GAAG;YACnB,OAAO,EAAE,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC;YACtC,SAAS,EAAE,CAAC,GAAG,CAAC,MAAA,QAAQ,CAAC,SAAS,mCAAI,EAAE,CAAC,CAAC;SAC3C,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AARD,4BAQC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx-ddd/core",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "dependencies": {},
@@ -0,0 +1,10 @@
1
+ import { NxModule } from "../nx-module";
2
+ export declare class TestBed {
3
+ static _INSTANCE: TestBed;
4
+ static get INSTANCE(): TestBed;
5
+ private moduleRef;
6
+ configureTestingModule(nxModule: NxModule): this;
7
+ inject(token: any): any;
8
+ static inject(token: any): any;
9
+ static configureTestingModule(nxModule: NxModule): TestBed;
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestBed = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const nx_module_1 = require("../nx-module");
6
+ class TestBed {
7
+ static get INSTANCE() {
8
+ var _a;
9
+ return (_a = this._INSTANCE) !== null && _a !== void 0 ? _a : (this._INSTANCE = new this());
10
+ }
11
+ configureTestingModule(nxModule) {
12
+ let Module = class Module {
13
+ };
14
+ Module = tslib_1.__decorate([
15
+ (0, nx_module_1.NxModule)(nxModule)
16
+ ], Module);
17
+ this.moduleRef = (0, nx_module_1.createNxModuleRef)(Module);
18
+ return this;
19
+ }
20
+ inject(token) {
21
+ return this.moduleRef.injector.get(token);
22
+ }
23
+ static inject(token) {
24
+ return this.INSTANCE.inject(token);
25
+ }
26
+ static configureTestingModule(nxModule) {
27
+ return this.INSTANCE.configureTestingModule(nxModule);
28
+ }
29
+ }
30
+ exports.TestBed = TestBed;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/core/src/test-bed/index.ts"],"names":[],"mappings":";;;;AAAA,4CAAwE;AAExE,MAAa,OAAO;IAGlB,MAAM,KAAK,QAAQ;;QACjB,aAAO,IAAI,CAAC,SAAS,oCAAd,IAAI,CAAC,SAAS,GAAK,IAAI,IAAI,EAAE,EAAC;IACvC,CAAC;IAID,sBAAsB,CAAC,QAAkB;QACnB,IAAM,MAAM,GAAZ,MAAM,MAAM;SAAI,CAAA;QAAV,MAAM;YAA/B,IAAA,oBAAQ,EAAC,QAAQ,CAAC;WAAO,MAAM,CAAI;QACpC,IAAI,CAAC,SAAS,GAAG,IAAA,6BAAiB,EAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAU;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAU;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,sBAAsB,CAAC,QAAkB;QAC9C,OAAO,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;CACF;AA1BD,0BA0BC"}
@@ -1,23 +0,0 @@
1
- import { InjectionToken } from 'injection-js';
2
- import 'reflect-metadata';
3
- export declare const EXAMPLE_VALUE: InjectionToken<unknown>;
4
- export declare abstract class Repository {
5
- get name(): string;
6
- }
7
- export declare class AppService {
8
- repository: Repository;
9
- constructor(repository: Repository);
10
- }
11
- export declare class FeatureModule {
12
- }
13
- export declare class LibraryModule {
14
- static forRoot(): {
15
- nxModule: typeof LibraryModule;
16
- providers: {
17
- provide: InjectionToken<unknown>;
18
- useValue: string;
19
- }[];
20
- };
21
- }
22
- export declare class AppModule {
23
- }
package/_testing/index.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var LibraryModule_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AppModule = exports.LibraryModule = exports.FeatureModule = exports.AppService = exports.Repository = exports.EXAMPLE_VALUE = void 0;
5
- const tslib_1 = require("tslib");
6
- const nx_module_1 = require("../nx-module");
7
- const injection_js_1 = require("injection-js");
8
- require("reflect-metadata");
9
- exports.EXAMPLE_VALUE = new injection_js_1.InjectionToken('examole value');
10
- let Repository = class Repository {
11
- get name() {
12
- throw new Error('Repository.name is not implemented!');
13
- }
14
- };
15
- Repository = tslib_1.__decorate([
16
- (0, injection_js_1.Injectable)()
17
- ], Repository);
18
- exports.Repository = Repository;
19
- let AppService = class AppService {
20
- constructor(repository) {
21
- this.repository = repository;
22
- }
23
- };
24
- AppService = tslib_1.__decorate([
25
- (0, injection_js_1.Injectable)(),
26
- tslib_1.__metadata("design:paramtypes", [Repository])
27
- ], AppService);
28
- exports.AppService = AppService;
29
- let FeatureModule = class FeatureModule {
30
- };
31
- FeatureModule = tslib_1.__decorate([
32
- (0, nx_module_1.NxModule)({
33
- imports: [],
34
- providers: [{ provide: exports.EXAMPLE_VALUE, useValue: 'featureValue' }],
35
- })
36
- ], FeatureModule);
37
- exports.FeatureModule = FeatureModule;
38
- let LibraryModule = LibraryModule_1 = class LibraryModule {
39
- static forRoot() {
40
- return {
41
- nxModule: LibraryModule_1,
42
- providers: [
43
- { provide: exports.EXAMPLE_VALUE, useValue: 'rootValue' },
44
- ],
45
- };
46
- }
47
- };
48
- LibraryModule = LibraryModule_1 = tslib_1.__decorate([
49
- (0, nx_module_1.NxModule)({
50
- imports: [
51
- FeatureModule,
52
- ],
53
- providers: []
54
- })
55
- ], LibraryModule);
56
- exports.LibraryModule = LibraryModule;
57
- let AppModule = class AppModule {
58
- };
59
- AppModule = tslib_1.__decorate([
60
- (0, nx_module_1.NxModule)({
61
- imports: [
62
- LibraryModule.forRoot(),
63
- ],
64
- providers: [
65
- AppService,
66
- Repository,
67
- ]
68
- })
69
- ], AppModule);
70
- exports.AppModule = AppModule;
71
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/core/src/_testing/index.ts"],"names":[],"mappings":";;;;;AAAA,4CAAwC;AACxC,+CAA0D;AAC1D,4BAA0B;AAEb,QAAA,aAAa,GAAG,IAAI,6BAAc,CAAC,eAAe,CAAC,CAAC;AAI1D,IAAe,UAAU,GAAzB,MAAe,UAAU;IAC9B,IAAI,IAAI;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AAJqB,UAAU;IAD/B,IAAA,yBAAU,GAAE;GACS,UAAU,CAI/B;AAJqB,gCAAU;AAOzB,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAI,CAAC;CAC/C,CAAA;AAFY,UAAU;IADtB,IAAA,yBAAU,GAAE;6CAEoB,UAAU;GAD9B,UAAU,CAEtB;AAFY,gCAAU;AAQhB,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAI,CAAA;AAAjB,aAAa;IAJzB,IAAA,oBAAQ,EAAC;QACR,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAa,EAAE,QAAQ,EAAE,cAAc,EAAC,CAAC;KACjE,CAAC;GACW,aAAa,CAAI;AAAjB,sCAAa;AAQnB,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,QAAQ,EAAE,eAAa;YACvB,SAAS,EAAE;gBACT,EAAC,OAAO,EAAE,qBAAa,EAAE,QAAQ,EAAE,WAAW,EAAC;aAChD;SACF,CAAA;IACH,CAAC;CACF,CAAA;AATY,aAAa;IANzB,IAAA,oBAAQ,EAAC;QACR,OAAO,EAAE;YACP,aAAa;SACd;QACD,SAAS,EAAE,EAAE;KACd,CAAC;GACW,aAAa,CASzB;AATY,sCAAa;AAoBnB,IAAM,SAAS,GAAf,MAAM,SAAS;CAAI,CAAA;AAAb,SAAS;IATrB,IAAA,oBAAQ,EAAC;QACR,OAAO,EAAE;YACP,aAAa,CAAC,OAAO,EAAE;SACxB;QACD,SAAS,EAAE;YACT,UAAU;YACV,UAAU;SACX;KACF,CAAC;GACW,SAAS,CAAI;AAAb,8BAAS"}