@wildix/xbees-conversations-utils 1.0.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 +1 -0
- package/dist-cjs/index.js +6 -0
- package/dist-cjs/normalization.js +141 -0
- package/dist-cjs/stream.js +8 -0
- package/dist-cjs/types.js +8 -0
- package/dist-es/index.js +3 -0
- package/dist-es/normalization.js +132 -0
- package/dist-es/stream.js +5 -0
- package/dist-es/types.js +5 -0
- package/dist-types/index.d.ts +3 -0
- package/dist-types/normalization.d.ts +9 -0
- package/dist-types/stream.d.ts +94 -0
- package/dist-types/types.d.ts +22 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# TDB
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./normalization"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./stream"), exports);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeStreamChannel = exports.localizeStreamMessage = exports.normalizeStreamMessage = exports.normalizeStreamReaction = exports.localizeStreamUser = exports.normalizeStreamUser = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
function normalizeStreamUser(streamUser) {
|
|
6
|
+
return {
|
|
7
|
+
id: streamUser.id,
|
|
8
|
+
name: streamUser.name || undefined,
|
|
9
|
+
email: streamUser.email || undefined,
|
|
10
|
+
phone: streamUser.phone || undefined,
|
|
11
|
+
picture: streamUser.picture,
|
|
12
|
+
company: streamUser.company,
|
|
13
|
+
pbxDomain: streamUser.pbxDomain,
|
|
14
|
+
pbxPort: streamUser.pbxPort,
|
|
15
|
+
pbxExtension: streamUser.pbxExtension,
|
|
16
|
+
pbxSerial: streamUser.pbxSerial,
|
|
17
|
+
pbxUserId: streamUser.pbxUserId,
|
|
18
|
+
createdAt: streamUser.created_at,
|
|
19
|
+
updatedAt: streamUser.updated_at,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
exports.normalizeStreamUser = normalizeStreamUser;
|
|
23
|
+
function localizeStreamUser(streamUser) {
|
|
24
|
+
const normalizedUser = normalizeStreamUser(streamUser);
|
|
25
|
+
return {
|
|
26
|
+
...normalizedUser,
|
|
27
|
+
createdAt: new Date(streamUser.created_at),
|
|
28
|
+
updatedAt: new Date(streamUser.updated_at),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
exports.localizeStreamUser = localizeStreamUser;
|
|
32
|
+
function normalizeStreamReaction(streamReaction) {
|
|
33
|
+
const { type, message_id, user_id } = streamReaction;
|
|
34
|
+
return {
|
|
35
|
+
type,
|
|
36
|
+
userId: user_id,
|
|
37
|
+
messageId: message_id,
|
|
38
|
+
user: streamReaction.user ? normalizeStreamUser(streamReaction.user) : undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.normalizeStreamReaction = normalizeStreamReaction;
|
|
42
|
+
function normalizeStreamMessage(streamMessage, channelId) {
|
|
43
|
+
const { id, type, text, attachments, mentioned_users, giphy, quote, forward, latest_reactions, reaction_counts, edit, silent, event, } = streamMessage;
|
|
44
|
+
const user = normalizeStreamUser(streamMessage.user);
|
|
45
|
+
const latestReactions = latest_reactions ? latest_reactions.map(normalizeStreamReaction) : [];
|
|
46
|
+
return {
|
|
47
|
+
messageId: id,
|
|
48
|
+
channelId,
|
|
49
|
+
type: type,
|
|
50
|
+
text,
|
|
51
|
+
attachments,
|
|
52
|
+
mentions: mentioned_users ? mentioned_users.map(normalizeStreamUser) : [],
|
|
53
|
+
giphy,
|
|
54
|
+
latestReactions,
|
|
55
|
+
reactionCounts: reaction_counts || {},
|
|
56
|
+
createdAt: streamMessage.created_at,
|
|
57
|
+
updatedAt: streamMessage.updated_at !== streamMessage.created_at && streamMessage.updated_at ? streamMessage.updated_at : undefined,
|
|
58
|
+
user,
|
|
59
|
+
quote,
|
|
60
|
+
forward,
|
|
61
|
+
edit,
|
|
62
|
+
sms: streamMessage.sms,
|
|
63
|
+
smsStatus: streamMessage.sms_status,
|
|
64
|
+
silent,
|
|
65
|
+
event,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
exports.normalizeStreamMessage = normalizeStreamMessage;
|
|
69
|
+
function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
70
|
+
const normalizedMessage = normalizeStreamMessage(streamMessage, channelId);
|
|
71
|
+
const createdAt = new Date(normalizedMessage.createdAt);
|
|
72
|
+
const updatedAt = normalizedMessage.updatedAt ? new Date(normalizedMessage.updatedAt) : undefined;
|
|
73
|
+
const latestReactions = streamMessage.latest_reactions ? streamMessage.latest_reactions.map(normalizeStreamReaction) : [];
|
|
74
|
+
const ownReactionsFromLatestReactions = latestReactions.filter((r) => userId === r.userId);
|
|
75
|
+
const ownReactions = streamMessage.own_reactions ? streamMessage.own_reactions.map(normalizeStreamReaction).filter((r) => userId === r.userId) : [];
|
|
76
|
+
ownReactionsFromLatestReactions.forEach((reaction) => {
|
|
77
|
+
if (!ownReactions.find((ownReaction) => ownReaction.type === reaction.type)) {
|
|
78
|
+
ownReactions.push(reaction);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const direction = userId === streamMessage.user_id ? types_1.MessageDirection.OUTGOING : types_1.MessageDirection.INCOMING;
|
|
82
|
+
return {
|
|
83
|
+
...normalizedMessage,
|
|
84
|
+
user: localizeStreamUser(streamMessage.user),
|
|
85
|
+
ownReactions,
|
|
86
|
+
direction,
|
|
87
|
+
createdAt,
|
|
88
|
+
updatedAt,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
exports.localizeStreamMessage = localizeStreamMessage;
|
|
92
|
+
function normalizeStreamChannel(channel) {
|
|
93
|
+
const { data } = channel;
|
|
94
|
+
if (!data) {
|
|
95
|
+
throw new Error(`Illegal channel data`);
|
|
96
|
+
}
|
|
97
|
+
let context = undefined;
|
|
98
|
+
if (data.context) {
|
|
99
|
+
try {
|
|
100
|
+
context = JSON.parse(data.context);
|
|
101
|
+
}
|
|
102
|
+
catch (e) { }
|
|
103
|
+
}
|
|
104
|
+
let assignee = undefined;
|
|
105
|
+
if (data.assignee) {
|
|
106
|
+
try {
|
|
107
|
+
assignee = JSON.parse(data.assignee);
|
|
108
|
+
}
|
|
109
|
+
catch (e) { }
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
channelId: data.id,
|
|
113
|
+
channelType: data.type,
|
|
114
|
+
memberCount: data.member_count || 0,
|
|
115
|
+
subject: data.subject,
|
|
116
|
+
description: data.description,
|
|
117
|
+
picture: data.picture,
|
|
118
|
+
pictureColor: data.picture_color,
|
|
119
|
+
access: data.access,
|
|
120
|
+
company: data.company,
|
|
121
|
+
context,
|
|
122
|
+
kite: data.kite,
|
|
123
|
+
kiteTarget: data.kite_target,
|
|
124
|
+
kiteVariant: data.kite_variant,
|
|
125
|
+
kiteAssign: data.kite_assign,
|
|
126
|
+
kiteServiceName: data.kite_service_name,
|
|
127
|
+
kiteDefaultSubject: data.kite_default_subject,
|
|
128
|
+
service: data.service,
|
|
129
|
+
serviceTitle: data.service_title,
|
|
130
|
+
serviceRecipient: data.service_recipient,
|
|
131
|
+
assignee,
|
|
132
|
+
telephony: data.telephony,
|
|
133
|
+
sms: data.sms,
|
|
134
|
+
broadcast: data.broadcast || data.is_broadcast,
|
|
135
|
+
external: data.external,
|
|
136
|
+
createdAt: data.created_at,
|
|
137
|
+
createdBy: data.created_by_id,
|
|
138
|
+
updatedAt: data.updated_at,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
exports.normalizeStreamChannel = normalizeStreamChannel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamChannelAccess = void 0;
|
|
4
|
+
var StreamChannelAccess;
|
|
5
|
+
(function (StreamChannelAccess) {
|
|
6
|
+
StreamChannelAccess["PRIVATE"] = "private";
|
|
7
|
+
StreamChannelAccess["PUBLIC"] = "public";
|
|
8
|
+
})(StreamChannelAccess = exports.StreamChannelAccess || (exports.StreamChannelAccess = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageDirection = void 0;
|
|
4
|
+
var MessageDirection;
|
|
5
|
+
(function (MessageDirection) {
|
|
6
|
+
MessageDirection["INCOMING"] = "incoming";
|
|
7
|
+
MessageDirection["OUTGOING"] = "outgoing";
|
|
8
|
+
})(MessageDirection = exports.MessageDirection || (exports.MessageDirection = {}));
|
package/dist-es/index.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { MessageDirection } from "./types";
|
|
2
|
+
export function normalizeStreamUser(streamUser) {
|
|
3
|
+
return {
|
|
4
|
+
id: streamUser.id,
|
|
5
|
+
name: streamUser.name || undefined,
|
|
6
|
+
email: streamUser.email || undefined,
|
|
7
|
+
phone: streamUser.phone || undefined,
|
|
8
|
+
picture: streamUser.picture,
|
|
9
|
+
company: streamUser.company,
|
|
10
|
+
pbxDomain: streamUser.pbxDomain,
|
|
11
|
+
pbxPort: streamUser.pbxPort,
|
|
12
|
+
pbxExtension: streamUser.pbxExtension,
|
|
13
|
+
pbxSerial: streamUser.pbxSerial,
|
|
14
|
+
pbxUserId: streamUser.pbxUserId,
|
|
15
|
+
createdAt: streamUser.created_at,
|
|
16
|
+
updatedAt: streamUser.updated_at,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function localizeStreamUser(streamUser) {
|
|
20
|
+
const normalizedUser = normalizeStreamUser(streamUser);
|
|
21
|
+
return {
|
|
22
|
+
...normalizedUser,
|
|
23
|
+
createdAt: new Date(streamUser.created_at),
|
|
24
|
+
updatedAt: new Date(streamUser.updated_at),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function normalizeStreamReaction(streamReaction) {
|
|
28
|
+
const { type, message_id, user_id } = streamReaction;
|
|
29
|
+
return {
|
|
30
|
+
type,
|
|
31
|
+
userId: user_id,
|
|
32
|
+
messageId: message_id,
|
|
33
|
+
user: streamReaction.user ? normalizeStreamUser(streamReaction.user) : undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function normalizeStreamMessage(streamMessage, channelId) {
|
|
37
|
+
const { id, type, text, attachments, mentioned_users, giphy, quote, forward, latest_reactions, reaction_counts, edit, silent, event, } = streamMessage;
|
|
38
|
+
const user = normalizeStreamUser(streamMessage.user);
|
|
39
|
+
const latestReactions = latest_reactions ? latest_reactions.map(normalizeStreamReaction) : [];
|
|
40
|
+
return {
|
|
41
|
+
messageId: id,
|
|
42
|
+
channelId,
|
|
43
|
+
type: type,
|
|
44
|
+
text,
|
|
45
|
+
attachments,
|
|
46
|
+
mentions: mentioned_users ? mentioned_users.map(normalizeStreamUser) : [],
|
|
47
|
+
giphy,
|
|
48
|
+
latestReactions,
|
|
49
|
+
reactionCounts: reaction_counts || {},
|
|
50
|
+
createdAt: streamMessage.created_at,
|
|
51
|
+
updatedAt: streamMessage.updated_at !== streamMessage.created_at && streamMessage.updated_at ? streamMessage.updated_at : undefined,
|
|
52
|
+
user,
|
|
53
|
+
quote,
|
|
54
|
+
forward,
|
|
55
|
+
edit,
|
|
56
|
+
sms: streamMessage.sms,
|
|
57
|
+
smsStatus: streamMessage.sms_status,
|
|
58
|
+
silent,
|
|
59
|
+
event,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
63
|
+
const normalizedMessage = normalizeStreamMessage(streamMessage, channelId);
|
|
64
|
+
const createdAt = new Date(normalizedMessage.createdAt);
|
|
65
|
+
const updatedAt = normalizedMessage.updatedAt ? new Date(normalizedMessage.updatedAt) : undefined;
|
|
66
|
+
const latestReactions = streamMessage.latest_reactions ? streamMessage.latest_reactions.map(normalizeStreamReaction) : [];
|
|
67
|
+
const ownReactionsFromLatestReactions = latestReactions.filter((r) => userId === r.userId);
|
|
68
|
+
const ownReactions = streamMessage.own_reactions ? streamMessage.own_reactions.map(normalizeStreamReaction).filter((r) => userId === r.userId) : [];
|
|
69
|
+
ownReactionsFromLatestReactions.forEach((reaction) => {
|
|
70
|
+
if (!ownReactions.find((ownReaction) => ownReaction.type === reaction.type)) {
|
|
71
|
+
ownReactions.push(reaction);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const direction = userId === streamMessage.user_id ? MessageDirection.OUTGOING : MessageDirection.INCOMING;
|
|
75
|
+
return {
|
|
76
|
+
...normalizedMessage,
|
|
77
|
+
user: localizeStreamUser(streamMessage.user),
|
|
78
|
+
ownReactions,
|
|
79
|
+
direction,
|
|
80
|
+
createdAt,
|
|
81
|
+
updatedAt,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export function normalizeStreamChannel(channel) {
|
|
85
|
+
const { data } = channel;
|
|
86
|
+
if (!data) {
|
|
87
|
+
throw new Error(`Illegal channel data`);
|
|
88
|
+
}
|
|
89
|
+
let context = undefined;
|
|
90
|
+
if (data.context) {
|
|
91
|
+
try {
|
|
92
|
+
context = JSON.parse(data.context);
|
|
93
|
+
}
|
|
94
|
+
catch (e) { }
|
|
95
|
+
}
|
|
96
|
+
let assignee = undefined;
|
|
97
|
+
if (data.assignee) {
|
|
98
|
+
try {
|
|
99
|
+
assignee = JSON.parse(data.assignee);
|
|
100
|
+
}
|
|
101
|
+
catch (e) { }
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
channelId: data.id,
|
|
105
|
+
channelType: data.type,
|
|
106
|
+
memberCount: data.member_count || 0,
|
|
107
|
+
subject: data.subject,
|
|
108
|
+
description: data.description,
|
|
109
|
+
picture: data.picture,
|
|
110
|
+
pictureColor: data.picture_color,
|
|
111
|
+
access: data.access,
|
|
112
|
+
company: data.company,
|
|
113
|
+
context,
|
|
114
|
+
kite: data.kite,
|
|
115
|
+
kiteTarget: data.kite_target,
|
|
116
|
+
kiteVariant: data.kite_variant,
|
|
117
|
+
kiteAssign: data.kite_assign,
|
|
118
|
+
kiteServiceName: data.kite_service_name,
|
|
119
|
+
kiteDefaultSubject: data.kite_default_subject,
|
|
120
|
+
service: data.service,
|
|
121
|
+
serviceTitle: data.service_title,
|
|
122
|
+
serviceRecipient: data.service_recipient,
|
|
123
|
+
assignee,
|
|
124
|
+
telephony: data.telephony,
|
|
125
|
+
sms: data.sms,
|
|
126
|
+
broadcast: data.broadcast || data.is_broadcast,
|
|
127
|
+
external: data.external,
|
|
128
|
+
createdAt: data.created_at,
|
|
129
|
+
createdBy: data.created_by_id,
|
|
130
|
+
updatedAt: data.updated_at,
|
|
131
|
+
};
|
|
132
|
+
}
|
package/dist-es/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StreamChannel, StreamMessageResponse, StreamReactionResponse, StreamUserResponse } from "./stream";
|
|
2
|
+
import { LocalizedMessage, LocalizedUser } from "./types";
|
|
3
|
+
import { Channel, Message, Reaction, User } from "@wildix/xbees-conversations-client";
|
|
4
|
+
export declare function normalizeStreamUser(streamUser: StreamUserResponse): User;
|
|
5
|
+
export declare function localizeStreamUser(streamUser: StreamUserResponse): LocalizedUser;
|
|
6
|
+
export declare function normalizeStreamReaction(streamReaction: StreamReactionResponse): Reaction;
|
|
7
|
+
export declare function normalizeStreamMessage(streamMessage: StreamMessageResponse, channelId: string): Message;
|
|
8
|
+
export declare function localizeStreamMessage(streamMessage: StreamMessageResponse, channelId: string, userId: string): LocalizedMessage;
|
|
9
|
+
export declare function normalizeStreamChannel(channel: StreamChannel): Channel;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Channel, ChannelData, ChannelFilters, ChannelMembership, ChannelSort, ChannelResponse, Event, ExtendableGenerics, LiteralStringForUnion, Message, MessageResponse, ReactionResponse, UR, UserResponse, ChannelAPIResponse, User, Reaction } from 'stream-chat';
|
|
2
|
+
import { Message as MessageNormalized, MessageForward, MessageAttachment, MessageGiphy } from "@wildix/xbees-conversations-client";
|
|
3
|
+
export declare enum StreamChannelAccess {
|
|
4
|
+
PRIVATE = "private",
|
|
5
|
+
PUBLIC = "public"
|
|
6
|
+
}
|
|
7
|
+
export interface StreamChannelFields extends UR {
|
|
8
|
+
subject?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
picture?: string;
|
|
11
|
+
picture_color?: string;
|
|
12
|
+
access?: StreamChannelAccess;
|
|
13
|
+
company?: string;
|
|
14
|
+
context?: string;
|
|
15
|
+
kite?: boolean;
|
|
16
|
+
kite_target?: string;
|
|
17
|
+
kite_variant?: string;
|
|
18
|
+
kite_assign?: string;
|
|
19
|
+
kite_service_name?: string;
|
|
20
|
+
kite_default_subject?: string;
|
|
21
|
+
service?: string;
|
|
22
|
+
service_title?: string;
|
|
23
|
+
service_recipient?: string;
|
|
24
|
+
assignee?: string;
|
|
25
|
+
telephony?: boolean;
|
|
26
|
+
sms?: boolean;
|
|
27
|
+
broadcast?: boolean;
|
|
28
|
+
is_broadcast?: boolean;
|
|
29
|
+
external?: boolean;
|
|
30
|
+
unreadMarkUsers?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface StreamType extends ExtendableGenerics {
|
|
33
|
+
attachmentType: StreamAttachmentFields;
|
|
34
|
+
channelType: StreamChannelFields;
|
|
35
|
+
commandType: LiteralStringForUnion;
|
|
36
|
+
eventType: StreamEventFields;
|
|
37
|
+
messageType: StreamMessageFields;
|
|
38
|
+
userType: StreamUserFields;
|
|
39
|
+
}
|
|
40
|
+
export interface StreamEventFields extends UR {
|
|
41
|
+
members?: StreamChannelMembership[];
|
|
42
|
+
}
|
|
43
|
+
export interface StreamMessageFields extends UR {
|
|
44
|
+
type: 'regular' | 'system';
|
|
45
|
+
quote?: MessageNormalized;
|
|
46
|
+
forward?: MessageForward;
|
|
47
|
+
giphy?: MessageGiphy;
|
|
48
|
+
edit?: boolean;
|
|
49
|
+
event?: string;
|
|
50
|
+
attachments?: MessageAttachment[];
|
|
51
|
+
sms?: boolean;
|
|
52
|
+
sms_status?: 'CONNECTING' | 'TALKING' | 'HOLD';
|
|
53
|
+
created_at: string;
|
|
54
|
+
updated_at: string;
|
|
55
|
+
}
|
|
56
|
+
export interface StreamAttachmentFields extends UR {
|
|
57
|
+
id: string;
|
|
58
|
+
fisId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
size: number;
|
|
61
|
+
}
|
|
62
|
+
export interface StreamUserFields extends UR {
|
|
63
|
+
email?: string;
|
|
64
|
+
phone?: string;
|
|
65
|
+
picture: string;
|
|
66
|
+
online: boolean;
|
|
67
|
+
banned: boolean;
|
|
68
|
+
company: string;
|
|
69
|
+
pbxSerial: string;
|
|
70
|
+
pbxPort: string;
|
|
71
|
+
pbxDomain: string;
|
|
72
|
+
pbxUserId: string;
|
|
73
|
+
pbxUpdatedAt?: string;
|
|
74
|
+
pbxExtension: string;
|
|
75
|
+
created_at: string;
|
|
76
|
+
updated_at: string;
|
|
77
|
+
last_active: string;
|
|
78
|
+
locale?: string;
|
|
79
|
+
timeZone?: string;
|
|
80
|
+
}
|
|
81
|
+
export type StreamEvent = Event<StreamType>;
|
|
82
|
+
export type StreamReaction = Reaction<StreamType>;
|
|
83
|
+
export type StreamReactionResponse = ReactionResponse<StreamType>;
|
|
84
|
+
export type StreamMessage = Message<StreamType>;
|
|
85
|
+
export type StreamMessageResponse = MessageResponse<StreamType>;
|
|
86
|
+
export type StreamChannel = Channel<StreamType>;
|
|
87
|
+
export type StreamChannelResponse = ChannelResponse<StreamType>;
|
|
88
|
+
export type StreamUser = User<StreamType>;
|
|
89
|
+
export type StreamUserResponse = UserResponse<StreamType>;
|
|
90
|
+
export type StreamChannelMembership = ChannelMembership<StreamType>;
|
|
91
|
+
export type StreamChannelFilters = ChannelFilters<StreamType>;
|
|
92
|
+
export type StreamChannelSort = ChannelSort<StreamType>;
|
|
93
|
+
export type StreamChannelData = ChannelData<StreamType>;
|
|
94
|
+
export type StreamChannelAPIResponse = ChannelAPIResponse<StreamType>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Channel, ChannelMemberRole, Message, Reaction, User } from "@wildix/xbees-conversations-client";
|
|
2
|
+
export declare enum MessageDirection {
|
|
3
|
+
INCOMING = "incoming",
|
|
4
|
+
OUTGOING = "outgoing"
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizedUser extends Omit<User, 'createdAt' | 'updatedAt'> {
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
export interface LocalizedMessage extends Omit<Message, 'user' | 'createdAt' | 'updatedAt'> {
|
|
11
|
+
user: LocalizedUser;
|
|
12
|
+
ownReactions: Reaction[];
|
|
13
|
+
direction: MessageDirection;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
}
|
|
17
|
+
export interface LocalizedChannel extends Omit<Channel, 'createdAt' | 'updatedAt'> {
|
|
18
|
+
userId?: string;
|
|
19
|
+
role: ChannelMemberRole;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
updatedAt?: Date;
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wildix/xbees-conversations-utils",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist-cjs/index.js",
|
|
6
|
+
"module": "./dist-es/index.js",
|
|
7
|
+
"types": "./dist-types/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
10
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
11
|
+
"build:es": "tsc -p tsconfig.es.json",
|
|
12
|
+
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
13
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
14
|
+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
15
|
+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=14.0.0"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@wildix/xbees-conversations-client": "^1.0.21",
|
|
23
|
+
"stream-chat": "8.12.1",
|
|
24
|
+
"tslib": "^2.5.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@tsconfig/recommended": "1.0.1",
|
|
28
|
+
"concurrently": "7.0.0",
|
|
29
|
+
"downlevel-dts": "0.10.1",
|
|
30
|
+
"rimraf": "3.0.2",
|
|
31
|
+
"typescript": "~4.9.5"
|
|
32
|
+
},
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"<4.0": {
|
|
35
|
+
"dist-types/*": [
|
|
36
|
+
"dist-types/ts3.4/*"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist-*/**"
|
|
42
|
+
]
|
|
43
|
+
}
|