@theholocron/posthog-client 1.58.0-alpha.1 → 1.58.0-alpha.10

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/dist/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
1
  import "@theholocron/http-client";
2
2
  import { ErrorSink, Logger } from "@theholocron/observability/core";
3
+ /** Options for `createPostHogClient`. */
3
4
  interface PostHogClientOptions {
5
+ /** PostHog API token, sent as a bearer token. */
4
6
  token: string;
5
7
  /**
6
8
  * PostHog host. Defaults to `https://app.posthog.com`.
@@ -16,27 +18,42 @@ interface PostHogClientOptions {
16
18
  /** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
17
19
  errors?: ErrorSink;
18
20
  }
21
+ /** The PostHog organization a user belongs to. */
19
22
  interface PostHogOrganization {
23
+ /** The organization id. */
20
24
  id: string;
25
+ /** The organization slug. */
21
26
  slug: string;
27
+ /** The organization name. */
22
28
  name: string;
23
29
  }
30
+ /** The user the PostHog token belongs to. */
24
31
  interface PostHogUser {
32
+ /** The user's email address. */
25
33
  email: string;
34
+ /** The organization the user is currently in. */
26
35
  organization: PostHogOrganization;
27
36
  }
37
+ /** A PostHog project. */
28
38
  interface PostHogProject {
39
+ /** The project id. */
29
40
  id: number;
41
+ /** The project name. */
30
42
  name: string;
31
43
  /** The client-side tracking token (`phc_*`). */
32
44
  api_token: string;
33
45
  }
46
+ /** The response of listing projects. */
34
47
  interface PostHogProjectsResponse {
48
+ /** The projects the token can access. */
35
49
  results: PostHogProject[];
36
50
  }
51
+ /** What to create a project with. */
37
52
  interface CreatePostHogProjectInput {
53
+ /** The name of the new project. */
38
54
  name: string;
39
55
  }
56
+ /** Creates a PostHog API client with `users` and `projects` groups, both sharing one REST client. */
40
57
  export declare function createPostHogClient(opts: PostHogClientOptions): {
41
58
  users: {
42
59
  me: () => Promise<PostHogUser>;
@@ -46,5 +63,6 @@ export declare function createPostHogClient(opts: PostHogClientOptions): {
46
63
  create: (input: CreatePostHogProjectInput) => Promise<PostHogProject>;
47
64
  };
48
65
  };
66
+ /** The client `createPostHogClient` returns. */
49
67
  export type PostHogClient = ReturnType<typeof createPostHogClient>;
50
68
  export type { CreatePostHogProjectInput, PostHogClientOptions, PostHogOrganization, PostHogProject, PostHogProjectsResponse, PostHogUser };
package/dist/index.mjs CHANGED
@@ -29,6 +29,7 @@ function createPostHogRestClient(opts) {
29
29
  });
30
30
  }
31
31
  // src/index.ts
32
+ /** Creates a PostHog API client with `users` and `projects` groups, both sharing one REST client. */
32
33
  function createPostHogClient(opts) {
33
34
  const rest = createPostHogRestClient(opts);
34
35
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/posthog-client",
3
- "version": "1.58.0-alpha.1",
3
+ "version": "1.58.0-alpha.10",
4
4
  "description": "A TypeScript client for the PostHog management API",
5
5
  "keywords": [
6
6
  "posthog",
@@ -32,23 +32,23 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/http-client": "^1.58.0-alpha.1",
36
- "@theholocron/observability": "^0.6.1-alpha.1"
35
+ "@theholocron/observability": "^0.7.0-alpha.1",
36
+ "@theholocron/http-client": "^1.58.0-alpha.10"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26",
40
40
  "@vitest/coverage-v8": "^5.0.5",
41
- "@vitest/eslint-plugin": "^1.6.27",
42
- "eslint": "^10.8.1",
43
- "eslint-plugin-n": "^18.3.0",
44
- "globals": "^17.11.0",
45
- "tsdown": "^0.23.3",
41
+ "@vitest/eslint-plugin": "^1.6.28",
42
+ "eslint": "^10.14.0",
43
+ "eslint-plugin-n": "^18.5.0",
44
+ "globals": "^17.14.0",
45
+ "tsdown": "^0.23.4",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^5.0.5",
48
- "@theholocron/tsconfig": "^8.9.0-alpha.3",
49
- "@theholocron/eslint-config": "^8.9.0-alpha.3",
50
- "@theholocron/tsdown-config": "^8.9.0-alpha.3",
51
- "@theholocron/vitest-config": "^8.9.0-alpha.3"
48
+ "@theholocron/tsconfig": "^8.9.0-alpha.8",
49
+ "@theholocron/eslint-config": "^8.9.0-alpha.8",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.8",
51
+ "@theholocron/tsdown-config": "^8.9.0-alpha.8"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22.0.0"
@@ -57,10 +57,10 @@
57
57
  "access": "public"
58
58
  },
59
59
  "scripts": {
60
- "delivery.build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
- "sourceQuality.staticAnalysis": "eslint .",
60
+ "build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
+ "lint:code": "eslint .",
62
+ "test:unit": "vitest run --coverage",
62
63
  "test:watch": "vitest",
63
- "verification.typeSafety": "tsc --noEmit",
64
- "verification.unitTests": "vitest run"
64
+ "typecheck": "tsc --noEmit"
65
65
  }
66
66
  }