@semiont/event-sourcing 0.5.4 → 0.5.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.
- package/dist/index.d.ts +645 -20
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- package/dist/event-log.d.ts +0 -51
- package/dist/event-log.d.ts.map +0 -1
- package/dist/event-store-factory.d.ts +0 -19
- package/dist/event-store-factory.d.ts.map +0 -1
- package/dist/event-store.d.ts +0 -40
- package/dist/event-store.d.ts.map +0 -1
- package/dist/identifier-utils.d.ts +0 -10
- package/dist/identifier-utils.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/query/event-query.d.ts +0 -48
- package/dist/query/event-query.d.ts.map +0 -1
- package/dist/storage/event-storage.d.ts +0 -111
- package/dist/storage/event-storage.d.ts.map +0 -1
- package/dist/storage/shard-utils.d.ts +0 -56
- package/dist/storage/shard-utils.d.ts.map +0 -1
- package/dist/storage/storage-uri-index.d.ts +0 -60
- package/dist/storage/storage-uri-index.d.ts.map +0 -1
- package/dist/storage/view-storage.d.ts +0 -33
- package/dist/storage/view-storage.d.ts.map +0 -1
- package/dist/view-manager.d.ts +0 -84
- package/dist/view-manager.d.ts.map +0 -1
- package/dist/views/projection-reducers.d.ts +0 -73
- package/dist/views/projection-reducers.d.ts.map +0 -1
- package/dist/views/view-materializer.d.ts +0 -92
- package/dist/views/view-materializer.d.ts.map +0 -1
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* View Materializer - Materialized View Management
|
|
3
|
-
*
|
|
4
|
-
* Materializes resource views from events:
|
|
5
|
-
* - Full view materialization from scratch
|
|
6
|
-
* - Incremental view updates
|
|
7
|
-
* - System-level views (entity types)
|
|
8
|
-
*
|
|
9
|
-
* @see docs/EVENT-STORE.md#viewmaterializer for architecture details
|
|
10
|
-
*/
|
|
11
|
-
import type { PersistedEvent, StoredEvent, ResourceId, Logger } from '@semiont/core';
|
|
12
|
-
import type { ViewStorage, ResourceView } from '../storage/view-storage';
|
|
13
|
-
/**
|
|
14
|
-
* Minimal structural type for the event log dependency of `rebuildAll`.
|
|
15
|
-
* Avoids importing the concrete EventLog class from a sibling directory and
|
|
16
|
-
* keeps the materializer independent of the event-log implementation.
|
|
17
|
-
*/
|
|
18
|
-
export interface RebuildEventSource {
|
|
19
|
-
getEvents(resourceId: ResourceId): Promise<StoredEvent[]>;
|
|
20
|
-
getAllResourceIds(): Promise<ResourceId[]>;
|
|
21
|
-
}
|
|
22
|
-
export interface ViewMaterializerConfig {
|
|
23
|
-
basePath: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* ViewMaterializer builds and maintains materialized views from events
|
|
27
|
-
*/
|
|
28
|
-
export declare class ViewMaterializer {
|
|
29
|
-
private viewStorage;
|
|
30
|
-
private config;
|
|
31
|
-
private logger?;
|
|
32
|
-
constructor(viewStorage: ViewStorage, config: ViewMaterializerConfig, logger?: Logger);
|
|
33
|
-
/**
|
|
34
|
-
* Materialize resource view from events
|
|
35
|
-
* Loads existing view if cached, otherwise rebuilds from events
|
|
36
|
-
*/
|
|
37
|
-
materialize(events: StoredEvent[], resourceId: ResourceId): Promise<ResourceView | null>;
|
|
38
|
-
/**
|
|
39
|
-
* Materialize view incrementally with a single event
|
|
40
|
-
* Falls back to full rebuild if view doesn't exist
|
|
41
|
-
*/
|
|
42
|
-
materializeIncremental(resourceId: ResourceId, event: PersistedEvent, getAllEvents: () => Promise<StoredEvent[]>): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Update the storage-uri index in response to an event.
|
|
45
|
-
*
|
|
46
|
-
* Only yield:created (with storageUri), yield:moved, need index changes.
|
|
47
|
-
* resource.archived / resource.unarchived do NOT modify the index.
|
|
48
|
-
*/
|
|
49
|
-
private materializeStorageUriIndex;
|
|
50
|
-
/**
|
|
51
|
-
* Materialize view from event list (full rebuild)
|
|
52
|
-
*/
|
|
53
|
-
private materializeFromEvents;
|
|
54
|
-
/**
|
|
55
|
-
* Apply an event to ResourceDescriptor state (metadata only)
|
|
56
|
-
*/
|
|
57
|
-
private applyEventToResource;
|
|
58
|
-
/**
|
|
59
|
-
* Apply an event to ResourceAnnotations (annotation collections only)
|
|
60
|
-
*/
|
|
61
|
-
private applyEventToAnnotations;
|
|
62
|
-
/**
|
|
63
|
-
* Walk every event stream in the event log and materialize the corresponding
|
|
64
|
-
* view from scratch. Idempotent: existing view files are overwritten.
|
|
65
|
-
*
|
|
66
|
-
* Mirrors GraphDBConsumer.rebuildAll() and Smelter.rebuildAll() — this is the
|
|
67
|
-
* recovery path that makes the ephemeral stateDir safe to wipe. The live
|
|
68
|
-
* append path (EventStore.appendEvent → materializeIncremental /
|
|
69
|
-
* materializeEntityTypes / materializeTagSchemas) is unchanged and runs in
|
|
70
|
-
* addition.
|
|
71
|
-
*/
|
|
72
|
-
rebuildAll(eventLog: RebuildEventSource): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Materialize entity types view — System-level view.
|
|
75
|
-
*
|
|
76
|
-
* I/O shell around the pure {@link applyEntityTypeAdded} reducer:
|
|
77
|
-
* read JSON file → reduce → write JSON file. The reducer owns the
|
|
78
|
-
* dedup + sort semantics; the shell owns the disk I/O.
|
|
79
|
-
*/
|
|
80
|
-
materializeEntityTypes(entityType: string): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Materialize tag schemas view — System-level view.
|
|
83
|
-
*
|
|
84
|
-
* I/O shell around the pure {@link applyTagSchemaAdded} reducer.
|
|
85
|
-
* The reducer owns the most-recent-wins semantics + the
|
|
86
|
-
* differing-content-overwrite-warning; the shell forwards the
|
|
87
|
-
* warning (when present) to this materializer's logger and writes
|
|
88
|
-
* the resulting state to disk.
|
|
89
|
-
*/
|
|
90
|
-
materializeTagSchemas(schema: import('@semiont/core').TagSchema): Promise<void>;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=view-materializer.d.ts.map
|
|
@@ -1 +0,0 @@
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