@almadar/server 1.4.5 → 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.
- package/LICENSE +21 -72
- package/README.md +25 -0
- package/dist/index.js +435 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -12
- package/dist/deepagent/memory.d.ts +0 -20
- package/dist/deepagent/session.d.ts +0 -20
- package/dist/deepagent/skill-agent.d.ts +0 -24
- package/dist/index-B64ll_cY.d.ts +0 -149
- package/dist/index-D8fohXsO.d.ts +0 -178
- package/dist/index.d.ts +0 -41
- package/dist/lib/index.d.ts +0 -4
- package/dist/middleware/index.d.ts +0 -71
- package/dist/middleware/multi-user.d.ts +0 -37
- package/dist/routes/observability.d.ts +0 -12
- package/dist/services/index.d.ts +0 -2
- package/dist/stores/index.d.ts +0 -167
- package/dist/utils/index.d.ts +0 -78
- package/dist/websocket/state-sync.d.ts +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Shared server infrastructure for Almadar applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,23 +39,18 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"@almadar/agent": ">=2.0.0",
|
|
43
|
+
"@almadar/core": ">=2.0.0",
|
|
42
44
|
"@faker-js/faker": "^9.3.0",
|
|
43
45
|
"cors": "^2.8.5",
|
|
44
46
|
"dotenv": "^16.4.0",
|
|
47
|
+
"firebase-admin": "^12.0.0",
|
|
45
48
|
"helmet": "^8.0.0",
|
|
46
49
|
"ws": "^8.18.0",
|
|
47
|
-
"zod": "^3.24.0"
|
|
48
|
-
"@almadar/agent": "1.6.4",
|
|
49
|
-
"@almadar/core": "1.0.18"
|
|
50
|
+
"zod": "^3.24.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"express": "^4.0.0"
|
|
53
|
-
"firebase-admin": "^12.0.0"
|
|
54
|
-
},
|
|
55
|
-
"peerDependenciesMeta": {
|
|
56
|
-
"firebase-admin": {
|
|
57
|
-
"optional": true
|
|
58
|
-
}
|
|
53
|
+
"express": "^4.0.0"
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@types/cors": "^2.8.17",
|
|
@@ -71,7 +66,7 @@
|
|
|
71
66
|
"repository": {
|
|
72
67
|
"type": "git",
|
|
73
68
|
"url": "https://github.com/almadar-io/almadar.git",
|
|
74
|
-
"directory": "packages/
|
|
69
|
+
"directory": "docs/packages/server"
|
|
75
70
|
},
|
|
76
71
|
"license": "MIT",
|
|
77
72
|
"keywords": [
|
|
@@ -80,6 +75,7 @@
|
|
|
80
75
|
"express",
|
|
81
76
|
"middleware"
|
|
82
77
|
],
|
|
78
|
+
"homepage": "https://github.com/almadar-io/almadar#readme",
|
|
83
79
|
"scripts": {
|
|
84
80
|
"build": "NODE_OPTIONS='--max-old-space-size=4096' tsup",
|
|
85
81
|
"build:watch": "tsup --watch",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { MemoryManager } from '@almadar/agent';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Memory Manager Singleton
|
|
5
|
-
*
|
|
6
|
-
* Provides Firestore-backed memory management for DeepAgent.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get or create the MemoryManager singleton
|
|
13
|
-
*/
|
|
14
|
-
declare function getMemoryManager(): MemoryManager;
|
|
15
|
-
/**
|
|
16
|
-
* Reset the MemoryManager (useful for testing)
|
|
17
|
-
*/
|
|
18
|
-
declare function resetMemoryManager(): void;
|
|
19
|
-
|
|
20
|
-
export { getMemoryManager, resetMemoryManager };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SessionManager } from '@almadar/agent';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Session Manager Singleton
|
|
5
|
-
*
|
|
6
|
-
* Provides Firestore-backed session management with full GAP features.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get or create the SessionManager singleton
|
|
13
|
-
*/
|
|
14
|
-
declare function getSessionManager(): SessionManager;
|
|
15
|
-
/**
|
|
16
|
-
* Reset the SessionManager (useful for testing)
|
|
17
|
-
*/
|
|
18
|
-
declare function resetSessionManager(): void;
|
|
19
|
-
|
|
20
|
-
export { getSessionManager, resetSessionManager };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SkillAgentOptions, SkillAgentResult } from '@almadar/agent';
|
|
2
|
-
export { getMemoryManager } from './memory.js';
|
|
3
|
-
export { getSessionManager } from './session.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Skill Agent Factory
|
|
7
|
-
*
|
|
8
|
-
* Creates DeepAgent instances with full GAP feature integration.
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface ServerSkillAgentOptions extends SkillAgentOptions {
|
|
14
|
-
/** User ID from Firebase Auth */
|
|
15
|
-
userId: string;
|
|
16
|
-
/** App/Project ID for context */
|
|
17
|
-
appId?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Create a skill agent with full server-side GAP integration
|
|
21
|
-
*/
|
|
22
|
-
declare function createServerSkillAgent(options: ServerSkillAgentOptions): Promise<SkillAgentResult>;
|
|
23
|
-
|
|
24
|
-
export { createServerSkillAgent };
|
package/dist/index-B64ll_cY.d.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import admin from 'firebase-admin';
|
|
2
|
-
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { Server } from 'http';
|
|
4
|
-
|
|
5
|
-
declare const env: {
|
|
6
|
-
NODE_ENV: "development" | "production" | "test";
|
|
7
|
-
PORT: number;
|
|
8
|
-
CORS_ORIGIN: string | string[];
|
|
9
|
-
API_PREFIX: string;
|
|
10
|
-
USE_MOCK_DATA: boolean;
|
|
11
|
-
DATABASE_URL?: string | undefined;
|
|
12
|
-
FIREBASE_PROJECT_ID?: string | undefined;
|
|
13
|
-
FIREBASE_CLIENT_EMAIL?: string | undefined;
|
|
14
|
-
FIREBASE_PRIVATE_KEY?: string | undefined;
|
|
15
|
-
FIREBASE_SERVICE_ACCOUNT_PATH?: string | undefined;
|
|
16
|
-
FIRESTORE_EMULATOR_HOST?: string | undefined;
|
|
17
|
-
FIREBASE_AUTH_EMULATOR_HOST?: string | undefined;
|
|
18
|
-
MOCK_SEED?: number | undefined;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
declare const logger: {
|
|
22
|
-
debug: (message: string, meta?: unknown) => void;
|
|
23
|
-
info: (message: string, meta?: unknown) => void;
|
|
24
|
-
warn: (message: string, meta?: unknown) => void;
|
|
25
|
-
error: (message: string, meta?: unknown) => void;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Server EventBus - Singleton for server-side cross-trait communication
|
|
30
|
-
*
|
|
31
|
-
* This EventBus enables:
|
|
32
|
-
* - Server-side trait event emission after CRUD operations
|
|
33
|
-
* - Server-side trait listeners responding to events
|
|
34
|
-
* - Cross-client event broadcast via WebSocket
|
|
35
|
-
*
|
|
36
|
-
* @packageDocumentation
|
|
37
|
-
*/
|
|
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
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Simple EventBus implementation for server-side events
|
|
48
|
-
*/
|
|
49
|
-
declare class EventBus {
|
|
50
|
-
private handlers;
|
|
51
|
-
private debug;
|
|
52
|
-
private eventLog;
|
|
53
|
-
constructor(options?: {
|
|
54
|
-
debug?: boolean;
|
|
55
|
-
});
|
|
56
|
-
on(event: string, handler: EventHandler): () => void;
|
|
57
|
-
off(event: string, handler: EventHandler): void;
|
|
58
|
-
emit(event: string, payload?: unknown, meta?: Record<string, unknown>): void;
|
|
59
|
-
getRecentEvents(limit?: number): EventLogEntry[];
|
|
60
|
-
clearEventLog(): void;
|
|
61
|
-
getListenerCounts(): Record<string, number>;
|
|
62
|
-
clear(): void;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Singleton EventBus instance for server-side event communication.
|
|
66
|
-
*/
|
|
67
|
-
declare const serverEventBus: EventBus;
|
|
68
|
-
/**
|
|
69
|
-
* Type-safe event emission helper
|
|
70
|
-
*/
|
|
71
|
-
declare function emitEntityEvent(entityType: string, action: 'CREATED' | 'UPDATED' | 'DELETED', payload: Record<string, unknown>): void;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Database Accessors & Initialization
|
|
75
|
-
*
|
|
76
|
-
* This module provides:
|
|
77
|
-
* - `initializeFirebase()` — convenience function to init Firebase from env vars
|
|
78
|
-
* - `getFirestore()`, `getAuth()` — accessors for Firebase services
|
|
79
|
-
* - `db` — lazy Firestore proxy (no eager initialization)
|
|
80
|
-
*
|
|
81
|
-
* The consuming application MUST call `initializeFirebase()` or
|
|
82
|
-
* `admin.initializeApp()` before using any Firebase-dependent features.
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Initialize Firebase Admin SDK from environment variables.
|
|
87
|
-
*
|
|
88
|
-
* Reads: FIREBASE_PROJECT_ID, FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY,
|
|
89
|
-
* FIREBASE_SERVICE_ACCOUNT_PATH, FIRESTORE_EMULATOR_HOST
|
|
90
|
-
*
|
|
91
|
-
* Safe to call multiple times — returns existing app if already initialized.
|
|
92
|
-
*/
|
|
93
|
-
declare function initializeFirebase(): admin.app.App;
|
|
94
|
-
/**
|
|
95
|
-
* Get Firestore instance from the pre-initialized Firebase app.
|
|
96
|
-
*/
|
|
97
|
-
declare function getFirestore(): admin.firestore.Firestore;
|
|
98
|
-
/**
|
|
99
|
-
* Get Firebase Auth instance from the pre-initialized Firebase app.
|
|
100
|
-
*/
|
|
101
|
-
declare function getAuth(): admin.auth.Auth;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Lazy Firestore proxy — resolves on first property access, not at import time.
|
|
105
|
-
* This prevents the "Firebase not initialized" error during module loading.
|
|
106
|
-
*/
|
|
107
|
-
declare const db: admin.firestore.Firestore;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* WebSocket Event Broadcast - Cross-client event synchronization
|
|
111
|
-
*
|
|
112
|
-
* Broadcasts server-side events to all connected clients via WebSocket.
|
|
113
|
-
* This enables real-time updates across multiple browser clients.
|
|
114
|
-
*
|
|
115
|
-
* @packageDocumentation
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Setup WebSocket server for event broadcasting.
|
|
120
|
-
*
|
|
121
|
-
* Listens to all server events via wildcard and broadcasts to connected clients.
|
|
122
|
-
*
|
|
123
|
-
* @param server - HTTP server to attach WebSocket to
|
|
124
|
-
* @param path - WebSocket endpoint path (default: '/ws/events')
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* import { createServer } from 'http';
|
|
129
|
-
* import { setupEventBroadcast } from '@/lib/websocket';
|
|
130
|
-
*
|
|
131
|
-
* const server = createServer(app);
|
|
132
|
-
* setupEventBroadcast(server);
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
declare function setupEventBroadcast(server: Server, path?: string): WebSocketServer;
|
|
136
|
-
/**
|
|
137
|
-
* Get the WebSocket server instance (for testing or advanced usage)
|
|
138
|
-
*/
|
|
139
|
-
declare function getWebSocketServer(): WebSocketServer | null;
|
|
140
|
-
/**
|
|
141
|
-
* Close the WebSocket server
|
|
142
|
-
*/
|
|
143
|
-
declare function closeWebSocketServer(): Promise<void>;
|
|
144
|
-
/**
|
|
145
|
-
* Get connected client count
|
|
146
|
-
*/
|
|
147
|
-
declare function getConnectedClientCount(): number;
|
|
148
|
-
|
|
149
|
-
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, initializeFirebase as j, setupEventBroadcast as k, logger as l, serverEventBus as s };
|
package/dist/index-D8fohXsO.d.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { ParsedFilter } from './utils/index.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MockDataService - In-memory data store with faker-based mock generation
|
|
5
|
-
*
|
|
6
|
-
* Provides a stateful mock data layer that supports all CRUD operations.
|
|
7
|
-
* Uses @faker-js/faker for realistic data generation based on field types.
|
|
8
|
-
*
|
|
9
|
-
* @packageDocumentation
|
|
10
|
-
*/
|
|
11
|
-
interface FieldSchema {
|
|
12
|
-
name: string;
|
|
13
|
-
type: 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'relation' | 'array';
|
|
14
|
-
required?: boolean;
|
|
15
|
-
enumValues?: string[];
|
|
16
|
-
min?: number;
|
|
17
|
-
max?: number;
|
|
18
|
-
fakerMethod?: string;
|
|
19
|
-
relatedEntity?: string;
|
|
20
|
-
}
|
|
21
|
-
interface EntitySchema {
|
|
22
|
-
fields: FieldSchema[];
|
|
23
|
-
seedCount?: number;
|
|
24
|
-
}
|
|
25
|
-
interface BaseEntity$1 {
|
|
26
|
-
id: string;
|
|
27
|
-
createdAt: Date;
|
|
28
|
-
updatedAt: Date;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* In-memory mock data store with CRUD operations and faker-based seeding.
|
|
32
|
-
*/
|
|
33
|
-
declare class MockDataService {
|
|
34
|
-
private stores;
|
|
35
|
-
private schemas;
|
|
36
|
-
private idCounters;
|
|
37
|
-
constructor();
|
|
38
|
-
/**
|
|
39
|
-
* Initialize store for an entity.
|
|
40
|
-
*/
|
|
41
|
-
private getStore;
|
|
42
|
-
/**
|
|
43
|
-
* Generate next ID for an entity.
|
|
44
|
-
*/
|
|
45
|
-
private nextId;
|
|
46
|
-
/**
|
|
47
|
-
* Register an entity schema.
|
|
48
|
-
*/
|
|
49
|
-
registerSchema(entityName: string, schema: EntitySchema): void;
|
|
50
|
-
/**
|
|
51
|
-
* Seed an entity with mock data.
|
|
52
|
-
*/
|
|
53
|
-
seed(entityName: string, fields: FieldSchema[], count?: number): void;
|
|
54
|
-
/**
|
|
55
|
-
* Generate a single mock item based on field schemas.
|
|
56
|
-
*/
|
|
57
|
-
private generateMockItem;
|
|
58
|
-
/**
|
|
59
|
-
* Generate a mock value for a field based on its schema.
|
|
60
|
-
*/
|
|
61
|
-
private generateFieldValue;
|
|
62
|
-
/**
|
|
63
|
-
* Generate a string value based on field name heuristics.
|
|
64
|
-
* Generic name/title fields use entity-aware format (e.g., "Project Name 1").
|
|
65
|
-
* Specific fields (email, phone, etc.) use faker.
|
|
66
|
-
*/
|
|
67
|
-
private generateStringValue;
|
|
68
|
-
/**
|
|
69
|
-
* Capitalize first letter of a string.
|
|
70
|
-
*/
|
|
71
|
-
private capitalizeFirst;
|
|
72
|
-
/**
|
|
73
|
-
* Generate a date value based on field name heuristics.
|
|
74
|
-
*/
|
|
75
|
-
private generateDateValue;
|
|
76
|
-
/**
|
|
77
|
-
* List all items of an entity.
|
|
78
|
-
*/
|
|
79
|
-
list<T>(entityName: string): T[];
|
|
80
|
-
/**
|
|
81
|
-
* Get a single item by ID.
|
|
82
|
-
*/
|
|
83
|
-
getById<T>(entityName: string, id: string): T | null;
|
|
84
|
-
/**
|
|
85
|
-
* Create a new item.
|
|
86
|
-
*/
|
|
87
|
-
create<T extends BaseEntity$1>(entityName: string, data: Partial<T>): T;
|
|
88
|
-
/**
|
|
89
|
-
* Update an existing item.
|
|
90
|
-
*/
|
|
91
|
-
update<T extends BaseEntity$1>(entityName: string, id: string, data: Partial<T>): T | null;
|
|
92
|
-
/**
|
|
93
|
-
* Delete an item.
|
|
94
|
-
*/
|
|
95
|
-
delete(entityName: string, id: string): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Clear all data for an entity.
|
|
98
|
-
*/
|
|
99
|
-
clear(entityName: string): void;
|
|
100
|
-
/**
|
|
101
|
-
* Clear all data.
|
|
102
|
-
*/
|
|
103
|
-
clearAll(): void;
|
|
104
|
-
/**
|
|
105
|
-
* Get count of items for an entity.
|
|
106
|
-
*/
|
|
107
|
-
count(entityName: string): number;
|
|
108
|
-
}
|
|
109
|
-
declare const mockDataService: MockDataService;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* DataService - Unified data access abstraction
|
|
113
|
-
*
|
|
114
|
-
* Provides a common interface for data operations that can be backed by
|
|
115
|
-
* either MockDataService (for development) or Firebase (for production).
|
|
116
|
-
*
|
|
117
|
-
* @packageDocumentation
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
interface BaseEntity {
|
|
121
|
-
id: string;
|
|
122
|
-
createdAt: Date;
|
|
123
|
-
updatedAt: Date;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Pagination options for list queries
|
|
127
|
-
*/
|
|
128
|
-
interface PaginationOptions {
|
|
129
|
-
/** Page number (1-indexed) */
|
|
130
|
-
page?: number;
|
|
131
|
-
/** Number of items per page */
|
|
132
|
-
pageSize?: number;
|
|
133
|
-
/** Search term to filter results */
|
|
134
|
-
search?: string;
|
|
135
|
-
/** Fields to search in (defaults to all string fields) */
|
|
136
|
-
searchFields?: string[];
|
|
137
|
-
/** Sort field */
|
|
138
|
-
sortBy?: string;
|
|
139
|
-
/** Sort direction */
|
|
140
|
-
sortOrder?: 'asc' | 'desc';
|
|
141
|
-
/** Filters parsed from query params */
|
|
142
|
-
filters?: ParsedFilter[];
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Paginated response structure
|
|
146
|
-
*/
|
|
147
|
-
interface PaginatedResult<T> {
|
|
148
|
-
data: T[];
|
|
149
|
-
total: number;
|
|
150
|
-
page: number;
|
|
151
|
-
pageSize: number;
|
|
152
|
-
totalPages: number;
|
|
153
|
-
}
|
|
154
|
-
interface DataService {
|
|
155
|
-
list<T>(collection: string): Promise<T[]>;
|
|
156
|
-
listPaginated<T>(collection: string, options?: PaginationOptions): Promise<PaginatedResult<T>>;
|
|
157
|
-
getById<T>(collection: string, id: string): Promise<T | null>;
|
|
158
|
-
create<T extends BaseEntity>(collection: string, data: Partial<T>): Promise<T>;
|
|
159
|
-
update<T extends BaseEntity>(collection: string, id: string, data: Partial<T>): Promise<T | null>;
|
|
160
|
-
delete(collection: string, id: string): Promise<boolean>;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Singleton data service instance.
|
|
164
|
-
* Use this in handlers for all data operations.
|
|
165
|
-
*/
|
|
166
|
-
declare const dataService: DataService;
|
|
167
|
-
interface EntitySeedConfig {
|
|
168
|
-
name: string;
|
|
169
|
-
fields: FieldSchema[];
|
|
170
|
-
seedCount: number;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Seed mock data for multiple entities.
|
|
174
|
-
* Only works when USE_MOCK_DATA is enabled.
|
|
175
|
-
*/
|
|
176
|
-
declare function seedMockData(entities: EntitySeedConfig[]): void;
|
|
177
|
-
|
|
178
|
-
export { type DataService as D, type EntitySchema as E, type FieldSchema as F, MockDataService as M, type PaginatedResult as P, type EntitySeedConfig as a, type PaginationOptions as b, dataService as d, mockDataService as m, seedMockData as s };
|
package/dist/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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, j as initializeFirebase, l as logger, s as serverEventBus, k as setupEventBroadcast } from './index-B64ll_cY.js';
|
|
2
|
-
import { Router } from 'express';
|
|
3
|
-
export { AppError, ConflictError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError, asyncHandler, authenticateFirebase, errorHandler, notFoundHandler, validateBody, validateParams, validateQuery } from './middleware/index.js';
|
|
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';
|
|
6
|
-
export { FirestoreWhereFilterOp, PaginationParams, ParsedFilter, applyFiltersToQuery, extractPaginationParams, parseQueryFilters } from './utils/index.js';
|
|
7
|
-
export { getMemoryManager as getAgentMemoryManager, getMemoryManager, resetMemoryManager } from './deepagent/memory.js';
|
|
8
|
-
export { getSessionManager as getAgentSessionManager, getSessionManager, resetSessionManager } from './deepagent/session.js';
|
|
9
|
-
export { createServerSkillAgent } from './deepagent/skill-agent.js';
|
|
10
|
-
export { multiUserMiddleware, verifyFirebaseAuth } from './middleware/multi-user.js';
|
|
11
|
-
export { setupStateSyncWebSocket } from './websocket/state-sync.js';
|
|
12
|
-
export { default as observabilityRouter } from './routes/observability.js';
|
|
13
|
-
export { default as admin } from 'firebase-admin';
|
|
14
|
-
import 'ws';
|
|
15
|
-
import 'http';
|
|
16
|
-
import 'zod';
|
|
17
|
-
import '@almadar/core';
|
|
18
|
-
import '@almadar/agent';
|
|
19
|
-
import 'express-serve-static-core';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Debug Events Router
|
|
23
|
-
*
|
|
24
|
-
* Provides diagnostic endpoints for inspecting the server EventBus.
|
|
25
|
-
* Only active when NODE_ENV=development.
|
|
26
|
-
*
|
|
27
|
-
* Endpoints:
|
|
28
|
-
* GET /event-log - Recent emitted events with listener counts
|
|
29
|
-
* DELETE /event-log - Clear the event log
|
|
30
|
-
* GET /listeners - Registered listener counts per event
|
|
31
|
-
*
|
|
32
|
-
* @packageDocumentation
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Creates an Express router with debug endpoints for the server EventBus.
|
|
37
|
-
* Returns a no-op router in production (no routes registered).
|
|
38
|
-
*/
|
|
39
|
-
declare function debugEventsRouter(): Router;
|
|
40
|
-
|
|
41
|
-
export { debugEventsRouter };
|
package/dist/lib/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { c as closeWebSocketServer, e as emitEntityEvent, b as env, g as getAuth, f as getConnectedClientCount, h as getFirestore, i as getWebSocketServer, l as logger, s as serverEventBus, k as setupEventBroadcast } from '../index-B64ll_cY.js';
|
|
2
|
-
export { default as admin } from 'firebase-admin';
|
|
3
|
-
import 'ws';
|
|
4
|
-
import 'http';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
import { AnyZodObject } from 'zod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Base application error class
|
|
6
|
-
*/
|
|
7
|
-
declare class AppError extends Error {
|
|
8
|
-
statusCode: number;
|
|
9
|
-
message: string;
|
|
10
|
-
code?: string | undefined;
|
|
11
|
-
constructor(statusCode: number, message: string, code?: string | undefined);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 404 Not Found error
|
|
15
|
-
*/
|
|
16
|
-
declare class NotFoundError extends AppError {
|
|
17
|
-
constructor(message?: string);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 400 Bad Request / Validation error
|
|
21
|
-
*/
|
|
22
|
-
declare class ValidationError extends AppError {
|
|
23
|
-
constructor(message?: string);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 401 Unauthorized error
|
|
27
|
-
*/
|
|
28
|
-
declare class UnauthorizedError extends AppError {
|
|
29
|
-
constructor(message?: string);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 403 Forbidden error
|
|
33
|
-
*/
|
|
34
|
-
declare class ForbiddenError extends AppError {
|
|
35
|
-
constructor(message?: string);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* 409 Conflict error
|
|
39
|
-
*/
|
|
40
|
-
declare class ConflictError extends AppError {
|
|
41
|
-
constructor(message?: string);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Global error handler middleware
|
|
45
|
-
*/
|
|
46
|
-
declare const errorHandler: (err: Error, _req: Request, res: Response, _next: NextFunction) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Async handler wrapper to catch errors in async route handlers
|
|
49
|
-
*/
|
|
50
|
-
declare const asyncHandler: (fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>) => (req: Request, res: Response, next: NextFunction) => void;
|
|
51
|
-
/**
|
|
52
|
-
* 404 handler for unmatched routes
|
|
53
|
-
*/
|
|
54
|
-
declare const notFoundHandler: (req: Request, res: Response) => void;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Middleware to validate request body against a Zod schema
|
|
58
|
-
*/
|
|
59
|
-
declare const validateBody: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Middleware to validate request query parameters against a Zod schema
|
|
62
|
-
*/
|
|
63
|
-
declare const validateQuery: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Middleware to validate request params against a Zod schema
|
|
66
|
-
*/
|
|
67
|
-
declare const validateParams: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
68
|
-
|
|
69
|
-
declare function authenticateFirebase(req: Request, res: Response, next: NextFunction): Promise<void | Response<any, Record<string, any>>>;
|
|
70
|
-
|
|
71
|
-
export { AppError, ConflictError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError, asyncHandler, authenticateFirebase, errorHandler, notFoundHandler, validateBody, validateParams, validateQuery };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Multi-User Middleware
|
|
5
|
-
*
|
|
6
|
-
* Provides user isolation and session ownership using Firebase Auth.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
namespace Express {
|
|
13
|
-
interface Request {
|
|
14
|
-
user?: {
|
|
15
|
-
uid: string;
|
|
16
|
-
email?: string;
|
|
17
|
-
roles?: string[];
|
|
18
|
-
orgId?: string;
|
|
19
|
-
};
|
|
20
|
-
userContext?: {
|
|
21
|
-
userId: string;
|
|
22
|
-
orgId?: string;
|
|
23
|
-
roles?: string[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Middleware to set up user context from Firebase Auth
|
|
30
|
-
*/
|
|
31
|
-
declare function multiUserMiddleware(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Verify Firebase Auth token from Authorization header
|
|
34
|
-
*/
|
|
35
|
-
declare function verifyFirebaseAuth(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
36
|
-
|
|
37
|
-
export { multiUserMiddleware, verifyFirebaseAuth };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as express_serve_static_core from 'express-serve-static-core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Observability Routes
|
|
5
|
-
*
|
|
6
|
-
* Provides endpoints for metrics, health checks, and telemetry.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
declare const router: express_serve_static_core.Router;
|
|
11
|
-
|
|
12
|
-
export { router as default };
|
package/dist/services/index.d.ts
DELETED