vona-module-a-startup 5.0.13 → 5.0.15
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/dist/.metadata/index.d.ts +40 -28
- package/dist/index.js +33 -24
- package/package.json +1 -1
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/** service: begin */
|
|
2
|
+
export * from '../service/startup.ts';
|
|
3
|
+
import 'vona';
|
|
4
|
+
declare module 'vona-module-a-bean' {
|
|
5
|
+
interface IServiceRecord {
|
|
6
|
+
'a-startup:startup': never;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare module 'vona-module-a-startup' {
|
|
10
|
+
interface ServiceStartup {
|
|
11
|
+
}
|
|
12
|
+
interface ServiceStartup {
|
|
13
|
+
get $beanFullName(): 'a-startup.service.startup';
|
|
14
|
+
get $onionName(): 'a-startup:startup';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** service: end */
|
|
18
|
+
/** service: begin */
|
|
19
|
+
import type { ServiceStartup } from '../service/startup.ts';
|
|
20
|
+
export interface IModuleService {
|
|
21
|
+
'startup': ServiceStartup;
|
|
22
|
+
}
|
|
23
|
+
/** service: end */
|
|
24
|
+
/** service: begin */
|
|
25
|
+
import 'vona';
|
|
26
|
+
declare module 'vona' {
|
|
27
|
+
interface IBeanRecordGeneral {
|
|
28
|
+
'a-startup.service.startup': ServiceStartup;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** service: end */
|
|
1
32
|
/** cacheRedis: begin */
|
|
2
33
|
export * from '../bean/cacheRedis.startupDebounce.ts';
|
|
3
34
|
import { type IDecoratorCacheRedisOptions } from 'vona-module-a-cache';
|
|
@@ -9,6 +40,10 @@ declare module 'vona-module-a-cache' {
|
|
|
9
40
|
declare module 'vona-module-a-startup' {
|
|
10
41
|
interface CacheRedisStartupDebounce {
|
|
11
42
|
}
|
|
43
|
+
interface CacheRedisStartupDebounce {
|
|
44
|
+
get $beanFullName(): 'a-startup.cacheRedis.startupDebounce';
|
|
45
|
+
get $onionName(): 'a-startup:startupDebounce';
|
|
46
|
+
}
|
|
12
47
|
}
|
|
13
48
|
/** cacheRedis: end */
|
|
14
49
|
/** cacheRedis: begin */
|
|
@@ -28,38 +63,15 @@ declare module 'vona' {
|
|
|
28
63
|
declare module 'vona-module-a-startup' {
|
|
29
64
|
interface MetaRedlock {
|
|
30
65
|
}
|
|
66
|
+
interface MetaRedlock {
|
|
67
|
+
get $beanFullName(): 'a-startup.meta.redlock';
|
|
68
|
+
get $onionName(): 'a-startup:redlock';
|
|
69
|
+
}
|
|
31
70
|
}
|
|
32
71
|
/** meta: end */
|
|
33
72
|
/** meta redlock: begin */
|
|
34
73
|
import type { MetaRedlock } from '../bean/meta.redlock.ts';
|
|
35
74
|
/** meta redlock: end */
|
|
36
|
-
/** service: begin */
|
|
37
|
-
export * from '../service/startup.ts';
|
|
38
|
-
import 'vona';
|
|
39
|
-
declare module 'vona-module-a-web' {
|
|
40
|
-
interface IServiceRecord {
|
|
41
|
-
'a-startup:startup': never;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
declare module 'vona-module-a-startup' {
|
|
45
|
-
interface ServiceStartup {
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** service: end */
|
|
49
|
-
/** service: begin */
|
|
50
|
-
import type { ServiceStartup } from '../service/startup.ts';
|
|
51
|
-
export interface IModuleService {
|
|
52
|
-
'startup': ServiceStartup;
|
|
53
|
-
}
|
|
54
|
-
/** service: end */
|
|
55
|
-
/** service: begin */
|
|
56
|
-
import 'vona';
|
|
57
|
-
declare module 'vona' {
|
|
58
|
-
interface IBeanRecordGeneral {
|
|
59
|
-
'a-startup.service.startup': ServiceStartup;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** service: end */
|
|
63
75
|
/** config: begin */
|
|
64
76
|
export * from '../config/config.ts';
|
|
65
77
|
import type { config } from '../config/config.ts';
|
|
@@ -74,9 +86,9 @@ export declare class ScopeModuleAStartup extends BeanScopeBase {
|
|
|
74
86
|
export interface ScopeModuleAStartup {
|
|
75
87
|
util: BeanScopeUtil;
|
|
76
88
|
config: TypeModuleConfig<typeof config>;
|
|
89
|
+
service: IModuleService;
|
|
77
90
|
cacheRedis: IModuleCacheRedis;
|
|
78
91
|
redlock: MetaRedlock;
|
|
79
|
-
service: IModuleService;
|
|
80
92
|
}
|
|
81
93
|
import 'vona';
|
|
82
94
|
declare module 'vona' {
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import { BeanInfo, BeanBase, cast, BeanSimple, BeanScopeBase, createBeanDecorator } from 'vona';
|
|
2
|
-
import { CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
3
|
-
import { Meta } from 'vona-module-a-meta';
|
|
4
|
-
import { BeanRedlockBase } from 'vona-module-a-redlock';
|
|
5
2
|
import path from 'node:path';
|
|
6
3
|
import { isNil } from '@cabloy/utils';
|
|
7
4
|
import fse from 'fs-extra';
|
|
8
|
-
import { Service } from 'vona-module-a-
|
|
9
|
-
import {
|
|
5
|
+
import { Service, Scope } from 'vona-module-a-bean';
|
|
6
|
+
import { CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
7
|
+
import { Meta } from 'vona-module-a-meta';
|
|
8
|
+
import { BeanRedlockBase } from 'vona-module-a-redlock';
|
|
10
9
|
|
|
11
10
|
var _dec$3, _dec2$3, _class$3;
|
|
12
|
-
let
|
|
13
|
-
module: "a-startup"
|
|
14
|
-
}), _dec$3(_class$3 = _dec2$3(_class$3 = class CacheRedisStartupDebounce extends BeanCacheRedisBase {}) || _class$3) || _class$3);
|
|
15
|
-
|
|
16
|
-
var _dec$2, _dec2$2, _class$2;
|
|
17
|
-
let MetaRedlock = (_dec$2 = Meta(), _dec2$2 = BeanInfo({
|
|
11
|
+
let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
18
12
|
module: "a-startup"
|
|
19
|
-
}), _dec$
|
|
20
|
-
|
|
21
|
-
var _dec$1, _dec2$1, _class$1;
|
|
22
|
-
let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
23
|
-
module: "a-startup"
|
|
24
|
-
}), _dec$1(_class$1 = _dec2$1(_class$1 = class ServiceStartup extends BeanBase {
|
|
13
|
+
}), _dec$3(_class$3 = _dec2$3(_class$3 = class ServiceStartup extends BeanBase {
|
|
25
14
|
async appStart() {
|
|
26
15
|
// clear keys
|
|
27
16
|
await this._clearResources();
|
|
@@ -51,7 +40,9 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
51
40
|
force: false
|
|
52
41
|
});
|
|
53
42
|
}, {
|
|
54
|
-
dbInfo:
|
|
43
|
+
dbInfo: {
|
|
44
|
+
level: 1
|
|
45
|
+
},
|
|
55
46
|
instanceName
|
|
56
47
|
});
|
|
57
48
|
} else {
|
|
@@ -59,7 +50,9 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
59
50
|
const instances = await this.bean.executor.newCtx(async () => {
|
|
60
51
|
return await this.bean.instance.list();
|
|
61
52
|
}, {
|
|
62
|
-
dbInfo:
|
|
53
|
+
dbInfo: {
|
|
54
|
+
level: 1
|
|
55
|
+
}
|
|
63
56
|
});
|
|
64
57
|
for (const instance of instances) {
|
|
65
58
|
const instanceName = instance.name;
|
|
@@ -69,7 +62,9 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
69
62
|
force: false
|
|
70
63
|
});
|
|
71
64
|
}, {
|
|
72
|
-
dbInfo:
|
|
65
|
+
dbInfo: {
|
|
66
|
+
level: 1
|
|
67
|
+
},
|
|
73
68
|
instanceName
|
|
74
69
|
});
|
|
75
70
|
}
|
|
@@ -81,7 +76,9 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
81
76
|
await this.bean.executor.newCtx(async () => {
|
|
82
77
|
await this.$scope.version.service.version.__instanceTest(instanceName);
|
|
83
78
|
}, {
|
|
84
|
-
dbInfo:
|
|
79
|
+
dbInfo: {
|
|
80
|
+
level: 1
|
|
81
|
+
},
|
|
85
82
|
instanceName
|
|
86
83
|
});
|
|
87
84
|
}
|
|
@@ -122,7 +119,9 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
122
119
|
const bean = cast(this.bean._getBean(startup.beanOptions.beanFullName));
|
|
123
120
|
await bean.execute(options);
|
|
124
121
|
}, {
|
|
125
|
-
dbInfo:
|
|
122
|
+
dbInfo: {
|
|
123
|
+
level: 1
|
|
124
|
+
},
|
|
126
125
|
instanceName,
|
|
127
126
|
transaction: startupOptions.transaction
|
|
128
127
|
});
|
|
@@ -151,11 +150,21 @@ let ServiceStartup = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
151
150
|
async _clearResources() {
|
|
152
151
|
if (!this.app.meta.isTest) return;
|
|
153
152
|
// redis
|
|
154
|
-
await this.$scope.redis.service.
|
|
153
|
+
await this.$scope.redis.service.redis.clearAllData();
|
|
155
154
|
// .app/public
|
|
156
155
|
await fse.remove(path.join(this.app.config.server.publicDir, '1'));
|
|
157
156
|
}
|
|
158
|
-
}) || _class$
|
|
157
|
+
}) || _class$3) || _class$3);
|
|
158
|
+
|
|
159
|
+
var _dec$2, _dec2$2, _class$2;
|
|
160
|
+
let CacheRedisStartupDebounce = (_dec$2 = CacheRedis(), _dec2$2 = BeanInfo({
|
|
161
|
+
module: "a-startup"
|
|
162
|
+
}), _dec$2(_class$2 = _dec2$2(_class$2 = class CacheRedisStartupDebounce extends BeanCacheRedisBase {}) || _class$2) || _class$2);
|
|
163
|
+
|
|
164
|
+
var _dec$1, _dec2$1, _class$1;
|
|
165
|
+
let MetaRedlock = (_dec$1 = Meta(), _dec2$1 = BeanInfo({
|
|
166
|
+
module: "a-startup"
|
|
167
|
+
}), _dec$1(_class$1 = _dec2$1(_class$1 = class MetaRedlock extends BeanRedlockBase {}) || _class$1) || _class$1);
|
|
159
168
|
|
|
160
169
|
function config(_app) {
|
|
161
170
|
return {
|