nucleus-core-ts 0.10.252 → 0.10.253
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/.build-ok
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.253
|
|
@@ -32,3 +32,11 @@ export declare const DEFAULT_READ_KEYS: readonly string[];
|
|
|
32
32
|
* replay has made that write; one recorded with a time only once the playhead has reached it.
|
|
33
33
|
*/
|
|
34
34
|
export declare function nextEntry(queue: Queue, payload: string | null, clock: Clock): Entry | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* How far ahead an answer for the SAME payload is served instead of another payload's answer already due. `at` is
|
|
37
|
+
* when an answer ARRIVED, so a call the page makes now was in flight in the recording too: ACE asked the skills list
|
|
38
|
+
* for scope "mine" (answered empty at 964 ms), then "public" (answered at 1357 ms). Handing the due "mine" answer to
|
|
39
|
+
* the "public" call told the replayed page the skill was missing, and a warning the recording never showed came up.
|
|
40
|
+
* The bound keeps a much later answer of that payload (a state the page reached later) out.
|
|
41
|
+
*/
|
|
42
|
+
export declare const IN_FLIGHT_MS = 60000;
|
|
@@ -24,13 +24,23 @@ function seen(entry, clock) {
|
|
|
24
24
|
*/ export function nextEntry(queue, payload, clock) {
|
|
25
25
|
const floor = queue.last?.at === undefined ? queue.last?.epoch ?? 0 : 0;
|
|
26
26
|
const ready = queue.entries.filter((entry)=>due(entry, clock, floor));
|
|
27
|
-
const fresh = latest(ready.filter((entry)=>entry.payload === payload)) ?? latest(ready);
|
|
27
|
+
const fresh = latest(ready.filter((entry)=>entry.payload === payload)) ?? inFlight(queue.entries, payload, clock) ?? latest(ready);
|
|
28
28
|
if (fresh) return fresh;
|
|
29
29
|
const past = queue.entries.filter((entry)=>seen(entry, clock));
|
|
30
30
|
return [
|
|
31
31
|
...past
|
|
32
32
|
].reverse().find((entry)=>entry.payload === payload) ?? queue.last ?? past.at(-1) ?? queue.entries.find((entry)=>entry.at === undefined) ?? earliestAhead(queue.entries, payload, clock);
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* How far ahead an answer for the SAME payload is served instead of another payload's answer already due. `at` is
|
|
36
|
+
* when an answer ARRIVED, so a call the page makes now was in flight in the recording too: ACE asked the skills list
|
|
37
|
+
* for scope "mine" (answered empty at 964 ms), then "public" (answered at 1357 ms). Handing the due "mine" answer to
|
|
38
|
+
* the "public" call told the replayed page the skill was missing, and a warning the recording never showed came up.
|
|
39
|
+
* The bound keeps a much later answer of that payload (a state the page reached later) out.
|
|
40
|
+
*/ export const IN_FLIGHT_MS = 60000;
|
|
41
|
+
function inFlight(entries, payload, clock) {
|
|
42
|
+
return entries.filter((entry)=>entry.payload === payload && entry.at !== undefined && entry.at > clock.playhead).filter((entry)=>(entry.at ?? 0) - clock.playhead <= IN_FLIGHT_MS && !(entry.write && entry.served)).sort((a, b)=>(a.at ?? 0) - (b.at ?? 0))[0];
|
|
43
|
+
}
|
|
34
44
|
/**
|
|
35
45
|
* A call made before the first recorded answer of its key: the recorded call was made before its answer arrived too
|
|
36
46
|
* (`at` is when the answer came), so a page that asks at load gets the first answer ahead, the one for the same payload
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.253",
|
|
4
4
|
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
5
|
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|