@vvlad1973/telegram-bot-client 1.2.0 → 2.0.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 (66) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/README.md +300 -273
  3. package/dist/agents/LongPollingManager.d.ts +5 -6
  4. package/dist/agents/LongPollingManager.js +48 -46
  5. package/dist/agents/LongPollingManager.js.map +1 -1
  6. package/dist/agents/types/polling-manager.types.d.ts +4 -4
  7. package/dist/agents/workers/WorkerClientFactory.js +3 -3
  8. package/dist/agents/workers/WorkerClientFactory.js.map +1 -1
  9. package/dist/agents/workers/long-polling-worker-test.js +2 -1
  10. package/dist/agents/workers/long-polling-worker-test.js.map +1 -1
  11. package/dist/api/BaseTelegramApi.generated.js +481 -0
  12. package/dist/api/BaseTelegramApi.generated.js.map +1 -1
  13. package/dist/client/TelegramBotClient.d.ts +15 -4
  14. package/dist/client/TelegramBotClient.js +17 -4
  15. package/dist/client/TelegramBotClient.js.map +1 -1
  16. package/dist/client/index.d.ts +1 -1
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/managers/PollingIntegrationManager.d.ts +160 -0
  19. package/dist/client/managers/PollingIntegrationManager.js +274 -0
  20. package/dist/client/managers/PollingIntegrationManager.js.map +1 -0
  21. package/dist/client/managers/RouteConfigManager.d.ts +186 -0
  22. package/dist/client/managers/RouteConfigManager.js +395 -0
  23. package/dist/client/managers/RouteConfigManager.js.map +1 -0
  24. package/dist/client/managers/RouteLifecycleManager.d.ts +146 -0
  25. package/dist/client/managers/RouteLifecycleManager.js +402 -0
  26. package/dist/client/managers/RouteLifecycleManager.js.map +1 -0
  27. package/dist/client/managers/index.d.ts +11 -0
  28. package/dist/client/managers/index.js +10 -0
  29. package/dist/client/managers/index.js.map +1 -0
  30. package/dist/helpers/index.d.ts +1 -0
  31. package/dist/helpers/index.js +2 -0
  32. package/dist/helpers/index.js.map +1 -1
  33. package/dist/helpers/logger-helpers.d.ts +2 -5
  34. package/dist/helpers/logger-helpers.js +2 -10
  35. package/dist/helpers/logger-helpers.js.map +1 -1
  36. package/dist/helpers/logging-decorators.d.ts +43 -0
  37. package/dist/helpers/logging-decorators.js +156 -0
  38. package/dist/helpers/logging-decorators.js.map +1 -0
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +1 -3
  41. package/dist/index.js.map +1 -1
  42. package/dist/queue/InMemoryQueueProvider.d.ts +2 -2
  43. package/dist/queue/InMemoryQueueProvider.js +2 -2
  44. package/dist/queue/InMemoryQueueProvider.js.map +1 -1
  45. package/dist/transport/TelegramHttpClient.d.ts +2 -2
  46. package/dist/transport/TelegramHttpClient.js +2 -2
  47. package/dist/transport/TelegramHttpClient.js.map +1 -1
  48. package/dist/transport/TelegramHttpTransport.d.ts +2 -2
  49. package/dist/transport/TelegramHttpTransport.js +3 -4
  50. package/dist/transport/TelegramHttpTransport.js.map +1 -1
  51. package/dist/transport/TelegramTransport.d.ts +2 -2
  52. package/dist/transport/TelegramTransport.js +23 -7
  53. package/dist/transport/TelegramTransport.js.map +1 -1
  54. package/dist/transport/TokensManager.d.ts +2 -2
  55. package/dist/transport/TokensManager.js +6 -6
  56. package/dist/transport/TokensManager.js.map +1 -1
  57. package/dist/transport/index.d.ts +0 -1
  58. package/dist/transport/index.js +1 -3
  59. package/dist/transport/index.js.map +1 -1
  60. package/dist/types/logger.types.d.ts +3 -9
  61. package/dist/types/route.types.d.ts +110 -0
  62. package/dist/types/route.types.js +19 -0
  63. package/dist/types/route.types.js.map +1 -0
  64. package/dist/types/transport.types.d.ts +3 -1
  65. package/package.json +1 -1
  66. package/test_output.txt +256 -0
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Route Configuration Manager
3
+ * Manages route configurations, validation, and parameter operations
4
+ *
5
+ * @module client/managers/RouteConfigManager
6
+ */
7
+ import type { RouteConfig, WebhookDefaults } from '../../types/route.types.js';
8
+ import type { ILogger, LoggerOptions, ILoggerAware } from '../../types/logger.types.js';
9
+ /**
10
+ * Configuration options for RouteConfigManager
11
+ */
12
+ export interface RouteConfigManagerOptions extends LoggerOptions {
13
+ /** Initial routes configuration */
14
+ routes?: RouteConfig | RouteConfig[] | Map<string, RouteConfig>;
15
+ /** Default route ID */
16
+ defaultRouteId?: string;
17
+ /** Default webhook configuration values */
18
+ webhookDefaults?: WebhookDefaults;
19
+ }
20
+ /**
21
+ * Route Configuration Manager
22
+ * Manages route configurations storage, validation, and updates
23
+ *
24
+ * Responsibilities:
25
+ * - Store and retrieve route configurations
26
+ * - Validate route configurations
27
+ * - Manage default route
28
+ * - Provide webhook defaults
29
+ * - Support dot notation for parameter updates
30
+ */
31
+ export declare class RouteConfigManager implements ILoggerAware {
32
+ private routes;
33
+ private defaultRouteId?;
34
+ private webhookDefaults?;
35
+ private static validator;
36
+ private static validatorInitPromise;
37
+ /** Logger instance - mutable to support LoggerBinder.bind() */
38
+ logger?: ILogger;
39
+ /**
40
+ * Create a new RouteConfigManager instance
41
+ * @param options - Configuration options
42
+ */
43
+ constructor(options?: RouteConfigManagerOptions);
44
+ /**
45
+ * Initialize DataValidator for schema validation
46
+ * Called automatically on first validation
47
+ */
48
+ private static initValidator;
49
+ /**
50
+ * Load routes from various formats
51
+ * Supports: single config, array, or Map
52
+ *
53
+ * @param routes - Routes in any supported format
54
+ */
55
+ private loadRoutes;
56
+ /**
57
+ * Set or update a route configuration
58
+ * Applies webhook defaults if configured
59
+ *
60
+ * @param id - Route identifier
61
+ * @param config - Route configuration
62
+ */
63
+ setRoute(id: string, config: RouteConfig): void;
64
+ /**
65
+ * Get route configuration
66
+ *
67
+ * @param id - Route identifier (uses default if not specified)
68
+ * @returns Route configuration or undefined
69
+ */
70
+ getRoute(id?: string): RouteConfig | undefined;
71
+ /**
72
+ * Update route configuration (partial update)
73
+ *
74
+ * @param id - Route identifier
75
+ * @param updates - Partial route configuration
76
+ */
77
+ updateRoute(id: string, updates: Partial<RouteConfig>): void;
78
+ /**
79
+ * Remove a route
80
+ *
81
+ * @param id - Route identifier
82
+ */
83
+ removeRoute(id: string): void;
84
+ /**
85
+ * Check if route exists
86
+ *
87
+ * @param id - Route identifier
88
+ * @returns True if route exists
89
+ */
90
+ hasRoute(id: string): boolean;
91
+ /**
92
+ * Get all route IDs
93
+ *
94
+ * @returns Array of route IDs
95
+ */
96
+ getRouteIds(): string[];
97
+ /**
98
+ * Get default route ID
99
+ *
100
+ * @returns Default route ID or undefined
101
+ */
102
+ getDefaultRouteId(): string | undefined;
103
+ /**
104
+ * Set default route
105
+ *
106
+ * @param id - Route identifier to set as default
107
+ */
108
+ setDefaultRoute(id: string): void;
109
+ /**
110
+ * Get webhook defaults
111
+ *
112
+ * @returns Webhook defaults or undefined
113
+ */
114
+ getWebhookDefaults(): WebhookDefaults | undefined;
115
+ /**
116
+ * Set webhook defaults
117
+ *
118
+ * @param defaults - Webhook defaults
119
+ */
120
+ setWebhookDefaults(defaults: WebhookDefaults): void;
121
+ /**
122
+ * Set route parameter using dot notation
123
+ * Supports nested paths like "webhook.url" or "longPolling.timeout"
124
+ *
125
+ * @param routeId - Route identifier
126
+ * @param path - Parameter path (dot notation)
127
+ * @param value - Value to set
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * manager.setParam('support', 'webhook.url', 'https://new-url.com');
132
+ * manager.setParam('support', 'longPolling.timeout', 60);
133
+ * ```
134
+ */
135
+ setParam(routeId: string, path: string, value: unknown): void;
136
+ /**
137
+ * Get route parameter using dot notation
138
+ *
139
+ * @param routeId - Route identifier
140
+ * @param path - Parameter path (dot notation)
141
+ * @returns Parameter value or undefined
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * const url = manager.getParam('support', 'webhook.url');
146
+ * const timeout = manager.getParam('support', 'longPolling.timeout');
147
+ * ```
148
+ */
149
+ getParam(routeId: string, path: string): unknown;
150
+ /**
151
+ * Replace all routes
152
+ * Clears existing routes and loads new configuration
153
+ *
154
+ * @param routes - New routes configuration
155
+ */
156
+ replaceAll(routes: RouteConfig | RouteConfig[] | Map<string, RouteConfig>): void;
157
+ /**
158
+ * Validate route configuration using DataValidator and JSON Schema
159
+ * Async method that initializes validator on first call
160
+ *
161
+ * @param config - Route configuration to validate
162
+ * @throws {Error} If validation fails with detailed error message
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * try {
167
+ * await manager.validateRouteAsync(config);
168
+ * console.log('Config is valid');
169
+ * } catch (error) {
170
+ * console.error('Validation failed:', error.message);
171
+ * }
172
+ * ```
173
+ */
174
+ validateRouteAsync(config: RouteConfig): Promise<void>;
175
+ /**
176
+ * Validate route configuration (synchronous basic validation)
177
+ * For full JSON Schema validation, use validateRouteAsync()
178
+ * Returns array of validation errors (empty if valid)
179
+ *
180
+ * @param config - Route configuration to validate
181
+ * @returns Array of error messages
182
+ *
183
+ * @deprecated Use validateRouteAsync() for full JSON Schema validation
184
+ */
185
+ validateRoute(config: RouteConfig): string[];
186
+ }
@@ -0,0 +1,395 @@
1
+ /**
2
+ * Route Configuration Manager
3
+ * Manages route configurations, validation, and parameter operations
4
+ *
5
+ * @module client/managers/RouteConfigManager
6
+ */
7
+ 'use strict';
8
+ import { initializeLogger } from '../../helpers/logger-helpers.js';
9
+ import DataValidator from '@vvlad1973/data-validator';
10
+ import { fileURLToPath } from 'url';
11
+ import { dirname, join } from 'path';
12
+ /**
13
+ * Route Configuration Manager
14
+ * Manages route configurations storage, validation, and updates
15
+ *
16
+ * Responsibilities:
17
+ * - Store and retrieve route configurations
18
+ * - Validate route configurations
19
+ * - Manage default route
20
+ * - Provide webhook defaults
21
+ * - Support dot notation for parameter updates
22
+ */
23
+ export class RouteConfigManager {
24
+ routes = new Map();
25
+ defaultRouteId;
26
+ webhookDefaults;
27
+ static validator = null;
28
+ static validatorInitPromise = null;
29
+ /** Logger instance - mutable to support LoggerBinder.bind() */
30
+ logger;
31
+ /**
32
+ * Create a new RouteConfigManager instance
33
+ * @param options - Configuration options
34
+ */
35
+ constructor(options) {
36
+ this.logger = initializeLogger(this, options?.logger);
37
+ this.webhookDefaults = options?.webhookDefaults;
38
+ if (options?.routes) {
39
+ this.loadRoutes(options.routes);
40
+ }
41
+ if (options?.defaultRouteId && this.routes.has(options.defaultRouteId)) {
42
+ this.defaultRouteId = options.defaultRouteId;
43
+ }
44
+ else if (this.routes.size > 0) {
45
+ // Set first route as default if no default specified
46
+ this.defaultRouteId = this.routes.keys().next().value;
47
+ }
48
+ this.logger?.info?.(`RouteConfigManager initialized with ${this.routes.size} route(s)`);
49
+ }
50
+ /**
51
+ * Initialize DataValidator for schema validation
52
+ * Called automatically on first validation
53
+ */
54
+ static async initValidator() {
55
+ if (RouteConfigManager.validator) {
56
+ return;
57
+ }
58
+ if (RouteConfigManager.validatorInitPromise) {
59
+ return RouteConfigManager.validatorInitPromise;
60
+ }
61
+ RouteConfigManager.validatorInitPromise = (async () => {
62
+ // Get schemas directory path
63
+ const __filename = fileURLToPath(import.meta.url);
64
+ const __dirname = dirname(__filename);
65
+ const schemasDir = join(__dirname, '..', '..', 'schemas');
66
+ RouteConfigManager.validator = new DataValidator({
67
+ schemasDir
68
+ });
69
+ await RouteConfigManager.validator.isReady();
70
+ })();
71
+ return RouteConfigManager.validatorInitPromise;
72
+ }
73
+ /**
74
+ * Load routes from various formats
75
+ * Supports: single config, array, or Map
76
+ *
77
+ * @param routes - Routes in any supported format
78
+ */
79
+ loadRoutes(routes) {
80
+ if (routes instanceof Map) {
81
+ // Direct Map import
82
+ routes.forEach((config, id) => {
83
+ this.setRoute(id, config);
84
+ });
85
+ }
86
+ else if (Array.isArray(routes)) {
87
+ // Array - generate IDs as route0, route1, etc.
88
+ routes.forEach((config, index) => {
89
+ const id = `route${index}`;
90
+ this.setRoute(id, config);
91
+ });
92
+ }
93
+ else {
94
+ // Single config - use 'default' as ID
95
+ this.setRoute('default', routes);
96
+ }
97
+ }
98
+ /**
99
+ * Set or update a route configuration
100
+ * Applies webhook defaults if configured
101
+ *
102
+ * @param id - Route identifier
103
+ * @param config - Route configuration
104
+ */
105
+ setRoute(id, config) {
106
+ // Apply webhook defaults if not specified
107
+ if (config.webhook && this.webhookDefaults) {
108
+ config.webhook = {
109
+ secretToken: this.webhookDefaults.secretToken,
110
+ maxConnections: this.webhookDefaults.maxConnections,
111
+ allowedUpdates: this.webhookDefaults.allowedUpdates,
112
+ dropPendingUpdates: this.webhookDefaults.dropPendingUpdates,
113
+ ipAddress: this.webhookDefaults.ipAddress,
114
+ ...config.webhook, // Config overrides defaults
115
+ };
116
+ }
117
+ this.routes.set(id, config);
118
+ // Set as default if this is the first route
119
+ if (!this.defaultRouteId) {
120
+ this.defaultRouteId = id;
121
+ }
122
+ this.logger?.debug?.({ routeId: id }, 'Route set');
123
+ }
124
+ /**
125
+ * Get route configuration
126
+ *
127
+ * @param id - Route identifier (uses default if not specified)
128
+ * @returns Route configuration or undefined
129
+ */
130
+ getRoute(id) {
131
+ const routeId = id || this.defaultRouteId;
132
+ return routeId ? this.routes.get(routeId) : undefined;
133
+ }
134
+ /**
135
+ * Update route configuration (partial update)
136
+ *
137
+ * @param id - Route identifier
138
+ * @param updates - Partial route configuration
139
+ */
140
+ updateRoute(id, updates) {
141
+ const existing = this.routes.get(id);
142
+ if (!existing) {
143
+ throw new Error(`Route not found: ${id}`);
144
+ }
145
+ // Deep merge for webhook and longPolling
146
+ const updated = {
147
+ ...existing,
148
+ ...updates,
149
+ };
150
+ if (updates.webhook) {
151
+ updated.webhook = {
152
+ ...existing.webhook,
153
+ ...updates.webhook,
154
+ };
155
+ }
156
+ if (updates.longPolling) {
157
+ updated.longPolling = {
158
+ ...existing.longPolling,
159
+ ...updates.longPolling,
160
+ };
161
+ }
162
+ this.routes.set(id, updated);
163
+ this.logger?.debug?.({ routeId: id }, 'Route updated');
164
+ }
165
+ /**
166
+ * Remove a route
167
+ *
168
+ * @param id - Route identifier
169
+ */
170
+ removeRoute(id) {
171
+ if (!this.routes.has(id)) {
172
+ this.logger?.warn?.({ routeId: id }, 'Attempting to remove non-existent route');
173
+ return;
174
+ }
175
+ this.routes.delete(id);
176
+ // Update default if we removed it
177
+ if (this.defaultRouteId === id) {
178
+ this.defaultRouteId = this.routes.size > 0 ? this.routes.keys().next().value : undefined;
179
+ }
180
+ this.logger?.debug?.({ routeId: id }, 'Route removed');
181
+ }
182
+ /**
183
+ * Check if route exists
184
+ *
185
+ * @param id - Route identifier
186
+ * @returns True if route exists
187
+ */
188
+ hasRoute(id) {
189
+ return this.routes.has(id);
190
+ }
191
+ /**
192
+ * Get all route IDs
193
+ *
194
+ * @returns Array of route IDs
195
+ */
196
+ getRouteIds() {
197
+ return Array.from(this.routes.keys());
198
+ }
199
+ /**
200
+ * Get default route ID
201
+ *
202
+ * @returns Default route ID or undefined
203
+ */
204
+ getDefaultRouteId() {
205
+ return this.defaultRouteId;
206
+ }
207
+ /**
208
+ * Set default route
209
+ *
210
+ * @param id - Route identifier to set as default
211
+ */
212
+ setDefaultRoute(id) {
213
+ if (!this.routes.has(id)) {
214
+ throw new Error(`Cannot set default: route not found: ${id}`);
215
+ }
216
+ this.defaultRouteId = id;
217
+ this.logger?.debug?.({ routeId: id }, 'Default route set');
218
+ }
219
+ /**
220
+ * Get webhook defaults
221
+ *
222
+ * @returns Webhook defaults or undefined
223
+ */
224
+ getWebhookDefaults() {
225
+ return this.webhookDefaults;
226
+ }
227
+ /**
228
+ * Set webhook defaults
229
+ *
230
+ * @param defaults - Webhook defaults
231
+ */
232
+ setWebhookDefaults(defaults) {
233
+ this.webhookDefaults = defaults;
234
+ this.logger?.debug?.({}, 'Webhook defaults updated');
235
+ }
236
+ /**
237
+ * Set route parameter using dot notation
238
+ * Supports nested paths like "webhook.url" or "longPolling.timeout"
239
+ *
240
+ * @param routeId - Route identifier
241
+ * @param path - Parameter path (dot notation)
242
+ * @param value - Value to set
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * manager.setParam('support', 'webhook.url', 'https://new-url.com');
247
+ * manager.setParam('support', 'longPolling.timeout', 60);
248
+ * ```
249
+ */
250
+ setParam(routeId, path, value) {
251
+ const route = this.routes.get(routeId);
252
+ if (!route) {
253
+ throw new Error(`Route not found: ${routeId}`);
254
+ }
255
+ const parts = path.split('.');
256
+ let current = route;
257
+ // Navigate to parent object
258
+ for (let i = 0; i < parts.length - 1; i++) {
259
+ const part = parts[i];
260
+ if (typeof current[part] !== 'object' || current[part] === null) {
261
+ current[part] = {};
262
+ }
263
+ current = current[part];
264
+ }
265
+ // Set value
266
+ const lastPart = parts[parts.length - 1];
267
+ current[lastPart] = value;
268
+ this.logger?.trace?.({ routeId, path }, 'Parameter set');
269
+ }
270
+ /**
271
+ * Get route parameter using dot notation
272
+ *
273
+ * @param routeId - Route identifier
274
+ * @param path - Parameter path (dot notation)
275
+ * @returns Parameter value or undefined
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * const url = manager.getParam('support', 'webhook.url');
280
+ * const timeout = manager.getParam('support', 'longPolling.timeout');
281
+ * ```
282
+ */
283
+ getParam(routeId, path) {
284
+ const route = this.routes.get(routeId);
285
+ if (!route) {
286
+ return undefined;
287
+ }
288
+ const parts = path.split('.');
289
+ let current = route;
290
+ for (const part of parts) {
291
+ if (typeof current !== 'object' || current === null) {
292
+ return undefined;
293
+ }
294
+ current = current[part];
295
+ }
296
+ return current;
297
+ }
298
+ /**
299
+ * Replace all routes
300
+ * Clears existing routes and loads new configuration
301
+ *
302
+ * @param routes - New routes configuration
303
+ */
304
+ replaceAll(routes) {
305
+ this.routes.clear();
306
+ this.defaultRouteId = undefined;
307
+ this.loadRoutes(routes);
308
+ this.logger?.info?.(`Routes replaced - ${this.routes.size} route(s) loaded`);
309
+ }
310
+ /**
311
+ * Validate route configuration using DataValidator and JSON Schema
312
+ * Async method that initializes validator on first call
313
+ *
314
+ * @param config - Route configuration to validate
315
+ * @throws {Error} If validation fails with detailed error message
316
+ *
317
+ * @example
318
+ * ```typescript
319
+ * try {
320
+ * await manager.validateRouteAsync(config);
321
+ * console.log('Config is valid');
322
+ * } catch (error) {
323
+ * console.error('Validation failed:', error.message);
324
+ * }
325
+ * ```
326
+ */
327
+ async validateRouteAsync(config) {
328
+ await RouteConfigManager.initValidator();
329
+ if (!RouteConfigManager.validator) {
330
+ throw new Error('Validator not initialized');
331
+ }
332
+ try {
333
+ await RouteConfigManager.validator.validate('route-config.schema.json', config);
334
+ }
335
+ catch (error) {
336
+ const err = error instanceof Error ? error : new Error(String(error));
337
+ throw new Error(`Route config validation failed: ${err.message}`);
338
+ }
339
+ }
340
+ /**
341
+ * Validate route configuration (synchronous basic validation)
342
+ * For full JSON Schema validation, use validateRouteAsync()
343
+ * Returns array of validation errors (empty if valid)
344
+ *
345
+ * @param config - Route configuration to validate
346
+ * @returns Array of error messages
347
+ *
348
+ * @deprecated Use validateRouteAsync() for full JSON Schema validation
349
+ */
350
+ validateRoute(config) {
351
+ const errors = [];
352
+ // Basic validation - token required
353
+ if (!config.token || typeof config.token !== 'string') {
354
+ errors.push('Token is required and must be a string');
355
+ }
356
+ // Validate webhook config if present
357
+ if (config.webhook) {
358
+ if (!config.webhook.url) {
359
+ errors.push('Webhook URL is required when webhook config is present');
360
+ }
361
+ else if (typeof config.webhook.url !== 'string') {
362
+ errors.push('Webhook URL must be a string');
363
+ }
364
+ if (config.webhook.maxConnections !== undefined) {
365
+ const max = config.webhook.maxConnections;
366
+ if (typeof max !== 'number' || max < 1 || max > 100) {
367
+ errors.push('Webhook maxConnections must be a number between 1 and 100');
368
+ }
369
+ }
370
+ }
371
+ // Validate long polling config if present
372
+ if (config.longPolling) {
373
+ if (config.longPolling.timeout !== undefined) {
374
+ const timeout = config.longPolling.timeout;
375
+ if (typeof timeout !== 'number' || timeout < 0) {
376
+ errors.push('Long polling timeout must be a non-negative number');
377
+ }
378
+ }
379
+ if (config.longPolling.limit !== undefined) {
380
+ const limit = config.longPolling.limit;
381
+ if (typeof limit !== 'number' || limit < 1 || limit > 100) {
382
+ errors.push('Long polling limit must be a number between 1 and 100');
383
+ }
384
+ }
385
+ if (config.longPolling.interval !== undefined) {
386
+ const interval = config.longPolling.interval;
387
+ if (typeof interval !== 'number' || interval < 0) {
388
+ errors.push('Long polling interval must be a non-negative number');
389
+ }
390
+ }
391
+ }
392
+ return errors;
393
+ }
394
+ }
395
+ //# sourceMappingURL=RouteConfigManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteConfigManager.js","sourceRoot":"","sources":["../../../src/client/managers/RouteConfigManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,CAAC;AAIb,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAgBrC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IACxC,cAAc,CAAU;IACxB,eAAe,CAAmB;IAClC,MAAM,CAAC,SAAS,GAAyB,IAAI,CAAC;IAC9C,MAAM,CAAC,oBAAoB,GAAyB,IAAI,CAAC;IAEjE,+DAA+D;IACxD,MAAM,CAAW;IAExB;;;OAGG;IACH,YAAY,OAAmC;QAC7C,IAAI,CAAC,MAAM,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,CAAC;QAEhD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC/C,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC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