@dudousxd/nestjs-durable-dashboard 0.17.0 → 0.17.1
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/client/merge-live-events.d.ts +15 -0
- package/dist/client/merge-live-events.d.ts.map +1 -0
- package/dist/client/merge-live-events.js +30 -0
- package/dist/client/merge-live-events.js.map +1 -0
- package/dist/spa/assets/{index-4cBbLKJA.js → index-CNxNpvxn.js} +5 -5
- package/dist/spa/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RunDetail } from './durable-client';
|
|
2
|
+
/**
|
|
3
|
+
* Merge a freshly-fetched run with the previously-cached one, preserving the live event trail the SSE
|
|
4
|
+
* stream accumulated for in-flight steps.
|
|
5
|
+
*
|
|
6
|
+
* The store only persists a step's `events` at COMPLETION, so a poll/refetch returns a still-running
|
|
7
|
+
* step with empty `events`. The live-tail (`step.progress`) appends events into the cache as they
|
|
8
|
+
* arrive; replacing the cache wholesale on every 1.5s refetch would wipe that streamed trail — it
|
|
9
|
+
* then reappears on the next stream event, so sub-processes flicker (appear → vanish → reappear).
|
|
10
|
+
*
|
|
11
|
+
* Rule: a step still `pending`/`running` with no fetched events keeps the streamed copy; a
|
|
12
|
+
* `completed`/`failed` step is authoritative and always uses the fetched events (even if empty).
|
|
13
|
+
*/
|
|
14
|
+
export declare function mergeLiveEvents(prev: RunDetail | undefined, fresh: RunDetail): RunDetail;
|
|
15
|
+
//# sourceMappingURL=merge-live-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-live-events.d.ts","sourceRoot":"","sources":["../../src/client/merge-live-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAcxF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge a freshly-fetched run with the previously-cached one, preserving the live event trail the SSE
|
|
3
|
+
* stream accumulated for in-flight steps.
|
|
4
|
+
*
|
|
5
|
+
* The store only persists a step's `events` at COMPLETION, so a poll/refetch returns a still-running
|
|
6
|
+
* step with empty `events`. The live-tail (`step.progress`) appends events into the cache as they
|
|
7
|
+
* arrive; replacing the cache wholesale on every 1.5s refetch would wipe that streamed trail — it
|
|
8
|
+
* then reappears on the next stream event, so sub-processes flicker (appear → vanish → reappear).
|
|
9
|
+
*
|
|
10
|
+
* Rule: a step still `pending`/`running` with no fetched events keeps the streamed copy; a
|
|
11
|
+
* `completed`/`failed` step is authoritative and always uses the fetched events (even if empty).
|
|
12
|
+
*/
|
|
13
|
+
export function mergeLiveEvents(prev, fresh) {
|
|
14
|
+
if (!prev)
|
|
15
|
+
return fresh;
|
|
16
|
+
const prevBySeq = new Map(prev.timeline.map((step) => [step.seq, step]));
|
|
17
|
+
return {
|
|
18
|
+
...fresh,
|
|
19
|
+
timeline: fresh.timeline.map((step) => {
|
|
20
|
+
const inFlight = step.status === 'pending' || step.status === 'running';
|
|
21
|
+
if (inFlight && (step.events?.length ?? 0) === 0) {
|
|
22
|
+
const streamed = prevBySeq.get(step.seq)?.events;
|
|
23
|
+
if (streamed?.length)
|
|
24
|
+
return { ...step, events: streamed };
|
|
25
|
+
}
|
|
26
|
+
return step;
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=merge-live-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-live-events.js","sourceRoot":"","sources":["../../src/client/merge-live-events.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,IAA2B,EAAE,KAAgB;IAC3E,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO;QACL,GAAG,KAAK;QACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC;YACxE,IAAI,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;gBACjD,IAAI,QAAQ,EAAE,MAAM;oBAAE,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YAC7D,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|