gramio 0.5.0 → 0.6.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/dist/index.cjs +412 -182
- package/dist/index.d.cts +519 -1117
- package/dist/index.d.ts +519 -1117
- package/dist/index.js +410 -185
- package/dist/{utils-C46rnh-r.cjs → utils-DCXj-tb5.cjs} +10 -10
- package/dist/{utils-En0iVLWH.js → utils-DqK73ALI.js} +10 -10
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +8 -8
|
@@ -67,25 +67,25 @@ function timeoutWebhook(task, timeout, mode) {
|
|
|
67
67
|
|
|
68
68
|
async function suppressError(fn) {
|
|
69
69
|
try {
|
|
70
|
-
return
|
|
70
|
+
return { value: await fn(), caught: false };
|
|
71
71
|
} catch (error) {
|
|
72
|
-
return
|
|
72
|
+
return { value: error, caught: true };
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
async function withRetries(resultPromise) {
|
|
76
|
-
let
|
|
77
|
-
while (
|
|
78
|
-
const retryAfter =
|
|
76
|
+
let state = await suppressError(resultPromise);
|
|
77
|
+
while (state.value instanceof TelegramError) {
|
|
78
|
+
const retryAfter = state.value.payload?.retry_after;
|
|
79
79
|
if (retryAfter) {
|
|
80
80
|
await sleep(retryAfter * 1e3);
|
|
81
|
-
|
|
81
|
+
state = await suppressError(resultPromise);
|
|
82
82
|
} else {
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
83
|
+
if (state.caught) throw state.value;
|
|
84
|
+
return state.value;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
87
|
+
if (state.caught) throw state.value;
|
|
88
|
+
return state.value;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
exports.ErrorKind = ErrorKind;
|
|
@@ -65,25 +65,25 @@ function timeoutWebhook(task, timeout, mode) {
|
|
|
65
65
|
|
|
66
66
|
async function suppressError(fn) {
|
|
67
67
|
try {
|
|
68
|
-
return
|
|
68
|
+
return { value: await fn(), caught: false };
|
|
69
69
|
} catch (error) {
|
|
70
|
-
return
|
|
70
|
+
return { value: error, caught: true };
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
async function withRetries(resultPromise) {
|
|
74
|
-
let
|
|
75
|
-
while (
|
|
76
|
-
const retryAfter =
|
|
74
|
+
let state = await suppressError(resultPromise);
|
|
75
|
+
while (state.value instanceof TelegramError) {
|
|
76
|
+
const retryAfter = state.value.payload?.retry_after;
|
|
77
77
|
if (retryAfter) {
|
|
78
78
|
await sleep(retryAfter * 1e3);
|
|
79
|
-
|
|
79
|
+
state = await suppressError(resultPromise);
|
|
80
80
|
} else {
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
81
|
+
if (state.caught) throw state.value;
|
|
82
|
+
return state.value;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
85
|
+
if (state.caught) throw state.value;
|
|
86
|
+
return state.value;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export { ErrorKind as E, IS_BUN as I, TelegramError as T, simplifyObject as a, debug$updates as d, sleep as s, timeoutWebhook as t, withRetries as w };
|
package/dist/utils.cjs
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { w as withRetries } from './utils-
|
|
1
|
+
export { w as withRetries } from './utils-DqK73ALI.js';
|
|
2
2
|
import 'debug';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "Powerful, extensible and really type-safe Telegram Bot API framework",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -55,22 +55,22 @@
|
|
|
55
55
|
"author": "kravets",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@biomejs/biome": "2.4.
|
|
59
|
-
"@gramio/test": "^0.1
|
|
58
|
+
"@biomejs/biome": "2.4.4",
|
|
59
|
+
"@gramio/test": "^0.3.1",
|
|
60
60
|
"@types/bun": "^1.3.9",
|
|
61
61
|
"@types/debug": "^4.1.12",
|
|
62
62
|
"expect-type": "^1.3.0",
|
|
63
|
-
"pkgroll": "^2.
|
|
63
|
+
"pkgroll": "^2.27.0",
|
|
64
64
|
"typescript": "^5.9.3"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@gramio/callback-data": "^0.0
|
|
68
|
-
"@gramio/composer": "^0.
|
|
67
|
+
"@gramio/callback-data": "^0.1.0",
|
|
68
|
+
"@gramio/composer": "^0.3.3",
|
|
69
69
|
"@gramio/contexts": "^0.4.0",
|
|
70
70
|
"@gramio/files": "^0.3.0",
|
|
71
|
-
"@gramio/format": "^0.
|
|
71
|
+
"@gramio/format": "^0.4.0",
|
|
72
72
|
"@gramio/keyboards": "^1.3.0",
|
|
73
|
-
"@gramio/types": "^9.4.
|
|
73
|
+
"@gramio/types": "^9.4.2",
|
|
74
74
|
"debug": "^4.4.3"
|
|
75
75
|
},
|
|
76
76
|
"files": [
|