@in.pulse-crm/sdk 1.3.1 → 1.3.2
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 +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -17
- package/dist/socket-client.d.ts +7 -1
- package/dist/socket-server.d.ts +17 -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 +23 -4
package/dist/file.d.ts
CHANGED
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/index.js
CHANGED
|
@@ -15,23 +15,13 @@ 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) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
27
|
};
|
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
|
*/
|
|
@@ -60,6 +72,7 @@ export type EmitFunction = {
|
|
|
60
72
|
(instanceName: string, room: SocketAdminRoom, event: SocketEventType.NOTIFICATION, value: NotImplemented): void;
|
|
61
73
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_EDIT, value: NotImplemented): void;
|
|
62
74
|
(instanceName: string, room: SocketChatRoom, event: SocketEventType.MESSAGE_STATUS, value: NotImplemented): void;
|
|
75
|
+
(instanceName: string, room: SocketAdminRoom, event: SocketEventType.REPORT_STATUS, value: ReportStatusData): void;
|
|
63
76
|
};
|
|
64
77
|
/**
|
|
65
78
|
* 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.2",
|
|
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
|
*/
|
|
@@ -107,6 +120,12 @@ export type EmitFunction = {
|
|
|
107
120
|
event: SocketEventType.MESSAGE_STATUS,
|
|
108
121
|
value: NotImplemented
|
|
109
122
|
): void;
|
|
123
|
+
(
|
|
124
|
+
instanceName: string,
|
|
125
|
+
room: SocketAdminRoom,
|
|
126
|
+
event: SocketEventType.REPORT_STATUS,
|
|
127
|
+
value: ReportStatusData
|
|
128
|
+
): void;
|
|
110
129
|
};
|
|
111
130
|
|
|
112
131
|
/**
|