@juspay/neurolink 13.6.4 → 13.6.5

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.
@@ -137,7 +137,7 @@ export declare function recordsSpanContent(): boolean;
137
137
  */
138
138
  export declare function isFinishedAttribute(value: string): boolean;
139
139
  /**
140
- * @description Returns a copy of a value with credentials masked: values under keys such as `access_token`, `password`, `authorization` or `set-cookie`, the value of a `{ name, value }` or `{ key, value }` entry whose name is such a key, bearer tokens, and `name=value` credentials inside text and inside object keys. Purely numeric values after a credential-looking name (e.g. `max_tokens: 4096`) are left alone, and so is an entry whose name ends in `tokens`, `policy`, `type`, `algorithm`, `count` or `limit` (a setting, not a credential).
140
+ * @description Returns a copy of a value with credentials masked: values under keys such as `access_token`, `password`, `authorization` or `set-cookie`, bearer tokens, and `name=value` credentials inside text. Purely numeric values after a credential-looking name (e.g. `max_tokens: 4096`) are left alone.
141
141
  * @param value {JsonValue | object} - Content to redact; objects and arrays are walked recursively.
142
142
  * @returns {JsonValue | object} A redacted copy, serializing exactly as the input when nothing in it is sensitive.
143
143
  * @throws {Error} When the value cannot be walked; tracing callers use `spanContentAttribute`, which turns that into an omitted value.
@@ -227,29 +227,6 @@ function redactText(text) {
227
227
  });
228
228
  return redacted;
229
229
  }
230
- // A name that says how many, how long or what kind of thing rather than
231
- // holding the credential (`max_tokens`, `password_policy`, `credential_type`).
232
- const MEASUREMENT_ENTRY_NAME = /(?:^|_)tokens$|_(?:policy|type|algorithm|count|limit)$/;
233
- const NUMERIC_TEXT = /^\s*\d+(?:\.\d+)?\s*$/;
234
- function snakeCased(name) {
235
- return name
236
- .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
237
- .replace(/[\s.-]+/g, "_")
238
- .toLowerCase();
239
- }
240
- // Headers, environment variables and form fields are often lists of
241
- // `{ name, value }` or `{ key, value }` entries; when the name is a credential
242
- // the value is one, exactly as if it were stored under that key. A setting
243
- // that merely mentions a credential, or a purely numeric value, is not one.
244
- function credentialEntryName(node) {
245
- const name = "name" in node ? node.name : "key" in node ? node.key : undefined;
246
- if (typeof name !== "string" || !("value" in node) || !isSensitiveKey(name)) {
247
- return undefined;
248
- }
249
- const isSetting = MEASUREMENT_ENTRY_NAME.test(snakeCased(name)) ||
250
- (typeof node.value === "string" && NUMERIC_TEXT.test(node.value));
251
- return isSetting ? undefined : name;
252
- }
253
230
  function redactNode(value, ancestors) {
254
231
  if (typeof value === "string") {
255
232
  return redactText(describeDataUrls(value));
@@ -274,26 +251,17 @@ function redactNode(value, ancestors) {
274
251
  // No prototype, so a key named __proto__ is data rather than an assignment.
275
252
  const redacted = Object.create(null);
276
253
  const mimeType = declaredMimeType(value);
277
- const entryName = credentialEntryName(value);
278
254
  for (const [key, entry] of Object.entries(value)) {
279
- // A key can carry a credential too, such as a URL with an api_key
280
- // parameter used as a map key.
281
- const safeKey = redactText(key);
282
- const sensitiveName = key === "value" && entryName !== undefined
283
- ? entryName
284
- : isSensitiveKey(key)
285
- ? key
286
- : undefined;
287
- if (sensitiveName !== undefined &&
255
+ if (isSensitiveKey(key) &&
288
256
  (typeof entry === "string" ||
289
257
  (typeof entry === "object" && entry !== null))) {
290
- redacted[safeKey] = redactSensitiveEntry(sensitiveName, entry);
258
+ redacted[key] = redactSensitiveEntry(key, entry);
291
259
  continue;
292
260
  }
293
261
  const placeholder = isBinaryKey(key)
294
262
  ? binaryPlaceholder(entry, mimeType)
295
263
  : undefined;
296
- redacted[safeKey] = placeholder ?? redactNode(entry, ancestors);
264
+ redacted[key] = placeholder ?? redactNode(entry, ancestors);
297
265
  }
298
266
  return redacted;
299
267
  }
@@ -302,7 +270,7 @@ function redactNode(value, ancestors) {
302
270
  }
303
271
  }
304
272
  /**
305
- * @description Returns a copy of a value with credentials masked: values under keys such as `access_token`, `password`, `authorization` or `set-cookie`, the value of a `{ name, value }` or `{ key, value }` entry whose name is such a key, bearer tokens, and `name=value` credentials inside text and inside object keys. Purely numeric values after a credential-looking name (e.g. `max_tokens: 4096`) are left alone, and so is an entry whose name ends in `tokens`, `policy`, `type`, `algorithm`, `count` or `limit` (a setting, not a credential).
273
+ * @description Returns a copy of a value with credentials masked: values under keys such as `access_token`, `password`, `authorization` or `set-cookie`, bearer tokens, and `name=value` credentials inside text. Purely numeric values after a credential-looking name (e.g. `max_tokens: 4096`) are left alone.
306
274
  * @param value {JsonValue | object} - Content to redact; objects and arrays are walked recursively.
307
275
  * @returns {JsonValue | object} A redacted copy, serializing exactly as the input when nothing in it is sensitive.
308
276
  * @throws {Error} When the value cannot be walked; tracing callers use `spanContentAttribute`, which turns that into an omitted value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "13.6.4",
3
+ "version": "13.6.5",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002/call) for routing, tool selection and context budgeting. MCP-native (4 transports), voice TTS/STT/realtime, RAG, agents, memory, compaction, 9 observability exporters. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · TypeSafe Jev and more.",
6
6
  "author": {