@semiont/make-meaning 0.2.34 → 0.2.35-build.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +50 -16
- package/dist/index.js +1762 -216
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -216,59 +216,93 @@ declare class TagAnnotationWorker extends JobWorker {
|
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* GraphDB Consumer
|
|
219
|
-
* Subscribes to resource events and updates GraphDB accordingly
|
|
220
219
|
*
|
|
221
|
-
*
|
|
220
|
+
* Subscribes to resource events and updates GraphDB accordingly.
|
|
221
|
+
* Makes GraphDB a projection of Event Store events (single source of truth).
|
|
222
|
+
*
|
|
223
|
+
* Uses an RxJS pipeline with adaptive burst buffering:
|
|
224
|
+
* - First event after idle passes through immediately (zero latency)
|
|
225
|
+
* - Subsequent events in a burst are batched and flushed together
|
|
226
|
+
* - After idle, returns to passthrough mode
|
|
227
|
+
*
|
|
228
|
+
* Per-resource ordering is preserved via groupBy(resourceId) + concatMap.
|
|
229
|
+
* Cross-resource parallelism is provided via mergeMap over groups.
|
|
230
|
+
*
|
|
231
|
+
* Burst buffer thresholds (see BATCH-GRAPH-CONSUMER-RX.md for tuning guidance):
|
|
232
|
+
* BURST_WINDOW_MS = 50 — debounce window before flushing a batch
|
|
233
|
+
* MAX_BATCH_SIZE = 500 — force flush to bound memory
|
|
234
|
+
* IDLE_TIMEOUT_MS = 200 — silence before returning to passthrough
|
|
222
235
|
*/
|
|
223
236
|
|
|
224
237
|
declare class GraphDBConsumer {
|
|
225
238
|
private config;
|
|
226
239
|
private eventStore;
|
|
227
240
|
private graphDb;
|
|
241
|
+
private static readonly GRAPH_RELEVANT_EVENTS;
|
|
242
|
+
private static readonly BURST_WINDOW_MS;
|
|
243
|
+
private static readonly MAX_BATCH_SIZE;
|
|
244
|
+
private static readonly IDLE_TIMEOUT_MS;
|
|
228
245
|
private _globalSubscription;
|
|
229
|
-
private
|
|
246
|
+
private eventSubject;
|
|
247
|
+
private pipelineSubscription;
|
|
230
248
|
private lastProcessed;
|
|
231
249
|
private readonly logger;
|
|
232
250
|
constructor(config: EnvironmentConfig, eventStore: EventStore, graphDb: GraphDatabase, logger: Logger);
|
|
233
251
|
initialize(): Promise<void>;
|
|
234
252
|
/**
|
|
235
|
-
* Subscribe globally to ALL events
|
|
236
|
-
*
|
|
253
|
+
* Subscribe globally to ALL events, pre-filter to graph-relevant types,
|
|
254
|
+
* and wire through the RxJS burst-buffered pipeline.
|
|
237
255
|
*/
|
|
238
256
|
private subscribeToGlobalEvents;
|
|
257
|
+
/**
|
|
258
|
+
* Wrap applyEventToGraph in try/catch so one failed event doesn't kill the pipeline.
|
|
259
|
+
*/
|
|
260
|
+
private safeApplyEvent;
|
|
239
261
|
private ensureInitialized;
|
|
240
262
|
/**
|
|
241
|
-
* Stop the consumer
|
|
263
|
+
* Stop the consumer, flush remaining buffered events, and unsubscribe.
|
|
242
264
|
*/
|
|
243
265
|
stop(): Promise<void>;
|
|
244
266
|
/**
|
|
245
|
-
* Process
|
|
267
|
+
* Process a batch of events for the same resource.
|
|
268
|
+
* Partitions into consecutive same-type runs for batch optimization.
|
|
269
|
+
*/
|
|
270
|
+
private processBatch;
|
|
271
|
+
/**
|
|
272
|
+
* Batch-optimized processing for consecutive events of the same type.
|
|
273
|
+
* Uses batch graph methods where available, falls back to sequential.
|
|
274
|
+
*/
|
|
275
|
+
private applyBatchByType;
|
|
276
|
+
/**
|
|
277
|
+
* Build a ResourceDescriptor from a resource.created event.
|
|
278
|
+
* Extracted for reuse by both applyEventToGraph and applyBatchByType.
|
|
246
279
|
*/
|
|
247
|
-
|
|
280
|
+
private buildResourceDescriptor;
|
|
248
281
|
/**
|
|
249
|
-
* Apply event to GraphDB
|
|
282
|
+
* Apply a single event to GraphDB.
|
|
250
283
|
*/
|
|
251
284
|
protected applyEventToGraph(storedEvent: StoredEvent): Promise<void>;
|
|
252
285
|
/**
|
|
253
|
-
* Rebuild entire resource from events
|
|
254
|
-
*
|
|
286
|
+
* Rebuild entire resource from events.
|
|
287
|
+
* Bypasses the live pipeline — reads directly from event store.
|
|
255
288
|
*/
|
|
256
289
|
rebuildResource(resourceId: ResourceId): Promise<void>;
|
|
257
290
|
/**
|
|
258
|
-
* Rebuild entire GraphDB from all events
|
|
259
|
-
* Uses two-pass approach to ensure all resources exist before creating REFERENCES edges
|
|
291
|
+
* Rebuild entire GraphDB from all events.
|
|
292
|
+
* Uses two-pass approach to ensure all resources exist before creating REFERENCES edges.
|
|
293
|
+
* Bypasses the live pipeline — reads directly from event store.
|
|
260
294
|
*/
|
|
261
295
|
rebuildAll(): Promise<void>;
|
|
262
296
|
/**
|
|
263
|
-
* Get consumer health metrics
|
|
297
|
+
* Get consumer health metrics.
|
|
264
298
|
*/
|
|
265
299
|
getHealthMetrics(): {
|
|
266
300
|
subscriptions: number;
|
|
267
301
|
lastProcessed: Record<string, number>;
|
|
268
|
-
|
|
302
|
+
pipelineActive: boolean;
|
|
269
303
|
};
|
|
270
304
|
/**
|
|
271
|
-
* Shutdown consumer
|
|
305
|
+
* Shutdown consumer.
|
|
272
306
|
*/
|
|
273
307
|
shutdown(): Promise<void>;
|
|
274
308
|
}
|