@wildix/xbees-conversations-utils 1.0.14 → 1.0.15
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/dist-cjs/normalization.js +14 -1
- package/dist-cjs/stream.js +0 -6
- package/dist-es/normalization.js +12 -0
- package/dist-es/stream.js +1 -5
- package/dist-types/normalization.d.ts +3 -2
- package/dist-types/stream.d.ts +16 -8
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeStreamChannel = exports.localizeStreamMessage = exports.normalizeStreamMessage = exports.normalizeStreamReaction = exports.localizeStreamUser = exports.normalizeStreamUser = void 0;
|
|
3
|
+
exports.normalizeStreamMember = exports.normalizeStreamChannel = exports.localizeStreamMessage = exports.normalizeStreamMessage = exports.normalizeStreamReaction = exports.localizeStreamUser = exports.normalizeStreamUser = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
function normalizeStreamUser(streamUser) {
|
|
6
6
|
return {
|
|
@@ -63,6 +63,8 @@ function normalizeStreamMessage(streamMessage, channelId) {
|
|
|
63
63
|
edit,
|
|
64
64
|
sms: streamMessage.sms,
|
|
65
65
|
smsStatus: streamMessage.sms_status,
|
|
66
|
+
whatsapp: streamMessage.whatsapp,
|
|
67
|
+
whatsappStatus: streamMessage.whatsapp_status,
|
|
66
68
|
silent,
|
|
67
69
|
event,
|
|
68
70
|
};
|
|
@@ -137,6 +139,8 @@ function normalizeStreamChannel(channel) {
|
|
|
137
139
|
telephony: data.telephony,
|
|
138
140
|
sms: data.sms,
|
|
139
141
|
mms: data.mms,
|
|
142
|
+
whatsapp: data.whatsapp,
|
|
143
|
+
whatsappStatus: data.whatsapp_status,
|
|
140
144
|
broadcast: data.broadcast || data.is_broadcast,
|
|
141
145
|
external: data.external,
|
|
142
146
|
createdAt: data.created_at,
|
|
@@ -145,3 +149,12 @@ function normalizeStreamChannel(channel) {
|
|
|
145
149
|
};
|
|
146
150
|
}
|
|
147
151
|
exports.normalizeStreamChannel = normalizeStreamChannel;
|
|
152
|
+
function normalizeStreamMember(member) {
|
|
153
|
+
const { role, user_id, created_at } = member;
|
|
154
|
+
return {
|
|
155
|
+
id: user_id,
|
|
156
|
+
createdAt: created_at,
|
|
157
|
+
role: (role || 'member'),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
exports.normalizeStreamMember = normalizeStreamMember;
|
package/dist-cjs/stream.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
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 = {}));
|
package/dist-es/normalization.js
CHANGED
|
@@ -57,6 +57,8 @@ export function normalizeStreamMessage(streamMessage, channelId) {
|
|
|
57
57
|
edit,
|
|
58
58
|
sms: streamMessage.sms,
|
|
59
59
|
smsStatus: streamMessage.sms_status,
|
|
60
|
+
whatsapp: streamMessage.whatsapp,
|
|
61
|
+
whatsappStatus: streamMessage.whatsapp_status,
|
|
60
62
|
silent,
|
|
61
63
|
event,
|
|
62
64
|
};
|
|
@@ -129,6 +131,8 @@ export function normalizeStreamChannel(channel) {
|
|
|
129
131
|
telephony: data.telephony,
|
|
130
132
|
sms: data.sms,
|
|
131
133
|
mms: data.mms,
|
|
134
|
+
whatsapp: data.whatsapp,
|
|
135
|
+
whatsappStatus: data.whatsapp_status,
|
|
132
136
|
broadcast: data.broadcast || data.is_broadcast,
|
|
133
137
|
external: data.external,
|
|
134
138
|
createdAt: data.created_at,
|
|
@@ -136,3 +140,11 @@ export function normalizeStreamChannel(channel) {
|
|
|
136
140
|
updatedAt: data.updated_at,
|
|
137
141
|
};
|
|
138
142
|
}
|
|
143
|
+
export function normalizeStreamMember(member) {
|
|
144
|
+
const { role, user_id, created_at } = member;
|
|
145
|
+
return {
|
|
146
|
+
id: user_id,
|
|
147
|
+
createdAt: created_at,
|
|
148
|
+
role: (role || 'member'),
|
|
149
|
+
};
|
|
150
|
+
}
|
package/dist-es/stream.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { StreamChannel, StreamMessageResponse, StreamReactionResponse, StreamUserResponse, StreamChannelResponse } from "./stream";
|
|
1
|
+
import { StreamChannel, StreamMessageResponse, StreamReactionResponse, StreamUserResponse, StreamChannelResponse, StreamChannelMemberResponse } from "./stream";
|
|
2
2
|
import { LocalizedMessage, LocalizedUser } from "./types";
|
|
3
|
-
import { Channel, Message, Reaction, User } from "@wildix/xbees-conversations-client";
|
|
3
|
+
import { Channel, ChannelMember, Message, Reaction, User } from "@wildix/xbees-conversations-client";
|
|
4
4
|
export declare function normalizeStreamUser(streamUser: StreamUserResponse): User;
|
|
5
5
|
export declare function localizeStreamUser(streamUser: StreamUserResponse): LocalizedUser;
|
|
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
9
|
export declare function normalizeStreamChannel(channel: StreamChannel | StreamChannelResponse): Channel;
|
|
10
|
+
export declare function normalizeStreamMember(member: StreamChannelMemberResponse): ChannelMember;
|
package/dist-types/stream.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
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, User as NormalizedUser } from "@wildix/xbees-conversations-client";
|
|
3
|
-
export declare enum StreamChannelAccess {
|
|
4
|
-
PRIVATE = "private",
|
|
5
|
-
PUBLIC = "public"
|
|
6
|
-
}
|
|
1
|
+
import { Channel, ChannelData, ChannelFilters, ChannelMembership, ChannelMemberResponse, ChannelSort, ChannelResponse, Event, ExtendableGenerics, LiteralStringForUnion, Message, MessageResponse, ReactionResponse, UR, UserResponse, ChannelAPIResponse, User, Reaction, PartialMessageUpdate, UpdatedMessage, PartialUpdateChannel } from 'stream-chat';
|
|
2
|
+
import { Message as MessageNormalized, MessageForward, MessageAttachment, MessageGiphy, User as NormalizedUser, ChannelAccess, MessageSmsStatus, MessageWhatsAppStatus, ChannelWhatsAppStatus } from "@wildix/xbees-conversations-client";
|
|
7
3
|
export interface StreamChannelFields extends UR {
|
|
8
4
|
subject?: string;
|
|
9
5
|
description?: string;
|
|
10
6
|
picture?: string;
|
|
11
7
|
picture_color?: string;
|
|
12
|
-
access?:
|
|
8
|
+
access?: ChannelAccess;
|
|
13
9
|
company?: string;
|
|
14
10
|
context?: string;
|
|
15
11
|
kite?: boolean;
|
|
@@ -25,6 +21,8 @@ export interface StreamChannelFields extends UR {
|
|
|
25
21
|
telephony?: boolean;
|
|
26
22
|
sms?: boolean;
|
|
27
23
|
mms?: boolean;
|
|
24
|
+
whatsapp?: boolean;
|
|
25
|
+
whatsapp_status?: ChannelWhatsAppStatus | string;
|
|
28
26
|
broadcast?: boolean;
|
|
29
27
|
is_broadcast?: boolean;
|
|
30
28
|
external?: boolean;
|
|
@@ -50,15 +48,21 @@ export interface StreamMessageFields extends UR {
|
|
|
50
48
|
event?: string;
|
|
51
49
|
attachments?: MessageAttachment[];
|
|
52
50
|
sms?: boolean;
|
|
53
|
-
sms_status?:
|
|
51
|
+
sms_status?: MessageSmsStatus | string;
|
|
52
|
+
whatsapp?: boolean;
|
|
53
|
+
whatsapp_status?: MessageWhatsAppStatus | string;
|
|
54
54
|
created_at: string;
|
|
55
55
|
updated_at: string;
|
|
56
56
|
}
|
|
57
57
|
export interface StreamAttachmentFields extends UR {
|
|
58
58
|
id: string;
|
|
59
59
|
fsId: string;
|
|
60
|
+
mime?: string;
|
|
60
61
|
name: string;
|
|
61
62
|
size: number;
|
|
63
|
+
width?: number;
|
|
64
|
+
height?: number;
|
|
65
|
+
thumbnail?: string;
|
|
62
66
|
}
|
|
63
67
|
export interface StreamUserFields extends UR {
|
|
64
68
|
email?: string;
|
|
@@ -83,13 +87,17 @@ export type StreamEvent = Event<StreamType>;
|
|
|
83
87
|
export type StreamReaction = Reaction<StreamType>;
|
|
84
88
|
export type StreamReactionResponse = ReactionResponse<StreamType>;
|
|
85
89
|
export type StreamMessage = Message<StreamType>;
|
|
90
|
+
export type StreamUpdatedMessage = UpdatedMessage<StreamType>;
|
|
91
|
+
export type StreamPartialMessageUpdate = PartialMessageUpdate<StreamType>;
|
|
86
92
|
export type StreamMessageResponse = MessageResponse<StreamType>;
|
|
87
93
|
export type StreamChannel = Channel<StreamType>;
|
|
88
94
|
export type StreamChannelResponse = ChannelResponse<StreamType>;
|
|
95
|
+
export type StreamChannelMemberResponse = ChannelMemberResponse<StreamType>;
|
|
89
96
|
export type StreamUser = User<StreamType>;
|
|
90
97
|
export type StreamUserResponse = UserResponse<StreamType>;
|
|
91
98
|
export type StreamChannelMembership = ChannelMembership<StreamType>;
|
|
92
99
|
export type StreamChannelFilters = ChannelFilters<StreamType>;
|
|
93
100
|
export type StreamChannelSort = ChannelSort<StreamType>;
|
|
94
101
|
export type StreamChannelData = ChannelData<StreamType>;
|
|
102
|
+
export type StreamPartialUpdateChannel = PartialUpdateChannel<StreamType>;
|
|
95
103
|
export type StreamChannelAPIResponse = ChannelAPIResponse<StreamType>;
|
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.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=16.0.0"
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@wildix/xbees-conversations-client": "1.0.
|
|
23
|
+
"@wildix/xbees-conversations-client": "1.0.42",
|
|
24
24
|
"stream-chat": "8.12.1",
|
|
25
25
|
"tslib": "^2.5.0"
|
|
26
26
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@tsconfig/recommended": "1.0.1",
|
|
29
29
|
"concurrently": "7.0.0",
|
|
30
30
|
"downlevel-dts": "0.10.1",
|
|
31
|
-
"rimraf": "3.0.
|
|
31
|
+
"rimraf": "^3.0.0",
|
|
32
32
|
"typescript": "~4.9.5"
|
|
33
33
|
},
|
|
34
34
|
"typesVersions": {
|