ravejs 1.5.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 +1 -1
- package/dist/constants.js +1 -1
- package/dist/core/httpworkflow.d.ts +1 -0
- package/dist/core/httpworkflow.d.ts.map +1 -1
- package/dist/core/httpworkflow.js +17 -9
- package/dist/core/rave.d.ts +7 -0
- package/dist/core/rave.d.ts.map +1 -1
- package/dist/core/rave.js +34 -2
- package/dist/factories/auth-factory.d.ts +0 -1
- package/dist/factories/auth-factory.d.ts.map +1 -1
- package/dist/factories/auth-factory.js +0 -9
- 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 +5 -2
- package/dist/factories/user-factory.d.ts.map +1 -1
- package/dist/factories/user-factory.js +14 -6
- 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/public.d.ts +1 -1
- package/dist/schemas/public.js +1 -1
- package/dist/schemas/rave/mesh.d.ts +2 -2
- package/dist/schemas/rave/mesh.js +2 -2
- 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 +4 -4
- package/dist/schemas/rave/user.js +3 -3
- package/dist/schemas/responses.d.ts +27 -16
- package/dist/schemas/responses.d.ts.map +1 -1
- package/dist/schemas/responses.js +6 -2
- 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 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIErrorData } from './schemas/error';
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.6.3";
|
|
3
3
|
export declare const API_URL = "https://api1.a-l-p-a.com";
|
|
4
4
|
export declare const PARSE_API_URL = "https://api3.a-l-p-a.com";
|
|
5
5
|
export declare const EVENTS_API_URL = "https://api2.a-l-p-a.com/api";
|
package/dist/constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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
7
|
exports.PARSE_API_URL = 'https://api3.a-l-p-a.com';
|
|
8
8
|
exports.EVENTS_API_URL = 'https://api2.a-l-p-a.com/api';
|
|
@@ -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,11 +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.API_HEADERS;
|
|
13
|
-
this.__weMeshHeaders = constants_1.API_HEADERS;
|
|
14
|
-
this.__configureHeaders = (data) => {
|
|
12
|
+
this.__headers = Object.assign({}, constants_1.API_HEADERS);
|
|
13
|
+
this.__weMeshHeaders = Object.assign({}, constants_1.API_HEADERS);
|
|
14
|
+
this.__configureHeaders = (data, headers) => {
|
|
15
15
|
const timestamp = Date.now().toString();
|
|
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) });
|
|
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) });
|
|
17
17
|
};
|
|
18
18
|
this.__handleResponse = async (statusCode, fullPath, body, schema) => {
|
|
19
19
|
if (!(0, utils_1.isOk)(statusCode)) {
|
|
@@ -22,13 +22,18 @@ class HttpWorkflow {
|
|
|
22
22
|
}
|
|
23
23
|
const response = await body.text();
|
|
24
24
|
logger_1.LOGGER.child({ path: fullPath }).info(statusCode);
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
return schema.parse(JSON.parse(response));
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
26
31
|
};
|
|
27
32
|
this.__sendDataRequest = async (method, config, schema) => {
|
|
28
33
|
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
29
34
|
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
30
35
|
method,
|
|
31
|
-
headers: this.__configureHeaders(config.body),
|
|
36
|
+
headers: this.__configureHeaders(config.body, config.headers),
|
|
32
37
|
body: config.body,
|
|
33
38
|
});
|
|
34
39
|
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
@@ -37,7 +42,7 @@ class HttpWorkflow {
|
|
|
37
42
|
const baseUrl = config.baseUrl || constants_1.API_URL;
|
|
38
43
|
const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
|
|
39
44
|
method: 'GET',
|
|
40
|
-
headers: this.__configureHeaders(),
|
|
45
|
+
headers: this.__configureHeaders(undefined, config.headers),
|
|
41
46
|
});
|
|
42
47
|
return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
|
|
43
48
|
};
|
|
@@ -48,10 +53,10 @@ class HttpWorkflow {
|
|
|
48
53
|
return await this.__sendDataRequest('PUT', config, schema);
|
|
49
54
|
};
|
|
50
55
|
this.sendWeMeshGet = async (config, schema) => {
|
|
51
|
-
return await this.sendGet(Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
|
|
56
|
+
return await this.sendGet(Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL, headers: this.__weMeshHeaders }), schema);
|
|
52
57
|
};
|
|
53
58
|
this.sendWeMeshPost = async (config, schema) => {
|
|
54
|
-
return await this.__sendDataRequest('POST', Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
|
|
59
|
+
return await this.__sendDataRequest('POST', Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL, headers: this.__weMeshHeaders }), schema);
|
|
55
60
|
};
|
|
56
61
|
this.sendRaw = async (config, schema) => {
|
|
57
62
|
const { statusCode, body } = await (0, undici_1.request)(config.path, {
|
|
@@ -65,6 +70,9 @@ class HttpWorkflow {
|
|
|
65
70
|
get token() {
|
|
66
71
|
return this.__headers.Authorization.slice(7, this.__headers.Authorization.length);
|
|
67
72
|
}
|
|
73
|
+
get weMeshToken() {
|
|
74
|
+
return this.__weMeshHeaders.Authorization.slice(7, this.__weMeshHeaders.Authorization.length);
|
|
75
|
+
}
|
|
68
76
|
set token(token) {
|
|
69
77
|
this.__headers.Authorization = `Bearer ${token}`;
|
|
70
78
|
}
|
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,20 +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 = {}) {
|
|
14
|
-
var _a;
|
|
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
|
+
};
|
|
15
33
|
this.__config = config;
|
|
16
34
|
this.__http = new httpworkflow_1.HttpWorkflow();
|
|
17
|
-
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token)
|
|
35
|
+
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token) {
|
|
18
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
|
+
}
|
|
19
40
|
(0, logger_1.default)(!!config.enableLogging);
|
|
20
41
|
}
|
|
42
|
+
get token() {
|
|
43
|
+
return this.__http.token;
|
|
44
|
+
}
|
|
45
|
+
get JWT() {
|
|
46
|
+
return this.__http.weMeshToken;
|
|
47
|
+
}
|
|
21
48
|
get auth() {
|
|
22
49
|
if (!this.__authFactory)
|
|
23
50
|
return (this.__authFactory = new auth_factory_1.AuthFactory(this.__config, this.__http));
|
|
@@ -33,5 +60,10 @@ class Rave {
|
|
|
33
60
|
return (this.__meshFactory = new mesh_factory_1.MeshFactory(this.__config, this.__http));
|
|
34
61
|
return this.__meshFactory;
|
|
35
62
|
}
|
|
63
|
+
get thread() {
|
|
64
|
+
if (!this.__threadFactory)
|
|
65
|
+
return (this.__threadFactory = new thread_factory_1.ThreadFactory(this.__http));
|
|
66
|
+
return this.__threadFactory;
|
|
67
|
+
}
|
|
36
68
|
}
|
|
37
69
|
exports.Rave = Rave;
|
|
@@ -12,6 +12,5 @@ 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>;
|
|
16
15
|
}
|
|
17
16
|
//# 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,EAEtB,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;CACH"}
|
|
@@ -80,15 +80,6 @@ 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
|
-
};
|
|
92
83
|
this.__config = config;
|
|
93
84
|
this.__http = http;
|
|
94
85
|
}
|
|
@@ -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,11 +1,14 @@
|
|
|
1
1
|
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
2
|
import { EditProfileBuilder } from '../schemas';
|
|
3
|
-
import { EditProfileResponse, GetAvatarUploadResponse, GetUserResponse,
|
|
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;
|
|
7
8
|
get: (userId: number) => Promise<GetUserResponse>;
|
|
8
|
-
sendFriendship: (userId: number) => Promise<
|
|
9
|
+
sendFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
10
|
+
acceptFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
11
|
+
declineFriendship: (userId: number) => Promise<FriendshipResponse>;
|
|
9
12
|
edit: (builder: EditProfileBuilder) => Promise<EditProfileResponse>;
|
|
10
13
|
getAvatarUpload: () => Promise<GetAvatarUploadResponse>;
|
|
11
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,26 +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
|
+
};
|
|
12
17
|
this.get = async (userId) => {
|
|
13
18
|
return await this.__http.sendGet({
|
|
14
19
|
path: `/profiles/${userId}?exclude=false&clientVersion=1`,
|
|
15
20
|
}, responses_1.GetUserSchema);
|
|
16
21
|
};
|
|
17
22
|
this.sendFriendship = async (userId) => {
|
|
18
|
-
return await this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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' }));
|
|
22
30
|
};
|
|
23
31
|
this.edit = async (builder) => {
|
|
24
32
|
return await this.__http.sendPut({
|
|
25
33
|
path: '/users/self',
|
|
26
34
|
body: JSON.stringify(builder),
|
|
27
|
-
},
|
|
35
|
+
}, responses_1.EditProfileSchema);
|
|
28
36
|
};
|
|
29
37
|
this.getAvatarUpload = async () => {
|
|
30
38
|
return await this.__http.sendPost({
|
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":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC"}
|
|
@@ -4,11 +4,13 @@ export declare const PostRequestConfigSchema: z.ZodObject<{
|
|
|
4
4
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
5
5
|
body: z.ZodReadonly<z.ZodString>;
|
|
6
6
|
contentType: z.ZodOptional<z.ZodString>;
|
|
7
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
7
8
|
}, z.core.$strip>;
|
|
8
9
|
export declare const GetRequestConfigSchema: z.ZodObject<{
|
|
9
10
|
path: z.ZodReadonly<z.ZodString>;
|
|
10
11
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
11
12
|
contentType: z.ZodOptional<z.ZodString>;
|
|
13
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
14
|
}, z.core.$strip>;
|
|
13
15
|
export declare const RawRequestConfigSchema: z.ZodObject<{
|
|
14
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
|
@@ -7,6 +7,7 @@ exports.PostRequestConfigSchema = zod_1.z.object({
|
|
|
7
7
|
baseUrl: zod_1.z.string().optional(),
|
|
8
8
|
body: zod_1.z.string().readonly(),
|
|
9
9
|
contentType: zod_1.z.string().optional(),
|
|
10
|
+
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
10
11
|
});
|
|
11
12
|
exports.GetRequestConfigSchema = exports.PostRequestConfigSchema.omit({
|
|
12
13
|
body: true,
|
package/dist/schemas/public.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const RaveConfigSchema: z.ZodObject<{
|
|
|
11
11
|
credentials: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
token: z.ZodOptional<z.ZodString>;
|
|
13
13
|
deviceId: z.ZodOptional<z.ZodString>;
|
|
14
|
-
|
|
14
|
+
autoJWT: z.ZodOptional<z.ZodBoolean>;
|
|
15
15
|
}, z.core.$strip>>;
|
|
16
16
|
enableLogging: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
}, z.core.$strip>;
|
package/dist/schemas/public.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.RaveConfigSchema = zod_1.default.object({
|
|
|
12
12
|
.object({
|
|
13
13
|
token: zod_1.default.string().optional(),
|
|
14
14
|
deviceId: zod_1.default.string().optional(),
|
|
15
|
-
|
|
15
|
+
autoJWT: zod_1.default.boolean().optional(),
|
|
16
16
|
})
|
|
17
17
|
.optional(),
|
|
18
18
|
enableLogging: zod_1.default.boolean().optional(),
|
|
@@ -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;
|
|
@@ -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,17 +3,17 @@ 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
13
|
export declare const ProfileSchema: z.ZodObject<{
|
|
14
14
|
name: z.ZodString;
|
|
15
15
|
displayName: z.ZodOptional<z.ZodString>;
|
|
16
|
-
handle: z.ZodString
|
|
16
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
17
17
|
avatar: z.ZodString;
|
|
18
18
|
country: z.ZodString;
|
|
19
19
|
}, z.core.$strip>;
|
|
@@ -9,11 +9,11 @@ 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
19
|
exports.ProfileSchema = exports.UserSchema.omit({
|
|
@@ -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>;
|
|
@@ -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>>;
|
|
@@ -168,11 +168,11 @@ export declare const GetMeshSchema: z.ZodObject<{
|
|
|
168
168
|
avatar: z.ZodString;
|
|
169
169
|
country: z.ZodString;
|
|
170
170
|
displayName: z.ZodOptional<z.ZodString>;
|
|
171
|
-
handle: z.ZodString
|
|
171
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
172
172
|
id: z.ZodNumber;
|
|
173
173
|
lang: z.ZodString;
|
|
174
|
-
lat: z.
|
|
175
|
-
lng: z.
|
|
174
|
+
lat: z.ZodNumber;
|
|
175
|
+
lng: z.ZodNumber;
|
|
176
176
|
name: z.ZodString;
|
|
177
177
|
}, z.core.$strip>>;
|
|
178
178
|
blurT: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -193,7 +193,7 @@ export declare const GetMeshSchema: z.ZodObject<{
|
|
|
193
193
|
mediaUrl: z.ZodString;
|
|
194
194
|
originator: z.ZodNumber;
|
|
195
195
|
playMode: z.ZodString;
|
|
196
|
-
position: z.
|
|
196
|
+
position: z.ZodNumber;
|
|
197
197
|
server: z.ZodString;
|
|
198
198
|
shareLink: z.ZodString;
|
|
199
199
|
thumbnails: z.ZodOptional<z.ZodObject<{
|
|
@@ -205,7 +205,7 @@ export declare const GetMeshSchema: z.ZodObject<{
|
|
|
205
205
|
default: z.ZodOptional<z.ZodString>;
|
|
206
206
|
high: z.ZodOptional<z.ZodString>;
|
|
207
207
|
}, z.core.$strip>>;
|
|
208
|
-
time: z.
|
|
208
|
+
time: z.ZodNumber;
|
|
209
209
|
videoAuthor: z.ZodString;
|
|
210
210
|
videoDuration: z.ZodNumber;
|
|
211
211
|
videoProvider: z.ZodString;
|
|
@@ -229,13 +229,13 @@ export declare const GetUserSchema: z.ZodObject<{
|
|
|
229
229
|
profile: z.ZodObject<{
|
|
230
230
|
name: z.ZodString;
|
|
231
231
|
displayName: z.ZodOptional<z.ZodString>;
|
|
232
|
-
handle: z.ZodString
|
|
232
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
233
233
|
avatar: z.ZodString;
|
|
234
234
|
country: z.ZodString;
|
|
235
235
|
}, z.core.$strip>;
|
|
236
236
|
}, z.core.$strip>;
|
|
237
237
|
}, z.core.$strip>;
|
|
238
|
-
export declare const
|
|
238
|
+
export declare const FriendshipSchema: z.ZodObject<{
|
|
239
239
|
data: z.ZodObject<{
|
|
240
240
|
fromUserId: z.ZodNumber;
|
|
241
241
|
state: z.ZodString;
|
|
@@ -245,6 +245,16 @@ export declare const SendFriendshipSchema: z.ZodObject<{
|
|
|
245
245
|
export declare const ValidateMeSchema: z.ZodObject<{
|
|
246
246
|
data: z.ZodString;
|
|
247
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>;
|
|
248
258
|
export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
|
|
249
259
|
export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
|
|
250
260
|
export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
|
|
@@ -255,6 +265,7 @@ export type GetAvatarUploadResponse = z.infer<typeof GetAvatarUploadSchema>;
|
|
|
255
265
|
export type GetManyMeshesResponse = z.infer<typeof GetManyMeshesSchema>;
|
|
256
266
|
export type GetMeshResponse = z.infer<typeof GetMeshSchema>;
|
|
257
267
|
export type GetUserResponse = z.infer<typeof GetUserSchema>;
|
|
258
|
-
export type
|
|
268
|
+
export type FriendshipResponse = z.infer<typeof FriendshipSchema>;
|
|
259
269
|
export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
|
|
270
|
+
export type GetThreadsResponse = z.infer<typeof GetThreadsSchema>;
|
|
260
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,11 +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.ValidateMeSchema = exports.
|
|
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
10
|
const private_1 = require("./private");
|
|
11
|
+
const thread_1 = require("./rave/thread");
|
|
11
12
|
exports.EditProfileSchema = zod_1.default.object({
|
|
12
13
|
data: user_1.UserSchema,
|
|
13
14
|
});
|
|
@@ -119,7 +120,7 @@ exports.GetUserSchema = zod_1.default.object({
|
|
|
119
120
|
profile: user_1.ProfileSchema,
|
|
120
121
|
}),
|
|
121
122
|
});
|
|
122
|
-
exports.
|
|
123
|
+
exports.FriendshipSchema = zod_1.default.object({
|
|
123
124
|
data: zod_1.default.object({
|
|
124
125
|
fromUserId: zod_1.default.number(),
|
|
125
126
|
state: zod_1.default.string(),
|
|
@@ -129,3 +130,6 @@ exports.SendFriendshipSchema = zod_1.default.object({
|
|
|
129
130
|
exports.ValidateMeSchema = zod_1.default.object({
|
|
130
131
|
data: zod_1.default.string(),
|
|
131
132
|
});
|
|
133
|
+
exports.GetThreadsSchema = zod_1.default.object({
|
|
134
|
+
data: zod_1.default.array(thread_1.ThreadSchema),
|
|
135
|
+
});
|
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;
|