ravejs 1.3.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/constants.d.ts +6 -3
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +13 -6
  4. package/dist/core/httpworkflow.d.ts +5 -1
  5. package/dist/core/httpworkflow.d.ts.map +1 -1
  6. package/dist/core/httpworkflow.js +24 -12
  7. package/dist/core/rave.d.ts +3 -0
  8. package/dist/core/rave.d.ts.map +1 -1
  9. package/dist/core/rave.js +8 -1
  10. package/dist/factories/auth-factory.d.ts +5 -1
  11. package/dist/factories/auth-factory.d.ts.map +1 -1
  12. package/dist/factories/auth-factory.js +35 -1
  13. package/dist/factories/mesh-factory.d.ts +11 -0
  14. package/dist/factories/mesh-factory.d.ts.map +1 -0
  15. package/dist/factories/mesh-factory.js +27 -0
  16. package/dist/factories/user-factory.d.ts +6 -1
  17. package/dist/factories/user-factory.d.ts.map +1 -1
  18. package/dist/factories/user-factory.js +37 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/schemas/configs.d.ts +3 -1
  21. package/dist/schemas/configs.d.ts.map +1 -1
  22. package/dist/schemas/configs.js +2 -1
  23. package/dist/schemas/index.d.ts +1 -0
  24. package/dist/schemas/index.d.ts.map +1 -1
  25. package/dist/schemas/index.js +1 -0
  26. package/dist/schemas/private.d.ts +9 -0
  27. package/dist/schemas/private.d.ts.map +1 -0
  28. package/dist/schemas/private.js +12 -0
  29. package/dist/schemas/public.d.ts +25 -2
  30. package/dist/schemas/public.d.ts.map +1 -1
  31. package/dist/schemas/public.js +14 -3
  32. package/dist/schemas/rave/mesh.d.ts +45 -0
  33. package/dist/schemas/rave/mesh.d.ts.map +1 -0
  34. package/dist/schemas/rave/mesh.js +48 -0
  35. package/dist/schemas/rave/user.d.ts +9 -1
  36. package/dist/schemas/rave/user.d.ts.map +1 -1
  37. package/dist/schemas/rave/user.js +8 -2
  38. package/dist/schemas/responses.d.ts +166 -1
  39. package/dist/schemas/responses.d.ts.map +1 -1
  40. package/dist/schemas/responses.js +50 -1
  41. package/dist/utils/cryptography.d.ts.map +1 -1
  42. package/dist/utils/cryptography.js +2 -3
  43. package/dist/utils/logger.d.ts.map +1 -1
  44. package/dist/utils/logger.js +5 -7
  45. package/package.json +1 -2
@@ -1,11 +1,14 @@
1
1
  import { APIErrorData } from './schemas/error';
2
- export declare const VERSION = "1.3.1";
2
+ export declare const VERSION = "1.5.2";
3
3
  export declare const API_URL = "https://api1.a-l-p-a.com";
4
- export declare const THIRD_API_URL = "https://api3.a-l-p-a.com";
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 WE_MESH_HEADERS: {
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;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/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;AAIrC,eAAO,MAAM,eAAe;;;;;;;;;CAU3B,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,CAiBlD,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,19 +1,22 @@
1
1
  "use strict";
2
- // Constants
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CODES_MAP = exports.PARSE_USERS_HEADERS = exports.PATCHED_IP_DATA = exports.PATCHED_DEVICE = exports.MOJO_AUTH_HEADERS = exports.WE_MESH_HEADERS = exports.DEFAULT_LANGUAGE = exports.HASH_SECRET = exports.MOJO_AUTH_URL = exports.THIRD_API_URL = exports.API_URL = exports.VERSION = void 0;
5
- exports.VERSION = '1.3.1';
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
+ // Constants
5
+ exports.VERSION = '1.5.2';
6
6
  exports.API_URL = 'https://api1.a-l-p-a.com';
7
- exports.THIRD_API_URL = 'https://api3.a-l-p-a.com';
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.WE_MESH_HEADERS = {
15
+ exports.API_HEADERS = {
13
16
  'Content-Type': 'application/json',
14
17
  Accept: 'application/json',
15
18
  Connection: 'keep-alive',
16
- 'User-Agent': 'Rave/2133 (8.1.93) (Android 15; 24117RN76O; Redmi tanzanite; ru)',
19
+ 'User-Agent': 'Rave/2133 (8.1.93) (Android 666; FuckRave; AndFuckYouAll; ru)',
17
20
  'WeMesh-API-Version': '4.0',
18
21
  'WeMesh-Platform': 'android',
19
22
  ssaid: '13c4e8d5fac67aff',
@@ -105,4 +108,8 @@ exports.CODES_MAP = {
105
108
  name: 'RaveJSException.NotFound',
106
109
  message: 'Not Found. Resource not found.',
107
110
  },
111
+ 429: {
112
+ name: 'RaveJSException.RateLimitExceeded',
113
+ message: 'Rate Limit Exceeded. Too many requests.',
114
+ },
108
115
  };
@@ -2,15 +2,19 @@ import { z } from 'zod';
2
2
  import { GetRequestConfig, PostRequestConfig, RawRequestConfig } from '../schemas/configs';
3
3
  export declare class HttpWorkflow {
4
4
  private __headers;
5
+ private __weMeshHeaders;
5
6
  get token(): string;
6
7
  set token(token: string);
8
+ set weMeshToken(token: string);
9
+ set popHeaders(key: string);
7
10
  private __configureHeaders;
8
- private __configureDataHeaders;
9
11
  private __handleResponse;
10
12
  private __sendDataRequest;
11
13
  sendGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
12
14
  sendPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
13
15
  sendPut: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
16
+ sendWeMeshGet: <T>(config: GetRequestConfig, schema: z.ZodSchema) => Promise<T>;
17
+ sendWeMeshPost: <T>(config: PostRequestConfig, schema: z.ZodSchema) => Promise<T>;
14
18
  sendRaw: <T>(config: RawRequestConfig, schema: z.ZodSchema) => Promise<T>;
15
19
  }
16
20
  //# sourceMappingURL=httpworkflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpworkflow.d.ts","sourceRoot":"","sources":["../../src/core/httpworkflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAI5B,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAgC;IAEjD,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,OAAO,CAAC,kBAAkB,CAKxB;IAEF,OAAO,CAAC,sBAAsB,CAW5B;IAEF,OAAO,CAAC,gBAAgB,CAetB;IAEF,OAAO,CAAC,iBAAiB,CAiBvB;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAYX;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,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAQX;CACH"}
1
+ {"version":3,"file":"httpworkflow.d.ts","sourceRoot":"","sources":["../../src/core/httpworkflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAI5B,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,eAAe,CAA4B;IAEnD,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,EAE5B;IAED,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,EAEzB;IAED,OAAO,CAAC,kBAAkB,CAQxB;IAEF,OAAO,CAAC,gBAAgB,CAetB;IAEF,OAAO,CAAC,iBAAiB,CAkBvB;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAaX;IAEK,QAAQ,GAAU,CAAC,UAChB,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAEX;IAEK,OAAO,GAAU,CAAC,UACf,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAEX;IAEK,aAAa,GAAU,CAAC,UACrB,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAQX;IAEK,cAAc,GAAU,CAAC,UACtB,iBAAiB,UACjB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CASX;IAEK,OAAO,GAAU,CAAC,UACf,gBAAgB,UAChB,CAAC,CAAC,SAAS,KAClB,OAAO,CAAC,CAAC,CAAC,CAQX;CACH"}
@@ -9,13 +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.WE_MESH_HEADERS;
13
- this.__configureHeaders = () => {
14
- return Object.assign(Object.assign({}, this.__headers), { 'request-ts': Date.now().toString() });
15
- };
16
- this.__configureDataHeaders = (data) => {
17
- const headers = this.__configureHeaders();
18
- return Object.assign(Object.assign({}, headers), { 'request-hash': (0, cryptography_1.generateHash)(this.token, headers['request-ts'], data.length) });
12
+ this.__headers = constants_1.API_HEADERS;
13
+ this.__weMeshHeaders = constants_1.API_HEADERS;
14
+ this.__configureHeaders = (data) => {
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) });
19
17
  };
20
18
  this.__handleResponse = async (statusCode, fullPath, body, schema) => {
21
19
  if (!(0, utils_1.isOk)(statusCode)) {
@@ -27,19 +25,21 @@ class HttpWorkflow {
27
25
  return schema.parse(JSON.parse(response));
28
26
  };
29
27
  this.__sendDataRequest = async (method, config, schema) => {
30
- const { statusCode, body } = await (0, undici_1.request)(`${constants_1.API_URL}${config.path}`, {
28
+ const baseUrl = config.baseUrl || constants_1.API_URL;
29
+ const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
31
30
  method,
32
- headers: this.__configureDataHeaders(config.body),
31
+ headers: this.__configureHeaders(config.body),
33
32
  body: config.body,
34
33
  });
35
- return await this.__handleResponse(statusCode, `${constants_1.API_URL}${config.path}`, body, schema);
34
+ return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
36
35
  };
37
36
  this.sendGet = async (config, schema) => {
38
- const { statusCode, body } = await (0, undici_1.request)(`${constants_1.API_URL}${config.path}`, {
37
+ const baseUrl = config.baseUrl || constants_1.API_URL;
38
+ const { statusCode, body } = await (0, undici_1.request)(`${baseUrl}${config.path}`, {
39
39
  method: 'GET',
40
40
  headers: this.__configureHeaders(),
41
41
  });
42
- return await this.__handleResponse(statusCode, `${constants_1.API_URL}${config.path}`, body, schema);
42
+ return await this.__handleResponse(statusCode, `${baseUrl}${config.path}`, body, schema);
43
43
  };
44
44
  this.sendPost = async (config, schema) => {
45
45
  return await this.__sendDataRequest('POST', config, schema);
@@ -47,6 +47,12 @@ class HttpWorkflow {
47
47
  this.sendPut = async (config, schema) => {
48
48
  return await this.__sendDataRequest('PUT', config, schema);
49
49
  };
50
+ this.sendWeMeshGet = async (config, schema) => {
51
+ return await this.sendGet(Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
52
+ };
53
+ this.sendWeMeshPost = async (config, schema) => {
54
+ return await this.__sendDataRequest('POST', Object.assign(Object.assign({}, config), { baseUrl: constants_1.WE_MESH_API_URL }), schema);
55
+ };
50
56
  this.sendRaw = async (config, schema) => {
51
57
  const { statusCode, body } = await (0, undici_1.request)(config.path, {
52
58
  headers: config.headers,
@@ -62,5 +68,11 @@ class HttpWorkflow {
62
68
  set token(token) {
63
69
  this.__headers.Authorization = `Bearer ${token}`;
64
70
  }
71
+ set weMeshToken(token) {
72
+ this.__weMeshHeaders.Authorization = `Bearer ${token}`;
73
+ }
74
+ set popHeaders(key) {
75
+ delete this.__headers[key];
76
+ }
65
77
  }
66
78
  exports.HttpWorkflow = HttpWorkflow;
@@ -1,4 +1,5 @@
1
1
  import { AuthFactory } from '../factories/auth-factory';
2
+ import { MeshFactory } from '../factories/mesh-factory';
2
3
  import { UserFactory } from '../factories/user-factory';
3
4
  import { RaveConfig } from '../schemas/public';
4
5
  export declare class Rave {
@@ -6,8 +7,10 @@ export declare class Rave {
6
7
  private __http;
7
8
  private __authFactory?;
8
9
  private __userFactory?;
10
+ private __meshFactory?;
9
11
  constructor(config?: RaveConfig);
10
12
  get auth(): AuthFactory;
11
13
  get user(): UserFactory;
14
+ get mesh(): MeshFactory;
12
15
  }
13
16
  //# sourceMappingURL=rave.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,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;gBAExB,MAAM,GAAE,UAAe;IASnC,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;CACF"}
1
+ {"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,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;gBAExB,MAAM,GAAE,UAAe;IASnC,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;IAED,IAAI,IAAI,gBAIP;CACF"}
package/dist/core/rave.js CHANGED
@@ -5,14 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Rave = void 0;
7
7
  const auth_factory_1 = require("../factories/auth-factory");
8
+ const mesh_factory_1 = require("../factories/mesh-factory");
8
9
  const user_factory_1 = require("../factories/user-factory");
9
10
  const logger_1 = __importDefault(require("../utils/logger"));
10
11
  const httpworkflow_1 = require("./httpworkflow");
11
12
  class Rave {
12
13
  constructor(config = {}) {
14
+ var _a;
13
15
  this.__config = config;
14
16
  this.__http = new httpworkflow_1.HttpWorkflow();
15
- if (this.__config.credentials)
17
+ if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token)
16
18
  this.__http.token = this.__config.credentials.token;
17
19
  (0, logger_1.default)(!!config.enableLogging);
18
20
  }
@@ -26,5 +28,10 @@ class Rave {
26
28
  return (this.__userFactory = new user_factory_1.UserFactory(this.__http));
27
29
  return this.__userFactory;
28
30
  }
31
+ get mesh() {
32
+ if (!this.__meshFactory)
33
+ return (this.__meshFactory = new mesh_factory_1.MeshFactory(this.__config, this.__http));
34
+ return this.__meshFactory;
35
+ }
29
36
  }
30
37
  exports.Rave = Rave;
@@ -1,13 +1,17 @@
1
1
  import { HttpWorkflow } from '../core/httpworkflow';
2
2
  import { RaveConfig } from '../schemas';
3
- import { CheckRegisterStateResponse, MojoLoginResponse, ParseUserCredentialsResponse, SendMagicLinkResponse } from '../schemas/responses';
3
+ import { AuthenticateResponse, CheckRegisterStateResponse, MojoLoginResponse, ParseUserCredentialsResponse, SendMagicLinkResponse } from '../schemas/responses';
4
4
  export declare class AuthFactory {
5
5
  private __config;
6
6
  private readonly __http;
7
7
  constructor(config: RaveConfig | undefined, http: HttpWorkflow);
8
+ private __authenticator;
8
9
  sendMagicLink: (email: string, language?: string) => Promise<SendMagicLinkResponse>;
9
10
  checkRegisterState: (stateId: string) => Promise<CheckRegisterStateResponse>;
10
11
  parseUserCredentials: (idToken: string, email: string) => Promise<ParseUserCredentialsResponse>;
11
12
  mojoLogin: (email: string, parseId: string, parseToken: string, name: string, deviceId?: string, language?: string) => Promise<MojoLoginResponse>;
13
+ login: (stateId: string, name?: string, deviceId?: string, language?: string) => Promise<AuthenticateResponse>;
14
+ register: (stateId: string, name?: string, deviceId?: string, language?: string) => Promise<AuthenticateResponse>;
15
+ getWeMeshJWT: (deviceId?: string) => Promise<string>;
12
16
  }
13
17
  //# sourceMappingURL=auth-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../src/factories/auth-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,0BAA0B,EAE1B,iBAAiB,EAEjB,4BAA4B,EAE5B,qBAAqB,EAEtB,MAAM,sBAAsB,CAAC;AAG9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,UAAU,YAAK,EAAE,IAAI,EAAE,YAAY;IAKhD,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;CACH"}
1
+ {"version":3,"file":"auth-factory.d.ts","sourceRoot":"","sources":["../../src/factories/auth-factory.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAEL,oBAAoB,EACpB,0BAA0B,EAE1B,iBAAiB,EAEjB,4BAA4B,EAE5B,qBAAqB,EAItB,MAAM,sBAAsB,CAAC;AAI9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,UAAU,YAAK,EAAE,IAAI,EAAE,YAAY;IAKvD,OAAO,CAAC,eAAe,CAsCrB;IAEK,aAAa,UACX,MAAM,aACH,MAAM,KACf,OAAO,CAAC,qBAAqB,CAAC,CAU/B;IAEK,kBAAkB,YACd,MAAM,KACd,OAAO,CAAC,0BAA0B,CAAC,CASpC;IAEK,oBAAoB,YAChB,MAAM,SACR,MAAM,KACZ,OAAO,CAAC,4BAA4B,CAAC,CAiBtC;IAEK,SAAS,UACP,MAAM,WACJ,MAAM,cACH,MAAM,QACZ,MAAM,aACF,MAAM,aACN,MAAM,KACf,OAAO,CAAC,iBAAiB,CAAC,CAsB3B;IAEK,KAAK,YACD,MAAM,SACR,MAAM,aACF,MAAM,aACN,MAAM,KAChB,OAAO,CAAC,oBAAoB,CAAC,CAQ9B;IAEK,QAAQ,YACJ,MAAM,SACR,MAAM,aACF,MAAM,aACN,MAAM,KAChB,OAAO,CAAC,oBAAoB,CAAC,CAQ9B;IAEK,YAAY,cAAqB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAc9D;CACH"}
@@ -4,8 +4,27 @@ exports.AuthFactory = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  const responses_1 = require("../schemas/responses");
6
6
  const cryptography_1 = require("../utils/cryptography");
7
+ const exceptions_1 = require("../utils/exceptions");
7
8
  class AuthFactory {
8
9
  constructor(config = {}, http) {
10
+ this.__authenticator = async (stateId, action, name = (0, cryptography_1.generateToken)(), deviceId = (0, cryptography_1.generateToken)(), language = constants_1.DEFAULT_LANGUAGE) => {
11
+ var _a;
12
+ const state = await this.checkRegisterState(stateId);
13
+ if (!state.authenticated) {
14
+ exceptions_1.APIException.throw(401);
15
+ }
16
+ const userCredentials = await this.parseUserCredentials(state.oauth.idToken, state.user.email);
17
+ const { data } = await this.mojoLogin(state.user.email, userCredentials.objectId, userCredentials.sessionToken, name, deviceId, language);
18
+ if (action == 'REGISTER')
19
+ this.__http.popHeaders = 'Authorization';
20
+ return responses_1.AuthenticateSchema.parse({
21
+ isNewUser: data.newUser,
22
+ email: (_a = state.user) === null || _a === void 0 ? void 0 : _a.email,
23
+ username: userCredentials.username,
24
+ deviceId: deviceId,
25
+ token: userCredentials.sessionToken.slice(2, userCredentials.sessionToken.length),
26
+ });
27
+ };
9
28
  this.sendMagicLink = async (email, language = constants_1.DEFAULT_LANGUAGE) => {
10
29
  return await this.__http.sendRaw({
11
30
  method: 'POST',
@@ -25,7 +44,7 @@ class AuthFactory {
25
44
  return await this.__http.sendRaw({
26
45
  method: 'POST',
27
46
  headers: constants_1.PARSE_USERS_HEADERS,
28
- path: `${constants_1.THIRD_API_URL}/parse/users`,
47
+ path: `${constants_1.PARSE_API_URL}/parse/users`,
29
48
  body: JSON.stringify({
30
49
  authData: {
31
50
  mojo: {
@@ -55,6 +74,21 @@ class AuthFactory {
55
74
  }),
56
75
  }, responses_1.MojoLoginSchema);
57
76
  };
77
+ this.login = async (stateId, name, deviceId, language) => {
78
+ return await this.__authenticator(stateId, 'LOGIN', name, deviceId, language);
79
+ };
80
+ this.register = async (stateId, name, deviceId, language) => {
81
+ return await this.__authenticator(stateId, 'REGISTER', name, deviceId, language);
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
+ };
58
92
  this.__config = config;
59
93
  this.__http = http;
60
94
  }
@@ -0,0 +1,11 @@
1
+ import { HttpWorkflow } from '../core/httpworkflow';
2
+ import { GetManyMeshesParams, RaveConfig } from '../schemas';
3
+ import { GetManyMeshesResponse, GetMeshResponse } from '../schemas/responses';
4
+ export declare class MeshFactory {
5
+ private readonly __config;
6
+ private readonly __http;
7
+ constructor(config: RaveConfig | undefined, http: HttpWorkflow);
8
+ get: (meshId: string) => Promise<GetMeshResponse>;
9
+ getMany: (params?: GetManyMeshesParams) => Promise<GetManyMeshesResponse>;
10
+ }
11
+ //# sourceMappingURL=mesh-factory.d.ts.map
@@ -0,0 +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,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"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MeshFactory = void 0;
4
+ const constants_1 = require("../constants");
5
+ const responses_1 = require("../schemas/responses");
6
+ class MeshFactory {
7
+ constructor(config = {}, http) {
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
+ }) => {
18
+ var _a;
19
+ return await this.__http.sendGet({
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}`,
21
+ }, responses_1.GetManyMeshesSchema);
22
+ };
23
+ this.__config = config;
24
+ this.__http = http;
25
+ }
26
+ }
27
+ exports.MeshFactory = MeshFactory;
@@ -1,9 +1,14 @@
1
1
  import { HttpWorkflow } from '../core/httpworkflow';
2
2
  import { EditProfileBuilder } from '../schemas';
3
- import { EditProfileResponse } from '../schemas/responses';
3
+ import { EditProfileResponse, GetAvatarUploadResponse, GetUserResponse, SendFriendshipResponse } from '../schemas/responses';
4
4
  export declare class UserFactory {
5
5
  private readonly __http;
6
6
  constructor(http: HttpWorkflow);
7
+ get: (userId: number) => Promise<GetUserResponse>;
8
+ sendFriendship: (userId: number) => Promise<SendFriendshipResponse>;
7
9
  edit: (builder: EditProfileBuilder) => Promise<EditProfileResponse>;
10
+ getAvatarUpload: () => Promise<GetAvatarUploadResponse>;
11
+ uploadOnUrl: (uploadUrl: string, image: Buffer) => Promise<any>;
12
+ uploadAvatar: (image: Buffer) => Promise<string>;
8
13
  }
9
14
  //# sourceMappingURL=user-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-factory.d.ts","sourceRoot":"","sources":["../../src/factories/user-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,IAAI,YACA,kBAAkB,KAC1B,OAAO,CAAC,mBAAmB,CAAC,CAQ7B;CACH"}
1
+ {"version":3,"file":"user-factory.d.ts","sourceRoot":"","sources":["../../src/factories/user-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EAEvB,eAAe,EAEf,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,GAAG,WAAkB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAO3D;IAEK,cAAc,WACX,MAAM,KACb,OAAO,CAAC,sBAAsB,CAAC,CAQhC;IAEK,IAAI,YACA,kBAAkB,KAC1B,OAAO,CAAC,mBAAmB,CAAC,CAQ7B;IAEK,eAAe,QAAa,OAAO,CAAC,uBAAuB,CAAC,CAQjE;IAEK,WAAW,cACL,MAAM,SACV,MAAM,KACZ,OAAO,CAAC,GAAG,CAAC,CAYb;IAEK,YAAY,UAAiB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAI1D;CACH"}
@@ -1,15 +1,52 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.UserFactory = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
4
8
  const schemas_1 = require("../schemas");
9
+ const responses_1 = require("../schemas/responses");
5
10
  class UserFactory {
6
11
  constructor(http) {
12
+ this.get = async (userId) => {
13
+ return await this.__http.sendGet({
14
+ path: `/profiles/${userId}?exclude=false&clientVersion=1`,
15
+ }, responses_1.GetUserSchema);
16
+ };
17
+ this.sendFriendship = async (userId) => {
18
+ return await this.__http.sendPost({
19
+ path: `/friendships`,
20
+ body: JSON.stringify({ id: userId }),
21
+ }, responses_1.SendFriendshipSchema);
22
+ };
7
23
  this.edit = async (builder) => {
8
24
  return await this.__http.sendPut({
9
25
  path: '/users/self',
10
26
  body: JSON.stringify(builder),
11
27
  }, schemas_1.EditProfileBuilderSchema);
12
28
  };
29
+ this.getAvatarUpload = async () => {
30
+ return await this.__http.sendPost({
31
+ path: '/users/self/avatar/upload',
32
+ body: JSON.stringify({ mime: 'image/jpeg' }),
33
+ }, responses_1.GetAvatarUploadSchema);
34
+ };
35
+ this.uploadOnUrl = async (uploadUrl, image) => {
36
+ return await this.__http.sendRaw({
37
+ path: uploadUrl,
38
+ method: 'PUT',
39
+ body: image,
40
+ headers: {
41
+ 'Content-Type': 'image/jpeg',
42
+ },
43
+ }, zod_1.default.any());
44
+ };
45
+ this.uploadAvatar = async (image) => {
46
+ const { data } = await this.getAvatarUpload();
47
+ await this.uploadOnUrl(data.uploadUrl, image);
48
+ return data.uploadUrl;
49
+ };
13
50
  this.__http = http;
14
51
  }
15
52
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC"}
@@ -1,18 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  export declare const PostRequestConfigSchema: z.ZodObject<{
3
3
  path: z.ZodReadonly<z.ZodString>;
4
+ baseUrl: z.ZodOptional<z.ZodString>;
4
5
  body: z.ZodReadonly<z.ZodString>;
5
6
  contentType: z.ZodOptional<z.ZodString>;
6
7
  }, z.core.$strip>;
7
8
  export declare const GetRequestConfigSchema: z.ZodObject<{
8
9
  path: z.ZodReadonly<z.ZodString>;
10
+ baseUrl: z.ZodOptional<z.ZodString>;
9
11
  contentType: z.ZodOptional<z.ZodString>;
10
12
  }, z.core.$strip>;
11
13
  export declare const RawRequestConfigSchema: z.ZodObject<{
12
14
  method: z.ZodString;
13
15
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
16
  path: z.ZodReadonly<z.ZodString>;
15
- body: z.ZodOptional<z.ZodString>;
17
+ body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Buffer, Buffer>]>>;
16
18
  }, z.core.$strip>;
17
19
  export type PostRequestConfig = z.infer<typeof PostRequestConfigSchema>;
18
20
  export type GetRequestConfig = z.infer<typeof GetRequestConfigSchema>;
@@ -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;;;;iBAIlC,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"}
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/schemas/configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;iBAEjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -4,6 +4,7 @@ exports.RawRequestConfigSchema = exports.GetRequestConfigSchema = exports.PostRe
4
4
  const zod_1 = require("zod");
5
5
  exports.PostRequestConfigSchema = zod_1.z.object({
6
6
  path: zod_1.z.string().readonly(),
7
+ baseUrl: zod_1.z.string().optional(),
7
8
  body: zod_1.z.string().readonly(),
8
9
  contentType: zod_1.z.string().optional(),
9
10
  });
@@ -14,5 +15,5 @@ exports.RawRequestConfigSchema = zod_1.z.object({
14
15
  method: zod_1.z.string(),
15
16
  headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
16
17
  path: zod_1.z.string().readonly(),
17
- body: zod_1.z.string().optional(),
18
+ body: zod_1.z.union([zod_1.z.string(), zod_1.z.instanceof(Buffer)]).optional(),
18
19
  });
@@ -1,2 +1,3 @@
1
1
  export * from './public';
2
+ export * from './rave/user';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./public"), exports);
18
+ __exportStar(require("./rave/user"), exports);
@@ -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();
@@ -1,8 +1,17 @@
1
1
  import z from 'zod';
2
+ export declare const LanguagesSchema: z.ZodEnum<{
3
+ ru: "ru";
4
+ en: "en";
5
+ }>;
6
+ export declare const AuthenticatorMethodSchema: z.ZodEnum<{
7
+ LOGIN: "LOGIN";
8
+ REGISTER: "REGISTER";
9
+ }>;
2
10
  export declare const RaveConfigSchema: z.ZodObject<{
3
11
  credentials: z.ZodOptional<z.ZodObject<{
4
- token: z.ZodString;
5
- deviceId: z.ZodString;
12
+ token: z.ZodOptional<z.ZodString>;
13
+ deviceId: z.ZodOptional<z.ZodString>;
14
+ weMeshJWT: z.ZodOptional<z.ZodString>;
6
15
  }, z.core.$strip>>;
7
16
  enableLogging: z.ZodOptional<z.ZodBoolean>;
8
17
  }, z.core.$strip>;
@@ -11,6 +20,20 @@ export declare const EditProfileBuilderSchema: z.ZodObject<{
11
20
  displayName: z.ZodOptional<z.ZodString>;
12
21
  handle: z.ZodOptional<z.ZodString>;
13
22
  }, z.core.$strip>;
23
+ export declare const GetManyMeshesSchema: z.ZodObject<{
24
+ isPublic: z.ZodOptional<z.ZodBoolean>;
25
+ limit: z.ZodDefault<z.ZodNumber>;
26
+ hasFriends: z.ZodOptional<z.ZodBoolean>;
27
+ local: z.ZodOptional<z.ZodBoolean>;
28
+ hasInvited: z.ZodOptional<z.ZodBoolean>;
29
+ language: z.ZodEnum<{
30
+ ru: "ru";
31
+ en: "en";
32
+ }>;
33
+ }, z.core.$strip>;
14
34
  export type RaveConfig = z.infer<typeof RaveConfigSchema>;
15
35
  export type EditProfileBuilder = z.infer<typeof EditProfileBuilderSchema>;
36
+ export type GetManyMeshesParams = z.infer<typeof GetManyMeshesSchema>;
37
+ export type Languages = z.infer<typeof LanguagesSchema>;
38
+ export type AuthenticatorMethod = z.infer<typeof AuthenticatorMethodSchema>;
16
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,gBAAgB;;;;;;iBAQ3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;iBAInC,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"}
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"}
@@ -3,13 +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.EditProfileBuilderSchema = exports.RaveConfigSchema = void 0;
6
+ exports.GetManyMeshesSchema = exports.EditProfileBuilderSchema = exports.RaveConfigSchema = exports.AuthenticatorMethodSchema = exports.LanguagesSchema = void 0;
7
7
  const zod_1 = __importDefault(require("zod"));
8
+ exports.LanguagesSchema = zod_1.default.enum(['en', 'ru']);
9
+ exports.AuthenticatorMethodSchema = zod_1.default.enum(['LOGIN', 'REGISTER']);
8
10
  exports.RaveConfigSchema = zod_1.default.object({
9
11
  credentials: zod_1.default
10
12
  .object({
11
- token: zod_1.default.string(),
12
- deviceId: zod_1.default.string(),
13
+ token: zod_1.default.string().optional(),
14
+ deviceId: zod_1.default.string().optional(),
15
+ weMeshJWT: zod_1.default.string().optional(),
13
16
  })
14
17
  .optional(),
15
18
  enableLogging: zod_1.default.boolean().optional(),
@@ -19,3 +22,11 @@ exports.EditProfileBuilderSchema = zod_1.default.object({
19
22
  displayName: zod_1.default.string().optional(),
20
23
  handle: zod_1.default.string().optional(),
21
24
  });
25
+ exports.GetManyMeshesSchema = zod_1.default.object({
26
+ isPublic: zod_1.default.boolean().optional(),
27
+ limit: zod_1.default.number().default(20),
28
+ hasFriends: zod_1.default.boolean().optional(),
29
+ local: zod_1.default.boolean().optional(),
30
+ hasInvited: zod_1.default.boolean().optional(),
31
+ language: exports.LanguagesSchema,
32
+ });
@@ -0,0 +1,45 @@
1
+ import z from 'zod';
2
+ export declare const MeshSchema: z.ZodObject<{
3
+ blurT: z.ZodOptional<z.ZodBoolean>;
4
+ category: z.ZodString;
5
+ channel: z.ZodNumber;
6
+ createdAt: z.ZodString;
7
+ currentState: z.ZodEnum<{
8
+ play: "play";
9
+ paus: "paus";
10
+ }>;
11
+ explicit: z.ZodBoolean;
12
+ id: z.ZodString;
13
+ isFriend: z.ZodBoolean;
14
+ isLocal: z.ZodBoolean;
15
+ isPublic: z.ZodBoolean;
16
+ kickMode: z.ZodString;
17
+ maturity: z.ZodString;
18
+ mediaUrl: z.ZodString;
19
+ originator: z.ZodNumber;
20
+ playMode: z.ZodString;
21
+ position: z.ZodFloat32;
22
+ server: z.ZodString;
23
+ shareLink: z.ZodString;
24
+ thumbnails: z.ZodOptional<z.ZodObject<{
25
+ channel: z.ZodOptional<z.ZodString>;
26
+ standard: z.ZodOptional<z.ZodString>;
27
+ animated: z.ZodOptional<z.ZodString>;
28
+ maxres: z.ZodOptional<z.ZodString>;
29
+ medium: z.ZodOptional<z.ZodString>;
30
+ default: z.ZodOptional<z.ZodString>;
31
+ high: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>>;
33
+ time: z.ZodFloat32;
34
+ videoAuthor: z.ZodString;
35
+ videoDuration: z.ZodNumber;
36
+ videoProvider: z.ZodString;
37
+ videoPublishedAt: z.ZodString;
38
+ videoThumbnail: z.ZodString;
39
+ videoTitle: z.ZodString;
40
+ videoUrl: z.ZodString;
41
+ vikiPass: z.ZodBoolean;
42
+ voipMode: z.ZodString;
43
+ }, z.core.$strip>;
44
+ export type Mesh = z.infer<typeof MeshSchema>;
45
+ //# sourceMappingURL=mesh.d.ts.map
@@ -0,0 +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;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,48 @@
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.MeshSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.MeshSchema = zod_1.default.object({
9
+ blurT: zod_1.default.boolean().optional(),
10
+ category: zod_1.default.string(),
11
+ channel: zod_1.default.number(),
12
+ createdAt: zod_1.default.string(),
13
+ currentState: zod_1.default.enum(['play', 'paus']),
14
+ explicit: zod_1.default.boolean(),
15
+ id: zod_1.default.string(),
16
+ isFriend: zod_1.default.boolean(),
17
+ isLocal: zod_1.default.boolean(),
18
+ isPublic: zod_1.default.boolean(),
19
+ kickMode: zod_1.default.string(),
20
+ maturity: zod_1.default.string(),
21
+ mediaUrl: zod_1.default.string(),
22
+ originator: zod_1.default.number(),
23
+ playMode: zod_1.default.string(),
24
+ position: zod_1.default.float32(),
25
+ server: zod_1.default.string(),
26
+ shareLink: zod_1.default.string(),
27
+ thumbnails: zod_1.default
28
+ .object({
29
+ channel: zod_1.default.string().optional(),
30
+ standard: zod_1.default.string().optional(),
31
+ animated: zod_1.default.string().optional(),
32
+ maxres: zod_1.default.string().optional(),
33
+ medium: zod_1.default.string().optional(),
34
+ default: zod_1.default.string().optional(),
35
+ high: zod_1.default.string().optional(),
36
+ })
37
+ .optional(),
38
+ time: zod_1.default.float32(),
39
+ videoAuthor: zod_1.default.string(),
40
+ videoDuration: zod_1.default.number(),
41
+ videoProvider: zod_1.default.string(),
42
+ videoPublishedAt: zod_1.default.string(),
43
+ videoThumbnail: zod_1.default.string(),
44
+ videoTitle: zod_1.default.string(),
45
+ videoUrl: zod_1.default.string(),
46
+ vikiPass: zod_1.default.boolean(),
47
+ voipMode: zod_1.default.string(),
48
+ });
@@ -2,7 +2,7 @@ import z from 'zod';
2
2
  export declare const UserSchema: z.ZodObject<{
3
3
  avatar: z.ZodString;
4
4
  country: z.ZodString;
5
- displayName: z.ZodString;
5
+ displayName: z.ZodOptional<z.ZodString>;
6
6
  handle: z.ZodString;
7
7
  id: z.ZodNumber;
8
8
  lang: z.ZodString;
@@ -10,5 +10,13 @@ export declare const UserSchema: z.ZodObject<{
10
10
  lng: z.ZodFloat32;
11
11
  name: z.ZodString;
12
12
  }, z.core.$strip>;
13
+ export declare const ProfileSchema: z.ZodObject<{
14
+ name: z.ZodString;
15
+ displayName: z.ZodOptional<z.ZodString>;
16
+ handle: z.ZodString;
17
+ avatar: z.ZodString;
18
+ country: z.ZodString;
19
+ }, z.core.$strip>;
13
20
  export type User = z.infer<typeof UserSchema>;
21
+ export type Profile = z.infer<typeof ProfileSchema>;
14
22
  //# sourceMappingURL=user.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/user.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;iBAUrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/user.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,UAAU;;;;;;;;;;iBAUrB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;iBAKxB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -3,12 +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.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
- displayName: zod_1.default.string(),
11
+ displayName: zod_1.default.string().optional(),
12
12
  handle: zod_1.default.string(),
13
13
  id: zod_1.default.number(),
14
14
  lang: zod_1.default.string(),
@@ -16,3 +16,9 @@ exports.UserSchema = zod_1.default.object({
16
16
  lng: zod_1.default.float32(),
17
17
  name: zod_1.default.string(),
18
18
  });
19
+ exports.ProfileSchema = exports.UserSchema.omit({
20
+ id: true,
21
+ lat: true,
22
+ lng: true,
23
+ lang: true,
24
+ });
@@ -3,7 +3,7 @@ export declare const EditProfileSchema: z.ZodObject<{
3
3
  data: z.ZodObject<{
4
4
  avatar: z.ZodString;
5
5
  country: z.ZodString;
6
- displayName: z.ZodString;
6
+ displayName: z.ZodOptional<z.ZodString>;
7
7
  handle: z.ZodString;
8
8
  id: z.ZodNumber;
9
9
  lang: z.ZodString;
@@ -87,9 +87,174 @@ export declare const MojoLoginSchema: z.ZodObject<{
87
87
  suggestedHandles: z.ZodArray<z.ZodString>;
88
88
  }, z.core.$strip>;
89
89
  }, z.core.$strip>;
90
+ export declare const AuthenticateSchema: z.ZodObject<{
91
+ isNewUser: z.ZodBoolean;
92
+ email: z.ZodString;
93
+ username: z.ZodString;
94
+ deviceId: z.ZodString;
95
+ token: z.ZodString;
96
+ }, z.core.$strip>;
97
+ export declare const GetAvatarUploadSchema: z.ZodObject<{
98
+ data: z.ZodObject<{
99
+ expiresAt: z.ZodString;
100
+ fileName: z.ZodString;
101
+ mime: z.ZodString;
102
+ uploadUrl: z.ZodString;
103
+ }, z.core.$strip>;
104
+ }, z.core.$strip>;
105
+ export declare const GetManyMeshesSchema: z.ZodObject<{
106
+ data: z.ZodArray<z.ZodObject<{
107
+ mesh: z.ZodObject<{
108
+ blurT: z.ZodOptional<z.ZodBoolean>;
109
+ category: z.ZodString;
110
+ channel: z.ZodNumber;
111
+ createdAt: z.ZodString;
112
+ currentState: z.ZodEnum<{
113
+ play: "play";
114
+ paus: "paus";
115
+ }>;
116
+ explicit: z.ZodBoolean;
117
+ id: z.ZodString;
118
+ isFriend: z.ZodBoolean;
119
+ isLocal: z.ZodBoolean;
120
+ isPublic: z.ZodBoolean;
121
+ kickMode: z.ZodString;
122
+ maturity: z.ZodString;
123
+ mediaUrl: z.ZodString;
124
+ originator: z.ZodNumber;
125
+ playMode: z.ZodString;
126
+ position: z.ZodFloat32;
127
+ server: z.ZodString;
128
+ shareLink: z.ZodString;
129
+ thumbnails: z.ZodOptional<z.ZodObject<{
130
+ channel: z.ZodOptional<z.ZodString>;
131
+ standard: z.ZodOptional<z.ZodString>;
132
+ animated: z.ZodOptional<z.ZodString>;
133
+ maxres: z.ZodOptional<z.ZodString>;
134
+ medium: z.ZodOptional<z.ZodString>;
135
+ default: z.ZodOptional<z.ZodString>;
136
+ high: z.ZodOptional<z.ZodString>;
137
+ }, z.core.$strip>>;
138
+ time: z.ZodFloat32;
139
+ videoAuthor: z.ZodString;
140
+ videoDuration: z.ZodNumber;
141
+ videoProvider: z.ZodString;
142
+ videoPublishedAt: z.ZodString;
143
+ videoThumbnail: z.ZodString;
144
+ videoTitle: z.ZodString;
145
+ videoUrl: z.ZodString;
146
+ vikiPass: z.ZodBoolean;
147
+ voipMode: z.ZodString;
148
+ }, z.core.$strip>;
149
+ users: z.ZodArray<z.ZodObject<{
150
+ avatar: z.ZodString;
151
+ country: z.ZodString;
152
+ displayName: z.ZodOptional<z.ZodString>;
153
+ handle: z.ZodString;
154
+ id: z.ZodNumber;
155
+ lang: z.ZodString;
156
+ lat: z.ZodFloat32;
157
+ lng: z.ZodFloat32;
158
+ name: z.ZodString;
159
+ }, z.core.$strip>>;
160
+ }, z.core.$strip>>;
161
+ paging: z.ZodOptional<z.ZodObject<{
162
+ next: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strip>>;
164
+ }, z.core.$strip>;
165
+ export declare const GetMeshSchema: z.ZodObject<{
166
+ data: z.ZodObject<{
167
+ users: z.ZodArray<z.ZodObject<{
168
+ avatar: z.ZodString;
169
+ country: z.ZodString;
170
+ displayName: z.ZodOptional<z.ZodString>;
171
+ handle: z.ZodString;
172
+ id: z.ZodNumber;
173
+ lang: z.ZodString;
174
+ lat: z.ZodFloat32;
175
+ lng: z.ZodFloat32;
176
+ name: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ blurT: z.ZodOptional<z.ZodBoolean>;
179
+ category: z.ZodString;
180
+ channel: z.ZodNumber;
181
+ createdAt: z.ZodString;
182
+ currentState: z.ZodEnum<{
183
+ play: "play";
184
+ paus: "paus";
185
+ }>;
186
+ explicit: z.ZodBoolean;
187
+ id: z.ZodString;
188
+ isFriend: z.ZodBoolean;
189
+ isLocal: z.ZodBoolean;
190
+ isPublic: z.ZodBoolean;
191
+ kickMode: z.ZodString;
192
+ maturity: z.ZodString;
193
+ mediaUrl: z.ZodString;
194
+ originator: z.ZodNumber;
195
+ playMode: z.ZodString;
196
+ position: z.ZodFloat32;
197
+ server: z.ZodString;
198
+ shareLink: z.ZodString;
199
+ thumbnails: z.ZodOptional<z.ZodObject<{
200
+ channel: z.ZodOptional<z.ZodString>;
201
+ standard: z.ZodOptional<z.ZodString>;
202
+ animated: z.ZodOptional<z.ZodString>;
203
+ maxres: z.ZodOptional<z.ZodString>;
204
+ medium: z.ZodOptional<z.ZodString>;
205
+ default: z.ZodOptional<z.ZodString>;
206
+ high: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>>;
208
+ time: z.ZodFloat32;
209
+ videoAuthor: z.ZodString;
210
+ videoDuration: z.ZodNumber;
211
+ videoProvider: z.ZodString;
212
+ videoPublishedAt: z.ZodString;
213
+ videoThumbnail: z.ZodString;
214
+ videoTitle: z.ZodString;
215
+ videoUrl: z.ZodString;
216
+ vikiPass: z.ZodBoolean;
217
+ voipMode: z.ZodString;
218
+ }, z.core.$strip>;
219
+ }, z.core.$strip>;
220
+ export declare const GetUserSchema: z.ZodObject<{
221
+ data: z.ZodObject<{
222
+ bio: z.ZodObject<{
223
+ bio: z.ZodOptional<z.ZodString>;
224
+ metadata: z.ZodObject<{
225
+ position: z.ZodNumber;
226
+ privacy: z.ZodString;
227
+ }, z.core.$strip>;
228
+ }, z.core.$strip>;
229
+ profile: z.ZodObject<{
230
+ name: z.ZodString;
231
+ displayName: z.ZodOptional<z.ZodString>;
232
+ handle: z.ZodString;
233
+ avatar: z.ZodString;
234
+ country: z.ZodString;
235
+ }, z.core.$strip>;
236
+ }, z.core.$strip>;
237
+ }, z.core.$strip>;
238
+ export declare const SendFriendshipSchema: z.ZodObject<{
239
+ data: z.ZodObject<{
240
+ fromUserId: z.ZodNumber;
241
+ state: z.ZodString;
242
+ toUserId: z.ZodNumber;
243
+ }, z.core.$strip>;
244
+ }, z.core.$strip>;
245
+ export declare const ValidateMeSchema: z.ZodObject<{
246
+ data: z.ZodString;
247
+ }, z.core.$strip>;
90
248
  export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
91
249
  export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
92
250
  export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
93
251
  export type ParseUserCredentialsResponse = z.infer<typeof ParseUserCredentialsSchema>;
94
252
  export type MojoLoginResponse = z.infer<typeof MojoLoginSchema>;
253
+ export type AuthenticateResponse = z.infer<typeof AuthenticateSchema>;
254
+ export type GetAvatarUploadResponse = z.infer<typeof GetAvatarUploadSchema>;
255
+ export type GetManyMeshesResponse = z.infer<typeof GetManyMeshesSchema>;
256
+ export type GetMeshResponse = z.infer<typeof GetMeshSchema>;
257
+ export type GetUserResponse = z.infer<typeof GetUserSchema>;
258
+ export type SendFriendshipResponse = z.infer<typeof SendFriendshipSchema>;
259
+ export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
95
260
  //# sourceMappingURL=responses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,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,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"}
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;GAQ5B,CAAC;AAEL,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDjC,CAAC;AAEL,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;iBAM1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;iBAOhC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAWxB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;iBAM/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACxE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,wBAAwB,CAChC,CAAC;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,0BAA0B,CAClC,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAChE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACtE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC5E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
6
+ exports.ValidateMeSchema = exports.SendFriendshipSchema = exports.GetUserSchema = exports.GetMeshSchema = exports.GetManyMeshesSchema = exports.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
7
7
  const zod_1 = __importDefault(require("zod"));
8
8
  const user_1 = require("./rave/user");
9
+ const mesh_1 = require("./rave/mesh");
10
+ const private_1 = require("./private");
9
11
  exports.EditProfileSchema = zod_1.default.object({
10
12
  data: user_1.UserSchema,
11
13
  });
@@ -80,3 +82,50 @@ exports.MojoLoginSchema = zod_1.default.object({
80
82
  suggestedHandles: zod_1.default.array(zod_1.default.string()),
81
83
  }),
82
84
  });
85
+ exports.AuthenticateSchema = zod_1.default.object({
86
+ isNewUser: zod_1.default.boolean(),
87
+ email: zod_1.default.string(),
88
+ username: zod_1.default.string(),
89
+ deviceId: zod_1.default.string(),
90
+ token: zod_1.default.string(),
91
+ });
92
+ exports.GetAvatarUploadSchema = zod_1.default.object({
93
+ data: zod_1.default.object({
94
+ expiresAt: zod_1.default.string(),
95
+ fileName: zod_1.default.string(),
96
+ mime: zod_1.default.string(),
97
+ uploadUrl: zod_1.default.string(),
98
+ }),
99
+ });
100
+ exports.GetManyMeshesSchema = zod_1.default.object({
101
+ data: zod_1.default.array(zod_1.default.object({
102
+ mesh: mesh_1.MeshSchema,
103
+ users: zod_1.default.array(user_1.UserSchema),
104
+ })),
105
+ paging: private_1.PagingSchema,
106
+ });
107
+ exports.GetMeshSchema = zod_1.default.object({
108
+ data: zod_1.default.object(Object.assign(Object.assign({}, mesh_1.MeshSchema.shape), { users: zod_1.default.array(user_1.UserSchema) })),
109
+ });
110
+ exports.GetUserSchema = zod_1.default.object({
111
+ data: zod_1.default.object({
112
+ bio: zod_1.default.object({
113
+ bio: zod_1.default.string().optional(),
114
+ metadata: zod_1.default.object({
115
+ position: zod_1.default.number(),
116
+ privacy: zod_1.default.string(),
117
+ }),
118
+ }),
119
+ profile: user_1.ProfileSchema,
120
+ }),
121
+ });
122
+ exports.SendFriendshipSchema = zod_1.default.object({
123
+ data: zod_1.default.object({
124
+ fromUserId: zod_1.default.number(),
125
+ state: zod_1.default.string(),
126
+ toUserId: zod_1.default.number(),
127
+ }),
128
+ });
129
+ exports.ValidateMeSchema = zod_1.default.object({
130
+ data: zod_1.default.string(),
131
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"cryptography.d.ts","sourceRoot":"","sources":["../../src/utils/cryptography.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,UAChB,MAAM,aACF,MAAM,iBACF,MAAM,WAMtB,CAAC;AAEF,eAAO,MAAM,aAAa,cAKzB,CAAC"}
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"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateToken = exports.generateHash = void 0;
4
4
  const crypto_1 = require("crypto");
5
- const uuid_1 = require("uuid");
6
5
  const constants_1 = require("../constants");
7
6
  const generateHash = (token, timestamp, contentLength) => {
8
7
  const hash = (0, crypto_1.createHmac)('sha256', constants_1.HASH_SECRET)
@@ -12,9 +11,9 @@ const generateHash = (token, timestamp, contentLength) => {
12
11
  };
13
12
  exports.generateHash = generateHash;
14
13
  const generateToken = () => {
15
- return (0, uuid_1.v4)().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
- });
17
+ }).replace(/-/g, '');
19
18
  };
20
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;AAEpC,eAAO,IAAI,MAAM,EAAE,MAAM,CAAC;AAE1B,QAAA,MAAM,UAAU,kBAAmB,OAAO,KAAG,MAY5C,CAAC;AAEF,eAAe,UAAU,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"}
@@ -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
- transport: {
14
- target: 'pino-pretty',
15
- options: {
16
- colorize: true,
17
- },
18
- },
19
- }));
14
+ }, (0, pino_pretty_1.default)({
15
+ colorize: true,
16
+ sync: true,
17
+ })));
20
18
  };
21
19
  exports.default = initLogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravejs",
3
- "version": "1.3.1",
3
+ "version": "1.5.2",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -44,7 +44,6 @@
44
44
  "dependencies": {
45
45
  "pino": "^10.1.0",
46
46
  "pino-pretty": "^13.1.3",
47
- "uuid": "^13.0.0",
48
47
  "zod": "^4.1.13"
49
48
  }
50
49
  }