ravejs 1.4.2 → 1.6.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 +6 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -4
- package/dist/core/httpworkflow.d.ts +5 -0
- package/dist/core/httpworkflow.d.ts.map +1 -1
- package/dist/core/httpworkflow.js +30 -10
- package/dist/core/rave.d.ts +7 -0
- package/dist/core/rave.d.ts.map +1 -1
- package/dist/core/rave.js +34 -1
- package/dist/factories/auth-factory.js +1 -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/thread-factory.d.ts +8 -0
- package/dist/factories/thread-factory.d.ts.map +1 -0
- package/dist/factories/thread-factory.js +15 -0
- package/dist/factories/user-factory.d.ts +6 -1
- package/dist/factories/user-factory.d.ts.map +1 -1
- package/dist/factories/user-factory.js +21 -2
- package/dist/schemas/configs.d.ts +4 -0
- package/dist/schemas/configs.d.ts.map +1 -1
- package/dist/schemas/configs.js +2 -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 +4 -3
- package/dist/schemas/rave/mesh.d.ts.map +1 -1
- package/dist/schemas/rave/mesh.js +3 -3
- package/dist/schemas/rave/thread.d.ts +11 -0
- package/dist/schemas/rave/thread.d.ts.map +1 -0
- package/dist/schemas/rave/thread.js +15 -0
- package/dist/schemas/rave/user.d.ts +11 -3
- package/dist/schemas/rave/user.d.ts.map +1 -1
- package/dist/schemas/rave/user.js +10 -4
- package/dist/schemas/responses.d.ts +107 -9
- package/dist/schemas/responses.d.ts.map +1 -1
- package/dist/schemas/responses.js +32 -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/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +6 -1
- 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.6.3";
|
|
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.6.3';
|
|
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,11 @@ 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;
|
|
7
|
+
get weMeshToken(): string;
|
|
6
8
|
set token(token: string);
|
|
9
|
+
set weMeshToken(token: string);
|
|
7
10
|
set popHeaders(key: string);
|
|
8
11
|
private __configureHeaders;
|
|
9
12
|
private __handleResponse;
|
|
@@ -11,6 +14,8 @@ export declare class HttpWorkflow {
|
|
|
11
14
|
sendGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
12
15
|
sendPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
13
16
|
sendPut: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
17
|
+
sendWeMeshGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
18
|
+
sendWeMeshPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
14
19
|
sendRaw: <T>(config: RawRequestConfig, schema: z.ZodSchema) => Promise<T>;
|
|
15
20
|
}
|
|
16
21
|
//# 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,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,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,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,CAQX;CACH"}
|
|
@@ -9,10 +9,11 @@ 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.
|
|
13
|
-
this.
|
|
12
|
+
this.__headers = Object.assign({}, constants_1.API_HEADERS);
|
|
13
|
+
this.__weMeshHeaders = Object.assign({}, constants_1.API_HEADERS);
|
|
14
|
+
this.__configureHeaders = (data, headers) => {
|
|
14
15
|
const timestamp = Date.now().toString();
|
|
15
|
-
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) });
|
|
16
|
+
return Object.assign(Object.assign({}, (headers || this.__headers)), { 'request-ts': timestamp, 'request-hash': (0, cryptography_1.generateHash)(this.token, timestamp, (data === null || data === void 0 ? void 0 : data.length) || 0) });
|
|
16
17
|
};
|
|
17
18
|
this.__handleResponse = async (statusCode, fullPath, body, schema) => {
|
|
18
19
|
if (!(0, utils_1.isOk)(statusCode)) {
|
|
@@ -21,22 +22,29 @@ class HttpWorkflow {
|
|
|
21
22
|
}
|
|
22
23
|
const response = await body.text();
|
|
23
24
|
logger_1.LOGGER.child({ path: fullPath }).info(statusCode);
|
|
24
|
-
|
|
25
|
+
try {
|
|
26
|
+
return schema.parse(JSON.parse(response));
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
25
31
|
};
|
|
26
32
|
this.__sendDataRequest = async (method, config, schema) => {
|
|
27
|
-
const
|
|
33
|
+
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
34
|
+
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
28
35
|
method,
|
|
29
|
-
headers: this.__configureHeaders(config.body),
|
|
36
|
+
headers: this.__configureHeaders(config.body, config.headers),
|
|
30
37
|
body: config.body,
|
|
31
38
|
});
|
|
32
|
-
return await this.__handleResponse(statusCode, `${
|
|
39
|
+
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
33
40
|
};
|
|
34
41
|
this.sendGet = async (config, schema) => {
|
|
35
|
-
const
|
|
42
|
+
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
43
|
+
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
36
44
|
method: 'GET',
|
|
37
|
-
headers: this.__configureHeaders(),
|
|
45
|
+
headers: this.__configureHeaders(undefined, config.headers),
|
|
38
46
|
});
|
|
39
|
-
return await this.__handleResponse(statusCode, `${
|
|
47
|
+
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
40
48
|
};
|
|
41
49
|
this.sendPost = async (config, schema) => {
|
|
42
50
|
return await this.__sendDataRequest('POST', config, schema);
|
|
@@ -44,6 +52,12 @@ class HttpWorkflow {
|
|
|
44
52
|
this.sendPut = async (config, schema) => {
|
|
45
53
|
return await this.__sendDataRequest('PUT', config, schema);
|
|
46
54
|
};
|
|
55
|
+
this.sendWeMeshGet = async (config, schema) => {
|
|
56
|
+
return await this.sendGet(Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL, headers: this.__weMeshHeaders }), schema);
|
|
57
|
+
};
|
|
58
|
+
this.sendWeMeshPost = async (config, schema) => {
|
|
59
|
+
return await this.__sendDataRequest('POST', Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL, headers: this.__weMeshHeaders }), schema);
|
|
60
|
+
};
|
|
47
61
|
this.sendRaw = async (config, schema) => {
|
|
48
62
|
const { statusCode, body } = await (0, undici_1.request)(config.path, {
|
|
49
63
|
headers: config.headers,
|
|
@@ -56,9 +70,15 @@ class HttpWorkflow {
|
|
|
56
70
|
get token() {
|
|
57
71
|
return this.__headers.Authorization.slice(7, this.__headers.Authorization.length);
|
|
58
72
|
}
|
|
73
|
+
get weMeshToken() {
|
|
74
|
+
return this.__weMeshHeaders.Authorization.slice(7, this.__weMeshHeaders.Authorization.length);
|
|
75
|
+
}
|
|
59
76
|
set token(token) {
|
|
60
77
|
this.__headers.Authorization = `Bearer ${token}`;
|
|
61
78
|
}
|
|
79
|
+
set weMeshToken(token) {
|
|
80
|
+
this.__weMeshHeaders.Authorization = `Bearer ${token}`;
|
|
81
|
+
}
|
|
62
82
|
set popHeaders(key) {
|
|
63
83
|
delete this.__headers[key];
|
|
64
84
|
}
|
package/dist/core/rave.d.ts
CHANGED
|
@@ -2,15 +2,22 @@ import { AuthFactory } from '../factories/auth-factory';
|
|
|
2
2
|
import { MeshFactory } from '../factories/mesh-factory';
|
|
3
3
|
import { UserFactory } from '../factories/user-factory';
|
|
4
4
|
import { RaveConfig } from '../schemas/public';
|
|
5
|
+
import { ThreadFactory } from '../factories/thread-factory';
|
|
5
6
|
export declare class Rave {
|
|
6
7
|
private __config?;
|
|
7
8
|
private __http;
|
|
8
9
|
private __authFactory?;
|
|
9
10
|
private __userFactory?;
|
|
10
11
|
private __meshFactory?;
|
|
12
|
+
private __threadFactory?;
|
|
11
13
|
constructor(config?: RaveConfig);
|
|
14
|
+
get token(): string;
|
|
15
|
+
get JWT(): string;
|
|
12
16
|
get auth(): AuthFactory;
|
|
13
17
|
get user(): UserFactory;
|
|
14
18
|
get mesh(): MeshFactory;
|
|
19
|
+
get thread(): ThreadFactory;
|
|
20
|
+
refreshJWT: (deviceId?: string) => Promise<string>;
|
|
21
|
+
getMeshByLink: (meshLink: string) => Promise<string>;
|
|
15
22
|
}
|
|
16
23
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"AAEA,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;AAK/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,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;IAWnC,IAAI,KAAK,WAER;IAED,IAAI,GAAG,WAEN;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,MAAM,kBAIT;IAEM,UAAU,cAAqB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAU5D;IAEK,aAAa,aAAoB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAU9D;CACH"}
|
package/dist/core/rave.js
CHANGED
|
@@ -4,19 +4,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Rave = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
7
8
|
const auth_factory_1 = require("../factories/auth-factory");
|
|
8
9
|
const mesh_factory_1 = require("../factories/mesh-factory");
|
|
9
10
|
const user_factory_1 = require("../factories/user-factory");
|
|
10
11
|
const logger_1 = __importDefault(require("../utils/logger"));
|
|
11
12
|
const httpworkflow_1 = require("./httpworkflow");
|
|
13
|
+
const utils_1 = require("../utils/utils");
|
|
14
|
+
const responses_1 = require("../schemas/responses");
|
|
15
|
+
const thread_factory_1 = require("../factories/thread-factory");
|
|
12
16
|
class Rave {
|
|
13
17
|
constructor(config = {}) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
this.refreshJWT = async (deviceId) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const { data } = await this.__http.sendGet({
|
|
22
|
+
path: `/users/self/validateMe?deviceId=${deviceId || ((_b = (_a = this.__config) === null || _a === void 0 ? void 0 : _a.credentials) === null || _b === void 0 ? void 0 : _b.deviceId)}`,
|
|
23
|
+
}, responses_1.ValidateMeSchema);
|
|
24
|
+
this.__http.weMeshToken = data;
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
this.getMeshByLink = async (meshLink) => {
|
|
28
|
+
return (0, utils_1.matchMeshId)(await this.__http.sendRaw({
|
|
29
|
+
method: 'GET',
|
|
30
|
+
path: meshLink,
|
|
31
|
+
}, zod_1.default.string()));
|
|
32
|
+
};
|
|
14
33
|
this.__config = config;
|
|
15
34
|
this.__http = new httpworkflow_1.HttpWorkflow();
|
|
16
|
-
if (this.__config.credentials)
|
|
35
|
+
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token) {
|
|
17
36
|
this.__http.token = this.__config.credentials.token;
|
|
37
|
+
if ((_b = this.__config.credentials) === null || _b === void 0 ? void 0 : _b.autoJWT)
|
|
38
|
+
this.refreshJWT();
|
|
39
|
+
}
|
|
18
40
|
(0, logger_1.default)(!!config.enableLogging);
|
|
19
41
|
}
|
|
42
|
+
get token() {
|
|
43
|
+
return this.__http.token;
|
|
44
|
+
}
|
|
45
|
+
get JWT() {
|
|
46
|
+
return this.__http.weMeshToken;
|
|
47
|
+
}
|
|
20
48
|
get auth() {
|
|
21
49
|
if (!this.__authFactory)
|
|
22
50
|
return (this.__authFactory = new auth_factory_1.AuthFactory(this.__config, this.__http));
|
|
@@ -32,5 +60,10 @@ class Rave {
|
|
|
32
60
|
return (this.__meshFactory = new mesh_factory_1.MeshFactory(this.__config, this.__http));
|
|
33
61
|
return this.__meshFactory;
|
|
34
62
|
}
|
|
63
|
+
get thread() {
|
|
64
|
+
if (!this.__threadFactory)
|
|
65
|
+
return (this.__threadFactory = new thread_factory_1.ThreadFactory(this.__http));
|
|
66
|
+
return this.__threadFactory;
|
|
67
|
+
}
|
|
35
68
|
}
|
|
36
69
|
exports.Rave = Rave;
|
|
@@ -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: {
|
|
@@ -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}`,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
|
+
import { Thread } from '../schemas/rave/thread';
|
|
3
|
+
export declare class ThreadFactory {
|
|
4
|
+
private readonly __http;
|
|
5
|
+
constructor(http: HttpWorkflow);
|
|
6
|
+
getMany: () => Promise<Thread[]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=thread-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-factory.d.ts","sourceRoot":"","sources":["../../src/factories/thread-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,OAAO,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAS1C;CACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThreadFactory = void 0;
|
|
4
|
+
const responses_1 = require("../schemas/responses");
|
|
5
|
+
class ThreadFactory {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.getMany = async () => {
|
|
8
|
+
return (await this.__http.sendWeMeshGet({
|
|
9
|
+
path: '/dms',
|
|
10
|
+
}, responses_1.GetThreadsSchema)).data;
|
|
11
|
+
};
|
|
12
|
+
this.__http = http;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ThreadFactory = ThreadFactory;
|
|
@@ -1,9 +1,14 @@
|
|
|
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, FriendshipResponse } from '../schemas/responses';
|
|
4
4
|
export declare class UserFactory {
|
|
5
5
|
private readonly __http;
|
|
6
6
|
constructor(http: HttpWorkflow);
|
|
7
|
+
private __friendshipRequests;
|
|
8
|
+
get: (userId: number) => Promise<GetUserResponse>;
|
|
9
|
+
sendFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
10
|
+
acceptFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
11
|
+
declineFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
7
12
|
edit: (builder: EditProfileBuilder) => Promise<EditProfileResponse>;
|
|
8
13
|
getAvatarUpload: () => Promise<GetAvatarUploadResponse>;
|
|
9
14
|
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,
|
|
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,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,EAEvB,eAAe,EAEf,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAI9B,OAAO,CAAC,oBAAoB,CAU1B;IAEK,GAAG,WAAkB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAO3D;IAEK,cAAc,WACX,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC,CAE5B;IAEK,gBAAgB,WACb,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC,CAI5B;IAEK,iBAAiB,WACd,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC,CAI5B;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"}
|
|
@@ -5,15 +5,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.UserFactory = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
|
-
const schemas_1 = require("../schemas");
|
|
9
8
|
const responses_1 = require("../schemas/responses");
|
|
10
9
|
class UserFactory {
|
|
11
10
|
constructor(http) {
|
|
11
|
+
this.__friendshipRequests = async (body) => {
|
|
12
|
+
return await this.__http.sendPost({
|
|
13
|
+
path: `/friendships`,
|
|
14
|
+
body,
|
|
15
|
+
}, responses_1.FriendshipSchema);
|
|
16
|
+
};
|
|
17
|
+
this.get = async (userId) => {
|
|
18
|
+
return await this.__http.sendGet({
|
|
19
|
+
path: `/profiles/${userId}?exclude=false&clientVersion=1`,
|
|
20
|
+
}, responses_1.GetUserSchema);
|
|
21
|
+
};
|
|
22
|
+
this.sendFriendship = async (userId) => {
|
|
23
|
+
return await this.__friendshipRequests(JSON.stringify({ id: userId }));
|
|
24
|
+
};
|
|
25
|
+
this.acceptFriendship = async (userId) => {
|
|
26
|
+
return await this.__friendshipRequests(JSON.stringify({ id: userId, state: 'friends' }));
|
|
27
|
+
};
|
|
28
|
+
this.declineFriendship = async (userId) => {
|
|
29
|
+
return await this.__friendshipRequests(JSON.stringify({ id: userId, state: 'notfriends' }));
|
|
30
|
+
};
|
|
12
31
|
this.edit = async (builder) => {
|
|
13
32
|
return await this.__http.sendPut({
|
|
14
33
|
path: '/users/self',
|
|
15
34
|
body: JSON.stringify(builder),
|
|
16
|
-
},
|
|
35
|
+
}, responses_1.EditProfileSchema);
|
|
17
36
|
};
|
|
18
37
|
this.getAvatarUpload = async () => {
|
|
19
38
|
return await this.__http.sendPost({
|
|
@@ -1,12 +1,16 @@
|
|
|
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>;
|
|
7
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
8
|
}, z.core.$strip>;
|
|
7
9
|
export declare const GetRequestConfigSchema: z.ZodObject<{
|
|
8
10
|
path: z.ZodReadonly<z.ZodString>;
|
|
11
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
9
12
|
contentType: z.ZodOptional<z.ZodString>;
|
|
13
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
10
14
|
}, z.core.$strip>;
|
|
11
15
|
export declare const RawRequestConfigSchema: z.ZodObject<{
|
|
12
16
|
method: z.ZodString;
|
|
@@ -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;;;;;;iBAMlC,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,8 +4,10 @@ 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(),
|
|
10
|
+
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
9
11
|
});
|
|
10
12
|
exports.GetRequestConfigSchema = exports.PostRequestConfigSchema.omit({
|
|
11
13
|
body: true,
|
|
@@ -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
|
+
autoJWT: z.ZodOptional<z.ZodBoolean>;
|
|
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
|
+
autoJWT: zod_1.default.boolean().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;
|
|
@@ -18,7 +18,7 @@ export declare const MeshSchema: z.ZodObject<{
|
|
|
18
18
|
mediaUrl: z.ZodString;
|
|
19
19
|
originator: z.ZodNumber;
|
|
20
20
|
playMode: z.ZodString;
|
|
21
|
-
position: z.
|
|
21
|
+
position: z.ZodNumber;
|
|
22
22
|
server: z.ZodString;
|
|
23
23
|
shareLink: z.ZodString;
|
|
24
24
|
thumbnails: z.ZodOptional<z.ZodObject<{
|
|
@@ -30,7 +30,7 @@ export declare const MeshSchema: z.ZodObject<{
|
|
|
30
30
|
default: z.ZodOptional<z.ZodString>;
|
|
31
31
|
high: z.ZodOptional<z.ZodString>;
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
|
-
time: z.
|
|
33
|
+
time: z.ZodNumber;
|
|
34
34
|
videoAuthor: z.ZodString;
|
|
35
35
|
videoDuration: z.ZodNumber;
|
|
36
36
|
videoProvider: 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(),
|
|
@@ -21,7 +21,7 @@ exports.MeshSchema = zod_1.default.object({
|
|
|
21
21
|
mediaUrl: zod_1.default.string(),
|
|
22
22
|
originator: zod_1.default.number(),
|
|
23
23
|
playMode: zod_1.default.string(),
|
|
24
|
-
position: zod_1.default.
|
|
24
|
+
position: zod_1.default.number(),
|
|
25
25
|
server: zod_1.default.string(),
|
|
26
26
|
shareLink: zod_1.default.string(),
|
|
27
27
|
thumbnails: zod_1.default
|
|
@@ -35,7 +35,7 @@ exports.MeshSchema = zod_1.default.object({
|
|
|
35
35
|
high: zod_1.default.string().optional(),
|
|
36
36
|
})
|
|
37
37
|
.optional(),
|
|
38
|
-
time: zod_1.default.
|
|
38
|
+
time: zod_1.default.number(),
|
|
39
39
|
videoAuthor: zod_1.default.string(),
|
|
40
40
|
videoDuration: zod_1.default.number(),
|
|
41
41
|
videoProvider: zod_1.default.string(),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const ThreadSchema: z.ZodObject<{
|
|
3
|
+
expiryMode: z.ZodNumber;
|
|
4
|
+
isFriend: z.ZodBoolean;
|
|
5
|
+
myself: z.ZodNumber;
|
|
6
|
+
opposingUser: z.ZodNumber;
|
|
7
|
+
spokenLangs: z.ZodArray<z.ZodString>;
|
|
8
|
+
threadId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type Thread = z.infer<typeof ThreadSchema>;
|
|
11
|
+
//# sourceMappingURL=thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/thread.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,YAAY;;;;;;;iBAOvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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.ThreadSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.ThreadSchema = zod_1.default.object({
|
|
9
|
+
expiryMode: zod_1.default.number(),
|
|
10
|
+
isFriend: zod_1.default.boolean(),
|
|
11
|
+
myself: zod_1.default.number(),
|
|
12
|
+
opposingUser: zod_1.default.number(),
|
|
13
|
+
spokenLangs: zod_1.default.array(zod_1.default.string()),
|
|
14
|
+
threadId: zod_1.default.string(),
|
|
15
|
+
});
|
|
@@ -3,12 +3,20 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
3
3
|
avatar: z.ZodString;
|
|
4
4
|
country: z.ZodString;
|
|
5
5
|
displayName: z.ZodOptional<z.ZodString>;
|
|
6
|
-
handle: z.ZodString
|
|
6
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
7
7
|
id: z.ZodNumber;
|
|
8
8
|
lang: z.ZodString;
|
|
9
|
-
lat: z.
|
|
10
|
-
lng: z.
|
|
9
|
+
lat: z.ZodNumber;
|
|
10
|
+
lng: z.ZodNumber;
|
|
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.ZodOptional<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,16 +3,22 @@ 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(),
|
|
10
10
|
country: zod_1.default.string(),
|
|
11
11
|
displayName: zod_1.default.string().optional(),
|
|
12
|
-
handle: zod_1.default.string(),
|
|
12
|
+
handle: zod_1.default.string().optional(),
|
|
13
13
|
id: zod_1.default.number(),
|
|
14
14
|
lang: zod_1.default.string(),
|
|
15
|
-
lat: zod_1.default.
|
|
16
|
-
lng: zod_1.default.
|
|
15
|
+
lat: zod_1.default.number(),
|
|
16
|
+
lng: zod_1.default.number(),
|
|
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
|
+
});
|
|
@@ -4,11 +4,11 @@ export declare const EditProfileSchema: z.ZodObject<{
|
|
|
4
4
|
avatar: z.ZodString;
|
|
5
5
|
country: z.ZodString;
|
|
6
6
|
displayName: z.ZodOptional<z.ZodString>;
|
|
7
|
-
handle: z.ZodString
|
|
7
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
8
8
|
id: z.ZodNumber;
|
|
9
9
|
lang: z.ZodString;
|
|
10
|
-
lat: z.
|
|
11
|
-
lng: z.
|
|
10
|
+
lat: z.ZodNumber;
|
|
11
|
+
lng: z.ZodNumber;
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
}, z.core.$strip>;
|
|
@@ -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;
|
|
@@ -123,7 +123,7 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
123
123
|
mediaUrl: z.ZodString;
|
|
124
124
|
originator: z.ZodNumber;
|
|
125
125
|
playMode: z.ZodString;
|
|
126
|
-
position: z.
|
|
126
|
+
position: z.ZodNumber;
|
|
127
127
|
server: z.ZodString;
|
|
128
128
|
shareLink: z.ZodString;
|
|
129
129
|
thumbnails: z.ZodOptional<z.ZodObject<{
|
|
@@ -135,7 +135,7 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
135
135
|
default: z.ZodOptional<z.ZodString>;
|
|
136
136
|
high: z.ZodOptional<z.ZodString>;
|
|
137
137
|
}, z.core.$strip>>;
|
|
138
|
-
time: z.
|
|
138
|
+
time: z.ZodNumber;
|
|
139
139
|
videoAuthor: z.ZodString;
|
|
140
140
|
videoDuration: z.ZodNumber;
|
|
141
141
|
videoProvider: z.ZodString;
|
|
@@ -150,11 +150,11 @@ export declare const GetManyMeshesSchema: z.ZodObject<{
|
|
|
150
150
|
avatar: z.ZodString;
|
|
151
151
|
country: z.ZodString;
|
|
152
152
|
displayName: z.ZodOptional<z.ZodString>;
|
|
153
|
-
handle: z.ZodString
|
|
153
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
154
154
|
id: z.ZodNumber;
|
|
155
155
|
lang: z.ZodString;
|
|
156
|
-
lat: z.
|
|
157
|
-
lng: z.
|
|
156
|
+
lat: z.ZodNumber;
|
|
157
|
+
lng: z.ZodNumber;
|
|
158
158
|
name: z.ZodString;
|
|
159
159
|
}, z.core.$strip>>;
|
|
160
160
|
}, z.core.$strip>>;
|
|
@@ -162,6 +162,99 @@ 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.ZodOptional<z.ZodString>;
|
|
172
|
+
id: z.ZodNumber;
|
|
173
|
+
lang: z.ZodString;
|
|
174
|
+
lat: z.ZodNumber;
|
|
175
|
+
lng: z.ZodNumber;
|
|
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.ZodNumber;
|
|
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.ZodNumber;
|
|
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.ZodOptional<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 FriendshipSchema: 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>;
|
|
248
|
+
export declare const GetThreadsSchema: z.ZodObject<{
|
|
249
|
+
data: z.ZodArray<z.ZodObject<{
|
|
250
|
+
expiryMode: z.ZodNumber;
|
|
251
|
+
isFriend: z.ZodBoolean;
|
|
252
|
+
myself: z.ZodNumber;
|
|
253
|
+
opposingUser: z.ZodNumber;
|
|
254
|
+
spokenLangs: z.ZodArray<z.ZodString>;
|
|
255
|
+
threadId: z.ZodString;
|
|
256
|
+
}, z.core.$strip>>;
|
|
257
|
+
}, z.core.$strip>;
|
|
165
258
|
export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
|
|
166
259
|
export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
|
|
167
260
|
export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
|
|
@@ -170,4 +263,9 @@ export type MojoLoginResponse = z.infer<typeof MojoLoginSchema>;
|
|
|
170
263
|
export type AuthenticateResponse = z.infer<typeof AuthenticateSchema>;
|
|
171
264
|
export type GetAvatarUploadResponse = z.infer<typeof GetAvatarUploadSchema>;
|
|
172
265
|
export type GetManyMeshesResponse = z.infer<typeof GetManyMeshesSchema>;
|
|
266
|
+
export type GetMeshResponse = z.infer<typeof GetMeshSchema>;
|
|
267
|
+
export type GetUserResponse = z.infer<typeof GetUserSchema>;
|
|
268
|
+
export type FriendshipResponse = z.infer<typeof FriendshipSchema>;
|
|
269
|
+
export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
|
|
270
|
+
export type GetThreadsResponse = z.infer<typeof GetThreadsSchema>;
|
|
173
271
|
//# 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;AAOpB,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,gBAAgB;;;;;;iBAM3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,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,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -3,10 +3,12 @@ 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.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
|
+
const private_1 = require("./private");
|
|
11
|
+
const thread_1 = require("./rave/thread");
|
|
10
12
|
exports.EditProfileSchema = zod_1.default.object({
|
|
11
13
|
data: user_1.UserSchema,
|
|
12
14
|
});
|
|
@@ -101,9 +103,33 @@ exports.GetManyMeshesSchema = zod_1.default.object({
|
|
|
101
103
|
mesh: mesh_1.MeshSchema,
|
|
102
104
|
users: zod_1.default.array(user_1.UserSchema),
|
|
103
105
|
})),
|
|
104
|
-
paging:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
})
|
|
108
|
-
|
|
106
|
+
paging: private_1.PagingSchema,
|
|
107
|
+
});
|
|
108
|
+
exports.GetMeshSchema = zod_1.default.object({
|
|
109
|
+
data: zod_1.default.object(Object.assign(Object.assign({}, mesh_1.MeshSchema.shape), { users: zod_1.default.array(user_1.UserSchema) })),
|
|
110
|
+
});
|
|
111
|
+
exports.GetUserSchema = zod_1.default.object({
|
|
112
|
+
data: zod_1.default.object({
|
|
113
|
+
bio: zod_1.default.object({
|
|
114
|
+
bio: zod_1.default.string().optional(),
|
|
115
|
+
metadata: zod_1.default.object({
|
|
116
|
+
position: zod_1.default.number(),
|
|
117
|
+
privacy: zod_1.default.string(),
|
|
118
|
+
}),
|
|
119
|
+
}),
|
|
120
|
+
profile: user_1.ProfileSchema,
|
|
121
|
+
}),
|
|
122
|
+
});
|
|
123
|
+
exports.FriendshipSchema = zod_1.default.object({
|
|
124
|
+
data: zod_1.default.object({
|
|
125
|
+
fromUserId: zod_1.default.number(),
|
|
126
|
+
state: zod_1.default.string(),
|
|
127
|
+
toUserId: zod_1.default.number(),
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
exports.ValidateMeSchema = zod_1.default.object({
|
|
131
|
+
data: zod_1.default.string(),
|
|
132
|
+
});
|
|
133
|
+
exports.GetThreadsSchema = zod_1.default.object({
|
|
134
|
+
data: zod_1.default.array(thread_1.ThreadSchema),
|
|
109
135
|
});
|
|
@@ -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/dist/utils/utils.d.ts
CHANGED
|
@@ -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"}
|
|
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"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOk = void 0;
|
|
3
|
+
exports.matchMeshId = exports.isOk = void 0;
|
|
4
4
|
const isOk = (status) => status >= 200 && status < 300;
|
|
5
5
|
exports.isOk = isOk;
|
|
6
|
+
const matchMeshId = (text) => {
|
|
7
|
+
var _a;
|
|
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
|
+
};
|
|
10
|
+
exports.matchMeshId = matchMeshId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ravejs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.3",
|
|
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
|
}
|