taon 21.0.53 → 21.0.55
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/bin/taon +5 -5
- package/bin/taon-debug +5 -5
- package/bin/taon-debug-brk +4 -4
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/icon-menu-taon.svg +15 -15
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/taon-admin-mode-configuration/index.js +2 -2
- package/lib-prod/base-classes/base-abstract-entity.js +17 -31
- package/lib-prod/base-classes/base-angular-service.js +83 -55
- package/lib-prod/base-classes/base-class.js +33 -35
- package/lib-prod/base-classes/base-context.js +17 -19
- package/lib-prod/base-classes/base-controller.js +146 -154
- package/lib-prod/base-classes/base-crud-controller.js +250 -221
- package/lib-prod/base-classes/base-custom-repository.js +7 -18
- package/lib-prod/base-classes/base-electron-service.js +49 -0
- package/lib-prod/base-classes/base-entity.js +20 -30
- package/lib-prod/base-classes/base-file-upload.middleware.js +72 -75
- package/lib-prod/base-classes/base-injector.js +176 -194
- package/lib-prod/base-classes/base-middleware.js +8 -5
- package/lib-prod/base-classes/base-migration.js +19 -22
- package/lib-prod/base-classes/base-provider.js +7 -5
- package/lib-prod/base-classes/base-repository.js +601 -573
- package/lib-prod/base-classes/base-subscriber-for-entity.js +143 -152
- package/lib-prod/base-classes/base.js +18 -0
- package/lib-prod/build-info._auto-generated_.js +26 -14
- package/lib-prod/config/controller-config.js +24 -24
- package/lib-prod/config/controller-options.js +2 -5
- package/lib-prod/config/method-config.js +6 -8
- package/lib-prod/config/param-config.js +2 -8
- package/lib-prod/constants.js +29 -25
- package/lib-prod/context-db-migrations.js +328 -324
- package/lib-prod/create-context.js +211 -146
- package/lib-prod/decorators/classes/controller-decorator.js +16 -20
- package/lib-prod/decorators/classes/entity-decorator.js +26 -47
- package/lib-prod/decorators/classes/middleware-decorator.js +14 -24
- package/lib-prod/decorators/classes/migration-decorator.js +13 -22
- package/lib-prod/decorators/classes/provider-decorator.js +13 -23
- package/lib-prod/decorators/classes/repository-decorator.js +13 -22
- package/lib-prod/decorators/classes/subscriber-decorator.js +13 -23
- package/lib-prod/decorators/decorator-abstract-opt.js +1 -4
- package/lib-prod/decorators/http/http-decorators.js +20 -5
- package/lib-prod/decorators/http/http-methods-decorators.js +91 -133
- package/lib-prod/decorators/http/http-params-decorators.js +36 -62
- package/lib-prod/dependency-injection/di-container.js +28 -29
- package/lib-prod/endpoint-context-storage.js +27 -32
- package/lib-prod/endpoint-context.js +2294 -1930
- package/lib-prod/entity-process.js +209 -198
- package/lib-prod/env/env.angular-node-app.js +66 -130
- package/lib-prod/env/env.docs-webapp.js +66 -130
- package/lib-prod/env/env.electron-app.js +66 -130
- package/lib-prod/env/env.mobile-app.js +66 -130
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +66 -130
- package/lib-prod/env/env.vscode-plugin.js +66 -130
- package/lib-prod/env/index.js +6 -6
- package/lib-prod/express-types.js +1 -0
- package/lib-prod/formly/formly.models.js +1 -0
- package/lib-prod/formly/fromly.js +196 -175
- package/lib-prod/formly/type-from-entity.js +45 -52
- package/lib-prod/get-response-value.js +21 -18
- package/lib-prod/global-state/taon-global-state/index.js +6 -5
- package/lib-prod/global-state/taon-global-state/taon-global-state.abstract.context.js +18 -19
- package/lib-prod/global-state/taon-global-state/taon-global-state.constants.js +6 -9
- package/lib-prod/global-state/taon-global-state/taon-global-state.controller.js +40 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.entity.js +33 -46
- package/lib-prod/global-state/taon-global-state/taon-global-state.middleware.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.models.js +43 -33
- package/lib-prod/global-state/taon-global-state/taon-global-state.provider.js +10 -20
- package/lib-prod/global-state/taon-global-state/taon-global-state.repository.js +43 -44
- package/lib-prod/global-state/taon-global-state/taon-global-state.subscriber.js +20 -27
- package/lib-prod/global-state/taon-global-state/taon-global-state.utils.js +10 -10
- package/lib-prod/global-state/taon-transaction-registry/index.js +11 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.abstract.context.js +20 -21
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js +4 -7
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.controller.js +34 -39
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.entity.js +34 -54
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.middleware.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.models.js +7 -10
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.provider.js +10 -20
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.repository.js +29 -34
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.subscriber.js +20 -27
- package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.utils.js +4 -5
- package/lib-prod/helpers/class-helpers.js +210 -177
- package/lib-prod/helpers/clone-obj.js +16 -20
- package/lib-prod/helpers/taon-helpers.js +132 -114
- package/lib-prod/index._auto-generated_.js +5 -0
- package/lib-prod/index.js +248 -227
- package/lib-prod/inject.js +88 -33
- package/lib-prod/migrations/index.js +2 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.js +3 -0
- package/lib-prod/models.js +72 -103
- package/lib-prod/orm/columns.js +58 -118
- package/lib-prod/orm/index.js +56 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/realtime/realtime-client.js +188 -186
- package/lib-prod/realtime/realtime-core.js +77 -78
- package/lib-prod/realtime/realtime-server.js +225 -240
- package/lib-prod/realtime/realtime-strategy/index.js +4 -4
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-ipc.js +273 -219
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-mock.js +267 -240
- package/lib-prod/realtime/realtime-strategy/realtime-strategy-socket-io.js +26 -20
- package/lib-prod/realtime/realtime-strategy/realtime-strategy.js +10 -13
- package/lib-prod/realtime/realtime-subs-manager.js +82 -90
- package/lib-prod/realtime/realtime.models.js +2 -0
- package/lib-prod/symbols.js +104 -105
- package/lib-prod/ui/index.js +1 -5
- package/lib-prod/ui/taon-admin-mode-configuration/index.js +1 -5
- package/lib-prod/validators.js +43 -37
- package/lib-prod.split-namespaces.json +32 -86
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -1,60 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!___NS__isFunction(this.entityClassResolveFn)) {
|
|
33
|
-
Helpers__NS__warn(
|
|
34
|
-
`Skipping initing CRUD controller ${ClassHelpers__NS__getName(
|
|
35
|
-
this
|
|
36
|
-
)} because entityClassResolveFn is not provided.`
|
|
37
|
-
);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
let entityClassFn = this.entityClassResolveFn();
|
|
41
|
-
this.db = this.injectRepo(entityClassFn);
|
|
42
|
-
if (entityClassFn) {
|
|
43
|
-
const configEntity = Reflect.getMetadata(
|
|
44
|
-
Symbols__NS__metadata.options.entity,
|
|
45
|
-
ClassHelpers__NS__getClassFnFromObject(this)
|
|
46
|
-
);
|
|
47
|
-
if (configEntity?.createTable === false) {
|
|
48
|
-
Helpers__NS__warn(
|
|
49
|
-
`Table for entity ${ClassHelpers__NS__getName(
|
|
50
|
-
entityClassFn
|
|
51
|
-
)} will not be created. Crud will not work properly.`
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
Helpers__NS__error(`Entity class not provided for controller ${ClassHelpers__NS__getName(
|
|
56
|
-
this
|
|
57
|
-
)}.
|
|
1
|
+
//#region imports
|
|
2
|
+
import { ___NS__isArray, ___NS__isFunction, ___NS__isString, Helpers__NS__error, Helpers__NS__warn } from 'tnp-core/lib-prod';
|
|
3
|
+
import { TaonController } from '../decorators/classes/controller-decorator';
|
|
4
|
+
import { GET, PUT, DELETE, POST, PATCH, } from '../decorators/http/http-methods-decorators';
|
|
5
|
+
import { Query, Body } from '../decorators/http/http-params-decorators';
|
|
6
|
+
import { ClassHelpers__NS__getClassFnFromObject, ClassHelpers__NS__getName } from '../helpers/class-helpers';
|
|
7
|
+
import { Symbols__NS__metadata, Symbols__NS__old } from '../symbols';
|
|
8
|
+
import { Validators__NS__preventUndefinedModel } from '../validators';
|
|
9
|
+
import { TaonBaseController } from './base-controller';
|
|
10
|
+
//#endregion
|
|
11
|
+
/**
|
|
12
|
+
* Please override property entityClassFn with entity class.
|
|
13
|
+
*/
|
|
14
|
+
let TaonBaseCrudController = class TaonBaseCrudController extends TaonBaseController {
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region init
|
|
17
|
+
async _() {
|
|
18
|
+
if (!___NS__isFunction(this.entityClassResolveFn)) {
|
|
19
|
+
Helpers__NS__warn(`Skipping initing CRUD controller ${ClassHelpers__NS__getName(this)} because entityClassResolveFn is not provided.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let entityClassFn = this.entityClassResolveFn();
|
|
23
|
+
this.db = this.injectRepo(entityClassFn);
|
|
24
|
+
if (entityClassFn) {
|
|
25
|
+
const configEntity = Reflect.getMetadata(Symbols__NS__metadata.options.entity, ClassHelpers__NS__getClassFnFromObject(this));
|
|
26
|
+
if (configEntity?.createTable === false) {
|
|
27
|
+
Helpers__NS__warn(`Table for entity ${ClassHelpers__NS__getName(entityClassFn)} will not be created. Crud will not work properly.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
Helpers__NS__error(`Entity class not provided for controller ${ClassHelpers__NS__getName(this)}.
|
|
58
32
|
|
|
59
33
|
Please provide entity as class property entityClassFn:
|
|
60
34
|
|
|
@@ -65,171 +39,226 @@ let TaonBaseCrudController = class extends TaonBaseController {
|
|
|
65
39
|
}
|
|
66
40
|
|
|
67
41
|
`);
|
|
42
|
+
}
|
|
43
|
+
await super._();
|
|
68
44
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
pagination(pageNumber = 1, pageSize = 10, search = "") {
|
|
87
|
-
return async (request, response) => {
|
|
88
|
-
if (this.db.repositoryExists) {
|
|
89
|
-
const query = {
|
|
90
|
-
page: pageNumber,
|
|
91
|
-
take: pageSize,
|
|
92
|
-
keyword: search
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region bufferd changes
|
|
47
|
+
bufforedChanges(id, property, alreadyLength) {
|
|
48
|
+
//#region @websqlFunc
|
|
49
|
+
return async (request, response) => {
|
|
50
|
+
const model = await this.db.getBy(id);
|
|
51
|
+
if (model === void 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
Validators__NS__preventUndefinedModel(model, id);
|
|
55
|
+
let value = model[property];
|
|
56
|
+
let result;
|
|
57
|
+
if (___NS__isString(value) || ___NS__isArray(value)) {
|
|
58
|
+
result = value.slice(alreadyLength);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
93
61
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
62
|
+
//#endregion
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region pagintation
|
|
66
|
+
pagination(pageNumber = 1, pageSize = 10, search = '') {
|
|
67
|
+
//#region @websqlFunc
|
|
68
|
+
return async (request, response) => {
|
|
69
|
+
if (this.db.repositoryExists) {
|
|
70
|
+
const query = {
|
|
71
|
+
page: pageNumber,
|
|
72
|
+
take: pageSize,
|
|
73
|
+
keyword: search,
|
|
74
|
+
};
|
|
75
|
+
// console.log({
|
|
76
|
+
// query
|
|
77
|
+
// })
|
|
78
|
+
const take = query.take || 10;
|
|
79
|
+
const page = query.page || 1;
|
|
80
|
+
const skip = (page - 1) * take;
|
|
81
|
+
const keyword = query.keyword || '';
|
|
82
|
+
const [result, total] = await this.db.findAndCount({
|
|
83
|
+
// where: { name: Like('%' + keyword + '%') },
|
|
84
|
+
// order: { name: "DESC" },
|
|
85
|
+
take: take,
|
|
86
|
+
skip: skip,
|
|
87
|
+
});
|
|
88
|
+
response?.setHeader(Symbols__NS__old.X_TOTAL_COUNT, total);
|
|
89
|
+
// const lastPage = Math.ceil(total / take);
|
|
90
|
+
// const nextPage = page + 1 > lastPage ? null : page + 1;
|
|
91
|
+
// const prevPage = page - 1 < 1 ? null : page - 1;
|
|
92
|
+
// console.log({
|
|
93
|
+
// result,
|
|
94
|
+
// total
|
|
95
|
+
// })
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
return [];
|
|
99
|
+
};
|
|
100
|
+
//#endregion
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region get all
|
|
104
|
+
getAll() {
|
|
105
|
+
//#region @websqlFunc
|
|
106
|
+
return async (request, response) => {
|
|
107
|
+
if (this.db.repositoryExists) {
|
|
108
|
+
const { models, totalCount } = await this.db.getAll();
|
|
109
|
+
response?.setHeader(Symbols__NS__old.X_TOTAL_COUNT, totalCount);
|
|
110
|
+
return models;
|
|
111
|
+
}
|
|
112
|
+
return [];
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region get by id
|
|
118
|
+
getBy(id) {
|
|
119
|
+
//#region @websqlFunc
|
|
120
|
+
return async () => {
|
|
121
|
+
const model = await this.db.getBy(id);
|
|
122
|
+
return model;
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region update by id
|
|
128
|
+
updateById(id, item) {
|
|
129
|
+
//#region @websqlFunc
|
|
130
|
+
return async () => {
|
|
131
|
+
const model = await this.db.updateById(id, item);
|
|
132
|
+
return model;
|
|
133
|
+
};
|
|
134
|
+
//#endregion
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region patch by id
|
|
138
|
+
patchById(id, item) {
|
|
139
|
+
//#region @websqlFunc
|
|
140
|
+
return async () => {
|
|
141
|
+
const model = await this.db.updateById(id, item);
|
|
142
|
+
return model;
|
|
143
|
+
};
|
|
144
|
+
//#endregion
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region bulk update
|
|
148
|
+
bulkUpdate(items) {
|
|
149
|
+
//#region @websqlFunc
|
|
150
|
+
return async () => {
|
|
151
|
+
if (!Array.isArray(items) || items?.length === 0) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
const { models } = await this.db.bulkUpdate(items);
|
|
155
|
+
return models;
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region delete by id
|
|
161
|
+
deleteById(id) {
|
|
162
|
+
//#region @websqlFunc
|
|
163
|
+
return async () => {
|
|
164
|
+
const model = await this.db.deleteById(id);
|
|
165
|
+
return model;
|
|
166
|
+
};
|
|
167
|
+
//#endregion
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region bulk delete
|
|
171
|
+
bulkDelete(ids) {
|
|
172
|
+
//#region @websqlFunc
|
|
173
|
+
return async () => {
|
|
174
|
+
const models = await this.db.bulkDelete(ids);
|
|
175
|
+
return models;
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region bulk delete
|
|
181
|
+
clearTable() {
|
|
182
|
+
//#region @websqlFunc
|
|
183
|
+
return async () => {
|
|
184
|
+
await this.db.clear();
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region create
|
|
190
|
+
save(item) {
|
|
191
|
+
//#region @websqlFunc
|
|
192
|
+
return async () => {
|
|
193
|
+
const model = await this.db.save(item);
|
|
194
|
+
return model;
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region bulk create
|
|
200
|
+
bulkCreate(items) {
|
|
201
|
+
//#region @websqlFunc
|
|
202
|
+
return async () => {
|
|
203
|
+
const models = await this.db.bulkCreate(items);
|
|
204
|
+
return models;
|
|
205
|
+
};
|
|
206
|
+
//#endregion
|
|
207
|
+
}
|
|
177
208
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
], TaonBaseCrudController.prototype, "bufforedChanges",
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
], TaonBaseCrudController.prototype, "pagination",
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
], TaonBaseCrudController.prototype, "getAll",
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
], TaonBaseCrudController.prototype, "getBy",
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
], TaonBaseCrudController.prototype, "updateById",
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
], TaonBaseCrudController.prototype, "patchById",
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
], TaonBaseCrudController.prototype, "bulkUpdate",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
], TaonBaseCrudController.prototype, "deleteById",
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
], TaonBaseCrudController.prototype, "bulkDelete",
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
], TaonBaseCrudController.prototype, "clearTable",
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
], TaonBaseCrudController.prototype, "save",
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
], TaonBaseCrudController.prototype, "bulkCreate",
|
|
230
|
-
TaonBaseCrudController =
|
|
231
|
-
|
|
209
|
+
__decorate([
|
|
210
|
+
GET(),
|
|
211
|
+
__param(0, Query(`id`)),
|
|
212
|
+
__param(1, Query(`property`)),
|
|
213
|
+
__param(2, Query('alreadyLength'))
|
|
214
|
+
], TaonBaseCrudController.prototype, "bufforedChanges", null);
|
|
215
|
+
__decorate([
|
|
216
|
+
GET(),
|
|
217
|
+
__param(0, Query('pageNumber')),
|
|
218
|
+
__param(1, Query('pageSize')),
|
|
219
|
+
__param(2, Query('search'))
|
|
220
|
+
], TaonBaseCrudController.prototype, "pagination", null);
|
|
221
|
+
__decorate([
|
|
222
|
+
GET()
|
|
223
|
+
], TaonBaseCrudController.prototype, "getAll", null);
|
|
224
|
+
__decorate([
|
|
225
|
+
GET(),
|
|
226
|
+
__param(0, Query(`id`))
|
|
227
|
+
], TaonBaseCrudController.prototype, "getBy", null);
|
|
228
|
+
__decorate([
|
|
229
|
+
PUT(),
|
|
230
|
+
__param(0, Query(`id`)),
|
|
231
|
+
__param(1, Body())
|
|
232
|
+
], TaonBaseCrudController.prototype, "updateById", null);
|
|
233
|
+
__decorate([
|
|
234
|
+
PATCH(),
|
|
235
|
+
__param(0, Query(`id`)),
|
|
236
|
+
__param(1, Body())
|
|
237
|
+
], TaonBaseCrudController.prototype, "patchById", null);
|
|
238
|
+
__decorate([
|
|
239
|
+
PUT(),
|
|
240
|
+
__param(0, Body())
|
|
241
|
+
], TaonBaseCrudController.prototype, "bulkUpdate", null);
|
|
242
|
+
__decorate([
|
|
243
|
+
DELETE(),
|
|
244
|
+
__param(0, Query(`id`))
|
|
245
|
+
], TaonBaseCrudController.prototype, "deleteById", null);
|
|
246
|
+
__decorate([
|
|
247
|
+
DELETE(),
|
|
248
|
+
__param(0, Query(`ids`))
|
|
249
|
+
], TaonBaseCrudController.prototype, "bulkDelete", null);
|
|
250
|
+
__decorate([
|
|
251
|
+
DELETE()
|
|
252
|
+
], TaonBaseCrudController.prototype, "clearTable", null);
|
|
253
|
+
__decorate([
|
|
254
|
+
POST(),
|
|
255
|
+
__param(0, Body())
|
|
256
|
+
], TaonBaseCrudController.prototype, "save", null);
|
|
257
|
+
__decorate([
|
|
258
|
+
POST(),
|
|
259
|
+
__param(0, Body())
|
|
260
|
+
], TaonBaseCrudController.prototype, "bulkCreate", null);
|
|
261
|
+
TaonBaseCrudController = __decorate([
|
|
262
|
+
TaonController({ className: 'TaonBaseCrudController' })
|
|
232
263
|
], TaonBaseCrudController);
|
|
233
|
-
export {
|
|
234
|
-
TaonBaseCrudController
|
|
235
|
-
};
|
|
264
|
+
export { TaonBaseCrudController };
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result) __defProp(target, key, result);
|
|
9
|
-
return result;
|
|
1
|
+
import { TaonRepository } from '../decorators/classes/repository-decorator';
|
|
2
|
+
import { TaonBaseInjector } from './base-injector';
|
|
3
|
+
//#endregion
|
|
4
|
+
let TaonBaseCustomRepository = class TaonBaseCustomRepository extends TaonBaseInjector {
|
|
10
5
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let TaonBaseCustomRepository = class extends TaonBaseInjector {
|
|
14
|
-
};
|
|
15
|
-
TaonBaseCustomRepository = __decorateClass([
|
|
16
|
-
TaonRepository({ className: "TaonBaseCustomRepository" })
|
|
6
|
+
TaonBaseCustomRepository = __decorate([
|
|
7
|
+
TaonRepository({ className: 'TaonBaseCustomRepository' })
|
|
17
8
|
], TaonBaseCustomRepository);
|
|
18
|
-
export {
|
|
19
|
-
TaonBaseCustomRepository
|
|
20
|
-
};
|
|
9
|
+
export { TaonBaseCustomRepository };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// TODO any purpose for this ?
|
|
2
|
+
// //#region imports
|
|
3
|
+
// import * as childProcess from 'child_process';
|
|
4
|
+
// import * as fs from 'fs';
|
|
5
|
+
// import { Injectable } from '@angular/core';
|
|
6
|
+
// import { ipcRenderer, webFrame } from 'electron';
|
|
7
|
+
// import { UtilsOs } from 'tnp-core/src';
|
|
8
|
+
// //#endregion
|
|
9
|
+
// // If you import a module but never use any of the imported values other than as TypeScript types,
|
|
10
|
+
// // the resulting javascript file will look as if you never imported the module at all.
|
|
11
|
+
// @Injectable({
|
|
12
|
+
// providedIn: 'root',
|
|
13
|
+
// })
|
|
14
|
+
// export class TaonBaseElectronService {
|
|
15
|
+
// ipcRenderer!: typeof ipcRenderer;
|
|
16
|
+
// webFrame!: typeof webFrame;
|
|
17
|
+
// childProcess!: typeof childProcess;
|
|
18
|
+
// fs!: typeof fs;
|
|
19
|
+
// constructor() {
|
|
20
|
+
// // Conditional imports
|
|
21
|
+
// if (UtilsOs.isElectron) {
|
|
22
|
+
// this.ipcRenderer = (window as any).require('electron').ipcRenderer;
|
|
23
|
+
// this.webFrame = (window as any).require('electron').webFrame;
|
|
24
|
+
// this.fs = (window as any).require('fs');
|
|
25
|
+
// this.childProcess = (window as any).require('child_process');
|
|
26
|
+
// this.childProcess.exec('node -v', (error, stdout, stderr) => {
|
|
27
|
+
// if (error) {
|
|
28
|
+
// console.error(`error: ${error.message}`);
|
|
29
|
+
// return;
|
|
30
|
+
// }
|
|
31
|
+
// if (stderr) {
|
|
32
|
+
// console.error(`stderr: ${stderr}`);
|
|
33
|
+
// return;
|
|
34
|
+
// }
|
|
35
|
+
// console.log(`stdout:\n${stdout}`);
|
|
36
|
+
// });
|
|
37
|
+
// // Notes :
|
|
38
|
+
// // * A NodeJS's dependency imported with 'window.require' MUST BE present in `dependencies` of both `app/package.json`
|
|
39
|
+
// // and `package.json (root folder)` in order to make it work here in Electron's Renderer process (src folder)
|
|
40
|
+
// // because it will loaded at runtime by Electron.
|
|
41
|
+
// // * A NodeJS's dependency imported with TS module import (ex: import { Dropbox } from 'dropbox') CAN only be present
|
|
42
|
+
// // in `dependencies` of `package.json (root folder)` because it is loaded during build phase and does not need to be
|
|
43
|
+
// // in the final bundle. Reminder : only if not used in Electron's Main process (app folder)
|
|
44
|
+
// // If you want to use a NodeJS 3rd party deps in Renderer process,
|
|
45
|
+
// // ipcRenderer.invoke can serve many common use cases.
|
|
46
|
+
// // https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrendererinvokechannel-args
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Entity } from 'taon-typeorm/lib-prod'; // @websql
|
|
2
|
+
import { TaonBaseClass } from './base-class';
|
|
3
|
+
//#region @websql
|
|
4
|
+
let TaonBaseEntity = class TaonBaseEntity extends TaonBaseClass {
|
|
5
|
+
/**
|
|
6
|
+
* simple check if relation is ok
|
|
7
|
+
*/
|
|
8
|
+
relation(relationName) {
|
|
9
|
+
return relationName;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* simple check if relation is ok
|
|
13
|
+
*/
|
|
14
|
+
relations(relationNames) {
|
|
15
|
+
return relationNames;
|
|
16
|
+
}
|
|
10
17
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* simple check if relation is ok
|
|
16
|
-
*/
|
|
17
|
-
relation(relationName) {
|
|
18
|
-
return relationName;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* simple check if relation is ok
|
|
22
|
-
*/
|
|
23
|
-
relations(relationNames) {
|
|
24
|
-
return relationNames;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
TaonBaseEntity = __decorateClass([
|
|
28
|
-
Entity()
|
|
18
|
+
TaonBaseEntity = __decorate([
|
|
19
|
+
Entity()
|
|
20
|
+
//#endregion
|
|
29
21
|
], TaonBaseEntity);
|
|
30
|
-
export {
|
|
31
|
-
TaonBaseEntity
|
|
32
|
-
};
|
|
22
|
+
export { TaonBaseEntity };
|