@keystrokehq/posthog 0.0.15 → 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/{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 +16 -88
- 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
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { IntegrationTriggerBindingOptions, createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
|
|
1
|
+
import { n as posthogCredentialSet } from "../posthog.credential-set-C8TimFgo.mjs";
|
|
4
2
|
import { BoundTrigger } from "@keystrokehq/core";
|
|
3
|
+
import { z } from "zod";
|
|
5
4
|
import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
|
|
6
5
|
|
|
7
|
-
//#region
|
|
8
|
-
|
|
6
|
+
//#region ../../packages/integration-authoring/dist/index.d.mts
|
|
7
|
+
declare function createPollingTriggerBindingFactory(config: any): (options: any) => any;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/triggers/index.d.ts
|
|
10
|
+
type PosthogCredentialSets = readonly [typeof posthogCredentialSet];
|
|
9
11
|
type Schedule = Parameters<typeof createPollingTriggerBindingFactory>[0]['schedule'];
|
|
10
12
|
type PosthogPollingBoundTrigger<TResponse extends z.ZodTypeAny, TOutput = z.output<TResponse>> = BoundTrigger<z.output<TResponse>, PosthogCredentialSets, PollingTriggerManifest, TOutput>;
|
|
11
13
|
interface PosthogPollingBindingOptions<TResponse extends z.ZodTypeAny, TOutput = z.output<TResponse>> extends IntegrationTriggerBindingOptions<z.output<TResponse>, TOutput> {
|
|
@@ -1,22 +1,70 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { createPosthogManagementClient } from "
|
|
1
|
+
import { t as posthogCredentialSet } from "../posthog.credential-set-DwYnDkeD.mjs";
|
|
2
|
+
import { r as createPosthogManagementClient } from "../client-BZWd9-On.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { pollingTrigger } from "@keystrokehq/core/trigger";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../../packages/integration-authoring/dist/index.mjs
|
|
7
|
+
const IntegrationConfigSchema = z.object({
|
|
8
|
+
id: z.string().min(1),
|
|
9
|
+
name: z.string().min(1),
|
|
10
|
+
description: z.string().optional()
|
|
11
|
+
});
|
|
12
|
+
function resolveMetadata(metadata, defaults) {
|
|
13
|
+
return {
|
|
14
|
+
id: metadata?.id ?? defaults.defaultId,
|
|
15
|
+
description: metadata?.description ?? defaults.defaultDescription
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function resolveAuthorPayload(payload, mapPayload) {
|
|
19
|
+
if (!mapPayload) return payload;
|
|
20
|
+
return mapPayload(payload);
|
|
21
|
+
}
|
|
22
|
+
function createIntegrationTriggerBindingFactory(config) {
|
|
23
|
+
const bind = (options) => {
|
|
24
|
+
const resolvedMetadata = resolveMetadata(options, config);
|
|
25
|
+
const baseTrigger = config.createBaseTrigger(resolvedMetadata);
|
|
26
|
+
const userTransform = options?.transform;
|
|
27
|
+
return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
|
|
28
|
+
const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
|
|
29
|
+
if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
|
|
30
|
+
if (!userTransform) return authorPayload;
|
|
31
|
+
return userTransform(authorPayload, request);
|
|
32
|
+
} : void 0 });
|
|
33
|
+
};
|
|
34
|
+
return Object.freeze(bind);
|
|
35
|
+
}
|
|
36
|
+
function createPollingTriggerBindingFactory(config) {
|
|
37
|
+
return createIntegrationTriggerBindingFactory({
|
|
38
|
+
defaultId: config.defaultId,
|
|
39
|
+
defaultDescription: config.defaultDescription,
|
|
40
|
+
mapPayload: config.mapPayload,
|
|
41
|
+
createBaseTrigger: (metadata) => pollingTrigger({
|
|
42
|
+
id: metadata.id,
|
|
43
|
+
description: metadata.description,
|
|
44
|
+
schedule: config.schedule,
|
|
45
|
+
response: config.response,
|
|
46
|
+
poll: config.poll,
|
|
47
|
+
...config.credentialSets ? { credentialSets: config.credentialSets } : {},
|
|
48
|
+
...config.filter ? { filter: config.filter } : {}
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/triggers/index.ts
|
|
7
55
|
function withDefaultSchedule(schedule) {
|
|
8
56
|
if (schedule === void 0) return "1m";
|
|
9
57
|
return schedule;
|
|
10
58
|
}
|
|
11
59
|
function extractCredentials(ctx) {
|
|
12
|
-
return ctx.credentials
|
|
60
|
+
return ctx.credentials.posthog;
|
|
13
61
|
}
|
|
14
62
|
function createPosthogPollingBindingFactory(config) {
|
|
15
63
|
return createPollingTriggerBindingFactory({
|
|
16
64
|
defaultId: config.defaultId,
|
|
17
65
|
defaultDescription: config.defaultDescription,
|
|
18
66
|
schedule: withDefaultSchedule(config.schedule),
|
|
19
|
-
credentialSets: [
|
|
67
|
+
credentialSets: [posthogCredentialSet],
|
|
20
68
|
response: config.responseSchema,
|
|
21
69
|
poll: async (ctx) => {
|
|
22
70
|
const creds = extractCredentials(ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystrokehq/posthog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16-integration-id-canonicalization.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -9,93 +9,21 @@
|
|
|
9
9
|
"types": "./dist/index.d.mts",
|
|
10
10
|
"default": "./dist/index.mjs"
|
|
11
11
|
},
|
|
12
|
-
"./
|
|
13
|
-
"types": "./dist/
|
|
14
|
-
"default": "./dist/
|
|
12
|
+
"./credential-sets": {
|
|
13
|
+
"types": "./dist/credential-sets/index.d.mts",
|
|
14
|
+
"default": "./dist/credential-sets/index.mjs"
|
|
15
15
|
},
|
|
16
|
-
"./
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"default": "./dist/
|
|
19
|
-
},
|
|
20
|
-
"./errors": {
|
|
21
|
-
"types": "./dist/errors.d.mts",
|
|
22
|
-
"default": "./dist/errors.mjs"
|
|
16
|
+
"./operations": {
|
|
17
|
+
"types": "./dist/operations/index.d.mts",
|
|
18
|
+
"default": "./dist/operations/index.mjs"
|
|
23
19
|
},
|
|
24
20
|
"./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"
|
|
21
|
+
"types": "./dist/schemas/index.d.mts",
|
|
22
|
+
"default": "./dist/schemas/index.mjs"
|
|
31
23
|
},
|
|
32
24
|
"./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"
|
|
25
|
+
"types": "./dist/triggers/index.d.mts",
|
|
26
|
+
"default": "./dist/triggers/index.mjs"
|
|
99
27
|
}
|
|
100
28
|
},
|
|
101
29
|
"files": [
|
|
@@ -104,20 +32,20 @@
|
|
|
104
32
|
"LICENSE"
|
|
105
33
|
],
|
|
106
34
|
"dependencies": {
|
|
107
|
-
"@keystrokehq/integration-authoring": "^0.0.9",
|
|
108
35
|
"zod": "^4.3.6"
|
|
109
36
|
},
|
|
110
37
|
"peerDependencies": {
|
|
111
|
-
"@keystrokehq/core": ">=0.0.
|
|
38
|
+
"@keystrokehq/core": ">=0.0.8 <0.1.0"
|
|
112
39
|
},
|
|
113
40
|
"devDependencies": {
|
|
114
41
|
"@types/node": "^22.19.11",
|
|
115
42
|
"tsdown": "^0.20.3",
|
|
116
43
|
"typescript": "^5.9.3",
|
|
117
44
|
"vitest": "^4.0.18",
|
|
118
|
-
"@keystrokehq/core": "^0.0.
|
|
119
|
-
"@keystrokehq/
|
|
120
|
-
"@keystrokehq/
|
|
45
|
+
"@keystrokehq/core": "^0.0.12",
|
|
46
|
+
"@keystrokehq/typescript-config": "0.0.0",
|
|
47
|
+
"@keystrokehq/integration-authoring": "0.0.9",
|
|
48
|
+
"@keystrokehq/test-utils": "0.0.0"
|
|
121
49
|
},
|
|
122
50
|
"keywords": [
|
|
123
51
|
"posthog",
|
package/dist/_official/index.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { n as posthog } from "../integration-Dv7fVIxG.mjs";
|
|
2
|
-
import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
|
|
3
|
-
|
|
4
|
-
//#region src/factory.d.ts
|
|
5
|
-
declare const posthogOperation: ReturnType<typeof createOfficialOperationFactory<typeof posthog>>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { posthogOperation };
|
package/dist/_runtime/index.mjs
DELETED
package/dist/actions.d.mts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/actions.d.ts
|
|
5
|
-
declare const listActions: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
6
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
|
-
search: z.ZodOptional<z.ZodString>;
|
|
9
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
10
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
-
next: z.ZodNullable<z.ZodString>;
|
|
12
|
-
previous: z.ZodNullable<z.ZodString>;
|
|
13
|
-
count: z.ZodNumber;
|
|
14
|
-
results: z.ZodArray<z.ZodObject<{
|
|
15
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
24
|
-
contains: "contains";
|
|
25
|
-
regex: "regex";
|
|
26
|
-
exact: "exact";
|
|
27
|
-
}>>>;
|
|
28
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
32
|
-
}, z.core.$strip>>>;
|
|
33
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
34
|
-
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
35
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
-
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
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
|
-
declare const getAction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
46
|
-
id: z.ZodNumber;
|
|
47
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
48
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
50
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
58
|
-
contains: "contains";
|
|
59
|
-
regex: "regex";
|
|
60
|
-
exact: "exact";
|
|
61
|
-
}>>>;
|
|
62
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
66
|
-
}, z.core.$strip>>>;
|
|
67
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
68
|
-
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
69
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
-
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
72
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
73
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
74
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
75
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
76
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
-
}, z.core.$strip>>], undefined>;
|
|
78
|
-
declare const createAction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
79
|
-
name: z.ZodString;
|
|
80
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
82
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
85
|
-
contains: "contains";
|
|
86
|
-
regex: "regex";
|
|
87
|
-
exact: "exact";
|
|
88
|
-
}>>>;
|
|
89
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
93
|
-
}, z.core.$strip>>>;
|
|
94
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
96
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
98
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
100
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
101
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
105
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
108
|
-
contains: "contains";
|
|
109
|
-
regex: "regex";
|
|
110
|
-
exact: "exact";
|
|
111
|
-
}>>>;
|
|
112
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
116
|
-
}, z.core.$strip>>>;
|
|
117
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
118
|
-
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
119
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
-
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
122
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
123
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
124
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
125
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
126
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
-
}, z.core.$strip>>], undefined>;
|
|
128
|
-
declare const updateAction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
129
|
-
name: z.ZodOptional<z.ZodString>;
|
|
130
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
131
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
135
|
-
contains: "contains";
|
|
136
|
-
regex: "regex";
|
|
137
|
-
exact: "exact";
|
|
138
|
-
}>>>;
|
|
139
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
140
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
143
|
-
}, z.core.$strip>>>;
|
|
144
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
146
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
-
id: z.ZodNumber;
|
|
148
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
149
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
151
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
156
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
157
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
158
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
159
|
-
contains: "contains";
|
|
160
|
-
regex: "regex";
|
|
161
|
-
exact: "exact";
|
|
162
|
-
}>>>;
|
|
163
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
166
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
167
|
-
}, z.core.$strip>>>;
|
|
168
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
169
|
-
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
170
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
-
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
173
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
174
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
175
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
176
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
177
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
178
|
-
}, z.core.$strip>>], undefined>;
|
|
179
|
-
declare const deleteAction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
180
|
-
id: z.ZodNumber;
|
|
181
|
-
projectId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
182
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
183
|
-
id: z.ZodOptional<z.ZodNumber>;
|
|
184
|
-
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
185
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
-
post_to_slack: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
-
slack_message_format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
-
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
189
|
-
event: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
190
|
-
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
191
|
-
url_matching: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
192
|
-
contains: "contains";
|
|
193
|
-
regex: "regex";
|
|
194
|
-
exact: "exact";
|
|
195
|
-
}>>>;
|
|
196
|
-
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
197
|
-
href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
|
-
selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
199
|
-
properties: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
200
|
-
}, z.core.$strip>>>;
|
|
201
|
-
created_at: z.ZodOptional<z.ZodString>;
|
|
202
|
-
created_by: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
203
|
-
deleted: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
-
is_calculating: z.ZodOptional<z.ZodBoolean>;
|
|
205
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:posthog", z.ZodObject<{
|
|
206
|
-
POSTHOG_PERSONAL_API_KEY: z.ZodString;
|
|
207
|
-
POSTHOG_PROJECT_API_KEY: z.ZodOptional<z.ZodString>;
|
|
208
|
-
POSTHOG_HOST: z.ZodDefault<z.ZodURL>;
|
|
209
|
-
POSTHOG_PROJECT_ID: z.ZodOptional<z.ZodString>;
|
|
210
|
-
POSTHOG_SCOPES: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
-
}, z.core.$strip>>], undefined>;
|
|
212
|
-
//#endregion
|
|
213
|
-
export { createAction, deleteAction, getAction, listActions, updateAction };
|
package/dist/actions.mjs
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { createPosthogManagementClient } from "./client.mjs";
|
|
2
|
-
import { actionSchema, actionStepSchema, paginatedResponseSchema, projectIdInputShape } from "./schemas.mjs";
|
|
3
|
-
import { t as posthogOperation } from "./factory-D4Ve2fJ-.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/actions.ts
|
|
7
|
-
/**
|
|
8
|
-
* posthog/actions.ts
|
|
9
|
-
*
|
|
10
|
-
* Action CRUD. Actions are reusable event matchers used by dashboards,
|
|
11
|
-
* funnels, and Slack notifications.
|
|
12
|
-
*
|
|
13
|
-
* Docs: https://posthog.com/docs/api/actions
|
|
14
|
-
*/
|
|
15
|
-
const idInput = {
|
|
16
|
-
...projectIdInputShape,
|
|
17
|
-
id: z.number().int()
|
|
18
|
-
};
|
|
19
|
-
const writeShape = {
|
|
20
|
-
name: z.string().optional(),
|
|
21
|
-
description: z.string().nullable().optional(),
|
|
22
|
-
steps: z.array(actionStepSchema).optional(),
|
|
23
|
-
post_to_slack: z.boolean().optional(),
|
|
24
|
-
slack_message_format: z.string().nullable().optional(),
|
|
25
|
-
deleted: z.boolean().optional()
|
|
26
|
-
};
|
|
27
|
-
const listActions = posthogOperation({
|
|
28
|
-
id: "posthog.actions-list",
|
|
29
|
-
name: "PostHog List Actions",
|
|
30
|
-
description: "List actions in a project",
|
|
31
|
-
input: z.object({
|
|
32
|
-
...projectIdInputShape,
|
|
33
|
-
limit: z.number().int().min(1).max(500).optional(),
|
|
34
|
-
offset: z.number().int().min(0).optional(),
|
|
35
|
-
search: z.string().optional()
|
|
36
|
-
}),
|
|
37
|
-
output: paginatedResponseSchema(actionSchema),
|
|
38
|
-
run: async (input, credentials) => {
|
|
39
|
-
const client = createPosthogManagementClient(credentials);
|
|
40
|
-
const projectId = client.projectId(input.projectId);
|
|
41
|
-
return client.request({
|
|
42
|
-
method: "GET",
|
|
43
|
-
path: `/api/projects/${projectId}/actions/`,
|
|
44
|
-
query: {
|
|
45
|
-
limit: input.limit,
|
|
46
|
-
offset: input.offset,
|
|
47
|
-
search: input.search
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const getAction = posthogOperation({
|
|
53
|
-
id: "posthog.actions-get",
|
|
54
|
-
name: "PostHog Get Action",
|
|
55
|
-
description: "Retrieve an action by id",
|
|
56
|
-
input: z.object(idInput),
|
|
57
|
-
output: actionSchema,
|
|
58
|
-
run: async (input, credentials) => {
|
|
59
|
-
const client = createPosthogManagementClient(credentials);
|
|
60
|
-
const projectId = client.projectId(input.projectId);
|
|
61
|
-
return client.request({
|
|
62
|
-
method: "GET",
|
|
63
|
-
path: `/api/projects/${projectId}/actions/${input.id}/`
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const createAction = posthogOperation({
|
|
68
|
-
id: "posthog.actions-create",
|
|
69
|
-
name: "PostHog Create Action",
|
|
70
|
-
description: "Create a new action",
|
|
71
|
-
input: z.object({
|
|
72
|
-
...projectIdInputShape,
|
|
73
|
-
...writeShape,
|
|
74
|
-
name: z.string().min(1)
|
|
75
|
-
}),
|
|
76
|
-
output: actionSchema,
|
|
77
|
-
needsApproval: true,
|
|
78
|
-
run: async (input, credentials) => {
|
|
79
|
-
const client = createPosthogManagementClient(credentials);
|
|
80
|
-
const projectId = client.projectId(input.projectId);
|
|
81
|
-
const { projectId: _pid, ...body } = input;
|
|
82
|
-
return client.request({
|
|
83
|
-
method: "POST",
|
|
84
|
-
path: `/api/projects/${projectId}/actions/`,
|
|
85
|
-
body
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const updateAction = posthogOperation({
|
|
90
|
-
id: "posthog.actions-update",
|
|
91
|
-
name: "PostHog Update Action",
|
|
92
|
-
description: "Partial update to an action",
|
|
93
|
-
input: z.object({
|
|
94
|
-
...idInput,
|
|
95
|
-
...writeShape
|
|
96
|
-
}),
|
|
97
|
-
output: actionSchema,
|
|
98
|
-
needsApproval: true,
|
|
99
|
-
run: async (input, credentials) => {
|
|
100
|
-
const client = createPosthogManagementClient(credentials);
|
|
101
|
-
const projectId = client.projectId(input.projectId);
|
|
102
|
-
const { projectId: _pid, id, ...body } = input;
|
|
103
|
-
return client.request({
|
|
104
|
-
method: "PATCH",
|
|
105
|
-
path: `/api/projects/${projectId}/actions/${id}/`,
|
|
106
|
-
body
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const deleteAction = posthogOperation({
|
|
111
|
-
id: "posthog.actions-delete",
|
|
112
|
-
name: "PostHog Delete Action",
|
|
113
|
-
description: "Soft-delete an action",
|
|
114
|
-
input: z.object(idInput),
|
|
115
|
-
output: actionSchema,
|
|
116
|
-
needsApproval: true,
|
|
117
|
-
run: async (input, credentials) => {
|
|
118
|
-
const client = createPosthogManagementClient(credentials);
|
|
119
|
-
const projectId = client.projectId(input.projectId);
|
|
120
|
-
return client.request({
|
|
121
|
-
method: "PATCH",
|
|
122
|
-
path: `/api/projects/${projectId}/actions/${input.id}/`,
|
|
123
|
-
body: { deleted: true }
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
//#endregion
|
|
129
|
-
export { createAction, deleteAction, getAction, listActions, updateAction };
|