polfan-server-js-client 0.2.44 → 0.2.46
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/workspace.xml +40 -22
- package/build/index.cjs.js +60 -0
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +8 -1
- package/build/types/state-tracker/ChatStateTracker.d.ts +5 -0
- package/build/types/state-tracker/RelationshipsManager.d.ts +15 -0
- package/build/types/types/src/index.d.ts +7 -1
- package/build/types/types/src/schemes/UserRelationship.d.ts +8 -0
- package/build/types/types/src/schemes/commands/CreateRelationship.d.ts +5 -0
- package/build/types/types/src/schemes/commands/DeleteRelationship.d.ts +5 -0
- package/build/types/types/src/schemes/commands/GetRelationships.d.ts +2 -0
- package/build/types/types/src/schemes/events/NewRelationship.d.ts +4 -0
- package/build/types/types/src/schemes/events/RelationshipDeleted.d.ts +4 -0
- package/build/types/types/src/schemes/events/Relationships.d.ts +4 -0
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +8 -1
- package/src/state-tracker/ChatStateTracker.ts +6 -0
- package/src/state-tracker/RelationshipsManager.ts +68 -0
- package/src/types/src/index.ts +13 -0
- package/src/types/src/schemes/UserRelationship.ts +10 -0
- package/src/types/src/schemes/commands/CreateRelationship.ts +6 -0
- package/src/types/src/schemes/commands/DeleteRelationship.ts +6 -0
- package/src/types/src/schemes/commands/GetRelationships.ts +3 -0
- package/src/types/src/schemes/events/NewRelationship.ts +5 -0
- package/src/types/src/schemes/events/RelationshipDeleted.ts +5 -0
- package/src/types/src/schemes/events/Relationships.ts +5 -0
package/.idea/workspace.xml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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="Relationships support" />
|
|
8
8
|
<option name="SHOW_DIALOG" value="false" />
|
|
9
9
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
10
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
@@ -46,24 +46,24 @@
|
|
|
46
46
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
47
47
|
<option name="showLibraryContents" value="true" />
|
|
48
48
|
</component>
|
|
49
|
-
<component name="PropertiesComponent"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
50
|
+
"keyToString": {
|
|
51
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
52
|
+
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
|
53
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
54
|
+
"git-widget-placeholder": "master",
|
|
55
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
56
|
+
"junie.onboarding.icon.badge.shown": "true",
|
|
57
|
+
"last_opened_file_path": "//wsl.localhost/Debian/home/jarek/polfan-js-client-library",
|
|
58
|
+
"node.js.detected.package.eslint": "true",
|
|
59
|
+
"node.js.detected.package.tslint": "true",
|
|
60
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
61
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
62
|
+
"nodejs_package_manager_path": "npm",
|
|
63
|
+
"ts.external.directory.path": "\\\\wsl.localhost\\Debian\\home\\jarek\\polfan-js-client-library\\node_modules\\typescript\\lib",
|
|
64
|
+
"vue.rearranger.settings.migration": "true"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}]]></component>
|
|
67
67
|
<component name="SharedIndexes">
|
|
68
68
|
<attachedChunks>
|
|
69
69
|
<set>
|
|
@@ -119,7 +119,9 @@
|
|
|
119
119
|
<workItem from="1752705788150" duration="3566000" />
|
|
120
120
|
<workItem from="1752756543261" duration="1956000" />
|
|
121
121
|
<workItem from="1752834023436" duration="2601000" />
|
|
122
|
-
<workItem from="1753062168800" duration="
|
|
122
|
+
<workItem from="1753062168800" duration="4938000" />
|
|
123
|
+
<workItem from="1753441064452" duration="1184000" />
|
|
124
|
+
<workItem from="1753954931871" duration="7324000" />
|
|
123
125
|
</task>
|
|
124
126
|
<task id="LOCAL-00001" summary="Emoticons objects">
|
|
125
127
|
<option name="closed" value="true" />
|
|
@@ -489,7 +491,23 @@
|
|
|
489
491
|
<option name="project" value="LOCAL" />
|
|
490
492
|
<updated>1753379410620</updated>
|
|
491
493
|
</task>
|
|
492
|
-
<
|
|
494
|
+
<task id="LOCAL-00047" summary="Fix for incorrectly emitted RoomUpdated event">
|
|
495
|
+
<option name="closed" value="true" />
|
|
496
|
+
<created>1753379731857</created>
|
|
497
|
+
<option name="number" value="00047" />
|
|
498
|
+
<option name="presentableId" value="LOCAL-00047" />
|
|
499
|
+
<option name="project" value="LOCAL" />
|
|
500
|
+
<updated>1753379731857</updated>
|
|
501
|
+
</task>
|
|
502
|
+
<task id="LOCAL-00048" summary="Relationships support">
|
|
503
|
+
<option name="closed" value="true" />
|
|
504
|
+
<created>1754149839341</created>
|
|
505
|
+
<option name="number" value="00048" />
|
|
506
|
+
<option name="presentableId" value="LOCAL-00048" />
|
|
507
|
+
<option name="project" value="LOCAL" />
|
|
508
|
+
<updated>1754149839341</updated>
|
|
509
|
+
</task>
|
|
510
|
+
<option name="localTasksCounter" value="49" />
|
|
493
511
|
<servers />
|
|
494
512
|
</component>
|
|
495
513
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -507,7 +525,6 @@
|
|
|
507
525
|
</option>
|
|
508
526
|
</component>
|
|
509
527
|
<component name="VcsManagerConfiguration">
|
|
510
|
-
<MESSAGE value="Emoticon permissions support" />
|
|
511
528
|
<MESSAGE value="Permission related changes in protocol types" />
|
|
512
529
|
<MESSAGE value="ClassicText room type" />
|
|
513
530
|
<MESSAGE value="Restore support for nullable parameter in permission overwrites id function" />
|
|
@@ -532,6 +549,7 @@
|
|
|
532
549
|
<MESSAGE value="Fix global emoticons support" />
|
|
533
550
|
<MESSAGE value="Update schemes" />
|
|
534
551
|
<MESSAGE value="Fix for incorrectly emitted RoomUpdated event" />
|
|
535
|
-
<
|
|
552
|
+
<MESSAGE value="Relationships support" />
|
|
553
|
+
<option name="LAST_COMMIT_MESSAGE" value="Relationships support" />
|
|
536
554
|
</component>
|
|
537
555
|
</project>
|
package/build/index.cjs.js
CHANGED
|
@@ -1912,6 +1912,61 @@ class UsersManager {
|
|
|
1912
1912
|
this.users.set(...users);
|
|
1913
1913
|
}
|
|
1914
1914
|
}
|
|
1915
|
+
;// CONCATENATED MODULE: ./src/state-tracker/RelationshipsManager.ts
|
|
1916
|
+
function RelationshipsManager_defineProperty(obj, key, value) { key = RelationshipsManager_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1917
|
+
function RelationshipsManager_toPropertyKey(arg) { var key = RelationshipsManager_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
1918
|
+
function RelationshipsManager_toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
const getId = (refUserId, type) => `${refUserId}-${type}`;
|
|
1922
|
+
const getIdFromRelationship = relationship => getId(relationship.refUser.id, relationship.type);
|
|
1923
|
+
class RelationshipsManager {
|
|
1924
|
+
constructor(tracker) {
|
|
1925
|
+
this.tracker = tracker;
|
|
1926
|
+
RelationshipsManager_defineProperty(this, "relationships", new ObservableIndexedObjectCollection(getIdFromRelationship));
|
|
1927
|
+
RelationshipsManager_defineProperty(this, "promises", new PromiseRegistry());
|
|
1928
|
+
this.tracker.client.on('Relationships', ev => this.handleRelationships(ev));
|
|
1929
|
+
this.tracker.client.on('NewRelationship', ev => this.handleNewRelationship(ev));
|
|
1930
|
+
this.tracker.client.on('RelationshipDeleted', ev => this.handleRelationshipDeleted(ev));
|
|
1931
|
+
this.tracker.client.on('Session', () => this.handleSession());
|
|
1932
|
+
}
|
|
1933
|
+
async get() {
|
|
1934
|
+
if (this.promises.notExist('all')) {
|
|
1935
|
+
this.promises.registerByFunction(async () => {
|
|
1936
|
+
const result = await this.tracker.client.send('GetRelationships', {});
|
|
1937
|
+
if (result.error) {
|
|
1938
|
+
throw result.error;
|
|
1939
|
+
}
|
|
1940
|
+
}, 'all');
|
|
1941
|
+
}
|
|
1942
|
+
await this.promises.get('all');
|
|
1943
|
+
return this.relationships;
|
|
1944
|
+
}
|
|
1945
|
+
async exists(refUserId, type) {
|
|
1946
|
+
await this.get();
|
|
1947
|
+
return this.relationships.has(getId(refUserId, type));
|
|
1948
|
+
}
|
|
1949
|
+
handleRelationships(ev) {
|
|
1950
|
+
this.relationships.deleteAll();
|
|
1951
|
+
ev.relationships.forEach(relationship => {
|
|
1952
|
+
this.relationships.set(relationship);
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
handleNewRelationship(ev) {
|
|
1956
|
+
if (this.promises.has('all')) {
|
|
1957
|
+
this.relationships.set(ev.relationship);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
handleRelationshipDeleted(ev) {
|
|
1961
|
+
if (this.promises.has('all')) {
|
|
1962
|
+
this.relationships.delete(getIdFromRelationship(ev.relationship));
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
handleSession() {
|
|
1966
|
+
this.promises.forgetAll();
|
|
1967
|
+
this.relationships.deleteAll();
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1915
1970
|
;// CONCATENATED MODULE: ./src/state-tracker/ChatStateTracker.ts
|
|
1916
1971
|
function ChatStateTracker_defineProperty(obj, key, value) { key = ChatStateTracker_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1917
1972
|
function ChatStateTracker_toPropertyKey(arg) { var key = ChatStateTracker_toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
@@ -1922,6 +1977,7 @@ function ChatStateTracker_toPrimitive(input, hint) { if (typeof input !== "objec
|
|
|
1922
1977
|
|
|
1923
1978
|
|
|
1924
1979
|
|
|
1980
|
+
|
|
1925
1981
|
class ChatStateTracker {
|
|
1926
1982
|
constructor(client) {
|
|
1927
1983
|
this.client = client;
|
|
@@ -1945,6 +2001,10 @@ class ChatStateTracker {
|
|
|
1945
2001
|
* Users related state.
|
|
1946
2002
|
*/
|
|
1947
2003
|
ChatStateTracker_defineProperty(this, "users", new UsersManager(this));
|
|
2004
|
+
/**
|
|
2005
|
+
* State of relationships with other users.
|
|
2006
|
+
*/
|
|
2007
|
+
ChatStateTracker_defineProperty(this, "relationships", new RelationshipsManager(this));
|
|
1948
2008
|
ChatStateTracker_defineProperty(this, "_me", null);
|
|
1949
2009
|
ChatStateTracker_defineProperty(this, "deferredSession", new DeferredTask());
|
|
1950
2010
|
this.client.on('Session', ev => this.handleSession(ev));
|