@lsby/net-core 0.0.1
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/cjs/global/global.cjs +122 -0
- package/dist/cjs/global/global.d.cts +16 -0
- package/dist/cjs/index.cjs +400 -0
- package/dist/cjs/index.d.cts +14 -0
- package/dist/cjs/interface/interface-type.cjs +53 -0
- package/dist/cjs/interface/interface-type.d.cts +22 -0
- package/dist/cjs/interface/interface.cjs +41 -0
- package/dist/cjs/interface/interface.d.cts +18 -0
- package/dist/cjs/interface/plug.cjs +41 -0
- package/dist/cjs/interface/plug.d.cts +16 -0
- package/dist/cjs/plug/chinese-path.cjs +62 -0
- package/dist/cjs/plug/chinese-path.d.cts +12 -0
- package/dist/cjs/plug/custom-data.cjs +51 -0
- package/dist/cjs/plug/custom-data.d.cts +11 -0
- package/dist/cjs/plug/json.cjs +163 -0
- package/dist/cjs/plug/json.d.cts +14 -0
- package/dist/cjs/plug/urlencoded.cjs +76 -0
- package/dist/cjs/plug/urlencoded.d.cts +13 -0
- package/dist/cjs/result/result.cjs +178 -0
- package/dist/cjs/result/result.d.cts +33 -0
- package/dist/cjs/server/server.cjs +191 -0
- package/dist/cjs/server/server.d.cts +22 -0
- package/dist/cjs/tools/get-pro-name.cjs +48 -0
- package/dist/cjs/tools/get-pro-name.d.cts +8 -0
- package/dist/cjs/tools/log.cjs +72 -0
- package/dist/cjs/tools/log.d.cts +16 -0
- package/dist/cjs/types/type-hold.cjs +30 -0
- package/dist/cjs/types/type-hold.d.cts +3 -0
- package/dist/esm/chunk-2GISBUKY.js +26 -0
- package/dist/esm/chunk-4S6GMOG5.js +78 -0
- package/dist/esm/chunk-FBQ7H3IE.js +30 -0
- package/dist/esm/chunk-GWFW2KCB.js +39 -0
- package/dist/esm/chunk-KRIDSMPV.js +17 -0
- package/dist/esm/chunk-KSZE2DTR.js +17 -0
- package/dist/esm/chunk-MFQZP7FG.js +24 -0
- package/dist/esm/chunk-PLYBVQKK.js +38 -0
- package/dist/esm/chunk-SF5Z34AP.js +29 -0
- package/dist/esm/chunk-SJCC3KPB.js +36 -0
- package/dist/esm/chunk-THMF6WFQ.js +60 -0
- package/dist/esm/chunk-Z4OJO6ZH.js +15 -0
- package/dist/esm/global/global.d.ts +16 -0
- package/dist/esm/global/global.js +10 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +51 -0
- package/dist/esm/interface/interface-type.d.ts +22 -0
- package/dist/esm/interface/interface-type.js +6 -0
- package/dist/esm/interface/interface.d.ts +18 -0
- package/dist/esm/interface/interface.js +6 -0
- package/dist/esm/interface/plug.d.ts +16 -0
- package/dist/esm/interface/plug.js +6 -0
- package/dist/esm/plug/chinese-path.d.ts +12 -0
- package/dist/esm/plug/chinese-path.js +7 -0
- package/dist/esm/plug/custom-data.d.ts +11 -0
- package/dist/esm/plug/custom-data.js +7 -0
- package/dist/esm/plug/json.d.ts +14 -0
- package/dist/esm/plug/json.js +10 -0
- package/dist/esm/plug/urlencoded.d.ts +13 -0
- package/dist/esm/plug/urlencoded.js +7 -0
- package/dist/esm/result/result.d.ts +33 -0
- package/dist/esm/result/result.js +19 -0
- package/dist/esm/server/server.d.ts +22 -0
- package/dist/esm/server/server.js +9 -0
- package/dist/esm/tools/get-pro-name.d.ts +8 -0
- package/dist/esm/tools/get-pro-name.js +6 -0
- package/dist/esm/tools/log.d.ts +16 -0
- package/dist/esm/tools/log.js +6 -0
- package/dist/esm/types/type-hold.d.ts +3 -0
- package/dist/esm/types/type-hold.js +5 -0
- package/package.json +48 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/interface/interface-type.ts
|
|
2
|
+
var \u63A5\u53E3\u7C7B\u578B = class {
|
|
3
|
+
constructor(\u8DEF\u5F84, \u65B9\u6CD5, \u63D2\u4EF6\u4EEC, \u6B63\u786E\u7ED3\u679C, \u9519\u8BEF\u7ED3\u679C) {
|
|
4
|
+
this.\u8DEF\u5F84 = \u8DEF\u5F84;
|
|
5
|
+
this.\u65B9\u6CD5 = \u65B9\u6CD5;
|
|
6
|
+
this.\u63D2\u4EF6\u4EEC = \u63D2\u4EF6\u4EEC;
|
|
7
|
+
this.\u6B63\u786E\u7ED3\u679C = \u6B63\u786E\u7ED3\u679C;
|
|
8
|
+
this.\u9519\u8BEF\u7ED3\u679C = \u9519\u8BEF\u7ED3\u679C;
|
|
9
|
+
}
|
|
10
|
+
\u83B7\u5F97\u8DEF\u5F84() {
|
|
11
|
+
return this.\u8DEF\u5F84;
|
|
12
|
+
}
|
|
13
|
+
\u83B7\u5F97\u65B9\u6CD5() {
|
|
14
|
+
return this.\u65B9\u6CD5;
|
|
15
|
+
}
|
|
16
|
+
\u83B7\u5F97\u63D2\u4EF6\u4EEC() {
|
|
17
|
+
return this.\u63D2\u4EF6\u4EEC;
|
|
18
|
+
}
|
|
19
|
+
\u83B7\u5F97\u6B63\u786E\u7ED3\u679C\u7C7B\u578B() {
|
|
20
|
+
return this.\u6B63\u786E\u7ED3\u679C;
|
|
21
|
+
}
|
|
22
|
+
\u83B7\u5F97\u9519\u8BEF\u7ED3\u679C\u7C7B\u578B() {
|
|
23
|
+
return this.\u9519\u8BEF\u7ED3\u679C;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
接口类型
|
|
29
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetProName
|
|
3
|
+
} from "./chunk-MFQZP7FG.js";
|
|
4
|
+
import {
|
|
5
|
+
Log
|
|
6
|
+
} from "./chunk-PLYBVQKK.js";
|
|
7
|
+
|
|
8
|
+
// src/global/global.ts
|
|
9
|
+
var GlobalLog = class _GlobalLog {
|
|
10
|
+
static instance;
|
|
11
|
+
static getInstance() {
|
|
12
|
+
return GlobalGetProName.getInstance().getProName().map((\u6807\u8BC6\u7B26) => {
|
|
13
|
+
\u6807\u8BC6\u7B26 = \u6807\u8BC6\u7B26.replaceAll("/", ":");
|
|
14
|
+
if (!_GlobalLog.instance)
|
|
15
|
+
_GlobalLog.instance = new Log(\u6807\u8BC6\u7B26);
|
|
16
|
+
return _GlobalLog.instance;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var GlobalGetProName = class _GlobalGetProName {
|
|
23
|
+
static instance;
|
|
24
|
+
static getInstance() {
|
|
25
|
+
if (!_GlobalGetProName.instance)
|
|
26
|
+
_GlobalGetProName.instance = new GetProName();
|
|
27
|
+
return _GlobalGetProName.instance;
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
GlobalLog,
|
|
35
|
+
GlobalGetProName
|
|
36
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GlobalLog
|
|
3
|
+
} from "./chunk-SJCC3KPB.js";
|
|
4
|
+
|
|
5
|
+
// src/result/result.ts
|
|
6
|
+
import { Task } from "@lsby/ts-fp-data";
|
|
7
|
+
var \u7ED3\u679C = class {
|
|
8
|
+
};
|
|
9
|
+
var \u6210\u529F\u7ED3\u679C = class extends \u7ED3\u679C {
|
|
10
|
+
\u6210\u529F\u7ED3\u679C\u70D9\u5370 = true;
|
|
11
|
+
};
|
|
12
|
+
var \u6210\u529FJSON\u7ED3\u679C = class extends \u6210\u529F\u7ED3\u679C {
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super();
|
|
15
|
+
this.data = data;
|
|
16
|
+
}
|
|
17
|
+
log = GlobalLog.getInstance();
|
|
18
|
+
run(req, res) {
|
|
19
|
+
return new Task(async () => {
|
|
20
|
+
var log = (await this.log.run()).extend("\u6210\u529FJSON\u7ED3\u679C");
|
|
21
|
+
await log.debug("\u8FD4\u56DE\u6570\u636E: %o", this.data).run();
|
|
22
|
+
res.send(this.data);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var \u6210\u529F\u81EA\u5B9A\u4E49\u7ED3\u679C = class extends \u6210\u529F\u7ED3\u679C {
|
|
27
|
+
constructor(customHandler) {
|
|
28
|
+
super();
|
|
29
|
+
this.customHandler = customHandler;
|
|
30
|
+
}
|
|
31
|
+
run(req, res) {
|
|
32
|
+
return this.customHandler(req, res);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var \u9519\u8BEF\u7ED3\u679C = class extends \u7ED3\u679C {
|
|
36
|
+
\u9519\u8BEF\u7ED3\u679C\u70D9\u5370 = true;
|
|
37
|
+
};
|
|
38
|
+
var \u9519\u8BEFJSON\u7ED3\u679C = class extends \u9519\u8BEF\u7ED3\u679C {
|
|
39
|
+
constructor(data) {
|
|
40
|
+
super();
|
|
41
|
+
this.data = data;
|
|
42
|
+
}
|
|
43
|
+
log = GlobalLog.getInstance();
|
|
44
|
+
run(req, res) {
|
|
45
|
+
return new Task(async () => {
|
|
46
|
+
var log = (await this.log.run()).extend("\u9519\u8BEFJSON\u7ED3\u679C");
|
|
47
|
+
await log.debug("\u8FD4\u56DE\u6570\u636E: %o", this.data).run();
|
|
48
|
+
res.send(this.data);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
结果,
|
|
55
|
+
成功结果,
|
|
56
|
+
成功JSON结果,
|
|
57
|
+
成功自定义结果,
|
|
58
|
+
错误结果,
|
|
59
|
+
错误JSON结果
|
|
60
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
插件
|
|
3
|
+
} from "./chunk-KSZE2DTR.js";
|
|
4
|
+
|
|
5
|
+
// src/plug/custom-data.ts
|
|
6
|
+
import { Task } from "@lsby/ts-fp-data";
|
|
7
|
+
var \u81EA\u5B9A\u4E49\u6570\u636E\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
|
|
8
|
+
constructor(t, data) {
|
|
9
|
+
super(t, () => Task.pure(data));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
自定义数据插件
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
2
|
+
import { GetProName } from '../tools/get-pro-name.js';
|
|
3
|
+
import { Log } from '../tools/log.js';
|
|
4
|
+
|
|
5
|
+
declare class GlobalLog {
|
|
6
|
+
private static instance;
|
|
7
|
+
static getInstance(): Task<Log>;
|
|
8
|
+
private constructor();
|
|
9
|
+
}
|
|
10
|
+
declare class GlobalGetProName {
|
|
11
|
+
private static instance;
|
|
12
|
+
static getInstance(): GetProName;
|
|
13
|
+
private constructor();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { GlobalGetProName, GlobalLog };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { 任意接口, 接口 } from './interface/interface.js';
|
|
2
|
+
export { 接口类型 } from './interface/interface-type.js';
|
|
3
|
+
export { 合并插件结果, 插件 } from './interface/plug.js';
|
|
4
|
+
export { 中文路径支持插件 } from './plug/chinese-path.js';
|
|
5
|
+
export { 自定义数据插件 } from './plug/custom-data.js';
|
|
6
|
+
export { JSON解析插件 } from './plug/json.js';
|
|
7
|
+
export { 表单解析插件 } from './plug/urlencoded.js';
|
|
8
|
+
export { 成功JSON结果, 成功结果, 成功自定义结果, 结果, 错误JSON结果, 错误结果 } from './result/result.js';
|
|
9
|
+
export { 服务器 } from './server/server.js';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import '@lsby/ts-fp-data';
|
|
12
|
+
import './types/type-hold.js';
|
|
13
|
+
import 'express';
|
|
14
|
+
import 'node:http';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
表单解析插件
|
|
3
|
+
} from "./chunk-FBQ7H3IE.js";
|
|
4
|
+
import {
|
|
5
|
+
成功JSON结果,
|
|
6
|
+
成功结果,
|
|
7
|
+
成功自定义结果,
|
|
8
|
+
结果,
|
|
9
|
+
错误JSON结果,
|
|
10
|
+
错误结果
|
|
11
|
+
} from "./chunk-THMF6WFQ.js";
|
|
12
|
+
import {
|
|
13
|
+
服务器
|
|
14
|
+
} from "./chunk-4S6GMOG5.js";
|
|
15
|
+
import {
|
|
16
|
+
接口类型
|
|
17
|
+
} from "./chunk-SF5Z34AP.js";
|
|
18
|
+
import {
|
|
19
|
+
接口
|
|
20
|
+
} from "./chunk-KRIDSMPV.js";
|
|
21
|
+
import {
|
|
22
|
+
中文路径支持插件
|
|
23
|
+
} from "./chunk-2GISBUKY.js";
|
|
24
|
+
import {
|
|
25
|
+
自定义数据插件
|
|
26
|
+
} from "./chunk-Z4OJO6ZH.js";
|
|
27
|
+
import {
|
|
28
|
+
JSON解析插件
|
|
29
|
+
} from "./chunk-GWFW2KCB.js";
|
|
30
|
+
import "./chunk-SJCC3KPB.js";
|
|
31
|
+
import "./chunk-MFQZP7FG.js";
|
|
32
|
+
import "./chunk-PLYBVQKK.js";
|
|
33
|
+
import {
|
|
34
|
+
插件
|
|
35
|
+
} from "./chunk-KSZE2DTR.js";
|
|
36
|
+
export {
|
|
37
|
+
JSON\u89E3\u6790\u63D2\u4EF6,
|
|
38
|
+
\u4E2D\u6587\u8DEF\u5F84\u652F\u6301\u63D2\u4EF6,
|
|
39
|
+
\u6210\u529FJSON\u7ED3\u679C,
|
|
40
|
+
\u6210\u529F\u7ED3\u679C,
|
|
41
|
+
\u6210\u529F\u81EA\u5B9A\u4E49\u7ED3\u679C,
|
|
42
|
+
\u63A5\u53E3,
|
|
43
|
+
\u63A5\u53E3\u7C7B\u578B,
|
|
44
|
+
\u63D2\u4EF6,
|
|
45
|
+
\u670D\u52A1\u5668,
|
|
46
|
+
\u7ED3\u679C,
|
|
47
|
+
\u81EA\u5B9A\u4E49\u6570\u636E\u63D2\u4EF6,
|
|
48
|
+
\u8868\u5355\u89E3\u6790\u63D2\u4EF6,
|
|
49
|
+
\u9519\u8BEFJSON\u7ED3\u679C,
|
|
50
|
+
\u9519\u8BEF\u7ED3\u679C
|
|
51
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { 类型保持符号 as ______ } from '../types/type-hold.js';
|
|
3
|
+
import { 插件 as __ } from './plug.js';
|
|
4
|
+
import 'express';
|
|
5
|
+
import '@lsby/ts-fp-data';
|
|
6
|
+
|
|
7
|
+
declare class 接口类型<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject>>, 正确结果类型 extends z.ZodTypeAny, 错误结果类型 extends z.ZodTypeAny> {
|
|
8
|
+
private 路径;
|
|
9
|
+
private 方法;
|
|
10
|
+
private 插件们;
|
|
11
|
+
private 正确结果;
|
|
12
|
+
private 错误结果;
|
|
13
|
+
[______]: [路径, 方法, 插件们, 正确结果类型, 错误结果类型];
|
|
14
|
+
constructor(路径: 路径, 方法: 方法, 插件们: [...插件们], 正确结果: 正确结果类型, 错误结果: 错误结果类型);
|
|
15
|
+
获得路径(): 路径;
|
|
16
|
+
获得方法(): 方法;
|
|
17
|
+
获得插件们(): [...插件们];
|
|
18
|
+
获得正确结果类型(): 正确结果类型;
|
|
19
|
+
获得错误结果类型(): 错误结果类型;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { 接口类型 };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
3
|
+
import { 成功结果 as ____$1, 错误结果 as ____$2 } from '../result/result.js';
|
|
4
|
+
import { 接口类型 as ____ } from './interface-type.js';
|
|
5
|
+
import { 插件 as __, 合并插件结果 as ______ } from './plug.js';
|
|
6
|
+
import 'express';
|
|
7
|
+
import '../types/type-hold.js';
|
|
8
|
+
|
|
9
|
+
declare class 接口<路径 extends string, 方法 extends 'get' | 'post', 插件们 extends Array<__<z.AnyZodObject>>, 正确返回类型 extends z.ZodTypeAny, 错误返回类型 extends z.ZodTypeAny> {
|
|
10
|
+
private 接口类型;
|
|
11
|
+
private 实现;
|
|
12
|
+
constructor(接口类型: ____<路径, 方法, 插件们, 正确返回类型, 错误返回类型>, 实现: (插件结果: ______<插件们>) => Task<____$1<z.infer<正确返回类型>> | ____$2<z.infer<错误返回类型>>>);
|
|
13
|
+
获得类型(): typeof this.接口类型;
|
|
14
|
+
获得实现(): typeof this.实现;
|
|
15
|
+
}
|
|
16
|
+
type 任意接口 = 接口<any, any, any, any, any>;
|
|
17
|
+
|
|
18
|
+
export { type 任意接口, 接口 };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
4
|
+
import { 类型保持符号 as ______ } from '../types/type-hold.js';
|
|
5
|
+
|
|
6
|
+
declare class 插件<Obj extends z.AnyZodObject> {
|
|
7
|
+
private 类型;
|
|
8
|
+
private 实现;
|
|
9
|
+
[______]: Obj;
|
|
10
|
+
constructor(类型: Obj, 实现: (req: Request, res: Response) => Task<z.infer<Obj>>);
|
|
11
|
+
获得类型(): typeof this.类型;
|
|
12
|
+
获得实现(): typeof this.实现;
|
|
13
|
+
}
|
|
14
|
+
type 合并插件结果<Arr extends Array<插件<z.AnyZodObject>>> = Arr extends [] ? {} : Arr extends [infer x, ...infer xs] ? x extends 插件<infer obj> ? xs extends Array<插件<z.AnyZodObject>> ? z.infer<obj> & 合并插件结果<xs> : {} : {} : {};
|
|
15
|
+
|
|
16
|
+
export { type 合并插件结果, 插件 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { 插件 as __ } from '../interface/plug.js';
|
|
3
|
+
import 'express';
|
|
4
|
+
import '@lsby/ts-fp-data';
|
|
5
|
+
import '../types/type-hold.js';
|
|
6
|
+
|
|
7
|
+
declare const zod类型表示: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
8
|
+
declare class 中文路径支持插件 extends __<typeof zod类型表示> {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { 中文路径支持插件 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { 插件 as __ } from '../interface/plug.js';
|
|
3
|
+
import 'express';
|
|
4
|
+
import '@lsby/ts-fp-data';
|
|
5
|
+
import '../types/type-hold.js';
|
|
6
|
+
|
|
7
|
+
declare class 自定义数据插件<Data extends z.AnyZodObject> extends __<Data> {
|
|
8
|
+
constructor(t: Data, data: z.infer<Data>);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { 自定义数据插件 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { 插件 as __ } from '../interface/plug.js';
|
|
4
|
+
import '@lsby/ts-fp-data';
|
|
5
|
+
import '../types/type-hold.js';
|
|
6
|
+
|
|
7
|
+
declare class JSON解析插件<Result extends z.ZodObject<{
|
|
8
|
+
body: z.AnyZodObject;
|
|
9
|
+
}>> extends __<Result> {
|
|
10
|
+
private log;
|
|
11
|
+
constructor(t: Result, opt: Parameters<typeof express.json>[0]);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { JSON解析插件 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { 插件 as __ } from '../interface/plug.js';
|
|
4
|
+
import '@lsby/ts-fp-data';
|
|
5
|
+
import '../types/type-hold.js';
|
|
6
|
+
|
|
7
|
+
declare class 表单解析插件<Result extends z.ZodObject<{
|
|
8
|
+
body: z.AnyZodObject;
|
|
9
|
+
}>> extends __<Result> {
|
|
10
|
+
constructor(t: Result, opt: Parameters<typeof express.urlencoded>[0]);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { 表单解析插件 };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
3
|
+
import { 类型保持符号 as ______ } from '../types/type-hold.js';
|
|
4
|
+
|
|
5
|
+
declare abstract class 结果<T> {
|
|
6
|
+
[______]: T;
|
|
7
|
+
abstract run(req: Request, res: Response): Task<void>;
|
|
8
|
+
}
|
|
9
|
+
declare abstract class 成功结果<T> extends 结果<T> {
|
|
10
|
+
private 成功结果烙印;
|
|
11
|
+
}
|
|
12
|
+
declare class 成功JSON结果<Data extends Record<string, unknown>> extends 成功结果<Data> {
|
|
13
|
+
private data;
|
|
14
|
+
private log;
|
|
15
|
+
constructor(data: Data);
|
|
16
|
+
run(req: Request, res: Response): Task<void>;
|
|
17
|
+
}
|
|
18
|
+
declare class 成功自定义结果 extends 成功结果<unknown> {
|
|
19
|
+
private customHandler;
|
|
20
|
+
constructor(customHandler: (req: Request, res: Response) => Task<void>);
|
|
21
|
+
run(req: Request, res: Response): Task<void>;
|
|
22
|
+
}
|
|
23
|
+
declare abstract class 错误结果<T> extends 结果<T> {
|
|
24
|
+
private 错误结果烙印;
|
|
25
|
+
}
|
|
26
|
+
declare class 错误JSON结果<Data> extends 错误结果<Data> {
|
|
27
|
+
private data;
|
|
28
|
+
private log;
|
|
29
|
+
constructor(data: Data);
|
|
30
|
+
run(req: Request, res: Response): Task<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { 成功JSON结果, 成功结果, 成功自定义结果, 结果, 错误JSON结果, 错误结果 };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
成功JSON结果,
|
|
3
|
+
成功结果,
|
|
4
|
+
成功自定义结果,
|
|
5
|
+
结果,
|
|
6
|
+
错误JSON结果,
|
|
7
|
+
错误结果
|
|
8
|
+
} from "../chunk-THMF6WFQ.js";
|
|
9
|
+
import "../chunk-SJCC3KPB.js";
|
|
10
|
+
import "../chunk-MFQZP7FG.js";
|
|
11
|
+
import "../chunk-PLYBVQKK.js";
|
|
12
|
+
export {
|
|
13
|
+
\u6210\u529FJSON\u7ED3\u679C,
|
|
14
|
+
\u6210\u529F\u7ED3\u679C,
|
|
15
|
+
\u6210\u529F\u81EA\u5B9A\u4E49\u7ED3\u679C,
|
|
16
|
+
\u7ED3\u679C,
|
|
17
|
+
\u9519\u8BEFJSON\u7ED3\u679C,
|
|
18
|
+
\u9519\u8BEF\u7ED3\u679C
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as http from 'node:http';
|
|
2
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
3
|
+
import { 任意接口 as ____ } from '../interface/interface.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '../result/result.js';
|
|
6
|
+
import 'express';
|
|
7
|
+
import '../types/type-hold.js';
|
|
8
|
+
import '../interface/interface-type.js';
|
|
9
|
+
import '../interface/plug.js';
|
|
10
|
+
|
|
11
|
+
declare class 服务器 {
|
|
12
|
+
private 接口们;
|
|
13
|
+
private 端口;
|
|
14
|
+
private log;
|
|
15
|
+
constructor(接口们: ____[], 端口: number);
|
|
16
|
+
run(): Task<{
|
|
17
|
+
ip: string[];
|
|
18
|
+
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { 服务器 };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Task } from '@lsby/ts-fp-data';
|
|
2
|
+
|
|
3
|
+
declare class Log {
|
|
4
|
+
private fileName;
|
|
5
|
+
private debugObj;
|
|
6
|
+
private _info;
|
|
7
|
+
private _debug;
|
|
8
|
+
private _err;
|
|
9
|
+
constructor(fileName: string);
|
|
10
|
+
extend(name: string): Log;
|
|
11
|
+
info(formatter: unknown, ...args: unknown[]): Task<void>;
|
|
12
|
+
debug(formatter: unknown, ...args: unknown[]): Task<void>;
|
|
13
|
+
err(formatter: unknown, ...args: unknown[]): Task<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { Log };
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lsby/net-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
"require": "./dist/cjs/index.cjs",
|
|
7
|
+
"import": "./dist/esm/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@lsby/ts-fp-data": "^0.0.5",
|
|
14
|
+
"debug": "^4.3.5",
|
|
15
|
+
"express": "^4.19.2",
|
|
16
|
+
"zod": "^3.23.8"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
|
20
|
+
"@types/debug": "^4.1.12",
|
|
21
|
+
"@types/express": "^4.17.21",
|
|
22
|
+
"@types/node": "^20.12.10",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
24
|
+
"@typescript-eslint/parser": "^7.8.0",
|
|
25
|
+
"bumpp": "^9.4.1",
|
|
26
|
+
"eslint": "^8.56.0",
|
|
27
|
+
"eslint-config-prettier": "^9.1.0",
|
|
28
|
+
"eslint-plugin-sort-class-members": "^1.20.0",
|
|
29
|
+
"eslint-plugin-unused-imports": "^3.2.0",
|
|
30
|
+
"prettier": "3.2.5",
|
|
31
|
+
"prettier-plugin-packagejson": "^2.5.0",
|
|
32
|
+
"tsup": "^8.0.2",
|
|
33
|
+
"tsx": "^4.9.3",
|
|
34
|
+
"typescript": "^5.4.5"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build:all": "npm run build:cjs && npm run build:esm",
|
|
38
|
+
"build:cjs": "tsup src/**/*.ts --format cjs --clean --dts -d dist/cjs",
|
|
39
|
+
"build:esm": "tsup src/**/*.ts --format esm --clean --dts -d dist/esm",
|
|
40
|
+
"other:clean": "rm -rf dist",
|
|
41
|
+
"other:format": "prettier --write .",
|
|
42
|
+
"other:lint": "eslint . --fix",
|
|
43
|
+
"other:pub": "npm run other:typecheck && npm run build:all && bumpp && pnpm -r publish --access public",
|
|
44
|
+
"other:typecheck": "tsc --noEmit",
|
|
45
|
+
"other:typecheck:watch": "tsc --noEmit -w",
|
|
46
|
+
"run:start": "tsx src/index.ts"
|
|
47
|
+
}
|
|
48
|
+
}
|