@mobilon-dev/chotto 0.3.110 → 0.3.111
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/chotto.css +1 -1
- package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue.js +2 -2
- package/dist/components/2_feed_elements/FeedReplyQuote/FeedReplyQuote.vue2.js +14 -11
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/ImageMessage/ImageMessage.vue2.js +170 -170
- package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/ReplyImageMessage/ReplyImageMessage.vue2.js +27 -27
- package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue.js +1 -1
- package/dist/components/2_feed_elements/ReplyVideoMessage/ReplyVideoMessage.vue2.js +48 -35
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue.js +3 -3
- package/dist/components/2_feed_elements/VideoMessage/VideoMessage.vue2.js +297 -286
- package/dist/hooks/messages/buildReplyPayload.js +12 -9
- package/dist/hooks/validators/messages/messageValidator.js +48 -48
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/src/apps/data/messages.d.ts +288 -0
- package/dist/types/src/components/2_feed_elements/ImageMessage/stories/ImageMessage.stories.d.ts +2 -0
- package/dist/types/src/components/2_feed_elements/ReplyVideoMessage/styles/types.d.ts +32 -0
- package/dist/types/src/components/2_feed_elements/VideoMessage/stories/VideoMessage.stories.d.ts +3 -0
- package/dist/types/src/components/2_feed_elements/VideoMessage/styles/types.d.ts +32 -0
- package/dist/types/src/components/2_feed_elements/types/components.d.ts +6 -0
- package/dist/types/src/components/2_feed_elements/types/messages.d.ts +12 -0
- package/dist/types/src/hooks/messages/buildReplyPayload.d.ts +3 -0
- package/dist/types/src/hooks/validators/messages/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
function r
|
|
1
|
+
function e(r, l) {
|
|
2
2
|
return {
|
|
3
|
-
messageId: String(
|
|
4
|
-
type:
|
|
5
|
-
text:
|
|
6
|
-
filename:
|
|
7
|
-
url:
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
messageId: String(r.messageId),
|
|
4
|
+
type: r.type ?? l,
|
|
5
|
+
text: r.text,
|
|
6
|
+
filename: r.filename,
|
|
7
|
+
url: r.url,
|
|
8
|
+
imagePreviewUrl: r.imagePreviewUrl,
|
|
9
|
+
videoPreviewUrl: r.videoPreviewUrl,
|
|
10
|
+
coverUrl: r.coverUrl,
|
|
11
|
+
header: r.header,
|
|
12
|
+
callDuration: r.callDuration
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
export {
|
|
13
|
-
|
|
16
|
+
e as buildReplyPayload
|
|
14
17
|
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
return typeof
|
|
1
|
+
function v(e, o) {
|
|
2
|
+
const t = [], i = `messages[${o}].reply`;
|
|
3
|
+
return typeof e != "object" || e === null ? (t.push({ path: i, message: "Reply должен быть объектом", value: e }), t) : (e.messageId === void 0 ? t.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: e.messageId }) : typeof e.messageId != "string" && typeof e.messageId != "number" && t.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: e.messageId }), (!e.type || typeof e.type != "string") && t.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: e.type }), e.text !== void 0 && typeof e.text != "string" && t.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: e.text }), e.url !== void 0 && typeof e.url != "string" && t.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: e.url }), e.imagePreviewUrl !== void 0 && typeof e.imagePreviewUrl != "string" && t.push({ path: `${i}.imagePreviewUrl`, message: "Поле imagePreviewUrl должно быть строкой", value: e.imagePreviewUrl }), e.videoPreviewUrl !== void 0 && typeof e.videoPreviewUrl != "string" && t.push({ path: `${i}.videoPreviewUrl`, message: "Поле videoPreviewUrl должно быть строкой", value: e.videoPreviewUrl }), e.coverUrl !== void 0 && typeof e.coverUrl != "string" && t.push({ path: `${i}.coverUrl`, message: "Поле coverUrl должно быть строкой", value: e.coverUrl }), e.filename !== void 0 && typeof e.filename != "string" && t.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: e.filename }), t);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (typeof
|
|
8
|
-
return
|
|
9
|
-
if (
|
|
5
|
+
function s(e, o) {
|
|
6
|
+
const t = [], i = `messages[${o}]`;
|
|
7
|
+
if (typeof e != "object" || e === null)
|
|
8
|
+
return t.push({ path: i, message: "Сообщение должно быть объектом", value: e }), t;
|
|
9
|
+
if (e.chatId !== void 0 && typeof e.chatId != "string" && t.push({ path: `${i}.chatId`, message: "Поле chatId должно быть строкой", value: e.chatId }), e.type !== "system.date" && (e.messageId === void 0 ? t.push({ path: `${i}.messageId`, message: "Поле messageId обязательно", value: e.messageId }) : typeof e.messageId != "string" && typeof e.messageId != "number" && t.push({ path: `${i}.messageId`, message: "Поле messageId должно быть строкой или числом", value: e.messageId })), (!e.type || typeof e.type != "string") && t.push({ path: `${i}.type`, message: "Поле type обязательно и должно быть строкой", value: e.type }), e.type !== "system.date" && (e.timestamp === void 0 ? t.push({ path: `${i}.timestamp`, message: "Поле timestamp обязательно", value: e.timestamp }) : typeof e.timestamp != "string" && typeof e.timestamp != "number" && t.push({ path: `${i}.timestamp`, message: "Поле timestamp должно быть строкой или числом", value: e.timestamp })), e.dialogId !== void 0 && typeof e.dialogId != "string" && t.push({ path: `${i}.dialogId`, message: "Поле dialogId должно быть строкой", value: e.dialogId }), e.direction !== void 0) {
|
|
10
10
|
const a = ["incoming", "outgoing"];
|
|
11
|
-
a.includes(
|
|
11
|
+
a.includes(e.direction) || t.push({
|
|
12
12
|
path: `${i}.direction`,
|
|
13
13
|
message: `Поле direction должно быть одним из: ${a.join(", ")}`,
|
|
14
|
-
value:
|
|
14
|
+
value: e.direction
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
if (
|
|
17
|
+
if (e.status !== void 0) {
|
|
18
18
|
const a = ["read", "sent", "received"];
|
|
19
|
-
a.includes(
|
|
19
|
+
a.includes(e.status) || t.push({
|
|
20
20
|
path: `${i}.status`,
|
|
21
21
|
message: `Поле status должно быть одним из: ${a.join(", ")}`,
|
|
22
|
-
value:
|
|
22
|
+
value: e.status
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return e.text !== void 0 && typeof e.text != "string" && t.push({ path: `${i}.text`, message: "Поле text должно быть строкой", value: e.text }), e.header !== void 0 && typeof e.header != "string" && t.push({ path: `${i}.header`, message: "Поле header должно быть строкой", value: e.header }), e.subText !== void 0 && typeof e.subText != "string" && t.push({ path: `${i}.subText`, message: "Поле subText должно быть строкой", value: e.subText }), e.avatar !== void 0 && typeof e.avatar != "string" && t.push({ path: `${i}.avatar`, message: "Поле avatar должно быть строкой", value: e.avatar }), e.url !== void 0 && typeof e.url != "string" && t.push({ path: `${i}.url`, message: "Поле url должно быть строкой", value: e.url }), e.imagePreviewUrl !== void 0 && typeof e.imagePreviewUrl != "string" && t.push({ path: `${i}.imagePreviewUrl`, message: "Поле imagePreviewUrl должно быть строкой", value: e.imagePreviewUrl }), e.videoPreviewUrl !== void 0 && typeof e.videoPreviewUrl != "string" && t.push({ path: `${i}.videoPreviewUrl`, message: "Поле videoPreviewUrl должно быть строкой", value: e.videoPreviewUrl }), e.coverUrl !== void 0 && typeof e.coverUrl != "string" && t.push({ path: `${i}.coverUrl`, message: "Поле coverUrl должно быть строкой", value: e.coverUrl }), e.filename !== void 0 && typeof e.filename != "string" && t.push({ path: `${i}.filename`, message: "Поле filename должно быть строкой", value: e.filename }), e.views !== void 0 && typeof e.views != "number" && t.push({ path: `${i}.views`, message: "Поле views должно быть числом", value: e.views }), e.reply !== void 0 && t.push(...v(e.reply, o)), e.embed !== void 0 && (typeof e.embed != "object" || e.embed === null ? t.push({ path: `${i}.embed`, message: "Поле embed должно быть объектом", value: e.embed }) : ((!e.embed.type || typeof e.embed.type != "string") && t.push({ path: `${i}.embed.type`, message: "Поле embed.type обязательно и должно быть строкой", value: e.embed.type }), (!e.embed.url || typeof e.embed.url != "string") && t.push({ path: `${i}.embed.url`, message: "Поле embed.url обязательно и должно быть строкой", value: e.embed.url }))), t;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (!Array.isArray(
|
|
27
|
+
function h(e) {
|
|
28
|
+
const o = [], t = [];
|
|
29
|
+
if (!Array.isArray(e))
|
|
30
30
|
return {
|
|
31
31
|
isValid: !1,
|
|
32
|
-
errors: [{ path: "messages", message: "Данные должны быть массивом", value:
|
|
32
|
+
errors: [{ path: "messages", message: "Данные должны быть массивом", value: e }],
|
|
33
33
|
warnings: []
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
e.length === 0 && t.push({ path: "messages", message: "Массив сообщений пустой" });
|
|
36
36
|
const i = /* @__PURE__ */ new Map();
|
|
37
|
-
return
|
|
37
|
+
return e.forEach((a, d) => {
|
|
38
38
|
if (a && typeof a == "object" && a.chatId !== void 0 && a.messageId !== void 0) {
|
|
39
|
-
const
|
|
40
|
-
i.has(
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
path: `messages[${
|
|
46
|
-
message: `Дублирующийся messageId ${
|
|
39
|
+
const r = a.dialogId ? `${a.chatId}:${a.dialogId}` : `${a.chatId}`;
|
|
40
|
+
i.has(r) || i.set(r, /* @__PURE__ */ new Set());
|
|
41
|
+
const u = i.get(r);
|
|
42
|
+
if (u.has(a.messageId)) {
|
|
43
|
+
const p = a.dialogId ? `в чате ${a.chatId}, диалоге ${a.dialogId}` : `в чате ${a.chatId}`;
|
|
44
|
+
o.push({
|
|
45
|
+
path: `messages[${d}].messageId`,
|
|
46
|
+
message: `Дублирующийся messageId ${p}`,
|
|
47
47
|
value: a.messageId
|
|
48
48
|
});
|
|
49
49
|
} else
|
|
50
|
-
|
|
50
|
+
u.add(a.messageId);
|
|
51
51
|
}
|
|
52
|
-
}),
|
|
53
|
-
|
|
52
|
+
}), e.forEach((a, d) => {
|
|
53
|
+
o.push(...s(a, d));
|
|
54
54
|
}), {
|
|
55
|
-
isValid:
|
|
56
|
-
errors:
|
|
57
|
-
warnings:
|
|
55
|
+
isValid: o.length === 0,
|
|
56
|
+
errors: o,
|
|
57
|
+
warnings: t
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function l(
|
|
61
|
-
const
|
|
62
|
-
return
|
|
63
|
-
`),
|
|
64
|
-
`) :
|
|
65
|
-
`),
|
|
66
|
-
🔴 ОШИБКИ (${
|
|
67
|
-
|
|
68
|
-
})),
|
|
69
|
-
⚠️ ПРЕДУПРЕЖДЕНИЯ (${
|
|
70
|
-
|
|
71
|
-
})),
|
|
72
|
-
` + "=".repeat(40)),
|
|
60
|
+
function l(e) {
|
|
61
|
+
const o = [];
|
|
62
|
+
return o.push(`=== РЕЗУЛЬТАТ ВАЛИДАЦИИ СООБЩЕНИЙ ===
|
|
63
|
+
`), e.isValid ? o.push(`✅ Данные валидны!
|
|
64
|
+
`) : o.push(`❌ Обнаружены ошибки!
|
|
65
|
+
`), e.errors.length > 0 && (o.push(`
|
|
66
|
+
🔴 ОШИБКИ (${e.errors.length}):`), e.errors.forEach((t, i) => {
|
|
67
|
+
o.push(` ${i + 1}. [${t.path}] ${t.message}`), t.value !== void 0 && o.push(` Значение: ${JSON.stringify(t.value)}`);
|
|
68
|
+
})), e.warnings.length > 0 && (o.push(`
|
|
69
|
+
⚠️ ПРЕДУПРЕЖДЕНИЯ (${e.warnings.length}):`), e.warnings.forEach((t, i) => {
|
|
70
|
+
o.push(` ${i + 1}. [${t.path}] ${t.message}`), t.value !== void 0 && o.push(` Значение: ${JSON.stringify(t.value)}`);
|
|
71
|
+
})), o.push(`
|
|
72
|
+
` + "=".repeat(40)), o.join(`
|
|
73
73
|
`);
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
l as getMessageValidationReport,
|
|
77
|
-
|
|
77
|
+
h as validateMessages
|
|
78
78
|
};
|