@objectstack/spec 2.0.4 → 2.0.6

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 (57) hide show
  1. package/dist/contracts/index.d.mts +2 -2
  2. package/dist/contracts/index.d.ts +2 -2
  3. package/dist/contracts/index.js.map +1 -1
  4. package/dist/data/index.d.mts +2 -2
  5. package/dist/data/index.d.ts +2 -2
  6. package/dist/data/index.js +482 -453
  7. package/dist/data/index.js.map +1 -1
  8. package/dist/data/index.mjs +481 -453
  9. package/dist/data/index.mjs.map +1 -1
  10. package/dist/{driver.zod-DddW_4lJ.d.mts → driver.zod-DnOPgUGi.d.mts} +430 -1
  11. package/dist/{driver.zod-BJHWEbwG.d.ts → driver.zod-E3C6n0W-.d.ts} +430 -1
  12. package/dist/index-B-u2mVKn.d.mts +1965 -0
  13. package/dist/{index-yvEIvpa3.d.ts → index-BPhGHW32.d.ts} +4 -2
  14. package/dist/index-BjxWBAB_.d.ts +1965 -0
  15. package/dist/index-CDN6TRx9.d.mts +765 -0
  16. package/dist/index-CDN6TRx9.d.ts +765 -0
  17. package/dist/{index-Cp6xnrOM.d.mts → index-D-tf4nDV.d.mts} +4 -2
  18. package/dist/{index-DOuMlF5h.d.ts → index-DyawwLFZ.d.ts} +31 -2
  19. package/dist/{index-DPlvQwlz.d.mts → index-E1mP_eoE.d.mts} +31 -2
  20. package/dist/index.d.mts +38 -799
  21. package/dist/index.d.ts +38 -799
  22. package/dist/index.js +8585 -8556
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +8585 -8556
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/kernel/index.d.mts +1 -1
  27. package/dist/kernel/index.d.ts +1 -1
  28. package/dist/kernel/index.js +23 -0
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/kernel/index.mjs +22 -0
  31. package/dist/kernel/index.mjs.map +1 -1
  32. package/dist/security/index.d.mts +2 -0
  33. package/dist/security/index.d.ts +2 -0
  34. package/dist/security/index.js +666 -0
  35. package/dist/security/index.js.map +1 -0
  36. package/dist/security/index.mjs +616 -0
  37. package/dist/security/index.mjs.map +1 -0
  38. package/json-schema/data/BaseEngineOptions.json +49 -0
  39. package/json-schema/data/DataEngineAggregateOptions.json +42 -0
  40. package/json-schema/data/DataEngineAggregateRequest.json +42 -0
  41. package/json-schema/data/DataEngineBatchRequest.json +294 -0
  42. package/json-schema/data/DataEngineCountOptions.json +42 -0
  43. package/json-schema/data/DataEngineCountRequest.json +42 -0
  44. package/json-schema/data/DataEngineDeleteOptions.json +42 -0
  45. package/json-schema/data/DataEngineDeleteRequest.json +42 -0
  46. package/json-schema/data/DataEngineFindOneRequest.json +42 -0
  47. package/json-schema/data/DataEngineFindRequest.json +42 -0
  48. package/json-schema/data/DataEngineInsertOptions.json +42 -0
  49. package/json-schema/data/DataEngineInsertRequest.json +42 -0
  50. package/json-schema/data/DataEngineQueryOptions.json +42 -0
  51. package/json-schema/data/DataEngineRequest.json +588 -0
  52. package/json-schema/data/DataEngineUpdateOptions.json +42 -0
  53. package/json-schema/data/DataEngineUpdateRequest.json +42 -0
  54. package/json-schema/kernel/ExecutionContext.json +43 -0
  55. package/package.json +6 -1
  56. package/dist/index-C8xlxqpA.d.ts +0 -767
  57. package/dist/index-wFiQRott.d.mts +0 -767
@@ -0,0 +1,1965 @@
1
+ import { Q as QueryAST, a as FieldSchema } from './field.zod-DuaF0Lcl.js';
2
+ import { D as DataEngineQueryOptions, a as DataEngineInsertOptions, b as DataEngineUpdateOptions, c as DataEngineDeleteOptions, d as DataEngineCountOptions, e as DataEngineAggregateOptions, f as DataEngineRequest, g as DriverOptions, O as ObjectSchema } from './driver.zod-E3C6n0W-.js';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Logger Contract
7
+ *
8
+ * Defines the interface for logging in ObjectStack.
9
+ * Compatible with both browser console and structured logging systems.
10
+ */
11
+ interface Logger {
12
+ /**
13
+ * Log a debug message
14
+ * @param message - The message to log
15
+ * @param meta - Optional metadata to include
16
+ */
17
+ debug(message: string, meta?: Record<string, any>): void;
18
+ /**
19
+ * Log an informational message
20
+ * @param message - The message to log
21
+ * @param meta - Optional metadata to include
22
+ */
23
+ info(message: string, meta?: Record<string, any>): void;
24
+ /**
25
+ * Log a warning message
26
+ * @param message - The message to log
27
+ * @param meta - Optional metadata to include
28
+ */
29
+ warn(message: string, meta?: Record<string, any>): void;
30
+ /**
31
+ * Log an error message
32
+ * @param message - The message to log
33
+ * @param error - Optional error object
34
+ * @param meta - Optional metadata to include
35
+ */
36
+ error(message: string, error?: Error, meta?: Record<string, any>): void;
37
+ /**
38
+ * Log a fatal error message
39
+ * @param message - The message to log
40
+ * @param error - Optional error object
41
+ * @param meta - Optional metadata to include
42
+ */
43
+ fatal?(message: string, error?: Error, meta?: Record<string, any>): void;
44
+ /**
45
+ * Create a child logger with additional context
46
+ * @param context - Context to add to all logs from this child
47
+ */
48
+ child?(context: Record<string, any>): Logger;
49
+ /**
50
+ * Set trace context for distributed tracing
51
+ * @param traceId - Trace identifier
52
+ * @param spanId - Span identifier
53
+ */
54
+ withTrace?(traceId: string, spanId?: string): Logger;
55
+ /**
56
+ * Compatibility method for console.log usage
57
+ * @param message - The message to log
58
+ * @param args - Additional arguments
59
+ */
60
+ log?(message: string, ...args: any[]): void;
61
+ /**
62
+ * Cleanup resources (close file streams, etc.)
63
+ * Should be called when the logger is no longer needed
64
+ */
65
+ destroy?(): Promise<void>;
66
+ }
67
+
68
+ /**
69
+ * IDataEngine - Standard Data Engine Interface
70
+ *
71
+ * Abstract interface for data persistence capabilities.
72
+ * Following the Dependency Inversion Principle - plugins depend on this interface,
73
+ * not on concrete database implementations.
74
+ *
75
+ * Aligned with 'src/data/data-engine.zod.ts' in @objectstack/spec.
76
+ */
77
+ interface IDataEngine {
78
+ find(objectName: string, query?: DataEngineQueryOptions): Promise<any[]>;
79
+ findOne(objectName: string, query?: DataEngineQueryOptions): Promise<any>;
80
+ insert(objectName: string, data: any | any[], options?: DataEngineInsertOptions): Promise<any>;
81
+ update(objectName: string, data: any, options?: DataEngineUpdateOptions): Promise<any>;
82
+ delete(objectName: string, options?: DataEngineDeleteOptions): Promise<any>;
83
+ count(objectName: string, query?: DataEngineCountOptions): Promise<number>;
84
+ aggregate(objectName: string, query: DataEngineAggregateOptions): Promise<any[]>;
85
+ /**
86
+ * Vector Search (AI/RAG)
87
+ */
88
+ vectorFind?(objectName: string, vector: number[], options?: {
89
+ filter?: any;
90
+ limit?: number;
91
+ select?: string[];
92
+ threshold?: number;
93
+ }): Promise<any[]>;
94
+ /**
95
+ * Batch Operations (Transactional)
96
+ */
97
+ batch?(requests: DataEngineRequest[], options?: {
98
+ transaction?: boolean;
99
+ }): Promise<any[]>;
100
+ /**
101
+ * Execute raw command (Escape hatch)
102
+ */
103
+ execute?(command: any, options?: Record<string, any>): Promise<any>;
104
+ }
105
+ interface DriverInterface {
106
+ name: string;
107
+ version: string;
108
+ connect(): Promise<void>;
109
+ disconnect(): Promise<void>;
110
+ find(object: string, query: QueryAST, options?: DriverOptions): Promise<any[]>;
111
+ findOne(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
112
+ create(object: string, data: any, options?: DriverOptions): Promise<any>;
113
+ update(object: string, id: any, data: any, options?: DriverOptions): Promise<any>;
114
+ delete(object: string, id: any, options?: DriverOptions): Promise<any>;
115
+ /**
116
+ * Bulk & Batch Operations
117
+ */
118
+ bulkCreate?(object: string, data: any[], options?: DriverOptions): Promise<any>;
119
+ updateMany?(object: string, query: QueryAST, data: any, options?: DriverOptions): Promise<any>;
120
+ deleteMany?(object: string, query: QueryAST, options?: DriverOptions): Promise<any>;
121
+ count?(object: string, query: QueryAST, options?: DriverOptions): Promise<number>;
122
+ /**
123
+ * Raw Execution
124
+ */
125
+ execute?(command: any, params?: any, options?: DriverOptions): Promise<any>;
126
+ }
127
+
128
+ /**
129
+ * IHttpServer - Standard HTTP Server Interface
130
+ *
131
+ * Abstract interface for HTTP server capabilities.
132
+ * This allows plugins to interact with HTTP servers without knowing
133
+ * the underlying implementation (Express, Fastify, Hono, etc.).
134
+ *
135
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
136
+ * not on concrete HTTP framework implementations.
137
+ */
138
+ /**
139
+ * Generic HTTP Request type
140
+ * Abstraction over framework-specific request objects
141
+ */
142
+ interface IHttpRequest {
143
+ /** Request path parameters */
144
+ params: Record<string, string>;
145
+ /** Request query parameters */
146
+ query: Record<string, string | string[]>;
147
+ /** Request body */
148
+ body?: any;
149
+ /** Request headers */
150
+ headers: Record<string, string | string[]>;
151
+ /** HTTP method */
152
+ method: string;
153
+ /** Request path */
154
+ path: string;
155
+ }
156
+ /**
157
+ * Generic HTTP Response type
158
+ * Abstraction over framework-specific response objects
159
+ */
160
+ interface IHttpResponse {
161
+ /**
162
+ * Send a JSON response
163
+ * @param data - Data to send
164
+ */
165
+ json(data: any): void | Promise<void>;
166
+ /**
167
+ * Send a text/html response
168
+ * @param data - Data to send
169
+ */
170
+ send(data: string): void | Promise<void>;
171
+ /**
172
+ * Set HTTP status code
173
+ * @param code - HTTP status code
174
+ */
175
+ status(code: number): IHttpResponse;
176
+ /**
177
+ * Set response header
178
+ * @param name - Header name
179
+ * @param value - Header value (string or array of strings for multi-value headers)
180
+ */
181
+ header(name: string, value: string | string[]): IHttpResponse;
182
+ }
183
+ /**
184
+ * Route handler function
185
+ */
186
+ type RouteHandler = (req: IHttpRequest, res: IHttpResponse) => void | Promise<void>;
187
+ /**
188
+ * Middleware function
189
+ */
190
+ type Middleware = (req: IHttpRequest, res: IHttpResponse, next: () => void | Promise<void>) => void | Promise<void>;
191
+ /**
192
+ * IHttpServer - HTTP Server capability interface
193
+ *
194
+ * Defines the contract for HTTP server implementations.
195
+ * Concrete implementations (Express, Fastify, Hono) should implement this interface.
196
+ */
197
+ interface IHttpServer {
198
+ /**
199
+ * Register a GET route handler
200
+ * @param path - Route path (e.g., '/api/users/:id')
201
+ * @param handler - Route handler function
202
+ */
203
+ get(path: string, handler: RouteHandler): void;
204
+ /**
205
+ * Register a POST route handler
206
+ * @param path - Route path
207
+ * @param handler - Route handler function
208
+ */
209
+ post(path: string, handler: RouteHandler): void;
210
+ /**
211
+ * Register a PUT route handler
212
+ * @param path - Route path
213
+ * @param handler - Route handler function
214
+ */
215
+ put(path: string, handler: RouteHandler): void;
216
+ /**
217
+ * Register a DELETE route handler
218
+ * @param path - Route path
219
+ * @param handler - Route handler function
220
+ */
221
+ delete(path: string, handler: RouteHandler): void;
222
+ /**
223
+ * Register a PATCH route handler
224
+ * @param path - Route path
225
+ * @param handler - Route handler function
226
+ */
227
+ patch(path: string, handler: RouteHandler): void;
228
+ /**
229
+ * Register middleware
230
+ * @param path - Optional path to apply middleware to (if omitted, applies globally)
231
+ * @param handler - Middleware function
232
+ */
233
+ use(path: string | Middleware, handler?: Middleware): void;
234
+ /**
235
+ * Start the HTTP server
236
+ * @param port - Port number to listen on
237
+ * @returns Promise that resolves when server is ready
238
+ */
239
+ listen(port: number): Promise<void>;
240
+ /**
241
+ * Stop the HTTP server
242
+ * @returns Promise that resolves when server is stopped
243
+ */
244
+ close?(): Promise<void>;
245
+ }
246
+
247
+ /**
248
+ * IServiceRegistry - Service Registry Interface
249
+ *
250
+ * Abstract interface for managing service registration and lookup.
251
+ * This provides a single source of truth for all services in the system.
252
+ *
253
+ * Following the Dependency Inversion Principle - both kernel implementations
254
+ * and plugins depend on this interface, not on concrete implementations.
255
+ */
256
+ interface IServiceRegistry {
257
+ /**
258
+ * Register a service with a unique name
259
+ * @param name - Unique service identifier
260
+ * @param service - The service instance to register
261
+ * @throws Error if service name is already registered
262
+ */
263
+ register<T>(name: string, service: T): void;
264
+ /**
265
+ * Get a registered service by name (synchronous)
266
+ * @param name - Service identifier
267
+ * @returns The registered service
268
+ * @throws Error if service is not found
269
+ */
270
+ get<T>(name: string): T;
271
+ /**
272
+ * Get a registered service by name (asynchronous)
273
+ * Useful for lazy-loaded or async-initialized services
274
+ * @param name - Service identifier
275
+ * @param scopeId - Optional scope identifier for scoped services
276
+ * @returns Promise resolving to the registered service
277
+ * @throws Error if service is not found
278
+ */
279
+ getAsync<T>(name: string, scopeId?: string): Promise<T>;
280
+ /**
281
+ * Check if a service is registered
282
+ * @param name - Service identifier
283
+ * @returns True if service is registered, false otherwise
284
+ */
285
+ has(name: string): boolean;
286
+ /**
287
+ * Unregister a service
288
+ * @param name - Service identifier
289
+ * @returns True if service was unregistered, false if it wasn't registered
290
+ */
291
+ unregister(name: string): boolean;
292
+ /**
293
+ * Get all registered service names
294
+ * @returns Array of service names
295
+ */
296
+ getServiceNames?(): string[];
297
+ /**
298
+ * Clear all registered services
299
+ * Useful for cleanup in tests or during shutdown
300
+ */
301
+ clear?(): void;
302
+ }
303
+ /**
304
+ * BasicServiceRegistry - Simple synchronous implementation
305
+ * Used by ObjectKernel for basic service management
306
+ */
307
+ interface IBasicServiceRegistry extends IServiceRegistry {
308
+ }
309
+ /**
310
+ * AdvancedServiceRegistry - Enhanced implementation with additional features
311
+ * Used by ObjectKernel for advanced service management
312
+ */
313
+ interface IAdvancedServiceRegistry extends IServiceRegistry {
314
+ /**
315
+ * Register a factory function that creates services on-demand
316
+ * @param name - Service identifier
317
+ * @param factory - Factory function that creates the service
318
+ * @param singleton - If true, factory is called once and result is cached
319
+ */
320
+ registerFactory?<T>(name: string, factory: () => T | Promise<T>, singleton?: boolean): void;
321
+ /**
322
+ * Register a scoped service (per-request, per-session, etc.)
323
+ * @param name - Service identifier
324
+ * @param factory - Factory function that creates the service
325
+ * @param scopeType - Type of scope ('request', 'session', 'transaction', etc.)
326
+ */
327
+ registerScoped?<T>(name: string, factory: (scopeId: string) => T | Promise<T>, scopeType: string): void;
328
+ /**
329
+ * Create a new scope for scoped services
330
+ * @param scopeType - Type of scope
331
+ * @returns Scope identifier
332
+ */
333
+ createScope?(scopeType: string): string;
334
+ /**
335
+ * Dispose a scope and cleanup scoped services
336
+ * @param scopeId - Scope identifier
337
+ */
338
+ disposeScope?(scopeId: string): Promise<void>;
339
+ }
340
+
341
+ /**
342
+ * IPluginValidator - Plugin Validator Interface
343
+ *
344
+ * Abstract interface for validating plugins before registration and startup.
345
+ * Extracted from PluginLoader to follow Single Responsibility Principle.
346
+ */
347
+ /**
348
+ * Validation result for a plugin
349
+ */
350
+ interface ValidationResult {
351
+ /**
352
+ * Whether the plugin passed validation
353
+ */
354
+ valid: boolean;
355
+ /**
356
+ * Validation errors (if any)
357
+ */
358
+ errors?: Array<{
359
+ field: string;
360
+ message: string;
361
+ code?: string;
362
+ }>;
363
+ /**
364
+ * Validation warnings (non-fatal issues)
365
+ */
366
+ warnings?: Array<{
367
+ field: string;
368
+ message: string;
369
+ code?: string;
370
+ }>;
371
+ }
372
+ /**
373
+ * Plugin metadata for validation
374
+ */
375
+ interface Plugin {
376
+ /**
377
+ * Unique plugin identifier
378
+ */
379
+ name: string;
380
+ /**
381
+ * Plugin version (semver)
382
+ */
383
+ version?: string;
384
+ /**
385
+ * Plugin dependencies
386
+ */
387
+ dependencies?: string[];
388
+ /**
389
+ * Plugin initialization function
390
+ */
391
+ init?: (context: any) => void | Promise<void>;
392
+ /**
393
+ * Plugin startup function
394
+ */
395
+ start?: (context: any) => void | Promise<void>;
396
+ /**
397
+ * Plugin destruction function
398
+ */
399
+ destroy?: (context: any) => void | Promise<void>;
400
+ /**
401
+ * Plugin signature for verification (optional)
402
+ */
403
+ signature?: string;
404
+ /**
405
+ * Additional plugin metadata
406
+ */
407
+ [key: string]: any;
408
+ }
409
+ /**
410
+ * IPluginValidator - Plugin validation interface
411
+ */
412
+ interface IPluginValidator {
413
+ /**
414
+ * Validate a plugin object structure
415
+ * @param plugin - Plugin to validate
416
+ * @returns Validation result
417
+ */
418
+ validate(plugin: unknown): ValidationResult;
419
+ /**
420
+ * Validate plugin version format (semver)
421
+ * @param version - Version string to validate
422
+ * @returns True if version is valid, false otherwise
423
+ */
424
+ validateVersion(version: string): boolean;
425
+ /**
426
+ * Validate plugin cryptographic signature (optional)
427
+ * Used for plugin security verification
428
+ * @param plugin - Plugin to validate
429
+ * @returns Promise resolving to true if signature is valid
430
+ */
431
+ validateSignature?(plugin: Plugin): Promise<boolean>;
432
+ /**
433
+ * Validate plugin dependencies are satisfied
434
+ * @param plugin - Plugin to validate
435
+ * @param registry - Map of already registered plugins
436
+ * @throws Error if dependencies are not satisfied
437
+ */
438
+ validateDependencies(plugin: Plugin, registry: Map<string, Plugin>): void;
439
+ /**
440
+ * Validate plugin has required lifecycle methods
441
+ * @param plugin - Plugin to validate
442
+ * @returns True if plugin has valid lifecycle methods
443
+ */
444
+ validateLifecycle?(plugin: Plugin): boolean;
445
+ }
446
+
447
+ /**
448
+ * IStartupOrchestrator - Startup Orchestrator Interface
449
+ *
450
+ * Abstract interface for orchestrating plugin startup with advanced features:
451
+ * - Timeout handling
452
+ * - Rollback on failure
453
+ * - Health checks
454
+ * - Startup metrics
455
+ *
456
+ * Extracted from PluginLoader to follow Single Responsibility Principle.
457
+ */
458
+ /**
459
+ * Startup options for orchestration
460
+ */
461
+ interface StartupOptions {
462
+ /**
463
+ * Maximum time (ms) to wait for each plugin to start
464
+ * @default 30000 (30 seconds)
465
+ */
466
+ timeout?: number;
467
+ /**
468
+ * Whether to rollback (destroy) already-started plugins on failure
469
+ * @default true
470
+ */
471
+ rollbackOnFailure?: boolean;
472
+ /**
473
+ * Whether to run health checks after startup
474
+ * @default false
475
+ */
476
+ healthCheck?: boolean;
477
+ /**
478
+ * Whether to run plugins in parallel (if dependencies allow)
479
+ * @default false (sequential startup)
480
+ */
481
+ parallel?: boolean;
482
+ /**
483
+ * Custom context to pass to plugin lifecycle methods
484
+ */
485
+ context?: any;
486
+ }
487
+ /**
488
+ * Plugin startup result
489
+ */
490
+ interface PluginStartupResult {
491
+ /**
492
+ * Plugin that was started
493
+ */
494
+ plugin: Plugin;
495
+ /**
496
+ * Whether startup was successful
497
+ */
498
+ success: boolean;
499
+ /**
500
+ * Time taken to start (milliseconds)
501
+ */
502
+ duration: number;
503
+ /**
504
+ * Error if startup failed
505
+ */
506
+ error?: Error;
507
+ /**
508
+ * Health status after startup (if healthCheck enabled)
509
+ */
510
+ health?: HealthStatus;
511
+ }
512
+ /**
513
+ * Health status for a plugin
514
+ */
515
+ interface HealthStatus {
516
+ /**
517
+ * Whether the plugin is healthy
518
+ */
519
+ healthy: boolean;
520
+ /**
521
+ * Health check timestamp
522
+ */
523
+ timestamp: number;
524
+ /**
525
+ * Optional health details
526
+ */
527
+ details?: Record<string, any>;
528
+ /**
529
+ * Optional error message if unhealthy
530
+ */
531
+ message?: string;
532
+ }
533
+ /**
534
+ * IStartupOrchestrator - Plugin startup orchestration interface
535
+ */
536
+ interface IStartupOrchestrator {
537
+ /**
538
+ * Orchestrate startup of multiple plugins
539
+ * Handles timeout, rollback, and health checks
540
+ * @param plugins - Array of plugins to start (in dependency order)
541
+ * @param options - Startup options
542
+ * @returns Promise resolving to startup results for each plugin
543
+ */
544
+ orchestrateStartup(plugins: Plugin[], options: StartupOptions): Promise<PluginStartupResult[]>;
545
+ /**
546
+ * Rollback (destroy) a set of plugins
547
+ * Used when startup fails and rollback is enabled
548
+ * @param startedPlugins - Plugins that were successfully started
549
+ * @returns Promise that resolves when rollback is complete
550
+ */
551
+ rollback(startedPlugins: Plugin[]): Promise<void>;
552
+ /**
553
+ * Check health of a single plugin
554
+ * @param plugin - Plugin to check
555
+ * @returns Promise resolving to health status
556
+ */
557
+ checkHealth(plugin: Plugin): Promise<HealthStatus>;
558
+ /**
559
+ * Wait for a plugin to start with timeout
560
+ * @param plugin - Plugin to start
561
+ * @param context - Plugin context
562
+ * @param timeoutMs - Maximum time to wait (milliseconds)
563
+ * @returns Promise resolving when plugin starts or rejecting on timeout
564
+ */
565
+ startWithTimeout?(plugin: Plugin, context: any, timeoutMs: number): Promise<void>;
566
+ }
567
+
568
+ /**
569
+ * IPluginLifecycleEvents - Typed Plugin Lifecycle Events
570
+ *
571
+ * Type-safe event definitions for plugin and kernel lifecycle.
572
+ * Provides strong typing for event emitters and listeners.
573
+ *
574
+ * This replaces the generic Map<string, any[]> approach with typed events.
575
+ */
576
+ /**
577
+ * Plugin lifecycle event types and their payloads
578
+ */
579
+ interface IPluginLifecycleEvents {
580
+ /**
581
+ * Emitted when kernel is ready (all plugins initialized)
582
+ * Payload: []
583
+ */
584
+ 'kernel:ready': [];
585
+ /**
586
+ * Emitted when kernel is shutting down
587
+ * Payload: []
588
+ */
589
+ 'kernel:shutdown': [];
590
+ /**
591
+ * Emitted before kernel initialization starts
592
+ * Payload: []
593
+ */
594
+ 'kernel:before-init': [];
595
+ /**
596
+ * Emitted after kernel initialization completes
597
+ * Payload: [duration: number (milliseconds)]
598
+ */
599
+ 'kernel:after-init': [duration: number];
600
+ /**
601
+ * Emitted when a plugin is registered
602
+ * Payload: [pluginName: string]
603
+ */
604
+ 'plugin:registered': [pluginName: string];
605
+ /**
606
+ * Emitted before a plugin's init method is called
607
+ * Payload: [pluginName: string]
608
+ */
609
+ 'plugin:before-init': [pluginName: string];
610
+ /**
611
+ * Emitted when a plugin has been initialized
612
+ * Payload: [pluginName: string]
613
+ */
614
+ 'plugin:init': [pluginName: string];
615
+ /**
616
+ * Emitted after a plugin's init method completes
617
+ * Payload: [pluginName: string, duration: number (milliseconds)]
618
+ */
619
+ 'plugin:after-init': [pluginName: string, duration: number];
620
+ /**
621
+ * Emitted before a plugin's start method is called
622
+ * Payload: [pluginName: string]
623
+ */
624
+ 'plugin:before-start': [pluginName: string];
625
+ /**
626
+ * Emitted when a plugin has started successfully
627
+ * Payload: [pluginName: string, duration: number (milliseconds)]
628
+ */
629
+ 'plugin:started': [pluginName: string, duration: number];
630
+ /**
631
+ * Emitted after a plugin's start method completes
632
+ * Payload: [pluginName: string, duration: number (milliseconds)]
633
+ */
634
+ 'plugin:after-start': [pluginName: string, duration: number];
635
+ /**
636
+ * Emitted before a plugin's destroy method is called
637
+ * Payload: [pluginName: string]
638
+ */
639
+ 'plugin:before-destroy': [pluginName: string];
640
+ /**
641
+ * Emitted when a plugin has been destroyed
642
+ * Payload: [pluginName: string]
643
+ */
644
+ 'plugin:destroyed': [pluginName: string];
645
+ /**
646
+ * Emitted after a plugin's destroy method completes
647
+ * Payload: [pluginName: string, duration: number (milliseconds)]
648
+ */
649
+ 'plugin:after-destroy': [pluginName: string, duration: number];
650
+ /**
651
+ * Emitted when a plugin encounters an error
652
+ * Payload: [pluginName: string, error: Error, phase: 'init' | 'start' | 'destroy']
653
+ */
654
+ 'plugin:error': [pluginName: string, error: Error, phase: 'init' | 'start' | 'destroy'];
655
+ /**
656
+ * Emitted when a service is registered
657
+ * Payload: [serviceName: string]
658
+ */
659
+ 'service:registered': [serviceName: string];
660
+ /**
661
+ * Emitted when a service is unregistered
662
+ * Payload: [serviceName: string]
663
+ */
664
+ 'service:unregistered': [serviceName: string];
665
+ /**
666
+ * Emitted when a hook is registered
667
+ * Payload: [hookName: string, handlerCount: number]
668
+ */
669
+ 'hook:registered': [hookName: string, handlerCount: number];
670
+ /**
671
+ * Emitted when a hook is triggered
672
+ * Payload: [hookName: string, args: any[]]
673
+ */
674
+ 'hook:triggered': [hookName: string, args: any[]];
675
+ }
676
+ /**
677
+ * Type-safe event emitter interface
678
+ * Provides compile-time type checking for event names and payloads
679
+ */
680
+ interface ITypedEventEmitter<Events extends Record<string, any[]>> {
681
+ /**
682
+ * Register an event listener
683
+ * @param event - Event name (type-checked)
684
+ * @param handler - Event handler (type-checked against event payload)
685
+ */
686
+ on<K extends keyof Events>(event: K, handler: (...args: Events[K]) => void | Promise<void>): void;
687
+ /**
688
+ * Unregister an event listener
689
+ * @param event - Event name (type-checked)
690
+ * @param handler - Event handler to remove
691
+ */
692
+ off<K extends keyof Events>(event: K, handler: (...args: Events[K]) => void | Promise<void>): void;
693
+ /**
694
+ * Emit an event with type-checked payload
695
+ * @param event - Event name (type-checked)
696
+ * @param args - Event payload (type-checked)
697
+ */
698
+ emit<K extends keyof Events>(event: K, ...args: Events[K]): Promise<void>;
699
+ /**
700
+ * Register a one-time event listener
701
+ * @param event - Event name (type-checked)
702
+ * @param handler - Event handler (type-checked against event payload)
703
+ */
704
+ once?<K extends keyof Events>(event: K, handler: (...args: Events[K]) => void | Promise<void>): void;
705
+ /**
706
+ * Get the number of listeners for an event
707
+ * @param event - Event name
708
+ * @returns Number of registered listeners
709
+ */
710
+ listenerCount?<K extends keyof Events>(event: K): number;
711
+ /**
712
+ * Remove all listeners for an event (or all events if not specified)
713
+ * @param event - Optional event name
714
+ */
715
+ removeAllListeners?<K extends keyof Events>(event?: K): void;
716
+ }
717
+
718
+ type DataField = z.infer<typeof FieldSchema>;
719
+ type DataObject = z.infer<typeof ObjectSchema>;
720
+ /**
721
+ * Interface for Data Definition Language (DDL) operations.
722
+ * Drivers should implement this to support automatic migrations.
723
+ */
724
+ interface ISchemaDriver {
725
+ createCollection(objectName: string, schema?: DataObject): Promise<void>;
726
+ dropCollection(objectName: string): Promise<void>;
727
+ addColumn(objectName: string, fieldName: string, field: DataField): Promise<void>;
728
+ modifyColumn(objectName: string, fieldName: string, field: DataField): Promise<void>;
729
+ dropColumn(objectName: string, fieldName: string): Promise<void>;
730
+ createIndex(objectName: string, indexName: string, fields: string[]): Promise<void>;
731
+ dropIndex(objectName: string, indexName: string): Promise<void>;
732
+ executeRaw(statement: string): Promise<any>;
733
+ }
734
+
735
+ /**
736
+ * ICacheService - Cache Service Contract
737
+ *
738
+ * Defines the interface for cache operations in ObjectStack.
739
+ * Concrete implementations (Redis, Memory, etc.) should implement this interface.
740
+ *
741
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
742
+ * not on concrete cache implementations.
743
+ *
744
+ * Aligned with CoreServiceName 'cache' in core-services.zod.ts.
745
+ */
746
+ /**
747
+ * Cache statistics for monitoring and observability
748
+ */
749
+ interface CacheStats {
750
+ /** Total number of cache hits */
751
+ hits: number;
752
+ /** Total number of cache misses */
753
+ misses: number;
754
+ /** Number of keys currently stored */
755
+ keyCount: number;
756
+ /** Memory usage in bytes (if available) */
757
+ memoryUsage?: number;
758
+ }
759
+ interface ICacheService {
760
+ /**
761
+ * Get a cached value by key
762
+ * @param key - Cache key
763
+ * @returns The cached value, or undefined if not found
764
+ */
765
+ get<T = unknown>(key: string): Promise<T | undefined>;
766
+ /**
767
+ * Set a value in the cache
768
+ * @param key - Cache key
769
+ * @param value - Value to cache
770
+ * @param ttl - Optional time-to-live in seconds
771
+ */
772
+ set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
773
+ /**
774
+ * Delete a cached value by key
775
+ * @param key - Cache key
776
+ * @returns True if the key was deleted, false if it did not exist
777
+ */
778
+ delete(key: string): Promise<boolean>;
779
+ /**
780
+ * Check if a key exists in the cache
781
+ * @param key - Cache key
782
+ * @returns True if the key exists
783
+ */
784
+ has(key: string): Promise<boolean>;
785
+ /**
786
+ * Clear all entries from the cache
787
+ */
788
+ clear(): Promise<void>;
789
+ /**
790
+ * Get cache statistics
791
+ * @returns Cache stats including hits, misses, and key count
792
+ */
793
+ stats(): Promise<CacheStats>;
794
+ }
795
+
796
+ /**
797
+ * ISearchService - Search Service Contract
798
+ *
799
+ * Defines the interface for full-text search capabilities in ObjectStack.
800
+ * Concrete implementations (Elasticsearch, MeiliSearch, Typesense, etc.)
801
+ * should implement this interface.
802
+ *
803
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
804
+ * not on concrete search engine implementations.
805
+ *
806
+ * Aligned with CoreServiceName 'search' in core-services.zod.ts.
807
+ */
808
+ /**
809
+ * Options for search queries
810
+ */
811
+ interface SearchOptions {
812
+ /** Filter conditions to narrow results */
813
+ filter?: Record<string, unknown>;
814
+ /** Maximum number of results to return */
815
+ limit?: number;
816
+ /** Offset for pagination */
817
+ offset?: number;
818
+ /** Fields to sort by */
819
+ sort?: string[];
820
+ /** Fields to include in results */
821
+ select?: string[];
822
+ /** Facet fields to aggregate */
823
+ facets?: string[];
824
+ /** Enable highlighting of matching terms */
825
+ highlight?: boolean;
826
+ }
827
+ /**
828
+ * A single search result hit
829
+ */
830
+ interface SearchHit {
831
+ /** Document ID */
832
+ id: string;
833
+ /** Relevance score */
834
+ score: number;
835
+ /** The matched document */
836
+ document: Record<string, unknown>;
837
+ /** Highlighted fields (if requested) */
838
+ highlights?: Record<string, string[]>;
839
+ }
840
+ /**
841
+ * Search result set
842
+ */
843
+ interface SearchResult {
844
+ /** Matched documents */
845
+ hits: SearchHit[];
846
+ /** Total number of matching documents */
847
+ totalHits: number;
848
+ /** Query processing time in milliseconds */
849
+ processingTimeMs?: number;
850
+ /** Facet counts (if requested) */
851
+ facets?: Record<string, Record<string, number>>;
852
+ }
853
+ interface ISearchService {
854
+ /**
855
+ * Index a document for search
856
+ * @param object - Object/collection name
857
+ * @param id - Document identifier
858
+ * @param document - Document data to index
859
+ */
860
+ index(object: string, id: string, document: Record<string, unknown>): Promise<void>;
861
+ /**
862
+ * Remove a document from the search index
863
+ * @param object - Object/collection name
864
+ * @param id - Document identifier
865
+ */
866
+ remove(object: string, id: string): Promise<void>;
867
+ /**
868
+ * Search for documents
869
+ * @param object - Object/collection name
870
+ * @param query - Search query string
871
+ * @param options - Search options (filters, pagination, etc.)
872
+ * @returns Search results with hits, total count, and optional facets
873
+ */
874
+ search(object: string, query: string, options?: SearchOptions): Promise<SearchResult>;
875
+ /**
876
+ * Bulk index multiple documents at once
877
+ * @param object - Object/collection name
878
+ * @param documents - Array of documents with id and data
879
+ */
880
+ bulkIndex?(object: string, documents: Array<{
881
+ id: string;
882
+ document: Record<string, unknown>;
883
+ }>): Promise<void>;
884
+ /**
885
+ * Delete all documents in an index
886
+ * @param object - Object/collection name
887
+ */
888
+ deleteIndex?(object: string): Promise<void>;
889
+ }
890
+
891
+ /**
892
+ * IQueueService - Message Queue Service Contract
893
+ *
894
+ * Defines the interface for asynchronous message queue operations in ObjectStack.
895
+ * Concrete implementations (BullMQ, Redis Pub/Sub, Kafka, etc.)
896
+ * should implement this interface.
897
+ *
898
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
899
+ * not on concrete queue implementations.
900
+ *
901
+ * Aligned with CoreServiceName 'queue' in core-services.zod.ts.
902
+ */
903
+ /**
904
+ * Options for publishing a message to a queue
905
+ */
906
+ interface QueuePublishOptions {
907
+ /** Delay before the message becomes available (in milliseconds) */
908
+ delay?: number;
909
+ /** Message priority (lower = higher priority) */
910
+ priority?: number;
911
+ /** Number of retry attempts on failure */
912
+ retries?: number;
913
+ }
914
+ /**
915
+ * A message received from a queue
916
+ */
917
+ interface QueueMessage<T = unknown> {
918
+ /** Unique message identifier */
919
+ id: string;
920
+ /** The message payload */
921
+ data: T;
922
+ /** Number of times this message has been attempted */
923
+ attempts: number;
924
+ /** Timestamp when the message was published */
925
+ timestamp: number;
926
+ }
927
+ /**
928
+ * Handler function for processing queue messages
929
+ */
930
+ type QueueHandler<T = unknown> = (message: QueueMessage<T>) => Promise<void>;
931
+ interface IQueueService {
932
+ /**
933
+ * Publish a message to a named queue
934
+ * @param queue - Queue name
935
+ * @param data - Message payload
936
+ * @param options - Publish options (delay, priority, retries)
937
+ * @returns The message identifier
938
+ */
939
+ publish<T = unknown>(queue: string, data: T, options?: QueuePublishOptions): Promise<string>;
940
+ /**
941
+ * Subscribe to messages from a named queue
942
+ * @param queue - Queue name
943
+ * @param handler - Message handler function
944
+ */
945
+ subscribe<T = unknown>(queue: string, handler: QueueHandler<T>): Promise<void>;
946
+ /**
947
+ * Unsubscribe from a named queue
948
+ * @param queue - Queue name
949
+ */
950
+ unsubscribe(queue: string): Promise<void>;
951
+ /**
952
+ * Get the number of messages waiting in a queue
953
+ * @param queue - Queue name
954
+ * @returns Number of pending messages
955
+ */
956
+ getQueueSize?(queue: string): Promise<number>;
957
+ /**
958
+ * Purge all messages from a queue
959
+ * @param queue - Queue name
960
+ */
961
+ purge?(queue: string): Promise<void>;
962
+ }
963
+
964
+ /**
965
+ * INotificationService - Notification Service Contract
966
+ *
967
+ * Defines the interface for sending notifications in ObjectStack.
968
+ * Concrete implementations (Email, Push, SMS, Slack, etc.)
969
+ * should implement this interface.
970
+ *
971
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
972
+ * not on concrete notification provider implementations.
973
+ *
974
+ * Aligned with CoreServiceName 'notification' in core-services.zod.ts.
975
+ */
976
+ /**
977
+ * Supported notification delivery channels
978
+ */
979
+ type NotificationChannel = 'email' | 'sms' | 'push' | 'in-app' | 'slack' | 'teams' | 'webhook';
980
+ /**
981
+ * A notification message to be sent
982
+ */
983
+ interface NotificationMessage {
984
+ /** Notification channel to use */
985
+ channel: NotificationChannel;
986
+ /** Recipient identifier (email, phone, user ID, etc.) */
987
+ to: string | string[];
988
+ /** Notification subject/title */
989
+ subject?: string;
990
+ /** Notification body content */
991
+ body: string;
992
+ /** Template identifier (if using a pre-defined template) */
993
+ templateId?: string;
994
+ /** Template variable values */
995
+ templateData?: Record<string, unknown>;
996
+ /** Additional metadata */
997
+ metadata?: Record<string, unknown>;
998
+ }
999
+ /**
1000
+ * Result of sending a notification
1001
+ */
1002
+ interface NotificationResult {
1003
+ /** Whether the notification was sent successfully */
1004
+ success: boolean;
1005
+ /** Unique identifier for tracking */
1006
+ messageId?: string;
1007
+ /** Error message if sending failed */
1008
+ error?: string;
1009
+ }
1010
+ interface INotificationService {
1011
+ /**
1012
+ * Send a notification
1013
+ * @param message - The notification message to send
1014
+ * @returns Result indicating success or failure
1015
+ */
1016
+ send(message: NotificationMessage): Promise<NotificationResult>;
1017
+ /**
1018
+ * Send multiple notifications in a batch
1019
+ * @param messages - Array of notification messages
1020
+ * @returns Array of results for each message
1021
+ */
1022
+ sendBatch?(messages: NotificationMessage[]): Promise<NotificationResult[]>;
1023
+ /**
1024
+ * List available notification channels
1025
+ * @returns Array of supported channel names
1026
+ */
1027
+ getChannels?(): NotificationChannel[];
1028
+ }
1029
+
1030
+ /**
1031
+ * IStorageService - File Storage Service Contract
1032
+ *
1033
+ * Defines the interface for file/object storage in ObjectStack.
1034
+ * Concrete implementations (S3, Azure Blob, Local FS, etc.)
1035
+ * should implement this interface.
1036
+ *
1037
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1038
+ * not on concrete storage implementations.
1039
+ *
1040
+ * Aligned with CoreServiceName 'file-storage' in core-services.zod.ts.
1041
+ */
1042
+ /**
1043
+ * Options for uploading a file
1044
+ */
1045
+ interface StorageUploadOptions {
1046
+ /** MIME content type */
1047
+ contentType?: string;
1048
+ /** Custom metadata key-value pairs */
1049
+ metadata?: Record<string, string>;
1050
+ /** Access control level */
1051
+ acl?: 'private' | 'public-read';
1052
+ }
1053
+ /**
1054
+ * Metadata about a stored file
1055
+ */
1056
+ interface StorageFileInfo {
1057
+ /** File key/path */
1058
+ key: string;
1059
+ /** File size in bytes */
1060
+ size: number;
1061
+ /** MIME content type */
1062
+ contentType?: string;
1063
+ /** Last modified timestamp */
1064
+ lastModified: Date;
1065
+ /** Custom metadata */
1066
+ metadata?: Record<string, string>;
1067
+ }
1068
+ interface IStorageService {
1069
+ /**
1070
+ * Upload a file to storage
1071
+ * @param key - Storage key/path for the file
1072
+ * @param data - File content as Buffer or readable stream
1073
+ * @param options - Upload options (content type, metadata, ACL)
1074
+ */
1075
+ upload(key: string, data: Buffer | ReadableStream, options?: StorageUploadOptions): Promise<void>;
1076
+ /**
1077
+ * Download a file from storage
1078
+ * @param key - Storage key/path
1079
+ * @returns File content as Buffer
1080
+ */
1081
+ download(key: string): Promise<Buffer>;
1082
+ /**
1083
+ * Delete a file from storage
1084
+ * @param key - Storage key/path
1085
+ */
1086
+ delete(key: string): Promise<void>;
1087
+ /**
1088
+ * Check if a file exists in storage
1089
+ * @param key - Storage key/path
1090
+ * @returns True if the file exists
1091
+ */
1092
+ exists(key: string): Promise<boolean>;
1093
+ /**
1094
+ * Get metadata about a stored file
1095
+ * @param key - Storage key/path
1096
+ * @returns File info including size, content type, and last modified date
1097
+ */
1098
+ getInfo(key: string): Promise<StorageFileInfo>;
1099
+ /**
1100
+ * List files in a directory/prefix
1101
+ * @param prefix - Key prefix to list
1102
+ * @returns Array of file info objects
1103
+ */
1104
+ list?(prefix: string): Promise<StorageFileInfo[]>;
1105
+ /**
1106
+ * Generate a pre-signed URL for temporary access
1107
+ * @param key - Storage key/path
1108
+ * @param expiresIn - URL expiration time in seconds
1109
+ * @returns Pre-signed URL string
1110
+ */
1111
+ getSignedUrl?(key: string, expiresIn: number): Promise<string>;
1112
+ }
1113
+
1114
+ /**
1115
+ * IMetadataService - Metadata Service Contract
1116
+ *
1117
+ * Defines the interface for managing object/field definitions in ObjectStack.
1118
+ * Concrete implementations (SchemaRegistry, Database-backed, etc.)
1119
+ * should implement this interface.
1120
+ *
1121
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1122
+ * not on concrete metadata storage implementations.
1123
+ *
1124
+ * Aligned with CoreServiceName 'metadata' in core-services.zod.ts.
1125
+ */
1126
+ interface IMetadataService {
1127
+ /**
1128
+ * Register a metadata item by type
1129
+ * @param type - Metadata type (e.g. 'object', 'view', 'flow')
1130
+ * @param definition - The metadata definition to register
1131
+ */
1132
+ register(type: string, definition: unknown): void;
1133
+ /**
1134
+ * Get a metadata item by type and name
1135
+ * @param type - Metadata type
1136
+ * @param name - Item name/identifier
1137
+ * @returns The metadata definition, or undefined if not found
1138
+ */
1139
+ get(type: string, name: string): unknown | undefined;
1140
+ /**
1141
+ * List all metadata items of a given type
1142
+ * @param type - Metadata type
1143
+ * @returns Array of metadata definitions
1144
+ */
1145
+ list(type: string): unknown[];
1146
+ /**
1147
+ * Unregister a metadata item by type and name
1148
+ * @param type - Metadata type
1149
+ * @param name - Item name/identifier
1150
+ */
1151
+ unregister(type: string, name: string): void;
1152
+ /**
1153
+ * Convenience: get an object definition by name
1154
+ * @param name - Object name (snake_case)
1155
+ * @returns The object definition, or undefined if not found
1156
+ */
1157
+ getObject(name: string): unknown | undefined;
1158
+ /**
1159
+ * Convenience: list all object definitions
1160
+ * @returns Array of object definitions
1161
+ */
1162
+ listObjects(): unknown[];
1163
+ /**
1164
+ * Unregister all metadata items from a specific package
1165
+ * @param packageName - The package name whose items should be removed
1166
+ */
1167
+ unregisterPackage?(packageName: string): void;
1168
+ }
1169
+
1170
+ /**
1171
+ * IAuthService - Authentication Service Contract
1172
+ *
1173
+ * Defines the interface for authentication and session management in ObjectStack.
1174
+ * Concrete implementations (better-auth, custom, LDAP, etc.)
1175
+ * should implement this interface.
1176
+ *
1177
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1178
+ * not on concrete auth provider implementations.
1179
+ *
1180
+ * Aligned with CoreServiceName 'auth' in core-services.zod.ts.
1181
+ */
1182
+ /**
1183
+ * Authenticated session user information
1184
+ */
1185
+ interface AuthUser {
1186
+ /** User identifier */
1187
+ id: string;
1188
+ /** Email address */
1189
+ email: string;
1190
+ /** Display name */
1191
+ name: string;
1192
+ /** Assigned role identifiers */
1193
+ roles?: string[];
1194
+ /** Current tenant identifier (multi-tenant) */
1195
+ tenantId?: string;
1196
+ }
1197
+ /**
1198
+ * Active session information
1199
+ */
1200
+ interface AuthSession {
1201
+ /** Session identifier */
1202
+ id: string;
1203
+ /** Associated user identifier */
1204
+ userId: string;
1205
+ /** Session expiry (ISO 8601) */
1206
+ expiresAt: string;
1207
+ /** Bearer token (if not using cookies) */
1208
+ token?: string;
1209
+ }
1210
+ /**
1211
+ * Authentication result returned by login/verify operations
1212
+ */
1213
+ interface AuthResult {
1214
+ /** Whether authentication succeeded */
1215
+ success: boolean;
1216
+ /** Authenticated user (if success) */
1217
+ user?: AuthUser;
1218
+ /** Active session (if success) */
1219
+ session?: AuthSession;
1220
+ /** Error message (if failure) */
1221
+ error?: string;
1222
+ }
1223
+ interface IAuthService {
1224
+ /**
1225
+ * Handle an incoming HTTP authentication request
1226
+ * @param request - Standard Request object
1227
+ * @returns Standard Response object
1228
+ */
1229
+ handleRequest(request: Request): Promise<Response>;
1230
+ /**
1231
+ * Verify a session token or cookie and return the user
1232
+ * @param token - Bearer token or session identifier
1233
+ * @returns Auth result with user and session if valid
1234
+ */
1235
+ verify(token: string): Promise<AuthResult>;
1236
+ /**
1237
+ * Invalidate a session (logout)
1238
+ * @param sessionId - Session identifier to invalidate
1239
+ */
1240
+ logout?(sessionId: string): Promise<void>;
1241
+ /**
1242
+ * Get the current user from a request
1243
+ * @param request - Standard Request object
1244
+ * @returns Authenticated user or undefined
1245
+ */
1246
+ getCurrentUser?(request: Request): Promise<AuthUser | undefined>;
1247
+ }
1248
+
1249
+ /**
1250
+ * IAutomationService - Automation Service Contract
1251
+ *
1252
+ * Defines the interface for flow/script execution in ObjectStack.
1253
+ * Concrete implementations (Flow Engine, Script Runner, etc.)
1254
+ * should implement this interface.
1255
+ *
1256
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1257
+ * not on concrete automation engine implementations.
1258
+ *
1259
+ * Aligned with CoreServiceName 'automation' in core-services.zod.ts.
1260
+ */
1261
+ /**
1262
+ * Context passed to a flow/script execution
1263
+ */
1264
+ interface AutomationContext {
1265
+ /** Record that triggered the automation (if applicable) */
1266
+ record?: Record<string, unknown>;
1267
+ /** Object name the record belongs to */
1268
+ object?: string;
1269
+ /** Trigger event type (e.g. 'on_create', 'on_update') */
1270
+ event?: string;
1271
+ /** User who triggered the automation */
1272
+ userId?: string;
1273
+ /** Additional contextual data */
1274
+ params?: Record<string, unknown>;
1275
+ }
1276
+ /**
1277
+ * Result of an automation execution
1278
+ */
1279
+ interface AutomationResult {
1280
+ /** Whether the automation completed successfully */
1281
+ success: boolean;
1282
+ /** Output data from the automation */
1283
+ output?: unknown;
1284
+ /** Error message if execution failed */
1285
+ error?: string;
1286
+ /** Execution duration in milliseconds */
1287
+ durationMs?: number;
1288
+ }
1289
+ interface IAutomationService {
1290
+ /**
1291
+ * Execute a named flow or script
1292
+ * @param flowName - Flow/script identifier (snake_case)
1293
+ * @param context - Execution context with trigger data
1294
+ * @returns Automation result
1295
+ */
1296
+ execute(flowName: string, context?: AutomationContext): Promise<AutomationResult>;
1297
+ /**
1298
+ * List all registered automation flows
1299
+ * @returns Array of flow names
1300
+ */
1301
+ listFlows(): Promise<string[]>;
1302
+ /**
1303
+ * Register a flow definition
1304
+ * @param name - Flow name (snake_case)
1305
+ * @param definition - Flow definition object
1306
+ */
1307
+ registerFlow?(name: string, definition: unknown): void;
1308
+ /**
1309
+ * Unregister a flow by name
1310
+ * @param name - Flow name (snake_case)
1311
+ */
1312
+ unregisterFlow?(name: string): void;
1313
+ }
1314
+
1315
+ /**
1316
+ * IGraphQLService - GraphQL Service Contract
1317
+ *
1318
+ * Defines the interface for GraphQL schema and query execution in ObjectStack.
1319
+ * Concrete implementations (Apollo, Yoga, Mercurius, etc.)
1320
+ * should implement this interface.
1321
+ *
1322
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1323
+ * not on concrete GraphQL server implementations.
1324
+ *
1325
+ * Aligned with CoreServiceName 'graphql' in core-services.zod.ts.
1326
+ */
1327
+ /**
1328
+ * A GraphQL execution request
1329
+ */
1330
+ interface GraphQLRequest {
1331
+ /** GraphQL query or mutation string */
1332
+ query: string;
1333
+ /** Operation name (when document contains multiple operations) */
1334
+ operationName?: string;
1335
+ /** Variables for the operation */
1336
+ variables?: Record<string, unknown>;
1337
+ }
1338
+ /**
1339
+ * A GraphQL execution response
1340
+ */
1341
+ interface GraphQLResponse {
1342
+ /** Query result data */
1343
+ data?: Record<string, unknown> | null;
1344
+ /** Errors encountered during execution */
1345
+ errors?: Array<{
1346
+ message: string;
1347
+ locations?: Array<{
1348
+ line: number;
1349
+ column: number;
1350
+ }>;
1351
+ path?: Array<string | number>;
1352
+ extensions?: Record<string, unknown>;
1353
+ }>;
1354
+ }
1355
+ interface IGraphQLService {
1356
+ /**
1357
+ * Execute a GraphQL query or mutation
1358
+ * @param request - The GraphQL request
1359
+ * @param context - Optional execution context (e.g. auth user)
1360
+ * @returns GraphQL response with data and/or errors
1361
+ */
1362
+ execute(request: GraphQLRequest, context?: Record<string, unknown>): Promise<GraphQLResponse>;
1363
+ /**
1364
+ * Handle an incoming HTTP request for GraphQL
1365
+ * @param request - Standard Request object
1366
+ * @returns Standard Response object
1367
+ */
1368
+ handleRequest?(request: Request): Promise<Response>;
1369
+ /**
1370
+ * Get the current GraphQL schema as SDL string
1371
+ * @returns SDL schema string
1372
+ */
1373
+ getSchema?(): string;
1374
+ }
1375
+
1376
+ /**
1377
+ * IAnalyticsService - Analytics / BI Service Contract
1378
+ *
1379
+ * Defines the interface for analytical query execution and semantic layer
1380
+ * metadata discovery in ObjectStack. Concrete implementations (Cube.js, custom, etc.)
1381
+ * should implement this interface.
1382
+ *
1383
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1384
+ * not on concrete analytics engine implementations.
1385
+ *
1386
+ * Aligned with CoreServiceName 'analytics' in core-services.zod.ts.
1387
+ */
1388
+ /**
1389
+ * An analytical query definition
1390
+ */
1391
+ interface AnalyticsQuery {
1392
+ /** Target cube name */
1393
+ cube: string;
1394
+ /** Measures to compute (e.g. ['orders.count', 'orders.totalRevenue']) */
1395
+ measures?: string[];
1396
+ /** Dimensions to group by (e.g. ['orders.status', 'orders.createdAt']) */
1397
+ dimensions?: string[];
1398
+ /** Filter conditions */
1399
+ filters?: Array<{
1400
+ member: string;
1401
+ operator: string;
1402
+ values?: string[];
1403
+ }>;
1404
+ /** Time dimension configuration */
1405
+ timeDimensions?: Array<{
1406
+ dimension: string;
1407
+ granularity?: string;
1408
+ dateRange?: string | string[];
1409
+ }>;
1410
+ /** Result limit */
1411
+ limit?: number;
1412
+ /** Result offset */
1413
+ offset?: number;
1414
+ }
1415
+ /**
1416
+ * Analytics query result
1417
+ */
1418
+ interface AnalyticsResult {
1419
+ /** Result rows */
1420
+ rows: Record<string, unknown>[];
1421
+ /** Column metadata */
1422
+ fields: Array<{
1423
+ name: string;
1424
+ type: string;
1425
+ }>;
1426
+ /** Generated SQL (if available) */
1427
+ sql?: string;
1428
+ }
1429
+ /**
1430
+ * Cube metadata for discovery
1431
+ */
1432
+ interface CubeMeta {
1433
+ /** Cube name */
1434
+ name: string;
1435
+ /** Human-readable title */
1436
+ title?: string;
1437
+ /** Available measures */
1438
+ measures: Array<{
1439
+ name: string;
1440
+ type: string;
1441
+ title?: string;
1442
+ }>;
1443
+ /** Available dimensions */
1444
+ dimensions: Array<{
1445
+ name: string;
1446
+ type: string;
1447
+ title?: string;
1448
+ }>;
1449
+ }
1450
+ interface IAnalyticsService {
1451
+ /**
1452
+ * Execute an analytical query
1453
+ * @param query - The analytics query definition
1454
+ * @returns Query results with rows and field metadata
1455
+ */
1456
+ query(query: AnalyticsQuery): Promise<AnalyticsResult>;
1457
+ /**
1458
+ * Get available cube metadata for discovery
1459
+ * @param cubeName - Optional cube name to filter (returns all if omitted)
1460
+ * @returns Array of cube metadata definitions
1461
+ */
1462
+ getMeta(cubeName?: string): Promise<CubeMeta[]>;
1463
+ /**
1464
+ * Generate SQL for a query without executing it (dry-run)
1465
+ * @param query - The analytics query definition
1466
+ * @returns Generated SQL string and parameters
1467
+ */
1468
+ generateSql?(query: AnalyticsQuery): Promise<{
1469
+ sql: string;
1470
+ params: unknown[];
1471
+ }>;
1472
+ }
1473
+
1474
+ /**
1475
+ * IRealtimeService - Realtime / PubSub Service Contract
1476
+ *
1477
+ * Defines the interface for realtime event subscription and publishing
1478
+ * in ObjectStack. Concrete implementations (WebSocket, SSE, Socket.IO, etc.)
1479
+ * should implement this interface.
1480
+ *
1481
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1482
+ * not on concrete realtime transport implementations.
1483
+ *
1484
+ * Aligned with CoreServiceName 'realtime' in core-services.zod.ts.
1485
+ */
1486
+ /**
1487
+ * A realtime event payload
1488
+ */
1489
+ interface RealtimeEventPayload {
1490
+ /** Event type (e.g. 'record.created', 'record.updated') */
1491
+ type: string;
1492
+ /** Object name the event relates to */
1493
+ object?: string;
1494
+ /** Event data */
1495
+ payload: Record<string, unknown>;
1496
+ /** Timestamp (ISO 8601) */
1497
+ timestamp: string;
1498
+ }
1499
+ /**
1500
+ * Handler function for realtime event subscriptions
1501
+ */
1502
+ type RealtimeEventHandler = (event: RealtimeEventPayload) => void | Promise<void>;
1503
+ /**
1504
+ * Subscription options for filtering events
1505
+ */
1506
+ interface RealtimeSubscriptionOptions {
1507
+ /** Object name to filter events for */
1508
+ object?: string;
1509
+ /** Event types to listen for */
1510
+ eventTypes?: string[];
1511
+ /** Additional filter conditions */
1512
+ filter?: Record<string, unknown>;
1513
+ }
1514
+ interface IRealtimeService {
1515
+ /**
1516
+ * Publish an event to all subscribers
1517
+ * @param event - The event to publish
1518
+ */
1519
+ publish(event: RealtimeEventPayload): Promise<void>;
1520
+ /**
1521
+ * Subscribe to realtime events
1522
+ * @param channel - Channel/topic name
1523
+ * @param handler - Event handler function
1524
+ * @param options - Optional subscription filters
1525
+ * @returns Subscription identifier for unsubscribing
1526
+ */
1527
+ subscribe(channel: string, handler: RealtimeEventHandler, options?: RealtimeSubscriptionOptions): Promise<string>;
1528
+ /**
1529
+ * Unsubscribe from a channel
1530
+ * @param subscriptionId - Subscription identifier returned by subscribe()
1531
+ */
1532
+ unsubscribe(subscriptionId: string): Promise<void>;
1533
+ /**
1534
+ * Handle an incoming HTTP upgrade request (WebSocket handshake)
1535
+ * @param request - Standard Request object
1536
+ * @returns Standard Response object
1537
+ */
1538
+ handleUpgrade?(request: Request): Promise<Response>;
1539
+ }
1540
+
1541
+ /**
1542
+ * IJobService - Background Job Service Contract
1543
+ *
1544
+ * Defines the interface for scheduling and managing background jobs
1545
+ * in ObjectStack. Concrete implementations (BullMQ, node-cron, etc.)
1546
+ * should implement this interface.
1547
+ *
1548
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1549
+ * not on concrete job scheduler implementations.
1550
+ *
1551
+ * Aligned with CoreServiceName 'job' in core-services.zod.ts.
1552
+ */
1553
+ /**
1554
+ * Schedule definition for a job
1555
+ */
1556
+ interface JobSchedule {
1557
+ /** Schedule type */
1558
+ type: 'cron' | 'interval' | 'once';
1559
+ /** Cron expression (when type is 'cron') */
1560
+ expression?: string;
1561
+ /** Timezone for cron (when type is 'cron') */
1562
+ timezone?: string;
1563
+ /** Interval in milliseconds (when type is 'interval') */
1564
+ intervalMs?: number;
1565
+ /** ISO 8601 datetime (when type is 'once') */
1566
+ at?: string;
1567
+ }
1568
+ /**
1569
+ * Job handler function
1570
+ */
1571
+ type JobHandler = (context: {
1572
+ jobId: string;
1573
+ data?: unknown;
1574
+ }) => Promise<void>;
1575
+ /**
1576
+ * Status of a job execution
1577
+ */
1578
+ interface JobExecution {
1579
+ /** Job identifier */
1580
+ jobId: string;
1581
+ /** Execution status */
1582
+ status: 'running' | 'success' | 'failed' | 'timeout';
1583
+ /** Start time (ISO 8601) */
1584
+ startedAt: string;
1585
+ /** Completion time (ISO 8601) */
1586
+ completedAt?: string;
1587
+ /** Error message if failed */
1588
+ error?: string;
1589
+ /** Duration in milliseconds */
1590
+ durationMs?: number;
1591
+ }
1592
+ interface IJobService {
1593
+ /**
1594
+ * Schedule a recurring or one-time job
1595
+ * @param name - Job name (snake_case)
1596
+ * @param schedule - Schedule configuration
1597
+ * @param handler - Job handler function
1598
+ */
1599
+ schedule(name: string, schedule: JobSchedule, handler: JobHandler): Promise<void>;
1600
+ /**
1601
+ * Cancel a scheduled job
1602
+ * @param name - Job name
1603
+ */
1604
+ cancel(name: string): Promise<void>;
1605
+ /**
1606
+ * Trigger a job to run immediately (outside its normal schedule)
1607
+ * @param name - Job name
1608
+ * @param data - Optional data to pass to the handler
1609
+ */
1610
+ trigger(name: string, data?: unknown): Promise<void>;
1611
+ /**
1612
+ * Get the status of recent job executions
1613
+ * @param name - Job name
1614
+ * @param limit - Maximum number of executions to return
1615
+ * @returns Array of job execution records
1616
+ */
1617
+ getExecutions?(name: string, limit?: number): Promise<JobExecution[]>;
1618
+ /**
1619
+ * List all registered job names
1620
+ * @returns Array of job names
1621
+ */
1622
+ listJobs?(): Promise<string[]>;
1623
+ }
1624
+
1625
+ /**
1626
+ * IAIService - AI Engine Service Contract
1627
+ *
1628
+ * Defines the interface for AI capabilities (NLQ, chat, suggestions, embeddings)
1629
+ * in ObjectStack. Concrete implementations (OpenAI, Anthropic, Ollama, etc.)
1630
+ * should implement this interface.
1631
+ *
1632
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1633
+ * not on concrete AI/LLM provider implementations.
1634
+ *
1635
+ * Aligned with CoreServiceName 'ai' in core-services.zod.ts.
1636
+ */
1637
+ /**
1638
+ * A chat message in a conversation
1639
+ */
1640
+ interface AIMessage {
1641
+ /** Message role */
1642
+ role: 'system' | 'user' | 'assistant';
1643
+ /** Message content */
1644
+ content: string;
1645
+ }
1646
+ /**
1647
+ * Options for AI completion/chat requests
1648
+ */
1649
+ interface AIRequestOptions {
1650
+ /** Model identifier to use */
1651
+ model?: string;
1652
+ /** Sampling temperature (0-2) */
1653
+ temperature?: number;
1654
+ /** Maximum tokens to generate */
1655
+ maxTokens?: number;
1656
+ /** Stop sequences */
1657
+ stop?: string[];
1658
+ }
1659
+ /**
1660
+ * Result of an AI completion/chat request
1661
+ */
1662
+ interface AIResult {
1663
+ /** Generated text content */
1664
+ content: string;
1665
+ /** Model used for generation */
1666
+ model?: string;
1667
+ /** Token usage statistics */
1668
+ usage?: {
1669
+ promptTokens: number;
1670
+ completionTokens: number;
1671
+ totalTokens: number;
1672
+ };
1673
+ }
1674
+ interface IAIService {
1675
+ /**
1676
+ * Generate a chat completion from a conversation
1677
+ * @param messages - Array of conversation messages
1678
+ * @param options - Optional request configuration
1679
+ * @returns AI-generated response
1680
+ */
1681
+ chat(messages: AIMessage[], options?: AIRequestOptions): Promise<AIResult>;
1682
+ /**
1683
+ * Generate a text completion from a prompt
1684
+ * @param prompt - Input prompt string
1685
+ * @param options - Optional request configuration
1686
+ * @returns AI-generated response
1687
+ */
1688
+ complete(prompt: string, options?: AIRequestOptions): Promise<AIResult>;
1689
+ /**
1690
+ * Generate embeddings for a text input
1691
+ * @param input - Text or array of texts to embed
1692
+ * @param model - Optional embedding model identifier
1693
+ * @returns Array of embedding vectors
1694
+ */
1695
+ embed?(input: string | string[], model?: string): Promise<number[][]>;
1696
+ /**
1697
+ * List available models
1698
+ * @returns Array of model identifiers
1699
+ */
1700
+ listModels?(): Promise<string[]>;
1701
+ }
1702
+
1703
+ /**
1704
+ * II18nService - Internationalization Service Contract
1705
+ *
1706
+ * Defines the interface for translation and locale management in ObjectStack.
1707
+ * Concrete implementations (i18next, custom, etc.)
1708
+ * should implement this interface.
1709
+ *
1710
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1711
+ * not on concrete i18n library implementations.
1712
+ *
1713
+ * Aligned with CoreServiceName 'i18n' in core-services.zod.ts.
1714
+ */
1715
+ interface II18nService {
1716
+ /**
1717
+ * Translate a message key for a given locale
1718
+ * @param key - Translation key (e.g. 'objects.account.label')
1719
+ * @param locale - BCP-47 locale code (e.g. 'en-US', 'zh-CN')
1720
+ * @param params - Optional interpolation parameters
1721
+ * @returns Translated string, or the key itself if not found
1722
+ */
1723
+ t(key: string, locale: string, params?: Record<string, unknown>): string;
1724
+ /**
1725
+ * Get all translations for a locale
1726
+ * @param locale - BCP-47 locale code
1727
+ * @returns Translation data map
1728
+ */
1729
+ getTranslations(locale: string): Record<string, unknown>;
1730
+ /**
1731
+ * Load translations for a locale
1732
+ * @param locale - BCP-47 locale code
1733
+ * @param translations - Translation key-value data
1734
+ */
1735
+ loadTranslations(locale: string, translations: Record<string, unknown>): void;
1736
+ /**
1737
+ * List available locales
1738
+ * @returns Array of BCP-47 locale codes
1739
+ */
1740
+ getLocales(): string[];
1741
+ /**
1742
+ * Get the current default locale
1743
+ * @returns BCP-47 locale code
1744
+ */
1745
+ getDefaultLocale?(): string;
1746
+ /**
1747
+ * Set the default locale
1748
+ * @param locale - BCP-47 locale code
1749
+ */
1750
+ setDefaultLocale?(locale: string): void;
1751
+ }
1752
+
1753
+ /**
1754
+ * IUIService - UI Metadata Service Contract
1755
+ *
1756
+ * Defines the interface for managing UI metadata (views, dashboards, layouts)
1757
+ * in ObjectStack. Concrete implementations (database-backed, in-memory, etc.)
1758
+ * should implement this interface.
1759
+ *
1760
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1761
+ * not on concrete UI metadata storage implementations.
1762
+ *
1763
+ * Aligned with CoreServiceName 'ui' in core-services.zod.ts.
1764
+ */
1765
+ interface IUIService {
1766
+ /**
1767
+ * Get a view definition by name
1768
+ * @param name - View name (snake_case)
1769
+ * @returns View definition, or undefined if not found
1770
+ */
1771
+ getView(name: string): unknown | undefined;
1772
+ /**
1773
+ * List view definitions, optionally filtered by object
1774
+ * @param object - Optional object name to filter views for
1775
+ * @returns Array of view definitions
1776
+ */
1777
+ listViews(object?: string): unknown[];
1778
+ /**
1779
+ * Get a dashboard definition by name
1780
+ * @param name - Dashboard name (snake_case)
1781
+ * @returns Dashboard definition, or undefined if not found
1782
+ */
1783
+ getDashboard?(name: string): unknown | undefined;
1784
+ /**
1785
+ * List all dashboard definitions
1786
+ * @returns Array of dashboard definitions
1787
+ */
1788
+ listDashboards?(): unknown[];
1789
+ /**
1790
+ * Register a view definition
1791
+ * @param name - View name (snake_case)
1792
+ * @param definition - View definition object
1793
+ */
1794
+ registerView?(name: string, definition: unknown): void;
1795
+ /**
1796
+ * Register a dashboard definition
1797
+ * @param name - Dashboard name (snake_case)
1798
+ * @param definition - Dashboard definition object
1799
+ */
1800
+ registerDashboard?(name: string, definition: unknown): void;
1801
+ }
1802
+
1803
+ /**
1804
+ * IWorkflowService - Workflow State Machine Service Contract
1805
+ *
1806
+ * Defines the interface for workflow state management and approval processes
1807
+ * in ObjectStack. Concrete implementations (state machine engines, BPMN, etc.)
1808
+ * should implement this interface.
1809
+ *
1810
+ * Follows Dependency Inversion Principle - plugins depend on this interface,
1811
+ * not on concrete workflow engine implementations.
1812
+ *
1813
+ * Aligned with CoreServiceName 'workflow' in core-services.zod.ts.
1814
+ */
1815
+ /**
1816
+ * A state transition request
1817
+ */
1818
+ interface WorkflowTransition {
1819
+ /** Record identifier */
1820
+ recordId: string;
1821
+ /** Object name the record belongs to */
1822
+ object: string;
1823
+ /** Target state to transition to */
1824
+ targetState: string;
1825
+ /** Optional comment for the transition */
1826
+ comment?: string;
1827
+ /** User performing the transition */
1828
+ userId?: string;
1829
+ }
1830
+ /**
1831
+ * Result of a transition attempt
1832
+ */
1833
+ interface WorkflowTransitionResult {
1834
+ /** Whether the transition succeeded */
1835
+ success: boolean;
1836
+ /** The new current state (if success) */
1837
+ currentState?: string;
1838
+ /** Error or rejection reason (if failure) */
1839
+ error?: string;
1840
+ }
1841
+ /**
1842
+ * Status of a workflow instance
1843
+ */
1844
+ interface WorkflowStatus {
1845
+ /** Record identifier */
1846
+ recordId: string;
1847
+ /** Object name */
1848
+ object: string;
1849
+ /** Current state */
1850
+ currentState: string;
1851
+ /** Available transitions from the current state */
1852
+ availableTransitions: string[];
1853
+ }
1854
+ interface IWorkflowService {
1855
+ /**
1856
+ * Transition a record to a new workflow state
1857
+ * @param transition - Transition request details
1858
+ * @returns Transition result
1859
+ */
1860
+ transition(transition: WorkflowTransition): Promise<WorkflowTransitionResult>;
1861
+ /**
1862
+ * Get the current workflow status of a record
1863
+ * @param object - Object name
1864
+ * @param recordId - Record identifier
1865
+ * @returns Current workflow status with available transitions
1866
+ */
1867
+ getStatus(object: string, recordId: string): Promise<WorkflowStatus>;
1868
+ /**
1869
+ * Get transition history for a record
1870
+ * @param object - Object name
1871
+ * @param recordId - Record identifier
1872
+ * @returns Array of historical transitions
1873
+ */
1874
+ getHistory?(object: string, recordId: string): Promise<Array<{
1875
+ fromState: string;
1876
+ toState: string;
1877
+ userId?: string;
1878
+ comment?: string;
1879
+ timestamp: string;
1880
+ }>>;
1881
+ }
1882
+
1883
+ /**
1884
+ * ObjectStack Contracts
1885
+ *
1886
+ * Core interface definitions following "Protocol First" principle.
1887
+ * All interfaces should be defined in @objectstack/spec to avoid circular dependencies.
1888
+ */
1889
+
1890
+ type index_AIMessage = AIMessage;
1891
+ type index_AIRequestOptions = AIRequestOptions;
1892
+ type index_AIResult = AIResult;
1893
+ type index_AnalyticsQuery = AnalyticsQuery;
1894
+ type index_AnalyticsResult = AnalyticsResult;
1895
+ type index_AuthResult = AuthResult;
1896
+ type index_AuthSession = AuthSession;
1897
+ type index_AuthUser = AuthUser;
1898
+ type index_AutomationContext = AutomationContext;
1899
+ type index_AutomationResult = AutomationResult;
1900
+ type index_CacheStats = CacheStats;
1901
+ type index_CubeMeta = CubeMeta;
1902
+ type index_DriverInterface = DriverInterface;
1903
+ type index_GraphQLRequest = GraphQLRequest;
1904
+ type index_GraphQLResponse = GraphQLResponse;
1905
+ type index_HealthStatus = HealthStatus;
1906
+ type index_IAIService = IAIService;
1907
+ type index_IAdvancedServiceRegistry = IAdvancedServiceRegistry;
1908
+ type index_IAnalyticsService = IAnalyticsService;
1909
+ type index_IAuthService = IAuthService;
1910
+ type index_IAutomationService = IAutomationService;
1911
+ type index_IBasicServiceRegistry = IBasicServiceRegistry;
1912
+ type index_ICacheService = ICacheService;
1913
+ type index_IDataEngine = IDataEngine;
1914
+ type index_IGraphQLService = IGraphQLService;
1915
+ type index_IHttpRequest = IHttpRequest;
1916
+ type index_IHttpResponse = IHttpResponse;
1917
+ type index_IHttpServer = IHttpServer;
1918
+ type index_II18nService = II18nService;
1919
+ type index_IJobService = IJobService;
1920
+ type index_IMetadataService = IMetadataService;
1921
+ type index_INotificationService = INotificationService;
1922
+ type index_IPluginLifecycleEvents = IPluginLifecycleEvents;
1923
+ type index_IPluginValidator = IPluginValidator;
1924
+ type index_IQueueService = IQueueService;
1925
+ type index_IRealtimeService = IRealtimeService;
1926
+ type index_ISchemaDriver = ISchemaDriver;
1927
+ type index_ISearchService = ISearchService;
1928
+ type index_IServiceRegistry = IServiceRegistry;
1929
+ type index_IStartupOrchestrator = IStartupOrchestrator;
1930
+ type index_IStorageService = IStorageService;
1931
+ type index_ITypedEventEmitter<Events extends Record<string, any[]>> = ITypedEventEmitter<Events>;
1932
+ type index_IUIService = IUIService;
1933
+ type index_IWorkflowService = IWorkflowService;
1934
+ type index_JobExecution = JobExecution;
1935
+ type index_JobHandler = JobHandler;
1936
+ type index_JobSchedule = JobSchedule;
1937
+ type index_Logger = Logger;
1938
+ type index_Middleware = Middleware;
1939
+ type index_NotificationChannel = NotificationChannel;
1940
+ type index_NotificationMessage = NotificationMessage;
1941
+ type index_NotificationResult = NotificationResult;
1942
+ type index_Plugin = Plugin;
1943
+ type index_PluginStartupResult = PluginStartupResult;
1944
+ type index_QueueHandler<T = unknown> = QueueHandler<T>;
1945
+ type index_QueueMessage<T = unknown> = QueueMessage<T>;
1946
+ type index_QueuePublishOptions = QueuePublishOptions;
1947
+ type index_RealtimeEventHandler = RealtimeEventHandler;
1948
+ type index_RealtimeEventPayload = RealtimeEventPayload;
1949
+ type index_RealtimeSubscriptionOptions = RealtimeSubscriptionOptions;
1950
+ type index_RouteHandler = RouteHandler;
1951
+ type index_SearchHit = SearchHit;
1952
+ type index_SearchOptions = SearchOptions;
1953
+ type index_SearchResult = SearchResult;
1954
+ type index_StartupOptions = StartupOptions;
1955
+ type index_StorageFileInfo = StorageFileInfo;
1956
+ type index_StorageUploadOptions = StorageUploadOptions;
1957
+ type index_ValidationResult = ValidationResult;
1958
+ type index_WorkflowStatus = WorkflowStatus;
1959
+ type index_WorkflowTransition = WorkflowTransition;
1960
+ type index_WorkflowTransitionResult = WorkflowTransitionResult;
1961
+ declare namespace index {
1962
+ export type { index_AIMessage as AIMessage, index_AIRequestOptions as AIRequestOptions, index_AIResult as AIResult, index_AnalyticsQuery as AnalyticsQuery, index_AnalyticsResult as AnalyticsResult, index_AuthResult as AuthResult, index_AuthSession as AuthSession, index_AuthUser as AuthUser, index_AutomationContext as AutomationContext, index_AutomationResult as AutomationResult, index_CacheStats as CacheStats, index_CubeMeta as CubeMeta, index_DriverInterface as DriverInterface, index_GraphQLRequest as GraphQLRequest, index_GraphQLResponse as GraphQLResponse, index_HealthStatus as HealthStatus, index_IAIService as IAIService, index_IAdvancedServiceRegistry as IAdvancedServiceRegistry, index_IAnalyticsService as IAnalyticsService, index_IAuthService as IAuthService, index_IAutomationService as IAutomationService, index_IBasicServiceRegistry as IBasicServiceRegistry, index_ICacheService as ICacheService, index_IDataEngine as IDataEngine, index_IGraphQLService as IGraphQLService, index_IHttpRequest as IHttpRequest, index_IHttpResponse as IHttpResponse, index_IHttpServer as IHttpServer, index_II18nService as II18nService, index_IJobService as IJobService, index_IMetadataService as IMetadataService, index_INotificationService as INotificationService, index_IPluginLifecycleEvents as IPluginLifecycleEvents, index_IPluginValidator as IPluginValidator, index_IQueueService as IQueueService, index_IRealtimeService as IRealtimeService, index_ISchemaDriver as ISchemaDriver, index_ISearchService as ISearchService, index_IServiceRegistry as IServiceRegistry, index_IStartupOrchestrator as IStartupOrchestrator, index_IStorageService as IStorageService, index_ITypedEventEmitter as ITypedEventEmitter, index_IUIService as IUIService, index_IWorkflowService as IWorkflowService, index_JobExecution as JobExecution, index_JobHandler as JobHandler, index_JobSchedule as JobSchedule, index_Logger as Logger, index_Middleware as Middleware, index_NotificationChannel as NotificationChannel, index_NotificationMessage as NotificationMessage, index_NotificationResult as NotificationResult, index_Plugin as Plugin, index_PluginStartupResult as PluginStartupResult, index_QueueHandler as QueueHandler, index_QueueMessage as QueueMessage, index_QueuePublishOptions as QueuePublishOptions, index_RealtimeEventHandler as RealtimeEventHandler, index_RealtimeEventPayload as RealtimeEventPayload, index_RealtimeSubscriptionOptions as RealtimeSubscriptionOptions, index_RouteHandler as RouteHandler, index_SearchHit as SearchHit, index_SearchOptions as SearchOptions, index_SearchResult as SearchResult, index_StartupOptions as StartupOptions, index_StorageFileInfo as StorageFileInfo, index_StorageUploadOptions as StorageUploadOptions, index_ValidationResult as ValidationResult, index_WorkflowStatus as WorkflowStatus, index_WorkflowTransition as WorkflowTransition, index_WorkflowTransitionResult as WorkflowTransitionResult };
1963
+ }
1964
+
1965
+ export { type IAnalyticsService as $, type IStorageService as A, type IMetadataService as B, type CacheStats as C, type DriverInterface as D, type AuthUser as E, type AuthSession as F, type AuthResult as G, type HealthStatus as H, type IDataEngine as I, type IAuthService as J, type AutomationContext as K, type Logger as L, type Middleware as M, type NotificationChannel as N, type AutomationResult as O, type Plugin as P, type QueuePublishOptions as Q, type RouteHandler as R, type StartupOptions as S, type IAutomationService as T, type GraphQLRequest as U, type ValidationResult as V, type GraphQLResponse as W, type IGraphQLService as X, type AnalyticsQuery as Y, type AnalyticsResult as Z, type CubeMeta as _, type IHttpRequest as a, type RealtimeEventPayload as a0, type RealtimeEventHandler as a1, type RealtimeSubscriptionOptions as a2, type IRealtimeService as a3, type JobSchedule as a4, type JobHandler as a5, type JobExecution as a6, type IJobService as a7, type AIMessage as a8, type AIRequestOptions as a9, type AIResult as aa, type IAIService as ab, type II18nService as ac, type IUIService as ad, type WorkflowTransition as ae, type WorkflowTransitionResult as af, type WorkflowStatus as ag, type IWorkflowService as ah, type IHttpResponse as b, type IHttpServer as c, type IServiceRegistry as d, type IBasicServiceRegistry as e, type IAdvancedServiceRegistry as f, type IPluginValidator as g, type PluginStartupResult as h, index as i, type IStartupOrchestrator as j, type IPluginLifecycleEvents as k, type ITypedEventEmitter as l, type ISchemaDriver as m, type ICacheService as n, type SearchOptions as o, type SearchHit as p, type SearchResult as q, type ISearchService as r, type QueueMessage as s, type QueueHandler as t, type IQueueService as u, type NotificationMessage as v, type NotificationResult as w, type INotificationService as x, type StorageUploadOptions as y, type StorageFileInfo as z };