Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stream): fix inconsistent timestamp type in sdk & socket #1230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions packages/restapi/src/lib/pushstream/DataModifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
VideoEventType,
MessageOrigin,
VideoEvent,
GroupEventBase
} from './pushStreamTypes';
import { VideoCallStatus, VideoPeerInfo } from '../types';
import { VideoDataType } from '../video';
Expand Down Expand Up @@ -183,7 +184,7 @@ export class DataModifier {
includeRaw
);

const groupEvent: any = {
const groupEvent: GroupEventBase = {
event: eventType,
origin: incomingData.messageOrigin,
timestamp: incomingData.timestamp,
Expand Down Expand Up @@ -233,7 +234,7 @@ export class DataModifier {
const messageEvent: MessageEvent = {
event: eventType,
origin: data.messageOrigin,
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
chatId: data.chatId, // TODO: ChatId not working for w2w
from: data.fromCAIP10,
to: [data.toCAIP10], // TODO: Assuming 'to' is an array in MessageEvent. Update as necessary.
Expand Down Expand Up @@ -496,7 +497,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
meta: {
Expand Down Expand Up @@ -541,7 +542,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
meta: {
Expand Down Expand Up @@ -602,7 +603,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: any;
timestamp: number;
spaceId: any;
from: any;
to: any[];
Expand Down Expand Up @@ -633,7 +634,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand All @@ -645,7 +646,7 @@ export class DataModifier {
const baseEventData: BaseEventData = {
event: 'reject',
origin: data.messageOrigin === 'other' ? 'other' : 'self',
timestamp: data.timestamp.toString(),
timestamp: data.timestamp,
spaceId: data.chatId,
from: data.fromCAIP10,
to: null,
Expand All @@ -664,7 +665,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand Down Expand Up @@ -692,7 +693,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand Down Expand Up @@ -720,7 +721,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand Down Expand Up @@ -748,7 +749,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand Down Expand Up @@ -776,7 +777,7 @@ export class DataModifier {
type BaseEventData = {
event: string;
origin: string;
timestamp: string;
timestamp: number;
spaceId: string;
from: string;
to: null;
Expand Down
12 changes: 6 additions & 6 deletions packages/restapi/src/lib/pushstream/pushStreamTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export interface GroupEventRawData {

export interface GroupEventBase {
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
meta: GroupMeta;
Expand All @@ -151,7 +151,7 @@ export interface UpdateGroupEvent extends GroupEventBase {
export interface GroupMemberEventBase {
event: GroupEventType | MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
to: string[];
Expand Down Expand Up @@ -185,7 +185,7 @@ export interface RoleEvent extends GroupMemberEventBase {
export interface SpaceMemberEventBase {
event: SpaceEventType | MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
spaceId: string;
from: string;
to: string[];
Expand All @@ -211,7 +211,7 @@ export interface SpaceRemoveEvent extends SpaceMemberEventBase {
export interface MessageEvent {
event: MessageEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
chatId: string;
from: string;
to: string[];
Expand Down Expand Up @@ -239,7 +239,7 @@ export type NotificationType = keyof typeof NOTIFICATION.TYPE;
export interface NotificationEvent {
event: NotificationEventType;
origin: 'other' | 'self';
timestamp: string;
timestamp: number
from: string;
to: string[];
notifID: string;
Expand Down Expand Up @@ -298,7 +298,7 @@ export interface MessageRawData {
export interface VideoEvent {
event: VideoEventType;
origin: MessageOrigin;
timestamp: string;
timestamp: number
peerInfo: VideoPeerInfo;
raw?: GroupEventRawData;
}
Expand Down
Loading