Skip to content

Commit 69147a1

Browse files
committed
feat: added free function to wrappers
clears wrappers that are stored in memory and haven't been saved to the database yet, there is no direct call to libsession
1 parent 2e5be95 commit 69147a1

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

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<UserConfigWrapper, '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<UserConfigWrapper, '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<UserConfigWrapper, 'free'>
8588
| MakeActionCall<UserGroupsWrapper, 'getCommunityByFullUrl'>
8689
| MakeActionCall<UserGroupsWrapper, 'setCommunityByFullUrl'>
8790
| MakeActionCall<UserGroupsWrapper, 'getAllCommunities'>

0 commit comments

Comments
 (0)