stitchkit 0.108.5 → 0.109.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/CHANGELOG.md +47 -0
- package/dist/browser/cancellation.d.ts +4 -5
- package/dist/browser/cancellation.d.ts.map +1 -1
- package/dist/browser/client-executors.d.ts.map +1 -1
- package/dist/browser/client.d.ts +1 -1
- package/dist/browser/client.d.ts.map +1 -1
- package/dist/browser/http.d.ts +1 -1
- package/dist/browser/http.d.ts.map +1 -1
- package/dist/browser/session.d.ts +1 -1
- package/dist/browser/session.d.ts.map +1 -1
- package/dist/browser/transport.d.ts +1 -1
- package/dist/browser/transport.d.ts.map +1 -1
- package/dist/entrypoints/cli.js +1 -1
- package/dist/entrypoints/index.js +2 -2
- package/dist/entrypoints/react.js +1 -1
- package/dist/entrypoints/remote.js +2 -2
- package/dist/entrypoints/telegram.d.ts +2 -2
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +868 -137
- package/dist/entrypoints/testing.js +2 -2
- package/dist/entrypoints/tools.js +1 -1
- package/dist/{index-7jvwrjqa.js → index-00v1qz76.js} +20 -17
- package/dist/{index-05s01c94.js → index-5cw390s6.js} +96 -16
- package/dist/{index-p5kx5vqd.js → index-e32vy8jw.js} +22 -11
- package/dist/telegram/update-intake-work.d.ts +39 -0
- package/dist/telegram/update-intake-work.d.ts.map +1 -0
- package/dist/telegram/update-intake.d.ts +47 -9
- package/dist/telegram/update-intake.d.ts.map +1 -1
- package/dist/telegram/update-store-check.d.ts.map +1 -1
- package/dist/telegram/update-store-postgres.d.ts +2 -2
- package/dist/telegram/update-store-postgres.d.ts.map +1 -1
- package/dist/telegram/update-store-sqlite.d.ts +2 -2
- package/dist/telegram/update-store-sqlite.d.ts.map +1 -1
- package/dist/telegram/update-store.d.ts +52 -3
- package/dist/telegram/update-store.d.ts.map +1 -1
- package/dist/tools/cli/args-fields.d.ts +7 -1
- package/dist/tools/cli/args-fields.d.ts.map +1 -1
- package/dist/tools/cli/args.d.ts.map +1 -1
- package/llms/cli.txt +9 -1
- package/llms/stitchkit.txt +10 -3
- package/llms/telegram.txt +59 -8
- package/llms/{upgrading-0.100.0-0.108.0.txt → upgrading-0.101.0-0.109.0.txt} +70 -72
- package/llms/upgrading-0.37.0.txt +176 -0
- package/llms/{upgrading-0.37.0-0.58.0.txt → upgrading-0.44.0-0.60.0.txt} +229 -169
- package/llms/{upgrading-0.59.0-0.71.0.txt → upgrading-0.61.0-0.73.0.txt} +122 -229
- package/llms/{upgrading-0.72.0-0.99.0.txt → upgrading-0.74.0-0.100.0.txt} +72 -122
- package/llms/upgrading.txt +5 -4
- package/llms-full.txt +145 -12
- package/llms.txt +9 -8
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
joinRoutePath
|
|
3
3
|
} from "../index-m38ej7e5.js";
|
|
4
4
|
import"../index-h2fhjqy7.js";
|
|
5
|
-
import"../index-
|
|
5
|
+
import"../index-00v1qz76.js";
|
|
6
6
|
import"../index-q0th8q0z.js";
|
|
7
7
|
import {
|
|
8
8
|
createApplication2
|
|
@@ -35,7 +35,7 @@ import"../index-fynr93w4.js";
|
|
|
35
35
|
import {
|
|
36
36
|
createClient2,
|
|
37
37
|
createClients2
|
|
38
|
-
} from "../index-
|
|
38
|
+
} from "../index-e32vy8jw.js";
|
|
39
39
|
import {
|
|
40
40
|
assertPositiveSafeInteger
|
|
41
41
|
} from "../index-0s4xebbg.js";
|
|
@@ -19,10 +19,10 @@ import ky, {
|
|
|
19
19
|
|
|
20
20
|
// src/browser/cancellation.ts
|
|
21
21
|
class RequestCancellationError extends Error {
|
|
22
|
-
|
|
23
|
-
constructor(cause) {
|
|
24
|
-
super(
|
|
25
|
-
this.
|
|
22
|
+
origin;
|
|
23
|
+
constructor(origin, cause) {
|
|
24
|
+
super(origin === "caller" ? "Request was aborted" : "Request timed out", cause === undefined ? undefined : { cause });
|
|
25
|
+
this.origin = origin;
|
|
26
26
|
this.name = "RequestCancellationError";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -32,12 +32,12 @@ function createRequestCancellation(caller, timeoutMs) {
|
|
|
32
32
|
}
|
|
33
33
|
const timeoutController = timeoutMs === undefined ? undefined : new AbortController;
|
|
34
34
|
const signal = caller && timeoutController ? AbortSignal.any([caller, timeoutController.signal]) : caller ?? timeoutController?.signal;
|
|
35
|
-
let
|
|
35
|
+
let origin;
|
|
36
36
|
let timer;
|
|
37
37
|
const abortFromCaller = () => {
|
|
38
|
-
if (
|
|
38
|
+
if (origin)
|
|
39
39
|
return;
|
|
40
|
-
|
|
40
|
+
origin = "caller";
|
|
41
41
|
};
|
|
42
42
|
if (caller?.aborted)
|
|
43
43
|
abortFromCaller();
|
|
@@ -45,9 +45,9 @@ function createRequestCancellation(caller, timeoutMs) {
|
|
|
45
45
|
caller?.addEventListener("abort", abortFromCaller, { once: true });
|
|
46
46
|
if (timeoutMs !== undefined && timeoutController) {
|
|
47
47
|
timer = setTimeout(() => {
|
|
48
|
-
if (
|
|
48
|
+
if (origin)
|
|
49
49
|
return;
|
|
50
|
-
|
|
50
|
+
origin = "timeout";
|
|
51
51
|
timeoutController.abort(new DOMException("Request timed out", "TimeoutError"));
|
|
52
52
|
}, timeoutMs);
|
|
53
53
|
}
|
|
@@ -55,12 +55,14 @@ function createRequestCancellation(caller, timeoutMs) {
|
|
|
55
55
|
signal,
|
|
56
56
|
async run(operation) {
|
|
57
57
|
try {
|
|
58
|
-
if (
|
|
59
|
-
throw cancellationError(
|
|
58
|
+
if (origin === "caller")
|
|
59
|
+
throw cancellationError(origin);
|
|
60
60
|
return await operation(signal);
|
|
61
61
|
} catch (error) {
|
|
62
|
-
if (
|
|
63
|
-
throw
|
|
62
|
+
if (error instanceof RequestCancellationError)
|
|
63
|
+
throw error;
|
|
64
|
+
if (origin)
|
|
65
|
+
throw cancellationError(origin, error);
|
|
64
66
|
throw error;
|
|
65
67
|
} finally {
|
|
66
68
|
if (timer !== undefined)
|
|
@@ -70,8 +72,8 @@ function createRequestCancellation(caller, timeoutMs) {
|
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
|
-
function cancellationError(cause) {
|
|
74
|
-
return new RequestCancellationError(cause);
|
|
75
|
+
function cancellationError(origin, cause) {
|
|
76
|
+
return new RequestCancellationError(origin, cause);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
// src/browser/http-fetch.ts
|
|
@@ -412,9 +414,10 @@ function assertTransportChoice(config) {
|
|
|
412
414
|
}
|
|
413
415
|
function requestFailure(error, emit) {
|
|
414
416
|
if (error instanceof RequestCancellationError) {
|
|
415
|
-
return new ApiError2(error.
|
|
417
|
+
return new ApiError2(error.origin === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
|
|
416
418
|
status: 0,
|
|
417
|
-
message: error.message
|
|
419
|
+
message: error.message,
|
|
420
|
+
...error.cause !== undefined && { cause: error.cause }
|
|
418
421
|
});
|
|
419
422
|
}
|
|
420
423
|
if (ApiError2.is(error))
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
validateDeclaredOutput
|
|
3
3
|
} from "./index-fynr93w4.js";
|
|
4
|
+
import {
|
|
5
|
+
jsonSchemaObjectCoercionMembers
|
|
6
|
+
} from "./index-t5sjh517.js";
|
|
4
7
|
import {
|
|
5
8
|
coerceJsonArgs2
|
|
6
9
|
} from "./index-cykxpxz5.js";
|
|
@@ -167,7 +170,7 @@ class CliArgumentError2 extends Error {
|
|
|
167
170
|
import { z } from "zod";
|
|
168
171
|
function appendCliOptionValue(raw, name, value, info) {
|
|
169
172
|
const existing = raw.get(name);
|
|
170
|
-
const repeatable = !name.includes(".") &&
|
|
173
|
+
const repeatable = info?.kind === "array" || !name.includes(".") && info === undefined;
|
|
171
174
|
if (existing !== undefined) {
|
|
172
175
|
if (!repeatable) {
|
|
173
176
|
throw new CliArgumentError2(`--${name} was passed ${existing.length + 1} times`);
|
|
@@ -230,8 +233,12 @@ function mergeField(fields, name, info) {
|
|
|
230
233
|
fields.set(name, info);
|
|
231
234
|
return;
|
|
232
235
|
}
|
|
233
|
-
if (existing.kind === info.kind)
|
|
236
|
+
if (existing.kind === info.kind) {
|
|
237
|
+
if (existing.kind === "array" && existing.elementKind !== info.elementKind) {
|
|
238
|
+
fields.set(name, { kind: "array", elementKind: "other" });
|
|
239
|
+
}
|
|
234
240
|
return;
|
|
241
|
+
}
|
|
235
242
|
if (existing.kind === "boolean" || info.kind === "boolean") {
|
|
236
243
|
fields.set(name, { kind: "boolean" });
|
|
237
244
|
return;
|
|
@@ -275,6 +282,71 @@ function describeSchemaFields(schema) {
|
|
|
275
282
|
collectSchemaFields(schema, fields);
|
|
276
283
|
return fields;
|
|
277
284
|
}
|
|
285
|
+
function infoOf(field) {
|
|
286
|
+
const base = unwrap(field);
|
|
287
|
+
const kind = classify(base);
|
|
288
|
+
if (kind === "array" && base instanceof z.ZodArray) {
|
|
289
|
+
return { kind, elementKind: classify(unwrap(base.element)) };
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
kind,
|
|
293
|
+
...base instanceof z.ZodNumber && base.isInt && { integer: true }
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function mergePathInfos(infos, composition) {
|
|
297
|
+
const present = infos.filter((info) => info !== undefined);
|
|
298
|
+
if (present.length === 0)
|
|
299
|
+
return;
|
|
300
|
+
if (composition === "union" && present.some((info) => info.kind === "other")) {
|
|
301
|
+
return { kind: "other" };
|
|
302
|
+
}
|
|
303
|
+
const concrete = present.filter((info) => info.kind !== "other");
|
|
304
|
+
const candidates = composition === "intersection" && concrete.length > 0 ? concrete : present;
|
|
305
|
+
const first = candidates[0];
|
|
306
|
+
if (!first)
|
|
307
|
+
return;
|
|
308
|
+
if (candidates.every((info) => info.kind === first.kind)) {
|
|
309
|
+
const elementKind = first.kind === "array" ? candidates.every((info) => info.elementKind === first.elementKind) ? first.elementKind : "other" : undefined;
|
|
310
|
+
return {
|
|
311
|
+
kind: first.kind,
|
|
312
|
+
...elementKind && { elementKind },
|
|
313
|
+
...first.integer && candidates.every((info) => info.integer) && { integer: true }
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return candidates.some((info) => info.kind === "boolean") ? { kind: "boolean" } : { kind: "other" };
|
|
317
|
+
}
|
|
318
|
+
function pathInfo(schema, path) {
|
|
319
|
+
const guarded = jsonSchemaObjectCoercionMembers(schema);
|
|
320
|
+
if (guarded) {
|
|
321
|
+
return mergePathInfos(guarded.map((member) => pathInfo(member, path)), "intersection");
|
|
322
|
+
}
|
|
323
|
+
const base = unwrap(schema);
|
|
324
|
+
if (base !== schema)
|
|
325
|
+
return pathInfo(base, path);
|
|
326
|
+
if (base instanceof z.ZodUnion) {
|
|
327
|
+
return mergePathInfos(base.def.options.map((member) => pathInfo(member, path)), "union");
|
|
328
|
+
}
|
|
329
|
+
if (base instanceof z.ZodIntersection) {
|
|
330
|
+
return mergePathInfos([pathInfo(base.def.left, path), pathInfo(base.def.right, path)], "intersection");
|
|
331
|
+
}
|
|
332
|
+
if (path.length === 0)
|
|
333
|
+
return infoOf(base);
|
|
334
|
+
const [name, ...rest] = path;
|
|
335
|
+
if (name === undefined)
|
|
336
|
+
return infoOf(base);
|
|
337
|
+
if (base instanceof z.ZodObject) {
|
|
338
|
+
const member = base.shape[name] ?? base.def.catchall;
|
|
339
|
+
return member ? pathInfo(member, rest) : undefined;
|
|
340
|
+
}
|
|
341
|
+
if (base instanceof z.ZodRecord)
|
|
342
|
+
return pathInfo(base.valueType, rest);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
function describeSchemaPath(schema, path) {
|
|
346
|
+
if (!schema || path.length === 0)
|
|
347
|
+
return;
|
|
348
|
+
return pathInfo(schema, path);
|
|
349
|
+
}
|
|
278
350
|
var TRUE_WORDS = new Set(["true", "1", "yes", "on"]);
|
|
279
351
|
var FALSE_WORDS = new Set(["false", "0", "no", "off"]);
|
|
280
352
|
function separateBoolValue(next) {
|
|
@@ -329,8 +401,8 @@ function looseCoerce(value) {
|
|
|
329
401
|
return true;
|
|
330
402
|
if (value === "false")
|
|
331
403
|
return false;
|
|
332
|
-
const
|
|
333
|
-
return value.trim() !== "" && !Number.isNaN(
|
|
404
|
+
const number = Number(value);
|
|
405
|
+
return value.trim() !== "" && !Number.isNaN(number) ? number : value;
|
|
334
406
|
}
|
|
335
407
|
function looksLikeJson(value) {
|
|
336
408
|
const t = value.trim();
|
|
@@ -840,7 +912,7 @@ function resolveCliView(flags, ascending) {
|
|
|
840
912
|
}
|
|
841
913
|
|
|
842
914
|
// src/tools/cli/args.ts
|
|
843
|
-
function readCliTokens(argv, fields, config) {
|
|
915
|
+
function readCliTokens(argv, fields, fieldFor, config) {
|
|
844
916
|
const options = {
|
|
845
917
|
json: false,
|
|
846
918
|
wait: false,
|
|
@@ -855,7 +927,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
855
927
|
let ascending = false;
|
|
856
928
|
const positionals = [];
|
|
857
929
|
const pushFlag = (name, value) => {
|
|
858
|
-
appendCliOptionValue(flags, name, value,
|
|
930
|
+
appendCliOptionValue(flags, name, value, fieldFor(name));
|
|
859
931
|
};
|
|
860
932
|
let optionsEnded = false;
|
|
861
933
|
for (let i = 0;i < argv.length; i++) {
|
|
@@ -881,7 +953,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
881
953
|
if (!alias || !field)
|
|
882
954
|
throw new CliArgumentError2(`Unknown option "${tok}"`);
|
|
883
955
|
const inline = match?.[2];
|
|
884
|
-
const info =
|
|
956
|
+
const info = fieldFor(field);
|
|
885
957
|
if (info?.kind === "boolean") {
|
|
886
958
|
const separate = inline === undefined ? separateBoolValue(argv[i + 1]) : undefined;
|
|
887
959
|
if (separate !== undefined)
|
|
@@ -958,7 +1030,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
958
1030
|
}
|
|
959
1031
|
continue;
|
|
960
1032
|
}
|
|
961
|
-
if (value === undefined && name.startsWith("no-") &&
|
|
1033
|
+
if (value === undefined && name.startsWith("no-") && fieldFor(name.slice(3))?.kind === "boolean") {
|
|
962
1034
|
pushFlag(name.slice(3), "false");
|
|
963
1035
|
literalBooleanFlags.add(name.slice(3));
|
|
964
1036
|
continue;
|
|
@@ -967,7 +1039,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
967
1039
|
if (unsafeSegment !== undefined) {
|
|
968
1040
|
throw new CliArgumentError2(`Unsafe option name "--${name}"`);
|
|
969
1041
|
}
|
|
970
|
-
const info =
|
|
1042
|
+
const info = fieldFor(name);
|
|
971
1043
|
const rootName = name.split(".")[0] ?? name;
|
|
972
1044
|
if (!fields.has(rootName) && !config.allowUnknown) {
|
|
973
1045
|
throw new CliArgumentError2(`Unknown option "--${name}"`);
|
|
@@ -993,7 +1065,7 @@ function readCliTokens(argv, fields, config) {
|
|
|
993
1065
|
}
|
|
994
1066
|
return { options, flags, literalBooleanFlags, viewFlags, ascending, positionals };
|
|
995
1067
|
}
|
|
996
|
-
function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
1068
|
+
function buildToolArgs(tokens, fields, fieldFor, declaredPositionals, allowUnknown) {
|
|
997
1069
|
const { flags, literalBooleanFlags, positionals } = tokens;
|
|
998
1070
|
const toolArgs = {};
|
|
999
1071
|
const fillable = declaredPositionals === undefined ? [...fields.entries()].filter(([, info]) => info.kind !== "boolean").map(([name]) => name) : [...declaredPositionals];
|
|
@@ -1023,7 +1095,8 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
|
1023
1095
|
const dottedRoots = new Map;
|
|
1024
1096
|
for (const key of flags.keys()) {
|
|
1025
1097
|
const dot = key.indexOf(".");
|
|
1026
|
-
|
|
1098
|
+
const exactLiteralBoolean = literalBooleanFlags.has(key) && fields.has(key);
|
|
1099
|
+
if (dot > 0 && !exactLiteralBoolean) {
|
|
1027
1100
|
dottedRoots.set(key.slice(0, dot), key);
|
|
1028
1101
|
}
|
|
1029
1102
|
}
|
|
@@ -1033,9 +1106,12 @@ function buildToolArgs(tokens, fields, declaredPositionals) {
|
|
|
1033
1106
|
}
|
|
1034
1107
|
}
|
|
1035
1108
|
for (const [key, values] of flags) {
|
|
1036
|
-
const info =
|
|
1037
|
-
|
|
1038
|
-
|
|
1109
|
+
const info = fieldFor(key);
|
|
1110
|
+
const exactLiteralBoolean = literalBooleanFlags.has(key) && fields.has(key);
|
|
1111
|
+
if (key.includes(".") && !exactLiteralBoolean) {
|
|
1112
|
+
const root = key.split(".")[0] ?? key;
|
|
1113
|
+
const value = info === undefined && allowUnknown && !fields.has(root) ? looseCoerce(values[0] ?? "") : coerceField(info, values, `--${key}`);
|
|
1114
|
+
setNested(toolArgs, key.split("."), value);
|
|
1039
1115
|
continue;
|
|
1040
1116
|
}
|
|
1041
1117
|
toolArgs[key] = coerceField(info, values, `--${key}`);
|
|
@@ -1048,12 +1124,16 @@ function parseCliArgs2(argv, schema, config = {}) {
|
|
|
1048
1124
|
if (!fields.has(name))
|
|
1049
1125
|
fields.set(name, { kind: "other" });
|
|
1050
1126
|
}
|
|
1051
|
-
const
|
|
1127
|
+
const fieldFor = (name) => fields.get(name) ?? (name.includes(".") ? describeSchemaPath(schema, name.split(".")) : undefined);
|
|
1128
|
+
const tokens = readCliTokens(argv, fields, fieldFor, config);
|
|
1052
1129
|
const { options } = tokens;
|
|
1053
1130
|
const view = resolveCliView(tokens.viewFlags, tokens.ascending);
|
|
1054
1131
|
if (view)
|
|
1055
1132
|
options.view = view;
|
|
1056
|
-
return {
|
|
1133
|
+
return {
|
|
1134
|
+
toolArgs: buildToolArgs(tokens, fields, fieldFor, config.positionals, config.allowUnknown === true),
|
|
1135
|
+
options
|
|
1136
|
+
};
|
|
1057
1137
|
}
|
|
1058
1138
|
function refuseGlobalOption(issue) {
|
|
1059
1139
|
const field = issue?.path[0];
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
uploadProgressRoute,
|
|
14
14
|
withUploadProgress,
|
|
15
15
|
parseApiErrorBody
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-00v1qz76.js";
|
|
17
17
|
import {
|
|
18
18
|
abortReason,
|
|
19
19
|
untilAborted
|
|
@@ -702,23 +702,33 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
|
|
|
702
702
|
const cancellation = streamAbort ? {
|
|
703
703
|
signal: requestSignal,
|
|
704
704
|
async run(operation) {
|
|
705
|
-
let
|
|
705
|
+
let origin;
|
|
706
|
+
const abortFromCaller = () => {
|
|
707
|
+
origin ??= "caller";
|
|
708
|
+
};
|
|
709
|
+
if (options?.signal?.aborted)
|
|
710
|
+
abortFromCaller();
|
|
711
|
+
else
|
|
712
|
+
options?.signal?.addEventListener("abort", abortFromCaller, { once: true });
|
|
706
713
|
const timer = setTimeout(() => {
|
|
707
|
-
|
|
714
|
+
if (origin)
|
|
715
|
+
return;
|
|
716
|
+
origin = "timeout";
|
|
708
717
|
streamAbort.abort(new DOMException("Request timed out", "TimeoutError"));
|
|
709
718
|
}, openTimeoutMs);
|
|
710
719
|
try {
|
|
711
|
-
if (
|
|
712
|
-
throw new RequestCancellationError(
|
|
720
|
+
if (origin === "caller")
|
|
721
|
+
throw new RequestCancellationError(origin);
|
|
713
722
|
return await operation(requestSignal);
|
|
714
723
|
} catch (error) {
|
|
715
|
-
if (
|
|
716
|
-
throw
|
|
717
|
-
if (
|
|
718
|
-
throw new RequestCancellationError(
|
|
724
|
+
if (error instanceof RequestCancellationError)
|
|
725
|
+
throw error;
|
|
726
|
+
if (origin)
|
|
727
|
+
throw new RequestCancellationError(origin, error);
|
|
719
728
|
throw error;
|
|
720
729
|
} finally {
|
|
721
730
|
clearTimeout(timer);
|
|
731
|
+
options?.signal?.removeEventListener("abort", abortFromCaller);
|
|
722
732
|
}
|
|
723
733
|
}
|
|
724
734
|
} : createRequestCancellation(requestSignal, openTimeoutMs);
|
|
@@ -758,9 +768,10 @@ function createFetchExecutor(endpoint, prefix, config, contractConfig) {
|
|
|
758
768
|
});
|
|
759
769
|
} catch (error) {
|
|
760
770
|
if (error instanceof RequestCancellationError) {
|
|
761
|
-
throw new ApiError2(error.
|
|
771
|
+
throw new ApiError2(error.origin === "caller" ? "REQUEST_ABORTED" : "REQUEST_TIMEOUT", {
|
|
762
772
|
status: 0,
|
|
763
|
-
message: error.message
|
|
773
|
+
message: error.message,
|
|
774
|
+
...error.cause !== undefined && { cause: error.cause }
|
|
764
775
|
});
|
|
765
776
|
}
|
|
766
777
|
if (ApiError2.is(error))
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TelegramUpdateAttemptIntakeConfig, TelegramUpdateEnvelope, TelegramUpdateIntakeConfig, TelegramUpdateStoreStep } from './update-intake.js';
|
|
2
|
+
import type { StoredTelegramUpdateExhaustion, TelegramUpdateAttemptIdentity, TelegramUpdateDurableStore, TelegramUpdateFencedStore, TelegramUpdateStore } from './update-store.js';
|
|
3
|
+
type TelegramUpdateAnyIntakeConfig<TUpdate extends TelegramUpdateEnvelope> = TelegramUpdateIntakeConfig<TUpdate> | TelegramUpdateAttemptIntakeConfig<TUpdate>;
|
|
4
|
+
export type TelegramUpdateStoreErrorReporter = (error: unknown, step: TelegramUpdateStoreStep) => void;
|
|
5
|
+
/** One shared concurrency budget for ordinary attempts and exhaustion delivery. */
|
|
6
|
+
export interface TelegramUpdateWorkSlots {
|
|
7
|
+
take(): Promise<void>;
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createTelegramUpdateWorkSlots(maxConcurrent: number): TelegramUpdateWorkSlots;
|
|
11
|
+
export interface TelegramUpdateExhaustionScheduler {
|
|
12
|
+
schedule(row: StoredTelegramUpdateExhaustion, active: boolean): boolean;
|
|
13
|
+
pending(): readonly Promise<void>[];
|
|
14
|
+
}
|
|
15
|
+
/** Deliver recoverable terminal obligations without creating another durable queue. */
|
|
16
|
+
export declare function createTelegramUpdateExhaustionScheduler<TUpdate extends TelegramUpdateEnvelope>(options: {
|
|
17
|
+
readonly config: TelegramUpdateAnyIntakeConfig<TUpdate>;
|
|
18
|
+
readonly store: TelegramUpdateDurableStore | undefined;
|
|
19
|
+
readonly now: () => number;
|
|
20
|
+
readonly slots: TelegramUpdateWorkSlots;
|
|
21
|
+
readonly parse: (body: string) => Record<string, unknown> | undefined;
|
|
22
|
+
readonly reportStoreError: TelegramUpdateStoreErrorReporter;
|
|
23
|
+
}): TelegramUpdateExhaustionScheduler;
|
|
24
|
+
/** Build the claim/renew/settle state machine for one update attempt. */
|
|
25
|
+
export declare function createTelegramUpdateAttemptRunner<TUpdate extends TelegramUpdateEnvelope>(options: {
|
|
26
|
+
readonly config: TelegramUpdateAnyIntakeConfig<TUpdate>;
|
|
27
|
+
readonly store: TelegramUpdateStore;
|
|
28
|
+
readonly fenced: TelegramUpdateFencedStore | undefined;
|
|
29
|
+
readonly durable: TelegramUpdateDurableStore | undefined;
|
|
30
|
+
readonly now: () => number;
|
|
31
|
+
readonly retry: (error: unknown, attempt: number) => number | false;
|
|
32
|
+
readonly maxAttempts: number;
|
|
33
|
+
readonly leaseMs: number;
|
|
34
|
+
readonly reportStoreError: TelegramUpdateStoreErrorReporter;
|
|
35
|
+
readonly scheduleExhaustion: (row: StoredTelegramUpdateExhaustion) => void;
|
|
36
|
+
readonly ownershipLostReason: (identity: TelegramUpdateAttemptIdentity) => unknown;
|
|
37
|
+
}): (update: Record<string, unknown>, updateId: number) => Promise<void>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=update-intake-work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-intake-work.d.ts","sourceRoot":"","sources":["../../src/telegram/update-intake-work.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iCAAiC,EACjC,sBAAsB,EAEtB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACpB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O,CAAC,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,KAAK,CAAC;IACpE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,gCAAgC,CAAC;IAC5D,QAAQ,CAAC,kBAAkB,EAAE,CAAC,GAAG,EAAE,8BAA8B,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,6BAA6B,KAAK,OAAO,CAAC;CACpF,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CA+JvE"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `processing` whose lease nobody renewed. Delivery is at least once: a
|
|
19
19
|
* handler that finished but could not be recorded as finished runs again.
|
|
20
20
|
*/
|
|
21
|
-
import type { TelegramUpdateStore } from './update-store.js';
|
|
21
|
+
import type { TelegramUpdateAttemptIdentity, TelegramUpdateFencedStore, TelegramUpdateStore } from './update-store.js';
|
|
22
22
|
import type { TelegramUpdateAcceptance } from './webhook.js';
|
|
23
23
|
/** An update as Telegram sends it; name grammY's `Update` to get its full type. */
|
|
24
24
|
export interface TelegramUpdateEnvelope {
|
|
@@ -31,15 +31,32 @@ export interface TelegramUpdateFailure {
|
|
|
31
31
|
/** `false` when the update was abandoned — no attempt follows. */
|
|
32
32
|
readonly retrying: boolean;
|
|
33
33
|
}
|
|
34
|
+
/** One handler invocation under one immutable store claim. */
|
|
35
|
+
export interface TelegramUpdateAttemptContext extends TelegramUpdateAttemptIdentity {
|
|
36
|
+
/** Pass this exact identity to a fenced store check inside the consumer's DB transaction. */
|
|
37
|
+
readonly fence: TelegramUpdateAttemptIdentity;
|
|
38
|
+
/** Aborted once renewal proves the attempt lost ownership or its last proven lease expires. */
|
|
39
|
+
readonly ownerLost: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
/** A terminal update failure recovered from the same durable update store. */
|
|
42
|
+
export interface TelegramUpdateExhaustion<TUpdate extends TelegramUpdateEnvelope> extends TelegramUpdateAttemptIdentity {
|
|
43
|
+
readonly update: TUpdate;
|
|
44
|
+
readonly exhaustedAt: number;
|
|
45
|
+
readonly error: string;
|
|
46
|
+
}
|
|
47
|
+
/** A failed delivery of a durable terminal-update obligation. */
|
|
48
|
+
export interface TelegramUpdateExhaustionFailure<TUpdate extends TelegramUpdateEnvelope> {
|
|
49
|
+
readonly exhaustion: TelegramUpdateExhaustion<TUpdate>;
|
|
50
|
+
readonly error: unknown;
|
|
51
|
+
}
|
|
52
|
+
/** The reason carried by `ownerLost` when an attempt no longer owns its lease. */
|
|
53
|
+
export declare class TelegramUpdateOwnershipLostError extends Error {
|
|
54
|
+
readonly identity: TelegramUpdateAttemptIdentity;
|
|
55
|
+
constructor(identity: TelegramUpdateAttemptIdentity);
|
|
56
|
+
}
|
|
34
57
|
export type TelegramUpdateStoreStep = 'claim' | 'renew' | 'settle' | 'sweep';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Handle one update — with grammY, `(update) => bot.handleUpdate(update)`.
|
|
39
|
-
* A grammY `BotError` is unwrapped: `retry`, `onFailure` and the stored
|
|
40
|
-
* error see what the middleware threw.
|
|
41
|
-
*/
|
|
42
|
-
readonly handle: (update: TUpdate) => unknown;
|
|
58
|
+
/** Retry, lease, scheduling and observation options shared by both handler forms. */
|
|
59
|
+
export interface TelegramUpdateIntakeOptions<TUpdate extends TelegramUpdateEnvelope> {
|
|
43
60
|
/**
|
|
44
61
|
* After a failed attempt: milliseconds until the next, or `false` to
|
|
45
62
|
* abandon the update. Default: abandon what Telegram said repeating cannot
|
|
@@ -61,11 +78,31 @@ export interface TelegramUpdateIntakeConfig<TUpdate extends TelegramUpdateEnvelo
|
|
|
61
78
|
readonly maxConcurrent?: number;
|
|
62
79
|
/** Every failed attempt. */
|
|
63
80
|
readonly onFailure?: (failure: TelegramUpdateFailure) => void;
|
|
81
|
+
/**
|
|
82
|
+
* A durable final obligation. Resolving acknowledges it; throwing leaves it
|
|
83
|
+
* in the same store for a later sweep. Requires a `TelegramUpdateDurableStore`.
|
|
84
|
+
* Delivery is at least once, so persist by the supplied update/attempt identity.
|
|
85
|
+
*/
|
|
86
|
+
readonly handleExhaustion?: (exhaustion: TelegramUpdateExhaustion<TUpdate>) => unknown;
|
|
87
|
+
/** An observational report that `handleExhaustion` threw; it never acknowledges the row. */
|
|
88
|
+
readonly onExhaustionFailure?: (failure: TelegramUpdateExhaustionFailure<TUpdate>) => void;
|
|
64
89
|
/** The store refused a step; the update is retried when its lease lapses. */
|
|
65
90
|
readonly onStoreError?: (error: unknown, step: TelegramUpdateStoreStep) => void;
|
|
66
91
|
/** Default `Date.now`. */
|
|
67
92
|
readonly now?: () => number;
|
|
68
93
|
}
|
|
94
|
+
/** Existing one-argument intake configuration. */
|
|
95
|
+
export interface TelegramUpdateIntakeConfig<TUpdate extends TelegramUpdateEnvelope> extends TelegramUpdateIntakeOptions<TUpdate> {
|
|
96
|
+
readonly store: TelegramUpdateStore;
|
|
97
|
+
/** Direct grammY handlers keep their optional second argument private. */
|
|
98
|
+
readonly handle: (update: TUpdate) => unknown;
|
|
99
|
+
}
|
|
100
|
+
/** Intake configuration for a handler that needs attempt ownership metadata. */
|
|
101
|
+
export interface TelegramUpdateAttemptIntakeConfig<TUpdate extends TelegramUpdateEnvelope> extends TelegramUpdateIntakeOptions<TUpdate> {
|
|
102
|
+
readonly store: TelegramUpdateFencedStore;
|
|
103
|
+
/** Handle an update with its immutable attempt fence and ownership-loss signal. */
|
|
104
|
+
readonly handleAttempt: (update: TUpdate, context: TelegramUpdateAttemptContext) => unknown;
|
|
105
|
+
}
|
|
69
106
|
export interface TelegramUpdateIntake {
|
|
70
107
|
/** Record one webhook body; handling starts after, once the intake is started. */
|
|
71
108
|
accept(body: string): Promise<TelegramUpdateAcceptance>;
|
|
@@ -79,4 +116,5 @@ export interface TelegramUpdateIntake {
|
|
|
79
116
|
close(): Promise<void>;
|
|
80
117
|
}
|
|
81
118
|
export declare function createTelegramUpdateIntake<TUpdate extends TelegramUpdateEnvelope>(config: TelegramUpdateIntakeConfig<TUpdate>): TelegramUpdateIntake;
|
|
119
|
+
export declare function createTelegramUpdateIntake<TUpdate extends TelegramUpdateEnvelope>(config: TelegramUpdateAttemptIntakeConfig<TUpdate>): TelegramUpdateIntake;
|
|
82
120
|
//# sourceMappingURL=update-intake.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-intake.d.ts","sourceRoot":"","sources":["../../src/telegram/update-intake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"update-intake.d.ts","sourceRoot":"","sources":["../../src/telegram/update-intake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,KAAK,EACV,6BAA6B,EAE7B,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,mFAAmF;AACnF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE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F,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;CAC7F;AAMD,MAAM,WAAW,oBAAoB;IACnC,kFAAkF;IAClF,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACxD,iEAAiE;IACjE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,kEAAkE;IAClE,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,0CAA0C;IAC1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,2DAA2D;IAC3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAmFD,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,sBAAsB,EAC/E,MAAM,EAAE,0BAA0B,CAAC,OAAO,CAAC,GAC1C,oBAAoB,CAAC;AACxB,wBAAgB,0BAA0B,CAAC,OAAO,SAAS,sBAAsB,EAC/E,MAAM,EAAE,iCAAiC,CAAC,OAAO,CAAC,GACjD,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-store-check.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"update-store-check.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAGV,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAiXxB;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAC7D,OAAO,CAAC,MAAM,EAAE,CAAC,CAYnB"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Parameters carry explicit casts: a driver that sends a JS number as a
|
|
14
14
|
* double still lands in a `bigint` column.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { TelegramUpdateDurableStore } from './update-store.js';
|
|
17
17
|
/** Run one statement with `$1…$n` parameters; resolve with the rows it returned. */
|
|
18
18
|
export type TelegramPostgresQuery = (text: string, parameters: readonly (string | number | null)[]) => Promise<readonly unknown[]>;
|
|
19
19
|
export interface PostgresTelegramUpdateStoreConfig {
|
|
@@ -29,5 +29,5 @@ export interface PostgresTelegramUpdateStoreConfig {
|
|
|
29
29
|
}
|
|
30
30
|
/** The table and its index, for a migration. Safe to run twice. */
|
|
31
31
|
export declare function postgresTelegramUpdateStoreSchema(table?: string): string;
|
|
32
|
-
export declare function postgresTelegramUpdateStore(config: PostgresTelegramUpdateStoreConfig):
|
|
32
|
+
export declare function postgresTelegramUpdateStore(config: PostgresTelegramUpdateStoreConfig): TelegramUpdateDurableStore;
|
|
33
33
|
//# sourceMappingURL=update-store-postgres.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-store-postgres.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"update-store-postgres.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAIV,0BAA0B,EAE3B,MAAM,gBAAgB,CAAC;AAExB,oFAAoF;AACpF,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,KAC5C,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;AAEjC,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,kCAAkC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAaD,mEAAmE;AACnE,wBAAgB,iCAAiC,CAAC,KAAK,SAAqB,GAAG,MAAM,CAepF;AA4HD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,iCAAiC,GACxC,0BAA0B,CAmK5B"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Each rule of `TelegramUpdateStore` is one conditional statement, so a claim
|
|
7
7
|
* is atomic across processes sharing the file.
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { TelegramUpdateDurableStore } from './update-store.js';
|
|
10
10
|
/** What this store needs of a SQLite handle; both runtimes' handles have it. */
|
|
11
11
|
export interface TelegramSqliteDatabase {
|
|
12
12
|
exec(sql: string): unknown;
|
|
@@ -22,5 +22,5 @@ export interface SqliteTelegramUpdateStoreConfig {
|
|
|
22
22
|
/** Default `telegram_updates`. Created when missing. */
|
|
23
23
|
readonly table?: string;
|
|
24
24
|
}
|
|
25
|
-
export declare function sqliteTelegramUpdateStore(config: SqliteTelegramUpdateStoreConfig):
|
|
25
|
+
export declare function sqliteTelegramUpdateStore(config: SqliteTelegramUpdateStoreConfig): TelegramUpdateDurableStore;
|
|
26
26
|
//# sourceMappingURL=update-store-sqlite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-store-sqlite.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"update-store-sqlite.d.ts","sourceRoot":"","sources":["../../src/telegram/update-store-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAKV,0BAA0B,EAE3B,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACpB,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QACtF,GAAG,CAAC,GAAG,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;KAC3D,CAAC;CACH;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AA+ID,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,+BAA+B,GACtC,0BAA0B,CAyI5B"}
|