exodus-framework 2.0.871 → 2.0.873
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/cache.d.ts +2 -0
- package/lib/app/classes/cache.d.ts.map +1 -1
- package/lib/app/classes/cache.js +12 -2
- 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 -1
- package/lib/utils/api.d.ts.map +1 -1
- package/lib/utils/api.js +2 -2
- package/lib/utils/session.d.ts +1 -1
- package/package.json +2 -1
@@ -6,6 +6,7 @@ export declare class Cache<T> extends System {
|
|
6
6
|
delete(_key: string): Promise<void>;
|
7
7
|
all(): Promise<T[]>;
|
8
8
|
clear(): Promise<void>;
|
9
|
+
has(_key: string): Promise<boolean>;
|
9
10
|
}
|
10
11
|
export declare class RedisCache<T> extends Cache<T> {
|
11
12
|
protected client: RedisClientType;
|
@@ -16,5 +17,6 @@ export declare class RedisCache<T> extends Cache<T> {
|
|
16
17
|
delete(key: string): Promise<void>;
|
17
18
|
all(): Promise<T[]>;
|
18
19
|
clear(): Promise<void>;
|
20
|
+
has(key: string): Promise<boolean>;
|
19
21
|
}
|
20
22
|
//# sourceMappingURL=cache.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/app/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,qBAAa,KAAK,CAAC,CAAC,CAAE,SAAQ,MAAM;IAC5B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAG7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAG1B,MAAM,CAAC,IAAI,EAAE,MAAM;IAGnB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC;IAGnB,KAAK;
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/app/classes/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,qBAAa,KAAK,CAAC,CAAC,CAAE,SAAQ,MAAM;IAC5B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAG7B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAG1B,MAAM,CAAC,IAAI,EAAE,MAAM;IAGnB,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC;IAGnB,KAAK;IAGL,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAG1C;AAED,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IAEvC,SAAS,CAAC,MAAM,EAAE,eAAe;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM;gBADX,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,MAAM;IAKjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAS5B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IASxB,MAAM,CAAC,GAAG,EAAE,MAAM;IAQlB,GAAG;IAcH,KAAK;IAWL,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAOzC"}
|
package/lib/app/classes/cache.js
CHANGED
@@ -23,6 +23,9 @@ class Cache extends _system.default {
|
|
23
23
|
async clear() {
|
24
24
|
throw new Error('Not implemented');
|
25
25
|
}
|
26
|
+
async has(_key) {
|
27
|
+
throw new Error('Not implemented');
|
28
|
+
}
|
26
29
|
}
|
27
30
|
exports.Cache = Cache;
|
28
31
|
class RedisCache extends Cache {
|
@@ -65,7 +68,7 @@ class RedisCache extends Cache {
|
|
65
68
|
}
|
66
69
|
return data;
|
67
70
|
} catch (error) {
|
68
|
-
new _error.ErrorHandler('Falha no
|
71
|
+
new _error.ErrorHandler('Falha no all do redis cache', error);
|
69
72
|
}
|
70
73
|
}
|
71
74
|
async clear() {
|
@@ -77,7 +80,14 @@ class RedisCache extends Cache {
|
|
77
80
|
await this.delete(k);
|
78
81
|
}
|
79
82
|
} catch (error) {
|
80
|
-
new _error.ErrorHandler('Falha no
|
83
|
+
new _error.ErrorHandler('Falha no clear do redis cache', error);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
async has(key) {
|
87
|
+
try {
|
88
|
+
return !this.get(key);
|
89
|
+
} catch (error) {
|
90
|
+
new _error.ErrorHandler('Falha no has do redis cache', error);
|
81
91
|
}
|
82
92
|
}
|
83
93
|
}
|
@@ -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
@@ -7,7 +7,7 @@ declare abstract class Api {
|
|
7
7
|
constructor();
|
8
8
|
init(): Promise<void>;
|
9
9
|
abstract validateStatus(status: number): boolean;
|
10
|
-
request<T>(endpoint: string, method: Method, data?: any, params?: any, headers?: AxiosHeaders): Promise<IApiResponse<T>>;
|
10
|
+
request<T>(endpoint: string, method: Method, data?: any, params?: any, headers?: AxiosHeaders, direct?: boolean): Promise<IApiResponse<T> | import("axios").AxiosResponse<IApiResponse<T>, any>>;
|
11
11
|
protected getLogicalSecurityId(): string;
|
12
12
|
}
|
13
13
|
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;
|
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,EACtB,MAAM,CAAC,EAAE,OAAO;IAgBlB,SAAS,CAAC,oBAAoB;CAI/B;AAED,eAAe,GAAG,CAAC"}
|
package/lib/utils/api.js
CHANGED
@@ -23,7 +23,7 @@ class Api {
|
|
23
23
|
validateStatus: this.validateStatus
|
24
24
|
});
|
25
25
|
}
|
26
|
-
async request(endpoint, method, data, params, headers) {
|
26
|
+
async request(endpoint, method, data, params, headers, direct) {
|
27
27
|
try {
|
28
28
|
const res = await this.axios({
|
29
29
|
method,
|
@@ -35,7 +35,7 @@ class Api {
|
|
35
35
|
...this.headers
|
36
36
|
}
|
37
37
|
});
|
38
|
-
return res.data;
|
38
|
+
return direct ? res : res.data;
|
39
39
|
} catch (error) {
|
40
40
|
new _app.ErrorHandler('não foi possível realizar uma requisição', error);
|
41
41
|
}
|
package/lib/utils/session.d.ts
CHANGED
@@ -6,6 +6,6 @@ export declare class SessionAPI extends Api {
|
|
6
6
|
'X-Exodus-Core-Version': string;
|
7
7
|
};
|
8
8
|
validateStatus(status: number): boolean;
|
9
|
-
getCertificate(): Promise<import("..").IApiResponse<string>>;
|
9
|
+
getCertificate(): Promise<import("..").IApiResponse<string> | import("axios").AxiosResponse<import("..").IApiResponse<string>, any>>;
|
10
10
|
}
|
11
11
|
//# sourceMappingURL=session.d.ts.map
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "exodus-framework",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.873",
|
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",
|