Skip to content

Commit

Permalink
fix: socket events
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed May 17, 2024
1 parent ec62707 commit adba660
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 4 deletions.
6 changes: 6 additions & 0 deletions dist/browser/socket/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/browser/socket/index.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dist/node/socket/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/node/socket/index.js.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions dist/types/socket/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ export interface SocketItemFavorite {
value: 0 | 1;
metadata: string;
}
export interface SocketChatConversationParticipantNew {
conversation: string;
userId: number;
email: string;
avatar: string | null;
nickName: string | null;
metadata: string;
permissionsAdd: boolean;
addedTimestamp: number;
}
export type SocketEvent = {
type: "newEvent";
data: SocketNewEvent;
Expand Down Expand Up @@ -303,6 +313,9 @@ export type SocketEvent = {
} | {
type: "itemFavorite";
data: SocketItemFavorite;
} | {
type: "chatConversationParticipantNew";
data: SocketChatConversationParticipantNew;
};
/**
* Socket
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@filen/sdk",
"version": "0.1.78",
"version": "0.1.79",
"description": "Filen SDK",
"main": "dist/node/index.js",
"browser": "dist/browser/index.js",
Expand All @@ -26,7 +26,7 @@
"filen"
],
"engines": {
"node": "^18"
"node": ">=18"
},
"author": "Filen",
"license": "AGPLv3",
Expand Down
22 changes: 22 additions & 0 deletions src/socket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ export interface SocketItemFavorite {
metadata: string
}

export interface SocketChatConversationParticipantNew {
conversation: string
userId: number
email: string
avatar: string | null
nickName: string | null
metadata: string
permissionsAdd: boolean
addedTimestamp: number
}

export type SocketEvent =
| {
type: "newEvent"
Expand Down Expand Up @@ -375,6 +386,10 @@ export type SocketEvent =
type: "itemFavorite"
data: SocketItemFavorite
}
| {
type: "chatConversationParticipantNew"
data: SocketChatConversationParticipantNew
}

/**
* Socket
Expand Down Expand Up @@ -815,6 +830,13 @@ export class Socket extends EventEmitter {
data
} as SocketEvent)
})

this.socket.on("chatConversationParticipantNew", (data: SocketChatConversationParticipantNew) => {
this.emit("socketEvent", {
type: "chatConversationParticipantNew",
data
} as SocketEvent)
})
}

/**
Expand Down

0 comments on commit adba660

Please sign in to comment.