nvent 0.5.15 → 1.0.0-alpha.2

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 (149) hide show
  1. package/dist/module.d.mts +181 -8
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1257 -1196
  4. package/dist/runtime/app/composables/useFunctionCall.d.ts +17 -0
  5. package/dist/runtime/app/composables/useFunctionCall.js +25 -0
  6. package/dist/runtime/app/composables/useNventStream.d.ts +23 -0
  7. package/dist/runtime/app/composables/useNventStream.js +58 -0
  8. package/dist/runtime/nitro/plugins/00.iii-lifecycle.d.ts +19 -0
  9. package/dist/runtime/nitro/plugins/00.iii-lifecycle.js +62 -0
  10. package/dist/runtime/nitro/plugins/01.iii-worker.d.ts +15 -0
  11. package/dist/runtime/nitro/plugins/01.iii-worker.js +91 -0
  12. package/dist/runtime/nitro/routes/stream-proxy.d.ts +17 -0
  13. package/dist/runtime/nitro/routes/stream-proxy.js +45 -0
  14. package/dist/runtime/nitro/utils/console.d.ts +32 -0
  15. package/dist/runtime/nitro/utils/console.js +95 -0
  16. package/dist/runtime/nitro/utils/defineFunction.d.ts +378 -3
  17. package/dist/runtime/nitro/utils/defineFunction.js +224 -4
  18. package/dist/runtime/nitro/utils/engine.d.ts +25 -0
  19. package/dist/runtime/nitro/utils/engine.js +130 -0
  20. package/dist/runtime/nitro/utils/nventDir.d.ts +1 -0
  21. package/dist/runtime/nitro/utils/nventDir.js +20 -0
  22. package/dist/runtime/nitro/utils/useIii.d.ts +23 -0
  23. package/dist/runtime/nitro/utils/useIii.js +14 -0
  24. package/dist/runtime/nitro/utils/workers/node.d.ts +24 -0
  25. package/dist/runtime/nitro/utils/workers/node.js +57 -0
  26. package/dist/runtime/nitro/utils/workers/python.d.ts +67 -0
  27. package/dist/runtime/nitro/utils/workers/python.js +220 -0
  28. package/dist/runtime/python/nvent.py +208 -0
  29. package/dist/runtime/python/worker_runtime.py +659 -0
  30. package/dist/runtime/virtual.d.ts +17 -0
  31. package/dist/types.d.mts +5 -1
  32. package/package.json +11 -14
  33. package/dist/runtime/adapters/base/index.d.ts +0 -6
  34. package/dist/runtime/adapters/base/index.js +0 -1
  35. package/dist/runtime/adapters/base/store-validator.d.ts +0 -48
  36. package/dist/runtime/adapters/base/store-validator.js +0 -147
  37. package/dist/runtime/adapters/builtin/file-queue.d.ts +0 -67
  38. package/dist/runtime/adapters/builtin/file-queue.js +0 -499
  39. package/dist/runtime/adapters/builtin/file-store.d.ts +0 -32
  40. package/dist/runtime/adapters/builtin/file-store.js +0 -206
  41. package/dist/runtime/adapters/builtin/file-stream.d.ts +0 -39
  42. package/dist/runtime/adapters/builtin/file-stream.js +0 -56
  43. package/dist/runtime/adapters/builtin/index.d.ts +0 -10
  44. package/dist/runtime/adapters/builtin/index.js +0 -5
  45. package/dist/runtime/adapters/builtin/memory-queue.d.ts +0 -52
  46. package/dist/runtime/adapters/builtin/memory-queue.js +0 -243
  47. package/dist/runtime/adapters/builtin/memory-store.d.ts +0 -69
  48. package/dist/runtime/adapters/builtin/memory-store.js +0 -357
  49. package/dist/runtime/adapters/builtin/memory-stream.d.ts +0 -21
  50. package/dist/runtime/adapters/builtin/memory-stream.js +0 -56
  51. package/dist/runtime/adapters/factory.d.ts +0 -31
  52. package/dist/runtime/adapters/factory.js +0 -135
  53. package/dist/runtime/adapters/index.d.ts +0 -8
  54. package/dist/runtime/adapters/index.js +0 -3
  55. package/dist/runtime/adapters/interfaces/index.d.ts +0 -11
  56. package/dist/runtime/adapters/interfaces/index.js +0 -3
  57. package/dist/runtime/adapters/interfaces/queue.d.ts +0 -155
  58. package/dist/runtime/adapters/interfaces/queue.js +0 -0
  59. package/dist/runtime/adapters/interfaces/store.d.ts +0 -299
  60. package/dist/runtime/adapters/interfaces/store.js +0 -0
  61. package/dist/runtime/adapters/interfaces/stream.d.ts +0 -62
  62. package/dist/runtime/adapters/interfaces/stream.js +0 -0
  63. package/dist/runtime/adapters/registry.d.ts +0 -85
  64. package/dist/runtime/adapters/registry.js +0 -161
  65. package/dist/runtime/config/index.d.ts +0 -23
  66. package/dist/runtime/config/index.js +0 -200
  67. package/dist/runtime/config/types.d.ts +0 -439
  68. package/dist/runtime/config/types.js +0 -0
  69. package/dist/runtime/events/eventBus.d.ts +0 -20
  70. package/dist/runtime/events/eventBus.js +0 -35
  71. package/dist/runtime/events/types.d.ts +0 -144
  72. package/dist/runtime/events/types.js +0 -0
  73. package/dist/runtime/events/utils/scheduleTrigger.d.ts +0 -8
  74. package/dist/runtime/events/utils/scheduleTrigger.js +0 -71
  75. package/dist/runtime/events/utils/stallDetector.d.ts +0 -83
  76. package/dist/runtime/events/utils/stallDetector.js +0 -318
  77. package/dist/runtime/events/utils/triggerRuntime.d.ts +0 -58
  78. package/dist/runtime/events/utils/triggerRuntime.js +0 -212
  79. package/dist/runtime/events/wiring/flowWiring.d.ts +0 -34
  80. package/dist/runtime/events/wiring/flowWiring.js +0 -1258
  81. package/dist/runtime/events/wiring/registry.d.ts +0 -19
  82. package/dist/runtime/events/wiring/registry.js +0 -43
  83. package/dist/runtime/events/wiring/stateWiring.d.ts +0 -37
  84. package/dist/runtime/events/wiring/stateWiring.js +0 -92
  85. package/dist/runtime/events/wiring/streamWiring.d.ts +0 -36
  86. package/dist/runtime/events/wiring/streamWiring.js +0 -156
  87. package/dist/runtime/events/wiring/triggerWiring.d.ts +0 -21
  88. package/dist/runtime/events/wiring/triggerWiring.js +0 -422
  89. package/dist/runtime/nitro/plugins/00.adapters.d.ts +0 -14
  90. package/dist/runtime/nitro/plugins/00.adapters.js +0 -73
  91. package/dist/runtime/nitro/plugins/01.ws-lifecycle.d.ts +0 -5
  92. package/dist/runtime/nitro/plugins/01.ws-lifecycle.js +0 -69
  93. package/dist/runtime/nitro/plugins/02.workers.d.ts +0 -2
  94. package/dist/runtime/nitro/plugins/02.workers.js +0 -92
  95. package/dist/runtime/nitro/plugins/03.triggers.d.ts +0 -12
  96. package/dist/runtime/nitro/plugins/03.triggers.js +0 -55
  97. package/dist/runtime/nitro/routes/webhook.await.d.ts +0 -23
  98. package/dist/runtime/nitro/routes/webhook.await.js +0 -112
  99. package/dist/runtime/nitro/routes/webhook.trigger.d.ts +0 -86
  100. package/dist/runtime/nitro/routes/webhook.trigger.js +0 -73
  101. package/dist/runtime/nitro/utils/adapters.d.ts +0 -66
  102. package/dist/runtime/nitro/utils/adapters.js +0 -51
  103. package/dist/runtime/nitro/utils/awaitPatterns/event.d.ts +0 -15
  104. package/dist/runtime/nitro/utils/awaitPatterns/event.js +0 -128
  105. package/dist/runtime/nitro/utils/awaitPatterns/index.d.ts +0 -28
  106. package/dist/runtime/nitro/utils/awaitPatterns/index.js +0 -55
  107. package/dist/runtime/nitro/utils/awaitPatterns/schedule.d.ts +0 -16
  108. package/dist/runtime/nitro/utils/awaitPatterns/schedule.js +0 -83
  109. package/dist/runtime/nitro/utils/awaitPatterns/time.d.ts +0 -15
  110. package/dist/runtime/nitro/utils/awaitPatterns/time.js +0 -71
  111. package/dist/runtime/nitro/utils/awaitPatterns/webhook.d.ts +0 -15
  112. package/dist/runtime/nitro/utils/awaitPatterns/webhook.js +0 -128
  113. package/dist/runtime/nitro/utils/defineFunctionConfig.d.ts +0 -378
  114. package/dist/runtime/nitro/utils/defineFunctionConfig.js +0 -3
  115. package/dist/runtime/nitro/utils/defineHooks.d.ts +0 -95
  116. package/dist/runtime/nitro/utils/defineHooks.js +0 -9
  117. package/dist/runtime/nitro/utils/registerAdapter.d.ts +0 -59
  118. package/dist/runtime/nitro/utils/registerAdapter.js +0 -13
  119. package/dist/runtime/nitro/utils/useAwait.d.ts +0 -83
  120. package/dist/runtime/nitro/utils/useAwait.js +0 -169
  121. package/dist/runtime/nitro/utils/useEventManager.d.ts +0 -15
  122. package/dist/runtime/nitro/utils/useEventManager.js +0 -26
  123. package/dist/runtime/nitro/utils/useFlow.d.ts +0 -66
  124. package/dist/runtime/nitro/utils/useFlow.js +0 -310
  125. package/dist/runtime/nitro/utils/useHookRegistry.d.ts +0 -40
  126. package/dist/runtime/nitro/utils/useHookRegistry.js +0 -25
  127. package/dist/runtime/nitro/utils/useNventLogger.d.ts +0 -42
  128. package/dist/runtime/nitro/utils/useNventLogger.js +0 -54
  129. package/dist/runtime/nitro/utils/useRunContext.d.ts +0 -6
  130. package/dist/runtime/nitro/utils/useRunContext.js +0 -102
  131. package/dist/runtime/nitro/utils/useStreamTopics.d.ts +0 -83
  132. package/dist/runtime/nitro/utils/useStreamTopics.js +0 -94
  133. package/dist/runtime/nitro/utils/useTrigger.d.ts +0 -150
  134. package/dist/runtime/nitro/utils/useTrigger.js +0 -311
  135. package/dist/runtime/nitro/utils/wsPeerManager.d.ts +0 -44
  136. package/dist/runtime/nitro/utils/wsPeerManager.js +0 -32
  137. package/dist/runtime/scheduler/index.d.ts +0 -33
  138. package/dist/runtime/scheduler/index.js +0 -42
  139. package/dist/runtime/scheduler/scheduler.d.ts +0 -132
  140. package/dist/runtime/scheduler/scheduler.js +0 -799
  141. package/dist/runtime/scheduler/types.d.ts +0 -122
  142. package/dist/runtime/scheduler/types.js +0 -0
  143. package/dist/runtime/worker/node/runner.d.ts +0 -95
  144. package/dist/runtime/worker/node/runner.js +0 -272
  145. package/dist/runtime/worker/python/get_config.py +0 -64
  146. package/dist/runtime/worker/system/awaitHandlers.d.ts +0 -27
  147. package/dist/runtime/worker/system/awaitHandlers.js +0 -230
  148. package/dist/runtime/worker/system/index.d.ts +0 -24
  149. package/dist/runtime/worker/system/index.js +0 -39
@@ -1,155 +0,0 @@
1
- /**
2
- * Queue Adapter Interface
3
- *
4
- * Handles job queue operations only (enqueue, retrieve, manage)
5
- * Does NOT handle event storage, state, or logging - those are separate concerns
6
- */
7
- export interface QueueAdapter {
8
- /**
9
- * Initialize the queue adapter
10
- */
11
- init(): Promise<void>;
12
- /**
13
- * Add a job to the queue
14
- * @returns Job ID
15
- */
16
- enqueue(queueName: string, job: JobInput): Promise<string>;
17
- /**
18
- * Schedule a job (delayed or recurring)
19
- * @returns Job ID
20
- */
21
- schedule(queueName: string, job: JobInput, opts?: ScheduleOptions): Promise<string>;
22
- /**
23
- * Get a specific job by ID
24
- */
25
- getJob(queueName: string, id: string): Promise<Job | null>;
26
- /**
27
- * Get multiple jobs with optional filtering
28
- */
29
- getJobs(queueName: string, query?: JobsQuery): Promise<Job[]>;
30
- /**
31
- * Subscribe to queue events
32
- * @returns Unsubscribe function
33
- */
34
- on(queueName: string, event: QueueEvent, callback: (payload: any) => void): () => void;
35
- /**
36
- * Check if queue is paused
37
- */
38
- isPaused(queueName: string): Promise<boolean>;
39
- /**
40
- * Get job counts by state
41
- */
42
- getJobCounts(queueName: string): Promise<JobCounts>;
43
- /**
44
- * Get scheduled/repeatable jobs (cron jobs)
45
- */
46
- getScheduledJobs?(queueName: string): Promise<ScheduledJobInfo[]>;
47
- /**
48
- * Remove a scheduled/repeatable job
49
- * @returns true if removed, false if not found
50
- */
51
- removeScheduledJob?(scheduleId: string): Promise<boolean>;
52
- /**
53
- * Remove/cancel a job by ID
54
- * @returns true if removed, false if not found
55
- */
56
- removeJob?(queueName: string, jobId: string): Promise<boolean>;
57
- /**
58
- * Pause the queue
59
- */
60
- pause(queueName: string): Promise<void>;
61
- /**
62
- * Resume the queue
63
- */
64
- resume(queueName: string): Promise<void>;
65
- /**
66
- * Register a worker handler for processing jobs
67
- * This is called by the worker registration system
68
- */
69
- registerWorker(queueName: string, jobName: string, handler: WorkerHandler, opts?: WorkerOptions): void;
70
- /**
71
- * Start processing waiting jobs for a queue
72
- * Should be called after all handlers are registered
73
- */
74
- startProcessingQueue?(queueName: string): void;
75
- /**
76
- * Close/cleanup the adapter
77
- */
78
- close(): Promise<void>;
79
- }
80
- export interface JobInput {
81
- name: string;
82
- data: any;
83
- opts?: JobOptions;
84
- }
85
- export interface JobOptions {
86
- jobId?: string;
87
- attempts?: number;
88
- backoff?: {
89
- type: 'exponential' | 'fixed';
90
- delay: number;
91
- };
92
- delay?: number;
93
- priority?: number;
94
- timeout?: number;
95
- removeOnComplete?: boolean | number;
96
- removeOnFail?: boolean | number;
97
- }
98
- export interface Job {
99
- id: string;
100
- name: string;
101
- data: any;
102
- returnvalue?: any;
103
- failedReason?: string;
104
- state: 'waiting' | 'active' | 'completed' | 'failed' | 'delayed' | 'paused';
105
- timestamp?: number;
106
- processedOn?: number;
107
- finishedOn?: number;
108
- attemptsMade?: number;
109
- progress?: number;
110
- }
111
- export interface JobsQuery {
112
- state?: JobState[];
113
- limit?: number;
114
- offset?: number;
115
- }
116
- export type JobState = 'waiting' | 'active' | 'completed' | 'failed' | 'delayed' | 'paused';
117
- export interface ScheduleOptions {
118
- delay?: number;
119
- cron?: string;
120
- repeat?: {
121
- pattern?: string;
122
- limit?: number;
123
- };
124
- }
125
- export interface JobCounts {
126
- active: number;
127
- completed: number;
128
- failed: number;
129
- delayed: number;
130
- waiting: number;
131
- paused: number;
132
- }
133
- export interface ScheduledJobInfo {
134
- id: string;
135
- jobName: string;
136
- queueName: string;
137
- cron?: string;
138
- pattern?: string;
139
- nextRun?: Date;
140
- repeatCount?: number;
141
- limit?: number;
142
- }
143
- export type QueueEvent = 'waiting' | 'active' | 'progress' | 'completed' | 'failed' | 'delayed' | 'paused' | 'stalled';
144
- export interface WorkerHandler {
145
- (payload: any, ctx: WorkerContext): Promise<any>;
146
- }
147
- export interface WorkerContext {
148
- jobId: string;
149
- queueName: string;
150
- [key: string]: any;
151
- }
152
- export interface WorkerOptions {
153
- concurrency?: number;
154
- autorun?: boolean;
155
- }
File without changes
@@ -1,299 +0,0 @@
1
- /**
2
- * Store Adapter Interface
3
- *
4
- * Three-tier storage system:
5
- * 1. Event Stream - Append-only event log
6
- * 2. Sorted Index - Time-ordered metadata storage
7
- * 3. Key-Value Store - Fast lookups (for state, caching)
8
- *
9
- * ## Critical Implementation Requirements
10
- *
11
- * ### 1. Index Operations - add() vs update()
12
- *
13
- * **index.add()** - MUST completely REPLACE metadata when entry exists:
14
- * ```typescript
15
- * // First call
16
- * await index.add('flows', 'my-flow', 123, { name: 'Flow', stats: {...} })
17
- * // Second call - REPLACES entire metadata
18
- * await index.add('flows', 'my-flow', 456, { lastRunAt: 789 })
19
- * // Result: { lastRunAt: 789 } ← stats are LOST!
20
- * ```
21
- *
22
- * **index.update()** - MUST perform DEEP MERGE of metadata:
23
- * ```typescript
24
- * // Initial state: { status: 'running', emittedEvents: { test: { completed: 1 } } }
25
- * await index.update('runs', 'run-id', { emittedEvents: { another: { fired: 2 } } })
26
- * // Result: { status: 'running', emittedEvents: { test: { completed: 1 }, another: { fired: 2 } } }
27
- * ```
28
- *
29
- * ⚠️ **CRITICAL**: update() must perform DEEP merge at ALL nesting levels, not just top-level!
30
- * - PostgreSQL `||` operator: Only shallow merge (top-level keys)
31
- * - Redis HSET loop: Field-level merge (simulates deep merge for flat structures)
32
- * - Memory defu(): True deep merge
33
- *
34
- * ### 2. Nested Metadata Structure
35
- *
36
- * Flow orchestration stores deeply nested metadata:
37
- * ```typescript
38
- * {
39
- * emittedEvents: {
40
- * 'step1': {
41
- * 'completed': 1234567890,
42
- * 'custom_event': 1234567891
43
- * },
44
- * 'step2': {
45
- * 'completed': 1234567892
46
- * }
47
- * },
48
- * awaitingSteps: {
49
- * 'step_name': {
50
- * status: 'awaiting',
51
- * position: 'after',
52
- * awaitType: 'event'
53
- * }
54
- * }
55
- * }
56
- * ```
57
- *
58
- * Multiple updates add to nested structures incrementally. If deep merge fails,
59
- * flow orchestration will miss events and steps won't trigger.
60
- *
61
- * ### 3. Concurrent Updates
62
- *
63
- * Flow steps run in parallel and update metadata concurrently:
64
- * - Multiple steps emit events simultaneously
65
- * - Each emits triggers index.updateWithRetry() with partial metadata
66
- * - Updates must NOT overwrite each other
67
- * - Use optimistic locking (version field) + retries
68
- *
69
- * ### 4. Testing Deep Merge
70
- *
71
- * Test that your adapter correctly handles:
72
- * ```typescript
73
- * // Setup
74
- * await index.add('test', 'id', 1, { a: { b: 1 }, c: 2 })
75
- *
76
- * // Update nested property
77
- * await index.update('test', 'id', { a: { d: 3 } })
78
- * const result = await index.get('test', 'id')
79
- *
80
- * // MUST preserve existing nested data
81
- * expect(result.metadata).toEqual({ a: { b: 1, d: 3 }, c: 2 })
82
- * // NOT: { a: { d: 3 }, c: 2 } ← b is lost!
83
- * ```
84
- *
85
- */
86
- export interface StoreAdapter {
87
- /**
88
- * Close/cleanup the adapter
89
- */
90
- close(): Promise<void>;
91
- stream: {
92
- /**
93
- * Append an event to a subject's event stream
94
- * @param subject - Event stream identifier (e.g., 'nq:flow:abc-123')
95
- * @param event - Event to append (id and ts will be auto-generated)
96
- * @returns The complete event record with generated id and timestamp
97
- */
98
- append(subject: string, event: Omit<EventRecord, 'id' | 'ts'>): Promise<EventRecord>;
99
- /**
100
- * Read events from a subject's event stream
101
- * @param subject - Event stream identifier
102
- * @param opts - Query options (filtering, pagination, etc.)
103
- * @returns Array of event records
104
- */
105
- read(subject: string, opts?: EventReadOptions): Promise<EventRecord[]>;
106
- /**
107
- * Subscribe to new events in a subject's event stream (optional, not all adapters support this)
108
- * @param subject - Event stream identifier (supports wildcards if adapter allows)
109
- * @param onEvent - Callback for new events
110
- * @returns Subscription handle for unsubscribing
111
- */
112
- subscribe?(subject: string, onEvent: (event: EventRecord) => void): Promise<EventSubscription>;
113
- /**
114
- * Delete an entire event stream
115
- * @param subject - Event stream identifier
116
- * @returns True if stream was deleted, false if not found
117
- */
118
- delete?(subject: string): Promise<boolean>;
119
- };
120
- kv: {
121
- /**
122
- * Get a value by key
123
- */
124
- get<T = any>(key: string): Promise<T | null>;
125
- /**
126
- * Set a value with optional TTL
127
- * @param key - Key
128
- * @param value - Value to store
129
- * @param ttl - Time to live in seconds (optional)
130
- */
131
- set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
132
- /**
133
- * Delete a key
134
- */
135
- delete(key: string): Promise<void>;
136
- /**
137
- * Delete all keys matching a pattern (optional, not all adapters support patterns)
138
- * @returns Number of keys deleted
139
- */
140
- clear?(pattern: string): Promise<number>;
141
- /**
142
- * Atomic increment operation (optional, for counters)
143
- * @returns New value after increment
144
- */
145
- increment?(key: string, by?: number): Promise<number>;
146
- };
147
- index: {
148
- /**
149
- * Add entry to a sorted index
150
- * @param key - Index key (e.g., 'nq:flows:flowName')
151
- * @param id - Entry ID
152
- * @param score - Sort score (typically timestamp)
153
- * @param metadata - Optional metadata to store with entry
154
- */
155
- add(key: string, id: string, score: number, metadata?: Record<string, any>): Promise<void>;
156
- /**
157
- * Get a single entry from a sorted index
158
- * @param key - Index key
159
- * @param id - Entry ID
160
- * @returns Entry with score and metadata, or null if not found
161
- */
162
- get(key: string, id: string): Promise<{
163
- id: string;
164
- score: number;
165
- metadata?: any;
166
- } | null>;
167
- /**
168
- * Read entries from a sorted index (ordered by score descending)
169
- * @param key - Index key
170
- * @param opts - Pagination and filter options
171
- * @param opts.offset - Number of entries to skip
172
- * @param opts.limit - Maximum number of entries to return
173
- * @param opts.filter - Optional filter criteria for metadata fields (adapter-dependent efficiency)
174
- * @returns Array of entries with scores and metadata
175
- */
176
- read(key: string, opts?: {
177
- offset?: number;
178
- limit?: number;
179
- filter?: Record<string, any>;
180
- }): Promise<Array<{
181
- id: string;
182
- score: number;
183
- metadata?: any;
184
- }>>;
185
- /**
186
- * Update metadata for an entry in a sorted index
187
- * @param key - Index key
188
- * @param id - Entry ID
189
- * @param metadata - Metadata to update
190
- * @returns True if update succeeded, false if version conflict
191
- */
192
- update(key: string, id: string, metadata: Record<string, any>): Promise<boolean>;
193
- /**
194
- * Update with automatic retries on version conflicts
195
- * @param key - Index key
196
- * @param id - Entry ID
197
- * @param metadata - Metadata to update
198
- * @param maxRetries - Maximum retry attempts (default: 3)
199
- */
200
- updateWithRetry(key: string, id: string, metadata: Record<string, any>, maxRetries?: number): Promise<void>;
201
- /**
202
- * Atomic increment of a metadata field in an index entry
203
- * @param key - Index key
204
- * @param id - Entry ID
205
- * @param field - Field name to increment
206
- * @param increment - Amount to increment by (default: 1)
207
- * @returns New value after increment
208
- */
209
- increment(key: string, id: string, field: string, increment?: number): Promise<number>;
210
- /**
211
- * Delete an entry from a sorted index
212
- * @param key - Index key
213
- * @param id - Entry ID
214
- * @returns True if entry was deleted, false if not found
215
- */
216
- delete(key: string, id: string): Promise<boolean>;
217
- };
218
- }
219
- /**
220
- * Event record in the event stream
221
- * This is the storage representation - converts FlowEvent to/from storage format
222
- */
223
- export interface EventRecord {
224
- id: string;
225
- ts: number;
226
- type: string;
227
- runId: string;
228
- flowName: string;
229
- stepName?: string;
230
- stepId?: string;
231
- attempt?: number;
232
- data?: any;
233
- }
234
- /**
235
- * Options for reading events from the event stream
236
- */
237
- export interface EventReadOptions {
238
- /**
239
- * Filter by event types
240
- */
241
- types?: string[];
242
- /**
243
- * Read events after this ID
244
- */
245
- after?: string;
246
- /**
247
- * Read events before this ID
248
- */
249
- before?: string;
250
- /**
251
- * Read events from this timestamp
252
- */
253
- from?: number;
254
- /**
255
- * Read events until this timestamp
256
- */
257
- to?: number;
258
- /**
259
- * Maximum number of events to return
260
- */
261
- limit?: number;
262
- /**
263
- * Sort order ('asc' or 'desc')
264
- */
265
- order?: 'asc' | 'desc';
266
- }
267
- /**
268
- * Subscription handle for event stream subscriptions
269
- */
270
- export interface EventSubscription {
271
- id: string;
272
- subject: string;
273
- unsubscribe: () => Promise<void>;
274
- }
275
- /**
276
- * Options for listing documents
277
- */
278
- export interface ListOptions {
279
- /**
280
- * Filter documents by field values
281
- */
282
- filter?: Record<string, any>;
283
- /**
284
- * Maximum number of documents to return
285
- */
286
- limit?: number;
287
- /**
288
- * Number of documents to skip
289
- */
290
- offset?: number;
291
- /**
292
- * Sort by field
293
- */
294
- sortBy?: string;
295
- /**
296
- * Sort order
297
- */
298
- order?: 'asc' | 'desc';
299
- }
File without changes
@@ -1,62 +0,0 @@
1
- /**
2
- * Stream Adapter Interface
3
- *
4
- * Handles pub/sub messaging for cross-instance communication
5
- * Replaces the pub/sub functionality from EventStoreAdapter.subscribe()
6
- */
7
- export interface StreamAdapter {
8
- /**
9
- * Initialize the stream adapter
10
- */
11
- init(): Promise<void>;
12
- /**
13
- * Publish an event to a topic
14
- */
15
- publish(topic: string, event: StreamEvent): Promise<void>;
16
- /**
17
- * Subscribe to a topic
18
- * @returns Subscription handle for unsubscribing
19
- */
20
- subscribe(topic: string, handler: (event: StreamEvent) => void | Promise<void>, opts?: SubscribeOptions): Promise<SubscriptionHandle>;
21
- /**
22
- * Unsubscribe from a topic
23
- */
24
- unsubscribe(handle: SubscriptionHandle): Promise<void>;
25
- /**
26
- * List all active topics
27
- */
28
- listTopics(): Promise<string[]>;
29
- /**
30
- * Get number of subscribers for a topic
31
- */
32
- getSubscriptionCount(topic: string): Promise<number>;
33
- /**
34
- * Shutdown the adapter and cleanup resources
35
- */
36
- shutdown(): Promise<void>;
37
- }
38
- export interface StreamEvent {
39
- type: string;
40
- data: any;
41
- metadata?: Record<string, any>;
42
- timestamp?: number;
43
- }
44
- export interface SubscribeOptions {
45
- /**
46
- * Consumer group for load balancing (if supported)
47
- */
48
- group?: string;
49
- /**
50
- * Filter events by type pattern
51
- */
52
- filter?: string | RegExp;
53
- /**
54
- * Starting position (if supported by adapter)
55
- */
56
- fromBeginning?: boolean;
57
- }
58
- export interface SubscriptionHandle {
59
- id: string;
60
- topic: string;
61
- unsubscribe: () => Promise<void>;
62
- }
File without changes
@@ -1,85 +0,0 @@
1
- /**
2
- * Adapter Registry
3
- *
4
- * Central registry for all adapter types (queue, stream, store)
5
- * Adapters are registered via the nvent:registerAdapter Nuxt hook
6
- */
7
- import type { QueueAdapter, StreamAdapter, StoreAdapter } from './interfaces/index.js';
8
- export declare class AdapterRegistry {
9
- private queueAdapters;
10
- private streamAdapters;
11
- private storeAdapters;
12
- /**
13
- * Register a queue adapter
14
- * @param name - Adapter name (e.g., 'redis', 'memory', 'postgres')
15
- * @param adapter - QueueAdapter implementation
16
- */
17
- registerQueue(name: string, adapter: QueueAdapter): void;
18
- /**
19
- * Register a stream adapter
20
- * @param name - Adapter name (e.g., 'redis', 'memory', 'rabbitmq')
21
- * @param adapter - StreamAdapter implementation
22
- */
23
- registerStream(name: string, adapter: StreamAdapter): void;
24
- /**
25
- * Register a store adapter
26
- * @param name - Adapter name (e.g., 'redis', 'memory', 'postgres')
27
- * @param adapter - StoreAdapter implementation
28
- */
29
- registerStore(name: string, adapter: StoreAdapter): void;
30
- /**
31
- * Get a queue adapter by name
32
- * @throws Error if adapter not found
33
- */
34
- getQueue(name: string): QueueAdapter;
35
- /**
36
- * Get a stream adapter by name
37
- * @throws Error if adapter not found
38
- */
39
- getStream(name: string): StreamAdapter;
40
- /**
41
- * Get a store adapter by name
42
- * @throws Error if adapter not found
43
- */
44
- getStore(name: string): StoreAdapter;
45
- /**
46
- * Check if a queue adapter is registered
47
- */
48
- hasQueue(name: string): boolean;
49
- /**
50
- * Check if a stream adapter is registered
51
- */
52
- hasStream(name: string): boolean;
53
- /**
54
- * Check if a store adapter is registered
55
- */
56
- hasStore(name: string): boolean;
57
- /**
58
- * List all registered queue adapters
59
- */
60
- listQueueAdapters(): string[];
61
- /**
62
- * List all registered stream adapters
63
- */
64
- listStreamAdapters(): string[];
65
- /**
66
- * List all registered store adapters
67
- */
68
- listStoreAdapters(): string[];
69
- /**
70
- * Initialize all registered adapters
71
- */
72
- initAll(): Promise<void>;
73
- /**
74
- * Close/cleanup all registered adapters
75
- */
76
- closeAll(): Promise<void>;
77
- }
78
- /**
79
- * Get the global adapter registry instance
80
- */
81
- export declare function useAdapterRegistry(): AdapterRegistry;
82
- /**
83
- * Reset the registry (useful for testing)
84
- */
85
- export declare function resetAdapterRegistry(): void;