ravejs 1.4.2 → 1.5.2
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 +6 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -4
- package/dist/core/httpworkflow.d.ts +4 -0
- package/dist/core/httpworkflow.d.ts.map +1 -1
- package/dist/core/httpworkflow.js +17 -5
- package/dist/core/rave.js +2 -1
- package/dist/factories/auth-factory.d.ts +1 -0
- package/dist/factories/auth-factory.d.ts.map +1 -1
- package/dist/factories/auth-factory.js +10 -1
- package/dist/factories/mesh-factory.d.ts +2 -1
- package/dist/factories/mesh-factory.d.ts.map +1 -1
- package/dist/factories/mesh-factory.js +10 -1
- package/dist/factories/user-factory.d.ts +3 -1
- package/dist/factories/user-factory.d.ts.map +1 -1
- package/dist/factories/user-factory.js +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/schemas/configs.d.ts +2 -0
- package/dist/schemas/configs.d.ts.map +1 -1
- package/dist/schemas/configs.js +1 -0
- package/dist/schemas/private.d.ts +9 -0
- package/dist/schemas/private.d.ts.map +1 -0
- package/dist/schemas/private.js +12 -0
- package/dist/schemas/public.d.ts +8 -2
- package/dist/schemas/public.d.ts.map +1 -1
- package/dist/schemas/public.js +5 -3
- package/dist/schemas/rave/mesh.d.ts +2 -1
- package/dist/schemas/rave/mesh.d.ts.map +1 -1
- package/dist/schemas/rave/mesh.js +1 -1
- package/dist/schemas/rave/user.d.ts +8 -0
- package/dist/schemas/rave/user.d.ts.map +1 -1
- package/dist/schemas/rave/user.js +7 -1
- package/dist/schemas/responses.d.ts +88 -1
- package/dist/schemas/responses.d.ts.map +1 -1
- package/dist/schemas/responses.js +28 -6
- package/dist/utils/cryptography.d.ts.map +1 -1
- package/dist/utils/cryptography.js +2 -4
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +5 -7
- package/package.json +1 -2
package/dist/constants.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { APIErrorData } from './schemas/error';
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.5.2";
|
|
3
3
|
export declare const API_URL = "https://api1.a-l-p-a.com";
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const PARSE_API_URL = "https://api3.a-l-p-a.com";
|
|
5
|
+
export declare const EVENTS_API_URL = "https://api2.a-l-p-a.com/api";
|
|
6
|
+
export declare const WE_MESH_API_URL = "https://wallace2.red.wemesh.ca";
|
|
5
7
|
export declare const MOJO_AUTH_URL = "https://api.mojoauth.com";
|
|
6
8
|
export declare const HASH_SECRET = "c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2";
|
|
7
9
|
export declare const DEFAULT_LANGUAGE = "ru";
|
|
8
|
-
export declare const
|
|
10
|
+
export declare const UUID_PATTERN = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
11
|
+
export declare const API_HEADERS: {
|
|
9
12
|
'Content-Type': string;
|
|
10
13
|
Accept: string;
|
|
11
14
|
Connection: 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,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,OAAO,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;AAInE,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,CAqBlD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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.
|
|
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;
|
|
4
4
|
// Constants
|
|
5
|
-
exports.VERSION = '1.
|
|
5
|
+
exports.VERSION = '1.5.2';
|
|
6
6
|
exports.API_URL = 'https://api1.a-l-p-a.com';
|
|
7
|
-
exports.
|
|
7
|
+
exports.PARSE_API_URL = 'https://api3.a-l-p-a.com';
|
|
8
|
+
exports.EVENTS_API_URL = 'https://api2.a-l-p-a.com/api';
|
|
9
|
+
exports.WE_MESH_API_URL = 'https://wallace2.red.wemesh.ca';
|
|
8
10
|
exports.MOJO_AUTH_URL = 'https://api.mojoauth.com';
|
|
9
11
|
exports.HASH_SECRET = 'c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2';
|
|
10
12
|
exports.DEFAULT_LANGUAGE = 'ru';
|
|
13
|
+
exports.UUID_PATTERN = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
11
14
|
// Structures
|
|
12
|
-
exports.
|
|
15
|
+
exports.API_HEADERS = {
|
|
13
16
|
'Content-Type': 'application/json',
|
|
14
17
|
Accept: 'application/json',
|
|
15
18
|
Connection: 'keep-alive',
|
|
@@ -2,8 +2,10 @@ import { z } from 'zod';
|
|
|
2
2
|
import { GetRequestConfig, PostRequestConfig, RawRequestConfig } from '../schemas/configs';
|
|
3
3
|
export declare class HttpWorkflow {
|
|
4
4
|
private __headers;
|
|
5
|
+
private __weMeshHeaders;
|
|
5
6
|
get token(): string;
|
|
6
7
|
set token(token: string);
|
|
8
|
+
set weMeshToken(token: string);
|
|
7
9
|
set popHeaders(key: string);
|
|
8
10
|
private __configureHeaders;
|
|
9
11
|
private __handleResponse;
|
|
@@ -11,6 +13,8 @@ export declare class HttpWorkflow {
|
|
|
11
13
|
sendGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
12
14
|
sendPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
13
15
|
sendPut: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
16
|
+
sendWeMeshGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
17
|
+
sendWeMeshPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
14
18
|
sendRaw: <T>(config: RawRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
15
19
|
}
|
|
16
20
|
//# 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,
|
|
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,CAA4B;IAC7C,OAAO,CAAC,eAAe,CAA4B;IAEnD,IAAI,KAAK,IAAI,MAAM,CAKlB;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,CAQxB;IAEF,OAAO,CAAC,gBAAgB,CAetB;IAEF,OAAO,CAAC,iBAAiB,CAkBvB;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAaX;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,CAQX;IAEK,cAAc,GAAU,CAAC,UACtB,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CASX;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAQX;CACH"}
|
|
@@ -9,7 +9,8 @@ const utils_1 = require("../utils/utils");
|
|
|
9
9
|
const exceptions_1 = require("../utils/exceptions");
|
|
10
10
|
class HttpWorkflow {
|
|
11
11
|
constructor() {
|
|
12
|
-
this.__headers = constants_1.
|
|
12
|
+
this.__headers = constants_1.API_HEADERS;
|
|
13
|
+
this.__weMeshHeaders = constants_1.API_HEADERS;
|
|
13
14
|
this.__configureHeaders = (data) => {
|
|
14
15
|
const timestamp = Date.now().toString();
|
|
15
16
|
return Object.assign(Object.assign({}, this.__headers), { 'request-ts': timestamp, 'request-hash': (0, cryptography_1.generateHash)(this.token, timestamp, (data === null || data === void 0 ? void 0 : data.length) || 0) });
|
|
@@ -24,19 +25,21 @@ class HttpWorkflow {
|
|
|
24
25
|
return schema.parse(JSON.parse(response));
|
|
25
26
|
};
|
|
26
27
|
this.__sendDataRequest = async (method, config, schema) => {
|
|
27
|
-
const
|
|
28
|
+
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
29
|
+
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
28
30
|
method,
|
|
29
31
|
headers: this.__configureHeaders(config.body),
|
|
30
32
|
body: config.body,
|
|
31
33
|
});
|
|
32
|
-
return await this.__handleResponse(statusCode, `${
|
|
34
|
+
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
33
35
|
};
|
|
34
36
|
this.sendGet = async (config, schema) => {
|
|
35
|
-
const
|
|
37
|
+
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
38
|
+
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
36
39
|
method: 'GET',
|
|
37
40
|
headers: this.__configureHeaders(),
|
|
38
41
|
});
|
|
39
|
-
return await this.__handleResponse(statusCode, `${
|
|
42
|
+
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
40
43
|
};
|
|
41
44
|
this.sendPost = async (config, schema) => {
|
|
42
45
|
return await this.__sendDataRequest('POST', config, schema);
|
|
@@ -44,6 +47,12 @@ class HttpWorkflow {
|
|
|
44
47
|
this.sendPut = async (config, schema) => {
|
|
45
48
|
return await this.__sendDataRequest('PUT', config, schema);
|
|
46
49
|
};
|
|
50
|
+
this.sendWeMeshGet = async (config, schema) => {
|
|
51
|
+
return await this.sendGet(Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
|
|
52
|
+
};
|
|
53
|
+
this.sendWeMeshPost = async (config, schema) => {
|
|
54
|
+
return await this.__sendDataRequest('POST', Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
|
|
55
|
+
};
|
|
47
56
|
this.sendRaw = async (config, schema) => {
|
|
48
57
|
const { statusCode, body } = await (0, undici_1.request)(config.path, {
|
|
49
58
|
headers: config.headers,
|
|
@@ -59,6 +68,9 @@ class HttpWorkflow {
|
|
|
59
68
|
set token(token) {
|
|
60
69
|
this.__headers.Authorization = `Bearer ${token}`;
|
|
61
70
|
}
|
|
71
|
+
set weMeshToken(token) {
|
|
72
|
+
this.__weMeshHeaders.Authorization = `Bearer ${token}`;
|
|
73
|
+
}
|
|
62
74
|
set popHeaders(key) {
|
|
63
75
|
delete this.__headers[key];
|
|
64
76
|
}
|
package/dist/core/rave.js
CHANGED
|
@@ -11,9 +11,10 @@ const logger_1 = __importDefault(require("../utils/logger"));
|
|
|
11
11
|
const httpworkflow_1 = require("./httpworkflow");
|
|
12
12
|
class Rave {
|
|
13
13
|
constructor(config = {}) {
|
|
14
|
+
var _a;
|
|
14
15
|
this.__config = config;
|
|
15
16
|
this.__http = new httpworkflow_1.HttpWorkflow();
|
|
16
|
-
if (this.__config.credentials)
|
|
17
|
+
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token)
|
|
17
18
|
this.__http.token = this.__config.credentials.token;
|
|
18
19
|
(0, logger_1.default)(!!config.enableLogging);
|
|
19
20
|
}
|
|
@@ -12,5 +12,6 @@ export declare class AuthFactory {
|
|
|
12
12
|
mojoLogin: (email: string, parseId: string, parseToken: string, name: string, deviceId?: string, language?: string) => Promise<MojoLoginResponse>;
|
|
13
13
|
login: (stateId: string, name?: string, deviceId?: string, language?: string) => Promise<AuthenticateResponse>;
|
|
14
14
|
register: (stateId: string, name?: string, deviceId?: string, language?: string) => Promise<AuthenticateResponse>;
|
|
15
|
+
getWeMeshJWT: (deviceId?: string) => Promise<string>;
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=auth-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../src/factories/auth-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAEL,oBAAoB,EACpB,0BAA0B,EAE1B,iBAAiB,EAEjB,4BAA4B,EAE5B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../src/factories/auth-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAEL,oBAAoB,EACpB,0BAA0B,EAE1B,iBAAiB,EAEjB,4BAA4B,EAE5B,qBAAqB,EAItB,MAAM,sBAAsB,CAAC;AAI9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,UAAU,YAAK,EAAE,IAAI,EAAE,YAAY;IAKvD,OAAO,CAAC,eAAe,CAsCrB;IAEK,aAAa,UACX,MAAM,aACH,MAAM,KACf,OAAO,CAAC,qBAAqB,CAAC,CAU/B;IAEK,kBAAkB,YACd,MAAM,KACd,OAAO,CAAC,0BAA0B,CAAC,CASpC;IAEK,oBAAoB,YAChB,MAAM,SACR,MAAM,KACZ,OAAO,CAAC,4BAA4B,CAAC,CAiBtC;IAEK,SAAS,UACP,MAAM,WACJ,MAAM,cACH,MAAM,QACZ,MAAM,aACF,MAAM,aACN,MAAM,KACf,OAAO,CAAC,iBAAiB,CAAC,CAsB3B;IAEK,KAAK,YACD,MAAM,SACR,MAAM,aACF,MAAM,aACN,MAAM,KAChB,OAAO,CAAC,oBAAoB,CAAC,CAQ9B;IAEK,QAAQ,YACJ,MAAM,SACR,MAAM,aACF,MAAM,aACN,MAAM,KAChB,OAAO,CAAC,oBAAoB,CAAC,CAQ9B;IAEK,YAAY,cAAqB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAc9D;CACH"}
|
|
@@ -44,7 +44,7 @@ class AuthFactory {
|
|
|
44
44
|
return await this.__http.sendRaw({
|
|
45
45
|
method: 'POST',
|
|
46
46
|
headers: constants_1.PARSE_USERS_HEADERS,
|
|
47
|
-
path: `${constants_1.
|
|
47
|
+
path: `${constants_1.PARSE_API_URL}/parse/users`,
|
|
48
48
|
body: JSON.stringify({
|
|
49
49
|
authData: {
|
|
50
50
|
mojo: {
|
|
@@ -80,6 +80,15 @@ class AuthFactory {
|
|
|
80
80
|
this.register = async (stateId, name, deviceId, language) => {
|
|
81
81
|
return await this.__authenticator(stateId, 'REGISTER', name, deviceId, language);
|
|
82
82
|
};
|
|
83
|
+
this.getWeMeshJWT = async (deviceId) => {
|
|
84
|
+
var _a;
|
|
85
|
+
const { data } = await this.__http.sendGet({
|
|
86
|
+
path: `/users/self/validateMe?deviceId=${deviceId || ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.deviceId)}`,
|
|
87
|
+
}, responses_1.ValidateMeSchema);
|
|
88
|
+
this.__config.credentials = Object.assign(Object.assign({}, this.__config.credentials), { weMeshJWT: data });
|
|
89
|
+
this.__http.weMeshToken = data;
|
|
90
|
+
return data;
|
|
91
|
+
};
|
|
83
92
|
this.__config = config;
|
|
84
93
|
this.__http = http;
|
|
85
94
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
2
|
import { GetManyMeshesParams, RaveConfig } from '../schemas';
|
|
3
|
-
import { GetManyMeshesResponse } from '../schemas/responses';
|
|
3
|
+
import { GetManyMeshesResponse, GetMeshResponse } from '../schemas/responses';
|
|
4
4
|
export declare class MeshFactory {
|
|
5
5
|
private readonly __config;
|
|
6
6
|
private readonly __http;
|
|
7
7
|
constructor(config: RaveConfig | undefined, http: HttpWorkflow);
|
|
8
|
+
get: (meshId: string) => Promise<GetMeshResponse>;
|
|
8
9
|
getMany: (params?: GetManyMeshesParams) => Promise<GetManyMeshesResponse>;
|
|
9
10
|
}
|
|
10
11
|
//# 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":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,qBAAqB,
|
|
1
|
+
{"version":3,"file":"mesh-factory.d.ts","sourceRoot":"","sources":["../../src/factories/mesh-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,qBAAqB,EAErB,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,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,OAAO,YACJ,mBAAmB,KAK1B,OAAO,CAAC,qBAAqB,CAAC,CAO/B;CACH"}
|
|
@@ -5,7 +5,16 @@ const constants_1 = require("../constants");
|
|
|
5
5
|
const responses_1 = require("../schemas/responses");
|
|
6
6
|
class MeshFactory {
|
|
7
7
|
constructor(config = {}, http) {
|
|
8
|
-
this.
|
|
8
|
+
this.get = async (meshId) => {
|
|
9
|
+
return await this.__http.sendGet({
|
|
10
|
+
path: `/meshes/${meshId}`,
|
|
11
|
+
}, responses_1.GetMeshSchema);
|
|
12
|
+
};
|
|
13
|
+
this.getMany = async (params = {
|
|
14
|
+
limit: 20,
|
|
15
|
+
language: constants_1.DEFAULT_LANGUAGE,
|
|
16
|
+
isPublic: true,
|
|
17
|
+
}) => {
|
|
9
18
|
var _a;
|
|
10
19
|
return await this.__http.sendGet({
|
|
11
20
|
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}`,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
2
|
import { EditProfileBuilder } from '../schemas';
|
|
3
|
-
import { EditProfileResponse, GetAvatarUploadResponse } from '../schemas/responses';
|
|
3
|
+
import { EditProfileResponse, GetAvatarUploadResponse, GetUserResponse, SendFriendshipResponse } from '../schemas/responses';
|
|
4
4
|
export declare class UserFactory {
|
|
5
5
|
private readonly __http;
|
|
6
6
|
constructor(http: HttpWorkflow);
|
|
7
|
+
get: (userId: number) => Promise<GetUserResponse>;
|
|
8
|
+
sendFriendship: (userId: number) => Promise<SendFriendshipResponse>;
|
|
7
9
|
edit: (builder: EditProfileBuilder) => Promise<EditProfileResponse>;
|
|
8
10
|
getAvatarUpload: () => Promise<GetAvatarUploadResponse>;
|
|
9
11
|
uploadOnUrl: (uploadUrl: string, image: Buffer) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-factory.d.ts","sourceRoot":"","sources":["../../src/factories/user-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"user-factory.d.ts","sourceRoot":"","sources":["../../src/factories/user-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EAEvB,eAAe,EAEf,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,GAAG,WAAkB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAO3D;IAEK,cAAc,WACX,MAAM,KACb,OAAO,CAAC,sBAAsB,CAAC,CAQhC;IAEK,IAAI,YACA,kBAAkB,KAC1B,OAAO,CAAC,mBAAmB,CAAC,CAQ7B;IAEK,eAAe,QAAa,OAAO,CAAC,uBAAuB,CAAC,CAQjE;IAEK,WAAW,cACL,MAAM,SACV,MAAM,KACZ,OAAO,CAAC,GAAG,CAAC,CAYb;IAEK,YAAY,UAAiB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAI1D;CACH"}
|
|
@@ -9,6 +9,17 @@ const schemas_1 = require("../schemas");
|
|
|
9
9
|
const responses_1 = require("../schemas/responses");
|
|
10
10
|
class UserFactory {
|
|
11
11
|
constructor(http) {
|
|
12
|
+
this.get = async (userId) => {
|
|
13
|
+
return await this.__http.sendGet({
|
|
14
|
+
path: `/profiles/${userId}?exclude=false&clientVersion=1`,
|
|
15
|
+
}, responses_1.GetUserSchema);
|
|
16
|
+
};
|
|
17
|
+
this.sendFriendship = async (userId) => {
|
|
18
|
+
return await this.__http.sendPost({
|
|
19
|
+
path: `/friendships`,
|
|
20
|
+
body: JSON.stringify({ id: userId }),
|
|
21
|
+
}, responses_1.SendFriendshipSchema);
|
|
22
|
+
};
|
|
12
23
|
this.edit = async (builder) => {
|
|
13
24
|
return await this.__http.sendPut({
|
|
14
25
|
path: '/users/self',
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const PostRequestConfigSchema: z.ZodObject<{
|
|
3
3
|
path: z.ZodReadonly<z.ZodString>;
|
|
4
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
4
5
|
body: z.ZodReadonly<z.ZodString>;
|
|
5
6
|
contentType: z.ZodOptional<z.ZodString>;
|
|
6
7
|
}, z.core.$strip>;
|
|
7
8
|
export declare const GetRequestConfigSchema: z.ZodObject<{
|
|
8
9
|
path: z.ZodReadonly<z.ZodString>;
|
|
10
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
9
11
|
contentType: z.ZodOptional<z.ZodString>;
|
|
10
12
|
}, z.core.$strip>;
|
|
11
13
|
export declare const RawRequestConfigSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/schemas/configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/schemas/configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;iBAEjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/schemas/configs.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.RawRequestConfigSchema = exports.GetRequestConfigSchema = exports.PostRe
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.PostRequestConfigSchema = zod_1.z.object({
|
|
6
6
|
path: zod_1.z.string().readonly(),
|
|
7
|
+
baseUrl: zod_1.z.string().optional(),
|
|
7
8
|
body: zod_1.z.string().readonly(),
|
|
8
9
|
contentType: zod_1.z.string().optional(),
|
|
9
10
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const PagingSchema: z.ZodOptional<z.ZodObject<{
|
|
3
|
+
next: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>>;
|
|
5
|
+
export type HeadersType = Record<string, string>;
|
|
6
|
+
export type MethodType = 'POST' | 'PUT';
|
|
7
|
+
export type AuthenticatorMethod = 'LOGIN' | 'REGISTER';
|
|
8
|
+
export type Paging = z.infer<typeof PagingSchema>;
|
|
9
|
+
//# sourceMappingURL=private.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.d.ts","sourceRoot":"","sources":["../../src/schemas/private.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,YAAY;;kBAIZ,CAAC;AAEd,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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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.PagingSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.PagingSchema = zod_1.default
|
|
9
|
+
.object({
|
|
10
|
+
next: zod_1.default.string().optional(),
|
|
11
|
+
})
|
|
12
|
+
.optional();
|
package/dist/schemas/public.d.ts
CHANGED
|
@@ -3,10 +3,15 @@ export declare const LanguagesSchema: z.ZodEnum<{
|
|
|
3
3
|
ru: "ru";
|
|
4
4
|
en: "en";
|
|
5
5
|
}>;
|
|
6
|
+
export declare const AuthenticatorMethodSchema: z.ZodEnum<{
|
|
7
|
+
LOGIN: "LOGIN";
|
|
8
|
+
REGISTER: "REGISTER";
|
|
9
|
+
}>;
|
|
6
10
|
export declare const RaveConfigSchema: z.ZodObject<{
|
|
7
11
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
8
|
-
token: z.ZodString
|
|
9
|
-
deviceId: z.ZodString
|
|
12
|
+
token: z.ZodOptional<z.ZodString>;
|
|
13
|
+
deviceId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
weMeshJWT: z.ZodOptional<z.ZodString>;
|
|
10
15
|
}, z.core.$strip>>;
|
|
11
16
|
enableLogging: z.ZodOptional<z.ZodBoolean>;
|
|
12
17
|
}, z.core.$strip>;
|
|
@@ -30,4 +35,5 @@ export type RaveConfig = z.infer<typeof RaveConfigSchema>;
|
|
|
30
35
|
export type EditProfileBuilder = z.infer<typeof EditProfileBuilderSchema>;
|
|
31
36
|
export type GetManyMeshesParams = z.infer<typeof GetManyMeshesSchema>;
|
|
32
37
|
export type Languages = z.infer<typeof LanguagesSchema>;
|
|
38
|
+
export type AuthenticatorMethod = z.infer<typeof AuthenticatorMethodSchema>;
|
|
33
39
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/schemas/public.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,eAAe;;;EAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/schemas/public.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,eAAe;;;EAAuB,CAAC;AACpD,eAAO,MAAM,yBAAyB;;;EAAgC,CAAC;AAEvE,eAAO,MAAM,gBAAgB;;;;;;;iBAS3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAO9B,CAAC;AAEH,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,14 +3,16 @@ 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.LanguagesSchema = void 0;
|
|
6
|
+
exports.GetManyMeshesSchema = exports.EditProfileBuilderSchema = exports.RaveConfigSchema = exports.AuthenticatorMethodSchema = exports.LanguagesSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
exports.LanguagesSchema = zod_1.default.enum(['en', 'ru']);
|
|
9
|
+
exports.AuthenticatorMethodSchema = zod_1.default.enum(['LOGIN', 'REGISTER']);
|
|
9
10
|
exports.RaveConfigSchema = zod_1.default.object({
|
|
10
11
|
credentials: zod_1.default
|
|
11
12
|
.object({
|
|
12
|
-
token: zod_1.default.string(),
|
|
13
|
-
deviceId: zod_1.default.string(),
|
|
13
|
+
token: zod_1.default.string().optional(),
|
|
14
|
+
deviceId: zod_1.default.string().optional(),
|
|
15
|
+
weMeshJWT: zod_1.default.string().optional(),
|
|
14
16
|
})
|
|
15
17
|
.optional(),
|
|
16
18
|
enableLogging: zod_1.default.boolean().optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
export declare const MeshSchema: z.ZodObject<{
|
|
3
|
-
blurT: z.ZodBoolean
|
|
3
|
+
blurT: z.ZodOptional<z.ZodBoolean>;
|
|
4
4
|
category: z.ZodString;
|
|
5
5
|
channel: z.ZodNumber;
|
|
6
6
|
createdAt: z.ZodString;
|
|
@@ -41,4 +41,5 @@ export declare const MeshSchema: z.ZodObject<{
|
|
|
41
41
|
vikiPass: z.ZodBoolean;
|
|
42
42
|
voipMode: z.ZodString;
|
|
43
43
|
}, z.core.$strip>;
|
|
44
|
+
export type Mesh = z.infer<typeof MeshSchema>;
|
|
44
45
|
//# sourceMappingURL=mesh.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MeshSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
exports.MeshSchema = zod_1.default.object({
|
|
9
|
-
blurT: zod_1.default.boolean(),
|
|
9
|
+
blurT: zod_1.default.boolean().optional(),
|
|
10
10
|
category: zod_1.default.string(),
|
|
11
11
|
channel: zod_1.default.number(),
|
|
12
12
|
createdAt: zod_1.default.string(),
|
|
@@ -10,5 +10,13 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
10
10
|
lng: z.ZodFloat32;
|
|
11
11
|
name: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
+
export declare const ProfileSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
handle: z.ZodString;
|
|
17
|
+
avatar: z.ZodString;
|
|
18
|
+
country: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
13
20
|
export type User = z.infer<typeof UserSchema>;
|
|
21
|
+
export type Profile = z.infer<typeof ProfileSchema>;
|
|
14
22
|
//# sourceMappingURL=user.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/user.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;iBAUrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/user.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;iBAUrB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;iBAKxB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ 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.UserSchema = void 0;
|
|
6
|
+
exports.ProfileSchema = exports.UserSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
exports.UserSchema = zod_1.default.object({
|
|
9
9
|
avatar: zod_1.default.string(),
|
|
@@ -16,3 +16,9 @@ exports.UserSchema = zod_1.default.object({
|
|
|
16
16
|
lng: zod_1.default.float32(),
|
|
17
17
|
name: zod_1.default.string(),
|
|
18
18
|
});
|
|
19
|
+
exports.ProfileSchema = exports.UserSchema.omit({
|
|
20
|
+
id: true,
|
|
21
|
+
lat: true,
|
|
22
|
+
lng: true,
|
|
23
|
+
lang: true,
|
|
24
|
+
});
|
|
@@ -105,7 +105,7 @@ export declare const GetAvatarUploadSchema: z.ZodObject<{
|
|
|
105
105
|
export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
106
106
|
data: z.ZodArray<z.ZodObject<{
|
|
107
107
|
mesh: z.ZodObject<{
|
|
108
|
-
blurT: z.ZodBoolean
|
|
108
|
+
blurT: z.ZodOptional<z.ZodBoolean>;
|
|
109
109
|
category: z.ZodString;
|
|
110
110
|
channel: z.ZodNumber;
|
|
111
111
|
createdAt: z.ZodString;
|
|
@@ -162,6 +162,89 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
162
162
|
next: z.ZodOptional<z.ZodString>;
|
|
163
163
|
}, z.core.$strip>>;
|
|
164
164
|
}, z.core.$strip>;
|
|
165
|
+
export declare const GetMeshSchema: z.ZodObject<{
|
|
166
|
+
data: z.ZodObject<{
|
|
167
|
+
users: z.ZodArray<z.ZodObject<{
|
|
168
|
+
avatar: z.ZodString;
|
|
169
|
+
country: z.ZodString;
|
|
170
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
171
|
+
handle: z.ZodString;
|
|
172
|
+
id: z.ZodNumber;
|
|
173
|
+
lang: z.ZodString;
|
|
174
|
+
lat: z.ZodFloat32;
|
|
175
|
+
lng: z.ZodFloat32;
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
blurT: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
category: z.ZodString;
|
|
180
|
+
channel: z.ZodNumber;
|
|
181
|
+
createdAt: z.ZodString;
|
|
182
|
+
currentState: z.ZodEnum<{
|
|
183
|
+
play: "play";
|
|
184
|
+
paus: "paus";
|
|
185
|
+
}>;
|
|
186
|
+
explicit: z.ZodBoolean;
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
isFriend: z.ZodBoolean;
|
|
189
|
+
isLocal: z.ZodBoolean;
|
|
190
|
+
isPublic: z.ZodBoolean;
|
|
191
|
+
kickMode: z.ZodString;
|
|
192
|
+
maturity: z.ZodString;
|
|
193
|
+
mediaUrl: z.ZodString;
|
|
194
|
+
originator: z.ZodNumber;
|
|
195
|
+
playMode: z.ZodString;
|
|
196
|
+
position: z.ZodFloat32;
|
|
197
|
+
server: z.ZodString;
|
|
198
|
+
shareLink: z.ZodString;
|
|
199
|
+
thumbnails: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
201
|
+
standard: z.ZodOptional<z.ZodString>;
|
|
202
|
+
animated: z.ZodOptional<z.ZodString>;
|
|
203
|
+
maxres: z.ZodOptional<z.ZodString>;
|
|
204
|
+
medium: z.ZodOptional<z.ZodString>;
|
|
205
|
+
default: z.ZodOptional<z.ZodString>;
|
|
206
|
+
high: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
time: z.ZodFloat32;
|
|
209
|
+
videoAuthor: z.ZodString;
|
|
210
|
+
videoDuration: z.ZodNumber;
|
|
211
|
+
videoProvider: z.ZodString;
|
|
212
|
+
videoPublishedAt: z.ZodString;
|
|
213
|
+
videoThumbnail: z.ZodString;
|
|
214
|
+
videoTitle: z.ZodString;
|
|
215
|
+
videoUrl: z.ZodString;
|
|
216
|
+
vikiPass: z.ZodBoolean;
|
|
217
|
+
voipMode: z.ZodString;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
export declare const GetUserSchema: z.ZodObject<{
|
|
221
|
+
data: z.ZodObject<{
|
|
222
|
+
bio: z.ZodObject<{
|
|
223
|
+
bio: z.ZodOptional<z.ZodString>;
|
|
224
|
+
metadata: z.ZodObject<{
|
|
225
|
+
position: z.ZodNumber;
|
|
226
|
+
privacy: z.ZodString;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
profile: z.ZodObject<{
|
|
230
|
+
name: z.ZodString;
|
|
231
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
232
|
+
handle: z.ZodString;
|
|
233
|
+
avatar: z.ZodString;
|
|
234
|
+
country: z.ZodString;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
}, z.core.$strip>;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
export declare const SendFriendshipSchema: z.ZodObject<{
|
|
239
|
+
data: z.ZodObject<{
|
|
240
|
+
fromUserId: z.ZodNumber;
|
|
241
|
+
state: z.ZodString;
|
|
242
|
+
toUserId: z.ZodNumber;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
}, z.core.$strip>;
|
|
245
|
+
export declare const ValidateMeSchema: z.ZodObject<{
|
|
246
|
+
data: z.ZodString;
|
|
247
|
+
}, z.core.$strip>;
|
|
165
248
|
export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
|
|
166
249
|
export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
|
|
167
250
|
export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
|
|
@@ -170,4 +253,8 @@ export type MojoLoginResponse = z.infer<typeof MojoLoginSchema>;
|
|
|
170
253
|
export type AuthenticateResponse = z.infer<typeof AuthenticateSchema>;
|
|
171
254
|
export type GetAvatarUploadResponse = z.infer<typeof GetAvatarUploadSchema>;
|
|
172
255
|
export type GetManyMeshesResponse = z.infer<typeof GetManyMeshesSchema>;
|
|
256
|
+
export type GetMeshResponse = z.infer<typeof GetMeshSchema>;
|
|
257
|
+
export type GetUserResponse = z.infer<typeof GetUserSchema>;
|
|
258
|
+
export type SendFriendshipResponse = z.infer<typeof SendFriendshipSchema>;
|
|
259
|
+
export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
|
|
173
260
|
//# 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":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;GAQ5B,CAAC;AAEL,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDjC,CAAC;AAEL,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;iBAM1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;iBAOhC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAWxB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;iBAM/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACxE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,wBAAwB,CAChC,CAAC;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,0BAA0B,CAClC,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAChE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACtE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC5E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -3,10 +3,11 @@ 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.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
|
|
6
|
+
exports.ValidateMeSchema = exports.SendFriendshipSchema = 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
|
+
const private_1 = require("./private");
|
|
10
11
|
exports.EditProfileSchema = zod_1.default.object({
|
|
11
12
|
data: user_1.UserSchema,
|
|
12
13
|
});
|
|
@@ -101,9 +102,30 @@ exports.GetManyMeshesSchema = zod_1.default.object({
|
|
|
101
102
|
mesh: mesh_1.MeshSchema,
|
|
102
103
|
users: zod_1.default.array(user_1.UserSchema),
|
|
103
104
|
})),
|
|
104
|
-
paging:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
})
|
|
108
|
-
|
|
105
|
+
paging: private_1.PagingSchema,
|
|
106
|
+
});
|
|
107
|
+
exports.GetMeshSchema = zod_1.default.object({
|
|
108
|
+
data: zod_1.default.object(Object.assign(Object.assign({}, mesh_1.MeshSchema.shape), { users: zod_1.default.array(user_1.UserSchema) })),
|
|
109
|
+
});
|
|
110
|
+
exports.GetUserSchema = zod_1.default.object({
|
|
111
|
+
data: zod_1.default.object({
|
|
112
|
+
bio: zod_1.default.object({
|
|
113
|
+
bio: zod_1.default.string().optional(),
|
|
114
|
+
metadata: zod_1.default.object({
|
|
115
|
+
position: zod_1.default.number(),
|
|
116
|
+
privacy: zod_1.default.string(),
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
profile: user_1.ProfileSchema,
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
exports.SendFriendshipSchema = zod_1.default.object({
|
|
123
|
+
data: zod_1.default.object({
|
|
124
|
+
fromUserId: zod_1.default.number(),
|
|
125
|
+
state: zod_1.default.string(),
|
|
126
|
+
toUserId: zod_1.default.number(),
|
|
127
|
+
}),
|
|
128
|
+
});
|
|
129
|
+
exports.ValidateMeSchema = zod_1.default.object({
|
|
130
|
+
data: zod_1.default.string(),
|
|
109
131
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptography.d.ts","sourceRoot":"","sources":["../../src/utils/cryptography.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAChB,MAAM,aACF,MAAM,iBACF,MAAM,WAMtB,CAAC;AAEF,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"cryptography.d.ts","sourceRoot":"","sources":["../../src/utils/cryptography.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAChB,MAAM,aACF,MAAM,iBACF,MAAM,WAMtB,CAAC;AAEF,eAAO,MAAM,aAAa,cAKzB,CAAC"}
|
|
@@ -11,11 +11,9 @@ const generateHash = (token, timestamp, contentLength) => {
|
|
|
11
11
|
};
|
|
12
12
|
exports.generateHash = generateHash;
|
|
13
13
|
const generateToken = () => {
|
|
14
|
-
return
|
|
15
|
-
.replace(/[xy]/g, (c) => {
|
|
14
|
+
return constants_1.UUID_PATTERN.replace(/[xy]/g, (c) => {
|
|
16
15
|
const r = (Math.random() * 16) | 0;
|
|
17
16
|
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
18
|
-
})
|
|
19
|
-
.replace(/-/g, '');
|
|
17
|
+
}).replace(/-/g, '');
|
|
20
18
|
};
|
|
21
19
|
exports.generateToken = generateToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,eAAO,IAAI,MAAM,EAAE,MAAM,CAAC;AAE1B,QAAA,MAAM,UAAU,kBAAmB,OAAO,KAAG,MAY5C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -5,17 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LOGGER = void 0;
|
|
7
7
|
const pino_1 = __importDefault(require("pino"));
|
|
8
|
+
const pino_pretty_1 = __importDefault(require("pino-pretty"));
|
|
8
9
|
const initLogger = (enableLogging) => {
|
|
9
10
|
if (exports.LOGGER)
|
|
10
11
|
return exports.LOGGER;
|
|
11
12
|
return (exports.LOGGER = (0, pino_1.default)({
|
|
12
13
|
enabled: enableLogging,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}));
|
|
14
|
+
}, (0, pino_pretty_1.default)({
|
|
15
|
+
colorize: true,
|
|
16
|
+
sync: true,
|
|
17
|
+
})));
|
|
20
18
|
};
|
|
21
19
|
exports.default = initLogger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ravejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"pino": "^10.1.0",
|
|
46
46
|
"pino-pretty": "^13.1.3",
|
|
47
|
-
"uuid": "^13.0.0",
|
|
48
47
|
"zod": "^4.1.13"
|
|
49
48
|
}
|
|
50
49
|
}
|