@pachca/cli 2026.3.9 → 2026.3.10
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/CHANGELOG.md +6 -0
- package/dist/commands/chats/list.js +8 -8
- package/dist/commands/messages/create.js +9 -3
- package/dist/commands/messages/list.js +9 -4
- package/dist/commands/security/list.js +0 -29
- package/dist/data/changelog.json +21 -0
- package/oclif.manifest.json +1 -12576
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.3.10 (21 марта 2026)
|
|
4
|
+
|
|
5
|
+
- **Изменено** (messages create): Поле link_preview перемещено на верхний уровень тела запроса (раньше было внутри message)
|
|
6
|
+
- **Изменено** (security list): Параметры start-time и end-time стали необязательными
|
|
7
|
+
- **Изменено** (chats list, messages list): Сортировка через --sort и --order вместо --sort-id и --sort-last-message-at
|
|
8
|
+
|
|
3
9
|
## 2026.3.9 (19 марта 2026)
|
|
4
10
|
|
|
5
11
|
- **Изменено** (all): Убрана клиентская валидация скоупов — проверка разрешений теперь только на стороне API (403)
|
|
@@ -15,11 +15,13 @@ export default class ChatsList extends BaseCommand {
|
|
|
15
15
|
static args = {};
|
|
16
16
|
static flags = {
|
|
17
17
|
...BaseCommand.baseFlags,
|
|
18
|
-
|
|
19
|
-
description: "
|
|
18
|
+
sort: Flags.string({
|
|
19
|
+
description: "Поле сортировки (id — идентификатор чата, last-message-at — дата и время создания последнего сообщения)",
|
|
20
|
+
options: ["id", "last-message-at"],
|
|
20
21
|
}),
|
|
21
|
-
|
|
22
|
-
description: "
|
|
22
|
+
order: Flags.string({
|
|
23
|
+
description: "Порядок сортировки",
|
|
24
|
+
options: ["asc", "desc"],
|
|
23
25
|
}),
|
|
24
26
|
'availability': Flags.string({
|
|
25
27
|
description: "Параметр, который отвечает за доступность и выборку чатов для пользователя",
|
|
@@ -56,8 +58,7 @@ export default class ChatsList extends BaseCommand {
|
|
|
56
58
|
const seenCursors = new Set();
|
|
57
59
|
while (pages < 500) {
|
|
58
60
|
const query = {
|
|
59
|
-
|
|
60
|
-
'sort[last_message_at]': flags['sort-last-message-at'],
|
|
61
|
+
...(flags.sort ? { [`sort[${flags.sort.replace(/-/g, '_')}]`]: flags.order || 'desc' } : {}),
|
|
61
62
|
availability: flags['availability'],
|
|
62
63
|
'last_message_at_after': flags['last-message-at-after'],
|
|
63
64
|
'last_message_at_before': flags['last-message-at-before'],
|
|
@@ -99,8 +100,7 @@ export default class ChatsList extends BaseCommand {
|
|
|
99
100
|
method: 'GET',
|
|
100
101
|
path: '/chats',
|
|
101
102
|
query: {
|
|
102
|
-
|
|
103
|
-
'sort[last_message_at]': flags['sort-last-message-at'],
|
|
103
|
+
...(flags.sort ? { [`sort[${flags.sort.replace(/-/g, '_')}]`]: flags.order || 'desc' } : {}),
|
|
104
104
|
availability: flags['availability'],
|
|
105
105
|
'last_message_at_after': flags['last-message-at-after'],
|
|
106
106
|
'last_message_at_before': flags['last-message-at-before'],
|
|
@@ -98,7 +98,8 @@ export default class MessagesCreate extends BaseCommand {
|
|
|
98
98
|
if (validationErrors.length > 0) {
|
|
99
99
|
this.validationError(validationErrors);
|
|
100
100
|
}
|
|
101
|
-
const body = {
|
|
101
|
+
const body = {
|
|
102
|
+
message: {
|
|
102
103
|
entity_type: flags['entity-type'],
|
|
103
104
|
entity_id: flags['entity-id'],
|
|
104
105
|
content: flags['content'],
|
|
@@ -108,14 +109,19 @@ export default class MessagesCreate extends BaseCommand {
|
|
|
108
109
|
display_avatar_url: flags['display-avatar-url'],
|
|
109
110
|
display_name: flags['display-name'],
|
|
110
111
|
skip_invite_mentions: flags['skip-invite-mentions'],
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
},
|
|
113
|
+
link_preview: flags['link-preview'],
|
|
114
|
+
};
|
|
113
115
|
// Clean undefined fields
|
|
114
116
|
const inner = body['message'];
|
|
115
117
|
for (const [k, v] of Object.entries(inner)) {
|
|
116
118
|
if (v === undefined)
|
|
117
119
|
delete inner[k];
|
|
118
120
|
}
|
|
121
|
+
for (const [k, v] of Object.entries(body)) {
|
|
122
|
+
if (k !== 'message' && v === undefined)
|
|
123
|
+
delete body[k];
|
|
124
|
+
}
|
|
119
125
|
const { data } = await this.apiRequest({
|
|
120
126
|
method: 'POST',
|
|
121
127
|
path: '/messages',
|
|
@@ -20,8 +20,13 @@ export default class MessagesList extends BaseCommand {
|
|
|
20
20
|
'chat-id': Flags.integer({
|
|
21
21
|
description: "Идентификатор чата (беседа, канал, диалог или чат треда)",
|
|
22
22
|
}),
|
|
23
|
-
|
|
24
|
-
description: "
|
|
23
|
+
sort: Flags.string({
|
|
24
|
+
description: "Поле сортировки (id — идентификатор сообщения)",
|
|
25
|
+
options: ["id"],
|
|
26
|
+
}),
|
|
27
|
+
order: Flags.string({
|
|
28
|
+
description: "Порядок сортировки",
|
|
29
|
+
options: ["asc", "desc"],
|
|
25
30
|
}),
|
|
26
31
|
limit: Flags.integer({
|
|
27
32
|
description: 'Количество результатов на страницу',
|
|
@@ -72,7 +77,7 @@ export default class MessagesList extends BaseCommand {
|
|
|
72
77
|
while (pages < 500) {
|
|
73
78
|
const query = {
|
|
74
79
|
'chat_id': flags['chat-id'],
|
|
75
|
-
|
|
80
|
+
...(flags.sort ? { [`sort[${flags.sort.replace(/-/g, '_')}]`]: flags.order || 'desc' } : {}),
|
|
76
81
|
limit: flags.limit,
|
|
77
82
|
cursor: nextCursor,
|
|
78
83
|
};
|
|
@@ -111,7 +116,7 @@ export default class MessagesList extends BaseCommand {
|
|
|
111
116
|
path: '/messages',
|
|
112
117
|
query: {
|
|
113
118
|
'chat_id': flags['chat-id'],
|
|
114
|
-
|
|
119
|
+
...(flags.sort ? { [`sort[${flags.sort.replace(/-/g, '_')}]`]: flags.order || 'desc' } : {}),
|
|
115
120
|
limit: flags.limit,
|
|
116
121
|
cursor: flags.cursor,
|
|
117
122
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Auto-generated from openapi.yaml — DO NOT EDIT
|
|
2
2
|
import { Flags } from '@oclif/core';
|
|
3
3
|
import { BaseCommand } from '../../base-command.js';
|
|
4
|
-
import * as clack from '@clack/prompts';
|
|
5
4
|
export default class SecurityList extends BaseCommand {
|
|
6
5
|
static description = "Журнал аудита событий";
|
|
7
6
|
static examples = [
|
|
@@ -14,7 +13,6 @@ export default class SecurityList extends BaseCommand {
|
|
|
14
13
|
static apiMethod = "GET";
|
|
15
14
|
static apiPath = "/audit_events";
|
|
16
15
|
static defaultColumns = ["id", "created_at", "event_key", "entity_id", "entity_type"];
|
|
17
|
-
static requiredFlags = ["start-time", "end-time"];
|
|
18
16
|
static args = {};
|
|
19
17
|
static flags = {
|
|
20
18
|
...BaseCommand.baseFlags,
|
|
@@ -54,33 +52,6 @@ export default class SecurityList extends BaseCommand {
|
|
|
54
52
|
async run() {
|
|
55
53
|
const { args, flags } = await this.parse(SecurityList);
|
|
56
54
|
this.parsedFlags = flags;
|
|
57
|
-
const missingRequired = [
|
|
58
|
-
{ flag: 'start-time', label: "Начальная метка времени (включительно)", type: 'string' },
|
|
59
|
-
{ flag: 'end-time', label: "Конечная метка времени (исключительно)", type: 'string' },
|
|
60
|
-
].filter((f) => flags[f.flag] === undefined || flags[f.flag] === null);
|
|
61
|
-
if (missingRequired.length > 0) {
|
|
62
|
-
if (this.isInteractive()) {
|
|
63
|
-
for (const field of missingRequired) {
|
|
64
|
-
const value = await clack.text({ message: field.label, validate: (v) => v.length === 0 ? 'Обязательное поле' : undefined });
|
|
65
|
-
if (clack.isCancel(value)) {
|
|
66
|
-
process.stderr.write('Отменено.\n');
|
|
67
|
-
this.exit(0);
|
|
68
|
-
}
|
|
69
|
-
if (field.type === 'integer') {
|
|
70
|
-
flags[field.flag] = Number.parseInt(value, 10);
|
|
71
|
-
}
|
|
72
|
-
else if (field.type === 'boolean') {
|
|
73
|
-
flags[field.flag] = value === 'true';
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
flags[field.flag] = value;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
this.validationError(missingRequired.map((f) => ({ message: `Обязательный флаг --${f.flag} не передан`, flag: f.flag })), { hint: "Обязательные: --start-time <string>, --end-time <string>. pachca introspect security list" });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
55
|
if (flags.all) {
|
|
85
56
|
// Auto-pagination
|
|
86
57
|
const allData = [];
|
package/dist/data/changelog.json
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "2026.3.10",
|
|
4
|
+
"date": "21 марта 2026",
|
|
5
|
+
"changes": [
|
|
6
|
+
{
|
|
7
|
+
"type": "~",
|
|
8
|
+
"command": "messages create",
|
|
9
|
+
"description": "Поле link_preview перемещено на верхний уровень тела запроса (раньше было внутри message)"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "~",
|
|
13
|
+
"command": "security list",
|
|
14
|
+
"description": "Параметры start-time и end-time стали необязательными"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "~",
|
|
18
|
+
"command": "chats list, messages list",
|
|
19
|
+
"description": "Сортировка через --sort и --order вместо --sort-id и --sort-last-message-at"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
2
23
|
{
|
|
3
24
|
"version": "2026.3.9",
|
|
4
25
|
"date": "19 марта 2026",
|