exodus-framework 2.0.872 → 2.0.874
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/lib/app/classes/socket/index.d.ts.map +1 -1
- package/lib/contracts/communication/communication.d.ts +17 -0
- package/lib/contracts/communication/communication.d.ts.map +1 -0
- package/lib/contracts/communication/communication.js +14 -0
- package/lib/services/file_new.d.ts +1 -0
- package/lib/services/file_new.d.ts.map +1 -0
- package/lib/services/file_new.js +136 -0
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.d.ts.map +1 -1
- package/lib/utils/api.js +17 -0
- package/package.json +2 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/classes/socket/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/app/classes/socket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
declare class Conversation {
|
2
|
+
protected id: string;
|
3
|
+
protected title: string;
|
4
|
+
protected metadata: Metadata;
|
5
|
+
protected messages: Message[];
|
6
|
+
protected participants: Contact[];
|
7
|
+
protected channel: Channel;
|
8
|
+
}
|
9
|
+
declare class Metadata {
|
10
|
+
}
|
11
|
+
declare class Contact {
|
12
|
+
}
|
13
|
+
declare class Message {
|
14
|
+
}
|
15
|
+
declare class Channel {
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=communication.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../../../src/contracts/communication/communication.ts"],"names":[],"mappings":"AAAA,cAAM,YAAY;IAChB,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC9B,SAAS,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;IAElC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;CAC5B;AAED,cAAM,QAAQ;CAAG;AAEjB,cAAM,OAAO;CAAG;AAEhB,cAAM,OAAO;CAAG;AAEhB,cAAM,OAAO;CAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=file_new.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file_new.d.ts","sourceRoot":"","sources":["../../src/services/file_new.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
// import { createHash } from 'crypto';
|
2
|
+
// import * as fs from 'fs';
|
3
|
+
// import * as fsPromisses from 'fs/promises';
|
4
|
+
// import NodeCache from 'node-cache';
|
5
|
+
// import { Core, ErrorHandler } from '../app';
|
6
|
+
// import Service from '../app/classes/service';
|
7
|
+
// import { TFilePathSettings } from '../contracts/settings';
|
8
|
+
// import logger from '../utils/logger';
|
9
|
+
|
10
|
+
// class FileService extends Service {
|
11
|
+
// protected cache: NodeCache;
|
12
|
+
|
13
|
+
// async onServiceInit() {
|
14
|
+
// this.cache = new NodeCache();
|
15
|
+
// await Promise.all([this.checkPaths(), this.cleanTemp()]);
|
16
|
+
// }
|
17
|
+
|
18
|
+
// //# Managment
|
19
|
+
// async save(filename: string, destiny: keyof TFilePathSettings) {
|
20
|
+
// const p = Core.settings.getAppication().filePaths.temporary + '/' + filename;
|
21
|
+
// const d = Core.settings.getAppication().filePaths[destiny] + '/' + filename;
|
22
|
+
|
23
|
+
// try {
|
24
|
+
// const md5 = await this.getMD5FromFile(p);
|
25
|
+
|
26
|
+
// if (this.cache.has(md5)) {
|
27
|
+
// return true;
|
28
|
+
// }
|
29
|
+
|
30
|
+
// await this.move(p, d);
|
31
|
+
// this.cache.set(md5, d);
|
32
|
+
|
33
|
+
// return true;
|
34
|
+
// } catch (error) {
|
35
|
+
// new ErrorHandler('Não foi possível salva o arquivo', error);
|
36
|
+
// return false;
|
37
|
+
// }
|
38
|
+
// }
|
39
|
+
// async delete(filename: string, destiny: keyof TFilePathSettings) {
|
40
|
+
// const d = Core.settings.getAppication().filePaths[destiny] + '/' + filename;
|
41
|
+
// return await fsPromisses
|
42
|
+
// .unlink(d)
|
43
|
+
// .then(() => true)
|
44
|
+
// .catch((e) => {
|
45
|
+
// logger().error({ filename, destiny, erro: e }, 'Não foi possível deletar o arquivo');
|
46
|
+
// return false;
|
47
|
+
// });
|
48
|
+
// }
|
49
|
+
// async move(to: string, from: string) {
|
50
|
+
// return await fsPromisses
|
51
|
+
// .rename(to, from)
|
52
|
+
// .then((d) => d)
|
53
|
+
// .catch((e) => {
|
54
|
+
// logger().error({ to, from, erro: e }, 'Não foi possível mover o arquivo');
|
55
|
+
// return false;
|
56
|
+
// });
|
57
|
+
// }
|
58
|
+
|
59
|
+
// //# Getters
|
60
|
+
// public getBuffer(filename: string, destiny: keyof TFilePathSettings) {
|
61
|
+
// const d = Core.settings.getAppication().filePaths[destiny] + '/' + filename;
|
62
|
+
|
63
|
+
// return new Promise((resolve, reject) => {
|
64
|
+
// this.getMD5FromFile(d).then();
|
65
|
+
|
66
|
+
// fsPromisses
|
67
|
+
// .readFile(path)
|
68
|
+
// .then(cb)
|
69
|
+
// .catch((e) => {
|
70
|
+
// logger.error({ path, erro: e }, 'Não foi possível ler o arquivo', path);
|
71
|
+
// });
|
72
|
+
// });
|
73
|
+
// }
|
74
|
+
// /* public getStatByMD5(filename: string, destiny: keyof TFilePathSettings) {
|
75
|
+
// const p = this.getPathByMD5(md5);
|
76
|
+
// if (!p) return;
|
77
|
+
// return fs.statSync(p);
|
78
|
+
// } */
|
79
|
+
|
80
|
+
// //# Utils
|
81
|
+
// private async checkPaths() {
|
82
|
+
// for (const path of Object.values(Core.settings.getAppication().filePaths)) {
|
83
|
+
// !fs.existsSync(path) && fs.mkdirSync(path, { recursive: true });
|
84
|
+
// }
|
85
|
+
// }
|
86
|
+
// private async cleanTemp() {
|
87
|
+
// this.listFiles('temporary', (files) => {
|
88
|
+
// for (const file of files) {
|
89
|
+
// const p = Core.settings.getAppication().filePaths.temporary + '/' + file;
|
90
|
+
// fs.rmSync(p, { recursive: true });
|
91
|
+
// }
|
92
|
+
// });
|
93
|
+
// }
|
94
|
+
// public listFiles(origin: keyof TFilePathSettings, cb: (file: string[]) => void) {
|
95
|
+
// const p = Core.settings.getAppication().filePaths[origin];
|
96
|
+
// fs.readdir(p, (_, file) => cb(file));
|
97
|
+
// }
|
98
|
+
|
99
|
+
// //# MD5
|
100
|
+
// public getMD5FromFile(filePath: string) {
|
101
|
+
// return new Promise<string>((resolve, reject) => {
|
102
|
+
// const hash = createHash('md5');
|
103
|
+
// const stream = fs.createReadStream(filePath);
|
104
|
+
|
105
|
+
// stream.on('data', (dados) => hash.update(dados));
|
106
|
+
// stream.on('error', (error) => reject(error));
|
107
|
+
// stream.on('end', () => resolve(hash.digest('hex')));
|
108
|
+
// });
|
109
|
+
// }
|
110
|
+
// public getMD5FromBuffer(buffer: Buffer) {
|
111
|
+
// const hash = createHash('md5');
|
112
|
+
// hash.update(buffer);
|
113
|
+
// return hash.digest('hex');
|
114
|
+
// }
|
115
|
+
|
116
|
+
// //# Cache
|
117
|
+
// public loadCache() {}
|
118
|
+
// public async hasCached(filePath: string) {
|
119
|
+
// const md5 = await this.getMD5FromFile(filePath);
|
120
|
+
|
121
|
+
// return this.cache.has(md5);
|
122
|
+
// }
|
123
|
+
// //!imcomplete
|
124
|
+
// /* public async loadItem(filename: string, origin: keyof TFilePathSettings) {
|
125
|
+
// try {
|
126
|
+
// const p = Core.settings.getAppication().filePaths[origin] + '/' + filename;
|
127
|
+
// const md5 = await this.getMD5FromFile(p);
|
128
|
+
|
129
|
+
// return md5;
|
130
|
+
// } catch (error) {
|
131
|
+
// return;
|
132
|
+
// }
|
133
|
+
// } */
|
134
|
+
// }
|
135
|
+
// export default FileService;
|
136
|
+
"use strict";
|
package/lib/utils/api.d.ts
CHANGED
@@ -8,6 +8,7 @@ declare abstract class Api {
|
|
8
8
|
init(): Promise<void>;
|
9
9
|
abstract validateStatus(status: number): boolean;
|
10
10
|
request<T>(endpoint: string, method: Method, data?: any, params?: any, headers?: AxiosHeaders): Promise<IApiResponse<T>>;
|
11
|
+
requestDirect<T>(endpoint: string, method: Method, data?: any, params?: any, headers?: AxiosHeaders): Promise<import("axios").AxiosResponse<IApiResponse<T>, any>>;
|
11
12
|
protected getLogicalSecurityId(): string;
|
12
13
|
}
|
13
14
|
export default Api;
|
package/lib/utils/api.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,uBAAe,GAAG;IAChB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;;IAMhC,IAAI;IAWV,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAE1C,OAAO,CAAC,CAAC,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,YAAY;IAgBxB,SAAS,CAAC,oBAAoB;CAI/B;AAED,eAAe,GAAG,CAAC"}
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,uBAAe,GAAG;IAChB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;;IAMhC,IAAI;IAWV,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAE1C,OAAO,CAAC,CAAC,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,YAAY;IAgBlB,aAAa,CAAC,CAAC,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,GAAG,EACV,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,YAAY;IAgBxB,SAAS,CAAC,oBAAoB;CAI/B;AAED,eAAe,GAAG,CAAC"}
|
package/lib/utils/api.js
CHANGED
@@ -40,6 +40,23 @@ class Api {
|
|
40
40
|
new _app.ErrorHandler('não foi possível realizar uma requisição', error);
|
41
41
|
}
|
42
42
|
}
|
43
|
+
async requestDirect(endpoint, method, data, params, headers) {
|
44
|
+
try {
|
45
|
+
const res = await this.axios({
|
46
|
+
method,
|
47
|
+
url: this.host + endpoint,
|
48
|
+
data,
|
49
|
+
params,
|
50
|
+
headers: {
|
51
|
+
...headers,
|
52
|
+
...this.headers
|
53
|
+
}
|
54
|
+
});
|
55
|
+
return res;
|
56
|
+
} catch (error) {
|
57
|
+
new _app.ErrorHandler('não foi possível realizar uma requisição', error);
|
58
|
+
}
|
59
|
+
}
|
43
60
|
getLogicalSecurityId() {
|
44
61
|
const date = (0, _dateFns.format)(new Date(), 'yyyy-MM-dd');
|
45
62
|
return String(Date.parse(date) - 5000);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "exodus-framework",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.874",
|
4
4
|
"description": "Exodus Framework",
|
5
5
|
"author": "jhownpaixao",
|
6
6
|
"license": "ISC",
|
@@ -41,6 +41,7 @@
|
|
41
41
|
"mariadb": "^3.3.1",
|
42
42
|
"multer": "^1.4.5-lts.1",
|
43
43
|
"mysql2": "^3.11.0",
|
44
|
+
"node-cache": "^5.1.2",
|
44
45
|
"node-jose": "^2.2.0",
|
45
46
|
"node-schedule": "^2.1.1",
|
46
47
|
"pino": "^9.3.2",
|