@kanun-hq/plugin-file 0.1.6 → 0.1.7
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/index.d.ts +21 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,18 @@ import { ValidatorPlugin } from "kanun";
|
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
interface FileLike {
|
|
6
|
+
buffer?: ArrayBuffer | Buffer | Uint8Array;
|
|
7
|
+
filename?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
mimetype?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
originalname?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
size?: number;
|
|
14
|
+
type?: string;
|
|
15
|
+
width?: number;
|
|
16
|
+
}
|
|
5
17
|
interface FileRuleResolverArgs {
|
|
6
18
|
attribute: string;
|
|
7
19
|
context: Record<string, any>;
|
|
@@ -133,6 +145,15 @@ declare module 'kanun' {
|
|
|
133
145
|
mimes: 'paramable';
|
|
134
146
|
mimetypes: 'paramable';
|
|
135
147
|
}
|
|
148
|
+
interface ValidationRuleOutputTypeMap {
|
|
149
|
+
dimensions: FileLike;
|
|
150
|
+
extensions: FileLike;
|
|
151
|
+
file: FileLike;
|
|
152
|
+
files: FileLike[];
|
|
153
|
+
image: FileLike;
|
|
154
|
+
mimes: FileLike;
|
|
155
|
+
mimetypes: FileLike;
|
|
156
|
+
}
|
|
136
157
|
}
|
|
137
158
|
/**
|
|
138
159
|
* Create the validation rules for a wildcard attribute based on the given item and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanun-hq/plugin-file",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "File validation plugin for Kanun.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"image-size": "^2.0.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"kanun": "^1.0.
|
|
34
|
+
"kanun": "^1.0.10"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsdown",
|