grammy 1.17.2 → 1.18.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/README.md +2 -2
- package/out/context.d.ts +8 -0
- package/out/context.js +10 -0
- package/out/core/api.d.ts +9 -0
- package/out/core/api.js +11 -0
- package/out/filter.d.ts +4 -0
- package/out/filter.js +1 -0
- package/out/web.mjs +468 -451
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="right">
|
|
4
4
|
|
|
5
|
-
# The Telegram Bot Framework
|
|
5
|
+
# The Telegram Bot Framework
|
|
6
6
|
|
|
7
7
|
</div>
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://deno.land/x/grammy)
|
|
15
15
|
[](https://www.npmjs.org/package/grammy)
|
|
16
16
|
[](#contributors-)
|
package/out/context.d.ts
CHANGED
|
@@ -931,6 +931,14 @@ export declare class Context implements RenamedUpdate {
|
|
|
931
931
|
* **Official reference:** https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
|
932
932
|
*/
|
|
933
933
|
unhideGeneralForumTopic(signal?: AbortSignal): Promise<true>;
|
|
934
|
+
/**
|
|
935
|
+
* Context-aware alias for `api.unpinAllGeneralForumTopicMessages`. Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
|
|
936
|
+
*
|
|
937
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
938
|
+
*
|
|
939
|
+
* **Official reference:** https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
|
940
|
+
*/
|
|
941
|
+
unpinAllGeneralForumTopicMessages(signal?: AbortSignal): Promise<true>;
|
|
934
942
|
/**
|
|
935
943
|
* Context-aware alias for `api.answerCallbackQuery`. Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
|
|
936
944
|
*
|
package/out/context.js
CHANGED
|
@@ -1125,6 +1125,16 @@ class Context {
|
|
|
1125
1125
|
unhideGeneralForumTopic(signal) {
|
|
1126
1126
|
return this.api.unhideGeneralForumTopic(orThrow(this.chat, "unhideGeneralForumTopic").id, signal);
|
|
1127
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Context-aware alias for `api.unpinAllGeneralForumTopicMessages`. Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
|
|
1130
|
+
*
|
|
1131
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1132
|
+
*
|
|
1133
|
+
* **Official reference:** https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
|
1134
|
+
*/
|
|
1135
|
+
unpinAllGeneralForumTopicMessages(signal) {
|
|
1136
|
+
return this.api.unpinAllGeneralForumTopicMessages(orThrow(this.chat, "unpinAllGeneralForumTopicMessages").id, signal);
|
|
1137
|
+
}
|
|
1128
1138
|
/**
|
|
1129
1139
|
* Context-aware alias for `api.answerCallbackQuery`. Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
|
|
1130
1140
|
*
|
package/out/core/api.d.ts
CHANGED
|
@@ -812,6 +812,15 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
812
812
|
* **Official reference:** https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
|
813
813
|
*/
|
|
814
814
|
unhideGeneralForumTopic(chat_id: number | string, signal?: AbortSignal): Promise<true>;
|
|
815
|
+
/**
|
|
816
|
+
* Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
|
|
817
|
+
*
|
|
818
|
+
* @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
|
819
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
820
|
+
*
|
|
821
|
+
* **Official reference:** https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
|
822
|
+
*/
|
|
823
|
+
unpinAllGeneralForumTopicMessages(chat_id: number | string, signal?: AbortSignal): Promise<true>;
|
|
815
824
|
/**
|
|
816
825
|
* Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
|
|
817
826
|
*
|
package/out/core/api.js
CHANGED
|
@@ -917,6 +917,17 @@ class Api {
|
|
|
917
917
|
unhideGeneralForumTopic(chat_id, signal) {
|
|
918
918
|
return this.raw.unhideGeneralForumTopic({ chat_id }, signal);
|
|
919
919
|
}
|
|
920
|
+
/**
|
|
921
|
+
* Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
|
|
922
|
+
*
|
|
923
|
+
* @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
|
924
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
925
|
+
*
|
|
926
|
+
* **Official reference:** https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
|
927
|
+
*/
|
|
928
|
+
unpinAllGeneralForumTopicMessages(chat_id, signal) {
|
|
929
|
+
return this.raw.unpinAllGeneralForumTopicMessages({ chat_id }, signal);
|
|
930
|
+
}
|
|
920
931
|
/**
|
|
921
932
|
* Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
|
|
922
933
|
*
|
package/out/filter.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ declare const UPDATE_KEYS: {
|
|
|
65
65
|
readonly is_animated: {};
|
|
66
66
|
readonly premium_animation: {};
|
|
67
67
|
};
|
|
68
|
+
readonly story: {};
|
|
68
69
|
readonly video_note: {};
|
|
69
70
|
readonly voice: {};
|
|
70
71
|
readonly contact: {};
|
|
@@ -172,6 +173,7 @@ declare const UPDATE_KEYS: {
|
|
|
172
173
|
readonly is_animated: {};
|
|
173
174
|
readonly premium_animation: {};
|
|
174
175
|
};
|
|
176
|
+
readonly story: {};
|
|
175
177
|
readonly video_note: {};
|
|
176
178
|
readonly voice: {};
|
|
177
179
|
readonly contact: {};
|
|
@@ -249,6 +251,7 @@ declare const UPDATE_KEYS: {
|
|
|
249
251
|
readonly is_animated: {};
|
|
250
252
|
readonly premium_animation: {};
|
|
251
253
|
};
|
|
254
|
+
readonly story: {};
|
|
252
255
|
readonly video_note: {};
|
|
253
256
|
readonly voice: {};
|
|
254
257
|
readonly contact: {};
|
|
@@ -326,6 +329,7 @@ declare const UPDATE_KEYS: {
|
|
|
326
329
|
readonly is_animated: {};
|
|
327
330
|
readonly premium_animation: {};
|
|
328
331
|
};
|
|
332
|
+
readonly story: {};
|
|
329
333
|
readonly video_note: {};
|
|
330
334
|
readonly voice: {};
|
|
331
335
|
readonly contact: {};
|
package/out/filter.js
CHANGED
package/out/web.mjs
CHANGED
|
@@ -185,6 +185,7 @@ const EDITABLE_MESSAGE_KEYS = {
|
|
|
185
185
|
const COMMON_MESSAGE_KEYS = {
|
|
186
186
|
...EDITABLE_MESSAGE_KEYS,
|
|
187
187
|
sticker: STICKER_KEYS,
|
|
188
|
+
story: {},
|
|
188
189
|
video_note: {},
|
|
189
190
|
voice: {},
|
|
190
191
|
contact: {},
|
|
@@ -372,6 +373,9 @@ const checker = {
|
|
|
372
373
|
}
|
|
373
374
|
};
|
|
374
375
|
class Context {
|
|
376
|
+
update;
|
|
377
|
+
api;
|
|
378
|
+
me;
|
|
375
379
|
match;
|
|
376
380
|
constructor(update, api, me){
|
|
377
381
|
this.update = update;
|
|
@@ -694,6 +698,9 @@ class Context {
|
|
|
694
698
|
unhideGeneralForumTopic(signal) {
|
|
695
699
|
return this.api.unhideGeneralForumTopic(orThrow(this.chat, "unhideGeneralForumTopic").id, signal);
|
|
696
700
|
}
|
|
701
|
+
unpinAllGeneralForumTopicMessages(signal) {
|
|
702
|
+
return this.api.unpinAllGeneralForumTopicMessages(orThrow(this.chat, "unpinAllGeneralForumTopicMessages").id, signal);
|
|
703
|
+
}
|
|
697
704
|
answerCallbackQuery(other, signal) {
|
|
698
705
|
return this.api.answerCallbackQuery(orThrow(this.callbackQuery, "answerCallbackQuery").id, typeof other === "string" ? {
|
|
699
706
|
text: other
|
|
@@ -759,9 +766,6 @@ class Context {
|
|
|
759
766
|
replyWithGame(game_short_name, other, signal) {
|
|
760
767
|
return this.api.sendGame(orThrow(this.chat, "sendGame").id, game_short_name, other, signal);
|
|
761
768
|
}
|
|
762
|
-
update;
|
|
763
|
-
api;
|
|
764
|
-
me;
|
|
765
769
|
}
|
|
766
770
|
function orThrow(value, method) {
|
|
767
771
|
if (value === undefined) {
|
|
@@ -788,6 +792,8 @@ function toArray(e) {
|
|
|
788
792
|
];
|
|
789
793
|
}
|
|
790
794
|
class BotError extends Error {
|
|
795
|
+
error;
|
|
796
|
+
ctx;
|
|
791
797
|
constructor(error, ctx){
|
|
792
798
|
super(generateBotErrorMessage(error));
|
|
793
799
|
this.error = error;
|
|
@@ -795,8 +801,6 @@ class BotError extends Error {
|
|
|
795
801
|
this.name = "BotError";
|
|
796
802
|
if (error instanceof Error) this.stack = error.stack;
|
|
797
803
|
}
|
|
798
|
-
error;
|
|
799
|
-
ctx;
|
|
800
804
|
}
|
|
801
805
|
function generateBotErrorMessage(error) {
|
|
802
806
|
let msg;
|
|
@@ -1570,15 +1574,15 @@ browser$1.log;
|
|
|
1570
1574
|
browser$1.save;
|
|
1571
1575
|
browser$1.storage;
|
|
1572
1576
|
browser$1.useColors;
|
|
1573
|
-
class
|
|
1577
|
+
class AssertionError extends Error {
|
|
1578
|
+
name = "AssertionError";
|
|
1574
1579
|
constructor(message){
|
|
1575
1580
|
super(message);
|
|
1576
|
-
this.name = "DenoStdInternalError";
|
|
1577
1581
|
}
|
|
1578
1582
|
}
|
|
1579
1583
|
function assert(expr, msg = "") {
|
|
1580
1584
|
if (!expr) {
|
|
1581
|
-
throw new
|
|
1585
|
+
throw new AssertionError(msg);
|
|
1582
1586
|
}
|
|
1583
1587
|
}
|
|
1584
1588
|
function copy(src, dst, off = 0) {
|
|
@@ -1666,27 +1670,27 @@ class Buffer1 {
|
|
|
1666
1670
|
assert(len <= this.#buf.buffer.byteLength);
|
|
1667
1671
|
this.#buf = new Uint8Array(this.#buf.buffer, 0, len);
|
|
1668
1672
|
}
|
|
1669
|
-
#grow(
|
|
1673
|
+
#grow(n) {
|
|
1670
1674
|
const m = this.length;
|
|
1671
1675
|
if (m === 0 && this.#off !== 0) {
|
|
1672
1676
|
this.reset();
|
|
1673
1677
|
}
|
|
1674
|
-
const i = this.#tryGrowByReslice(
|
|
1678
|
+
const i = this.#tryGrowByReslice(n);
|
|
1675
1679
|
if (i >= 0) {
|
|
1676
1680
|
return i;
|
|
1677
1681
|
}
|
|
1678
1682
|
const c = this.capacity;
|
|
1679
|
-
if (
|
|
1683
|
+
if (n <= Math.floor(c / 2) - m) {
|
|
1680
1684
|
copy(this.#buf.subarray(this.#off), this.#buf);
|
|
1681
|
-
} else if (c +
|
|
1685
|
+
} else if (c + n > MAX_SIZE) {
|
|
1682
1686
|
throw new Error("The buffer cannot be grown beyond the maximum size.");
|
|
1683
1687
|
} else {
|
|
1684
|
-
const buf = new Uint8Array(Math.min(2 * c +
|
|
1688
|
+
const buf = new Uint8Array(Math.min(2 * c + n, MAX_SIZE));
|
|
1685
1689
|
copy(this.#buf.subarray(this.#off), buf);
|
|
1686
1690
|
this.#buf = buf;
|
|
1687
1691
|
}
|
|
1688
1692
|
this.#off = 0;
|
|
1689
|
-
this.#reslice(Math.min(m +
|
|
1693
|
+
this.#reslice(Math.min(m + n, MAX_SIZE));
|
|
1690
1694
|
return m;
|
|
1691
1695
|
}
|
|
1692
1696
|
grow(n) {
|
|
@@ -1907,6 +1911,8 @@ function readableStreamFromIterable(iterable) {
|
|
|
1907
1911
|
const baseFetchConfig = (_apiRoot)=>({});
|
|
1908
1912
|
const defaultAdapter = "cloudflare";
|
|
1909
1913
|
class GrammyError extends Error {
|
|
1914
|
+
method;
|
|
1915
|
+
payload;
|
|
1910
1916
|
ok;
|
|
1911
1917
|
error_code;
|
|
1912
1918
|
description;
|
|
@@ -1921,19 +1927,17 @@ class GrammyError extends Error {
|
|
|
1921
1927
|
this.description = err.description;
|
|
1922
1928
|
this.parameters = err.parameters ?? {};
|
|
1923
1929
|
}
|
|
1924
|
-
method;
|
|
1925
|
-
payload;
|
|
1926
1930
|
}
|
|
1927
1931
|
function toGrammyError(err, method, payload) {
|
|
1928
1932
|
return new GrammyError(`Call to '${method}' failed!`, err, method, payload);
|
|
1929
1933
|
}
|
|
1930
1934
|
class HttpError extends Error {
|
|
1935
|
+
error;
|
|
1931
1936
|
constructor(message, error){
|
|
1932
1937
|
super(message);
|
|
1933
1938
|
this.error = error;
|
|
1934
1939
|
this.name = "HttpError";
|
|
1935
1940
|
}
|
|
1936
|
-
error;
|
|
1937
1941
|
}
|
|
1938
1942
|
function isTelegramError(err) {
|
|
1939
1943
|
return typeof err === "object" && err !== null && "status" in err && "statusText" in err;
|
|
@@ -2026,43 +2030,6 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
|
|
|
2026
2030
|
}
|
|
2027
2031
|
return res;
|
|
2028
2032
|
}
|
|
2029
|
-
function _format(sep, pathObject) {
|
|
2030
|
-
const dir = pathObject.dir || pathObject.root;
|
|
2031
|
-
const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
2032
|
-
if (!dir) return base;
|
|
2033
|
-
if (base === sep) return dir;
|
|
2034
|
-
if (dir === pathObject.root) return dir + base;
|
|
2035
|
-
return dir + sep + base;
|
|
2036
|
-
}
|
|
2037
|
-
const WHITESPACE_ENCODINGS = {
|
|
2038
|
-
"\u0009": "%09",
|
|
2039
|
-
"\u000A": "%0A",
|
|
2040
|
-
"\u000B": "%0B",
|
|
2041
|
-
"\u000C": "%0C",
|
|
2042
|
-
"\u000D": "%0D",
|
|
2043
|
-
"\u0020": "%20"
|
|
2044
|
-
};
|
|
2045
|
-
function encodeWhitespace(string) {
|
|
2046
|
-
return string.replaceAll(/[\s]/g, (c)=>{
|
|
2047
|
-
return WHITESPACE_ENCODINGS[c] ?? c;
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
function lastPathSegment(path, isSep, start = 0) {
|
|
2051
|
-
let matchedNonSeparator = false;
|
|
2052
|
-
let end = path.length;
|
|
2053
|
-
for(let i = path.length - 1; i >= start; --i){
|
|
2054
|
-
if (isSep(path.charCodeAt(i))) {
|
|
2055
|
-
if (matchedNonSeparator) {
|
|
2056
|
-
start = i + 1;
|
|
2057
|
-
break;
|
|
2058
|
-
}
|
|
2059
|
-
} else if (!matchedNonSeparator) {
|
|
2060
|
-
matchedNonSeparator = true;
|
|
2061
|
-
end = i + 1;
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
return path.slice(start, end);
|
|
2065
|
-
}
|
|
2066
2033
|
function stripTrailingSeparators(segment, isSep) {
|
|
2067
2034
|
if (segment.length <= 1) {
|
|
2068
2035
|
return segment;
|
|
@@ -2077,21 +2044,34 @@ function stripTrailingSeparators(segment, isSep) {
|
|
|
2077
2044
|
}
|
|
2078
2045
|
return segment.slice(0, end);
|
|
2079
2046
|
}
|
|
2080
|
-
function
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2047
|
+
function posixResolve(...pathSegments) {
|
|
2048
|
+
let resolvedPath = "";
|
|
2049
|
+
let resolvedAbsolute = false;
|
|
2050
|
+
for(let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--){
|
|
2051
|
+
let path;
|
|
2052
|
+
if (i >= 0) path = pathSegments[i];
|
|
2053
|
+
else {
|
|
2054
|
+
const { Deno } = globalThis;
|
|
2055
|
+
if (typeof Deno?.cwd !== "function") {
|
|
2056
|
+
throw new TypeError("Resolved a relative path without a CWD.");
|
|
2057
|
+
}
|
|
2058
|
+
path = Deno.cwd();
|
|
2059
|
+
}
|
|
2060
|
+
assertPath(path);
|
|
2061
|
+
if (path.length === 0) {
|
|
2062
|
+
continue;
|
|
2088
2063
|
}
|
|
2064
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
2065
|
+
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
2089
2066
|
}
|
|
2090
|
-
|
|
2067
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
|
|
2068
|
+
if (resolvedAbsolute) {
|
|
2069
|
+
if (resolvedPath.length > 0) return `/${resolvedPath}`;
|
|
2070
|
+
else return "/";
|
|
2071
|
+
} else if (resolvedPath.length > 0) return resolvedPath;
|
|
2072
|
+
else return ".";
|
|
2091
2073
|
}
|
|
2092
|
-
|
|
2093
|
-
const delimiter = ";";
|
|
2094
|
-
function resolve(...pathSegments) {
|
|
2074
|
+
function windowsResolve(...pathSegments) {
|
|
2095
2075
|
let resolvedDevice = "";
|
|
2096
2076
|
let resolvedTail = "";
|
|
2097
2077
|
let resolvedAbsolute = false;
|
|
@@ -2184,10 +2164,23 @@ function resolve(...pathSegments) {
|
|
|
2184
2164
|
resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator);
|
|
2185
2165
|
return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
|
|
2186
2166
|
}
|
|
2187
|
-
function
|
|
2167
|
+
function assertArg(path) {
|
|
2188
2168
|
assertPath(path);
|
|
2169
|
+
if (path.length === 0) return ".";
|
|
2170
|
+
}
|
|
2171
|
+
function posixNormalize(path) {
|
|
2172
|
+
assertArg(path);
|
|
2173
|
+
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
2174
|
+
const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
|
|
2175
|
+
path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
|
|
2176
|
+
if (path.length === 0 && !isAbsolute) path = ".";
|
|
2177
|
+
if (path.length > 0 && trailingSeparator) path += "/";
|
|
2178
|
+
if (isAbsolute) return `/${path}`;
|
|
2179
|
+
return path;
|
|
2180
|
+
}
|
|
2181
|
+
function windowsNormalize(path) {
|
|
2182
|
+
assertArg(path);
|
|
2189
2183
|
const len = path.length;
|
|
2190
|
-
if (len === 0) return ".";
|
|
2191
2184
|
let rootEnd = 0;
|
|
2192
2185
|
let device;
|
|
2193
2186
|
let isAbsolute = false;
|
|
@@ -2266,7 +2259,7 @@ function normalize(path) {
|
|
|
2266
2259
|
return device;
|
|
2267
2260
|
}
|
|
2268
2261
|
}
|
|
2269
|
-
function
|
|
2262
|
+
function windowsIsAbsolute(path) {
|
|
2270
2263
|
assertPath(path);
|
|
2271
2264
|
const len = path.length;
|
|
2272
2265
|
if (len === 0) return false;
|
|
@@ -2280,12 +2273,29 @@ function isAbsolute(path) {
|
|
|
2280
2273
|
}
|
|
2281
2274
|
return false;
|
|
2282
2275
|
}
|
|
2283
|
-
function
|
|
2284
|
-
|
|
2285
|
-
|
|
2276
|
+
function posixIsAbsolute(path) {
|
|
2277
|
+
assertPath(path);
|
|
2278
|
+
return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
|
|
2279
|
+
}
|
|
2280
|
+
function posixJoin(...paths) {
|
|
2281
|
+
if (paths.length === 0) return ".";
|
|
2282
|
+
let joined;
|
|
2283
|
+
for(let i = 0, len = paths.length; i < len; ++i){
|
|
2284
|
+
const path = paths[i];
|
|
2285
|
+
assertPath(path);
|
|
2286
|
+
if (path.length > 0) {
|
|
2287
|
+
if (!joined) joined = path;
|
|
2288
|
+
else joined += `/${path}`;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
if (!joined) return ".";
|
|
2292
|
+
return posixNormalize(joined);
|
|
2293
|
+
}
|
|
2294
|
+
function windowsJoin(...paths) {
|
|
2295
|
+
if (paths.length === 0) return ".";
|
|
2286
2296
|
let joined;
|
|
2287
2297
|
let firstPart = null;
|
|
2288
|
-
for(let i = 0; i <
|
|
2298
|
+
for(let i = 0; i < paths.length; ++i){
|
|
2289
2299
|
const path = paths[i];
|
|
2290
2300
|
assertPath(path);
|
|
2291
2301
|
if (path.length > 0) {
|
|
@@ -2318,14 +2328,73 @@ function join(...paths) {
|
|
|
2318
2328
|
}
|
|
2319
2329
|
if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`;
|
|
2320
2330
|
}
|
|
2321
|
-
return
|
|
2331
|
+
return windowsNormalize(joined);
|
|
2322
2332
|
}
|
|
2323
|
-
function
|
|
2333
|
+
function assertArgs(from, to) {
|
|
2324
2334
|
assertPath(from);
|
|
2325
2335
|
assertPath(to);
|
|
2326
2336
|
if (from === to) return "";
|
|
2327
|
-
|
|
2328
|
-
|
|
2337
|
+
}
|
|
2338
|
+
function posixRelative(from, to) {
|
|
2339
|
+
assertArgs(from, to);
|
|
2340
|
+
from = posixResolve(from);
|
|
2341
|
+
to = posixResolve(to);
|
|
2342
|
+
if (from === to) return "";
|
|
2343
|
+
let fromStart = 1;
|
|
2344
|
+
const fromEnd = from.length;
|
|
2345
|
+
for(; fromStart < fromEnd; ++fromStart){
|
|
2346
|
+
if (!isPosixPathSeparator(from.charCodeAt(fromStart))) break;
|
|
2347
|
+
}
|
|
2348
|
+
const fromLen = fromEnd - fromStart;
|
|
2349
|
+
let toStart = 1;
|
|
2350
|
+
const toEnd = to.length;
|
|
2351
|
+
for(; toStart < toEnd; ++toStart){
|
|
2352
|
+
if (!isPosixPathSeparator(to.charCodeAt(toStart))) break;
|
|
2353
|
+
}
|
|
2354
|
+
const toLen = toEnd - toStart;
|
|
2355
|
+
const length = fromLen < toLen ? fromLen : toLen;
|
|
2356
|
+
let lastCommonSep = -1;
|
|
2357
|
+
let i = 0;
|
|
2358
|
+
for(; i <= length; ++i){
|
|
2359
|
+
if (i === length) {
|
|
2360
|
+
if (toLen > length) {
|
|
2361
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
2362
|
+
return to.slice(toStart + i + 1);
|
|
2363
|
+
} else if (i === 0) {
|
|
2364
|
+
return to.slice(toStart + i);
|
|
2365
|
+
}
|
|
2366
|
+
} else if (fromLen > length) {
|
|
2367
|
+
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
2368
|
+
lastCommonSep = i;
|
|
2369
|
+
} else if (i === 0) {
|
|
2370
|
+
lastCommonSep = 0;
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
break;
|
|
2374
|
+
}
|
|
2375
|
+
const fromCode = from.charCodeAt(fromStart + i);
|
|
2376
|
+
const toCode = to.charCodeAt(toStart + i);
|
|
2377
|
+
if (fromCode !== toCode) break;
|
|
2378
|
+
else if (isPosixPathSeparator(fromCode)) lastCommonSep = i;
|
|
2379
|
+
}
|
|
2380
|
+
let out = "";
|
|
2381
|
+
for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){
|
|
2382
|
+
if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
|
|
2383
|
+
if (out.length === 0) out += "..";
|
|
2384
|
+
else out += "/..";
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
if (out.length > 0) return out + to.slice(toStart + lastCommonSep);
|
|
2388
|
+
else {
|
|
2389
|
+
toStart += lastCommonSep;
|
|
2390
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart))) ++toStart;
|
|
2391
|
+
return to.slice(toStart);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
function windowsRelative(from, to) {
|
|
2395
|
+
assertArgs(from, to);
|
|
2396
|
+
const fromOrig = windowsResolve(from);
|
|
2397
|
+
const toOrig = windowsResolve(to);
|
|
2329
2398
|
if (fromOrig === toOrig) return "";
|
|
2330
2399
|
from = fromOrig.toLowerCase();
|
|
2331
2400
|
to = toOrig.toLowerCase();
|
|
@@ -2393,10 +2462,13 @@ function relative(from, to) {
|
|
|
2393
2462
|
return toOrig.slice(toStart, toEnd);
|
|
2394
2463
|
}
|
|
2395
2464
|
}
|
|
2396
|
-
function
|
|
2465
|
+
function posixToNamespacedPath(path) {
|
|
2466
|
+
return path;
|
|
2467
|
+
}
|
|
2468
|
+
function windowsToNamespacedPath(path) {
|
|
2397
2469
|
if (typeof path !== "string") return path;
|
|
2398
2470
|
if (path.length === 0) return "";
|
|
2399
|
-
const resolvedPath =
|
|
2471
|
+
const resolvedPath = windowsResolve(path);
|
|
2400
2472
|
if (resolvedPath.length >= 3) {
|
|
2401
2473
|
if (resolvedPath.charCodeAt(0) === 92) {
|
|
2402
2474
|
if (resolvedPath.charCodeAt(1) === 92) {
|
|
@@ -2413,10 +2485,32 @@ function toNamespacedPath(path) {
|
|
|
2413
2485
|
}
|
|
2414
2486
|
return path;
|
|
2415
2487
|
}
|
|
2416
|
-
function
|
|
2488
|
+
function assertArg1(path) {
|
|
2417
2489
|
assertPath(path);
|
|
2490
|
+
if (path.length === 0) return ".";
|
|
2491
|
+
}
|
|
2492
|
+
function posixDirname(path) {
|
|
2493
|
+
assertArg1(path);
|
|
2494
|
+
let end = -1;
|
|
2495
|
+
let matchedNonSeparator = false;
|
|
2496
|
+
for(let i = path.length - 1; i >= 1; --i){
|
|
2497
|
+
if (isPosixPathSeparator(path.charCodeAt(i))) {
|
|
2498
|
+
if (matchedNonSeparator) {
|
|
2499
|
+
end = i;
|
|
2500
|
+
break;
|
|
2501
|
+
}
|
|
2502
|
+
} else {
|
|
2503
|
+
matchedNonSeparator = true;
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
if (end === -1) {
|
|
2507
|
+
return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
|
|
2508
|
+
}
|
|
2509
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
2510
|
+
}
|
|
2511
|
+
function windowsDirname(path) {
|
|
2512
|
+
assertArg1(path);
|
|
2418
2513
|
const len = path.length;
|
|
2419
|
-
if (len === 0) return ".";
|
|
2420
2514
|
let rootEnd = -1;
|
|
2421
2515
|
let end = -1;
|
|
2422
2516
|
let matchedSlash = true;
|
|
@@ -2477,362 +2571,61 @@ function dirname(path) {
|
|
|
2477
2571
|
}
|
|
2478
2572
|
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
2479
2573
|
}
|
|
2480
|
-
function
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
if (typeof suffix !== "string") {
|
|
2484
|
-
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
2485
|
-
}
|
|
2486
|
-
let start = 0;
|
|
2487
|
-
if (path.length >= 2) {
|
|
2488
|
-
const drive = path.charCodeAt(0);
|
|
2489
|
-
if (isWindowsDeviceRoot(drive)) {
|
|
2490
|
-
if (path.charCodeAt(1) === 58) start = 2;
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
2494
|
-
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
2495
|
-
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
2496
|
-
}
|
|
2497
|
-
function extname(path) {
|
|
2498
|
-
assertPath(path);
|
|
2499
|
-
let start = 0;
|
|
2500
|
-
let startDot = -1;
|
|
2501
|
-
let startPart = 0;
|
|
2502
|
-
let end = -1;
|
|
2503
|
-
let matchedSlash = true;
|
|
2504
|
-
let preDotState = 0;
|
|
2505
|
-
if (path.length >= 2 && path.charCodeAt(1) === 58 && isWindowsDeviceRoot(path.charCodeAt(0))) {
|
|
2506
|
-
start = startPart = 2;
|
|
2507
|
-
}
|
|
2508
|
-
for(let i = path.length - 1; i >= start; --i){
|
|
2509
|
-
const code = path.charCodeAt(i);
|
|
2510
|
-
if (isPathSeparator(code)) {
|
|
2511
|
-
if (!matchedSlash) {
|
|
2512
|
-
startPart = i + 1;
|
|
2513
|
-
break;
|
|
2514
|
-
}
|
|
2515
|
-
continue;
|
|
2516
|
-
}
|
|
2517
|
-
if (end === -1) {
|
|
2518
|
-
matchedSlash = false;
|
|
2519
|
-
end = i + 1;
|
|
2520
|
-
}
|
|
2521
|
-
if (code === 46) {
|
|
2522
|
-
if (startDot === -1) startDot = i;
|
|
2523
|
-
else if (preDotState !== 1) preDotState = 1;
|
|
2524
|
-
} else if (startDot !== -1) {
|
|
2525
|
-
preDotState = -1;
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2529
|
-
return "";
|
|
2530
|
-
}
|
|
2531
|
-
return path.slice(startDot, end);
|
|
2532
|
-
}
|
|
2533
|
-
function format(pathObject) {
|
|
2534
|
-
if (pathObject === null || typeof pathObject !== "object") {
|
|
2535
|
-
throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
|
|
2536
|
-
}
|
|
2537
|
-
return _format("\\", pathObject);
|
|
2538
|
-
}
|
|
2539
|
-
function parse2(path) {
|
|
2540
|
-
assertPath(path);
|
|
2541
|
-
const ret = {
|
|
2542
|
-
root: "",
|
|
2543
|
-
dir: "",
|
|
2544
|
-
base: "",
|
|
2545
|
-
ext: "",
|
|
2546
|
-
name: ""
|
|
2547
|
-
};
|
|
2548
|
-
const len = path.length;
|
|
2549
|
-
if (len === 0) return ret;
|
|
2550
|
-
let rootEnd = 0;
|
|
2551
|
-
let code = path.charCodeAt(0);
|
|
2552
|
-
if (len > 1) {
|
|
2553
|
-
if (isPathSeparator(code)) {
|
|
2554
|
-
rootEnd = 1;
|
|
2555
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
|
2556
|
-
let j = 2;
|
|
2557
|
-
let last = j;
|
|
2558
|
-
for(; j < len; ++j){
|
|
2559
|
-
if (isPathSeparator(path.charCodeAt(j))) break;
|
|
2560
|
-
}
|
|
2561
|
-
if (j < len && j !== last) {
|
|
2562
|
-
last = j;
|
|
2563
|
-
for(; j < len; ++j){
|
|
2564
|
-
if (!isPathSeparator(path.charCodeAt(j))) break;
|
|
2565
|
-
}
|
|
2566
|
-
if (j < len && j !== last) {
|
|
2567
|
-
last = j;
|
|
2568
|
-
for(; j < len; ++j){
|
|
2569
|
-
if (isPathSeparator(path.charCodeAt(j))) break;
|
|
2570
|
-
}
|
|
2571
|
-
if (j === len) {
|
|
2572
|
-
rootEnd = j;
|
|
2573
|
-
} else if (j !== last) {
|
|
2574
|
-
rootEnd = j + 1;
|
|
2575
|
-
}
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
}
|
|
2579
|
-
} else if (isWindowsDeviceRoot(code)) {
|
|
2580
|
-
if (path.charCodeAt(1) === 58) {
|
|
2581
|
-
rootEnd = 2;
|
|
2582
|
-
if (len > 2) {
|
|
2583
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
|
2584
|
-
if (len === 3) {
|
|
2585
|
-
ret.root = ret.dir = path;
|
|
2586
|
-
ret.base = "\\";
|
|
2587
|
-
return ret;
|
|
2588
|
-
}
|
|
2589
|
-
rootEnd = 3;
|
|
2590
|
-
}
|
|
2591
|
-
} else {
|
|
2592
|
-
ret.root = ret.dir = path;
|
|
2593
|
-
return ret;
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
} else if (isPathSeparator(code)) {
|
|
2598
|
-
ret.root = ret.dir = path;
|
|
2599
|
-
ret.base = "\\";
|
|
2600
|
-
return ret;
|
|
2601
|
-
}
|
|
2602
|
-
if (rootEnd > 0) ret.root = path.slice(0, rootEnd);
|
|
2603
|
-
let startDot = -1;
|
|
2604
|
-
let startPart = rootEnd;
|
|
2605
|
-
let end = -1;
|
|
2606
|
-
let matchedSlash = true;
|
|
2607
|
-
let i = path.length - 1;
|
|
2608
|
-
let preDotState = 0;
|
|
2609
|
-
for(; i >= rootEnd; --i){
|
|
2610
|
-
code = path.charCodeAt(i);
|
|
2611
|
-
if (isPathSeparator(code)) {
|
|
2612
|
-
if (!matchedSlash) {
|
|
2613
|
-
startPart = i + 1;
|
|
2614
|
-
break;
|
|
2615
|
-
}
|
|
2616
|
-
continue;
|
|
2617
|
-
}
|
|
2618
|
-
if (end === -1) {
|
|
2619
|
-
matchedSlash = false;
|
|
2620
|
-
end = i + 1;
|
|
2621
|
-
}
|
|
2622
|
-
if (code === 46) {
|
|
2623
|
-
if (startDot === -1) startDot = i;
|
|
2624
|
-
else if (preDotState !== 1) preDotState = 1;
|
|
2625
|
-
} else if (startDot !== -1) {
|
|
2626
|
-
preDotState = -1;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2630
|
-
if (end !== -1) {
|
|
2631
|
-
ret.base = ret.name = path.slice(startPart, end);
|
|
2632
|
-
}
|
|
2633
|
-
} else {
|
|
2634
|
-
ret.name = path.slice(startPart, startDot);
|
|
2635
|
-
ret.base = path.slice(startPart, end);
|
|
2636
|
-
ret.ext = path.slice(startDot, end);
|
|
2637
|
-
}
|
|
2638
|
-
ret.base = ret.base || "\\";
|
|
2639
|
-
if (startPart > 0 && startPart !== rootEnd) {
|
|
2640
|
-
ret.dir = path.slice(0, startPart - 1);
|
|
2641
|
-
} else ret.dir = ret.root;
|
|
2642
|
-
return ret;
|
|
2643
|
-
}
|
|
2644
|
-
function fromFileUrl(url) {
|
|
2645
|
-
url = url instanceof URL ? url : new URL(url);
|
|
2646
|
-
if (url.protocol != "file:") {
|
|
2647
|
-
throw new TypeError("Must be a file URL.");
|
|
2648
|
-
}
|
|
2649
|
-
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
|
|
2650
|
-
if (url.hostname != "") {
|
|
2651
|
-
path = `\\\\${url.hostname}${path}`;
|
|
2652
|
-
}
|
|
2653
|
-
return path;
|
|
2654
|
-
}
|
|
2655
|
-
function toFileUrl(path) {
|
|
2656
|
-
if (!isAbsolute(path)) {
|
|
2657
|
-
throw new TypeError("Must be an absolute path.");
|
|
2658
|
-
}
|
|
2659
|
-
const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
|
|
2660
|
-
const url = new URL("file:///");
|
|
2661
|
-
url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
|
|
2662
|
-
if (hostname != null && hostname != "localhost") {
|
|
2663
|
-
url.hostname = hostname;
|
|
2664
|
-
if (!url.hostname) {
|
|
2665
|
-
throw new TypeError("Invalid hostname.");
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
return url;
|
|
2669
|
-
}
|
|
2670
|
-
const mod = {
|
|
2671
|
-
sep: sep,
|
|
2672
|
-
delimiter: delimiter,
|
|
2673
|
-
resolve: resolve,
|
|
2674
|
-
normalize: normalize,
|
|
2675
|
-
isAbsolute: isAbsolute,
|
|
2676
|
-
join: join,
|
|
2677
|
-
relative: relative,
|
|
2678
|
-
toNamespacedPath: toNamespacedPath,
|
|
2679
|
-
dirname: dirname,
|
|
2680
|
-
basename: basename,
|
|
2681
|
-
extname: extname,
|
|
2682
|
-
format: format,
|
|
2683
|
-
parse: parse2,
|
|
2684
|
-
fromFileUrl: fromFileUrl,
|
|
2685
|
-
toFileUrl: toFileUrl
|
|
2686
|
-
};
|
|
2687
|
-
const sep1 = "/";
|
|
2688
|
-
const delimiter1 = ":";
|
|
2689
|
-
function resolve1(...pathSegments) {
|
|
2690
|
-
let resolvedPath = "";
|
|
2691
|
-
let resolvedAbsolute = false;
|
|
2692
|
-
for(let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--){
|
|
2693
|
-
let path;
|
|
2694
|
-
if (i >= 0) path = pathSegments[i];
|
|
2695
|
-
else {
|
|
2696
|
-
const { Deno } = globalThis;
|
|
2697
|
-
if (typeof Deno?.cwd !== "function") {
|
|
2698
|
-
throw new TypeError("Resolved a relative path without a CWD.");
|
|
2699
|
-
}
|
|
2700
|
-
path = Deno.cwd();
|
|
2701
|
-
}
|
|
2702
|
-
assertPath(path);
|
|
2703
|
-
if (path.length === 0) {
|
|
2704
|
-
continue;
|
|
2705
|
-
}
|
|
2706
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
2707
|
-
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
2708
|
-
}
|
|
2709
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
|
|
2710
|
-
if (resolvedAbsolute) {
|
|
2711
|
-
if (resolvedPath.length > 0) return `/${resolvedPath}`;
|
|
2712
|
-
else return "/";
|
|
2713
|
-
} else if (resolvedPath.length > 0) return resolvedPath;
|
|
2714
|
-
else return ".";
|
|
2715
|
-
}
|
|
2716
|
-
function normalize1(path) {
|
|
2717
|
-
assertPath(path);
|
|
2718
|
-
if (path.length === 0) return ".";
|
|
2719
|
-
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
2720
|
-
const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1));
|
|
2721
|
-
path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator);
|
|
2722
|
-
if (path.length === 0 && !isAbsolute) path = ".";
|
|
2723
|
-
if (path.length > 0 && trailingSeparator) path += "/";
|
|
2724
|
-
if (isAbsolute) return `/${path}`;
|
|
2725
|
-
return path;
|
|
2726
|
-
}
|
|
2727
|
-
function isAbsolute1(path) {
|
|
2728
|
-
assertPath(path);
|
|
2729
|
-
return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
|
|
2730
|
-
}
|
|
2731
|
-
function join1(...paths) {
|
|
2732
|
-
if (paths.length === 0) return ".";
|
|
2733
|
-
let joined;
|
|
2734
|
-
for(let i = 0, len = paths.length; i < len; ++i){
|
|
2735
|
-
const path = paths[i];
|
|
2736
|
-
assertPath(path);
|
|
2737
|
-
if (path.length > 0) {
|
|
2738
|
-
if (!joined) joined = path;
|
|
2739
|
-
else joined += `/${path}`;
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
if (!joined) return ".";
|
|
2743
|
-
return normalize1(joined);
|
|
2744
|
-
}
|
|
2745
|
-
function relative1(from, to) {
|
|
2746
|
-
assertPath(from);
|
|
2747
|
-
assertPath(to);
|
|
2748
|
-
if (from === to) return "";
|
|
2749
|
-
from = resolve1(from);
|
|
2750
|
-
to = resolve1(to);
|
|
2751
|
-
if (from === to) return "";
|
|
2752
|
-
let fromStart = 1;
|
|
2753
|
-
const fromEnd = from.length;
|
|
2754
|
-
for(; fromStart < fromEnd; ++fromStart){
|
|
2755
|
-
if (!isPosixPathSeparator(from.charCodeAt(fromStart))) break;
|
|
2756
|
-
}
|
|
2757
|
-
const fromLen = fromEnd - fromStart;
|
|
2758
|
-
let toStart = 1;
|
|
2759
|
-
const toEnd = to.length;
|
|
2760
|
-
for(; toStart < toEnd; ++toStart){
|
|
2761
|
-
if (!isPosixPathSeparator(to.charCodeAt(toStart))) break;
|
|
2762
|
-
}
|
|
2763
|
-
const toLen = toEnd - toStart;
|
|
2764
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
|
2765
|
-
let lastCommonSep = -1;
|
|
2766
|
-
let i = 0;
|
|
2767
|
-
for(; i <= length; ++i){
|
|
2768
|
-
if (i === length) {
|
|
2769
|
-
if (toLen > length) {
|
|
2770
|
-
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
2771
|
-
return to.slice(toStart + i + 1);
|
|
2772
|
-
} else if (i === 0) {
|
|
2773
|
-
return to.slice(toStart + i);
|
|
2774
|
-
}
|
|
2775
|
-
} else if (fromLen > length) {
|
|
2776
|
-
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
2777
|
-
lastCommonSep = i;
|
|
2778
|
-
} else if (i === 0) {
|
|
2779
|
-
lastCommonSep = 0;
|
|
2780
|
-
}
|
|
2781
|
-
}
|
|
2782
|
-
break;
|
|
2783
|
-
}
|
|
2784
|
-
const fromCode = from.charCodeAt(fromStart + i);
|
|
2785
|
-
const toCode = to.charCodeAt(toStart + i);
|
|
2786
|
-
if (fromCode !== toCode) break;
|
|
2787
|
-
else if (isPosixPathSeparator(fromCode)) lastCommonSep = i;
|
|
2574
|
+
function stripSuffix(name, suffix) {
|
|
2575
|
+
if (suffix.length >= name.length) {
|
|
2576
|
+
return name;
|
|
2788
2577
|
}
|
|
2789
|
-
|
|
2790
|
-
for(i =
|
|
2791
|
-
if (
|
|
2792
|
-
|
|
2793
|
-
else out += "/..";
|
|
2578
|
+
const lenDiff = name.length - suffix.length;
|
|
2579
|
+
for(let i = suffix.length - 1; i >= 0; --i){
|
|
2580
|
+
if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
|
|
2581
|
+
return name;
|
|
2794
2582
|
}
|
|
2795
2583
|
}
|
|
2796
|
-
|
|
2797
|
-
else {
|
|
2798
|
-
toStart += lastCommonSep;
|
|
2799
|
-
if (isPosixPathSeparator(to.charCodeAt(toStart))) ++toStart;
|
|
2800
|
-
return to.slice(toStart);
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
function toNamespacedPath1(path) {
|
|
2804
|
-
return path;
|
|
2584
|
+
return name.slice(0, -suffix.length);
|
|
2805
2585
|
}
|
|
2806
|
-
function
|
|
2807
|
-
if (path.length === 0) return ".";
|
|
2808
|
-
let end = -1;
|
|
2586
|
+
function lastPathSegment(path, isSep, start = 0) {
|
|
2809
2587
|
let matchedNonSeparator = false;
|
|
2810
|
-
|
|
2811
|
-
|
|
2588
|
+
let end = path.length;
|
|
2589
|
+
for(let i = path.length - 1; i >= start; --i){
|
|
2590
|
+
if (isSep(path.charCodeAt(i))) {
|
|
2812
2591
|
if (matchedNonSeparator) {
|
|
2813
|
-
|
|
2592
|
+
start = i + 1;
|
|
2814
2593
|
break;
|
|
2815
2594
|
}
|
|
2816
|
-
} else {
|
|
2595
|
+
} else if (!matchedNonSeparator) {
|
|
2817
2596
|
matchedNonSeparator = true;
|
|
2597
|
+
end = i + 1;
|
|
2818
2598
|
}
|
|
2819
2599
|
}
|
|
2820
|
-
|
|
2821
|
-
return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
|
|
2822
|
-
}
|
|
2823
|
-
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
2600
|
+
return path.slice(start, end);
|
|
2824
2601
|
}
|
|
2825
|
-
function
|
|
2602
|
+
function assertArgs1(path, suffix) {
|
|
2826
2603
|
assertPath(path);
|
|
2827
2604
|
if (path.length === 0) return path;
|
|
2828
2605
|
if (typeof suffix !== "string") {
|
|
2829
2606
|
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
2830
2607
|
}
|
|
2608
|
+
}
|
|
2609
|
+
function posixBasename(path, suffix = "") {
|
|
2610
|
+
assertArgs1(path, suffix);
|
|
2831
2611
|
const lastSegment = lastPathSegment(path, isPosixPathSeparator);
|
|
2832
2612
|
const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
|
|
2833
2613
|
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
2834
2614
|
}
|
|
2835
|
-
function
|
|
2615
|
+
function windowsBasename(path, suffix = "") {
|
|
2616
|
+
assertArgs1(path, suffix);
|
|
2617
|
+
let start = 0;
|
|
2618
|
+
if (path.length >= 2) {
|
|
2619
|
+
const drive = path.charCodeAt(0);
|
|
2620
|
+
if (isWindowsDeviceRoot(drive)) {
|
|
2621
|
+
if (path.charCodeAt(1) === 58) start = 2;
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
2625
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
2626
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
2627
|
+
}
|
|
2628
|
+
function posixExtname(path) {
|
|
2836
2629
|
assertPath(path);
|
|
2837
2630
|
let startDot = -1;
|
|
2838
2631
|
let startPart = 0;
|
|
@@ -2864,13 +2657,64 @@ function extname1(path) {
|
|
|
2864
2657
|
}
|
|
2865
2658
|
return path.slice(startDot, end);
|
|
2866
2659
|
}
|
|
2867
|
-
function
|
|
2660
|
+
function windowsExtname(path) {
|
|
2661
|
+
assertPath(path);
|
|
2662
|
+
let start = 0;
|
|
2663
|
+
let startDot = -1;
|
|
2664
|
+
let startPart = 0;
|
|
2665
|
+
let end = -1;
|
|
2666
|
+
let matchedSlash = true;
|
|
2667
|
+
let preDotState = 0;
|
|
2668
|
+
if (path.length >= 2 && path.charCodeAt(1) === 58 && isWindowsDeviceRoot(path.charCodeAt(0))) {
|
|
2669
|
+
start = startPart = 2;
|
|
2670
|
+
}
|
|
2671
|
+
for(let i = path.length - 1; i >= start; --i){
|
|
2672
|
+
const code = path.charCodeAt(i);
|
|
2673
|
+
if (isPathSeparator(code)) {
|
|
2674
|
+
if (!matchedSlash) {
|
|
2675
|
+
startPart = i + 1;
|
|
2676
|
+
break;
|
|
2677
|
+
}
|
|
2678
|
+
continue;
|
|
2679
|
+
}
|
|
2680
|
+
if (end === -1) {
|
|
2681
|
+
matchedSlash = false;
|
|
2682
|
+
end = i + 1;
|
|
2683
|
+
}
|
|
2684
|
+
if (code === 46) {
|
|
2685
|
+
if (startDot === -1) startDot = i;
|
|
2686
|
+
else if (preDotState !== 1) preDotState = 1;
|
|
2687
|
+
} else if (startDot !== -1) {
|
|
2688
|
+
preDotState = -1;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2692
|
+
return "";
|
|
2693
|
+
}
|
|
2694
|
+
return path.slice(startDot, end);
|
|
2695
|
+
}
|
|
2696
|
+
function _format(sep, pathObject) {
|
|
2697
|
+
const dir = pathObject.dir || pathObject.root;
|
|
2698
|
+
const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
2699
|
+
if (!dir) return base;
|
|
2700
|
+
if (base === sep) return dir;
|
|
2701
|
+
if (dir === pathObject.root) return dir + base;
|
|
2702
|
+
return dir + sep + base;
|
|
2703
|
+
}
|
|
2704
|
+
function assertArg2(pathObject) {
|
|
2868
2705
|
if (pathObject === null || typeof pathObject !== "object") {
|
|
2869
2706
|
throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
|
|
2870
2707
|
}
|
|
2708
|
+
}
|
|
2709
|
+
function posixFormat(pathObject) {
|
|
2710
|
+
assertArg2(pathObject);
|
|
2871
2711
|
return _format("/", pathObject);
|
|
2872
2712
|
}
|
|
2873
|
-
function
|
|
2713
|
+
function windowsFormat(pathObject) {
|
|
2714
|
+
assertArg2(pathObject);
|
|
2715
|
+
return _format("\\", pathObject);
|
|
2716
|
+
}
|
|
2717
|
+
function posixParse(path) {
|
|
2874
2718
|
assertPath(path);
|
|
2875
2719
|
const ret = {
|
|
2876
2720
|
root: "",
|
|
@@ -2938,42 +2782,210 @@ function parse3(path) {
|
|
|
2938
2782
|
} else if (isAbsolute) ret.dir = "/";
|
|
2939
2783
|
return ret;
|
|
2940
2784
|
}
|
|
2941
|
-
function
|
|
2785
|
+
function windowsParse(path) {
|
|
2786
|
+
assertPath(path);
|
|
2787
|
+
const ret = {
|
|
2788
|
+
root: "",
|
|
2789
|
+
dir: "",
|
|
2790
|
+
base: "",
|
|
2791
|
+
ext: "",
|
|
2792
|
+
name: ""
|
|
2793
|
+
};
|
|
2794
|
+
const len = path.length;
|
|
2795
|
+
if (len === 0) return ret;
|
|
2796
|
+
let rootEnd = 0;
|
|
2797
|
+
let code = path.charCodeAt(0);
|
|
2798
|
+
if (len > 1) {
|
|
2799
|
+
if (isPathSeparator(code)) {
|
|
2800
|
+
rootEnd = 1;
|
|
2801
|
+
if (isPathSeparator(path.charCodeAt(1))) {
|
|
2802
|
+
let j = 2;
|
|
2803
|
+
let last = j;
|
|
2804
|
+
for(; j < len; ++j){
|
|
2805
|
+
if (isPathSeparator(path.charCodeAt(j))) break;
|
|
2806
|
+
}
|
|
2807
|
+
if (j < len && j !== last) {
|
|
2808
|
+
last = j;
|
|
2809
|
+
for(; j < len; ++j){
|
|
2810
|
+
if (!isPathSeparator(path.charCodeAt(j))) break;
|
|
2811
|
+
}
|
|
2812
|
+
if (j < len && j !== last) {
|
|
2813
|
+
last = j;
|
|
2814
|
+
for(; j < len; ++j){
|
|
2815
|
+
if (isPathSeparator(path.charCodeAt(j))) break;
|
|
2816
|
+
}
|
|
2817
|
+
if (j === len) {
|
|
2818
|
+
rootEnd = j;
|
|
2819
|
+
} else if (j !== last) {
|
|
2820
|
+
rootEnd = j + 1;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
} else if (isWindowsDeviceRoot(code)) {
|
|
2826
|
+
if (path.charCodeAt(1) === 58) {
|
|
2827
|
+
rootEnd = 2;
|
|
2828
|
+
if (len > 2) {
|
|
2829
|
+
if (isPathSeparator(path.charCodeAt(2))) {
|
|
2830
|
+
if (len === 3) {
|
|
2831
|
+
ret.root = ret.dir = path;
|
|
2832
|
+
ret.base = "\\";
|
|
2833
|
+
return ret;
|
|
2834
|
+
}
|
|
2835
|
+
rootEnd = 3;
|
|
2836
|
+
}
|
|
2837
|
+
} else {
|
|
2838
|
+
ret.root = ret.dir = path;
|
|
2839
|
+
return ret;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
} else if (isPathSeparator(code)) {
|
|
2844
|
+
ret.root = ret.dir = path;
|
|
2845
|
+
ret.base = "\\";
|
|
2846
|
+
return ret;
|
|
2847
|
+
}
|
|
2848
|
+
if (rootEnd > 0) ret.root = path.slice(0, rootEnd);
|
|
2849
|
+
let startDot = -1;
|
|
2850
|
+
let startPart = rootEnd;
|
|
2851
|
+
let end = -1;
|
|
2852
|
+
let matchedSlash = true;
|
|
2853
|
+
let i = path.length - 1;
|
|
2854
|
+
let preDotState = 0;
|
|
2855
|
+
for(; i >= rootEnd; --i){
|
|
2856
|
+
code = path.charCodeAt(i);
|
|
2857
|
+
if (isPathSeparator(code)) {
|
|
2858
|
+
if (!matchedSlash) {
|
|
2859
|
+
startPart = i + 1;
|
|
2860
|
+
break;
|
|
2861
|
+
}
|
|
2862
|
+
continue;
|
|
2863
|
+
}
|
|
2864
|
+
if (end === -1) {
|
|
2865
|
+
matchedSlash = false;
|
|
2866
|
+
end = i + 1;
|
|
2867
|
+
}
|
|
2868
|
+
if (code === 46) {
|
|
2869
|
+
if (startDot === -1) startDot = i;
|
|
2870
|
+
else if (preDotState !== 1) preDotState = 1;
|
|
2871
|
+
} else if (startDot !== -1) {
|
|
2872
|
+
preDotState = -1;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2876
|
+
if (end !== -1) {
|
|
2877
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
2878
|
+
}
|
|
2879
|
+
} else {
|
|
2880
|
+
ret.name = path.slice(startPart, startDot);
|
|
2881
|
+
ret.base = path.slice(startPart, end);
|
|
2882
|
+
ret.ext = path.slice(startDot, end);
|
|
2883
|
+
}
|
|
2884
|
+
ret.base = ret.base || "\\";
|
|
2885
|
+
if (startPart > 0 && startPart !== rootEnd) {
|
|
2886
|
+
ret.dir = path.slice(0, startPart - 1);
|
|
2887
|
+
} else ret.dir = ret.root;
|
|
2888
|
+
return ret;
|
|
2889
|
+
}
|
|
2890
|
+
function assertArg3(url) {
|
|
2942
2891
|
url = url instanceof URL ? url : new URL(url);
|
|
2943
2892
|
if (url.protocol != "file:") {
|
|
2944
2893
|
throw new TypeError("Must be a file URL.");
|
|
2945
2894
|
}
|
|
2895
|
+
return url;
|
|
2896
|
+
}
|
|
2897
|
+
function posixFromFileUrl(url) {
|
|
2898
|
+
url = assertArg3(url);
|
|
2946
2899
|
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
|
|
2947
2900
|
}
|
|
2948
|
-
function
|
|
2949
|
-
|
|
2901
|
+
function windowsFromFileUrl(url) {
|
|
2902
|
+
url = assertArg3(url);
|
|
2903
|
+
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
|
|
2904
|
+
if (url.hostname != "") {
|
|
2905
|
+
path = `\\\\${url.hostname}${path}`;
|
|
2906
|
+
}
|
|
2907
|
+
return path;
|
|
2908
|
+
}
|
|
2909
|
+
const WHITESPACE_ENCODINGS = {
|
|
2910
|
+
"\u0009": "%09",
|
|
2911
|
+
"\u000A": "%0A",
|
|
2912
|
+
"\u000B": "%0B",
|
|
2913
|
+
"\u000C": "%0C",
|
|
2914
|
+
"\u000D": "%0D",
|
|
2915
|
+
"\u0020": "%20"
|
|
2916
|
+
};
|
|
2917
|
+
function encodeWhitespace(string) {
|
|
2918
|
+
return string.replaceAll(/[\s]/g, (c)=>{
|
|
2919
|
+
return WHITESPACE_ENCODINGS[c] ?? c;
|
|
2920
|
+
});
|
|
2921
|
+
}
|
|
2922
|
+
function posixToFileUrl(path) {
|
|
2923
|
+
if (!posixIsAbsolute(path)) {
|
|
2950
2924
|
throw new TypeError("Must be an absolute path.");
|
|
2951
2925
|
}
|
|
2952
2926
|
const url = new URL("file:///");
|
|
2953
2927
|
url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
|
|
2954
2928
|
return url;
|
|
2955
2929
|
}
|
|
2930
|
+
function windowsToFileUrl(path) {
|
|
2931
|
+
if (!windowsIsAbsolute(path)) {
|
|
2932
|
+
throw new TypeError("Must be an absolute path.");
|
|
2933
|
+
}
|
|
2934
|
+
const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
|
|
2935
|
+
const url = new URL("file:///");
|
|
2936
|
+
url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25"));
|
|
2937
|
+
if (hostname != null && hostname != "localhost") {
|
|
2938
|
+
url.hostname = hostname;
|
|
2939
|
+
if (!url.hostname) {
|
|
2940
|
+
throw new TypeError("Invalid hostname.");
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
return url;
|
|
2944
|
+
}
|
|
2945
|
+
const sep = "\\";
|
|
2946
|
+
const delimiter = ";";
|
|
2947
|
+
const mod = {
|
|
2948
|
+
resolve: windowsResolve,
|
|
2949
|
+
normalize: windowsNormalize,
|
|
2950
|
+
isAbsolute: windowsIsAbsolute,
|
|
2951
|
+
join: windowsJoin,
|
|
2952
|
+
relative: windowsRelative,
|
|
2953
|
+
toNamespacedPath: windowsToNamespacedPath,
|
|
2954
|
+
dirname: windowsDirname,
|
|
2955
|
+
basename: windowsBasename,
|
|
2956
|
+
extname: windowsExtname,
|
|
2957
|
+
format: windowsFormat,
|
|
2958
|
+
parse: windowsParse,
|
|
2959
|
+
fromFileUrl: windowsFromFileUrl,
|
|
2960
|
+
toFileUrl: windowsToFileUrl,
|
|
2961
|
+
sep: sep,
|
|
2962
|
+
delimiter: delimiter
|
|
2963
|
+
};
|
|
2964
|
+
const sep1 = "/";
|
|
2965
|
+
const delimiter1 = ":";
|
|
2956
2966
|
const mod1 = {
|
|
2967
|
+
resolve: posixResolve,
|
|
2968
|
+
normalize: posixNormalize,
|
|
2969
|
+
isAbsolute: posixIsAbsolute,
|
|
2970
|
+
join: posixJoin,
|
|
2971
|
+
relative: posixRelative,
|
|
2972
|
+
toNamespacedPath: posixToNamespacedPath,
|
|
2973
|
+
dirname: posixDirname,
|
|
2974
|
+
basename: posixBasename,
|
|
2975
|
+
extname: posixExtname,
|
|
2976
|
+
format: posixFormat,
|
|
2977
|
+
parse: posixParse,
|
|
2978
|
+
fromFileUrl: posixFromFileUrl,
|
|
2979
|
+
toFileUrl: posixToFileUrl,
|
|
2957
2980
|
sep: sep1,
|
|
2958
|
-
delimiter: delimiter1
|
|
2959
|
-
resolve: resolve1,
|
|
2960
|
-
normalize: normalize1,
|
|
2961
|
-
isAbsolute: isAbsolute1,
|
|
2962
|
-
join: join1,
|
|
2963
|
-
relative: relative1,
|
|
2964
|
-
toNamespacedPath: toNamespacedPath1,
|
|
2965
|
-
dirname: dirname1,
|
|
2966
|
-
basename: basename1,
|
|
2967
|
-
extname: extname1,
|
|
2968
|
-
format: format1,
|
|
2969
|
-
parse: parse3,
|
|
2970
|
-
fromFileUrl: fromFileUrl1,
|
|
2971
|
-
toFileUrl: toFileUrl1
|
|
2981
|
+
delimiter: delimiter1
|
|
2972
2982
|
};
|
|
2983
|
+
function basename(path, suffix = "") {
|
|
2984
|
+
return isWindows ? windowsBasename(path, suffix) : posixBasename(path, suffix);
|
|
2985
|
+
}
|
|
2973
2986
|
const path = isWindows ? mod : mod1;
|
|
2974
|
-
const { join
|
|
2975
|
-
|
|
2976
|
-
const { basename: basename2 , delimiter: delimiter2 , dirname: dirname2 , extname: extname2 , format: format2 , fromFileUrl: fromFileUrl2 , isAbsolute: isAbsolute2 , join: join3 , normalize: normalize3 , parse: parse4 , relative: relative2 , resolve: resolve2 , toFileUrl: toFileUrl2 , toNamespacedPath: toNamespacedPath2 } = path1;
|
|
2987
|
+
const { join , normalize } = path;
|
|
2988
|
+
isWindows ? mod.delimiter : mod1.delimiter;
|
|
2977
2989
|
class InputFile {
|
|
2978
2990
|
consumed = false;
|
|
2979
2991
|
fileData;
|
|
@@ -2984,11 +2996,11 @@ class InputFile {
|
|
|
2984
2996
|
this.filename = filename;
|
|
2985
2997
|
}
|
|
2986
2998
|
guessFilename(file) {
|
|
2987
|
-
if (typeof file === "string") return
|
|
2999
|
+
if (typeof file === "string") return basename(file);
|
|
2988
3000
|
if (typeof file !== "object") return undefined;
|
|
2989
|
-
if ("url" in file) return
|
|
3001
|
+
if ("url" in file) return basename(file.url);
|
|
2990
3002
|
if (!(file instanceof URL)) return undefined;
|
|
2991
|
-
return
|
|
3003
|
+
return basename(file.pathname) || basename(file.hostname);
|
|
2992
3004
|
}
|
|
2993
3005
|
toRaw() {
|
|
2994
3006
|
if (this.consumed) {
|
|
@@ -3132,6 +3144,8 @@ function concatTransformer(prev, trans) {
|
|
|
3132
3144
|
return (method, payload, signal)=>trans(prev, method, payload, signal);
|
|
3133
3145
|
}
|
|
3134
3146
|
class ApiClient {
|
|
3147
|
+
token;
|
|
3148
|
+
webhookReplyEnvelope;
|
|
3135
3149
|
options;
|
|
3136
3150
|
hasUsedWebhookReply;
|
|
3137
3151
|
installedTransformers;
|
|
@@ -3208,8 +3222,6 @@ class ApiClient {
|
|
|
3208
3222
|
if (data.ok) return data.result;
|
|
3209
3223
|
else throw toGrammyError(data, method, payload);
|
|
3210
3224
|
}
|
|
3211
|
-
token;
|
|
3212
|
-
webhookReplyEnvelope;
|
|
3213
3225
|
}
|
|
3214
3226
|
function createRawApi(token, options, webhookReplyEnvelope) {
|
|
3215
3227
|
const client = new ApiClient(token, options, webhookReplyEnvelope);
|
|
@@ -3739,6 +3751,11 @@ class Api {
|
|
|
3739
3751
|
chat_id
|
|
3740
3752
|
}, signal);
|
|
3741
3753
|
}
|
|
3754
|
+
unpinAllGeneralForumTopicMessages(chat_id, signal) {
|
|
3755
|
+
return this.raw.unpinAllGeneralForumTopicMessages({
|
|
3756
|
+
chat_id
|
|
3757
|
+
}, signal);
|
|
3758
|
+
}
|
|
3742
3759
|
answerCallbackQuery(callback_query_id, other, signal) {
|
|
3743
3760
|
return this.raw.answerCallbackQuery({
|
|
3744
3761
|
callback_query_id,
|
|
@@ -4088,6 +4105,7 @@ const DEFAULT_UPDATE_TYPES = [
|
|
|
4088
4105
|
"chat_join_request"
|
|
4089
4106
|
];
|
|
4090
4107
|
class Bot extends Composer {
|
|
4108
|
+
token;
|
|
4091
4109
|
pollingRunning;
|
|
4092
4110
|
pollingAbortController;
|
|
4093
4111
|
lastTriedUpdateId;
|
|
@@ -4279,7 +4297,6 @@ a known bot info object.");
|
|
|
4279
4297
|
debugErr(`Call to getUpdates failed, retrying in ${sleepSeconds} seconds ...`);
|
|
4280
4298
|
await sleep(sleepSeconds);
|
|
4281
4299
|
}
|
|
4282
|
-
token;
|
|
4283
4300
|
}
|
|
4284
4301
|
async function withRetries(task, signal) {
|
|
4285
4302
|
const INITIAL_DELAY = 50;
|
|
@@ -4716,6 +4733,7 @@ const InputMediaBuilder = {
|
|
|
4716
4733
|
};
|
|
4717
4734
|
export { InputMediaBuilder as InputMediaBuilder };
|
|
4718
4735
|
class Keyboard {
|
|
4736
|
+
keyboard;
|
|
4719
4737
|
is_persistent;
|
|
4720
4738
|
selective;
|
|
4721
4739
|
one_time_keyboard;
|
|
@@ -4866,9 +4884,9 @@ class Keyboard {
|
|
|
4866
4884
|
}
|
|
4867
4885
|
return new Keyboard(source.map((row)=>row.map(toButton)));
|
|
4868
4886
|
}
|
|
4869
|
-
keyboard;
|
|
4870
4887
|
}
|
|
4871
4888
|
class InlineKeyboard {
|
|
4889
|
+
inline_keyboard;
|
|
4872
4890
|
constructor(inline_keyboard = [
|
|
4873
4891
|
[]
|
|
4874
4892
|
]){
|
|
@@ -4991,7 +5009,6 @@ class InlineKeyboard {
|
|
|
4991
5009
|
if (source instanceof InlineKeyboard) return source.clone();
|
|
4992
5010
|
return new InlineKeyboard(source.map((row)=>row.slice()));
|
|
4993
5011
|
}
|
|
4994
|
-
inline_keyboard;
|
|
4995
5012
|
}
|
|
4996
5013
|
function transpose(grid) {
|
|
4997
5014
|
const transposed = [];
|
|
@@ -5084,6 +5101,10 @@ function lazySession(options = {}) {
|
|
|
5084
5101
|
};
|
|
5085
5102
|
}
|
|
5086
5103
|
class PropertySession {
|
|
5104
|
+
storage;
|
|
5105
|
+
obj;
|
|
5106
|
+
prop;
|
|
5107
|
+
initial;
|
|
5087
5108
|
key;
|
|
5088
5109
|
value;
|
|
5089
5110
|
promise;
|
|
@@ -5168,10 +5189,6 @@ class PropertySession {
|
|
|
5168
5189
|
}
|
|
5169
5190
|
}
|
|
5170
5191
|
}
|
|
5171
|
-
storage;
|
|
5172
|
-
obj;
|
|
5173
|
-
prop;
|
|
5174
|
-
initial;
|
|
5175
5192
|
}
|
|
5176
5193
|
function fillDefaults(opts = {}) {
|
|
5177
5194
|
let { getSessionKey =defaultGetSessionKey , initial , storage } = opts;
|
|
@@ -5288,6 +5305,7 @@ function wrapStorage(storage) {
|
|
|
5288
5305
|
};
|
|
5289
5306
|
}
|
|
5290
5307
|
class MemorySessionStorage {
|
|
5308
|
+
timeToLive;
|
|
5291
5309
|
storage;
|
|
5292
5310
|
constructor(timeToLive){
|
|
5293
5311
|
this.timeToLive = timeToLive;
|
|
@@ -5326,7 +5344,6 @@ class MemorySessionStorage {
|
|
|
5326
5344
|
delete(key) {
|
|
5327
5345
|
this.storage.delete(key);
|
|
5328
5346
|
}
|
|
5329
|
-
timeToLive;
|
|
5330
5347
|
}
|
|
5331
5348
|
function addExpiryDate(value, ttl) {
|
|
5332
5349
|
if (ttl !== undefined && ttl < Infinity) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grammy",
|
|
3
3
|
"description": "The Telegram Bot Framework.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.1",
|
|
5
5
|
"author": "KnorpelSenf",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"contribs": "all-contributors"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@grammyjs/types": "3.
|
|
21
|
+
"@grammyjs/types": "3.2.0",
|
|
22
22
|
"abort-controller": "^3.0.0",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
24
|
"node-fetch": "^2.6.11"
|