@almadar/server 1.0.13 → 1.0.15
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/dist/{index--XhXIuTh.d.ts → index-BGC2yptv.d.ts} +12 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.js +583 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +43 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/middleware/index.js +21 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/stores/index.d.ts +167 -0
- package/dist/stores/index.js +594 -0
- package/dist/stores/index.js.map +1 -0
- package/package.json +7 -2
|
@@ -36,18 +36,29 @@ declare const logger: {
|
|
|
36
36
|
* @packageDocumentation
|
|
37
37
|
*/
|
|
38
38
|
type EventHandler = (payload: unknown, meta?: Record<string, unknown>) => void;
|
|
39
|
+
interface EventLogEntry {
|
|
40
|
+
event: string;
|
|
41
|
+
payload: unknown;
|
|
42
|
+
timestamp: number;
|
|
43
|
+
listenerCount: number;
|
|
44
|
+
wildcardListenerCount: number;
|
|
45
|
+
}
|
|
39
46
|
/**
|
|
40
47
|
* Simple EventBus implementation for server-side events
|
|
41
48
|
*/
|
|
42
49
|
declare class EventBus {
|
|
43
50
|
private handlers;
|
|
44
51
|
private debug;
|
|
52
|
+
private eventLog;
|
|
45
53
|
constructor(options?: {
|
|
46
54
|
debug?: boolean;
|
|
47
55
|
});
|
|
48
56
|
on(event: string, handler: EventHandler): () => void;
|
|
49
57
|
off(event: string, handler: EventHandler): void;
|
|
50
58
|
emit(event: string, payload?: unknown, meta?: Record<string, unknown>): void;
|
|
59
|
+
getRecentEvents(limit?: number): EventLogEntry[];
|
|
60
|
+
clearEventLog(): void;
|
|
61
|
+
getListenerCounts(): Record<string, number>;
|
|
51
62
|
clear(): void;
|
|
52
63
|
}
|
|
53
64
|
/**
|
|
@@ -117,4 +128,4 @@ declare function closeWebSocketServer(): Promise<void>;
|
|
|
117
128
|
*/
|
|
118
129
|
declare function getConnectedClientCount(): number;
|
|
119
130
|
|
|
120
|
-
export { EventBus as E,
|
|
131
|
+
export { EventBus as E, type EventLogEntry as a, env as b, closeWebSocketServer as c, db as d, emitEntityEvent as e, getConnectedClientCount as f, getAuth as g, getFirestore as h, getWebSocketServer as i, setupEventBroadcast as j, logger as l, serverEventBus as s };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
|
-
export { E as EventBus, c as closeWebSocketServer, d as db, e as emitEntityEvent,
|
|
1
|
+
export { E as EventBus, a as EventLogEntry, c as closeWebSocketServer, d as db, e as emitEntityEvent, b as env, g as getAuth, f as getConnectedClientCount, h as getFirestore, i as getWebSocketServer, l as logger, s as serverEventBus, j as setupEventBroadcast } from './index-BGC2yptv.js';
|
|
2
|
+
import { Router } from 'express';
|
|
2
3
|
export { AppError, ConflictError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError, asyncHandler, authenticateFirebase, errorHandler, notFoundHandler, validateBody, validateParams, validateQuery } from './middleware/index.js';
|
|
3
4
|
export { D as DataService, E as EntitySchema, a as EntitySeedConfig, F as FieldSchema, M as MockDataService, P as PaginatedResult, b as PaginationOptions, d as dataService, m as mockDataService, s as seedMockData } from './index-D8fohXsO.js';
|
|
5
|
+
export { ChangeSetStore, SchemaProtectionService, SchemaStore, SnapshotStore, ValidationStore, fromFirestoreFormat, toFirestoreFormat } from './stores/index.js';
|
|
4
6
|
export { FirestoreWhereFilterOp, PaginationParams, ParsedFilter, applyFiltersToQuery, extractPaginationParams, parseQueryFilters } from './utils/index.js';
|
|
5
7
|
export { default as admin } from 'firebase-admin';
|
|
6
8
|
import 'ws';
|
|
7
9
|
import 'http';
|
|
8
|
-
import 'express';
|
|
9
10
|
import 'zod';
|
|
11
|
+
import '@almadar/core';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Debug Events Router
|
|
15
|
+
*
|
|
16
|
+
* Provides diagnostic endpoints for inspecting the server EventBus.
|
|
17
|
+
* Only active when NODE_ENV=development.
|
|
18
|
+
*
|
|
19
|
+
* Endpoints:
|
|
20
|
+
* GET /event-log - Recent emitted events with listener counts
|
|
21
|
+
* DELETE /event-log - Clear the event log
|
|
22
|
+
* GET /listeners - Registered listener counts per event
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates an Express router with debug endpoints for the server EventBus.
|
|
29
|
+
* Returns a no-op router in production (no routes registered).
|
|
30
|
+
*/
|
|
31
|
+
declare function debugEventsRouter(): Router;
|
|
32
|
+
|
|
33
|
+
export { debugEventsRouter };
|