@mtcute/core 0.20.0 → 0.20.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/highlevel/methods/premium/get-saved-star-gifts.d.cts +5 -1
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +5 -1
- package/highlevel/methods/premium/get-star-gifts.cjs +4 -13
- package/highlevel/methods/premium/get-star-gifts.d.cts +3 -2
- package/highlevel/methods/premium/get-star-gifts.d.ts +3 -2
- package/highlevel/methods/premium/get-star-gifts.js +4 -13
- package/highlevel/types/premium/saved-star-gift.cjs +1 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +3 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +3 -0
- package/highlevel/types/premium/saved-star-gift.js +2 -1
- package/highlevel/types/premium/stars-gift.cjs +0 -66
- package/highlevel/types/premium/stars-gift.d.cts +0 -39
- package/highlevel/types/premium/stars-gift.d.ts +0 -39
- package/highlevel/types/premium/stars-gift.js +1 -67
- package/index.cjs +1 -1
- package/index.js +2 -2
- package/network/middlewares/bundle.cjs +4 -0
- package/network/middlewares/bundle.d.cts +2 -0
- package/network/middlewares/bundle.d.ts +2 -0
- package/network/middlewares/bundle.js +4 -0
- package/network/middlewares/internal-errors.cjs +3 -1
- package/network/middlewares/internal-errors.d.cts +4 -0
- package/network/middlewares/internal-errors.d.ts +4 -0
- package/network/middlewares/internal-errors.js +3 -1
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { ArrayPaginated, InputPeerLike } from '../../types/index.js';
|
|
3
3
|
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Get a list of saved star gifts of a user/channel
|
|
6
|
+
*
|
|
7
|
+
* Note that filters currently only work for channels
|
|
8
|
+
*/
|
|
5
9
|
export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
6
10
|
/** Peer to get saved gifts from */
|
|
7
11
|
owner: InputPeerLike;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { ArrayPaginated, InputPeerLike } from '../../types/index.js';
|
|
3
3
|
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Get a list of saved star gifts of a user/channel
|
|
6
|
+
*
|
|
7
|
+
* Note that filters currently only work for channels
|
|
8
|
+
*/
|
|
5
9
|
export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
6
10
|
/** Peer to get saved gifts from */
|
|
7
11
|
owner: InputPeerLike;
|
|
@@ -5,20 +5,11 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const
|
|
9
|
-
const starsGift = require("../../types/premium/stars-gift.cjs");
|
|
10
|
-
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
11
|
-
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
8
|
+
const getSavedStarGifts = require("./get-saved-star-gifts.cjs");
|
|
12
9
|
async function getStarGifts(client, userId, params) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
userId: await resolvePeer.resolveUser(client, userId),
|
|
17
|
-
offset,
|
|
18
|
-
limit
|
|
10
|
+
return getSavedStarGifts.getSavedStarGifts(client, {
|
|
11
|
+
owner: userId,
|
|
12
|
+
...params
|
|
19
13
|
});
|
|
20
|
-
const peers = peersIndex.PeersIndex.from(res);
|
|
21
|
-
const gifts = res.gifts.map((gift) => new starsGift.UserStarGift(gift, peers));
|
|
22
|
-
return miscUtils.makeArrayPaginated(gifts, res.count, res.nextOffset);
|
|
23
14
|
}
|
|
24
15
|
exports.getStarGifts = getStarGifts;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { SavedStarGift } from '../../types/index.js';
|
|
2
3
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
4
|
import { ArrayPaginated } from '../../types/utils.js';
|
|
4
|
-
import { UserStarGift } from '../../types/premium/stars-gift.js';
|
|
5
5
|
/**
|
|
6
6
|
* Get a list of gifts sent to a user.
|
|
7
7
|
*
|
|
8
8
|
* @param userId User whose gifts to fetch
|
|
9
|
+
* @deprecated Use {@link getSavedStarGifts} instead
|
|
9
10
|
* @returns Gifts sent to the user
|
|
10
11
|
*/
|
|
11
12
|
export declare function getStarGifts(client: ITelegramClient, userId: InputPeerLike, params?: {
|
|
@@ -19,4 +20,4 @@ export declare function getStarGifts(client: ITelegramClient, userId: InputPeerL
|
|
|
19
20
|
* @default 100
|
|
20
21
|
*/
|
|
21
22
|
limit?: number;
|
|
22
|
-
}): Promise<ArrayPaginated<
|
|
23
|
+
}): Promise<ArrayPaginated<SavedStarGift, string>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { SavedStarGift } from '../../types/index.js';
|
|
2
3
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
4
|
import { ArrayPaginated } from '../../types/utils.js';
|
|
4
|
-
import { UserStarGift } from '../../types/premium/stars-gift.js';
|
|
5
5
|
/**
|
|
6
6
|
* Get a list of gifts sent to a user.
|
|
7
7
|
*
|
|
8
8
|
* @param userId User whose gifts to fetch
|
|
9
|
+
* @deprecated Use {@link getSavedStarGifts} instead
|
|
9
10
|
* @returns Gifts sent to the user
|
|
10
11
|
*/
|
|
11
12
|
export declare function getStarGifts(client: ITelegramClient, userId: InputPeerLike, params?: {
|
|
@@ -19,4 +20,4 @@ export declare function getStarGifts(client: ITelegramClient, userId: InputPeerL
|
|
|
19
20
|
* @default 100
|
|
20
21
|
*/
|
|
21
22
|
limit?: number;
|
|
22
|
-
}): Promise<ArrayPaginated<
|
|
23
|
+
}): Promise<ArrayPaginated<SavedStarGift, string>>;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UserStarGift as UserStarGift$2 } from "../../types/premium/stars-gift.js";
|
|
3
|
-
import { makeArrayPaginated } from "../../utils/misc-utils.js";
|
|
4
|
-
import { resolveUser } from "../users/resolve-peer.js";
|
|
1
|
+
import { getSavedStarGifts } from "./get-saved-star-gifts.js";
|
|
5
2
|
async function getStarGifts(client, userId, params) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
userId: await resolveUser(client, userId),
|
|
10
|
-
offset,
|
|
11
|
-
limit
|
|
3
|
+
return getSavedStarGifts(client, {
|
|
4
|
+
owner: userId,
|
|
5
|
+
...params
|
|
12
6
|
});
|
|
13
|
-
const peers = PeersIndex.from(res);
|
|
14
|
-
const gifts = res.gifts.map((gift) => new UserStarGift$2(gift, peers));
|
|
15
|
-
return makeArrayPaginated(gifts, res.count, res.nextOffset);
|
|
16
7
|
}
|
|
17
8
|
export {
|
|
18
9
|
getStarGifts
|
|
@@ -78,3 +78,4 @@ class SavedStarGift {
|
|
|
78
78
|
const SavedStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(SavedStarGift);
|
|
79
79
|
const SavedStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
80
80
|
exports.SavedStarGift = SavedStarGift$2;
|
|
81
|
+
exports.UserStarGift = SavedStarGift;
|
|
@@ -71,5 +71,6 @@ class SavedStarGift {
|
|
|
71
71
|
const SavedStarGift$1 = /* @__PURE__ */ makeInspectable(SavedStarGift);
|
|
72
72
|
const SavedStarGift$2 = /* @__PURE__ */ memoizeGetters(SavedStarGift$1, ["sender", "gift"]);
|
|
73
73
|
export {
|
|
74
|
-
SavedStarGift$2 as SavedStarGift
|
|
74
|
+
SavedStarGift$2 as SavedStarGift,
|
|
75
|
+
SavedStarGift as UserStarGift
|
|
75
76
|
};
|
|
@@ -5,14 +5,11 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const Long = require("long");
|
|
9
8
|
const errors = require("../../../types/errors.cjs");
|
|
10
9
|
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
11
10
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
12
11
|
const memoize = require("../../utils/memoize.cjs");
|
|
13
12
|
const documentUtils = require("../media/document-utils.cjs");
|
|
14
|
-
const user = require("../peers/user.cjs");
|
|
15
|
-
const starsGiftUnique = require("./stars-gift-unique.cjs");
|
|
16
13
|
class StarGift {
|
|
17
14
|
constructor(raw) {
|
|
18
15
|
this.raw = raw;
|
|
@@ -82,67 +79,4 @@ class StarGift {
|
|
|
82
79
|
}
|
|
83
80
|
const StarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(StarGift);
|
|
84
81
|
const StarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(StarGift$1, ["sticker"]);
|
|
85
|
-
class UserStarGift {
|
|
86
|
-
constructor(raw, peers) {
|
|
87
|
-
this.raw = raw;
|
|
88
|
-
this.peers = peers;
|
|
89
|
-
}
|
|
90
|
-
/** Whether the sender chose to appear anonymously */
|
|
91
|
-
get nameHidden() {
|
|
92
|
-
return this.raw.nameHidden;
|
|
93
|
-
}
|
|
94
|
-
/** Whether this gift is not visible on the recipient's profile */
|
|
95
|
-
get hidden() {
|
|
96
|
-
return this.raw.unsaved;
|
|
97
|
-
}
|
|
98
|
-
get isRefunded() {
|
|
99
|
-
return this.raw.refunded;
|
|
100
|
-
}
|
|
101
|
-
/** Sender of the gift, if available */
|
|
102
|
-
get sender() {
|
|
103
|
-
return this.raw.fromId ? new user.User(this.peers.user(this.raw.fromId)) : null;
|
|
104
|
-
}
|
|
105
|
-
/** Message ID where the gift was sent, if available */
|
|
106
|
-
get messageId() {
|
|
107
|
-
return this.raw.msgId ?? null;
|
|
108
|
-
}
|
|
109
|
-
/** Date the gift was sent or minted */
|
|
110
|
-
get date() {
|
|
111
|
-
return new Date(this.raw.date * 1e3);
|
|
112
|
-
}
|
|
113
|
-
/** Whether the gift can be upgraded to a unique gift */
|
|
114
|
-
get canUpgrade() {
|
|
115
|
-
return this.raw.canUpgrade;
|
|
116
|
-
}
|
|
117
|
-
/** Number of stars to upgrade the gift to a unique gift (may be 0) */
|
|
118
|
-
get upgradeStars() {
|
|
119
|
-
if (!this.raw.canUpgrade) return null;
|
|
120
|
-
return this.raw.upgradeStars ?? Long.ZERO;
|
|
121
|
-
}
|
|
122
|
-
/** The gift itself */
|
|
123
|
-
get gift() {
|
|
124
|
-
return this.raw.gift._ === "starGift" ? new StarGift(this.raw.gift) : new starsGiftUnique.StarGiftUnique(this.raw.gift, this.peers);
|
|
125
|
-
}
|
|
126
|
-
/** Text attached to the gift */
|
|
127
|
-
get text() {
|
|
128
|
-
return this.raw.message ?? null;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* If the gift was converted to stars, the amount of stars
|
|
132
|
-
* it was converted to
|
|
133
|
-
*/
|
|
134
|
-
get convertStars() {
|
|
135
|
-
return this.raw.convertStars ?? null;
|
|
136
|
-
}
|
|
137
|
-
get canExportAt() {
|
|
138
|
-
return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
|
|
139
|
-
}
|
|
140
|
-
/** Number of stars this gift can be transferred for */
|
|
141
|
-
get transferStars() {
|
|
142
|
-
return this.raw.transferStars ?? null;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const UserStarGift$1 = /* @__PURE__ */ inspectable.makeInspectable(UserStarGift);
|
|
146
|
-
const UserStarGift$2 = /* @__PURE__ */ memoize.memoizeGetters(UserStarGift$1, ["sender", "gift"]);
|
|
147
82
|
exports.StarGift = StarGift$2;
|
|
148
|
-
exports.UserStarGift = UserStarGift$2;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { Sticker } from '../media/sticker.js';
|
|
3
3
|
import { Message } from '../messages/message.js';
|
|
4
|
-
import { TextWithEntities } from '../misc/entities.js';
|
|
5
4
|
import { InputPeerLike } from '../peers/peer.js';
|
|
6
|
-
import { PeersIndex } from '../peers/peers-index.js';
|
|
7
|
-
import { User } from '../peers/user.js';
|
|
8
|
-
import { StarGiftUnique } from './stars-gift-unique.js';
|
|
9
5
|
export type InputStarGift = {
|
|
10
6
|
/** ID of the message containing the gift */
|
|
11
7
|
message: number | Message;
|
|
@@ -57,38 +53,3 @@ export declare class StarGift {
|
|
|
57
53
|
total: number;
|
|
58
54
|
} | null;
|
|
59
55
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Information about a certain user's {@link StarGift}.
|
|
62
|
-
*/
|
|
63
|
-
export declare class UserStarGift {
|
|
64
|
-
readonly raw: tl.RawUserStarGift;
|
|
65
|
-
readonly peers: PeersIndex;
|
|
66
|
-
constructor(raw: tl.RawUserStarGift, peers: PeersIndex);
|
|
67
|
-
/** Whether the sender chose to appear anonymously */
|
|
68
|
-
get nameHidden(): boolean;
|
|
69
|
-
/** Whether this gift is not visible on the recipient's profile */
|
|
70
|
-
get hidden(): boolean;
|
|
71
|
-
get isRefunded(): boolean;
|
|
72
|
-
/** Sender of the gift, if available */
|
|
73
|
-
get sender(): User | null;
|
|
74
|
-
/** Message ID where the gift was sent, if available */
|
|
75
|
-
get messageId(): number | null;
|
|
76
|
-
/** Date the gift was sent or minted */
|
|
77
|
-
get date(): Date;
|
|
78
|
-
/** Whether the gift can be upgraded to a unique gift */
|
|
79
|
-
get canUpgrade(): boolean;
|
|
80
|
-
/** Number of stars to upgrade the gift to a unique gift (may be 0) */
|
|
81
|
-
get upgradeStars(): tl.Long | null;
|
|
82
|
-
/** The gift itself */
|
|
83
|
-
get gift(): StarGift | StarGiftUnique;
|
|
84
|
-
/** Text attached to the gift */
|
|
85
|
-
get text(): TextWithEntities | null;
|
|
86
|
-
/**
|
|
87
|
-
* If the gift was converted to stars, the amount of stars
|
|
88
|
-
* it was converted to
|
|
89
|
-
*/
|
|
90
|
-
get convertStars(): tl.Long | null;
|
|
91
|
-
get canExportAt(): Date | null;
|
|
92
|
-
/** Number of stars this gift can be transferred for */
|
|
93
|
-
get transferStars(): tl.Long | null;
|
|
94
|
-
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { Sticker } from '../media/sticker.js';
|
|
3
3
|
import { Message } from '../messages/message.js';
|
|
4
|
-
import { TextWithEntities } from '../misc/entities.js';
|
|
5
4
|
import { InputPeerLike } from '../peers/peer.js';
|
|
6
|
-
import { PeersIndex } from '../peers/peers-index.js';
|
|
7
|
-
import { User } from '../peers/user.js';
|
|
8
|
-
import { StarGiftUnique } from './stars-gift-unique.js';
|
|
9
5
|
export type InputStarGift = {
|
|
10
6
|
/** ID of the message containing the gift */
|
|
11
7
|
message: number | Message;
|
|
@@ -57,38 +53,3 @@ export declare class StarGift {
|
|
|
57
53
|
total: number;
|
|
58
54
|
} | null;
|
|
59
55
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Information about a certain user's {@link StarGift}.
|
|
62
|
-
*/
|
|
63
|
-
export declare class UserStarGift {
|
|
64
|
-
readonly raw: tl.RawUserStarGift;
|
|
65
|
-
readonly peers: PeersIndex;
|
|
66
|
-
constructor(raw: tl.RawUserStarGift, peers: PeersIndex);
|
|
67
|
-
/** Whether the sender chose to appear anonymously */
|
|
68
|
-
get nameHidden(): boolean;
|
|
69
|
-
/** Whether this gift is not visible on the recipient's profile */
|
|
70
|
-
get hidden(): boolean;
|
|
71
|
-
get isRefunded(): boolean;
|
|
72
|
-
/** Sender of the gift, if available */
|
|
73
|
-
get sender(): User | null;
|
|
74
|
-
/** Message ID where the gift was sent, if available */
|
|
75
|
-
get messageId(): number | null;
|
|
76
|
-
/** Date the gift was sent or minted */
|
|
77
|
-
get date(): Date;
|
|
78
|
-
/** Whether the gift can be upgraded to a unique gift */
|
|
79
|
-
get canUpgrade(): boolean;
|
|
80
|
-
/** Number of stars to upgrade the gift to a unique gift (may be 0) */
|
|
81
|
-
get upgradeStars(): tl.Long | null;
|
|
82
|
-
/** The gift itself */
|
|
83
|
-
get gift(): StarGift | StarGiftUnique;
|
|
84
|
-
/** Text attached to the gift */
|
|
85
|
-
get text(): TextWithEntities | null;
|
|
86
|
-
/**
|
|
87
|
-
* If the gift was converted to stars, the amount of stars
|
|
88
|
-
* it was converted to
|
|
89
|
-
*/
|
|
90
|
-
get convertStars(): tl.Long | null;
|
|
91
|
-
get canExportAt(): Date | null;
|
|
92
|
-
/** Number of stars this gift can be transferred for */
|
|
93
|
-
get transferStars(): tl.Long | null;
|
|
94
|
-
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import Long from "long";
|
|
2
1
|
import { MtTypeAssertionError } from "../../../types/errors.js";
|
|
3
2
|
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
4
3
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
5
4
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
6
5
|
import { parseDocument } from "../media/document-utils.js";
|
|
7
|
-
import { User as User$2 } from "../peers/user.js";
|
|
8
|
-
import { StarGiftUnique as StarGiftUnique$2 } from "./stars-gift-unique.js";
|
|
9
6
|
class StarGift {
|
|
10
7
|
constructor(raw) {
|
|
11
8
|
this.raw = raw;
|
|
@@ -75,69 +72,6 @@ class StarGift {
|
|
|
75
72
|
}
|
|
76
73
|
const StarGift$1 = /* @__PURE__ */ makeInspectable(StarGift);
|
|
77
74
|
const StarGift$2 = /* @__PURE__ */ memoizeGetters(StarGift$1, ["sticker"]);
|
|
78
|
-
class UserStarGift {
|
|
79
|
-
constructor(raw, peers) {
|
|
80
|
-
this.raw = raw;
|
|
81
|
-
this.peers = peers;
|
|
82
|
-
}
|
|
83
|
-
/** Whether the sender chose to appear anonymously */
|
|
84
|
-
get nameHidden() {
|
|
85
|
-
return this.raw.nameHidden;
|
|
86
|
-
}
|
|
87
|
-
/** Whether this gift is not visible on the recipient's profile */
|
|
88
|
-
get hidden() {
|
|
89
|
-
return this.raw.unsaved;
|
|
90
|
-
}
|
|
91
|
-
get isRefunded() {
|
|
92
|
-
return this.raw.refunded;
|
|
93
|
-
}
|
|
94
|
-
/** Sender of the gift, if available */
|
|
95
|
-
get sender() {
|
|
96
|
-
return this.raw.fromId ? new User$2(this.peers.user(this.raw.fromId)) : null;
|
|
97
|
-
}
|
|
98
|
-
/** Message ID where the gift was sent, if available */
|
|
99
|
-
get messageId() {
|
|
100
|
-
return this.raw.msgId ?? null;
|
|
101
|
-
}
|
|
102
|
-
/** Date the gift was sent or minted */
|
|
103
|
-
get date() {
|
|
104
|
-
return new Date(this.raw.date * 1e3);
|
|
105
|
-
}
|
|
106
|
-
/** Whether the gift can be upgraded to a unique gift */
|
|
107
|
-
get canUpgrade() {
|
|
108
|
-
return this.raw.canUpgrade;
|
|
109
|
-
}
|
|
110
|
-
/** Number of stars to upgrade the gift to a unique gift (may be 0) */
|
|
111
|
-
get upgradeStars() {
|
|
112
|
-
if (!this.raw.canUpgrade) return null;
|
|
113
|
-
return this.raw.upgradeStars ?? Long.ZERO;
|
|
114
|
-
}
|
|
115
|
-
/** The gift itself */
|
|
116
|
-
get gift() {
|
|
117
|
-
return this.raw.gift._ === "starGift" ? new StarGift(this.raw.gift) : new StarGiftUnique$2(this.raw.gift, this.peers);
|
|
118
|
-
}
|
|
119
|
-
/** Text attached to the gift */
|
|
120
|
-
get text() {
|
|
121
|
-
return this.raw.message ?? null;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* If the gift was converted to stars, the amount of stars
|
|
125
|
-
* it was converted to
|
|
126
|
-
*/
|
|
127
|
-
get convertStars() {
|
|
128
|
-
return this.raw.convertStars ?? null;
|
|
129
|
-
}
|
|
130
|
-
get canExportAt() {
|
|
131
|
-
return this.raw.canExportAt ? new Date(this.raw.canExportAt * 1e3) : null;
|
|
132
|
-
}
|
|
133
|
-
/** Number of stars this gift can be transferred for */
|
|
134
|
-
get transferStars() {
|
|
135
|
-
return this.raw.transferStars ?? null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const UserStarGift$1 = /* @__PURE__ */ makeInspectable(UserStarGift);
|
|
139
|
-
const UserStarGift$2 = /* @__PURE__ */ memoizeGetters(UserStarGift$1, ["sender", "gift"]);
|
|
140
75
|
export {
|
|
141
|
-
StarGift$2 as StarGift
|
|
142
|
-
UserStarGift$2 as UserStarGift
|
|
76
|
+
StarGift$2 as StarGift
|
|
143
77
|
};
|
package/index.cjs
CHANGED
|
@@ -256,12 +256,12 @@ exports.BusinessLocation = businessLocation.BusinessLocation;
|
|
|
256
256
|
exports.BusinessWorkHours = businessWorkHours.BusinessWorkHours;
|
|
257
257
|
exports.businessWorkHoursDaysToRaw = businessWorkHours.businessWorkHoursDaysToRaw;
|
|
258
258
|
exports.SavedStarGift = savedStarGift.SavedStarGift;
|
|
259
|
+
exports.UserStarGift = savedStarGift.UserStarGift;
|
|
259
260
|
exports.StarGiftUnique = starsGiftUnique.StarGiftUnique;
|
|
260
261
|
exports.StarGiftUniqueAttribute = starsGiftUnique.StarGiftUniqueAttribute;
|
|
261
262
|
exports.StarGiftUniqueBackdrop = starsGiftUnique.StarGiftUniqueBackdrop;
|
|
262
263
|
exports.StarGiftUniqueOriginalDetails = starsGiftUnique.StarGiftUniqueOriginalDetails;
|
|
263
264
|
exports.StarGift = starsGift.StarGift;
|
|
264
|
-
exports.UserStarGift = starsGift.UserStarGift;
|
|
265
265
|
exports.StarsStatus = starsStatus.StarsStatus;
|
|
266
266
|
exports.StarsTransaction = starsTransaction.StarsTransaction;
|
|
267
267
|
exports.EmojiStatus = emojiStatus.EmojiStatus;
|
package/index.js
CHANGED
|
@@ -82,9 +82,9 @@ import { BusinessConnection } from "./highlevel/types/premium/business-connectio
|
|
|
82
82
|
import { BusinessIntro } from "./highlevel/types/premium/business-intro.js";
|
|
83
83
|
import { BusinessLocation } from "./highlevel/types/premium/business-location.js";
|
|
84
84
|
import { BusinessWorkHours, businessWorkHoursDaysToRaw } from "./highlevel/types/premium/business-work-hours.js";
|
|
85
|
-
import { SavedStarGift } from "./highlevel/types/premium/saved-star-gift.js";
|
|
85
|
+
import { SavedStarGift, UserStarGift } from "./highlevel/types/premium/saved-star-gift.js";
|
|
86
86
|
import { StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop, StarGiftUniqueOriginalDetails } from "./highlevel/types/premium/stars-gift-unique.js";
|
|
87
|
-
import { StarGift
|
|
87
|
+
import { StarGift } from "./highlevel/types/premium/stars-gift.js";
|
|
88
88
|
import { StarsStatus } from "./highlevel/types/premium/stars-status.js";
|
|
89
89
|
import { StarsTransaction } from "./highlevel/types/premium/stars-transaction.js";
|
|
90
90
|
import { EmojiStatus, EmojiStatusCollectible } from "./highlevel/types/reactions/emoji-status.js";
|
|
@@ -6,8 +6,12 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const _default = require("./default.cjs");
|
|
9
|
+
const floodWaiter = require("./flood-waiter.cjs");
|
|
10
|
+
const internalErrors = require("./internal-errors.cjs");
|
|
9
11
|
const onError = require("./on-error.cjs");
|
|
10
12
|
const onMethod = require("./on-method.cjs");
|
|
11
13
|
exports.basic = _default.basic;
|
|
14
|
+
exports.floodWaiter = floodWaiter.floodWaiter;
|
|
15
|
+
exports.internalErrorsHandler = internalErrors.internalErrorsHandler;
|
|
12
16
|
exports.onRpcError = onError.onRpcError;
|
|
13
17
|
exports.onMethod = onMethod.onMethod;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { basic } from "./default.js";
|
|
2
|
+
import { floodWaiter } from "./flood-waiter.js";
|
|
3
|
+
import { internalErrorsHandler } from "./internal-errors.js";
|
|
2
4
|
import { onRpcError } from "./on-error.js";
|
|
3
5
|
import { onMethod } from "./on-method.js";
|
|
4
6
|
export {
|
|
5
7
|
basic,
|
|
8
|
+
floodWaiter,
|
|
9
|
+
internalErrorsHandler,
|
|
6
10
|
onMethod,
|
|
7
11
|
onRpcError
|
|
8
12
|
};
|
|
@@ -20,13 +20,15 @@ const CLIENT_ERRORS = /* @__PURE__ */ new Set([
|
|
|
20
20
|
tl.tl.RpcError.NOT_ACCEPTABLE
|
|
21
21
|
]);
|
|
22
22
|
function internalErrorsHandler(params) {
|
|
23
|
-
const { maxRetries = Infinity, waitTime = 1 } = params;
|
|
23
|
+
const { maxRetries = Infinity, waitTime = 1, exceptErrors } = params;
|
|
24
|
+
const exceptErrorsSet = exceptErrors ? new Set(exceptErrors) : void 0;
|
|
24
25
|
return async (ctx, next) => {
|
|
25
26
|
const numRetries = ctx.params?.maxRetryCount ?? maxRetries;
|
|
26
27
|
for (let i = 0; i <= numRetries; i++) {
|
|
27
28
|
const res = await next(ctx);
|
|
28
29
|
if (!typeAssertions.isTlRpcError(res)) return res;
|
|
29
30
|
if (!CLIENT_ERRORS.has(res.errorCode)) {
|
|
31
|
+
if (exceptErrorsSet?.has(res.errorMessage)) return res;
|
|
30
32
|
if (ctx.params?.throw503 && res.errorCode === -503) {
|
|
31
33
|
throw new errors.MtTimeoutError();
|
|
32
34
|
}
|
|
@@ -13,5 +13,9 @@ export interface InternalErrorsHandlerOptions {
|
|
|
13
13
|
* @default 1
|
|
14
14
|
*/
|
|
15
15
|
waitTime?: number;
|
|
16
|
+
/**
|
|
17
|
+
* List of internal errors that should not be retried and should be thrown immediately.
|
|
18
|
+
*/
|
|
19
|
+
exceptErrors?: string[];
|
|
16
20
|
}
|
|
17
21
|
export declare function internalErrorsHandler(params: InternalErrorsHandlerOptions): RpcCallMiddleware;
|
|
@@ -13,5 +13,9 @@ export interface InternalErrorsHandlerOptions {
|
|
|
13
13
|
* @default 1
|
|
14
14
|
*/
|
|
15
15
|
waitTime?: number;
|
|
16
|
+
/**
|
|
17
|
+
* List of internal errors that should not be retried and should be thrown immediately.
|
|
18
|
+
*/
|
|
19
|
+
exceptErrors?: string[];
|
|
16
20
|
}
|
|
17
21
|
export declare function internalErrorsHandler(params: InternalErrorsHandlerOptions): RpcCallMiddleware;
|
|
@@ -13,13 +13,15 @@ const CLIENT_ERRORS = /* @__PURE__ */ new Set([
|
|
|
13
13
|
tl.RpcError.NOT_ACCEPTABLE
|
|
14
14
|
]);
|
|
15
15
|
function internalErrorsHandler(params) {
|
|
16
|
-
const { maxRetries = Infinity, waitTime = 1 } = params;
|
|
16
|
+
const { maxRetries = Infinity, waitTime = 1, exceptErrors } = params;
|
|
17
|
+
const exceptErrorsSet = exceptErrors ? new Set(exceptErrors) : void 0;
|
|
17
18
|
return async (ctx, next) => {
|
|
18
19
|
const numRetries = ctx.params?.maxRetryCount ?? maxRetries;
|
|
19
20
|
for (let i = 0; i <= numRetries; i++) {
|
|
20
21
|
const res = await next(ctx);
|
|
21
22
|
if (!isTlRpcError(res)) return res;
|
|
22
23
|
if (!CLIENT_ERRORS.has(res.errorCode)) {
|
|
24
|
+
if (exceptErrorsSet?.has(res.errorMessage)) return res;
|
|
23
25
|
if (ctx.params?.throw503 && res.errorCode === -503) {
|
|
24
26
|
throw new MtTimeoutError();
|
|
25
27
|
}
|