ravejs 1.5.2 → 1.7.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.
Files changed (44) hide show
  1. package/dist/constants.d.ts +1 -1
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +5 -1
  4. package/dist/core/httpworkflow.d.ts +1 -0
  5. package/dist/core/httpworkflow.d.ts.map +1 -1
  6. package/dist/core/httpworkflow.js +17 -9
  7. package/dist/core/rave.d.ts +6 -0
  8. package/dist/core/rave.d.ts.map +1 -1
  9. package/dist/core/rave.js +26 -2
  10. package/dist/factories/auth-factory.d.ts +0 -1
  11. package/dist/factories/auth-factory.d.ts.map +1 -1
  12. package/dist/factories/auth-factory.js +0 -9
  13. package/dist/factories/mesh-factory.d.ts +1 -0
  14. package/dist/factories/mesh-factory.d.ts.map +1 -1
  15. package/dist/factories/mesh-factory.js +12 -0
  16. package/dist/factories/thread-factory.d.ts +11 -0
  17. package/dist/factories/thread-factory.d.ts.map +1 -0
  18. package/dist/factories/thread-factory.js +42 -0
  19. package/dist/factories/user-factory.d.ts +5 -2
  20. package/dist/factories/user-factory.d.ts.map +1 -1
  21. package/dist/factories/user-factory.js +14 -6
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/schemas/configs.d.ts +2 -0
  24. package/dist/schemas/configs.d.ts.map +1 -1
  25. package/dist/schemas/configs.js +1 -0
  26. package/dist/schemas/public.d.ts +1 -1
  27. package/dist/schemas/public.js +1 -1
  28. package/dist/schemas/rave/mesh.d.ts +2 -2
  29. package/dist/schemas/rave/mesh.js +2 -2
  30. package/dist/schemas/rave/message.d.ts +19 -0
  31. package/dist/schemas/rave/message.d.ts.map +1 -0
  32. package/dist/schemas/rave/message.js +22 -0
  33. package/dist/schemas/rave/thread.d.ts +11 -0
  34. package/dist/schemas/rave/thread.d.ts.map +1 -0
  35. package/dist/schemas/rave/thread.js +15 -0
  36. package/dist/schemas/rave/user.d.ts +4 -4
  37. package/dist/schemas/rave/user.js +3 -3
  38. package/dist/schemas/responses.d.ts +63 -16
  39. package/dist/schemas/responses.d.ts.map +1 -1
  40. package/dist/schemas/responses.js +19 -2
  41. package/dist/utils/utils.d.ts +2 -0
  42. package/dist/utils/utils.d.ts.map +1 -1
  43. package/dist/utils/utils.js +11 -1
  44. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import { APIErrorData } from './schemas/error';
2
- export declare const VERSION = "1.5.2";
2
+ export declare const VERSION = "1.7.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";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAClD,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,cAAc,iCAAiC,CAAC;AAC7D,eAAO,MAAM,eAAe,mCAAmC,CAAC;AAChE,eAAO,MAAM,aAAa,6BAA6B,CAAC;AACxD,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,YAAY,yCAAyC,CAAC;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"}
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,CAyBlD,CAAC"}
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.2';
5
+ exports.VERSION = '1.7.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';
@@ -112,4 +112,8 @@ exports.CODES_MAP = {
112
112
  name: 'RaveJSException.RateLimitExceeded',
113
113
  message: 'Rate Limit Exceeded. Too many requests.',
114
114
  },
115
+ 500: {
116
+ name: 'RaveJSException.InternalServerError',
117
+ message: 'Internal Server Error. Something went wrong.',
118
+ },
115
119
  };
@@ -4,6 +4,7 @@ export declare class HttpWorkflow {
4
4
  private __headers;
5
5
  private __weMeshHeaders;
6
6
  get token(): string;
7
+ get weMeshToken(): string;
7
8
  set token(token: string);
8
9
  set weMeshToken(token: string);
9
10
  set popHeaders(key: string);
@@ -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,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,CAA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AAO,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
- return schema.parse(JSON.parse(response));
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
  }
@@ -2,15 +2,21 @@ 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>;
15
21
  }
16
22
  //# 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,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"}
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;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;CACH"}
package/dist/core/rave.js CHANGED
@@ -9,15 +9,34 @@ const mesh_factory_1 = require("../factories/mesh-factory");
9
9
  const user_factory_1 = require("../factories/user-factory");
10
10
  const logger_1 = __importDefault(require("../utils/logger"));
11
11
  const httpworkflow_1 = require("./httpworkflow");
12
+ const responses_1 = require("../schemas/responses");
13
+ const thread_factory_1 = require("../factories/thread-factory");
12
14
  class Rave {
13
15
  constructor(config = {}) {
14
- var _a;
16
+ var _a, _b;
17
+ this.refreshJWT = async (deviceId) => {
18
+ var _a, _b;
19
+ const { data } = await this.__http.sendGet({
20
+ 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)}`,
21
+ }, responses_1.ValidateMeSchema);
22
+ this.__http.weMeshToken = data;
23
+ return data;
24
+ };
15
25
  this.__config = config;
16
26
  this.__http = new httpworkflow_1.HttpWorkflow();
17
- if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token)
27
+ if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token) {
18
28
  this.__http.token = this.__config.credentials.token;
29
+ if ((_b = this.__config.credentials) === null || _b === void 0 ? void 0 : _b.autoJWT)
30
+ this.refreshJWT();
31
+ }
19
32
  (0, logger_1.default)(!!config.enableLogging);
20
33
  }
34
+ get token() {
35
+ return this.__http.token;
36
+ }
37
+ get JWT() {
38
+ return this.__http.weMeshToken;
39
+ }
21
40
  get auth() {
22
41
  if (!this.__authFactory)
23
42
  return (this.__authFactory = new auth_factory_1.AuthFactory(this.__config, this.__http));
@@ -33,5 +52,10 @@ class Rave {
33
52
  return (this.__meshFactory = new mesh_factory_1.MeshFactory(this.__config, this.__http));
34
53
  return this.__meshFactory;
35
54
  }
55
+ get thread() {
56
+ if (!this.__threadFactory)
57
+ return (this.__threadFactory = new thread_factory_1.ThreadFactory(this.__http));
58
+ return this.__threadFactory;
59
+ }
36
60
  }
37
61
  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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B,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
  }
@@ -6,6 +6,7 @@ export declare class MeshFactory {
6
6
  private readonly __http;
7
7
  constructor(config: RaveConfig | undefined, http: HttpWorkflow);
8
8
  get: (meshId: string) => Promise<GetMeshResponse>;
9
+ getByLink: (meshLink: string) => Promise<GetMeshResponse>;
9
10
  getMany: (params?: GetManyMeshesParams) => Promise<GetManyMeshesResponse>;
10
11
  }
11
12
  //# sourceMappingURL=mesh-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-factory.d.ts","sourceRoot":"","sources":["../../src/factories/mesh-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,qBAAqB,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"}
1
+ {"version":3,"file":"mesh-factory.d.ts","sourceRoot":"","sources":["../../src/factories/mesh-factory.ts"],"names":[],"mappings":"AAEA,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;AAG9B,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,MAAM,EAAE,UAAU,YAAK,EAAE,IAAI,EAAE,YAAY;IAKhD,GAAG,WAAkB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAO3D;IAEK,SAAS,aAAoB,MAAM,KAAG,OAAO,CAAC,eAAe,CAAC,CAYnE;IAEK,OAAO,YACJ,mBAAmB,KAK1B,OAAO,CAAC,qBAAqB,CAAC,CAO/B;CACH"}
@@ -1,8 +1,13 @@
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.MeshFactory = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
4
8
  const constants_1 = require("../constants");
5
9
  const responses_1 = require("../schemas/responses");
10
+ const utils_1 = require("../utils/utils");
6
11
  class MeshFactory {
7
12
  constructor(config = {}, http) {
8
13
  this.get = async (meshId) => {
@@ -10,6 +15,13 @@ class MeshFactory {
10
15
  path: `/meshes/${meshId}`,
11
16
  }, responses_1.GetMeshSchema);
12
17
  };
18
+ this.getByLink = async (meshLink) => {
19
+ const meshId = (0, utils_1.matchMeshId)(await this.__http.sendRaw({
20
+ method: 'GET',
21
+ path: meshLink,
22
+ }, zod_1.default.string()));
23
+ return await this.get(meshId);
24
+ };
13
25
  this.getMany = async (params = {
14
26
  limit: 20,
15
27
  language: constants_1.DEFAULT_LANGUAGE,
@@ -0,0 +1,11 @@
1
+ import { HttpWorkflow } from '../core/httpworkflow';
2
+ import { Thread } from '../schemas/rave/thread';
3
+ import { SendMessageResponse } from '../schemas/responses';
4
+ export declare class ThreadFactory {
5
+ private readonly __http;
6
+ constructor(http: HttpWorkflow);
7
+ getMany: () => Promise<Thread[]>;
8
+ create: (userId: number) => Promise<Thread>;
9
+ sendMessage: (threadId: string, content: string) => Promise<SendMessageResponse>;
10
+ }
11
+ //# 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;AAChD,OAAO,EAKL,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAG9B,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,IAAI,EAAE,YAAY;IAIvB,OAAO,QAAa,OAAO,CAAC,MAAM,EAAE,CAAC,CAS1C;IAEK,MAAM,WAAkB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAYrD;IAEK,WAAW,aACN,MAAM,WACP,MAAM,KACd,OAAO,CAAC,mBAAmB,CAAC,CAqB7B;CACH"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThreadFactory = void 0;
4
+ const responses_1 = require("../schemas/responses");
5
+ const utils_1 = require("../utils/utils");
6
+ class ThreadFactory {
7
+ constructor(http) {
8
+ this.getMany = async () => {
9
+ return (await this.__http.sendWeMeshGet({
10
+ path: '/dms',
11
+ }, responses_1.GetThreadsSchema)).data;
12
+ };
13
+ this.create = async (userId) => {
14
+ return (await this.__http.sendWeMeshPost({
15
+ path: '/dms/thread',
16
+ body: JSON.stringify({
17
+ targetUserId: userId,
18
+ }),
19
+ }, responses_1.GetThreadSchema)).data;
20
+ };
21
+ this.sendMessage = async (threadId, content) => {
22
+ const messageId = await (0, utils_1.generateMessageId)();
23
+ return await this.__http.sendWeMeshPost({
24
+ path: `/dms/thread/${threadId}`,
25
+ body: JSON.stringify({
26
+ correlateId: messageId,
27
+ messageBody: {
28
+ chat: content,
29
+ detected_lang: 'ru',
30
+ id: messageId,
31
+ translations: {
32
+ ru: content,
33
+ },
34
+ },
35
+ messageType: 'MESSAGE',
36
+ }),
37
+ }, responses_1.SendMessageSchema);
38
+ };
39
+ this.__http = http;
40
+ }
41
+ }
42
+ 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, SendFriendshipResponse } from '../schemas/responses';
3
+ import { EditProfileResponse, GetAvatarUploadResponse, GetUserResponse, FriendshipResponse } from '../schemas/responses';
4
4
  export declare class UserFactory {
5
5
  private readonly __http;
6
6
  constructor(http: HttpWorkflow);
7
+ private __friendshipRequests;
7
8
  get: (userId: number) => Promise<GetUserResponse>;
8
- sendFriendship: (userId: number) => Promise<SendFriendshipResponse>;
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,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
+ {"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.__http.sendPost({
19
- path: `/friendships`,
20
- body: JSON.stringify({ id: userId }),
21
- }, responses_1.SendFriendshipSchema);
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
- }, schemas_1.EditProfileBuilderSchema);
35
+ }, responses_1.EditProfileSchema);
28
36
  };
29
37
  this.getAvatarUpload = async () => {
30
38
  return await this.__http.sendPost({
@@ -1 +1 @@
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
+ {"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;;;;;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"}
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"}
@@ -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,
@@ -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
- weMeshJWT: z.ZodOptional<z.ZodString>;
14
+ autoJWT: z.ZodOptional<z.ZodBoolean>;
15
15
  }, z.core.$strip>>;
16
16
  enableLogging: z.ZodOptional<z.ZodBoolean>;
17
17
  }, z.core.$strip>;
@@ -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
- weMeshJWT: zod_1.default.string().optional(),
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.ZodFloat32;
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.ZodFloat32;
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.float32(),
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.float32(),
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,19 @@
1
+ import z from 'zod';
2
+ export declare const MessageSchema: z.ZodPipe<z.ZodObject<{
3
+ chat: z.ZodString;
4
+ detected_lang: z.ZodString;
5
+ id: z.ZodString;
6
+ translations: z.ZodRecord<z.ZodString, z.ZodString>;
7
+ }, z.core.$strip>, z.ZodTransform<{
8
+ content: string;
9
+ detectedLang: string;
10
+ id: string;
11
+ translations: Record<string, string>;
12
+ }, {
13
+ chat: string;
14
+ detected_lang: string;
15
+ id: string;
16
+ translations: Record<string, string>;
17
+ }>>;
18
+ export type Message = z.infer<typeof MessageSchema>;
19
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/schemas/rave/message.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;GActB,CAAC;AAEL,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,22 @@
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.MessageSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.MessageSchema = zod_1.default
9
+ .object({
10
+ chat: zod_1.default.string(),
11
+ detected_lang: zod_1.default.string(),
12
+ id: zod_1.default.string(),
13
+ translations: zod_1.default.record(zod_1.default.string(), zod_1.default.string()),
14
+ })
15
+ .transform((data) => {
16
+ return {
17
+ content: data.chat,
18
+ detectedLang: data.detected_lang,
19
+ id: data.id,
20
+ translations: data.translations,
21
+ };
22
+ });
@@ -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.ZodFloat32;
10
- lng: z.ZodFloat32;
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.float32(),
16
- lng: zod_1.default.float32(),
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.ZodFloat32;
11
- lng: z.ZodFloat32;
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.ZodFloat32;
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.ZodFloat32;
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.ZodFloat32;
157
- lng: z.ZodFloat32;
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.ZodFloat32;
175
- lng: z.ZodFloat32;
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.ZodFloat32;
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.ZodFloat32;
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 SendFriendshipSchema: z.ZodObject<{
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,50 @@ 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>;
258
+ export declare const GetThreadSchema: z.ZodObject<{
259
+ data: z.ZodObject<{
260
+ expiryMode: z.ZodNumber;
261
+ isFriend: z.ZodBoolean;
262
+ myself: z.ZodNumber;
263
+ opposingUser: z.ZodNumber;
264
+ spokenLangs: z.ZodArray<z.ZodString>;
265
+ threadId: z.ZodString;
266
+ }, z.core.$strip>;
267
+ }, z.core.$strip>;
268
+ export declare const SendMessageSchema: z.ZodObject<{
269
+ data: z.ZodObject<{
270
+ correlateId: z.ZodString;
271
+ threadId: z.ZodString;
272
+ messageType: z.ZodString;
273
+ originator: z.ZodNumber;
274
+ messageBody: z.ZodPipe<z.ZodObject<{
275
+ chat: z.ZodString;
276
+ detected_lang: z.ZodString;
277
+ id: z.ZodString;
278
+ translations: z.ZodRecord<z.ZodString, z.ZodString>;
279
+ }, z.core.$strip>, z.ZodTransform<{
280
+ content: string;
281
+ detectedLang: string;
282
+ id: string;
283
+ translations: Record<string, string>;
284
+ }, {
285
+ chat: string;
286
+ detected_lang: string;
287
+ id: string;
288
+ translations: Record<string, string>;
289
+ }>>;
290
+ }, z.core.$strip>;
291
+ }, z.core.$strip>;
248
292
  export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
249
293
  export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
250
294
  export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
@@ -255,6 +299,9 @@ export type GetAvatarUploadResponse = z.infer<typeof GetAvatarUploadSchema>;
255
299
  export type GetManyMeshesResponse = z.infer<typeof GetManyMeshesSchema>;
256
300
  export type GetMeshResponse = z.infer<typeof GetMeshSchema>;
257
301
  export type GetUserResponse = z.infer<typeof GetUserSchema>;
258
- export type SendFriendshipResponse = z.infer<typeof SendFriendshipSchema>;
302
+ export type FriendshipResponse = z.infer<typeof FriendshipSchema>;
259
303
  export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
304
+ export type GetThreadsResponse = z.infer<typeof GetThreadsSchema>;
305
+ export type GetThreadResponse = z.infer<typeof GetThreadSchema>;
306
+ export type SendMessageResponse = z.infer<typeof SendMessageSchema>;
260
307
  //# 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;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,CA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AC,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;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -3,11 +3,13 @@ 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.SendFriendshipSchema = exports.GetUserSchema = exports.GetMeshSchema = exports.GetManyMeshesSchema = exports.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
6
+ exports.SendMessageSchema = exports.GetThreadSchema = exports.GetThreadsSchema = exports.ValidateMeSchema = exports.FriendshipSchema = exports.GetUserSchema = exports.GetMeshSchema = exports.GetManyMeshesSchema = exports.GetAvatarUploadSchema = exports.AuthenticateSchema = exports.MojoLoginSchema = exports.ParseUserCredentialsSchema = exports.CheckRegisterStateSchema = exports.SendMagicLinkSchema = exports.EditProfileSchema = void 0;
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");
12
+ const message_1 = require("./rave/message");
11
13
  exports.EditProfileSchema = zod_1.default.object({
12
14
  data: user_1.UserSchema,
13
15
  });
@@ -119,7 +121,7 @@ exports.GetUserSchema = zod_1.default.object({
119
121
  profile: user_1.ProfileSchema,
120
122
  }),
121
123
  });
122
- exports.SendFriendshipSchema = zod_1.default.object({
124
+ exports.FriendshipSchema = zod_1.default.object({
123
125
  data: zod_1.default.object({
124
126
  fromUserId: zod_1.default.number(),
125
127
  state: zod_1.default.string(),
@@ -129,3 +131,18 @@ exports.SendFriendshipSchema = zod_1.default.object({
129
131
  exports.ValidateMeSchema = zod_1.default.object({
130
132
  data: zod_1.default.string(),
131
133
  });
134
+ exports.GetThreadsSchema = zod_1.default.object({
135
+ data: zod_1.default.array(thread_1.ThreadSchema),
136
+ });
137
+ exports.GetThreadSchema = zod_1.default.object({
138
+ data: thread_1.ThreadSchema,
139
+ });
140
+ exports.SendMessageSchema = zod_1.default.object({
141
+ data: zod_1.default.object({
142
+ correlateId: zod_1.default.string(),
143
+ threadId: zod_1.default.string(),
144
+ messageType: zod_1.default.string(),
145
+ originator: zod_1.default.number(),
146
+ messageBody: message_1.MessageSchema,
147
+ }),
148
+ });
@@ -1,2 +1,4 @@
1
1
  export declare const isOk: (status: number) => boolean;
2
+ export declare const matchMeshId: (text: string) => string;
3
+ export declare const generateMessageId: () => Promise<string>;
2
4
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,WAAY,MAAM,YAAkC,CAAC"}
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;AACf,eAAO,MAAM,iBAAiB,uBAG7B,CAAC"}
@@ -1,5 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isOk = void 0;
3
+ exports.generateMessageId = 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;
11
+ const generateMessageId = async () => {
12
+ const { v4 } = await import('uuid');
13
+ return v4();
14
+ };
15
+ exports.generateMessageId = generateMessageId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravejs",
3
- "version": "1.5.2",
3
+ "version": "1.7.3",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -44,6 +44,7 @@
44
44
  "dependencies": {
45
45
  "pino": "^10.1.0",
46
46
  "pino-pretty": "^13.1.3",
47
+ "uuid": "^13.0.0",
47
48
  "zod": "^4.1.13"
48
49
  }
49
50
  }