polfan-server-js-client 0.3.0 → 0.3.2
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/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch +18 -0
- package/.idea/shelf/Uncommitted_changes_before_rebase__Changes_.xml +4 -0
- package/.idea/workspace.xml +59 -29
- package/build/index.cjs.js +82 -53
- package/build/index.cjs.js.map +1 -1
- package/build/index.js +62 -62
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +6 -2
- package/build/types/Permissions.d.ts +5 -1
- package/build/types/state-tracker/RoomsManager.d.ts +1 -1
- package/build/types/state-tracker/SpacesManager.d.ts +6 -0
- package/build/types/types/src/index.d.ts +6 -2
- package/build/types/types/src/schemes/Message.d.ts +1 -1
- package/build/types/types/src/schemes/RoomMember.d.ts +1 -0
- package/build/types/types/src/schemes/RoomSummary.d.ts +1 -0
- package/build/types/types/src/schemes/SpaceMember.d.ts +1 -0
- package/build/types/types/src/schemes/commands/GetInvited.d.ts +3 -0
- package/build/types/types/src/schemes/commands/Invite.d.ts +5 -0
- package/build/types/types/src/schemes/commands/JoinRoom.d.ts +10 -0
- package/build/types/types/src/schemes/commands/Uninvite.d.ts +5 -0
- package/build/types/types/src/schemes/commands/UpdateRoomMember.d.ts +1 -0
- package/build/types/types/src/schemes/commands/UpdateSpaceMember.d.ts +1 -0
- package/build/types/types/src/schemes/events/Invited.d.ts +10 -0
- package/build/types/types/src/schemes/events/RoomMembersJoined.d.ts +9 -0
- package/build/types/types/src/schemes/events/RoomSummaryUpdated.d.ts +2 -1
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +10 -2
- package/src/Permissions.ts +2 -1
- package/src/state-tracker/RoomsManager.ts +5 -4
- package/src/state-tracker/SpacesManager.ts +10 -0
- package/src/state-tracker/UsersManager.ts +1 -1
- package/src/types/src/index.ts +10 -2
- package/src/types/src/schemes/Message.ts +1 -1
- package/src/types/src/schemes/RoomMember.ts +1 -0
- package/src/types/src/schemes/RoomSummary.ts +2 -1
- package/src/types/src/schemes/SpaceMember.ts +1 -0
- package/src/types/src/schemes/commands/GetInvited.ts +3 -0
- package/src/types/src/schemes/commands/Invite.ts +5 -0
- package/src/types/src/schemes/commands/JoinRoom.ts +12 -0
- package/src/types/src/schemes/commands/Uninvite.ts +5 -0
- package/src/types/src/schemes/commands/UpdateRoomMember.ts +1 -0
- package/src/types/src/schemes/commands/UpdateSpaceMember.ts +1 -0
- package/src/types/src/schemes/events/Invited.ts +13 -0
- package/src/types/src/schemes/events/RoomMembersJoined.ts +11 -0
- package/src/types/src/schemes/events/RoomSummaryUpdated.ts +3 -2
- package/src/types/src/schemes/events/RoomMemberJoined.ts +0 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Index: package.json
|
|
2
|
+
IDEA additional info:
|
|
3
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
|
|
4
|
+
<+>{\n \"name\": \"polfan-server-js-client\",\n \"version\": \"0.3.1\",\n \"description\": \"JavaScript client library for handling communication with Polfan chat server.\",\n \"author\": \"Jarosław Żak\",\n \"license\": \"MIT\",\n \"main\": \"build/index.cjs.js\",\n \"browser\": \"build/index.umd.js\",\n \"types\": \"build/types/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./build/types/index.d.ts\",\n \"require\": \"./build/index.cjs.js\",\n \"browser\": \"./build/index.umd.js\",\n \"default\": \"./build/index.cjs.js\"\n }\n },\n \"scripts\": {\n \"build\": \"npm run build:node && npm run build:browser && tsc\",\n \"build:node\": \"webpack --config webpack.config.node.js\",\n \"build:browser\": \"webpack --config webpack.config.browser.js\",\n \"test\": \"jest\",\n \"coverage\": \"npm run test -- --coverage\",\n \"trypublish\": \"npm publish || true\"\n },\n \"devDependencies\": {\n \"@babel/cli\": \"^7.28.3\",\n \"@babel/core\": \"^7.28.5\",\n \"@babel/preset-env\": \"^7.28.5\",\n \"@babel/preset-typescript\": \"^7.28.5\",\n \"@types/jest\": \"^29.5.14\",\n \"babel-loader\": \"^9.2.1\",\n \"file-loader\": \"^6.2.0\",\n \"jest\": \"^29.7.0\",\n \"ts-node\": \"^10.9.2\",\n \"typescript\": \"^4.9.5\",\n \"webpack\": \"^5.103.0\",\n \"webpack-cli\": \"^5.1.4\"\n },\n \"dependencies\": {\n \"terser-webpack-plugin\": \"^5.3.14\"\n }\n}\n
|
|
5
|
+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
6
|
+
<+>UTF-8
|
|
7
|
+
===================================================================
|
|
8
|
+
diff --git a/package.json b/package.json
|
|
9
|
+
--- a/package.json (revision d974e79c5de0f1238eda4bf6d13f7e38ca819d90)
|
|
10
|
+
+++ b/package.json (date 1785593595442)
|
|
11
|
+
@@ -1,6 +1,6 @@
|
|
12
|
+
{
|
|
13
|
+
"name": "polfan-server-js-client",
|
|
14
|
+
- "version": "0.3.1",
|
|
15
|
+
+ "version": "0.3.2",
|
|
16
|
+
"description": "JavaScript client library for handling communication with Polfan chat server.",
|
|
17
|
+
"author": "Jarosław Żak",
|
|
18
|
+
"license": "MIT",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<changelist name="Uncommitted_changes_before_rebase_[Changes]" date="1785593598500" recycled="true" deleted="true">
|
|
2
|
+
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch" />
|
|
3
|
+
<option name="DESCRIPTION" value="Uncommitted changes before rebase [Changes]" />
|
|
4
|
+
</changelist>
|
package/.idea/workspace.xml
CHANGED
|
@@ -4,8 +4,16 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Introduce room invitations and manual member adding">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js.map" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/build/index.umd.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.umd.js.map" afterDir="false" />
|
|
8
11
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
12
|
+
<change beforePath="$PROJECT_DIR$/src/types" beforeDir="false" afterPath="$PROJECT_DIR$/src/types" afterDir="false" />
|
|
13
|
+
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/RoomMember.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/RoomMember.ts" afterDir="false" />
|
|
14
|
+
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/SpaceMember.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/SpaceMember.ts" afterDir="false" />
|
|
15
|
+
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/UpdateRoomMember.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/UpdateRoomMember.ts" afterDir="false" />
|
|
16
|
+
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/UpdateSpaceMember.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/UpdateSpaceMember.ts" afterDir="false" />
|
|
9
17
|
</list>
|
|
10
18
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
19
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -16,7 +24,7 @@
|
|
|
16
24
|
<execution />
|
|
17
25
|
</component>
|
|
18
26
|
<component name="EmbeddingIndexingInfo">
|
|
19
|
-
<option name="cachedIndexableFilesCount" value="
|
|
27
|
+
<option name="cachedIndexableFilesCount" value="212" />
|
|
20
28
|
</component>
|
|
21
29
|
<component name="Git.Rebase.Settings">
|
|
22
30
|
<option name="NEW_BASE" value="origin/main" />
|
|
@@ -24,11 +32,11 @@
|
|
|
24
32
|
<component name="Git.Settings">
|
|
25
33
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
|
26
34
|
<map>
|
|
27
|
-
<entry key="$PROJECT_DIR$" value="
|
|
35
|
+
<entry key="$PROJECT_DIR$" value="master" />
|
|
28
36
|
<entry key="$PROJECT_DIR$/src/types" value="562c7beff95ea1eaf5c236df978f50a614a146af" />
|
|
29
37
|
</map>
|
|
30
38
|
</option>
|
|
31
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR
|
|
39
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/src/types" />
|
|
32
40
|
<option name="ROOT_SYNC" value="DONT_SYNC" />
|
|
33
41
|
</component>
|
|
34
42
|
<component name="GitHubPullRequestSearchHistory">{
|
|
@@ -37,6 +45,16 @@
|
|
|
37
45
|
"assignee": "szado"
|
|
38
46
|
}
|
|
39
47
|
}</component>
|
|
48
|
+
<component name="GitRewordedCommitMessages">
|
|
49
|
+
<option name="commitMessagesMapping">
|
|
50
|
+
<RewordedCommitMessageMapping>
|
|
51
|
+
<option name="originalMessage" value="Add customAvatar member fields to types and rebuild SpaceMember.customAvatar and RoomMember.customAvatar (file id or null) plus the optional customAvatar field of the UpdateSpaceMember/UpdateRoomMember commands, matching the new server protocol. PM-room virtual members get a null default. Note: the src/types submodule (pserv-ts-types) needs the same fields committed upstream; the change is included here only in the built output. No version bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C3pK4vFFEWWrK7gtKeQjC6" />
|
|
52
|
+
<option name="rewordedMessage" value="Custom avatars support" />
|
|
53
|
+
</RewordedCommitMessageMapping>
|
|
54
|
+
</option>
|
|
55
|
+
<option name="currentCommit" value="1" />
|
|
56
|
+
<option name="onto" value="6a2d671a2ea3742ea3977b1d035f4d4bed40c7eb" />
|
|
57
|
+
</component>
|
|
40
58
|
<component name="GithubPullRequestsUISettings">{
|
|
41
59
|
"selectedUrlAndAccountId": {
|
|
42
60
|
"url": "https://github.com/szado/pserv-ts-types",
|
|
@@ -69,7 +87,7 @@
|
|
|
69
87
|
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
|
70
88
|
"codeWithMe.voiceChat.enabledByDefault": "false",
|
|
71
89
|
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
|
|
72
|
-
"git-widget-placeholder": "
|
|
90
|
+
"git-widget-placeholder": "main",
|
|
73
91
|
"git.auto.fetch.suggestion.counter": "3",
|
|
74
92
|
"ignore.virus.scanning.warn.message": "true",
|
|
75
93
|
"junie.onboarding.icon.badge.shown": "true",
|
|
@@ -102,6 +120,7 @@
|
|
|
102
120
|
<list>
|
|
103
121
|
<item itemvalue="npm.build:node" />
|
|
104
122
|
<item itemvalue="npm.build:node" />
|
|
123
|
+
<item itemvalue="npm.build:node" />
|
|
105
124
|
</list>
|
|
106
125
|
</recent_temporary>
|
|
107
126
|
</component>
|
|
@@ -230,23 +249,8 @@
|
|
|
230
249
|
<workItem from="1783939298935" duration="21428000" />
|
|
231
250
|
<workItem from="1784102649250" duration="12484000" />
|
|
232
251
|
<workItem from="1784524117686" duration="79000" />
|
|
233
|
-
<workItem from="1784562428378" duration="
|
|
234
|
-
|
|
235
|
-
<task id="LOCAL-00062" summary="Update deps and improve library building">
|
|
236
|
-
<option name="closed" value="true" />
|
|
237
|
-
<created>1763587128702</created>
|
|
238
|
-
<option name="number" value="00062" />
|
|
239
|
-
<option name="presentableId" value="LOCAL-00062" />
|
|
240
|
-
<option name="project" value="LOCAL" />
|
|
241
|
-
<updated>1763587128703</updated>
|
|
242
|
-
</task>
|
|
243
|
-
<task id="LOCAL-00063" summary="Improvements and fixes to collection mirroring">
|
|
244
|
-
<option name="closed" value="true" />
|
|
245
|
-
<created>1763587170120</created>
|
|
246
|
-
<option name="number" value="00063" />
|
|
247
|
-
<option name="presentableId" value="LOCAL-00063" />
|
|
248
|
-
<option name="project" value="LOCAL" />
|
|
249
|
-
<updated>1763587170121</updated>
|
|
252
|
+
<workItem from="1784562428378" duration="25143000" />
|
|
253
|
+
<workItem from="1785316847947" duration="4472000" />
|
|
250
254
|
</task>
|
|
251
255
|
<task id="LOCAL-00064" summary="Align to custom colors and nicks protocol changes">
|
|
252
256
|
<option name="closed" value="true" />
|
|
@@ -624,7 +628,23 @@
|
|
|
624
628
|
<option name="project" value="LOCAL" />
|
|
625
629
|
<updated>1785107453415</updated>
|
|
626
630
|
</task>
|
|
627
|
-
<
|
|
631
|
+
<task id="LOCAL-00111" summary="Introduce UserData support">
|
|
632
|
+
<option name="closed" value="true" />
|
|
633
|
+
<created>1785167989175</created>
|
|
634
|
+
<option name="number" value="00111" />
|
|
635
|
+
<option name="presentableId" value="LOCAL-00111" />
|
|
636
|
+
<option name="project" value="LOCAL" />
|
|
637
|
+
<updated>1785167989175</updated>
|
|
638
|
+
</task>
|
|
639
|
+
<task id="LOCAL-00112" summary="Introduce room invitations and manual member adding">
|
|
640
|
+
<option name="closed" value="true" />
|
|
641
|
+
<created>1785177501237</created>
|
|
642
|
+
<option name="number" value="00112" />
|
|
643
|
+
<option name="presentableId" value="LOCAL-00112" />
|
|
644
|
+
<option name="project" value="LOCAL" />
|
|
645
|
+
<updated>1785177501238</updated>
|
|
646
|
+
</task>
|
|
647
|
+
<option name="localTasksCounter" value="113" />
|
|
628
648
|
<servers />
|
|
629
649
|
</component>
|
|
630
650
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -636,6 +656,16 @@
|
|
|
636
656
|
<entry key="Branch">
|
|
637
657
|
<value>
|
|
638
658
|
<list>
|
|
659
|
+
<RecentGroup>
|
|
660
|
+
<option name="FILTER_VALUES">
|
|
661
|
+
<option value="claude/avatars-room-space-support-bvrcaz" />
|
|
662
|
+
</option>
|
|
663
|
+
</RecentGroup>
|
|
664
|
+
<RecentGroup>
|
|
665
|
+
<option name="FILTER_VALUES">
|
|
666
|
+
<option value="claude/add-members-invite-rooms-1nphsj" />
|
|
667
|
+
</option>
|
|
668
|
+
</RecentGroup>
|
|
639
669
|
<RecentGroup>
|
|
640
670
|
<option name="FILTER_VALUES">
|
|
641
671
|
<option value="master" />
|
|
@@ -666,7 +696,7 @@
|
|
|
666
696
|
<entry key="branch">
|
|
667
697
|
<value>
|
|
668
698
|
<list>
|
|
669
|
-
<option value="
|
|
699
|
+
<option value="claude/avatars-room-space-support-bvrcaz" />
|
|
670
700
|
</list>
|
|
671
701
|
</value>
|
|
672
702
|
</entry>
|
|
@@ -679,10 +709,6 @@
|
|
|
679
709
|
</option>
|
|
680
710
|
</component>
|
|
681
711
|
<component name="VcsManagerConfiguration">
|
|
682
|
-
<MESSAGE value="Improve EventTarget typings" />
|
|
683
|
-
<MESSAGE value="Delete redacted messages, improve collections, add tests" />
|
|
684
|
-
<MESSAGE value="Fix emitting event with deleted topics" />
|
|
685
|
-
<MESSAGE value="Adjust to ban changes" />
|
|
686
712
|
<MESSAGE value="TopicHistoryWindow retainRatio and event handling improvements" />
|
|
687
713
|
<MESSAGE value="Remove removed message from Topic last message" />
|
|
688
714
|
<MESSAGE value="Update Topic on redacted message" />
|
|
@@ -704,7 +730,11 @@
|
|
|
704
730
|
<MESSAGE value="Unread topic counter in summary, bump version" />
|
|
705
731
|
<MESSAGE value="Unread room counter in summary, bump version" />
|
|
706
732
|
<MESSAGE value="Reconcile tracked state on reconnect" />
|
|
707
|
-
<
|
|
733
|
+
<MESSAGE value="Introduce UserData support" />
|
|
734
|
+
<MESSAGE value="Add members to rooms and invitation only rooms support" />
|
|
735
|
+
<MESSAGE value="Introduce room invitations and manual member adding" />
|
|
736
|
+
<MESSAGE value="Custom avatars support" />
|
|
737
|
+
<option name="LAST_COMMIT_MESSAGE" value="Custom avatars support" />
|
|
708
738
|
</component>
|
|
709
739
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
710
740
|
<expand />
|
package/build/index.cjs.js
CHANGED
|
@@ -2917,8 +2917,8 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
2917
2917
|
this.tracker.client.on('TopicUpdated', function (ev) {
|
|
2918
2918
|
return _this.handleTopicUpdated(ev);
|
|
2919
2919
|
});
|
|
2920
|
-
this.tracker.client.on('
|
|
2921
|
-
return _this.
|
|
2920
|
+
this.tracker.client.on('RoomMembersJoined', function (ev) {
|
|
2921
|
+
return _this.handleRoomMembersJoined(ev);
|
|
2922
2922
|
});
|
|
2923
2923
|
this.tracker.client.on('RoomMemberLeft', function (ev) {
|
|
2924
2924
|
return _this.handleRoomMemberLeft(ev);
|
|
@@ -3325,6 +3325,7 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
3325
3325
|
roles: null,
|
|
3326
3326
|
customColor: null,
|
|
3327
3327
|
customNick: null,
|
|
3328
|
+
customAvatar: null,
|
|
3328
3329
|
extras: ''
|
|
3329
3330
|
};
|
|
3330
3331
|
})
|
|
@@ -3340,10 +3341,11 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
3340
3341
|
this.deleteRoom(ev.id);
|
|
3341
3342
|
}
|
|
3342
3343
|
}, {
|
|
3343
|
-
key: "
|
|
3344
|
-
value: function
|
|
3344
|
+
key: "handleRoomMembersJoined",
|
|
3345
|
+
value: function handleRoomMembersJoined(ev) {
|
|
3345
3346
|
if (this.members.has(ev.roomId)) {
|
|
3346
|
-
|
|
3347
|
+
var _this$members$get;
|
|
3348
|
+
(_this$members$get = this.members.get(ev.roomId)).set.apply(_this$members$get, RoomsManager_toConsumableArray(ev.members));
|
|
3347
3349
|
}
|
|
3348
3350
|
}
|
|
3349
3351
|
}, {
|
|
@@ -3362,10 +3364,10 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
3362
3364
|
return (_member$user$id2 = (_member$user2 = member.user) === null || _member$user2 === void 0 ? void 0 : _member$user2.id) !== null && _member$user$id2 !== void 0 ? _member$user$id2 : member.spaceMember.user.id;
|
|
3363
3365
|
}, ev.members)]);
|
|
3364
3366
|
} else {
|
|
3365
|
-
var _this$members$
|
|
3367
|
+
var _this$members$get2;
|
|
3366
3368
|
// Reconcile into the existing (bound) collection so a reconnect
|
|
3367
3369
|
// refetch updates it in place instead of leaving stale members.
|
|
3368
|
-
(_this$members$
|
|
3370
|
+
(_this$members$get2 = this.members.get(ev.id)).reconcile.apply(_this$members$get2, RoomsManager_toConsumableArray(ev.members));
|
|
3369
3371
|
}
|
|
3370
3372
|
}
|
|
3371
3373
|
}, {
|
|
@@ -3712,6 +3714,29 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3712
3714
|
}
|
|
3713
3715
|
return getRooms;
|
|
3714
3716
|
}()
|
|
3717
|
+
/**
|
|
3718
|
+
* Drop the cached room listing of the space and fetch it again from the server.
|
|
3719
|
+
* Room visibility depends on things this client is not notified about (invitations,
|
|
3720
|
+
* permission changes), so the listing needs a way to be pulled anew on demand.
|
|
3721
|
+
*/
|
|
3722
|
+
)
|
|
3723
|
+
}, {
|
|
3724
|
+
key: "refreshRooms",
|
|
3725
|
+
value: (function () {
|
|
3726
|
+
var _refreshRooms = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee5(spaceId) {
|
|
3727
|
+
return SpacesManager_regenerator().w(function (_context5) {
|
|
3728
|
+
while (1) switch (_context5.n) {
|
|
3729
|
+
case 0:
|
|
3730
|
+
this.roomsPromises.forget(spaceId);
|
|
3731
|
+
return _context5.a(2, this.getRooms(spaceId));
|
|
3732
|
+
}
|
|
3733
|
+
}, _callee5, this);
|
|
3734
|
+
}));
|
|
3735
|
+
function refreshRooms(_x3) {
|
|
3736
|
+
return _refreshRooms.apply(this, arguments);
|
|
3737
|
+
}
|
|
3738
|
+
return refreshRooms;
|
|
3739
|
+
}()
|
|
3715
3740
|
/**
|
|
3716
3741
|
* Get collection of space members.
|
|
3717
3742
|
*/
|
|
@@ -3719,44 +3744,44 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3719
3744
|
}, {
|
|
3720
3745
|
key: "getMembers",
|
|
3721
3746
|
value: (function () {
|
|
3722
|
-
var _getMembers = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function
|
|
3747
|
+
var _getMembers = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee7(spaceId) {
|
|
3723
3748
|
var _this3 = this;
|
|
3724
|
-
return SpacesManager_regenerator().w(function (
|
|
3725
|
-
while (1) switch (
|
|
3749
|
+
return SpacesManager_regenerator().w(function (_context7) {
|
|
3750
|
+
while (1) switch (_context7.n) {
|
|
3726
3751
|
case 0:
|
|
3727
3752
|
if (this.membersPromises.notExist(spaceId)) {
|
|
3728
|
-
this.membersPromises.registerByFunction(/*#__PURE__*/SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function
|
|
3753
|
+
this.membersPromises.registerByFunction(/*#__PURE__*/SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee6() {
|
|
3729
3754
|
var result;
|
|
3730
|
-
return SpacesManager_regenerator().w(function (
|
|
3731
|
-
while (1) switch (
|
|
3755
|
+
return SpacesManager_regenerator().w(function (_context6) {
|
|
3756
|
+
while (1) switch (_context6.n) {
|
|
3732
3757
|
case 0:
|
|
3733
|
-
|
|
3758
|
+
_context6.n = 1;
|
|
3734
3759
|
return _this3.tracker.client.send('GetSpaceMembers', {
|
|
3735
3760
|
id: spaceId
|
|
3736
3761
|
});
|
|
3737
3762
|
case 1:
|
|
3738
|
-
result =
|
|
3763
|
+
result = _context6.v;
|
|
3739
3764
|
if (!result.error) {
|
|
3740
|
-
|
|
3765
|
+
_context6.n = 2;
|
|
3741
3766
|
break;
|
|
3742
3767
|
}
|
|
3743
3768
|
throw result.error;
|
|
3744
3769
|
case 2:
|
|
3745
3770
|
_this3.handleSpaceMembers(result.data);
|
|
3746
3771
|
case 3:
|
|
3747
|
-
return
|
|
3772
|
+
return _context6.a(2);
|
|
3748
3773
|
}
|
|
3749
|
-
},
|
|
3774
|
+
}, _callee6);
|
|
3750
3775
|
})), spaceId);
|
|
3751
3776
|
}
|
|
3752
|
-
|
|
3777
|
+
_context7.n = 1;
|
|
3753
3778
|
return this.membersPromises.get(spaceId);
|
|
3754
3779
|
case 1:
|
|
3755
|
-
return
|
|
3780
|
+
return _context7.a(2, this.members.get(spaceId));
|
|
3756
3781
|
}
|
|
3757
|
-
},
|
|
3782
|
+
}, _callee7, this);
|
|
3758
3783
|
}));
|
|
3759
|
-
function getMembers(
|
|
3784
|
+
function getMembers(_x4) {
|
|
3760
3785
|
return _getMembers.apply(this, arguments);
|
|
3761
3786
|
}
|
|
3762
3787
|
return getMembers;
|
|
@@ -3768,32 +3793,32 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3768
3793
|
}, {
|
|
3769
3794
|
key: "getMe",
|
|
3770
3795
|
value: (function () {
|
|
3771
|
-
var _getMe = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function
|
|
3796
|
+
var _getMe = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee8(spaceId) {
|
|
3772
3797
|
var userId, members;
|
|
3773
|
-
return SpacesManager_regenerator().w(function (
|
|
3774
|
-
while (1) switch (
|
|
3798
|
+
return SpacesManager_regenerator().w(function (_context8) {
|
|
3799
|
+
while (1) switch (_context8.n) {
|
|
3775
3800
|
case 0:
|
|
3776
|
-
|
|
3801
|
+
_context8.n = 1;
|
|
3777
3802
|
return this.tracker.getMe();
|
|
3778
3803
|
case 1:
|
|
3779
|
-
userId =
|
|
3804
|
+
userId = _context8.v.id;
|
|
3780
3805
|
if (this.list.has(spaceId)) {
|
|
3781
|
-
|
|
3806
|
+
_context8.n = 2;
|
|
3782
3807
|
break;
|
|
3783
3808
|
}
|
|
3784
|
-
return
|
|
3809
|
+
return _context8.a(2, undefined);
|
|
3785
3810
|
case 2:
|
|
3786
|
-
|
|
3811
|
+
_context8.n = 3;
|
|
3787
3812
|
return this.getMembers(spaceId);
|
|
3788
3813
|
case 3:
|
|
3789
|
-
members =
|
|
3790
|
-
return
|
|
3814
|
+
members = _context8.v;
|
|
3815
|
+
return _context8.a(2, members === null || members === void 0 ? void 0 : members.items.find(function (member) {
|
|
3791
3816
|
return member.user.id === userId;
|
|
3792
3817
|
}));
|
|
3793
3818
|
}
|
|
3794
|
-
},
|
|
3819
|
+
}, _callee8, this);
|
|
3795
3820
|
}));
|
|
3796
|
-
function getMe(
|
|
3821
|
+
function getMe(_x5) {
|
|
3797
3822
|
return _getMe.apply(this, arguments);
|
|
3798
3823
|
}
|
|
3799
3824
|
return getMe;
|
|
@@ -3826,19 +3851,19 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3826
3851
|
}, {
|
|
3827
3852
|
key: "handleRoomDeleted",
|
|
3828
3853
|
value: function () {
|
|
3829
|
-
var _handleRoomDeleted = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function
|
|
3854
|
+
var _handleRoomDeleted = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee9(ev) {
|
|
3830
3855
|
var _this$rooms$get2;
|
|
3831
3856
|
var spaceId, space, spaceChanged;
|
|
3832
|
-
return SpacesManager_regenerator().w(function (
|
|
3833
|
-
while (1) switch (
|
|
3857
|
+
return SpacesManager_regenerator().w(function (_context9) {
|
|
3858
|
+
while (1) switch (_context9.n) {
|
|
3834
3859
|
case 0:
|
|
3835
3860
|
spaceId = this.roomIdToSpaceId.get(ev.id);
|
|
3836
3861
|
this.roomIdToSpaceId["delete"](ev.id);
|
|
3837
3862
|
if (spaceId) {
|
|
3838
|
-
|
|
3863
|
+
_context9.n = 1;
|
|
3839
3864
|
break;
|
|
3840
3865
|
}
|
|
3841
|
-
return
|
|
3866
|
+
return _context9.a(2);
|
|
3842
3867
|
case 1:
|
|
3843
3868
|
space = this.list.get(spaceId);
|
|
3844
3869
|
spaceChanged = false;
|
|
@@ -3857,11 +3882,11 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3857
3882
|
this.list.set(space);
|
|
3858
3883
|
}
|
|
3859
3884
|
case 2:
|
|
3860
|
-
return
|
|
3885
|
+
return _context9.a(2);
|
|
3861
3886
|
}
|
|
3862
|
-
},
|
|
3887
|
+
}, _callee9, this);
|
|
3863
3888
|
}));
|
|
3864
|
-
function handleRoomDeleted(
|
|
3889
|
+
function handleRoomDeleted(_x6) {
|
|
3865
3890
|
return _handleRoomDeleted.apply(this, arguments);
|
|
3866
3891
|
}
|
|
3867
3892
|
return handleRoomDeleted;
|
|
@@ -3955,10 +3980,10 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3955
3980
|
}, {
|
|
3956
3981
|
key: "handleRoomSummaryUpdated",
|
|
3957
3982
|
value: function () {
|
|
3958
|
-
var _handleRoomSummaryUpdated = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function
|
|
3983
|
+
var _handleRoomSummaryUpdated = SpacesManager_asyncToGenerator(/*#__PURE__*/SpacesManager_regenerator().m(function _callee0(ev) {
|
|
3959
3984
|
var spaceId, summariesPromise, summaries, oldSummary, newSummary;
|
|
3960
|
-
return SpacesManager_regenerator().w(function (
|
|
3961
|
-
while (1) switch (
|
|
3985
|
+
return SpacesManager_regenerator().w(function (_context0) {
|
|
3986
|
+
while (1) switch (_context0.n) {
|
|
3962
3987
|
case 0:
|
|
3963
3988
|
spaceId = this.roomIdToSpaceId.get(ev.summary.id);
|
|
3964
3989
|
summariesPromise = this.roomsPromises.get(spaceId);
|
|
@@ -3967,10 +3992,10 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3967
3992
|
* RoomSummaryUpdated event has a partial summary, so we need to update the existing summary by merging it.
|
|
3968
3993
|
*/
|
|
3969
3994
|
if (!(spaceId && summariesPromise)) {
|
|
3970
|
-
|
|
3995
|
+
_context0.n = 2;
|
|
3971
3996
|
break;
|
|
3972
3997
|
}
|
|
3973
|
-
|
|
3998
|
+
_context0.n = 1;
|
|
3974
3999
|
return summariesPromise;
|
|
3975
4000
|
case 1:
|
|
3976
4001
|
summaries = this.rooms.get(spaceId);
|
|
@@ -3982,11 +4007,11 @@ var SpacesManager = /*#__PURE__*/function () {
|
|
|
3982
4007
|
}
|
|
3983
4008
|
summaries.set(newSummary);
|
|
3984
4009
|
case 2:
|
|
3985
|
-
return
|
|
4010
|
+
return _context0.a(2);
|
|
3986
4011
|
}
|
|
3987
|
-
},
|
|
4012
|
+
}, _callee0, this);
|
|
3988
4013
|
}));
|
|
3989
|
-
function handleRoomSummaryUpdated(
|
|
4014
|
+
function handleRoomSummaryUpdated(_x7) {
|
|
3990
4015
|
return _handleRoomSummaryUpdated.apply(this, arguments);
|
|
3991
4016
|
}
|
|
3992
4017
|
return handleRoomSummaryUpdated;
|
|
@@ -4199,7 +4224,7 @@ Permissions_defineProperty(Permissions, "list", {
|
|
|
4199
4224
|
value: 1 << 16,
|
|
4200
4225
|
maxLayer: Layer.Room
|
|
4201
4226
|
},
|
|
4202
|
-
|
|
4227
|
+
ChangeOwnProfile: {
|
|
4203
4228
|
value: 1 << 17,
|
|
4204
4229
|
maxLayer: Layer.Space
|
|
4205
4230
|
},
|
|
@@ -4210,6 +4235,10 @@ Permissions_defineProperty(Permissions, "list", {
|
|
|
4210
4235
|
RedactMessages: {
|
|
4211
4236
|
value: 1 << 19,
|
|
4212
4237
|
maxLayer: Layer.Topic
|
|
4238
|
+
},
|
|
4239
|
+
AddMembers: {
|
|
4240
|
+
value: 1 << 20,
|
|
4241
|
+
maxLayer: Layer.Space
|
|
4213
4242
|
}
|
|
4214
4243
|
});
|
|
4215
4244
|
;// ./src/state-tracker/PermissionsManager.ts
|
|
@@ -4968,8 +4997,8 @@ var UsersManager = /*#__PURE__*/function () {
|
|
|
4968
4997
|
tracker.client.on('UserUpdated', function (event) {
|
|
4969
4998
|
return _this.handleUsers([event.user]);
|
|
4970
4999
|
});
|
|
4971
|
-
tracker.client.on('
|
|
4972
|
-
return _this.handleMembers(
|
|
5000
|
+
tracker.client.on('RoomMembersJoined', function (event) {
|
|
5001
|
+
return _this.handleMembers(event.members);
|
|
4973
5002
|
});
|
|
4974
5003
|
tracker.client.on('SpaceMemberJoined', function (event) {
|
|
4975
5004
|
return _this.handleMembers([event.member]);
|