@armoury/fivem-framework-server 1.0.36 → 1.0.37
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/dist/cjs/server/services/session/session.service.js +2 -8
- package/dist/cjs/shared/models/session.js +6 -0
- package/dist/esm/server/services/session/session.service.js +2 -8
- package/dist/esm/shared/models/session.js +6 -0
- package/dist/types/server/services/session/session.service.d.ts +0 -1
- package/dist/types/shared/models/session.d.ts +1 -0
- package/package.json +2 -2
|
@@ -32,20 +32,14 @@ let SessionService = class SessionService {
|
|
|
32
32
|
return this.armouryResource.instance.isPlayerConnected(playerId);
|
|
33
33
|
}
|
|
34
34
|
getSessionByPlayerId(playerId) {
|
|
35
|
-
return
|
|
35
|
+
return fivem_framework_common_1.Session.from(this.armouryResource.instance.getSessionByPlayerId(playerId));
|
|
36
36
|
}
|
|
37
37
|
getSessionByPrincipal(principal) {
|
|
38
|
-
return
|
|
38
|
+
return fivem_framework_common_1.Session.from(this.armouryResource.instance.getSessionByPrincipal(principal));
|
|
39
39
|
}
|
|
40
40
|
setPlayerPrincipal(playerId, principal) {
|
|
41
41
|
this.armouryResource.instance.setPlayerPrincipal(playerId, principal);
|
|
42
42
|
}
|
|
43
|
-
toSessionInstance(session) {
|
|
44
|
-
if (session instanceof fivem_framework_common_1.Session) {
|
|
45
|
-
return session;
|
|
46
|
-
}
|
|
47
|
-
return new fivem_framework_common_1.Session(session.id, session.platformId, session.lastKnownName, session.principal);
|
|
48
|
-
}
|
|
49
43
|
};
|
|
50
44
|
exports.SessionService = SessionService;
|
|
51
45
|
exports.SessionService = SessionService = __decorate([
|
|
@@ -105,5 +105,11 @@ class Session {
|
|
|
105
105
|
this.setState(claimName, value, false);
|
|
106
106
|
return value;
|
|
107
107
|
}
|
|
108
|
+
static from(session) {
|
|
109
|
+
if (session instanceof Session) {
|
|
110
|
+
return session;
|
|
111
|
+
}
|
|
112
|
+
return new Session(session.id, session.platformId, session.lastKnownName, session.principal);
|
|
113
|
+
}
|
|
108
114
|
}
|
|
109
115
|
exports.Session = Session;
|
|
@@ -29,20 +29,14 @@ let SessionService = class SessionService {
|
|
|
29
29
|
return this.armouryResource.instance.isPlayerConnected(playerId);
|
|
30
30
|
}
|
|
31
31
|
getSessionByPlayerId(playerId) {
|
|
32
|
-
return
|
|
32
|
+
return Session.from(this.armouryResource.instance.getSessionByPlayerId(playerId));
|
|
33
33
|
}
|
|
34
34
|
getSessionByPrincipal(principal) {
|
|
35
|
-
return
|
|
35
|
+
return Session.from(this.armouryResource.instance.getSessionByPrincipal(principal));
|
|
36
36
|
}
|
|
37
37
|
setPlayerPrincipal(playerId, principal) {
|
|
38
38
|
this.armouryResource.instance.setPlayerPrincipal(playerId, principal);
|
|
39
39
|
}
|
|
40
|
-
toSessionInstance(session) {
|
|
41
|
-
if (session instanceof Session) {
|
|
42
|
-
return session;
|
|
43
|
-
}
|
|
44
|
-
return new Session(session.id, session.platformId, session.lastKnownName, session.principal);
|
|
45
|
-
}
|
|
46
40
|
};
|
|
47
41
|
SessionService = __decorate([
|
|
48
42
|
Injectable(),
|
|
@@ -102,4 +102,10 @@ export class Session {
|
|
|
102
102
|
this.setState(claimName, value, false);
|
|
103
103
|
return value;
|
|
104
104
|
}
|
|
105
|
+
static from(session) {
|
|
106
|
+
if (session instanceof Session) {
|
|
107
|
+
return session;
|
|
108
|
+
}
|
|
109
|
+
return new Session(session.id, session.platformId, session.lastKnownName, session.principal);
|
|
110
|
+
}
|
|
105
111
|
}
|
|
@@ -73,6 +73,7 @@ export declare class Session {
|
|
|
73
73
|
* @returns the updated value, or null if not found or impossible to update.
|
|
74
74
|
*/
|
|
75
75
|
setServerClaim<T extends Primitive>(claimName: string, value: T): T | null;
|
|
76
|
+
static from(session: Session): Session;
|
|
76
77
|
}
|
|
77
78
|
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
78
79
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armoury/fivem-framework-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
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.
|
|
30
|
+
"@armoury/fivem-framework-common": "1.0.37"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|