@messenger-box/platform-client 10.0.3-alpha.17 → 10.0.3-alpha.171
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/lib/graphql/fragments/post-message.gql +36 -0
- package/lib/graphql/id-generation.js.map +1 -1
- package/lib/graphql/index.js.map +1 -1
- package/lib/graphql/mutations/channel-mutation.gql +5 -0
- package/lib/graphql/mutations/messages-mutation.gql +3 -0
- package/lib/graphql/policies/channel-policies.d.ts.map +1 -1
- package/lib/graphql/policies/channel-policies.js +150 -2
- package/lib/graphql/policies/channel-policies.js.map +1 -1
- package/lib/graphql/policies/messages-policies.d.ts.map +1 -1
- package/lib/graphql/policies/messages-policies.js +229 -37
- package/lib/graphql/policies/messages-policies.js.map +1 -1
- package/lib/graphql/policies/post-thread-policies.d.ts.map +1 -1
- package/lib/graphql/policies/post-thread-policies.js +136 -31
- package/lib/graphql/policies/post-thread-policies.js.map +1 -1
- package/lib/graphql/policies/posts-policies.js.map +1 -1
- package/lib/graphql/policies/teams-policies.d.ts.map +1 -1
- package/lib/graphql/policies/teams-policies.js +13 -1
- package/lib/graphql/policies/teams-policies.js.map +1 -1
- package/lib/graphql/policies/user-account-policies.js.map +1 -1
- package/lib/graphql/policies/user-policies.js.map +1 -1
- package/lib/graphql/queries/channels-by-user.gql +26 -0
- package/lib/graphql/queries/messages.gql +2 -2
- package/lib/graphql/queries/organization-query.gql +70 -35
- package/lib/graphql/queries/post-thread-message.gql +4 -0
- package/lib/graphql/queries/teams-query.gql +29 -29
- package/lib/graphql/queries/user-account.gql +1 -1
- package/lib/graphql/queries/users.gql +1 -1
- package/lib/graphql/schema/index.js.map +1 -1
- package/lib/graphql/subscription/fileUpdated.gql +11 -0
- package/lib/hooks/use-base-file-upload.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.js +1 -1
- package/lib/hooks/use-upload-file.hook.js.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.js +1 -1
- package/lib/hooks/use-upload-file.hook.native.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.js +1 -1
- package/lib/hooks/use-upload-files.hook.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.js +1 -1
- package/lib/hooks/use-upload-files.hook.native.js.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -141
- package/jest.config.js +0 -25
- package/rollup.config.mjs +0 -36
- package/src/graphql/fragments/configuration.gql +0 -12
- package/src/graphql/fragments/extended-user-account.gql +0 -10
- package/src/graphql/fragments/file-info.gql +0 -12
- package/src/graphql/fragments/messenger-user.gql +0 -15
- package/src/graphql/fragments/minimal-user.gql +0 -9
- package/src/graphql/fragments/post-message.gql +0 -116
- package/src/graphql/fragments/post-thread-message.gql +0 -77
- package/src/graphql/fragments/user.gql +0 -11
- package/src/graphql/id-generation.ts +0 -8
- package/src/graphql/index.ts +0 -24
- package/src/graphql/mutations/channel-mutation.gql +0 -72
- package/src/graphql/mutations/expo-notification-token.gql +0 -13
- package/src/graphql/mutations/message-threads-mutation.gql +0 -44
- package/src/graphql/mutations/messages-mutation.gql +0 -110
- package/src/graphql/mutations/messages-mutation.gql.bk +0 -66
- package/src/graphql/mutations/organization-mutation.gql.bk +0 -14
- package/src/graphql/mutations/teams-mutation.gql.bk +0 -8
- package/src/graphql/policies/channel-policies.ts +0 -7
- package/src/graphql/policies/index.ts +0 -7
- package/src/graphql/policies/messages-policies.ts +0 -109
- package/src/graphql/policies/post-thread-policies.ts +0 -59
- package/src/graphql/policies/posts-policies.ts +0 -110
- package/src/graphql/policies/teams-policies.ts +0 -7
- package/src/graphql/policies/user-account-policies.ts +0 -15
- package/src/graphql/policies/user-policies.ts +0 -32
- package/src/graphql/queries/channel.gql +0 -57
- package/src/graphql/queries/channels-by-user.gql +0 -60
- package/src/graphql/queries/check-for-new-messages.gql +0 -5
- package/src/graphql/queries/file-url.gql +0 -5
- package/src/graphql/queries/get-device-token.gql +0 -8
- package/src/graphql/queries/messages.gql +0 -28
- package/src/graphql/queries/organization-query.gql +0 -90
- package/src/graphql/queries/post-message.gql +0 -8
- package/src/graphql/queries/post-thread-message.gql +0 -20
- package/src/graphql/queries/support-service-channels.gql +0 -18
- package/src/graphql/queries/teams-query.gql +0 -32
- package/src/graphql/queries/user-account.gql +0 -5
- package/src/graphql/queries/users.gql +0 -48
- package/src/graphql/schema/index.ts +0 -6
- package/src/graphql/schema/messages.graphql +0 -5
- package/src/graphql/schema/post.graphql +0 -44
- package/src/graphql/schema/services.graphql +0 -6
- package/src/graphql/schema/user-account.graphql +0 -3
- package/src/graphql/subscription/chat-message-added.gql +0 -6
- package/src/graphql/subscription/public-post-added.gql +0 -5
- package/src/graphql/subscription/thread-chat-message-added.gql +0 -5
- package/src/graphql/subscription/thread-created-updated.gql +0 -12
- package/src/hooks/index.ts +0 -4
- package/src/hooks/use-base-file-upload.hook.ts +0 -148
- package/src/hooks/use-upload-file.hook.native.ts +0 -22
- package/src/hooks/use-upload-file.hook.ts +0 -22
- package/src/hooks/use-upload-files.hook.native.ts +0 -22
- package/src/hooks/use-upload-files.hook.ts +0 -22
- package/src/index.ts +0 -3
- package/src/inversify-containers/index.ts +0 -1
- package/src/inversify-containers/module.ts +0 -4
- package/src/packages/constants/constants.ts +0 -1831
- package/src/packages/types/channels.ts +0 -194
- package/src/packages/types/emojis.ts +0 -41
- package/src/packages/types/files.ts +0 -43
- package/src/packages/types/posts.ts +0 -155
- package/src/packages/types/reactions.ts +0 -8
- package/src/packages/types/teams.ts +0 -109
- package/src/packages/types/utilities.ts +0 -30
- package/src/services/index.ts +0 -0
- package/src/tests/mutation/__snapshots__/set-device-token.test.ts.snap +0 -18
- package/src/tests/mutation/set-device-token.test.ts +0 -85
- package/src/utils/constants.tsx +0 -1120
- package/src/utils/i18n.tsx +0 -15
- package/src/utils/index.ts +0 -34
- package/src/utils/post_list.ts +0 -54
- package/src/utils/post_utils.ts +0 -33
- package/src/utils/user_agent.tsx +0 -153
- package/src/utils/utils.tsx +0 -54
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -58
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
import { IDMappedObjects, UserIDMappedObjects, RelationOneToMany, RelationOneToOne } from './utilities';
|
|
5
|
-
import { Team } from './teams';
|
|
6
|
-
|
|
7
|
-
export type ChannelType = 'O' | 'P' | 'D' | 'G';
|
|
8
|
-
|
|
9
|
-
export type ChannelStats = {
|
|
10
|
-
channel_id: string;
|
|
11
|
-
member_count: number;
|
|
12
|
-
guest_count: number;
|
|
13
|
-
pinnedpost_count: number;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type ChannelNotifyProps = {
|
|
17
|
-
desktop: 'default' | 'all' | 'mention' | 'none';
|
|
18
|
-
email: 'default' | 'all' | 'mention' | 'none';
|
|
19
|
-
mark_unread: 'all' | 'mention';
|
|
20
|
-
push: 'default' | 'all' | 'mention' | 'none';
|
|
21
|
-
ignore_channel_mentions: 'default' | 'off' | 'on';
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type Channel = {
|
|
25
|
-
id: string;
|
|
26
|
-
create_at: number;
|
|
27
|
-
update_at: number;
|
|
28
|
-
delete_at: number;
|
|
29
|
-
team_id: string;
|
|
30
|
-
type: ChannelType;
|
|
31
|
-
display_name: string;
|
|
32
|
-
name: string;
|
|
33
|
-
header: string;
|
|
34
|
-
purpose: string;
|
|
35
|
-
last_post_at: number;
|
|
36
|
-
creator_id: string;
|
|
37
|
-
scheme_id: string;
|
|
38
|
-
teammate_id?: string;
|
|
39
|
-
status?: string;
|
|
40
|
-
group_constrained: boolean;
|
|
41
|
-
shared?: boolean;
|
|
42
|
-
props?: Record<string, any>;
|
|
43
|
-
policy_id?: string | null;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type ServerChannel = Channel & {
|
|
47
|
-
/**
|
|
48
|
-
* The total number of posts in this channel, not including join/leave messages
|
|
49
|
-
*
|
|
50
|
-
* @remarks This field will be moved to a {@link ChannelMessageCount} object when this channel is stored in Redux.
|
|
51
|
-
*/
|
|
52
|
-
total_msg_count: number;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The number of root posts in this channel, not including join/leave messages
|
|
56
|
-
*
|
|
57
|
-
* @remarks This field will be moved to a {@link ChannelMessageCount} object when this channel is stored in Redux.
|
|
58
|
-
*/
|
|
59
|
-
total_msg_count_root: number;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type ChannelMessageCount = {
|
|
63
|
-
/** The total number of posts in this channel, not including join/leave messages */
|
|
64
|
-
total: number;
|
|
65
|
-
|
|
66
|
-
/** The number of root posts in this channel, not including join/leave messages */
|
|
67
|
-
root: number;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type ChannelWithTeamData = Channel & {
|
|
71
|
-
team_display_name: string;
|
|
72
|
-
team_name: string;
|
|
73
|
-
team_update_at: number;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export type ChannelsWithTotalCount = {
|
|
77
|
-
channels: ChannelWithTeamData[];
|
|
78
|
-
total_count: number;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type ChannelMembership = {
|
|
82
|
-
channel_id: string;
|
|
83
|
-
user_id: string;
|
|
84
|
-
roles: string;
|
|
85
|
-
last_viewed_at: number;
|
|
86
|
-
|
|
87
|
-
/** The number of posts in this channel which have been read by the user */
|
|
88
|
-
msg_count: number;
|
|
89
|
-
|
|
90
|
-
/** The number of root posts in this channel which have been read by the user */
|
|
91
|
-
msg_count_root: number;
|
|
92
|
-
|
|
93
|
-
/** The number of unread mentions in this channel */
|
|
94
|
-
mention_count: number;
|
|
95
|
-
|
|
96
|
-
/** The number of unread mentions in root posts in this channel */
|
|
97
|
-
mention_count_root: number;
|
|
98
|
-
|
|
99
|
-
notify_props: Partial<ChannelNotifyProps>;
|
|
100
|
-
last_update_at: number;
|
|
101
|
-
scheme_user: boolean;
|
|
102
|
-
scheme_admin: boolean;
|
|
103
|
-
post_root_id?: string;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type ChannelUnread = {
|
|
107
|
-
channel_id: string;
|
|
108
|
-
user_id: string;
|
|
109
|
-
team_id: string;
|
|
110
|
-
|
|
111
|
-
/** The number of posts which have been read by the user */
|
|
112
|
-
msg_count: number;
|
|
113
|
-
|
|
114
|
-
/** The number of root posts which have been read by the user */
|
|
115
|
-
msg_count_root: number;
|
|
116
|
-
|
|
117
|
-
/** The number of unread mentions in this channel */
|
|
118
|
-
mention_count: number;
|
|
119
|
-
|
|
120
|
-
/** The number of unread mentions in root posts in this channel */
|
|
121
|
-
mention_count_root: number;
|
|
122
|
-
|
|
123
|
-
last_viewed_at: number;
|
|
124
|
-
deltaMsgs: number;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export type ChannelsState = {
|
|
128
|
-
currentChannelId: string;
|
|
129
|
-
channels: IDMappedObjects<Channel>;
|
|
130
|
-
channelsInTeam: RelationOneToMany<Team, Channel>;
|
|
131
|
-
myMembers: RelationOneToOne<Channel, ChannelMembership>;
|
|
132
|
-
roles: RelationOneToOne<Channel, Set<string>>;
|
|
133
|
-
membersInChannel: RelationOneToOne<Channel, UserIDMappedObjects<ChannelMembership>>;
|
|
134
|
-
stats: RelationOneToOne<Channel, ChannelStats>;
|
|
135
|
-
groupsAssociatedToChannel: any;
|
|
136
|
-
totalCount: number;
|
|
137
|
-
manuallyUnread: RelationOneToOne<Channel, boolean>;
|
|
138
|
-
channelModerations: RelationOneToOne<Channel, ChannelModeration[]>;
|
|
139
|
-
channelMemberCountsByGroup: RelationOneToOne<Channel, ChannelMemberCountsByGroup>;
|
|
140
|
-
messageCounts: RelationOneToOne<Channel, ChannelMessageCount>;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export type ChannelModeration = {
|
|
144
|
-
name: string;
|
|
145
|
-
roles: {
|
|
146
|
-
guests?: {
|
|
147
|
-
value: boolean;
|
|
148
|
-
enabled: boolean;
|
|
149
|
-
};
|
|
150
|
-
members: {
|
|
151
|
-
value: boolean;
|
|
152
|
-
enabled: boolean;
|
|
153
|
-
};
|
|
154
|
-
admins: {
|
|
155
|
-
value: boolean;
|
|
156
|
-
enabled: boolean;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export type ChannelModerationPatch = {
|
|
162
|
-
name: string;
|
|
163
|
-
roles: {
|
|
164
|
-
guests?: boolean;
|
|
165
|
-
members?: boolean;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
export type ChannelMemberCountByGroup = {
|
|
170
|
-
group_id: string;
|
|
171
|
-
channel_member_count: number;
|
|
172
|
-
channel_member_timezones_count: number;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export type ChannelMemberCountsByGroup = Record<string, ChannelMemberCountByGroup>;
|
|
176
|
-
|
|
177
|
-
export type ChannelViewResponse = {
|
|
178
|
-
status: string;
|
|
179
|
-
last_viewed_at_times: RelationOneToOne<Channel, number>;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export type ChannelSearchOpts = {
|
|
183
|
-
exclude_default_channels?: boolean;
|
|
184
|
-
not_associated_to_group?: string;
|
|
185
|
-
team_ids?: string[];
|
|
186
|
-
group_constrained?: boolean;
|
|
187
|
-
exclude_group_constrained?: boolean;
|
|
188
|
-
public?: boolean;
|
|
189
|
-
private?: boolean;
|
|
190
|
-
include_deleted?: boolean;
|
|
191
|
-
deleted?: boolean;
|
|
192
|
-
page?: number;
|
|
193
|
-
per_page?: number;
|
|
194
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
export type EmojiCategory = (
|
|
5
|
-
| 'recent'
|
|
6
|
-
| 'people'
|
|
7
|
-
| 'nature'
|
|
8
|
-
| 'foods'
|
|
9
|
-
| 'activity'
|
|
10
|
-
| 'places'
|
|
11
|
-
| 'objects'
|
|
12
|
-
| 'symbols'
|
|
13
|
-
| 'flags'
|
|
14
|
-
| 'custom'
|
|
15
|
-
);
|
|
16
|
-
export type CustomEmoji = {
|
|
17
|
-
id: string;
|
|
18
|
-
create_at: number;
|
|
19
|
-
update_at: number;
|
|
20
|
-
delete_at: number;
|
|
21
|
-
creator_id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
category: 'custom';
|
|
24
|
-
};
|
|
25
|
-
export type SystemEmoji = {
|
|
26
|
-
name: string;
|
|
27
|
-
image: string;
|
|
28
|
-
short_name: string;
|
|
29
|
-
short_names: string[];
|
|
30
|
-
category: EmojiCategory;
|
|
31
|
-
batch: number;
|
|
32
|
-
skins?: string[];
|
|
33
|
-
skin_variations?: unknown[]; // we currently don't have a use for it other than knowing the field exists.
|
|
34
|
-
};
|
|
35
|
-
export type Emoji = SystemEmoji | CustomEmoji;
|
|
36
|
-
export type EmojisState = {
|
|
37
|
-
customEmoji: {
|
|
38
|
-
[x: string]: CustomEmoji;
|
|
39
|
-
};
|
|
40
|
-
nonExistentEmoji: Set<string>;
|
|
41
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
import {Dictionary, $ID} from './utilities';
|
|
5
|
-
|
|
6
|
-
export type FileInfo = {
|
|
7
|
-
id: string;
|
|
8
|
-
user_id: string;
|
|
9
|
-
create_at: number;
|
|
10
|
-
update_at: number;
|
|
11
|
-
delete_at: number;
|
|
12
|
-
name: string;
|
|
13
|
-
extension: string;
|
|
14
|
-
size: number;
|
|
15
|
-
mime_type: string;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
has_preview_image: boolean;
|
|
19
|
-
clientId: string;
|
|
20
|
-
post_id?: string;
|
|
21
|
-
};
|
|
22
|
-
export type FilesState = {
|
|
23
|
-
files: Dictionary<FileInfo>;
|
|
24
|
-
filesFromSearch: Dictionary<FileSearchResultItem>;
|
|
25
|
-
fileIdsByPostId: Dictionary<string[]>;
|
|
26
|
-
filePublicLink?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type FileUploadResponse = {
|
|
30
|
-
file_infos: FileInfo[];
|
|
31
|
-
client_ids: string[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type FileSearchResultItem = FileInfo & {
|
|
35
|
-
channel_id: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type FileSearchResults = {
|
|
39
|
-
order: Array<$ID<FileSearchResultItem>>;
|
|
40
|
-
file_infos: Map<string, FileSearchResultItem>;
|
|
41
|
-
next_file_info_id: string;
|
|
42
|
-
prev_file_info_id: string;
|
|
43
|
-
};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
import { CustomEmoji } from './emojis';
|
|
5
|
-
import { FileInfo } from './files';
|
|
6
|
-
import { Reaction } from './reactions';
|
|
7
|
-
import { $ID, RelationOneToOne, RelationOneToMany, IDMappedObjects, Dictionary } from './utilities';
|
|
8
|
-
|
|
9
|
-
export type PostType =
|
|
10
|
-
| 'system_add_remove'
|
|
11
|
-
| 'system_add_to_channel'
|
|
12
|
-
| 'system_add_to_team'
|
|
13
|
-
| 'system_channel_deleted'
|
|
14
|
-
| 'system_channel_restored'
|
|
15
|
-
| 'system_displayname_change'
|
|
16
|
-
| 'system_convert_channel'
|
|
17
|
-
| 'system_ephemeral'
|
|
18
|
-
| 'system_header_change'
|
|
19
|
-
| 'system_join_channel'
|
|
20
|
-
| 'system_join_leave'
|
|
21
|
-
| 'system_leave_channel'
|
|
22
|
-
| 'system_purpose_change'
|
|
23
|
-
| 'system_remove_from_channel'
|
|
24
|
-
| 'system_combined_user_activity';
|
|
25
|
-
|
|
26
|
-
export type PostEmbedType = 'image' | 'link' | 'message_attachment' | 'opengraph' | 'permalink';
|
|
27
|
-
|
|
28
|
-
export type PostEmbed = {
|
|
29
|
-
type: PostEmbedType;
|
|
30
|
-
url: string;
|
|
31
|
-
data?: OpenGraphMetadata | PostPreviewMetadata;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type PostImage = {
|
|
35
|
-
format: string;
|
|
36
|
-
frameCount: number;
|
|
37
|
-
height: number;
|
|
38
|
-
width: number;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type PostMetadata = {
|
|
42
|
-
embeds: PostEmbed[];
|
|
43
|
-
emojis: CustomEmoji[];
|
|
44
|
-
files: FileInfo[];
|
|
45
|
-
images: Dictionary<PostImage>;
|
|
46
|
-
reactions: Reaction[];
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type Post = {
|
|
50
|
-
id: string;
|
|
51
|
-
create_at: number;
|
|
52
|
-
update_at: number;
|
|
53
|
-
edit_at: number;
|
|
54
|
-
delete_at: number;
|
|
55
|
-
is_pinned: boolean;
|
|
56
|
-
user_id: string;
|
|
57
|
-
channel_id: string;
|
|
58
|
-
root_id: string;
|
|
59
|
-
original_id: string;
|
|
60
|
-
message: string;
|
|
61
|
-
type: PostType;
|
|
62
|
-
props: Record<string, any>;
|
|
63
|
-
hashtags: string;
|
|
64
|
-
pending_post_id: string;
|
|
65
|
-
reply_count: number;
|
|
66
|
-
file_ids?: string[];
|
|
67
|
-
metadata: PostMetadata;
|
|
68
|
-
failed?: boolean;
|
|
69
|
-
user_activity_posts?: Post[];
|
|
70
|
-
state?: 'DELETED';
|
|
71
|
-
filenames?: string[];
|
|
72
|
-
last_reply_at?: number;
|
|
73
|
-
participants?: any; //Array<UserProfile | $ID<UserProfile>>;
|
|
74
|
-
message_source?: string;
|
|
75
|
-
is_following?: boolean;
|
|
76
|
-
exists?: boolean;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export type UserActivityPost = Post & {
|
|
80
|
-
system_post_ids: string[];
|
|
81
|
-
user_activity_posts: Post[];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export type PostList = {
|
|
85
|
-
order: Array<$ID<Post>>;
|
|
86
|
-
posts: Map<string, Post>;
|
|
87
|
-
next_post_id: string;
|
|
88
|
-
prev_post_id: string;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export type PostSearchResults = PostList & {
|
|
92
|
-
matches: RelationOneToOne<Post, string[]>;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export type PostWithFormatData = Post & {
|
|
96
|
-
isFirstReply: boolean;
|
|
97
|
-
isLastReply: boolean;
|
|
98
|
-
previousPostIsComment: boolean;
|
|
99
|
-
commentedOnPost?: Post;
|
|
100
|
-
consecutivePostByUser: boolean;
|
|
101
|
-
replyCount: number;
|
|
102
|
-
isCommentMention: boolean;
|
|
103
|
-
highlight: boolean;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type PostOrderBlock = {
|
|
107
|
-
order: string[];
|
|
108
|
-
recent?: boolean;
|
|
109
|
-
oldest?: boolean;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export type MessageHistory = {
|
|
113
|
-
messages: string[];
|
|
114
|
-
index: {
|
|
115
|
-
post: number;
|
|
116
|
-
comment: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export type PostsState = {
|
|
121
|
-
posts: IDMappedObjects<Post>;
|
|
122
|
-
postsReplies: { [x in $ID<Post>]: number };
|
|
123
|
-
postsInChannel: Dictionary<PostOrderBlock[]>;
|
|
124
|
-
postsInThread: RelationOneToMany<Post, Post>;
|
|
125
|
-
reactions: RelationOneToOne<Post, Dictionary<Reaction>>;
|
|
126
|
-
openGraph: RelationOneToOne<Post, Dictionary<OpenGraphMetadata>>;
|
|
127
|
-
pendingPostIds: string[];
|
|
128
|
-
selectedPostId: string;
|
|
129
|
-
currentFocusedPostId: string;
|
|
130
|
-
messagesHistory: MessageHistory;
|
|
131
|
-
expandedURLs: Dictionary<string>;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export declare type OpenGraphMetadataImage = {
|
|
135
|
-
secure_url?: string;
|
|
136
|
-
url: string;
|
|
137
|
-
height?: number;
|
|
138
|
-
width?: number;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export declare type OpenGraphMetadata = {
|
|
142
|
-
type?: string;
|
|
143
|
-
title?: string;
|
|
144
|
-
description?: string;
|
|
145
|
-
site_name?: string;
|
|
146
|
-
url?: string;
|
|
147
|
-
images: OpenGraphMetadataImage[];
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export declare type PostPreviewMetadata = {
|
|
151
|
-
post_id: string;
|
|
152
|
-
post?: Post;
|
|
153
|
-
channel_display_name: string;
|
|
154
|
-
team_name: string;
|
|
155
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
// import {ServerError} from './errors';
|
|
5
|
-
// import {UserProfile} from './users';
|
|
6
|
-
import { IUserProfile } from 'common';
|
|
7
|
-
import { Dictionary, RelationOneToOne } from './utilities';
|
|
8
|
-
|
|
9
|
-
export type TeamMembership = TeamUnread & {
|
|
10
|
-
user_id: string;
|
|
11
|
-
roles: string;
|
|
12
|
-
delete_at: number;
|
|
13
|
-
scheme_user: boolean;
|
|
14
|
-
scheme_admin: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type TeamMemberWithError = {
|
|
18
|
-
member: TeamMembership;
|
|
19
|
-
user_id: string;
|
|
20
|
-
// error: ServerError;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type TeamType = 'O' | 'I';
|
|
24
|
-
|
|
25
|
-
export type Team = {
|
|
26
|
-
id: string;
|
|
27
|
-
create_at: number;
|
|
28
|
-
update_at: number;
|
|
29
|
-
delete_at: number;
|
|
30
|
-
display_name: string;
|
|
31
|
-
name: string;
|
|
32
|
-
description: string;
|
|
33
|
-
email: string;
|
|
34
|
-
type: TeamType;
|
|
35
|
-
company_name: string;
|
|
36
|
-
allowed_domains: string;
|
|
37
|
-
invite_id: string;
|
|
38
|
-
allow_open_invite: boolean;
|
|
39
|
-
scheme_id: string;
|
|
40
|
-
group_constrained: boolean;
|
|
41
|
-
policy_id?: string | null;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type TeamsState = {
|
|
45
|
-
currentTeamId: string;
|
|
46
|
-
teams: Dictionary<Team>;
|
|
47
|
-
myMembers: Dictionary<TeamMembership>;
|
|
48
|
-
membersInTeam: RelationOneToOne<Team, RelationOneToOne<IUserProfile & { id: string }, TeamMembership>>;
|
|
49
|
-
stats: RelationOneToOne<Team, TeamStats>;
|
|
50
|
-
groupsAssociatedToTeam: any;
|
|
51
|
-
totalCount: number;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type TeamUnread = {
|
|
55
|
-
team_id: string;
|
|
56
|
-
|
|
57
|
-
/** The number of unread mentions in channels on this team, not including DMs and GMs */
|
|
58
|
-
mention_count: number;
|
|
59
|
-
|
|
60
|
-
/** The number of unread mentions in root posts in channels on this team, not including DMs and GMs */
|
|
61
|
-
mention_count_root: number;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The number of unread posts in channels on this team, not including DMs and GMs
|
|
65
|
-
*
|
|
66
|
-
* @remarks Note that this differs from ChannelMembership.msg_count and ChannelUnread.msg_count since it tracks
|
|
67
|
-
* unread posts instead of read posts.
|
|
68
|
-
*/
|
|
69
|
-
msg_count: number;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* The number of unread root posts in channels on this team, not including DMs and GMs
|
|
73
|
-
*
|
|
74
|
-
* @remarks Note that this differs from ChannelMember.msg_count_root and ChannelUnread.msg_count_root since it
|
|
75
|
-
* tracks unread posts instead of read posts.
|
|
76
|
-
*/
|
|
77
|
-
msg_count_root: number;
|
|
78
|
-
|
|
79
|
-
thread_count?: number;
|
|
80
|
-
thread_mention_count?: number;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type GetTeamMembersOpts = {
|
|
84
|
-
sort?: 'Username';
|
|
85
|
-
exclude_deleted_users?: boolean;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export type TeamsWithCount = {
|
|
89
|
-
teams: Team[];
|
|
90
|
-
total_count: number;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export type TeamStats = {
|
|
94
|
-
team_id: string;
|
|
95
|
-
total_member_count: number;
|
|
96
|
-
active_member_count: number;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export type TeamSearchOpts = {
|
|
100
|
-
page?: number;
|
|
101
|
-
per_page?: number;
|
|
102
|
-
allow_open_invite?: boolean;
|
|
103
|
-
group_constrained?: boolean;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export type TeamInviteWithError = {
|
|
107
|
-
email: string;
|
|
108
|
-
error: Error;
|
|
109
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
export type $ID<E extends {id: string}> = E['id'];
|
|
4
|
-
export type $UserID<E extends {user_id: string}> = E['user_id'];
|
|
5
|
-
export type $Name<E extends {name: string}> = E['name'];
|
|
6
|
-
export type $Username<E extends {username: string}> = E['username'];
|
|
7
|
-
export type $Email<E extends {email: string}> = E['email'];
|
|
8
|
-
export type RelationOneToOne<E extends {id: string}, T> = {
|
|
9
|
-
[x in $ID<E>]: T;
|
|
10
|
-
};
|
|
11
|
-
export type RelationOneToMany<E1 extends {id: string}, E2 extends {id: string}> = {
|
|
12
|
-
[x in $ID<E1>]: Array<$ID<E2>>;
|
|
13
|
-
};
|
|
14
|
-
export type IDMappedObjects<E extends {id: string}> = RelationOneToOne<E, E>;
|
|
15
|
-
export type UserIDMappedObjects<E extends {user_id: string}> = {
|
|
16
|
-
[x in $UserID<E>]: E;
|
|
17
|
-
};
|
|
18
|
-
export type NameMappedObjects<E extends {name: string}> = {
|
|
19
|
-
[x in $Name<E>]: E;
|
|
20
|
-
};
|
|
21
|
-
export type UsernameMappedObjects<E extends {username: string}> = {
|
|
22
|
-
[x in $Username<E>]: E;
|
|
23
|
-
};
|
|
24
|
-
export type EmailMappedObjects<E extends {email: string}> = {
|
|
25
|
-
[x in $Email<E>]: E;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type Dictionary<T> = {
|
|
29
|
-
[key: string]: T;
|
|
30
|
-
};
|
package/src/services/index.ts
DELETED
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Set expo token test Set expo token 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"getDeviceToken": {
|
|
6
|
-
"tokens": [
|
|
7
|
-
{
|
|
8
|
-
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InRhcnVudXBhZGh5YXlkZXYyMDIyQGdtYWlsLmNvbSIsImlhdCI6MTY3MTE4MTQ1NSwiZXhwIjoxNjcxMjY3ODU1fQ.XQTWTuUW3HUo4pviGgK2bEvd79e4BIYPgLKfItx5OEo",
|
|
9
|
-
"type": "EMAIL_VERIFICATION",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"token": "ExponentPushToken[_RzGb5J887HIJpVzH9_07h]",
|
|
13
|
-
"type": "EXPO_NOTIFICATION_TOKEN",
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import fetch from 'node-fetch';
|
|
2
|
-
|
|
3
|
-
describe('Set expo token test', () => {
|
|
4
|
-
const API = 'http://localhost:8091/graphql';
|
|
5
|
-
const bearerToken =
|
|
6
|
-
'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJFRkdOalEzTlRJNFJUY3dNRVV5TXpRNVJFTTNORE0wUkVWRU56VTJOemd6TkRVME16RXpSUSJ9.eyJpc3MiOiJodHRwczovL2Rldi1jZGViYXNlLmF1dGgwLmNvbS8iLCJzdWIiOiJnb29nbGUtb2F1dGgyfDExMzQ4ODQ2MzgxMTAwODMyNDMxNiIsImF1ZCI6WyJodHRwczovL2Rldi1jZGViYXNlLmF1dGgwLmNvbS9hcGkvdjIvIiwiaHR0cHM6Ly9kZXYtY2RlYmFzZS5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjgzNzkwNTM4LCJleHAiOjE2ODM4NzY5MzgsImF6cCI6IlQ5WE0yOTJsMzNYYjEyUlZQdlJJZnJiNWhZVFpzUm1lIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCByZWFkOmN1cnJlbnRfdXNlciB1cGRhdGU6Y3VycmVudF91c2VyX2lkZW50aXRpZXMgb2ZmbGluZV9hY2Nlc3MifQ.Ft_sRo0f3J0vGCckes0r2AuJpr21KZPgkCow9kRxyCpuoffKNu34o9XebFWNX_fP4GQlT68Nj71EDsQA7AMlvCwv5IvZVeYdTeCYNcDa7FwmXhRsGUxH-lOlqp-KZjKI3BB_AwVUFNh9w5EaEcAXOgqK-00DKbuUniXygH2fckMXevMB1s6q9De167G-YwTmyKbVQUDCNA6pemsgB6CiaZkf2MF_7LETGcSl3TgY-WN6AP9gjZh8HayK3la4sbrfdJ05gIF32yFrSm5kiM84F3y2f-2m6FT6AzbrlBGr3nBaL1vYOYpxrRHOIq3y_HvBGxr4yJGPrZdLcC5VjEoGsg';
|
|
7
|
-
const expoToken = 'ExponentPushToken[_RzGb5J887HIJpVzH9_07h]';
|
|
8
|
-
|
|
9
|
-
it('Set expo token', async () => {
|
|
10
|
-
const tokensquery: any = `
|
|
11
|
-
getDeviceToken
|
|
12
|
-
{
|
|
13
|
-
tokens
|
|
14
|
-
{
|
|
15
|
-
token
|
|
16
|
-
type
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
const query = `
|
|
22
|
-
mutation SetDeviceToken($deviceToken: String) {
|
|
23
|
-
setDeviceToken(deviceToken: $deviceToken) {
|
|
24
|
-
tokens {
|
|
25
|
-
token
|
|
26
|
-
type
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
let getTokens = await fetch(API, {
|
|
33
|
-
method: 'POST',
|
|
34
|
-
headers: {
|
|
35
|
-
'Content-Type': 'application/json',
|
|
36
|
-
Authorization: bearerToken,
|
|
37
|
-
},
|
|
38
|
-
body: JSON.stringify({
|
|
39
|
-
query: `{${tokensquery}}`,
|
|
40
|
-
}),
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
let tokensResponse = await getTokens.json();
|
|
44
|
-
if (tokensResponse) {
|
|
45
|
-
const checkExpoTokens: any =
|
|
46
|
-
tokensResponse?.data?.getDeviceToken?.tokens?.filter(
|
|
47
|
-
(t: any) => t?.type === 'EXPO_NOTIFICATION_TOKEN' && t?.token == expoToken,
|
|
48
|
-
) ?? null;
|
|
49
|
-
|
|
50
|
-
if (checkExpoTokens && checkExpoTokens?.length == 0) {
|
|
51
|
-
let response = await fetch(API, {
|
|
52
|
-
method: 'POST',
|
|
53
|
-
headers: {
|
|
54
|
-
'Content-Type': 'application/json',
|
|
55
|
-
Authorization: bearerToken,
|
|
56
|
-
},
|
|
57
|
-
body: JSON.stringify({
|
|
58
|
-
query,
|
|
59
|
-
variables: {
|
|
60
|
-
deviceToken: expoToken,
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
});
|
|
64
|
-
let result = await response.json();
|
|
65
|
-
if (result) expect(result?.data).toMatchSnapshot();
|
|
66
|
-
} else expect(tokensResponse?.data).toMatchSnapshot();
|
|
67
|
-
} else {
|
|
68
|
-
let response = await fetch(API, {
|
|
69
|
-
method: 'POST',
|
|
70
|
-
headers: {
|
|
71
|
-
'Content-Type': 'application/json',
|
|
72
|
-
Authorization: bearerToken,
|
|
73
|
-
},
|
|
74
|
-
body: JSON.stringify({
|
|
75
|
-
query,
|
|
76
|
-
variables: {
|
|
77
|
-
deviceToken: expoToken,
|
|
78
|
-
},
|
|
79
|
-
}),
|
|
80
|
-
});
|
|
81
|
-
let result = await response.json();
|
|
82
|
-
expect(result?.data).toMatchSnapshot();
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|