Server-side scenario execution: thin effects client replaces local engine
- engine/ (DagWalker, sessions, IndexedDbPlanStore) deleted; server owns the graph - trigger/callback/counter carry PendingEffect; GET /sdk/v1/scenarios/pending polled (30s jittered heartbeat paused on hidden tab + wait-deadline timers) - client.effects public API unchanged (done/buy/dismiss/end/claim/battlepass/quest) - planStateStore removed; loginEvent kept; reconcile() makes server the source of truth - generated models regenerated; skills/README/CHANGELOG updated
This commit is contained in:
@@ -1,29 +1,3 @@
|
||||
import type { PlanStateStore } from '../../src/scenario/engine/IndexedDbPlanStore.js';
|
||||
|
||||
/**
|
||||
* In-memory PlanStateStore that survives across RudderClient instances — lets a
|
||||
* test simulate a page reload: drive scenario A on one client, construct a fresh
|
||||
* client sharing the same `backing`, call `scenarios.restore()`, and assert the
|
||||
* run resumed mid-DAG.
|
||||
*/
|
||||
export function createMemoryPlanStore(backing: { value: string | null } = { value: null }): PlanStateStore {
|
||||
return {
|
||||
get state() {
|
||||
return backing.value;
|
||||
},
|
||||
set state(v: string | null) {
|
||||
backing.value = v;
|
||||
},
|
||||
async load() {
|
||||
/* state already in `backing` */
|
||||
},
|
||||
async save(s: string | null) {
|
||||
backing.value = s;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** Deterministic, collision-free crypto.randomUUID() stub for scenario run IDs. */
|
||||
export function stubDeterministicUuid(): void {
|
||||
let n = 0;
|
||||
const existing = (globalThis as { crypto?: Crypto }).crypto ?? ({} as Crypto);
|
||||
|
||||
Reference in New Issue
Block a user