posthog-node 2.0.1 → 2.0.2
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 +9 -1
- package/index.ts +0 -3
- package/lib/index.cjs.js +32 -33
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.esm.js +32 -32
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-node/index.d.ts +0 -2
- package/lib/posthog-node/src/posthog-node.d.ts +1 -1
- package/package.json +2 -5
- package/src/posthog-node.ts +4 -4
- package/test/feature-flags.spec.ts +2 -2
- package/test/posthog-node.spec.ts +2 -2
|
@@ -7,7 +7,7 @@ export declare type PostHogOptions = PosthogCoreOptions & {
|
|
|
7
7
|
requestTimeout?: number;
|
|
8
8
|
maxCacheSize?: number;
|
|
9
9
|
};
|
|
10
|
-
export declare class
|
|
10
|
+
export declare class PostHog implements PostHogNodeV1 {
|
|
11
11
|
private _sharedClient;
|
|
12
12
|
private featureFlagsPoller?;
|
|
13
13
|
private maxCacheSize;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "PostHog Node.js integration",
|
|
5
5
|
"repository": "PostHog/posthog-node",
|
|
6
6
|
"scripts": {
|
|
@@ -30,8 +30,5 @@
|
|
|
30
30
|
"stats",
|
|
31
31
|
"analysis",
|
|
32
32
|
"funnels"
|
|
33
|
-
]
|
|
34
|
-
"bin": {
|
|
35
|
-
"posthog": "cli.js"
|
|
36
|
-
}
|
|
33
|
+
]
|
|
37
34
|
}
|
package/src/posthog-node.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type PostHogOptions = PosthogCoreOptions & {
|
|
|
25
25
|
const THIRTY_SECONDS = 30 * 1000
|
|
26
26
|
const MAX_CACHE_SIZE = 50 * 1000
|
|
27
27
|
|
|
28
|
-
class
|
|
28
|
+
class PostHogClient extends PostHogCore {
|
|
29
29
|
private _memoryStorage = new PostHogMemoryStorage()
|
|
30
30
|
|
|
31
31
|
constructor(apiKey: string, options: PostHogOptions = {}) {
|
|
@@ -65,15 +65,15 @@ class PostHog extends PostHogCore {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// The actual exported Nodejs API.
|
|
68
|
-
export class
|
|
69
|
-
private _sharedClient:
|
|
68
|
+
export class PostHog implements PostHogNodeV1 {
|
|
69
|
+
private _sharedClient: PostHogClient
|
|
70
70
|
private featureFlagsPoller?: FeatureFlagsPoller
|
|
71
71
|
private maxCacheSize: number
|
|
72
72
|
|
|
73
73
|
distinctIdHasSentFlagCalls: Record<string, string[]>
|
|
74
74
|
|
|
75
75
|
constructor(apiKey: string, options: PostHogOptions = {}) {
|
|
76
|
-
this._sharedClient = new
|
|
76
|
+
this._sharedClient = new PostHogClient(apiKey, options)
|
|
77
77
|
if (options.personalApiKey) {
|
|
78
78
|
this.featureFlagsPoller = new FeatureFlagsPoller({
|
|
79
79
|
pollingInterval:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// import PostHog from '../'
|
|
1
|
+
// import { PostHog } from '../'
|
|
2
2
|
// Uncomment below line while developing to not compile code everytime
|
|
3
|
-
import {
|
|
3
|
+
import { PostHog as PostHog } from '../src/posthog-node'
|
|
4
4
|
import { matchProperty, InconclusiveMatchError } from '../src/feature-flags'
|
|
5
5
|
jest.mock('undici')
|
|
6
6
|
import undici from 'undici'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// import PostHog from '../'
|
|
2
|
-
import {
|
|
1
|
+
// import { PostHog } from '../'
|
|
2
|
+
import { PostHog as PostHog } from '../src/posthog-node'
|
|
3
3
|
jest.mock('undici')
|
|
4
4
|
import undici from 'undici'
|
|
5
5
|
import { decideImplementation, localEvaluationImplementation } from './feature-flags.spec'
|