@mastra/telegram 0.2.3-alpha.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +71 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
10
10
|
var __exportAll = (all, no_symbols) => {
|
|
11
11
|
let target = {};
|
|
12
12
|
for (var name in all) __defProp(target, name, {
|
|
@@ -26,7 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
}
|
|
27
27
|
return to;
|
|
28
28
|
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
30
|
value: mod,
|
|
31
31
|
enumerable: true
|
|
32
32
|
}) : target, mod));
|
|
@@ -38,7 +38,9 @@ let _mastra_core_storage = require("@mastra/core/storage");
|
|
|
38
38
|
let async_hooks = require("async_hooks");
|
|
39
39
|
let net = require("net");
|
|
40
40
|
let process$1 = require("process");
|
|
41
|
+
process$1 = __toESM(process$1, 1);
|
|
41
42
|
let path = require("path");
|
|
43
|
+
path = __toESM(path, 1);
|
|
42
44
|
let url = require("url");
|
|
43
45
|
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/mdast-util-to-string/4.0.0/3001db021a790b37432b62272503499c0eaa2fb2c605e9dc3d1a5e4620151f66/node_modules/mdast-util-to-string/lib/index.js
|
|
44
46
|
/**
|
|
@@ -1803,14 +1805,15 @@ function markdownTable(table, options) {
|
|
|
1803
1805
|
const size = longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0);
|
|
1804
1806
|
const code = alignments[columnIndex];
|
|
1805
1807
|
if (code === 114) before = " ".repeat(size);
|
|
1806
|
-
else if (code === 99)
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1808
|
+
else if (code === 99) {
|
|
1809
|
+
if (size % 2) {
|
|
1810
|
+
before = " ".repeat(size / 2 + .5);
|
|
1811
|
+
after = " ".repeat(size / 2 - .5);
|
|
1812
|
+
} else {
|
|
1813
|
+
before = " ".repeat(size / 2);
|
|
1814
|
+
after = before;
|
|
1815
|
+
}
|
|
1816
|
+
} else after = " ".repeat(size);
|
|
1814
1817
|
}
|
|
1815
1818
|
if (settings.delimiterStart !== false && !columnIndex) line.push("|");
|
|
1816
1819
|
if (settings.padding !== false && !(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) line.push(" ");
|
|
@@ -10106,7 +10109,9 @@ function factoryLabel(effects, ok, nok, type, markerType, stringType) {
|
|
|
10106
10109
|
* @type {State}
|
|
10107
10110
|
*/
|
|
10108
10111
|
function atBreak(code) {
|
|
10109
|
-
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
|
|
10112
|
+
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
|
|
10113
|
+
/* c8 ignore next 3 */
|
|
10114
|
+
code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs) return nok(code);
|
|
10110
10115
|
if (code === 93) {
|
|
10111
10116
|
effects.exit(stringType);
|
|
10112
10117
|
effects.enter(markerType);
|
|
@@ -14584,19 +14589,21 @@ function resolveTable(events, context) {
|
|
|
14584
14589
|
}
|
|
14585
14590
|
cell[2] = index;
|
|
14586
14591
|
}
|
|
14587
|
-
} else if (token.type === "tableCellDivider")
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
+
} else if (token.type === "tableCellDivider") {
|
|
14593
|
+
if (inFirstCellAwaitingPipe) inFirstCellAwaitingPipe = false;
|
|
14594
|
+
else {
|
|
14595
|
+
if (lastCell[1] !== 0) {
|
|
14596
|
+
cell[0] = cell[1];
|
|
14597
|
+
currentCell = flushCell(map, context, lastCell, rowKind, void 0, currentCell);
|
|
14598
|
+
}
|
|
14599
|
+
lastCell = cell;
|
|
14600
|
+
cell = [
|
|
14601
|
+
lastCell[1],
|
|
14602
|
+
index,
|
|
14603
|
+
0,
|
|
14604
|
+
0
|
|
14605
|
+
];
|
|
14592
14606
|
}
|
|
14593
|
-
lastCell = cell;
|
|
14594
|
-
cell = [
|
|
14595
|
-
lastCell[1],
|
|
14596
|
-
index,
|
|
14597
|
-
0,
|
|
14598
|
-
0
|
|
14599
|
-
];
|
|
14600
14607
|
}
|
|
14601
14608
|
} else if (token.type === "tableHead") {
|
|
14602
14609
|
afterHeadAwaitingFirstBodyRow = true;
|
|
@@ -16406,8 +16413,10 @@ function compiler(options) {
|
|
|
16406
16413
|
/** @type {Array<number>} */
|
|
16407
16414
|
const listStack = [];
|
|
16408
16415
|
let index = -1;
|
|
16409
|
-
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered")
|
|
16410
|
-
|
|
16416
|
+
while (++index < events.length) if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") {
|
|
16417
|
+
if (events[index][0] === "enter") listStack.push(index);
|
|
16418
|
+
else index = prepareList(events, listStack.pop(), index);
|
|
16419
|
+
}
|
|
16411
16420
|
index = -1;
|
|
16412
16421
|
while (++index < events.length) {
|
|
16413
16422
|
const handler = config[events[index][0]];
|
|
@@ -16597,8 +16606,10 @@ function compiler(options) {
|
|
|
16597
16606
|
start: token.start,
|
|
16598
16607
|
end: token.end
|
|
16599
16608
|
}) + "): it’s not open");
|
|
16600
|
-
else if (open[0].type !== token.type)
|
|
16601
|
-
|
|
16609
|
+
else if (open[0].type !== token.type) {
|
|
16610
|
+
if (onExitError) onExitError.call(this, token, open[0]);
|
|
16611
|
+
else (open[1] || defaultOnError).call(this, token, open[0]);
|
|
16612
|
+
}
|
|
16602
16613
|
node.position.end = point(token.end);
|
|
16603
16614
|
}
|
|
16604
16615
|
/**
|
|
@@ -17449,9 +17460,11 @@ function wrap(middleware, callback) {
|
|
|
17449
17460
|
if (fnExpectsCallback && called) throw exception;
|
|
17450
17461
|
return done(exception);
|
|
17451
17462
|
}
|
|
17452
|
-
if (!fnExpectsCallback)
|
|
17453
|
-
|
|
17454
|
-
|
|
17463
|
+
if (!fnExpectsCallback) {
|
|
17464
|
+
if (result && result.then && typeof result.then === "function") result.then(then, done);
|
|
17465
|
+
else if (result instanceof Error) done(result);
|
|
17466
|
+
else then(result);
|
|
17467
|
+
}
|
|
17455
17468
|
}
|
|
17456
17469
|
/**
|
|
17457
17470
|
* Call `callback`, only once.
|
|
@@ -17563,13 +17576,15 @@ var VFileMessage = class extends Error {
|
|
|
17563
17576
|
/** @type {Options} */
|
|
17564
17577
|
let options = {};
|
|
17565
17578
|
let legacyCause = false;
|
|
17566
|
-
if (optionsOrParentOrPlace)
|
|
17567
|
-
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17579
|
+
if (optionsOrParentOrPlace) {
|
|
17580
|
+
if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) options = { place: optionsOrParentOrPlace };
|
|
17581
|
+
else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) options = { place: optionsOrParentOrPlace };
|
|
17582
|
+
else if ("type" in optionsOrParentOrPlace) options = {
|
|
17583
|
+
ancestors: [optionsOrParentOrPlace],
|
|
17584
|
+
place: optionsOrParentOrPlace.position
|
|
17585
|
+
};
|
|
17586
|
+
else options = { ...optionsOrParentOrPlace };
|
|
17587
|
+
}
|
|
17573
17588
|
if (typeof causeOrReason === "string") reason = causeOrReason;
|
|
17574
17589
|
else if (!options.cause && causeOrReason) {
|
|
17575
17590
|
legacyCause = true;
|
|
@@ -19212,9 +19227,10 @@ const unified = new class Processor extends CallableInstance {
|
|
|
19212
19227
|
const namespace = this.namespace;
|
|
19213
19228
|
assertUnfrozen("use", this.frozen);
|
|
19214
19229
|
if (value === null || value === void 0) {} else if (typeof value === "function") addPlugin(value, parameters);
|
|
19215
|
-
else if (typeof value === "object")
|
|
19216
|
-
|
|
19217
|
-
|
|
19230
|
+
else if (typeof value === "object") {
|
|
19231
|
+
if (Array.isArray(value)) addList(value);
|
|
19232
|
+
else addPreset(value);
|
|
19233
|
+
} else throw new TypeError("Expected usable value, not `" + value + "`");
|
|
19218
19234
|
return this;
|
|
19219
19235
|
/**
|
|
19220
19236
|
* @param {Pluggable} value
|
|
@@ -19222,11 +19238,12 @@ const unified = new class Processor extends CallableInstance {
|
|
|
19222
19238
|
*/
|
|
19223
19239
|
function add(value) {
|
|
19224
19240
|
if (typeof value === "function") addPlugin(value, []);
|
|
19225
|
-
else if (typeof value === "object")
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19241
|
+
else if (typeof value === "object") {
|
|
19242
|
+
if (Array.isArray(value)) {
|
|
19243
|
+
const [plugin, ...parameters] = value;
|
|
19244
|
+
addPlugin(plugin, parameters);
|
|
19245
|
+
} else addPreset(value);
|
|
19246
|
+
} else throw new TypeError("Expected usable value, not `" + value + "`");
|
|
19230
19247
|
}
|
|
19231
19248
|
/**
|
|
19232
19249
|
* @param {Preset} result
|
|
@@ -21998,14 +22015,11 @@ function media(blocks, result) {
|
|
|
21998
22015
|
width: value.video.width
|
|
21999
22016
|
});
|
|
22000
22017
|
break;
|
|
22001
|
-
case "voice_note":
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
});
|
|
22007
|
-
break;
|
|
22008
|
-
default: break;
|
|
22018
|
+
case "voice_note": result.push({
|
|
22019
|
+
file: value.voice_note,
|
|
22020
|
+
mimeType: value.voice_note.mime_type,
|
|
22021
|
+
type: "audio"
|
|
22022
|
+
});
|
|
22009
22023
|
}
|
|
22010
22024
|
}
|
|
22011
22025
|
function richMessageToMarkdown(message) {
|
|
@@ -22020,7 +22034,7 @@ function richMessageMedia(message) {
|
|
|
22020
22034
|
return result;
|
|
22021
22035
|
}
|
|
22022
22036
|
var TELEGRAM_API_BASE = "https://api.telegram.org";
|
|
22023
|
-
var TELEGRAM_FILE_LIMIT =
|
|
22037
|
+
var TELEGRAM_FILE_LIMIT = 26214400;
|
|
22024
22038
|
var TELEGRAM_FILE_TIMEOUT_MS = 3e4;
|
|
22025
22039
|
async function readTelegramFile(response, fileId) {
|
|
22026
22040
|
const declared = Number(response.headers.get("content-length"));
|
|
@@ -22099,7 +22113,7 @@ var TELEGRAM_INCOMING_MEDIA_GROUP_BUFFER_TTL_MS = 3e4;
|
|
|
22099
22113
|
var TELEGRAM_INCOMING_MEDIA_GROUP_LOCK_TTL_MS = 5e3;
|
|
22100
22114
|
var TELEGRAM_INCOMING_MEDIA_GROUP_RETRY_MS = 50;
|
|
22101
22115
|
var TELEGRAM_INCOMING_MEDIA_GROUP_SETTLE_MS = 1e3;
|
|
22102
|
-
var TELEGRAM_WEBHOOK_UPDATE_TTL_MS =
|
|
22116
|
+
var TELEGRAM_WEBHOOK_UPDATE_TTL_MS = 864e5;
|
|
22103
22117
|
var TELEGRAM_MEDIA_GROUP_MIN = 2;
|
|
22104
22118
|
var TELEGRAM_MEDIA_GROUP_MAX = 10;
|
|
22105
22119
|
var TELEGRAM_MARKDOWN_PARSE_ERROR_PATTERN = /can't parse (?:caption )?entities/i;
|
|
@@ -22119,7 +22133,7 @@ var TELEGRAM_DEFAULT_ALLOWED_UPDATES = [
|
|
|
22119
22133
|
"edited_channel_post",
|
|
22120
22134
|
"callback_query"
|
|
22121
22135
|
];
|
|
22122
|
-
var TELEGRAM_BUSINESS_CONNECTION_TTL_MS =
|
|
22136
|
+
var TELEGRAM_BUSINESS_CONNECTION_TTL_MS = 36e5;
|
|
22123
22137
|
function normalizeBotTokenProvider(botToken) {
|
|
22124
22138
|
if (typeof botToken === "function") return async () => await botToken();
|
|
22125
22139
|
return () => Promise.resolve(botToken);
|
|
@@ -22156,10 +22170,7 @@ function applyTelegramEntities(text2, entities) {
|
|
|
22156
22170
|
${entityText}
|
|
22157
22171
|
\`\`\``;
|
|
22158
22172
|
break;
|
|
22159
|
-
case "strikethrough":
|
|
22160
|
-
replacement = `~~${entityText}~~`;
|
|
22161
|
-
break;
|
|
22162
|
-
default: break;
|
|
22173
|
+
case "strikethrough": replacement = `~~${entityText}~~`;
|
|
22163
22174
|
}
|
|
22164
22175
|
if (replacement !== void 0) result = result.slice(0, start) + replacement + result.slice(end);
|
|
22165
22176
|
}
|