@xmobitea/gn-typescript-client 0.0.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.
Files changed (85) hide show
  1. package/GNServerSettingsConfig.debug.json +21 -0
  2. package/dist/editor/GNServerSettingsEditor.d.ts +2 -0
  3. package/dist/index.d.ts +160 -0
  4. package/dist/runtime/GNNetwork.d.ts +85 -0
  5. package/dist/runtime/common/Action0.d.ts +3 -0
  6. package/dist/runtime/common/Action1.d.ts +3 -0
  7. package/dist/runtime/common/Action2.d.ts +3 -0
  8. package/dist/runtime/common/Action3.d.ts +3 -0
  9. package/dist/runtime/common/Action4.d.ts +3 -0
  10. package/dist/runtime/common/GNData.d.ts +69 -0
  11. package/dist/runtime/config/GNServerSettings.d.ts +56 -0
  12. package/dist/runtime/constant/Commands.d.ts +16 -0
  13. package/dist/runtime/constant/EventCode.d.ts +3 -0
  14. package/dist/runtime/constant/OperationCode.d.ts +13 -0
  15. package/dist/runtime/constant/ReturnCode.d.ts +12 -0
  16. package/dist/runtime/constant/enumType/FriendStatus.d.ts +6 -0
  17. package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +4 -0
  18. package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +17 -0
  19. package/dist/runtime/constant/enumType/LoginType.d.ts +10 -0
  20. package/dist/runtime/constant/enumType/PlatformType.d.ts +8 -0
  21. package/dist/runtime/constant/enumType/UserRoleType.d.ts +8 -0
  22. package/dist/runtime/constant/errorCode/DebugErrorCode.d.ts +3 -0
  23. package/dist/runtime/constant/errorCode/EnterDisplayNameErrorCode.d.ts +3 -0
  24. package/dist/runtime/constant/errorCode/FetchAllDataErrorCode.d.ts +4 -0
  25. package/dist/runtime/constant/errorCode/FetchSparkPlayerErrorCode.d.ts +4 -0
  26. package/dist/runtime/constant/errorCode/FileUploadInfoErrorCode.d.ts +5 -0
  27. package/dist/runtime/constant/errorCode/GetAppConfigErrorCode.d.ts +3 -0
  28. package/dist/runtime/constant/errorCode/LoginErrorCode.d.ts +11 -0
  29. package/dist/runtime/constant/errorCode/RegisterSocketErrorCode.d.ts +3 -0
  30. package/dist/runtime/constant/parameterCode/DebugParameterCode.d.ts +7 -0
  31. package/dist/runtime/constant/parameterCode/EnterDisplayNameParameterCode.d.ts +4 -0
  32. package/dist/runtime/constant/parameterCode/FetchAllDataParameterCode.d.ts +7 -0
  33. package/dist/runtime/constant/parameterCode/FetchSparkPlayerParameterCode.d.ts +15 -0
  34. package/dist/runtime/constant/parameterCode/FileUploadInfoParameterCode.d.ts +11 -0
  35. package/dist/runtime/constant/parameterCode/GetAppConfigParameterCode.d.ts +4 -0
  36. package/dist/runtime/constant/parameterCode/LoginParameterCode.d.ts +18 -0
  37. package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +6 -0
  38. package/dist/runtime/constant/parameterCode/RegisterSocketParameterCode.d.ts +3 -0
  39. package/dist/runtime/entity/InvalidMember.d.ts +5 -0
  40. package/dist/runtime/entity/OperationEvent.d.ts +14 -0
  41. package/dist/runtime/entity/OperationHelper.d.ts +16 -0
  42. package/dist/runtime/entity/OperationRequest.d.ts +23 -0
  43. package/dist/runtime/entity/OperationResponse.d.ts +27 -0
  44. package/dist/runtime/entity/request/CreateNewFileUploadInfoOperationRequest.d.ts +6 -0
  45. package/dist/runtime/entity/request/CustomOperationRequest.d.ts +10 -0
  46. package/dist/runtime/entity/request/DebugOperationRequest.d.ts +7 -0
  47. package/dist/runtime/entity/request/EnterDisplayNameOperationRequest.d.ts +6 -0
  48. package/dist/runtime/entity/request/FetchAllDataOperationRequest.d.ts +6 -0
  49. package/dist/runtime/entity/request/FetchSparkPlayerOperationRequest.d.ts +6 -0
  50. package/dist/runtime/entity/request/GetAppConfigOperationRequest.d.ts +7 -0
  51. package/dist/runtime/entity/request/GetFileUploadInfoOperationRequest.d.ts +6 -0
  52. package/dist/runtime/entity/request/LoginOperationRequest.d.ts +33 -0
  53. package/dist/runtime/entity/request/LogoutOperationRequest.d.ts +6 -0
  54. package/dist/runtime/entity/request/RegisterAccountOperationRequest.d.ts +6 -0
  55. package/dist/runtime/entity/request/RegisterSocketOperationRequest.d.ts +6 -0
  56. package/dist/runtime/entity/request/TemplateOperationRequest.d.ts +6 -0
  57. package/dist/runtime/entity/response/CreateNewFileUploadInfoOperationResponse.d.ts +10 -0
  58. package/dist/runtime/entity/response/CustomOperationResponse.d.ts +14 -0
  59. package/dist/runtime/entity/response/DebugOperationResponse.d.ts +11 -0
  60. package/dist/runtime/entity/response/EnterDisplayNameOperationResponse.d.ts +7 -0
  61. package/dist/runtime/entity/response/FetchAllDataOperationResponse.d.ts +10 -0
  62. package/dist/runtime/entity/response/FetchSparkPlayerOperationResponse.d.ts +20 -0
  63. package/dist/runtime/entity/response/GetAppConfigOperationResponse.d.ts +6 -0
  64. package/dist/runtime/entity/response/GetFileUploadInfoOperationResponse.d.ts +15 -0
  65. package/dist/runtime/entity/response/LoginOperationResponse.d.ts +9 -0
  66. package/dist/runtime/entity/response/LogoutOperationResponse.d.ts +5 -0
  67. package/dist/runtime/entity/response/PublicAddressGetRandomMessageOperationResponse.d.ts +6 -0
  68. package/dist/runtime/entity/response/RegisterAccountOperationResponse.d.ts +5 -0
  69. package/dist/runtime/entity/response/RegisterSocketOperationResponse.d.ts +5 -0
  70. package/dist/runtime/entity/response/TemplateOperationResponse.d.ts +6 -0
  71. package/dist/runtime/helper/CodeHelper.d.ts +16 -0
  72. package/dist/runtime/helper/GNSupport.d.ts +5 -0
  73. package/dist/runtime/logger/GNDebug.d.ts +15 -0
  74. package/dist/runtime/networking/HttpPeer.d.ts +29 -0
  75. package/dist/runtime/networking/IPeer.d.ts +9 -0
  76. package/dist/runtime/networking/NetworkingPeer.d.ts +74 -0
  77. package/dist/runtime/networking/NetworkingPeerBase.d.ts +47 -0
  78. package/dist/runtime/networking/NetworkingPeerSocket.d.ts +22 -0
  79. package/dist/runtime/networking/OperationPending.d.ts +17 -0
  80. package/dist/runtime/networking/PeerBase.d.ts +28 -0
  81. package/dist/runtime/networking/SocketPeer.d.ts +24 -0
  82. package/dist/runtime/networking/handler/IServerEventHandler.d.ts +14 -0
  83. package/dist/runtime/networking/handler/OnDebugEventHander.d.ts +6 -0
  84. package/index.js +391 -0
  85. package/package.json +37 -0
@@ -0,0 +1,4 @@
1
+ export declare class GetAppConfigParameterCode {
2
+ static readonly ConfigTypes: string;
3
+ static readonly ConfigNotUptodateLst: string;
4
+ }
@@ -0,0 +1,18 @@
1
+ export declare class LoginParameterCode {
2
+ static readonly LoginType: string;
3
+ static readonly Username: string;
4
+ static readonly Password: string;
5
+ static readonly DeviceInfo: string;
6
+ static readonly FacebookToken: string;
7
+ static readonly GoogleToken: string;
8
+ static readonly UserId: string;
9
+ static readonly AppleToken: string;
10
+ static readonly DisplayName: string;
11
+ static readonly Signature: string;
12
+ static readonly PublicAddress: string;
13
+ static readonly Message: string;
14
+ static readonly CustomId: string;
15
+ static readonly TsExpire: string;
16
+ static readonly Reason: string;
17
+ static readonly GoogleLoginType: string;
18
+ }
@@ -0,0 +1,6 @@
1
+ export declare class ParameterCode {
2
+ static readonly AuthToken: string;
3
+ static readonly Ts: string;
4
+ static readonly ErrorCode: string;
5
+ static readonly UserId: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare class RegisterSocketParameterCode {
2
+ static readonly SId: string;
3
+ }
@@ -0,0 +1,5 @@
1
+ import { InvalidMemberType } from "./../constant/enumType/InvalidMemberType";
2
+ export declare class InvalidMember {
3
+ code: number;
4
+ invalidMemberType: InvalidMemberType;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { GNHashtable } from "./../common/GNData";
2
+ export declare class OperationEvent {
3
+ private eventCode;
4
+ private parameters;
5
+ private encrypted;
6
+ constructor(eventCode: number, parameters?: GNHashtable, encrypted?: boolean);
7
+ getEventCode(): number;
8
+ getParameters(): GNHashtable;
9
+ isEncrypted(): boolean;
10
+ setScriptData(k: string, value: any): OperationEvent;
11
+ setParameters(parameters: GNHashtable): OperationEvent;
12
+ setEncrypted(encrypted: boolean): OperationEvent;
13
+ toString(): string;
14
+ }
@@ -0,0 +1,16 @@
1
+ import { InvalidMember } from "./InvalidMember";
2
+ import { OperationEvent } from "./OperationEvent";
3
+ import { OperationRequest } from "./OperationRequest";
4
+ import { OperationResponse } from "./OperationResponse";
5
+ export declare class OperationHelper {
6
+ private static invalidMemberData;
7
+ static toResponseSocketData(operationResponse: OperationResponse): [number, any, number];
8
+ static toResponseHttpData(operationResponse: OperationResponse): [number, any];
9
+ static newOperationResponse(operationCode: number, responseId: number, encrypted: boolean): OperationResponse;
10
+ static newOperationResponseInvalid(operationCode: number, responseId: number, encrypted: boolean, debugMessage?: string): OperationResponse;
11
+ static newOperationResponseInvalidRequestParameters(operationCode: number, responseId: number, invalidMembers: InvalidMember[], encrypted: boolean, debugMessage?: string): OperationResponse;
12
+ static newOperationResponseInternalServerError(operationCode: number, responseId: number, encrypted: boolean, debugMessage?: string): OperationResponse;
13
+ static newOperationResponseNotAuthorized(operationCode: number, responseId: number, encrypted: boolean, debugMessage?: string): OperationResponse;
14
+ static toEventSocketData(operationEvent: OperationEvent): [number, {}];
15
+ static toSocketData(request: OperationRequest): any[];
16
+ }
@@ -0,0 +1,23 @@
1
+ import { GNHashtable } from "./../common/GNData";
2
+ export declare class OperationRequest {
3
+ static readonly DefaultTimeOut: number;
4
+ private isValid;
5
+ isValidRequest(): boolean;
6
+ private operationCode;
7
+ private requestId;
8
+ private parameters;
9
+ private encrypted;
10
+ private timeout;
11
+ constructor(operationCode: number, encrypted: boolean, timeout?: number);
12
+ getOperationCode(): number;
13
+ getRequestId(): number;
14
+ getParameters(): GNHashtable;
15
+ isEncrypted(): boolean;
16
+ getTimeout(): number;
17
+ setRequestId(requestId: number): OperationRequest;
18
+ setScriptData(key: string, value: any): OperationRequest;
19
+ setParameters(parameters: GNHashtable): OperationRequest;
20
+ setEncrypted(encrypted: boolean): OperationRequest;
21
+ setTimeout(timeout: number): OperationRequest;
22
+ toString(): string;
23
+ }
@@ -0,0 +1,27 @@
1
+ import { GNHashtable } from "./../common/GNData";
2
+ import { InvalidMember } from "./InvalidMember";
3
+ export declare class OperationResponse {
4
+ private operationCode;
5
+ private responseId;
6
+ private returnCode;
7
+ private debugMessage;
8
+ private parameters;
9
+ private encrypted;
10
+ private invalidMembers;
11
+ constructor(operationCode: number, responseId: number, encrypted?: boolean);
12
+ getOperationCode(): number;
13
+ getReturnCode(): number;
14
+ getParameters(): GNHashtable;
15
+ isEncrypted(): boolean;
16
+ getResponseId(): number;
17
+ getDebugMessage(): string;
18
+ getInvalidMembers(): InvalidMember[];
19
+ hasError(): boolean;
20
+ setReturnCode(returnCode: number): OperationResponse;
21
+ setDebugMessage(debugMessage: string): OperationResponse;
22
+ setScriptData(k: string, value: any): OperationResponse;
23
+ setParameters(parameters: GNHashtable): OperationResponse;
24
+ setEncrypted(encrypted: boolean): OperationResponse;
25
+ setInvalidMembers(invalidMembers: InvalidMember[]): OperationResponse;
26
+ toString(): string;
27
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class CreateNewFileUploadInfoOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(originFileName: string, timeout?: number);
6
+ }
@@ -0,0 +1,10 @@
1
+ import { GNHashtable } from "./../../common/GNData";
2
+ import { OperationRequest } from "./../OperationRequest";
3
+ export declare abstract class CustomOperationRequest {
4
+ protected abstract operationCode: number;
5
+ protected abstract operationEncrypted: boolean;
6
+ protected operationTimeout: number;
7
+ protected operationParameters: GNHashtable;
8
+ constructor(timeout: number);
9
+ build(): OperationRequest;
10
+ }
@@ -0,0 +1,7 @@
1
+ import { GNArray, GNHashtable } from "./../../common/GNData";
2
+ import { CustomOperationRequest } from "./CustomOperationRequest";
3
+ export declare class DebugOperationRequest extends CustomOperationRequest {
4
+ protected operationCode: number;
5
+ protected operationEncrypted: boolean;
6
+ constructor(booleanValue: boolean, numberValue: number, stringValue: string, gnHashtableValue: GNHashtable, gnArrayValue: GNArray, timeout?: number);
7
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class EnterDisplayNameOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(displayName: string, timeout?: number);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class FetchAllDataOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(timeout?: number);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class FetchSparkPlayerOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(timeout?: number);
6
+ }
@@ -0,0 +1,7 @@
1
+ import { GNArray } from "./../../common/GNData";
2
+ import { CustomOperationRequest } from "./CustomOperationRequest";
3
+ export declare class GetAppConfigOperationRequest extends CustomOperationRequest {
4
+ protected operationCode: number;
5
+ protected operationEncrypted: boolean;
6
+ constructor(configTypes: GNArray, timeout?: number);
7
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class GetFileUploadInfoOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(fileId: string, timeout?: number);
6
+ }
@@ -0,0 +1,33 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class LoginOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(timeout?: number);
6
+ }
7
+ export declare class AccountLoginOperationRequest extends LoginOperationRequest {
8
+ constructor(username: string, password: string, timeout?: number);
9
+ }
10
+ export declare class DeviceLoginOperationRequest extends LoginOperationRequest {
11
+ constructor(deviceInfo: string, timeout?: number);
12
+ }
13
+ export declare class FacebookLoginOperationRequest extends LoginOperationRequest {
14
+ constructor(facebookToken: string, timeout?: number);
15
+ }
16
+ export declare class GoogleLoginOperationRequest extends LoginOperationRequest {
17
+ constructor(googleToken: string, googleLoginType: number, timeout?: number);
18
+ }
19
+ export declare class AppleLoginOperationRequest extends LoginOperationRequest {
20
+ constructor(appleToken: string, displayName: string, timeout?: number);
21
+ }
22
+ export declare class UserIdLoginOperationRequest extends LoginOperationRequest {
23
+ constructor(userId: string, timeout?: number);
24
+ }
25
+ export declare class PublicAddressLoginOperationRequest extends LoginOperationRequest {
26
+ constructor(signature: string, publicAddress: string, message: string, timeout?: number);
27
+ }
28
+ export declare class PublicAddressGetRandomMessageOperationRequest extends LoginOperationRequest {
29
+ constructor(timeout?: number);
30
+ }
31
+ export declare class CustomIdLoginOperationRequest extends LoginOperationRequest {
32
+ constructor(customId: string, timeout?: number);
33
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class LogoutOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(timeout?: number);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class RegisterAccountOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(username: string, password: string, timeout?: number);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class RegisterSocketOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(sid: string, timeout?: number);
6
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomOperationRequest } from "./CustomOperationRequest";
2
+ export declare class TemplateOperationRequest extends CustomOperationRequest {
3
+ protected operationCode: number;
4
+ protected operationEncrypted: boolean;
5
+ constructor(booleanValue: boolean, timeout?: number);
6
+ }
@@ -0,0 +1,10 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class CreateNewFileUploadInfoOperationResponse extends CustomOperationResponse {
4
+ fileId: string;
5
+ originFileName: string;
6
+ tsCreate: number;
7
+ tsUploadExpire: number;
8
+ userId: string;
9
+ setupOperationResponse(operationResponse: OperationResponse): void;
10
+ }
@@ -0,0 +1,14 @@
1
+ import { GNHashtable } from "./../../common/GNData";
2
+ import { InvalidMember } from "./../InvalidMember";
3
+ import { OperationResponse } from "./../OperationResponse";
4
+ export declare abstract class CustomOperationResponse {
5
+ operationCode: number;
6
+ parameters: GNHashtable;
7
+ returnCode: number;
8
+ debugMessage: string;
9
+ errorCode: number;
10
+ invalidMembers: InvalidMember[];
11
+ hasError(): boolean;
12
+ setupOperationResponse(operationResponse: OperationResponse): void;
13
+ toString(): string;
14
+ }
@@ -0,0 +1,11 @@
1
+ import { GNArray, GNHashtable } from "./../../common/GNData";
2
+ import { OperationResponse } from "./../OperationResponse";
3
+ import { CustomOperationResponse } from "./CustomOperationResponse";
4
+ export declare class DebugOperationResponse extends CustomOperationResponse {
5
+ boolean: boolean;
6
+ string: string;
7
+ number: number;
8
+ gnHashtable: GNHashtable;
9
+ gnArray: GNArray;
10
+ setupOperationResponse(operationResponse: OperationResponse): void;
11
+ }
@@ -0,0 +1,7 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class EnterDisplayNameOperationResponse extends CustomOperationResponse {
4
+ userRole: number;
5
+ displayName: string;
6
+ setupOperationResponse(operationResponse: OperationResponse): void;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class FetchAllDataOperationResponse extends CustomOperationResponse {
4
+ userId: string;
5
+ userRole: number;
6
+ displayName: string;
7
+ tsExpire: number;
8
+ reason: string;
9
+ setupOperationResponse(operationResponse: OperationResponse): void;
10
+ }
@@ -0,0 +1,20 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export interface UserExternal {
4
+ customId: string;
5
+ facebookId: string;
6
+ googleUserId: string;
7
+ appleUserId: string;
8
+ deviceInfo: string;
9
+ publicAddress: string;
10
+ }
11
+ export declare class FetchSparkPlayerOperationResponse extends CustomOperationResponse {
12
+ userId: string;
13
+ userRole: number;
14
+ fullname: string;
15
+ tsCreate: number;
16
+ userExternal: UserExternal;
17
+ tsExpire: number;
18
+ reason: string;
19
+ setupOperationResponse(operationResponse: OperationResponse): void;
20
+ }
@@ -0,0 +1,6 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class GetAppConfigOperationResponse extends CustomOperationResponse {
4
+ configNotUptodateLst: string[];
5
+ setupOperationResponse(operationResponse: OperationResponse): void;
6
+ }
@@ -0,0 +1,15 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class GetFileUploadInfoOperationResponse extends CustomOperationResponse {
4
+ fileHasUpload: boolean;
5
+ fileId: string;
6
+ originFileName: string;
7
+ tsCreate: number;
8
+ userId: string;
9
+ tsUploadExpire: number;
10
+ tsUploadFile: number;
11
+ mimeType: string;
12
+ size: number;
13
+ folderFileName: string;
14
+ setupOperationResponse(operationResponse: OperationResponse): void;
15
+ }
@@ -0,0 +1,9 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class LoginOperationResponse extends CustomOperationResponse {
4
+ authToken: string;
5
+ tsExpire: number;
6
+ reason: string;
7
+ userId: string;
8
+ setupOperationResponse(operationResponse: OperationResponse): void;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class LogoutOperationResponse extends CustomOperationResponse {
4
+ setupOperationResponse(operationResponse: OperationResponse): void;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class PublicAddressGetRandomMessageOperationResponse extends CustomOperationResponse {
4
+ message: string;
5
+ setupOperationResponse(operationResponse: OperationResponse): void;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { LoginOperationResponse } from "./LoginOperationResponse";
3
+ export declare class RegisterAccountOperationResponse extends LoginOperationResponse {
4
+ setupOperationResponse(operationResponse: OperationResponse): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class RegisterSocketOperationResponse extends CustomOperationResponse {
4
+ setupOperationResponse(operationResponse: OperationResponse): void;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { OperationResponse } from "./../OperationResponse";
2
+ import { CustomOperationResponse } from "./CustomOperationResponse";
3
+ export declare class TemplateOperationResponse extends CustomOperationResponse {
4
+ boolean: boolean;
5
+ setupOperationResponse(operationResponse: OperationResponse): void;
6
+ }
@@ -0,0 +1,16 @@
1
+ export declare class CodeHelper {
2
+ private static readonly UnknownCode;
3
+ private static operationCodeDic;
4
+ private static eventCodeDic;
5
+ private static returnCodeDic;
6
+ static getOperationCodeName(operationCode: number): string;
7
+ static getEventCodeName(eventCode: number): string;
8
+ static getReturnCodeName(returnCode: number): string;
9
+ static init(): void;
10
+ private static setOperationCodeDic;
11
+ static addOperationCodeDic(operationCode: any): void;
12
+ private static setEventCodeDic;
13
+ static addEventCodeDic(eventCode: any): void;
14
+ private static setReturnCodeDic;
15
+ static addReturnCodeDic(returnCode: any): void;
16
+ }
@@ -0,0 +1,5 @@
1
+ export declare class GNSupport {
2
+ private static _isBrowser;
3
+ static init(): void;
4
+ static isBrowser(): boolean;
5
+ }
@@ -0,0 +1,15 @@
1
+ export declare enum LogType {
2
+ Off = 0,
3
+ Exception = 1,
4
+ Error = 2,
5
+ Warning = 3,
6
+ All = 4
7
+ }
8
+ export declare class GNDebug {
9
+ private static _logType;
10
+ static setLogType(logType: LogType): void;
11
+ static log(message: any): void;
12
+ static logException(exception: Error): void;
13
+ static logWarning(message: any): void;
14
+ static logError(message: any): void;
15
+ }
@@ -0,0 +1,29 @@
1
+ import { Action1 } from "./../common/Action1";
2
+ import { OperationPending } from "./OperationPending";
3
+ import { PeerBase } from "./PeerBase";
4
+ export declare class HttpAppResponse {
5
+ statusCode: number;
6
+ error: string;
7
+ data: Uint8Array;
8
+ text: string;
9
+ hasError(): boolean;
10
+ }
11
+ export declare enum PostType {
12
+ Json = 0,
13
+ MsgPack = 1
14
+ }
15
+ export declare class HttpPeer extends PeerBase {
16
+ private static userAgent;
17
+ private httpUrl;
18
+ private static readonly JSON_CHAR_KNOWN;
19
+ protected initGNSocketObject(): void;
20
+ send(operationPending: OperationPending): void;
21
+ private onSendOperationRequestResponse;
22
+ getRequest(subUri: string, onHttpAppResponse: Action1<HttpAppResponse>, timeout?: number): void;
23
+ private getRequestViaHTTPRequest;
24
+ private postRequestViaHTTPRequest;
25
+ uploadFile(fileId: string, content: Uint8Array, mimetype: string, onHttpAppResponse: Action1<HttpAppResponse>, timeout?: number): void;
26
+ private postRequestUploadViaHTTPRequest;
27
+ private uint8ArrayToString;
28
+ private toBuffers;
29
+ }
@@ -0,0 +1,9 @@
1
+ import { Action1 } from "./../common/Action1";
2
+ import { OperationRequest } from "./../entity/OperationRequest";
3
+ import { OperationResponse } from "./../entity/OperationResponse";
4
+ export interface IPeer {
5
+ initPeer(): void;
6
+ enqueue(operationRequest: OperationRequest, onOperationResponse: Action1<OperationResponse>): void;
7
+ isUsing(): boolean;
8
+ service(): void;
9
+ }
@@ -0,0 +1,74 @@
1
+ import { Action0 } from "./../common/Action0";
2
+ import { Action1 } from "./../common/Action1";
3
+ import { GNArray, GNHashtable } from "./../common/GNData";
4
+ import { OperationRequest } from "./../entity/OperationRequest";
5
+ import { OperationResponse } from "./../entity/OperationResponse";
6
+ import { CreateNewFileUploadInfoOperationResponse } from "./../entity/response/CreateNewFileUploadInfoOperationResponse";
7
+ import { DebugOperationResponse } from "./../entity/response/DebugOperationResponse";
8
+ import { EnterDisplayNameOperationResponse } from "./../entity/response/EnterDisplayNameOperationResponse";
9
+ import { FetchAllDataOperationResponse } from "./../entity/response/FetchAllDataOperationResponse";
10
+ import { FetchSparkPlayerOperationResponse } from "./../entity/response/FetchSparkPlayerOperationResponse";
11
+ import { GetAppConfigOperationResponse } from "./../entity/response/GetAppConfigOperationResponse";
12
+ import { GetFileUploadInfoOperationResponse } from "./../entity/response/GetFileUploadInfoOperationResponse";
13
+ import { LoginOperationResponse } from "./../entity/response/LoginOperationResponse";
14
+ import { LogoutOperationResponse } from "./../entity/response/LogoutOperationResponse";
15
+ import { PublicAddressGetRandomMessageOperationResponse } from "./../entity/response/PublicAddressGetRandomMessageOperationResponse";
16
+ import { RegisterAccountOperationResponse } from "./../entity/response/RegisterAccountOperationResponse";
17
+ import { RegisterSocketOperationResponse } from "./../entity/response/RegisterSocketOperationResponse";
18
+ import { TemplateOperationResponse } from "./../entity/response/TemplateOperationResponse";
19
+ import { IServerEventHandler } from "./handler/IServerEventHandler";
20
+ import { HttpAppResponse } from "./HttpPeer";
21
+ export declare class NetworkingPeer {
22
+ static readonly SYNC_TS: string;
23
+ static readonly UPLOAD_FILE: string;
24
+ static readonly DOWNLOAD_FILE: string;
25
+ static readonly GET_CONFIG: string;
26
+ static readonly API_JSON: string;
27
+ static readonly API_MSG_PACK: string;
28
+ private socketPeer;
29
+ private httpPeer;
30
+ authToken: string;
31
+ userId: string;
32
+ getPing(): number;
33
+ private update;
34
+ private service;
35
+ private lastCurrentServerMilliseconds;
36
+ private lastGetCurrentMilliseconds;
37
+ setServerTimeMilliseconds(currentServerMilliseconds: number): void;
38
+ getServerTimestamp(): number;
39
+ initPeer(): void;
40
+ sendViaSocket(request: OperationRequest, onResponse?: Action1<OperationResponse>): void;
41
+ sendViaHttp(request: OperationRequest, onResponse?: Action1<OperationResponse>): void;
42
+ sendRequestAuthSocket(): void;
43
+ connectSocket(_onSocketConnect: Action0): void;
44
+ disconnectSocket(_onSocketDisconnect: Action0): void;
45
+ setOnConnectHandler(_onConnectHandler: Action0): void;
46
+ setOnDisconnectHandler(_onDisconnectHandler: Action0): void;
47
+ removeOnConnectHandler(_onConnectHandler: Action0): void;
48
+ removeOnDisconnectHandler(_onDisconnectHandler: Action0): void;
49
+ subscriberServerEventHandler(serverEventHandler: IServerEventHandler): void;
50
+ syncTs(onResponse?: Action1<number>): void;
51
+ getConfig(configName: string, onResponse: Action1<string>): void;
52
+ downloadFile(fileId: string, onHttpAppResponse: Action1<HttpAppResponse>): void;
53
+ uploadFile(fileId: string, content: Uint8Array, mimeType: string, onHttpAppResponse: Action1<HttpAppResponse>): void;
54
+ debug(booleanValue: boolean, numberValue: number, stringValue: string, gnHashtableValue: GNHashtable, gnArrayValue: GNArray, onResponse?: Action1<DebugOperationResponse>): void;
55
+ enterDisplayName(displayName: string, onResponse?: Action1<EnterDisplayNameOperationResponse>): void;
56
+ fetchAllData(onResponse?: Action1<FetchAllDataOperationResponse>): void;
57
+ fetchSparkPlayer(onResponse?: Action1<FetchSparkPlayerOperationResponse>): void;
58
+ getAppConfig(configTypes: GNArray, onResponse?: Action1<GetAppConfigOperationResponse>): void;
59
+ accountLogin(username: string, password: string, onResponse?: Action1<LoginOperationResponse>): void;
60
+ deviceLogin(onResponse?: Action1<LoginOperationResponse>): void;
61
+ facebookLogin(facebookToken: string, onResponse?: Action1<LoginOperationResponse>): void;
62
+ googleLogin(googleToken: string, googleLoginType: number, onResponse?: Action1<LoginOperationResponse>): void;
63
+ appleLogin(appleToken: string, displayName: string, onResponse?: Action1<LoginOperationResponse>): void;
64
+ userIdLogin(userId: string, onResponse?: Action1<LoginOperationResponse>): void;
65
+ publicAddressLogin(signature: string, publicAddress: string, message: string, onResponse?: Action1<LoginOperationResponse>): void;
66
+ publicAddressGetRandomMessage(onResponse?: Action1<PublicAddressGetRandomMessageOperationResponse>): void;
67
+ customIdLogin(customId: string, onResponse?: Action1<LoginOperationResponse>): void;
68
+ registerAccount(username: string, password: string, onResponse?: Action1<RegisterAccountOperationResponse>): void;
69
+ registerSocket(sid: string, onResponse?: Action1<RegisterSocketOperationResponse>): void;
70
+ template(booleanValue: boolean, onResponse?: Action1<TemplateOperationResponse>): void;
71
+ createNewFileUploadInfo(originFileName: string, onResponse?: Action1<CreateNewFileUploadInfoOperationResponse>): void;
72
+ getFileUploadInfo(fileId: string, onResponse?: Action1<GetFileUploadInfoOperationResponse>): void;
73
+ logout(onResponse?: Action1<LogoutOperationResponse>): void;
74
+ }
@@ -0,0 +1,47 @@
1
+ import { Action0 } from "./../common/Action0";
2
+ import { Action2 } from "./../common/Action2";
3
+ import { GNArray } from "./../common/GNData";
4
+ import { OperationRequest } from "./../entity/OperationRequest";
5
+ export declare class SocketPacket {
6
+ obj: any;
7
+ encrypted: boolean;
8
+ constructor(obj: any, encrypted: boolean);
9
+ }
10
+ export declare abstract class NetworkingPeerBase {
11
+ protected reconnectDelay: number;
12
+ protected pingInterval: number;
13
+ protected pingTimeout: number;
14
+ clientId: string;
15
+ isWsConnected: boolean;
16
+ protected responsePacketLst: SocketPacket[];
17
+ protected eventPacketLst: SocketPacket[];
18
+ protected url: string;
19
+ private _onEventHandler;
20
+ private _onResponseHandler;
21
+ private _onSocketConnect;
22
+ private _onSocketDisconnect;
23
+ private _onConnectHandler;
24
+ private _onDisconnectHandler;
25
+ constructor();
26
+ init(url: string, reconnectDelay: number, pingInterval: number, pingTimeout: number): void;
27
+ onApplicationQuit(): void;
28
+ connect(_onSocketConnect: Action0): void;
29
+ close(_onSocketDisconnect: Action0): void;
30
+ sendRequestAuthSocket(): void;
31
+ send(operationRequest: OperationRequest): void;
32
+ protected abstract emit(operationRequest: OperationRequest): void;
33
+ reInitNewSocket(): void;
34
+ setOnConnectHandler(_onConnectHandler: Action0): void;
35
+ setOnDisconnectHandler(_onDisconnectHandler: Action0): void;
36
+ removeOnConnectHandler(_onConnectHandler: Action0): void;
37
+ removeOnDisconnectHandler(_onDisconnectHandler: Action0): void;
38
+ onConnectHandler(): void;
39
+ onDisconnectHandler(): void;
40
+ setOnEventHandler(_onEventHandler: Action2<GNArray, boolean>): void;
41
+ onEventHandler(obj: GNArray, isEncrypted: boolean): void;
42
+ setOnResponseHandler(_onResponseHandler: Action2<GNArray, boolean>): void;
43
+ onResponseHandler(obj: GNArray, isEncrypted: boolean): void;
44
+ static fromMsgList(objects: any[]): any[];
45
+ static fromJsonList(objects: any): any[];
46
+ service(): void;
47
+ }