@effect/chat-telegram 0.0.0 → 4.1.5
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/AGENTS.md +434 -0
- package/CLAUDE.md +434 -0
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +7 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +163 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +111 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/40_sql/10_basics.ts +175 -0
- package/ai-docs/src/40_sql/index.md +6 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +118 -0
- package/ai-docs/src/51_http-server/20_testing.ts +100 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/52_graphql/10_basics.ts +117 -0
- package/ai-docs/src/52_graphql/20_testing.ts +45 -0
- package/ai-docs/src/52_graphql/30_batching.ts +118 -0
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +124 -0
- package/ai-docs/src/52_graphql/50_errors-and-retries.ts +74 -0
- package/ai-docs/src/52_graphql/index.md +6 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +162 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +28 -0
- package/dist/TelegramBotApi.d.ts +153 -0
- package/dist/TelegramBotApi.d.ts.map +1 -0
- package/dist/TelegramBotApi.js +219 -0
- package/dist/TelegramBotApi.js.map +1 -0
- package/dist/TelegramChat.d.ts +390 -0
- package/dist/TelegramChat.d.ts.map +1 -0
- package/dist/TelegramChat.js +359 -0
- package/dist/TelegramChat.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/actions.d.ts +2 -0
- package/dist/internal/actions.d.ts.map +1 -0
- package/dist/internal/actions.js +88 -0
- package/dist/internal/actions.js.map +1 -0
- package/dist/internal/adapter.d.ts +2 -0
- package/dist/internal/adapter.d.ts.map +1 -0
- package/dist/internal/adapter.js +309 -0
- package/dist/internal/adapter.js.map +1 -0
- package/dist/internal/address.d.ts +2 -0
- package/dist/internal/address.d.ts.map +1 -0
- package/dist/internal/address.js +26 -0
- package/dist/internal/address.js.map +1 -0
- package/dist/internal/commands.d.ts +2 -0
- package/dist/internal/commands.d.ts.map +1 -0
- package/dist/internal/commands.js +30 -0
- package/dist/internal/commands.js.map +1 -0
- package/dist/internal/errors.d.ts +2 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +136 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/markdown.d.ts +9 -0
- package/dist/internal/markdown.d.ts.map +1 -0
- package/dist/internal/markdown.js +708 -0
- package/dist/internal/markdown.js.map +1 -0
- package/dist/internal/normalize.d.ts +2 -0
- package/dist/internal/normalize.d.ts.map +1 -0
- package/dist/internal/normalize.js +276 -0
- package/dist/internal/normalize.js.map +1 -0
- package/dist/internal/options.d.ts +2 -0
- package/dist/internal/options.d.ts.map +1 -0
- package/dist/internal/options.js +6 -0
- package/dist/internal/options.js.map +1 -0
- package/dist/internal/polling.d.ts +2 -0
- package/dist/internal/polling.d.ts.map +1 -0
- package/dist/internal/polling.js +68 -0
- package/dist/internal/polling.js.map +1 -0
- package/dist/internal/receive.d.ts +2 -0
- package/dist/internal/receive.d.ts.map +1 -0
- package/dist/internal/receive.js +183 -0
- package/dist/internal/receive.js.map +1 -0
- package/dist/internal/webhook.d.ts +2 -0
- package/dist/internal/webhook.d.ts.map +1 -0
- package/dist/internal/webhook.js +61 -0
- package/dist/internal/webhook.js.map +1 -0
- package/package.json +65 -1
- package/src/TelegramBotApi.ts +282 -0
- package/src/TelegramChat.ts +542 -0
- package/src/index.ts +18 -0
- package/src/internal/actions.ts +95 -0
- package/src/internal/adapter.ts +319 -0
- package/src/internal/address.ts +33 -0
- package/src/internal/commands.ts +37 -0
- package/src/internal/errors.ts +148 -0
- package/src/internal/markdown.ts +805 -0
- package/src/internal/normalize.ts +283 -0
- package/src/internal/options.ts +12 -0
- package/src/internal/polling.ts +86 -0
- package/src/internal/receive.ts +268 -0
- package/src/internal/webhook.ts +85 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "../tsconfig.base.json",
|
|
4
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"rootDir": ".",
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"declarationMap": false,
|
|
10
|
+
"composite": false,
|
|
11
|
+
"incremental": false,
|
|
12
|
+
"types": ["node"],
|
|
13
|
+
"plugins": [
|
|
14
|
+
{
|
|
15
|
+
"name": "@effect/language-service",
|
|
16
|
+
"effectFn": ["untraced"],
|
|
17
|
+
"namespaceImportPackages": [],
|
|
18
|
+
"diagnosticSeverity": {
|
|
19
|
+
"floatingEffect": "off",
|
|
20
|
+
"globalJson": "off",
|
|
21
|
+
"globalJsonInEffect": "off",
|
|
22
|
+
"unstableApiUsage": "off",
|
|
23
|
+
"effectFnOpportunity": "error"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal Bot API client the Telegram adapter is built on. It is public,
|
|
3
|
+
* so a consumer can call a method the adapter has no op for, with the same
|
|
4
|
+
* error mapping, the same rule for writes and the same care for the token.
|
|
5
|
+
*
|
|
6
|
+
* **Details**
|
|
7
|
+
*
|
|
8
|
+
* The bot token is part of every request's path, and `HttpClient` records
|
|
9
|
+
* the path of a request in its span and in its errors. So the client's own
|
|
10
|
+
* span is turned off for every request made here, and each call gets a span
|
|
11
|
+
* `TelegramBotApi.{method}` whose `url.path` is `/bot<redacted>/{method}`.
|
|
12
|
+
* Every failure becomes a `ChatError` whose `cause` holds no request,
|
|
13
|
+
* response or URL.
|
|
14
|
+
*
|
|
15
|
+
* @stability unstable
|
|
16
|
+
* @since 4.1.5
|
|
17
|
+
*/
|
|
18
|
+
import { type File } from "effect/chat/ChatAdapter";
|
|
19
|
+
import type { ChatError } from "effect/chat/ChatError";
|
|
20
|
+
import * as Context from "effect/Context";
|
|
21
|
+
import * as Effect from "effect/Effect";
|
|
22
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
23
|
+
import * as Layer from "effect/Layer";
|
|
24
|
+
import * as Redacted from "effect/Redacted";
|
|
25
|
+
import * as Schema from "effect/Schema";
|
|
26
|
+
import * as Stream from "effect/Stream";
|
|
27
|
+
/**
|
|
28
|
+
* Which Telegram environment a bot lives in. The test environment has its
|
|
29
|
+
* own accounts and bots, and its methods sit under `/bot<token>/test/`.
|
|
30
|
+
*
|
|
31
|
+
* @stability unstable
|
|
32
|
+
* @category models
|
|
33
|
+
* @since 4.1.5
|
|
34
|
+
*/
|
|
35
|
+
export type Environment = "production" | "test";
|
|
36
|
+
declare const TelegramChatMigrated_base: Schema.Class<TelegramChatMigrated, Schema.TaggedStruct<"TelegramChatMigrated", {
|
|
37
|
+
readonly thread: Schema.Struct<{
|
|
38
|
+
readonly platform: Schema.String;
|
|
39
|
+
readonly id: Schema.String;
|
|
40
|
+
}>;
|
|
41
|
+
}>, import("effect/Cause").YieldableError>;
|
|
42
|
+
/**
|
|
43
|
+
* The cause of a `NotFound` with detail `chat_migrated`: the group became
|
|
44
|
+
* a supergroup, which has a new chat id. The adapter does not follow it,
|
|
45
|
+
* since the consumer is the one that stores the old address.
|
|
46
|
+
*
|
|
47
|
+
* @stability unstable
|
|
48
|
+
* @category errors
|
|
49
|
+
* @since 4.1.5
|
|
50
|
+
*/
|
|
51
|
+
export declare class TelegramChatMigrated extends TelegramChatMigrated_base {
|
|
52
|
+
get message(): string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for one Bot API call.
|
|
56
|
+
*
|
|
57
|
+
* @stability unstable
|
|
58
|
+
* @category models
|
|
59
|
+
* @since 4.1.5
|
|
60
|
+
*/
|
|
61
|
+
export interface CallOptions {
|
|
62
|
+
/**
|
|
63
|
+
* The call changes something. It is never repeated once the request left,
|
|
64
|
+
* and a failure that may have landed is `uncertain`.
|
|
65
|
+
*/
|
|
66
|
+
readonly write?: boolean | undefined;
|
|
67
|
+
/** Files sent as parts of a `multipart/form-data` body, each under its `field`. */
|
|
68
|
+
readonly files?: ReadonlyArray<{
|
|
69
|
+
readonly field: string;
|
|
70
|
+
readonly file: File;
|
|
71
|
+
}> | undefined;
|
|
72
|
+
/** Retry `retry` failures, as `ChatAdapter.retrySafe` does. Default true. */
|
|
73
|
+
readonly retry?: boolean | undefined;
|
|
74
|
+
}
|
|
75
|
+
declare const TelegramBotApi_base: Context.ServiceClass<TelegramBotApi, "@effect/chat-telegram/TelegramBotApi", {
|
|
76
|
+
readonly botId: string;
|
|
77
|
+
readonly environment: Environment;
|
|
78
|
+
readonly call: (method: string, params?: Readonly<Record<string, unknown>> | undefined, options?: CallOptions | undefined) => Effect.Effect<Schema.Json, ChatError>;
|
|
79
|
+
readonly file: (filePath: string, options: {
|
|
80
|
+
readonly maxBytes: number;
|
|
81
|
+
}) => Stream.Stream<Uint8Array, ChatError>;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* The Bot API client, with the bot's token.
|
|
85
|
+
*
|
|
86
|
+
* **Details**
|
|
87
|
+
*
|
|
88
|
+
* - `call` posts `params` to a method and succeeds with its `result`.
|
|
89
|
+
* Objects in `params` are sent as JSON; with `files` the body is
|
|
90
|
+
* multipart and each object is a JSON string part.
|
|
91
|
+
* - An answer with `ok: false` fails with the reason for its `error_code`
|
|
92
|
+
* and `parameters`. Its `detail` is a fixed string, never Telegram's
|
|
93
|
+
* description, which can quote the message. A `migrate_to_chat_id` gives
|
|
94
|
+
* `NotFound` with detail `chat_migrated` and a `TelegramChatMigrated`
|
|
95
|
+
* cause.
|
|
96
|
+
* - `file` streams a file by its `file_path` from `getFile`, failing
|
|
97
|
+
* `TooLarge` once more than `maxBytes` arrive. Redirects are refused.
|
|
98
|
+
* - `botId` is the numeric id in front of the token's colon.
|
|
99
|
+
* - The error's `op` is the method.
|
|
100
|
+
*
|
|
101
|
+
* @stability unstable
|
|
102
|
+
* @category services
|
|
103
|
+
* @since 4.1.5
|
|
104
|
+
*/
|
|
105
|
+
export declare class TelegramBotApi extends TelegramBotApi_base {
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The cloud Bot API server.
|
|
109
|
+
*
|
|
110
|
+
* @stability unstable
|
|
111
|
+
* @category constants
|
|
112
|
+
* @since 4.1.5
|
|
113
|
+
*/
|
|
114
|
+
export declare const defaultApiUrl = "https://api.telegram.org";
|
|
115
|
+
/**
|
|
116
|
+
* Builds the client from an `HttpClient` and a bot token.
|
|
117
|
+
*
|
|
118
|
+
* **Details**
|
|
119
|
+
*
|
|
120
|
+
* Fails `Unauthenticated` with detail `invalid_token` when the token has
|
|
121
|
+
* no numeric bot id in front of a colon. `apiUrl` is for a local Bot API
|
|
122
|
+
* server and is privileged configuration.
|
|
123
|
+
*
|
|
124
|
+
* @stability unstable
|
|
125
|
+
* @category constructors
|
|
126
|
+
* @since 4.1.5
|
|
127
|
+
*/
|
|
128
|
+
export declare const make: (options: {
|
|
129
|
+
readonly token: Redacted.Redacted<string>;
|
|
130
|
+
readonly environment?: Environment | undefined;
|
|
131
|
+
readonly apiUrl?: string | undefined;
|
|
132
|
+
}) => Effect.Effect<{
|
|
133
|
+
readonly botId: string;
|
|
134
|
+
readonly environment: Environment;
|
|
135
|
+
readonly call: (method: string, params?: Readonly<Record<string, unknown>> | undefined, options?: CallOptions | undefined) => Effect.Effect<Schema.Json, ChatError>;
|
|
136
|
+
readonly file: (filePath: string, options: {
|
|
137
|
+
readonly maxBytes: number;
|
|
138
|
+
}) => Stream.Stream<Uint8Array, ChatError>;
|
|
139
|
+
}, ChatError, HttpClient.HttpClient>;
|
|
140
|
+
/**
|
|
141
|
+
* The client as a layer.
|
|
142
|
+
*
|
|
143
|
+
* @stability unstable
|
|
144
|
+
* @category layers
|
|
145
|
+
* @since 4.1.5
|
|
146
|
+
*/
|
|
147
|
+
export declare const layer: (options: {
|
|
148
|
+
readonly token: Redacted.Redacted<string>;
|
|
149
|
+
readonly environment?: Environment | undefined;
|
|
150
|
+
readonly apiUrl?: string | undefined;
|
|
151
|
+
}) => Layer.Layer<TelegramBotApi, ChatError, HttpClient.HttpClient>;
|
|
152
|
+
export {};
|
|
153
|
+
//# sourceMappingURL=TelegramBotApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TelegramBotApi.d.ts","sourceRoot":"","sources":["../src/TelegramBotApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,IAAI,EAAa,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAGpD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,MAAM,CAAA;;;;;;;AAE/C;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,yBAIxC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,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SAAS,CAAC;mBAC3B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC;oCA4JjH,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,YAAa;IAC7B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC,KAAG,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,SAAS,EAAE,UAAU,CAAC,UAAU,CAAgD,CAAA"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal Bot API client the Telegram adapter is built on. It is public,
|
|
3
|
+
* so a consumer can call a method the adapter has no op for, with the same
|
|
4
|
+
* error mapping, the same rule for writes and the same care for the token.
|
|
5
|
+
*
|
|
6
|
+
* **Details**
|
|
7
|
+
*
|
|
8
|
+
* The bot token is part of every request's path, and `HttpClient` records
|
|
9
|
+
* the path of a request in its span and in its errors. So the client's own
|
|
10
|
+
* span is turned off for every request made here, and each call gets a span
|
|
11
|
+
* `TelegramBotApi.{method}` whose `url.path` is `/bot<redacted>/{method}`.
|
|
12
|
+
* Every failure becomes a `ChatError` whose `cause` holds no request,
|
|
13
|
+
* response or URL.
|
|
14
|
+
*
|
|
15
|
+
* @stability unstable
|
|
16
|
+
* @since 4.1.5
|
|
17
|
+
*/
|
|
18
|
+
import { retrySafe } from "effect/chat/ChatAdapter";
|
|
19
|
+
import { ChatThread } from "effect/chat/ChatThread";
|
|
20
|
+
import * as Context from "effect/Context";
|
|
21
|
+
import * as Effect from "effect/Effect";
|
|
22
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
23
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
24
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
25
|
+
import * as Layer from "effect/Layer";
|
|
26
|
+
import { isObject } from "effect/Predicate";
|
|
27
|
+
import * as Redacted from "effect/Redacted";
|
|
28
|
+
import * as Schema from "effect/Schema";
|
|
29
|
+
import * as Stream from "effect/Stream";
|
|
30
|
+
import * as Address from "./internal/address.js";
|
|
31
|
+
import * as Errors from "./internal/errors.js";
|
|
32
|
+
/**
|
|
33
|
+
* The cause of a `NotFound` with detail `chat_migrated`: the group became
|
|
34
|
+
* a supergroup, which has a new chat id. The adapter does not follow it,
|
|
35
|
+
* since the consumer is the one that stores the old address.
|
|
36
|
+
*
|
|
37
|
+
* @stability unstable
|
|
38
|
+
* @category errors
|
|
39
|
+
* @since 4.1.5
|
|
40
|
+
*/
|
|
41
|
+
export class TelegramChatMigrated extends /*#__PURE__*/Schema.TaggedError("@effect/chat-telegram/TelegramBotApi/TelegramChatMigrated")("TelegramChatMigrated", {
|
|
42
|
+
thread: ChatThread
|
|
43
|
+
}) {
|
|
44
|
+
get message() {
|
|
45
|
+
return "The Telegram group became a supergroup with a new address";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The Bot API client, with the bot's token.
|
|
50
|
+
*
|
|
51
|
+
* **Details**
|
|
52
|
+
*
|
|
53
|
+
* - `call` posts `params` to a method and succeeds with its `result`.
|
|
54
|
+
* Objects in `params` are sent as JSON; with `files` the body is
|
|
55
|
+
* multipart and each object is a JSON string part.
|
|
56
|
+
* - An answer with `ok: false` fails with the reason for its `error_code`
|
|
57
|
+
* and `parameters`. Its `detail` is a fixed string, never Telegram's
|
|
58
|
+
* description, which can quote the message. A `migrate_to_chat_id` gives
|
|
59
|
+
* `NotFound` with detail `chat_migrated` and a `TelegramChatMigrated`
|
|
60
|
+
* cause.
|
|
61
|
+
* - `file` streams a file by its `file_path` from `getFile`, failing
|
|
62
|
+
* `TooLarge` once more than `maxBytes` arrive. Redirects are refused.
|
|
63
|
+
* - `botId` is the numeric id in front of the token's colon.
|
|
64
|
+
* - The error's `op` is the method.
|
|
65
|
+
*
|
|
66
|
+
* @stability unstable
|
|
67
|
+
* @category services
|
|
68
|
+
* @since 4.1.5
|
|
69
|
+
*/
|
|
70
|
+
export class TelegramBotApi extends /*#__PURE__*/Context.Service()("@effect/chat-telegram/TelegramBotApi") {}
|
|
71
|
+
/**
|
|
72
|
+
* The cloud Bot API server.
|
|
73
|
+
*
|
|
74
|
+
* @stability unstable
|
|
75
|
+
* @category constants
|
|
76
|
+
* @since 4.1.5
|
|
77
|
+
*/
|
|
78
|
+
export const defaultApiUrl = "https://api.telegram.org";
|
|
79
|
+
const methodName = /^[A-Za-z]{1,64}$/;
|
|
80
|
+
const filePath = /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$/;
|
|
81
|
+
const formValue = value => typeof value === "string" ? value : JSON.stringify(value);
|
|
82
|
+
/**
|
|
83
|
+
* Builds the client from an `HttpClient` and a bot token.
|
|
84
|
+
*
|
|
85
|
+
* **Details**
|
|
86
|
+
*
|
|
87
|
+
* Fails `Unauthenticated` with detail `invalid_token` when the token has
|
|
88
|
+
* no numeric bot id in front of a colon. `apiUrl` is for a local Bot API
|
|
89
|
+
* server and is privileged configuration.
|
|
90
|
+
*
|
|
91
|
+
* @stability unstable
|
|
92
|
+
* @category constructors
|
|
93
|
+
* @since 4.1.5
|
|
94
|
+
*/
|
|
95
|
+
export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
96
|
+
const http = yield* HttpClient.HttpClient;
|
|
97
|
+
const environment = options.environment ?? "production";
|
|
98
|
+
const apiUrl = (options.apiUrl ?? defaultApiUrl).replace(/\/+$/, "");
|
|
99
|
+
const botId = /^(\d{1,20}):[A-Za-z0-9_-]+$/.exec(Redacted.value(options.token))?.[1];
|
|
100
|
+
if (botId === undefined) {
|
|
101
|
+
return yield* Errors.fail("layer", Errors.unauthenticatedToken);
|
|
102
|
+
}
|
|
103
|
+
const suffix = environment === "test" ? "/test" : "";
|
|
104
|
+
const methodUrl = method => `${apiUrl}/bot${Redacted.value(options.token)}${suffix}/${method}`;
|
|
105
|
+
const fileUrl = path => `${apiUrl}/file/bot${Redacted.value(options.token)}${suffix}/${path}`;
|
|
106
|
+
// Redirects are never followed: the next hop would see the token in the path.
|
|
107
|
+
const send = (request, op, write) => Effect.flatMap(Effect.serviceOption(FetchHttpClient.RequestInit), init => http.execute(request).pipe(Effect.provideService(HttpClient.TracerDisabledWhen, () => true), Effect.provideService(FetchHttpClient.RequestInit, {
|
|
108
|
+
...(init._tag === "Some" ? init.value : {}),
|
|
109
|
+
redirect: "manual"
|
|
110
|
+
}), Effect.mapError(error => Errors.chatError(op, Errors.transport(write, error.reason._tag)))));
|
|
111
|
+
const decode = (op, write, response) => {
|
|
112
|
+
const success = response.status >= 200 && response.status < 300;
|
|
113
|
+
const statusError = {
|
|
114
|
+
code: response.status,
|
|
115
|
+
description: ""
|
|
116
|
+
};
|
|
117
|
+
return response.json.pipe(Effect.matchEffect({
|
|
118
|
+
onFailure: () => Errors.fail(op, success ? Errors.invalidResponse(write, "invalid_json") : Errors.reasonForApiError(statusError, {
|
|
119
|
+
write
|
|
120
|
+
})),
|
|
121
|
+
onSuccess: body => {
|
|
122
|
+
if (isObject(body) && body.ok === true && "result" in body) return Effect.succeed(body.result);
|
|
123
|
+
const error = Errors.apiError(body, response.status) ?? (success ? undefined : statusError);
|
|
124
|
+
if (error === undefined) return Errors.fail(op, Errors.invalidResponse(write, "invalid_answer"));
|
|
125
|
+
const cause = error.migrateTo === undefined ? undefined : new TelegramChatMigrated({
|
|
126
|
+
thread: Address.thread(error.migrateTo)
|
|
127
|
+
});
|
|
128
|
+
return Errors.fail(op, Errors.reasonForApiError(error, {
|
|
129
|
+
write,
|
|
130
|
+
cause
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
const once = (method, params, callOptions) => {
|
|
136
|
+
const write = callOptions.write === true;
|
|
137
|
+
let request = HttpClientRequest.post(methodUrl(method));
|
|
138
|
+
if (callOptions.files !== undefined && callOptions.files.length > 0) {
|
|
139
|
+
const form = new FormData();
|
|
140
|
+
for (const [key, value] of Object.entries(params)) {
|
|
141
|
+
if (value !== undefined) form.append(key, formValue(value));
|
|
142
|
+
}
|
|
143
|
+
for (const {
|
|
144
|
+
field,
|
|
145
|
+
file
|
|
146
|
+
} of callOptions.files) {
|
|
147
|
+
form.append(field, new Blob([file.content], {
|
|
148
|
+
type: file.contentType
|
|
149
|
+
}), file.name);
|
|
150
|
+
}
|
|
151
|
+
request = HttpClientRequest.bodyFormData(request, form);
|
|
152
|
+
} else {
|
|
153
|
+
request = HttpClientRequest.bodyJsonUnsafe(request, params);
|
|
154
|
+
}
|
|
155
|
+
return Effect.flatMap(send(request, method, write), response => decode(method, write, response)).pipe(Effect.withSpan(`TelegramBotApi.${method}`, {
|
|
156
|
+
kind: "client",
|
|
157
|
+
attributes: {
|
|
158
|
+
"http.request.method": "POST",
|
|
159
|
+
"url.path": `/bot<redacted>${suffix}/${method}`,
|
|
160
|
+
"telegram.method": method
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
};
|
|
164
|
+
const call = (method, params = {}, callOptions = {}) => {
|
|
165
|
+
if (!methodName.test(method)) return Errors.fail(method, Errors.invalidRequest("invalid_method"));
|
|
166
|
+
const effect = once(method, params, callOptions);
|
|
167
|
+
return callOptions.retry === false ? effect : retrySafe(effect);
|
|
168
|
+
};
|
|
169
|
+
const file = (path, {
|
|
170
|
+
maxBytes
|
|
171
|
+
}) => Stream.unwrap(Effect.gen(function* () {
|
|
172
|
+
const op = "download";
|
|
173
|
+
if (!filePath.test(path) || path.split("/").some(segment => segment === "." || segment === "..")) {
|
|
174
|
+
return yield* Errors.fail(op, Errors.invalidResponse(false, "untrusted_file_path"));
|
|
175
|
+
}
|
|
176
|
+
const url = fileUrl(path);
|
|
177
|
+
const response = yield* send(HttpClientRequest.get(url), op, false);
|
|
178
|
+
if (response.status >= 300 && response.status < 400 || response.url !== url) {
|
|
179
|
+
return yield* Errors.fail(op, Errors.invalidResponse(false, "redirect"));
|
|
180
|
+
}
|
|
181
|
+
if (response.status < 200 || response.status >= 300) {
|
|
182
|
+
return yield* Errors.fail(op, Errors.reasonForApiError({
|
|
183
|
+
code: response.status,
|
|
184
|
+
description: ""
|
|
185
|
+
}, {
|
|
186
|
+
write: false
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
const tooLarge = Errors.chatError(op, Errors.tooLarge("files", "max_bytes"));
|
|
190
|
+
const length = Number(response.headers["content-length"]);
|
|
191
|
+
if (Number.isFinite(length) && length > maxBytes) return yield* Effect.fail(tooLarge);
|
|
192
|
+
let received = 0;
|
|
193
|
+
return response.stream.pipe(Stream.mapError(error => Errors.chatError(op, Errors.transport(false, error.reason._tag))), Stream.mapEffect(chunk => {
|
|
194
|
+
received += chunk.length;
|
|
195
|
+
return received > maxBytes ? Effect.fail(tooLarge) : Effect.succeed(chunk);
|
|
196
|
+
}));
|
|
197
|
+
}).pipe(Effect.withSpan("TelegramBotApi.file", {
|
|
198
|
+
kind: "client",
|
|
199
|
+
attributes: {
|
|
200
|
+
"http.request.method": "GET",
|
|
201
|
+
"url.path": "/file/bot<redacted>"
|
|
202
|
+
}
|
|
203
|
+
})));
|
|
204
|
+
return TelegramBotApi.of({
|
|
205
|
+
botId,
|
|
206
|
+
environment,
|
|
207
|
+
call,
|
|
208
|
+
file
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* The client as a layer.
|
|
213
|
+
*
|
|
214
|
+
* @stability unstable
|
|
215
|
+
* @category layers
|
|
216
|
+
* @since 4.1.5
|
|
217
|
+
*/
|
|
218
|
+
export const layer = options => Layer.effect(TelegramBotApi, make(options));
|
|
219
|
+
//# sourceMappingURL=TelegramBotApi.js.map
|
|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