ravejs 1.6.3 → 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.
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/core/rave.d.ts +0 -1
- package/dist/core/rave.d.ts.map +1 -1
- package/dist/core/rave.js +0 -8
- package/dist/factories/mesh-factory.d.ts +1 -0
- package/dist/factories/mesh-factory.d.ts.map +1 -1
- package/dist/factories/mesh-factory.js +12 -0
- package/dist/factories/thread-factory.d.ts +3 -0
- package/dist/factories/thread-factory.d.ts.map +1 -1
- package/dist/factories/thread-factory.js +27 -0
- package/dist/schemas/rave/message.d.ts +19 -0
- package/dist/schemas/rave/message.d.ts.map +1 -0
- package/dist/schemas/rave/message.js +22 -0
- package/dist/schemas/responses.d.ts +36 -0
- package/dist/schemas/responses.d.ts.map +1 -1
- package/dist/schemas/responses.js +14 -1
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +6 -1
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIErrorData } from './schemas/error';
|
|
2
|
-
export declare const VERSION = "1.
|
|
2
|
+
export declare const VERSION = "1.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";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,OAAO,6BAA6B,CAAC;AACl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AC;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
|
+
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
|
};
|
package/dist/core/rave.d.ts
CHANGED
package/dist/core/rave.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rave.d.ts","sourceRoot":"","sources":["../../src/core/rave.ts"],"names":[],"mappings":"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
|
@@ -4,13 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Rave = void 0;
|
|
7
|
-
const zod_1 = __importDefault(require("zod"));
|
|
8
7
|
const auth_factory_1 = require("../factories/auth-factory");
|
|
9
8
|
const mesh_factory_1 = require("../factories/mesh-factory");
|
|
10
9
|
const user_factory_1 = require("../factories/user-factory");
|
|
11
10
|
const logger_1 = __importDefault(require("../utils/logger"));
|
|
12
11
|
const httpworkflow_1 = require("./httpworkflow");
|
|
13
|
-
const utils_1 = require("../utils/utils");
|
|
14
12
|
const responses_1 = require("../schemas/responses");
|
|
15
13
|
const thread_factory_1 = require("../factories/thread-factory");
|
|
16
14
|
class Rave {
|
|
@@ -24,12 +22,6 @@ class Rave {
|
|
|
24
22
|
this.__http.weMeshToken = data;
|
|
25
23
|
return data;
|
|
26
24
|
};
|
|
27
|
-
this.getMeshByLink = async (meshLink) => {
|
|
28
|
-
return (0, utils_1.matchMeshId)(await this.__http.sendRaw({
|
|
29
|
-
method: 'GET',
|
|
30
|
-
path: meshLink,
|
|
31
|
-
}, zod_1.default.string()));
|
|
32
|
-
};
|
|
33
25
|
this.__config = config;
|
|
34
26
|
this.__http = new httpworkflow_1.HttpWorkflow();
|
|
35
27
|
if ((_a = this.__config.credentials) === null || _a === void 0 ? void 0 : _a.token) {
|
|
@@ -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":"
|
|
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,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { HttpWorkflow } from '../core/httpworkflow';
|
|
2
2
|
import { Thread } from '../schemas/rave/thread';
|
|
3
|
+
import { SendMessageResponse } from '../schemas/responses';
|
|
3
4
|
export declare class ThreadFactory {
|
|
4
5
|
private readonly __http;
|
|
5
6
|
constructor(http: HttpWorkflow);
|
|
6
7
|
getMany: () => Promise<Thread[]>;
|
|
8
|
+
create: (userId: number) => Promise<Thread>;
|
|
9
|
+
sendMessage: (threadId: string, content: string) => Promise<SendMessageResponse>;
|
|
7
10
|
}
|
|
8
11
|
//# sourceMappingURL=thread-factory.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThreadFactory = void 0;
|
|
4
4
|
const responses_1 = require("../schemas/responses");
|
|
5
|
+
const utils_1 = require("../utils/utils");
|
|
5
6
|
class ThreadFactory {
|
|
6
7
|
constructor(http) {
|
|
7
8
|
this.getMany = async () => {
|
|
@@ -9,6 +10,32 @@ class ThreadFactory {
|
|
|
9
10
|
path: '/dms',
|
|
10
11
|
}, responses_1.GetThreadsSchema)).data;
|
|
11
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
|
+
};
|
|
12
39
|
this.__http = http;
|
|
13
40
|
}
|
|
14
41
|
}
|
|
@@ -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
|
+
});
|
|
@@ -255,6 +255,40 @@ export declare const GetThreadsSchema: z.ZodObject<{
|
|
|
255
255
|
threadId: z.ZodString;
|
|
256
256
|
}, z.core.$strip>>;
|
|
257
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>;
|
|
258
292
|
export type EditProfileResponse = z.infer<typeof EditProfileSchema>;
|
|
259
293
|
export type SendMagicLinkResponse = z.infer<typeof SendMagicLinkSchema>;
|
|
260
294
|
export type CheckRegisterStateResponse = z.infer<typeof CheckRegisterStateSchema>;
|
|
@@ -268,4 +302,6 @@ export type GetUserResponse = z.infer<typeof GetUserSchema>;
|
|
|
268
302
|
export type FriendshipResponse = z.infer<typeof FriendshipSchema>;
|
|
269
303
|
export type ValidateMeResponse = z.infer<typeof ValidateMeSchema>;
|
|
270
304
|
export type GetThreadsResponse = z.infer<typeof GetThreadsSchema>;
|
|
305
|
+
export type GetThreadResponse = z.infer<typeof GetThreadSchema>;
|
|
306
|
+
export type SendMessageResponse = z.infer<typeof SendMessageSchema>;
|
|
271
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;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAQpB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBAE5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;GAQ5B,CAAC;AAEL,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDjC,CAAC;AAEL,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;iBAM1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;iBAOhC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQ9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAWxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;iBAM3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;iBAE3B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;iBAE1B,CAAC;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AAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -3,12 +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.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;
|
|
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
11
|
const thread_1 = require("./rave/thread");
|
|
12
|
+
const message_1 = require("./rave/message");
|
|
12
13
|
exports.EditProfileSchema = zod_1.default.object({
|
|
13
14
|
data: user_1.UserSchema,
|
|
14
15
|
});
|
|
@@ -133,3 +134,15 @@ exports.ValidateMeSchema = zod_1.default.object({
|
|
|
133
134
|
exports.GetThreadsSchema = zod_1.default.object({
|
|
134
135
|
data: zod_1.default.array(thread_1.ThreadSchema),
|
|
135
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
|
+
});
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,WAAY,MAAM,YAAkC,CAAC;AACtE,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAG7B,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"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.matchMeshId = 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
6
|
const matchMeshId = (text) => {
|
|
@@ -8,3 +8,8 @@ const matchMeshId = (text) => {
|
|
|
8
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
9
|
};
|
|
10
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.
|
|
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
|
}
|