@mtkruto/node 0.1.200 → 0.1.300
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/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.js +2 -1
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/4_errors.js +3 -3
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_utilities.d.ts +6 -0
- package/esm/client/0_utilities.js +35 -4
- package/esm/client/1_account_manager.js +4 -4
- package/esm/client/1_client_encrypted.js +4 -4
- package/esm/client/1_client_plain.js +3 -3
- package/esm/client/1_file_manager.js +6 -5
- package/esm/client/1_reaction_manager.js +2 -2
- package/esm/client/1_update_manager.js +9 -8
- package/esm/client/2_message_manager.js +47 -24
- package/esm/client/3_callback_query_manager.js +2 -0
- package/esm/client/3_chat_list_manager.js +13 -12
- package/esm/client/3_inline_query_manager.js +4 -2
- package/esm/client/3_story_manager.js +7 -5
- package/esm/client/4_client.d.ts +5 -8
- package/esm/client/4_client.js +19 -27
- package/esm/connection/1_connection_web_socket.js +3 -2
- package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/storage/0_storage.js +6 -5
- package/esm/storage/1_utilities.d.ts +0 -1
- package/esm/storage/1_utilities.js +2 -3
- package/esm/storage/2_storage_local_storage.js +1 -4
- package/esm/storage/2_storage_session_storage.js +1 -4
- package/esm/tl/3_utilities.js +5 -4
- package/esm/transport/2_transport_provider.js +4 -4
- package/esm/types/0_message_entity.js +3 -3
- package/esm/types/0_message_search_filter.js +2 -2
- package/esm/types/0_reaction.js +2 -2
- package/esm/types/1_bot_command_scope.js +3 -3
- package/esm/types/1_chat_p.js +3 -2
- package/esm/types/1_keyboard_button.js +3 -3
- package/esm/types/1_message_reaction.js +2 -2
- package/esm/types/1_story_privacy.js +3 -3
- package/esm/types/2_chat_member.js +6 -5
- package/esm/types/2_chosen_inline_result.js +3 -2
- package/esm/types/2_inactive_chat.js +3 -2
- package/esm/types/2_inline_keyboard_button.js +3 -3
- package/esm/types/2_inline_query.js +3 -3
- package/esm/types/2_invite_link.js +3 -2
- package/esm/types/2_story_content.js +5 -5
- package/esm/types/2_story_interactive_area.js +5 -5
- package/esm/types/3_chat_member_updated.js +4 -3
- package/esm/types/3_reply_markup.js +4 -3
- package/esm/types/3_story.js +3 -2
- package/esm/types/4_inline_query_result.js +5 -5
- package/esm/types/4_message.js +17 -16
- package/esm/types/5_callback_query.js +4 -3
- package/esm/types/5_chat.js +8 -7
- package/esm/types/_file_id.js +9 -8
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +25 -0
- package/esm/utilities/0_logger.d.ts +8 -0
- package/esm/utilities/0_logger.js +9 -5
- package/esm/utilities/1_math.d.ts +1 -0
- package/esm/utilities/1_math.js +51 -0
- package/esm/utilities/1_misc.js +2 -2
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +3 -3
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/4_errors.js +3 -3
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_utilities.d.ts +6 -0
- package/script/client/0_utilities.js +41 -4
- package/script/client/1_account_manager.js +4 -4
- package/script/client/1_client_encrypted.js +2 -2
- package/script/client/1_client_plain.js +2 -2
- package/script/client/1_file_manager.js +5 -4
- package/script/client/1_reaction_manager.js +2 -2
- package/script/client/1_update_manager.js +8 -7
- package/script/client/2_message_manager.js +51 -28
- package/script/client/3_callback_query_manager.js +2 -0
- package/script/client/3_chat_list_manager.js +12 -11
- package/script/client/3_inline_query_manager.js +4 -2
- package/script/client/3_story_manager.js +4 -2
- package/script/client/4_client.d.ts +5 -8
- package/script/client/4_client.js +18 -26
- package/script/connection/1_connection_web_socket.js +2 -1
- package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/mod.d.ts +1 -1
- package/script/mod.js +2 -1
- package/script/storage/0_storage.js +5 -4
- package/script/storage/1_utilities.d.ts +0 -1
- package/script/storage/1_utilities.js +3 -4
- package/script/storage/2_storage_local_storage.js +0 -3
- package/script/storage/2_storage_session_storage.js +0 -3
- package/script/tl/3_utilities.js +4 -3
- package/script/transport/2_transport_provider.js +4 -4
- package/script/types/0_message_entity.js +3 -3
- package/script/types/0_message_search_filter.js +2 -2
- package/script/types/0_reaction.js +2 -2
- package/script/types/1_bot_command_scope.js +3 -3
- package/script/types/1_chat_p.js +2 -1
- package/script/types/1_keyboard_button.js +3 -3
- package/script/types/1_message_reaction.js +2 -2
- package/script/types/1_story_privacy.js +3 -3
- package/script/types/2_chat_member.js +5 -4
- package/script/types/2_chosen_inline_result.js +2 -1
- package/script/types/2_inactive_chat.js +2 -1
- package/script/types/2_inline_keyboard_button.js +3 -3
- package/script/types/2_inline_query.js +3 -3
- package/script/types/2_invite_link.js +2 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactive_area.js +5 -5
- package/script/types/3_chat_member_updated.js +3 -2
- package/script/types/3_reply_markup.js +3 -2
- package/script/types/3_story.js +2 -1
- package/script/types/4_inline_query_result.js +5 -5
- package/script/types/4_message.js +16 -15
- package/script/types/5_callback_query.js +3 -2
- package/script/types/5_chat.js +7 -6
- package/script/types/_file_id.js +8 -7
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +27 -1
- package/script/utilities/0_logger.d.ts +8 -0
- package/script/utilities/0_logger.js +11 -6
- package/script/utilities/1_math.d.ts +1 -0
- package/script/utilities/1_math.js +55 -0
- package/script/utilities/1_misc.js +2 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import DomHandler, { DomHandlerOptions } from './DomHandler.js';
|
|
2
|
-
import { ParserOptions } from './Parser.js';
|
|
3
|
-
declare enum FeedItemMediaMedium {
|
|
4
|
-
image = 0,
|
|
5
|
-
audio = 1,
|
|
6
|
-
video = 2,
|
|
7
|
-
document = 3,
|
|
8
|
-
executable = 4
|
|
9
|
-
}
|
|
10
|
-
declare enum FeedItemMediaExpression {
|
|
11
|
-
sample = 0,
|
|
12
|
-
full = 1,
|
|
13
|
-
nonstop = 2
|
|
14
|
-
}
|
|
15
|
-
interface FeedItemMedia {
|
|
16
|
-
url?: string;
|
|
17
|
-
fileSize?: number;
|
|
18
|
-
type?: string;
|
|
19
|
-
medium: FeedItemMediaMedium | undefined;
|
|
20
|
-
isDefault: boolean;
|
|
21
|
-
expression?: FeedItemMediaExpression;
|
|
22
|
-
bitrate?: number;
|
|
23
|
-
framerate?: number;
|
|
24
|
-
samplingrate?: number;
|
|
25
|
-
channels?: number;
|
|
26
|
-
duration?: number;
|
|
27
|
-
height?: number;
|
|
28
|
-
width?: number;
|
|
29
|
-
lang?: string;
|
|
30
|
-
}
|
|
31
|
-
interface FeedItem {
|
|
32
|
-
id?: string;
|
|
33
|
-
title?: string;
|
|
34
|
-
link?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
pubDate?: Date;
|
|
37
|
-
media?: FeedItemMedia[];
|
|
38
|
-
}
|
|
39
|
-
interface Feed {
|
|
40
|
-
type?: string;
|
|
41
|
-
id?: string;
|
|
42
|
-
title?: string;
|
|
43
|
-
link?: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
updated?: Date;
|
|
46
|
-
author?: string;
|
|
47
|
-
items?: FeedItem[];
|
|
48
|
-
}
|
|
49
|
-
export declare class FeedHandler extends DomHandler {
|
|
50
|
-
feed?: Feed;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param callback
|
|
54
|
-
* @param options
|
|
55
|
-
*/
|
|
56
|
-
constructor(callback?: ((error: Error | null) => void) | DomHandlerOptions, options?: DomHandlerOptions);
|
|
57
|
-
onend(): void;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Parse a feed.
|
|
61
|
-
*
|
|
62
|
-
* @param feed The feed that should be parsed, as a string.
|
|
63
|
-
* @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`.
|
|
64
|
-
*/
|
|
65
|
-
export declare function parseFeed(feed: string, options?: ParserOptions & DomHandlerOptions): Feed | undefined;
|
|
66
|
-
export {};
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.parseFeed = exports.FeedHandler = void 0;
|
|
30
|
-
const DomHandler_js_1 = __importDefault(require("./DomHandler.js"));
|
|
31
|
-
const DomUtils = __importStar(require("./utils/mod.js"));
|
|
32
|
-
const Parser_js_1 = require("./Parser.js");
|
|
33
|
-
var FeedItemMediaMedium;
|
|
34
|
-
(function (FeedItemMediaMedium) {
|
|
35
|
-
FeedItemMediaMedium[FeedItemMediaMedium["image"] = 0] = "image";
|
|
36
|
-
FeedItemMediaMedium[FeedItemMediaMedium["audio"] = 1] = "audio";
|
|
37
|
-
FeedItemMediaMedium[FeedItemMediaMedium["video"] = 2] = "video";
|
|
38
|
-
FeedItemMediaMedium[FeedItemMediaMedium["document"] = 3] = "document";
|
|
39
|
-
FeedItemMediaMedium[FeedItemMediaMedium["executable"] = 4] = "executable";
|
|
40
|
-
})(FeedItemMediaMedium || (FeedItemMediaMedium = {}));
|
|
41
|
-
var FeedItemMediaExpression;
|
|
42
|
-
(function (FeedItemMediaExpression) {
|
|
43
|
-
FeedItemMediaExpression[FeedItemMediaExpression["sample"] = 0] = "sample";
|
|
44
|
-
FeedItemMediaExpression[FeedItemMediaExpression["full"] = 1] = "full";
|
|
45
|
-
FeedItemMediaExpression[FeedItemMediaExpression["nonstop"] = 2] = "nonstop";
|
|
46
|
-
})(FeedItemMediaExpression || (FeedItemMediaExpression = {}));
|
|
47
|
-
// TODO: Consume data as it is coming in
|
|
48
|
-
class FeedHandler extends DomHandler_js_1.default {
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @param callback
|
|
52
|
-
* @param options
|
|
53
|
-
*/
|
|
54
|
-
constructor(callback, options) {
|
|
55
|
-
if (typeof callback === 'object') {
|
|
56
|
-
callback = undefined;
|
|
57
|
-
options = callback;
|
|
58
|
-
}
|
|
59
|
-
super(callback, options);
|
|
60
|
-
Object.defineProperty(this, "feed", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
configurable: true,
|
|
63
|
-
writable: true,
|
|
64
|
-
value: void 0
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
onend() {
|
|
68
|
-
const feedRoot = getOneElement(isValidFeed, this.dom);
|
|
69
|
-
if (!feedRoot) {
|
|
70
|
-
this.handleCallback(new Error("couldn't find root of feed"));
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const feed = {};
|
|
74
|
-
if (feedRoot.name === 'feed') {
|
|
75
|
-
const childs = feedRoot.children;
|
|
76
|
-
feed.type = 'atom';
|
|
77
|
-
addConditionally(feed, 'id', 'id', childs);
|
|
78
|
-
addConditionally(feed, 'title', 'title', childs);
|
|
79
|
-
const href = getAttribute('href', getOneElement('link', childs));
|
|
80
|
-
if (href) {
|
|
81
|
-
feed.link = href;
|
|
82
|
-
}
|
|
83
|
-
addConditionally(feed, 'description', 'subtitle', childs);
|
|
84
|
-
const updated = fetch('updated', childs);
|
|
85
|
-
if (updated) {
|
|
86
|
-
feed.updated = new Date(updated);
|
|
87
|
-
}
|
|
88
|
-
addConditionally(feed, 'author', 'email', childs, true);
|
|
89
|
-
feed.items = getElements('entry', childs).map(item => {
|
|
90
|
-
const entry = {};
|
|
91
|
-
const { children } = item;
|
|
92
|
-
addConditionally(entry, 'id', 'id', children);
|
|
93
|
-
addConditionally(entry, 'title', 'title', children);
|
|
94
|
-
const href = getAttribute('href', getOneElement('link', children));
|
|
95
|
-
if (href) {
|
|
96
|
-
entry.link = href;
|
|
97
|
-
}
|
|
98
|
-
const description = fetch('summary', children) || fetch('content', children);
|
|
99
|
-
if (description) {
|
|
100
|
-
entry.description = description;
|
|
101
|
-
}
|
|
102
|
-
const pubDate = fetch('updated', children);
|
|
103
|
-
if (pubDate) {
|
|
104
|
-
entry.pubDate = new Date(pubDate);
|
|
105
|
-
}
|
|
106
|
-
entry.media = getMediaElements(children);
|
|
107
|
-
return entry;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
const childs = getOneElement('channel', feedRoot.children)?.children ?? [];
|
|
112
|
-
feed.type = feedRoot.name.substr(0, 3);
|
|
113
|
-
feed.id = '';
|
|
114
|
-
addConditionally(feed, 'title', 'title', childs);
|
|
115
|
-
addConditionally(feed, 'link', 'link', childs);
|
|
116
|
-
addConditionally(feed, 'description', 'description', childs);
|
|
117
|
-
const updated = fetch('lastBuildDate', childs);
|
|
118
|
-
if (updated) {
|
|
119
|
-
feed.updated = new Date(updated);
|
|
120
|
-
}
|
|
121
|
-
addConditionally(feed, 'author', 'managingEditor', childs, true);
|
|
122
|
-
feed.items = getElements('item', feedRoot.children).map((item) => {
|
|
123
|
-
const entry = {};
|
|
124
|
-
const { children } = item;
|
|
125
|
-
addConditionally(entry, 'id', 'guid', children);
|
|
126
|
-
addConditionally(entry, 'title', 'title', children);
|
|
127
|
-
addConditionally(entry, 'link', 'link', children);
|
|
128
|
-
addConditionally(entry, 'description', 'description', children);
|
|
129
|
-
const pubDate = fetch('pubDate', children);
|
|
130
|
-
if (pubDate)
|
|
131
|
-
entry.pubDate = new Date(pubDate);
|
|
132
|
-
entry.media = getMediaElements(children);
|
|
133
|
-
return entry;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
this.feed = feed;
|
|
137
|
-
this.handleCallback(null);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.FeedHandler = FeedHandler;
|
|
141
|
-
function getMediaElements(where) {
|
|
142
|
-
return getElements('media:content', where).map(elem => {
|
|
143
|
-
const media = {
|
|
144
|
-
medium: elem.attribs.medium,
|
|
145
|
-
isDefault: !!elem.attribs.isDefault,
|
|
146
|
-
};
|
|
147
|
-
if (elem.attribs.url) {
|
|
148
|
-
media.url = elem.attribs.url;
|
|
149
|
-
}
|
|
150
|
-
if (elem.attribs.fileSize) {
|
|
151
|
-
media.fileSize = parseInt(elem.attribs.fileSize, 10);
|
|
152
|
-
}
|
|
153
|
-
if (elem.attribs.type) {
|
|
154
|
-
media.type = elem.attribs.type;
|
|
155
|
-
}
|
|
156
|
-
if (elem.attribs.expression) {
|
|
157
|
-
media.expression = elem.attribs
|
|
158
|
-
.expression;
|
|
159
|
-
}
|
|
160
|
-
if (elem.attribs.bitrate) {
|
|
161
|
-
media.bitrate = parseInt(elem.attribs.bitrate, 10);
|
|
162
|
-
}
|
|
163
|
-
if (elem.attribs.framerate) {
|
|
164
|
-
media.framerate = parseInt(elem.attribs.framerate, 10);
|
|
165
|
-
}
|
|
166
|
-
if (elem.attribs.samplingrate) {
|
|
167
|
-
media.samplingrate = parseInt(elem.attribs.samplingrate, 10);
|
|
168
|
-
}
|
|
169
|
-
if (elem.attribs.channels) {
|
|
170
|
-
media.channels = parseInt(elem.attribs.channels, 10);
|
|
171
|
-
}
|
|
172
|
-
if (elem.attribs.duration) {
|
|
173
|
-
media.duration = parseInt(elem.attribs.duration, 10);
|
|
174
|
-
}
|
|
175
|
-
if (elem.attribs.height) {
|
|
176
|
-
media.height = parseInt(elem.attribs.height, 10);
|
|
177
|
-
}
|
|
178
|
-
if (elem.attribs.width) {
|
|
179
|
-
media.width = parseInt(elem.attribs.width, 10);
|
|
180
|
-
}
|
|
181
|
-
if (elem.attribs.lang) {
|
|
182
|
-
media.lang = elem.attribs.lang;
|
|
183
|
-
}
|
|
184
|
-
return media;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function getElements(tagName, where) {
|
|
188
|
-
return DomUtils.getElementsByTagName(tagName, where, true);
|
|
189
|
-
}
|
|
190
|
-
function getOneElement(tagName, node) {
|
|
191
|
-
return DomUtils.getElementsByTagName(tagName, node, true, 1)[0];
|
|
192
|
-
}
|
|
193
|
-
function fetch(tagName, where, recurse = false) {
|
|
194
|
-
return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim();
|
|
195
|
-
}
|
|
196
|
-
function getAttribute(name, elem) {
|
|
197
|
-
if (!elem) {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
const { attribs } = elem;
|
|
201
|
-
return attribs[name];
|
|
202
|
-
}
|
|
203
|
-
function addConditionally(obj, prop, what, where, recurse = false) {
|
|
204
|
-
const tmp = fetch(what, where, recurse);
|
|
205
|
-
if (tmp)
|
|
206
|
-
obj[prop] = tmp;
|
|
207
|
-
}
|
|
208
|
-
function isValidFeed(value) {
|
|
209
|
-
return value === 'rss' || value === 'feed' || value === 'rdf:RDF';
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Parse a feed.
|
|
213
|
-
*
|
|
214
|
-
* @param feed The feed that should be parsed, as a string.
|
|
215
|
-
* @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`.
|
|
216
|
-
*/
|
|
217
|
-
function parseFeed(feed, options = { xmlMode: true }) {
|
|
218
|
-
const handler = new FeedHandler(options);
|
|
219
|
-
new Parser_js_1.Parser(handler, options).end(feed);
|
|
220
|
-
return handler.feed;
|
|
221
|
-
}
|
|
222
|
-
exports.parseFeed = parseFeed;
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { ElementType } from './ElementType.js';
|
|
2
|
-
/**
|
|
3
|
-
* This object will be used as the prototype for Nodes when creating a
|
|
4
|
-
* DOM-Level-1-compliant structure.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Node {
|
|
7
|
-
type: ElementType;
|
|
8
|
-
/** Parent of the node */
|
|
9
|
-
parent: NodeWithChildren | null;
|
|
10
|
-
/** Previous sibling */
|
|
11
|
-
prev: Node | null;
|
|
12
|
-
/** Next sibling */
|
|
13
|
-
next: Node | null;
|
|
14
|
-
/** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
|
|
15
|
-
startIndex: number | null;
|
|
16
|
-
/** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
|
|
17
|
-
endIndex: number | null;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param type The type of the node.
|
|
21
|
-
*/
|
|
22
|
-
constructor(type: ElementType);
|
|
23
|
-
get nodeType(): number;
|
|
24
|
-
get parentNode(): NodeWithChildren | null;
|
|
25
|
-
set parentNode(parent: NodeWithChildren | null);
|
|
26
|
-
get previousSibling(): Node | null;
|
|
27
|
-
set previousSibling(prev: Node | null);
|
|
28
|
-
get nextSibling(): Node | null;
|
|
29
|
-
set nextSibling(next: Node | null);
|
|
30
|
-
/**
|
|
31
|
-
* Clone this node, and optionally its children.
|
|
32
|
-
*
|
|
33
|
-
* @param recursive Clone child nodes as well.
|
|
34
|
-
* @returns A clone of the node.
|
|
35
|
-
*/
|
|
36
|
-
cloneNode<T extends Node>(this: T, recursive?: boolean): T;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A node that contains some data.
|
|
40
|
-
*/
|
|
41
|
-
export declare class DataNode extends Node {
|
|
42
|
-
data: string;
|
|
43
|
-
/**
|
|
44
|
-
* @param type The type of the node
|
|
45
|
-
* @param data The content of the data node
|
|
46
|
-
*/
|
|
47
|
-
constructor(type: ElementType.Comment | ElementType.Text | ElementType.Directive, data: string);
|
|
48
|
-
get nodeValue(): string;
|
|
49
|
-
set nodeValue(data: string);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Text within the document.
|
|
53
|
-
*/
|
|
54
|
-
export declare class Text extends DataNode {
|
|
55
|
-
constructor(data: string);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Comments within the document.
|
|
59
|
-
*/
|
|
60
|
-
export declare class Comment extends DataNode {
|
|
61
|
-
constructor(data: string);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Processing instructions, including doc types.
|
|
65
|
-
*/
|
|
66
|
-
export declare class ProcessingInstruction extends DataNode {
|
|
67
|
-
name: string;
|
|
68
|
-
constructor(name: string, data: string);
|
|
69
|
-
'x-name'?: string;
|
|
70
|
-
'x-publicId'?: string;
|
|
71
|
-
'x-systemId'?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* A `Node` that can have children.
|
|
75
|
-
*/
|
|
76
|
-
export declare class NodeWithChildren extends Node {
|
|
77
|
-
children: Node[];
|
|
78
|
-
/**
|
|
79
|
-
* @param type Type of the node.
|
|
80
|
-
* @param children Children of the node. Only certain node types can have children.
|
|
81
|
-
*/
|
|
82
|
-
constructor(type: ElementType.Root | ElementType.CDATA | ElementType.Script | ElementType.Style | ElementType.Tag, children: Node[]);
|
|
83
|
-
get firstChild(): Node | null;
|
|
84
|
-
get lastChild(): Node | null;
|
|
85
|
-
get childNodes(): Node[];
|
|
86
|
-
set childNodes(children: Node[]);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* The root node of the document.
|
|
90
|
-
*/
|
|
91
|
-
export declare class Document extends NodeWithChildren {
|
|
92
|
-
constructor(children: Node[]);
|
|
93
|
-
'x-mode'?: 'no-quirks' | 'quirks' | 'limited-quirks';
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* The description of an individual attribute.
|
|
97
|
-
*/
|
|
98
|
-
interface Attribute {
|
|
99
|
-
name: string;
|
|
100
|
-
value: string;
|
|
101
|
-
namespace?: string;
|
|
102
|
-
prefix?: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* An element within the DOM.
|
|
106
|
-
*/
|
|
107
|
-
export declare class Element extends NodeWithChildren {
|
|
108
|
-
name: string;
|
|
109
|
-
attribs: {
|
|
110
|
-
[name: string]: string;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* @param name Name of the tag, eg. `div`, `span`.
|
|
114
|
-
* @param attribs Object mapping attribute names to attribute values.
|
|
115
|
-
* @param children Children of the node.
|
|
116
|
-
*/
|
|
117
|
-
constructor(name: string, attribs: {
|
|
118
|
-
[name: string]: string;
|
|
119
|
-
}, children?: Node[], type?: ElementType.Tag | ElementType.Script | ElementType.Style);
|
|
120
|
-
get tagName(): string;
|
|
121
|
-
set tagName(name: string);
|
|
122
|
-
get attributes(): Attribute[];
|
|
123
|
-
'x-attribsNamespace'?: Record<string, string>;
|
|
124
|
-
'x-attribsPrefix'?: Record<string, string>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @param node Node to check.
|
|
128
|
-
* @returns `true` if the node is a `Element`, `false` otherwise.
|
|
129
|
-
*/
|
|
130
|
-
export declare function isTag(node: Node): node is Element;
|
|
131
|
-
/**
|
|
132
|
-
* @param node Node to check.
|
|
133
|
-
* @returns `true` if the node has the type `CDATA`, `false` otherwise.
|
|
134
|
-
*/
|
|
135
|
-
export declare function isCDATA(node: Node): node is NodeWithChildren;
|
|
136
|
-
/**
|
|
137
|
-
* @param node Node to check.
|
|
138
|
-
* @returns `true` if the node has the type `Text`, `false` otherwise.
|
|
139
|
-
*/
|
|
140
|
-
export declare function isText(node: Node): node is Text;
|
|
141
|
-
/**
|
|
142
|
-
* @param node Node to check.
|
|
143
|
-
* @returns `true` if the node has the type `Comment`, `false` otherwise.
|
|
144
|
-
*/
|
|
145
|
-
export declare function isComment(node: Node): node is DataNode;
|
|
146
|
-
/**
|
|
147
|
-
* @param node Node to check.
|
|
148
|
-
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
|
149
|
-
*/
|
|
150
|
-
export declare function isDirective(node: Node): node is ProcessingInstruction;
|
|
151
|
-
/**
|
|
152
|
-
* @param node Node to check.
|
|
153
|
-
* @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
|
|
154
|
-
*/
|
|
155
|
-
export declare function isDocument(node: Node): node is Document;
|
|
156
|
-
/**
|
|
157
|
-
* @param node Node to check.
|
|
158
|
-
* @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.
|
|
159
|
-
*/
|
|
160
|
-
export declare function hasChildren(node: Node): node is NodeWithChildren;
|
|
161
|
-
/**
|
|
162
|
-
* Clone a node, and optionally its children.
|
|
163
|
-
*
|
|
164
|
-
* @param recursive Clone child nodes as well.
|
|
165
|
-
* @returns A clone of the node.
|
|
166
|
-
*/
|
|
167
|
-
export declare function cloneNode<T extends Node>(node: T, recursive?: boolean): T;
|
|
168
|
-
export {};
|