@yaebal/types 0.0.1

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 neverlane
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # @yaebal/types
2
+
3
+ @yaebal/types — the full Telegram Bot API surface, code-generated from the
4
+ official machine-readable schema. use it to type `api.call` params/results:
5
+
6
+ ```ts
7
+ import type { SendMessageParams, Message } from "@yaebal/types";
8
+
9
+ await bot.api.call<Message>("sendMessage", params satisfies SendMessageParams);
10
+ ```
11
+
12
+ ## install
13
+
14
+ ```sh
15
+ pnpm add @yaebal/types
16
+ ```
17
+
18
+ ---
19
+
20
+ part of [**yaebal**](https://github.com/neverlane/yaebal) — a type-safe, runtime-agnostic Telegram Bot API framework. MIT.
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @yaebal/types — the full Telegram Bot API surface, code-generated from the
3
+ * official machine-readable schema. use it to type `api.call` params/results:
4
+ *
5
+ * ```ts
6
+ * import type { SendMessageParams, Message } from "@yaebal/types";
7
+ * await bot.api.call<Message>("sendMessage", params satisfies SendMessageParams);
8
+ * ```
9
+ */
10
+ export * from "./telegram.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,eAAe,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @yaebal/types — the full Telegram Bot API surface, code-generated from the
3
+ * official machine-readable schema. use it to type `api.call` params/results:
4
+ *
5
+ * ```ts
6
+ * import type { SendMessageParams, Message } from "@yaebal/types";
7
+ * await bot.api.call<Message>("sendMessage", params satisfies SendMessageParams);
8
+ * ```
9
+ */
10
+ export * from "./telegram.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { BOT_API_VERSION } from "./index.js";
4
+ test("exposes the generated Bot API version", () => {
5
+ assert.match(BOT_API_VERSION, /^\d+\.\d+$/);
6
+ });
7
+ test("generated object types have the expected shape", () => {
8
+ // if the generator emitted these wrong, this file wouldn't compile
9
+ const user = { id: 42, is_bot: false, first_name: "Sam" };
10
+ assert.equal(user.id, 42);
11
+ const update = { update_id: 1 };
12
+ assert.equal(update.update_id, 1);
13
+ });
14
+ test("generated method params accept a real call", () => {
15
+ const params = { chat_id: 1, text: "hi" };
16
+ assert.equal(params.text, "hi");
17
+ // chat_id is a union of number | string per the schema
18
+ const byUsername = { chat_id: "@channel", text: "yo" };
19
+ assert.equal(byUsername.chat_id, "@channel");
20
+ });
21
+ test("Message is a usable type reference", () => {
22
+ const msg = { message_id: 10, date: 0 };
23
+ assert.equal(msg.message_id, 10);
24
+ });
25
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;IAClD,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAC3D,mEAAmE;IACnE,MAAM,IAAI,GAAS,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAChE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAE1B,MAAM,MAAM,GAAW,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACvD,MAAM,MAAM,GAAsB,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC7D,MAAM,CAAC,KAAK,CA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