nucleus-core-ts 0.10.239 → 0.10.241

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.239
1
+ 0.10.241
@@ -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',
@@ -25,9 +26,10 @@ const TEXT_RULES = [
25
26
  'key',
26
27
  /(?<=(?:key|secret|token|password)["'\\]*\s*[:=]\s*["'\\]*)[A-Za-z0-9+/_=-]{20,}/gi
27
28
  ],
29
+ // The domain ends in letters: `nucleus-core-ts@0.10.236` is a package version, not an address.
28
30
  [
29
31
  'email',
30
- /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+/g
32
+ /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,63}(?![A-Za-z0-9-])/g
31
33
  ],
32
34
  [
33
35
  'ipv4',
@@ -108,7 +110,9 @@ function removeHits(text, where, name, options, findings) {
108
110
  }
109
111
  const hosts = options.internalHosts;
110
112
  if (hosts) out = out.replace(new RegExp(hosts.source, hosts.flags.includes('g') ? hosts.flags : `${hosts.flags}g`), (found)=>hit('host', found));
111
- return SECRET_NAME.test(name) && SECRET_VALUE.test(out) ? hit('key', out) : out;
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;
112
116
  }
113
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) {
114
118
  return mapIdentity(text, options.identity ?? {}, findings).map((segment)=>segment.mapped ? segment.text : removeHits(segment.text, where, name, options, findings)).join('');
@@ -12,6 +12,11 @@ export interface StepCaptureOptions {
12
12
  debounceMs?: number;
13
13
  /** Written in place of what was typed into a password field; the real value is never read. Default empty. */
14
14
  secretValue?: string;
15
+ /**
16
+ * An action this long after the previous one of the same step is preceded by a `waitUntil` at its own time, so a step
17
+ * that groups actions minutes apart replays them when they happened. Default 1500 ms.
18
+ */
19
+ holdMs?: number;
15
20
  }
16
21
  export interface StepCapture {
17
22
  start: () => void;
@@ -18,6 +18,8 @@ const KEYS = new Set([
18
18
  const { root, clock } = options;
19
19
  const attribute = options.targetAttribute ?? 'data-tour';
20
20
  const debounceMs = options.debounceMs ?? 400;
21
+ const holdMs = options.holdMs ?? 1500;
22
+ let lastAt = 0;
21
23
  const log = createUnanchoredLog(root, attribute);
22
24
  const list = [];
23
25
  let chapter = options.chapter ?? 'main';
@@ -28,18 +30,23 @@ const KEYS = new Set([
28
30
  if (target === null) return log.add(element);
29
31
  const action = build(target);
30
32
  if (action === null) return;
33
+ const at = clock.at();
31
34
  if (current === null) {
32
35
  current = {
33
36
  id: `step-${list.length + 1}`,
34
37
  chapter,
35
- at: clock.at(),
38
+ at,
36
39
  caption: {
37
40
  en: ''
38
41
  },
39
42
  actions: []
40
43
  };
41
44
  list.push(current);
42
- }
45
+ } else if (at - lastAt > holdMs) current.actions.push({
46
+ kind: 'waitUntil',
47
+ at
48
+ });
49
+ lastAt = at;
43
50
  current.actions.push(action);
44
51
  };
45
52
  const flush = ()=>{
@@ -108,8 +115,11 @@ const KEYS = new Set([
108
115
  const onKey = (event)=>{
109
116
  if (!(event instanceof KeyboardEvent) || !KEYS.has(event.key) || !(event.target instanceof Element)) return;
110
117
  const { target } = event;
111
- // Enter on a button or link is already its click; Enter inside a textarea is a line break.
112
- if (event.key === 'Enter' && target.closest('button, a[href], summary, textarea')) return;
118
+ // Enter on a button or link is already its click; Shift+Enter inside a textarea is a line break. A plain Enter in a
119
+ // textarea is kept: chat composers send on it, and flush() below writes the text typed so far first (the send
120
+ // clears the box before the typing debounce would have read it).
121
+ if (event.key === 'Enter' && target.closest('button, a[href], summary')) return;
122
+ if (event.key === 'Enter' && event.shiftKey && target.closest('textarea')) return;
113
123
  flush();
114
124
  add(target, (id)=>({
115
125
  kind: 'key',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.10.239",
3
+ "version": "0.10.241",
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",