exodus-framework 2.0.697 → 2.0.699
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/settings.d.ts.map +1 -1
- package/lib/contracts/messaging.d.ts +28 -1
- package/lib/contracts/messaging.d.ts.map +1 -1
- package/lib/contracts/security.d.ts +11 -0
- package/lib/contracts/security.d.ts.map +1 -0
- package/lib/contracts/settings.d.ts +6 -0
- package/lib/contracts/settings.d.ts.map +1 -1
- package/lib/controllers/messaging/database.d.ts +9 -0
- package/lib/controllers/messaging/database.d.ts.map +1 -0
- package/lib/controllers/messaging/environment.d.ts +10 -0
- package/lib/controllers/messaging/environment.d.ts.map +1 -0
- package/lib/middlewares/access.d.ts.map +1 -1
- package/lib/middlewares/authentication.d.ts +1 -1
- package/lib/middlewares/authentication.d.ts.map +1 -1
- package/lib/models/Application.d.ts +13 -0
- package/lib/models/Application.d.ts.map +1 -0
- package/lib/models/Connection.d.ts +1 -0
- package/lib/models/Connection.d.ts.map +1 -1
- package/lib/models/EnvConnection.d.ts +9 -0
- package/lib/models/EnvConnection.d.ts.map +1 -0
- package/lib/models/index.d.ts +4 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/routes/index.d.ts +2 -0
- package/lib/routes/index.d.ts.map +1 -0
- package/lib/routes/messaging/index.d.ts +4 -0
- package/lib/routes/messaging/index.d.ts.map +1 -0
- package/lib/services/rabitmq.d.ts.map +1 -1
- package/lib/services/security.d.ts +29 -0
- package/lib/services/security.d.ts.map +1 -0
- package/lib/services/sequelize.d.ts.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/lib/app/app.js +0 -84
- package/lib/app/controller.js +0 -95
- package/lib/app/core.js +0 -66
- package/lib/app/index.js +0 -60
- package/lib/app/service.js +0 -24
- package/lib/app/settings.js +0 -130
- package/lib/app/singleton.js +0 -29
- package/lib/contracts/console.js +0 -5
- package/lib/contracts/entity.js +0 -5
- package/lib/contracts/http.js +0 -50
- package/lib/contracts/index.js +0 -104
- package/lib/contracts/messaging.js +0 -14
- package/lib/contracts/service.js +0 -5
- package/lib/contracts/session.js +0 -5
- package/lib/contracts/settings.js +0 -5
- package/lib/contracts/singleton.js +0 -5
- package/lib/contracts/socket.js +0 -11
- package/lib/contracts/tenant.d.ts +0 -1
- package/lib/contracts/tenant.d.ts.map +0 -1
- package/lib/contracts/tenant.js +0 -1
- package/lib/controllers/api/file.js +0 -24
- package/lib/controllers/api/index.js +0 -13
- package/lib/controllers/index.js +0 -16
- package/lib/express.d.js +0 -5
- package/lib/index.js +0 -92
- package/lib/middlewares/access.js +0 -35
- package/lib/middlewares/authentication.js +0 -27
- package/lib/middlewares/file.js +0 -41
- package/lib/middlewares/index.js +0 -27
- package/lib/models/Connection.js +0 -50
- package/lib/models/index.js +0 -16
- package/lib/services/error.js +0 -49
- package/lib/services/express.js +0 -140
- package/lib/services/file.js +0 -65
- package/lib/services/index.js +0 -80
- package/lib/services/rabitmq.js +0 -87
- package/lib/services/redis.js +0 -60
- package/lib/services/sequelize.js +0 -238
- package/lib/services/socket.js +0 -56
- package/lib/services/task.js +0 -162
- package/lib/utils/api.js +0 -50
- package/lib/utils/database.js +0 -36
- package/lib/utils/date.js +0 -28
- package/lib/utils/index.js +0 -60
- package/lib/utils/logger.js +0 -55
- package/lib/utils/session.js +0 -23
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/app/settings.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAKvB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,cAAM,YAAY;IAChB,WAAW,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;IAChD,cAAc,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAM;IACtD,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,CAAM;IACpC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAM;IAC1C,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAM;IAClC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAM;IAC9B,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAM;IAE5C,QAAQ,EAAE,eAAe,
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/app/settings.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAKvB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,cAAM,YAAY;IAChB,WAAW,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;IAChD,cAAc,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAM;IACtD,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,CAAM;IACpC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAM;IAC1C,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAM;IAClC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAM;IAC9B,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAM;IAE5C,QAAQ,EAAE,eAAe,CAgFvB;IACF,QAAQ,EAAE,eAAe,CAAC;;IAM1B,SAAS,CAAC,aAAa;IAavB,aAAa;IAGb,iBAAiB;IAGjB,QAAQ;IAGR,WAAW;IAGX,OAAO;IAGP,SAAS;IAGT,YAAY;CAGb;AAED,eAAe,YAAY,CAAC"}
|
@@ -1,10 +1,16 @@
|
|
1
|
+
import { Dialect } from 'sequelize';
|
1
2
|
import { IAccount, IEnvironment } from './entity';
|
3
|
+
import { Connection } from '@sequelize/core';
|
2
4
|
export declare enum EMessagingQueue {
|
3
5
|
test = "exodus.queue.test",
|
4
6
|
accountCreated = "exodus.account.created",
|
5
7
|
environmentCreated = "exodus.environment.created",
|
6
8
|
environmentDeleted = "exodus.environment.deleted",
|
7
|
-
environmentUpdatedToken = "exodus.environment.updated.token"
|
9
|
+
environmentUpdatedToken = "exodus.environment.updated.token",
|
10
|
+
environmentUpdatedDatabase = "exodus.environment.updated.database",
|
11
|
+
databaseCreated = "exodus.database.created",
|
12
|
+
databaseUpdate = "exodus.database.updated",
|
13
|
+
databaseDeleted = "exodus.database.deleted"
|
8
14
|
}
|
9
15
|
export type TMessageQueueDataMap = {
|
10
16
|
[EMessagingQueue.test]: {
|
@@ -17,11 +23,32 @@ export type TMessageQueueDataMap = {
|
|
17
23
|
oldToken: string;
|
18
24
|
newToken: string;
|
19
25
|
};
|
26
|
+
[EMessagingQueue.environmentUpdatedDatabase]: {
|
27
|
+
database: string;
|
28
|
+
envUuid: string;
|
29
|
+
};
|
20
30
|
[EMessagingQueue.environmentDeleted]: {
|
21
31
|
uuid: string;
|
22
32
|
token: string;
|
23
33
|
database: string;
|
24
34
|
};
|
35
|
+
[EMessagingQueue.databaseCreated]: {
|
36
|
+
uuid: string;
|
37
|
+
name: string;
|
38
|
+
dialect: Dialect;
|
39
|
+
username: string;
|
40
|
+
password: string;
|
41
|
+
credential: Buffer;
|
42
|
+
active: boolean;
|
43
|
+
params?: Record<string, any>;
|
44
|
+
};
|
45
|
+
[EMessagingQueue.databaseUpdate]: {
|
46
|
+
uuid: string;
|
47
|
+
updated: Partial<Connection>;
|
48
|
+
};
|
49
|
+
[EMessagingQueue.databaseDeleted]: {
|
50
|
+
uuid: string;
|
51
|
+
};
|
25
52
|
};
|
26
53
|
export type TMessagingQueueHandler<K extends keyof TMessageQueueDataMap = any> = (data: TMessageQueueDataMap[K], ack: () => void) => void;
|
27
54
|
export type TMessagingQueueEventList = Partial<Record<keyof TMessageQueueDataMap, TMessagingQueueHandler>>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/contracts/messaging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/contracts/messaging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,oBAAY,eAAe;IACzB,IAAI,sBAAsB;IAG1B,cAAc,2BAA2B;IAGzC,kBAAkB,+BAA+B;IACjD,kBAAkB,+BAA+B;IACjD,uBAAuB,qCAAqC;IAC5D,0BAA0B,wCAAwC;IAGlE,eAAe,4BAA4B;IAC3C,cAAc,4BAA4B;IAC1C,eAAe,4BAA4B;CAC5C;AAGD,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QACtB,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;IACF,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC3C,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IACnD,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE;QACzC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,CAAC,eAAe,CAAC,0BAA0B,CAAC,EAAE;QAC5C,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE;QACjC,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC;IACF,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE;QAChC,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;KAC9B,CAAC;IACF,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,oBAAoB,GAAG,GAAG,IAAI,CAC/E,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAC7B,GAAG,EAAE,MAAM,IAAI,KACZ,IAAI,CAAC;AAEV,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,MAAM,CAAC,MAAM,oBAAoB,EAAE,sBAAsB,CAAC,CAC3D,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/contracts/security.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
@@ -18,6 +18,12 @@ export type TApplicationSettings = {
|
|
18
18
|
export type TAuthenticationSettings = {
|
19
19
|
host: string;
|
20
20
|
issuer: string;
|
21
|
+
serviceIssuer: string;
|
22
|
+
algorithm: string;
|
23
|
+
initialVector: number;
|
24
|
+
certPath: string;
|
25
|
+
servicePublicKeyPath: string;
|
26
|
+
signExpirationSecs: number;
|
21
27
|
};
|
22
28
|
export type TCacheSettings = {
|
23
29
|
host: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/contracts/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAG1B,SAAS,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/contracts/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAG1B,SAAS,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC;CACpC,CAAC;AACF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,cAAc,EAAE,uBAAuB,CAAC;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { MessagingController } from '../../app';
|
2
|
+
import { EMessagingQueue, TMessagingQueueHandler } from '../../contracts';
|
3
|
+
declare class DatabaseController extends MessagingController {
|
4
|
+
created: TMessagingQueueHandler<EMessagingQueue.databaseCreated>;
|
5
|
+
update: TMessagingQueueHandler<EMessagingQueue.databaseUpdate>;
|
6
|
+
delete: TMessagingQueueHandler<EMessagingQueue.databaseDeleted>;
|
7
|
+
}
|
8
|
+
export default DatabaseController;
|
9
|
+
//# sourceMappingURL=database.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/controllers/messaging/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAI1E,cAAM,kBAAmB,SAAQ,mBAAmB;IAClD,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,eAAe,CAAC,CAc9D;IAEF,MAAM,EAAE,sBAAsB,CAAC,eAAe,CAAC,cAAc,CAAC,CAmB5D;IAEF,MAAM,EAAE,sBAAsB,CAAC,eAAe,CAAC,eAAe,CAAC,CAmB7D;CACH;AAED,eAAe,kBAAkB,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { MessagingController } from '../../app';
|
2
|
+
import { EMessagingQueue, TMessagingQueueHandler } from '../../contracts';
|
3
|
+
declare class EnvironmentController extends MessagingController {
|
4
|
+
created: TMessagingQueueHandler<EMessagingQueue.environmentCreated>;
|
5
|
+
deleted: TMessagingQueueHandler<EMessagingQueue.environmentDeleted>;
|
6
|
+
updatedToken: TMessagingQueueHandler<EMessagingQueue.environmentUpdatedToken>;
|
7
|
+
updatedDatabase: TMessagingQueueHandler<EMessagingQueue.environmentUpdatedDatabase>;
|
8
|
+
}
|
9
|
+
export default EnvironmentController;
|
10
|
+
//# sourceMappingURL=environment.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/controllers/messaging/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAI1E,cAAM,qBAAsB,SAAQ,mBAAmB;IACrD,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAuBjE;IAEF,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAmBjE;IAEF,YAAY,EAAE,sBAAsB,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAK3E;IAEF,eAAe,EAAE,sBAAsB,CAAC,eAAe,CAAC,0BAA0B,CAAC,CAwBjF;CACH;AAED,eAAe,qBAAqB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/middlewares/access.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/middlewares/access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,WAAW,UAAW,YAAY,EAAE,KAAG,cAAc,CAWnD;IAEF,SAAS,EAAE,cAAc,CAiDvB;CACH;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,wBAAyB,SAAQ,cAAc;IACnD,YAAY,EAAE,cAAc,CAMzB;CACJ;AAED,eAAe,wBAAwB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CreationOptional, InferAttributes, InferCreationAttributes, Model } from 'sequelize';
|
2
|
+
export declare class Application extends Model<InferAttributes<Application>, InferCreationAttributes<Application>> {
|
3
|
+
uuid: CreationOptional<string>;
|
4
|
+
name: string;
|
5
|
+
comments: string;
|
6
|
+
token: string;
|
7
|
+
acess: string;
|
8
|
+
expiresAt: string;
|
9
|
+
key: string;
|
10
|
+
active: boolean;
|
11
|
+
params: CreationOptional<Record<string, any>>;
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=Application.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../src/models/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,eAAe,EACf,uBAAuB,EACvB,KAAK,EACN,MAAM,WAAW,CAAC;AAGnB,qBAAa,WAAY,SAAQ,KAAK,CACpC,eAAe,CAAC,WAAW,CAAC,EAC5B,uBAAuB,CAAC,WAAW,CAAC,CACrC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACvD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/models/Connection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,KAAK,EACN,MAAM,WAAW,CAAC;AAGnB,qBAAa,UAAW,SAAQ,KAAK,CACnC,eAAe,CAAC,UAAU,CAAC,EAC3B,uBAAuB,CAAC,UAAU,CAAC,CACpC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACvD"}
|
1
|
+
{"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/models/Connection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,KAAK,EACN,MAAM,WAAW,CAAC;AAGnB,qBAAa,UAAW,SAAQ,KAAK,CACnC,eAAe,CAAC,UAAU,CAAC,EAC3B,uBAAuB,CAAC,UAAU,CAAC,CACpC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACvD"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { CreationOptional, InferAttributes, InferCreationAttributes } from 'sequelize';
|
2
|
+
import { Model } from 'sequelize';
|
3
|
+
export declare class EnvConnection extends Model<InferAttributes<EnvConnection>, InferCreationAttributes<EnvConnection>> {
|
4
|
+
uuid: CreationOptional<string>;
|
5
|
+
envUuid: string;
|
6
|
+
connUuid: string;
|
7
|
+
envToken: string;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=EnvConnection.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EnvConnection.d.ts","sourceRoot":"","sources":["../../src/models/EnvConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAa,KAAK,EAAE,MAAM,WAAW,CAAC;AAG7C,qBAAa,aAAc,SAAQ,KAAK,CACtC,eAAe,CAAC,aAAa,CAAC,EAC9B,uBAAuB,CAAC,aAAa,CAAC,CACvC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAC1B"}
|
package/lib/models/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAKxC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,GAAG,CAAC,EAA6C,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/messaging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAS3D,QAAA,MAAM,qBAAqB,EAAE,wBAW5B,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rabitmq.d.ts","sourceRoot":"","sources":["../../src/services/rabitmq.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAEL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AACtB,OAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
1
|
+
{"version":3,"file":"rabitmq.d.ts","sourceRoot":"","sources":["../../src/services/rabitmq.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAEL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AACtB,OAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYhD,cAAM,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IACvD,UAAU,EAAG,UAAU,CAAC;IACxB,OAAO,EAAG,OAAO,CAAC;IAClB,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,UAAU,CAA2B;;IAMvC,IAAI;IAMV,eAAe;IAKT,OAAO;IAmBP,WAAW,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAWzF,gBAAgB,CAAC,CAAC,SAAS,MAAM,oBAAoB,EACzD,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC;IA2BrC,cAAc,CAAC,MAAM,EAAE,wBAAwB;CAGhD;AAED,eAAe,eAAe,CAAC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { JWK, JWS } from 'node-jose';
|
2
|
+
import { Service } from '../app';
|
3
|
+
import { IService } from '../contracts';
|
4
|
+
import { TSignData } from '../contracts/security';
|
5
|
+
declare class SecurityService extends Service implements IService {
|
6
|
+
private privateKey;
|
7
|
+
private publicKey;
|
8
|
+
private servicePublicKey;
|
9
|
+
init(): Promise<void>;
|
10
|
+
private checkPaths;
|
11
|
+
private loadPrivateKey;
|
12
|
+
private loadPublicKey;
|
13
|
+
createKeyPairs(): Promise<{
|
14
|
+
publicKey: string;
|
15
|
+
privateKey: string;
|
16
|
+
}>;
|
17
|
+
loadServicePublicKey(): Promise<void>;
|
18
|
+
getPrivateKey(): JWK.Key;
|
19
|
+
getPublicKey(): JWK.Key;
|
20
|
+
getServicePublicKey(): JWK.Key;
|
21
|
+
encrypt(data: TSignData, publicKey: JWK.Key): Promise<string | false>;
|
22
|
+
decrypt<T = any>(encryptedData: string, privateKey: JWK.Key): Promise<T | false>;
|
23
|
+
sign(data: TSignData, privateKey: JWK.Key): Promise<JWS.CreateSignResult>;
|
24
|
+
verifySignature<T = any>(signature: string, publicKey: JWK.Key): Promise<T | false>;
|
25
|
+
simpleEncrypt(data: string | object): [string, Buffer];
|
26
|
+
simpleDecrypt(data: string, key: Buffer): Buffer | false;
|
27
|
+
}
|
28
|
+
export default SecurityService;
|
29
|
+
//# sourceMappingURL=security.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/services/security.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAQ,OAAO,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,cAAM,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IACvD,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,gBAAgB,CAAU;IAE5B,IAAI;IAMV,OAAO,CAAC,UAAU;YAMJ,cAAc;YAWd,aAAa;IAMd,cAAc;;;;IASd,oBAAoB;IAgB1B,aAAa;IAQb,YAAY;IAQZ,mBAAmB;IASb,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG;IAyB3C,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC;IAkBhF,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,CAAC,GAAG;IA0BzC,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC;IAiBzF,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAoBtD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;CAgBhE;AAED,eAAe,eAAe,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sequelize.d.ts","sourceRoot":"","sources":["../../src/services/sequelize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
1
|
+
{"version":3,"file":"sequelize.d.ts","sourceRoot":"","sources":["../../src/services/sequelize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAchD,cAAM,gBAAiB,SAAQ,OAAQ,YAAW,QAAQ;IACxD,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;;IAMjD,IAAI;IAOJ,mBAAmB;IAgCzB,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,SAAI;IAerC,mBAAmB;IAGb,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA6C9C,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAwC9C,KAAK,CAAC,QAAQ,EAAE,MAAM;IAatB,MAAM,CAAC,QAAQ,EAAE,MAAM;IA4C7B,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE;IAInC,QAAQ,CAAC,CAAC,SAAS,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7C,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;QAAE,UAAU,EAAE,CAAC,UAAU,EAAE,SAAS,KAAK,CAAC,CAAA;KAAE,EAC5E,QAAQ,EAAE,MAAM;IAwBlB,uBAAuB,CAAC,MAAM,EAAE,MAAM;;;;CAMvC;AAED,eAAe,gBAAgB,CAAC"}
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "exodus-framework",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.699",
|
4
4
|
"description": "Exodus Framework",
|
5
5
|
"author": "jhownpaixao",
|
6
6
|
"license": "ISC",
|
@@ -24,6 +24,7 @@
|
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
26
|
"@sequelize/core": "^7.0.0-alpha.37",
|
27
|
+
"@types/node-jose": "^1.1.13",
|
27
28
|
"amqplib": "^0.10.4",
|
28
29
|
"axios": "^1.7.5",
|
29
30
|
"bullmq": "^5.12.11",
|
@@ -38,6 +39,7 @@
|
|
38
39
|
"mariadb": "^3.3.1",
|
39
40
|
"multer": "^1.4.5-lts.1",
|
40
41
|
"mysql2": "^3.11.0",
|
42
|
+
"node-jose": "^2.2.0",
|
41
43
|
"node-schedule": "^2.1.1",
|
42
44
|
"pino": "^9.3.2",
|
43
45
|
"pino-http": "^10.2.0",
|
package/lib/app/app.js
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
var _cluster = _interopRequireDefault(require("cluster"));
|
8
|
-
var fs = _interopRequireWildcard(require("fs"));
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
10
|
-
var _core = _interopRequireDefault(require("./core"));
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
14
|
-
/**
|
15
|
-
* Classe da aplicação principal
|
16
|
-
* Responsável por inicializar todos os recursos usados por este micro-serviço
|
17
|
-
*
|
18
|
-
* @class Application
|
19
|
-
* @extends {Core}
|
20
|
-
*/
|
21
|
-
class Exodus extends _core.default {
|
22
|
-
services;
|
23
|
-
|
24
|
-
//* Initialization
|
25
|
-
constructor() {
|
26
|
-
super();
|
27
|
-
this.services = [];
|
28
|
-
}
|
29
|
-
async start() {
|
30
|
-
if (_cluster.default.isPrimary) {
|
31
|
-
this.initMaster();
|
32
|
-
} else {
|
33
|
-
await this.initCluster();
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
//* Cluster Managment
|
38
|
-
async initMaster() {
|
39
|
-
this.log(`✨ Starting ${_core.default.settings.getAppication().description} · Clusters: ${_core.default.settings.getAppication().clusters}`);
|
40
|
-
this.log(`✨ Core version ${Exodus.getVersion()}`);
|
41
|
-
this.createClusters();
|
42
|
-
}
|
43
|
-
async initCluster() {
|
44
|
-
this.log(`📊 Cluster ${_cluster.default.worker.id} started · PID ${_cluster.default.worker.process.pid}`);
|
45
|
-
this.initServices();
|
46
|
-
}
|
47
|
-
async createClusters() {
|
48
|
-
for (let i = 0; i < _core.default.settings.getAppication().clusters; i++) {
|
49
|
-
_cluster.default.fork();
|
50
|
-
}
|
51
|
-
_cluster.default.on('exit', (worker, _code, _signal) => {
|
52
|
-
this.log(`Cluester ${worker.process.pid} foi encerrado`, 'warning');
|
53
|
-
if (_core.default.settings.getAppication().clustersRestarts) {
|
54
|
-
this.log(`Reiniciando cluster`, 'warning');
|
55
|
-
_cluster.default.fork();
|
56
|
-
}
|
57
|
-
});
|
58
|
-
}
|
59
|
-
|
60
|
-
//* Service Managment
|
61
|
-
registerSingletonService(service) {
|
62
|
-
this.services.push(service);
|
63
|
-
}
|
64
|
-
async initServices() {
|
65
|
-
for (const service of this.services) {
|
66
|
-
await service.init().catch(error => {
|
67
|
-
this.log(`Erro on starting service: ${error.message || 'unknow'}`, 'danger');
|
68
|
-
});
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
// *System
|
73
|
-
static getVersion() {
|
74
|
-
try {
|
75
|
-
const packageJson = fs.readFileSync(_path.default.resolve(__dirname, '../../package.json'), 'utf8');
|
76
|
-
const packageData = JSON.parse(packageJson);
|
77
|
-
return packageData.version;
|
78
|
-
} catch (error) {
|
79
|
-
console.error('Error reading package.json:', error);
|
80
|
-
return undefined;
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
var _default = exports.default = Exodus;
|
package/lib/app/controller.js
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = exports.SocketRequest = exports.SocketController = exports.MessagingController = exports.HttpController = void 0;
|
7
|
-
var _express = _interopRequireDefault(require("../services/express"));
|
8
|
-
var _core = _interopRequireDefault(require("./core"));
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
-
/**
|
11
|
-
* Classe base dos conttrolers http
|
12
|
-
*
|
13
|
-
* @abstract
|
14
|
-
* @class Controller
|
15
|
-
* @extends {Core}
|
16
|
-
*/
|
17
|
-
class HttpController extends _core.default {
|
18
|
-
constructor() {
|
19
|
-
super();
|
20
|
-
}
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Metódo de envio de respostar http para o cliente
|
24
|
-
*
|
25
|
-
* @protected
|
26
|
-
* @param {THttpResponse} objResponse
|
27
|
-
* @param {Response} res
|
28
|
-
* @param {NextFunction} [next]
|
29
|
-
* @return {void}
|
30
|
-
* @memberof Controller
|
31
|
-
*/
|
32
|
-
send(objResponse, res, next) {
|
33
|
-
return _express.default.singleton().sendResponse(objResponse, res, next);
|
34
|
-
}
|
35
|
-
validate(data) {
|
36
|
-
return _express.default.singleton().checkRequest(data);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Class base dos controllers SocketIO
|
42
|
-
*
|
43
|
-
* @export
|
44
|
-
* @abstract
|
45
|
-
* @class SocketController
|
46
|
-
* @extends {Core}
|
47
|
-
*/
|
48
|
-
exports.HttpController = HttpController;
|
49
|
-
class SocketController extends _core.default {
|
50
|
-
constructor() {
|
51
|
-
super();
|
52
|
-
}
|
53
|
-
handlerEventBind(cb) {
|
54
|
-
return (req, data) => {
|
55
|
-
const d = this.bufferToData(data);
|
56
|
-
cb(req, ...d);
|
57
|
-
};
|
58
|
-
}
|
59
|
-
bufferToData(data) {
|
60
|
-
return Array.from(data);
|
61
|
-
}
|
62
|
-
}
|
63
|
-
exports.SocketController = SocketController;
|
64
|
-
class SocketRequest extends _core.default {
|
65
|
-
socket;
|
66
|
-
event;
|
67
|
-
constructor(socket, event) {
|
68
|
-
super();
|
69
|
-
this.event = event;
|
70
|
-
this.socket = socket;
|
71
|
-
}
|
72
|
-
send(event, ...data) {
|
73
|
-
this.socket.emit(event, ...data);
|
74
|
-
}
|
75
|
-
getEvent() {
|
76
|
-
return this.event;
|
77
|
-
}
|
78
|
-
getSocket() {
|
79
|
-
return this.socket;
|
80
|
-
}
|
81
|
-
dataToBuffer(data) {
|
82
|
-
return Buffer.from(data, 'utf-8');
|
83
|
-
}
|
84
|
-
}
|
85
|
-
exports.SocketRequest = SocketRequest;
|
86
|
-
class MessagingController extends _core.default {
|
87
|
-
constructor() {
|
88
|
-
super();
|
89
|
-
}
|
90
|
-
bufferToData(data) {
|
91
|
-
return Array.from(data);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
exports.MessagingController = MessagingController;
|
95
|
-
var _default = exports.default = HttpController;
|
package/lib/app/core.js
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
var _cluster = _interopRequireDefault(require("cluster"));
|
8
|
-
var _dateFns = require("date-fns");
|
9
|
-
var _settings = _interopRequireDefault(require("./settings"));
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
|
-
/**
|
12
|
-
* Class base responsável pelo gerênciamento RUNTIME da aplicação
|
13
|
-
* controle de cache, uso de memoria e gerênciamento de dados locais
|
14
|
-
*
|
15
|
-
* Todas as classes devem herdar esta classe para um gerênciamento completo
|
16
|
-
*
|
17
|
-
* @abstract
|
18
|
-
* @class Core
|
19
|
-
*/
|
20
|
-
class Core {
|
21
|
-
static settings = new _settings.default();
|
22
|
-
constructor() {
|
23
|
-
// #TODO
|
24
|
-
}
|
25
|
-
log(msg, level = 'normal') {
|
26
|
-
if (!msg) return;
|
27
|
-
let query = '\x1b[97m[%s]';
|
28
|
-
const params = [(0, _dateFns.format)(new Date(), 'HH:mm:ss')];
|
29
|
-
if (_cluster.default.isWorker) {
|
30
|
-
query = query + `\x1b[96m[%s]`;
|
31
|
-
params.push(`Cluster${_cluster.default.worker.id}`);
|
32
|
-
}
|
33
|
-
query = query + `\x1b[33m[%s]`;
|
34
|
-
params.push(this.constructor.name || 'unknow');
|
35
|
-
switch (level) {
|
36
|
-
case 'info':
|
37
|
-
query = query + `\x1b[94m `;
|
38
|
-
break;
|
39
|
-
case 'danger':
|
40
|
-
query = query + `\x1b[91m `;
|
41
|
-
break;
|
42
|
-
case 'warning':
|
43
|
-
query = query + `\x1b[33m `;
|
44
|
-
break;
|
45
|
-
case 'success':
|
46
|
-
query = query + `\x1b[92m `;
|
47
|
-
break;
|
48
|
-
case 'especial':
|
49
|
-
query = query + `\x1b[95m `;
|
50
|
-
break;
|
51
|
-
case 'comment':
|
52
|
-
query = query + `\x1b[97m `;
|
53
|
-
break;
|
54
|
-
case 'normal':
|
55
|
-
query = query + `\x1b[0m `;
|
56
|
-
break;
|
57
|
-
}
|
58
|
-
query = query + `%s\x1b[0m`;
|
59
|
-
params.push(msg);
|
60
|
-
console.log(query, ...params);
|
61
|
-
}
|
62
|
-
static setSettings(settings) {
|
63
|
-
this.settings = settings;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
var _default = exports.default = Core;
|
package/lib/app/index.js
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
var _exportNames = {
|
7
|
-
Exodus: true,
|
8
|
-
Core: true,
|
9
|
-
Service: true,
|
10
|
-
Singleton: true,
|
11
|
-
CoreSettings: true
|
12
|
-
};
|
13
|
-
Object.defineProperty(exports, "Core", {
|
14
|
-
enumerable: true,
|
15
|
-
get: function () {
|
16
|
-
return _core.default;
|
17
|
-
}
|
18
|
-
});
|
19
|
-
Object.defineProperty(exports, "CoreSettings", {
|
20
|
-
enumerable: true,
|
21
|
-
get: function () {
|
22
|
-
return _settings.default;
|
23
|
-
}
|
24
|
-
});
|
25
|
-
Object.defineProperty(exports, "Exodus", {
|
26
|
-
enumerable: true,
|
27
|
-
get: function () {
|
28
|
-
return _app.default;
|
29
|
-
}
|
30
|
-
});
|
31
|
-
Object.defineProperty(exports, "Service", {
|
32
|
-
enumerable: true,
|
33
|
-
get: function () {
|
34
|
-
return _service.default;
|
35
|
-
}
|
36
|
-
});
|
37
|
-
Object.defineProperty(exports, "Singleton", {
|
38
|
-
enumerable: true,
|
39
|
-
get: function () {
|
40
|
-
return _singleton.default;
|
41
|
-
}
|
42
|
-
});
|
43
|
-
var _app = _interopRequireDefault(require("./app"));
|
44
|
-
var _controller = require("./controller");
|
45
|
-
Object.keys(_controller).forEach(function (key) {
|
46
|
-
if (key === "default" || key === "__esModule") return;
|
47
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
48
|
-
if (key in exports && exports[key] === _controller[key]) return;
|
49
|
-
Object.defineProperty(exports, key, {
|
50
|
-
enumerable: true,
|
51
|
-
get: function () {
|
52
|
-
return _controller[key];
|
53
|
-
}
|
54
|
-
});
|
55
|
-
});
|
56
|
-
var _core = _interopRequireDefault(require("./core"));
|
57
|
-
var _service = _interopRequireDefault(require("./service"));
|
58
|
-
var _singleton = _interopRequireDefault(require("./singleton"));
|
59
|
-
var _settings = _interopRequireDefault(require("./settings"));
|
60
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|