stitchkit 0.106.1 → 0.108.0
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 +151 -0
- package/README.md +2 -0
- package/darwin-native.cjs +17 -4
- package/dist/agent-runtime/deferred-tool-types.d.ts +6 -27
- package/dist/agent-runtime/deferred-tool-types.d.ts.map +1 -1
- package/dist/browser/stream.d.ts +38 -12
- package/dist/browser/stream.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime/browser.js +2 -3
- package/dist/entrypoints/agent-runtime/coding-tools.js +6 -8
- package/dist/entrypoints/agent-runtime/harness.js +7 -11
- package/dist/entrypoints/agent-runtime/realtime.js +2 -3
- package/dist/entrypoints/agent-runtime/sandbox.js +6 -8
- package/dist/entrypoints/agent-runtime.d.ts +2 -1
- package/dist/entrypoints/agent-runtime.d.ts.map +1 -1
- package/dist/entrypoints/agent-runtime.js +20 -23
- package/dist/entrypoints/application/diagnostic-journal.js +3 -3
- package/dist/entrypoints/application/directory-inbox.js +8 -9
- package/dist/entrypoints/application/grammy.js +3 -3
- package/dist/entrypoints/application.js +7 -8
- package/dist/entrypoints/bin/upgrade-cli.d.ts +32 -0
- package/dist/entrypoints/bin/upgrade-cli.d.ts.map +1 -1
- package/dist/entrypoints/bin/upgrade-cli.js +451 -8
- package/dist/entrypoints/cli/publish.js +10 -11
- package/dist/entrypoints/cli.js +12 -16
- package/dist/entrypoints/contract.js +1 -1
- package/dist/entrypoints/files/packaging.d.ts +3 -1
- package/dist/entrypoints/files/packaging.d.ts.map +1 -1
- package/dist/entrypoints/files/packaging.js +171 -55
- package/dist/entrypoints/files.js +16 -16
- package/dist/entrypoints/index.d.ts +1 -1
- package/dist/entrypoints/index.d.ts.map +1 -1
- package/dist/entrypoints/index.js +47 -41
- package/dist/entrypoints/node.js +27 -29
- package/dist/entrypoints/observability.js +10 -12
- package/dist/entrypoints/process.js +2 -2
- package/dist/entrypoints/react.js +3 -4
- package/dist/entrypoints/remote.js +8 -9
- package/dist/entrypoints/server.js +48 -51
- package/dist/entrypoints/telegram/html.js +3 -3
- package/dist/entrypoints/telegram/screens.js +6 -6
- package/dist/entrypoints/telegram.d.ts +2 -0
- package/dist/entrypoints/telegram.d.ts.map +1 -1
- package/dist/entrypoints/telegram.js +344 -11
- package/dist/entrypoints/testing.d.ts +1 -0
- package/dist/entrypoints/testing.d.ts.map +1 -1
- package/dist/entrypoints/testing.js +138 -11
- package/dist/entrypoints/tools/connections.js +11 -11
- package/dist/entrypoints/tools/invoker.js +5 -9
- package/dist/entrypoints/tools/mcp.js +8 -14
- package/dist/entrypoints/tools.js +19 -25
- package/dist/entrypoints/tracking.js +3 -3
- package/dist/files/native-artifact.d.ts +14 -0
- package/dist/files/native-artifact.d.ts.map +1 -0
- package/dist/files/native-packaging-layout.d.ts +11 -2
- package/dist/files/native-packaging-layout.d.ts.map +1 -1
- package/dist/files/native-packaging-plugin.d.ts +53 -0
- package/dist/files/native-packaging-plugin.d.ts.map +1 -0
- package/dist/files/native-packaging.d.ts +44 -43
- package/dist/files/native-packaging.d.ts.map +1 -1
- package/dist/{index-v5ee8ath.js → index-1h2zv8rx.js} +10 -40
- package/dist/index-2kbysk9s.js +42 -0
- package/dist/{index-wbhdzxar.js → index-2s6fpehp.js} +5 -5
- package/dist/{index-ksfagmyz.js → index-4qh90tyw.js} +8 -8
- package/dist/{index-yvfk3y36.js → index-636mggad.js} +4 -3
- package/dist/{index-f199nfq5.js → index-6y9t2fwz.js} +7 -7
- package/dist/{index-w8etpm8j.js → index-9j2atjte.js} +1 -1
- package/dist/index-a5qr2rj6.js +26 -0
- package/dist/{index-azx12jgv.js → index-bh2ht9y5.js} +13 -7
- package/dist/{index-pz3y6b6g.js → index-cx2nh595.js} +3 -3
- package/dist/{index-2k91mewf.js → index-dm2fv45z.js} +9 -9
- package/dist/{index-9bskshe3.js → index-dwf0gymy.js} +10 -10
- package/dist/{index-qaqbdm7s.js → index-h7qms8f9.js} +8 -8
- package/dist/{index-drs41arz.js → index-ktjmgq9p.js} +1 -1
- package/dist/{index-916yh4e2.js → index-mep4sb48.js} +14 -14
- package/dist/{index-wdy68sh6.js → index-njs9gvrh.js} +17 -17
- package/dist/{index-1ptj98e0.js → index-nx49x0tw.js} +2 -2
- package/dist/{index-1pwwan01.js → index-p5kx5vqd.js} +214 -59
- package/dist/{index-sj28htvf.js → index-pvh3z03x.js} +1 -1
- package/dist/{index-r393tnfp.js → index-q6crhe1n.js} +4 -4
- package/dist/{index-dsnjzb62.js → index-t2bsd0hm.js} +1 -1
- package/dist/{index-4vsby8n8.js → index-w9mqgnz9.js} +1 -1
- package/dist/{index-z23rfxhj.js → index-xmgjtkvr.js} +1 -1
- package/dist/{index-e05cjgtf.js → index-xvj9h8yh.js} +28 -1
- package/dist/{index-gr5g3xfw.js → index-yz8x0hbx.js} +1 -1
- package/dist/{index-gxm9rc97.js → index-zrtrjkbf.js} +1 -1
- package/dist/internal/bounded-lines.d.ts +46 -2
- package/dist/internal/bounded-lines.d.ts.map +1 -1
- package/dist/internal/darwin-binding-error.d.ts +9 -1
- package/dist/internal/darwin-binding-error.d.ts.map +1 -1
- package/dist/internal/darwin-binding.d.ts.map +1 -1
- package/dist/internal/process-identity.d.ts.map +1 -1
- package/dist/internal/until-aborted.d.ts +9 -0
- package/dist/internal/until-aborted.d.ts.map +1 -0
- package/dist/internal/upgrade-affects.d.ts +58 -0
- package/dist/internal/upgrade-affects.d.ts.map +1 -0
- package/dist/internal/upgrade-plan.d.ts +20 -0
- package/dist/internal/upgrade-plan.d.ts.map +1 -1
- package/dist/internal/upgrade-usage.d.ts +61 -0
- package/dist/internal/upgrade-usage.d.ts.map +1 -0
- package/dist/telegram/bot-api.d.ts +10 -4
- package/dist/telegram/bot-api.d.ts.map +1 -1
- package/dist/telegram/broadcast.d.ts +2 -1
- package/dist/telegram/broadcast.d.ts.map +1 -1
- package/dist/telegram/not-dispatched.d.ts +26 -0
- package/dist/telegram/not-dispatched.d.ts.map +1 -0
- package/dist/telegram/operator-channel.d.ts +2 -1
- package/dist/telegram/operator-channel.d.ts.map +1 -1
- package/dist/telegram/send-failure.d.ts +4 -3
- package/dist/telegram/send-failure.d.ts.map +1 -1
- package/dist/telegram/transport-connect.d.ts +38 -0
- package/dist/telegram/transport-connect.d.ts.map +1 -0
- package/dist/telegram/transport.d.ts +43 -0
- package/dist/telegram/transport.d.ts.map +1 -0
- package/dist/telegram/webhook.d.ts +2 -1
- package/dist/telegram/webhook.d.ts.map +1 -1
- package/dist/testing/manual-clock.d.ts +82 -0
- package/dist/testing/manual-clock.d.ts.map +1 -0
- package/dist/tools/internal/surface-projector.d.ts +0 -7
- package/dist/tools/internal/surface-projector.d.ts.map +1 -1
- package/dist/tools/runtime-tool-declaration.d.ts +11 -0
- package/dist/tools/runtime-tool-declaration.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +2 -3
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/llms/files-packaging.txt +13 -6
- package/llms/process.txt +71 -15
- package/llms/stitchkit.2.txt +211 -628
- package/llms/stitchkit.txt +635 -10
- package/llms/telegram.txt +36 -3
- package/llms/testing.txt +47 -0
- package/llms/{upgrading-0.96.0-0.106.0.txt → upgrading-0.100.0-0.108.0.txt} +112 -144
- package/llms/{upgrading-0.37.0-0.53.0.txt → upgrading-0.37.0-0.58.0.txt} +209 -3
- package/llms/{upgrading-0.55.0-0.68.0.txt → upgrading-0.59.0-0.71.0.txt} +149 -209
- package/llms/{upgrading-0.69.0-0.95.0.txt → upgrading-0.72.0-0.99.0.txt} +137 -149
- package/llms/upgrading.txt +36 -4
- package/llms-full.txt +360 -39
- package/llms.txt +10 -10
- package/package.json +2 -1
- package/llms/stitchkit.3.txt +0 -177
- package/dist/{index-cazts87s.js → index-07dcf2yn.js} +3 -3
- package/dist/{index-n1nszyk0.js → index-7jvwrjqa.js} +3 -3
- package/dist/{index-cmzvhhtd.js → index-85qve8mq.js} +3 -3
- package/dist/{index-rpzewktb.js → index-fynr93w4.js} +3 -3
- package/dist/{index-37asdw3a.js → index-k7qdkh3n.js} +3 -3
- package/dist/{index-x7w1z6pf.js → index-q4hjtyye.js} +4 -4
- package/dist/{index-7n68nmc6.js → index-y3nemndz.js} +3 -3
- package/dist/{index-12zsej7b.js → index-y70v24cw.js} +3 -3
- package/dist/{index-pzb63z66.js → index-ykdcnq1f.js} +3 -3
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
/** Error code of a generated beside-loader that runs inside a bundle built without the packaging plugin. */
|
|
2
|
+
export declare const NATIVE_NOT_PACKAGED = "STITCHKIT_NATIVE_NOT_PACKAGED";
|
|
1
3
|
declare const messages: {
|
|
2
4
|
architecture: string;
|
|
5
|
+
packaging: string;
|
|
3
6
|
resolve: string;
|
|
4
7
|
load: string;
|
|
5
8
|
surface: string;
|
|
6
9
|
};
|
|
7
10
|
type Stage = keyof typeof messages;
|
|
8
11
|
export declare function darwinNativeCode(cause: unknown): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Which stage a failed addon load stopped at: a bundle built without the packaging plugin, an
|
|
14
|
+
* addon that is not where the loader looked, or one that was found and did not load.
|
|
15
|
+
*/
|
|
16
|
+
export declare function darwinLoadStage(cause: unknown): 'packaging' | 'resolve' | 'load';
|
|
9
17
|
/** Live callers retain the original Error; operator JSON only carries safe loader evidence. */
|
|
10
18
|
export declare class DarwinBackendError extends Error {
|
|
11
19
|
readonly stage: Stage;
|
|
@@ -14,7 +22,7 @@ export declare class DarwinBackendError extends Error {
|
|
|
14
22
|
toJSON(): {
|
|
15
23
|
name: string;
|
|
16
24
|
code: string;
|
|
17
|
-
stage: "architecture" | "load" | "resolve" | "surface";
|
|
25
|
+
stage: "architecture" | "load" | "packaging" | "resolve" | "surface";
|
|
18
26
|
architecture: NodeJS.Architecture;
|
|
19
27
|
message: string;
|
|
20
28
|
nativeCode: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"darwin-binding-error.d.ts","sourceRoot":"","sources":["../../src/internal/darwin-binding-error.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ;IACZ,YAAY;IACZ,OAAO;IACP,IAAI;IACJ,OAAO;CACR,CAAC;AACF,KAAK,KAAK,GAAG,MAAM,OAAO,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"darwin-binding-error.d.ts","sourceRoot":"","sources":["../../src/internal/darwin-binding-error.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAEnE,QAAA,MAAM,QAAQ;IACZ,YAAY;IACZ,SAAS;IAET,OAAO;IACP,IAAI;IACJ,OAAO;CACR,CAAC;AACF,KAAK,KAAK,GAAG,MAAM,OAAO,QAAQ,CAAC;AAanC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAanE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAMhF;AAED,+FAA+F;AAC/F,qBAAa,kBAAmB,SAAQ,KAAK;IAGzC,QAAQ,CAAC,KAAK,EAAE,KAAK;IAFvB,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,YACW,KAAK,EAAE,KAAK,EACrB,KAAK,CAAC,EAAE,OAAO,EAIhB;IACD,MAAM;;;;;;;MASL;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"darwin-binding.d.ts","sourceRoot":"","sources":["../../src/internal/darwin-binding.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAA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E,MAAM,GAAG,MAAM,CAAC;IACpD,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC1E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,WAAW,EAAE,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACjD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAM9E;AAID,wBAAgB,iBAAiB,IAAI,aAAa,CA4BjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-identity.d.ts","sourceRoot":"","sources":["../../src/internal/process-identity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-identity.d.ts","sourceRoot":"","sources":["../../src/internal/process-identity.ts"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7D;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,SAAU,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBtF;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAW1F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,KAAK,YAAY,MAAM,SAA4B,GAClD,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,CAY3B;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACnD,OAAO,CAAC,OAAO,CAAC,CAsBlB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The signal's reason, or the `AbortError` a signal aborted without one stands for. */
|
|
2
|
+
export declare function abortReason(signal: AbortSignal): unknown;
|
|
3
|
+
/**
|
|
4
|
+
* `pending`, or the signal's reason as soon as it aborts. Each call owns its listener and removes
|
|
5
|
+
* it when `pending` settles: one promise shared by every call would retain each result for as long
|
|
6
|
+
* as the signal lives. `pending` itself is not cancelled, only no longer waited for.
|
|
7
|
+
*/
|
|
8
|
+
export declare function untilAborted<T>(pending: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
9
|
+
//# sourceMappingURL=until-aborted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"until-aborted.d.ts","sourceRoot":"","sources":["../../src/internal/until-aborted.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAoBpF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The machine line of a breaking changelog item: what it touches, in a form a
|
|
3
|
+
* consumer's tooling reads without guessing from prose.
|
|
4
|
+
*
|
|
5
|
+
* **Affects:** `stitchkit/files/packaging` createNativePackaging(delivery: 'embedded')
|
|
6
|
+
* **Affects:** `stitchkit/contract`, `stitchkit/server` AppError; `stitchkit` ApiError
|
|
7
|
+
* **Affects:** `stitchkit/process` behaviour
|
|
8
|
+
* **Affects:** `stitchkit/agent-runtime/harness-tools` *
|
|
9
|
+
*
|
|
10
|
+
* Targets are separated by `; `. A target is one or more backticked entrypoints
|
|
11
|
+
* (`, ` between them) and then either export names (`, ` between them, each with
|
|
12
|
+
* an optional parenthesised qualifier naming the option or member), `behaviour`
|
|
13
|
+
* for a change of semantics no import name reveals, or `*` for every import of
|
|
14
|
+
* the entrypoint (a removed leaf). The whole line stays on one line.
|
|
15
|
+
*
|
|
16
|
+
* Pure: shared by the release gate, which refuses a breaking item without it,
|
|
17
|
+
* and by `stitchkit upgrade`, which matches it against a project's imports.
|
|
18
|
+
*/
|
|
19
|
+
/** One export a breaking item changes, with what about it changed. */
|
|
20
|
+
export interface UpgradeAffectedSymbol {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
/** The option or member the change is about, as written, e.g. `delivery: 'embedded'`. */
|
|
23
|
+
readonly qualifier?: string;
|
|
24
|
+
}
|
|
25
|
+
/** What one target of an `**Affects:**` line touches in one entrypoint. */
|
|
26
|
+
export type UpgradeAffectsTarget = {
|
|
27
|
+
readonly entrypoint: string;
|
|
28
|
+
readonly kind: 'symbols';
|
|
29
|
+
readonly symbols: readonly UpgradeAffectedSymbol[];
|
|
30
|
+
} | {
|
|
31
|
+
readonly entrypoint: string;
|
|
32
|
+
readonly kind: 'behaviour';
|
|
33
|
+
} | {
|
|
34
|
+
readonly entrypoint: string;
|
|
35
|
+
readonly kind: 'any-import';
|
|
36
|
+
};
|
|
37
|
+
/** One top-level `- ` item of a breaking section, with its lines as written. */
|
|
38
|
+
export interface UpgradeBreakingItemText {
|
|
39
|
+
readonly markdown: string;
|
|
40
|
+
}
|
|
41
|
+
/** The line could not be read; `reason` says which part is malformed. */
|
|
42
|
+
export declare class UpgradeAffectsError extends Error {
|
|
43
|
+
readonly name = "UpgradeAffectsError";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The top-level items of a breaking section. An item opens with a `- `, `* ` or
|
|
47
|
+
* `+ ` bullet at column zero outside a fence; indented and blank lines continue
|
|
48
|
+
* it, and the next unindented line closes it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function breakingItems(section: string): UpgradeBreakingItemText[];
|
|
51
|
+
/**
|
|
52
|
+
* The text after `**Affects:**` in an item, or undefined when it declares none.
|
|
53
|
+
* An item carries at most one such line; a second is refused, never dropped.
|
|
54
|
+
*/
|
|
55
|
+
export declare function affectsLineOf(itemMarkdown: string): string | undefined;
|
|
56
|
+
/** Every target of an `**Affects:**` line; throws `UpgradeAffectsError` on a malformed one. */
|
|
57
|
+
export declare function parseAffectsLine(line: string): UpgradeAffectsTarget[];
|
|
58
|
+
//# sourceMappingURL=upgrade-affects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-affects.d.ts","sourceRoot":"","sources":["../../src/internal/upgrade-affects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,sEAAsE;AACtE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,2EAA2E;AAC3E,MAAM,MAAM,oBAAoB,GAC5B;IACE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACpD,GACD;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAEjE,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAOD,yEAAyE;AACzE,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAkB,IAAI,yBAAyB;CAChD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,EAAE,CA6BxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiBtE;AAyDD,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAGrE"}
|
|
@@ -7,11 +7,31 @@
|
|
|
7
7
|
* consumer recovers the plan without cloning the repository or being told the
|
|
8
8
|
* range by whoever cut the release.
|
|
9
9
|
*/
|
|
10
|
+
import { type UpgradeAffectsTarget } from './upgrade-affects.js';
|
|
11
|
+
/** One breaking item of a release, with its machine line when it declares one. */
|
|
12
|
+
export interface UpgradeBreakingItem {
|
|
13
|
+
version: string;
|
|
14
|
+
/** The backticked entrypoints the item leads with. */
|
|
15
|
+
entrypoints: string[];
|
|
16
|
+
/** The item's bold title, or its first line. */
|
|
17
|
+
title: string;
|
|
18
|
+
/** What the item touches; `undefined` for an item written before the `**Affects:**` line. */
|
|
19
|
+
affects: UpgradeAffectsTarget[] | undefined;
|
|
20
|
+
/** The item's own `**Who must act:**`, or its section's. */
|
|
21
|
+
whoMustAct: string;
|
|
22
|
+
markdown: string;
|
|
23
|
+
}
|
|
10
24
|
export interface UpgradeBreakingChange {
|
|
11
25
|
version: string;
|
|
12
26
|
whoMustAct: string;
|
|
13
27
|
markdown: string;
|
|
28
|
+
items: UpgradeBreakingItem[];
|
|
14
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The heading that marks a changelog section as breaking. The release gate and `stitchkit upgrade`
|
|
32
|
+
* read it through this one expression, so a heading one accepts is a heading the other finds.
|
|
33
|
+
*/
|
|
34
|
+
export declare const BREAKING_HEADING: RegExp;
|
|
15
35
|
/** Extract every breaking section crossed by an exact `from` (exclusive) → `to` (inclusive) upgrade. */
|
|
16
36
|
export declare function planUpgrade(changelog: string, from: string, to: string): UpgradeBreakingChange[];
|
|
17
37
|
export declare function renderUpgradePlan(changes: readonly UpgradeBreakingChange[], from: string, to: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-plan.d.ts","sourceRoot":"","sources":["../../src/internal/upgrade-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"upgrade-plan.d.ts","sourceRoot":"","sources":["../../src/internal/upgrade-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,6FAA6F;IAC7F,OAAO,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAC;IAC5C,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AA2EzE,wGAAwG;AACxG,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,qBAAqB,EAAE,CAgCzB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,MAAM,CASR"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a breaking item touches one project: the plan's `**Affects:**` lines
|
|
3
|
+
* against the names the project imports from `stitchkit`.
|
|
4
|
+
*
|
|
5
|
+
* Pure over source text. The scanner reads static `import`/`export … from`
|
|
6
|
+
* declarations at a statement start (named, aliased, `type`, default, namespace,
|
|
7
|
+
* `export *`), bare imports, and `import()` / `require()` of a literal specifier,
|
|
8
|
+
* and the script blocks of `.vue` and `.svelte` files. Comments and the contents
|
|
9
|
+
* of strings and templates are blanked first, so a commented-out import or one
|
|
10
|
+
* written inside a string is not a use; it does not evaluate code, so a
|
|
11
|
+
* specifier built at run time is invisible to it, and a regular-expression literal that holds a
|
|
12
|
+
* quote or a comment marker can hide what follows it.
|
|
13
|
+
*/
|
|
14
|
+
import type { UpgradeAffectsTarget } from './upgrade-affects.js';
|
|
15
|
+
import type { UpgradeBreakingItem } from './upgrade-plan.js';
|
|
16
|
+
/** One project file, by a path relative to the project root. */
|
|
17
|
+
export interface ProjectSource {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly text: string;
|
|
20
|
+
}
|
|
21
|
+
/** One name a file imports from one stitchkit entrypoint; `*` for a namespace, star or dynamic import. */
|
|
22
|
+
export interface StitchkitImport {
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly line: number;
|
|
25
|
+
readonly entrypoint: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
}
|
|
28
|
+
export type UpgradeVerdict = {
|
|
29
|
+
readonly kind: 'affects';
|
|
30
|
+
readonly uses: readonly StitchkitImport[];
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'not-used';
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: 'behavioural';
|
|
35
|
+
readonly files: readonly string[];
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'not-declared';
|
|
38
|
+
readonly files: readonly string[];
|
|
39
|
+
};
|
|
40
|
+
export interface UpgradeItemVerdict {
|
|
41
|
+
readonly item: UpgradeBreakingItem;
|
|
42
|
+
readonly verdict: UpgradeVerdict;
|
|
43
|
+
}
|
|
44
|
+
/** Every name the given sources import from a `stitchkit` entrypoint. */
|
|
45
|
+
export declare function scanStitchkitImports(sources: readonly ProjectSource[]): StitchkitImport[];
|
|
46
|
+
/** One verdict per item, in plan order. */
|
|
47
|
+
export declare function upgradeVerdicts(items: readonly UpgradeBreakingItem[], imports: readonly StitchkitImport[]): UpgradeItemVerdict[];
|
|
48
|
+
/** The verdicts as the Markdown section `stitchkit upgrade` prints after the plan. */
|
|
49
|
+
export declare function renderUpgradeVerdicts(verdicts: readonly UpgradeItemVerdict[]): string;
|
|
50
|
+
/** The verdicts as the `--json` document's items. */
|
|
51
|
+
export declare function upgradeVerdictsJson(verdicts: readonly UpgradeItemVerdict[]): {
|
|
52
|
+
version: string;
|
|
53
|
+
entrypoints: string[];
|
|
54
|
+
title: string;
|
|
55
|
+
whoMustAct: string;
|
|
56
|
+
affects: UpgradeAffectsTarget[] | null;
|
|
57
|
+
verdict: "affects" | "behavioural" | "not-declared" | "not-used";
|
|
58
|
+
uses?: readonly StitchkitImport[] | undefined;
|
|
59
|
+
files?: readonly string[] | undefined;
|
|
60
|
+
}[];
|
|
61
|
+
//# sourceMappingURL=upgrade-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-usage.d.ts","sourceRoot":"","sources":["../../src/internal/upgrade-usage.ts"],"names":[],"mappings":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E,SAAS,eAAe,EAAE,GAClC,kBAAkB,EAAE,CAiBtB;AASD,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,MAAM,CAoBrF;AAED,qDAAqD;AACrD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE;;;;;;;;;IAa1E"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Telegram's own structured answer, because `classifyTelegramSendFailure`
|
|
8
8
|
* reads `error_code` and `parameters.retry_after` before it ever reads prose.
|
|
9
9
|
*/
|
|
10
|
+
import type { TelegramFetch } from './transport.js';
|
|
10
11
|
/**
|
|
11
12
|
* The secret half of a bot token — what follows the bot's numeric id and the
|
|
12
13
|
* colon. The id stays readable: it is the bot's public user id, and the only
|
|
@@ -40,14 +41,19 @@ export interface TelegramBotApiCall {
|
|
|
40
41
|
/** A local Bot API server, e.g. `http://127.0.0.1:8081`. Default: Telegram's. */
|
|
41
42
|
readonly apiRoot?: string;
|
|
42
43
|
readonly signal?: AbortSignal;
|
|
43
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Default: the global `fetch`. `createTelegramBotTransport()` separates a request that never
|
|
46
|
+
* left (`TelegramNotDispatchedError`, safe to repeat) from one whose outcome is unknown.
|
|
47
|
+
*/
|
|
48
|
+
readonly fetch?: TelegramFetch;
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* Call one Bot API method and return its `result`.
|
|
47
52
|
*
|
|
48
|
-
* A refusal throws `TelegramBotApiError`; a
|
|
49
|
-
*
|
|
50
|
-
*
|
|
53
|
+
* A refusal throws `TelegramBotApiError`; a request that never left throws the
|
|
54
|
+
* transport's `TelegramNotDispatchedError` unchanged; any other transport failure
|
|
55
|
+
* throws an error whose message names the method and never the URL, since the URL
|
|
56
|
+
* holds the token.
|
|
51
57
|
*/
|
|
52
58
|
export declare function callTelegramBotApi(call: TelegramBotApiCall): Promise<unknown>;
|
|
53
59
|
//# sourceMappingURL=bot-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-api.d.ts","sourceRoot":"","sources":["../../src/telegram/bot-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAyB,CAAC;AAEnE,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAID,gFAAgF;AAChF,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAE7F,YACE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;KAChD,EAQF;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"bot-api.d.ts","sourceRoot":"","sources":["../../src/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AC,OAAO,CAAC,CAyCnF"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { TelegramBroadcastFailure } from './broadcast-failure.js';
|
|
17
17
|
import { type TelegramBroadcastRecipient } from './broadcast-state.js';
|
|
18
|
+
import type { TelegramFetch } from './transport.js';
|
|
18
19
|
export type { TelegramBroadcastOutcome, TelegramBroadcastRecipient } from './broadcast-state.js';
|
|
19
20
|
export interface TelegramBroadcastSend {
|
|
20
21
|
readonly recipient: TelegramBroadcastRecipient;
|
|
@@ -91,7 +92,7 @@ export interface TelegramBroadcastSenderConfig {
|
|
|
91
92
|
readonly token: string;
|
|
92
93
|
readonly message: TelegramBroadcastMessage;
|
|
93
94
|
readonly apiRoot?: string;
|
|
94
|
-
readonly fetch?:
|
|
95
|
+
readonly fetch?: TelegramFetch;
|
|
95
96
|
}
|
|
96
97
|
/** The standard `send`: `sendMessage` or `copyMessage` through the Bot API, no bot library. */
|
|
97
98
|
export declare function telegramBroadcastSender(config: TelegramBroadcastSenderConfig): TelegramBroadcastConfig['send'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/telegram/broadcast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EASL,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/telegram/broadcast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EASL,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,YAAY,EAAE,wBAAwB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B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAED,+FAA+F;AAC/F,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,6BAA6B,GACpC,uBAAuB,CAAC,MAAM,CAAC,CAyBjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a Bot API request stopped before any byte of it was written: the address lookup, the
|
|
3
|
+
* connection, or the request itself (a body that could not be read).
|
|
4
|
+
*/
|
|
5
|
+
export type TelegramNotDispatchedStage = 'lookup' | 'connect' | 'request';
|
|
6
|
+
/**
|
|
7
|
+
* The request provably never reached Telegram, so sending it again cannot duplicate a message.
|
|
8
|
+
* Thrown only before the first byte is written; any failure after that is an ordinary error,
|
|
9
|
+
* because the request may have arrived. Its message names no address that carries the token.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TelegramNotDispatchedError extends Error {
|
|
12
|
+
readonly stage: TelegramNotDispatchedStage;
|
|
13
|
+
readonly name = "TelegramNotDispatchedError";
|
|
14
|
+
readonly code = "TELEGRAM_NOT_DISPATCHED";
|
|
15
|
+
constructor(stage: TelegramNotDispatchedStage, message: string, options?: {
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This error, whichever copy of the package made it: its name and code identify it. Only this
|
|
21
|
+
* error is known to carry no address, so it is the one a sender passes through unchanged.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isTelegramNotDispatchedError(error: unknown): error is TelegramNotDispatchedError;
|
|
24
|
+
/** Whether `error`, or an error it wraps, is a request that never left. */
|
|
25
|
+
export declare function isTelegramNotDispatched(error: unknown, depth?: number): boolean;
|
|
26
|
+
//# sourceMappingURL=not-dispatched.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-dispatched.d.ts","sourceRoot":"","sources":["../../src/telegram/not-dispatched.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAE1E;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IAIjD,QAAQ,CAAC,KAAK,EAAE,0BAA0B;IAH5C,SAAkB,IAAI,gCAAgC;IACtD,QAAQ,CAAC,IAAI,6BAA6B;IAC1C,YACW,KAAK,EAAE,0BAA0B,EAC1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAG9B;CACF;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,0BAA0B,CAOrC;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAO1E"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { type TelegramOperatorDedupe } from './operator-dedupe.js';
|
|
17
17
|
import { type TelegramSendFailure } from './send-failure.js';
|
|
18
|
+
import type { TelegramFetch } from './transport.js';
|
|
18
19
|
export type TelegramChatId = number | string;
|
|
19
20
|
export interface TelegramOperatorMessage {
|
|
20
21
|
readonly chatId: TelegramChatId;
|
|
@@ -83,7 +84,7 @@ export interface TelegramOperatorSenderConfig {
|
|
|
83
84
|
readonly apiRoot?: string;
|
|
84
85
|
/** Default: plain text, so an operator message never fails on entity parsing. */
|
|
85
86
|
readonly parseMode?: 'HTML' | 'MarkdownV2';
|
|
86
|
-
readonly fetch?:
|
|
87
|
+
readonly fetch?: TelegramFetch;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
90
|
* The standard `send`: `sendMessage` through the Bot API, no bot library. With
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-channel.d.ts","sourceRoot":"","sources":["../../src/telegram/operator-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAgC,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAA+B,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"operator-channel.d.ts","sourceRoot":"","sources":["../../src/telegram/operator-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAgC,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAA+B,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;AAyB7C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM,SAAS,MAAM;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAED,MAAM,WAAW,6BAA6B,CAAC,MAAM,SAAS,MAAM;IAClE,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,O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AI,CAAC;CACf;AAeD,wBAAgB,6BAA6B,CAAC,MAAM,SAAS,MAAM,GAAG,KAAK,EACzE,MAAM,EAAE,6BAA6B,CAAC,MAAM,CAAC,GAC5C,uBAAuB,CAAC,MAAM,CAAC,CA+JjC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC;AAaD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,4BAA4B,GACnC,6BAA6B,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAkB/C"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* chat Telegram does not know is usually a bad identifier on our side — a
|
|
32
32
|
* defect in our data, not a fact about a person.
|
|
33
33
|
*/
|
|
34
|
-
export type TelegramSendFailureReason = 'blocked-by-user' | 'user-deactivated' | 'chat-not-found' | 'not-started' | 'rate-limited' | 'message-invalid' | 'server-error' | 'unknown';
|
|
34
|
+
export type TelegramSendFailureReason = 'blocked-by-user' | 'user-deactivated' | 'chat-not-found' | 'not-started' | 'rate-limited' | 'message-invalid' | 'server-error' | 'not-dispatched' | 'unknown';
|
|
35
35
|
export interface TelegramSendFailure {
|
|
36
36
|
reason: TelegramSendFailureReason;
|
|
37
37
|
/** Telegram's `error_code`, when the failure carried one. */
|
|
@@ -59,9 +59,10 @@ export interface TelegramSendFailure {
|
|
|
59
59
|
/**
|
|
60
60
|
* How the reason was reached. `parameters` and `status` are Telegram stating
|
|
61
61
|
* its own answer in a structured field; `description` is us reading its
|
|
62
|
-
* prose, which changes without notice
|
|
62
|
+
* prose, which changes without notice; `transport` is the transport stating
|
|
63
|
+
* that the request never left (`TelegramNotDispatchedError`).
|
|
63
64
|
*/
|
|
64
|
-
evidence: 'parameters' | 'status' | 'description' | 'none';
|
|
65
|
+
evidence: 'parameters' | 'status' | 'description' | 'transport' | 'none';
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Every reason, for a consumer that maps each one to its own code or text. A
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-failure.d.ts","sourceRoot":"","sources":["../../src/telegram/send-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"send-failure.d.ts","sourceRoot":"","sources":["../../src/telegram/send-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GACjC,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,yBAAyB,CAAC;IAClC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,YAAY,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;CAC1E;AA+CD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,yBAAyB,EAC7B,CAAC;AAyClD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CA4D/E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,OAAO,CAAC;AAeZ,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAM/E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a Node `net.Socket` / `tls.TLSSocket` the transport uses, so its declarations need
|
|
3
|
+
* no Node types. A socket emits `connect` (or `secureConnect` when `encrypted`), `data`, `end`,
|
|
4
|
+
* `close` and `error`.
|
|
5
|
+
*/
|
|
6
|
+
export interface TelegramBotTransportSocket {
|
|
7
|
+
readonly encrypted?: boolean;
|
|
8
|
+
once(event: 'connect' | 'secureConnect' | 'end' | 'close', listener: () => void): unknown;
|
|
9
|
+
once(event: 'error', listener: (error: Error) => void): unknown;
|
|
10
|
+
on(event: 'data', listener: (chunk: Uint8Array) => void): unknown;
|
|
11
|
+
write(data: Uint8Array): unknown;
|
|
12
|
+
destroy(): unknown;
|
|
13
|
+
}
|
|
14
|
+
/** Opens one socket to one address; `servername` is set for TLS to a host name. */
|
|
15
|
+
export type TelegramBotTransportOpen = (target: {
|
|
16
|
+
readonly address: string;
|
|
17
|
+
readonly port: number;
|
|
18
|
+
readonly tls: boolean;
|
|
19
|
+
readonly servername: string | undefined;
|
|
20
|
+
}) => TelegramBotTransportSocket;
|
|
21
|
+
/** Every address of a host, in the system resolver's order. */
|
|
22
|
+
export type TelegramBotTransportResolve = (host: string) => Promise<readonly string[]>;
|
|
23
|
+
export interface TelegramConnectPolicy {
|
|
24
|
+
readonly resolve: TelegramBotTransportResolve;
|
|
25
|
+
readonly open: TelegramBotTransportOpen;
|
|
26
|
+
/** Real milliseconds one round waits for a connection. */
|
|
27
|
+
readonly attemptMs: number;
|
|
28
|
+
/** Real milliseconds after which no new connection round starts. */
|
|
29
|
+
readonly budgetMs: number;
|
|
30
|
+
}
|
|
31
|
+
export declare const resolveAll: TelegramBotTransportResolve;
|
|
32
|
+
export declare const openSocket: TelegramBotTransportOpen;
|
|
33
|
+
/**
|
|
34
|
+
* A connected socket to `host`, or `TelegramNotDispatchedError`: nothing has been written yet,
|
|
35
|
+
* so every failure here leaves the request unsent. An abort rejects with the signal's reason.
|
|
36
|
+
*/
|
|
37
|
+
export declare function establish(host: string, port: number, tls: boolean, policy: TelegramConnectPolicy, signal: AbortSignal | undefined): Promise<TelegramBotTransportSocket>;
|
|
38
|
+
//# sourceMappingURL=transport-connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-connect.d.ts","sourceRoot":"","sources":["../../src/telegram/transport-connect.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,eAAe,GAAG,KAAK,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;IAC1F,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC;IAChE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC;IAClE,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IACjC,OAAO,IAAI,OAAO,CAAC;CACpB;AAED,mFAAmF;AACnF,MAAM,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,KAAK,0BAA0B,CAAC;AAEjC,+DAA+D;AAC/D,MAAM,MAAM,2BAA2B,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;AAEvF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAOD,eAAO,MAAM,UAAU,EAAE,2BAC0D,CAAC;AAEpF,eAAO,MAAM,UAAU,EAAE,wBAQgB,CAAC;AAkG1C;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,0BAA0B,CAAC,CAuCrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Bot API transport that knows whether its request left.
|
|
3
|
+
*
|
|
4
|
+
* `fetch` folds establishing the connection and waiting for the answer into one failure, and
|
|
5
|
+
* from that failure nobody can say whether Telegram saw the message. A sender that must never
|
|
6
|
+
* duplicate a message then treats every network failure as "maybe delivered" and never repeats
|
|
7
|
+
* it, so a route that only sometimes fails to connect loses messages outright.
|
|
8
|
+
*
|
|
9
|
+
* This transport connects first and writes the request only on an established connection.
|
|
10
|
+
* Until the first byte is written, every failure is `TelegramNotDispatchedError`: the request
|
|
11
|
+
* certainly did not leave and repeating it is safe. After that, a failure is an ordinary error,
|
|
12
|
+
* because the request may have arrived. Addresses come in the system resolver's order with no
|
|
13
|
+
* family forced; the next address starts after a short delay (Happy Eyeballs), and a round with
|
|
14
|
+
* no connection is repeated with new sockets inside a bounded budget.
|
|
15
|
+
*/
|
|
16
|
+
import { type TelegramBotTransportOpen, type TelegramBotTransportResolve } from './transport-connect.js';
|
|
17
|
+
export type { TelegramBotTransportOpen, TelegramBotTransportResolve, TelegramBotTransportSocket, } from './transport-connect.js';
|
|
18
|
+
/** What the Bot API senders call: a URL and a request, answered by a `Response`. */
|
|
19
|
+
export type TelegramFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
20
|
+
export interface TelegramBotTransportOptions {
|
|
21
|
+
/** Real milliseconds one connection round waits. Default 2000: one kernel SYN retry fits. */
|
|
22
|
+
readonly connectAttemptMs?: number;
|
|
23
|
+
/** Real milliseconds after which no new connection round starts. Default 5000. */
|
|
24
|
+
readonly connectBudgetMs?: number;
|
|
25
|
+
/** Real milliseconds from the written request to the end of the answer. Default 30 000. */
|
|
26
|
+
readonly responseTimeoutMs?: number;
|
|
27
|
+
/** Largest answer read, in bytes. Default 1 MiB. */
|
|
28
|
+
readonly maxResponseBytes?: number;
|
|
29
|
+
/** Address lookup. Default: the system resolver, every address in its order. */
|
|
30
|
+
readonly resolve?: TelegramBotTransportResolve;
|
|
31
|
+
/** Socket factory. Default: TLS (ALPN `http/1.1`) for `https:`, plain TCP for `http:`. */
|
|
32
|
+
readonly open?: TelegramBotTransportOpen;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A `fetch` for the Bot API senders (`callTelegramBotApi`, `telegramBroadcastSender`,
|
|
36
|
+
* `telegramOperatorSender`) that separates "not sent" from "unknown". Pass it as their `fetch`:
|
|
37
|
+
* a failure before the request is written throws `TelegramNotDispatchedError`, which
|
|
38
|
+
* `classifyTelegramSendFailure` reads as `not-dispatched` (retryable); any later failure stays
|
|
39
|
+
* an outcome nobody can know. Speaks HTTP/1.1 over `https:` (and `http:` for a local Bot API
|
|
40
|
+
* server); it does not use a proxy.
|
|
41
|
+
*/
|
|
42
|
+
export declare function createTelegramBotTransport(options?: TelegramBotTransportOptions): TelegramFetch;
|
|
43
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/telegram/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAEjC,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAElF,MAAM,WAAW,2BAA2B;IAC1C,6FAA6F;IAC7F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,kFAAkF;IAClF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,2FAA2F;IAC3F,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,oDAAoD;IACpD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC;IAC/C,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,CAAC,EAAE,wBAAwB,CAAC;CAC1C;AA+MD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,2BAAgC,GACxC,aAAa,CAyCf"}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* recovered from it. Errors and reports name hosts only — a foreign webhook's
|
|
19
19
|
* path may itself be a secret.
|
|
20
20
|
*/
|
|
21
|
+
import type { TelegramFetch } from './transport.js';
|
|
21
22
|
/** `takeoverFrom` when there is no webhook to take over — the bot polls, or is new. */
|
|
22
23
|
export declare const TELEGRAM_WEBHOOK_NONE = "none";
|
|
23
24
|
export interface TelegramWebhookConfig {
|
|
@@ -28,7 +29,7 @@ export interface TelegramWebhookConfig {
|
|
|
28
29
|
readonly secret: string;
|
|
29
30
|
/** A local Bot API server. Default: Telegram's. */
|
|
30
31
|
readonly apiRoot?: string;
|
|
31
|
-
readonly fetch?:
|
|
32
|
+
readonly fetch?: TelegramFetch;
|
|
32
33
|
readonly signal?: AbortSignal;
|
|
33
34
|
}
|
|
34
35
|
export interface ClaimTelegramWebhookConfig extends TelegramWebhookConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/telegram/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/telegram/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,2CAA2C;IAC3C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,oFAA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,CAAC,CAS/B;AAED,+EAA+E;AAC/E,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAE5E,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtE;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,QAAQ,CAAC,CAUnB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual time for tests of schedules, retries and deadlines.
|
|
3
|
+
*
|
|
4
|
+
* Time stands still until the test moves it, and due timers fire strictly in deadline order
|
|
5
|
+
* (ties in scheduling order), so "retry after 5 s" runs in milliseconds and the same way every
|
|
6
|
+
* time. It satisfies every timer boundary Stitchkit accepts: `ManagedScheduleClock`,
|
|
7
|
+
* `DurabilityClock`, `RevisionSignalClock` and `BoundedAdmissionClock`.
|
|
8
|
+
*
|
|
9
|
+
* Between firings the clock yields to the **real event loop** (`setImmediate` turns), not just to
|
|
10
|
+
* microtasks: an async continuation that schedules the next timer often waits on I/O (a socket,
|
|
11
|
+
* a file), and without a real turn `advance(10_000)` would skip a retry the code meant to arm at
|
|
12
|
+
* the fifth second. When the work in flight has no bounded length (a request over a socket, a
|
|
13
|
+
* hash in a thread pool), the code under test `hold`s the clock for its duration; the clock does
|
|
14
|
+
* not move while a hold is open and waits for it in real time, up to `holdLimitMs`, then fails
|
|
15
|
+
* naming every open hold. A held operation that itself waits for the clock (a deadline it is
|
|
16
|
+
* timing out on) `park`s its hold, or the deadline it waits for would never come.
|
|
17
|
+
*/
|
|
18
|
+
/** Cancels one scheduled callback; calling it again is harmless. */
|
|
19
|
+
export interface ManualClockTimer {
|
|
20
|
+
cancel(): void;
|
|
21
|
+
}
|
|
22
|
+
/** An open hold: the clock stays where it is until `release`, unless the hold is parked. */
|
|
23
|
+
export interface ManualClockHold {
|
|
24
|
+
/** Ends the hold. */
|
|
25
|
+
release(): void;
|
|
26
|
+
/** The held work now waits for the clock itself; returns the function that ends the park. */
|
|
27
|
+
park(): () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface ManualClockOptions {
|
|
30
|
+
/** Monotonic start, in milliseconds. Default `0`. */
|
|
31
|
+
readonly startMs?: number;
|
|
32
|
+
/** Wall-clock instant at `startMs`. Default `2026-01-01T00:00:00.000Z`. */
|
|
33
|
+
readonly wallStart?: Date;
|
|
34
|
+
/** Real event-loop turns yielded after each firing. Default `8`. */
|
|
35
|
+
readonly yieldTurns?: number;
|
|
36
|
+
/** Real milliseconds the clock waits for open holds before failing. Default `5000`. */
|
|
37
|
+
readonly holdLimitMs?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface ManualClockUntilOptions {
|
|
40
|
+
/** Manual milliseconds per step while no timer is pending. Default `100`. */
|
|
41
|
+
readonly stepMs?: number;
|
|
42
|
+
/** Manual milliseconds after which `until` fails. Default `600_000`. */
|
|
43
|
+
readonly limitMs?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface ManualClock {
|
|
46
|
+
/** Monotonic milliseconds. */
|
|
47
|
+
now(): number;
|
|
48
|
+
/** The wall clock that moves with `now`. */
|
|
49
|
+
wallNow(): Date;
|
|
50
|
+
/** Runs `callback` once the clock reaches `now() + delayMs` (negative delays fire next). */
|
|
51
|
+
schedule(callback: () => void, delayMs: number): ManualClockTimer;
|
|
52
|
+
/**
|
|
53
|
+
* Moves time by `ms`, firing every timer due on the way in deadline order and yielding to the
|
|
54
|
+
* event loop after each, so a timer armed by a fired callback inside the window fires too.
|
|
55
|
+
* A callback that throws rejects `advance` with that error.
|
|
56
|
+
*/
|
|
57
|
+
advance(ms: number): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Moves time from deadline to deadline (by `stepMs` while nothing is pending) until `done()`
|
|
60
|
+
* holds; resolves with the manual milliseconds that took. Fails with `MANUAL_CLOCK_LIMIT`
|
|
61
|
+
* once `limitMs` of manual time pass, naming how many timers are pending.
|
|
62
|
+
*/
|
|
63
|
+
until(done: () => boolean, options?: ManualClockUntilOptions): Promise<number>;
|
|
64
|
+
/** How many timers wait. A timer leaked past a component's `close()` shows here. */
|
|
65
|
+
pending(): number;
|
|
66
|
+
/** Holds time while unbounded real work runs; `reason` names it if the hold outlives the limit. */
|
|
67
|
+
hold(reason: string): ManualClockHold;
|
|
68
|
+
}
|
|
69
|
+
/** `MANUAL_CLOCK_HOLD_TIMEOUT`: open holds outlived `holdLimitMs`; `MANUAL_CLOCK_LIMIT`: `until` ran out. */
|
|
70
|
+
export type ManualClockErrorCode = 'MANUAL_CLOCK_HOLD_TIMEOUT' | 'MANUAL_CLOCK_LIMIT';
|
|
71
|
+
/** A manual clock refused to go on; the message and `holds` name what did not finish. */
|
|
72
|
+
export declare class ManualClockError extends Error {
|
|
73
|
+
readonly code: ManualClockErrorCode;
|
|
74
|
+
/** Reasons of the open, unparked holds (`MANUAL_CLOCK_HOLD_TIMEOUT` only). */
|
|
75
|
+
readonly holds: readonly string[];
|
|
76
|
+
readonly name = "ManualClockError";
|
|
77
|
+
constructor(code: ManualClockErrorCode, message: string,
|
|
78
|
+
/** Reasons of the open, unparked holds (`MANUAL_CLOCK_HOLD_TIMEOUT` only). */
|
|
79
|
+
holds?: readonly string[]);
|
|
80
|
+
}
|
|
81
|
+
export declare function createManualClock(options?: ManualClockOptions): ManualClock;
|
|
82
|
+
//# sourceMappingURL=manual-clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manual-clock.d.ts","sourceRoot":"","sources":["../../src/testing/manual-clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,IAAI,IAAI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