@wrongstack/telegram 0.286.0 → 0.289.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/README.md +24 -18
- package/dist/api-client.d.ts +119 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/bot-queue.d.ts +27 -0
- package/dist/bot-queue.d.ts.map +1 -0
- package/dist/bot.d.ts +50 -67
- package/dist/bot.d.ts.map +1 -1
- package/dist/config-classifier.d.ts +64 -0
- package/dist/config-classifier.d.ts.map +1 -0
- package/dist/config.d.ts +45 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/inbox-cursor-store.d.ts +54 -0
- package/dist/inbox-cursor-store.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1254 -415
- package/dist/index.js.map +4 -4
- package/dist/offset-store.d.ts +40 -0
- package/dist/offset-store.d.ts.map +1 -0
- package/dist/outbound-queue.d.ts +52 -0
- package/dist/outbound-queue.d.ts.map +1 -0
- package/dist/security/outbound.d.ts +25 -0
- package/dist/security/outbound.d.ts.map +1 -0
- package/dist/slash-commands/index.d.ts +8 -2
- package/dist/slash-commands/index.d.ts.map +1 -1
- package/dist/tools/telegram-approve.d.ts +15 -3
- package/dist/tools/telegram-approve.d.ts.map +1 -1
- package/dist/tools/telegram-send.d.ts +6 -4
- package/dist/tools/telegram-send.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Default inbox cursor path. */
|
|
2
|
+
export declare function inboxCursorPath(token: string, chatId: string | number, globalRoot?: string): string;
|
|
3
|
+
export interface InboxCursorStoreOptions {
|
|
4
|
+
/** Bot token — derives a token-scoped default path. Never persisted. */
|
|
5
|
+
token?: string | undefined;
|
|
6
|
+
/** Explicit file path override. An empty string disables persistence. */
|
|
7
|
+
path?: string | undefined;
|
|
8
|
+
/** Base directory for token-scoped derivation. */
|
|
9
|
+
globalRoot?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class InboxCursorStore {
|
|
12
|
+
private readonly path;
|
|
13
|
+
constructor(opts?: InboxCursorStoreOptions);
|
|
14
|
+
get storePath(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Read the persisted offset. Returns null when the file is missing,
|
|
17
|
+
* empty, or contains a value that is not a valid non-negative integer.
|
|
18
|
+
*/
|
|
19
|
+
read(): number | null;
|
|
20
|
+
/**
|
|
21
|
+
* Persist an offset using an atomic write (temp + fsync + rename).
|
|
22
|
+
* Creates the parent directory on first call.
|
|
23
|
+
*
|
|
24
|
+
* P1.6 semantics: commit only on progress. offset = 0 means "never
|
|
25
|
+
* advanced past the initial state", so writing 0 would re-play the
|
|
26
|
+
* entire inbox on the next poll — we no-op it.
|
|
27
|
+
*/
|
|
28
|
+
write(offset: number): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Per-inbox cursor map: chatId -> PersistedInboxCursor.
|
|
32
|
+
*
|
|
33
|
+
* The map is built by passing an `inboxId` to each operation, so a single
|
|
34
|
+
* store instance can drive an arbitrary number of inboxes; each one is
|
|
35
|
+
* isolated on disk and on the wire (the Telegram long-poll returns all
|
|
36
|
+
* messages globally, so the bot must also commit per-inbox deltas to
|
|
37
|
+
* maintain the replay boundary).
|
|
38
|
+
*/
|
|
39
|
+
export declare class PerInboxCursorMap {
|
|
40
|
+
private readonly basePath;
|
|
41
|
+
private readonly stores;
|
|
42
|
+
constructor(token: string, globalRoot?: string);
|
|
43
|
+
private readonly token;
|
|
44
|
+
private storeFor;
|
|
45
|
+
/** Read the offset for `inboxId`. Returns null when no offset is persisted. */
|
|
46
|
+
read(inboxId: string): number | null;
|
|
47
|
+
/** Persist the offset for `inboxId`. */
|
|
48
|
+
write(inboxId: string, offset: number): void;
|
|
49
|
+
/** Drop the cached store for `inboxId` (next read/write will reload from disk). */
|
|
50
|
+
invalidate(inboxId: string): void;
|
|
51
|
+
/** Drop all cached stores. */
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=inbox-cursor-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-cursor-store.d.ts","sourceRoot":"","sources":["../src/inbox-cursor-store.ts"],"names":[],"mappings":"AAiCA,iCAAiC;AACjC,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,SAAqB,GAC9B,MAAM,CAER;AAED,MAAM,WAAW,uBAAuB;IACtC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAE9B,YAAY,IAAI,GAAE,uBAA4B,EAQ7C;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;OAGG;IACH,IAAI,IAAI,MAAM,GAAG,IAAI,CAuBpB;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAoB1B;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE,YAAY,KAAK,EAAE,MAAM,EAAE,UAAU,SAAqB,EAOzD;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B,OAAO,CAAC,QAAQ;IAehB,+EAA+E;IAC/E,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnC;IAED,wCAAwC;IACxC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAE3C;IAED,mFAAmF;IACnF,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED,8BAA8B;IAC9B,KAAK,IAAI,IAAI,CAEZ;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { Plugin } from '@wrongstack/core';
|
|
2
|
+
import { TelegramBot } from './bot.js';
|
|
3
|
+
import { TelegramBotOutbound } from './bot-queue.js';
|
|
4
|
+
interface RuntimeState {
|
|
5
|
+
bot: TelegramBot;
|
|
6
|
+
outbound: TelegramBotOutbound;
|
|
7
|
+
cleanups: Array<() => void>;
|
|
8
|
+
}
|
|
9
|
+
declare let teardownState: RuntimeState | null;
|
|
2
10
|
declare const plugin: Plugin;
|
|
3
11
|
export default plugin;
|
|
12
|
+
export { teardownState };
|
|
4
13
|
export type { TelegramIncomingMessage } from './bot.js';
|
|
5
14
|
export type { TelegramPluginConfig } from './config.js';
|
|
6
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,MAAM,EAA2B,MAAM,kBAAkB,CAAC;AAGxF,OAAO,EAAE,WAAW,EAAuB,MAAM,UAAU,CAAC;AAS5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAuBrD,UAAU,YAAY;IACpB,GAAG,EAAE,WAAW,CAAC;IACjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;CAC7B;AAED,QAAA,IAAI,aAAa,EAAE,YAAY,GAAG,IAAW,CAAC;AA+F9C,QAAA,MAAM,MAAM,EAAE,MA6Rb,CAAC;eAEa,MAAM;AAGrB,OAAO,EAAE,aAAa,EAAE,CAAC;AAGzB,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|