posthog-node
Advanced tools
Comparing version 4.0.0-beta.2 to 4.0.0-beta.3
@@ -0,13 +1,17 @@ | ||
# 4.0.0-beta.3 - 2024-03-13 | ||
1. Sets `User-Agent` headers with SDK name and version for RN | ||
# 4.0.0-beta.2 - 2024-03-12 | ||
- `flushAsync` and `shutdownAsync` are removed with `flush` and `shutdown` now being the async methods. | ||
- Fixed an issue where `shutdown` would potentially exit early if a flush was already in progress | ||
- Flushes will now try to flush up to `maxBatchSize` (default 100) in one go | ||
1. `flushAsync` and `shutdownAsync` are removed with `flush` and `shutdown` now being the async methods. | ||
2. Fixed an issue where `shutdown` would potentially exit early if a flush was already in progress | ||
3. Flushes will now try to flush up to `maxBatchSize` (default 100) in one go | ||
# 4.0.0-beta.1 - 2024-03-04 | ||
- Adds a `disabled` option and the ability to change it later via `posthog.disabled = true`. Useful for disabling PostHog tracking for example in a testing environment without having complex conditional checking | ||
- Fixes some typos in types | ||
- `shutdown` and `shutdownAsync` takes a `shutdownTimeoutMs` param with a default of 30000 (30s). This is the time to wait for flushing events before shutting down the client. If the timeout is reached, the client will be shut down regardless of pending events. | ||
- Adds a new `featureFlagsRequestTimeoutMs` timeout parameter for feature flags which defaults to 3 seconds, updated from the default 10s for all other API calls. | ||
1. Adds a `disabled` option and the ability to change it later via `posthog.disabled = true`. Useful for disabling PostHog tracking for example in a testing environment without having complex conditional checking | ||
2. Fixes some typos in types | ||
3. `shutdown` and `shutdownAsync` takes a `shutdownTimeoutMs` param with a default of 30000 (30s). This is the time to wait for flushing events before shutting down the client. If the timeout is reached, the client will be shut down regardless of pending events. | ||
4. Adds a new `featureFlagsRequestTimeoutMs` timeout parameter for feature flags which defaults to 3 seconds, updated from the default 10s for all other API calls. | ||
@@ -14,0 +18,0 @@ # 3.6.3 - 2024-02-15 |
@@ -198,2 +198,5 @@ /// <reference types="node" /> | ||
flush(): Promise<any[]>; | ||
protected getCustomHeaders(): { | ||
[key: string]: string; | ||
}; | ||
private _flush; | ||
@@ -200,0 +203,0 @@ private fetchWithRetry; |
@@ -81,2 +81,5 @@ import { PostHogFetchOptions, PostHogFetchResponse, PostHogAutocaptureElement, PostHogDecideResponse, PostHogCoreOptions, PostHogEventProperties, PostHogPersistedProperty, PostHogCaptureOptions, JsonType } from './types'; | ||
flush(): Promise<any[]>; | ||
protected getCustomHeaders(): { | ||
[key: string]: string; | ||
}; | ||
private _flush; | ||
@@ -83,0 +86,0 @@ private fetchWithRetry; |
@@ -18,2 +18,5 @@ /// <reference types="node" /> | ||
onError?: (error: Error) => void; | ||
customHeaders?: { | ||
[key: string]: string; | ||
}; | ||
}; | ||
@@ -35,3 +38,6 @@ declare class FeatureFlagsPoller { | ||
onError?: (error: Error) => void; | ||
constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, ...options }: FeatureFlagsPollerOptions); | ||
customHeaders?: { | ||
[key: string]: string; | ||
}; | ||
constructor({ pollingInterval, personalApiKey, projectApiKey, timeout, host, customHeaders, ...options }: FeatureFlagsPollerOptions); | ||
debug(enabled?: boolean): void; | ||
@@ -38,0 +44,0 @@ getFeatureFlag(key: string, distinctId: string, groups?: Record<string, string>, personProperties?: Record<string, string>, groupProperties?: Record<string, Record<string, string>>): Promise<string | boolean | undefined>; |
{ | ||
"name": "posthog-node", | ||
"version": "4.0.0-beta.2", | ||
"version": "4.0.0-beta.3", | ||
"description": "PostHog Node.js integration", | ||
@@ -5,0 +5,0 @@ "repository": { |
import { createHash } from 'rusha' | ||
import { FeatureFlagCondition, FlagProperty, PostHogFeatureFlag, PropertyGroup } from './types' | ||
import { version } from '../package.json' | ||
import { JsonType, PostHogFetchOptions, PostHogFetchResponse } from 'posthog-core/src' | ||
@@ -41,2 +40,3 @@ import { safeSetTimeout } from 'posthog-core/src/utils' | ||
onError?: (error: Error) => void | ||
customHeaders?: { [key: string]: string } | ||
} | ||
@@ -59,2 +59,3 @@ | ||
onError?: (error: Error) => void | ||
customHeaders?: { [key: string]: string } | ||
@@ -67,2 +68,3 @@ constructor({ | ||
host, | ||
customHeaders, | ||
...options | ||
@@ -84,2 +86,3 @@ }: FeatureFlagsPollerOptions) { | ||
this.onError = options.onError | ||
this.customHeaders = customHeaders | ||
@@ -420,5 +423,5 @@ void this.loadFeatureFlags() | ||
headers: { | ||
...this.customHeaders, | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${this.personalApiKey}`, | ||
'user-agent': `posthog-node/${version}`, | ||
}, | ||
@@ -425,0 +428,0 @@ } |
@@ -61,2 +61,3 @@ import { version } from '../package.json' | ||
}, | ||
customHeaders: this.getCustomHeaders(), | ||
}) | ||
@@ -87,3 +88,3 @@ } | ||
getCustomUserAgent(): string { | ||
return `posthog-node/${version}` | ||
return `${this.getLibraryId()}/${this.getLibraryVersion()}` | ||
} | ||
@@ -90,0 +91,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
871234
12808