Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename export for node to PostHog #16

Merged
merged 4 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions posthog-node/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostHogGlobal } from './src/posthog-node'
import { PostHog } from './src/posthog-node'
export * from './src/posthog-node'

export default PostHogGlobal
export default PostHog
8 changes: 4 additions & 4 deletions posthog-node/src/posthog-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type PostHogOptions = PosthogCoreOptions & {
const THIRTY_SECONDS = 30 * 1000
const MAX_CACHE_SIZE = 50 * 1000

class PostHog extends PostHogCore {
class PostHogClient extends PostHogCore {
private _memoryStorage = new PostHogMemoryStorage()

constructor(apiKey: string, options: PostHogOptions = {}) {
Expand Down Expand Up @@ -65,15 +65,15 @@ class PostHog extends PostHogCore {
}

// The actual exported Nodejs API.
export class PostHogGlobal implements PostHogNodeV1 {
private _sharedClient: PostHog
export class PostHog implements PostHogNodeV1 {
private _sharedClient: PostHogClient
private featureFlagsPoller?: FeatureFlagsPoller
private maxCacheSize: number

distinctIdHasSentFlagCalls: Record<string, string[]>

constructor(apiKey: string, options: PostHogOptions = {}) {
this._sharedClient = new PostHog(apiKey, options)
this._sharedClient = new PostHogClient(apiKey, options)
if (options.personalApiKey) {
this.featureFlagsPoller = new FeatureFlagsPoller({
pollingInterval:
Expand Down
2 changes: 1 addition & 1 deletion posthog-node/test/feature-flags.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import PostHog from '../'
// Uncomment below line while developing to not compile code everytime
import { PostHogGlobal as PostHog } from '../src/posthog-node'
import { PostHog as PostHog } from '../src/posthog-node'
import { matchProperty, InconclusiveMatchError } from '../src/feature-flags'
jest.mock('undici')
import undici from 'undici'
Expand Down
2 changes: 1 addition & 1 deletion posthog-node/test/posthog-node.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import PostHog from '../'
import { PostHogGlobal as PostHog } from '../src/posthog-node'
import { PostHog as PostHog } from '../src/posthog-node'
jest.mock('undici')
import undici from 'undici'
import { decideImplementation, localEvaluationImplementation } from './feature-flags.spec'
Expand Down