@armoury/fivem-framework-server 1.0.22 → 1.0.23

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.
@@ -23,6 +23,15 @@ let SessionService = class SessionService {
23
23
  constructor(armouryResource) {
24
24
  this.armouryResource = armouryResource;
25
25
  }
26
+ getNumPlayersConnected() {
27
+ return this.armouryResource.instance.getNumPlayersConnected();
28
+ }
29
+ getAllPlayerIds() {
30
+ return this.armouryResource.instance.getAllPlayerIds();
31
+ }
32
+ getAllPlayerPrincipals() {
33
+ return this.armouryResource.instance.getAllPlayerPrincipals();
34
+ }
26
35
  isPlayerConnected(playerId) {
27
36
  return this.armouryResource.instance.isPlayerConnected(playerId);
28
37
  }
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./account"), exports);
18
18
  __exportStar(require("./character"), exports);
19
+ /** Session */
19
20
  __exportStar(require("./session"), exports);
21
+ __exportStar(require("./session-update-type"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionUpdateType = void 0;
4
+ var SessionUpdateType;
5
+ (function (SessionUpdateType) {
6
+ SessionUpdateType[SessionUpdateType["PrincipalUpdate"] = 0] = "PrincipalUpdate";
7
+ })(SessionUpdateType || (exports.SessionUpdateType = SessionUpdateType = {}));
@@ -6,7 +6,7 @@ class Session {
6
6
  this.id = id;
7
7
  this.platformId = platformId;
8
8
  this.lastKnownName = lastKnownName;
9
- this.principal = principal !== null && principal !== void 0 ? principal : id;
9
+ this.principal = principal;
10
10
  }
11
11
  }
12
12
  exports.Session = Session;
@@ -20,6 +20,15 @@ let SessionService = class SessionService {
20
20
  constructor(armouryResource) {
21
21
  this.armouryResource = armouryResource;
22
22
  }
23
+ getNumPlayersConnected() {
24
+ return this.armouryResource.instance.getNumPlayersConnected();
25
+ }
26
+ getAllPlayerIds() {
27
+ return this.armouryResource.instance.getAllPlayerIds();
28
+ }
29
+ getAllPlayerPrincipals() {
30
+ return this.armouryResource.instance.getAllPlayerPrincipals();
31
+ }
23
32
  isPlayerConnected(playerId) {
24
33
  return this.armouryResource.instance.isPlayerConnected(playerId);
25
34
  }
@@ -1,3 +1,5 @@
1
1
  export * from './account';
2
2
  export * from './character';
3
+ /** Session */
3
4
  export * from './session';
5
+ export * from './session-update-type';
@@ -0,0 +1,4 @@
1
+ export var SessionUpdateType;
2
+ (function (SessionUpdateType) {
3
+ SessionUpdateType[SessionUpdateType["PrincipalUpdate"] = 0] = "PrincipalUpdate";
4
+ })(SessionUpdateType || (SessionUpdateType = {}));
@@ -3,6 +3,6 @@ export class Session {
3
3
  this.id = id;
4
4
  this.platformId = platformId;
5
5
  this.lastKnownName = lastKnownName;
6
- this.principal = principal !== null && principal !== void 0 ? principal : id;
6
+ this.principal = principal;
7
7
  }
8
8
  }
@@ -2,6 +2,9 @@ import { ResourceRef, Session } from '@armoury/fivem-framework-common';
2
2
  export declare class SessionService {
3
3
  private readonly armouryResource;
4
4
  constructor(armouryResource: ResourceRef);
5
+ getNumPlayersConnected(): number;
6
+ getAllPlayerIds(): number[];
7
+ getAllPlayerPrincipals(): number[];
5
8
  isPlayerConnected(playerId: number): boolean;
6
9
  getSessionByPlayerId(playerId: number): Session;
7
10
  setPlayerPrincipal(playerId: number, principal: number): void;
@@ -1,3 +1,5 @@
1
1
  export * from './account';
2
2
  export * from './character';
3
+ /** Session */
3
4
  export * from './session';
5
+ export * from './session-update-type';
@@ -0,0 +1,3 @@
1
+ export declare enum SessionUpdateType {
2
+ PrincipalUpdate = 0
3
+ }
@@ -2,11 +2,12 @@ export interface Session {
2
2
  readonly id: number;
3
3
  readonly platformId: string;
4
4
  readonly lastKnownName: string;
5
- principal: number;
5
+ principal?: number;
6
6
  }
7
7
  export declare class Session {
8
8
  readonly id: number;
9
9
  readonly platformId: string;
10
10
  readonly lastKnownName: string;
11
- constructor(id: number, platformId: string, lastKnownName: string, principal?: number);
11
+ principal?: number | undefined;
12
+ constructor(id: number, platformId: string, lastKnownName: string, principal?: number | undefined);
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armoury/fivem-framework-server",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Server APIs for the Armoury FiveM framework",
5
5
  "main": "dist/cjs/server/index.js",
6
6
  "module": "dist/esm/server/index.js",
@@ -27,7 +27,7 @@
27
27
  "rxjs": "^7.8.1"
28
28
  },
29
29
  "peerDependencies": {
30
- "@armoury/fivem-framework-common": "1.0.22",
30
+ "@armoury/fivem-framework-common": "1.0.23",
31
31
  "drizzle-orm": "^0.45.4",
32
32
  "mysql2": "^3.24.5"
33
33
  },