@mantajs/plugin-posthog-proxy 0.2.0-beta.0
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.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/posthog/api/[...path]/route.d.ts +6 -0
- package/dist/modules/posthog/api/[...path]/route.d.ts.map +1 -0
- package/dist/modules/posthog/api/[...path]/route.js +625 -0
- package/dist/modules/posthog/api/[...path]/route.js.map +1 -0
- package/dist/modules/posthog/commands/identify-user.d.ts +12 -0
- package/dist/modules/posthog/commands/identify-user.d.ts.map +1 -0
- package/dist/modules/posthog/commands/identify-user.js +31 -0
- package/dist/modules/posthog/commands/identify-user.js.map +1 -0
- package/dist/modules/posthog/commands/track-event.d.ts +15 -0
- package/dist/modules/posthog/commands/track-event.d.ts.map +1 -0
- package/dist/modules/posthog/commands/track-event.js +33 -0
- package/dist/modules/posthog/commands/track-event.js.map +1 -0
- package/dist/modules/posthog/entities/event/model.d.ts +3 -0
- package/dist/modules/posthog/entities/event/model.d.ts.map +1 -0
- package/dist/modules/posthog/entities/event/model.js +4 -0
- package/dist/modules/posthog/entities/event/model.js.map +1 -0
- package/dist/modules/posthog/entities/insight/model.d.ts +3 -0
- package/dist/modules/posthog/entities/insight/model.d.ts.map +1 -0
- package/dist/modules/posthog/entities/insight/model.js +4 -0
- package/dist/modules/posthog/entities/insight/model.js.map +1 -0
- package/dist/modules/posthog/entities/person/model.d.ts +3 -0
- package/dist/modules/posthog/entities/person/model.d.ts.map +1 -0
- package/dist/modules/posthog/entities/person/model.js +4 -0
- package/dist/modules/posthog/entities/person/model.js.map +1 -0
- package/dist/modules/posthog/queries/graph.d.ts +3 -0
- package/dist/modules/posthog/queries/graph.d.ts.map +1 -0
- package/dist/modules/posthog/queries/graph.js +23 -0
- package/dist/modules/posthog/queries/graph.js.map +1 -0
- package/dist/modules/posthog/queries/lib/execute.d.ts +26 -0
- package/dist/modules/posthog/queries/lib/execute.d.ts.map +1 -0
- package/dist/modules/posthog/queries/lib/execute.js +93 -0
- package/dist/modules/posthog/queries/lib/execute.js.map +1 -0
- package/dist/modules/posthog/queries/lib/schema.d.ts +13 -0
- package/dist/modules/posthog/queries/lib/schema.d.ts.map +1 -0
- package/dist/modules/posthog/queries/lib/schema.js +42 -0
- package/dist/modules/posthog/queries/lib/schema.js.map +1 -0
- package/dist/modules/posthog/queries/lib/translate.d.ts +15 -0
- package/dist/modules/posthog/queries/lib/translate.d.ts.map +1 -0
- package/dist/modules/posthog/queries/lib/translate.js +72 -0
- package/dist/modules/posthog/queries/lib/translate.js.map +1 -0
- package/dist/modules/posthog/schemas.d.ts +103 -0
- package/dist/modules/posthog/schemas.d.ts.map +1 -0
- package/dist/modules/posthog/schemas.js +42 -0
- package/dist/modules/posthog/schemas.js.map +1 -0
- package/package.json +37 -0
- package/src/index.ts +1 -0
- package/src/modules/posthog/api/[...path]/route.ts +672 -0
- package/src/modules/posthog/commands/identify-user.ts +32 -0
- package/src/modules/posthog/commands/track-event.ts +34 -0
- package/src/modules/posthog/entities/event/model.ts +4 -0
- package/src/modules/posthog/entities/insight/model.ts +4 -0
- package/src/modules/posthog/entities/person/model.ts +4 -0
- package/src/modules/posthog/queries/graph.ts +24 -0
- package/src/modules/posthog/queries/lib/execute.ts +111 -0
- package/src/modules/posthog/queries/lib/schema.ts +45 -0
- package/src/modules/posthog/queries/lib/translate.ts +73 -0
- package/src/modules/posthog/schemas.ts +48 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const postHogCaptureInputSchema: z.ZodObject<{
|
|
3
|
+
distinctId: z.ZodString;
|
|
4
|
+
event: z.ZodString;
|
|
5
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
timestamp: z.ZodOptional<z.ZodDate>;
|
|
7
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
distinctId: string;
|
|
10
|
+
event: string;
|
|
11
|
+
properties?: Record<string, unknown> | undefined;
|
|
12
|
+
timestamp?: Date | undefined;
|
|
13
|
+
uuid?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
distinctId: string;
|
|
16
|
+
event: string;
|
|
17
|
+
properties?: Record<string, unknown> | undefined;
|
|
18
|
+
timestamp?: Date | undefined;
|
|
19
|
+
uuid?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const postHogIdentifyInputSchema: z.ZodObject<{
|
|
22
|
+
distinctId: z.ZodString;
|
|
23
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
distinctId: string;
|
|
26
|
+
properties?: Record<string, unknown> | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
distinctId: string;
|
|
29
|
+
properties?: Record<string, unknown> | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const postHogEventSchema: z.ZodObject<{
|
|
32
|
+
uuid: z.ZodString;
|
|
33
|
+
event: z.ZodString;
|
|
34
|
+
distinctId: z.ZodString;
|
|
35
|
+
timestamp: z.ZodString;
|
|
36
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
37
|
+
personId: z.ZodNullable<z.ZodString>;
|
|
38
|
+
url: z.ZodNullable<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
distinctId: string;
|
|
41
|
+
event: string;
|
|
42
|
+
properties: Record<string, unknown>;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
uuid: string;
|
|
45
|
+
personId: string | null;
|
|
46
|
+
url: string | null;
|
|
47
|
+
}, {
|
|
48
|
+
distinctId: string;
|
|
49
|
+
event: string;
|
|
50
|
+
properties: Record<string, unknown>;
|
|
51
|
+
timestamp: string;
|
|
52
|
+
uuid: string;
|
|
53
|
+
personId: string | null;
|
|
54
|
+
url: string | null;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const postHogPersonSchema: z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
distinctId: z.ZodString;
|
|
59
|
+
email: z.ZodNullable<z.ZodString>;
|
|
60
|
+
name: z.ZodNullable<z.ZodString>;
|
|
61
|
+
createdAt: z.ZodString;
|
|
62
|
+
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
distinctId: string;
|
|
65
|
+
properties: Record<string, unknown>;
|
|
66
|
+
id: string;
|
|
67
|
+
email: string | null;
|
|
68
|
+
name: string | null;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
}, {
|
|
71
|
+
distinctId: string;
|
|
72
|
+
properties: Record<string, unknown>;
|
|
73
|
+
id: string;
|
|
74
|
+
email: string | null;
|
|
75
|
+
name: string | null;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const postHogInsightSchema: z.ZodObject<{
|
|
79
|
+
id: z.ZodNumber;
|
|
80
|
+
shortId: z.ZodNullable<z.ZodString>;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
description: z.ZodNullable<z.ZodString>;
|
|
83
|
+
filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
84
|
+
createdAt: z.ZodString;
|
|
85
|
+
updatedAt: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
id: number;
|
|
88
|
+
name: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
shortId: string | null;
|
|
91
|
+
description: string | null;
|
|
92
|
+
filters: Record<string, unknown>;
|
|
93
|
+
updatedAt: string | null;
|
|
94
|
+
}, {
|
|
95
|
+
id: number;
|
|
96
|
+
name: string;
|
|
97
|
+
createdAt: string;
|
|
98
|
+
shortId: string | null;
|
|
99
|
+
description: string | null;
|
|
100
|
+
filters: Record<string, unknown>;
|
|
101
|
+
updatedAt: string | null;
|
|
102
|
+
}>;
|
|
103
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/modules/posthog/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;EAMpC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;EAGrC,CAAA;AAMF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;EAO9B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;EAQ/B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Generated by ts-to-zod
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const postHogCaptureInputSchema = z.object({
|
|
4
|
+
distinctId: z.string(),
|
|
5
|
+
event: z.string(),
|
|
6
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
7
|
+
timestamp: z.date().optional(),
|
|
8
|
+
uuid: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const postHogIdentifyInputSchema = z.object({
|
|
11
|
+
distinctId: z.string(),
|
|
12
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
13
|
+
});
|
|
14
|
+
const _assertCaptureMatchesSdkSchema = z.any();
|
|
15
|
+
const _assertIdentifyMatchesSdkSchema = z.any();
|
|
16
|
+
export const postHogEventSchema = z.object({
|
|
17
|
+
uuid: z.string(),
|
|
18
|
+
event: z.string(),
|
|
19
|
+
distinctId: z.string(),
|
|
20
|
+
timestamp: z.string(),
|
|
21
|
+
properties: z.record(z.string(), z.unknown()),
|
|
22
|
+
personId: z.string().nullable(),
|
|
23
|
+
url: z.string().nullable(),
|
|
24
|
+
});
|
|
25
|
+
export const postHogPersonSchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
distinctId: z.string(),
|
|
28
|
+
email: z.string().nullable(),
|
|
29
|
+
name: z.string().nullable(),
|
|
30
|
+
createdAt: z.string(),
|
|
31
|
+
properties: z.record(z.string(), z.unknown()),
|
|
32
|
+
});
|
|
33
|
+
export const postHogInsightSchema = z.object({
|
|
34
|
+
id: z.number(),
|
|
35
|
+
shortId: z.string().nullable(),
|
|
36
|
+
name: z.string(),
|
|
37
|
+
description: z.string().nullable(),
|
|
38
|
+
filters: z.record(z.string(), z.unknown()),
|
|
39
|
+
createdAt: z.string(),
|
|
40
|
+
updatedAt: z.string().nullable(),
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/modules/posthog/schemas.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB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C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mantajs/plugin-posthog-proxy",
|
|
3
|
+
"version": "0.2.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "PostHog module for Manta — external entities, query-graph resolver via HogQL, capture/identify commands, and proxy route. 100% auto-discovered.",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
"./src/*": {
|
|
16
|
+
"types": "./dist/*",
|
|
17
|
+
"import": "./dist/*",
|
|
18
|
+
"default": "./dist/*"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"posthog-node": "5.35.0",
|
|
23
|
+
"zod": "^3.23.0",
|
|
24
|
+
"@mantajs/core": "0.2.0-beta.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"ts-to-zod": "^5.1.0",
|
|
28
|
+
"typescript": "^5.5.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"gen-schemas": "ts-to-zod scripts/posthog-types.ts src/modules/posthog/schemas.ts"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const pluginName = '@mantajs/plugin-posthog-proxy'
|