@in.pulse-crm/sdk 1.3.2 → 1.3.4
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/file.d.ts +0 -2
- package/dist/index.js +17 -7
- package/dist/socket-server.d.ts +73 -4
- package/package.json +1 -1
- package/src/socket-server.ts +74 -5
package/dist/file.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/dist/socket-server.d.ts
CHANGED
|
@@ -44,9 +44,15 @@ export type ReportStatusData = {
|
|
|
44
44
|
id: number;
|
|
45
45
|
type: string;
|
|
46
46
|
progress: number;
|
|
47
|
-
isCompleted:
|
|
48
|
-
isFailed:
|
|
49
|
-
|
|
47
|
+
isCompleted: true;
|
|
48
|
+
isFailed: false;
|
|
49
|
+
fileId: number;
|
|
50
|
+
} | {
|
|
51
|
+
id: number;
|
|
52
|
+
type: string;
|
|
53
|
+
isCompleted: false;
|
|
54
|
+
isFailed: true;
|
|
55
|
+
error: string;
|
|
50
56
|
};
|
|
51
57
|
/**
|
|
52
58
|
* String representando um QR Code.
|
|
@@ -64,6 +70,69 @@ export type SectorId = number;
|
|
|
64
70
|
* Nome de uma instância.
|
|
65
71
|
*/
|
|
66
72
|
export type InstanceName = string;
|
|
73
|
+
/**
|
|
74
|
+
* Represents a function type for emitting events to specific rooms in a socket server.
|
|
75
|
+
* This function type supports multiple overloads, each corresponding to a specific
|
|
76
|
+
* combination of room type, event type, and value type.
|
|
77
|
+
*
|
|
78
|
+
* @typedef EmitFunction
|
|
79
|
+
*
|
|
80
|
+
* @overload
|
|
81
|
+
* Emits a `NEW_CHAT` event to a chat or monitor room.
|
|
82
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
83
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
84
|
+
* @param event - The event type, `SocketEventType.NEW_CHAT`.
|
|
85
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
86
|
+
*
|
|
87
|
+
* @overload
|
|
88
|
+
* Emits a `CHAT_FINISHED` 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.CHAT_FINISHED`.
|
|
92
|
+
* @param value - The ID of the finished chat.
|
|
93
|
+
*
|
|
94
|
+
* @overload
|
|
95
|
+
* Emits a `QR_CODE` event to an admin room.
|
|
96
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
97
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
98
|
+
* @param event - The event type, `SocketEventType.QR_CODE`.
|
|
99
|
+
* @param value - The QR code data.
|
|
100
|
+
*
|
|
101
|
+
* @overload
|
|
102
|
+
* Emits a `MESSAGE` event to a chat room.
|
|
103
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
104
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
105
|
+
* @param event - The event type, `SocketEventType.MESSAGE`.
|
|
106
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
107
|
+
*
|
|
108
|
+
* @overload
|
|
109
|
+
* Emits a `NOTIFICATION` event to an admin room.
|
|
110
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
111
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
112
|
+
* @param event - The event type, `SocketEventType.NOTIFICATION`.
|
|
113
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
114
|
+
*
|
|
115
|
+
* @overload
|
|
116
|
+
* Emits a `MESSAGE_EDIT` event to a chat room.
|
|
117
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
118
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
119
|
+
* @param event - The event type, `SocketEventType.MESSAGE_EDIT`.
|
|
120
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
121
|
+
*
|
|
122
|
+
* @overload
|
|
123
|
+
* Emits a `MESSAGE_STATUS` 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_STATUS`.
|
|
127
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
128
|
+
*
|
|
129
|
+
* @overload
|
|
130
|
+
* Emits a `REPORT_STATUS` event to an admin room.
|
|
131
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
132
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
133
|
+
* @param event - The event type, `SocketEventType.REPORT_STATUS`.
|
|
134
|
+
* @param value - The report status data.
|
|
135
|
+
*/
|
|
67
136
|
export type EmitFunction = {
|
|
68
137
|
(instanceName: string, room: SocketChatRoom | SocketMonitorRoom, event: SocketEventType.NEW_CHAT, value: NotImplemented): void;
|
|
69
138
|
(instanceName: string, room: SocketChatRoom | SocketMonitorRoom, event: SocketEventType.CHAT_FINISHED, value: ChatId): void;
|
|
@@ -72,7 +141,7 @@ export type EmitFunction = {
|
|
|
72
141
|
(instanceName: string, room: SocketAdminRoom, event: SocketEventType.NOTIFICATION, value: NotImplemented): void;
|
|
73
142
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_EDIT, value: NotImplemented): void;
|
|
74
143
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_STATUS, value: NotImplemented): void;
|
|
75
|
-
(instanceName: string, room:
|
|
144
|
+
(instanceName: string, room: SocketReportsRoom, event: SocketEventType.REPORT_STATUS, value: ReportStatusData): void;
|
|
76
145
|
};
|
|
77
146
|
/**
|
|
78
147
|
* Classe para manipulação de eventos de socket.
|
package/package.json
CHANGED
package/src/socket-server.ts
CHANGED
|
@@ -52,10 +52,16 @@ export type ReportStatusData = {
|
|
|
52
52
|
id: number;
|
|
53
53
|
type: string;
|
|
54
54
|
progress: number;
|
|
55
|
-
isCompleted:
|
|
56
|
-
isFailed:
|
|
57
|
-
|
|
58
|
-
}
|
|
55
|
+
isCompleted: true;
|
|
56
|
+
isFailed: false;
|
|
57
|
+
fileId: number;
|
|
58
|
+
} | {
|
|
59
|
+
id: number;
|
|
60
|
+
type: string;
|
|
61
|
+
isCompleted: false;
|
|
62
|
+
isFailed: true;
|
|
63
|
+
error: string;
|
|
64
|
+
}
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
67
|
* String representando um QR Code.
|
|
@@ -77,6 +83,69 @@ export type SectorId = number;
|
|
|
77
83
|
*/
|
|
78
84
|
export type InstanceName = string;
|
|
79
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Represents a function type for emitting events to specific rooms in a socket server.
|
|
88
|
+
* This function type supports multiple overloads, each corresponding to a specific
|
|
89
|
+
* combination of room type, event type, and value type.
|
|
90
|
+
*
|
|
91
|
+
* @typedef EmitFunction
|
|
92
|
+
*
|
|
93
|
+
* @overload
|
|
94
|
+
* Emits a `NEW_CHAT` event to a chat or monitor room.
|
|
95
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
96
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
97
|
+
* @param event - The event type, `SocketEventType.NEW_CHAT`.
|
|
98
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
99
|
+
*
|
|
100
|
+
* @overload
|
|
101
|
+
* Emits a `CHAT_FINISHED` event to a chat or monitor room.
|
|
102
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
103
|
+
* @param room - The target room, either a `SocketChatRoom` or `SocketMonitorRoom`.
|
|
104
|
+
* @param event - The event type, `SocketEventType.CHAT_FINISHED`.
|
|
105
|
+
* @param value - The ID of the finished chat.
|
|
106
|
+
*
|
|
107
|
+
* @overload
|
|
108
|
+
* Emits a `QR_CODE` event to an admin room.
|
|
109
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
110
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
111
|
+
* @param event - The event type, `SocketEventType.QR_CODE`.
|
|
112
|
+
* @param value - The QR code data.
|
|
113
|
+
*
|
|
114
|
+
* @overload
|
|
115
|
+
* Emits a `MESSAGE` event to a chat room.
|
|
116
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
117
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
118
|
+
* @param event - The event type, `SocketEventType.MESSAGE`.
|
|
119
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
120
|
+
*
|
|
121
|
+
* @overload
|
|
122
|
+
* Emits a `NOTIFICATION` event to an admin room.
|
|
123
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
124
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
125
|
+
* @param event - The event type, `SocketEventType.NOTIFICATION`.
|
|
126
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
127
|
+
*
|
|
128
|
+
* @overload
|
|
129
|
+
* Emits a `MESSAGE_EDIT` event to a chat room.
|
|
130
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
131
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
132
|
+
* @param event - The event type, `SocketEventType.MESSAGE_EDIT`.
|
|
133
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
134
|
+
*
|
|
135
|
+
* @overload
|
|
136
|
+
* Emits a `MESSAGE_STATUS` event to a chat room.
|
|
137
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
138
|
+
* @param room - The target room, a `SocketChatRoom`.
|
|
139
|
+
* @param event - The event type, `SocketEventType.MESSAGE_STATUS`.
|
|
140
|
+
* @param value - The value associated with the event (type not yet implemented).
|
|
141
|
+
*
|
|
142
|
+
* @overload
|
|
143
|
+
* Emits a `REPORT_STATUS` event to an admin room.
|
|
144
|
+
* @param instanceName - The name of the instance emitting the event.
|
|
145
|
+
* @param room - The target room, a `SocketAdminRoom`.
|
|
146
|
+
* @param event - The event type, `SocketEventType.REPORT_STATUS`.
|
|
147
|
+
* @param value - The report status data.
|
|
148
|
+
*/
|
|
80
149
|
export type EmitFunction = {
|
|
81
150
|
(
|
|
82
151
|
instanceName: string,
|
|
@@ -122,7 +191,7 @@ export type EmitFunction = {
|
|
|
122
191
|
): void;
|
|
123
192
|
(
|
|
124
193
|
instanceName: string,
|
|
125
|
-
room:
|
|
194
|
+
room: SocketReportsRoom,
|
|
126
195
|
event: SocketEventType.REPORT_STATUS,
|
|
127
196
|
value: ReportStatusData
|
|
128
197
|
): void;
|