@scefira/dfw 1.2.9 → 1.2.10
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
CHANGED
|
@@ -6,4 +6,6 @@ export { default as DFWCore } from './lib/DFWCore';
|
|
|
6
6
|
export { default as DFWUtils } from "./lib/DFWUtils";
|
|
7
7
|
export { default as DFWModule } from './lib/DFWModule';
|
|
8
8
|
export { default as DFWService } from './lib/DFWService';
|
|
9
|
+
export { UploadedFile } from "express-fileupload";
|
|
10
|
+
export { SavedFileParams } from "./modules/DFWFileModule";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAE3B,cAAc,mBAAmB,CAAA;AAEjC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAE3B,cAAc,mBAAmB,CAAA;AAEjC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import DFWModule from "../lib/DFWModule";
|
|
2
2
|
import { UploadedFile } from "express-fileupload";
|
|
3
|
-
|
|
3
|
+
import { DFW_FILE_STORAGE } from "@prisma/client";
|
|
4
|
+
export type SavedFileParams = {
|
|
4
5
|
name?: string;
|
|
5
6
|
variant?: string;
|
|
6
7
|
expire?: Date;
|
|
7
8
|
idParent?: string;
|
|
8
|
-
|
|
9
|
+
url?: string;
|
|
10
|
+
storage?: DFW_FILE_STORAGE;
|
|
9
11
|
};
|
|
10
12
|
declare class DFWFileModule extends DFWModule {
|
|
11
|
-
|
|
13
|
+
createFileRecordAsync: (file: UploadedFile, { name, url, storage, expire, idParent, variant }: SavedFileParams) => Promise<{
|
|
14
|
+
variant: string | null;
|
|
15
|
+
name: string | null;
|
|
16
|
+
id: string;
|
|
17
|
+
url: string | null;
|
|
18
|
+
metadata: import("@prisma/client/runtime/library").JsonValue | null;
|
|
19
|
+
path: string | null;
|
|
20
|
+
storage: import(".prisma/client").$Enums.DFW_FILE_STORAGE;
|
|
21
|
+
size: number | null;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
idUser: string | null;
|
|
25
|
+
checksum: string | null;
|
|
26
|
+
mimetype: string | null;
|
|
27
|
+
expire: Date | null;
|
|
28
|
+
idParent: string | null;
|
|
29
|
+
}>;
|
|
30
|
+
saveFileLocalAsync: (file: UploadedFile, params: SavedFileParams) => Promise<{
|
|
12
31
|
variant: string | null;
|
|
13
32
|
name: string | null;
|
|
14
33
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DFWFileModule.d.ts","sourceRoot":"","sources":["../../src/modules/DFWFileModule.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"DFWFileModule.d.ts","sourceRoot":"","sources":["../../src/modules/DFWFileModule.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,MAAM,eAAe,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,IAAI,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAED,cAAM,aAAc,SAAQ,SAAS;IAEjC,qBAAqB,GAAU,MAAM,YAAY,EAAE,mDAAmD,eAAe;;;;;;;;;;;;;;;;OAcpH;IAED,kBAAkB,GAAU,MAAM,YAAY,EAAE,QAAQ,eAAe;;;;;;;;;;;;;;;;OActE;IAED,oBAAoB,GAAI,SAAS,MAAM,YAEtC;CACJ;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const DFWModule_1 = __importDefault(require("../lib/DFWModule"));
|
|
16
16
|
const util_1 = require("util");
|
|
17
|
-
const client_1 = require("@prisma/client");
|
|
18
17
|
const luxon_1 = require("luxon");
|
|
19
18
|
const path_1 = __importDefault(require("path"));
|
|
20
19
|
const DFWUtils_1 = __importDefault(require("../lib/DFWUtils"));
|
|
@@ -23,30 +22,32 @@ const __1 = require("..");
|
|
|
23
22
|
class DFWFileModule extends DFWModule_1.default {
|
|
24
23
|
constructor() {
|
|
25
24
|
super(...arguments);
|
|
26
|
-
this.
|
|
27
|
-
const filePath = luxon_1.DateTime.now().toFormat("yyyy/MM");
|
|
28
|
-
const fileName = DFWUtils_1.default.uuid();
|
|
29
|
-
const ext = path_1.default.extname(file.name);
|
|
30
|
-
const localPath = `${__1.DFWCore.DFW_UPLOAD_DIR}/${filePath}`;
|
|
31
|
-
const localFilePath = `${localPath}/${fileName}${ext !== null && ext !== void 0 ? ext : ''}`;
|
|
32
|
-
const moveAsync = (0, util_1.promisify)(file.mv);
|
|
33
|
-
fs_1.default.mkdirSync(localPath, { recursive: true });
|
|
34
|
-
yield moveAsync(localFilePath);
|
|
25
|
+
this.createFileRecordAsync = (file_1, _a) => __awaiter(this, [file_1, _a], void 0, function* (file, { name, url, storage, expire, idParent, variant }) {
|
|
35
26
|
return this.db.dfw_file.create({
|
|
36
27
|
data: {
|
|
37
28
|
name: name !== null && name !== void 0 ? name : file.name,
|
|
38
29
|
size: file.size,
|
|
39
30
|
mimetype: file.mimetype,
|
|
40
31
|
checksum: file.md5,
|
|
41
|
-
url
|
|
42
|
-
|
|
43
|
-
storage: client_1.DFW_FILE_STORAGE.LOCAL,
|
|
32
|
+
url,
|
|
33
|
+
storage,
|
|
44
34
|
expire,
|
|
45
35
|
idParent,
|
|
46
36
|
variant
|
|
47
37
|
}
|
|
48
38
|
});
|
|
49
39
|
});
|
|
40
|
+
this.saveFileLocalAsync = (file, params) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const filePath = luxon_1.DateTime.now().toFormat("yyyy/MM");
|
|
42
|
+
const fileName = DFWUtils_1.default.uuid();
|
|
43
|
+
const ext = path_1.default.extname(file.name);
|
|
44
|
+
const localPath = `${__1.DFWCore.DFW_UPLOAD_DIR}/${filePath}`;
|
|
45
|
+
const localFilePath = `${localPath}/${fileName}${ext !== null && ext !== void 0 ? ext : ''}`;
|
|
46
|
+
const moveAsync = (0, util_1.promisify)(file.mv);
|
|
47
|
+
fs_1.default.mkdirSync(localPath, { recursive: true });
|
|
48
|
+
yield moveAsync(localFilePath);
|
|
49
|
+
return this.createFileRecordAsync(file, params);
|
|
50
|
+
});
|
|
50
51
|
this.generateTempFileName = (posfix) => {
|
|
51
52
|
return path_1.default.join(this.DFW.tmpDir, `${DFWUtils_1.default.uuid()}${posfix !== null && posfix !== void 0 ? posfix : ""}`);
|
|
52
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DFWFileModule.js","sourceRoot":"","sources":["../../src/modules/DFWFileModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAyC;AACzC,+BAAiC;
|
|
1
|
+
{"version":3,"file":"DFWFileModule.js","sourceRoot":"","sources":["../../src/modules/DFWFileModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAyC;AACzC,+BAAiC;AAGjC,iCAAiC;AACjC,gDAAwB;AACxB,+DAAuC;AACvC,4CAAoB;AACpB,0BAA6B;AAW7B,MAAM,aAAc,SAAQ,mBAAS;IAArC;;QAEI,0BAAqB,GAAG,aAA+F,EAAE,kDAA1F,IAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAmB;YACjH,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC3B,IAAI,EAAE;oBACF,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC,IAAI;oBACvB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,QAAQ,EAAE,IAAI,CAAC,GAAG;oBAClB,GAAG;oBACH,OAAO;oBACP,MAAM;oBACN,QAAQ;oBACR,OAAO;iBACV;aACJ,CAAC,CAAA;QACN,CAAC,CAAA,CAAA;QAED,uBAAkB,GAAG,CAAO,IAAkB,EAAE,MAAuB,EAAE,EAAE;YACvE,MAAM,QAAQ,GAAG,gBAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;YACnD,MAAM,QAAQ,GAAG,kBAAQ,CAAC,IAAI,EAAE,CAAA;YAChC,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACnC,MAAM,SAAS,GAAG,GAAG,WAAO,CAAC,cAAc,IAAI,QAAQ,EAAE,CAAA;YACzD,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,QAAQ,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,EAAE,CAAA;YAE5D,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEpC,YAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;YAE5C,MAAM,SAAS,CAAC,aAAa,CAAC,CAAA;YAE9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACnD,CAAC,CAAA,CAAA;QAED,yBAAoB,GAAG,CAAC,MAAe,EAAE,EAAE;YACvC,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,kBAAQ,CAAC,IAAI,EAAE,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,EAAE,CAAC,CAAC;QAC3E,CAAC,CAAA;IACL,CAAC;CAAA;AAED,kBAAe,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@scefira/dfw",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "NodeJS fast API prototiping framework",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist/**/*",
|
|
9
|
-
"prisma/**/*"
|
|
10
|
-
],
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"express": "^
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@types/
|
|
51
|
-
"@types/
|
|
52
|
-
"@types/
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@scefira/dfw",
|
|
3
|
+
"version": "1.2.10",
|
|
4
|
+
"description": "NodeJS fast API prototiping framework",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*",
|
|
9
|
+
"prisma/**/*"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "nodemon",
|
|
13
|
+
"dev:prisma": "dotenv -e .env.development -- npx prisma studio",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"sync": "npx prisma db push",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"author": "Scefira Technologies",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@prisma/client": "^6",
|
|
22
|
+
"zod": "^4"
|
|
23
|
+
},
|
|
24
|
+
"prisma": {
|
|
25
|
+
"schema": "./prisma/schema"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@paralleldrive/cuid2": "^2.2.2",
|
|
29
|
+
"@types/express": "^5.0.3",
|
|
30
|
+
"@types/express-fileupload": "^1.5.1",
|
|
31
|
+
"@types/express-session": "^1.18.2",
|
|
32
|
+
"@types/luxon": "^3",
|
|
33
|
+
"@types/passport": "^1.0.17",
|
|
34
|
+
"bcrypt": "^6.0.0",
|
|
35
|
+
"body-parser": "^2.2.0",
|
|
36
|
+
"chalk": "^4.1.2",
|
|
37
|
+
"cors": "^2.8.5",
|
|
38
|
+
"express": "^5.1.0",
|
|
39
|
+
"express-fileupload": "^1.5.2",
|
|
40
|
+
"express-session": "^1.18.2",
|
|
41
|
+
"lru.min": "^1.1.2",
|
|
42
|
+
"luxon": "^3",
|
|
43
|
+
"md5-file": "^5.0.0",
|
|
44
|
+
"mime-types": "^2.1.35",
|
|
45
|
+
"passport": "^0.7.0",
|
|
46
|
+
"passport-local": "^1.0.0",
|
|
47
|
+
"uuid": "^11.0.3"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/bcrypt": "^5.0.2",
|
|
51
|
+
"@types/body-parser": "^1.19.2",
|
|
52
|
+
"@types/busboy": "^1.3.0",
|
|
53
|
+
"@types/cookie-parser": "^1.4.2",
|
|
54
|
+
"@types/cors": "^2.8.17",
|
|
55
|
+
"@types/md5-file": "^5.0.0",
|
|
56
|
+
"@types/mime-types": "^2.1.1",
|
|
57
|
+
"@types/node": "^20.4.2",
|
|
58
|
+
"@types/passport-local": "^1.0.38",
|
|
59
|
+
"@types/uuid": "^8.3.4",
|
|
60
|
+
"cross-env": "^7.0.3",
|
|
61
|
+
"nodemon": "^3.1.4",
|
|
62
|
+
"prisma": "^6",
|
|
63
|
+
"ts-node": "^10.9.2",
|
|
64
|
+
"typescript": "^5.5.4"
|
|
65
|
+
}
|
|
65
66
|
}
|