posthog-node 4.4.0 → 4.4.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.
- package/CHANGELOG.md +4 -0
- package/lib/index.cjs.js +5 -5
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/types.d.ts +1 -0
- package/lib/posthog-core/src/utils.d.ts +2 -0
- package/lib/posthog-node/src/fetch.d.ts +1 -2
- package/lib/posthog-node/src/posthog-node.d.ts +1 -0
- package/package.json +1 -1
- package/src/fetch.ts +3 -7
- package/src/posthog-node.ts +1 -0
|
@@ -130,3 +130,4 @@ export type PostHogFlagsAndPayloadsResponse = {
|
|
|
130
130
|
export type JsonType = string | number | boolean | null | {
|
|
131
131
|
[key: string]: JsonType;
|
|
132
132
|
} | Array<JsonType>;
|
|
133
|
+
export type FetchLike = (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FetchLike } from './types';
|
|
1
2
|
export declare function assert(truthyValue: any, message: string): void;
|
|
2
3
|
export declare function removeTrailingSlash(url: string): string;
|
|
3
4
|
export interface RetriableOptions {
|
|
@@ -10,3 +11,4 @@ export declare function currentTimestamp(): number;
|
|
|
10
11
|
export declare function currentISOTime(): string;
|
|
11
12
|
export declare function safeSetTimeout(fn: () => void, timeout: number): any;
|
|
12
13
|
export declare const isPromise: (obj: any) => obj is Promise<any>;
|
|
14
|
+
export declare function getFetch(): FetchLike | undefined;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* This is currently solved by using the global fetch if available instead.
|
|
7
7
|
* See https://github.com/PostHog/posthog-js-lite/issues/127 for more info
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
type FetchLike = (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>;
|
|
9
|
+
import { FetchLike } from 'posthog-core/src';
|
|
11
10
|
declare const _default: FetchLike;
|
|
12
11
|
export default _default;
|
|
@@ -3,6 +3,7 @@ import { EventMessage, GroupIdentifyMessage, IdentifyMessage, PostHogNodeV1 } fr
|
|
|
3
3
|
export type PostHogOptions = PostHogCoreOptions & {
|
|
4
4
|
persistence?: 'memory';
|
|
5
5
|
personalApiKey?: string;
|
|
6
|
+
privacyMode?: boolean;
|
|
6
7
|
featureFlagsPollingInterval?: number;
|
|
7
8
|
maxCacheSize?: number;
|
|
8
9
|
fetch?: (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>;
|
package/package.json
CHANGED
package/src/fetch.ts
CHANGED
|
@@ -7,14 +7,10 @@
|
|
|
7
7
|
* See https://github.com/PostHog/posthog-js-lite/issues/127 for more info
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { PostHogFetchOptions, PostHogFetchResponse } from 'posthog-core/src'
|
|
10
|
+
import { FetchLike, PostHogFetchOptions, PostHogFetchResponse } from 'posthog-core/src'
|
|
11
|
+
import { getFetch } from 'posthog-core/src/utils'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let _fetch: FetchLike | undefined =
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined
|
|
13
|
+
let _fetch: FetchLike | undefined = getFetch()
|
|
18
14
|
|
|
19
15
|
if (!_fetch) {
|
|
20
16
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
package/src/posthog-node.ts
CHANGED
|
@@ -18,6 +18,7 @@ import fetch from './fetch'
|
|
|
18
18
|
export type PostHogOptions = PostHogCoreOptions & {
|
|
19
19
|
persistence?: 'memory'
|
|
20
20
|
personalApiKey?: string
|
|
21
|
+
privacyMode?: boolean
|
|
21
22
|
// The interval in milliseconds between polls for refreshing feature flag definitions. Defaults to 30 seconds.
|
|
22
23
|
featureFlagsPollingInterval?: number
|
|
23
24
|
// Maximum size of cache that deduplicates $feature_flag_called calls per user.
|