nucleus-core-ts 0.10.240 → 0.10.242
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.242
|
|
@@ -29,5 +29,14 @@ function seen(entry, clock) {
|
|
|
29
29
|
const past = queue.entries.filter((entry)=>seen(entry, clock));
|
|
30
30
|
return [
|
|
31
31
|
...past
|
|
32
|
-
].reverse().find((entry)=>entry.payload === payload) ?? queue.last ?? past.at(-1) ?? queue.entries.find((entry)=>entry.at === undefined);
|
|
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
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A call made before the first recorded answer of its key: the recorded call was made before its answer arrived too
|
|
36
|
+
* (`at` is when the answer came), so a page that asks at load gets the first answer ahead, the one for the same payload
|
|
37
|
+
* when there is one. Without it the page's first `ME` at 0 ms found its answer recorded at 388 ms "not due" and
|
|
38
|
+
* the replayed app took itself for signed out. A write recorded after other writes still waits for them.
|
|
39
|
+
*/ function earliestAhead(entries, payload, clock) {
|
|
40
|
+
const ahead = entries.filter((entry)=>entry.at !== undefined && entry.at > clock.playhead && !(entry.write && entry.served)).sort((a, b)=>(a.at ?? 0) - (b.at ?? 0));
|
|
41
|
+
return ahead.find((entry)=>entry.payload === payload) ?? ahead[0];
|
|
33
42
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
];
|
|
9
9
|
const SECRET_NAME = /key|secret|token|password|passwd|credential|authorization/i;
|
|
10
10
|
const SECRET_VALUE = /^[A-Za-z0-9+/_=.-]{20,}$/;
|
|
11
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
12
|
const TEXT_RULES = [
|
|
12
13
|
[
|
|
13
14
|
'bearer',
|
|
@@ -109,7 +110,9 @@ function removeHits(text, where, name, options, findings) {
|
|
|
109
110
|
}
|
|
110
111
|
const hosts = options.internalHosts;
|
|
111
112
|
if (hosts) out = out.replace(new RegExp(hosts.source, hosts.flags.includes('g') ? hosts.flags : `${hosts.flags}g`), (found)=>hit('host', found));
|
|
112
|
-
|
|
113
|
+
// A UUID under a key-named field (`owner_key`, `credential_id`) is a record id, not a secret; the ids that name a
|
|
114
|
+
// person are mapped by the identity table before this point.
|
|
115
|
+
return SECRET_NAME.test(name) && SECRET_VALUE.test(out) && !UUID.test(out) ? hit('key', out) : out;
|
|
113
116
|
}
|
|
114
117
|
/** Maps identity entries, then removes every rule hit from one string; unmapped hits are reported. `name` is the key the string sits under. */ export function scrubText(text, where, name, options, findings) {
|
|
115
118
|
return mapIdentity(text, options.identity ?? {}, findings).map((segment)=>segment.mapped ? segment.text : removeHits(segment.text, where, name, options, findings)).join('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nucleus-core-ts",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.242",
|
|
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",
|