@armoury/fivem-framework-common 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.
|
@@ -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;
|
|
@@ -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 {};
|