@accelbyte/sdk 0.0.0-dev-20241024073009 → 0.0.0-dev-20250113092628
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 +127 -50
- package/dist/cjs/node/index.cjs +86 -47
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.browser.js +81 -47
- package/dist/es/browser/index.browser.js.map +1 -1
- package/dist/es/node/index.node.js +85 -47
- package/dist/es/node/index.node.js.map +1 -1
- package/dist/global/index.global.js +107 -0
- package/dist/index.d.ts +46 -10
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,34 +7,60 @@ type MakeRequired<T, K extends keyof T> = T & {
|
|
|
7
7
|
};
|
|
8
8
|
declare function isType<T extends ZodTypeAny>(schema: T, data: unknown): data is z.infer<T>;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
declare const CoreConfig: z.ZodObject<{
|
|
11
11
|
/**
|
|
12
12
|
* The client ID for the SDK. This value is retrieved from Admin Portal, OAuth Clients.
|
|
13
13
|
*/
|
|
14
|
-
clientId:
|
|
14
|
+
clientId: z.ZodString;
|
|
15
15
|
/**
|
|
16
16
|
* The redirect URI after logging in. This is used to generate the valid login URL to IAM.
|
|
17
17
|
* This value is retrieved from Admin Portal, OAuth Clients.
|
|
18
18
|
*/
|
|
19
|
-
redirectURI:
|
|
19
|
+
redirectURI: z.ZodString;
|
|
20
20
|
/**
|
|
21
21
|
* The base URL of your AGS deployment.
|
|
22
22
|
*/
|
|
23
|
-
baseURL:
|
|
23
|
+
baseURL: z.ZodString;
|
|
24
24
|
/**
|
|
25
25
|
* The namespace of your AGS deployment.
|
|
26
26
|
*/
|
|
27
|
-
namespace:
|
|
27
|
+
namespace: z.ZodString;
|
|
28
28
|
/**
|
|
29
29
|
* When "false" is provided, the SDK bypasses Zod Schema Validation.
|
|
30
30
|
* Default is "true".
|
|
31
31
|
*/
|
|
32
|
+
useSchemaValidation: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
clientId: string;
|
|
35
|
+
redirectURI: string;
|
|
36
|
+
baseURL: string;
|
|
37
|
+
namespace: string;
|
|
32
38
|
useSchemaValidation: boolean;
|
|
33
|
-
}
|
|
39
|
+
}, {
|
|
40
|
+
clientId: string;
|
|
41
|
+
redirectURI: string;
|
|
42
|
+
baseURL: string;
|
|
43
|
+
namespace: string;
|
|
44
|
+
useSchemaValidation?: boolean | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
type CoreConfig = z.infer<typeof CoreConfig>;
|
|
34
47
|
interface AxiosConfig {
|
|
35
48
|
interceptors?: Interceptor[];
|
|
36
49
|
request?: AxiosRequestConfig;
|
|
37
50
|
}
|
|
51
|
+
interface WebSocketConfig {
|
|
52
|
+
/**
|
|
53
|
+
* Allow reconnect when upstream is abruptly disconnected.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
allowReconnect?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Maximum number of reconnect attempts. Positive value integer.
|
|
59
|
+
* Set 0 for unlimited attempts.
|
|
60
|
+
* @default 0
|
|
61
|
+
*/
|
|
62
|
+
maxReconnectAttempts?: number;
|
|
63
|
+
}
|
|
38
64
|
type Interceptor = {
|
|
39
65
|
type: 'request';
|
|
40
66
|
name: string;
|
|
@@ -49,10 +75,12 @@ type Interceptor = {
|
|
|
49
75
|
interface SdkConstructorParam {
|
|
50
76
|
coreConfig: MakeOptional<CoreConfig, 'useSchemaValidation'>;
|
|
51
77
|
axiosConfig?: AxiosConfig;
|
|
78
|
+
webSocketConfig?: WebSocketConfig;
|
|
52
79
|
}
|
|
53
80
|
interface SdkSetConfigParam {
|
|
54
81
|
coreConfig?: Partial<CoreConfig>;
|
|
55
82
|
axiosConfig?: AxiosConfig;
|
|
83
|
+
webSocketConfig?: WebSocketConfig;
|
|
56
84
|
}
|
|
57
85
|
type ApiError = {
|
|
58
86
|
errorCode: number | string;
|
|
@@ -70,16 +98,24 @@ declare class AccelByteSDK {
|
|
|
70
98
|
private coreConfig;
|
|
71
99
|
private axiosConfig;
|
|
72
100
|
private axiosInstance;
|
|
101
|
+
private webSocketConfig;
|
|
73
102
|
private token;
|
|
74
|
-
constructor({ coreConfig, axiosConfig }: SdkConstructorParam);
|
|
103
|
+
constructor({ coreConfig, axiosConfig, webSocketConfig }: SdkConstructorParam);
|
|
75
104
|
private createAxiosInstance;
|
|
76
105
|
/**
|
|
77
106
|
* Assembles and returns the current Axios instance along with core and Axios configurations.
|
|
78
107
|
*/
|
|
79
108
|
assembly(): {
|
|
80
109
|
axiosInstance: AxiosInstance;
|
|
81
|
-
coreConfig:
|
|
110
|
+
coreConfig: {
|
|
111
|
+
clientId: string;
|
|
112
|
+
redirectURI: string;
|
|
113
|
+
baseURL: string;
|
|
114
|
+
namespace: string;
|
|
115
|
+
useSchemaValidation: boolean;
|
|
116
|
+
};
|
|
82
117
|
axiosConfig: MakeRequired<AxiosConfig, "request">;
|
|
118
|
+
webSocketConfig: WebSocketConfig;
|
|
83
119
|
};
|
|
84
120
|
/**
|
|
85
121
|
* Creates a new instance of AccelByteSDK with a shallow copy of the current configurations.
|
|
@@ -104,7 +140,7 @@ declare class AccelByteSDK {
|
|
|
104
140
|
* Updates the SDK's core and Axios configurations.
|
|
105
141
|
* Merges the provided configurations with the current ones.
|
|
106
142
|
*/
|
|
107
|
-
setConfig({ coreConfig, axiosConfig }: SdkSetConfigParam): this;
|
|
143
|
+
setConfig({ coreConfig, axiosConfig, webSocketConfig }: SdkSetConfigParam): this;
|
|
108
144
|
/**
|
|
109
145
|
* Set accessToken and refreshToken and updates the Axios request headers to use Bearer authentication.
|
|
110
146
|
*/
|
|
@@ -465,4 +501,4 @@ declare class UrlHelper {
|
|
|
465
501
|
static removeQueryParam(fullUrlString: string, param: string): string;
|
|
466
502
|
}
|
|
467
503
|
|
|
468
|
-
export { AccelByte, AccelByteSDK, type ApiError, ApiUtils, type AxiosConfig, BrowserHelper, CodeGenUtil,
|
|
504
|
+
export { AccelByte, AccelByteSDK, type ApiError, ApiUtils, type AxiosConfig, BrowserHelper, CodeGenUtil, CoreConfig, DecodeError, DesktopChecker, ERROR_CODE_LINK_DELETION_ACCOUNT, ERROR_CODE_TOKEN_EXPIRED, ERROR_LINK_ANOTHER_3RD_PARTY_ACCOUNT, ERROR_USER_BANNED, ErrorInterceptors, IamErrorCode, type Interceptor, type MakeOptional, type MakeRequired, Network, RefreshSession, RefreshToken, type Response, type ResponseError, type SdkConstructorParam, SdkDevice, type SdkSetConfigParam, type TokenConfig, UrlHelper, Validate, type WebSocketConfig, createAuthInterceptor, createCustomPathInterceptor, createGetSessionInterceptor, createRefreshSessionInterceptor, isType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accelbyte/sdk",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250113092628",
|
|
4
4
|
"author": "AccelByte Inc",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"main": "./dist/cjs/node/index.cjs",
|
|
@@ -48,15 +48,16 @@
|
|
|
48
48
|
"vitest": "2.0.5"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@accelbyte/validator": "0.0.0-dev-
|
|
51
|
+
"@accelbyte/validator": "0.0.0-dev-20250113092628",
|
|
52
52
|
"axios": "1.7.7",
|
|
53
53
|
"buffer": "6.0.3",
|
|
54
|
-
"crypto-js": "4.
|
|
54
|
+
"crypto-js": "4.2.0",
|
|
55
55
|
"nanoid": "3.1.31",
|
|
56
56
|
"platform": "1.3.6",
|
|
57
57
|
"query-string": "7.1.1",
|
|
58
58
|
"uuid": "8.3.2",
|
|
59
59
|
"validator": "13.7.0",
|
|
60
|
+
"ws": "8.18.0",
|
|
60
61
|
"zod": "3.23.8"
|
|
61
62
|
},
|
|
62
63
|
"sideEffects": [
|