@keystrokehq/posthog 0.0.1
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 +237 -0
- package/dist/_official/index.d.mts +2 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +7 -0
- package/dist/_runtime/index.mjs +3 -0
- package/dist/actions.d.mts +244 -0
- package/dist/actions.mjs +129 -0
- package/dist/annotations.d.mts +185 -0
- package/dist/annotations.mjs +141 -0
- package/dist/capture.d.mts +177 -0
- package/dist/capture.mjs +241 -0
- package/dist/client.d.mts +51 -0
- package/dist/client.mjs +200 -0
- package/dist/cohorts.d.mts +229 -0
- package/dist/cohorts.mjs +185 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/dashboards.d.mts +434 -0
- package/dist/dashboards.mjs +356 -0
- package/dist/decide.d.mts +74 -0
- package/dist/decide.mjs +75 -0
- package/dist/errors.d.mts +58 -0
- package/dist/errors.mjs +120 -0
- package/dist/events-management.d.mts +294 -0
- package/dist/events-management.mjs +242 -0
- package/dist/factory-DYDvHOGb.mjs +8 -0
- package/dist/feature-flags.d.mts +416 -0
- package/dist/feature-flags.mjs +317 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/insights.d.mts +409 -0
- package/dist/insights.mjs +346 -0
- package/dist/integration-CsCBBu4d.d.mts +53 -0
- package/dist/integration-Doy2Dwli.mjs +30 -0
- package/dist/organizations.d.mts +257 -0
- package/dist/organizations.mjs +219 -0
- package/dist/persons.d.mts +369 -0
- package/dist/persons.mjs +345 -0
- package/dist/projects.d.mts +348 -0
- package/dist/projects.mjs +287 -0
- package/dist/schemas.d.mts +351 -0
- package/dist/schemas.mjs +302 -0
- package/dist/session-recordings.d.mts +391 -0
- package/dist/session-recordings.mjs +308 -0
- package/dist/surveys.d.mts +287 -0
- package/dist/surveys.mjs +208 -0
- package/dist/triggers.d.mts +115 -0
- package/dist/triggers.mjs +330 -0
- package/dist/webhook-management.d.mts +188 -0
- package/dist/webhook-management.mjs +152 -0
- package/package.json +147 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/webhook-management.d.ts
|
|
6
|
+
declare const listActionWebhooks: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
next: z.ZodNullable<z.ZodString>;
|
|
11
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
12
|
+
count: z.ZodNumber;
|
|
13
|
+
results: z.ZodArray<z.ZodObject<{
|
|
14
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
+
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
23
|
+
exact: "exact";
|
|
24
|
+
contains: "contains";
|
|
25
|
+
regex: "regex";
|
|
26
|
+
}>>>;
|
|
27
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
31
|
+
}, z.core.$strip>>>;
|
|
32
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
33
|
+
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
34
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
38
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
39
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
40
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
41
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
42
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
44
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
45
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
46
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
47
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
48
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
50
|
+
declare const attachActionWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
51
|
+
slack_message_format: z.ZodString;
|
|
52
|
+
actionId: z.ZodNumber;
|
|
53
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
64
|
+
exact: "exact";
|
|
65
|
+
contains: "contains";
|
|
66
|
+
regex: "regex";
|
|
67
|
+
}>>>;
|
|
68
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
72
|
+
}, z.core.$strip>>>;
|
|
73
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
74
|
+
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
75
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
78
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
79
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
80
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
81
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
82
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
84
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
85
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
86
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
87
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
88
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
90
|
+
declare const detachActionWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
91
|
+
actionId: z.ZodNumber;
|
|
92
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
100
|
+
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
103
|
+
exact: "exact";
|
|
104
|
+
contains: "contains";
|
|
105
|
+
regex: "regex";
|
|
106
|
+
}>>>;
|
|
107
|
+
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
112
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
113
|
+
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
114
|
+
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
117
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
118
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
119
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
120
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
121
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
122
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
123
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
124
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
125
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
126
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
127
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
129
|
+
declare const listPipelineDestinations: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
130
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
next: z.ZodNullable<z.ZodString>;
|
|
134
|
+
previous: z.ZodNullable<z.ZodString>;
|
|
135
|
+
count: z.ZodNumber;
|
|
136
|
+
results: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
137
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
138
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
139
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
140
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
141
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
142
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
144
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
145
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
146
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
147
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
148
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
149
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
150
|
+
declare const createPipelineDestination: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
151
|
+
plugin: z.ZodNumber;
|
|
152
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
153
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
155
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
156
|
+
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
157
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
158
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
159
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
160
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
161
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
163
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
164
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
165
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
166
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
167
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
169
|
+
declare const deletePipelineDestination: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
170
|
+
pluginConfigId: z.ZodNumber;
|
|
171
|
+
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
172
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
173
|
+
success: z.ZodBoolean;
|
|
174
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"posthog", z.ZodObject<{
|
|
175
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
176
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
177
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
178
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
179
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
180
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
181
|
+
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
182
|
+
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
183
|
+
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
184
|
+
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
185
|
+
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
186
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
187
|
+
//#endregion
|
|
188
|
+
export { attachActionWebhook, createPipelineDestination, deletePipelineDestination, detachActionWebhook, listActionWebhooks, listPipelineDestinations };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createPosthogManagementClient } from "./client.mjs";
|
|
2
|
+
import { actionSchema, paginatedResponseSchema, projectIdInputShape } from "./schemas.mjs";
|
|
3
|
+
import { t as posthogOperation } from "./factory-DYDvHOGb.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/webhook-management.ts
|
|
7
|
+
/**
|
|
8
|
+
* posthog/webhook-management.ts
|
|
9
|
+
*
|
|
10
|
+
* Helpers to manage PostHog Action webhooks + pipeline destination
|
|
11
|
+
* webhooks programmatically.
|
|
12
|
+
*
|
|
13
|
+
* Pass A exposes thin CRUD wrappers; the actual direct-binding webhook
|
|
14
|
+
* triggers (T2 action match, T4 pipeline destination) are deferred to
|
|
15
|
+
* Pass B because PostHog delivers those payloads unsigned and requires
|
|
16
|
+
* explicit product decisions on URL-embedded secrets vs. IP allowlisting.
|
|
17
|
+
*/
|
|
18
|
+
const actionIdInput = {
|
|
19
|
+
...projectIdInputShape,
|
|
20
|
+
actionId: z.number().int()
|
|
21
|
+
};
|
|
22
|
+
const listActionWebhooks = posthogOperation({
|
|
23
|
+
id: "posthog_action_webhooks_list",
|
|
24
|
+
name: "PostHog List Action Webhooks",
|
|
25
|
+
description: "List actions configured to post to a Slack webhook",
|
|
26
|
+
input: z.object({
|
|
27
|
+
...projectIdInputShape,
|
|
28
|
+
limit: z.number().int().min(1).max(500).optional()
|
|
29
|
+
}),
|
|
30
|
+
output: paginatedResponseSchema(actionSchema),
|
|
31
|
+
run: async (input, credentials) => {
|
|
32
|
+
const client = createPosthogManagementClient(credentials);
|
|
33
|
+
const projectId = client.projectId(input.projectId);
|
|
34
|
+
return client.request({
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: `/api/projects/${projectId}/actions/`,
|
|
37
|
+
query: {
|
|
38
|
+
limit: input.limit,
|
|
39
|
+
post_to_slack: true
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const attachActionWebhook = posthogOperation({
|
|
45
|
+
id: "posthog_action_webhooks_attach",
|
|
46
|
+
name: "PostHog Attach Action Webhook",
|
|
47
|
+
description: "Enable Slack-webhook posting on an action with a message format",
|
|
48
|
+
input: z.object({
|
|
49
|
+
...actionIdInput,
|
|
50
|
+
slack_message_format: z.string().min(1)
|
|
51
|
+
}),
|
|
52
|
+
output: actionSchema,
|
|
53
|
+
needsApproval: true,
|
|
54
|
+
run: async (input, credentials) => {
|
|
55
|
+
const client = createPosthogManagementClient(credentials);
|
|
56
|
+
const projectId = client.projectId(input.projectId);
|
|
57
|
+
return client.request({
|
|
58
|
+
method: "PATCH",
|
|
59
|
+
path: `/api/projects/${projectId}/actions/${input.actionId}/`,
|
|
60
|
+
body: {
|
|
61
|
+
post_to_slack: true,
|
|
62
|
+
slack_message_format: input.slack_message_format
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const detachActionWebhook = posthogOperation({
|
|
68
|
+
id: "posthog_action_webhooks_detach",
|
|
69
|
+
name: "PostHog Detach Action Webhook",
|
|
70
|
+
description: "Disable Slack-webhook posting on an action",
|
|
71
|
+
input: z.object(actionIdInput),
|
|
72
|
+
output: actionSchema,
|
|
73
|
+
needsApproval: true,
|
|
74
|
+
run: async (input, credentials) => {
|
|
75
|
+
const client = createPosthogManagementClient(credentials);
|
|
76
|
+
const projectId = client.projectId(input.projectId);
|
|
77
|
+
return client.request({
|
|
78
|
+
method: "PATCH",
|
|
79
|
+
path: `/api/projects/${projectId}/actions/${input.actionId}/`,
|
|
80
|
+
body: {
|
|
81
|
+
post_to_slack: false,
|
|
82
|
+
slack_message_format: null
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const listPipelineDestinations = posthogOperation({
|
|
88
|
+
id: "posthog_pipeline_destinations_list",
|
|
89
|
+
name: "PostHog List Pipeline Destinations",
|
|
90
|
+
description: "List configured pipeline destinations (plugin-configs)",
|
|
91
|
+
input: z.object({
|
|
92
|
+
...projectIdInputShape,
|
|
93
|
+
limit: z.number().int().min(1).max(500).optional()
|
|
94
|
+
}),
|
|
95
|
+
output: paginatedResponseSchema(z.record(z.string(), z.unknown())),
|
|
96
|
+
run: async (input, credentials) => {
|
|
97
|
+
const client = createPosthogManagementClient(credentials);
|
|
98
|
+
const projectId = client.projectId(input.projectId);
|
|
99
|
+
return client.request({
|
|
100
|
+
method: "GET",
|
|
101
|
+
path: `/api/projects/${projectId}/plugin_configs/`,
|
|
102
|
+
query: { limit: input.limit }
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const createPipelineDestination = posthogOperation({
|
|
107
|
+
id: "posthog_pipeline_destinations_create",
|
|
108
|
+
name: "PostHog Create Pipeline Destination",
|
|
109
|
+
description: "Configure a pipeline destination plugin (e.g. webhook delivery)",
|
|
110
|
+
input: z.object({
|
|
111
|
+
...projectIdInputShape,
|
|
112
|
+
plugin: z.number().int(),
|
|
113
|
+
enabled: z.boolean().default(true),
|
|
114
|
+
order: z.number().int().optional(),
|
|
115
|
+
config: z.record(z.string(), z.unknown())
|
|
116
|
+
}),
|
|
117
|
+
output: z.record(z.string(), z.unknown()),
|
|
118
|
+
needsApproval: true,
|
|
119
|
+
run: async (input, credentials) => {
|
|
120
|
+
const client = createPosthogManagementClient(credentials);
|
|
121
|
+
const projectId = client.projectId(input.projectId);
|
|
122
|
+
const { projectId: _pid, ...body } = input;
|
|
123
|
+
return client.request({
|
|
124
|
+
method: "POST",
|
|
125
|
+
path: `/api/projects/${projectId}/plugin_configs/`,
|
|
126
|
+
body
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const deletePipelineDestination = posthogOperation({
|
|
131
|
+
id: "posthog_pipeline_destinations_delete",
|
|
132
|
+
name: "PostHog Delete Pipeline Destination",
|
|
133
|
+
description: "Remove a pipeline destination configuration",
|
|
134
|
+
input: z.object({
|
|
135
|
+
...projectIdInputShape,
|
|
136
|
+
pluginConfigId: z.number().int()
|
|
137
|
+
}),
|
|
138
|
+
output: z.object({ success: z.boolean() }),
|
|
139
|
+
needsApproval: true,
|
|
140
|
+
run: async (input, credentials) => {
|
|
141
|
+
const client = createPosthogManagementClient(credentials);
|
|
142
|
+
const projectId = client.projectId(input.projectId);
|
|
143
|
+
await client.request({
|
|
144
|
+
method: "DELETE",
|
|
145
|
+
path: `/api/projects/${projectId}/plugin_configs/${input.pluginConfigId}/`
|
|
146
|
+
});
|
|
147
|
+
return { success: true };
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { attachActionWebhook, createPipelineDestination, deletePipelineDestination, detachActionWebhook, listActionWebhooks, listPipelineDestinations };
|
package/package.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keystrokehq/posthog",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"default": "./dist/index.mjs"
|
|
11
|
+
},
|
|
12
|
+
"./connection": {
|
|
13
|
+
"types": "./dist/connection.d.mts",
|
|
14
|
+
"default": "./dist/connection.mjs"
|
|
15
|
+
},
|
|
16
|
+
"./client": {
|
|
17
|
+
"types": "./dist/client.d.mts",
|
|
18
|
+
"default": "./dist/client.mjs"
|
|
19
|
+
},
|
|
20
|
+
"./errors": {
|
|
21
|
+
"types": "./dist/errors.d.mts",
|
|
22
|
+
"default": "./dist/errors.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./schemas": {
|
|
25
|
+
"types": "./dist/schemas.d.mts",
|
|
26
|
+
"default": "./dist/schemas.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./_official": {
|
|
29
|
+
"types": "./dist/_official/index.d.mts",
|
|
30
|
+
"default": "./dist/_official/index.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./triggers": {
|
|
33
|
+
"types": "./dist/triggers.d.mts",
|
|
34
|
+
"default": "./dist/triggers.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./capture": {
|
|
37
|
+
"types": "./dist/capture.d.mts",
|
|
38
|
+
"default": "./dist/capture.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./decide": {
|
|
41
|
+
"types": "./dist/decide.d.mts",
|
|
42
|
+
"default": "./dist/decide.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./feature-flags": {
|
|
45
|
+
"types": "./dist/feature-flags.d.mts",
|
|
46
|
+
"default": "./dist/feature-flags.mjs"
|
|
47
|
+
},
|
|
48
|
+
"./insights": {
|
|
49
|
+
"types": "./dist/insights.d.mts",
|
|
50
|
+
"default": "./dist/insights.mjs"
|
|
51
|
+
},
|
|
52
|
+
"./session-recordings": {
|
|
53
|
+
"types": "./dist/session-recordings.d.mts",
|
|
54
|
+
"default": "./dist/session-recordings.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./surveys": {
|
|
57
|
+
"types": "./dist/surveys.d.mts",
|
|
58
|
+
"default": "./dist/surveys.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./cohorts": {
|
|
61
|
+
"types": "./dist/cohorts.d.mts",
|
|
62
|
+
"default": "./dist/cohorts.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./persons": {
|
|
65
|
+
"types": "./dist/persons.d.mts",
|
|
66
|
+
"default": "./dist/persons.mjs"
|
|
67
|
+
},
|
|
68
|
+
"./annotations": {
|
|
69
|
+
"types": "./dist/annotations.d.mts",
|
|
70
|
+
"default": "./dist/annotations.mjs"
|
|
71
|
+
},
|
|
72
|
+
"./dashboards": {
|
|
73
|
+
"types": "./dist/dashboards.d.mts",
|
|
74
|
+
"default": "./dist/dashboards.mjs"
|
|
75
|
+
},
|
|
76
|
+
"./events-management": {
|
|
77
|
+
"types": "./dist/events-management.d.mts",
|
|
78
|
+
"default": "./dist/events-management.mjs"
|
|
79
|
+
},
|
|
80
|
+
"./actions": {
|
|
81
|
+
"types": "./dist/actions.d.mts",
|
|
82
|
+
"default": "./dist/actions.mjs"
|
|
83
|
+
},
|
|
84
|
+
"./projects": {
|
|
85
|
+
"types": "./dist/projects.d.mts",
|
|
86
|
+
"default": "./dist/projects.mjs"
|
|
87
|
+
},
|
|
88
|
+
"./organizations": {
|
|
89
|
+
"types": "./dist/organizations.d.mts",
|
|
90
|
+
"default": "./dist/organizations.mjs"
|
|
91
|
+
},
|
|
92
|
+
"./webhook-management": {
|
|
93
|
+
"types": "./dist/webhook-management.d.mts",
|
|
94
|
+
"default": "./dist/webhook-management.mjs"
|
|
95
|
+
},
|
|
96
|
+
"./_runtime": {
|
|
97
|
+
"types": "./dist/_runtime/index.d.mts",
|
|
98
|
+
"default": "./dist/_runtime/index.mjs"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"files": [
|
|
102
|
+
"dist",
|
|
103
|
+
"README.md",
|
|
104
|
+
"LICENSE"
|
|
105
|
+
],
|
|
106
|
+
"scripts": {
|
|
107
|
+
"typecheck": "tsgo --build",
|
|
108
|
+
"build": "tsdown",
|
|
109
|
+
"lint": "biome check .",
|
|
110
|
+
"test:unit": "vitest run --passWithNoTests --project unit",
|
|
111
|
+
"prepublishOnly": "pnpm build && pnpm test:unit",
|
|
112
|
+
"lint:fix": "biome check --write .",
|
|
113
|
+
"test:int": "vitest run --passWithNoTests --project int"
|
|
114
|
+
},
|
|
115
|
+
"dependencies": {
|
|
116
|
+
"@keystrokehq/integration-authoring": "^0.0.1",
|
|
117
|
+
"@keystrokehq/core": "^0.0.5",
|
|
118
|
+
"zod": "^4.3.6"
|
|
119
|
+
},
|
|
120
|
+
"devDependencies": {
|
|
121
|
+
"@types/node": "catalog:",
|
|
122
|
+
"@keystrokehq/test-utils": "workspace:*",
|
|
123
|
+
"@keystrokehq/typescript-config": "workspace:*",
|
|
124
|
+
"tsdown": "catalog:",
|
|
125
|
+
"typescript": "catalog:",
|
|
126
|
+
"vitest": "catalog:"
|
|
127
|
+
},
|
|
128
|
+
"keywords": [
|
|
129
|
+
"posthog",
|
|
130
|
+
"analytics",
|
|
131
|
+
"feature-flags",
|
|
132
|
+
"experiments",
|
|
133
|
+
"session-replay",
|
|
134
|
+
"keystroke",
|
|
135
|
+
"integration"
|
|
136
|
+
],
|
|
137
|
+
"repository": {
|
|
138
|
+
"type": "git",
|
|
139
|
+
"url": "https://github.com/keystrokehq/integrations",
|
|
140
|
+
"directory": "integrations/posthog"
|
|
141
|
+
},
|
|
142
|
+
"license": "MIT",
|
|
143
|
+
"publishConfig": {
|
|
144
|
+
"access": "public",
|
|
145
|
+
"registry": "https://registry.npmjs.org/"
|
|
146
|
+
}
|
|
147
|
+
}
|