easy-ping 0.6.1 → 0.8.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.
Files changed (82) hide show
  1. package/README.md +24 -4
  2. package/dist/{adapter-D3lTy-4E.d.cts → adapter-CV5Yt2c6.d.cts} +1 -1
  3. package/dist/{adapter-D3lTy-4E.d.ts → adapter-CV5Yt2c6.d.ts} +1 -1
  4. package/dist/adapters/drizzle.d.cts +1 -1
  5. package/dist/adapters/drizzle.d.ts +1 -1
  6. package/dist/adapters/mongodb.d.cts +2 -2
  7. package/dist/adapters/mongodb.d.ts +2 -2
  8. package/dist/adapters/mysql.d.cts +2 -2
  9. package/dist/adapters/mysql.d.ts +2 -2
  10. package/dist/adapters/postgres.d.cts +2 -2
  11. package/dist/adapters/postgres.d.ts +2 -2
  12. package/dist/adapters/sqlite.d.cts +2 -2
  13. package/dist/adapters/sqlite.d.ts +2 -2
  14. package/dist/chunk-R3BE67L7.js +13 -0
  15. package/dist/chunk-R3BE67L7.js.map +1 -0
  16. package/dist/chunk-SSHVZHSJ.js +100 -0
  17. package/dist/chunk-SSHVZHSJ.js.map +1 -0
  18. package/dist/client.cjs +7 -2
  19. package/dist/client.cjs.map +1 -1
  20. package/dist/client.js +7 -2
  21. package/dist/client.js.map +1 -1
  22. package/dist/index.d.cts +4 -4
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.js +2 -11
  25. package/dist/index.js.map +1 -1
  26. package/dist/{plugin-CHd2ZiGC.d.cts → plugin-6S8tpH0n.d.cts} +1 -1
  27. package/dist/{plugin-Cg9usuUi.d.ts → plugin-C4fikLl7.d.ts} +1 -1
  28. package/dist/plugins/digests.d.cts +2 -2
  29. package/dist/plugins/digests.d.ts +2 -2
  30. package/dist/plugins/mobile-push.cjs +307 -0
  31. package/dist/plugins/mobile-push.cjs.map +1 -0
  32. package/dist/plugins/mobile-push.d.cts +117 -0
  33. package/dist/plugins/mobile-push.d.ts +117 -0
  34. package/dist/plugins/mobile-push.js +261 -0
  35. package/dist/plugins/mobile-push.js.map +1 -0
  36. package/dist/plugins/preferences-client.d.cts +2 -2
  37. package/dist/plugins/preferences-client.d.ts +2 -2
  38. package/dist/plugins/preferences-react.d.cts +1 -1
  39. package/dist/plugins/preferences-react.d.ts +1 -1
  40. package/dist/plugins/preferences.cjs +9 -1
  41. package/dist/plugins/preferences.cjs.map +1 -1
  42. package/dist/plugins/preferences.d.cts +2 -2
  43. package/dist/plugins/preferences.d.ts +2 -2
  44. package/dist/plugins/preferences.js +9 -1
  45. package/dist/plugins/preferences.js.map +1 -1
  46. package/dist/plugins/push.d.cts +2 -2
  47. package/dist/plugins/push.d.ts +2 -2
  48. package/dist/plugins/telegram.cjs +379 -0
  49. package/dist/plugins/telegram.cjs.map +1 -0
  50. package/dist/plugins/telegram.d.cts +153 -0
  51. package/dist/plugins/telegram.d.ts +153 -0
  52. package/dist/plugins/telegram.js +313 -0
  53. package/dist/plugins/telegram.js.map +1 -0
  54. package/dist/providers/expo-push.cjs +114 -0
  55. package/dist/providers/expo-push.cjs.map +1 -0
  56. package/dist/providers/expo-push.d.cts +61 -0
  57. package/dist/providers/expo-push.d.ts +61 -0
  58. package/dist/providers/expo-push.js +109 -0
  59. package/dist/providers/expo-push.js.map +1 -0
  60. package/dist/providers/telegram.cjs +103 -0
  61. package/dist/providers/telegram.cjs.map +1 -0
  62. package/dist/providers/telegram.d.cts +83 -0
  63. package/dist/providers/telegram.d.ts +83 -0
  64. package/dist/providers/telegram.js +3 -0
  65. package/dist/providers/telegram.js.map +1 -0
  66. package/dist/providers/web-push.d.cts +2 -2
  67. package/dist/providers/web-push.d.ts +2 -2
  68. package/dist/react-native.cjs +637 -0
  69. package/dist/react-native.cjs.map +1 -0
  70. package/dist/react-native.d.cts +145 -0
  71. package/dist/react-native.d.ts +145 -0
  72. package/dist/react-native.js +609 -0
  73. package/dist/react-native.js.map +1 -0
  74. package/dist/react.cjs +7 -2
  75. package/dist/react.cjs.map +1 -1
  76. package/dist/react.js +7 -2
  77. package/dist/react.js.map +1 -1
  78. package/dist/schema.d.cts +2 -2
  79. package/dist/schema.d.ts +2 -2
  80. package/dist/testing.d.cts +1 -1
  81. package/dist/testing.d.ts +1 -1
  82. package/package.json +38 -4
@@ -0,0 +1,83 @@
1
+ type TelegramButton = {
2
+ text: string;
3
+ url: string;
4
+ };
5
+ type TelegramMessage = {
6
+ chatId: string;
7
+ /** Telegram HTML: <b>, <i>, <a href>, <code>, <pre>. Escape user text with escapeHtml(). */
8
+ text: string;
9
+ buttons?: readonly TelegramButton[] | undefined;
10
+ signal?: AbortSignal | undefined;
11
+ };
12
+ type TelegramSendResult = {
13
+ ok: true;
14
+ messageId: number;
15
+ } | {
16
+ ok: false;
17
+ error: string;
18
+ /** Worth another attempt: rate limit, 5xx, network. */
19
+ retryable: boolean;
20
+ /** The chat can never receive again (user blocked the bot, chat deleted). Prune it. */
21
+ gone: boolean;
22
+ retryAfterSeconds?: number | undefined;
23
+ };
24
+ /** The slice of a Bot API update the plugin reads. Everything else passes through untouched. */
25
+ type TelegramUpdate = {
26
+ update_id: number;
27
+ message?: {
28
+ text?: string;
29
+ chat: {
30
+ id: number | string;
31
+ type: string;
32
+ username?: string;
33
+ title?: string;
34
+ };
35
+ from?: {
36
+ id: number;
37
+ username?: string;
38
+ first_name?: string;
39
+ };
40
+ };
41
+ my_chat_member?: {
42
+ chat: {
43
+ id: number | string;
44
+ type: string;
45
+ username?: string;
46
+ title?: string;
47
+ };
48
+ new_chat_member: {
49
+ status: string;
50
+ };
51
+ };
52
+ };
53
+ type TelegramProvider = {
54
+ name: string;
55
+ send(message: TelegramMessage): Promise<TelegramSendResult>;
56
+ /** Long-polls for updates. For development or hosts without a public URL. */
57
+ getUpdates(options: {
58
+ offset?: number | undefined;
59
+ timeoutSeconds?: number | undefined;
60
+ signal?: AbortSignal | undefined;
61
+ }): Promise<TelegramUpdate[]>;
62
+ /** Points Telegram at your webhook route. Run once per deployment URL. */
63
+ setWebhook(url: string, secretToken: string): Promise<void>;
64
+ deleteWebhook(): Promise<void>;
65
+ getMe(): Promise<{
66
+ id: number;
67
+ username: string;
68
+ }>;
69
+ };
70
+ type TelegramBotOptions = {
71
+ /** From @BotFather. Never appears in errors or logs. */
72
+ token: string;
73
+ fetch?: typeof globalThis.fetch | undefined;
74
+ /** Default https://api.telegram.org. A local fake for tests. */
75
+ apiBase?: string | undefined;
76
+ timeoutMs?: number | undefined;
77
+ };
78
+ /** Deep link that opens the bot with a start parameter. Codes are [A-Za-z0-9_-], at most 64 chars. */
79
+ declare const telegramStartLink: (botUsername: string, code: string) => string;
80
+ /** Bot API over fetch, so it runs on edge runtimes. Failures are classified, never thrown, on send. */
81
+ declare function telegramBot(options: TelegramBotOptions): TelegramProvider;
82
+
83
+ export { type TelegramBotOptions, type TelegramButton, type TelegramMessage, type TelegramProvider, type TelegramSendResult, type TelegramUpdate, telegramBot, telegramStartLink };
@@ -0,0 +1,3 @@
1
+ export { telegramBot, telegramStartLink } from '../chunk-SSHVZHSJ.js';
2
+ //# sourceMappingURL=telegram.js.map
3
+ //# sourceMappingURL=telegram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"telegram.js"}
@@ -1,6 +1,6 @@
1
1
  import { PushProvider } from '../plugins/push.cjs';
2
- import '../plugin-CHd2ZiGC.cjs';
3
- import '../adapter-D3lTy-4E.cjs';
2
+ import '../plugin-6S8tpH0n.cjs';
3
+ import '../adapter-CV5Yt2c6.cjs';
4
4
 
5
5
  /** The subscription itself is unusable. Distinct from a transport failure so the plugin prunes rather than retries. */
6
6
  declare class InvalidSubscriptionError extends Error {
@@ -1,6 +1,6 @@
1
1
  import { PushProvider } from '../plugins/push.js';
2
- import '../plugin-Cg9usuUi.js';
3
- import '../adapter-D3lTy-4E.js';
2
+ import '../plugin-C4fikLl7.js';
3
+ import '../adapter-CV5Yt2c6.js';
4
4
 
5
5
  /** The subscription itself is unusable. Distinct from a transport failure so the plugin prunes rather than retries. */
6
6
  declare class InvalidSubscriptionError extends Error {