@contractspec/example.integration-posthog 1.57.0 → 1.59.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/.turbo/turbo-build.log +34 -33
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +25 -0
- package/dist/browser/docs/index.js +50 -0
- package/dist/browser/docs/integration-posthog.docblock.js +50 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/index.js +358 -0
- package/dist/browser/posthog.js +276 -0
- package/dist/browser/run.js +280 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +51 -1
- package/dist/docs/integration-posthog.docblock.d.ts +2 -1
- package/dist/docs/integration-posthog.docblock.d.ts.map +1 -0
- package/dist/docs/integration-posthog.docblock.js +25 -29
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +32 -43
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +358 -4
- package/dist/node/docs/index.js +50 -0
- package/dist/node/docs/integration-posthog.docblock.js +50 -0
- package/dist/node/example.js +33 -0
- package/dist/node/index.js +358 -0
- package/dist/node/posthog.js +276 -0
- package/dist/node/run.js +280 -0
- package/dist/posthog.d.ts +13 -17
- package/dist/posthog.d.ts.map +1 -1
- package/dist/posthog.js +241 -188
- package/dist/run.d.ts +2 -1
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +277 -8
- package/package.json +69 -26
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -33
- package/dist/docs/integration-posthog.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/posthog.js.map +0 -1
- package/dist/run.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/dist/run.js
CHANGED
|
@@ -1,12 +1,281 @@
|
|
|
1
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/posthog.ts
|
|
3
|
+
import { PosthogAnalyticsProvider } from "@contractspec/integration.providers-impls/impls/posthog";
|
|
4
|
+
async function runPosthogExampleFromEnv() {
|
|
5
|
+
const mode = resolvePosthogMode();
|
|
6
|
+
const dryRun = resolveBooleanEnv("CONTRACTSPEC_POSTHOG_DRY_RUN", true);
|
|
7
|
+
const allowWrites = resolveBooleanEnv("CONTRACTSPEC_POSTHOG_ALLOW_WRITES", false);
|
|
8
|
+
const output = { mode, dryRun, allowWrites };
|
|
9
|
+
if (dryRun) {
|
|
10
|
+
if (mode === "capture" || mode === "all") {
|
|
11
|
+
output.capture = buildCapturePreview();
|
|
12
|
+
}
|
|
13
|
+
if (mode === "query" || mode === "all") {
|
|
14
|
+
output.query = { query: buildHogQLQuery() };
|
|
15
|
+
}
|
|
16
|
+
if (mode === "request" || mode === "all") {
|
|
17
|
+
output.request = buildRequestPreview();
|
|
18
|
+
}
|
|
19
|
+
if (mode === "read" || mode === "all") {
|
|
20
|
+
output.read = buildReadPreview();
|
|
21
|
+
}
|
|
22
|
+
if (process.env.POSTHOG_MCP_URL) {
|
|
23
|
+
output.mcp = buildMcpPreview();
|
|
24
|
+
}
|
|
25
|
+
return output;
|
|
26
|
+
}
|
|
27
|
+
const provider = createProviderFromEnv();
|
|
28
|
+
if (mode === "capture" || mode === "all") {
|
|
29
|
+
output.capture = await runCapture(provider, allowWrites);
|
|
30
|
+
}
|
|
31
|
+
if (mode === "query" || mode === "all") {
|
|
32
|
+
output.query = await runHogQLQuery(provider);
|
|
33
|
+
}
|
|
34
|
+
if (mode === "request" || mode === "all") {
|
|
35
|
+
output.request = await runApiRequests(provider, allowWrites);
|
|
36
|
+
}
|
|
37
|
+
if (mode === "read" || mode === "all") {
|
|
38
|
+
output.read = await runReadOperations(provider);
|
|
39
|
+
}
|
|
40
|
+
if (process.env.POSTHOG_MCP_URL) {
|
|
41
|
+
output.mcp = await runMcpToolCall(provider);
|
|
42
|
+
}
|
|
43
|
+
return output;
|
|
44
|
+
}
|
|
45
|
+
function resolvePosthogMode() {
|
|
46
|
+
const raw = (process.env.CONTRACTSPEC_POSTHOG_MODE ?? "all").toLowerCase();
|
|
47
|
+
if (raw === "capture" || raw === "query" || raw === "request" || raw === "read" || raw === "all") {
|
|
48
|
+
return raw;
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`Unsupported CONTRACTSPEC_POSTHOG_MODE: ${raw}. Use capture, query, request, read, or all.`);
|
|
51
|
+
}
|
|
52
|
+
function createProviderFromEnv() {
|
|
53
|
+
return new PosthogAnalyticsProvider({
|
|
54
|
+
host: process.env.POSTHOG_HOST,
|
|
55
|
+
projectId: process.env.POSTHOG_PROJECT_ID,
|
|
56
|
+
projectApiKey: process.env.POSTHOG_PROJECT_API_KEY,
|
|
57
|
+
personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,
|
|
58
|
+
mcpUrl: process.env.POSTHOG_MCP_URL,
|
|
59
|
+
requestTimeoutMs: 1e4
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async function runCapture(provider, allowWrites) {
|
|
63
|
+
if (!allowWrites) {
|
|
64
|
+
return {
|
|
65
|
+
skipped: true,
|
|
66
|
+
reason: "Set CONTRACTSPEC_POSTHOG_ALLOW_WRITES=true to enable capture."
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const event = buildCaptureEvent();
|
|
70
|
+
if (provider.identify) {
|
|
71
|
+
await provider.identify({
|
|
72
|
+
distinctId: event.distinctId,
|
|
73
|
+
properties: { plan: "pro", source: "contractspec-example" }
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
await provider.capture(event);
|
|
77
|
+
return { captured: true, event };
|
|
78
|
+
}
|
|
79
|
+
async function runHogQLQuery(provider) {
|
|
80
|
+
if (!provider.queryHogQL) {
|
|
81
|
+
throw new Error("Analytics provider does not support HogQL queries.");
|
|
82
|
+
}
|
|
83
|
+
const query = buildHogQLQuery();
|
|
84
|
+
return provider.queryHogQL({ query });
|
|
85
|
+
}
|
|
86
|
+
async function runApiRequests(provider, allowWrites) {
|
|
87
|
+
const projectId = requireEnv("POSTHOG_PROJECT_ID");
|
|
88
|
+
const listRequest = {
|
|
89
|
+
method: "GET",
|
|
90
|
+
path: `/api/projects/${projectId}/feature_flags/`,
|
|
91
|
+
query: { limit: 5 }
|
|
92
|
+
};
|
|
93
|
+
const listResponse = await provider.request(listRequest);
|
|
94
|
+
const output = {
|
|
95
|
+
list: listResponse.data
|
|
96
|
+
};
|
|
97
|
+
if (!allowWrites) {
|
|
98
|
+
output.writeGuard = "Set CONTRACTSPEC_POSTHOG_ALLOW_WRITES=true to create/delete feature flags.";
|
|
99
|
+
return output;
|
|
100
|
+
}
|
|
101
|
+
const flagKey = `contractspec-example-${Date.now()}`;
|
|
102
|
+
const createResponse = await provider.request({
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: `/api/projects/${projectId}/feature_flags/`,
|
|
105
|
+
body: {
|
|
106
|
+
name: "ContractSpec Example Flag",
|
|
107
|
+
key: flagKey,
|
|
108
|
+
active: true,
|
|
109
|
+
filters: {
|
|
110
|
+
groups: [
|
|
111
|
+
{
|
|
112
|
+
properties: [],
|
|
113
|
+
rollout_percentage: 100
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
output.created = createResponse.data;
|
|
120
|
+
const createdId = extractId(createResponse);
|
|
121
|
+
if (createdId) {
|
|
122
|
+
const deleteResponse = await provider.request({
|
|
123
|
+
method: "DELETE",
|
|
124
|
+
path: `/api/projects/${projectId}/feature_flags/${createdId}`
|
|
125
|
+
});
|
|
126
|
+
output.deleted = deleteResponse.status;
|
|
127
|
+
} else {
|
|
128
|
+
output.deleted = "Skipped delete: response did not include an id.";
|
|
129
|
+
}
|
|
130
|
+
return output;
|
|
131
|
+
}
|
|
132
|
+
async function runReadOperations(provider) {
|
|
133
|
+
const now = new Date;
|
|
134
|
+
const from = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
|
135
|
+
const dateRange = { from, to: now };
|
|
136
|
+
const output = {
|
|
137
|
+
window: { from: from.toISOString(), to: now.toISOString() }
|
|
138
|
+
};
|
|
139
|
+
if (provider.getEvents) {
|
|
140
|
+
output.events = await provider.getEvents({ dateRange, limit: 5 });
|
|
141
|
+
} else {
|
|
142
|
+
output.events = "Provider does not support getEvents.";
|
|
143
|
+
}
|
|
144
|
+
if (provider.getPersons) {
|
|
145
|
+
output.persons = await provider.getPersons({ limit: 5 });
|
|
146
|
+
} else {
|
|
147
|
+
output.persons = "Provider does not support getPersons.";
|
|
148
|
+
}
|
|
149
|
+
if (provider.getInsights) {
|
|
150
|
+
output.insights = await provider.getInsights({ limit: 5 });
|
|
151
|
+
} else {
|
|
152
|
+
output.insights = "Provider does not support getInsights.";
|
|
153
|
+
}
|
|
154
|
+
if (provider.getFeatureFlags) {
|
|
155
|
+
output.featureFlags = await provider.getFeatureFlags({ limit: 5 });
|
|
156
|
+
} else {
|
|
157
|
+
output.featureFlags = "Provider does not support getFeatureFlags.";
|
|
158
|
+
}
|
|
159
|
+
return output;
|
|
160
|
+
}
|
|
161
|
+
async function runMcpToolCall(provider) {
|
|
162
|
+
if (!provider.callMcpTool) {
|
|
163
|
+
throw new Error("Analytics provider does not support MCP tool calls.");
|
|
164
|
+
}
|
|
165
|
+
const name = process.env.POSTHOG_MCP_TOOL_NAME ?? "posthog.query";
|
|
166
|
+
const argumentsValue = parseOptionalJsonEnv("POSTHOG_MCP_TOOL_ARGS", {
|
|
167
|
+
query: buildHogQLQuery()
|
|
168
|
+
});
|
|
169
|
+
return provider.callMcpTool({ name, arguments: argumentsValue });
|
|
170
|
+
}
|
|
171
|
+
function buildCaptureEvent() {
|
|
172
|
+
const distinctId = process.env.POSTHOG_DISTINCT_ID ?? "contractspec-demo";
|
|
173
|
+
const event = process.env.POSTHOG_EVENT_NAME ?? "contractspec.example.event";
|
|
174
|
+
return {
|
|
175
|
+
distinctId,
|
|
176
|
+
event,
|
|
177
|
+
properties: {
|
|
178
|
+
source: "contractspec-example",
|
|
179
|
+
environment: "development"
|
|
180
|
+
},
|
|
181
|
+
timestamp: new Date
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function buildHogQLQuery() {
|
|
185
|
+
return "select event, count() as count " + "from events " + "where timestamp >= now() - interval 1 day " + "group by event " + "order by count desc " + "limit 5";
|
|
186
|
+
}
|
|
187
|
+
function buildCapturePreview() {
|
|
188
|
+
return {
|
|
189
|
+
event: buildCaptureEvent(),
|
|
190
|
+
hint: "Dry run enabled. Set CONTRACTSPEC_POSTHOG_DRY_RUN=false."
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function buildRequestPreview() {
|
|
194
|
+
const projectId = process.env.POSTHOG_PROJECT_ID ?? "PROJECT_ID";
|
|
195
|
+
return {
|
|
196
|
+
listRequest: {
|
|
197
|
+
method: "GET",
|
|
198
|
+
path: `/api/projects/${projectId}/feature_flags/`,
|
|
199
|
+
query: { limit: 5 }
|
|
200
|
+
},
|
|
201
|
+
writeRequests: {
|
|
202
|
+
create: {
|
|
203
|
+
method: "POST",
|
|
204
|
+
path: `/api/projects/${projectId}/feature_flags/`
|
|
205
|
+
},
|
|
206
|
+
delete: {
|
|
207
|
+
method: "DELETE",
|
|
208
|
+
path: `/api/projects/${projectId}/feature_flags/{id}`
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function buildReadPreview() {
|
|
214
|
+
return {
|
|
215
|
+
events: {
|
|
216
|
+
dateRange: "last_24_hours",
|
|
217
|
+
limit: 5
|
|
218
|
+
},
|
|
219
|
+
persons: {
|
|
220
|
+
limit: 5
|
|
221
|
+
},
|
|
222
|
+
insights: {
|
|
223
|
+
limit: 5
|
|
224
|
+
},
|
|
225
|
+
featureFlags: {
|
|
226
|
+
limit: 5
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function buildMcpPreview() {
|
|
231
|
+
return {
|
|
232
|
+
url: process.env.POSTHOG_MCP_URL,
|
|
233
|
+
toolName: process.env.POSTHOG_MCP_TOOL_NAME ?? "posthog.query",
|
|
234
|
+
arguments: parseOptionalJsonEnv("POSTHOG_MCP_TOOL_ARGS", {
|
|
235
|
+
query: buildHogQLQuery()
|
|
236
|
+
})
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function extractId(response) {
|
|
240
|
+
if (!response || typeof response !== "object")
|
|
241
|
+
return null;
|
|
242
|
+
const data = response.data;
|
|
243
|
+
if (data && (typeof data.id === "string" || typeof data.id === "number")) {
|
|
244
|
+
return data.id;
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
function resolveBooleanEnv(key, defaultValue) {
|
|
249
|
+
const value = process.env[key];
|
|
250
|
+
if (value === undefined)
|
|
251
|
+
return defaultValue;
|
|
252
|
+
return value.toLowerCase() === "true";
|
|
253
|
+
}
|
|
254
|
+
function requireEnv(key) {
|
|
255
|
+
const value = process.env[key];
|
|
256
|
+
if (!value) {
|
|
257
|
+
throw new Error(`Missing required env var: ${key}`);
|
|
258
|
+
}
|
|
259
|
+
return value;
|
|
260
|
+
}
|
|
261
|
+
function parseOptionalJsonEnv(key, fallback) {
|
|
262
|
+
const raw = process.env[key];
|
|
263
|
+
if (!raw)
|
|
264
|
+
return fallback;
|
|
265
|
+
try {
|
|
266
|
+
const parsed = JSON.parse(raw);
|
|
267
|
+
if (parsed && typeof parsed === "object")
|
|
268
|
+
return parsed;
|
|
269
|
+
} catch {
|
|
270
|
+
throw new Error(`Invalid JSON in ${key}`);
|
|
271
|
+
}
|
|
272
|
+
return fallback;
|
|
273
|
+
}
|
|
2
274
|
|
|
3
|
-
|
|
275
|
+
// src/run.ts
|
|
4
276
|
runPosthogExampleFromEnv().then((result) => {
|
|
5
|
-
|
|
277
|
+
console.log(JSON.stringify(result, null, 2));
|
|
6
278
|
}).catch((error) => {
|
|
7
|
-
|
|
8
|
-
|
|
279
|
+
console.error(error);
|
|
280
|
+
process.exitCode = 1;
|
|
9
281
|
});
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
//# sourceMappingURL=run.js.map
|
package/package.json
CHANGED
|
@@ -1,51 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.integration-posthog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"description": "PostHog analytics integration example: capture events, run HogQL, and manage feature flags.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./
|
|
9
|
-
"./docs": "./
|
|
10
|
-
"./docs/
|
|
11
|
-
"./
|
|
12
|
-
"./
|
|
13
|
-
"./
|
|
14
|
-
"
|
|
8
|
+
".": "./src/index.ts",
|
|
9
|
+
"./docs": "./src/docs/index.ts",
|
|
10
|
+
"./docs/index": "./src/docs/index.ts",
|
|
11
|
+
"./docs/integration-posthog.docblock": "./src/docs/integration-posthog.docblock.ts",
|
|
12
|
+
"./example": "./src/example.ts",
|
|
13
|
+
"./posthog": "./src/posthog.ts",
|
|
14
|
+
"./run": "./src/run.ts"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
18
18
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
19
|
-
"build": "bun build:
|
|
20
|
-
"build:bundle": "
|
|
21
|
-
"build:types": "
|
|
22
|
-
"dev": "bun
|
|
19
|
+
"build": "bun run prebuild && bun run build:bundle && bun run build:types",
|
|
20
|
+
"build:bundle": "contractspec-bun-build transpile",
|
|
21
|
+
"build:types": "contractspec-bun-build types",
|
|
22
|
+
"dev": "contractspec-bun-build dev",
|
|
23
23
|
"clean": "rimraf dist .turbo",
|
|
24
24
|
"lint": "bun lint:fix",
|
|
25
25
|
"lint:fix": "eslint src --fix",
|
|
26
26
|
"lint:check": "eslint src",
|
|
27
|
-
"test": "bun test"
|
|
27
|
+
"test": "bun test",
|
|
28
|
+
"prebuild": "contractspec-bun-build prebuild",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@contractspec/integration.providers-impls": "1.
|
|
31
|
-
"@contractspec/lib.contracts": "1.
|
|
32
|
+
"@contractspec/integration.providers-impls": "1.59.0",
|
|
33
|
+
"@contractspec/lib.contracts": "1.59.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@contractspec/tool.
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"typescript": "^5.9.3"
|
|
36
|
+
"@contractspec/tool.typescript": "1.59.0",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"@contractspec/tool.bun": "1.58.0"
|
|
38
39
|
},
|
|
39
40
|
"publishConfig": {
|
|
40
41
|
"access": "public",
|
|
41
42
|
"exports": {
|
|
42
|
-
".":
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"bun": "./dist/index.js",
|
|
46
|
+
"node": "./dist/node/index.mjs",
|
|
47
|
+
"browser": "./dist/browser/index.js",
|
|
48
|
+
"default": "./dist/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./docs": {
|
|
51
|
+
"types": "./dist/docs/index.d.ts",
|
|
52
|
+
"bun": "./dist/docs/index.js",
|
|
53
|
+
"node": "./dist/node/docs/index.mjs",
|
|
54
|
+
"browser": "./dist/browser/docs/index.js",
|
|
55
|
+
"default": "./dist/docs/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./docs/index": {
|
|
58
|
+
"types": "./dist/docs/index.d.ts",
|
|
59
|
+
"bun": "./dist/docs/index.js",
|
|
60
|
+
"node": "./dist/node/docs/index.mjs",
|
|
61
|
+
"browser": "./dist/browser/docs/index.js",
|
|
62
|
+
"default": "./dist/docs/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./docs/integration-posthog.docblock": {
|
|
65
|
+
"types": "./dist/docs/integration-posthog.docblock.d.ts",
|
|
66
|
+
"bun": "./dist/docs/integration-posthog.docblock.js",
|
|
67
|
+
"node": "./dist/node/docs/integration-posthog.docblock.mjs",
|
|
68
|
+
"browser": "./dist/browser/docs/integration-posthog.docblock.js",
|
|
69
|
+
"default": "./dist/docs/integration-posthog.docblock.js"
|
|
70
|
+
},
|
|
71
|
+
"./example": {
|
|
72
|
+
"types": "./dist/example.d.ts",
|
|
73
|
+
"bun": "./dist/example.js",
|
|
74
|
+
"node": "./dist/node/example.mjs",
|
|
75
|
+
"browser": "./dist/browser/example.js",
|
|
76
|
+
"default": "./dist/example.js"
|
|
77
|
+
},
|
|
78
|
+
"./posthog": {
|
|
79
|
+
"types": "./dist/posthog.d.ts",
|
|
80
|
+
"bun": "./dist/posthog.js",
|
|
81
|
+
"node": "./dist/node/posthog.mjs",
|
|
82
|
+
"browser": "./dist/browser/posthog.js",
|
|
83
|
+
"default": "./dist/posthog.js"
|
|
84
|
+
},
|
|
85
|
+
"./run": {
|
|
86
|
+
"types": "./dist/run.d.ts",
|
|
87
|
+
"bun": "./dist/run.js",
|
|
88
|
+
"node": "./dist/node/run.mjs",
|
|
89
|
+
"browser": "./dist/browser/run.js",
|
|
90
|
+
"default": "./dist/run.js"
|
|
91
|
+
}
|
|
49
92
|
},
|
|
50
93
|
"registry": "https://registry.npmjs.org/"
|
|
51
94
|
},
|
package/tsdown.config.js
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
$ tsdown
|
|
2
|
-
[34mℹ[39m tsdown [2mv0.20.3[22m powered by rolldown [2mv1.0.0-rc.3[22m
|
|
3
|
-
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/integration-posthog/tsdown.config.js[24m
|
|
4
|
-
[34mℹ[39m entry: [34msrc/example.ts, src/index.ts, src/posthog.ts, src/run.ts, src/docs/index.ts, src/docs/integration-posthog.docblock.ts[39m
|
|
5
|
-
[34mℹ[39m target: [34mesnext[39m
|
|
6
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
7
|
-
[34mℹ[39m Build start
|
|
8
|
-
[34mℹ[39m Cleaning 19 files
|
|
9
|
-
[34mℹ[39m [2mdist/[22m[1mposthog.js[22m [2m 7.59 kB[22m [2m│ gzip: 2.32 kB[22m
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/integration-posthog.docblock.js[22m [2m 1.97 kB[22m [2m│ gzip: 0.94 kB[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m 0.99 kB[22m [2m│ gzip: 0.52 kB[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[1mrun.js[22m [2m 0.29 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m 0.20 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
14
|
-
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m 0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
15
|
-
[34mℹ[39m [2mdist/[22mposthog.js.map [2m14.43 kB[22m [2m│ gzip: 4.14 kB[22m
|
|
16
|
-
[34mℹ[39m [2mdist/[22mdocs/integration-posthog.docblock.js.map [2m 2.50 kB[22m [2m│ gzip: 1.13 kB[22m
|
|
17
|
-
[34mℹ[39m [2mdist/[22mexample.js.map [2m 1.46 kB[22m [2m│ gzip: 0.71 kB[22m
|
|
18
|
-
[34mℹ[39m [2mdist/[22mrun.js.map [2m 0.49 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22mposthog.d.ts.map [2m 0.33 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
20
|
-
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m 0.13 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22m[32m[1mposthog.d.ts[22m[39m [2m 0.74 kB[22m [2m│ gzip: 0.36 kB[22m
|
|
22
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 0.26 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
23
|
-
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m 0.25 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
24
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
25
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdocs/integration-posthog.docblock.d.ts[22m[39m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
26
|
-
[34mℹ[39m [2mdist/[22m[32m[1mrun.d.ts[22m[39m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
27
|
-
[34mℹ[39m 18 files, total: 31.72 kB
|
|
28
|
-
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugins. Here is a breakdown:
|
|
29
|
-
- rolldown-plugin-dts:generate (56%)
|
|
30
|
-
- tsdown:external (42%)
|
|
31
|
-
See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
32
|
-
|
|
33
|
-
[32m✔[39m Build complete in [32m19320ms[39m
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integration-posthog.docblock.js","names":[],"sources":["../../src/docs/integration-posthog.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.integration-posthog',\n title: 'Integration Example — PostHog Analytics',\n summary:\n 'Capture events, run HogQL, and manage feature flags using the PostHog analytics provider.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/integration-posthog',\n tags: ['posthog', 'analytics', 'hogql', 'example'],\n body: `## What this example shows\n- Capture product events and identify users.\n- Run HogQL queries through the analytics provider.\n- Perform generic REST API requests (feature flag list/create/delete).\n- Read events, persons, insights, and feature flags using typed reader methods.\n- Optionally call a PostHog MCP tool via JSON-RPC.\n\n## Guardrails\n- Use dry-run while validating credentials.\n- Writes are gated behind CONTRACTSPEC_POSTHOG_ALLOW_WRITES.\n- Keep API keys in secret storage.`,\n },\n {\n id: 'docs.examples.integration-posthog.usage',\n title: 'PostHog Integration Example — Usage',\n summary: 'How to run the PostHog example with env-driven settings.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/integration-posthog/usage',\n tags: ['posthog', 'usage'],\n body: `## Usage\n- Set CONTRACTSPEC_POSTHOG_MODE to capture | query | request | read | all.\n- Set CONTRACTSPEC_POSTHOG_DRY_RUN=true for a safe preview.\n- Set CONTRACTSPEC_POSTHOG_ALLOW_WRITES=true to enable capture and create/delete.\n\n## Required env vars\n- POSTHOG_PROJECT_ID for queries and REST requests.\n- POSTHOG_PROJECT_API_KEY for capture/identify.\n- POSTHOG_PERSONAL_API_KEY for HogQL queries and REST requests.\n\n## MCP\n- Set POSTHOG_MCP_URL to call tools/call.\n- Optionally set POSTHOG_MCP_TOOL_NAME and POSTHOG_MCP_TOOL_ARGS (JSON).\n\n## Example\n- Call runPosthogExampleFromEnv() from run.ts to execute the flow.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AAoDA,kBAjD2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAW;EAAa;EAAS;EAAU;CAClD,MAAM;;;;;;;;;;;CAWP,EACD;CACE,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM,CAAC,WAAW,QAAQ;CAC1B,MAAM;;;;;;;;;;;;;;;;CAgBP,CACF,CAEwB"}
|
package/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'integration-posthog',\n version: '1.0.0',\n title: 'Integration — PostHog Analytics',\n description:\n 'Capture events, run HogQL, and manage PostHog assets via AnalyticsProvider.',\n kind: 'integration',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.integrations'],\n tags: ['posthog', 'analytics', 'hogql', 'integration'],\n },\n docs: {\n rootDocId: 'docs.examples.integration-posthog',\n usageDocId: 'docs.examples.integration-posthog.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.integration-posthog',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,yBAAyB;EAClC,MAAM;GAAC;GAAW;GAAa;GAAS;GAAc;EACvD;CACD,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC"}
|
package/dist/posthog.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"posthog.js","names":[],"sources":["../src/posthog.ts"],"sourcesContent":["import { PosthogAnalyticsProvider } from '@contractspec/integration.providers-impls/impls/posthog';\nimport type {\n AnalyticsEventInput,\n AnalyticsProvider,\n AnalyticsQueryResult,\n AnalyticsRequest,\n AnalyticsResponse,\n} from '@contractspec/integration.providers-impls/analytics';\n\nexport type PosthogExampleMode =\n | 'capture'\n | 'query'\n | 'request'\n | 'read'\n | 'all';\n\nexport interface PosthogExampleOutput {\n mode: PosthogExampleMode;\n dryRun: boolean;\n allowWrites: boolean;\n capture?: unknown;\n query?: AnalyticsQueryResult | unknown;\n request?: Record<string, unknown>;\n read?: Record<string, unknown>;\n mcp?: unknown;\n}\n\nexport async function runPosthogExampleFromEnv(): Promise<PosthogExampleOutput> {\n const mode = resolvePosthogMode();\n const dryRun = resolveBooleanEnv('CONTRACTSPEC_POSTHOG_DRY_RUN', true);\n const allowWrites = resolveBooleanEnv(\n 'CONTRACTSPEC_POSTHOG_ALLOW_WRITES',\n false\n );\n const output: PosthogExampleOutput = { mode, dryRun, allowWrites };\n\n if (dryRun) {\n if (mode === 'capture' || mode === 'all') {\n output.capture = buildCapturePreview();\n }\n if (mode === 'query' || mode === 'all') {\n output.query = { query: buildHogQLQuery() };\n }\n if (mode === 'request' || mode === 'all') {\n output.request = buildRequestPreview();\n }\n if (mode === 'read' || mode === 'all') {\n output.read = buildReadPreview();\n }\n if (process.env.POSTHOG_MCP_URL) {\n output.mcp = buildMcpPreview();\n }\n return output;\n }\n\n const provider = createProviderFromEnv();\n\n if (mode === 'capture' || mode === 'all') {\n output.capture = await runCapture(provider, allowWrites);\n }\n\n if (mode === 'query' || mode === 'all') {\n output.query = await runHogQLQuery(provider);\n }\n\n if (mode === 'request' || mode === 'all') {\n output.request = await runApiRequests(provider, allowWrites);\n }\n\n if (mode === 'read' || mode === 'all') {\n output.read = await runReadOperations(provider);\n }\n\n if (process.env.POSTHOG_MCP_URL) {\n output.mcp = await runMcpToolCall(provider);\n }\n\n return output;\n}\n\nexport function resolvePosthogMode(): PosthogExampleMode {\n const raw = (process.env.CONTRACTSPEC_POSTHOG_MODE ?? 'all').toLowerCase();\n if (\n raw === 'capture' ||\n raw === 'query' ||\n raw === 'request' ||\n raw === 'read' ||\n raw === 'all'\n ) {\n return raw;\n }\n throw new Error(\n `Unsupported CONTRACTSPEC_POSTHOG_MODE: ${raw}. Use capture, query, request, read, or all.`\n );\n}\n\nfunction createProviderFromEnv(): AnalyticsProvider {\n return new PosthogAnalyticsProvider({\n host: process.env.POSTHOG_HOST,\n projectId: process.env.POSTHOG_PROJECT_ID,\n projectApiKey: process.env.POSTHOG_PROJECT_API_KEY,\n personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,\n mcpUrl: process.env.POSTHOG_MCP_URL,\n requestTimeoutMs: 10000,\n });\n}\n\nasync function runCapture(\n provider: AnalyticsProvider,\n allowWrites: boolean\n): Promise<Record<string, unknown>> {\n if (!allowWrites) {\n return {\n skipped: true,\n reason: 'Set CONTRACTSPEC_POSTHOG_ALLOW_WRITES=true to enable capture.',\n };\n }\n\n const event = buildCaptureEvent();\n if (provider.identify) {\n await provider.identify({\n distinctId: event.distinctId,\n properties: { plan: 'pro', source: 'contractspec-example' },\n });\n }\n await provider.capture(event);\n return { captured: true, event };\n}\n\nasync function runHogQLQuery(\n provider: AnalyticsProvider\n): Promise<AnalyticsQueryResult> {\n if (!provider.queryHogQL) {\n throw new Error('Analytics provider does not support HogQL queries.');\n }\n const query = buildHogQLQuery();\n return provider.queryHogQL({ query });\n}\n\nasync function runApiRequests(\n provider: AnalyticsProvider,\n allowWrites: boolean\n): Promise<Record<string, unknown>> {\n const projectId = requireEnv('POSTHOG_PROJECT_ID');\n const listRequest: AnalyticsRequest = {\n method: 'GET',\n path: `/api/projects/${projectId}/feature_flags/`,\n query: { limit: 5 },\n };\n const listResponse = await provider.request(listRequest);\n const output: Record<string, unknown> = {\n list: listResponse.data,\n };\n\n if (!allowWrites) {\n output.writeGuard =\n 'Set CONTRACTSPEC_POSTHOG_ALLOW_WRITES=true to create/delete feature flags.';\n return output;\n }\n\n const flagKey = `contractspec-example-${Date.now()}`;\n const createResponse = await provider.request({\n method: 'POST',\n path: `/api/projects/${projectId}/feature_flags/`,\n body: {\n name: 'ContractSpec Example Flag',\n key: flagKey,\n active: true,\n filters: {\n groups: [\n {\n properties: [],\n rollout_percentage: 100,\n },\n ],\n },\n },\n });\n output.created = createResponse.data;\n\n const createdId = extractId(createResponse);\n if (createdId) {\n const deleteResponse = await provider.request({\n method: 'DELETE',\n path: `/api/projects/${projectId}/feature_flags/${createdId}`,\n });\n output.deleted = deleteResponse.status;\n } else {\n output.deleted = 'Skipped delete: response did not include an id.';\n }\n\n return output;\n}\n\nasync function runReadOperations(\n provider: AnalyticsProvider\n): Promise<Record<string, unknown>> {\n const now = new Date();\n const from = new Date(now.getTime() - 24 * 60 * 60 * 1000);\n const dateRange = { from, to: now };\n const output: Record<string, unknown> = {\n window: { from: from.toISOString(), to: now.toISOString() },\n };\n\n if (provider.getEvents) {\n output.events = await provider.getEvents({ dateRange, limit: 5 });\n } else {\n output.events = 'Provider does not support getEvents.';\n }\n\n if (provider.getPersons) {\n output.persons = await provider.getPersons({ limit: 5 });\n } else {\n output.persons = 'Provider does not support getPersons.';\n }\n\n if (provider.getInsights) {\n output.insights = await provider.getInsights({ limit: 5 });\n } else {\n output.insights = 'Provider does not support getInsights.';\n }\n\n if (provider.getFeatureFlags) {\n output.featureFlags = await provider.getFeatureFlags({ limit: 5 });\n } else {\n output.featureFlags = 'Provider does not support getFeatureFlags.';\n }\n\n return output;\n}\n\nasync function runMcpToolCall(provider: AnalyticsProvider): Promise<unknown> {\n if (!provider.callMcpTool) {\n throw new Error('Analytics provider does not support MCP tool calls.');\n }\n const name = process.env.POSTHOG_MCP_TOOL_NAME ?? 'posthog.query';\n const argumentsValue = parseOptionalJsonEnv('POSTHOG_MCP_TOOL_ARGS', {\n query: buildHogQLQuery(),\n });\n return provider.callMcpTool({ name, arguments: argumentsValue });\n}\n\nfunction buildCaptureEvent(): AnalyticsEventInput {\n const distinctId = process.env.POSTHOG_DISTINCT_ID ?? 'contractspec-demo';\n const event = process.env.POSTHOG_EVENT_NAME ?? 'contractspec.example.event';\n return {\n distinctId,\n event,\n properties: {\n source: 'contractspec-example',\n environment: process.env.NODE_ENV ?? 'development',\n },\n timestamp: new Date(),\n };\n}\n\nfunction buildHogQLQuery(): string {\n return (\n 'select event, count() as count ' +\n 'from events ' +\n 'where timestamp >= now() - interval 1 day ' +\n 'group by event ' +\n 'order by count desc ' +\n 'limit 5'\n );\n}\n\nfunction buildCapturePreview(): Record<string, unknown> {\n return {\n event: buildCaptureEvent(),\n hint: 'Dry run enabled. Set CONTRACTSPEC_POSTHOG_DRY_RUN=false.',\n };\n}\n\nfunction buildRequestPreview(): Record<string, unknown> {\n const projectId = process.env.POSTHOG_PROJECT_ID ?? 'PROJECT_ID';\n return {\n listRequest: {\n method: 'GET',\n path: `/api/projects/${projectId}/feature_flags/`,\n query: { limit: 5 },\n },\n writeRequests: {\n create: {\n method: 'POST',\n path: `/api/projects/${projectId}/feature_flags/`,\n },\n delete: {\n method: 'DELETE',\n path: `/api/projects/${projectId}/feature_flags/{id}`,\n },\n },\n };\n}\n\nfunction buildReadPreview(): Record<string, unknown> {\n return {\n events: {\n dateRange: 'last_24_hours',\n limit: 5,\n },\n persons: {\n limit: 5,\n },\n insights: {\n limit: 5,\n },\n featureFlags: {\n limit: 5,\n },\n };\n}\n\nfunction buildMcpPreview(): Record<string, unknown> {\n return {\n url: process.env.POSTHOG_MCP_URL,\n toolName: process.env.POSTHOG_MCP_TOOL_NAME ?? 'posthog.query',\n arguments: parseOptionalJsonEnv('POSTHOG_MCP_TOOL_ARGS', {\n query: buildHogQLQuery(),\n }),\n };\n}\n\nfunction extractId(\n response: AnalyticsResponse<unknown>\n): string | number | null {\n if (!response || typeof response !== 'object') return null;\n const data = response.data as { id?: string | number } | null | undefined;\n if (data && (typeof data.id === 'string' || typeof data.id === 'number')) {\n return data.id;\n }\n return null;\n}\n\nfunction resolveBooleanEnv(key: string, defaultValue: boolean): boolean {\n const value = process.env[key];\n if (value === undefined) return defaultValue;\n return value.toLowerCase() === 'true';\n}\n\nfunction requireEnv(key: string): string {\n const value = process.env[key];\n if (!value) {\n throw new Error(`Missing required env var: ${key}`);\n }\n return value;\n}\n\nfunction parseOptionalJsonEnv(\n key: string,\n fallback: Record<string, unknown>\n): Record<string, unknown> {\n const raw = process.env[key];\n if (!raw) return fallback;\n try {\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n if (parsed && typeof parsed === 'object') return parsed;\n } catch {\n throw new Error(`Invalid JSON in ${key}`);\n }\n return fallback;\n}\n"],"mappings":";;;AA2BA,eAAsB,2BAA0D;CAC9E,MAAM,OAAO,oBAAoB;CACjC,MAAM,SAAS,kBAAkB,gCAAgC,KAAK;CACtE,MAAM,cAAc,kBAClB,qCACA,MACD;CACD,MAAM,SAA+B;EAAE;EAAM;EAAQ;EAAa;AAElE,KAAI,QAAQ;AACV,MAAI,SAAS,aAAa,SAAS,MACjC,QAAO,UAAU,qBAAqB;AAExC,MAAI,SAAS,WAAW,SAAS,MAC/B,QAAO,QAAQ,EAAE,OAAO,iBAAiB,EAAE;AAE7C,MAAI,SAAS,aAAa,SAAS,MACjC,QAAO,UAAU,qBAAqB;AAExC,MAAI,SAAS,UAAU,SAAS,MAC9B,QAAO,OAAO,kBAAkB;AAElC,MAAI,QAAQ,IAAI,gBACd,QAAO,MAAM,iBAAiB;AAEhC,SAAO;;CAGT,MAAM,WAAW,uBAAuB;AAExC,KAAI,SAAS,aAAa,SAAS,MACjC,QAAO,UAAU,MAAM,WAAW,UAAU,YAAY;AAG1D,KAAI,SAAS,WAAW,SAAS,MAC/B,QAAO,QAAQ,MAAM,cAAc,SAAS;AAG9C,KAAI,SAAS,aAAa,SAAS,MACjC,QAAO,UAAU,MAAM,eAAe,UAAU,YAAY;AAG9D,KAAI,SAAS,UAAU,SAAS,MAC9B,QAAO,OAAO,MAAM,kBAAkB,SAAS;AAGjD,KAAI,QAAQ,IAAI,gBACd,QAAO,MAAM,MAAM,eAAe,SAAS;AAG7C,QAAO;;AAGT,SAAgB,qBAAyC;CACvD,MAAM,OAA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K;;AAGjC,SAAS,WAAW,KAAqB;CACvC,MAAM,QAAQ,QAAQ,IAAI;AAC1B,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,6BAA6B,MAAM;AAErD,QAAO;;AAGT,SAAS,qBACP,KACA,UACyB;CACzB,MAAM,MAAM,QAAQ,IAAI;AACxB,KAAI,CAAC,IAAK,QAAO;AACjB,KAAI;EACF,MAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,MAAI,UAAU,OAAO,WAAW,SAAU,QAAO;SAC3C;AACN,QAAM,IAAI,MAAM,mBAAmB,MAAM;;AAE3C,QAAO"}
|
package/dist/run.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":[],"sources":["../src/run.ts"],"sourcesContent":["import { runPosthogExampleFromEnv } from './posthog';\n\nrunPosthogExampleFromEnv()\n .then((result) => {\n console.log(JSON.stringify(result, null, 2));\n })\n .catch((error) => {\n console.error(error);\n process.exitCode = 1;\n });\n"],"mappings":";;;AAEA,0BAA0B,CACvB,MAAM,WAAW;AAChB,SAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,EAAE,CAAC;EAC5C,CACD,OAAO,UAAU;AAChB,SAAQ,MAAM,MAAM;AACpB,SAAQ,WAAW;EACnB"}
|