@fragno-dev/telegram-fragment 0.0.1 → 0.0.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/browser/client/react.d.ts +129 -3
- package/dist/browser/client/react.d.ts.map +1 -1
- package/dist/browser/client/react.js +32 -22
- package/dist/browser/client/react.js.map +1 -1
- package/dist/browser/client/solid.d.ts +129 -3
- package/dist/browser/client/solid.d.ts.map +1 -1
- package/dist/browser/client/solid.js +2 -2
- package/dist/browser/client/solid.js.map +1 -1
- package/dist/browser/client/svelte.d.ts +129 -3
- package/dist/browser/client/svelte.d.ts.map +1 -1
- package/dist/browser/client/svelte.js +1 -1
- package/dist/browser/client/vanilla.d.ts +129 -3
- package/dist/browser/client/vanilla.d.ts.map +1 -1
- package/dist/browser/client/vanilla.js +1 -1
- package/dist/browser/client/vue.d.ts +129 -3
- package/dist/browser/client/vue.d.ts.map +1 -1
- package/dist/browser/client/vue.js +1 -1
- package/dist/browser/{client-Bk-J98pf.d.ts → client-BumUy6cu.d.ts} +87 -83
- package/dist/browser/client-BumUy6cu.d.ts.map +1 -0
- package/dist/browser/index.d.ts +697 -48
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{schema-QDMf15Vn.js → schema-IrJsGm4M.js} +264 -41
- package/dist/browser/schema-IrJsGm4M.js.map +1 -0
- package/dist/node/definition.d.ts.map +1 -1
- package/dist/node/index.d.ts +260 -13
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/routes.d.ts +130 -9
- package/dist/node/routes.d.ts.map +1 -1
- package/dist/node/routes.js +25 -15
- package/dist/node/routes.js.map +1 -1
- package/dist/node/services.js +56 -53
- package/dist/node/services.js.map +1 -1
- package/dist/node/telegram-api.js +80 -16
- package/dist/node/telegram-api.js.map +1 -1
- package/dist/node/telegram-utils.js +284 -9
- package/dist/node/telegram-utils.js.map +1 -1
- package/dist/node/types.d.ts +308 -27
- package/dist/node/types.d.ts.map +1 -1
- package/dist/node/types.js +232 -27
- package/dist/node/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -8
- package/dist/browser/client-Bk-J98pf.d.ts.map +0 -1
- package/dist/browser/schema-QDMf15Vn.js.map +0 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TelegramApi, TelegramApiResult, TelegramChatMemberHookPayload, TelegramChatMemberSummary, TelegramChatSummary, TelegramChatType, TelegramCommandApi, TelegramCommandApiResult, TelegramCommandBinding, TelegramCommandBindings, TelegramCommandContext, TelegramCommandDefinition, TelegramCommandRegistry, TelegramCommandScope, TelegramConfigBuilder, TelegramFragmentConfig, TelegramHooks, TelegramHooksMap, TelegramMessage, TelegramMessageHookPayload, TelegramMessageSummary, TelegramQueuedResult, TelegramUpdate, TelegramUpdateType, TelegramUser, TelegramUserSummary, createTelegram, defineCommand } from "./types.js";
|
|
1
|
+
import { TelegramApi, TelegramApiResult, TelegramAttachment, TelegramAttachmentKind, TelegramAttachmentPhotoSize, TelegramChatMemberHookPayload, TelegramChatMemberSummary, TelegramChatSummary, TelegramChatType, TelegramCommandApi, TelegramCommandApiResult, TelegramCommandBinding, TelegramCommandBindings, TelegramCommandContext, TelegramCommandDefinition, TelegramCommandRegistry, TelegramCommandScope, TelegramConfigBuilder, TelegramFragmentConfig, TelegramHooks, TelegramHooksMap, TelegramMessage, TelegramMessageHookPayload, TelegramMessageSummary, TelegramQueuedResult, TelegramUpdate, TelegramUpdateType, TelegramUser, TelegramUserSummary, createTelegram, defineCommand, telegramAttachmentKindSchema, telegramAttachmentSchema } from "./types.js";
|
|
2
2
|
import { telegramFragmentDefinition } from "./definition.js";
|
|
3
3
|
import { telegramRoutesFactory } from "./routes.js";
|
|
4
4
|
import { telegramSchema } from "./schema.js";
|
|
@@ -16,15 +16,10 @@ import * as _fragno_dev_db_fragment_definition_builder0 from "@fragno-dev/db/fra
|
|
|
16
16
|
import * as _fragno_dev_core_api0 from "@fragno-dev/core/api";
|
|
17
17
|
|
|
18
18
|
//#region src/index.d.ts
|
|
19
|
-
declare function createTelegramFragment(config: TelegramFragmentConfig, fragnoConfig: FragnoPublicConfigWithDatabase): _fragno_dev_core0.FragnoInstantiatedFragment<readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/telegram/webhook", zod.ZodObject<{
|
|
20
|
-
update_id: zod.ZodNumber;
|
|
21
|
-
message: zod.ZodOptional<zod.ZodType<TelegramMessage, unknown, zod_v4_core0.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
22
|
-
edited_message: zod.ZodOptional<zod.ZodType<TelegramMessage, unknown, zod_v4_core0.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
23
|
-
channel_post: zod.ZodOptional<zod.ZodType<TelegramMessage, unknown, zod_v4_core0.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
24
|
-
}, zod_v4_core0.$loose>, zod.ZodObject<{
|
|
19
|
+
declare function createTelegramFragment(config: TelegramFragmentConfig, fragnoConfig: FragnoPublicConfigWithDatabase): _fragno_dev_core0.FragnoInstantiatedFragment<readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/telegram/webhook", zod.ZodUnknown, zod.ZodObject<{
|
|
25
20
|
ok: zod.ZodBoolean;
|
|
26
21
|
duplicate: zod.ZodOptional<zod.ZodBoolean>;
|
|
27
|
-
}, zod_v4_core0.$strip>, "UNAUTHORIZED", string, _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/commands/bind", zod.ZodObject<{
|
|
22
|
+
}, zod_v4_core0.$strip>, "UNAUTHORIZED" | "INVALID_UPDATE", string, _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/commands/bind", zod.ZodObject<{
|
|
28
23
|
chatId: zod.ZodString;
|
|
29
24
|
commandName: zod.ZodString;
|
|
30
25
|
enabled: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
|
|
@@ -90,7 +85,7 @@ declare function createTelegramFragment(config: TelegramFragmentConfig, fragnoCo
|
|
|
90
85
|
supergroup: "supergroup";
|
|
91
86
|
channel: "channel";
|
|
92
87
|
}>>>;
|
|
93
|
-
}, zod_v4_core0.$
|
|
88
|
+
}, zod_v4_core0.$strip>>>;
|
|
94
89
|
createdAt: zod.ZodDate;
|
|
95
90
|
updatedAt: zod.ZodDate;
|
|
96
91
|
}, zod_v4_core0.$strip>>, string, "type", _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/chats/:chatId", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, zod.ZodObject<{
|
|
@@ -113,7 +108,7 @@ declare function createTelegramFragment(config: TelegramFragmentConfig, fragnoCo
|
|
|
113
108
|
supergroup: "supergroup";
|
|
114
109
|
channel: "channel";
|
|
115
110
|
}>>>;
|
|
116
|
-
}, zod_v4_core0.$
|
|
111
|
+
}, zod_v4_core0.$strip>>>;
|
|
117
112
|
createdAt: zod.ZodDate;
|
|
118
113
|
updatedAt: zod.ZodDate;
|
|
119
114
|
}, zod_v4_core0.$strip>;
|
|
@@ -150,6 +145,132 @@ declare function createTelegramFragment(config: TelegramFragmentConfig, fragnoCo
|
|
|
150
145
|
channel_post: "channel_post";
|
|
151
146
|
}>;
|
|
152
147
|
text: zod.ZodNullable<zod.ZodString>;
|
|
148
|
+
attachments: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
149
|
+
kind: zod.ZodLiteral<"photo">;
|
|
150
|
+
fileId: zod.ZodString;
|
|
151
|
+
fileUniqueId: zod.ZodString;
|
|
152
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
153
|
+
width: zod.ZodNumber;
|
|
154
|
+
height: zod.ZodNumber;
|
|
155
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
156
|
+
fileId: zod.ZodString;
|
|
157
|
+
fileUniqueId: zod.ZodString;
|
|
158
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
159
|
+
width: zod.ZodNumber;
|
|
160
|
+
height: zod.ZodNumber;
|
|
161
|
+
}, zod_v4_core0.$strip>>;
|
|
162
|
+
sizes: zod.ZodArray<zod.ZodObject<{
|
|
163
|
+
fileId: zod.ZodString;
|
|
164
|
+
fileUniqueId: zod.ZodString;
|
|
165
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
166
|
+
width: zod.ZodNumber;
|
|
167
|
+
height: zod.ZodNumber;
|
|
168
|
+
}, zod_v4_core0.$strip>>;
|
|
169
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
170
|
+
kind: zod.ZodLiteral<"voice">;
|
|
171
|
+
fileId: zod.ZodString;
|
|
172
|
+
fileUniqueId: zod.ZodString;
|
|
173
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
174
|
+
duration: zod.ZodNumber;
|
|
175
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
176
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
177
|
+
kind: zod.ZodLiteral<"audio">;
|
|
178
|
+
fileId: zod.ZodString;
|
|
179
|
+
fileUniqueId: zod.ZodString;
|
|
180
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
181
|
+
duration: zod.ZodNumber;
|
|
182
|
+
performer: zod.ZodOptional<zod.ZodString>;
|
|
183
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
184
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
185
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
186
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
187
|
+
fileId: zod.ZodString;
|
|
188
|
+
fileUniqueId: zod.ZodString;
|
|
189
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
190
|
+
width: zod.ZodNumber;
|
|
191
|
+
height: zod.ZodNumber;
|
|
192
|
+
}, zod_v4_core0.$strip>>;
|
|
193
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
194
|
+
kind: zod.ZodLiteral<"document">;
|
|
195
|
+
fileId: zod.ZodString;
|
|
196
|
+
fileUniqueId: zod.ZodString;
|
|
197
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
198
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
199
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
200
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
201
|
+
fileId: zod.ZodString;
|
|
202
|
+
fileUniqueId: zod.ZodString;
|
|
203
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
204
|
+
width: zod.ZodNumber;
|
|
205
|
+
height: zod.ZodNumber;
|
|
206
|
+
}, zod_v4_core0.$strip>>;
|
|
207
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
208
|
+
kind: zod.ZodLiteral<"video">;
|
|
209
|
+
fileId: zod.ZodString;
|
|
210
|
+
fileUniqueId: zod.ZodString;
|
|
211
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
212
|
+
width: zod.ZodNumber;
|
|
213
|
+
height: zod.ZodNumber;
|
|
214
|
+
duration: zod.ZodNumber;
|
|
215
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
216
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
217
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
218
|
+
fileId: zod.ZodString;
|
|
219
|
+
fileUniqueId: zod.ZodString;
|
|
220
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
221
|
+
width: zod.ZodNumber;
|
|
222
|
+
height: zod.ZodNumber;
|
|
223
|
+
}, zod_v4_core0.$strip>>;
|
|
224
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
225
|
+
kind: zod.ZodLiteral<"video_note">;
|
|
226
|
+
fileId: zod.ZodString;
|
|
227
|
+
fileUniqueId: zod.ZodString;
|
|
228
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
229
|
+
length: zod.ZodNumber;
|
|
230
|
+
duration: zod.ZodNumber;
|
|
231
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
232
|
+
fileId: zod.ZodString;
|
|
233
|
+
fileUniqueId: zod.ZodString;
|
|
234
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
235
|
+
width: zod.ZodNumber;
|
|
236
|
+
height: zod.ZodNumber;
|
|
237
|
+
}, zod_v4_core0.$strip>>;
|
|
238
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
239
|
+
kind: zod.ZodLiteral<"sticker">;
|
|
240
|
+
fileId: zod.ZodString;
|
|
241
|
+
fileUniqueId: zod.ZodString;
|
|
242
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
243
|
+
width: zod.ZodNumber;
|
|
244
|
+
height: zod.ZodNumber;
|
|
245
|
+
emoji: zod.ZodOptional<zod.ZodString>;
|
|
246
|
+
setName: zod.ZodOptional<zod.ZodString>;
|
|
247
|
+
isAnimated: zod.ZodBoolean;
|
|
248
|
+
isVideo: zod.ZodBoolean;
|
|
249
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
250
|
+
fileId: zod.ZodString;
|
|
251
|
+
fileUniqueId: zod.ZodString;
|
|
252
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
253
|
+
width: zod.ZodNumber;
|
|
254
|
+
height: zod.ZodNumber;
|
|
255
|
+
}, zod_v4_core0.$strip>>;
|
|
256
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
257
|
+
kind: zod.ZodLiteral<"animation">;
|
|
258
|
+
fileId: zod.ZodString;
|
|
259
|
+
fileUniqueId: zod.ZodString;
|
|
260
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
261
|
+
width: zod.ZodNumber;
|
|
262
|
+
height: zod.ZodNumber;
|
|
263
|
+
duration: zod.ZodNumber;
|
|
264
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
265
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
266
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
267
|
+
fileId: zod.ZodString;
|
|
268
|
+
fileUniqueId: zod.ZodString;
|
|
269
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
270
|
+
width: zod.ZodNumber;
|
|
271
|
+
height: zod.ZodNumber;
|
|
272
|
+
}, zod_v4_core0.$strip>>;
|
|
273
|
+
}, zod_v4_core0.$strip>], "kind">>;
|
|
153
274
|
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
154
275
|
sentAt: zod.ZodDate;
|
|
155
276
|
editedAt: zod.ZodNullable<zod.ZodDate>;
|
|
@@ -459,7 +580,7 @@ declare function createTelegramFragmentClients(fragnoConfig?: FragnoPublicClient
|
|
|
459
580
|
supergroup: "supergroup";
|
|
460
581
|
channel: "channel";
|
|
461
582
|
}>>>;
|
|
462
|
-
}, zod_v4_core0.$
|
|
583
|
+
}, zod_v4_core0.$strip>>>;
|
|
463
584
|
createdAt: zod.ZodDate;
|
|
464
585
|
updatedAt: zod.ZodDate;
|
|
465
586
|
}, zod_v4_core0.$strip>>, string, "type">;
|
|
@@ -483,7 +604,7 @@ declare function createTelegramFragmentClients(fragnoConfig?: FragnoPublicClient
|
|
|
483
604
|
supergroup: "supergroup";
|
|
484
605
|
channel: "channel";
|
|
485
606
|
}>>>;
|
|
486
|
-
}, zod_v4_core0.$
|
|
607
|
+
}, zod_v4_core0.$strip>>>;
|
|
487
608
|
createdAt: zod.ZodDate;
|
|
488
609
|
updatedAt: zod.ZodDate;
|
|
489
610
|
}, zod_v4_core0.$strip>;
|
|
@@ -521,6 +642,132 @@ declare function createTelegramFragmentClients(fragnoConfig?: FragnoPublicClient
|
|
|
521
642
|
channel_post: "channel_post";
|
|
522
643
|
}>;
|
|
523
644
|
text: zod.ZodNullable<zod.ZodString>;
|
|
645
|
+
attachments: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
646
|
+
kind: zod.ZodLiteral<"photo">;
|
|
647
|
+
fileId: zod.ZodString;
|
|
648
|
+
fileUniqueId: zod.ZodString;
|
|
649
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
650
|
+
width: zod.ZodNumber;
|
|
651
|
+
height: zod.ZodNumber;
|
|
652
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
653
|
+
fileId: zod.ZodString;
|
|
654
|
+
fileUniqueId: zod.ZodString;
|
|
655
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
656
|
+
width: zod.ZodNumber;
|
|
657
|
+
height: zod.ZodNumber;
|
|
658
|
+
}, zod_v4_core0.$strip>>;
|
|
659
|
+
sizes: zod.ZodArray<zod.ZodObject<{
|
|
660
|
+
fileId: zod.ZodString;
|
|
661
|
+
fileUniqueId: zod.ZodString;
|
|
662
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
663
|
+
width: zod.ZodNumber;
|
|
664
|
+
height: zod.ZodNumber;
|
|
665
|
+
}, zod_v4_core0.$strip>>;
|
|
666
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
667
|
+
kind: zod.ZodLiteral<"voice">;
|
|
668
|
+
fileId: zod.ZodString;
|
|
669
|
+
fileUniqueId: zod.ZodString;
|
|
670
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
671
|
+
duration: zod.ZodNumber;
|
|
672
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
673
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
674
|
+
kind: zod.ZodLiteral<"audio">;
|
|
675
|
+
fileId: zod.ZodString;
|
|
676
|
+
fileUniqueId: zod.ZodString;
|
|
677
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
678
|
+
duration: zod.ZodNumber;
|
|
679
|
+
performer: zod.ZodOptional<zod.ZodString>;
|
|
680
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
681
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
682
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
683
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
684
|
+
fileId: zod.ZodString;
|
|
685
|
+
fileUniqueId: zod.ZodString;
|
|
686
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
687
|
+
width: zod.ZodNumber;
|
|
688
|
+
height: zod.ZodNumber;
|
|
689
|
+
}, zod_v4_core0.$strip>>;
|
|
690
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
691
|
+
kind: zod.ZodLiteral<"document">;
|
|
692
|
+
fileId: zod.ZodString;
|
|
693
|
+
fileUniqueId: zod.ZodString;
|
|
694
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
695
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
696
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
697
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
698
|
+
fileId: zod.ZodString;
|
|
699
|
+
fileUniqueId: zod.ZodString;
|
|
700
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
701
|
+
width: zod.ZodNumber;
|
|
702
|
+
height: zod.ZodNumber;
|
|
703
|
+
}, zod_v4_core0.$strip>>;
|
|
704
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
705
|
+
kind: zod.ZodLiteral<"video">;
|
|
706
|
+
fileId: zod.ZodString;
|
|
707
|
+
fileUniqueId: zod.ZodString;
|
|
708
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
709
|
+
width: zod.ZodNumber;
|
|
710
|
+
height: zod.ZodNumber;
|
|
711
|
+
duration: zod.ZodNumber;
|
|
712
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
713
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
714
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
715
|
+
fileId: zod.ZodString;
|
|
716
|
+
fileUniqueId: zod.ZodString;
|
|
717
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
718
|
+
width: zod.ZodNumber;
|
|
719
|
+
height: zod.ZodNumber;
|
|
720
|
+
}, zod_v4_core0.$strip>>;
|
|
721
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
722
|
+
kind: zod.ZodLiteral<"video_note">;
|
|
723
|
+
fileId: zod.ZodString;
|
|
724
|
+
fileUniqueId: zod.ZodString;
|
|
725
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
726
|
+
length: zod.ZodNumber;
|
|
727
|
+
duration: zod.ZodNumber;
|
|
728
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
729
|
+
fileId: zod.ZodString;
|
|
730
|
+
fileUniqueId: zod.ZodString;
|
|
731
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
732
|
+
width: zod.ZodNumber;
|
|
733
|
+
height: zod.ZodNumber;
|
|
734
|
+
}, zod_v4_core0.$strip>>;
|
|
735
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
736
|
+
kind: zod.ZodLiteral<"sticker">;
|
|
737
|
+
fileId: zod.ZodString;
|
|
738
|
+
fileUniqueId: zod.ZodString;
|
|
739
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
740
|
+
width: zod.ZodNumber;
|
|
741
|
+
height: zod.ZodNumber;
|
|
742
|
+
emoji: zod.ZodOptional<zod.ZodString>;
|
|
743
|
+
setName: zod.ZodOptional<zod.ZodString>;
|
|
744
|
+
isAnimated: zod.ZodBoolean;
|
|
745
|
+
isVideo: zod.ZodBoolean;
|
|
746
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
747
|
+
fileId: zod.ZodString;
|
|
748
|
+
fileUniqueId: zod.ZodString;
|
|
749
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
750
|
+
width: zod.ZodNumber;
|
|
751
|
+
height: zod.ZodNumber;
|
|
752
|
+
}, zod_v4_core0.$strip>>;
|
|
753
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
754
|
+
kind: zod.ZodLiteral<"animation">;
|
|
755
|
+
fileId: zod.ZodString;
|
|
756
|
+
fileUniqueId: zod.ZodString;
|
|
757
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
758
|
+
width: zod.ZodNumber;
|
|
759
|
+
height: zod.ZodNumber;
|
|
760
|
+
duration: zod.ZodNumber;
|
|
761
|
+
fileName: zod.ZodOptional<zod.ZodString>;
|
|
762
|
+
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
763
|
+
thumbnail: zod.ZodOptional<zod.ZodObject<{
|
|
764
|
+
fileId: zod.ZodString;
|
|
765
|
+
fileUniqueId: zod.ZodString;
|
|
766
|
+
fileSize: zod.ZodOptional<zod.ZodNumber>;
|
|
767
|
+
width: zod.ZodNumber;
|
|
768
|
+
height: zod.ZodNumber;
|
|
769
|
+
}, zod_v4_core0.$strip>>;
|
|
770
|
+
}, zod_v4_core0.$strip>], "kind">>;
|
|
524
771
|
payload: zod.ZodNullable<zod.ZodUnknown>;
|
|
525
772
|
sentAt: zod.ZodDate;
|
|
526
773
|
editedAt: zod.ZodNullable<zod.ZodDate>;
|
|
@@ -583,5 +830,5 @@ declare function createTelegramFragmentClients(fragnoConfig?: FragnoPublicClient
|
|
|
583
830
|
}, zod_v4_core0.$strip> | undefined, "INVALID_MESSAGE_ID", string>;
|
|
584
831
|
};
|
|
585
832
|
//#endregion
|
|
586
|
-
export { type FragnoRouteConfig, type TelegramApi, type TelegramApiResult, type TelegramChatMemberHookPayload, type TelegramChatMemberSummary, type TelegramChatSummary, type TelegramChatType, type TelegramCommandApi, type TelegramCommandApiResult, type TelegramCommandBinding, type TelegramCommandBindings, type TelegramCommandContext, type TelegramCommandDefinition, type TelegramCommandRegistry, type TelegramCommandScope, type TelegramConfigBuilder, type TelegramFragmentConfig, type TelegramHooks, type TelegramMessage, type TelegramMessageHookPayload, type TelegramMessageSummary, type TelegramQueuedResult, type TelegramUpdate, type TelegramUpdateType, type TelegramUser, type TelegramUserSummary, createTelegram, createTelegramFragment, createTelegramFragmentClients, defineCommand, telegramFragmentDefinition, telegramRoutesFactory, telegramSchema };
|
|
833
|
+
export { type FragnoRouteConfig, type TelegramApi, type TelegramApiResult, type TelegramAttachment, type TelegramAttachmentKind, type TelegramAttachmentPhotoSize, type TelegramChatMemberHookPayload, type TelegramChatMemberSummary, type TelegramChatSummary, type TelegramChatType, type TelegramCommandApi, type TelegramCommandApiResult, type TelegramCommandBinding, type TelegramCommandBindings, type TelegramCommandContext, type TelegramCommandDefinition, type TelegramCommandRegistry, type TelegramCommandScope, type TelegramConfigBuilder, type TelegramFragmentConfig, type TelegramHooks, type TelegramMessage, type TelegramMessageHookPayload, type TelegramMessageSummary, type TelegramQueuedResult, type TelegramUpdate, type TelegramUpdateType, type TelegramUser, type TelegramUserSummary, createTelegram, createTelegramFragment, createTelegramFragmentClients, defineCommand, telegramAttachmentKindSchema, telegramAttachmentSchema, telegramFragmentDefinition, telegramRoutesFactory, telegramSchema };
|
|
587
834
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBAYgB,sBAAA,CACd,MAAA,EAAQ,sBAAA,EACR,YAAA,EAAc,8BAAA,qBAA8B,0BAAA,6BAAA,iBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBAYgB,sBAAA,CACd,MAAA,EAAQ,sBAAA,EACR,YAAA,EAAc,8BAAA,qBAA8B,0BAAA,6BAAA,iBAAA,8BAAA,GAAA,CAAA,UAAA,MAAA,SAAA;MAAA,GAAA,CAAA,UAAA;;2GAAA,gBAAA;UAAA,GAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgE6ixB,sBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;6BAAszF,MAAA;EAAA;cAAA,sBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAvDj42B,6BAAA,CAA8B,YAAA,GAAc,wBAAA;;;YAA6B,GAAA,CAAA,SAAA"}
|
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { telegramSchema } from "./schema.js";
|
|
2
|
-
import { createTelegram, defineCommand } from "./types.js";
|
|
2
|
+
import { createTelegram, defineCommand, telegramAttachmentKindSchema, telegramAttachmentSchema } from "./types.js";
|
|
3
3
|
import { telegramFragmentDefinition } from "./definition.js";
|
|
4
4
|
import { telegramRoutesFactory } from "./routes.js";
|
|
5
5
|
import { createClientBuilder } from "@fragno-dev/core/client";
|
|
@@ -25,5 +25,5 @@ function createTelegramFragmentClients(fragnoConfig = {}) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
export { createTelegram, createTelegramFragment, createTelegramFragmentClients, defineCommand, telegramFragmentDefinition, telegramRoutesFactory, telegramSchema };
|
|
28
|
+
export { createTelegram, createTelegramFragment, createTelegramFragmentClients, defineCommand, telegramAttachmentKindSchema, telegramAttachmentSchema, telegramFragmentDefinition, telegramRoutesFactory, telegramSchema };
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { createClientBuilder } from \"@fragno-dev/core/client\";\nimport type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\n\nimport { instantiate } from \"@fragno-dev/core\";\nimport type { FragnoPublicConfigWithDatabase } from \"@fragno-dev/db\";\n\nimport { telegramFragmentDefinition } from \"./definition\";\nimport { telegramRoutesFactory } from \"./routes\";\nimport type { TelegramFragmentConfig } from \"./types\";\n\nconst routes = [telegramRoutesFactory] as const;\n\nexport function createTelegramFragment(\n config: TelegramFragmentConfig,\n fragnoConfig: FragnoPublicConfigWithDatabase,\n) {\n return instantiate(telegramFragmentDefinition)\n .withConfig(config)\n .withRoutes(routes)\n .withOptions(fragnoConfig)\n .build();\n}\n\nexport function createTelegramFragmentClients(fragnoConfig: FragnoPublicClientConfig = {}) {\n const builder = createClientBuilder(telegramFragmentDefinition, fragnoConfig, routes);\n\n return {\n useCommands: builder.createHook(\"/commands\"),\n useBindCommand: builder.createMutator(\"POST\", \"/commands/bind\"),\n useChats: builder.createHook(\"/chats\"),\n useChat: builder.createHook(\"/chats/:chatId\"),\n useChatMessages: builder.createHook(\"/chats/:chatId/messages\"),\n useChatAction: builder.createMutator(\"POST\", \"/chats/:chatId/actions\"),\n useSendMessage: builder.createMutator(\"POST\", \"/chats/:chatId/send\"),\n useEditMessage: builder.createMutator(\"POST\", \"/chats/:chatId/messages/:messageId/edit\"),\n };\n}\n\nexport { telegramFragmentDefinition } from \"./definition\";\nexport { telegramRoutesFactory } from \"./routes\";\nexport { telegramSchema } from \"./schema\";\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { createClientBuilder } from \"@fragno-dev/core/client\";\nimport type { FragnoPublicClientConfig } from \"@fragno-dev/core/client\";\n\nimport { instantiate } from \"@fragno-dev/core\";\nimport type { FragnoPublicConfigWithDatabase } from \"@fragno-dev/db\";\n\nimport { telegramFragmentDefinition } from \"./definition\";\nimport { telegramRoutesFactory } from \"./routes\";\nimport type { TelegramFragmentConfig } from \"./types\";\n\nconst routes = [telegramRoutesFactory] as const;\n\nexport function createTelegramFragment(\n config: TelegramFragmentConfig,\n fragnoConfig: FragnoPublicConfigWithDatabase,\n) {\n return instantiate(telegramFragmentDefinition)\n .withConfig(config)\n .withRoutes(routes)\n .withOptions(fragnoConfig)\n .build();\n}\n\nexport function createTelegramFragmentClients(fragnoConfig: FragnoPublicClientConfig = {}) {\n const builder = createClientBuilder(telegramFragmentDefinition, fragnoConfig, routes);\n\n return {\n useCommands: builder.createHook(\"/commands\"),\n useBindCommand: builder.createMutator(\"POST\", \"/commands/bind\"),\n useChats: builder.createHook(\"/chats\"),\n useChat: builder.createHook(\"/chats/:chatId\"),\n useChatMessages: builder.createHook(\"/chats/:chatId/messages\"),\n useChatAction: builder.createMutator(\"POST\", \"/chats/:chatId/actions\"),\n useSendMessage: builder.createMutator(\"POST\", \"/chats/:chatId/send\"),\n useEditMessage: builder.createMutator(\"POST\", \"/chats/:chatId/messages/:messageId/edit\"),\n };\n}\n\nexport { telegramFragmentDefinition } from \"./definition\";\nexport { telegramRoutesFactory } from \"./routes\";\nexport { telegramSchema } from \"./schema\";\nexport {\n createTelegram,\n defineCommand,\n telegramAttachmentKindSchema,\n telegramAttachmentSchema,\n} from \"./types\";\nexport type {\n TelegramApi,\n TelegramApiResult,\n TelegramAttachment,\n TelegramAttachmentKind,\n TelegramAttachmentPhotoSize,\n TelegramCommandApi,\n TelegramCommandApiResult,\n TelegramChatMemberHookPayload,\n TelegramChatMemberSummary,\n TelegramChatSummary,\n TelegramChatType,\n TelegramCommandBinding,\n TelegramCommandBindings,\n TelegramConfigBuilder,\n TelegramCommandContext,\n TelegramCommandDefinition,\n TelegramCommandRegistry,\n TelegramCommandScope,\n TelegramFragmentConfig,\n TelegramHooks,\n TelegramMessage,\n TelegramMessageHookPayload,\n TelegramMessageSummary,\n TelegramQueuedResult,\n TelegramUpdateType,\n TelegramUpdate,\n TelegramUser,\n TelegramUserSummary,\n} from \"./types\";\nexport type { FragnoRouteConfig } from \"@fragno-dev/core\";\n"],"mappings":";;;;;;;;AAUA,MAAM,SAAS,CAAC,sBAAsB;AAEtC,SAAgB,uBACd,QACA,cACA;AACA,QAAO,YAAY,2BAA2B,CAC3C,WAAW,OAAO,CAClB,WAAW,OAAO,CAClB,YAAY,aAAa,CACzB,OAAO;;AAGZ,SAAgB,8BAA8B,eAAyC,EAAE,EAAE;CACzF,MAAM,UAAU,oBAAoB,4BAA4B,cAAc,OAAO;AAErF,QAAO;EACL,aAAa,QAAQ,WAAW,YAAY;EAC5C,gBAAgB,QAAQ,cAAc,QAAQ,iBAAiB;EAC/D,UAAU,QAAQ,WAAW,SAAS;EACtC,SAAS,QAAQ,WAAW,iBAAiB;EAC7C,iBAAiB,QAAQ,WAAW,0BAA0B;EAC9D,eAAe,QAAQ,cAAc,QAAQ,yBAAyB;EACtE,gBAAgB,QAAQ,cAAc,QAAQ,sBAAsB;EACpE,gBAAgB,QAAQ,cAAc,QAAQ,0CAA0C;EACzF"}
|
package/dist/node/routes.d.ts
CHANGED
|
@@ -189,15 +189,10 @@ declare const telegramRoutesFactory: _fragno_dev_core0.RouteFactory<TelegramFrag
|
|
|
189
189
|
updatedAt: Date;
|
|
190
190
|
} | null;
|
|
191
191
|
} | null]>;
|
|
192
|
-
}>, {}, readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/telegram/webhook", z.ZodObject<{
|
|
193
|
-
update_id: z.ZodNumber;
|
|
194
|
-
message: z.ZodOptional<z.ZodType<TelegramMessage, unknown, z.core.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
195
|
-
edited_message: z.ZodOptional<z.ZodType<TelegramMessage, unknown, z.core.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
196
|
-
channel_post: z.ZodOptional<z.ZodType<TelegramMessage, unknown, z.core.$ZodTypeInternals<TelegramMessage, unknown>>>;
|
|
197
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
192
|
+
}>, {}, readonly [_fragno_dev_core0.FragnoRouteConfig<"POST", "/telegram/webhook", z.ZodUnknown, z.ZodObject<{
|
|
198
193
|
ok: z.ZodBoolean;
|
|
199
194
|
duplicate: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
-
}, z.core.$strip>, "UNAUTHORIZED", string, _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/commands/bind", z.ZodObject<{
|
|
195
|
+
}, z.core.$strip>, "UNAUTHORIZED" | "INVALID_UPDATE", string, _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"POST", "/commands/bind", z.ZodObject<{
|
|
201
196
|
chatId: z.ZodString;
|
|
202
197
|
commandName: z.ZodString;
|
|
203
198
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -263,7 +258,7 @@ declare const telegramRoutesFactory: _fragno_dev_core0.RouteFactory<TelegramFrag
|
|
|
263
258
|
supergroup: "supergroup";
|
|
264
259
|
channel: "channel";
|
|
265
260
|
}>>>;
|
|
266
|
-
}, z.core.$
|
|
261
|
+
}, z.core.$strip>>>;
|
|
267
262
|
createdAt: z.ZodDate;
|
|
268
263
|
updatedAt: z.ZodDate;
|
|
269
264
|
}, z.core.$strip>>, string, "type", _fragno_dev_db0.DatabaseRequestContext<TelegramHooksMap>>, _fragno_dev_core0.FragnoRouteConfig<"GET", "/chats/:chatId", _standard_schema_spec0.StandardSchemaV1<unknown, unknown> | undefined, z.ZodObject<{
|
|
@@ -286,7 +281,7 @@ declare const telegramRoutesFactory: _fragno_dev_core0.RouteFactory<TelegramFrag
|
|
|
286
281
|
supergroup: "supergroup";
|
|
287
282
|
channel: "channel";
|
|
288
283
|
}>>>;
|
|
289
|
-
}, z.core.$
|
|
284
|
+
}, z.core.$strip>>>;
|
|
290
285
|
createdAt: z.ZodDate;
|
|
291
286
|
updatedAt: z.ZodDate;
|
|
292
287
|
}, z.core.$strip>;
|
|
@@ -323,6 +318,132 @@ declare const telegramRoutesFactory: _fragno_dev_core0.RouteFactory<TelegramFrag
|
|
|
323
318
|
channel_post: "channel_post";
|
|
324
319
|
}>;
|
|
325
320
|
text: z.ZodNullable<z.ZodString>;
|
|
321
|
+
attachments: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
322
|
+
kind: z.ZodLiteral<"photo">;
|
|
323
|
+
fileId: z.ZodString;
|
|
324
|
+
fileUniqueId: z.ZodString;
|
|
325
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
width: z.ZodNumber;
|
|
327
|
+
height: z.ZodNumber;
|
|
328
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
fileId: z.ZodString;
|
|
330
|
+
fileUniqueId: z.ZodString;
|
|
331
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
332
|
+
width: z.ZodNumber;
|
|
333
|
+
height: z.ZodNumber;
|
|
334
|
+
}, z.core.$strip>>;
|
|
335
|
+
sizes: z.ZodArray<z.ZodObject<{
|
|
336
|
+
fileId: z.ZodString;
|
|
337
|
+
fileUniqueId: z.ZodString;
|
|
338
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
339
|
+
width: z.ZodNumber;
|
|
340
|
+
height: z.ZodNumber;
|
|
341
|
+
}, z.core.$strip>>;
|
|
342
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
343
|
+
kind: z.ZodLiteral<"voice">;
|
|
344
|
+
fileId: z.ZodString;
|
|
345
|
+
fileUniqueId: z.ZodString;
|
|
346
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
347
|
+
duration: z.ZodNumber;
|
|
348
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
349
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
350
|
+
kind: z.ZodLiteral<"audio">;
|
|
351
|
+
fileId: z.ZodString;
|
|
352
|
+
fileUniqueId: z.ZodString;
|
|
353
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
354
|
+
duration: z.ZodNumber;
|
|
355
|
+
performer: z.ZodOptional<z.ZodString>;
|
|
356
|
+
title: z.ZodOptional<z.ZodString>;
|
|
357
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
358
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
359
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
360
|
+
fileId: z.ZodString;
|
|
361
|
+
fileUniqueId: z.ZodString;
|
|
362
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
363
|
+
width: z.ZodNumber;
|
|
364
|
+
height: z.ZodNumber;
|
|
365
|
+
}, z.core.$strip>>;
|
|
366
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
367
|
+
kind: z.ZodLiteral<"document">;
|
|
368
|
+
fileId: z.ZodString;
|
|
369
|
+
fileUniqueId: z.ZodString;
|
|
370
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
371
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
372
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
373
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
374
|
+
fileId: z.ZodString;
|
|
375
|
+
fileUniqueId: z.ZodString;
|
|
376
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
377
|
+
width: z.ZodNumber;
|
|
378
|
+
height: z.ZodNumber;
|
|
379
|
+
}, z.core.$strip>>;
|
|
380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
+
kind: z.ZodLiteral<"video">;
|
|
382
|
+
fileId: z.ZodString;
|
|
383
|
+
fileUniqueId: z.ZodString;
|
|
384
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
385
|
+
width: z.ZodNumber;
|
|
386
|
+
height: z.ZodNumber;
|
|
387
|
+
duration: z.ZodNumber;
|
|
388
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
389
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
390
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
391
|
+
fileId: z.ZodString;
|
|
392
|
+
fileUniqueId: z.ZodString;
|
|
393
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
394
|
+
width: z.ZodNumber;
|
|
395
|
+
height: z.ZodNumber;
|
|
396
|
+
}, z.core.$strip>>;
|
|
397
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
398
|
+
kind: z.ZodLiteral<"video_note">;
|
|
399
|
+
fileId: z.ZodString;
|
|
400
|
+
fileUniqueId: z.ZodString;
|
|
401
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
402
|
+
length: z.ZodNumber;
|
|
403
|
+
duration: z.ZodNumber;
|
|
404
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
405
|
+
fileId: z.ZodString;
|
|
406
|
+
fileUniqueId: z.ZodString;
|
|
407
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
408
|
+
width: z.ZodNumber;
|
|
409
|
+
height: z.ZodNumber;
|
|
410
|
+
}, z.core.$strip>>;
|
|
411
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
412
|
+
kind: z.ZodLiteral<"sticker">;
|
|
413
|
+
fileId: z.ZodString;
|
|
414
|
+
fileUniqueId: z.ZodString;
|
|
415
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
416
|
+
width: z.ZodNumber;
|
|
417
|
+
height: z.ZodNumber;
|
|
418
|
+
emoji: z.ZodOptional<z.ZodString>;
|
|
419
|
+
setName: z.ZodOptional<z.ZodString>;
|
|
420
|
+
isAnimated: z.ZodBoolean;
|
|
421
|
+
isVideo: z.ZodBoolean;
|
|
422
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
423
|
+
fileId: z.ZodString;
|
|
424
|
+
fileUniqueId: z.ZodString;
|
|
425
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
width: z.ZodNumber;
|
|
427
|
+
height: z.ZodNumber;
|
|
428
|
+
}, z.core.$strip>>;
|
|
429
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
430
|
+
kind: z.ZodLiteral<"animation">;
|
|
431
|
+
fileId: z.ZodString;
|
|
432
|
+
fileUniqueId: z.ZodString;
|
|
433
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
width: z.ZodNumber;
|
|
435
|
+
height: z.ZodNumber;
|
|
436
|
+
duration: z.ZodNumber;
|
|
437
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
438
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
439
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
440
|
+
fileId: z.ZodString;
|
|
441
|
+
fileUniqueId: z.ZodString;
|
|
442
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
443
|
+
width: z.ZodNumber;
|
|
444
|
+
height: z.ZodNumber;
|
|
445
|
+
}, z.core.$strip>>;
|
|
446
|
+
}, z.core.$strip>], "kind">>;
|
|
326
447
|
payload: z.ZodNullable<z.ZodUnknown>;
|
|
327
448
|
sentAt: z.ZodDate;
|
|
328
449
|
editedAt: z.ZodNullable<z.ZodDate>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","names":[],"sources":["../../src/routes.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","names":[],"sources":["../../src/routes.ts"],"mappings":";;;;;;;;cA0Ja,qBAAA,oBAAqB,YAAA,CAkVjC,sBAAA,EAlViC,eAAA,CAAA,4BAAA,wBAAA,MAAA;2GAAA,sBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAmVi/W,oBAAA;EAAA;;;;;;;;;;;;;;QAAA,sBAAA,CAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;6BAAszF,MAAA;EAAA;cAAA,sBAAA"}
|
package/dist/node/routes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { telegramSchema } from "./schema.js";
|
|
2
|
-
import { telegramChatTypeSchema, telegramCommandBindingsSchema
|
|
3
|
-
import { DEFAULT_COMMAND_SCOPES, parseCommandBindings } from "./telegram-utils.js";
|
|
2
|
+
import { telegramAttachmentSchema, telegramChatTypeSchema, telegramCommandBindingsSchema } from "./types.js";
|
|
3
|
+
import { DEFAULT_COMMAND_SCOPES, normalizeTelegramUpdate, parseCommandBindings } from "./telegram-utils.js";
|
|
4
4
|
import { createTelegramApi } from "./telegram-api.js";
|
|
5
5
|
import { telegramFragmentDefinition } from "./definition.js";
|
|
6
6
|
import { defineRoutes } from "@fragno-dev/core";
|
|
@@ -51,6 +51,7 @@ const messageSummarySchema = z.object({
|
|
|
51
51
|
"channel_post"
|
|
52
52
|
]),
|
|
53
53
|
text: z.string().nullable(),
|
|
54
|
+
attachments: z.array(telegramAttachmentSchema),
|
|
54
55
|
payload: z.unknown().nullable(),
|
|
55
56
|
sentAt: z.date(),
|
|
56
57
|
editedAt: z.date().nullable(),
|
|
@@ -135,19 +136,28 @@ const telegramRoutesFactory = defineRoutes(telegramFragmentDefinition).create(({
|
|
|
135
136
|
defineRoute({
|
|
136
137
|
method: "POST",
|
|
137
138
|
path: "/telegram/webhook",
|
|
138
|
-
inputSchema:
|
|
139
|
+
inputSchema: z.unknown(),
|
|
139
140
|
outputSchema: webhookOutputSchema,
|
|
140
|
-
errorCodes: ["UNAUTHORIZED"],
|
|
141
|
+
errorCodes: ["UNAUTHORIZED", "INVALID_UPDATE"],
|
|
141
142
|
handler: async function({ headers, input }, { json, error }) {
|
|
142
143
|
const secret = headers.get("x-telegram-bot-api-secret-token");
|
|
143
144
|
if (!secret || secret !== config.webhookSecretToken) return error({
|
|
144
145
|
message: "Unauthorized",
|
|
145
146
|
code: "UNAUTHORIZED"
|
|
146
147
|
}, 401);
|
|
147
|
-
const
|
|
148
|
+
const rawUpdate = await input.valid();
|
|
149
|
+
let update;
|
|
150
|
+
try {
|
|
151
|
+
update = normalizeTelegramUpdate(rawUpdate);
|
|
152
|
+
} catch {
|
|
153
|
+
return error({
|
|
154
|
+
message: "Invalid Telegram update",
|
|
155
|
+
code: "INVALID_UPDATE"
|
|
156
|
+
}, 400);
|
|
157
|
+
}
|
|
148
158
|
try {
|
|
149
159
|
await this.handlerTx().mutate(({ forSchema }) => {
|
|
150
|
-
forSchema(telegramSchema, {}).triggerHook("internalProcessUpdate", { update }, { id: String(update.
|
|
160
|
+
forSchema(telegramSchema, {}).triggerHook("internalProcessUpdate", { update }, { id: String(update.updateId) });
|
|
151
161
|
}).execute();
|
|
152
162
|
return json({ ok: true });
|
|
153
163
|
} catch (err) {
|
|
@@ -317,7 +327,7 @@ const telegramRoutesFactory = defineRoutes(telegramFragmentDefinition).create(({
|
|
|
317
327
|
handler: async function({ pathParams, input }, { json, error }) {
|
|
318
328
|
const { action } = await input.valid();
|
|
319
329
|
const result = await api.sendChatAction({
|
|
320
|
-
|
|
330
|
+
chatId: pathParams.chatId,
|
|
321
331
|
action
|
|
322
332
|
});
|
|
323
333
|
if (!result.ok) return error({
|
|
@@ -338,11 +348,11 @@ const telegramRoutesFactory = defineRoutes(telegramFragmentDefinition).create(({
|
|
|
338
348
|
forSchema(telegramSchema, {}).triggerHook("internalOutgoingMessage", {
|
|
339
349
|
action: "sendMessage",
|
|
340
350
|
payload: filterUndefined({
|
|
341
|
-
|
|
351
|
+
chatId: pathParams.chatId,
|
|
342
352
|
text: payload.text,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
353
|
+
parseMode: payload.parseMode,
|
|
354
|
+
disableWebPagePreview: payload.disableWebPagePreview,
|
|
355
|
+
replyToMessageId: payload.replyToMessageId
|
|
346
356
|
})
|
|
347
357
|
});
|
|
348
358
|
}).execute();
|
|
@@ -370,11 +380,11 @@ const telegramRoutesFactory = defineRoutes(telegramFragmentDefinition).create(({
|
|
|
370
380
|
forSchema(telegramSchema, {}).triggerHook("internalOutgoingMessage", {
|
|
371
381
|
action: "editMessageText",
|
|
372
382
|
payload: filterUndefined({
|
|
373
|
-
|
|
374
|
-
|
|
383
|
+
chatId: pathParams.chatId,
|
|
384
|
+
messageId,
|
|
375
385
|
text: payload.text,
|
|
376
|
-
|
|
377
|
-
|
|
386
|
+
parseMode: payload.parseMode,
|
|
387
|
+
disableWebPagePreview: payload.disableWebPagePreview
|
|
378
388
|
})
|
|
379
389
|
});
|
|
380
390
|
}).execute();
|