@wildix/xbees-conversations-utils 1.0.6 → 1.0.8
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,
|
|
@@ -131,6 +134,7 @@ function normalizeStreamChannel(channel) {
|
|
|
131
134
|
assignee,
|
|
132
135
|
telephony: data.telephony,
|
|
133
136
|
sms: data.sms,
|
|
137
|
+
mms: data.mms,
|
|
134
138
|
broadcast: data.broadcast || data.is_broadcast,
|
|
135
139
|
external: data.external,
|
|
136
140
|
createdAt: data.created_at,
|
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,
|
|
@@ -123,6 +126,7 @@ export function normalizeStreamChannel(channel) {
|
|
|
123
126
|
assignee,
|
|
124
127
|
telephony: data.telephony,
|
|
125
128
|
sms: data.sms,
|
|
129
|
+
mms: data.mms,
|
|
126
130
|
broadcast: data.broadcast || data.is_broadcast,
|
|
127
131
|
external: data.external,
|
|
128
132
|
createdAt: data.created_at,
|
|
@@ -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,9 +21,10 @@ 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
|
+
mms?: boolean;
|
|
27
28
|
broadcast?: boolean;
|
|
28
29
|
is_broadcast?: boolean;
|
|
29
30
|
external?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-conversations-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
13
13
|
"build:types": "tsc -p tsconfig.types.json",
|
|
14
14
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
15
|
+
"build:api-extractor": "mkdir -p etc && api-extractor run --local --verbose",
|
|
15
16
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo"
|
|
16
17
|
},
|
|
17
18
|
"engines": {
|