polfan-server-js-client 0.2.58 → 0.2.59

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.
@@ -1,6 +1,6 @@
1
1
  import { Message, Topic } from "../types/src";
2
2
  import { ChatStateTracker } from "./ChatStateTracker";
3
- import { IndexedObjectCollection, ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
3
+ import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
4
4
  export declare enum WindowState {
5
5
  /**
6
6
  * The latest messages (those received live) are available in the history window, history has not been fetched.
@@ -44,7 +44,7 @@ export declare abstract class TraversableRemoteCollection<T> extends ObservableI
44
44
  set limit(value: number | null);
45
45
  get hasLatest(): boolean;
46
46
  get hasOldest(): boolean;
47
- abstract createMirror(): IndexedObjectCollection<T>;
47
+ abstract createMirror(): TraversableRemoteCollection<T>;
48
48
  resetToLatest(): Promise<void>;
49
49
  fetchPrevious(): Promise<void>;
50
50
  fetchNext(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.58",
3
+ "version": "0.2.59",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -16,7 +16,6 @@
16
16
  }
17
17
  },
18
18
  "scripts": {
19
- "start": "webpack serve --config webpack.config.demo.js",
20
19
  "build": "npm run build:node && npm run build:browser && tsc",
21
20
  "build:node": "webpack --config webpack.config.node.js",
22
21
  "build:browser": "webpack --config webpack.config.browser.js",
@@ -25,33 +24,20 @@
25
24
  "trypublish": "npm publish || true"
26
25
  },
27
26
  "devDependencies": {
28
- "@babel/cli": "^7.20.7",
29
- "@babel/core": "^7.20.12",
30
- "@babel/plugin-proposal-class-properties": "^7.16.0",
31
- "@babel/plugin-transform-typescript": "^7.20.2",
32
- "@babel/polyfill": "^7.12.1",
33
- "@babel/preset-env": "^7.20.2",
27
+ "@babel/cli": "^7.28.3",
28
+ "@babel/core": "^7.28.5",
29
+ "@babel/preset-env": "^7.28.5",
34
30
  "@babel/preset-typescript": "^7.28.5",
35
- "@types/jest": "^29.2.5",
36
- "@typescript-eslint/eslint-plugin": "^4.33.0",
37
- "@typescript-eslint/parser": "^4.33.0",
38
- "babel-eslint": "^10.1.0",
39
- "babel-loader": "^9.1.2",
40
- "babel-preset-minify": "^0.5.2",
41
- "css-loader": "^6.7.3",
42
- "css-minimizer-webpack-plugin": "^4.2.2",
43
- "eslint": "^7.32.0",
31
+ "@types/jest": "^29.5.14",
32
+ "babel-loader": "^9.2.1",
44
33
  "file-loader": "^6.2.0",
45
- "html-webpack-plugin": "^5.5.0",
46
- "jest": "^29.3.1",
47
- "mini-css-extract-plugin": "^2.7.2",
48
- "style-loader": "^3.3.1",
49
- "terser-webpack-plugin": "^5.3.5",
34
+ "jest": "^29.7.0",
50
35
  "ts-node": "^10.9.2",
51
- "typescript": "^4.9.4",
52
- "url-loader": "^4.1.1",
53
- "webpack": "^5.75.0",
54
- "webpack-cli": "^5.0.1",
55
- "webpack-dev-server": "4.11.1"
36
+ "typescript": "^4.9.5",
37
+ "webpack": "^5.103.0",
38
+ "webpack-cli": "^5.1.4"
39
+ },
40
+ "dependencies": {
41
+ "terser-webpack-plugin": "^5.3.14"
56
42
  }
57
43
  }
@@ -9,41 +9,51 @@ import {UsersManager} from "./UsersManager";
9
9
  import {RelationshipsManager} from "./RelationshipsManager";
10
10
 
11
11
  export class ChatStateTracker {
12
+ public readonly client: WebSocketChatClient;
13
+
12
14
  /**
13
15
  * State of your permissions.
14
16
  */
15
- public readonly permissions = new PermissionsManager(this);
17
+ public readonly permissions: PermissionsManager;
16
18
 
17
19
  /**
18
20
  * State of the rooms you are in.
19
21
  */
20
- public readonly rooms: RoomsManager = new RoomsManager(this);
22
+ public readonly rooms: RoomsManager;
21
23
 
22
24
  /**
23
25
  * State of the spaces you are in.
24
26
  */
25
- public readonly spaces = new SpacesManager(this);
27
+ public readonly spaces: SpacesManager;
26
28
 
27
29
  /**
28
30
  * State of the emoticons (global and space-related).
29
31
  */
30
- public readonly emoticons = new EmoticonsManager(this);
32
+ public readonly emoticons: EmoticonsManager;
31
33
 
32
34
  /**
33
35
  * Users related state.
34
36
  */
35
- public readonly users = new UsersManager(this);
37
+ public readonly users: UsersManager;
36
38
 
37
39
  /**
38
40
  * State of relationships with other users.
39
41
  */
40
- public readonly relationships = new RelationshipsManager(this);
42
+ public readonly relationships: RelationshipsManager;
41
43
 
42
44
  private _me: User = null;
43
45
  private readonly deferredSession = new DeferredTask();
44
46
 
45
- public constructor(public readonly client: WebSocketChatClient) {
47
+ public constructor(client: WebSocketChatClient) {
48
+ this.client = client;
46
49
  this.client.on('Session', ev => this.handleSession(ev));
50
+
51
+ this.permissions = new PermissionsManager(this);
52
+ this.rooms = new RoomsManager(this);
53
+ this.spaces = new SpacesManager(this);
54
+ this.emoticons = new EmoticonsManager(this);
55
+ this.users = new UsersManager(this);
56
+ this.relationships = new RelationshipsManager(this);
47
57
  }
48
58
 
49
59
  public get me(): User | null {
@@ -74,7 +74,7 @@ export class RoomMessagesHistory {
74
74
 
75
75
  const historyWindow = new TopicHistoryWindow(this.room.id, topic.id, this.tracker);
76
76
 
77
- historyWindow.setTraverseLock(this.traverseLock);
77
+ void historyWindow.setTraverseLock(this.traverseLock);
78
78
 
79
79
  this.historyWindows.set([topic.id, historyWindow]);
80
80
 
@@ -1,6 +1,6 @@
1
1
  import {Message, NewMessage, Session, Topic} from "../types/src";
2
2
  import {ChatStateTracker} from "./ChatStateTracker";
3
- import {IndexedObjectCollection, ObservableIndexedObjectCollection} from "../IndexedObjectCollection";
3
+ import {ObservableIndexedObjectCollection} from "../IndexedObjectCollection";
4
4
 
5
5
  export enum WindowState {
6
6
  /**
@@ -70,7 +70,7 @@ export abstract class TraversableRemoteCollection<T> extends ObservableIndexedOb
70
70
  return this.state === WindowState.OLDEST || this.internalState.oldestId !== null && this.has(this.internalState.oldestId);
71
71
  }
72
72
 
73
- public abstract createMirror(): IndexedObjectCollection<T>;
73
+ public abstract createMirror(): TraversableRemoteCollection<T>;
74
74
 
75
75
  public async resetToLatest(): Promise<void> {
76
76
  if (this.internalState.ongoing || this.internalState.current === WindowState.LATEST) {
@@ -1,6 +1,5 @@
1
1
  const path = require('path');
2
- const TerserPlugin = require('terser-webpack-plugin');
3
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2
+ const TerserPlugin = require("terser-webpack-plugin");
4
3
 
5
4
  module.exports = {
6
5
  mode: "production",
@@ -27,32 +26,11 @@ module.exports = {
27
26
  test: /\.(m|j|t)s$/,
28
27
  exclude: /(node_modules|bower_components)/,
29
28
  use: {
30
- loader: 'babel-loader',
31
- options: {
32
- presets: [
33
- ['@babel/preset-env', { targets: { esmodules: true } }],
34
- '@babel/preset-typescript'
35
- ],
36
- plugins: [
37
-
38
- ]
39
- }
29
+ loader: 'babel-loader'
40
30
  }
41
31
  },
42
- {
43
- test: /\.(sa|sc|c)ss$/,
44
- use: [
45
- MiniCssExtractPlugin.loader,
46
- { loader: "css-loader", options: { sourceMap: true } },
47
- ],
48
- }
49
32
  ]
50
33
  },
51
- plugins: [
52
- new MiniCssExtractPlugin({
53
- filename: 'index.css',
54
- }),
55
- ],
56
34
  resolve: {
57
35
  extensions: ['.ts', '.js', '.json']
58
36
  }
@@ -24,24 +24,12 @@ module.exports = {
24
24
  test: /\.(m|j|t)s$/,
25
25
  exclude: /(node_modules|bower_components)/,
26
26
  use: {
27
- loader: 'babel-loader',
28
- options: {
29
- presets: [
30
- ['@babel/preset-env', { targets: { node: 'current' } }],
31
- '@babel/preset-typescript'
32
- ],
33
- plugins: [
34
-
35
- ]
36
- }
27
+ loader: 'babel-loader'
37
28
  }
38
29
  },
39
30
  ]
40
31
  },
41
32
  resolve: {
42
33
  extensions: ['.ts', '.js', '.json']
43
- },
44
- externals: [
45
-
46
- ]
34
+ }
47
35
  };
package/.eslintignore DELETED
File without changes
package/.eslintrc.json DELETED
File without changes