cmd-control-client-lib 3.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.
- package/.arcconfig +4 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +65 -0
- package/.husky/pre-commit +5 -0
- package/README.md +35 -0
- package/dist/@types/enum-boolean-digitized.d.ts +4 -0
- package/dist/@types/enum-boolean-stringified-extended.d.ts +6 -0
- package/dist/@types/enum-boolean-stringified.d.ts +4 -0
- package/dist/@types/enum-channel-flags.d.ts +14 -0
- package/dist/@types/enum-currency.d.ts +5 -0
- package/dist/@types/enum-status-type.d.ts +15 -0
- package/dist/@types/icurrency-description.d.ts +5 -0
- package/dist/@types/iemoji.d.ts +4 -0
- package/dist/@types/index.d.ts +9 -0
- package/dist/@types/json-stringified.d.ts +8 -0
- package/dist/cmd-connection.d.ts +71 -0
- package/dist/cmd-control-client-lib.js +2 -0
- package/dist/cmd-control-client-lib.js.map +1 -0
- package/dist/cmd-control-lib.d.ts +5 -0
- package/dist/cmd-protocol.d.ts +35 -0
- package/dist/cmd-session.d.ts +15 -0
- package/dist/logger.d.ts +28 -0
- package/dist/protocol/b2b/b2bcontact.d.ts +58 -0
- package/dist/protocol/b2b/b2buserinfo.d.ts +106 -0
- package/dist/protocol/backend.d.ts +48 -0
- package/dist/protocol/channel.d.ts +341 -0
- package/dist/protocol/channelinfo.d.ts +98 -0
- package/dist/protocol/chatstate.d.ts +42 -0
- package/dist/protocol/command/action.d.ts +116 -0
- package/dist/protocol/command/baseparams.d.ts +40 -0
- package/dist/protocol/command/icommand.d.ts +61 -0
- package/dist/protocol/command/resultcode.d.ts +44 -0
- package/dist/protocol/connection.d.ts +16 -0
- package/dist/protocol/contactnote.d.ts +62 -0
- package/dist/protocol/gifts.d.ts +19 -0
- package/dist/protocol/init.d.ts +64 -0
- package/dist/protocol/live/devicestatus.d.ts +30 -0
- package/dist/protocol/live/live-commands.d.ts +386 -0
- package/dist/protocol/live/login.d.ts +14 -0
- package/dist/protocol/live/onlinesummary.d.ts +21 -0
- package/dist/protocol/live/products-config.d.ts +19 -0
- package/dist/protocol/live/streamstate.d.ts +25 -0
- package/dist/protocol/live/supdate.d.ts +34 -0
- package/dist/protocol/live/usersettings.d.ts +40 -0
- package/dist/protocol/lobby.d.ts +37 -0
- package/dist/protocol/login.d.ts +57 -0
- package/dist/protocol/logout.d.ts +22 -0
- package/dist/protocol/mediaoffer.d.ts +48 -0
- package/dist/protocol/mediapurchase.d.ts +49 -0
- package/dist/protocol/mediaupload.d.ts +86 -0
- package/dist/protocol/message.d.ts +184 -0
- package/dist/protocol/messenger/expo.d.ts +19 -0
- package/dist/protocol/noop.d.ts +14 -0
- package/dist/protocol/onlinestate.d.ts +74 -0
- package/dist/protocol/sessionstate.d.ts +74 -0
- package/dist/protocol/systemmessagekey.d.ts +157 -0
- package/dist/protocol/toy.d.ts +60 -0
- package/dist/protocol/unused.d.ts +26 -0
- package/dist/protocol/update-state.d.ts +11 -0
- package/dist/version.d.ts +1 -0
- package/package.json +88 -0
- package/test/.eslintrc.js +12 -0
- package/test/json-stringified.spec.ts +11 -0
- package/test/result.spec.ts +18 -0
- package/test/session-state.spec.ts +23 -0
- package/workspace.code-workspace +13 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/** messageKey for msgTyp="sys" */
|
|
2
|
+
export declare enum SystemMessageKey {
|
|
3
|
+
bonusCodeRedemption = "bonusCodeRedemption",
|
|
4
|
+
g_chat_auto_charged = "g_chat_auto_charged",
|
|
5
|
+
g_chat_host_micro_off = "g_chat_host_micro_off",
|
|
6
|
+
g_chat_host_micro_on = "g_chat_host_micro_on",
|
|
7
|
+
g_discount_client = "g_discount_client",
|
|
8
|
+
g_discount_client_once = "g_discount_client_once",
|
|
9
|
+
g_single_not_started = "g_single_not_started",
|
|
10
|
+
g_single_rejected = "g_single_rejected",
|
|
11
|
+
g_single_started = "g_single_started",
|
|
12
|
+
g_video_cancel = "g_video_cancel",
|
|
13
|
+
g_video_delayed = "g_video_delayed",
|
|
14
|
+
g_video_delerror = "g_video_delerror",
|
|
15
|
+
h_chat_admin_start = "h_chat_admin_start",
|
|
16
|
+
h_chat_admin_stop = "h_chat_admin_stop",
|
|
17
|
+
h_chat_audio_start = "h_chat_audio_start",
|
|
18
|
+
h_chat_ban_failed = "h_chat_ban_failed",
|
|
19
|
+
h_chat_ban_ok = "h_chat_ban_ok",
|
|
20
|
+
h_chat_button_yes_close = "h_chat_button_yes_close",
|
|
21
|
+
h_chat_cam2cam_running = "h_chat_cam2cam_running",
|
|
22
|
+
h_chat_cam2cam_start = "h_chat_cam2cam_start",
|
|
23
|
+
h_chat_cam2cam_stop = "h_chat_cam2cam_stop",
|
|
24
|
+
h_chat_category_from = "h_chat_category_from",
|
|
25
|
+
h_chat_client_software = "h_chat_client_software",
|
|
26
|
+
h_chat_conversion_info_has_top_up = "h_chat_conversion_info_has_top_up",
|
|
27
|
+
h_chat_conversion_info_no_top_up = "h_chat_conversion_info_no_top_up",
|
|
28
|
+
h_chat_conversion_start = "h_chat_conversion_start",
|
|
29
|
+
h_chat_duration = "h_chat_duration",
|
|
30
|
+
h_chat_free_mode_converted = "h_chat_free_mode_converted",
|
|
31
|
+
h_chat_freeuserconv = "h_chat_freeuserconv",
|
|
32
|
+
h_chat_fsk_attention = "h_chat_fsk_attention",
|
|
33
|
+
h_chat_fsk_denied = "h_chat_fsk_denied",
|
|
34
|
+
h_chat_fsk_text_warn = "h_chat_fsk_text_warn",
|
|
35
|
+
h_chat_guest_mobile = "h_chat_guest_mobile",
|
|
36
|
+
h_chat_guest_sound_off = "h_chat_guest_sound_off",
|
|
37
|
+
h_chat_guest_sound_on = "h_chat_guest_sound_on",
|
|
38
|
+
h_chat_guest_visit = "h_chat_guest_visit",
|
|
39
|
+
h_chat_guest_visit_first = "h_chat_guest_visit_first",
|
|
40
|
+
h_chat_info_about = "h_chat_info_about",
|
|
41
|
+
h_chat_kicked = "h_chat_kicked",
|
|
42
|
+
h_chat_lovense_not_available = "h_chat_lovense_not_available",
|
|
43
|
+
h_chat_no_history = "h_chat_no_history",
|
|
44
|
+
h_chat_not_visitx_guest = "h_chat_not_visitx_guest",
|
|
45
|
+
h_chat_note_caption = "h_chat_note_caption",
|
|
46
|
+
h_chat_note_create = "h_chat_note_create",
|
|
47
|
+
h_chat_note_edit = "h_chat_note_edit",
|
|
48
|
+
h_chat_note_not_available = "h_chat_note_not_available",
|
|
49
|
+
h_chat_party_mode_converted = "h_chat_party_mode_converted",
|
|
50
|
+
h_chat_paused_4107 = "h_chat_paused_4107",
|
|
51
|
+
h_chat_please_micro_on = "h_chat_please_micro_on",
|
|
52
|
+
h_chat_preview_start = "h_chat_preview_start",
|
|
53
|
+
h_chat_preview_stop = "h_chat_preview_stop",
|
|
54
|
+
h_chat_pseudo_user = "h_chat_pseudo_user",
|
|
55
|
+
h_chat_quest_voyeur_shown = "h_chat_quest_voyeur_shown",
|
|
56
|
+
h_chat_quest_voyeur_start = "h_chat_quest_voyeur_start",
|
|
57
|
+
h_chat_rectuited_guest = "h_chat_rectuited_guest",
|
|
58
|
+
h_chat_single_available = "h_chat_single_available",
|
|
59
|
+
h_chat_single_not_available = "h_chat_single_not_available",
|
|
60
|
+
h_chat_single_running = "h_chat_single_running",
|
|
61
|
+
h_chat_stop = "h_chat_stop",
|
|
62
|
+
h_chat_stop_guest_error = "h_chat_stop_guest_error",
|
|
63
|
+
h_chat_test_chat = "h_chat_test_chat",
|
|
64
|
+
h_chat_text_chat_goal_video = "h_chat_text_chat_goal_video",
|
|
65
|
+
h_chat_text_muted = "h_chat_text_muted",
|
|
66
|
+
h_chat_text_start = "h_chat_text_start",
|
|
67
|
+
h_chat_text_to_video = "h_chat_text_to_video",
|
|
68
|
+
h_chat_text_unmuted = "h_chat_text_unmuted",
|
|
69
|
+
h_chat_tip = "h_chat_tip",
|
|
70
|
+
h_chat_url_blocked = "h_chat_url_blocked",
|
|
71
|
+
h_chat_userisnovip = "h_chat_userisnovip",
|
|
72
|
+
h_chat_userisvip = "h_chat_userisvip",
|
|
73
|
+
h_chat_video_start = "h_chat_video_start",
|
|
74
|
+
h_chat_video_start_voyeur = "h_chat_video_start_voyeur",
|
|
75
|
+
h_chat_voyer2single_video_disabled = "h_chat_voyer2single_video_disabled",
|
|
76
|
+
h_chat_voyeur2single = "h_chat_voyeur2single",
|
|
77
|
+
h_chat_voyeur2single_off = "h_chat_voyeur2single_off",
|
|
78
|
+
h_chat_voyeur2single_video_audio_warn = "h_chat_voyeur2single_video_audio_warn",
|
|
79
|
+
h_chat_voyeur2single_video_warn = "h_chat_voyeur2single_video_warn",
|
|
80
|
+
h_chat_voyeur_shown = "h_chat_voyeur_shown",
|
|
81
|
+
h_chat_voyuer = "h_chat_voyuer",
|
|
82
|
+
h_chat_voyuer_shown = "h_chat_voyuer_shown",
|
|
83
|
+
h_discount_available = "h_discount_available",
|
|
84
|
+
h_discount_current = "h_discount_current",
|
|
85
|
+
h_discount_invalid = "h_discount_invalid",
|
|
86
|
+
h_discount_not_available = "h_discount_not_available",
|
|
87
|
+
h_discount_set_ok = "h_discount_set_ok",
|
|
88
|
+
h_discount_setforinfo = "h_discount_setforinfo",
|
|
89
|
+
h_error_video_send_failed = "h_error_video_send_failed",
|
|
90
|
+
h_instant_start = "h_instant_start",
|
|
91
|
+
h_instant_stop = "h_instant_stop",
|
|
92
|
+
h_media_audio_error = "h_media_audio_error",
|
|
93
|
+
h_media_audio_informuploaded = "h_media_audio_informuploaded",
|
|
94
|
+
h_media_bitmap_error = "h_media_bitmap_error",
|
|
95
|
+
h_media_video_error = "h_media_video_error",
|
|
96
|
+
h_media_video_informuploaded = "h_media_video_informuploaded",
|
|
97
|
+
h_session_appear_offline = "h_session_appear_offline",
|
|
98
|
+
h_session_audio_device_error = "h_session_audio_device_error",
|
|
99
|
+
h_session_audio_device_frozen = "h_session_audio_device_frozen",
|
|
100
|
+
h_session_audio_loudness_ok = "h_session_audio_loudness_ok",
|
|
101
|
+
h_session_audio_no_loudness = "h_session_audio_no_loudness",
|
|
102
|
+
h_session_audio_off = "h_session_audio_off",
|
|
103
|
+
h_session_audio_on = "h_session_audio_on",
|
|
104
|
+
h_session_button_cancel = "h_session_button_cancel",
|
|
105
|
+
h_session_button_no = "h_session_button_no",
|
|
106
|
+
h_session_button_yes = "h_session_button_yes",
|
|
107
|
+
h_session_cpu_overload = "h_session_cpu_overload",
|
|
108
|
+
h_session_error = "h_session_error",
|
|
109
|
+
h_session_free_mode_off = "h_session_free_mode_off",
|
|
110
|
+
h_session_free_mode_on = "h_session_free_mode_on",
|
|
111
|
+
h_session_fsk_mixed_profile = "h_session_fsk_mixed_profile",
|
|
112
|
+
h_session_livepreview_off = "h_session_livepreview_off",
|
|
113
|
+
h_session_livepreview_on = "h_session_livepreview_on",
|
|
114
|
+
h_session_mixed_profile_auto_off = "h_session_mixed_profile_auto_off",
|
|
115
|
+
h_session_mixed_profile_no = "h_session_mixed_profile_no",
|
|
116
|
+
h_session_mixed_profile_not_available = "h_session_mixed_profile_not_available",
|
|
117
|
+
h_session_mixed_profile_off = "h_session_mixed_profile_off",
|
|
118
|
+
h_session_mixed_profile_on = "h_session_mixed_profile_on",
|
|
119
|
+
h_session_mixed_profile_reminder = "h_session_mixed_profile_reminder",
|
|
120
|
+
h_session_no_video_allowed = "h_session_no_video_allowed",
|
|
121
|
+
h_session_offline = "h_session_offline",
|
|
122
|
+
h_session_offline_title = "h_session_offline_title",
|
|
123
|
+
h_session_old_ssw = "h_session_old_ssw",
|
|
124
|
+
h_session_online = "h_session_online",
|
|
125
|
+
h_session_online_today = "h_session_online_today",
|
|
126
|
+
h_session_party_mode_off = "h_session_party_mode_off",
|
|
127
|
+
h_session_party_mode_on = "h_session_party_mode_on",
|
|
128
|
+
h_session_preview_picture_missed = "h_session_preview_picture_missed",
|
|
129
|
+
h_session_preview_picture_upload = "h_session_preview_picture_upload",
|
|
130
|
+
h_session_service0900state_turnoff = "h_session_service0900state_turnoff",
|
|
131
|
+
h_session_service0900state_turnon = "h_session_service0900state_turnon",
|
|
132
|
+
h_session_stream_not_found = "h_session_stream_not_found",
|
|
133
|
+
h_session_stream_restart = "h_session_stream_restart",
|
|
134
|
+
h_session_stream_wait = "h_session_stream_wait",
|
|
135
|
+
h_session_toy_start = "h_session_toy_start",
|
|
136
|
+
h_session_toy_stop = "h_session_toy_stop",
|
|
137
|
+
h_session_user_locked = "h_session_user_locked",
|
|
138
|
+
h_session_video_device_error = "h_session_video_device_error",
|
|
139
|
+
h_session_video_device_frozen = "h_session_video_device_frozen",
|
|
140
|
+
h_single_error = "h_single_error",
|
|
141
|
+
h_single_init_failed = "h_single_init_failed",
|
|
142
|
+
h_single_init_ok = "h_single_init_ok",
|
|
143
|
+
h_single_not_available = "h_single_not_available",
|
|
144
|
+
h_single_query = "h_single_query",
|
|
145
|
+
h_single_rejected = "h_single_rejected",
|
|
146
|
+
h_single_request_90s = "h_single_request_90s",
|
|
147
|
+
h_single_started = "h_single_started",
|
|
148
|
+
h_single_timeout = "h_single_timeout",
|
|
149
|
+
h_video_cancel = "h_video_cancel",
|
|
150
|
+
h_video_delayed = "h_video_delayed",
|
|
151
|
+
h_video_reconnect = "h_video_reconnect",
|
|
152
|
+
h_vcall_code = "h_vcall_code",
|
|
153
|
+
h_session_media_purchased = "h_session_media_purchased",
|
|
154
|
+
h_media_bitmap_purchased = "h_media_bitmap_purchased",
|
|
155
|
+
h_media_video_purchased = "h_media_video_purchased",
|
|
156
|
+
h_media_audio_purchased = "h_media_audio_purchased"
|
|
157
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IMayHaveChannelId } from "./channel";
|
|
2
|
+
import { ACTION } from "./command/action";
|
|
3
|
+
import { baseParamsType } from "./command/baseparams";
|
|
4
|
+
import { ICOMMAND, IKeyMaybeValue, IRESPONSE, RESULT } from "./command/icommand";
|
|
5
|
+
/**
|
|
6
|
+
* update the toy state
|
|
7
|
+
*/
|
|
8
|
+
export declare class CMDP_TOYSTATE implements ICOMMAND {
|
|
9
|
+
action: ACTION;
|
|
10
|
+
params: baseParamsType & {
|
|
11
|
+
online: boolean;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* response for CMDP_TOYSTATE
|
|
16
|
+
*/
|
|
17
|
+
export declare class CMDP_TOYSTATE_RESPONSE extends CMDP_TOYSTATE implements IRESPONSE {
|
|
18
|
+
result: RESULT;
|
|
19
|
+
/** unused */
|
|
20
|
+
values: IKeyMaybeValue;
|
|
21
|
+
/** unused */
|
|
22
|
+
commands: ICOMMAND[];
|
|
23
|
+
}
|
|
24
|
+
/** the toy action parameters */
|
|
25
|
+
export declare type toyActionParams = {
|
|
26
|
+
/** milliseconds */
|
|
27
|
+
duration: string;
|
|
28
|
+
/** float value from 0.0 to 1.0 */
|
|
29
|
+
intensity: string;
|
|
30
|
+
/** the messageKey - corelation to CMDP_MSG with gift */
|
|
31
|
+
messageKey?: string;
|
|
32
|
+
/** the relationId of this Action */
|
|
33
|
+
relationId?: string;
|
|
34
|
+
/** the text message from backend */
|
|
35
|
+
text?: string;
|
|
36
|
+
/** language */
|
|
37
|
+
language?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* command to send the toy action to channel
|
|
41
|
+
*/
|
|
42
|
+
export declare class CMDP_TOYACTION implements ICOMMAND {
|
|
43
|
+
action: ACTION;
|
|
44
|
+
params: baseParamsType & IMayHaveChannelId & toyActionParams;
|
|
45
|
+
}
|
|
46
|
+
/** response for CMDP_TOYACTION */
|
|
47
|
+
export declare class CMDP_TOYACTION_RESPONSE extends CMDP_TOYACTION implements IRESPONSE {
|
|
48
|
+
result: RESULT;
|
|
49
|
+
/** unused */
|
|
50
|
+
values: IKeyMaybeValue;
|
|
51
|
+
/** unused */
|
|
52
|
+
commands: ICOMMAND[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* the toy action command
|
|
56
|
+
*/
|
|
57
|
+
export declare class CMDC_TOYACTION implements ICOMMAND {
|
|
58
|
+
action: ACTION;
|
|
59
|
+
params: IMayHaveChannelId & toyActionParams & IKeyMaybeValue;
|
|
60
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ACTION } from "./command/action";
|
|
2
|
+
import { baseParamsType, SupportedLanguage } from "./command/baseparams";
|
|
3
|
+
import { ICOMMAND, IKeyMaybeValue, IRESPONSE, RESULT } from "./command/icommand";
|
|
4
|
+
/**
|
|
5
|
+
* unused
|
|
6
|
+
*/
|
|
7
|
+
export declare class CMDP_UPDATE implements ICOMMAND {
|
|
8
|
+
action: ACTION;
|
|
9
|
+
params: baseParamsType & {
|
|
10
|
+
usrId?: string;
|
|
11
|
+
usrKey?: string;
|
|
12
|
+
language?: SupportedLanguage;
|
|
13
|
+
broadcastData?: string;
|
|
14
|
+
permanentData?: string;
|
|
15
|
+
jwtKey?: string;
|
|
16
|
+
state?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Response for CMDP_UPDATE
|
|
21
|
+
*/
|
|
22
|
+
export declare class CMDP_UPDATE_RESPONSE extends CMDP_UPDATE implements IRESPONSE {
|
|
23
|
+
result: RESULT;
|
|
24
|
+
commands: ICOMMAND[];
|
|
25
|
+
values: IKeyMaybeValue;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChatState } from "./chatstate";
|
|
2
|
+
import { ACTION } from "./command/action";
|
|
3
|
+
import { ICOMMAND } from "./command/icommand";
|
|
4
|
+
import { SessionState } from "./sessionstate";
|
|
5
|
+
/**
|
|
6
|
+
* Update state command for vchat-core or for cmdcontrol-session
|
|
7
|
+
*/
|
|
8
|
+
export declare class CMDC_UPDATE implements ICOMMAND {
|
|
9
|
+
action: ACTION;
|
|
10
|
+
params: ChatState | SessionState;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "__VERSION__";
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cmd-control-client-lib",
|
|
3
|
+
"description": "Cmd-Client-Library",
|
|
4
|
+
"version": "3.0.1",
|
|
5
|
+
"directories": {
|
|
6
|
+
"lib": "./dist"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/cmd-control-lib.js",
|
|
9
|
+
"types": "./dist/cmd-control-lib.d.ts",
|
|
10
|
+
"private": false,
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Vladimir Lidberg, camPoint AG",
|
|
13
|
+
"contributors": [
|
|
14
|
+
{
|
|
15
|
+
"name": "Vladimir Lidberg",
|
|
16
|
+
"email": "vl@campoint.net"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "Igor Timoshenkov",
|
|
20
|
+
"email": "igor@aporia.su"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"xmlentities": "^0.2.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@babel/core": "^7.10.2",
|
|
29
|
+
"@babel/preset-env": "^7.10.2",
|
|
30
|
+
"@babel/preset-typescript": "^7.10.1",
|
|
31
|
+
"@types/jest": "^26.0.23",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
|
33
|
+
"@typescript-eslint/parser": "^4.22.0",
|
|
34
|
+
"clean-webpack-plugin": "^4.0.0-alpha.0",
|
|
35
|
+
"eslint": "^7.25.0",
|
|
36
|
+
"eslint-config-prettier": "^8.3.0",
|
|
37
|
+
"eslint-plugin-deprecation": "^1.2.0",
|
|
38
|
+
"eslint-plugin-jest": "^24.3.6",
|
|
39
|
+
"eslint-plugin-jest-formatting": "^3.0.0",
|
|
40
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
41
|
+
"eslint-plugin-sonarjs": "^0.7.0",
|
|
42
|
+
"eslint-plugin-tsdoc": "^0.2.14",
|
|
43
|
+
"eslint-plugin-unicorn": "^32.0.0",
|
|
44
|
+
"eslint-teamcity": "^3.0.1",
|
|
45
|
+
"husky": "^6.0.0",
|
|
46
|
+
"jest": "^26.6.3",
|
|
47
|
+
"lint-staged": "^11.0.0",
|
|
48
|
+
"pinst": "^2.1.6",
|
|
49
|
+
"prettier": "^2.2.1",
|
|
50
|
+
"pretty-quick": "^3.1.0",
|
|
51
|
+
"rimraf": "^3.0.0",
|
|
52
|
+
"string-replace-loader": "^3.0.1",
|
|
53
|
+
"ts-loader": "^9.1.1",
|
|
54
|
+
"typedoc": "^0.20.36",
|
|
55
|
+
"typedoc-plugin-markdown": "^3.7.2",
|
|
56
|
+
"typescript": "^4.2.4",
|
|
57
|
+
"webpack": "^5.36.1",
|
|
58
|
+
"webpack-cli": "^4.6.0",
|
|
59
|
+
"webpack-merge": "^5.7.3"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"clean": "rimraf ./dist",
|
|
63
|
+
"clean:docs": "rimraf ./doc",
|
|
64
|
+
"build": "webpack --config webpack.prod.js",
|
|
65
|
+
"build:dev": "webpack --config webpack.dev.js",
|
|
66
|
+
"watch": "webpack --config webpack.dev.js --watch",
|
|
67
|
+
"lint": "eslint src test --ext .ts",
|
|
68
|
+
"lint:teamcity": "yarn lint --format ./node_modules/eslint-teamcity/index.js",
|
|
69
|
+
"style": "prettier --write \"{src,test}/**/*.ts\"",
|
|
70
|
+
"test": "jest",
|
|
71
|
+
"generate:docs": "typedoc --out doc/ src/cmd-control-lib.ts --theme markdown",
|
|
72
|
+
"_postinstall": "husky install",
|
|
73
|
+
"prepack": "yarn run prepublishOnly",
|
|
74
|
+
"postpack": "yarn run postpublish",
|
|
75
|
+
"prepublishOnly": "pinst --disable",
|
|
76
|
+
"postpublish": "pinst --enable"
|
|
77
|
+
},
|
|
78
|
+
"prettier": {
|
|
79
|
+
"printWidth": 120,
|
|
80
|
+
"trailingComma": "all",
|
|
81
|
+
"singleQuote": false,
|
|
82
|
+
"semi": true,
|
|
83
|
+
"arrowParens": "always"
|
|
84
|
+
},
|
|
85
|
+
"lint-staged": {
|
|
86
|
+
"*.ts": "eslint --cache"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ["../.eslintrc.js", "plugin:jest/recommended", "plugin:jest-formatting/recommended"],
|
|
3
|
+
plugins: ["jest", "jest-formatting"],
|
|
4
|
+
env: {
|
|
5
|
+
"jest/globals": true,
|
|
6
|
+
},
|
|
7
|
+
rules: {
|
|
8
|
+
"sonarjs/no-duplicate-string": "off",
|
|
9
|
+
"unicorn/consistent-function-scoping": "off",
|
|
10
|
+
"jest/expect-expect": "off",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SupportedLanguage } from "../src/protocol/command/baseparams";
|
|
2
|
+
import { InitialTranslations } from "../src/protocol/init";
|
|
3
|
+
import { JSONString } from "../src/@types";
|
|
4
|
+
|
|
5
|
+
describe("JSONStringified", () => {
|
|
6
|
+
it("should be OK to JSON.parse", () => {
|
|
7
|
+
const response: JSONString<InitialTranslations> = '{"de": {"some": "token"}}';
|
|
8
|
+
const parsed = JSON.parse(response);
|
|
9
|
+
expect(parsed[SupportedLanguage.DE]?.some).toEqual("token");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RESULT } from "../src/protocol/command/icommand";
|
|
2
|
+
import { CODE } from "../src/protocol/command/resultcode";
|
|
3
|
+
|
|
4
|
+
describe("RESULT", () => {
|
|
5
|
+
it("Should accept ENUM OK value as result codes", () => {
|
|
6
|
+
const result: RESULT = {
|
|
7
|
+
code: CODE.OK,
|
|
8
|
+
reason: "All good",
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("Should accept ENUM ERROR value as result codes", () => {
|
|
13
|
+
const result: RESULT = {
|
|
14
|
+
code: CODE.SESSION_ERROR,
|
|
15
|
+
reason: "Unknown session",
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EnumSetTp, SessionState } from "../src/protocol/sessionstate";
|
|
2
|
+
|
|
3
|
+
describe("SessionState", () => {
|
|
4
|
+
// it("Should accept ENUM values as strings (flags)", () => {
|
|
5
|
+
// const flags = CommaSp;
|
|
6
|
+
|
|
7
|
+
// const withFlags: SessionState = {
|
|
8
|
+
// sessionID: "test",
|
|
9
|
+
// login: "test",
|
|
10
|
+
// startTime: Date.now().toString(),
|
|
11
|
+
// flags: `${SessionFlag.ADMIN},${SessionFlag.HASFSK18CHAT}`,
|
|
12
|
+
// };
|
|
13
|
+
// });
|
|
14
|
+
|
|
15
|
+
it("Should accept ENUM values as strings (setTp)", () => {
|
|
16
|
+
const withSetTp: SessionState = {
|
|
17
|
+
sessionID: "test",
|
|
18
|
+
login: "test",
|
|
19
|
+
startTime: Date.now().toString(),
|
|
20
|
+
setTp: EnumSetTp.OFFLINE,
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
});
|