posthog-node 5.51.0 → 5.51.1

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.
@@ -1,4 +1,4 @@
1
- import { type FetchLike, type PostHogEventProperties } from '@posthog/core';
1
+ import { type FetchLike, type PostHogEventProperties, type PostHogFetchBodyBytes } from '@posthog/core';
2
2
  export interface V1CaptureSenderConfig {
3
3
  host: string;
4
4
  apiKey: string;
@@ -26,7 +26,7 @@ export interface V1CaptureSenderHooks {
26
26
  now?: () => number;
27
27
  sleep?: (ms: number) => Promise<void>;
28
28
  generateRequestId?: () => string;
29
- compress?: (payload: string, isDebug?: boolean) => Promise<Blob | null>;
29
+ compress?: (payload: string, isDebug?: boolean) => Promise<Blob | PostHogFetchBodyBytes | null>;
30
30
  }
31
31
  /**
32
32
  * Sends already-normalized events to the Capture V1 endpoint
@@ -1 +1 @@
1
- {"version":3,"file":"sender.d.ts","sourceRoot":"","sources":["../../src/capture-v1/sender.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,sBAAsB,EAO5B,MAAM,eAAe,CAAA;AAYtB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,wFAAwF;IACxF,kBAAkB,EAAE,OAAO,CAAA;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAA;IAC3B,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAA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,CAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAc;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsF;gBAEnG,MAAM,EAAE,qBAAqB,EAAE,KAAK,EAAE,oBAAoB;IAWhE,WAAW,CAAC,QAAQ,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YA+FtD,QAAQ;IAwEtB,OAAO,CAAC,YAAY;IAiBpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAkBhB,OAAO,CAAC,YAAY;IASpB,8FAA8F;IAC9F,OAAO,CAAC,eAAe;YAkBT,aAAa;YAab,cAAc;IAe5B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,mBAAmB;YAMb,UAAU;CAOzB"}
@@ -1,10 +1,11 @@
1
1
  export * from '../exports';
2
+ import type { PostHogFetchBodyBytes } from '@posthog/core';
2
3
  import { PostHogBackendClient } from '../client';
3
4
  import { ErrorTracking as CoreErrorTracking } from '@posthog/core';
4
5
  import { PostHogContext } from '../extensions/context/context';
5
6
  export declare class PostHog extends PostHogBackendClient {
6
7
  getLibraryId(): string;
7
- protected compressPayload(payload: string): Promise<Blob | null>;
8
+ protected compressPayload(payload: string): Promise<PostHogFetchBodyBytes | null>;
8
9
  protected initializeContext(): PostHogContext;
9
10
  protected createErrorPropertiesBuilder(): CoreErrorTracking.ErrorPropertiesBuilder;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAG9D,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C,YAAY,IAAI,MAAM;cAIH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAIzE,SAAS,CAAC,iBAAiB,IAAI,cAAc;cAI1B,4BAA4B,IAAI,iBAAiB,CAAC,sBAAsB;CAiB5F"}
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../../src/entrypoints/index.node.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAM1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAG9D,qBAAa,OAAQ,SAAQ,oBAAoB;IAC/C,YAAY,IAAI,MAAM;cAIH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAI1F,SAAS,CAAC,iBAAiB,IAAI,cAAc;cAI1B,4BAA4B,IAAI,iBAAiB,CAAC,sBAAsB;CAiB5F"}
@@ -1,2 +1,3 @@
1
- export declare function gzipCompress(input: string, isDebug?: boolean): Promise<Blob | null>;
1
+ import type { PostHogFetchBodyBytes } from '@posthog/core';
2
+ export declare function gzipCompress(input: string, isDebug?: boolean): Promise<PostHogFetchBodyBytes | null>;
2
3
  //# sourceMappingURL=gzip.node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gzip.node.d.ts","sourceRoot":"","sources":["../src/gzip.node.ts"],"names":[],"mappings":"AAKA,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAUtF"}
1
+ {"version":3,"file":"gzip.node.d.ts","sourceRoot":"","sources":["../src/gzip.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAM1D,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAUvG"}
package/dist/gzip.node.js CHANGED
@@ -32,9 +32,7 @@ const gzipAsync = (0, external_node_util_namespaceObject.promisify)(external_nod
32
32
  async function gzipCompress(input, isDebug = true) {
33
33
  try {
34
34
  const compressed = await gzipAsync(input);
35
- return new Blob([
36
- new Uint8Array(compressed)
37
- ]);
35
+ return new Uint8Array(compressed);
38
36
  } catch (error) {
39
37
  if (isDebug) console.error('Failed to gzip compress data', error);
40
38
  return null;
@@ -4,9 +4,7 @@ const gzipAsync = promisify(gzip);
4
4
  async function gzipCompress(input, isDebug = true) {
5
5
  try {
6
6
  const compressed = await gzipAsync(input);
7
- return new Blob([
8
- new Uint8Array(compressed)
9
- ]);
7
+ return new Uint8Array(compressed);
10
8
  } catch (error) {
11
9
  if (isDebug) console.error('Failed to gzip compress data', error);
12
10
  return null;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.51.0";
1
+ export declare const version = "5.51.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  version: ()=>version
28
28
  });
29
- const version = '5.51.0';
29
+ const version = '5.51.1';
30
30
  exports.version = __webpack_exports__.version;
31
31
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
32
  "version"
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = '5.51.0';
1
+ const version = '5.51.1';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.51.0",
3
+ "version": "5.51.1",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "module": "dist/entrypoints/index.node.mjs",
29
29
  "types": "dist/entrypoints/index.node.d.ts",
30
30
  "dependencies": {
31
- "@posthog/core": "^1.48.8"
31
+ "@posthog/core": "^1.48.9"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@edge-runtime/jest-environment": "^4.0.0",
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type FetchLike,
3
3
  type PostHogEventProperties,
4
+ type PostHogFetchBodyBytes,
4
5
  type PostHogFetchOptions,
5
6
  type PostHogFetchResponse,
6
7
  gzipCompress,
@@ -47,7 +48,7 @@ export interface V1CaptureSenderHooks {
47
48
  now?: () => number
48
49
  sleep?: (ms: number) => Promise<void>
49
50
  generateRequestId?: () => string
50
- compress?: (payload: string, isDebug?: boolean) => Promise<Blob | null>
51
+ compress?: (payload: string, isDebug?: boolean) => Promise<Blob | PostHogFetchBodyBytes | null>
51
52
  }
52
53
 
53
54
  interface V1CaptureAttempt {
@@ -77,7 +78,7 @@ export class V1CaptureSender {
77
78
  private readonly now: () => number
78
79
  private readonly sleep: (ms: number) => Promise<void>
79
80
  private readonly generateRequestId: () => string
80
- private readonly compress: (payload: string, isDebug?: boolean) => Promise<Blob | null>
81
+ private readonly compress: (payload: string, isDebug?: boolean) => Promise<Blob | PostHogFetchBodyBytes | null>
81
82
 
82
83
  constructor(config: V1CaptureSenderConfig, hooks: V1CaptureSenderHooks) {
83
84
  this.config = config
@@ -187,7 +188,7 @@ export class V1CaptureSender {
187
188
 
188
189
  private async sendOnce(url: string, payload: string, attempt: number, requestId: string): Promise<V1CaptureAttempt> {
189
190
  const headers = this.buildHeaders(attempt, requestId)
190
- let body: string | Blob = payload
191
+ let body: string | Blob | PostHogFetchBodyBytes = payload
191
192
  if (this.config.compressionEnabled) {
192
193
  const compressed = await this.compress(payload, this.config.isDebug)
193
194
  if (compressed !== null) {
@@ -4,6 +4,7 @@ import { createModulerModifier } from '../extensions/error-tracking/modifiers/mo
4
4
  import { addSourceContext } from '../extensions/error-tracking/modifiers/context-lines.node'
5
5
  import { createRelativePathModifier } from '../extensions/error-tracking/modifiers/relative-path.node'
6
6
 
7
+ import type { PostHogFetchBodyBytes } from '@posthog/core'
7
8
  import { PostHogBackendClient } from '../client'
8
9
  import { ErrorTracking as CoreErrorTracking } from '@posthog/core'
9
10
  import { PostHogContext } from '../extensions/context/context'
@@ -14,7 +15,7 @@ export class PostHog extends PostHogBackendClient {
14
15
  return 'posthog-node'
15
16
  }
16
17
 
17
- protected override compressPayload(payload: string): Promise<Blob | null> {
18
+ protected override compressPayload(payload: string): Promise<PostHogFetchBodyBytes | null> {
18
19
  return gzipCompress(payload, this.isDebug)
19
20
  }
20
21
 
package/src/gzip.node.ts CHANGED
@@ -1,12 +1,13 @@
1
+ import type { PostHogFetchBodyBytes } from '@posthog/core'
1
2
  import { gzip } from 'node:zlib'
2
3
  import { promisify } from 'node:util'
3
4
 
4
5
  const gzipAsync = promisify(gzip)
5
6
 
6
- export async function gzipCompress(input: string, isDebug = true): Promise<Blob | null> {
7
+ export async function gzipCompress(input: string, isDebug = true): Promise<PostHogFetchBodyBytes | null> {
7
8
  try {
8
9
  const compressed = await gzipAsync(input)
9
- return new Blob([new Uint8Array(compressed)])
10
+ return new Uint8Array(compressed)
10
11
  } catch (error) {
11
12
  if (isDebug) {
12
13
  console.error('Failed to gzip compress data', error)
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.51.0'
1
+ export const version = '5.51.1'