@keystrokehq/posthog 0.0.9 → 0.0.16-integration-id-canonicalization.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/README.md +28 -48
- package/dist/{client.mjs → client-BZWd9-On.mjs} +195 -4
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +3 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +5 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/posthog.credential-set-C8TimFgo.d.mts +30 -0
- package/dist/posthog.credential-set-DwYnDkeD.mjs +28 -0
- package/dist/{schemas.d.mts → schemas/index.d.mts} +4 -4
- package/dist/{schemas.mjs → schemas/index.mjs} +1 -1
- package/dist/surveys-update.operation-C0MYZZ04.mjs +3836 -0
- package/dist/surveys-update.operation-gxREsmzk.d.mts +4578 -0
- package/dist/{triggers.d.mts → triggers/index.d.mts} +4 -4
- package/dist/{triggers.mjs → triggers/index.mjs} +5 -6
- package/package.json +13 -85
- package/dist/_official/index.d.mts +0 -2
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -6
- package/dist/_runtime/index.mjs +0 -3
- package/dist/actions.d.mts +0 -244
- package/dist/actions.mjs +0 -129
- package/dist/annotations.d.mts +0 -185
- package/dist/annotations.mjs +0 -141
- package/dist/capture.d.mts +0 -177
- package/dist/capture.mjs +0 -241
- package/dist/client.d.mts +0 -50
- package/dist/cohorts.d.mts +0 -229
- package/dist/cohorts.mjs +0 -185
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/dashboards.d.mts +0 -434
- package/dist/dashboards.mjs +0 -356
- package/dist/decide.d.mts +0 -74
- package/dist/decide.mjs +0 -75
- package/dist/errors.d.mts +0 -58
- package/dist/errors.mjs +0 -120
- package/dist/events-management.d.mts +0 -294
- package/dist/events-management.mjs +0 -242
- package/dist/factory-C3ssyfSy.mjs +0 -7
- package/dist/feature-flags.d.mts +0 -416
- package/dist/feature-flags.mjs +0 -317
- package/dist/http-BYcjqxPi.mjs +0 -84
- package/dist/insights.d.mts +0 -409
- package/dist/insights.mjs +0 -346
- package/dist/integration-BN7xcpga.d.mts +0 -63
- package/dist/integration-D0HdrI0T.mjs +0 -120
- package/dist/organizations.d.mts +0 -257
- package/dist/organizations.mjs +0 -219
- package/dist/persons.d.mts +0 -369
- package/dist/persons.mjs +0 -345
- package/dist/projects.d.mts +0 -348
- package/dist/projects.mjs +0 -287
- package/dist/session-recordings.d.mts +0 -391
- package/dist/session-recordings.mjs +0 -308
- package/dist/surveys.d.mts +0 -287
- package/dist/surveys.mjs +0 -208
- package/dist/webhook-management.d.mts +0 -188
- package/dist/webhook-management.mjs +0 -152
package/dist/insights.mjs
DELETED
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import { createPosthogManagementClient } from "./client.mjs";
|
|
2
|
-
import { insightSchema, paginatedResponseSchema, projectIdInputShape, sharingConfigurationSchema } from "./schemas.mjs";
|
|
3
|
-
import { t as posthogOperation } from "./factory-C3ssyfSy.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/insights.ts
|
|
7
|
-
/**
|
|
8
|
-
* posthog/insights.ts
|
|
9
|
-
*
|
|
10
|
-
* Insight CRUD, query execution, activity, and sharing.
|
|
11
|
-
*
|
|
12
|
-
* Docs: https://posthog.com/docs/api/insights
|
|
13
|
-
*/
|
|
14
|
-
const idInput = {
|
|
15
|
-
...projectIdInputShape,
|
|
16
|
-
id: z.number().int()
|
|
17
|
-
};
|
|
18
|
-
const writeShape = {
|
|
19
|
-
name: z.string().optional(),
|
|
20
|
-
description: z.string().nullable().optional(),
|
|
21
|
-
filters: z.record(z.string(), z.unknown()).optional(),
|
|
22
|
-
query: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
23
|
-
favorited: z.boolean().optional(),
|
|
24
|
-
saved: z.boolean().optional(),
|
|
25
|
-
dashboards: z.array(z.number().int()).optional(),
|
|
26
|
-
tags: z.array(z.string()).optional(),
|
|
27
|
-
deleted: z.boolean().optional()
|
|
28
|
-
};
|
|
29
|
-
const listInsights = posthogOperation({
|
|
30
|
-
id: "posthog.insights-list",
|
|
31
|
-
name: "PostHog List Insights",
|
|
32
|
-
description: "List insights in a project",
|
|
33
|
-
input: z.object({
|
|
34
|
-
...projectIdInputShape,
|
|
35
|
-
limit: z.number().int().min(1).max(500).optional(),
|
|
36
|
-
offset: z.number().int().min(0).optional(),
|
|
37
|
-
search: z.string().optional(),
|
|
38
|
-
favorited: z.boolean().optional(),
|
|
39
|
-
saved: z.boolean().optional(),
|
|
40
|
-
created_by: z.number().int().optional(),
|
|
41
|
-
dashboards: z.array(z.number().int()).optional()
|
|
42
|
-
}),
|
|
43
|
-
output: paginatedResponseSchema(insightSchema),
|
|
44
|
-
run: async (input, credentials) => {
|
|
45
|
-
const client = createPosthogManagementClient(credentials);
|
|
46
|
-
const projectId = client.projectId(input.projectId);
|
|
47
|
-
return client.request({
|
|
48
|
-
method: "GET",
|
|
49
|
-
path: `/api/projects/${projectId}/insights/`,
|
|
50
|
-
query: {
|
|
51
|
-
limit: input.limit,
|
|
52
|
-
offset: input.offset,
|
|
53
|
-
search: input.search,
|
|
54
|
-
favorited: input.favorited,
|
|
55
|
-
saved: input.saved,
|
|
56
|
-
created_by: input.created_by,
|
|
57
|
-
...input.dashboards ? { dashboards: input.dashboards.join(",") } : {}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
const getInsight = posthogOperation({
|
|
63
|
-
id: "posthog.insights-get",
|
|
64
|
-
name: "PostHog Get Insight",
|
|
65
|
-
description: "Retrieve a single insight by id",
|
|
66
|
-
input: z.object(idInput),
|
|
67
|
-
output: insightSchema,
|
|
68
|
-
run: async (input, credentials) => {
|
|
69
|
-
const client = createPosthogManagementClient(credentials);
|
|
70
|
-
const projectId = client.projectId(input.projectId);
|
|
71
|
-
return client.request({
|
|
72
|
-
method: "GET",
|
|
73
|
-
path: `/api/projects/${projectId}/insights/${input.id}/`
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const createInsight = posthogOperation({
|
|
78
|
-
id: "posthog.insights-create",
|
|
79
|
-
name: "PostHog Create Insight",
|
|
80
|
-
description: "Create a new insight",
|
|
81
|
-
input: z.object({
|
|
82
|
-
...projectIdInputShape,
|
|
83
|
-
...writeShape
|
|
84
|
-
}),
|
|
85
|
-
output: insightSchema,
|
|
86
|
-
needsApproval: true,
|
|
87
|
-
run: async (input, credentials) => {
|
|
88
|
-
const client = createPosthogManagementClient(credentials);
|
|
89
|
-
const projectId = client.projectId(input.projectId);
|
|
90
|
-
const { projectId: _pid, ...body } = input;
|
|
91
|
-
return client.request({
|
|
92
|
-
method: "POST",
|
|
93
|
-
path: `/api/projects/${projectId}/insights/`,
|
|
94
|
-
body
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
const updateInsight = posthogOperation({
|
|
99
|
-
id: "posthog.insights-update",
|
|
100
|
-
name: "PostHog Update Insight",
|
|
101
|
-
description: "Partial update to an insight",
|
|
102
|
-
input: z.object({
|
|
103
|
-
...idInput,
|
|
104
|
-
...writeShape
|
|
105
|
-
}),
|
|
106
|
-
output: insightSchema,
|
|
107
|
-
needsApproval: true,
|
|
108
|
-
run: async (input, credentials) => {
|
|
109
|
-
const client = createPosthogManagementClient(credentials);
|
|
110
|
-
const projectId = client.projectId(input.projectId);
|
|
111
|
-
const { projectId: _pid, id, ...body } = input;
|
|
112
|
-
return client.request({
|
|
113
|
-
method: "PATCH",
|
|
114
|
-
path: `/api/projects/${projectId}/insights/${id}/`,
|
|
115
|
-
body
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const deleteInsight = posthogOperation({
|
|
120
|
-
id: "posthog.insights-delete",
|
|
121
|
-
name: "PostHog Delete Insight",
|
|
122
|
-
description: "Soft-delete an insight",
|
|
123
|
-
input: z.object(idInput),
|
|
124
|
-
output: insightSchema,
|
|
125
|
-
needsApproval: true,
|
|
126
|
-
run: async (input, credentials) => {
|
|
127
|
-
const client = createPosthogManagementClient(credentials);
|
|
128
|
-
const projectId = client.projectId(input.projectId);
|
|
129
|
-
return client.request({
|
|
130
|
-
method: "PATCH",
|
|
131
|
-
path: `/api/projects/${projectId}/insights/${input.id}/`,
|
|
132
|
-
body: { deleted: true }
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
const getInsightActivity = posthogOperation({
|
|
137
|
-
id: "posthog.insights-activity",
|
|
138
|
-
name: "PostHog Insight Activity",
|
|
139
|
-
description: "Fetch activity log for an insight",
|
|
140
|
-
input: z.object({
|
|
141
|
-
...idInput,
|
|
142
|
-
limit: z.number().int().min(1).max(200).optional()
|
|
143
|
-
}),
|
|
144
|
-
output: z.object({ results: z.array(z.record(z.string(), z.unknown())) }),
|
|
145
|
-
run: async (input, credentials) => {
|
|
146
|
-
const client = createPosthogManagementClient(credentials);
|
|
147
|
-
const projectId = client.projectId(input.projectId);
|
|
148
|
-
return client.request({
|
|
149
|
-
method: "GET",
|
|
150
|
-
path: `/api/projects/${projectId}/insights/${input.id}/activity/`,
|
|
151
|
-
query: { limit: input.limit }
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
const getInsightsActivityFeed = posthogOperation({
|
|
156
|
-
id: "posthog.insights-activity-feed",
|
|
157
|
-
name: "PostHog Insights Activity Feed",
|
|
158
|
-
description: "Fetch the project-wide insights activity feed",
|
|
159
|
-
input: z.object({
|
|
160
|
-
...projectIdInputShape,
|
|
161
|
-
limit: z.number().int().min(1).max(200).optional()
|
|
162
|
-
}),
|
|
163
|
-
output: z.object({ results: z.array(z.record(z.string(), z.unknown())) }),
|
|
164
|
-
run: async (input, credentials) => {
|
|
165
|
-
const client = createPosthogManagementClient(credentials);
|
|
166
|
-
const projectId = client.projectId(input.projectId);
|
|
167
|
-
return client.request({
|
|
168
|
-
method: "GET",
|
|
169
|
-
path: `/api/projects/${projectId}/insights/activity/`,
|
|
170
|
-
query: { limit: input.limit }
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const getInsightSharing = posthogOperation({
|
|
175
|
-
id: "posthog.insights-sharing-get",
|
|
176
|
-
name: "PostHog Get Insight Sharing",
|
|
177
|
-
description: "Fetch sharing configuration for an insight",
|
|
178
|
-
input: z.object(idInput),
|
|
179
|
-
output: sharingConfigurationSchema,
|
|
180
|
-
run: async (input, credentials) => {
|
|
181
|
-
const client = createPosthogManagementClient(credentials);
|
|
182
|
-
const projectId = client.projectId(input.projectId);
|
|
183
|
-
return client.request({
|
|
184
|
-
method: "GET",
|
|
185
|
-
path: `/api/projects/${projectId}/insights/${input.id}/sharing/`
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
const updateInsightSharing = posthogOperation({
|
|
190
|
-
id: "posthog.insights-sharing-update",
|
|
191
|
-
name: "PostHog Update Insight Sharing",
|
|
192
|
-
description: "Enable or disable sharing for an insight",
|
|
193
|
-
input: z.object({
|
|
194
|
-
...idInput,
|
|
195
|
-
enabled: z.boolean()
|
|
196
|
-
}),
|
|
197
|
-
output: sharingConfigurationSchema,
|
|
198
|
-
needsApproval: true,
|
|
199
|
-
run: async (input, credentials) => {
|
|
200
|
-
const client = createPosthogManagementClient(credentials);
|
|
201
|
-
const projectId = client.projectId(input.projectId);
|
|
202
|
-
return client.request({
|
|
203
|
-
method: "PATCH",
|
|
204
|
-
path: `/api/projects/${projectId}/insights/${input.id}/sharing/`,
|
|
205
|
-
body: { enabled: input.enabled }
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
const getMyInsights = posthogOperation({
|
|
210
|
-
id: "posthog.insights-my-insights",
|
|
211
|
-
name: "PostHog My Insights",
|
|
212
|
-
description: "Fetch insights owned by the calling user",
|
|
213
|
-
input: z.object({
|
|
214
|
-
...projectIdInputShape,
|
|
215
|
-
limit: z.number().int().min(1).max(500).optional()
|
|
216
|
-
}),
|
|
217
|
-
output: paginatedResponseSchema(insightSchema),
|
|
218
|
-
run: async (input, credentials) => {
|
|
219
|
-
const client = createPosthogManagementClient(credentials);
|
|
220
|
-
const projectId = client.projectId(input.projectId);
|
|
221
|
-
return client.request({
|
|
222
|
-
method: "GET",
|
|
223
|
-
path: `/api/projects/${projectId}/insights/my_last_viewed/`,
|
|
224
|
-
query: { limit: input.limit }
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
const markInsightViewed = posthogOperation({
|
|
229
|
-
id: "posthog.insights-viewed",
|
|
230
|
-
name: "PostHog Mark Insight Viewed",
|
|
231
|
-
description: "Record that the calling user viewed an insight",
|
|
232
|
-
input: z.object(idInput),
|
|
233
|
-
output: z.object({ success: z.boolean() }),
|
|
234
|
-
needsApproval: true,
|
|
235
|
-
run: async (input, credentials) => {
|
|
236
|
-
const client = createPosthogManagementClient(credentials);
|
|
237
|
-
const projectId = client.projectId(input.projectId);
|
|
238
|
-
await client.request({
|
|
239
|
-
method: "POST",
|
|
240
|
-
path: `/api/projects/${projectId}/insights/${input.id}/viewed/`
|
|
241
|
-
});
|
|
242
|
-
return { success: true };
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
const executeInsightQuery = posthogOperation({
|
|
246
|
-
id: "posthog.insights-trend",
|
|
247
|
-
name: "PostHog Execute Insight Query",
|
|
248
|
-
description: "Execute an ad-hoc trend/funnel/retention/etc. query",
|
|
249
|
-
input: z.object({
|
|
250
|
-
...projectIdInputShape,
|
|
251
|
-
query: z.record(z.string(), z.unknown()),
|
|
252
|
-
refresh: z.boolean().optional()
|
|
253
|
-
}),
|
|
254
|
-
output: z.record(z.string(), z.unknown()),
|
|
255
|
-
run: async (input, credentials) => {
|
|
256
|
-
const client = createPosthogManagementClient(credentials);
|
|
257
|
-
const projectId = client.projectId(input.projectId);
|
|
258
|
-
return client.request({
|
|
259
|
-
method: "POST",
|
|
260
|
-
path: `/api/projects/${projectId}/query/`,
|
|
261
|
-
body: {
|
|
262
|
-
query: input.query,
|
|
263
|
-
refresh: input.refresh ?? false
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
const getInsightRetention = posthogOperation({
|
|
269
|
-
id: "posthog.insights-retention",
|
|
270
|
-
name: "PostHog Insight Retention",
|
|
271
|
-
description: "Fetch retention report for an insight/query combination",
|
|
272
|
-
input: z.object({
|
|
273
|
-
...projectIdInputShape,
|
|
274
|
-
query: z.record(z.string(), z.unknown())
|
|
275
|
-
}),
|
|
276
|
-
output: z.record(z.string(), z.unknown()),
|
|
277
|
-
run: async (input, credentials) => {
|
|
278
|
-
const client = createPosthogManagementClient(credentials);
|
|
279
|
-
const projectId = client.projectId(input.projectId);
|
|
280
|
-
return client.request({
|
|
281
|
-
method: "POST",
|
|
282
|
-
path: `/api/projects/${projectId}/insights/retention/`,
|
|
283
|
-
body: input.query
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
const getInsightFunnel = posthogOperation({
|
|
288
|
-
id: "posthog.insights-funnel",
|
|
289
|
-
name: "PostHog Insight Funnel",
|
|
290
|
-
description: "Execute a funnel query",
|
|
291
|
-
input: z.object({
|
|
292
|
-
...projectIdInputShape,
|
|
293
|
-
query: z.record(z.string(), z.unknown())
|
|
294
|
-
}),
|
|
295
|
-
output: z.record(z.string(), z.unknown()),
|
|
296
|
-
run: async (input, credentials) => {
|
|
297
|
-
const client = createPosthogManagementClient(credentials);
|
|
298
|
-
const projectId = client.projectId(input.projectId);
|
|
299
|
-
return client.request({
|
|
300
|
-
method: "POST",
|
|
301
|
-
path: `/api/projects/${projectId}/insights/funnel/`,
|
|
302
|
-
body: input.query
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
const getInsightPath = posthogOperation({
|
|
307
|
-
id: "posthog.insights-path",
|
|
308
|
-
name: "PostHog Insight Path",
|
|
309
|
-
description: "Execute a user-path query",
|
|
310
|
-
input: z.object({
|
|
311
|
-
...projectIdInputShape,
|
|
312
|
-
query: z.record(z.string(), z.unknown())
|
|
313
|
-
}),
|
|
314
|
-
output: z.record(z.string(), z.unknown()),
|
|
315
|
-
run: async (input, credentials) => {
|
|
316
|
-
const client = createPosthogManagementClient(credentials);
|
|
317
|
-
const projectId = client.projectId(input.projectId);
|
|
318
|
-
return client.request({
|
|
319
|
-
method: "POST",
|
|
320
|
-
path: `/api/projects/${projectId}/insights/path/`,
|
|
321
|
-
body: input.query
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
const getInsightTrend = posthogOperation({
|
|
326
|
-
id: "posthog.insights-trend-chart",
|
|
327
|
-
name: "PostHog Insight Trend",
|
|
328
|
-
description: "Execute a trend query",
|
|
329
|
-
input: z.object({
|
|
330
|
-
...projectIdInputShape,
|
|
331
|
-
query: z.record(z.string(), z.unknown())
|
|
332
|
-
}),
|
|
333
|
-
output: z.record(z.string(), z.unknown()),
|
|
334
|
-
run: async (input, credentials) => {
|
|
335
|
-
const client = createPosthogManagementClient(credentials);
|
|
336
|
-
const projectId = client.projectId(input.projectId);
|
|
337
|
-
return client.request({
|
|
338
|
-
method: "POST",
|
|
339
|
-
path: `/api/projects/${projectId}/insights/trend/`,
|
|
340
|
-
body: input.query
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
//#endregion
|
|
346
|
-
export { createInsight, deleteInsight, executeInsightQuery, getInsight, getInsightActivity, getInsightFunnel, getInsightPath, getInsightRetention, getInsightSharing, getInsightTrend, getInsightsActivityFeed, getMyInsights, listInsights, markInsightViewed, updateInsight, updateInsightSharing };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
-
import { CredentialSet, Operation } from "@keystrokehq/core";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
5
|
-
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
6
|
-
|
|
7
|
-
//#region ../../packages/integration-authoring/dist/official/index.d.mts
|
|
8
|
-
/**
|
|
9
|
-
* Creates a factory for Keystroke-official integration operations.
|
|
10
|
-
*
|
|
11
|
-
* It keeps the same flat `run(input, credentials)` ergonomics as the generic
|
|
12
|
-
* operation factory, while registering official metadata for builder/runtime
|
|
13
|
-
* operation metadata.
|
|
14
|
-
*/
|
|
15
|
-
declare function createOfficialOperationFactory(credentialSet: any): (config: any) => Operation<any, any, any[], undefined>;
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/integration.d.ts
|
|
18
|
-
/**
|
|
19
|
-
* PostHog integration — product analytics, feature flags, experiments,
|
|
20
|
-
* session replay, surveys, and data-platform management.
|
|
21
|
-
*
|
|
22
|
-
* The personal API key is injected as `Authorization: Bearer` for every
|
|
23
|
-
* management request (see `./client.ts`). The optional project API key
|
|
24
|
-
* is required only for capture/decide operations.
|
|
25
|
-
*/
|
|
26
|
-
declare const posthogOfficialIntegration: {
|
|
27
|
-
id: "posthog";
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
auth: z.ZodObject<{
|
|
31
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
32
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
33
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
34
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
35
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
};
|
|
38
|
-
declare const posthogBundle: undefined<"posthog", z.ZodObject<{
|
|
39
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
40
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
41
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
42
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
43
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
-
}, z.core.$strip>>;
|
|
45
|
-
declare const posthog: _keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
46
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
47
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
48
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
49
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
50
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
52
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
53
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
54
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
55
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
56
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
-
}, z.core.$strip>>[] | undefined>;
|
|
58
|
-
/**
|
|
59
|
-
* Credentials injected into steps. Derived from the integration definition.
|
|
60
|
-
*/
|
|
61
|
-
type PosthogCredentials = InferCredentialSetAuth<typeof posthog>;
|
|
62
|
-
//#endregion
|
|
63
|
-
export { createOfficialOperationFactory as a, posthogOfficialIntegration as i, posthog as n, posthogBundle as r, PosthogCredentials as t };
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { CredentialSet, Operation } from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
//#region ../../packages/integration-authoring/dist/official/runtime.mjs
|
|
5
|
-
const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
|
|
6
|
-
function getRegistry() {
|
|
7
|
-
const globalStore = globalThis;
|
|
8
|
-
if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
return globalStore[REGISTRY_KEY];
|
|
10
|
-
}
|
|
11
|
-
function registerOfficialOperation(operation, metadata) {
|
|
12
|
-
getRegistry().set(operation, Object.freeze({ ...metadata }));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region ../../packages/integration-authoring/dist/official/index.mjs
|
|
17
|
-
const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
|
|
18
|
-
function stripOfficialCredentialSetIdPrefix(id) {
|
|
19
|
-
return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Creates a factory for Keystroke-official integration operations.
|
|
23
|
-
*
|
|
24
|
-
* It keeps the same flat `run(input, credentials)` ergonomics as the generic
|
|
25
|
-
* operation factory, while registering official metadata for builder/runtime
|
|
26
|
-
* operation metadata.
|
|
27
|
-
*/
|
|
28
|
-
function createOfficialOperationFactory(credentialSet) {
|
|
29
|
-
const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
|
|
30
|
-
return (config) => {
|
|
31
|
-
const wrappedRun = async (input, ctx) => {
|
|
32
|
-
const creds = ctx.credentials[credentialSet.id];
|
|
33
|
-
return config.run(input, creds);
|
|
34
|
-
};
|
|
35
|
-
const operation = new Operation({
|
|
36
|
-
id: config.id,
|
|
37
|
-
name: config.name,
|
|
38
|
-
description: config.description,
|
|
39
|
-
input: config.input,
|
|
40
|
-
output: config.output,
|
|
41
|
-
credentialSets: [credentialSet],
|
|
42
|
-
...config.tags !== void 0 ? { tags: config.tags } : {},
|
|
43
|
-
...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
|
|
44
|
-
...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
|
|
45
|
-
...config.retries !== void 0 ? { retries: config.retries } : {},
|
|
46
|
-
...config.timeout !== void 0 ? { timeout: config.timeout } : {},
|
|
47
|
-
...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
|
|
48
|
-
run: wrappedRun
|
|
49
|
-
});
|
|
50
|
-
registerOfficialOperation(operation, { integrationId });
|
|
51
|
-
return operation;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates an official integration bundle from a single config object.
|
|
56
|
-
*
|
|
57
|
-
* - Creates the public `CredentialSet` internally.
|
|
58
|
-
* - Accepts optional `internal` fields for Keystroke-owned platform credentials.
|
|
59
|
-
*/
|
|
60
|
-
function defineOfficialIntegration(config) {
|
|
61
|
-
const internalCredentialSets = config.internal ?? {};
|
|
62
|
-
const allInternalCredentialSets = [
|
|
63
|
-
...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
|
|
64
|
-
...internalCredentialSets.providerAppVariants ?? [],
|
|
65
|
-
...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
|
|
66
|
-
...internalCredentialSets.other ?? []
|
|
67
|
-
];
|
|
68
|
-
const credentialSet = new CredentialSet({
|
|
69
|
-
id: config.id,
|
|
70
|
-
name: config.name,
|
|
71
|
-
description: config.description,
|
|
72
|
-
auth: config.auth,
|
|
73
|
-
...config.connections ? { connections: config.connections } : {},
|
|
74
|
-
...config.proxy ? { proxy: config.proxy } : {},
|
|
75
|
-
...config.needsRawSecret === true ? { needsRawSecret: true } : {}
|
|
76
|
-
});
|
|
77
|
-
return Object.freeze({
|
|
78
|
-
integration: {
|
|
79
|
-
id: config.id,
|
|
80
|
-
name: config.name,
|
|
81
|
-
...config.description !== void 0 ? { description: config.description } : {},
|
|
82
|
-
auth: config.auth,
|
|
83
|
-
...config.proxy ? { proxy: config.proxy } : {},
|
|
84
|
-
...config.needsRawSecret === true ? { needsRawSecret: true } : {},
|
|
85
|
-
...config.connections ? { connections: config.connections } : {}
|
|
86
|
-
},
|
|
87
|
-
credentialSet,
|
|
88
|
-
internalCredentialSets,
|
|
89
|
-
allInternalCredentialSets
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/integration.ts
|
|
95
|
-
const posthogAuthSchema = z.object({
|
|
96
|
-
POSTHOG_PERSONAL_API_KEY: z.string().min(1),
|
|
97
|
-
POSTHOG_PROJECT_API_KEY: z.string().min(1).optional(),
|
|
98
|
-
POSTHOG_HOST: z.url().default("https://us.posthog.com"),
|
|
99
|
-
POSTHOG_PROJECT_ID: z.string().min(1).optional(),
|
|
100
|
-
POSTHOG_SCOPES: z.array(z.string()).optional()
|
|
101
|
-
});
|
|
102
|
-
/**
|
|
103
|
-
* PostHog integration — product analytics, feature flags, experiments,
|
|
104
|
-
* session replay, surveys, and data-platform management.
|
|
105
|
-
*
|
|
106
|
-
* The personal API key is injected as `Authorization: Bearer` for every
|
|
107
|
-
* management request (see `./client.ts`). The optional project API key
|
|
108
|
-
* is required only for capture/decide operations.
|
|
109
|
-
*/
|
|
110
|
-
const posthogOfficialIntegration = {
|
|
111
|
-
id: "posthog",
|
|
112
|
-
name: "PostHog",
|
|
113
|
-
description: "PostHog product analytics, feature flags, experiments, session replay, surveys, and data-platform management",
|
|
114
|
-
auth: posthogAuthSchema
|
|
115
|
-
};
|
|
116
|
-
const posthogBundle = defineOfficialIntegration(posthogOfficialIntegration);
|
|
117
|
-
const posthog = posthogBundle.credentialSet;
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
export { createOfficialOperationFactory as i, posthogBundle as n, posthogOfficialIntegration as r, posthog as t };
|