webspresso 0.0.109 → 0.0.111

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.
@@ -8,7 +8,7 @@
8
8
  * and lifecycle cleanup errors without logging raw form values or sensitive payloads.
9
9
  */
10
10
 
11
- const { NOOP_DEBUGGER } = require('./utils');
11
+ const { isArray, isNumber, NOOP_DEBUGGER, uid } = require('./utils');
12
12
 
13
13
  const SENSITIVE_KEY_PATTERN = /password|passwd|secret|token|authorization|cookie|credit|card|cvv|ssn|api[-_]?key/i;
14
14
 
@@ -32,7 +32,7 @@ function summarizePayloadSafely(payload, includeSafePrimitives = false) {
32
32
  if (typeof Blob !== 'undefined' && payload instanceof Blob) {
33
33
  return { type: 'Blob', size: payload.size, mimeType: payload.type || 'application/octet-stream' };
34
34
  }
35
- if (Array.isArray(payload)) {
35
+ if (isArray(payload)) {
36
36
  return { type: 'Array', length: payload.length };
37
37
  }
38
38
  if (typeof payload === 'object') {
@@ -58,7 +58,7 @@ function summarizePayloadSafely(payload, includeSafePrimitives = false) {
58
58
  */
59
59
  function createActiveDebugger(options = {}) {
60
60
  let enabled = Boolean(options.enabled);
61
- const maxEvents = typeof options.maxEvents === 'number' && options.maxEvents > 0 ? options.maxEvents : 200;
61
+ const maxEvents = isNumber(options.maxEvents) && options.maxEvents > 0 ? options.maxEvents : 200;
62
62
  const customLogger = typeof options.logger === 'function' ? options.logger : null;
63
63
 
64
64
  const events = [];
@@ -73,7 +73,7 @@ function createActiveDebugger(options = {}) {
73
73
 
74
74
  function pushEvent(type, detail = {}) {
75
75
  const entry = {
76
- id: `evt_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
76
+ id: uid('evt'),
77
77
  type,
78
78
  timestamp: Date.now(),
79
79
  ...detail,
@@ -192,7 +192,7 @@ function createActiveDebugger(options = {}) {
192
192
  completedAt: Date.now(),
193
193
  },
194
194
  invalidation: {
195
- tags: Array.isArray(tags) ? [...tags] : [],
195
+ tags: isArray(tags) ? [...tags] : [],
196
196
  triggeredAt: Date.now(),
197
197
  },
198
198
  refresh: null,
@@ -215,11 +215,11 @@ function createActiveDebugger(options = {}) {
215
215
  recordChainRefresh(chainId, { fragmentIds, status, loadMs, renderMs, totalServerMs, error }) {
216
216
  const chain = chainId ? causalChains.get(chainId) : null;
217
217
  const refreshData = {
218
- fragmentIds: Array.isArray(fragmentIds) ? [...fragmentIds] : [],
218
+ fragmentIds: isArray(fragmentIds) ? [...fragmentIds] : [],
219
219
  status: status || 'ok',
220
- loadMs: typeof loadMs === 'number' ? loadMs : null,
221
- renderMs: typeof renderMs === 'number' ? renderMs : null,
222
- totalServerMs: typeof totalServerMs === 'number' ? totalServerMs : null,
220
+ loadMs: isNumber(loadMs) ? loadMs : null,
221
+ renderMs: isNumber(renderMs) ? renderMs : null,
222
+ totalServerMs: isNumber(totalServerMs) ? totalServerMs : null,
223
223
  error: error ? String(error.message || error) : null,
224
224
  completedAt: Date.now(),
225
225
  };
@@ -234,9 +234,9 @@ function createActiveDebugger(options = {}) {
234
234
  const patchData = {
235
235
  instanceId,
236
236
  fragmentName: fragmentName || null,
237
- patchMs: typeof patchMs === 'number' ? patchMs : 0,
238
- loadMs: typeof loadMs === 'number' ? loadMs : null,
239
- renderMs: typeof renderMs === 'number' ? renderMs : null,
237
+ patchMs: isNumber(patchMs) ? patchMs : 0,
238
+ loadMs: isNumber(loadMs) ? loadMs : null,
239
+ renderMs: isNumber(renderMs) ? renderMs : null,
240
240
  completedAt: Date.now(),
241
241
  };
242
242
  if (chain) {