@nomalism-com/types 0.45.14 → 0.45.16
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.
|
@@ -1,52 +1,59 @@
|
|
|
1
1
|
import type { IChatBalloon } from '../../stock/chat/interfaces';
|
|
2
2
|
import type { IPublicDocument, IPublicFindBySubscriberId, ITags } from '../../ui/portal/interface';
|
|
3
3
|
export declare const Route = "ws";
|
|
4
|
-
interface IEvent {
|
|
4
|
+
export interface IEvent {
|
|
5
5
|
type: string;
|
|
6
6
|
}
|
|
7
|
-
interface IChatTranslationUpdated extends IEvent {
|
|
7
|
+
export interface IChatTranslationUpdated extends IEvent {
|
|
8
8
|
type: 'chat.translation.updated';
|
|
9
9
|
chat_id: string;
|
|
10
10
|
translation: string;
|
|
11
11
|
target_language_id: string;
|
|
12
12
|
}
|
|
13
|
-
interface IChatMessageCreated extends IEvent {
|
|
13
|
+
export interface IChatMessageCreated extends IEvent {
|
|
14
14
|
type: 'chat.message.created';
|
|
15
15
|
balloon: IChatBalloon;
|
|
16
16
|
}
|
|
17
|
-
interface IChatMessageUpdated extends IEvent {
|
|
17
|
+
export interface IChatMessageUpdated extends IEvent {
|
|
18
18
|
type: 'chat.message.updated';
|
|
19
19
|
chat_id: string;
|
|
20
20
|
patch: Partial<NonNullable<IChatBalloon['chat']>>;
|
|
21
21
|
}
|
|
22
|
-
interface IChatMessageDeleted extends IEvent {
|
|
22
|
+
export interface IChatMessageDeleted extends IEvent {
|
|
23
23
|
type: 'chat.message.deleted';
|
|
24
24
|
chat_id: string;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export interface IChatFileDeleted extends IEvent {
|
|
27
27
|
type: 'chat.file.deleted';
|
|
28
28
|
file_id: string;
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
export interface IChatReadStateUpdated extends IEvent {
|
|
30
31
|
type: 'chat.read_state.updated';
|
|
31
32
|
chat_document_header_id: string;
|
|
32
33
|
client_read: boolean;
|
|
33
34
|
chat_id?: string;
|
|
34
35
|
file_id?: string;
|
|
35
|
-
}
|
|
36
|
+
}
|
|
37
|
+
export interface IChatTagsUpdated extends IEvent {
|
|
36
38
|
type: 'chat.tags.updated';
|
|
37
39
|
chat_document_header_id: string;
|
|
38
40
|
tags: ITags[];
|
|
39
|
-
}
|
|
41
|
+
}
|
|
42
|
+
export interface IPersonaUpdated extends IEvent {
|
|
40
43
|
type: 'persona.updated';
|
|
41
44
|
persona: NonNullable<IPublicFindBySubscriberId['persona']>;
|
|
42
|
-
}
|
|
45
|
+
}
|
|
46
|
+
export interface IDocumentUpdated extends IEvent {
|
|
43
47
|
type: 'document.updated';
|
|
44
48
|
document: IPublicDocument;
|
|
45
|
-
}
|
|
49
|
+
}
|
|
50
|
+
export interface IPing extends IEvent {
|
|
46
51
|
type: 'ping';
|
|
47
|
-
}
|
|
52
|
+
}
|
|
53
|
+
export interface IPong extends IEvent {
|
|
48
54
|
type: 'pong';
|
|
49
|
-
}
|
|
55
|
+
}
|
|
56
|
+
export type ChatSocketEvent = IChatTranslationUpdated | IChatMessageCreated | IChatMessageUpdated | IChatMessageDeleted | IChatFileDeleted | IChatReadStateUpdated | IChatTagsUpdated | IPersonaUpdated | IDocumentUpdated | IPing | IPong;
|
|
50
57
|
export interface SocketOptions<T extends IEvent> {
|
|
51
58
|
token: string;
|
|
52
59
|
onEvent: (evt: T) => void;
|
|
@@ -58,7 +65,6 @@ export interface SocketOptions<T extends IEvent> {
|
|
|
58
65
|
export interface SocketHandle {
|
|
59
66
|
close: () => void;
|
|
60
67
|
}
|
|
61
|
-
export interface IClient
|
|
62
|
-
openSocket(data: SocketOptions<T>): SocketHandle;
|
|
68
|
+
export interface IClient {
|
|
69
|
+
openSocket<T extends IEvent>(data: SocketOptions<T>): SocketHandle;
|
|
63
70
|
}
|
|
64
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomalism-com/types",
|
|
3
3
|
"description": "A nomalism package with all necessary types and validations for developing APIs",
|
|
4
|
-
"version": "0.45.
|
|
4
|
+
"version": "0.45.16",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"joi": "^18.2.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@swc/core": "^1.15.
|
|
32
|
+
"@swc/core": "^1.15.40",
|
|
33
33
|
"@types/node": "^24.12.4",
|
|
34
34
|
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
35
35
|
"@typescript-eslint/parser": "^8.59.4",
|