client-py connected
This commit is contained in:
@@ -271,6 +271,53 @@ export class WorkspaceManager {
|
||||
return this.registry.getStoreNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize entire workspace state as JSON.
|
||||
*/
|
||||
serializeState(): string {
|
||||
const state: Record<string, unknown> = {};
|
||||
|
||||
for (const storeConfig of this.stores) {
|
||||
const storeState = this.registry.getState(storeConfig.name);
|
||||
if (storeState !== undefined) {
|
||||
state[storeConfig.name] = storeState;
|
||||
}
|
||||
}
|
||||
|
||||
return JSON.stringify(state, null, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the highest sequence number across all stores.
|
||||
*/
|
||||
getCurrentSeq(): number {
|
||||
let maxSeq = 0;
|
||||
for (const storeName of this.registry.getStoreNames()) {
|
||||
const seq = this.registry.getSeq(storeName);
|
||||
if (seq > maxSeq) {
|
||||
maxSeq = seq;
|
||||
}
|
||||
}
|
||||
return maxSeq;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all patches since a given sequence number across all stores.
|
||||
* Returns patches grouped by store name.
|
||||
*/
|
||||
getChangesSince(sinceSeq: number): Record<string, JsonPatchOp[]> {
|
||||
const changes: Record<string, JsonPatchOp[]> = {};
|
||||
|
||||
for (const storeConfig of this.stores) {
|
||||
const patches = this.registry.getPatchesSince(storeConfig.name, sinceSeq);
|
||||
if (patches && patches.length > 0) {
|
||||
changes[storeConfig.name] = patches;
|
||||
}
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Path Triggers
|
||||
// ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user