@theholocron/holocron-plugin-posthog 5.0.0-alpha.246 → 5.0.0-alpha.248
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 +10 -18
- package/dist/index.mjs +4 -8
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Analytics, AuthError, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
2
2
|
import { PostHogClient, PostHogClient as PostHogClient$1, PostHogClientOptions, PostHogProject, PostHogProjectsResponse, PostHogUser, createPostHogClient } from "@theholocron/posthog-client";
|
|
3
|
-
|
|
4
|
-
declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/capabilities/analytics.d.ts
|
|
3
|
+
export declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
7
4
|
interface PostHogAnalyticsOptions {
|
|
8
5
|
/** PostHog instance host — pushed as NEXT_PUBLIC_POSTHOG_HOST. Default: https://app.posthog.com */
|
|
9
6
|
host?: string;
|
|
10
7
|
}
|
|
11
|
-
declare class PostHogAnalytics implements Analytics {
|
|
8
|
+
export declare class PostHogAnalytics implements Analytics {
|
|
12
9
|
private readonly client;
|
|
13
10
|
private readonly opts;
|
|
14
11
|
readonly key: "analytics";
|
|
@@ -28,17 +25,13 @@ declare class PostHogAnalytics implements Analytics {
|
|
|
28
25
|
/** The host value to push as NEXT_PUBLIC_POSTHOG_HOST. */
|
|
29
26
|
get resolvedHost(): string;
|
|
30
27
|
}
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/verify-token.d.ts
|
|
33
28
|
interface VerifyTokenOptions {
|
|
34
29
|
host?: string;
|
|
35
30
|
baseUrl?: string;
|
|
36
31
|
fetch?: typeof fetch;
|
|
37
32
|
}
|
|
38
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
39
|
-
|
|
40
|
-
//#region src/index.d.ts
|
|
41
|
-
interface PostHogPluginOptions extends ResolveTokenInput, PostHogAnalyticsOptions {
|
|
33
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
34
|
+
export interface PostHogPluginOptions extends ResolveTokenInput, PostHogAnalyticsOptions {
|
|
42
35
|
/**
|
|
43
36
|
* PostHog instance host. Defaults to US cloud.
|
|
44
37
|
* EU cloud: "https://eu.posthog.com"
|
|
@@ -49,13 +42,13 @@ interface PostHogPluginOptions extends ResolveTokenInput, PostHogAnalyticsOption
|
|
|
49
42
|
baseUrl?: string;
|
|
50
43
|
fetch?: typeof fetch;
|
|
51
44
|
}
|
|
52
|
-
interface PluginContext {
|
|
45
|
+
export interface PluginContext {
|
|
53
46
|
options: PostHogPluginOptions;
|
|
54
47
|
client: () => PostHogClient$1;
|
|
55
48
|
}
|
|
56
|
-
declare function createContext(options?: PostHogPluginOptions): PluginContext;
|
|
57
|
-
declare function analytics(ctx: PluginContext): Analytics;
|
|
58
|
-
declare function createPlugin(options?: PostHogPluginOptions): {
|
|
49
|
+
export declare function createContext(options?: PostHogPluginOptions): PluginContext;
|
|
50
|
+
export declare function analytics(ctx: PluginContext): Analytics;
|
|
51
|
+
export declare function createPlugin(options?: PostHogPluginOptions): {
|
|
59
52
|
name: string;
|
|
60
53
|
probes: {
|
|
61
54
|
connection: import("@theholocron/cli").Probe;
|
|
@@ -64,6 +57,5 @@ declare function createPlugin(options?: PostHogPluginOptions): {
|
|
|
64
57
|
analytics: () => Analytics;
|
|
65
58
|
};
|
|
66
59
|
};
|
|
67
|
-
declare const AUTH_HINT: string;
|
|
68
|
-
|
|
69
|
-
export { AUTH_HINT, AuthError, PluginContext, PostHogAnalytics, type PostHogAnalyticsOptions, type PostHogClient, type PostHogClientOptions, PostHogPluginOptions, type PostHogProject, type PostHogProjectsResponse, type PostHogUser, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, analytics, createContext, createPlugin, createPostHogClient, resolveToken, verifyToken };
|
|
60
|
+
export declare const AUTH_HINT: string;
|
|
61
|
+
export { AuthError, type PostHogAnalyticsOptions, type PostHogClient, type PostHogClientOptions, type PostHogProject, type PostHogProjectsResponse, type PostHogUser, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createPostHogClient };
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { AuthError, connectionProbe, createResolveToken } from "@theholocron/cli";
|
|
2
2
|
import { createPostHogClient, createPostHogClient as createPostHogClient$1 } from "@theholocron/posthog-client";
|
|
3
3
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
|
-
|
|
4
|
+
// src/auth.ts
|
|
5
5
|
const resolveToken = createResolveToken({
|
|
6
6
|
envName: "HOLOCRON_POSTHOG_TOKEN",
|
|
7
7
|
vendorEnvName: "POSTHOG_PERSONAL_API_KEY",
|
|
8
8
|
keyringService: "posthog",
|
|
9
9
|
errorMessage: "no PostHog personal API key found. Pass --token <KEY>, set HOLOCRON_POSTHOG_TOKEN / POSTHOG_PERSONAL_API_KEY, or run: holocron auth set posthog <phx_KEY>"
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
//#region src/capabilities/analytics.ts
|
|
11
|
+
// src/capabilities/analytics.ts
|
|
13
12
|
var PostHogAnalytics = class {
|
|
14
13
|
client;
|
|
15
14
|
opts;
|
|
@@ -45,8 +44,7 @@ var PostHogAnalytics = class {
|
|
|
45
44
|
return this.opts.host ?? "https://app.posthog.com";
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
|
|
49
|
-
//#region src/verify-token.ts
|
|
47
|
+
// src/verify-token.ts
|
|
50
48
|
async function verifyToken(token, opts = {}) {
|
|
51
49
|
const client = createPostHogClient$1({
|
|
52
50
|
token,
|
|
@@ -67,8 +65,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
67
65
|
};
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
71
|
-
//#region src/index.ts
|
|
68
|
+
// src/index.ts
|
|
72
69
|
function createContext(options = {}) {
|
|
73
70
|
let client;
|
|
74
71
|
return {
|
|
@@ -103,5 +100,4 @@ function createPlugin(options = {}) {
|
|
|
103
100
|
};
|
|
104
101
|
}
|
|
105
102
|
const AUTH_HINT = "create a personal API key at https://app.posthog.com/settings/user/api-keys (not the project API key — that is the client-side phc_* tracking token), then run: holocron auth set posthog <phx_KEY>";
|
|
106
|
-
//#endregion
|
|
107
103
|
export { AUTH_HINT, AuthError, PostHogAnalytics, analytics, createContext, createPlugin, createPostHogClient, resolveToken, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-posthog",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.248",
|
|
4
4
|
"description": "Holocron plugin for PostHog. Implements the analytics capability — project provisioning and tracking token retrieval.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
"@theholocron/tsdown-config": "^8.8.2",
|
|
41
41
|
"@theholocron/vitest-config": "^8.8.2",
|
|
42
42
|
"@types/node": "^26",
|
|
43
|
-
"@vitest/coverage-v8": "^
|
|
43
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
44
44
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
45
45
|
"chalk": "^6.0.0",
|
|
46
46
|
"eslint": "^10.8.1",
|
|
47
47
|
"eslint-plugin-n": "^18.3.0",
|
|
48
48
|
"globals": "^17.11.0",
|
|
49
|
-
"tsdown": "^0.
|
|
49
|
+
"tsdown": "^0.23.3",
|
|
50
50
|
"tsx": "4.23.15",
|
|
51
51
|
"typescript": "^5.9.3",
|
|
52
|
-
"vitest": "^
|
|
53
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
52
|
+
"vitest": "^5.0.5",
|
|
53
|
+
"@theholocron/cli": "5.0.0-alpha.248"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@theholocron/misc-utils": "^1.16.0",
|
|
57
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
57
|
+
"@theholocron/cli": "5.0.0-alpha.248"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22"
|