Skip to content

Commit

Permalink
77eb4bc38c0a9f3fd2e73a874aaa98f031e4a971
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 5, 2024
1 parent 7f4bce2 commit 938f7d7
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 34 deletions.
1 change: 0 additions & 1 deletion esm/1_utilities.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from "./utilities/0_bigint.js";
export * from "./utilities/0_buffer.js";
export * from "./utilities/0_cache_map.js";
export * from "./utilities/0_color.js";
export * from "./utilities/0_control.js";
export * from "./utilities/0_crypto.js";
export * from "./utilities/0_hash.js";
export * from "./utilities/0_logger.js";
Expand Down
1 change: 0 additions & 1 deletion esm/1_utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from "./utilities/0_bigint.js";
export * from "./utilities/0_buffer.js";
export * from "./utilities/0_cache_map.js";
export * from "./utilities/0_color.js";
export * from "./utilities/0_control.js";
export * from "./utilities/0_crypto.js";
export * from "./utilities/0_hash.js";
export * from "./utilities/0_logger.js";
Expand Down
5 changes: 3 additions & 2 deletions esm/connection/1_connection_web_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
};
var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionWebSocket_rMutex, _ConnectionWebSocket_wMutex, _ConnectionWebSocket_buffer, _ConnectionWebSocket_nextResolve, _ConnectionWebSocket_initWs, _ConnectionWebSocket_wasConnected, _ConnectionWebSocket_isConnecting, _ConnectionWebSocket_connectionError, _ConnectionWebSocket_assertConnected, _ConnectionWebSocket_rejectRead;
import * as dntShim from "../_dnt.shims.js";
import { concat, getLogger, Mutex, UNREACHABLE } from "../1_utilities.js";
import { unreachable } from "../0_deps.js";
import { concat, getLogger, Mutex } from "../1_utilities.js";
import { ConnectionUnframed } from "./0_connection.js";
const L = getLogger("ConnectionWebSocket");
const errConnectionNotOpen = new Error("Connection not open");
Expand Down Expand Up @@ -115,7 +116,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
return;
}
const unlock = await mutex.lock();
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : UNREACHABLE())).arrayBuffer());
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : unreachable())).arrayBuffer());
__classPrivateFieldSet(this, _ConnectionWebSocket_buffer, concat(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
Expand Down
4 changes: 2 additions & 2 deletions esm/storage/0_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Storage_instances, _Storage_authKeyId, _Storage_resetAuthKeyId, _Storage_accountId, _Storage_accountType, _Storage_getUpdateId;
import { unreachable } from "../0_deps.js";
import { AssertionError, unreachable } from "../0_deps.js";
import { base64DecodeUrlSafe, base64EncodeUrlSafe, bigIntFromBuffer, rleDecode, rleEncode, sha1, ZERO_CHANNEL_ID } from "../1_utilities.js";
import { peerToChatId, serialize, TLObject, TLReader, TLWriter, types } from "../2_tl.js";
// key parts
Expand Down Expand Up @@ -252,7 +252,7 @@ export class Storage {
unreachable();
}
catch (err) {
if (!(err instanceof Error) || !(err.message == "Unreachable")) {
if (!(err instanceof AssertionError)) {
throw err;
}
else {
Expand Down
4 changes: 2 additions & 2 deletions esm/types/2_chat_member.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { unreachable } from "../0_deps.js";
import { cleanObject, fromUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
import { types } from "../2_tl.js";
import { constructChatAdministratorRights } from "./0_chat_administrator_rights.js";
import { constructChatMemberRights } from "./0_chat_member_rights.js";
import { constructUser } from "./1_user.js";
export async function constructChatMember(participant, getEntity) {
const user_ = "user_id" in participant ? await getEntity(new types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof types.PeerUser ? await getEntity(participant.peer) : UNREACHABLE() : unreachable(); // TODO: support other peer types
const user_ = "user_id" in participant ? await getEntity(new types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof types.PeerUser ? await getEntity(participant.peer) : unreachable() : unreachable(); // TODO: support other peer types
if (user_ == null)
unreachable();
const user = constructUser(user_);
Expand Down
3 changes: 1 addition & 2 deletions esm/types/4_inline_query_result.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { unreachable } from "../0_deps.js";
import { UNREACHABLE } from "../1_utilities.js";
import { types } from "../2_tl.js";
import { deserializeFileId } from "./_file_id.js";
import { replyMarkupToTlObject } from "./3_reply_markup.js";
Expand Down Expand Up @@ -183,7 +182,7 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
title,
description,
document: new types.InputDocument({
id: "id" in fileId.location ? fileId.location.id : UNREACHABLE(),
id: "id" in fileId.location ? fileId.location.id : unreachable(),
access_hash: fileId.location.accessHash,
file_reference: fileId.fileReference ?? new Uint8Array(),
}),
Expand Down
6 changes: 3 additions & 3 deletions esm/types/4_message.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { unreachable } from "../0_deps.js";
import { cleanObject, fromUnixTimestamp, getLogger, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
import { cleanObject, fromUnixTimestamp, getLogger, ZERO_CHANNEL_ID } from "../1_utilities.js";
import { as, types } from "../2_tl.js";
import { FileType, toUniqueFileId } from "./_file_id.js";
import { serializeFileId } from "./_file_id.js";
Expand Down Expand Up @@ -122,7 +122,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
Object.assign(message, await getSender(message_, getEntity));
if (message_.action instanceof types.MessageActionChatAddUser || message_.action instanceof types.MessageActionChatJoinedByLink || message_.action instanceof types.MessageActionChatJoinedByRequest) {
const newChatMembers = new Array();
const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : UNREACHABLE()];
const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : unreachable()];
for (const user_ of users) {
const entity = await getEntity(new types.PeerUser({ user_id: user_ }));
if (entity) {
Expand Down Expand Up @@ -487,7 +487,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
m = { ...messageText, linkPreview };
}
else {
m = { ...message, linkPreview: { ...linkPreview, url: linkPreview.url ? linkPreview.url : UNREACHABLE() } };
m = { ...message, linkPreview: { ...linkPreview, url: linkPreview.url ? linkPreview.url : unreachable() } };
}
}
else if (message_.media instanceof types.MessageMediaGiveaway) {
Expand Down
1 change: 0 additions & 1 deletion esm/utilities/0_control.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions esm/utilities/0_control.js

This file was deleted.

1 change: 0 additions & 1 deletion script/1_utilities.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from "./utilities/0_bigint.js";
export * from "./utilities/0_buffer.js";
export * from "./utilities/0_cache_map.js";
export * from "./utilities/0_color.js";
export * from "./utilities/0_control.js";
export * from "./utilities/0_crypto.js";
export * from "./utilities/0_hash.js";
export * from "./utilities/0_logger.js";
Expand Down
1 change: 0 additions & 1 deletion script/1_utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ __exportStar(require("./utilities/0_bigint.js"), exports);
__exportStar(require("./utilities/0_buffer.js"), exports);
__exportStar(require("./utilities/0_cache_map.js"), exports);
__exportStar(require("./utilities/0_color.js"), exports);
__exportStar(require("./utilities/0_control.js"), exports);
__exportStar(require("./utilities/0_crypto.js"), exports);
__exportStar(require("./utilities/0_hash.js"), exports);
__exportStar(require("./utilities/0_logger.js"), exports);
Expand Down
3 changes: 2 additions & 1 deletion script/connection/1_connection_web_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionW
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectionWebSocket = void 0;
const dntShim = __importStar(require("../_dnt.shims.js"));
const _0_deps_js_1 = require("../0_deps.js");
const _1_utilities_js_1 = require("../1_utilities.js");
const _0_connection_js_1 = require("./0_connection.js");
const L = (0, _1_utilities_js_1.getLogger)("ConnectionWebSocket");
Expand Down Expand Up @@ -142,7 +143,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
return;
}
const unlock = await mutex.lock();
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _1_utilities_js_1.UNREACHABLE)())).arrayBuffer());
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _0_deps_js_1.unreachable)())).arrayBuffer());
__classPrivateFieldSet(this, _ConnectionWebSocket_buffer, (0, _1_utilities_js_1.concat)(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
Expand Down
2 changes: 1 addition & 1 deletion script/storage/0_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class Storage {
(0, _0_deps_js_1.unreachable)();
}
catch (err) {
if (!(err instanceof Error) || !(err.message == "Unreachable")) {
if (!(err instanceof _0_deps_js_1.AssertionError)) {
throw err;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion script/types/2_chat_member.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const _0_chat_administrator_rights_js_1 = require("./0_chat_administrator_rights
const _0_chat_member_rights_js_1 = require("./0_chat_member_rights.js");
const _1_user_js_1 = require("./1_user.js");
async function constructChatMember(participant, getEntity) {
const user_ = "user_id" in participant ? await getEntity(new _2_tl_js_1.types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof _2_tl_js_1.types.PeerUser ? await getEntity(participant.peer) : (0, _1_utilities_js_1.UNREACHABLE)() : (0, _0_deps_js_1.unreachable)(); // TODO: support other peer types
const user_ = "user_id" in participant ? await getEntity(new _2_tl_js_1.types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof _2_tl_js_1.types.PeerUser ? await getEntity(participant.peer) : (0, _0_deps_js_1.unreachable)() : (0, _0_deps_js_1.unreachable)(); // TODO: support other peer types
if (user_ == null)
(0, _0_deps_js_1.unreachable)();
const user = (0, _1_user_js_1.constructUser)(user_);
Expand Down
3 changes: 1 addition & 2 deletions script/types/4_inline_query_result.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.inlineQueryResultToTlObject = void 0;
const _0_deps_js_1 = require("../0_deps.js");
const _1_utilities_js_1 = require("../1_utilities.js");
const _2_tl_js_1 = require("../2_tl.js");
const _file_id_js_1 = require("./_file_id.js");
const _3_reply_markup_js_1 = require("./3_reply_markup.js");
Expand Down Expand Up @@ -186,7 +185,7 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
title,
description,
document: new _2_tl_js_1.types.InputDocument({
id: "id" in fileId.location ? fileId.location.id : (0, _1_utilities_js_1.UNREACHABLE)(),
id: "id" in fileId.location ? fileId.location.id : (0, _0_deps_js_1.unreachable)(),
access_hash: fileId.location.accessHash,
file_reference: fileId.fileReference ?? new Uint8Array(),
}),
Expand Down
4 changes: 2 additions & 2 deletions script/types/4_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
Object.assign(message, await getSender(message_, getEntity));
if (message_.action instanceof _2_tl_js_1.types.MessageActionChatAddUser || message_.action instanceof _2_tl_js_1.types.MessageActionChatJoinedByLink || message_.action instanceof _2_tl_js_1.types.MessageActionChatJoinedByRequest) {
const newChatMembers = new Array();
const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : (0, _1_utilities_js_1.UNREACHABLE)()];
const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : (0, _0_deps_js_1.unreachable)()];
for (const user_ of users) {
const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ user_id: user_ }));
if (entity) {
Expand Down Expand Up @@ -491,7 +491,7 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
m = { ...messageText, linkPreview };
}
else {
m = { ...message, linkPreview: { ...linkPreview, url: linkPreview.url ? linkPreview.url : (0, _1_utilities_js_1.UNREACHABLE)() } };
m = { ...message, linkPreview: { ...linkPreview, url: linkPreview.url ? linkPreview.url : (0, _0_deps_js_1.unreachable)() } };
}
}
else if (message_.media instanceof _2_tl_js_1.types.MessageMediaGiveaway) {
Expand Down
1 change: 0 additions & 1 deletion script/utilities/0_control.d.ts

This file was deleted.

7 changes: 0 additions & 7 deletions script/utilities/0_control.js

This file was deleted.

0 comments on commit 938f7d7

Please sign in to comment.