wbs-sessions 1.0.0-rc.1
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/README.md +0 -0
- package/lib/index.d.mts +119 -0
- package/lib/index.d.ts +119 -0
- package/lib/index.js +1058 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +1030 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
File without changes
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as typeorm from 'typeorm';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { AuthenticationState, WAMessageAddressingMode, GroupParticipant, Chat as Chat$1, WAMessage, BaileysEventEmitter, WAMessageKey, proto, GroupMetadata as GroupMetadata$1 } from 'baileys';
|
|
4
|
+
import * as node_cache from 'node-cache';
|
|
5
|
+
|
|
6
|
+
declare class AuthHandler {
|
|
7
|
+
private ds;
|
|
8
|
+
constructor(ds: DataSource);
|
|
9
|
+
init(): Promise<{
|
|
10
|
+
state: AuthenticationState;
|
|
11
|
+
saveCreds: () => Promise<void>;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Chat {
|
|
16
|
+
id: string;
|
|
17
|
+
data: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class Contact {
|
|
21
|
+
id: string;
|
|
22
|
+
lid?: string;
|
|
23
|
+
phoneNumber?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
notify?: string;
|
|
26
|
+
verifiedName?: string;
|
|
27
|
+
imgUrl?: string | "changed";
|
|
28
|
+
status?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class GroupMetadata {
|
|
32
|
+
id: string;
|
|
33
|
+
notify?: string;
|
|
34
|
+
addressingMode?: WAMessageAddressingMode;
|
|
35
|
+
owner?: string;
|
|
36
|
+
ownerPn?: string;
|
|
37
|
+
owner_country_code?: string;
|
|
38
|
+
subject: string;
|
|
39
|
+
subjectOwner?: string;
|
|
40
|
+
subjectOwnerPn?: string;
|
|
41
|
+
subjectTime?: number;
|
|
42
|
+
creation?: number;
|
|
43
|
+
desc?: string;
|
|
44
|
+
descOwner?: string;
|
|
45
|
+
descOwnerPn?: string;
|
|
46
|
+
descId?: string;
|
|
47
|
+
descTime?: number;
|
|
48
|
+
linkedParent?: string;
|
|
49
|
+
restrict?: boolean;
|
|
50
|
+
announce?: boolean;
|
|
51
|
+
memberAddMode?: boolean;
|
|
52
|
+
joinApprovalMode?: boolean;
|
|
53
|
+
isCommunity?: boolean;
|
|
54
|
+
isCommunityAnnounce?: boolean;
|
|
55
|
+
size?: number;
|
|
56
|
+
participants: GroupParticipant[];
|
|
57
|
+
ephemeralDuration?: number;
|
|
58
|
+
inviteCode?: string;
|
|
59
|
+
author?: string;
|
|
60
|
+
authorPn?: string;
|
|
61
|
+
expiredMetadata?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class StoreHandler {
|
|
65
|
+
ds: DataSource;
|
|
66
|
+
constructor(ds: DataSource);
|
|
67
|
+
init(): Promise<{
|
|
68
|
+
repos: {
|
|
69
|
+
chats: typeorm.Repository<Chat>;
|
|
70
|
+
groupMetadata: typeorm.Repository<GroupMetadata>;
|
|
71
|
+
contacts: typeorm.Repository<Contact>;
|
|
72
|
+
};
|
|
73
|
+
chats: {
|
|
74
|
+
chats: {};
|
|
75
|
+
get: (id: string) => Chat$1;
|
|
76
|
+
update: (id: string, update: Partial<Chat$1>) => Chat$1;
|
|
77
|
+
deleteById: (id: string) => boolean;
|
|
78
|
+
upsert: (messages?: Chat$1[]) => void;
|
|
79
|
+
all: () => Chat$1[];
|
|
80
|
+
clear: () => void;
|
|
81
|
+
};
|
|
82
|
+
contacts: Partial<{
|
|
83
|
+
[id: string]: Contact;
|
|
84
|
+
}>;
|
|
85
|
+
messages: {
|
|
86
|
+
[key: string]: {
|
|
87
|
+
messagesCache: node_cache;
|
|
88
|
+
get: (id: string) => WAMessage;
|
|
89
|
+
upsert: (item: WAMessage) => void;
|
|
90
|
+
update: (item: WAMessage) => boolean;
|
|
91
|
+
remove: (item: WAMessage) => boolean;
|
|
92
|
+
updateAssign: (id: string, update: Partial<WAMessage>) => boolean;
|
|
93
|
+
clear: () => void;
|
|
94
|
+
filter: (contain: (item: WAMessage) => boolean) => void;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
groupMetadata: {
|
|
98
|
+
[jid: string]: GroupMetadata;
|
|
99
|
+
};
|
|
100
|
+
presences: {};
|
|
101
|
+
bind: (ev: BaileysEventEmitter) => void;
|
|
102
|
+
loadMessage: (jid: string, id: string) => Promise<WAMessage>;
|
|
103
|
+
fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[]>;
|
|
104
|
+
fetchGroupMetadata: (jid: string, sock: Partial<{
|
|
105
|
+
groupMetadata: (jid: string) => Promise<GroupMetadata$1>;
|
|
106
|
+
}>, force?: boolean) => Promise<GroupMetadata>;
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class WbsSessions {
|
|
111
|
+
dbName: string;
|
|
112
|
+
auth: AuthHandler;
|
|
113
|
+
store: StoreHandler;
|
|
114
|
+
ds: DataSource;
|
|
115
|
+
constructor(dbName: string);
|
|
116
|
+
init(): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { WbsSessions as default };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as typeorm from 'typeorm';
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
|
+
import { AuthenticationState, WAMessageAddressingMode, GroupParticipant, Chat as Chat$1, WAMessage, BaileysEventEmitter, WAMessageKey, proto, GroupMetadata as GroupMetadata$1 } from 'baileys';
|
|
4
|
+
import * as node_cache from 'node-cache';
|
|
5
|
+
|
|
6
|
+
declare class AuthHandler {
|
|
7
|
+
private ds;
|
|
8
|
+
constructor(ds: DataSource);
|
|
9
|
+
init(): Promise<{
|
|
10
|
+
state: AuthenticationState;
|
|
11
|
+
saveCreds: () => Promise<void>;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Chat {
|
|
16
|
+
id: string;
|
|
17
|
+
data: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class Contact {
|
|
21
|
+
id: string;
|
|
22
|
+
lid?: string;
|
|
23
|
+
phoneNumber?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
notify?: string;
|
|
26
|
+
verifiedName?: string;
|
|
27
|
+
imgUrl?: string | "changed";
|
|
28
|
+
status?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class GroupMetadata {
|
|
32
|
+
id: string;
|
|
33
|
+
notify?: string;
|
|
34
|
+
addressingMode?: WAMessageAddressingMode;
|
|
35
|
+
owner?: string;
|
|
36
|
+
ownerPn?: string;
|
|
37
|
+
owner_country_code?: string;
|
|
38
|
+
subject: string;
|
|
39
|
+
subjectOwner?: string;
|
|
40
|
+
subjectOwnerPn?: string;
|
|
41
|
+
subjectTime?: number;
|
|
42
|
+
creation?: number;
|
|
43
|
+
desc?: string;
|
|
44
|
+
descOwner?: string;
|
|
45
|
+
descOwnerPn?: string;
|
|
46
|
+
descId?: string;
|
|
47
|
+
descTime?: number;
|
|
48
|
+
linkedParent?: string;
|
|
49
|
+
restrict?: boolean;
|
|
50
|
+
announce?: boolean;
|
|
51
|
+
memberAddMode?: boolean;
|
|
52
|
+
joinApprovalMode?: boolean;
|
|
53
|
+
isCommunity?: boolean;
|
|
54
|
+
isCommunityAnnounce?: boolean;
|
|
55
|
+
size?: number;
|
|
56
|
+
participants: GroupParticipant[];
|
|
57
|
+
ephemeralDuration?: number;
|
|
58
|
+
inviteCode?: string;
|
|
59
|
+
author?: string;
|
|
60
|
+
authorPn?: string;
|
|
61
|
+
expiredMetadata?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class StoreHandler {
|
|
65
|
+
ds: DataSource;
|
|
66
|
+
constructor(ds: DataSource);
|
|
67
|
+
init(): Promise<{
|
|
68
|
+
repos: {
|
|
69
|
+
chats: typeorm.Repository<Chat>;
|
|
70
|
+
groupMetadata: typeorm.Repository<GroupMetadata>;
|
|
71
|
+
contacts: typeorm.Repository<Contact>;
|
|
72
|
+
};
|
|
73
|
+
chats: {
|
|
74
|
+
chats: {};
|
|
75
|
+
get: (id: string) => Chat$1;
|
|
76
|
+
update: (id: string, update: Partial<Chat$1>) => Chat$1;
|
|
77
|
+
deleteById: (id: string) => boolean;
|
|
78
|
+
upsert: (messages?: Chat$1[]) => void;
|
|
79
|
+
all: () => Chat$1[];
|
|
80
|
+
clear: () => void;
|
|
81
|
+
};
|
|
82
|
+
contacts: Partial<{
|
|
83
|
+
[id: string]: Contact;
|
|
84
|
+
}>;
|
|
85
|
+
messages: {
|
|
86
|
+
[key: string]: {
|
|
87
|
+
messagesCache: node_cache;
|
|
88
|
+
get: (id: string) => WAMessage;
|
|
89
|
+
upsert: (item: WAMessage) => void;
|
|
90
|
+
update: (item: WAMessage) => boolean;
|
|
91
|
+
remove: (item: WAMessage) => boolean;
|
|
92
|
+
updateAssign: (id: string, update: Partial<WAMessage>) => boolean;
|
|
93
|
+
clear: () => void;
|
|
94
|
+
filter: (contain: (item: WAMessage) => boolean) => void;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
groupMetadata: {
|
|
98
|
+
[jid: string]: GroupMetadata;
|
|
99
|
+
};
|
|
100
|
+
presences: {};
|
|
101
|
+
bind: (ev: BaileysEventEmitter) => void;
|
|
102
|
+
loadMessage: (jid: string, id: string) => Promise<WAMessage>;
|
|
103
|
+
fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[]>;
|
|
104
|
+
fetchGroupMetadata: (jid: string, sock: Partial<{
|
|
105
|
+
groupMetadata: (jid: string) => Promise<GroupMetadata$1>;
|
|
106
|
+
}>, force?: boolean) => Promise<GroupMetadata>;
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class WbsSessions {
|
|
111
|
+
dbName: string;
|
|
112
|
+
auth: AuthHandler;
|
|
113
|
+
store: StoreHandler;
|
|
114
|
+
ds: DataSource;
|
|
115
|
+
constructor(dbName: string);
|
|
116
|
+
init(): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { WbsSessions as default };
|