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,48 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import { TaonController } from '../../decorators/classes/controller-decorator';
|
|
3
|
+
import { TaonBaseCrudController } from '../../base-classes/base-crud-controller';
|
|
4
|
+
import { Query } from '../../decorators/http/http-params-decorators';
|
|
5
|
+
import { GET } from '../../decorators/http/http-methods-decorators';
|
|
6
|
+
import { POST } from '../../decorators/http/http-methods-decorators';
|
|
7
|
+
import { TAON_GLOBAL_STATE } from './taon-global-state.entity';
|
|
8
|
+
import { TaonGlobalStateRepository } from './taon-global-state.repository';
|
|
9
|
+
//#endregion
|
|
10
|
+
let TaonGlobalStateController = class TaonGlobalStateController extends TaonBaseCrudController {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
|
|
14
|
+
this.taonGlobalStateRepository = this.injectCustomRepo(TaonGlobalStateRepository);
|
|
15
|
+
}
|
|
16
|
+
getStatus() {
|
|
17
|
+
return async () => {
|
|
18
|
+
//#region @websqlFunc
|
|
19
|
+
const stateEntity = await this.taonGlobalStateRepository.getLastStatus();
|
|
20
|
+
return stateEntity.status;
|
|
21
|
+
//#endregion
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
setDraining(secondsBeforeReadonly = 0) {
|
|
25
|
+
return async () => {
|
|
26
|
+
await this.taonGlobalStateRepository.setDraining(secondsBeforeReadonly);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
10
29
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
getStatus() {
|
|
23
|
-
return async () => {
|
|
24
|
-
const stateEntity = await this.taonGlobalStateRepository.getLastStatus();
|
|
25
|
-
return stateEntity.status;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
setDraining(secondsBeforeReadonly = 0) {
|
|
29
|
-
return async () => {
|
|
30
|
-
await this.taonGlobalStateRepository.setDraining(secondsBeforeReadonly);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
__decorateClass([
|
|
35
|
-
GET()
|
|
36
|
-
], TaonGlobalStateController.prototype, "getStatus", 1);
|
|
37
|
-
__decorateClass([
|
|
38
|
-
POST(),
|
|
39
|
-
__decorateParam(0, Query("secondsBeforeReadonly"))
|
|
40
|
-
], TaonGlobalStateController.prototype, "setDraining", 1);
|
|
41
|
-
TaonGlobalStateController = __decorateClass([
|
|
42
|
-
TaonController({
|
|
43
|
-
className: "TaonGlobalStateController"
|
|
44
|
-
})
|
|
30
|
+
__decorate([
|
|
31
|
+
GET()
|
|
32
|
+
], TaonGlobalStateController.prototype, "getStatus", null);
|
|
33
|
+
__decorate([
|
|
34
|
+
POST(),
|
|
35
|
+
__param(0, Query('secondsBeforeReadonly'))
|
|
36
|
+
], TaonGlobalStateController.prototype, "setDraining", null);
|
|
37
|
+
TaonGlobalStateController = __decorate([
|
|
38
|
+
TaonController({
|
|
39
|
+
className: 'TaonGlobalStateController',
|
|
40
|
+
})
|
|
45
41
|
], TaonGlobalStateController);
|
|
46
|
-
export {
|
|
47
|
-
TaonGlobalStateController
|
|
48
|
-
};
|
|
42
|
+
export { TaonGlobalStateController };
|
|
@@ -1,48 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (kind && result) __defProp(target, key, result);
|
|
9
|
-
return result;
|
|
1
|
+
//#region imports
|
|
2
|
+
import { CreateDateColumn, CustomColumn } from '../../orm/columns';
|
|
3
|
+
import { TaonGlobalStateDefaultsValues } from './taon-global-state.constants';
|
|
4
|
+
import { TaonBaseAbstractEntity } from '../../base-classes/base-abstract-entity';
|
|
5
|
+
import { TaonEntity } from '../../decorators/classes/entity-decorator';
|
|
6
|
+
//#endregion
|
|
7
|
+
let TAON_GLOBAL_STATE = class TAON_GLOBAL_STATE extends TaonBaseAbstractEntity {
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
], TAON_GLOBAL_STATE.prototype, "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: "int",
|
|
37
|
-
nullable: true
|
|
38
|
-
})
|
|
39
|
-
], TAON_GLOBAL_STATE.prototype, "secondsBeforeReadonly", 2);
|
|
40
|
-
TAON_GLOBAL_STATE = __decorateClass([
|
|
41
|
-
TaonEntity({
|
|
42
|
-
className: "TAON_GLOBAL_STATE",
|
|
43
|
-
createTable: true
|
|
44
|
-
})
|
|
9
|
+
__decorate([
|
|
10
|
+
CustomColumn({
|
|
11
|
+
type: 'varchar',
|
|
12
|
+
length: 20,
|
|
13
|
+
nullable: false,
|
|
14
|
+
default: TaonGlobalStateDefaultsValues.status,
|
|
15
|
+
})
|
|
16
|
+
//#endregion
|
|
17
|
+
], TAON_GLOBAL_STATE.prototype, "status", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
CreateDateColumn()
|
|
20
|
+
//#endregion
|
|
21
|
+
], TAON_GLOBAL_STATE.prototype, "createdAt", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
CustomColumn({
|
|
24
|
+
type: 'int',
|
|
25
|
+
nullable: true,
|
|
26
|
+
})
|
|
27
|
+
//#endregion
|
|
28
|
+
], TAON_GLOBAL_STATE.prototype, "secondsBeforeReadonly", void 0);
|
|
29
|
+
TAON_GLOBAL_STATE = __decorate([
|
|
30
|
+
TaonEntity({
|
|
31
|
+
className: 'TAON_GLOBAL_STATE',
|
|
32
|
+
createTable: true,
|
|
33
|
+
})
|
|
45
34
|
], TAON_GLOBAL_STATE);
|
|
46
|
-
export {
|
|
47
|
-
TAON_GLOBAL_STATE
|
|
48
|
-
};
|
|
35
|
+
export { TAON_GLOBAL_STATE };
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
//#region imports
|
|
2
|
+
import { TaonBaseMiddleware } from '../../base-classes/base-middleware';
|
|
3
|
+
import { TaonMiddleware } from '../../decorators/classes/middleware-decorator';
|
|
4
|
+
//#endregion
|
|
5
|
+
let TaonGlobalStateMiddleware = class TaonGlobalStateMiddleware extends TaonBaseMiddleware {
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
TaonGlobalStateMiddleware = __decorateClass([
|
|
16
|
-
TaonMiddleware({
|
|
17
|
-
className: "TaonGlobalStateMiddleware"
|
|
18
|
-
})
|
|
7
|
+
TaonGlobalStateMiddleware = __decorate([
|
|
8
|
+
TaonMiddleware({
|
|
9
|
+
className: 'TaonGlobalStateMiddleware',
|
|
10
|
+
})
|
|
19
11
|
], TaonGlobalStateMiddleware);
|
|
20
|
-
export {
|
|
21
|
-
TaonGlobalStateMiddleware
|
|
22
|
-
};
|
|
12
|
+
export { TaonGlobalStateMiddleware };
|
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
var TaonGlobalStateStatus
|
|
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
|
-
|
|
33
|
-
|
|
1
|
+
export var TaonGlobalStateStatus;
|
|
2
|
+
(function (TaonGlobalStateStatus) {
|
|
3
|
+
TaonGlobalStateStatus["NORMAL"] = "normal";
|
|
4
|
+
/**
|
|
5
|
+
* no new transactions allowed
|
|
6
|
+
* existing ones may finish
|
|
7
|
+
*/
|
|
8
|
+
TaonGlobalStateStatus["DRAINING"] = "draining";
|
|
9
|
+
/**
|
|
10
|
+
* DB is readonly
|
|
11
|
+
* app is readonly (no writes, no side effects)
|
|
12
|
+
*/
|
|
13
|
+
TaonGlobalStateStatus["READONLY"] = "readonly";
|
|
14
|
+
/**
|
|
15
|
+
* Db and app still readonly - migration in progress
|
|
16
|
+
*/
|
|
17
|
+
TaonGlobalStateStatus["MIGRATING"] = "migrating";
|
|
18
|
+
/**
|
|
19
|
+
* emergency stop / maintenance mode
|
|
20
|
+
*/
|
|
21
|
+
TaonGlobalStateStatus["FROZEN"] = "frozen";
|
|
22
|
+
})(TaonGlobalStateStatus || (TaonGlobalStateStatus = {}));
|
|
23
|
+
export const allowedTaonGlobalStatusOrders = {
|
|
24
|
+
[TaonGlobalStateStatus.NORMAL]: [
|
|
25
|
+
TaonGlobalStateStatus.DRAINING,
|
|
26
|
+
TaonGlobalStateStatus.FROZEN,
|
|
27
|
+
],
|
|
28
|
+
[TaonGlobalStateStatus.DRAINING]: [
|
|
29
|
+
TaonGlobalStateStatus.READONLY,
|
|
30
|
+
TaonGlobalStateStatus.FROZEN,
|
|
31
|
+
],
|
|
32
|
+
[TaonGlobalStateStatus.READONLY]: [
|
|
33
|
+
TaonGlobalStateStatus.MIGRATING,
|
|
34
|
+
TaonGlobalStateStatus.NORMAL,
|
|
35
|
+
TaonGlobalStateStatus.FROZEN,
|
|
36
|
+
],
|
|
37
|
+
[TaonGlobalStateStatus.MIGRATING]: [
|
|
38
|
+
TaonGlobalStateStatus.READONLY
|
|
39
|
+
],
|
|
40
|
+
[TaonGlobalStateStatus.FROZEN]: [
|
|
41
|
+
TaonGlobalStateStatus.READONLY,
|
|
42
|
+
TaonGlobalStateStatus.NORMAL,
|
|
43
|
+
],
|
|
34
44
|
};
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
//#region imports
|
|
2
|
+
import { TaonBaseProvider } from '../../base-classes/base-provider';
|
|
3
|
+
import { TaonProvider } from '../../decorators/classes/provider-decorator';
|
|
4
|
+
//#endregion
|
|
5
|
+
let TaonGlobalStateProvider = class TaonGlobalStateProvider extends TaonBaseProvider {
|
|
10
6
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
TaonGlobalStateProvider = __decorateClass([
|
|
16
|
-
TaonProvider({
|
|
17
|
-
className: "TaonGlobalStateProvider"
|
|
18
|
-
})
|
|
7
|
+
TaonGlobalStateProvider = __decorate([
|
|
8
|
+
TaonProvider({
|
|
9
|
+
className: 'TaonGlobalStateProvider',
|
|
10
|
+
})
|
|
19
11
|
], TaonGlobalStateProvider);
|
|
20
|
-
export {
|
|
21
|
-
TaonGlobalStateProvider
|
|
22
|
-
};
|
|
12
|
+
export { TaonGlobalStateProvider };
|
|
@@ -1,47 +1,46 @@
|
|
|
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
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import { TaonBaseRepository } from '../../base-classes/base-repository';
|
|
3
|
+
import { TaonRepository } from '../../decorators/classes/repository-decorator';
|
|
4
|
+
import { TAON_GLOBAL_STATE } from './taon-global-state.entity';
|
|
5
|
+
import { TaonGlobalStateStatus } from './taon-global-state.models';
|
|
6
|
+
import { TaonGlobalStateUtils__NS__assertAllowedTransition } from './taon-global-state.utils';
|
|
7
|
+
//#endregion
|
|
8
|
+
let TaonGlobalStateRepository = class TaonGlobalStateRepository extends TaonBaseRepository {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.entityClassResolveFn = () => TAON_GLOBAL_STATE;
|
|
12
|
+
}
|
|
13
|
+
async getLastStatus() {
|
|
14
|
+
//#region @websqlFunc
|
|
15
|
+
const lastStatus = await this.findOne({
|
|
16
|
+
order: { createdAt: 'DESC' },
|
|
17
|
+
});
|
|
18
|
+
return lastStatus;
|
|
19
|
+
//#endregion
|
|
20
|
+
}
|
|
21
|
+
async setDraining(secondsBeforeReadonly = 0) {
|
|
22
|
+
//#region @websqlFunc
|
|
23
|
+
await this.transitionTo(TaonGlobalStateStatus.DRAINING);
|
|
24
|
+
if (secondsBeforeReadonly > 0) {
|
|
25
|
+
setTimeout(async () => {
|
|
26
|
+
await this.transitionTo(TaonGlobalStateStatus.READONLY);
|
|
27
|
+
}, secondsBeforeReadonly);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
}
|
|
31
|
+
async transitionTo(next) {
|
|
32
|
+
//#region @websqlFunc
|
|
33
|
+
const current = await this.getLastStatus();
|
|
34
|
+
TaonGlobalStateUtils__NS__assertAllowedTransition(current.status, next);
|
|
35
|
+
const newState = this.create({ status: next });
|
|
36
|
+
await this.save(newState);
|
|
37
|
+
return newState;
|
|
38
|
+
//#endregion
|
|
30
39
|
}
|
|
31
|
-
}
|
|
32
|
-
async transitionTo(next) {
|
|
33
|
-
const current = await this.getLastStatus();
|
|
34
|
-
TaonGlobalStateUtils__NS__assertAllowedTransition(current.status, next);
|
|
35
|
-
const newState = this.create({ status: next });
|
|
36
|
-
await this.save(newState);
|
|
37
|
-
return newState;
|
|
38
|
-
}
|
|
39
40
|
};
|
|
40
|
-
TaonGlobalStateRepository =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
TaonGlobalStateRepository = __decorate([
|
|
42
|
+
TaonRepository({
|
|
43
|
+
className: 'TaonGlobalStateRepository',
|
|
44
|
+
})
|
|
44
45
|
], TaonGlobalStateRepository);
|
|
45
|
-
export {
|
|
46
|
-
TaonGlobalStateRepository
|
|
47
|
-
};
|
|
46
|
+
export { TaonGlobalStateRepository };
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import { TaonBaseSubscriberForEntity } from '../../base-classes/base-subscriber-for-entity';
|
|
3
|
+
import { TaonSubscriber } from '../../decorators/classes/subscriber-decorator';
|
|
4
|
+
import { TAON_GLOBAL_STATE } from './taon-global-state.entity';
|
|
5
|
+
import { TaonGlobalStateProvider } from './taon-global-state.provider';
|
|
6
|
+
//#endregion
|
|
7
|
+
let TaonGlobalStateSubscriber = class TaonGlobalStateSubscriber extends TaonBaseSubscriberForEntity {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.taonGlobalStateProvider = this.injectProvider(TaonGlobalStateProvider);
|
|
11
|
+
}
|
|
12
|
+
listenTo() {
|
|
13
|
+
return TAON_GLOBAL_STATE;
|
|
14
|
+
}
|
|
10
15
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
taonGlobalStateProvider = this.injectProvider(TaonGlobalStateProvider);
|
|
17
|
-
listenTo() {
|
|
18
|
-
return TAON_GLOBAL_STATE;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
TaonGlobalStateSubscriber = __decorateClass([
|
|
22
|
-
TaonSubscriber({
|
|
23
|
-
className: "TaonGlobalStateSubscriber"
|
|
24
|
-
// allowedEvents: ['afterUpdate'],
|
|
25
|
-
})
|
|
16
|
+
TaonGlobalStateSubscriber = __decorate([
|
|
17
|
+
TaonSubscriber({
|
|
18
|
+
className: 'TaonGlobalStateSubscriber',
|
|
19
|
+
// allowedEvents: ['afterUpdate'],
|
|
20
|
+
})
|
|
26
21
|
], TaonGlobalStateSubscriber);
|
|
27
|
-
export {
|
|
28
|
-
TaonGlobalStateSubscriber
|
|
29
|
-
};
|
|
22
|
+
export { TaonGlobalStateSubscriber };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
TaonGlobalStateUtils__NS__assertAllowedTransition
|
|
1
|
+
import { allowedTaonGlobalStatusOrders, } from './taon-global-state.models';
|
|
2
|
+
//namespace TaonGlobalStateUtils
|
|
3
|
+
// export function isActive(state: string): state is TaonGlobalStateStatus {
|
|
4
|
+
// return state === 'active';
|
|
5
|
+
// }
|
|
6
|
+
export const TaonGlobalStateUtils__NS__assertAllowedTransition = (from, to) => {
|
|
7
|
+
if (!allowedTaonGlobalStatusOrders[from]?.includes(to)) {
|
|
8
|
+
throw new Error(`Invalid state transition: ${from} → ${to}`);
|
|
9
|
+
}
|
|
11
10
|
};
|
|
11
|
+
//end of namespace TaonGlobalStateUtils
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
1
|
+
/* */
|
|
2
|
+
export * from './taon-transaction-registry.abstract.context';
|
|
3
|
+
export * from './taon-transaction-registry.constants';
|
|
4
|
+
export * from './taon-transaction-registry.controller';
|
|
5
|
+
export * from './taon-transaction-registry.entity';
|
|
6
|
+
export * from './taon-transaction-registry.middleware';
|
|
7
|
+
export * from './taon-transaction-registry.models';
|
|
8
|
+
export * from './taon-transaction-registry.provider';
|
|
9
|
+
export * from './taon-transaction-registry.repository';
|
|
10
|
+
export * from './taon-transaction-registry.subscriber';
|
|
11
|
+
export * from './taon-transaction-registry.utils';
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
//#region imports
|
|
2
|
+
import { TaonBaseContext } from '../../base-classes/base-context';
|
|
3
|
+
import { createContext } from '../../create-context';
|
|
4
|
+
import { TaonTransactionRegistryController } from './taon-transaction-registry.controller';
|
|
5
|
+
import { TAON_TANSACTION_REGISTRY } from './taon-transaction-registry.entity';
|
|
6
|
+
import { TaonTransactionRegistryMiddleware } from './taon-transaction-registry.middleware';
|
|
7
|
+
import { TaonTransactionRegistryProvider } from './taon-transaction-registry.provider';
|
|
8
|
+
import { TaonTransactionRegistryRepository } from './taon-transaction-registry.repository';
|
|
9
|
+
import { TaonTransactionRegistrySubscriber } from './taon-transaction-registry.subscriber';
|
|
10
|
+
//#endregion
|
|
11
|
+
export const TaonTransactionRegistryContext = createContext(() => ({
|
|
12
|
+
contextName: 'TaonTransactionRegistryContext',
|
|
13
|
+
abstract: true,
|
|
14
|
+
contexts: { TaonBaseContext },
|
|
15
|
+
entities: { TAON_TANSACTION_REGISTRY },
|
|
16
|
+
controllers: { TaonTransactionRegistryController },
|
|
17
|
+
repositories: { TaonTransactionRegistryRepository },
|
|
18
|
+
providers: { TaonTransactionRegistryProvider },
|
|
19
|
+
middlewares: { TaonTransactionRegistryMiddleware },
|
|
20
|
+
subscribers: { TaonTransactionRegistrySubscriber },
|
|
19
21
|
}));
|
|
20
|
-
export {
|
|
21
|
-
TaonTransactionRegistryContext
|
|
22
|
-
};
|
package/lib-prod/global-state/taon-transaction-registry/taon-transaction-registry.constants.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const TaonTransactionRegistryDefaultsValues = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export {
|
|
7
|
-
TaonTransactionRegistryDefaultsValues
|
|
1
|
+
export const TaonTransactionRegistryDefaultsValues = {
|
|
2
|
+
description: '',
|
|
3
|
+
version: 0,
|
|
4
|
+
id: void 0,
|
|
8
5
|
};
|