@lsby/net-core-file-upload 0.3.0 → 0.5.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/dist/cjs/index.cjs +6 -4
- package/dist/cjs/index.d.cts +3 -2
- package/dist/esm/index.d.ts +3 -2
- package/dist/esm/index.js +6 -4
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -36,7 +36,9 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
var import_express_fileupload = __toESM(require("express-fileupload"), 1);
|
|
37
37
|
var import_zod = require("zod");
|
|
38
38
|
var import_net_core = require("@lsby/net-core");
|
|
39
|
-
var
|
|
39
|
+
var import_ts_fp_data = require("@lsby/ts-fp-data");
|
|
40
|
+
var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.never();
|
|
41
|
+
var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = import_zod.z.object({
|
|
40
42
|
files: import_zod.z.object({
|
|
41
43
|
name: import_zod.z.string(),
|
|
42
44
|
encoding: import_zod.z.string(),
|
|
@@ -52,7 +54,7 @@ var \u7C7B\u578B\u63CF\u8FF0 = import_zod.z.object({
|
|
|
52
54
|
});
|
|
53
55
|
var \u6587\u4EF6\u4E0A\u4F20\u63D2\u4EF6 = class extends import_net_core.\u63D2\u4EF6 {
|
|
54
56
|
constructor(opt) {
|
|
55
|
-
super(\u7C7B\u578B\u63CF\u8FF0, async (req, res) => {
|
|
57
|
+
super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, res) => {
|
|
56
58
|
await new Promise(
|
|
57
59
|
(resP, _rej) => (0, import_express_fileupload.default)({ limits: { fileSize: opt.\u6587\u4EF6\u6700\u5927\u5927\u5C0F } })(req, res, () => {
|
|
58
60
|
resP(null);
|
|
@@ -65,10 +67,10 @@ var \u6587\u4EF6\u4E0A\u4F20\u63D2\u4EF6 = class extends import_net_core.\u63D2\
|
|
|
65
67
|
filePayload = temp;
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
return {
|
|
70
|
+
return new import_ts_fp_data.Right({
|
|
69
71
|
files: Object.values(req.files),
|
|
70
72
|
filePayload
|
|
71
|
-
};
|
|
73
|
+
});
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
};
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { 插件 as __ } from '@lsby/net-core';
|
|
3
3
|
|
|
4
|
-
declare var
|
|
4
|
+
declare var 错误类型描述: z.ZodNever;
|
|
5
|
+
declare var 正确类型描述: z.ZodObject<{
|
|
5
6
|
files: z.ZodArray<z.ZodObject<{
|
|
6
7
|
name: z.ZodString;
|
|
7
8
|
encoding: z.ZodString;
|
|
@@ -61,7 +62,7 @@ declare var 类型描述: z.ZodObject<{
|
|
|
61
62
|
}[];
|
|
62
63
|
filePayload?: string | undefined;
|
|
63
64
|
}>;
|
|
64
|
-
declare class 文件上传插件 extends __<typeof
|
|
65
|
+
declare class 文件上传插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
|
|
65
66
|
constructor(opt: {
|
|
66
67
|
文件最大大小: number;
|
|
67
68
|
});
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { 插件 as __ } from '@lsby/net-core';
|
|
3
3
|
|
|
4
|
-
declare var
|
|
4
|
+
declare var 错误类型描述: z.ZodNever;
|
|
5
|
+
declare var 正确类型描述: z.ZodObject<{
|
|
5
6
|
files: z.ZodArray<z.ZodObject<{
|
|
6
7
|
name: z.ZodString;
|
|
7
8
|
encoding: z.ZodString;
|
|
@@ -61,7 +62,7 @@ declare var 类型描述: z.ZodObject<{
|
|
|
61
62
|
}[];
|
|
62
63
|
filePayload?: string | undefined;
|
|
63
64
|
}>;
|
|
64
|
-
declare class 文件上传插件 extends __<typeof
|
|
65
|
+
declare class 文件上传插件 extends __<typeof 错误类型描述, typeof 正确类型描述> {
|
|
65
66
|
constructor(opt: {
|
|
66
67
|
文件最大大小: number;
|
|
67
68
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import fileUpload from "express-fileupload";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { \u63D2\u4EF6 } from "@lsby/net-core";
|
|
5
|
-
|
|
5
|
+
import { Right } from "@lsby/ts-fp-data";
|
|
6
|
+
var \u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0 = z.never();
|
|
7
|
+
var \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0 = z.object({
|
|
6
8
|
files: z.object({
|
|
7
9
|
name: z.string(),
|
|
8
10
|
encoding: z.string(),
|
|
@@ -18,7 +20,7 @@ var \u7C7B\u578B\u63CF\u8FF0 = z.object({
|
|
|
18
20
|
});
|
|
19
21
|
var \u6587\u4EF6\u4E0A\u4F20\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
|
|
20
22
|
constructor(opt) {
|
|
21
|
-
super(\u7C7B\u578B\u63CF\u8FF0, async (req, res) => {
|
|
23
|
+
super(\u9519\u8BEF\u7C7B\u578B\u63CF\u8FF0, \u6B63\u786E\u7C7B\u578B\u63CF\u8FF0, async (req, res) => {
|
|
22
24
|
await new Promise(
|
|
23
25
|
(resP, _rej) => fileUpload({ limits: { fileSize: opt.\u6587\u4EF6\u6700\u5927\u5927\u5C0F } })(req, res, () => {
|
|
24
26
|
resP(null);
|
|
@@ -31,10 +33,10 @@ var \u6587\u4EF6\u4E0A\u4F20\u63D2\u4EF6 = class extends \u63D2\u4EF6 {
|
|
|
31
33
|
filePayload = temp;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
return {
|
|
36
|
+
return new Right({
|
|
35
37
|
files: Object.values(req.files),
|
|
36
38
|
filePayload
|
|
37
|
-
};
|
|
39
|
+
});
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsby/net-core-file-upload",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"require": "./dist/cjs/index.cjs",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"test:coverage": "npm run check:all && vitest run --coverage && open-cli ./coverage/index.html"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lsby/ts-log": "^0.3.
|
|
27
|
-
"express-fileupload": "^1.5.
|
|
26
|
+
"@lsby/ts-log": "^0.3.1",
|
|
27
|
+
"express-fileupload": "^1.5.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"vitest": "^2.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@lsby/net-core": "^0.
|
|
44
|
+
"@lsby/net-core": "^0.13.0",
|
|
45
45
|
"@lsby/ts-fp-data": "^0.2.5",
|
|
46
46
|
"zod": "3.24.2"
|
|
47
47
|
},
|