@wildix/xbees-conversations-utils 1.0.5 → 1.0.7
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.
|
@@ -90,7 +90,13 @@ function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
90
90
|
}
|
|
91
91
|
exports.localizeStreamMessage = localizeStreamMessage;
|
|
92
92
|
function normalizeStreamChannel(channel) {
|
|
93
|
-
|
|
93
|
+
let data;
|
|
94
|
+
if (channel.data) {
|
|
95
|
+
data = channel.data;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
data = channel;
|
|
99
|
+
}
|
|
94
100
|
if (!data) {
|
|
95
101
|
throw new Error(`Illegal channel data`);
|
|
96
102
|
}
|
|
@@ -103,10 +109,7 @@ function normalizeStreamChannel(channel) {
|
|
|
103
109
|
}
|
|
104
110
|
let assignee = undefined;
|
|
105
111
|
if (data.assignee) {
|
|
106
|
-
|
|
107
|
-
assignee = JSON.parse(data.assignee);
|
|
108
|
-
}
|
|
109
|
-
catch (e) { }
|
|
112
|
+
assignee = data.assignee;
|
|
110
113
|
}
|
|
111
114
|
return {
|
|
112
115
|
channelId: data.id,
|
package/dist-es/normalization.js
CHANGED
|
@@ -82,7 +82,13 @@ export function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
export function normalizeStreamChannel(channel) {
|
|
85
|
-
|
|
85
|
+
let data;
|
|
86
|
+
if (channel.data) {
|
|
87
|
+
data = channel.data;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
data = channel;
|
|
91
|
+
}
|
|
86
92
|
if (!data) {
|
|
87
93
|
throw new Error(`Illegal channel data`);
|
|
88
94
|
}
|
|
@@ -95,10 +101,7 @@ export function normalizeStreamChannel(channel) {
|
|
|
95
101
|
}
|
|
96
102
|
let assignee = undefined;
|
|
97
103
|
if (data.assignee) {
|
|
98
|
-
|
|
99
|
-
assignee = JSON.parse(data.assignee);
|
|
100
|
-
}
|
|
101
|
-
catch (e) { }
|
|
104
|
+
assignee = data.assignee;
|
|
102
105
|
}
|
|
103
106
|
return {
|
|
104
107
|
channelId: data.id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StreamChannel, StreamMessageResponse, StreamReactionResponse, StreamUserResponse } from "./stream";
|
|
1
|
+
import { StreamChannel, StreamMessageResponse, StreamReactionResponse, StreamUserResponse, StreamChannelResponse } from "./stream";
|
|
2
2
|
import { LocalizedMessage, LocalizedUser } from "./types";
|
|
3
3
|
import { Channel, Message, Reaction, User } from "@wildix/xbees-conversations-client";
|
|
4
4
|
export declare function normalizeStreamUser(streamUser: StreamUserResponse): User;
|
|
@@ -6,4 +6,4 @@ export declare function localizeStreamUser(streamUser: StreamUserResponse): Loca
|
|
|
6
6
|
export declare function normalizeStreamReaction(streamReaction: StreamReactionResponse): Reaction;
|
|
7
7
|
export declare function normalizeStreamMessage(streamMessage: StreamMessageResponse, channelId: string): Message;
|
|
8
8
|
export declare function localizeStreamMessage(streamMessage: StreamMessageResponse, channelId: string, userId: string): LocalizedMessage;
|
|
9
|
-
export declare function normalizeStreamChannel(channel: StreamChannel): Channel;
|
|
9
|
+
export declare function normalizeStreamChannel(channel: StreamChannel | StreamChannelResponse): Channel;
|
package/dist-types/stream.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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";
|
|
2
|
+
import { Message as MessageNormalized, MessageForward, MessageAttachment, MessageGiphy, User as NormalizedUser } from "@wildix/xbees-conversations-client";
|
|
3
3
|
export declare enum StreamChannelAccess {
|
|
4
4
|
PRIVATE = "private",
|
|
5
5
|
PUBLIC = "public"
|
|
@@ -21,7 +21,7 @@ export interface StreamChannelFields extends UR {
|
|
|
21
21
|
service?: string;
|
|
22
22
|
service_title?: string;
|
|
23
23
|
service_recipient?: string;
|
|
24
|
-
assignee?:
|
|
24
|
+
assignee?: NormalizedUser;
|
|
25
25
|
telephony?: boolean;
|
|
26
26
|
sms?: boolean;
|
|
27
27
|
broadcast?: boolean;
|