@midwayjs/info 3.0.0-beta.9 → 3.0.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/README.md +6 -27
- package/dist/config.default.d.ts +3 -0
- package/dist/config.default.js +10 -0
- package/dist/configuration.d.ts +3 -0
- package/dist/configuration.js +18 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/infoService.d.ts +9 -2
- package/dist/infoService.js +81 -9
- package/dist/interface.d.ts +7 -4
- package/dist/interface.js +2 -6
- package/dist/middleware/info.middleware.d.ts +8 -0
- package/dist/middleware/info.middleware.js +55 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +19 -31
- package/package.json +14 -9
- package/CHANGELOG.md +0 -75
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Midway Information Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Show your project info in router or other way, like phpInfo.
|
|
4
|
+
|
|
5
|
+

|
|
4
6
|
|
|
5
|
-

|
|
6
7
|
## Usage
|
|
7
8
|
|
|
8
|
-
in
|
|
9
|
+
import info component in `configuration.ts` file
|
|
9
10
|
|
|
10
11
|
```ts
|
|
11
12
|
import * as info from '@midwayjs/info';
|
|
@@ -24,29 +25,7 @@ export class ContainerConfiguration {
|
|
|
24
25
|
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
// model/user.ts
|
|
31
|
-
import { Provider, Controller, Get } from '@midwayjs/decorator';
|
|
32
|
-
import { InfoService, InfoValueType } from '@midwayjs/info';
|
|
33
|
-
|
|
34
|
-
@Provider()
|
|
35
|
-
@Controller('/')
|
|
36
|
-
export class Photo {
|
|
37
|
-
|
|
38
|
-
@Inject()
|
|
39
|
-
infoService: InfoService;
|
|
40
|
-
|
|
41
|
-
@Get('/info')
|
|
42
|
-
getMidwayInfo() {
|
|
43
|
-
// return json
|
|
44
|
-
return this.infoService.info();
|
|
45
|
-
// return html
|
|
46
|
-
return this.infoService.info(InfoValueType.HTML);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
```
|
|
28
|
+
Your can curl `/_info` to show it.
|
|
50
29
|
|
|
51
30
|
## License
|
|
52
31
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.info = void 0;
|
|
4
|
+
const interface_1 = require("./interface");
|
|
5
|
+
exports.info = {
|
|
6
|
+
title: 'Midway Info',
|
|
7
|
+
infoPath: '/_info',
|
|
8
|
+
hiddenKey: interface_1.DefaultHiddenKey,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=config.default.js.map
|
package/dist/configuration.d.ts
CHANGED
package/dist/configuration.js
CHANGED
|
@@ -5,19 +5,34 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.InfoConfiguration = void 0;
|
|
10
13
|
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
+
const info_middleware_1 = require("./middleware/info.middleware");
|
|
15
|
+
const core_1 = require("@midwayjs/core");
|
|
16
|
+
const DefaultConfig = require("./config.default");
|
|
11
17
|
let InfoConfiguration = class InfoConfiguration {
|
|
18
|
+
async onReady() {
|
|
19
|
+
this.applicationManager
|
|
20
|
+
.getApplications(['koa', 'faas', 'express', 'egg'])
|
|
21
|
+
.forEach(app => {
|
|
22
|
+
app.useMiddleware(info_middleware_1.InfoMiddleware);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
12
25
|
};
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, decorator_1.Inject)(),
|
|
28
|
+
__metadata("design:type", core_1.MidwayApplicationManager)
|
|
29
|
+
], InfoConfiguration.prototype, "applicationManager", void 0);
|
|
13
30
|
InfoConfiguration = __decorate([
|
|
14
31
|
(0, decorator_1.Configuration)({
|
|
15
32
|
namespace: 'info',
|
|
16
33
|
importConfigs: [
|
|
17
34
|
{
|
|
18
|
-
default:
|
|
19
|
-
info: {},
|
|
20
|
-
},
|
|
35
|
+
default: DefaultConfig,
|
|
21
36
|
},
|
|
22
37
|
],
|
|
23
38
|
})
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,5 +14,6 @@ exports.Configuration = void 0;
|
|
|
14
14
|
var configuration_1 = require("./configuration");
|
|
15
15
|
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.InfoConfiguration; } });
|
|
16
16
|
__exportStar(require("./infoService"), exports);
|
|
17
|
+
__exportStar(require("./middleware/info.middleware"), exports);
|
|
17
18
|
__exportStar(require("./interface"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/infoService.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { MidwayInformationService, IMidwayContainer } from '@midwayjs/core';
|
|
1
|
+
import { MidwayInformationService, IMidwayContainer, MidwayConfigService, MidwayEnvironmentService } from '@midwayjs/core';
|
|
2
2
|
import { InfoValueType, TypeInfo } from './interface';
|
|
3
3
|
export declare class InfoService {
|
|
4
4
|
midwayInformationService: MidwayInformationService;
|
|
5
|
-
|
|
5
|
+
configService: MidwayConfigService;
|
|
6
|
+
environment: MidwayEnvironmentService;
|
|
7
|
+
titleConfig: any;
|
|
8
|
+
defaultHiddenKey: string[];
|
|
9
|
+
secretMatchList: Array<any>;
|
|
6
10
|
container: IMidwayContainer;
|
|
11
|
+
init(): Promise<void>;
|
|
7
12
|
info(infoValueType?: InfoValueType): string | TypeInfo[];
|
|
8
13
|
projectInfo(): TypeInfo;
|
|
9
14
|
systemInfo(): TypeInfo;
|
|
@@ -21,5 +26,7 @@ export declare class InfoService {
|
|
|
21
26
|
type: string;
|
|
22
27
|
info: {};
|
|
23
28
|
};
|
|
29
|
+
protected filterSecretContent(key: any, value: any): any;
|
|
30
|
+
protected safeJson(value: any): string;
|
|
24
31
|
}
|
|
25
32
|
//# sourceMappingURL=infoService.d.ts.map
|
package/dist/infoService.js
CHANGED
|
@@ -12,11 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.InfoService = void 0;
|
|
13
13
|
const decorator_1 = require("@midwayjs/decorator");
|
|
14
14
|
const core_1 = require("@midwayjs/core");
|
|
15
|
-
const interface_1 = require("./interface");
|
|
16
15
|
const utils_1 = require("./utils");
|
|
17
16
|
const os_1 = require("os");
|
|
18
17
|
const path_1 = require("path");
|
|
18
|
+
const pm = require("picomatch");
|
|
19
19
|
let InfoService = class InfoService {
|
|
20
|
+
async init() {
|
|
21
|
+
this.secretMatchList = Array.from(new Set(this.defaultHiddenKey)).map(pattern => {
|
|
22
|
+
return pm(pattern);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
20
25
|
info(infoValueType) {
|
|
21
26
|
const info = [];
|
|
22
27
|
info.push(this.projectInfo());
|
|
@@ -29,8 +34,8 @@ let InfoService = class InfoService {
|
|
|
29
34
|
info.push(this.envInfo());
|
|
30
35
|
info.push(this.dependenciesInfo());
|
|
31
36
|
info.push(this.networkInfo());
|
|
32
|
-
if (infoValueType ===
|
|
33
|
-
return (0, utils_1.renderToHtml)(info);
|
|
37
|
+
if (infoValueType === 'html') {
|
|
38
|
+
return (0, utils_1.renderToHtml)(info, this.titleConfig);
|
|
34
39
|
}
|
|
35
40
|
return info;
|
|
36
41
|
}
|
|
@@ -42,7 +47,7 @@ let InfoService = class InfoService {
|
|
|
42
47
|
AppDir: this.midwayInformationService.getAppDir(),
|
|
43
48
|
BaseDir: this.midwayInformationService.getBaseDir(),
|
|
44
49
|
Root: this.midwayInformationService.getRoot(),
|
|
45
|
-
Env: this.
|
|
50
|
+
Env: this.environment.getCurrentEnvironment(),
|
|
46
51
|
},
|
|
47
52
|
};
|
|
48
53
|
}
|
|
@@ -110,9 +115,13 @@ let InfoService = class InfoService {
|
|
|
110
115
|
};
|
|
111
116
|
}
|
|
112
117
|
envInfo() {
|
|
118
|
+
const env = {};
|
|
119
|
+
Object.keys(process.env).forEach(envName => {
|
|
120
|
+
env[envName] = this.filterSecretContent(envName, process.env[envName]);
|
|
121
|
+
});
|
|
113
122
|
return {
|
|
114
123
|
type: 'Environment Variable',
|
|
115
|
-
info:
|
|
124
|
+
info: env,
|
|
116
125
|
};
|
|
117
126
|
}
|
|
118
127
|
timeInfo() {
|
|
@@ -189,28 +198,91 @@ let InfoService = class InfoService {
|
|
|
189
198
|
}
|
|
190
199
|
midwayConfig() {
|
|
191
200
|
const info = {};
|
|
192
|
-
const config = this.
|
|
201
|
+
const config = this.configService.getConfiguration() || {};
|
|
193
202
|
Object.keys(config).forEach(key => {
|
|
194
|
-
info[key] = (
|
|
203
|
+
info[key] = this.safeJson(this.filterSecretContent(key, config[key]));
|
|
195
204
|
});
|
|
196
205
|
return {
|
|
197
206
|
type: 'Midway Config',
|
|
198
207
|
info,
|
|
199
208
|
};
|
|
200
209
|
}
|
|
210
|
+
filterSecretContent(key, value) {
|
|
211
|
+
if (typeof value === 'string') {
|
|
212
|
+
const find = this.secretMatchList.some(isMatch => {
|
|
213
|
+
return isMatch(key.toLowerCase());
|
|
214
|
+
});
|
|
215
|
+
if (find) {
|
|
216
|
+
return (0, utils_1.safeContent)(value);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (Array.isArray(value)) {
|
|
220
|
+
return value.map(item => {
|
|
221
|
+
return this.filterSecretContent(key, item);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
safeJson(value) {
|
|
227
|
+
switch (typeof value) {
|
|
228
|
+
case 'string':
|
|
229
|
+
return `"${value}"`;
|
|
230
|
+
case 'number':
|
|
231
|
+
return `${value}`;
|
|
232
|
+
case 'boolean':
|
|
233
|
+
return String(value);
|
|
234
|
+
case 'object':
|
|
235
|
+
if (!value) {
|
|
236
|
+
return 'null';
|
|
237
|
+
}
|
|
238
|
+
if (Array.isArray(value)) {
|
|
239
|
+
return `[${value.map(item => this.safeJson(item)).join(',')}]`;
|
|
240
|
+
}
|
|
241
|
+
if (value instanceof RegExp) {
|
|
242
|
+
return `"${value.toString()}"`;
|
|
243
|
+
}
|
|
244
|
+
// eslint-disable-next-line no-case-declarations
|
|
245
|
+
const props = [];
|
|
246
|
+
for (const key in value) {
|
|
247
|
+
props.push(`"${key}":${this.safeJson(this.filterSecretContent(key, value[key]))}`);
|
|
248
|
+
}
|
|
249
|
+
return `{${props.join(',')}}`;
|
|
250
|
+
case 'function':
|
|
251
|
+
return `function ${value.name}(${value.length} args)`;
|
|
252
|
+
}
|
|
253
|
+
return '';
|
|
254
|
+
}
|
|
201
255
|
};
|
|
202
256
|
__decorate([
|
|
203
257
|
(0, decorator_1.Inject)(),
|
|
204
258
|
__metadata("design:type", core_1.MidwayInformationService)
|
|
205
259
|
], InfoService.prototype, "midwayInformationService", void 0);
|
|
206
260
|
__decorate([
|
|
207
|
-
(0, decorator_1.
|
|
261
|
+
(0, decorator_1.Inject)(),
|
|
262
|
+
__metadata("design:type", core_1.MidwayConfigService)
|
|
263
|
+
], InfoService.prototype, "configService", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
(0, decorator_1.Inject)(),
|
|
266
|
+
__metadata("design:type", core_1.MidwayEnvironmentService)
|
|
267
|
+
], InfoService.prototype, "environment", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
(0, decorator_1.Config)('info.title'),
|
|
208
270
|
__metadata("design:type", Object)
|
|
209
|
-
], InfoService.prototype, "
|
|
271
|
+
], InfoService.prototype, "titleConfig", void 0);
|
|
272
|
+
__decorate([
|
|
273
|
+
(0, decorator_1.Config)('info.hiddenKey'),
|
|
274
|
+
__metadata("design:type", Array)
|
|
275
|
+
], InfoService.prototype, "defaultHiddenKey", void 0);
|
|
210
276
|
__decorate([
|
|
211
277
|
(0, decorator_1.ApplicationContext)(),
|
|
212
278
|
__metadata("design:type", Object)
|
|
213
279
|
], InfoService.prototype, "container", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
(0, decorator_1.Init)(),
|
|
282
|
+
__metadata("design:type", Function),
|
|
283
|
+
__metadata("design:paramtypes", []),
|
|
284
|
+
__metadata("design:returntype", Promise)
|
|
285
|
+
], InfoService.prototype, "init", null);
|
|
214
286
|
InfoService = __decorate([
|
|
215
287
|
(0, decorator_1.Provide)(),
|
|
216
288
|
(0, decorator_1.Scope)(decorator_1.ScopeEnum.Singleton)
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
JSON = "json"
|
|
4
|
-
}
|
|
1
|
+
export declare type InfoValueType = 'html' | 'json';
|
|
2
|
+
export declare const DefaultHiddenKey: string[];
|
|
5
3
|
export interface TypeInfo {
|
|
6
4
|
type: string;
|
|
7
5
|
info: {
|
|
8
6
|
[key: string]: string | number;
|
|
9
7
|
};
|
|
10
8
|
}
|
|
9
|
+
export interface InfoConfigOptions {
|
|
10
|
+
title: string;
|
|
11
|
+
infoPath: string;
|
|
12
|
+
hiddenKey: Array<string>;
|
|
13
|
+
}
|
|
11
14
|
//# sourceMappingURL=interface.d.ts.map
|
package/dist/interface.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
(function (InfoValueType) {
|
|
6
|
-
InfoValueType["HTML"] = "html";
|
|
7
|
-
InfoValueType["JSON"] = "json";
|
|
8
|
-
})(InfoValueType = exports.InfoValueType || (exports.InfoValueType = {}));
|
|
3
|
+
exports.DefaultHiddenKey = void 0;
|
|
4
|
+
exports.DefaultHiddenKey = ['keys', '*key', '*token', '*secret*', 'pass*'];
|
|
9
5
|
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InfoService } from '../infoService';
|
|
2
|
+
export declare class InfoMiddleware {
|
|
3
|
+
protected infoPath: any;
|
|
4
|
+
protected infoService: InfoService;
|
|
5
|
+
resolve(app: any): ((req: any, res: any, next: any) => Promise<void>) | ((ctx: any, next: any) => Promise<any>);
|
|
6
|
+
static getName(): string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=info.middleware.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InfoMiddleware = void 0;
|
|
13
|
+
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
+
const infoService_1 = require("../infoService");
|
|
15
|
+
let InfoMiddleware = class InfoMiddleware {
|
|
16
|
+
resolve(app) {
|
|
17
|
+
if (app.getFrameworkType() === decorator_1.MidwayFrameworkType.WEB_EXPRESS) {
|
|
18
|
+
return async (req, res, next) => {
|
|
19
|
+
if (req.path === this.infoPath) {
|
|
20
|
+
// return html
|
|
21
|
+
res.type('html');
|
|
22
|
+
res.send(this.infoService.info('html'));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
next();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return async (ctx, next) => {
|
|
31
|
+
if (ctx.path === this.infoPath) {
|
|
32
|
+
// return html
|
|
33
|
+
return this.infoService.info('html');
|
|
34
|
+
}
|
|
35
|
+
return await next();
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static getName() {
|
|
40
|
+
return 'info';
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, decorator_1.Config)('info.infoPath'),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], InfoMiddleware.prototype, "infoPath", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, decorator_1.Inject)(),
|
|
49
|
+
__metadata("design:type", infoService_1.InfoService)
|
|
50
|
+
], InfoMiddleware.prototype, "infoService", void 0);
|
|
51
|
+
InfoMiddleware = __decorate([
|
|
52
|
+
(0, decorator_1.Middleware)()
|
|
53
|
+
], InfoMiddleware);
|
|
54
|
+
exports.InfoMiddleware = InfoMiddleware;
|
|
55
|
+
//# sourceMappingURL=info.middleware.js.map
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeInfo } from './interface';
|
|
2
2
|
export declare function safeRequire(mod: string, defaultValue?: any): any;
|
|
3
3
|
export declare function bitToMB(bit: number): string;
|
|
4
|
-
export declare function renderToHtml(infoList: TypeInfo[]): string;
|
|
5
|
-
export declare function
|
|
4
|
+
export declare function renderToHtml(infoList: TypeInfo[], title: any): string;
|
|
5
|
+
export declare function safeContent(value?: string): string;
|
|
6
6
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.safeContent = exports.renderToHtml = exports.bitToMB = exports.safeRequire = void 0;
|
|
4
4
|
function safeRequire(mod, defaultValue) {
|
|
5
5
|
try {
|
|
6
6
|
return require(mod);
|
|
@@ -14,8 +14,8 @@ function bitToMB(bit) {
|
|
|
14
14
|
return Number((bit || 0) / 1024 / 1024).toFixed(2) + ' MB';
|
|
15
15
|
}
|
|
16
16
|
exports.bitToMB = bitToMB;
|
|
17
|
-
function renderToHtml(infoList) {
|
|
18
|
-
let html =
|
|
17
|
+
function renderToHtml(infoList, title) {
|
|
18
|
+
let html = `<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${title}</div>`;
|
|
19
19
|
html += infoList
|
|
20
20
|
.map(info => {
|
|
21
21
|
const infoList = Object.keys(info.info || {});
|
|
@@ -34,34 +34,22 @@ function renderToHtml(infoList) {
|
|
|
34
34
|
</style><div style="margin: 24px auto;max-width: 720px;min-width: 440px;">${html}</div>`;
|
|
35
35
|
}
|
|
36
36
|
exports.renderToHtml = renderToHtml;
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (value instanceof RegExp) {
|
|
53
|
-
return `"${value.toString()}"`;
|
|
54
|
-
}
|
|
55
|
-
// eslint-disable-next-line no-case-declarations
|
|
56
|
-
const props = [];
|
|
57
|
-
for (const key in value) {
|
|
58
|
-
props.push(`"${key}":${safeJson(value[key])}`);
|
|
59
|
-
}
|
|
60
|
-
return `{${props.join(',')}}`;
|
|
61
|
-
case 'function':
|
|
62
|
-
return `function ${value.name}(${value.length} args)`;
|
|
37
|
+
function safeContent(value = '') {
|
|
38
|
+
if (value.length < 3) {
|
|
39
|
+
return '*'.repeat(value.length);
|
|
40
|
+
}
|
|
41
|
+
else if (value.length < 6) {
|
|
42
|
+
return value[0] + '*'.repeat(value.length - 1);
|
|
43
|
+
}
|
|
44
|
+
else if (value.length < 10) {
|
|
45
|
+
return value[0] + '*'.repeat(value.length - 2) + value[value.length - 1];
|
|
46
|
+
}
|
|
47
|
+
else if (value.length < 15) {
|
|
48
|
+
return value.slice(0, 2) + '*'.repeat(value.length - 4) + value.slice(-2);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return value.slice(0, 3) + '*'.repeat(value.length - 6) + value.slice(-3);
|
|
63
52
|
}
|
|
64
|
-
return '';
|
|
65
53
|
}
|
|
66
|
-
exports.
|
|
54
|
+
exports.safeContent = safeContent;
|
|
67
55
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/info",
|
|
3
3
|
"description": "midway info",
|
|
4
|
-
"version": "3.0.0
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/**/*.js",
|
|
9
9
|
"dist/**/*.d.ts"
|
|
10
10
|
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"picomatch": "2.3.1"
|
|
13
|
+
},
|
|
11
14
|
"devDependencies": {
|
|
12
|
-
"@midwayjs/core": "^3.0.0
|
|
13
|
-
"@midwayjs/decorator": "^3.0.0
|
|
14
|
-
"@midwayjs/
|
|
15
|
-
"@midwayjs/
|
|
16
|
-
"@midwayjs/
|
|
15
|
+
"@midwayjs/core": "^3.0.0",
|
|
16
|
+
"@midwayjs/decorator": "^3.0.0",
|
|
17
|
+
"@midwayjs/express": "^3.0.0",
|
|
18
|
+
"@midwayjs/koa": "^3.0.0",
|
|
19
|
+
"@midwayjs/mock": "^3.0.0",
|
|
20
|
+
"@midwayjs/serverless-fc-starter": "^3.0.0",
|
|
21
|
+
"@midwayjs/serverless-scf-starter": "^3.0.0"
|
|
17
22
|
},
|
|
18
23
|
"keywords": [
|
|
19
24
|
"midway"
|
|
@@ -22,8 +27,8 @@
|
|
|
22
27
|
"license": "MIT",
|
|
23
28
|
"scripts": {
|
|
24
29
|
"build": "tsc",
|
|
25
|
-
"test": "node --require=ts-node/register ../../node_modules/.bin/jest",
|
|
26
|
-
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --coverage --forceExit",
|
|
30
|
+
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
|
|
31
|
+
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit",
|
|
27
32
|
"ci": "npm run test",
|
|
28
33
|
"lint": "mwts check"
|
|
29
34
|
},
|
|
@@ -34,5 +39,5 @@
|
|
|
34
39
|
"type": "git",
|
|
35
40
|
"url": "https://github.com/midwayjs/midway.git"
|
|
36
41
|
},
|
|
37
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "55c26029bccf7bbb739fa1597e8f418dafa2caa0"
|
|
38
43
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### Features
|
|
58
|
-
|
|
59
|
-
* add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
|
|
66
|
-
|
|
67
|
-
**Note:** Version bump only for package @midwayjs/info
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @midwayjs/info
|