@ligeti/step-telegram-notify 0.0.0-stage → 2.1.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Viktor "Bika" Nagy
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # @ligeti/step-telegram-notify
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Sends a message to a Telegram chat, group, channel or forum topic via the
4
+ [Telegram Bot API](https://core.telegram.org/bots/api#sendmessage), as the `telegram.notify` step.
5
+
6
+ ## Environment variables
7
+
8
+ Settings are read from the environment of the **worker process** that runs the step (`ligeti serve`
9
+ loads `.env` from the current directory and passes its environment on to each worker), and are
10
+ parsed on every invocation. An invalid environment fails the step with an error listing every
11
+ offending variable.
12
+
13
+ | Variable | Required | Default | Purpose |
14
+ | ------------------------------ | -------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | `LIGETI_TELEGRAM_BOT_TOKEN` | yes | -- | Bot token from [@BotFather](https://t.me/BotFather), e.g. `123456:ABC-DEF...`. Secret; see below. |
16
+ | `LIGETI_TELEGRAM_CHAT_ID` | no | none | Fallback chat to send to when a run omits the `chatId` input. A numeric id (`-1001234567890`) or an `@channelusername`. |
17
+ | `LIGETI_TELEGRAM_API_BASE_URL` | no | `https://api.telegram.org` | Base URL of the Bot API. Point it at a [local Bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server) or, in tests, a stub. Trailing slashes are stripped. |
18
+
19
+ Example:
20
+
21
+ ```sh
22
+ LIGETI_TELEGRAM_BOT_TOKEN=123456789:AAExampleTokenFromBotFather
23
+ LIGETI_TELEGRAM_CHAT_ID=-1001234567890
24
+ # LIGETI_TELEGRAM_API_BASE_URL=https://api.telegram.org
25
+ ```
26
+
27
+ ### The bot token is a secret
28
+
29
+ The token appears in the path of every Bot API request URL
30
+ (`https://api.telegram.org/bot<token>/sendMessage`), so it can leak through any error that quotes a
31
+ URL. This package redacts it from every error message and stack trace it raises, but the token
32
+ should never be logged, echoed into a status update, or committed to the repository.
33
+
34
+ ### Getting the two values
35
+
36
+ 1. Talk to [@BotFather](https://t.me/BotFather), `/newbot`, and copy the token it gives you into
37
+ `LIGETI_TELEGRAM_BOT_TOKEN`.
38
+ 2. Add the bot to the target chat or channel (as an admin, for a channel), send it a message, then
39
+ read the chat id out of `https://api.telegram.org/bot<token>/getUpdates`. A public channel or
40
+ supergroup can use its `@username` instead.
41
+
42
+ ## Inputs
43
+
44
+ `chatId` and `LIGETI_TELEGRAM_CHAT_ID` are the only overlapping settings: the per-run input wins,
45
+ and the environment variable is used only as a fallback. If neither is set, the step fails with an
46
+ error saying so. Everything else that drives a message is a per-run input, not an environment
47
+ variable:
48
+
49
+ | Input | Required | Notes |
50
+ | --------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
51
+ | `text` | yes | 1..4096 characters (UTF-16 units, as Telegram counts them); over-long text is rejected, never truncated. |
52
+ | `chatId` | no | Overrides `LIGETI_TELEGRAM_CHAT_ID`. |
53
+ | `parseMode` | no | `HTML` or `MarkdownV2`; omitted sends plain text, the safe default for machine-generated text. |
54
+ | `disableNotification` | no | Send silently, without a notification sound. |
55
+ | `messageThreadId` | no | Forum topic thread id, for chats with topics enabled. |
56
+
57
+ On success the step returns `messageId`, `chatId` and `date` as Telegram reported them.
58
+
59
+ ## Retry behaviour
60
+
61
+ Retries are handled inside the step and are not configurable through the environment. Transient
62
+ failures (HTTP 429, 408, 425, 5xx and network errors) are retried up to 3 attempts total, with
63
+ exponential backoff and full jitter for 5xx/network failures and Telegram's own `retry_after` for a 429. A 429 asking for a wait longer than 30s is not slept out -- retrying early during a flood wait
64
+ risks extending the ban, so the step fails with `TelegramRateLimitedError` carrying the wait
65
+ Telegram asked for. Permanent failures (invalid token, bad chat id, rejected message body, bot
66
+ blocked or kicked) fail immediately with `TelegramPermanentError`. DBOS-level retry is deliberately
67
+ off: DBOS cannot honour Telegram's `retry_after`, so a DBOS retry during a flood wait can extend the
68
+ ban, and a network failure after delivery cannot be told apart from one before it, so every extra
69
+ retry risks a duplicate message.
@@ -0,0 +1,4 @@
1
+ export { TelegramNotifyInput, TelegramNotifyOutput } from "./types.js";
2
+ export { telegramNotify } from "./notify.js";
3
+ export { TelegramMalformedResponseError, TelegramPermanentError, TelegramRateLimitedError, TelegramRetriesExhaustedError, } from "./telegram.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ // ABOUTME: Public entry point of @ligeti/step-telegram-notify: the telegramNotify step, its
2
+ // ABOUTME: input/output types, and the errors a caller needs to distinguish permanent failures.
3
+ export { TelegramNotifyInput, TelegramNotifyOutput } from "./types.js";
4
+ export { telegramNotify } from "./notify.js";
5
+ export { TelegramMalformedResponseError, TelegramPermanentError, TelegramRateLimitedError, TelegramRetriesExhaustedError, } from "./telegram.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,gGAAgG;AAChG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type StepDefinition } from "@ligeti/sdk";
2
+ import { TelegramNotifyInput, TelegramNotifyOutput } from "./types.js";
3
+ export declare const telegramNotify: StepDefinition<typeof TelegramNotifyInput, typeof TelegramNotifyOutput>;
4
+ //# sourceMappingURL=notify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAI9D,OAAO,EAAmB,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAExF,eAAO,MAAM,cAAc,EAAE,cAAc,CACzC,OAAO,mBAAmB,EAC1B,OAAO,oBAAoB,CAgD3B,CAAC"}
package/dist/notify.js ADDED
@@ -0,0 +1,44 @@
1
+ // ABOUTME: telegramNotify, the step that sends a message to a Telegram chat via the Bot API,
2
+ // ABOUTME: mapping camelCase input to the Bot API's snake_case sendMessage params.
3
+ import { defineStep } from "@ligeti/sdk";
4
+ import pkg from "../package.json" with { type: "json" };
5
+ import { TELEGRAM_ENV_VARS, loadTelegramNotifySettings } from "./settings.js";
6
+ import { sendMessage } from "./telegram.js";
7
+ import { CHAT_ID_PATTERN, TelegramNotifyInput, TelegramNotifyOutput } from "./types.js";
8
+ export const telegramNotify = defineStep({
9
+ name: "telegram.notify",
10
+ envVars: TELEGRAM_ENV_VARS,
11
+ description: "Sends a message to a Telegram chat or channel via the Telegram Bot API.",
12
+ package: { name: pkg.name, version: pkg.version },
13
+ input: TelegramNotifyInput,
14
+ output: TelegramNotifyOutput,
15
+ retry: { maxAttempts: 1 },
16
+ async run(sctx, input) {
17
+ const settings = loadTelegramNotifySettings();
18
+ const chatId = input.chatId ?? settings.defaultChatId;
19
+ if (chatId === undefined) {
20
+ throw new Error("telegram.notify: no chat id given -- pass the `chatId` input or set the " +
21
+ "LIGETI_TELEGRAM_CHAT_ID environment variable");
22
+ }
23
+ if (input.chatId === undefined && !CHAT_ID_PATTERN.test(chatId)) {
24
+ throw new Error(`telegram.notify: LIGETI_TELEGRAM_CHAT_ID is not a valid chat id (${JSON.stringify(chatId)}) -- ` +
25
+ 'it must be a numeric chat id (e.g. "-1001234567890") or an "@channelusername"');
26
+ }
27
+ const params = {
28
+ chat_id: chatId,
29
+ text: input.text,
30
+ ...(input.parseMode !== undefined ? { parse_mode: input.parseMode } : {}),
31
+ ...(input.disableNotification !== undefined
32
+ ? { disable_notification: input.disableNotification }
33
+ : {}),
34
+ ...(input.messageThreadId !== undefined ? { message_thread_id: input.messageThreadId } : {}),
35
+ };
36
+ const result = await sendMessage({ botToken: settings.botToken, apiBaseUrl: settings.apiBaseUrl }, params, sctx.signal);
37
+ return {
38
+ messageId: result.messageId,
39
+ chatId: result.chatId,
40
+ date: result.date,
41
+ };
42
+ },
43
+ });
44
+ //# sourceMappingURL=notify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,mFAAmF;AACnF,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9D,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,WAAW,EAA0B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,CAAC,MAAM,cAAc,GAGvB,UAAU,CAAC;IACb,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,yEAAyE;IACtF,OAAO,EAAE,EAAE,IAAI,EAAE,GA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C9B,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,EAChE,MAAM,EACN,IAAI,CAAC,MAAM,CACZ,CAAC;QAEF,OAAO;YACL,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { z } from "@ligeti/sdk";
2
+ export declare const TELEGRAM_ENV_VARS: {
3
+ optional: string[];
4
+ public: string[];
5
+ };
6
+ export declare const settingsSchema: z.ZodObject<{
7
+ LIGETI_TELEGRAM_BOT_TOKEN: z.ZodString;
8
+ LIGETI_TELEGRAM_API_BASE_URL: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
9
+ LIGETI_TELEGRAM_CHAT_ID: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
10
+ }, z.core.$strip>;
11
+ export interface TelegramNotifySettings {
12
+ readonly botToken: string;
13
+ readonly apiBaseUrl: string;
14
+ readonly defaultChatId: string | undefined;
15
+ }
16
+ export declare function loadTelegramNotifySettings(env?: NodeJS.ProcessEnv): TelegramNotifySettings;
17
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,CAAC,EAA2B,MAAM,aAAa,CAAC;AAE/E,eAAO,MAAM,iBAAiB;;;CAOA,CAAC;AAE/B,eAAO,MAAM,cAAc;;;;iBAczB,CAAC;AAEH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED,wBAAgB,0BAA0B,CACxC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,sBAAsB,CAexB"}
@@ -0,0 +1,42 @@
1
+ // ABOUTME: @ligeti/step-telegram-notify settings loaded from the environment (prefix LIGETI_),
2
+ // ABOUTME: parsed with zod. Read inside step code only -- never in a workflow body.
3
+ import { defineSettingsSchema, z } from "@ligeti/sdk";
4
+ export const TELEGRAM_ENV_VARS = {
5
+ optional: [
6
+ "LIGETI_TELEGRAM_BOT_TOKEN",
7
+ "LIGETI_TELEGRAM_API_BASE_URL",
8
+ "LIGETI_TELEGRAM_CHAT_ID",
9
+ ],
10
+ public: ["LIGETI_TELEGRAM_API_BASE_URL", "LIGETI_TELEGRAM_CHAT_ID"],
11
+ };
12
+ export const settingsSchema = defineSettingsSchema({
13
+ LIGETI_TELEGRAM_BOT_TOKEN: z.string().min(1).meta({ sensitivity: "secret" }),
14
+ LIGETI_TELEGRAM_API_BASE_URL: z
15
+ .string()
16
+ .min(1)
17
+ .default("https://api.telegram.org")
18
+ .refine((value) => URL.canParse(value), { message: "must be a valid URL" })
19
+ .transform((value) => value.replace(/\/+$/, ""))
20
+ .meta({ sensitivity: "public" }),
21
+ LIGETI_TELEGRAM_CHAT_ID: z
22
+ .string()
23
+ .optional()
24
+ .transform((value) => value?.trim())
25
+ .meta({ sensitivity: "public" }),
26
+ });
27
+ export function loadTelegramNotifySettings(env = process.env) {
28
+ const result = settingsSchema.safeParse(env);
29
+ if (!result.success) {
30
+ const issues = result.error.issues
31
+ .map((issue) => ` - ${issue.path.join(".")}: ${issue.message}`)
32
+ .join("\n");
33
+ throw new Error(`invalid telegram-notify step environment:\n${issues}`);
34
+ }
35
+ const parsed = result.data;
36
+ return {
37
+ botToken: parsed.LIGETI_TELEGRAM_BOT_TOKEN,
38
+ apiBaseUrl: parsed.LIGETI_TELEGRAM_API_BASE_URL,
39
+ defaultChatId: parsed.LIGETI_TELEGRAM_CHAT_ID === "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AM,UAAU,0BAA0B,CACxC,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;aAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aAC/D,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8CAA8C,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAC3B,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,yBAAyB;QAC1C,UAAU,EAAE,MAAM,CAAC,4BAA4B;QAC/C,aAAa,EACX,MAAM,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB;KACrF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,59 @@
1
+ export declare const MAX_ATTEMPTS = 3;
2
+ export declare const BASE_DELAY_MS = 500;
3
+ export declare const MAX_SINGLE_DELAY_MS = 30000;
4
+ export declare const DEFAULT_RETRY_AFTER_SECONDS = 1;
5
+ export declare class TelegramPermanentError extends Error {
6
+ readonly httpStatus: number;
7
+ readonly errorCode: number | undefined;
8
+ constructor(httpStatus: number, errorCode: number | undefined, description: string | undefined);
9
+ }
10
+ export declare class TelegramRetriesExhaustedError extends Error {
11
+ readonly attempts: number;
12
+ readonly cause: unknown;
13
+ constructor(attempts: number, cause: unknown);
14
+ }
15
+ export declare class TelegramMalformedResponseError extends Error {
16
+ readonly cause: unknown;
17
+ constructor(cause: unknown);
18
+ }
19
+ export declare class TelegramRateLimitedError extends Error {
20
+ readonly retryAfterSeconds: number;
21
+ constructor(retryAfterSeconds: number);
22
+ }
23
+ export declare function redactToken(text: string, token?: string): string;
24
+ export type TelegramClassification = {
25
+ readonly kind: "success";
26
+ } | {
27
+ readonly kind: "permanent";
28
+ } | {
29
+ readonly kind: "transient";
30
+ readonly retryAfterSeconds: number;
31
+ };
32
+ export declare function classifyResponse(httpStatus: number, body: unknown): TelegramClassification;
33
+ export interface TelegramClientSettings {
34
+ readonly botToken: string;
35
+ readonly apiBaseUrl: string;
36
+ }
37
+ export interface SendMessageParams {
38
+ readonly chat_id: string;
39
+ readonly text: string;
40
+ readonly parse_mode?: "HTML" | "MarkdownV2";
41
+ readonly disable_notification?: boolean;
42
+ readonly message_thread_id?: number;
43
+ }
44
+ export interface SendMessageResult {
45
+ readonly messageId: number;
46
+ readonly chatId: number;
47
+ readonly date: number;
48
+ }
49
+ export type FetchLike = (url: string, init: {
50
+ method: string;
51
+ headers: Record<string, string>;
52
+ body: string;
53
+ signal: AbortSignal;
54
+ }) => Promise<{
55
+ status: number;
56
+ json: () => Promise<unknown>;
57
+ }>;
58
+ export declare function sendMessage(settings: TelegramClientSettings, params: SendMessageParams, signal: AbortSignal, fetchImpl?: FetchLike): Promise<SendMessageResult>;
59
+ //# sourceMappingURL=telegram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telegram.d.ts","sourceRoot":"","sources":["../src/telegram.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AA2B7C,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;gBAD7B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG,SAA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C;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,CACtB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,KACzF,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AA6B/D,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,sBAAsB,EAChC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,EACnB,SAAS,GAAE,SAAiB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CA6D5B"}
@@ -0,0 +1,223 @@
1
+ // ABOUTME: Telegram Bot API client: classifies success/failure responses as permanent or
2
+ // ABOUTME: transient, retries transient failures with backoff, and redacts the bot token everywhere.
3
+ import { z } from "@ligeti/sdk";
4
+ export const MAX_ATTEMPTS = 3;
5
+ export const BASE_DELAY_MS = 500;
6
+ export const MAX_SINGLE_DELAY_MS = 30_000;
7
+ export const DEFAULT_RETRY_AFTER_SECONDS = 1;
8
+ const telegramResponseParametersSchema = z
9
+ .object({
10
+ retry_after: z.number().optional(),
11
+ migrate_to_chat_id: z.number().optional(),
12
+ })
13
+ .partial();
14
+ const telegramErrorEnvelopeSchema = z.object({
15
+ ok: z.literal(false),
16
+ error_code: z.number(),
17
+ description: z.string().optional(),
18
+ parameters: telegramResponseParametersSchema.optional(),
19
+ });
20
+ const telegramSuccessEnvelopeSchema = z.object({
21
+ ok: z.literal(true),
22
+ result: z.object({
23
+ message_id: z.number(),
24
+ date: z.number(),
25
+ chat: z.object({
26
+ id: z.number(),
27
+ }),
28
+ }),
29
+ });
30
+ export class TelegramPermanentError extends Error {
31
+ httpStatus;
32
+ errorCode;
33
+ constructor(httpStatus, errorCode, description) {
34
+ super(`Telegram request failed permanently (HTTP ${String(httpStatus)}` +
35
+ (errorCode !== undefined ? `, error_code ${String(errorCode)}` : "") +
36
+ `)${description !== undefined ? `: ${description}` : ""}`);
37
+ this.httpStatus = httpStatus;
38
+ this.errorCode = errorCode;
39
+ this.name = "TelegramPermanentError";
40
+ }
41
+ }
42
+ export class TelegramRetriesExhaustedError extends Error {
43
+ attempts;
44
+ cause;
45
+ constructor(attempts, cause) {
46
+ super(`Telegram request failed after ${String(attempts)} attempts: ${describeCause(cause)}`);
47
+ this.attempts = attempts;
48
+ this.cause = cause;
49
+ this.name = "TelegramRetriesExhaustedError";
50
+ }
51
+ }
52
+ export class TelegramMalformedResponseError extends Error {
53
+ cause;
54
+ constructor(cause) {
55
+ super(`Telegram returned a malformed success response: ${describeCause(cause)}`);
56
+ this.cause = cause;
57
+ this.name = "TelegramMalformedResponseError";
58
+ }
59
+ }
60
+ export class TelegramRateLimitedError extends Error {
61
+ retryAfterSeconds;
62
+ constructor(retryAfterSeconds) {
63
+ super(`Telegram reported a rate limit requiring a ${String(retryAfterSeconds)}s wait, longer ` +
64
+ `than this client will sleep for a single retry (${String(MAX_SINGLE_DELAY_MS / 1000)}s); ` +
65
+ "giving up immediately rather than retrying early during a flood wait");
66
+ this.retryAfterSeconds = retryAfterSeconds;
67
+ this.name = "TelegramRateLimitedError";
68
+ }
69
+ }
70
+ function describeCause(cause) {
71
+ if (cause instanceof Error) {
72
+ return redactToken(cause.message);
73
+ }
74
+ return redactToken(String(cause));
75
+ }
76
+ export function redactToken(text, token) {
77
+ let sanitized = text;
78
+ if (token !== undefined && token.length > 0) {
79
+ sanitized = sanitized.split(token).join("<redacted>");
80
+ const encodedToken = encodeURIComponent(token);
81
+ if (encodedToken !== token) {
82
+ sanitized = sanitized.split(encodedToken).join("<redacted>");
83
+ }
84
+ }
85
+ return sanitized.replace(/\/bot[A-Za-z0-9_:-]+/g, "/bot<redacted>");
86
+ }
87
+ function sanitizeError(err, token) {
88
+ if (err instanceof Error) {
89
+ const sanitized = new Error(redactToken(err.message, token));
90
+ sanitized.name = err.name;
91
+ if (err.stack !== undefined) {
92
+ sanitized.stack = redactToken(err.stack, token);
93
+ }
94
+ return sanitized;
95
+ }
96
+ return new Error(redactToken(String(err), token));
97
+ }
98
+ export function classifyResponse(httpStatus, body) {
99
+ const errorEnvelope = telegramErrorEnvelopeSchema.safeParse(body);
100
+ if (errorEnvelope.success) {
101
+ return classifyByStatus(httpStatus, errorEnvelope.data.parameters?.retry_after);
102
+ }
103
+ if (httpStatus >= 200 && httpStatus < 300) {
104
+ return { kind: "success" };
105
+ }
106
+ return classifyByStatus(httpStatus, undefined);
107
+ }
108
+ function classifyByStatus(httpStatus, retryAfterSecondsFromBody) {
109
+ if (httpStatus === 429) {
110
+ return {
111
+ kind: "transient",
112
+ retryAfterSeconds: retryAfterSecondsFromBody ?? DEFAULT_RETRY_AFTER_SECONDS,
113
+ };
114
+ }
115
+ if (httpStatus === 408 || httpStatus === 425 || httpStatus >= 500) {
116
+ return { kind: "transient", retryAfterSeconds: 0 };
117
+ }
118
+ return { kind: "permanent" };
119
+ }
120
+ function parseErrorEnvelope(body) {
121
+ const parsed = telegramErrorEnvelopeSchema.safeParse(body);
122
+ if (!parsed.success) {
123
+ return { errorCode: undefined, description: undefined };
124
+ }
125
+ return { errorCode: parsed.data.error_code, description: parsed.data.description };
126
+ }
127
+ function sleep(ms, signal) {
128
+ if (ms <= 0) {
129
+ return Promise.resolve();
130
+ }
131
+ return new Promise((resolve, reject) => {
132
+ if (signal.aborted) {
133
+ reject(signal.reason);
134
+ return;
135
+ }
136
+ const timer = setTimeout(() => {
137
+ signal.removeEventListener("abort", onAbort);
138
+ resolve();
139
+ }, ms);
140
+ function onAbort() {
141
+ clearTimeout(timer);
142
+ reject(signal.reason);
143
+ }
144
+ signal.addEventListener("abort", onAbort, { once: true });
145
+ });
146
+ }
147
+ function backoffDelayMs(attemptNumber) {
148
+ const exponential = BASE_DELAY_MS * 2 ** (attemptNumber - 1);
149
+ const capped = Math.min(exponential, MAX_SINGLE_DELAY_MS);
150
+ return Math.random() * capped;
151
+ }
152
+ export async function sendMessage(settings, params, signal, fetchImpl = fetch) {
153
+ const url = `${settings.apiBaseUrl}/bot${settings.botToken}/sendMessage`;
154
+ let lastError;
155
+ for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
156
+ signal.throwIfAborted();
157
+ let httpStatus;
158
+ let body;
159
+ try {
160
+ const response = await fetchImpl(url, {
161
+ method: "POST",
162
+ headers: { "content-type": "application/json" },
163
+ body: JSON.stringify(params),
164
+ signal,
165
+ });
166
+ httpStatus = response.status;
167
+ try {
168
+ body = await response.json();
169
+ }
170
+ catch {
171
+ body = undefined;
172
+ }
173
+ }
174
+ catch (err) {
175
+ const sanitized = sanitizeError(err, settings.botToken);
176
+ if (signal.aborted) {
177
+ throw sanitized;
178
+ }
179
+ lastError = sanitized;
180
+ if (attempt === MAX_ATTEMPTS) {
181
+ break;
182
+ }
183
+ await sleep(backoffDelayMs(attempt), signal);
184
+ continue;
185
+ }
186
+ const classification = classifyResponse(httpStatus, body);
187
+ if (classification.kind === "success") {
188
+ return parseSuccess(body);
189
+ }
190
+ if (classification.kind === "permanent") {
191
+ const { errorCode, description } = parseErrorEnvelope(body);
192
+ throw new TelegramPermanentError(httpStatus, errorCode, description !== undefined ? redactToken(description, settings.botToken) : undefined);
193
+ }
194
+ if (httpStatus === 429 && classification.retryAfterSeconds * 1000 > MAX_SINGLE_DELAY_MS) {
195
+ throw new TelegramRateLimitedError(classification.retryAfterSeconds);
196
+ }
197
+ lastError = describeTransientFailure(httpStatus, body, settings.botToken);
198
+ if (attempt === MAX_ATTEMPTS) {
199
+ break;
200
+ }
201
+ const delayMs = httpStatus === 429 ? classification.retryAfterSeconds * 1000 : backoffDelayMs(attempt);
202
+ await sleep(delayMs, signal);
203
+ }
204
+ throw new TelegramRetriesExhaustedError(MAX_ATTEMPTS, lastError);
205
+ }
206
+ function describeTransientFailure(httpStatus, body, token) {
207
+ const { errorCode, description } = parseErrorEnvelope(body);
208
+ return new Error(`HTTP ${String(httpStatus)}` +
209
+ (errorCode !== undefined ? `, error_code ${String(errorCode)}` : "") +
210
+ (description !== undefined ? `: ${redactToken(description, token)}` : ""));
211
+ }
212
+ function parseSuccess(body) {
213
+ const parsed = telegramSuccessEnvelopeSchema.safeParse(body);
214
+ if (!parsed.success) {
215
+ throw new TelegramMalformedResponseError(parsed.error);
216
+ }
217
+ return {
218
+ messageId: parsed.data.result.message_id,
219
+ chatId: parsed.data.result.chat.id,
220
+ date: parsed.data.result.date,
221
+ };
222
+ }
223
+ //# sourceMappingURL=telegram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telegram.js","sourceRoot":"","sources":["../src/telegram.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,qGAAqG;AACrG,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAE1C,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,MAAM,gCAAgC,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC;KACD,OAAO,EAAE,CAAC;AAEb,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,EAAE,EAAE,CAAC,C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,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;KAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from "@ligeti/sdk";
2
+ export declare const CHAT_ID_PATTERN: RegExp;
3
+ export declare const TelegramNotifyInput: z.ZodObject<{
4
+ text: z.ZodString;
5
+ chatId: z.ZodOptional<z.ZodString>;
6
+ parseMode: z.ZodOptional<z.ZodEnum<{
7
+ HTML: "HTML";
8
+ MarkdownV2: "MarkdownV2";
9
+ }>>;
10
+ disableNotification: z.ZodOptional<z.ZodBoolean>;
11
+ messageThreadId: z.ZodOptional<z.ZodNumber>;
12
+ }, z.core.$strip>;
13
+ export type TelegramNotifyInput = z.infer<typeof TelegramNotifyInput>;
14
+ export declare const TelegramNotifyOutput: z.ZodObject<{
15
+ messageId: z.ZodNumber;
16
+ chatId: z.ZodNumber;
17
+ date: z.ZodNumber;
18
+ }, z.core.$strip>;
19
+ export type TelegramNotifyOutput = z.infer<typeof TelegramNotifyOutput>;
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,eAAO,MAAM,eAAe,QAAkC,CAAC;AAI/D,eAAO,MAAM,mBAAmB;;;;;;;;;iBAsC9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,41 @@
1
+ // ABOUTME: Zod schemas for telegramNotify's input/output: the message to send plus optional
2
+ // ABOUTME: Telegram Bot API options, and the identifiers Telegram returns once it is sent.
3
+ import { z } from "@ligeti/sdk";
4
+ export const CHAT_ID_PATTERN = /^(-?\d+|@[A-Za-z0-9_]{5,32})$/;
5
+ const MAX_TEXT_LENGTH_UTF16_UNITS = 4096;
6
+ export const TelegramNotifyInput = z.object({
7
+ text: z
8
+ .string()
9
+ .min(1)
10
+ .max(MAX_TEXT_LENGTH_UTF16_UNITS, "Telegram messages must be 4096 characters or fewer; this step rejects longer text rather than truncating it")
11
+ .refine((value) => value.length <= MAX_TEXT_LENGTH_UTF16_UNITS, {
12
+ message: "Telegram messages must be 4096 characters or fewer; this step rejects longer text rather than truncating it",
13
+ })
14
+ .regex(/\S/, "must not be empty or whitespace-only")
15
+ .describe("Message text to send"),
16
+ chatId: z
17
+ .string()
18
+ .regex(CHAT_ID_PATTERN, 'must be a numeric chat id (e.g. "-1001234567890") or an "@channelusername"')
19
+ .optional()
20
+ .describe("Telegram chat id or @channelusername to send to; defaults to LIGETI_TELEGRAM_CHAT_ID when omitted"),
21
+ parseMode: z
22
+ .enum(["HTML", "MarkdownV2"])
23
+ .optional()
24
+ .describe("Telegram parse mode; omitted sends the message as plain text"),
25
+ disableNotification: z
26
+ .boolean()
27
+ .optional()
28
+ .describe("Send the message silently, without a notification sound"),
29
+ messageThreadId: z
30
+ .number()
31
+ .int()
32
+ .positive()
33
+ .optional()
34
+ .describe("Forum topic thread id to post into, for chats with topics enabled"),
35
+ });
36
+ export const TelegramNotifyOutput = z.object({
37
+ messageId: z.number(),
38
+ chatId: z.number(),
39
+ date: z.number(),
40
+ });
41
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2FAA2F;AAC3F,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,CAAC,MAAM,eAAe,GAAG,+BAA+B,CAAC;AAE/D,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CACF,2BAA2B,EAC3B,6GAA6G,CAC9G;SACA,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,2BAA2B,EAAE;QAC9D,OAAO,EACL,6GAA6G;KAChH,CAAC;SACD,KAAK,CAAC,IAAI,EAAE,sCAAsC,CAAC;SACnD,QAAQ,CAAC,sBAAsB,CAAC;IACnC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,KAAK,CACJ,eAAe,EACf,4EAA4E,CAC7E;SACA,QAAQ,EAAE;SACV,QAAQ,CACP,mGAAmG,CACpG;IACH,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;SAC5B,QAAQ,EAAE;SACV,QAAQ,CAAC,8DAA8D,CAAC;IAC3E,mBAAmB,EAAE,CAAC;SACnB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,yDAAyD,CAAC;IACtE,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@ligeti/step-telegram-notify",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.1.0",
4
+ "description": "Ligeti step package: sends a message to a Telegram chat via the Bot API.",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://gitlab.com/nagyv-projects/ligeti.git",
10
+ "directory": "steps/telegram-notify"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "peerDependencies": {
22
+ "@ligeti/sdk": "^2.2.0"
23
+ },
24
+ "devDependencies": {
25
+ "@ligeti/sdk": "2.2.0",
26
+ "@ligeti/testing": "2.0.4"
27
+ },
28
+ "scripts": {}
6
29
  }