Skip to content

Commit df3a273

Browse files
authored
Merge pull request #16 from yougotwill/feat/ses-899/free_the_wrappers_from_this_torment
Add free() to libsession wrappers
2 parents d230239 + f4ea6d5 commit df3a273

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/build/
22
/.vscode/
3+
/.vscrof/
34
/node_modules/
45
/*.tar.gz
56
/package-lock.json

user/contacts.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
declare module 'libsession_util_nodejs' {
77
type ContactsWrapper = BaseConfigWrapper & {
88
init: (secretKey: Uint8Array, dump: Uint8Array | null) => void;
9+
/** This function is used to free wrappers from memory only */
10+
free: () => void;
911
get: (pubkeyHex: string) => ContactInfo | null;
1012
set: (contact: ContactInfoSet) => void;
1113
getAll: () => Array<ContactInfo>;
@@ -55,6 +57,7 @@ declare module 'libsession_util_nodejs' {
5557

5658
export type ContactsConfigActionsType =
5759
| ['init', Uint8Array, Uint8Array | null]
60+
| MakeActionCall<ContactsWrapper, 'free'>
5861
| MakeActionCall<ContactsWrapper, 'get'>
5962
| MakeActionCall<ContactsWrapper, 'set'>
6063
| MakeActionCall<ContactsWrapper, 'getAll'>

user/convovolatile.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ declare module 'libsession_util_nodejs' {
1414

1515
type ConvoInfoVolatileWrapper = BaseConfigWrapper & {
1616
init: (secretKey: Uint8Array, dump: Uint8Array | null) => void;
17+
/** This function is used to free wrappers from memory only */
18+
free: () => void;
1719

1820
// 1o1 related methods
1921
get1o1: (pubkeyHex: string) => ConvoInfoVolatile1o1 | null;
@@ -60,6 +62,7 @@ declare module 'libsession_util_nodejs' {
6062

6163
export type ConvoInfoVolatileConfigActionsType =
6264
| ['init', Uint8Array, Uint8Array | null]
65+
| MakeActionCall<ConvoInfoVolatileWrapper, 'free'>
6366
| MakeActionCall<ConvoInfoVolatileWrapper, 'get1o1'>
6467
| MakeActionCall<ConvoInfoVolatileWrapper, 'getAll1o1'>
6568
| MakeActionCall<ConvoInfoVolatileWrapper, 'set1o1'>

user/userconfig.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ declare module 'libsession_util_nodejs' {
77

88
type UserConfigWrapper = BaseConfigWrapper & {
99
init: (secretKey: Uint8Array, dump: Uint8Array | null) => void;
10+
/** This function is used to free wrappers from memory only */
11+
free: () => void;
1012
getUserInfo: () => {
1113
name: string;
1214
priority: number;
@@ -49,6 +51,7 @@ declare module 'libsession_util_nodejs' {
4951
*/
5052
export type UserConfigActionsType =
5153
| ['init', Uint8Array, Uint8Array | null]
54+
| MakeActionCall<UserConfigWrapper, 'free'>
5255
| MakeActionCall<UserConfigWrapper, 'getUserInfo'>
5356
| MakeActionCall<UserConfigWrapper, 'setUserInfo'>
5457
| MakeActionCall<UserConfigWrapper, 'getEnableBlindedMsgRequest'>

user/usergroups.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ declare module 'libsession_util_nodejs' {
3737

3838
type UserGroupsWrapper = BaseConfigWrapper & {
3939
init: (secretKey: Uint8Array, dump: Uint8Array | null) => void;
40+
/** This function is used to free wrappers from memory only */
41+
free: () => void;
4042

4143
// Communities related methods
4244
/** Note: can have the pubkey argument set or not. */
@@ -82,6 +84,7 @@ declare module 'libsession_util_nodejs' {
8284

8385
export type UserGroupsConfigActionsType =
8486
| ['init', Uint8Array, Uint8Array | null]
87+
| MakeActionCall<UserGroupsWrapper, 'free'>
8588
| MakeActionCall<UserGroupsWrapper, 'getCommunityByFullUrl'>
8689
| MakeActionCall<UserGroupsWrapper, 'setCommunityByFullUrl'>
8790
| MakeActionCall<UserGroupsWrapper, 'getAllCommunities'>

0 commit comments

Comments
 (0)