@in.pulse-crm/sdk 1.3.1 → 1.3.3
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 +2 -2
- package/dist/socket-client.d.ts +7 -1
- package/dist/socket-server.d.ts +80 -4
- package/dist/socket-server.js +1 -0
- package/package.json +35 -35
- package/src/index.ts +55 -55
- package/src/socket-client.ts +8 -1
- package/src/socket-server.ts +86 -4
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ import UserSDK, { CreateUserDTO, UpdateUserDTO, User, UserRole } from "./user";
|
|
|
5
5
|
import { DataResponse, ErrorResponse, PaginatedResponse, QueryResponse } from "./response";
|
|
6
6
|
import ReportSDK, { ChatReport, ChatReportFileFormat, GenerateChatReportOptions } from "./report";
|
|
7
7
|
import SocketClientSDK, { JoinChatFunction, JoinRoomFunction, ListenEventFunction } from "./socket-client";
|
|
8
|
-
import SocketServerSDK, { EmitFunction, InstanceName, SocketAdminRoom,
|
|
9
|
-
export { AuthSDK, LoginData, SessionData, FileSDK, File, FileDirType, InstanceSDK, UserSDK, CreateUserDTO, UpdateUserDTO, User, UserRole, DataResponse, ErrorResponse, PaginatedResponse, QueryResponse, ReportSDK, ChatReport, ChatReportFileFormat, GenerateChatReportOptions, SocketClientSDK, JoinChatFunction, JoinRoomFunction, ListenEventFunction, SocketServerSDK, EmitFunction, InstanceName, SocketAdminRoom,
|
|
8
|
+
import SocketServerSDK, { EmitFunction, InstanceName, SocketAdminRoom, SocketChatRoom, SocketMonitorRoom, SocketReportsRoom, SocketRoomType, SocketEventType } from "./socket-server";
|
|
9
|
+
export { AuthSDK, LoginData, SessionData, FileSDK, File, FileDirType, InstanceSDK, UserSDK, CreateUserDTO, UpdateUserDTO, User, UserRole, DataResponse, ErrorResponse, PaginatedResponse, QueryResponse, ReportSDK, ChatReport, ChatReportFileFormat, GenerateChatReportOptions, SocketClientSDK, JoinChatFunction, JoinRoomFunction, ListenEventFunction, SocketServerSDK, EmitFunction, InstanceName, SocketAdminRoom, SocketReportsRoom, SocketChatRoom, SocketEventType, SocketMonitorRoom, SocketRoomType };
|
package/dist/socket-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Socket } from "socket.io-client";
|
|
2
2
|
import { PhoneNumber } from "@in.pulse-crm/utils";
|
|
3
|
-
import { ChatId, NotImplemented, QRCode, SocketEventType, SocketRoomType } from "./socket-server";
|
|
3
|
+
import { ChatId, NotImplemented, QRCode, ReportStatusData, SocketEventType, SocketRoomType } from "./socket-server";
|
|
4
4
|
/**
|
|
5
5
|
* Função para entrar em uma sala de socket.
|
|
6
6
|
*/
|
|
@@ -56,6 +56,12 @@ export type ListenEventFunction = {
|
|
|
56
56
|
* @target Sala de administração do setor
|
|
57
57
|
*/
|
|
58
58
|
(event: SocketEventType.QR_CODE, listener: (qr: QRCode) => void): void;
|
|
59
|
+
/**
|
|
60
|
+
* Escuta evento de status de relatório
|
|
61
|
+
* @trigger Quando o status de um relatório é atualizado
|
|
62
|
+
* @target Sala de relatórios
|
|
63
|
+
*/
|
|
64
|
+
(event: SocketEventType.REPORT_STATUS, listener: (data: ReportStatusData) => void): void;
|
|
59
65
|
};
|
|
60
66
|
/**
|
|
61
67
|
* Classe para consumo dos eventos de socket.
|
package/dist/socket-server.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export declare enum SocketEventType {
|
|
|
10
10
|
NEW_CHAT = "new_chat",
|
|
11
11
|
CHAT_FINISHED = "chat_finished",
|
|
12
12
|
NOTIFICATION = "notification",
|
|
13
|
-
QR_CODE = "qr_code"
|
|
13
|
+
QR_CODE = "qr_code",
|
|
14
|
+
REPORT_STATUS = "report_status"
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Sala de chat, recebe todos eventos de um chat específico.
|
|
@@ -25,17 +26,28 @@ export type SocketAdminRoom = `sector:${SectorId}:admin`;
|
|
|
25
26
|
*/
|
|
26
27
|
export type SocketMonitorRoom = `sector:${SectorId}:monitor`;
|
|
27
28
|
/**
|
|
28
|
-
* Sala de relatórios
|
|
29
|
+
* Sala de relatórios, recebe eventos de um tipo relatório específico de um setor específico.
|
|
29
30
|
*/
|
|
30
|
-
export type
|
|
31
|
+
export type SocketReportsRoom = `sector:${number}:reports:${string}`;
|
|
31
32
|
/**
|
|
32
33
|
* Tipo de sala de socket.
|
|
33
34
|
*/
|
|
34
|
-
export type SocketRoomType = SocketChatRoom | SocketAdminRoom |
|
|
35
|
+
export type SocketRoomType = SocketChatRoom | SocketAdminRoom | SocketReportsRoom | SocketMonitorRoom;
|
|
35
36
|
/**
|
|
36
37
|
* Ainda não implementado.
|
|
37
38
|
*/
|
|
38
39
|
export type NotImplemented = unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Dados de status de um relatório.
|
|
42
|
+
*/
|
|
43
|
+
export type ReportStatusData = {
|
|
44
|
+
id: number;
|
|
45
|
+
type: string;
|
|
46
|
+
progress: number;
|
|
47
|
+
isCompleted: boolean;
|
|
48
|
+
isFailed: boolean;
|
|
49
|
+
error?: string;
|
|
50
|
+
};
|
|
39
51
|
/**
|
|
40
52
|
* String representando um QR Code.
|
|
41
53
|
*/
|
|
@@ -52,6 +64,69 @@ export type SectorId = number;
|
|
|
52
64
|
* Nome de uma instância.
|
|
53
65
|
*/
|
|
54
66
|
export type InstanceName = string;
|
|
67
|
+
/**
|
|
68
|
+
* Represents a function type for emitting events to specific rooms in a socket server.
|
|
69
|
+
* This function type supports multiple overloads, each corresponding to a specific
|
|
70
|
+
* combination of room type, event type, and value type.
|
|
71
|
+
*
|
|
72
|
+
* @typedef EmitFunction
|
|
73
|
+
*
|
|
74
|
+
* @overload
|
|
75
|
+
* Emits a `NEW_CHAT` event to a chat or monitor room.
|
|
76
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
77
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
78
|
+
* @param event - The event type, `SocketEventType.NEW_CHAT`.
|
|
79
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
80
|
+
*
|
|
81
|
+
* @overload
|
|
82
|
+
* Emits a `CHAT_FINISHED` event to a chat or monitor room.
|
|
83
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
84
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
85
|
+
* @param event - The event type, `SocketEventType.CHAT_FINISHED`.
|
|
86
|
+
* @param value - The ID of the finished chat.
|
|
87
|
+
*
|
|
88
|
+
* @overload
|
|
89
|
+
* Emits a `QR_CODE` event to an admin room.
|
|
90
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
91
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
92
|
+
* @param event - The event type, `SocketEventType.QR_CODE`.
|
|
93
|
+
* @param value - The QR code data.
|
|
94
|
+
*
|
|
95
|
+
* @overload
|
|
96
|
+
* Emits a `MESSAGE` event to a chat room.
|
|
97
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
98
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
99
|
+
* @param event - The event type, `SocketEventType.MESSAGE`.
|
|
100
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
101
|
+
*
|
|
102
|
+
* @overload
|
|
103
|
+
* Emits a `NOTIFICATION` event to an admin room.
|
|
104
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
105
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
106
|
+
* @param event - The event type, `SocketEventType.NOTIFICATION`.
|
|
107
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
108
|
+
*
|
|
109
|
+
* @overload
|
|
110
|
+
* Emits a `MESSAGE_EDIT` event to a chat room.
|
|
111
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
112
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
113
|
+
* @param event - The event type, `SocketEventType.MESSAGE_EDIT`.
|
|
114
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
115
|
+
*
|
|
116
|
+
* @overload
|
|
117
|
+
* Emits a `MESSAGE_STATUS` event to a chat room.
|
|
118
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
119
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
120
|
+
* @param event - The event type, `SocketEventType.MESSAGE_STATUS`.
|
|
121
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
122
|
+
*
|
|
123
|
+
* @overload
|
|
124
|
+
* Emits a `REPORT_STATUS` event to an admin room.
|
|
125
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
126
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
127
|
+
* @param event - The event type, `SocketEventType.REPORT_STATUS`.
|
|
128
|
+
* @param value - The report status data.
|
|
129
|
+
*/
|
|
55
130
|
export type EmitFunction = {
|
|
56
131
|
(instanceName: string, room: SocketChatRoom | SocketMonitorRoom, event: SocketEventType.NEW_CHAT, value: NotImplemented): void;
|
|
57
132
|
(instanceName: string, room: SocketChatRoom | SocketMonitorRoom, event: SocketEventType.CHAT_FINISHED, value: ChatId): void;
|
|
@@ -60,6 +135,7 @@ export type EmitFunction = {
|
|
|
60
135
|
(instanceName: string, room: SocketAdminRoom, event: SocketEventType.NOTIFICATION, value: NotImplemented): void;
|
|
61
136
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_EDIT, value: NotImplemented): void;
|
|
62
137
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_STATUS, value: NotImplemented): void;
|
|
138
|
+
(instanceName: string, room: SocketReportsRoom, event: SocketEventType.REPORT_STATUS, value: ReportStatusData): void;
|
|
63
139
|
};
|
|
64
140
|
/**
|
|
65
141
|
* Classe para manipulação de eventos de socket.
|
package/dist/socket-server.js
CHANGED
|
@@ -13,6 +13,7 @@ var SocketEventType;
|
|
|
13
13
|
SocketEventType["CHAT_FINISHED"] = "chat_finished";
|
|
14
14
|
SocketEventType["NOTIFICATION"] = "notification";
|
|
15
15
|
SocketEventType["QR_CODE"] = "qr_code";
|
|
16
|
+
SocketEventType["REPORT_STATUS"] = "report_status";
|
|
16
17
|
})(SocketEventType || (exports.SocketEventType = SocketEventType = {}));
|
|
17
18
|
/**
|
|
18
19
|
* Classe para manipulação de eventos de socket.
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@in.pulse-crm/sdk",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "SDKs for abstraction of api consumption of in.pulse-crm application",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"require": "./dist/index.js"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"prettier": "prettier --write .",
|
|
17
|
-
"prettier:check": "prettier --check ."
|
|
18
|
-
},
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "in.pulse-crm"
|
|
22
|
-
},
|
|
23
|
-
"author": "Renan G. Dutra <r.granatodutra@gmail.com>",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@in.pulse-crm/utils": "^1.3.0",
|
|
27
|
-
"axios": "^1.8.3",
|
|
28
|
-
"socket.io-client": "^4.8.1"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^22.13.10",
|
|
32
|
-
"prettier": "^3.5.3",
|
|
33
|
-
"typescript": "^5.8.2"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@in.pulse-crm/sdk",
|
|
3
|
+
"version": "1.3.3",
|
|
4
|
+
"description": "SDKs for abstraction of api consumption of in.pulse-crm application",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"prettier": "prettier --write .",
|
|
17
|
+
"prettier:check": "prettier --check ."
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "in.pulse-crm"
|
|
22
|
+
},
|
|
23
|
+
"author": "Renan G. Dutra <r.granatodutra@gmail.com>",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@in.pulse-crm/utils": "^1.3.0",
|
|
27
|
+
"axios": "^1.8.3",
|
|
28
|
+
"socket.io-client": "^4.8.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.13.10",
|
|
32
|
+
"prettier": "^3.5.3",
|
|
33
|
+
"typescript": "^5.8.2"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import AuthSDK, { LoginData, SessionData } from "./auth";
|
|
2
|
-
import FileSDK, { File, FileDirType } from "./file";
|
|
3
|
-
import InstanceSDK from "./instance";
|
|
4
|
-
import UserSDK, { CreateUserDTO, UpdateUserDTO, User, UserRole } from "./user";
|
|
5
|
-
import { DataResponse, ErrorResponse, PaginatedResponse, QueryResponse } from "./response";
|
|
6
|
-
import ReportSDK, { ChatReport, ChatReportFileFormat, GenerateChatReportOptions } from "./report";
|
|
7
|
-
import SocketClientSDK, { JoinChatFunction, JoinRoomFunction, ListenEventFunction } from "./socket-client";
|
|
8
|
-
import
|
|
9
|
-
SocketServerSDK,
|
|
10
|
-
{
|
|
11
|
-
EmitFunction,
|
|
12
|
-
InstanceName,
|
|
13
|
-
SocketAdminRoom,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./socket-server";
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
AuthSDK,
|
|
23
|
-
LoginData,
|
|
24
|
-
SessionData,
|
|
25
|
-
FileSDK,
|
|
26
|
-
File,
|
|
27
|
-
FileDirType,
|
|
28
|
-
InstanceSDK,
|
|
29
|
-
UserSDK,
|
|
30
|
-
CreateUserDTO,
|
|
31
|
-
UpdateUserDTO,
|
|
32
|
-
User,
|
|
33
|
-
UserRole,
|
|
34
|
-
DataResponse,
|
|
35
|
-
ErrorResponse,
|
|
36
|
-
PaginatedResponse,
|
|
37
|
-
QueryResponse,
|
|
38
|
-
ReportSDK,
|
|
39
|
-
ChatReport,
|
|
40
|
-
ChatReportFileFormat,
|
|
41
|
-
GenerateChatReportOptions,
|
|
42
|
-
SocketClientSDK,
|
|
43
|
-
JoinChatFunction,
|
|
44
|
-
JoinRoomFunction,
|
|
45
|
-
ListenEventFunction,
|
|
46
|
-
SocketServerSDK,
|
|
47
|
-
EmitFunction,
|
|
48
|
-
InstanceName,
|
|
49
|
-
SocketAdminRoom,
|
|
50
|
-
|
|
51
|
-
SocketChatRoom,
|
|
52
|
-
SocketEventType,
|
|
53
|
-
SocketMonitorRoom,
|
|
54
|
-
SocketRoomType
|
|
55
|
-
};
|
|
1
|
+
import AuthSDK, { LoginData, SessionData } from "./auth";
|
|
2
|
+
import FileSDK, { File, FileDirType } from "./file";
|
|
3
|
+
import InstanceSDK from "./instance";
|
|
4
|
+
import UserSDK, { CreateUserDTO, UpdateUserDTO, User, UserRole } from "./user";
|
|
5
|
+
import { DataResponse, ErrorResponse, PaginatedResponse, QueryResponse } from "./response";
|
|
6
|
+
import ReportSDK, { ChatReport, ChatReportFileFormat, GenerateChatReportOptions } from "./report";
|
|
7
|
+
import SocketClientSDK, { JoinChatFunction, JoinRoomFunction, ListenEventFunction } from "./socket-client";
|
|
8
|
+
import
|
|
9
|
+
SocketServerSDK,
|
|
10
|
+
{
|
|
11
|
+
EmitFunction,
|
|
12
|
+
InstanceName,
|
|
13
|
+
SocketAdminRoom,
|
|
14
|
+
SocketChatRoom,
|
|
15
|
+
SocketMonitorRoom,
|
|
16
|
+
SocketReportsRoom,
|
|
17
|
+
SocketRoomType,
|
|
18
|
+
SocketEventType,
|
|
19
|
+
} from "./socket-server";
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
AuthSDK,
|
|
23
|
+
LoginData,
|
|
24
|
+
SessionData,
|
|
25
|
+
FileSDK,
|
|
26
|
+
File,
|
|
27
|
+
FileDirType,
|
|
28
|
+
InstanceSDK,
|
|
29
|
+
UserSDK,
|
|
30
|
+
CreateUserDTO,
|
|
31
|
+
UpdateUserDTO,
|
|
32
|
+
User,
|
|
33
|
+
UserRole,
|
|
34
|
+
DataResponse,
|
|
35
|
+
ErrorResponse,
|
|
36
|
+
PaginatedResponse,
|
|
37
|
+
QueryResponse,
|
|
38
|
+
ReportSDK,
|
|
39
|
+
ChatReport,
|
|
40
|
+
ChatReportFileFormat,
|
|
41
|
+
GenerateChatReportOptions,
|
|
42
|
+
SocketClientSDK,
|
|
43
|
+
JoinChatFunction,
|
|
44
|
+
JoinRoomFunction,
|
|
45
|
+
ListenEventFunction,
|
|
46
|
+
SocketServerSDK,
|
|
47
|
+
EmitFunction,
|
|
48
|
+
InstanceName,
|
|
49
|
+
SocketAdminRoom,
|
|
50
|
+
SocketReportsRoom,
|
|
51
|
+
SocketChatRoom,
|
|
52
|
+
SocketEventType,
|
|
53
|
+
SocketMonitorRoom,
|
|
54
|
+
SocketRoomType
|
|
55
|
+
};
|
package/src/socket-client.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Socket } from "socket.io-client";
|
|
2
2
|
import { PhoneNumber } from "@in.pulse-crm/utils";
|
|
3
|
-
import { ChatId, NotImplemented, QRCode, SocketEventType, SocketRoomType } from "./socket-server";
|
|
3
|
+
import { ChatId, NotImplemented, QRCode, ReportStatusData, SocketEventType, SocketRoomType } from "./socket-server";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Função para entrar em uma sala de socket.
|
|
@@ -65,6 +65,13 @@ export type ListenEventFunction = {
|
|
|
65
65
|
* @target Sala de administração do setor
|
|
66
66
|
*/
|
|
67
67
|
(event: SocketEventType.QR_CODE, listener: (qr: QRCode) => void): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Escuta evento de status de relatório
|
|
71
|
+
* @trigger Quando o status de um relatório é atualizado
|
|
72
|
+
* @target Sala de relatórios
|
|
73
|
+
*/
|
|
74
|
+
(event: SocketEventType.REPORT_STATUS, listener: (data: ReportStatusData) => void): void;
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
/**
|
package/src/socket-server.ts
CHANGED
|
@@ -11,7 +11,8 @@ export enum SocketEventType {
|
|
|
11
11
|
NEW_CHAT = "new_chat",
|
|
12
12
|
CHAT_FINISHED = "chat_finished",
|
|
13
13
|
NOTIFICATION = "notification",
|
|
14
|
-
QR_CODE = "qr_code"
|
|
14
|
+
QR_CODE = "qr_code",
|
|
15
|
+
REPORT_STATUS = "report_status"
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -30,20 +31,32 @@ export type SocketAdminRoom = `sector:${SectorId}:admin`;
|
|
|
30
31
|
export type SocketMonitorRoom = `sector:${SectorId}:monitor`;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* Sala de relatórios
|
|
34
|
+
* Sala de relatórios, recebe eventos de um tipo relatório específico de um setor específico.
|
|
34
35
|
*/
|
|
35
|
-
export type
|
|
36
|
+
export type SocketReportsRoom = `sector:${number}:reports:${string}`;
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Tipo de sala de socket.
|
|
39
40
|
*/
|
|
40
|
-
export type SocketRoomType = SocketChatRoom | SocketAdminRoom |
|
|
41
|
+
export type SocketRoomType = SocketChatRoom | SocketAdminRoom | SocketReportsRoom | SocketMonitorRoom;
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Ainda não implementado.
|
|
44
45
|
*/
|
|
45
46
|
export type NotImplemented = unknown;
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Dados de status de um relatório.
|
|
50
|
+
*/
|
|
51
|
+
export type ReportStatusData = {
|
|
52
|
+
id: number;
|
|
53
|
+
type: string;
|
|
54
|
+
progress: number;
|
|
55
|
+
isCompleted: boolean;
|
|
56
|
+
isFailed: boolean;
|
|
57
|
+
error?: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
47
60
|
/**
|
|
48
61
|
* String representando um QR Code.
|
|
49
62
|
*/
|
|
@@ -64,6 +77,69 @@ export type SectorId = number;
|
|
|
64
77
|
*/
|
|
65
78
|
export type InstanceName = string;
|
|
66
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Represents a function type for emitting events to specific rooms in a socket server.
|
|
82
|
+
* This function type supports multiple overloads, each corresponding to a specific
|
|
83
|
+
* combination of room type, event type, and value type.
|
|
84
|
+
*
|
|
85
|
+
* @typedef EmitFunction
|
|
86
|
+
*
|
|
87
|
+
* @overload
|
|
88
|
+
* Emits a `NEW_CHAT` event to a chat or monitor room.
|
|
89
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
90
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
91
|
+
* @param event - The event type, `SocketEventType.NEW_CHAT`.
|
|
92
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
93
|
+
*
|
|
94
|
+
* @overload
|
|
95
|
+
* Emits a `CHAT_FINISHED` event to a chat or monitor room.
|
|
96
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
97
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
98
|
+
* @param event - The event type, `SocketEventType.CHAT_FINISHED`.
|
|
99
|
+
* @param value - The ID of the finished chat.
|
|
100
|
+
*
|
|
101
|
+
* @overload
|
|
102
|
+
* Emits a `QR_CODE` event to an admin room.
|
|
103
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
104
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
105
|
+
* @param event - The event type, `SocketEventType.QR_CODE`.
|
|
106
|
+
* @param value - The QR code data.
|
|
107
|
+
*
|
|
108
|
+
* @overload
|
|
109
|
+
* Emits a `MESSAGE` event to a chat room.
|
|
110
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
111
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
112
|
+
* @param event - The event type, `SocketEventType.MESSAGE`.
|
|
113
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
114
|
+
*
|
|
115
|
+
* @overload
|
|
116
|
+
* Emits a `NOTIFICATION` event to an admin room.
|
|
117
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
118
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
119
|
+
* @param event - The event type, `SocketEventType.NOTIFICATION`.
|
|
120
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
121
|
+
*
|
|
122
|
+
* @overload
|
|
123
|
+
* Emits a `MESSAGE_EDIT` event to a chat room.
|
|
124
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
125
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
126
|
+
* @param event - The event type, `SocketEventType.MESSAGE_EDIT`.
|
|
127
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
128
|
+
*
|
|
129
|
+
* @overload
|
|
130
|
+
* Emits a `MESSAGE_STATUS` event to a chat room.
|
|
131
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
132
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
133
|
+
* @param event - The event type, `SocketEventType.MESSAGE_STATUS`.
|
|
134
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
135
|
+
*
|
|
136
|
+
* @overload
|
|
137
|
+
* Emits a `REPORT_STATUS` event to an admin room.
|
|
138
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
139
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
140
|
+
* @param event - The event type, `SocketEventType.REPORT_STATUS`.
|
|
141
|
+
* @param value - The report status data.
|
|
142
|
+
*/
|
|
67
143
|
export type EmitFunction = {
|
|
68
144
|
(
|
|
69
145
|
instanceName: string,
|
|
@@ -107,6 +183,12 @@ export type EmitFunction = {
|
|
|
107
183
|
event: SocketEventType.MESSAGE_STATUS,
|
|
108
184
|
value: NotImplemented
|
|
109
185
|
): void;
|
|
186
|
+
(
|
|
187
|
+
instanceName: string,
|
|
188
|
+
room: SocketReportsRoom,
|
|
189
|
+
event: SocketEventType.REPORT_STATUS,
|
|
190
|
+
value: ReportStatusData
|
|
191
|
+
): void;
|
|
110
192
|
};
|
|
111
193
|
|
|
112
194
|
/**
|