@effect/chat-telegram 0.0.0 → 4.1.6

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 (157) hide show
  1. package/AGENTS.md +434 -0
  2. package/CLAUDE.md +434 -0
  3. package/LICENSE +21 -0
  4. package/README.md +122 -0
  5. package/ai-docs/README.md +44 -0
  6. package/ai-docs/package.json +36 -0
  7. package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  8. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
  9. package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  10. package/ai-docs/src/01_effect/01_basics/index.md +7 -0
  11. package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
  12. package/ai-docs/src/01_effect/02_schema/index.md +7 -0
  13. package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
  14. package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
  15. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
  16. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
  17. package/ai-docs/src/01_effect/03_services/index.md +5 -0
  18. package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
  19. package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
  20. package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
  21. package/ai-docs/src/01_effect/04_errors/index.md +1 -0
  22. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
  23. package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
  24. package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
  25. package/ai-docs/src/01_effect/05_resources/index.md +3 -0
  26. package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
  27. package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
  28. package/ai-docs/src/01_effect/06_running/index.md +1 -0
  29. package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
  30. package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
  31. package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
  32. package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
  33. package/ai-docs/src/03_stream/30_encoding.ts +163 -0
  34. package/ai-docs/src/03_stream/index.md +4 -0
  35. package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
  36. package/ai-docs/src/04_integration/index.md +5 -0
  37. package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  38. package/ai-docs/src/05_batching/index.md +3 -0
  39. package/ai-docs/src/06_schedule/10_schedules.ts +111 -0
  40. package/ai-docs/src/06_schedule/index.md +3 -0
  41. package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  42. package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  43. package/ai-docs/src/07_datetime/index.md +5 -0
  44. package/ai-docs/src/08_observability/10_logging.ts +66 -0
  45. package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  46. package/ai-docs/src/08_observability/index.md +7 -0
  47. package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  48. package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  49. package/ai-docs/src/09_testing/index.md +1 -0
  50. package/ai-docs/src/10_predicate/01_basics.ts +14 -0
  51. package/ai-docs/src/10_predicate/index.md +9 -0
  52. package/ai-docs/src/40_sql/10_basics.ts +175 -0
  53. package/ai-docs/src/40_sql/index.md +6 -0
  54. package/ai-docs/src/50_http-client/10_basics.ts +102 -0
  55. package/ai-docs/src/50_http-client/index.md +3 -0
  56. package/ai-docs/src/51_http-server/10_basics.ts +118 -0
  57. package/ai-docs/src/51_http-server/20_testing.ts +100 -0
  58. package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  59. package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  60. package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  61. package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
  62. package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
  63. package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  64. package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
  65. package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
  66. package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
  67. package/ai-docs/src/51_http-server/index.md +3 -0
  68. package/ai-docs/src/52_graphql/10_basics.ts +117 -0
  69. package/ai-docs/src/52_graphql/20_testing.ts +45 -0
  70. package/ai-docs/src/52_graphql/30_batching.ts +118 -0
  71. package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
  72. package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
  73. package/ai-docs/src/52_graphql/index.md +6 -0
  74. package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  75. package/ai-docs/src/60_child-process/index.md +3 -0
  76. package/ai-docs/src/70_cli/10_basics.ts +162 -0
  77. package/ai-docs/src/70_cli/index.md +5 -0
  78. package/ai-docs/src/71_ai/10_language-model.ts +156 -0
  79. package/ai-docs/src/71_ai/20_tools.ts +226 -0
  80. package/ai-docs/src/71_ai/30_chat.ts +158 -0
  81. package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  82. package/ai-docs/src/71_ai/index.md +5 -0
  83. package/ai-docs/src/80_cluster/10_entities.ts +97 -0
  84. package/ai-docs/src/80_cluster/index.md +4 -0
  85. package/ai-docs/src/index.md +10 -0
  86. package/ai-docs/tsconfig.json +28 -0
  87. package/dist/TelegramBotApi.d.ts +153 -0
  88. package/dist/TelegramBotApi.d.ts.map +1 -0
  89. package/dist/TelegramBotApi.js +219 -0
  90. package/dist/TelegramBotApi.js.map +1 -0
  91. package/dist/TelegramChat.d.ts +390 -0
  92. package/dist/TelegramChat.d.ts.map +1 -0
  93. package/dist/TelegramChat.js +359 -0
  94. package/dist/TelegramChat.js.map +1 -0
  95. package/dist/index.d.ts +15 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +16 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/internal/actions.d.ts +2 -0
  100. package/dist/internal/actions.d.ts.map +1 -0
  101. package/dist/internal/actions.js +88 -0
  102. package/dist/internal/actions.js.map +1 -0
  103. package/dist/internal/adapter.d.ts +2 -0
  104. package/dist/internal/adapter.d.ts.map +1 -0
  105. package/dist/internal/adapter.js +309 -0
  106. package/dist/internal/adapter.js.map +1 -0
  107. package/dist/internal/address.d.ts +2 -0
  108. package/dist/internal/address.d.ts.map +1 -0
  109. package/dist/internal/address.js +26 -0
  110. package/dist/internal/address.js.map +1 -0
  111. package/dist/internal/commands.d.ts +2 -0
  112. package/dist/internal/commands.d.ts.map +1 -0
  113. package/dist/internal/commands.js +30 -0
  114. package/dist/internal/commands.js.map +1 -0
  115. package/dist/internal/errors.d.ts +2 -0
  116. package/dist/internal/errors.d.ts.map +1 -0
  117. package/dist/internal/errors.js +136 -0
  118. package/dist/internal/errors.js.map +1 -0
  119. package/dist/internal/markdown.d.ts +9 -0
  120. package/dist/internal/markdown.d.ts.map +1 -0
  121. package/dist/internal/markdown.js +708 -0
  122. package/dist/internal/markdown.js.map +1 -0
  123. package/dist/internal/normalize.d.ts +2 -0
  124. package/dist/internal/normalize.d.ts.map +1 -0
  125. package/dist/internal/normalize.js +276 -0
  126. package/dist/internal/normalize.js.map +1 -0
  127. package/dist/internal/options.d.ts +2 -0
  128. package/dist/internal/options.d.ts.map +1 -0
  129. package/dist/internal/options.js +6 -0
  130. package/dist/internal/options.js.map +1 -0
  131. package/dist/internal/polling.d.ts +2 -0
  132. package/dist/internal/polling.d.ts.map +1 -0
  133. package/dist/internal/polling.js +68 -0
  134. package/dist/internal/polling.js.map +1 -0
  135. package/dist/internal/receive.d.ts +2 -0
  136. package/dist/internal/receive.d.ts.map +1 -0
  137. package/dist/internal/receive.js +183 -0
  138. package/dist/internal/receive.js.map +1 -0
  139. package/dist/internal/webhook.d.ts +2 -0
  140. package/dist/internal/webhook.d.ts.map +1 -0
  141. package/dist/internal/webhook.js +61 -0
  142. package/dist/internal/webhook.js.map +1 -0
  143. package/package.json +65 -1
  144. package/src/TelegramBotApi.ts +282 -0
  145. package/src/TelegramChat.ts +542 -0
  146. package/src/index.ts +18 -0
  147. package/src/internal/actions.ts +95 -0
  148. package/src/internal/adapter.ts +319 -0
  149. package/src/internal/address.ts +33 -0
  150. package/src/internal/commands.ts +37 -0
  151. package/src/internal/errors.ts +148 -0
  152. package/src/internal/markdown.ts +805 -0
  153. package/src/internal/normalize.ts +283 -0
  154. package/src/internal/options.ts +12 -0
  155. package/src/internal/polling.ts +86 -0
  156. package/src/internal/receive.ts +268 -0
  157. package/src/internal/webhook.ts +85 -0
@@ -0,0 +1,359 @@
1
+ /**
2
+ * The Telegram adapter for `effect/chat`, over the Bot API: the `Registry`
3
+ * layer, the webhook and polling transports, the pure normaliser and the
4
+ * address helpers.
5
+ *
6
+ * **Details**
7
+ *
8
+ * - Raw REST over `HttpClient`, through `TelegramBotApi`, which keeps the
9
+ * bot token out of spans and errors.
10
+ * - Posts and edits are rich messages (`sendRichMessage`,
11
+ * `editMessageText` with `rich_message`), in Markdown escaped so that
12
+ * consumer text reaches no raw HTML, image, math, spoiler or non-web
13
+ * link.
14
+ * - The base live checks ran against production. Files, buttons and
15
+ * commands need further checks, so they are behind `unverified`
16
+ * options, off by default.
17
+ * - There is no `ephemeral`: a private answer to a command is refused
18
+ * through `Handler.refused`, never posted. `fetchMessage`, `history`,
19
+ * `opener`, `startThread`, selects, modals, native streams and reaction
20
+ * events are not in this version.
21
+ *
22
+ * @stability unstable
23
+ * @since 4.1.5
24
+ */
25
+ import * as ByteSize from "effect/ByteSize";
26
+ import { Registry } from "effect/chat/ChatAdapter";
27
+ import { ChatHandler } from "effect/chat/ChatHandler";
28
+ import * as Context from "effect/Context";
29
+ import * as Duration from "effect/Duration";
30
+ import * as Effect from "effect/Effect";
31
+ import { dual } from "effect/Function";
32
+ import * as HttpRouter from "effect/http/HttpRouter";
33
+ import * as Layer from "effect/Layer";
34
+ import * as Option from "effect/Option";
35
+ import * as Adapter from "./internal/adapter.js";
36
+ import * as Address from "./internal/address.js";
37
+ import * as Commands from "./internal/commands.js";
38
+ import * as Errors from "./internal/errors.js";
39
+ import * as Normalize from "./internal/normalize.js";
40
+ import { CurrentPostOptions } from "./internal/options.js";
41
+ import * as Polling from "./internal/polling.js";
42
+ import * as Receive from "./internal/receive.js";
43
+ import * as Webhook from "./internal/webhook.js";
44
+ import * as TelegramBotApi from "./TelegramBotApi.js";
45
+ /**
46
+ * The Telegram adapter's own service.
47
+ *
48
+ * **Details**
49
+ *
50
+ * - `botId` is the numeric id in front of the token's colon.
51
+ * - `receive` runs one update, already authenticated and parsed, as both
52
+ * transports do, for a consumer's own transport. It needs a
53
+ * `ChatHandler`. Clicks and commands go to `ChatInteraction.Handler`
54
+ * when there is one in context: without it a click is answered and
55
+ * dropped, and a command is an ordinary message.
56
+ *
57
+ * @stability unstable
58
+ * @category services
59
+ * @since 4.1.5
60
+ */
61
+ export class TelegramChat extends /*#__PURE__*/Context.Service()("@effect/chat-telegram/TelegramChat") {}
62
+ /**
63
+ * Registers the Telegram adapter in the `Registry` and provides the
64
+ * `TelegramChat` and `TelegramBotApi` services.
65
+ *
66
+ * **Details**
67
+ *
68
+ * - The descriptor has `edit`, `delete`, `replyTo`, `download`,
69
+ * `getThread` and `getUser`, beside `post`, and whatever `unverified`
70
+ * turns on.
71
+ * - `environment: "test"` uses Telegram's test environment.
72
+ * - `apiUrl` is for a local Bot API server and is privileged configuration.
73
+ * - Fails `Unauthenticated` when the token has no bot id. The token is not
74
+ * checked against Telegram here; the first call does that.
75
+ * - The bot's username, which commands and `@` mentions need, is read with
76
+ * `getMe` on the first message and kept. While it can't be read, a
77
+ * message update is `invalid`, and Telegram sends it again.
78
+ *
79
+ * @stability unstable
80
+ * @category layers
81
+ * @since 4.1.5
82
+ */
83
+ export const layer = options => Layer.effect(TelegramChat, Effect.gen(function* () {
84
+ const api = yield* TelegramBotApi.TelegramBotApi;
85
+ const registry = yield* Registry;
86
+ const capabilities = Adapter.capabilitiesOf(options.unverified ?? {});
87
+ const {
88
+ adapter,
89
+ answer
90
+ } = Adapter.make({
91
+ api,
92
+ capabilities
93
+ });
94
+ yield* registry.register(adapter);
95
+ let username;
96
+ const env = {
97
+ api,
98
+ capabilities,
99
+ answer,
100
+ username: Effect.suspend(() => username !== undefined ? Effect.succeed(username) : api.call("getMe").pipe(Effect.flatMap(me => {
101
+ const name = Normalize.string(me, "username");
102
+ if (name === undefined) return Errors.fail("getMe", Errors.invalidResponse(false, "missing_username"));
103
+ username = name;
104
+ return Effect.succeed(name);
105
+ })))
106
+ };
107
+ return TelegramChat.of({
108
+ botId: api.botId,
109
+ environment: api.environment,
110
+ receive: Effect.fnUntraced(function* (update, receiveOptions) {
111
+ const handler = yield* ChatHandler;
112
+ return yield* Receive.receive(update, env, receiveOptions ?? {}, handler.handle);
113
+ })
114
+ });
115
+ })).pipe(Layer.provideMerge(TelegramBotApi.layer(options)));
116
+ /** `TelegramChat.receive` with the layer's `ChatHandler`, as a transport runs it. */
117
+ const transportReceive = /*#__PURE__*/Effect.fnUntraced(function* (options) {
118
+ const telegram = yield* TelegramChat;
119
+ const context = yield* Effect.context();
120
+ return update => Effect.provideContext(telegram.receive(update, options), context);
121
+ });
122
+ /**
123
+ * The header Telegram sends the webhook secret in. An app that records
124
+ * server request headers must add it to `Headers.CurrentRedactedNames`,
125
+ * keeping the names already there, in the layer it serves:
126
+ * `Layer.provideMerge` reaches the server span, `Layer.provide` on the
127
+ * webhook alone does not. The README has the setup.
128
+ *
129
+ * @stability unstable
130
+ * @category constants
131
+ * @since 4.1.5
132
+ */
133
+ export const secretHeader = Webhook.secretHeader;
134
+ /**
135
+ * `POST {path}`: the bot's webhook.
136
+ *
137
+ * **Details**
138
+ *
139
+ * - The `X-Telegram-Bot-Api-Secret-Token` header must equal
140
+ * `secretToken`, compared in constant time. Otherwise the answer is 401
141
+ * and the body is not read. The layer fails unless `secretToken` is 32 to
142
+ * 256 characters of `A-Za-z0-9_-`.
143
+ * - 413 past `maxBodyBytes` (1 MiB by default), 400 for a body that can't
144
+ * be read or is not an update. `maxBodyBytes` must be a non-negative safe
145
+ * integer; another value is a defect when the layer is built.
146
+ * - The update goes through `receive`: 200 for `accepted` and
147
+ * `unhandled`, 503 for `notAccepted` and `invalid`, which Telegram
148
+ * sends again. A click or command is answered 200 after its reply
149
+ * attempt.
150
+ *
151
+ * @stability unstable
152
+ * @category layers
153
+ * @since 4.1.5
154
+ */
155
+ export const layerWebhook = options => HttpRouter.use(Effect.fnUntraced(function* (router) {
156
+ const secret = new TextEncoder().encode(yield* Webhook.secretToken("layerWebhook", options.secretToken));
157
+ const maxBodySize = ByteSize.bytes(options.maxBodyBytes ?? 1024 * 1024);
158
+ const receive = yield* transportReceive(options);
159
+ yield* router.add("POST", options.path, request => Webhook.handleRequest(request, {
160
+ secret,
161
+ maxBodySize,
162
+ receive
163
+ }));
164
+ }));
165
+ /**
166
+ * Long polling with `getUpdates`, for a long-running process.
167
+ *
168
+ * **Details**
169
+ *
170
+ * - Updates run one at a time, in order, through `receive`. An update is
171
+ * confirmed only after it ran, so a process that dies part way sees it
172
+ * again.
173
+ * - `notAccepted` and `invalid` are retried up to `maxAttempts` times (3
174
+ * by default) with a backoff, then logged as an error and skipped:
175
+ * `getUpdates` is one queue, and retrying forever would stall the bot.
176
+ * - The layer fails with `InvalidRequest` and detail `conflict` when
177
+ * Telegram answers 409 at start: a webhook is set, or another process
178
+ * polls. It never deletes a webhook itself. A later 409 stops polling
179
+ * with an error log.
180
+ *
181
+ * @stability unstable
182
+ * @category layers
183
+ * @since 4.1.5
184
+ */
185
+ export const layerPolling = (options = {}) => Layer.effectDiscard(Effect.gen(function* () {
186
+ const api = yield* TelegramBotApi.TelegramBotApi;
187
+ const pollingOptions = {
188
+ api,
189
+ timeout: options.timeout === undefined ? Duration.seconds(30) : Duration.fromInputUnsafe(options.timeout),
190
+ maxAttempts: Math.max(1, options.maxAttempts ?? 3),
191
+ receive: yield* transportReceive(options)
192
+ };
193
+ const first = yield* Polling.getUpdates(api, undefined, Duration.zero).pipe(Effect.mapError(Polling.conflict));
194
+ yield* Effect.forkScoped(Polling.loop(first, pollingOptions));
195
+ }));
196
+ /**
197
+ * Registers the webhook with exactly the `allowed_updates` the adapter
198
+ * reads. It is never called by the adapter itself.
199
+ *
200
+ * @stability unstable
201
+ * @category webhooks
202
+ * @since 4.1.5
203
+ */
204
+ export const setWebhook = options => Effect.gen(function* () {
205
+ const secret = yield* Webhook.secretToken("setWebhook", options.secretToken);
206
+ const api = yield* TelegramBotApi.TelegramBotApi;
207
+ yield* api.call("setWebhook", {
208
+ url: options.url,
209
+ secret_token: secret,
210
+ allowed_updates: Receive.allowedUpdates,
211
+ ...(options.maxConnections === undefined ? {} : {
212
+ max_connections: options.maxConnections
213
+ }),
214
+ ...(options.dropPendingUpdates === undefined ? {} : {
215
+ drop_pending_updates: options.dropPendingUpdates
216
+ })
217
+ }, {
218
+ write: true
219
+ });
220
+ });
221
+ /**
222
+ * The `setMyCommands` payload for a group's commands.
223
+ *
224
+ * **Details**
225
+ *
226
+ * - Fails `InvalidRequest` with detail `invalid_command_names` when a
227
+ * command id is not `[a-z0-9_]{1,32}`. The portable rule allows `-`;
228
+ * Telegram does not.
229
+ * - An `argument` has no Telegram counterpart and is appended to the
230
+ * description.
231
+ * - Commands are registered as ordinary, not ephemeral: this version has
232
+ * no `ephemeral`.
233
+ *
234
+ * @stability unstable
235
+ * @category commands
236
+ * @since 4.1.5
237
+ */
238
+ export const commandRequests = group => {
239
+ const result = Commands.botCommands(group);
240
+ return "invalid" in result ? Errors.fail("commandRequests", Errors.invalidRequest("invalid_command_names")) : Effect.succeed(result);
241
+ };
242
+ /**
243
+ * Sends a group's commands with `setMyCommands`.
244
+ *
245
+ * @stability unstable
246
+ * @category commands
247
+ * @since 4.1.5
248
+ */
249
+ export const setCommands = (group, options) => Effect.gen(function* () {
250
+ const payload = yield* commandRequests(group);
251
+ const api = yield* TelegramBotApi.TelegramBotApi;
252
+ yield* api.call("setMyCommands", {
253
+ commands: payload.commands,
254
+ ...(options?.scope === undefined ? {} : {
255
+ scope: options.scope
256
+ }),
257
+ ...(options?.languageCode === undefined ? {} : {
258
+ language_code: options.languageCode
259
+ })
260
+ }, {
261
+ write: true
262
+ });
263
+ });
264
+ /**
265
+ * The address of a chat, or of a forum topic in it.
266
+ *
267
+ * @stability unstable
268
+ * @category constructors
269
+ * @since 4.1.5
270
+ */
271
+ export const thread = Address.thread;
272
+ /**
273
+ * The parts of a Telegram address, or `None` for another platform's or a
274
+ * malformed one.
275
+ *
276
+ * @stability unstable
277
+ * @category destructors
278
+ * @since 4.1.5
279
+ */
280
+ export const parts = Address.parts;
281
+ /**
282
+ * The normaliser, for a consumer's own transport. It checks no secret:
283
+ * that is the transport's job.
284
+ *
285
+ * **Details**
286
+ *
287
+ * - A `message` or `channel_post` with text, a caption, a file or rich
288
+ * content gives a `MessageCreated`. `text` is verbatim, and empty for
289
+ * an inbound rich message, whose content is only in `raw`.
290
+ * - `text_mention` entities are mentions by id. An `@username` is a
291
+ * mention only when it names the bot.
292
+ * - The author is `sender_chat` when there is one, else `from`.
293
+ * - A private (ephemeral) message, a service message, and anything from a
294
+ * business connection, a channel's direct messages or guest mode give
295
+ * none, as does every other update. Commands are messages here too:
296
+ * `receive` is what routes them.
297
+ * - `raw` is the update.
298
+ *
299
+ * @stability unstable
300
+ * @category normalization
301
+ * @since 4.1.5
302
+ */
303
+ export const normalize = Normalize.normalize;
304
+ /**
305
+ * The click or command of an update, as `receive` would dispatch it.
306
+ *
307
+ * **Details**
308
+ *
309
+ * A click is given only when its `data` is the `callback_data` of a button
310
+ * in Telegram's own copy of the message. That proves the bot put the button
311
+ * there, not that it is still current or that this user may press it.
312
+ *
313
+ * @stability unstable
314
+ * @category normalization
315
+ * @since 4.1.5
316
+ */
317
+ export const normalizeInteraction = (update, context) => {
318
+ if (!Normalize.isObject(update)) return Option.none();
319
+ return Option.fromUndefinedOr(Receive.clickEvent(update) ?? Receive.commandEvent(update, context));
320
+ };
321
+ /**
322
+ * The delivery key of an update, or of an event or interaction whose `raw`
323
+ * is one: `{botId}.{update_id}.{date}`, with `test.` in front in the test
324
+ * environment. Telegram sends an update again until it gets a 200 (or an
325
+ * offset moves past it), clicks and commands included, so a handler whose
326
+ * work must not be lost or run twice commits this key and a recoverable
327
+ * work item in one transaction before it returns. A click or command
328
+ * past its deadline counts as answered and is not sent again, so that
329
+ * holds only for a commit within the deadline. The README has the recipe.
330
+ *
331
+ * @stability unstable
332
+ * @category normalization
333
+ * @since 4.1.5
334
+ */
335
+ export const deliveryKey = (raw, context) => Option.fromUndefinedOr(Normalize.deliveryId(raw, context));
336
+ /**
337
+ * Reads a mention for `ChatTest`. A mention's text is a display name or an
338
+ * `@username`, neither of which holds the id, so this is always `None`;
339
+ * a message's `mentions` come from its entities.
340
+ *
341
+ * @stability unstable
342
+ * @category testing
343
+ * @since 4.1.5
344
+ */
345
+ export const parseMention = () => Option.none();
346
+ /**
347
+ * Scoped Telegram options for every write inside `effect`. Nested calls
348
+ * merge, the inner one winning field by field. Answers to commands and
349
+ * follow-ups ignore them.
350
+ *
351
+ * @stability unstable
352
+ * @category combinators
353
+ * @since 4.1.5
354
+ */
355
+ export const withPostOptions = /*#__PURE__*/dual(2, (effect, options) => Effect.updateService(effect, CurrentPostOptions, current => ({
356
+ ...current,
357
+ ...options
358
+ })));
359
+ //# sourceMappingURL=TelegramChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelegramChat.js","names":[],"sources":["../src/TelegramChat.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,SAAS,QAAQ,QAAQ,yBAAyB;AAGlD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AC;AACpG,CAAC;AAED;;;;;;;;;;;;;;AAcA,OAAO,MAAM,WAAW,GAAG,CACzB,GAAY,EACZ,OAAkG,KACxE,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAEtF;;;;;;;;;AASA,OAAO,MAAM,YAAY,GAAiB,MAAM,MAAM,CAAC,IAAI,EAAE;AAmB7D;;;;;;;;;AASA,OAAO,MAAM,eAAe,gBAqBxB,IAAI,CACN,CAAC,EACD,CAAU,MAA8B,EAAE,OAA4B,KACpE,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,kBAAkB,EAAG,OAAO,KAAM;EAAE,GAAG,OAAO;EAAE,GAAG;AAAO,CAAE,CAAC,CAAC,CAC9F","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @stability unstable
3
+ * @since 4.1.5
4
+ */
5
+ /**
6
+ * @stability unstable
7
+ * @since 4.1.5
8
+ */
9
+ export * as TelegramBotApi from "./TelegramBotApi.ts";
10
+ /**
11
+ * @stability unstable
12
+ * @since 4.1.5
13
+ */
14
+ export * as TelegramChat from "./TelegramChat.ts";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;GAGG;AACH,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @stability unstable
3
+ * @since 4.1.5
4
+ */
5
+ // @barrel: Auto-generated exports. Do not edit manually.
6
+ /**
7
+ * @stability unstable
8
+ * @since 4.1.5
9
+ */
10
+ export * as TelegramBotApi from "./TelegramBotApi.js";
11
+ /**
12
+ * @stability unstable
13
+ * @since 4.1.5
14
+ */
15
+ export * as TelegramChat from "./TelegramChat.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAKA;AAEA;;;;AAIA,OAAO,KAAK,cAAc,MAAM,qBAAqB;AAErD;;;;AAIA,OAAO,KAAK,YAAY,MAAM,mBAAmB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/internal/actions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,88 @@
1
+ import * as Predicate from "effect/Predicate";
2
+ import * as Errors from "./errors.js";
3
+ import { string } from "./normalize.js";
4
+ /** The adapter's own cap, as Telegram publishes no button count. @internal */
5
+ export const actionsPerMessage = 100;
6
+ /** `callback_data` is 1 to 64 bytes, less the separator. @internal */
7
+ export const actionDataLength = 63;
8
+ /** Between a button's id and its value in `callback_data`. @internal */
9
+ export const separator = "\u001f";
10
+ const encoder = /*#__PURE__*/new TextEncoder();
11
+ const bytes = s => encoder.encode(s).length;
12
+ /** A button's `callback_data`: its id, and its value after the separator when it has one. @internal */
13
+ export const callbackData = button => button.value === undefined ? button.id : button.id + separator + button.value;
14
+ /** The id and value of `callback_data`. @internal */
15
+ export const parseData = data => {
16
+ const at = data.indexOf(separator);
17
+ return at === -1 ? {
18
+ id: data
19
+ } : {
20
+ id: data.slice(0, at),
21
+ value: data.slice(at + 1)
22
+ };
23
+ };
24
+ /** A label short enough to share a row with two others. */
25
+ const shortLabel = 12;
26
+ const perRow = 3;
27
+ /**
28
+ * The inline keyboard of a message's actions, or the reason it can't be
29
+ * sent: a select (`Unsupported`), too many elements, data past 63 bytes,
30
+ * an id holding the separator, or a link that is not http or https.
31
+ *
32
+ * @internal
33
+ */
34
+ export const keyboard = actions => {
35
+ if (actions.some(action => action._tag === "Select")) return Errors.unsupported("selects");
36
+ if (actions.length > actionsPerMessage) return Errors.tooLarge(undefined, "too_many_actions");
37
+ const buttons = [];
38
+ for (const action of actions) {
39
+ if (action._tag === "Button") {
40
+ if (action.id.includes(separator)) return Errors.invalidRequest("invalid_action_id");
41
+ if (bytes(action.id) + bytes(action.value ?? "") > actionDataLength) {
42
+ return Errors.tooLarge(undefined, "action_data_too_long");
43
+ }
44
+ buttons.push({
45
+ text: action.label,
46
+ callback_data: callbackData(action),
47
+ ...(action.style === "primary" || action.style === "danger" ? {
48
+ style: action.style
49
+ } : {})
50
+ });
51
+ } else if (action._tag === "LinkButton") {
52
+ if (!/^https?:\/\//i.test(action.url)) return Errors.invalidRequest("untrusted_url");
53
+ buttons.push({
54
+ text: action.label,
55
+ url: action.url
56
+ });
57
+ }
58
+ }
59
+ const rows = [];
60
+ let row = [];
61
+ for (const button of buttons) {
62
+ const short = button.text.length <= shortLabel;
63
+ if (!short || row.length === perRow || row.some(b => b.text.length > shortLabel)) {
64
+ if (row.length > 0) rows.push(row);
65
+ row = [];
66
+ }
67
+ row.push(button);
68
+ }
69
+ if (row.length > 0) rows.push(row);
70
+ return {
71
+ inline_keyboard: rows
72
+ };
73
+ };
74
+ /** Every `callback_data` in a message's `reply_markup`. @internal */
75
+ export const keyboardData = replyMarkup => {
76
+ const data = new Set();
77
+ const rows = Predicate.isObject(replyMarkup) ? replyMarkup.inline_keyboard : undefined;
78
+ if (!Array.isArray(rows)) return data;
79
+ for (const row of rows) {
80
+ if (!Array.isArray(row)) continue;
81
+ for (const button of row) {
82
+ const value = string(button, "callback_data");
83
+ if (value !== undefined) data.add(value);
84
+ }
85
+ }
86
+ return data;
87
+ };
88
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","names":[],"sources":["../../src/internal/actions.ts"],"sourcesContent":[null],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,kBAAkB;AAC7C,OAAO,KAAK,MAAM,MAAM,aAAa;AACrC,SAAS,MAAM,QAAQ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,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;MAClC,GAAG,GAAG,EAAE;IACV;IACA,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;EAClB;EACA,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;EAClC,OAAO;IAAE,eAAe,EAAE;EAAI,CAAE;AAClC,CAAC;AAED;AACA,OAAO,MAAM,YAAY,GAAI,WAAoB,IAAyB;EACxE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU;EAC9B,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC,eAAe,GAAG,SAAS;EACtF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI;EACrC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;IACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IACzB,KAAK,MAAM,MAAM,IAAI,GAAG,EAAE;MACxB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;MAC7C,IAAI,KAAK,KAAK,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC1C;EACF;EACA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/internal/adapter.ts"],"names":[],"mappings":""}