ravejs 1.7.3 → 1.8.3
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/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -2
- package/dist/core/httpworkflow.d.ts +5 -0
- package/dist/core/httpworkflow.d.ts.map +1 -1
- package/dist/core/httpworkflow.js +18 -0
- package/dist/core/mesh-socket.d.ts +15 -0
- package/dist/core/mesh-socket.d.ts.map +1 -0
- package/dist/core/mesh-socket.js +71 -0
- package/dist/core/rave.d.ts +23 -0
- package/dist/core/rave.d.ts.map +1 -1
- package/dist/core/rave.js +70 -4
- package/dist/factories/mesh-factory.d.ts +2 -0
- package/dist/factories/mesh-factory.d.ts.map +1 -1
- package/dist/factories/mesh-factory.js +38 -0
- package/dist/factories/thread-factory.d.ts.map +1 -1
- package/dist/factories/thread-factory.js +2 -2
- package/dist/schemas/configs.d.ts +1 -1
- package/dist/schemas/private.d.ts +10 -0
- package/dist/schemas/private.d.ts.map +1 -1
- package/dist/schemas/private.js +8 -1
- package/dist/schemas/public.d.ts +26 -2
- package/dist/schemas/public.d.ts.map +1 -1
- package/dist/schemas/public.js +8 -6
- package/dist/schemas/rave/account.d.ts +22 -0
- package/dist/schemas/rave/account.d.ts.map +1 -0
- package/dist/schemas/rave/account.js +9 -0
- package/dist/schemas/rave/user.d.ts +3 -3
- package/dist/schemas/rave/user.js +1 -1
- package/dist/schemas/responses.d.ts +31 -5
- package/dist/schemas/responses.d.ts.map +1 -1
- package/dist/schemas/responses.js +8 -1
- package/dist/utils/utils.d.ts +2 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +22 -5
- package/package.json +4 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIErrorData } from './schemas/error';
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.8.3";
|
|
3
3
|
export declare const API_URL = "https://api1.a-l-p-a.com";
|
|
4
4
|
export declare const PARSE_API_URL = "https://api3.a-l-p-a.com";
|
|
5
5
|
export declare const EVENTS_API_URL = "https://api2.a-l-p-a.com/api";
|
|
@@ -8,6 +8,7 @@ export declare const MOJO_AUTH_URL = "https://api.mojoauth.com";
|
|
|
8
8
|
export declare const HASH_SECRET = "c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2";
|
|
9
9
|
export declare const DEFAULT_LANGUAGE = "ru";
|
|
10
10
|
export declare const UUID_PATTERN = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
11
|
+
export declare const SOCKET_PING_DELAY = 20000;
|
|
11
12
|
export declare const API_HEADERS: {
|
|
12
13
|
'Content-Type': string;
|
|
13
14
|
Accept: string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,cAAc,iCAAiC,CAAC;AAC7D,eAAO,MAAM,eAAe,mCAAmC,CAAC;AAChE,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,YAAY,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,cAAc,iCAAiC,CAAC;AAC7D,eAAO,MAAM,eAAe,mCAAmC,CAAC;AAChE,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,YAAY,yCAAyC,CAAC;AACnE,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAIvC,eAAO,MAAM,WAAW;;;;;;;;;CASvB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAyB1B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CAwB3B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;CAU/B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAyBlD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CODES_MAP = exports.PARSE_USERS_HEADERS = exports.PATCHED_IP_DATA = exports.PATCHED_DEVICE = exports.MOJO_AUTH_HEADERS = exports.API_HEADERS = exports.UUID_PATTERN = exports.DEFAULT_LANGUAGE = exports.HASH_SECRET = exports.MOJO_AUTH_URL = exports.WE_MESH_API_URL = exports.EVENTS_API_URL = exports.PARSE_API_URL = exports.API_URL = exports.VERSION = void 0;
|
|
3
|
+
exports.CODES_MAP = exports.PARSE_USERS_HEADERS = exports.PATCHED_IP_DATA = exports.PATCHED_DEVICE = exports.MOJO_AUTH_HEADERS = exports.API_HEADERS = exports.SOCKET_PING_DELAY = exports.UUID_PATTERN = exports.DEFAULT_LANGUAGE = exports.HASH_SECRET = exports.MOJO_AUTH_URL = exports.WE_MESH_API_URL = exports.EVENTS_API_URL = exports.PARSE_API_URL = exports.API_URL = exports.VERSION = void 0;
|
|
4
4
|
// Constants
|
|
5
|
-
exports.VERSION = '1.
|
|
5
|
+
exports.VERSION = '1.8.3';
|
|
6
6
|
exports.API_URL = 'https://api1.a-l-p-a.com';
|
|
7
7
|
exports.PARSE_API_URL = 'https://api3.a-l-p-a.com';
|
|
8
8
|
exports.EVENTS_API_URL = 'https://api2.a-l-p-a.com/api';
|
|
@@ -11,6 +11,7 @@ exports.MOJO_AUTH_URL = 'https://api.mojoauth.com';
|
|
|
11
11
|
exports.HASH_SECRET = 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2';
|
|
12
12
|
exports.DEFAULT_LANGUAGE = 'ru';
|
|
13
13
|
exports.UUID_PATTERN = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
14
|
+
exports.SOCKET_PING_DELAY = 20000;
|
|
14
15
|
// Structures
|
|
15
16
|
exports.API_HEADERS = {
|
|
16
17
|
'Content-Type': 'application/json',
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { SocksProxies } from 'fetch-socks';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { GetRequestConfig, PostRequestConfig, RawRequestConfig } from '../schemas/configs';
|
|
3
4
|
export declare class HttpWorkflow {
|
|
4
5
|
private __headers;
|
|
5
6
|
private __weMeshHeaders;
|
|
7
|
+
private __currentProxy?;
|
|
8
|
+
private __currentDispatcher?;
|
|
6
9
|
get token(): string;
|
|
7
10
|
get weMeshToken(): string;
|
|
11
|
+
get proxy(): string | undefined;
|
|
8
12
|
set token(token: string);
|
|
9
13
|
set weMeshToken(token: string);
|
|
10
14
|
set popHeaders(key: string);
|
|
@@ -17,5 +21,6 @@ export declare class HttpWorkflow {
|
|
|
17
21
|
sendWeMeshGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
18
22
|
sendWeMeshPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
19
23
|
sendRaw: <T>(config: RawRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
24
|
+
setProxy(rawProxy: string, socksProxy: SocksProxies): void;
|
|
20
25
|
}
|
|
21
26
|
//# sourceMappingURL=httpworkflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpworkflow.d.ts","sourceRoot":"","sources":["../../src/core/httpworkflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAI5B,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,eAAe,CAAmC;IAE1D,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,EAEzB;IAED,OAAO,CAAC,kBAAkB,CAWxB;IAEF,OAAO,CAAC,gBAAgB,CAmBtB;IAEF,OAAO,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"httpworkflow.d.ts","sourceRoot":"","sources":["../../src/core/httpworkflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAI5B,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,eAAe,CAAmC;IAE1D,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,mBAAmB,CAAC,CAAa;IAEzC,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,EAEzB;IAED,OAAO,CAAC,kBAAkB,CAWxB;IAEF,OAAO,CAAC,gBAAgB,CAmBtB;IAEF,OAAO,CAAC,iBAAiB,CAmBvB;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAcX;IAEK,QAAQ,GAAU,CAAC,UAChB,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAEX;IAEK,OAAO,GAAU,CAAC,UACf,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAEX;IAEK,aAAa,GAAU,CAAC,UACrB,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CASX;IAEK,cAAc,GAAU,CAAC,UACtB,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAUX;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CASX;IAEK,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY;CAY3D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpWorkflow = void 0;
|
|
4
4
|
const undici_1 = require("undici");
|
|
5
|
+
const fetch_socks_1 = require("fetch-socks");
|
|
5
6
|
const constants_1 = require("../constants");
|
|
6
7
|
const cryptography_1 = require("../utils/cryptography");
|
|
7
8
|
const logger_1 = require("../utils/logger");
|
|
@@ -35,6 +36,7 @@ class HttpWorkflow {
|
|
|
35
36
|
method,
|
|
36
37
|
headers: this.__configureHeaders(config.body, config.headers),
|
|
37
38
|
body: config.body,
|
|
39
|
+
dispatcher: this.__currentDispatcher,
|
|
38
40
|
});
|
|
39
41
|
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
40
42
|
};
|
|
@@ -43,6 +45,7 @@ class HttpWorkflow {
|
|
|
43
45
|
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
44
46
|
method: 'GET',
|
|
45
47
|
headers: this.__configureHeaders(undefined, config.headers),
|
|
48
|
+
dispatcher: this.__currentDispatcher,
|
|
46
49
|
});
|
|
47
50
|
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
48
51
|
};
|
|
@@ -63,6 +66,7 @@ class HttpWorkflow {
|
|
|
63
66
|
headers: config.headers,
|
|
64
67
|
method: config.method,
|
|
65
68
|
body: config.body,
|
|
69
|
+
dispatcher: this.__currentDispatcher,
|
|
66
70
|
});
|
|
67
71
|
return await this.__handleResponse(statusCode, config.path, body, schema);
|
|
68
72
|
};
|
|
@@ -73,6 +77,9 @@ class HttpWorkflow {
|
|
|
73
77
|
get weMeshToken() {
|
|
74
78
|
return this.__weMeshHeaders.Authorization.slice(7, this.__weMeshHeaders.Authorization.length);
|
|
75
79
|
}
|
|
80
|
+
get proxy() {
|
|
81
|
+
return this.__currentProxy;
|
|
82
|
+
}
|
|
76
83
|
set token(token) {
|
|
77
84
|
this.__headers.Authorization = `Bearer ${token}`;
|
|
78
85
|
}
|
|
@@ -82,5 +89,16 @@ class HttpWorkflow {
|
|
|
82
89
|
set popHeaders(key) {
|
|
83
90
|
delete this.__headers[key];
|
|
84
91
|
}
|
|
92
|
+
setProxy(rawProxy, socksProxy) {
|
|
93
|
+
if (this.__currentDispatcher)
|
|
94
|
+
this.__currentDispatcher.close();
|
|
95
|
+
this.__currentProxy = rawProxy;
|
|
96
|
+
this.__currentDispatcher = (0, fetch_socks_1.socksDispatcher)(socksProxy, {
|
|
97
|
+
connect: {
|
|
98
|
+
rejectUnauthorized: false,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
logger_1.LOGGER.info({ proxy: rawProxy }, 'Proxy set');
|
|
102
|
+
}
|
|
85
103
|
}
|
|
86
104
|
exports.HttpWorkflow = HttpWorkflow;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MeshSocketConfig } from '../schemas/private';
|
|
2
|
+
export declare class MeshSocket {
|
|
3
|
+
private __config;
|
|
4
|
+
private __url;
|
|
5
|
+
private __websocket;
|
|
6
|
+
constructor(config: MeshSocketConfig);
|
|
7
|
+
private __send;
|
|
8
|
+
private __sendFullyJoined;
|
|
9
|
+
private __pingServer;
|
|
10
|
+
onclose: (handler: () => Promise<void>) => void;
|
|
11
|
+
onerror: (handler: () => Promise<void>) => void;
|
|
12
|
+
onmessage: (handler: (data: string) => Promise<void>) => void;
|
|
13
|
+
sendMessage: (content: string) => void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=mesh-socket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh-socket.d.ts","sourceRoot":"","sources":["../../src/core/mesh-socket.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAY;gBAEnB,MAAM,EAAE,gBAAgB;IAkBpC,OAAO,CAAC,MAAM,CAGZ;IAEF,OAAO,CAAC,iBAAiB,CASvB;IAEF,OAAO,CAAC,YAAY,CASlB;IAEK,OAAO,YAAa,MAAM,OAAO,CAAC,IAAI,CAAC,UAG5C;IAEK,OAAO,YAAa,MAAM,OAAO,CAAC,IAAI,CAAC,UAG5C;IAEK,SAAS,YAAa,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,UAG1D;IAEK,WAAW,YAAa,MAAM,KAAG,IAAI,CAe1C;CACH"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeshSocket = void 0;
|
|
4
|
+
const ws_1 = require("ws");
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const logger_1 = require("../utils/logger");
|
|
8
|
+
class MeshSocket {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.__send = (data) => {
|
|
11
|
+
logger_1.LOGGER.info({ url: this.__url, data }, 'Sending data');
|
|
12
|
+
this.__websocket.send(data);
|
|
13
|
+
};
|
|
14
|
+
this.__sendFullyJoined = () => {
|
|
15
|
+
this.__send(JSON.stringify({
|
|
16
|
+
data: {},
|
|
17
|
+
id: 1207144,
|
|
18
|
+
method: 'fullyJoined',
|
|
19
|
+
request: true,
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
this.__pingServer = () => {
|
|
23
|
+
this.__send(JSON.stringify({
|
|
24
|
+
data: {},
|
|
25
|
+
id: 8841449,
|
|
26
|
+
method: 'clientPing',
|
|
27
|
+
request: true,
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
this.onclose = (handler) => {
|
|
31
|
+
logger_1.LOGGER.info({ url: this.__url }, 'WebSocket closed');
|
|
32
|
+
this.__websocket.on('close', handler);
|
|
33
|
+
};
|
|
34
|
+
this.onerror = (handler) => {
|
|
35
|
+
logger_1.LOGGER.error({ ur: this.__url }, 'Websocket error');
|
|
36
|
+
this.__websocket.on('error', handler);
|
|
37
|
+
};
|
|
38
|
+
this.onmessage = (handler) => {
|
|
39
|
+
logger_1.LOGGER.info({ url: this.__url }, 'WebSocket message');
|
|
40
|
+
this.__websocket.on('message', handler);
|
|
41
|
+
};
|
|
42
|
+
this.sendMessage = (content) => {
|
|
43
|
+
this.__send(JSON.stringify({
|
|
44
|
+
data: {
|
|
45
|
+
chat: content,
|
|
46
|
+
detected_lang: 'ru',
|
|
47
|
+
id: (0, crypto_1.randomUUID)(),
|
|
48
|
+
translations: {
|
|
49
|
+
ru: content,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
method: 'chatMessage',
|
|
53
|
+
notification: true,
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
this.__config = config;
|
|
57
|
+
this.__url = `wss://${this.__config.server}/?roomId=${this.__config.meshId}&peerId=${this.__config.userId}_${this.__config.credentials.deviceId}`;
|
|
58
|
+
this.__websocket = new ws_1.WebSocket(this.__url, 'protoo', {
|
|
59
|
+
headers: {
|
|
60
|
+
authorization: `Bearer ${this.__config.credentials.token}`,
|
|
61
|
+
'API-Version': '4',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
this.__websocket.on('open', () => {
|
|
65
|
+
logger_1.LOGGER.info({ url: this.__url }, 'WebSocket opened');
|
|
66
|
+
this.__sendFullyJoined();
|
|
67
|
+
});
|
|
68
|
+
setInterval(this.__pingServer, constants_1.SOCKET_PING_DELAY);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.MeshSocket = MeshSocket;
|
package/dist/core/rave.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { MeshFactory } from '../factories/mesh-factory';
|
|
|
3
3
|
import { UserFactory } from '../factories/user-factory';
|
|
4
4
|
import { RaveConfig } from '../schemas/public';
|
|
5
5
|
import { ThreadFactory } from '../factories/thread-factory';
|
|
6
|
+
import { Account } from '../schemas/rave/account';
|
|
6
7
|
export declare class Rave {
|
|
7
8
|
private __config?;
|
|
8
9
|
private __http;
|
|
@@ -13,10 +14,32 @@ export declare class Rave {
|
|
|
13
14
|
constructor(config?: RaveConfig);
|
|
14
15
|
get token(): string;
|
|
15
16
|
get JWT(): string;
|
|
17
|
+
get account(): {
|
|
18
|
+
acceptDataPolicy: number;
|
|
19
|
+
acceptPrivacy: number;
|
|
20
|
+
acceptTos: number;
|
|
21
|
+
acceptWebIndexing: number;
|
|
22
|
+
gender: string;
|
|
23
|
+
pornScore: number;
|
|
24
|
+
userScore: number;
|
|
25
|
+
yearOfBirth: number;
|
|
26
|
+
avatar: string;
|
|
27
|
+
country: string;
|
|
28
|
+
id: number;
|
|
29
|
+
lat: number;
|
|
30
|
+
lng: number;
|
|
31
|
+
name: string;
|
|
32
|
+
displayName?: string | undefined;
|
|
33
|
+
handle?: string | undefined;
|
|
34
|
+
lang?: string | undefined;
|
|
35
|
+
};
|
|
16
36
|
get auth(): AuthFactory;
|
|
17
37
|
get user(): UserFactory;
|
|
18
38
|
get mesh(): MeshFactory;
|
|
19
39
|
get thread(): ThreadFactory;
|
|
40
|
+
get proxy(): string | undefined;
|
|
41
|
+
set proxy(proxy: string);
|
|
20
42
|
refreshJWT: (deviceId?: string) => Promise<string>;
|
|
43
|
+
getAccount: () => Promise<Account>;
|
|
21
44
|
}
|
|
22
45
|
//# sourceMappingURL=rave.d.ts.map
|
package/dist/core/rave.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIlD,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAe;IAE7B,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,eAAe,CAAC,CAAgB;gBAE5B,MAAM,GAAE,UAAe;IAcnC,IAAI,KAAK,WAER;IAED,IAAI,GAAG,WAEN;IAED,IAAI,OAAO;;;;;;;;;;;;;;;;;;MAMV;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,MAAM,kBAIT;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAMtB;IAEM,UAAU,cAAqB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAU5D;IAEK,UAAU,QAAa,OAAO,CAAC,OAAO,CAAC,CAqB5C;CACH"}
|
package/dist/core/rave.js
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.Rave = void 0;
|
|
7
37
|
const auth_factory_1 = require("../factories/auth-factory");
|
|
8
38
|
const mesh_factory_1 = require("../factories/mesh-factory");
|
|
9
39
|
const user_factory_1 = require("../factories/user-factory");
|
|
10
|
-
const logger_1 =
|
|
40
|
+
const logger_1 = __importStar(require("../utils/logger"));
|
|
11
41
|
const httpworkflow_1 = require("./httpworkflow");
|
|
12
42
|
const responses_1 = require("../schemas/responses");
|
|
13
43
|
const thread_factory_1 = require("../factories/thread-factory");
|
|
44
|
+
const constants_1 = require("../constants");
|
|
45
|
+
const utils_1 = require("../utils/utils");
|
|
14
46
|
class Rave {
|
|
15
47
|
constructor(config = {}) {
|
|
16
48
|
var _a, _b;
|
|
@@ -22,10 +54,26 @@ class Rave {
|
|
|
22
54
|
this.__http.weMeshToken = data;
|
|
23
55
|
return data;
|
|
24
56
|
};
|
|
57
|
+
this.getAccount = async () => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
const { data } = await this.__http.sendPost({
|
|
60
|
+
path: '/auth/login',
|
|
61
|
+
body: JSON.stringify({
|
|
62
|
+
adId: constants_1.PATCHED_DEVICE.adId,
|
|
63
|
+
carrierCountry: constants_1.DEFAULT_LANGUAGE.toUpperCase(),
|
|
64
|
+
deviceId: (_b = (_a = this.__config) === null || _a === void 0 ? void 0 : _a.credentials) === null || _b === void 0 ? void 0 : _b.deviceId,
|
|
65
|
+
lang: constants_1.DEFAULT_LANGUAGE,
|
|
66
|
+
storeCountry: constants_1.DEFAULT_LANGUAGE.toUpperCase(),
|
|
67
|
+
}),
|
|
68
|
+
}, responses_1.GetAccountSchema);
|
|
69
|
+
this.__config = Object.assign(Object.assign({}, this.__config), { account: data });
|
|
70
|
+
return this.__config.account;
|
|
71
|
+
};
|
|
25
72
|
this.__config = config;
|
|
26
73
|
this.__http = new httpworkflow_1.HttpWorkflow();
|
|
27
74
|
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token) {
|
|
28
75
|
this.__http.token = this.__config.credentials.token;
|
|
76
|
+
this.getAccount();
|
|
29
77
|
if ((_b = this.__config.credentials) === null || _b === void 0 ? void 0 : _b.autoJWT)
|
|
30
78
|
this.refreshJWT();
|
|
31
79
|
}
|
|
@@ -37,6 +85,13 @@ class Rave {
|
|
|
37
85
|
get JWT() {
|
|
38
86
|
return this.__http.weMeshToken;
|
|
39
87
|
}
|
|
88
|
+
get account() {
|
|
89
|
+
var _a;
|
|
90
|
+
if (!((_a = this.__config) === null || _a === void 0 ? void 0 : _a.account)) {
|
|
91
|
+
throw new Error('Account not found');
|
|
92
|
+
}
|
|
93
|
+
return this.__config.account;
|
|
94
|
+
}
|
|
40
95
|
get auth() {
|
|
41
96
|
if (!this.__authFactory)
|
|
42
97
|
return (this.__authFactory = new auth_factory_1.AuthFactory(this.__config, this.__http));
|
|
@@ -57,5 +112,16 @@ class Rave {
|
|
|
57
112
|
return (this.__threadFactory = new thread_factory_1.ThreadFactory(this.__http));
|
|
58
113
|
return this.__threadFactory;
|
|
59
114
|
}
|
|
115
|
+
get proxy() {
|
|
116
|
+
return this.__http.proxy;
|
|
117
|
+
}
|
|
118
|
+
set proxy(proxy) {
|
|
119
|
+
try {
|
|
120
|
+
this.__http.setProxy(proxy, (0, utils_1.validateProxy)(proxy));
|
|
121
|
+
}
|
|
122
|
+
catch (_a) {
|
|
123
|
+
logger_1.LOGGER.error({ proxy }, 'Invalid proxy');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
60
126
|
}
|
|
61
127
|
exports.Rave = Rave;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
2
|
import { GetManyMeshesParams, RaveConfig } from '../schemas';
|
|
3
3
|
import { GetManyMeshesResponse, GetMeshResponse } from '../schemas/responses';
|
|
4
|
+
import { MeshSocket } from '../core/mesh-socket';
|
|
4
5
|
export declare class MeshFactory {
|
|
5
6
|
private readonly __config;
|
|
6
7
|
private readonly __http;
|
|
@@ -8,5 +9,6 @@ export declare class MeshFactory {
|
|
|
8
9
|
get: (meshId: string) => Promise<GetMeshResponse>;
|
|
9
10
|
getByLink: (meshLink: string) => Promise<GetMeshResponse>;
|
|
10
11
|
getMany: (params?: GetManyMeshesParams) => Promise<GetManyMeshesResponse>;
|
|
12
|
+
join: (meshId: string) => Promise<MeshSocket>;
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=mesh-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh-factory.d.ts","sourceRoot":"","sources":["../../src/factories/mesh-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mesh-factory.d.ts","sourceRoot":"","sources":["../../src/factories/mesh-factory.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,qBAAqB,EAErB,eAAe,EAIhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,UAAU,YAAK,EAAE,IAAI,EAAE,YAAY;IAKhD,GAAG,WAAkB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAO3D;IAEK,SAAS,aAAoB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAYnE;IAEK,OAAO,YACJ,mBAAmB,KAK1B,OAAO,CAAC,qBAAqB,CAAC,CAO/B;IAEK,IAAI,WAAkB,MAAM,yBAyCjC;CACH"}
|
|
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MeshFactory = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
8
9
|
const constants_1 = require("../constants");
|
|
9
10
|
const responses_1 = require("../schemas/responses");
|
|
10
11
|
const utils_1 = require("../utils/utils");
|
|
12
|
+
const mesh_socket_1 = require("../core/mesh-socket");
|
|
11
13
|
class MeshFactory {
|
|
12
14
|
constructor(config = {}, http) {
|
|
13
15
|
this.get = async (meshId) => {
|
|
@@ -32,6 +34,42 @@ class MeshFactory {
|
|
|
32
34
|
path: `/meshes/self?deviceId=${(_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.deviceId}&public=${!!params.isPublic}&friends=${!!params.hasFriends}&local=${!!params.local}&invited=${!!params.hasInvited}&limit=${params.limit}&lang=${params.language}`,
|
|
33
35
|
}, responses_1.GetManyMeshesSchema);
|
|
34
36
|
};
|
|
37
|
+
this.join = async (meshId) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const mesh = await this.get(meshId);
|
|
40
|
+
await this.__http.sendPost({
|
|
41
|
+
baseUrl: constants_1.EVENTS_API_URL,
|
|
42
|
+
path: '/event',
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
device: Object.assign(Object.assign({}, constants_1.PATCHED_DEVICE), { id: (_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.deviceId }),
|
|
45
|
+
event: 'mesh_join',
|
|
46
|
+
mesh: {
|
|
47
|
+
id: meshId,
|
|
48
|
+
numFriends: 0,
|
|
49
|
+
numStrangers: 0,
|
|
50
|
+
numTotal: 1,
|
|
51
|
+
visibility: 'PRIVATE',
|
|
52
|
+
},
|
|
53
|
+
screen: {
|
|
54
|
+
name: 'LobbyActivity',
|
|
55
|
+
},
|
|
56
|
+
sessionId: (0, crypto_1.randomUUID)(),
|
|
57
|
+
user: {
|
|
58
|
+
id: this.__config.account.id,
|
|
59
|
+
ip_api_data: constants_1.PATCHED_IP_DATA,
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
}, responses_1.StatusSchema);
|
|
63
|
+
return new mesh_socket_1.MeshSocket({
|
|
64
|
+
meshId: meshId,
|
|
65
|
+
server: mesh.data.server,
|
|
66
|
+
userId: this.__config.account.id,
|
|
67
|
+
credentials: {
|
|
68
|
+
deviceId: this.__config.credentials.deviceId,
|
|
69
|
+
token: this.__config.credentials.token,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|
|
35
73
|
this.__config = config;
|
|
36
74
|
this.__http = http;
|
|
37
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-factory.d.ts","sourceRoot":"","sources":["../../src/factories/thread-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"thread-factory.d.ts","sourceRoot":"","sources":["../../src/factories/thread-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAKL,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,OAAO,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAS1C;IAEK,MAAM,WAAkB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAYrD;IAEK,WAAW,aACN,MAAM,WACP,MAAM,KACd,OAAO,CAAC,mBAAmB,CAAC,CAqB7B;CACH"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThreadFactory = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
4
5
|
const responses_1 = require("../schemas/responses");
|
|
5
|
-
const utils_1 = require("../utils/utils");
|
|
6
6
|
class ThreadFactory {
|
|
7
7
|
constructor(http) {
|
|
8
8
|
this.getMany = async () => {
|
|
@@ -19,7 +19,7 @@ class ThreadFactory {
|
|
|
19
19
|
}, responses_1.GetThreadSchema)).data;
|
|
20
20
|
};
|
|
21
21
|
this.sendMessage = async (threadId, content) => {
|
|
22
|
-
const messageId =
|
|
22
|
+
const messageId = (0, crypto_1.randomUUID)();
|
|
23
23
|
return await this.__http.sendWeMeshPost({
|
|
24
24
|
path: `/dms/thread/${threadId}`,
|
|
25
25
|
body: JSON.stringify({
|
|
@@ -16,7 +16,7 @@ export declare const RawRequestConfigSchema: z.ZodObject<{
|
|
|
16
16
|
method: z.ZodString;
|
|
17
17
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18
18
|
path: z.ZodReadonly<z.ZodString>;
|
|
19
|
-
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Buffer
|
|
19
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>]>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
export type PostRequestConfig = z.infer<typeof PostRequestConfigSchema>;
|
|
22
22
|
export type GetRequestConfig = z.infer<typeof GetRequestConfigSchema>;
|
|
@@ -2,8 +2,18 @@ import z from 'zod';
|
|
|
2
2
|
export declare const PagingSchema: z.ZodOptional<z.ZodObject<{
|
|
3
3
|
next: z.ZodOptional<z.ZodString>;
|
|
4
4
|
}, z.core.$strip>>;
|
|
5
|
+
export declare const MeshSocketConfigSchema: z.ZodObject<{
|
|
6
|
+
meshId: z.ZodString;
|
|
7
|
+
server: z.ZodString;
|
|
8
|
+
userId: z.ZodNumber;
|
|
9
|
+
credentials: z.ZodObject<{
|
|
10
|
+
token: z.ZodString;
|
|
11
|
+
deviceId: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, z.core.$strip>;
|
|
5
14
|
export type HeadersType = Record<string, string>;
|
|
6
15
|
export type MethodType = 'POST' | 'PUT';
|
|
7
16
|
export type AuthenticatorMethod = 'LOGIN' | 'REGISTER';
|
|
8
17
|
export type Paging = z.infer<typeof PagingSchema>;
|
|
18
|
+
export type MeshSocketConfig = z.infer<typeof MeshSocketConfigSchema>;
|
|
9
19
|
//# sourceMappingURL=private.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../../src/schemas/private.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../../src/schemas/private.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAIpB,eAAO,MAAM,YAAY;;kBAIZ,CAAC;AAEd,eAAO,MAAM,sBAAsB;;;;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AACxC,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,CAAC;AACvD,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/schemas/private.js
CHANGED
|
@@ -3,10 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PagingSchema = void 0;
|
|
6
|
+
exports.MeshSocketConfigSchema = exports.PagingSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const public_1 = require("./public");
|
|
8
9
|
exports.PagingSchema = zod_1.default
|
|
9
10
|
.object({
|
|
10
11
|
next: zod_1.default.string().optional(),
|
|
11
12
|
})
|
|
12
13
|
.optional();
|
|
14
|
+
exports.MeshSocketConfigSchema = zod_1.default.object({
|
|
15
|
+
meshId: zod_1.default.string(),
|
|
16
|
+
server: zod_1.default.string(),
|
|
17
|
+
userId: zod_1.default.number(),
|
|
18
|
+
credentials: public_1.CredentialsSchema,
|
|
19
|
+
});
|
package/dist/schemas/public.d.ts
CHANGED
|
@@ -7,13 +7,36 @@ export declare const AuthenticatorMethodSchema: z.ZodEnum<{
|
|
|
7
7
|
LOGIN: "LOGIN";
|
|
8
8
|
REGISTER: "REGISTER";
|
|
9
9
|
}>;
|
|
10
|
+
export declare const CredentialsSchema: z.ZodObject<{
|
|
11
|
+
token: z.ZodString;
|
|
12
|
+
deviceId: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
10
14
|
export declare const RaveConfigSchema: z.ZodObject<{
|
|
11
15
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
12
|
-
token: z.ZodOptional<z.ZodString>;
|
|
13
|
-
deviceId: z.ZodOptional<z.ZodString>;
|
|
14
16
|
autoJWT: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
deviceId: z.ZodString;
|
|
15
19
|
}, z.core.$strip>>;
|
|
16
20
|
enableLogging: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
acceptDataPolicy: z.ZodNumber;
|
|
23
|
+
acceptPrivacy: z.ZodNumber;
|
|
24
|
+
acceptTos: z.ZodNumber;
|
|
25
|
+
acceptWebIndexing: z.ZodNumber;
|
|
26
|
+
gender: z.ZodString;
|
|
27
|
+
pornScore: z.ZodNumber;
|
|
28
|
+
userScore: z.ZodNumber;
|
|
29
|
+
yearOfBirth: z.ZodNumber;
|
|
30
|
+
avatar: z.ZodString;
|
|
31
|
+
country: z.ZodString;
|
|
32
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
33
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
34
|
+
id: z.ZodNumber;
|
|
35
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
36
|
+
lat: z.ZodNumber;
|
|
37
|
+
lng: z.ZodNumber;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
17
40
|
}, z.core.$strip>;
|
|
18
41
|
export declare const EditProfileBuilderSchema: z.ZodObject<{
|
|
19
42
|
displayAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -31,6 +54,7 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
31
54
|
en: "en";
|
|
32
55
|
}>;
|
|
33
56
|
}, z.core.$strip>;
|
|
57
|
+
export type Credentials = z.infer<typeof CredentialsSchema>;
|
|
34
58
|
export type RaveConfig = z.infer<typeof RaveConfigSchema>;
|
|
35
59
|
export type EditProfileBuilder = z.infer<typeof EditProfileBuilderSchema>;
|
|
36
60
|
export type GetManyMeshesParams = z.infer<typeof GetManyMeshesSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/schemas/public.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/schemas/public.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,eAAe;;;EAAuB,CAAC;AACpD,eAAO,MAAM,yBAAyB;;;EAAgC,CAAC;AAEvE,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAS3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
package/dist/schemas/public.js
CHANGED
|
@@ -3,19 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GetManyMeshesSchema = exports.EditProfileBuilderSchema = exports.RaveConfigSchema = exports.AuthenticatorMethodSchema = exports.LanguagesSchema = void 0;
|
|
6
|
+
exports.GetManyMeshesSchema = exports.EditProfileBuilderSchema = exports.RaveConfigSchema = exports.CredentialsSchema = exports.AuthenticatorMethodSchema = exports.LanguagesSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const account_1 = require("./rave/account");
|
|
8
9
|
exports.LanguagesSchema = zod_1.default.enum(['en', 'ru']);
|
|
9
10
|
exports.AuthenticatorMethodSchema = zod_1.default.enum(['LOGIN', 'REGISTER']);
|
|
11
|
+
exports.CredentialsSchema = zod_1.default.object({
|
|
12
|
+
token: zod_1.default.string(),
|
|
13
|
+
deviceId: zod_1.default.string(),
|
|
14
|
+
});
|
|
10
15
|
exports.RaveConfigSchema = zod_1.default.object({
|
|
11
16
|
credentials: zod_1.default
|
|
12
|
-
.object({
|
|
13
|
-
token: zod_1.default.string().optional(),
|
|
14
|
-
deviceId: zod_1.default.string().optional(),
|
|
15
|
-
autoJWT: zod_1.default.boolean().optional(),
|
|
16
|
-
})
|
|
17
|
+
.object(Object.assign(Object.assign({}, exports.CredentialsSchema.shape), { autoJWT: zod_1.default.boolean().optional() }))
|
|
17
18
|
.optional(),
|
|
18
19
|
enableLogging: zod_1.default.boolean().optional(),
|
|
20
|
+
account: account_1.AccountSchema.optional(),
|
|
19
21
|
});
|
|
20
22
|
exports.EditProfileBuilderSchema = zod_1.default.object({
|
|
21
23
|
displayAvatar: zod_1.default.string().optional(),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const AccountSchema: z.ZodObject<{
|
|
3
|
+
acceptDataPolicy: z.ZodNumber;
|
|
4
|
+
acceptPrivacy: z.ZodNumber;
|
|
5
|
+
acceptTos: z.ZodNumber;
|
|
6
|
+
acceptWebIndexing: z.ZodNumber;
|
|
7
|
+
gender: z.ZodString;
|
|
8
|
+
pornScore: z.ZodNumber;
|
|
9
|
+
userScore: z.ZodNumber;
|
|
10
|
+
yearOfBirth: z.ZodNumber;
|
|
11
|
+
avatar: z.ZodString;
|
|
12
|
+
country: z.ZodString;
|
|
13
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
15
|
+
id: z.ZodNumber;
|
|
16
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
17
|
+
lat: z.ZodNumber;
|
|
18
|
+
lng: z.ZodNumber;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type Account = z.infer<typeof AccountSchema>;
|
|
22
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/account.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAIpB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;iBAUxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccountSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const user_1 = require("./user");
|
|
9
|
+
exports.AccountSchema = zod_1.default.object(Object.assign(Object.assign({}, user_1.UserSchema.shape), { acceptDataPolicy: zod_1.default.number(), acceptPrivacy: zod_1.default.number(), acceptTos: zod_1.default.number(), acceptWebIndexing: zod_1.default.number(), gender: zod_1.default.string(), pornScore: zod_1.default.number(), userScore: zod_1.default.number(), yearOfBirth: zod_1.default.number() }));
|
|
@@ -5,17 +5,17 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
5
5
|
displayName: z.ZodOptional<z.ZodString>;
|
|
6
6
|
handle: z.ZodOptional<z.ZodString>;
|
|
7
7
|
id: z.ZodNumber;
|
|
8
|
-
lang: z.ZodString
|
|
8
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
9
9
|
lat: z.ZodNumber;
|
|
10
10
|
lng: z.ZodNumber;
|
|
11
11
|
name: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export declare const ProfileSchema: z.ZodObject<{
|
|
14
14
|
name: z.ZodString;
|
|
15
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
16
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
17
15
|
avatar: z.ZodString;
|
|
18
16
|
country: z.ZodString;
|
|
17
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
export type User = z.infer<typeof UserSchema>;
|
|
21
21
|
export type Profile = z.infer<typeof ProfileSchema>;
|
|
@@ -11,7 +11,7 @@ exports.UserSchema = zod_1.default.object({
|
|
|
11
11
|
displayName: zod_1.default.string().optional(),
|
|
12
12
|
handle: zod_1.default.string().optional(),
|
|
13
13
|
id: zod_1.default.number(),
|
|
14
|
-
lang: zod_1.default.string(),
|
|
14
|
+
lang: zod_1.default.string().optional(),
|
|
15
15
|
lat: zod_1.default.number(),
|
|
16
16
|
lng: zod_1.default.number(),
|
|
17
17
|
name: zod_1.default.string(),
|
|
@@ -6,7 +6,7 @@ export declare const EditProfileSchema: z.ZodObject<{
|
|
|
6
6
|
displayName: z.ZodOptional<z.ZodString>;
|
|
7
7
|
handle: z.ZodOptional<z.ZodString>;
|
|
8
8
|
id: z.ZodNumber;
|
|
9
|
-
lang: z.ZodString
|
|
9
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
10
10
|
lat: z.ZodNumber;
|
|
11
11
|
lng: z.ZodNumber;
|
|
12
12
|
name: z.ZodString;
|
|
@@ -152,7 +152,7 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
152
152
|
displayName: z.ZodOptional<z.ZodString>;
|
|
153
153
|
handle: z.ZodOptional<z.ZodString>;
|
|
154
154
|
id: z.ZodNumber;
|
|
155
|
-
lang: z.ZodString
|
|
155
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
156
156
|
lat: z.ZodNumber;
|
|
157
157
|
lng: z.ZodNumber;
|
|
158
158
|
name: z.ZodString;
|
|
@@ -170,7 +170,7 @@ export declare const GetMeshSchema: z.ZodObject<{
|
|
|
170
170
|
displayName: z.ZodOptional<z.ZodString>;
|
|
171
171
|
handle: z.ZodOptional<z.ZodString>;
|
|
172
172
|
id: z.ZodNumber;
|
|
173
|
-
lang: z.ZodString
|
|
173
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
174
174
|
lat: z.ZodNumber;
|
|
175
175
|
lng: z.ZodNumber;
|
|
176
176
|
name: z.ZodString;
|
|
@@ -228,10 +228,10 @@ export declare const GetUserSchema: z.ZodObject<{
|
|
|
228
228
|
}, z.core.$strip>;
|
|
229
229
|
profile: z.ZodObject<{
|
|
230
230
|
name: z.ZodString;
|
|
231
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
232
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
233
231
|
avatar: z.ZodString;
|
|
234
232
|
country: z.ZodString;
|
|
233
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
234
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
235
235
|
}, z.core.$strip>;
|
|
236
236
|
}, z.core.$strip>;
|
|
237
237
|
}, z.core.$strip>;
|
|
@@ -289,6 +289,30 @@ export declare const SendMessageSchema: z.ZodObject<{
|
|
|
289
289
|
}>>;
|
|
290
290
|
}, z.core.$strip>;
|
|
291
291
|
}, z.core.$strip>;
|
|
292
|
+
export declare const StatusSchema: z.ZodObject<{
|
|
293
|
+
status: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>;
|
|
295
|
+
export declare const GetAccountSchema: z.ZodObject<{
|
|
296
|
+
data: z.ZodObject<{
|
|
297
|
+
acceptDataPolicy: z.ZodNumber;
|
|
298
|
+
acceptPrivacy: z.ZodNumber;
|
|
299
|
+
acceptTos: z.ZodNumber;
|
|
300
|
+
acceptWebIndexing: z.ZodNumber;
|
|
301
|
+
gender: z.ZodString;
|
|
302
|
+
pornScore: z.ZodNumber;
|
|
303
|
+
userScore: z.ZodNumber;
|
|
304
|
+
yearOfBirth: z.ZodNumber;
|
|
305
|
+
avatar: z.ZodString;
|
|
306
|
+
country: z.ZodString;
|
|
307
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
308
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
309
|
+
id: z.ZodNumber;
|
|
310
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
311
|
+
lat: z.ZodNumber;
|
|
312
|
+
lng: z.ZodNumber;
|
|
313
|
+
name: z.ZodString;
|
|
314
|
+
}, z.core.$strip>;
|
|
315
|
+
}, z.core.$strip>;
|
|
292
316
|
export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
|
|
293
317
|
export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
|
|
294
318
|
export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
|
|
@@ -304,4 +328,6 @@ export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
|
|
|
304
328
|
export type GetThreadsResponse = z.infer<typeof GetThreadsSchema>;
|
|
305
329
|
export type GetThreadResponse = z.infer<typeof GetThreadSchema>;
|
|
306
330
|
export type SendMessageResponse = z.infer<typeof SendMessageSchema>;
|
|
331
|
+
export type StatusedResponse = z.infer<typeof StatusSchema>;
|
|
332
|
+
export type GetAccountResponse = z.infer<typeof GetAccountSchema>;
|
|
307
333
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SendMessageSchema = exports.GetThreadSchema = exports.GetThreadsSchema = exports.ValidateMeSchema = exports.FriendshipSchema = exports.GetUserSchema = exports.GetMeshSchema = exports.GetManyMeshesSchema = exports.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
|
|
6
|
+
exports.GetAccountSchema = exports.StatusSchema = exports.SendMessageSchema = exports.GetThreadSchema = exports.GetThreadsSchema = exports.ValidateMeSchema = exports.FriendshipSchema = exports.GetUserSchema = exports.GetMeshSchema = exports.GetManyMeshesSchema = exports.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const user_1 = require("./rave/user");
|
|
9
9
|
const mesh_1 = require("./rave/mesh");
|
|
10
10
|
const private_1 = require("./private");
|
|
11
11
|
const thread_1 = require("./rave/thread");
|
|
12
12
|
const message_1 = require("./rave/message");
|
|
13
|
+
const account_1 = require("./rave/account");
|
|
13
14
|
exports.EditProfileSchema = zod_1.default.object({
|
|
14
15
|
data: user_1.UserSchema,
|
|
15
16
|
});
|
|
@@ -146,3 +147,9 @@ exports.SendMessageSchema = zod_1.default.object({
|
|
|
146
147
|
messageBody: message_1.MessageSchema,
|
|
147
148
|
}),
|
|
148
149
|
});
|
|
150
|
+
exports.StatusSchema = zod_1.default.object({
|
|
151
|
+
status: zod_1.default.number(),
|
|
152
|
+
});
|
|
153
|
+
exports.GetAccountSchema = zod_1.default.object({
|
|
154
|
+
data: account_1.AccountSchema,
|
|
155
|
+
});
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { SocksProxies } from 'fetch-socks';
|
|
1
2
|
export declare const isOk: (status: number) => boolean;
|
|
2
3
|
export declare const matchMeshId: (text: string) => string;
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const validateProxy: (proxy: string) => SocksProxies;
|
|
4
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,WAAY,MAAM,YAAkC,CAAC;AACtE,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAG7B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,IAAI,WAAY,MAAM,YAAkC,CAAC;AACtE,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAG7B,CAAC;AAEf,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,YAwB7C,CAAC"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateProxy = exports.matchMeshId = exports.isOk = void 0;
|
|
4
4
|
const isOk = (status) => status >= 200 && status < 300;
|
|
5
5
|
exports.isOk = isOk;
|
|
6
6
|
const matchMeshId = (text) => {
|
|
@@ -8,8 +8,25 @@ const matchMeshId = (text) => {
|
|
|
8
8
|
return ((_a = text.match(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi)) === null || _a === void 0 ? void 0 : _a[0]) || '';
|
|
9
9
|
};
|
|
10
10
|
exports.matchMeshId = matchMeshId;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
const validateProxy = (proxy) => {
|
|
12
|
+
const match = proxy.match(/socks([45])/);
|
|
13
|
+
if (proxy.includes('@')) {
|
|
14
|
+
const splittedPart = proxy.split('@');
|
|
15
|
+
const [, userId, password] = splittedPart[0].split(':');
|
|
16
|
+
const [host, port] = splittedPart[1].split(':');
|
|
17
|
+
return {
|
|
18
|
+
host,
|
|
19
|
+
type: match ? Number(match[1]) : 5,
|
|
20
|
+
port: Number(port),
|
|
21
|
+
userId: userId.slice(2),
|
|
22
|
+
password,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const [host, port] = proxy.slice(9).split(':');
|
|
26
|
+
return {
|
|
27
|
+
host,
|
|
28
|
+
type: match ? Number(match[1]) : 5,
|
|
29
|
+
port: Number(port),
|
|
30
|
+
};
|
|
14
31
|
};
|
|
15
|
-
exports.
|
|
32
|
+
exports.validateProxy = validateProxy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ravejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -39,12 +39,15 @@
|
|
|
39
39
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@types/ws": "^8.18.1",
|
|
42
43
|
"typescript": "^5.2.2"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
46
|
+
"fetch-socks": "^1.3.2",
|
|
45
47
|
"pino": "^10.1.0",
|
|
46
48
|
"pino-pretty": "^13.1.3",
|
|
47
49
|
"uuid": "^13.0.0",
|
|
50
|
+
"ws": "^8.18.3",
|
|
48
51
|
"zod": "^4.1.13"
|
|
49
52
|
}
|
|
50
53
|
}
|