mezon-js 2.7.1
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/README.md +244 -0
- package/api.gen.ts +4351 -0
- package/build.mjs +45 -0
- package/client.ts +1848 -0
- package/dist/api.gen.d.ts +735 -0
- package/dist/client.d.ts +527 -0
- package/dist/index.d.ts +24 -0
- package/dist/mezon-js.cjs.js +5204 -0
- package/dist/mezon-js.esm.mjs +5184 -0
- package/dist/session.d.ts +58 -0
- package/dist/socket.d.ts +673 -0
- package/dist/utils.d.ts +3 -0
- package/dist/web_socket_adapter.d.ts +83 -0
- package/index.ts +27 -0
- package/package.json +54 -0
- package/rollup.config.js +40 -0
- package/session.ts +114 -0
- package/socket.ts +1303 -0
- package/tsconfig.json +10 -0
- package/utils.ts +49 -0
- package/web_socket_adapter.ts +159 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2022 The Mezon Authors
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
/** A session authenticated for a user with Mezon server. */
|
17
|
+
export interface ISession {
|
18
|
+
/** Claims */
|
19
|
+
/** The authorization token used to construct this session. */
|
20
|
+
token: string;
|
21
|
+
/** If the user account for this session was just created. */
|
22
|
+
created: boolean;
|
23
|
+
/** The UNIX timestamp when this session was created. */
|
24
|
+
readonly created_at: number;
|
25
|
+
/** The UNIX timestamp when this session will expire. */
|
26
|
+
expires_at?: number;
|
27
|
+
/** The UNIX timestamp when the refresh token will expire. */
|
28
|
+
refresh_expires_at?: number;
|
29
|
+
/** Refresh token that can be used for session token renewal. */
|
30
|
+
refresh_token: string;
|
31
|
+
/** The username of the user who owns this session. */
|
32
|
+
username?: string;
|
33
|
+
/** The ID of the user who owns this session. */
|
34
|
+
user_id?: string;
|
35
|
+
/** Any custom properties associated with this session. */
|
36
|
+
vars?: object;
|
37
|
+
/** Validate token */
|
38
|
+
/** If the session has expired. */
|
39
|
+
isexpired(currenttime: number): boolean;
|
40
|
+
/** If the refresh token has expired. */
|
41
|
+
isrefreshexpired(currenttime: number): boolean;
|
42
|
+
}
|
43
|
+
export declare class Session implements ISession {
|
44
|
+
readonly created: boolean;
|
45
|
+
token: string;
|
46
|
+
readonly created_at: number;
|
47
|
+
expires_at?: number;
|
48
|
+
refresh_expires_at?: number;
|
49
|
+
refresh_token: string;
|
50
|
+
username?: string;
|
51
|
+
user_id?: string;
|
52
|
+
vars?: object;
|
53
|
+
constructor(token: string, refresh_token: string, created: boolean);
|
54
|
+
isexpired(currenttime: number): boolean;
|
55
|
+
isrefreshexpired(currenttime: number): boolean;
|
56
|
+
update(token: string, refreshToken: string): void;
|
57
|
+
static restore(token: string, refreshToken: string): Session;
|
58
|
+
}
|