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:
+10
-10
@@ -148,7 +148,7 @@ describe('lazy scenario runtime', () => {
|
||||
const client = new RudderClient({
|
||||
baseUrl: 'https://api.example.com',
|
||||
projectKey: 'proj_123',
|
||||
runtime: { planStateStore: null, loginEvent: null },
|
||||
runtime: { loginEvent: null },
|
||||
});
|
||||
const internals = client as unknown as {
|
||||
scenarioRuntime: unknown;
|
||||
@@ -163,7 +163,7 @@ describe('lazy scenario runtime', () => {
|
||||
const client = new RudderClient({
|
||||
baseUrl: 'https://api.example.com',
|
||||
projectKey: 'proj_123',
|
||||
runtime: { planStateStore: null }, // default loginEvent: player_login
|
||||
runtime: {},
|
||||
});
|
||||
|
||||
const notifications: string[] = [];
|
||||
@@ -182,18 +182,18 @@ describe('lazy scenario runtime', () => {
|
||||
}
|
||||
if (path === '/sdk/v1/scenarios/trigger') {
|
||||
return Promise.resolve(new Response(JSON.stringify({
|
||||
plans: [{
|
||||
planId: 'plan-1',
|
||||
scenarioId: 'scenario-1',
|
||||
userId: 'user-1',
|
||||
startNodeId: 'start',
|
||||
effects: [{
|
||||
runId: 'run-1',
|
||||
nodes: [{ id: 'start', type: 'notification', data: { message: 'Welcome!' } }],
|
||||
edges: [],
|
||||
boundaryNodes: [],
|
||||
scenarioId: 'scenario-1',
|
||||
nodeId: 'start',
|
||||
type: 'notification',
|
||||
data: { message: 'Welcome!' },
|
||||
}],
|
||||
}), { status: 200 }));
|
||||
}
|
||||
if (path === '/sdk/v1/scenarios/pending') {
|
||||
return Promise.resolve(new Response(JSON.stringify({ effects: [] }), { status: 200 }));
|
||||
}
|
||||
if (path === '/sdk/v1/remote-configs') {
|
||||
return Promise.resolve(new Response(JSON.stringify({ configs: {} }), { status: 200 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user