@keystrokehq/posthog 0.0.15 → 0.0.16-integration-id-canonicalization.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 +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/{integration-BHWIx2Lw.mjs → posthog.credential-set-DwYnDkeD.mjs} +6 -9
- package/dist/{schemas.d.mts → schemas/index.d.mts} +1 -1
- 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} +7 -5
- package/dist/{triggers.mjs → triggers/index.mjs} +54 -6
- package/package.json +14 -86
- package/dist/_official/index.d.mts +0 -2
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -7
- package/dist/_runtime/index.mjs +0 -3
- package/dist/actions.d.mts +0 -213
- package/dist/actions.mjs +0 -129
- package/dist/annotations.d.mts +0 -154
- package/dist/annotations.mjs +0 -141
- package/dist/capture.d.mts +0 -134
- package/dist/capture.mjs +0 -241
- package/dist/client.d.mts +0 -51
- package/dist/cohorts.d.mts +0 -180
- 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 -337
- package/dist/dashboards.mjs +0 -356
- package/dist/decide.d.mts +0 -61
- 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 -233
- package/dist/events-management.mjs +0 -242
- package/dist/factory-D4Ve2fJ-.mjs +0 -8
- package/dist/feature-flags.d.mts +0 -325
- package/dist/feature-flags.mjs +0 -317
- package/dist/insights.d.mts +0 -312
- package/dist/insights.mjs +0 -346
- package/dist/integration-Dv7fVIxG.d.mts +0 -47
- package/dist/organizations.d.mts +0 -190
- package/dist/organizations.mjs +0 -219
- package/dist/persons.d.mts +0 -278
- package/dist/persons.mjs +0 -345
- package/dist/projects.d.mts +0 -269
- package/dist/projects.mjs +0 -287
- package/dist/session-recordings.d.mts +0 -306
- package/dist/session-recordings.mjs +0 -308
- package/dist/surveys.d.mts +0 -232
- package/dist/surveys.mjs +0 -208
- package/dist/webhook-management.d.mts +0 -151
- package/dist/webhook-management.mjs +0 -152
package/dist/annotations.d.mts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/annotations.d.ts
|
|
5
|
-
declare const listAnnotations: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
6
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
search: z.ZodOptional<z.ZodString>;
|
|
9
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
dashboard_item: "dashboard_item";
|
|
11
|
-
project: "project";
|
|
12
|
-
organization: "organization";
|
|
13
|
-
}>>;
|
|
14
|
-
dashboardItemId: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
16
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
-
next: z.ZodNullable<z.ZodString>;
|
|
18
|
-
previous: z.ZodNullable<z.ZodString>;
|
|
19
|
-
count: z.ZodNumber;
|
|
20
|
-
results: z.ZodArray<z.ZodObject<{
|
|
21
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
content: z.ZodOptional<z.ZodString>;
|
|
23
|
-
date_marker: z.ZodOptional<z.ZodString>;
|
|
24
|
-
creation_type: z.ZodOptional<z.ZodString>;
|
|
25
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
26
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
-
insight_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
29
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
30
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
31
|
-
dashboard_item: "dashboard_item";
|
|
32
|
-
project: "project";
|
|
33
|
-
organization: "organization";
|
|
34
|
-
}>>;
|
|
35
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
-
}, z.core.$strip>>;
|
|
37
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
|
|
44
|
-
declare const getAnnotation: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
45
|
-
id: z.ZodNumber;
|
|
46
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
47
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
content: z.ZodOptional<z.ZodString>;
|
|
50
|
-
date_marker: z.ZodOptional<z.ZodString>;
|
|
51
|
-
creation_type: z.ZodOptional<z.ZodString>;
|
|
52
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
53
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
insight_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
56
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
57
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
dashboard_item: "dashboard_item";
|
|
59
|
-
project: "project";
|
|
60
|
-
organization: "organization";
|
|
61
|
-
}>>;
|
|
62
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
64
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
65
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
66
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
67
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
68
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
-
}, z.core.$strip>>], undefined>;
|
|
70
|
-
declare const createAnnotation: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
71
|
-
content: z.ZodString;
|
|
72
|
-
date_marker: z.ZodString;
|
|
73
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
dashboard_item: "dashboard_item";
|
|
75
|
-
project: "project";
|
|
76
|
-
organization: "organization";
|
|
77
|
-
}>>;
|
|
78
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
79
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
82
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
84
|
-
content: z.ZodOptional<z.ZodString>;
|
|
85
|
-
date_marker: z.ZodOptional<z.ZodString>;
|
|
86
|
-
creation_type: z.ZodOptional<z.ZodString>;
|
|
87
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
88
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
|
-
insight_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
91
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
92
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
93
|
-
dashboard_item: "dashboard_item";
|
|
94
|
-
project: "project";
|
|
95
|
-
organization: "organization";
|
|
96
|
-
}>>;
|
|
97
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
99
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
100
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
101
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
102
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
103
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
-
}, z.core.$strip>>], undefined>;
|
|
105
|
-
declare const updateAnnotation: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
106
|
-
content: z.ZodOptional<z.ZodString>;
|
|
107
|
-
date_marker: z.ZodOptional<z.ZodString>;
|
|
108
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
109
|
-
dashboard_item: "dashboard_item";
|
|
110
|
-
project: "project";
|
|
111
|
-
organization: "organization";
|
|
112
|
-
}>>;
|
|
113
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
114
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
-
id: z.ZodNumber;
|
|
117
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
118
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
119
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
120
|
-
content: z.ZodOptional<z.ZodString>;
|
|
121
|
-
date_marker: z.ZodOptional<z.ZodString>;
|
|
122
|
-
creation_type: z.ZodOptional<z.ZodString>;
|
|
123
|
-
dashboard_item: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
124
|
-
insight_short_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
125
|
-
insight_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
126
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
127
|
-
updated_at: z.ZodOptional<z.ZodString>;
|
|
128
|
-
scope: z.ZodOptional<z.ZodEnum<{
|
|
129
|
-
dashboard_item: "dashboard_item";
|
|
130
|
-
project: "project";
|
|
131
|
-
organization: "organization";
|
|
132
|
-
}>>;
|
|
133
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
135
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
136
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
137
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
138
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
139
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
|
-
}, z.core.$strip>>], undefined>;
|
|
141
|
-
declare const deleteAnnotation: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
142
|
-
id: z.ZodNumber;
|
|
143
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
144
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
-
success: z.ZodBoolean;
|
|
146
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
147
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
148
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
149
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
150
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
151
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
152
|
-
}, z.core.$strip>>], undefined>;
|
|
153
|
-
//#endregion
|
|
154
|
-
export { createAnnotation, deleteAnnotation, getAnnotation, listAnnotations, updateAnnotation };
|
package/dist/annotations.mjs
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { createPosthogManagementClient } from "./client.mjs";
|
|
2
|
-
import { annotationSchema, paginatedResponseSchema, projectIdInputShape } from "./schemas.mjs";
|
|
3
|
-
import { t as posthogOperation } from "./factory-D4Ve2fJ-.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/annotations.ts
|
|
7
|
-
/**
|
|
8
|
-
* posthog/annotations.ts
|
|
9
|
-
*
|
|
10
|
-
* Annotation CRUD + activity. Uses the management client.
|
|
11
|
-
*
|
|
12
|
-
* Docs: https://posthog.com/docs/api/annotations
|
|
13
|
-
*/
|
|
14
|
-
const idInput = {
|
|
15
|
-
...projectIdInputShape,
|
|
16
|
-
id: z.number().int()
|
|
17
|
-
};
|
|
18
|
-
const writeShape = {
|
|
19
|
-
content: z.string().optional(),
|
|
20
|
-
date_marker: z.string().optional(),
|
|
21
|
-
scope: z.enum([
|
|
22
|
-
"dashboard_item",
|
|
23
|
-
"project",
|
|
24
|
-
"organization"
|
|
25
|
-
]).optional(),
|
|
26
|
-
dashboard_item: z.number().int().nullable().optional(),
|
|
27
|
-
insight_short_id: z.string().nullable().optional(),
|
|
28
|
-
deleted: z.boolean().optional()
|
|
29
|
-
};
|
|
30
|
-
const listAnnotations = posthogOperation({
|
|
31
|
-
id: "posthog.annotations-list",
|
|
32
|
-
name: "PostHog List Annotations",
|
|
33
|
-
description: "List annotations in a project",
|
|
34
|
-
input: z.object({
|
|
35
|
-
...projectIdInputShape,
|
|
36
|
-
limit: z.number().int().min(1).max(500).optional(),
|
|
37
|
-
offset: z.number().int().min(0).optional(),
|
|
38
|
-
search: z.string().optional(),
|
|
39
|
-
scope: z.enum([
|
|
40
|
-
"dashboard_item",
|
|
41
|
-
"project",
|
|
42
|
-
"organization"
|
|
43
|
-
]).optional(),
|
|
44
|
-
dashboardItemId: z.number().int().optional()
|
|
45
|
-
}),
|
|
46
|
-
output: paginatedResponseSchema(annotationSchema),
|
|
47
|
-
run: async (input, credentials) => {
|
|
48
|
-
const client = createPosthogManagementClient(credentials);
|
|
49
|
-
const projectId = client.projectId(input.projectId);
|
|
50
|
-
return client.request({
|
|
51
|
-
method: "GET",
|
|
52
|
-
path: `/api/projects/${projectId}/annotations/`,
|
|
53
|
-
query: {
|
|
54
|
-
limit: input.limit,
|
|
55
|
-
offset: input.offset,
|
|
56
|
-
search: input.search,
|
|
57
|
-
scope: input.scope,
|
|
58
|
-
dashboardItemId: input.dashboardItemId
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const getAnnotation = posthogOperation({
|
|
64
|
-
id: "posthog.annotations-get",
|
|
65
|
-
name: "PostHog Get Annotation",
|
|
66
|
-
description: "Retrieve an annotation by id",
|
|
67
|
-
input: z.object(idInput),
|
|
68
|
-
output: annotationSchema,
|
|
69
|
-
run: async (input, credentials) => {
|
|
70
|
-
const client = createPosthogManagementClient(credentials);
|
|
71
|
-
const projectId = client.projectId(input.projectId);
|
|
72
|
-
return client.request({
|
|
73
|
-
method: "GET",
|
|
74
|
-
path: `/api/projects/${projectId}/annotations/${input.id}/`
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const createAnnotation = posthogOperation({
|
|
79
|
-
id: "posthog.annotations-create",
|
|
80
|
-
name: "PostHog Create Annotation",
|
|
81
|
-
description: "Create a new annotation",
|
|
82
|
-
input: z.object({
|
|
83
|
-
...projectIdInputShape,
|
|
84
|
-
...writeShape,
|
|
85
|
-
content: z.string().min(1),
|
|
86
|
-
date_marker: z.string().min(1)
|
|
87
|
-
}),
|
|
88
|
-
output: annotationSchema,
|
|
89
|
-
needsApproval: true,
|
|
90
|
-
run: async (input, credentials) => {
|
|
91
|
-
const client = createPosthogManagementClient(credentials);
|
|
92
|
-
const projectId = client.projectId(input.projectId);
|
|
93
|
-
const { projectId: _pid, ...body } = input;
|
|
94
|
-
return client.request({
|
|
95
|
-
method: "POST",
|
|
96
|
-
path: `/api/projects/${projectId}/annotations/`,
|
|
97
|
-
body
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const updateAnnotation = posthogOperation({
|
|
102
|
-
id: "posthog.annotations-update",
|
|
103
|
-
name: "PostHog Update Annotation",
|
|
104
|
-
description: "Partial update to an annotation",
|
|
105
|
-
input: z.object({
|
|
106
|
-
...idInput,
|
|
107
|
-
...writeShape
|
|
108
|
-
}),
|
|
109
|
-
output: annotationSchema,
|
|
110
|
-
needsApproval: true,
|
|
111
|
-
run: async (input, credentials) => {
|
|
112
|
-
const client = createPosthogManagementClient(credentials);
|
|
113
|
-
const projectId = client.projectId(input.projectId);
|
|
114
|
-
const { projectId: _pid, id, ...body } = input;
|
|
115
|
-
return client.request({
|
|
116
|
-
method: "PATCH",
|
|
117
|
-
path: `/api/projects/${projectId}/annotations/${id}/`,
|
|
118
|
-
body
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
const deleteAnnotation = posthogOperation({
|
|
123
|
-
id: "posthog.annotations-delete",
|
|
124
|
-
name: "PostHog Delete Annotation",
|
|
125
|
-
description: "Delete an annotation",
|
|
126
|
-
input: z.object(idInput),
|
|
127
|
-
output: z.object({ success: z.boolean() }),
|
|
128
|
-
needsApproval: true,
|
|
129
|
-
run: async (input, credentials) => {
|
|
130
|
-
const client = createPosthogManagementClient(credentials);
|
|
131
|
-
const projectId = client.projectId(input.projectId);
|
|
132
|
-
await client.request({
|
|
133
|
-
method: "DELETE",
|
|
134
|
-
path: `/api/projects/${projectId}/annotations/${input.id}/`
|
|
135
|
-
});
|
|
136
|
-
return { success: true };
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
//#endregion
|
|
141
|
-
export { createAnnotation, deleteAnnotation, getAnnotation, listAnnotations, updateAnnotation };
|
package/dist/capture.d.mts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/capture.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Capture a single analytics event.
|
|
7
|
-
* Maps Sim archive tool S1 (`posthog_capture_event`).
|
|
8
|
-
*/
|
|
9
|
-
declare const captureEvent: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
10
|
-
event: z.ZodString;
|
|
11
|
-
distinctId: z.ZodString;
|
|
12
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
13
|
-
uuid: z.ZodOptional<z.ZodString>;
|
|
14
|
-
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
15
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
17
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
18
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
19
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
20
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
21
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
22
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
-
}, z.core.$strip>>], undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* Capture a batch of analytics events in one request.
|
|
26
|
-
* Maps Sim archive tool S2 (`posthog_capture_batch_events`).
|
|
27
|
-
*/
|
|
28
|
-
declare const captureBatch: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
29
|
-
events: z.ZodArray<z.ZodObject<{
|
|
30
|
-
event: z.ZodString;
|
|
31
|
-
distinct_id: z.ZodString;
|
|
32
|
-
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
33
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
34
|
-
uuid: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, z.core.$strip>>;
|
|
36
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
38
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
|
|
45
|
-
/**
|
|
46
|
-
* Identify a person — associates distinct_id with a set of properties.
|
|
47
|
-
* Maps Sim archive tool S3 (`posthog_identify_person`).
|
|
48
|
-
*/
|
|
49
|
-
declare const identifyPerson: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
50
|
-
distinctId: z.ZodString;
|
|
51
|
-
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
52
|
-
propertiesOnce: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
53
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
54
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
56
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
57
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
58
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
59
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
60
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
61
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
-
}, z.core.$strip>>], undefined>;
|
|
63
|
-
/**
|
|
64
|
-
* Alias a distinct_id to an existing user.
|
|
65
|
-
* Maps Sim archive tool S4 (`posthog_alias_person`).
|
|
66
|
-
*/
|
|
67
|
-
declare const aliasPerson: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
68
|
-
distinctId: z.ZodString;
|
|
69
|
-
alias: z.ZodString;
|
|
70
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
71
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
73
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
74
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
75
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
76
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
77
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
78
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
79
|
-
}, z.core.$strip>>], undefined>;
|
|
80
|
-
/**
|
|
81
|
-
* Identify a group (multi-tenant properties).
|
|
82
|
-
* Maps Sim archive tool S5 (`posthog_group_identify`).
|
|
83
|
-
*/
|
|
84
|
-
declare const groupIdentify: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
85
|
-
distinctId: z.ZodString;
|
|
86
|
-
groupType: z.ZodString;
|
|
87
|
-
groupKey: z.ZodString;
|
|
88
|
-
groupProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
89
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
90
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
92
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
93
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
94
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
95
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
96
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
97
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
98
|
-
}, z.core.$strip>>], undefined>;
|
|
99
|
-
/**
|
|
100
|
-
* Set person properties (overwrites prior values).
|
|
101
|
-
* Maps Sim archive tool S6 (`posthog_set_person_properties`).
|
|
102
|
-
*/
|
|
103
|
-
declare const setPersonProperties: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
104
|
-
distinctId: z.ZodString;
|
|
105
|
-
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
106
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
107
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
109
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
110
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
111
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
112
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
113
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
114
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
-
}, z.core.$strip>>], undefined>;
|
|
116
|
-
/**
|
|
117
|
-
* Set person properties only if not already set.
|
|
118
|
-
* Maps Sim archive tool S7 (`posthog_set_person_properties_once`).
|
|
119
|
-
*/
|
|
120
|
-
declare const setPersonPropertiesOnce: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
121
|
-
distinctId: z.ZodString;
|
|
122
|
-
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
123
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
124
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
125
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<"ok">, z.ZodNumber, z.ZodString]>>;
|
|
126
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
127
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
128
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
129
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
130
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
131
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
|
-
}, z.core.$strip>>], undefined>;
|
|
133
|
-
//#endregion
|
|
134
|
-
export { aliasPerson, captureBatch, captureEvent, groupIdentify, identifyPerson, setPersonProperties, setPersonPropertiesOnce };
|
package/dist/capture.mjs
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { createPosthogIngestClient } from "./client.mjs";
|
|
2
|
-
import { captureResponseSchema, propertiesBagSchema } from "./schemas.mjs";
|
|
3
|
-
import { t as posthogOperation } from "./factory-D4Ve2fJ-.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/capture.ts
|
|
7
|
-
/**
|
|
8
|
-
* posthog/capture.ts
|
|
9
|
-
*
|
|
10
|
-
* Ingest operations — single event, batch capture, identify, alias, group
|
|
11
|
-
* identify, set person properties, set person properties once. All require
|
|
12
|
-
* the project API key on the credential set (not the personal API key).
|
|
13
|
-
*
|
|
14
|
-
* Docs: https://posthog.com/docs/api/capture
|
|
15
|
-
*/
|
|
16
|
-
const eventNameInput = {
|
|
17
|
-
event: z.string().min(1),
|
|
18
|
-
distinctId: z.string().min(1),
|
|
19
|
-
timestamp: z.iso.datetime().optional(),
|
|
20
|
-
uuid: z.string().optional(),
|
|
21
|
-
properties: propertiesBagSchema.optional()
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Capture a single analytics event.
|
|
25
|
-
* Maps Sim archive tool S1 (`posthog_capture_event`).
|
|
26
|
-
*/
|
|
27
|
-
const captureEvent = posthogOperation({
|
|
28
|
-
id: "posthog.capture-event",
|
|
29
|
-
name: "PostHog Capture Event",
|
|
30
|
-
description: "Capture a single analytics event via the PostHog /capture endpoint",
|
|
31
|
-
input: z.object(eventNameInput),
|
|
32
|
-
output: captureResponseSchema,
|
|
33
|
-
needsApproval: true,
|
|
34
|
-
run: async (input, credentials) => {
|
|
35
|
-
const client = createPosthogIngestClient(credentials);
|
|
36
|
-
return client.request({
|
|
37
|
-
method: "POST",
|
|
38
|
-
path: "/capture/",
|
|
39
|
-
body: {
|
|
40
|
-
api_key: client.projectApiKey(),
|
|
41
|
-
event: input.event,
|
|
42
|
-
distinct_id: input.distinctId,
|
|
43
|
-
...input.properties ? { properties: input.properties } : {},
|
|
44
|
-
...input.timestamp ? { timestamp: input.timestamp } : {},
|
|
45
|
-
...input.uuid ? { uuid: input.uuid } : {}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
/**
|
|
51
|
-
* Capture a batch of analytics events in one request.
|
|
52
|
-
* Maps Sim archive tool S2 (`posthog_capture_batch_events`).
|
|
53
|
-
*/
|
|
54
|
-
const captureBatch = posthogOperation({
|
|
55
|
-
id: "posthog.capture-batch-events",
|
|
56
|
-
name: "PostHog Capture Batch",
|
|
57
|
-
description: "Capture up to 100 analytics events via the PostHog /batch endpoint",
|
|
58
|
-
input: z.object({ events: z.array(z.object({
|
|
59
|
-
event: z.string().min(1),
|
|
60
|
-
distinct_id: z.string().min(1),
|
|
61
|
-
properties: propertiesBagSchema.optional(),
|
|
62
|
-
timestamp: z.iso.datetime().optional(),
|
|
63
|
-
uuid: z.string().optional()
|
|
64
|
-
})).min(1) }),
|
|
65
|
-
output: captureResponseSchema,
|
|
66
|
-
needsApproval: true,
|
|
67
|
-
run: async (input, credentials) => {
|
|
68
|
-
const client = createPosthogIngestClient(credentials);
|
|
69
|
-
return client.request({
|
|
70
|
-
method: "POST",
|
|
71
|
-
path: "/batch/",
|
|
72
|
-
body: {
|
|
73
|
-
api_key: client.projectApiKey(),
|
|
74
|
-
batch: input.events
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
/**
|
|
80
|
-
* Identify a person — associates distinct_id with a set of properties.
|
|
81
|
-
* Maps Sim archive tool S3 (`posthog_identify_person`).
|
|
82
|
-
*/
|
|
83
|
-
const identifyPerson = posthogOperation({
|
|
84
|
-
id: "posthog.identify-person",
|
|
85
|
-
name: "PostHog Identify Person",
|
|
86
|
-
description: "Associate a distinct_id with person properties via a $identify event",
|
|
87
|
-
input: z.object({
|
|
88
|
-
distinctId: z.string().min(1),
|
|
89
|
-
properties: propertiesBagSchema.optional(),
|
|
90
|
-
propertiesOnce: propertiesBagSchema.optional(),
|
|
91
|
-
timestamp: z.iso.datetime().optional()
|
|
92
|
-
}),
|
|
93
|
-
output: captureResponseSchema,
|
|
94
|
-
needsApproval: true,
|
|
95
|
-
run: async (input, credentials) => {
|
|
96
|
-
const client = createPosthogIngestClient(credentials);
|
|
97
|
-
const properties = {};
|
|
98
|
-
if (input.properties) properties.$set = input.properties;
|
|
99
|
-
if (input.propertiesOnce) properties.$set_once = input.propertiesOnce;
|
|
100
|
-
return client.request({
|
|
101
|
-
method: "POST",
|
|
102
|
-
path: "/capture/",
|
|
103
|
-
body: {
|
|
104
|
-
api_key: client.projectApiKey(),
|
|
105
|
-
event: "$identify",
|
|
106
|
-
distinct_id: input.distinctId,
|
|
107
|
-
properties,
|
|
108
|
-
...input.timestamp ? { timestamp: input.timestamp } : {}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
/**
|
|
114
|
-
* Alias a distinct_id to an existing user.
|
|
115
|
-
* Maps Sim archive tool S4 (`posthog_alias_person`).
|
|
116
|
-
*/
|
|
117
|
-
const aliasPerson = posthogOperation({
|
|
118
|
-
id: "posthog.alias-person",
|
|
119
|
-
name: "PostHog Alias Person",
|
|
120
|
-
description: "Merge one distinct_id into another via a $create_alias event",
|
|
121
|
-
input: z.object({
|
|
122
|
-
distinctId: z.string().min(1),
|
|
123
|
-
alias: z.string().min(1),
|
|
124
|
-
timestamp: z.iso.datetime().optional()
|
|
125
|
-
}),
|
|
126
|
-
output: captureResponseSchema,
|
|
127
|
-
needsApproval: true,
|
|
128
|
-
run: async (input, credentials) => {
|
|
129
|
-
const client = createPosthogIngestClient(credentials);
|
|
130
|
-
return client.request({
|
|
131
|
-
method: "POST",
|
|
132
|
-
path: "/capture/",
|
|
133
|
-
body: {
|
|
134
|
-
api_key: client.projectApiKey(),
|
|
135
|
-
event: "$create_alias",
|
|
136
|
-
distinct_id: input.distinctId,
|
|
137
|
-
properties: { alias: input.alias },
|
|
138
|
-
...input.timestamp ? { timestamp: input.timestamp } : {}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
/**
|
|
144
|
-
* Identify a group (multi-tenant properties).
|
|
145
|
-
* Maps Sim archive tool S5 (`posthog_group_identify`).
|
|
146
|
-
*/
|
|
147
|
-
const groupIdentify = posthogOperation({
|
|
148
|
-
id: "posthog.group-identify",
|
|
149
|
-
name: "PostHog Group Identify",
|
|
150
|
-
description: "Attach properties to a group (organization, project, etc.) via $groupidentify",
|
|
151
|
-
input: z.object({
|
|
152
|
-
distinctId: z.string().min(1),
|
|
153
|
-
groupType: z.string().min(1),
|
|
154
|
-
groupKey: z.string().min(1),
|
|
155
|
-
groupProperties: propertiesBagSchema.optional(),
|
|
156
|
-
timestamp: z.iso.datetime().optional()
|
|
157
|
-
}),
|
|
158
|
-
output: captureResponseSchema,
|
|
159
|
-
needsApproval: true,
|
|
160
|
-
run: async (input, credentials) => {
|
|
161
|
-
const client = createPosthogIngestClient(credentials);
|
|
162
|
-
return client.request({
|
|
163
|
-
method: "POST",
|
|
164
|
-
path: "/capture/",
|
|
165
|
-
body: {
|
|
166
|
-
api_key: client.projectApiKey(),
|
|
167
|
-
event: "$groupidentify",
|
|
168
|
-
distinct_id: input.distinctId,
|
|
169
|
-
properties: {
|
|
170
|
-
$group_type: input.groupType,
|
|
171
|
-
$group_key: input.groupKey,
|
|
172
|
-
$group_set: input.groupProperties ?? {}
|
|
173
|
-
},
|
|
174
|
-
...input.timestamp ? { timestamp: input.timestamp } : {}
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
/**
|
|
180
|
-
* Set person properties (overwrites prior values).
|
|
181
|
-
* Maps Sim archive tool S6 (`posthog_set_person_properties`).
|
|
182
|
-
*/
|
|
183
|
-
const setPersonProperties = posthogOperation({
|
|
184
|
-
id: "posthog.set-person-properties",
|
|
185
|
-
name: "PostHog Set Person Properties",
|
|
186
|
-
description: "Set (overwrite) properties on a person via a $set event",
|
|
187
|
-
input: z.object({
|
|
188
|
-
distinctId: z.string().min(1),
|
|
189
|
-
properties: propertiesBagSchema,
|
|
190
|
-
timestamp: z.iso.datetime().optional()
|
|
191
|
-
}),
|
|
192
|
-
output: captureResponseSchema,
|
|
193
|
-
needsApproval: true,
|
|
194
|
-
run: async (input, credentials) => {
|
|
195
|
-
const client = createPosthogIngestClient(credentials);
|
|
196
|
-
return client.request({
|
|
197
|
-
method: "POST",
|
|
198
|
-
path: "/capture/",
|
|
199
|
-
body: {
|
|
200
|
-
api_key: client.projectApiKey(),
|
|
201
|
-
event: "$set",
|
|
202
|
-
distinct_id: input.distinctId,
|
|
203
|
-
properties: { $set: input.properties },
|
|
204
|
-
...input.timestamp ? { timestamp: input.timestamp } : {}
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
/**
|
|
210
|
-
* Set person properties only if not already set.
|
|
211
|
-
* Maps Sim archive tool S7 (`posthog_set_person_properties_once`).
|
|
212
|
-
*/
|
|
213
|
-
const setPersonPropertiesOnce = posthogOperation({
|
|
214
|
-
id: "posthog.set-person-properties-once",
|
|
215
|
-
name: "PostHog Set Person Properties Once",
|
|
216
|
-
description: "Set properties on a person only if not already set ($set_once)",
|
|
217
|
-
input: z.object({
|
|
218
|
-
distinctId: z.string().min(1),
|
|
219
|
-
properties: propertiesBagSchema,
|
|
220
|
-
timestamp: z.iso.datetime().optional()
|
|
221
|
-
}),
|
|
222
|
-
output: captureResponseSchema,
|
|
223
|
-
needsApproval: true,
|
|
224
|
-
run: async (input, credentials) => {
|
|
225
|
-
const client = createPosthogIngestClient(credentials);
|
|
226
|
-
return client.request({
|
|
227
|
-
method: "POST",
|
|
228
|
-
path: "/capture/",
|
|
229
|
-
body: {
|
|
230
|
-
api_key: client.projectApiKey(),
|
|
231
|
-
event: "$set",
|
|
232
|
-
distinct_id: input.distinctId,
|
|
233
|
-
properties: { $set_once: input.properties },
|
|
234
|
-
...input.timestamp ? { timestamp: input.timestamp } : {}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
//#endregion
|
|
241
|
-
export { aliasPerson, captureBatch, captureEvent, groupIdentify, identifyPerson, setPersonProperties, setPersonPropertiesOnce };
|