Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@posthog/core

Package Overview
Dependencies
Maintainers
22
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@posthog/core - npm Package Compare versions

Comparing version
1.32.1
to
1.32.2
+1
-3
dist/logs/index.d.ts

@@ -27,5 +27,3 @@ import { Logger } from '../types';

* - returning `null` drops the record (logged at info)
* - a thrown error is logged and the chain *continues* with the previous
* result — a buggy user filter must never crash the caller's
* `captureLog()` call
* - a thrown error is logged and the record is dropped
*/

@@ -32,0 +30,0 @@ private _runBeforeSend;

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAA4B,MAAM,UAAU,CAAA;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE,OAAO,KAAK,EAGV,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAEhB,qBAAa,WAAW;IAuBpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAMzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAhCzC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,gBAAgB,CAAQ;IAIhC,OAAO,CAAC,uBAAuB,CAAQ;IACvC,OAAO,CAAC,WAAW,CAAC,CAAmC;IAGvD,OAAO,CAAC,aAAa,CAA6B;IAMlD,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,mBAAmB,CAAC,CAAQ;IACpC,OAAO,CAAC,oBAAoB,CAAI;IAChC,OAAO,CAAC,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B,OAAO,CAAC,gBAAgB;CAMzB"}

@@ -80,2 +80,3 @@ "use strict";

this._logger.error("Error in beforeSend function for log:", e);
return null;
}

@@ -82,0 +83,0 @@ return result;

@@ -52,2 +52,3 @@ import { buildOtlpLogRecord, buildOtlpLogsPayload } from "./logs-utils.mjs";

this._logger.error("Error in beforeSend function for log:", e);
return null;
}

@@ -54,0 +55,0 @@ return result;

{
"name": "@posthog/core",
"version": "1.32.1",
"version": "1.32.2",
"license": "MIT",

@@ -70,3 +70,3 @@ "main": "dist/index.js",

"dependencies": {
"@posthog/types": "1.386.1"
"@posthog/types": "1.386.2"
},

@@ -73,0 +73,0 @@ "devDependencies": {

@@ -964,5 +964,4 @@ import { PostHogPersistedProperty } from '../types'

// Cases that share a "captureLog → assert queue body" shape. Bespoke
// assertions (logger expectations, throw-doesn't-crash, post-chain
// continuation after throw) live in their own `it` blocks below — those
// were warping the table when forced into it.
// assertions (logger expectations, throw-drops-the-record) live in their
// own `it` blocks below — those were warping the table when forced into it.
type Case = {

@@ -1034,6 +1033,3 @@ name: string

it('never crashes the caller when a fn throws — the chain continues with the prior result', () => {
// Bespoke: needs to verify (a) no throw escapes captureLog, (b) the
// chain continues with the previous result so a buggy filter degrades
// to a no-op, and (c) the failure is logged. Doesn't fit the table.
it('never crashes the caller when a fn throws — drops the record (fail closed) and logs', () => {
const thrower = jest.fn(() => {

@@ -1052,3 +1048,4 @@ throw new Error('bad filter')

expect(() => logs.captureLog({ body: 'hi' })).not.toThrow()
expect(readQueue(mockInstance)[0].record.body.stringValue).toBe('hi!')
expect(readQueue(mockInstance)).toHaveLength(0)
expect(after).not.toHaveBeenCalled()
expect(logger.error).toHaveBeenCalledWith(

@@ -1055,0 +1052,0 @@ expect.stringContaining('Error in beforeSend function for log:'),

@@ -95,5 +95,3 @@ import type { LogAttributeValue } from '@posthog/types'

* - returning `null` drops the record (logged at info)
* - a thrown error is logged and the chain *continues* with the previous
* result — a buggy user filter must never crash the caller's
* `captureLog()` call
* - a thrown error is logged and the record is dropped
*/

@@ -116,5 +114,4 @@ private _runBeforeSend(options: CaptureLogOptions): CaptureLogOptions | null {

} catch (e) {
// Swallow the throw — the chain continues with `result` unchanged so
// a buggy filter degrades to a no-op rather than crashing the app.
this._logger.error(`Error in beforeSend function for log:`, e)
return null
}

@@ -121,0 +118,0 @@ }