@scefira/dfw 0.1.15 → 0.2.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.
Files changed (42) hide show
  1. package/lib/DFWInstance.d.ts +20 -20
  2. package/lib/DFWInstance.js +55 -55
  3. package/lib/DFWUtils.d.ts +27 -27
  4. package/lib/DFWUtils.js +63 -63
  5. package/lib/DFWUtils.js.map +1 -1
  6. package/lib/index.d.ts +10 -10
  7. package/lib/index.js +25 -25
  8. package/lib/manager/APIManager.d.ts +47 -47
  9. package/lib/manager/APIManager.d.ts.map +1 -1
  10. package/lib/manager/APIManager.js +207 -233
  11. package/lib/manager/APIManager.js.map +1 -1
  12. package/lib/manager/DFWModule.d.ts +13 -13
  13. package/lib/manager/DFWModule.js +19 -19
  14. package/lib/manager/DatabaseManager.d.ts +8 -8
  15. package/lib/manager/DatabaseManager.js +24 -24
  16. package/lib/manager/FileManager.d.ts +130 -130
  17. package/lib/manager/FileManager.js +254 -254
  18. package/lib/manager/SecurityManager.d.ts +50 -50
  19. package/lib/manager/SecurityManager.d.ts.map +1 -1
  20. package/lib/manager/SecurityManager.js +187 -191
  21. package/lib/manager/SecurityManager.js.map +1 -1
  22. package/lib/manager/SessionManager.d.ts +40 -40
  23. package/lib/manager/SessionManager.d.ts.map +1 -1
  24. package/lib/manager/SessionManager.js +194 -173
  25. package/lib/manager/SessionManager.js.map +1 -1
  26. package/lib/manager/UserManager.d.ts +42 -42
  27. package/lib/manager/UserManager.js +62 -62
  28. package/lib/test.d.ts +1 -1
  29. package/lib/test.js +70 -70
  30. package/lib/test.js.map +1 -1
  31. package/lib/types/APIListenerConfig.d.ts +52 -52
  32. package/lib/types/APIListenerConfig.js +2 -2
  33. package/lib/types/DFWBoot.d.ts +18 -18
  34. package/lib/types/DFWBoot.d.ts.map +1 -1
  35. package/lib/types/DFWBoot.js +2 -2
  36. package/lib/types/DFWConfig.d.ts +54 -54
  37. package/lib/types/DFWConfig.js +2 -2
  38. package/lib/types/DFWRequestScheme.d.ts +33 -37
  39. package/lib/types/DFWRequestScheme.d.ts.map +1 -1
  40. package/lib/types/DFWRequestScheme.js +2 -2
  41. package/package.json +4 -3
  42. package/prisma/schema.prisma +5 -27
@@ -1,131 +1,131 @@
1
- import DFWInstance from "../DFWInstance";
2
- import { DFWRequest } from "../types/DFWRequestScheme";
3
- import DFWModule from "./DFWModule";
4
- import { Response } from "express";
5
- import { dfw_file, dfw_user } from "@prisma/client";
6
- type FileConfig = {
7
- protected?: boolean | any[];
8
- expiration?: Date;
9
- ext?: string;
10
- slug?: string;
11
- description?: string;
12
- user?: dfw_user | number | null;
13
- parent?: number | dfw_file;
14
- variant?: string;
15
- replaceVariants?: boolean;
16
- };
17
- export type UploadConfig = {
18
- headers?: any;
19
- highWaterMark?: number;
20
- fileHwm?: number;
21
- defCharset?: string;
22
- preservePath?: boolean;
23
- limits?: {
24
- fieldNameSize?: number;
25
- fieldSize?: number;
26
- fields?: number;
27
- fileSize?: number;
28
- files?: number;
29
- parts?: number;
30
- headerPairs?: number;
31
- };
32
- };
33
- export default class FileManager extends DFWModule {
34
- readonly LOCAL_PUBLIC_UPLOAD_DIR = ".dfw/upload/public";
35
- readonly LOCAL_PROTECTED_UPLOAD_DIR = ".dfw/upload/protected";
36
- readonly tmpDir: string;
37
- private publicStaticFilesPath;
38
- get PUBLIC_STATIC_FILES_PATH(): string;
39
- constructor(DFW: DFWInstance);
40
- middleware: (req: DFWRequest, res: Response) => Promise<void>;
41
- /**
42
- * Takes a local tmp file and move to the files on DFW folder and save db record
43
- */
44
- assignLocalFileAsync(filePath: string, cfg: FileConfig, moveLocalFile?: boolean): Promise<import("@prisma/client/runtime/library").GetResult<{
45
- id: number;
46
- path: string;
47
- description: string | null;
48
- idUser: number | null;
49
- variant: string | null;
50
- size: number | null;
51
- checksum: string | null;
52
- slug: string | null;
53
- mimetype: string | null;
54
- expire: Date | null;
55
- idParent: number | null;
56
- createdAt: Date;
57
- updatedAt: Date;
58
- }, unknown, never> & {}>;
59
- /**
60
- *
61
- * @param bodyFileName
62
- * @param cfg
63
- */
64
- flushUpload(req: DFWRequest, file: string, cfg?: FileConfig): Promise<(import("@prisma/client/runtime/library").GetResult<{
65
- id: number;
66
- path: string;
67
- description: string | null;
68
- idUser: number | null;
69
- variant: string | null;
70
- size: number | null;
71
- checksum: string | null;
72
- slug: string | null;
73
- mimetype: string | null;
74
- expire: Date | null;
75
- idParent: number | null;
76
- createdAt: Date;
77
- updatedAt: Date;
78
- }, unknown, never> & {}) | Promise<import("@prisma/client/runtime/library").GetResult<{
79
- id: number;
80
- path: string;
81
- description: string | null;
82
- idUser: number | null;
83
- variant: string | null;
84
- size: number | null;
85
- checksum: string | null;
86
- slug: string | null;
87
- mimetype: string | null;
88
- expire: Date | null;
89
- idParent: number | null;
90
- createdAt: Date;
91
- updatedAt: Date;
92
- }, unknown, never> & {}>[]>;
93
- /**
94
- *
95
- * @param posfix
96
- * @returns
97
- */
98
- generateTempFileName(posfix?: string): string;
99
- /**
100
- * Get an array of all childrens of the file in the tree (including 2 levels of nested files)
101
- * @param file
102
- */
103
- getChildrenFileIdsAsync(file: number | {
104
- id: number;
105
- }): Promise<number[]>;
106
- /**
107
- *
108
- * @param file
109
- */
110
- removeFileAsync(file: number | dfw_file): Promise<(import("@prisma/client/runtime/library").GetResult<{
111
- id: number;
112
- path: string;
113
- description: string | null;
114
- idUser: number | null;
115
- variant: string | null;
116
- size: number | null;
117
- checksum: string | null;
118
- slug: string | null;
119
- mimetype: string | null;
120
- expire: Date | null;
121
- idParent: number | null;
122
- createdAt: Date;
123
- updatedAt: Date;
124
- }, unknown, never> & {})[]>;
125
- /**
126
- *
127
- */
128
- sweepExpiredFilesAsync(): Promise<void>;
129
- }
130
- export {};
1
+ import DFWInstance from "../DFWInstance";
2
+ import { DFWRequest } from "../types/DFWRequestScheme";
3
+ import DFWModule from "./DFWModule";
4
+ import { Response } from "express";
5
+ import { dfw_file, dfw_user } from "@prisma/client";
6
+ type FileConfig = {
7
+ protected?: boolean | any[];
8
+ expiration?: Date;
9
+ ext?: string;
10
+ slug?: string;
11
+ description?: string;
12
+ user?: dfw_user | number | null;
13
+ parent?: number | dfw_file;
14
+ variant?: string;
15
+ replaceVariants?: boolean;
16
+ };
17
+ export type UploadConfig = {
18
+ headers?: any;
19
+ highWaterMark?: number;
20
+ fileHwm?: number;
21
+ defCharset?: string;
22
+ preservePath?: boolean;
23
+ limits?: {
24
+ fieldNameSize?: number;
25
+ fieldSize?: number;
26
+ fields?: number;
27
+ fileSize?: number;
28
+ files?: number;
29
+ parts?: number;
30
+ headerPairs?: number;
31
+ };
32
+ };
33
+ export default class FileManager extends DFWModule {
34
+ readonly LOCAL_PUBLIC_UPLOAD_DIR = ".dfw/upload/public";
35
+ readonly LOCAL_PROTECTED_UPLOAD_DIR = ".dfw/upload/protected";
36
+ readonly tmpDir: string;
37
+ private publicStaticFilesPath;
38
+ get PUBLIC_STATIC_FILES_PATH(): string;
39
+ constructor(DFW: DFWInstance);
40
+ middleware: (req: DFWRequest, res: Response) => Promise<void>;
41
+ /**
42
+ * Takes a local tmp file and move to the files on DFW folder and save db record
43
+ */
44
+ assignLocalFileAsync(filePath: string, cfg: FileConfig, moveLocalFile?: boolean): Promise<import("@prisma/client/runtime/library").GetResult<{
45
+ id: number;
46
+ path: string;
47
+ description: string | null;
48
+ idUser: number | null;
49
+ variant: string | null;
50
+ size: number | null;
51
+ checksum: string | null;
52
+ slug: string | null;
53
+ mimetype: string | null;
54
+ expire: Date | null;
55
+ idParent: number | null;
56
+ createdAt: Date;
57
+ updatedAt: Date;
58
+ }, unknown> & {}>;
59
+ /**
60
+ *
61
+ * @param bodyFileName
62
+ * @param cfg
63
+ */
64
+ flushUpload(req: DFWRequest, file: string, cfg?: FileConfig): Promise<(import("@prisma/client/runtime/library").GetResult<{
65
+ id: number;
66
+ path: string;
67
+ description: string | null;
68
+ idUser: number | null;
69
+ variant: string | null;
70
+ size: number | null;
71
+ checksum: string | null;
72
+ slug: string | null;
73
+ mimetype: string | null;
74
+ expire: Date | null;
75
+ idParent: number | null;
76
+ createdAt: Date;
77
+ updatedAt: Date;
78
+ }, unknown> & {}) | Promise<import("@prisma/client/runtime/library").GetResult<{
79
+ id: number;
80
+ path: string;
81
+ description: string | null;
82
+ idUser: number | null;
83
+ variant: string | null;
84
+ size: number | null;
85
+ checksum: string | null;
86
+ slug: string | null;
87
+ mimetype: string | null;
88
+ expire: Date | null;
89
+ idParent: number | null;
90
+ createdAt: Date;
91
+ updatedAt: Date;
92
+ }, unknown> & {}>[]>;
93
+ /**
94
+ *
95
+ * @param posfix
96
+ * @returns
97
+ */
98
+ generateTempFileName(posfix?: string): string;
99
+ /**
100
+ * Get an array of all childrens of the file in the tree (including 2 levels of nested files)
101
+ * @param file
102
+ */
103
+ getChildrenFileIdsAsync(file: number | {
104
+ id: number;
105
+ }): Promise<number[]>;
106
+ /**
107
+ *
108
+ * @param file
109
+ */
110
+ removeFileAsync(file: number | dfw_file): Promise<(import("@prisma/client/runtime/library").GetResult<{
111
+ id: number;
112
+ path: string;
113
+ description: string | null;
114
+ idUser: number | null;
115
+ variant: string | null;
116
+ size: number | null;
117
+ checksum: string | null;
118
+ slug: string | null;
119
+ mimetype: string | null;
120
+ expire: Date | null;
121
+ idParent: number | null;
122
+ createdAt: Date;
123
+ updatedAt: Date;
124
+ }, unknown> & {})[]>;
125
+ /**
126
+ *
127
+ */
128
+ sweepExpiredFilesAsync(): Promise<void>;
129
+ }
130
+ export {};
131
131
  //# sourceMappingURL=FileManager.d.ts.map