taon 18.0.25 → 18.0.27
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/README.md +112 -51
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/esm2022/lib/endpoint-context.mjs +4 -1
- package/browser/esm2022/lib/index.mjs +2 -2
- package/browser/esm2022/lib/models.mjs +1 -1
- package/browser/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +11 -11
- package/browser/fesm2022/taon.mjs +3 -0
- package/browser/fesm2022/taon.mjs.map +1 -1
- package/browser/lib/models.d.ts +5 -0
- package/browser/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +4 -4
- package/cli.js +11 -17
- package/cli.js.map +1 -1
- package/client/esm2022/lib/endpoint-context.mjs +4 -1
- package/client/esm2022/lib/index.mjs +2 -2
- package/client/esm2022/lib/models.mjs +1 -1
- package/client/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +11 -11
- package/client/fesm2022/taon.mjs +3 -0
- package/client/fesm2022/taon.mjs.map +1 -1
- package/client/lib/models.d.ts +5 -0
- package/client/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +4 -4
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/base-classes/base-abstract-entity.js +30 -28
- package/lib/base-classes/base-abstract-entity.js.map +1 -1
- package/lib/base-classes/base-class.js +9 -17
- package/lib/base-classes/base-class.js.map +1 -1
- package/lib/base-classes/base-context.js +4 -4
- package/lib/base-classes/base-context.js.map +1 -1
- package/lib/base-classes/base-controller.js +15 -15
- package/lib/base-classes/base-controller.js.map +1 -1
- package/lib/base-classes/base-crud-controller.js +211 -329
- package/lib/base-classes/base-crud-controller.js.map +1 -1
- package/lib/base-classes/base-entity.js +15 -15
- package/lib/base-classes/base-entity.js.map +1 -1
- package/lib/base-classes/base-injector.js +99 -124
- package/lib/base-classes/base-injector.js.map +1 -1
- package/lib/base-classes/base-migration.js +15 -31
- package/lib/base-classes/base-migration.js.map +1 -1
- package/lib/base-classes/base-provider.js +3 -9
- package/lib/base-classes/base-provider.js.map +1 -1
- package/lib/base-classes/base-repository.js +310 -444
- package/lib/base-classes/base-repository.js.map +1 -1
- package/lib/base-classes/base-subscriber-for-entity.js +73 -73
- package/lib/base-classes/base-subscriber-for-entity.js.map +1 -1
- package/lib/base-classes/base.js +10 -10
- package/lib/base-classes/base.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/context-db-migrations.js +325 -581
- package/lib/context-db-migrations.js.map +1 -1
- package/lib/create-context.js +80 -109
- package/lib/create-context.js.map +1 -1
- package/lib/decorators/classes/controller-decorator.js +15 -13
- package/lib/decorators/classes/controller-decorator.js.map +1 -1
- package/lib/decorators/classes/entity-decorator.js +23 -20
- package/lib/decorators/classes/entity-decorator.js.map +1 -1
- package/lib/decorators/classes/migration-decorator.js +7 -13
- package/lib/decorators/classes/migration-decorator.js.map +1 -1
- package/lib/decorators/classes/provider-decorator.js +7 -13
- package/lib/decorators/classes/provider-decorator.js.map +1 -1
- package/lib/decorators/classes/repository-decorator.js +7 -13
- package/lib/decorators/classes/repository-decorator.js.map +1 -1
- package/lib/decorators/classes/subscriber-decorator.js +8 -13
- package/lib/decorators/classes/subscriber-decorator.js.map +1 -1
- package/lib/decorators/http/http-decorators.js +4 -4
- package/lib/decorators/http/http-decorators.js.map +1 -1
- package/lib/decorators/http/http-methods-decorators.js +19 -25
- package/lib/decorators/http/http-methods-decorators.js.map +1 -1
- package/lib/decorators/http/http-params-decorators.js +7 -9
- package/lib/decorators/http/http-params-decorators.js.map +1 -1
- package/lib/dependency-injection/di-container.js +13 -18
- package/lib/dependency-injection/di-container.js.map +1 -1
- package/lib/endpoint-context.js +1196 -1543
- package/lib/endpoint-context.js.map +1 -1
- package/lib/entity-process.js +102 -112
- package/lib/entity-process.js.map +1 -1
- package/lib/env.js +2 -2
- package/lib/env.js.map +1 -1
- package/lib/formly/formly-group-wrapper-component.js +45 -23
- package/lib/formly/formly-group-wrapper-component.js.map +1 -1
- package/lib/formly/formly-repeat-component.js +74 -27
- package/lib/formly/formly-repeat-component.js.map +1 -1
- package/lib/formly/formly.models.js.map +1 -1
- package/lib/formly/fromly.js +57 -61
- package/lib/formly/fromly.js.map +1 -1
- package/lib/formly/type-from-entity.js +11 -16
- package/lib/formly/type-from-entity.js.map +1 -1
- package/lib/get-response-value.js +22 -33
- package/lib/get-response-value.js.map +1 -1
- package/lib/helpers/class-helpers.js +62 -73
- package/lib/helpers/class-helpers.js.map +1 -1
- package/lib/helpers/taon-helpers.js +33 -31
- package/lib/helpers/taon-helpers.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.d.ts +1 -25
- package/lib/index.js +44 -41
- package/lib/index.js.map +1 -1
- package/lib/inject.js +15 -15
- package/lib/inject.js.map +1 -1
- package/lib/models.d.ts +5 -0
- package/lib/models.js +124 -100
- package/lib/models.js.map +1 -1
- package/lib/orm.js +13 -27
- package/lib/orm.js.map +1 -1
- package/lib/realtime/realtime-client.js +70 -65
- package/lib/realtime/realtime-client.js.map +1 -1
- package/lib/realtime/realtime-core.js +48 -29
- package/lib/realtime/realtime-core.js.map +1 -1
- package/lib/realtime/realtime-server.js +81 -80
- package/lib/realtime/realtime-server.js.map +1 -1
- package/lib/realtime/realtime-strategy/index.js +18 -5
- package/lib/realtime/realtime-strategy/index.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js +132 -172
- package/lib/realtime/realtime-strategy/realtime-strategy-ipc.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.js +158 -241
- package/lib/realtime/realtime-strategy/realtime-strategy-mock.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js +18 -29
- package/lib/realtime/realtime-strategy/realtime-strategy-socket-io.js.map +1 -1
- package/lib/realtime/realtime-strategy/realtime-strategy.js +9 -13
- package/lib/realtime/realtime-strategy/realtime-strategy.js.map +1 -1
- package/lib/realtime/realtime-subs-manager.js +29 -30
- package/lib/realtime/realtime-subs-manager.js.map +1 -1
- package/lib/realtime/realtime.models.js.map +1 -1
- package/lib/storage.js +1 -1
- package/lib/storage.js.map +1 -1
- package/lib/symbols.js +62 -66
- package/lib/symbols.js.map +1 -1
- package/lib/ui/directives/index.js +2 -2
- package/lib/ui/directives/index.js.map +1 -1
- package/lib/ui/directives/view-mode.js.map +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.js.map +1 -1
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.d.ts +2 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js +5 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/index.js.map +1 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.component.d.ts +29 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-admin-edit-mode/taon-admin-edit-mode.module.d.ts +2 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.d.ts +1 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js +5 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/index.js.map +1 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-db-admin/taon-db-admin.component.d.ts +8 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.d.ts +2 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js +5 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/index.js.map +1 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.component.d.ts +13 -0
- package/lib/ui/taon-admin-mode-configuration/components/taon-file-general-opt/taon-file-general-opt.module.d.ts +2 -0
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js.map +1 -1
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.d.ts +5 -0
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js +3 -0
- package/lib/ui/taon-admin-mode-configuration/models/taon-admin-mode-tabs.js.map +1 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin-control.service.d.ts +14 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +4 -4
- package/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.module.d.ts +2 -0
- package/lib/ui/taon-admin-mode-configuration/taon-admin.models.js.map +1 -1
- package/lib/ui/taon-github-fork-me-corner/index.js +2 -2
- package/lib/ui/taon-github-fork-me-corner/index.js.map +1 -1
- package/lib/ui/taon-github-fork-me-ribbon/index.js +2 -2
- package/lib/ui/taon-github-fork-me-ribbon/index.js.map +1 -1
- package/lib/ui/taon-notifications/index.js +15 -2
- package/lib/ui/taon-notifications/index.js.map +1 -1
- package/lib/ui/taon-notifications/taon-notifications.models.js +2 -2
- package/lib/ui/taon-notifications/taon-notifications.models.js.map +1 -1
- package/lib/ui/taon-progress-bar/index.js +2 -2
- package/lib/ui/taon-progress-bar/index.js.map +1 -1
- package/lib/ui/taon-progress-bar/taon-progress-bar.component.d.ts +2 -1
- package/lib/ui/taon-session-passcode/index.js +2 -2
- package/lib/ui/taon-session-passcode/index.js.map +1 -1
- package/lib/ui/taon-table/index.js +2 -2
- package/lib/ui/taon-table/index.js.map +1 -1
- package/lib/ui/taon.models.js.map +1 -1
- package/lib/validators.js +48 -16
- package/lib/validators.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.d.ts +1 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/old-app .d.ts +1 -0
- package/old-app .js +67 -78
- package/old-app .js.map +1 -1
- package/package.json +18 -65
- package/playground.d.ts +1 -0
- package/playground.js.map +1 -1
- package/src.d.ts +1 -1
- package/taon.jsonc +39 -42
- package/tmp-environment.json +8 -401
- package/websql/esm2022/lib/endpoint-context.mjs +4 -1
- package/websql/esm2022/lib/index.mjs +2 -2
- package/websql/esm2022/lib/models.mjs +1 -1
- package/websql/esm2022/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.mjs +11 -11
- package/websql/fesm2022/taon.mjs +3 -0
- package/websql/fesm2022/taon.mjs.map +1 -1
- package/websql/lib/models.d.ts +5 -0
- package/websql/lib/ui/taon-admin-mode-configuration/taon-admin-mode-configuration.component.d.ts +4 -4
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BaseEntity = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
10
|
//#region @websql
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
11
|
+
const taon_typeorm_1 = require("taon-typeorm");
|
|
12
|
+
const base_class_1 = require("./base-class");
|
|
13
|
+
let EntityDecorator = () => {
|
|
14
|
+
return (target) => { };
|
|
10
15
|
};
|
|
11
16
|
//#region @websql
|
|
12
17
|
EntityDecorator = taon_typeorm_1.Entity;
|
|
13
18
|
//#endregion
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function BaseEntity() {
|
|
17
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18
|
-
}
|
|
19
|
-
BaseEntity = tslib_1.__decorate([
|
|
20
|
-
EntityDecorator()
|
|
21
|
-
], BaseEntity);
|
|
22
|
-
return BaseEntity;
|
|
23
|
-
}(base_class_1.BaseClass));
|
|
19
|
+
let BaseEntity = class BaseEntity extends base_class_1.BaseClass {
|
|
20
|
+
};
|
|
24
21
|
exports.BaseEntity = BaseEntity;
|
|
22
|
+
exports.BaseEntity = BaseEntity = __decorate([
|
|
23
|
+
EntityDecorator()
|
|
24
|
+
], BaseEntity);
|
|
25
25
|
//# sourceMappingURL=base-entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-entity.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-entity.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/taon/src/lib/base-classes/base-entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iBAAiB;AACjB,+CAAsC;AAItC,6CAAyC;AAEzC,IAAI,eAAe,GAAG,GAAG,EAAE;IACzB,OAAO,CAAC,MAAW,EAAE,EAAE,GAAE,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,iBAAiB;AACjB,eAAe,GAAG,qBAAM,CAAC;AACzB,YAAY;AAGL,IAAe,UAAU,GAAzB,MAAe,UAKpB,SAAQ,sBAAiB;CAAG,CAAA;AALR,gCAAU;qBAAV,UAAU;IAD/B,eAAe,EAAE;GACI,UAAU,CAKF"}
|
|
@@ -1,191 +1,160 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseInjector = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
//#region imports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const tnp_core_1 = require("tnp-core");
|
|
6
|
+
const symbols_1 = require("../symbols");
|
|
7
|
+
const class_helpers_1 = require("../helpers/class-helpers");
|
|
9
8
|
//#endregion
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
class BaseInjector {
|
|
10
|
+
/**
|
|
11
|
+
* for proxy purposes
|
|
12
|
+
*/
|
|
13
|
+
getOriginalPrototype;
|
|
14
|
+
/**
|
|
15
|
+
* for proxy purposes
|
|
16
|
+
*/
|
|
17
|
+
getOriginalConstructor;
|
|
19
18
|
//#region class initialization hook
|
|
20
19
|
/**
|
|
21
20
|
* class initialization hook
|
|
22
21
|
* taon after class instace creation
|
|
23
22
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
reposToInit_1_1 = reposToInit_1.next();
|
|
46
|
-
return [3 /*break*/, 2];
|
|
47
|
-
case 5: return [3 /*break*/, 8];
|
|
48
|
-
case 6:
|
|
49
|
-
e_1_1 = _b.sent();
|
|
50
|
-
e_1 = { error: e_1_1 };
|
|
51
|
-
return [3 /*break*/, 8];
|
|
52
|
-
case 7:
|
|
53
|
-
try {
|
|
54
|
-
if (reposToInit_1_1 && !reposToInit_1_1.done && (_a = reposToInit_1.return)) _a.call(reposToInit_1);
|
|
55
|
-
}
|
|
56
|
-
finally { if (e_1) throw e_1.error; }
|
|
57
|
-
return [7 /*endfinally*/];
|
|
58
|
-
case 8: return [2 /*return*/];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
Object.defineProperty(BaseInjector.prototype, "__endpoint_context__", {
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region context
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated use ctx instead
|
|
68
|
-
* Current endpoint context
|
|
69
|
-
*/
|
|
70
|
-
get: function () {
|
|
71
|
-
return this[symbols_1.Symbols.ctxInClassOrClassObj];
|
|
72
|
-
},
|
|
73
|
-
enumerable: false,
|
|
74
|
-
configurable: true
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(BaseInjector.prototype, "ctx", {
|
|
77
|
-
/**
|
|
78
|
-
* get current endpoint context
|
|
79
|
-
*/
|
|
80
|
-
get: function () {
|
|
81
|
-
return this.__endpoint_context__;
|
|
82
|
-
},
|
|
83
|
-
enumerable: false,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
23
|
+
async _() {
|
|
24
|
+
const reposToInit = this.__repositories_to_init__;
|
|
25
|
+
for (const repo of reposToInit) {
|
|
26
|
+
await repo.__init(this);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region context
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated use ctx instead
|
|
33
|
+
* Current endpoint context
|
|
34
|
+
*/
|
|
35
|
+
get __endpoint_context__() {
|
|
36
|
+
return this[symbols_1.Symbols.ctxInClassOrClassObj];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* get current endpoint context
|
|
40
|
+
*/
|
|
41
|
+
get ctx() {
|
|
42
|
+
return this.__endpoint_context__;
|
|
43
|
+
}
|
|
86
44
|
//#endregion
|
|
87
45
|
//#region inject
|
|
88
46
|
//#region inject / repo for entity
|
|
89
47
|
/**
|
|
90
48
|
* inject crud repo for entity
|
|
91
49
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
50
|
+
injectRepo(entityForCrud) {
|
|
51
|
+
const repoProxy = this.__inject(void 0, {
|
|
94
52
|
localInstance: true,
|
|
95
53
|
resolveClassFromContext: 'BaseRepository',
|
|
96
|
-
locaInstanceConstructorArgs: [
|
|
54
|
+
locaInstanceConstructorArgs: [() => entityForCrud],
|
|
97
55
|
});
|
|
98
56
|
this.__repositories_to_init__.push(repoProxy);
|
|
99
57
|
return repoProxy;
|
|
100
|
-
}
|
|
58
|
+
}
|
|
101
59
|
//#endregion
|
|
102
60
|
//#region inject / custom repository
|
|
103
|
-
|
|
104
|
-
|
|
61
|
+
injectCustomRepository(cutomRepositoryClass) {
|
|
62
|
+
const repoProxy = this.__inject(cutomRepositoryClass, {
|
|
105
63
|
localInstance: true,
|
|
106
64
|
locaInstanceConstructorArgs: [
|
|
107
|
-
|
|
65
|
+
() => cutomRepositoryClass.prototype.entityClassResolveFn(),
|
|
108
66
|
],
|
|
109
67
|
});
|
|
110
68
|
this.__repositories_to_init__.push(repoProxy);
|
|
111
69
|
return repoProxy;
|
|
112
|
-
}
|
|
70
|
+
}
|
|
113
71
|
//#endregion
|
|
114
72
|
//#region inject / custom repo
|
|
115
73
|
/**
|
|
116
74
|
* aliast to .injectRepository()
|
|
117
75
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
76
|
+
injectCustomRepo(cutomRepositoryClass) {
|
|
77
|
+
const repoProxy = this.injectCustomRepository(cutomRepositoryClass);
|
|
120
78
|
this.__repositories_to_init__.push(repoProxy);
|
|
121
79
|
return repoProxy;
|
|
122
|
-
}
|
|
80
|
+
}
|
|
123
81
|
//#endregion
|
|
124
82
|
//#region inject / controller
|
|
125
|
-
|
|
83
|
+
injectController(ctor) {
|
|
126
84
|
return this.__inject(ctor, { localInstance: false });
|
|
127
|
-
}
|
|
85
|
+
}
|
|
128
86
|
//#endregion
|
|
129
87
|
//#region inject / ctrl
|
|
130
88
|
/**
|
|
131
89
|
* aliast to .injectController()
|
|
132
90
|
*/
|
|
133
|
-
|
|
91
|
+
injectSubscriber(ctor) {
|
|
134
92
|
return this.__inject(ctor, { localInstance: false });
|
|
135
|
-
}
|
|
93
|
+
}
|
|
136
94
|
//#endregion
|
|
137
95
|
//#region inject / ctrl
|
|
138
96
|
/**
|
|
139
97
|
* aliast to .injectController()
|
|
140
98
|
*/
|
|
141
|
-
|
|
99
|
+
injectCtrl(ctor) {
|
|
142
100
|
return this.injectController(ctor);
|
|
143
|
-
}
|
|
101
|
+
}
|
|
144
102
|
//#endregion
|
|
145
103
|
//#region inject / global provider
|
|
146
104
|
/**
|
|
147
105
|
* global provider available in every context
|
|
148
106
|
*/
|
|
149
|
-
|
|
107
|
+
injectGlobalProvider(ctor) {
|
|
150
108
|
return this.__inject(ctor, { localInstance: false });
|
|
151
|
-
}
|
|
109
|
+
}
|
|
152
110
|
//#endregion
|
|
153
111
|
//#region inject / context provider
|
|
154
112
|
/**
|
|
155
113
|
* context scoped provider
|
|
156
114
|
* TODO
|
|
157
115
|
*/
|
|
158
|
-
|
|
116
|
+
injectContextProvider(ctor) {
|
|
159
117
|
return this.__inject(ctor, { localInstance: false });
|
|
160
|
-
}
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
/**
|
|
121
|
+
* Repositories to init (by controller)
|
|
122
|
+
*/
|
|
123
|
+
__repositories_to_init__ = [];
|
|
161
124
|
//#region inject / __ inject
|
|
162
125
|
/**
|
|
163
126
|
* Inject: Controllers, Providers, Repositories, Services, etc.
|
|
164
127
|
* TODO addd nest js injecting
|
|
165
128
|
*/
|
|
166
|
-
|
|
167
|
-
var _this = this;
|
|
129
|
+
__inject(ctor, options) {
|
|
168
130
|
if (!options) {
|
|
169
131
|
options = {};
|
|
170
132
|
}
|
|
171
|
-
|
|
133
|
+
const contextClassInstance = this;
|
|
172
134
|
return new Proxy({}, {
|
|
173
|
-
get:
|
|
174
|
-
|
|
175
|
-
|
|
135
|
+
get: (__, propName) => {
|
|
136
|
+
const contextFromClass = ctor && ctor[symbols_1.Symbols.ctxInClassOrClassObj];
|
|
137
|
+
const resultContext = contextFromClass
|
|
176
138
|
? contextFromClass
|
|
177
|
-
:
|
|
139
|
+
: this.__endpoint_context__;
|
|
178
140
|
if (options.resolveClassFromContext) {
|
|
179
|
-
|
|
141
|
+
const resolvedClass = resultContext.getClassFunByClassName(options.resolveClassFromContext);
|
|
180
142
|
ctor = resolvedClass;
|
|
181
143
|
}
|
|
182
144
|
if (resultContext) {
|
|
183
|
-
var instance = resultContext.inject(ctor,
|
|
145
|
+
var instance = resultContext.inject(ctor, {
|
|
146
|
+
...options,
|
|
147
|
+
contextClassInstance,
|
|
148
|
+
});
|
|
184
149
|
if (!instance) {
|
|
185
|
-
throw new Error(
|
|
186
|
-
|
|
150
|
+
throw new Error(`Not able to inject "${class_helpers_1.ClassHelpers.getName(ctor) || ctor.name}" inside ` +
|
|
151
|
+
`property "${propName?.toString()}" on class "${class_helpers_1.ClassHelpers.getName(this)}".
|
|
152
|
+
|
|
153
|
+
Please add "${class_helpers_1.ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
|
|
154
|
+
|
|
155
|
+
`);
|
|
187
156
|
}
|
|
188
|
-
|
|
157
|
+
const result = typeof instance[propName] === 'function'
|
|
189
158
|
? instance[propName].bind(instance)
|
|
190
159
|
: instance[propName];
|
|
191
160
|
// console.log(`Accessing injected "${propName?.toString()}" from "${ClassHelpers.getName(ctor) || ctor.name}"`,result)
|
|
@@ -194,38 +163,44 @@ var BaseInjector = /** @class */ (function () {
|
|
|
194
163
|
/* */
|
|
195
164
|
/* */
|
|
196
165
|
},
|
|
197
|
-
set:
|
|
198
|
-
|
|
199
|
-
|
|
166
|
+
set: (__, propName, value) => {
|
|
167
|
+
const contextFromClass = ctor && ctor[symbols_1.Symbols.ctxInClassOrClassObj];
|
|
168
|
+
const resultContext = contextFromClass
|
|
200
169
|
? contextFromClass
|
|
201
|
-
:
|
|
170
|
+
: this.__endpoint_context__;
|
|
202
171
|
if (options.resolveClassFromContext) {
|
|
203
|
-
|
|
172
|
+
const resolvedClass = resultContext.getClassFunByClassName(options.resolveClassFromContext);
|
|
204
173
|
ctor = resolvedClass;
|
|
205
174
|
}
|
|
206
175
|
if (resultContext) {
|
|
207
|
-
var instance = resultContext.inject(ctor,
|
|
176
|
+
var instance = resultContext.inject(ctor, {
|
|
177
|
+
...options,
|
|
178
|
+
contextClassInstance,
|
|
179
|
+
});
|
|
208
180
|
if (!instance) {
|
|
209
|
-
|
|
210
|
-
throw new Error(
|
|
211
|
-
|
|
181
|
+
const classNameNotResolved = class_helpers_1.ClassHelpers.getName(ctor) || ctor.name;
|
|
182
|
+
throw new Error(`Not able to inject "${classNameNotResolved}" inside ` +
|
|
183
|
+
`property "${propName?.toString()}" on class "${class_helpers_1.ClassHelpers.getName(this)}".
|
|
184
|
+
|
|
185
|
+
Please add "${class_helpers_1.ClassHelpers.getName(ctor) || ctor.name}" to (entites or contorllers or providers or repositories)
|
|
186
|
+
|
|
187
|
+
`);
|
|
212
188
|
}
|
|
213
189
|
instance[propName] = value;
|
|
214
190
|
}
|
|
215
191
|
return true;
|
|
216
192
|
},
|
|
217
193
|
});
|
|
218
|
-
}
|
|
194
|
+
}
|
|
219
195
|
//#endregion
|
|
220
196
|
//#endregion
|
|
221
197
|
//#region clone
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
198
|
+
clone(override) {
|
|
199
|
+
const classFn = class_helpers_1.ClassHelpers.getClassFnFromObject(this);
|
|
200
|
+
const result = tnp_core_1._.merge(new classFn(), tnp_core_1._.merge(tnp_core_1._.cloneDeep(this), override));
|
|
225
201
|
// console.log({result})
|
|
226
202
|
return result;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
}());
|
|
203
|
+
}
|
|
204
|
+
}
|
|
230
205
|
exports.BaseInjector = BaseInjector;
|
|
231
206
|
//# sourceMappingURL=base-injector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-injector.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-injector.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/taon/src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ACF,CACG,CAAC;IACT,CAAC;IACD,YAAY;IAEZ,YAAY;IAEZ,eAAe;IACR,KAAK,CAAC,QAAyB;QACpC,MAAM,OAAO,GAAG,4BAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,YAAC,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,EAAE,YAAC,CAAC,KAAK,CAAC,YAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC5E,wBAAwB;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AAnQD,oCAmQC"}
|
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseMigration = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var BaseMigration = /** @class */ (function (_super) {
|
|
9
|
-
tslib_1.__extends(BaseMigration, _super);
|
|
10
|
-
function BaseMigration() {
|
|
11
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
-
}
|
|
4
|
+
const tnp_core_1 = require("tnp-core");
|
|
5
|
+
const class_helpers_1 = require("../helpers/class-helpers");
|
|
6
|
+
const base_injector_1 = require("./base-injector");
|
|
7
|
+
class BaseMigration extends base_injector_1.BaseInjector {
|
|
13
8
|
/**
|
|
14
9
|
* by default is READY to run
|
|
15
10
|
*/
|
|
16
|
-
|
|
11
|
+
isReadyToRun() {
|
|
17
12
|
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
13
|
+
}
|
|
14
|
+
getDescription() {
|
|
20
15
|
return tnp_core_1._.startCase(class_helpers_1.ClassHelpers.getName(this));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
BaseMigration.prototype.down = function (queryRunner) {
|
|
31
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
32
|
-
return tslib_1.__generator(this, function (_a) {
|
|
33
|
-
console.log("[BaseMigration] Running migration DOWN \"".concat(class_helpers_1.ClassHelpers.getName(this), "\""));
|
|
34
|
-
return [2 /*return*/];
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
return BaseMigration;
|
|
39
|
-
}(base_injector_1.BaseInjector));
|
|
16
|
+
}
|
|
17
|
+
async up(queryRunner) {
|
|
18
|
+
console.log(`[BaseMigration] Running migration UP "${class_helpers_1.ClassHelpers.getName(this)}"`);
|
|
19
|
+
}
|
|
20
|
+
async down(queryRunner) {
|
|
21
|
+
console.log(`[BaseMigration] Running migration DOWN "${class_helpers_1.ClassHelpers.getName(this)}"`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
40
24
|
exports.BaseMigration = BaseMigration;
|
|
41
25
|
//# sourceMappingURL=base-migration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-migration.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-migration.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/taon/src/lib/base-classes/base-migration.ts"],"names":[],"mappings":";;;AAAA,uCAA6B;AAC7B,4DAAwD;AACxD,mDAA+C;AAG/C,MAAa,aAAc,SAAQ,4BAAY;IAC7C;;OAEG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc;QACZ,OAAO,YAAC,CAAC,SAAS,CAAC,4BAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,WAAwB;QAC/B,OAAO,CAAC,GAAG,CAAC,yCAAyC,4BAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAwB;QACjC,OAAO,CAAC,GAAG,CAAC,2CAA2C,4BAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxF,CAAC;CACF;AAlBD,sCAkBC"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseProvider = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tslib_1.__extends(BaseProvider, _super);
|
|
8
|
-
function BaseProvider() {
|
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
-
}
|
|
11
|
-
return BaseProvider;
|
|
12
|
-
}(base_injector_1.BaseInjector));
|
|
4
|
+
const base_injector_1 = require("./base-injector");
|
|
5
|
+
class BaseProvider extends base_injector_1.BaseInjector {
|
|
6
|
+
}
|
|
13
7
|
exports.BaseProvider = BaseProvider;
|
|
14
8
|
//# sourceMappingURL=base-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-provider.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-provider.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/taon/src/lib/base-classes/base-provider.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,MAAa,YAAa,SAAQ,4BAAY;CAAG;AAAjD,oCAAiD"}
|