@almadar/server 1.4.5 → 2.0.1

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 (83) hide show
  1. package/LICENSE +21 -72
  2. package/README.md +25 -0
  3. package/dist/deepagent/__tests__/memory.test.d.ts +6 -0
  4. package/dist/deepagent/__tests__/memory.test.d.ts.map +1 -0
  5. package/dist/deepagent/__tests__/session.test.d.ts +6 -0
  6. package/dist/deepagent/__tests__/session.test.d.ts.map +1 -0
  7. package/dist/deepagent/__tests__/skill-agent.test.d.ts +6 -0
  8. package/dist/deepagent/__tests__/skill-agent.test.d.ts.map +1 -0
  9. package/dist/deepagent/memory.d.ts +4 -7
  10. package/dist/deepagent/memory.d.ts.map +1 -0
  11. package/dist/deepagent/session.d.ts +4 -7
  12. package/dist/deepagent/session.d.ts.map +1 -0
  13. package/dist/deepagent/skill-agent.d.ts +6 -8
  14. package/dist/deepagent/skill-agent.d.ts.map +1 -0
  15. package/dist/index.d.ts +30 -36
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +435 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/lib/db.d.ts +36 -0
  20. package/dist/lib/db.d.ts.map +1 -0
  21. package/dist/lib/debugRouter.d.ts +20 -0
  22. package/dist/lib/debugRouter.d.ts.map +1 -0
  23. package/dist/lib/env.d.ts +16 -0
  24. package/dist/lib/env.d.ts.map +1 -0
  25. package/dist/lib/eventBus.d.ts +46 -0
  26. package/dist/lib/eventBus.d.ts.map +1 -0
  27. package/dist/lib/eventBusTransport.d.ts +143 -0
  28. package/dist/lib/eventBusTransport.d.ts.map +1 -0
  29. package/dist/lib/eventPersistence.d.ts +151 -0
  30. package/dist/lib/eventPersistence.d.ts.map +1 -0
  31. package/dist/lib/index.d.ts +6 -4
  32. package/dist/lib/index.d.ts.map +1 -0
  33. package/dist/lib/logger.d.ts +7 -0
  34. package/dist/lib/logger.d.ts.map +1 -0
  35. package/dist/lib/serviceDiscovery.d.ts +168 -0
  36. package/dist/lib/serviceDiscovery.d.ts.map +1 -0
  37. package/dist/lib/websocket.d.ts +41 -0
  38. package/dist/lib/websocket.d.ts.map +1 -0
  39. package/dist/middleware/__tests__/multi-user.test.d.ts +6 -0
  40. package/dist/middleware/__tests__/multi-user.test.d.ts.map +1 -0
  41. package/dist/middleware/authenticateFirebase.d.ts +4 -0
  42. package/dist/middleware/authenticateFirebase.d.ts.map +1 -0
  43. package/dist/middleware/errorHandler.d.ts +53 -0
  44. package/dist/middleware/errorHandler.d.ts.map +1 -0
  45. package/dist/middleware/index.d.ts +4 -71
  46. package/dist/middleware/index.d.ts.map +1 -0
  47. package/dist/middleware/multi-user.d.ts +4 -7
  48. package/dist/middleware/multi-user.d.ts.map +1 -0
  49. package/dist/middleware/validation.d.ts +15 -0
  50. package/dist/middleware/validation.d.ts.map +1 -0
  51. package/dist/routes/__tests__/observability.test.d.ts +6 -0
  52. package/dist/routes/__tests__/observability.test.d.ts.map +1 -0
  53. package/dist/services/DataService.d.ts +69 -0
  54. package/dist/services/DataService.d.ts.map +1 -0
  55. package/dist/{index-D8fohXsO.d.ts → services/MockDataService.d.ts} +9 -78
  56. package/dist/services/MockDataService.d.ts.map +1 -0
  57. package/dist/services/index.d.ts +8 -2
  58. package/dist/services/index.d.ts.map +1 -0
  59. package/dist/stores/ChangeSetStore.d.ts +24 -0
  60. package/dist/stores/ChangeSetStore.d.ts.map +1 -0
  61. package/dist/stores/SchemaProtectionService.d.ts +23 -0
  62. package/dist/stores/SchemaProtectionService.d.ts.map +1 -0
  63. package/dist/stores/SchemaStore.d.ts +52 -0
  64. package/dist/stores/SchemaStore.d.ts.map +1 -0
  65. package/dist/stores/SnapshotStore.d.ts +26 -0
  66. package/dist/stores/SnapshotStore.d.ts.map +1 -0
  67. package/dist/stores/ValidationStore.d.ts +19 -0
  68. package/dist/stores/ValidationStore.d.ts.map +1 -0
  69. package/dist/stores/firestoreFormat.d.ts +21 -0
  70. package/dist/stores/firestoreFormat.d.ts.map +1 -0
  71. package/dist/stores/index.d.ts +10 -163
  72. package/dist/stores/index.d.ts.map +1 -0
  73. package/dist/utils/index.d.ts +4 -73
  74. package/dist/utils/index.d.ts.map +1 -0
  75. package/dist/utils/queryFilters.d.ts +77 -0
  76. package/dist/utils/queryFilters.d.ts.map +1 -0
  77. package/dist/websocket/__tests__/state-sync.test.d.ts +6 -0
  78. package/dist/websocket/__tests__/state-sync.test.d.ts.map +1 -0
  79. package/dist/websocket/state-sync.d.ts +3 -3
  80. package/dist/websocket/state-sync.d.ts.map +1 -0
  81. package/package.json +9 -13
  82. package/dist/index-B64ll_cY.d.ts +0 -149
  83. package/dist/routes/observability.d.ts +0 -12
@@ -0,0 +1,41 @@
1
+ /**
2
+ * WebSocket Event Broadcast - Cross-client event synchronization
3
+ *
4
+ * Broadcasts server-side events to all connected clients via WebSocket.
5
+ * This enables real-time updates across multiple browser clients.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { WebSocketServer } from 'ws';
10
+ import type { Server } from 'http';
11
+ /**
12
+ * Setup WebSocket server for event broadcasting.
13
+ *
14
+ * Listens to all server events via wildcard and broadcasts to connected clients.
15
+ *
16
+ * @param server - HTTP server to attach WebSocket to
17
+ * @param path - WebSocket endpoint path (default: '/ws/events')
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { createServer } from 'http';
22
+ * import { setupEventBroadcast } from '@/lib/websocket';
23
+ *
24
+ * const server = createServer(app);
25
+ * setupEventBroadcast(server);
26
+ * ```
27
+ */
28
+ export declare function setupEventBroadcast(server: Server, path?: string): WebSocketServer;
29
+ /**
30
+ * Get the WebSocket server instance (for testing or advanced usage)
31
+ */
32
+ export declare function getWebSocketServer(): WebSocketServer | null;
33
+ /**
34
+ * Close the WebSocket server
35
+ */
36
+ export declare function closeWebSocketServer(): Promise<void>;
37
+ /**
38
+ * Get connected client count
39
+ */
40
+ export declare function getConnectedClientCount(): number;
41
+ //# sourceMappingURL=websocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../src/lib/websocket.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAA2B,MAAM,IAAI,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,MAAM,CAAC;AAmBpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAqB,GAAG,eAAe,CA8EhG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAE3D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBpD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAGhD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @fileoverview Unit tests for multi-user middleware
3
+ * @module @almadar/server/middleware/multi-user.test
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=multi-user.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-user.test.d.ts","sourceRoot":"","sources":["../../../src/middleware/__tests__/multi-user.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,4 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export declare function authenticateFirebase(req: Request, res: Response, next: NextFunction): Promise<void | Response<any, Record<string, any>>>;
3
+ export default authenticateFirebase;
4
+ //# sourceMappingURL=authenticateFirebase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticateFirebase.d.ts","sourceRoot":"","sources":["../../src/middleware/authenticateFirebase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwB1D,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,sDA0BzF;AAED,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ /**
3
+ * Base application error class
4
+ */
5
+ export declare class AppError extends Error {
6
+ statusCode: number;
7
+ message: string;
8
+ code?: string | undefined;
9
+ constructor(statusCode: number, message: string, code?: string | undefined);
10
+ }
11
+ /**
12
+ * 404 Not Found error
13
+ */
14
+ export declare class NotFoundError extends AppError {
15
+ constructor(message?: string);
16
+ }
17
+ /**
18
+ * 400 Bad Request / Validation error
19
+ */
20
+ export declare class ValidationError extends AppError {
21
+ constructor(message?: string);
22
+ }
23
+ /**
24
+ * 401 Unauthorized error
25
+ */
26
+ export declare class UnauthorizedError extends AppError {
27
+ constructor(message?: string);
28
+ }
29
+ /**
30
+ * 403 Forbidden error
31
+ */
32
+ export declare class ForbiddenError extends AppError {
33
+ constructor(message?: string);
34
+ }
35
+ /**
36
+ * 409 Conflict error
37
+ */
38
+ export declare class ConflictError extends AppError {
39
+ constructor(message?: string);
40
+ }
41
+ /**
42
+ * Global error handler middleware
43
+ */
44
+ export declare const errorHandler: (err: Error, _req: Request, res: Response, _next: NextFunction) => void;
45
+ /**
46
+ * Async handler wrapper to catch errors in async route handlers
47
+ */
48
+ export declare const asyncHandler: (fn: (req: Request, res: Response, next: NextFunction) => Promise<unknown>) => (req: Request, res: Response, next: NextFunction) => void;
49
+ /**
50
+ * 404 handler for unmatched routes
51
+ */
52
+ export declare const notFoundHandler: (req: Request, res: Response) => void;
53
+ //# sourceMappingURL=errorHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/middleware/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI1D;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAExB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,IAAI,CAAC,EAAE,MAAM;gBAFb,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,GAAE,MAA6B;CAGnD;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,GAAE,MAA4B;CAGlD;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,GAAE,MAAuB;CAG7C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,OAAO,GAAE,MAAoB;CAG1C;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,GAAE,MAA4B;CAGlD;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,KAAK,EACV,MAAM,OAAO,EACb,KAAK,QAAQ,EACb,OAAO,YAAY,KAClB,IA2CF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACtB,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,MACzE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,SAE/C,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,KAAG,IAM7D,CAAC"}
@@ -1,71 +1,4 @@
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
+ export { errorHandler, notFoundHandler, asyncHandler, AppError, NotFoundError, ValidationError, UnauthorizedError, ForbiddenError, ConflictError, } from './errorHandler';
2
+ export { validateBody, validateQuery, validateParams } from './validation';
3
+ export { authenticateFirebase } from './authenticateFirebase.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,5 +1,3 @@
1
- import { Request, Response, NextFunction } from 'express';
2
-
3
1
  /**
4
2
  * Multi-User Middleware
5
3
  *
@@ -7,7 +5,7 @@ import { Request, Response, NextFunction } from 'express';
7
5
  *
8
6
  * @packageDocumentation
9
7
  */
10
-
8
+ import type { Request, Response, NextFunction } from 'express';
11
9
  declare global {
12
10
  namespace Express {
13
11
  interface Request {
@@ -28,10 +26,9 @@ declare global {
28
26
  /**
29
27
  * Middleware to set up user context from Firebase Auth
30
28
  */
31
- declare function multiUserMiddleware(req: Request, res: Response, next: NextFunction): Promise<void>;
29
+ export declare function multiUserMiddleware(req: Request, res: Response, next: NextFunction): Promise<void>;
32
30
  /**
33
31
  * Verify Firebase Auth token from Authorization header
34
32
  */
35
- declare function verifyFirebaseAuth(req: Request, res: Response, next: NextFunction): Promise<void>;
36
-
37
- export { multiUserMiddleware, verifyFirebaseAuth };
33
+ export declare function verifyFirebaseAuth(req: Request, res: Response, next: NextFunction): Promise<void>;
34
+ //# sourceMappingURL=multi-user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-user.d.ts","sourceRoot":"","sources":["../../src/middleware/multi-user.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO,CAAC;QAChB,UAAU,OAAO;YACf,IAAI,CAAC,EAAE;gBACL,GAAG,EAAE,MAAM,CAAC;gBACZ,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;gBACjB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,WAAW,CAAC,EAAE;gBACZ,MAAM,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;aAClB,CAAC;SACH;KACF;CACF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
@@ -0,0 +1,15 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ import { AnyZodObject } from 'zod';
3
+ /**
4
+ * Middleware to validate request body against a Zod schema
5
+ */
6
+ export declare const validateBody: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
7
+ /**
8
+ * Middleware to validate request query parameters against a Zod schema
9
+ */
10
+ export declare const validateQuery: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
11
+ /**
12
+ * Middleware to validate request params against a Zod schema
13
+ */
14
+ export declare const validateParams: (schema: AnyZodObject) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
15
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/middleware/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAY,MAAM,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,YAAY,GACtB,QAAQ,YAAY,MAAY,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,OAAO,CAAC,IAAI,CAmB9F,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,aAAa,GACvB,QAAQ,YAAY,MAAY,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,OAAO,CAAC,IAAI,CAmB9F,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,cAAc,GACxB,QAAQ,YAAY,MAAY,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,KAAG,OAAO,CAAC,IAAI,CAmB9F,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @fileoverview Unit tests for observability routes
3
+ * @module @almadar/server/routes/observability.test
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=observability.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability.test.d.ts","sourceRoot":"","sources":["../../../src/routes/__tests__/observability.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * DataService - Unified data access abstraction
3
+ *
4
+ * Provides a common interface for data operations that can be backed by
5
+ * either MockDataService (for development) or Firebase (for production).
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { type FieldSchema } from './MockDataService.js';
10
+ import { type ParsedFilter } from '../utils/queryFilters.js';
11
+ interface BaseEntity {
12
+ id: string;
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ }
16
+ /**
17
+ * Pagination options for list queries
18
+ */
19
+ export interface PaginationOptions {
20
+ /** Page number (1-indexed) */
21
+ page?: number;
22
+ /** Number of items per page */
23
+ pageSize?: number;
24
+ /** Search term to filter results */
25
+ search?: string;
26
+ /** Fields to search in (defaults to all string fields) */
27
+ searchFields?: string[];
28
+ /** Sort field */
29
+ sortBy?: string;
30
+ /** Sort direction */
31
+ sortOrder?: 'asc' | 'desc';
32
+ /** Filters parsed from query params */
33
+ filters?: ParsedFilter[];
34
+ }
35
+ /**
36
+ * Paginated response structure
37
+ */
38
+ export interface PaginatedResult<T> {
39
+ data: T[];
40
+ total: number;
41
+ page: number;
42
+ pageSize: number;
43
+ totalPages: number;
44
+ }
45
+ export interface DataService {
46
+ list<T>(collection: string): Promise<T[]>;
47
+ listPaginated<T>(collection: string, options?: PaginationOptions): Promise<PaginatedResult<T>>;
48
+ getById<T>(collection: string, id: string): Promise<T | null>;
49
+ create<T extends BaseEntity>(collection: string, data: Partial<T>): Promise<T>;
50
+ update<T extends BaseEntity>(collection: string, id: string, data: Partial<T>): Promise<T | null>;
51
+ delete(collection: string, id: string): Promise<boolean>;
52
+ }
53
+ /**
54
+ * Singleton data service instance.
55
+ * Use this in handlers for all data operations.
56
+ */
57
+ export declare const dataService: DataService;
58
+ export interface EntitySeedConfig {
59
+ name: string;
60
+ fields: FieldSchema[];
61
+ seedCount: number;
62
+ }
63
+ /**
64
+ * Seed mock data for multiple entities.
65
+ * Only works when USE_MOCK_DATA is enabled.
66
+ */
67
+ export declare function seedMockData(entities: EntitySeedConfig[]): void;
68
+ export {};
69
+ //# sourceMappingURL=DataService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataService.d.ts","sourceRoot":"","sources":["../../src/services/DataService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAMlC,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AAC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E,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAClG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D;AA6SD;;;GAGG;AACH,eAAO,MAAM,WAAW,aAAsB,CAAC;AAM/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAa/D"}
@@ -1,5 +1,3 @@
1
- import { ParsedFilter } from './utils/index.js';
2
-
3
1
  /**
4
2
  * MockDataService - In-memory data store with faker-based mock generation
5
3
  *
@@ -8,7 +6,7 @@ import { ParsedFilter } from './utils/index.js';
8
6
  *
9
7
  * @packageDocumentation
10
8
  */
11
- interface FieldSchema {
9
+ export interface FieldSchema {
12
10
  name: string;
13
11
  type: 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'relation' | 'array';
14
12
  required?: boolean;
@@ -18,11 +16,11 @@ interface FieldSchema {
18
16
  fakerMethod?: string;
19
17
  relatedEntity?: string;
20
18
  }
21
- interface EntitySchema {
19
+ export interface EntitySchema {
22
20
  fields: FieldSchema[];
23
21
  seedCount?: number;
24
22
  }
25
- interface BaseEntity$1 {
23
+ interface BaseEntity {
26
24
  id: string;
27
25
  createdAt: Date;
28
26
  updatedAt: Date;
@@ -30,7 +28,7 @@ interface BaseEntity$1 {
30
28
  /**
31
29
  * In-memory mock data store with CRUD operations and faker-based seeding.
32
30
  */
33
- declare class MockDataService {
31
+ export declare class MockDataService {
34
32
  private stores;
35
33
  private schemas;
36
34
  private idCounters;
@@ -84,11 +82,11 @@ declare class MockDataService {
84
82
  /**
85
83
  * Create a new item.
86
84
  */
87
- create<T extends BaseEntity$1>(entityName: string, data: Partial<T>): T;
85
+ create<T extends BaseEntity>(entityName: string, data: Partial<T>): T;
88
86
  /**
89
87
  * Update an existing item.
90
88
  */
91
- update<T extends BaseEntity$1>(entityName: string, id: string, data: Partial<T>): T | null;
89
+ update<T extends BaseEntity>(entityName: string, id: string, data: Partial<T>): T | null;
92
90
  /**
93
91
  * Delete an item.
94
92
  */
@@ -106,73 +104,6 @@ declare class MockDataService {
106
104
  */
107
105
  count(entityName: string): number;
108
106
  }
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 };
107
+ export declare const mockDataService: MockDataService;
108
+ export {};
109
+ //# sourceMappingURL=MockDataService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockDataService.d.ts","sourceRoot":"","sources":["../../src/services/MockDataService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAMD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAgD;IAC9D,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,UAAU,CAAkC;;IAcpD;;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AAwB,CAAC"}
@@ -1,2 +1,8 @@
1
- export { D as DataService, E as EntitySchema, a as EntitySeedConfig, F as FieldSchema, d as dataService, m as mockDataService, s as seedMockData } from '../index-D8fohXsO.js';
2
- import '../utils/index.js';
1
+ /**
2
+ * Services barrel export
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { mockDataService, type FieldSchema, type EntitySchema } from './MockDataService.js';
7
+ export { dataService, seedMockData, type DataService, type EntitySeedConfig } from './DataService.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * ChangeSetStore - Firestore CRUD for schema changesets
3
+ *
4
+ * Changesets track changes made to the schema over time,
5
+ * stored in subcollection: users/{uid}/apps/{appId}/changesets/{changeSetId}
6
+ */
7
+ import type { ChangeSetDocument } from '@almadar/core';
8
+ export declare class ChangeSetStore {
9
+ private appsCollection;
10
+ constructor(appsCollection?: string);
11
+ private getCollectionPath;
12
+ private getAppDocPath;
13
+ /** Append a changeset to history */
14
+ append(uid: string, appId: string, changeSet: ChangeSetDocument): Promise<void>;
15
+ /** Get change history for an app (ordered by version desc) */
16
+ getHistory(uid: string, appId: string): Promise<ChangeSetDocument[]>;
17
+ /** Get a specific changeset by ID */
18
+ get(uid: string, appId: string, changeSetId: string): Promise<ChangeSetDocument | null>;
19
+ /** Update a changeset's status */
20
+ updateStatus(uid: string, appId: string, changeSetId: string, status: 'applied' | 'reverted' | 'pending'): Promise<void>;
21
+ /** Delete a changeset */
22
+ delete(uid: string, appId: string, changeSetId: string): Promise<boolean>;
23
+ }
24
+ //# sourceMappingURL=ChangeSetStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeSetStore.d.ts","sourceRoot":"","sources":["../../src/stores/ChangeSetStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,eAAe,CAAC;AAKpE,qBAAa,cAAc;IACzB,OAAO,CAAC,cAAc,CAAS;gBAEnB,cAAc,SAAS;IAInC,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,aAAa;IAIrB,oCAAoC;IAC9B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrF,8DAA8D;IACxD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAe1E,qCAAqC;IAC/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAO7F,kCAAkC;IAC5B,YAAY,CAChB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GACzC,OAAO,CAAC,IAAI,CAAC;IAQhB,yBAAyB;IACnB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAyBhF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * SchemaProtectionService - Detects destructive schema changes
3
+ *
4
+ * Uses real diff functions from @almadar/core to detect and categorize
5
+ * removals, page content reductions, and other destructive changes.
6
+ */
7
+ import type { OrbitalSchema, CategorizedRemovals, PageContentReduction } from '@almadar/core';
8
+ export declare class SchemaProtectionService {
9
+ /**
10
+ * Compare two schemas and detect destructive changes.
11
+ *
12
+ * Returns categorized removals including page content reductions.
13
+ */
14
+ compareSchemas(before: OrbitalSchema, after: OrbitalSchema): {
15
+ isDestructive: boolean;
16
+ removals: CategorizedRemovals;
17
+ };
18
+ /** Check if critical removals require confirmation */
19
+ requiresConfirmation(removals: CategorizedRemovals): boolean;
20
+ /** Check for significant page content reductions */
21
+ hasSignificantContentReduction(reductions: PageContentReduction[]): boolean;
22
+ }
23
+ //# sourceMappingURL=SchemaProtectionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaProtectionService.d.ts","sourceRoot":"","sources":["../../src/stores/SchemaProtectionService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAU9F,qBAAa,uBAAuB;IAClC;;;;OAIG;IACH,cAAc,CACZ,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,aAAa,GACnB;QACD,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,mBAAmB,CAAC;KAC/B;IAiBD,sDAAsD;IACtD,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO;IAI5D,oDAAoD;IACpD,8BAA8B,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO;CAG5E"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * SchemaStore - Firestore CRUD for OrbitalSchema documents
3
+ *
4
+ * Handles schema get/save/create/delete/list with caching
5
+ * and Firestore serialization.
6
+ */
7
+ import type { OrbitalSchema, StatsView, AppSummary, SaveOptions, SaveResult } from '@almadar/core';
8
+ import type { SnapshotStore } from './SnapshotStore.js';
9
+ export declare class SchemaStore {
10
+ private appsCollection;
11
+ private schemaCache;
12
+ private listCache;
13
+ private protectionService;
14
+ private snapshotStore;
15
+ constructor(appsCollection?: string);
16
+ /** Set snapshot store for auto-snapshot on destructive saves */
17
+ setSnapshotStore(store: SnapshotStore): void;
18
+ /** Get a schema by app ID */
19
+ get(uid: string, appId: string): Promise<OrbitalSchema | null>;
20
+ /**
21
+ * Save a schema (create or full replace).
22
+ *
23
+ * Features:
24
+ * - Detects destructive changes (removals)
25
+ * - Requires confirmation for critical removals
26
+ * - Auto-creates snapshots before destructive changes (if SnapshotStore attached)
27
+ */
28
+ save(uid: string, appId: string, schema: OrbitalSchema, options?: SaveOptions): Promise<SaveResult>;
29
+ /** Create a new app with initial schema */
30
+ create(uid: string, metadata: {
31
+ name: string;
32
+ description?: string;
33
+ }): Promise<{
34
+ appId: string;
35
+ schema: OrbitalSchema;
36
+ }>;
37
+ /** Delete an app */
38
+ delete(uid: string, appId: string): Promise<boolean>;
39
+ /** List all apps for a user */
40
+ list(uid: string): Promise<AppSummary[]>;
41
+ /** Compute stats from OrbitalSchema */
42
+ computeStats(schema: OrbitalSchema): StatsView;
43
+ /** Invalidate caches for a specific app */
44
+ invalidateCache(uid: string, appId: string): void;
45
+ /** Clear all caches */
46
+ clearCaches(): void;
47
+ /** Get the collection path for an app */
48
+ getAppDocPath(uid: string, appId: string): string;
49
+ /** Expose apps collection name for subcollection stores */
50
+ getAppsCollection(): string;
51
+ }
52
+ //# sourceMappingURL=SchemaStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaStore.d.ts","sourceRoot":"","sources":["../../src/stores/SchemaStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAInG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKxD,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAmE;IACtF,OAAO,CAAC,S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+ * SnapshotStore - Firestore CRUD for schema snapshots
3
+ *
4
+ * Snapshots are full copies of the schema at a point in time,
5
+ * stored in subcollection: users/{uid}/apps/{appId}/snapshots/{snapshotId}
6
+ */
7
+ import type { OrbitalSchema, SnapshotDocument } from '@almadar/core';
8
+ export declare class SnapshotStore {
9
+ private appsCollection;
10
+ constructor(appsCollection?: string);
11
+ private getCollectionPath;
12
+ private getAppDocPath;
13
+ /** Create a snapshot of the current schema */
14
+ create(uid: string, appId: string, schema: OrbitalSchema, reason: string): Promise<string>;
15
+ /** Get all snapshots for an app (ordered by timestamp desc) */
16
+ getAll(uid: string, appId: string): Promise<SnapshotDocument[]>;
17
+ /** Get a specific snapshot by ID */
18
+ get(uid: string, appId: string, snapshotId: string): Promise<SnapshotDocument | null>;
19
+ /** Delete a snapshot */
20
+ delete(uid: string, appId: string, snapshotId: string): Promise<boolean>;
21
+ /** Get schema snapshot at a specific version */
22
+ getByVersion(uid: string, appId: string, version: number): Promise<OrbitalSchema | null>;
23
+ /** Get the schema from a snapshot (deserialized) */
24
+ getSchemaFromSnapshot(snapshot: SnapshotDocument): OrbitalSchema;
25
+ }
26
+ //# sourceMappingURL=SnapshotStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnapshotStore.d.ts","sourceRoot":"","sources":["../../src/stores/SnapshotStore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAe,MAAM,eAAe,CAAC;AAMlF,qBAAa,aAAa;IACxB,OAAO,CAAC,cAAc,CAAS;gBAEnB,cAAc,SAAS;IAInC,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,aAAa;IAIrB,8CAA8C;IACxC,MAAM,CACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IA6BlB,+DAA+D;IACzD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAUrE,oCAAoC;IAC9B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAO3F,wBAAwB;IAClB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA0B9E,gDAAgD;IAC1C,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAa9F,oDAAoD;IACpD,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,aAAa;CAGjE"}