@corsair-dev/amplitude 0.1.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/LICENSE +191 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/endpoints/annotations.d.ts +4 -0
- package/dist/endpoints/annotations.d.ts.map +1 -0
- package/dist/endpoints/charts.d.ts +3 -0
- package/dist/endpoints/charts.d.ts.map +1 -0
- package/dist/endpoints/cohorts.d.ts +6 -0
- package/dist/endpoints/cohorts.d.ts.map +1 -0
- package/dist/endpoints/dashboards.d.ts +4 -0
- package/dist/endpoints/dashboards.d.ts.map +1 -0
- package/dist/endpoints/events.d.ts +6 -0
- package/dist/endpoints/events.d.ts.map +1 -0
- package/dist/endpoints/exports.d.ts +3 -0
- package/dist/endpoints/exports.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +295 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/types.d.ts +2411 -0
- package/dist/endpoints/types.d.ts.map +1 -0
- package/dist/endpoints/users.d.ts +5 -0
- package/dist/endpoints/users.d.ts.map +1 -0
- package/dist/error-handlers.d.ts +40 -0
- package/dist/error-handlers.d.ts.map +1 -0
- package/dist/index.d.ts +1497 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/schema/database.d.ts +170 -0
- package/dist/schema/database.d.ts.map +1 -0
- package/dist/schema/index.d.ts +171 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/dist/webhooks/annotations.d.ts +4 -0
- package/dist/webhooks/annotations.d.ts.map +1 -0
- package/dist/webhooks/cohorts.d.ts +3 -0
- package/dist/webhooks/cohorts.d.ts.map +1 -0
- package/dist/webhooks/events.d.ts +4 -0
- package/dist/webhooks/events.d.ts.map +1 -0
- package/dist/webhooks/experiments.d.ts +3 -0
- package/dist/webhooks/experiments.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +202 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/monitors.d.ts +3 -0
- package/dist/webhooks/monitors.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +305 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export declare const EventWebhooks: {
|
|
2
|
+
track: {
|
|
3
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
4
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
5
|
+
type: "event.track";
|
|
6
|
+
event_type: string;
|
|
7
|
+
time: number;
|
|
8
|
+
event_id: string;
|
|
9
|
+
user_id?: string | undefined;
|
|
10
|
+
device_id?: string | undefined;
|
|
11
|
+
event_properties?: Record<string, unknown> | undefined;
|
|
12
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
13
|
+
app_version?: string | undefined;
|
|
14
|
+
platform?: string | undefined;
|
|
15
|
+
insert_id?: string | undefined;
|
|
16
|
+
session_id?: number | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
type: "event.track";
|
|
19
|
+
event_type: string;
|
|
20
|
+
time: number;
|
|
21
|
+
event_id: string;
|
|
22
|
+
user_id?: string | undefined;
|
|
23
|
+
device_id?: string | undefined;
|
|
24
|
+
event_properties?: Record<string, unknown> | undefined;
|
|
25
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
26
|
+
app_version?: string | undefined;
|
|
27
|
+
platform?: string | undefined;
|
|
28
|
+
insert_id?: string | undefined;
|
|
29
|
+
session_id?: number | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
identify: {
|
|
33
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
34
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
35
|
+
type: "event.identify";
|
|
36
|
+
time: number;
|
|
37
|
+
user_id?: string | undefined;
|
|
38
|
+
device_id?: string | undefined;
|
|
39
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
40
|
+
app_version?: string | undefined;
|
|
41
|
+
platform?: string | undefined;
|
|
42
|
+
insert_id?: string | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
type: "event.identify";
|
|
45
|
+
time: number;
|
|
46
|
+
user_id?: string | undefined;
|
|
47
|
+
device_id?: string | undefined;
|
|
48
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
49
|
+
app_version?: string | undefined;
|
|
50
|
+
platform?: string | undefined;
|
|
51
|
+
insert_id?: string | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const AnnotationWebhooks: {
|
|
56
|
+
created: {
|
|
57
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
58
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
59
|
+
date: string;
|
|
60
|
+
created_at: string;
|
|
61
|
+
type: "annotation.created";
|
|
62
|
+
label: string;
|
|
63
|
+
annotation_id: number;
|
|
64
|
+
app_id?: number | undefined;
|
|
65
|
+
details?: string | undefined;
|
|
66
|
+
source?: string | undefined;
|
|
67
|
+
}>, {
|
|
68
|
+
date: string;
|
|
69
|
+
created_at: string;
|
|
70
|
+
type: "annotation.created";
|
|
71
|
+
label: string;
|
|
72
|
+
annotation_id: number;
|
|
73
|
+
app_id?: number | undefined;
|
|
74
|
+
details?: string | undefined;
|
|
75
|
+
source?: string | undefined;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
updated: {
|
|
79
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
80
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
81
|
+
date: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
type: "annotation.updated";
|
|
84
|
+
label: string;
|
|
85
|
+
annotation_id: number;
|
|
86
|
+
app_id?: number | undefined;
|
|
87
|
+
details?: string | undefined;
|
|
88
|
+
source?: string | undefined;
|
|
89
|
+
}>, {
|
|
90
|
+
date: string;
|
|
91
|
+
updated_at: string;
|
|
92
|
+
type: "annotation.updated";
|
|
93
|
+
label: string;
|
|
94
|
+
annotation_id: number;
|
|
95
|
+
app_id?: number | undefined;
|
|
96
|
+
details?: string | undefined;
|
|
97
|
+
source?: string | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export declare const MonitorWebhooks: {
|
|
102
|
+
alert: {
|
|
103
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
104
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
105
|
+
type: "monitor.alert";
|
|
106
|
+
monitor_id: string;
|
|
107
|
+
monitor_name: string;
|
|
108
|
+
alert_type: string;
|
|
109
|
+
triggered_at: string;
|
|
110
|
+
value?: number | undefined;
|
|
111
|
+
chart_id?: string | undefined;
|
|
112
|
+
dashboard_id?: number | undefined;
|
|
113
|
+
condition?: string | undefined;
|
|
114
|
+
threshold?: number | undefined;
|
|
115
|
+
recipients?: string[] | undefined;
|
|
116
|
+
}>, {
|
|
117
|
+
type: "monitor.alert";
|
|
118
|
+
monitor_id: string;
|
|
119
|
+
monitor_name: string;
|
|
120
|
+
alert_type: string;
|
|
121
|
+
triggered_at: string;
|
|
122
|
+
value?: number | undefined;
|
|
123
|
+
chart_id?: string | undefined;
|
|
124
|
+
dashboard_id?: number | undefined;
|
|
125
|
+
condition?: string | undefined;
|
|
126
|
+
threshold?: number | undefined;
|
|
127
|
+
recipients?: string[] | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export declare const CohortWebhooks: {
|
|
132
|
+
computed: {
|
|
133
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
134
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
135
|
+
type: "cohort.computed";
|
|
136
|
+
size: number;
|
|
137
|
+
cohort_id: string;
|
|
138
|
+
cohort_name: string;
|
|
139
|
+
computed_at: string;
|
|
140
|
+
published?: boolean | undefined;
|
|
141
|
+
app_id?: number | undefined;
|
|
142
|
+
}>, {
|
|
143
|
+
type: "cohort.computed";
|
|
144
|
+
size: number;
|
|
145
|
+
cohort_id: string;
|
|
146
|
+
cohort_name: string;
|
|
147
|
+
computed_at: string;
|
|
148
|
+
published?: boolean | undefined;
|
|
149
|
+
app_id?: number | undefined;
|
|
150
|
+
}>;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export declare const ExperimentWebhooks: {
|
|
154
|
+
exposure: {
|
|
155
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
156
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
157
|
+
type: "experiment.exposure";
|
|
158
|
+
time: number;
|
|
159
|
+
user: {
|
|
160
|
+
user_id?: string | undefined;
|
|
161
|
+
device_id?: string | undefined;
|
|
162
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
163
|
+
platform?: string | undefined;
|
|
164
|
+
country?: string | undefined;
|
|
165
|
+
region?: string | undefined;
|
|
166
|
+
city?: string | undefined;
|
|
167
|
+
language?: string | undefined;
|
|
168
|
+
os?: string | undefined;
|
|
169
|
+
};
|
|
170
|
+
flag_key: string;
|
|
171
|
+
variant: string;
|
|
172
|
+
experiment_key?: string | undefined;
|
|
173
|
+
metadata?: {
|
|
174
|
+
deployment_name?: string | undefined;
|
|
175
|
+
flag_version?: number | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
}>, {
|
|
178
|
+
type: "experiment.exposure";
|
|
179
|
+
time: number;
|
|
180
|
+
user: {
|
|
181
|
+
user_id?: string | undefined;
|
|
182
|
+
device_id?: string | undefined;
|
|
183
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
184
|
+
platform?: string | undefined;
|
|
185
|
+
country?: string | undefined;
|
|
186
|
+
region?: string | undefined;
|
|
187
|
+
city?: string | undefined;
|
|
188
|
+
language?: string | undefined;
|
|
189
|
+
os?: string | undefined;
|
|
190
|
+
};
|
|
191
|
+
flag_key: string;
|
|
192
|
+
variant: string;
|
|
193
|
+
experiment_key?: string | undefined;
|
|
194
|
+
metadata?: {
|
|
195
|
+
deployment_name?: string | undefined;
|
|
196
|
+
flag_version?: number | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
}>;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
export * from './types';
|
|
202
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../webhooks/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAsB,CAAC;AACjD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAC;AACF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAY,CAAC;AACzC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;CAAe,CAAC;AAC3C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAe,CAAC;AAE/C,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../webhooks/monitors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAG5C,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,eAAe,CA4BpD,CAAC"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CorsairWebhookMatcher, WebhookRequest } from 'corsair/core';
|
|
3
|
+
export declare const AmplitudeTrackEventSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"event.track">;
|
|
5
|
+
event_id: z.ZodString;
|
|
6
|
+
event_type: z.ZodString;
|
|
7
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
device_id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
time: z.ZodNumber;
|
|
10
|
+
event_properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
user_properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
+
app_version: z.ZodOptional<z.ZodString>;
|
|
13
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
14
|
+
session_id: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
insert_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type: "event.track";
|
|
18
|
+
event_type: string;
|
|
19
|
+
time: number;
|
|
20
|
+
event_id: string;
|
|
21
|
+
user_id?: string | undefined;
|
|
22
|
+
device_id?: string | undefined;
|
|
23
|
+
event_properties?: Record<string, unknown> | undefined;
|
|
24
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
25
|
+
app_version?: string | undefined;
|
|
26
|
+
platform?: string | undefined;
|
|
27
|
+
insert_id?: string | undefined;
|
|
28
|
+
session_id?: number | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
type: "event.track";
|
|
31
|
+
event_type: string;
|
|
32
|
+
time: number;
|
|
33
|
+
event_id: string;
|
|
34
|
+
user_id?: string | undefined;
|
|
35
|
+
device_id?: string | undefined;
|
|
36
|
+
event_properties?: Record<string, unknown> | undefined;
|
|
37
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
38
|
+
app_version?: string | undefined;
|
|
39
|
+
platform?: string | undefined;
|
|
40
|
+
insert_id?: string | undefined;
|
|
41
|
+
session_id?: number | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export type AmplitudeTrackEvent = z.infer<typeof AmplitudeTrackEventSchema>;
|
|
44
|
+
export declare const AmplitudeIdentifyEventSchema: z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"event.identify">;
|
|
46
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
47
|
+
device_id: z.ZodOptional<z.ZodString>;
|
|
48
|
+
time: z.ZodNumber;
|
|
49
|
+
user_properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
50
|
+
app_version: z.ZodOptional<z.ZodString>;
|
|
51
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
52
|
+
insert_id: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
type: "event.identify";
|
|
55
|
+
time: number;
|
|
56
|
+
user_id?: string | undefined;
|
|
57
|
+
device_id?: string | undefined;
|
|
58
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
59
|
+
app_version?: string | undefined;
|
|
60
|
+
platform?: string | undefined;
|
|
61
|
+
insert_id?: string | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
type: "event.identify";
|
|
64
|
+
time: number;
|
|
65
|
+
user_id?: string | undefined;
|
|
66
|
+
device_id?: string | undefined;
|
|
67
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
68
|
+
app_version?: string | undefined;
|
|
69
|
+
platform?: string | undefined;
|
|
70
|
+
insert_id?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type AmplitudeIdentifyEvent = z.infer<typeof AmplitudeIdentifyEventSchema>;
|
|
73
|
+
export declare const AmplitudeAnnotationCreatedEventSchema: z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"annotation.created">;
|
|
75
|
+
annotation_id: z.ZodNumber;
|
|
76
|
+
date: z.ZodString;
|
|
77
|
+
label: z.ZodString;
|
|
78
|
+
details: z.ZodOptional<z.ZodString>;
|
|
79
|
+
app_id: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
source: z.ZodOptional<z.ZodString>;
|
|
81
|
+
created_at: z.ZodString;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
date: string;
|
|
84
|
+
created_at: string;
|
|
85
|
+
type: "annotation.created";
|
|
86
|
+
label: string;
|
|
87
|
+
annotation_id: number;
|
|
88
|
+
app_id?: number | undefined;
|
|
89
|
+
details?: string | undefined;
|
|
90
|
+
source?: string | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
date: string;
|
|
93
|
+
created_at: string;
|
|
94
|
+
type: "annotation.created";
|
|
95
|
+
label: string;
|
|
96
|
+
annotation_id: number;
|
|
97
|
+
app_id?: number | undefined;
|
|
98
|
+
details?: string | undefined;
|
|
99
|
+
source?: string | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export type AmplitudeAnnotationCreatedEvent = z.infer<typeof AmplitudeAnnotationCreatedEventSchema>;
|
|
102
|
+
export declare const AmplitudeAnnotationUpdatedEventSchema: z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"annotation.updated">;
|
|
104
|
+
annotation_id: z.ZodNumber;
|
|
105
|
+
date: z.ZodString;
|
|
106
|
+
label: z.ZodString;
|
|
107
|
+
details: z.ZodOptional<z.ZodString>;
|
|
108
|
+
app_id: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
source: z.ZodOptional<z.ZodString>;
|
|
110
|
+
updated_at: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
date: string;
|
|
113
|
+
updated_at: string;
|
|
114
|
+
type: "annotation.updated";
|
|
115
|
+
label: string;
|
|
116
|
+
annotation_id: number;
|
|
117
|
+
app_id?: number | undefined;
|
|
118
|
+
details?: string | undefined;
|
|
119
|
+
source?: string | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
date: string;
|
|
122
|
+
updated_at: string;
|
|
123
|
+
type: "annotation.updated";
|
|
124
|
+
label: string;
|
|
125
|
+
annotation_id: number;
|
|
126
|
+
app_id?: number | undefined;
|
|
127
|
+
details?: string | undefined;
|
|
128
|
+
source?: string | undefined;
|
|
129
|
+
}>;
|
|
130
|
+
export type AmplitudeAnnotationUpdatedEvent = z.infer<typeof AmplitudeAnnotationUpdatedEventSchema>;
|
|
131
|
+
export declare const AmplitudeMonitorAlertEventSchema: z.ZodObject<{
|
|
132
|
+
type: z.ZodLiteral<"monitor.alert">;
|
|
133
|
+
monitor_id: z.ZodString;
|
|
134
|
+
monitor_name: z.ZodString;
|
|
135
|
+
alert_type: z.ZodString;
|
|
136
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
137
|
+
value: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
triggered_at: z.ZodString;
|
|
140
|
+
chart_id: z.ZodOptional<z.ZodString>;
|
|
141
|
+
dashboard_id: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
type: "monitor.alert";
|
|
145
|
+
monitor_id: string;
|
|
146
|
+
monitor_name: string;
|
|
147
|
+
alert_type: string;
|
|
148
|
+
triggered_at: string;
|
|
149
|
+
value?: number | undefined;
|
|
150
|
+
chart_id?: string | undefined;
|
|
151
|
+
dashboard_id?: number | undefined;
|
|
152
|
+
condition?: string | undefined;
|
|
153
|
+
threshold?: number | undefined;
|
|
154
|
+
recipients?: string[] | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
type: "monitor.alert";
|
|
157
|
+
monitor_id: string;
|
|
158
|
+
monitor_name: string;
|
|
159
|
+
alert_type: string;
|
|
160
|
+
triggered_at: string;
|
|
161
|
+
value?: number | undefined;
|
|
162
|
+
chart_id?: string | undefined;
|
|
163
|
+
dashboard_id?: number | undefined;
|
|
164
|
+
condition?: string | undefined;
|
|
165
|
+
threshold?: number | undefined;
|
|
166
|
+
recipients?: string[] | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
export type AmplitudeMonitorAlertEvent = z.infer<typeof AmplitudeMonitorAlertEventSchema>;
|
|
169
|
+
export declare const AmplitudeCohortComputedEventSchema: z.ZodObject<{
|
|
170
|
+
type: z.ZodLiteral<"cohort.computed">;
|
|
171
|
+
cohort_id: z.ZodString;
|
|
172
|
+
cohort_name: z.ZodString;
|
|
173
|
+
app_id: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
size: z.ZodNumber;
|
|
175
|
+
computed_at: z.ZodString;
|
|
176
|
+
published: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
type: "cohort.computed";
|
|
179
|
+
size: number;
|
|
180
|
+
cohort_id: string;
|
|
181
|
+
cohort_name: string;
|
|
182
|
+
computed_at: string;
|
|
183
|
+
published?: boolean | undefined;
|
|
184
|
+
app_id?: number | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
type: "cohort.computed";
|
|
187
|
+
size: number;
|
|
188
|
+
cohort_id: string;
|
|
189
|
+
cohort_name: string;
|
|
190
|
+
computed_at: string;
|
|
191
|
+
published?: boolean | undefined;
|
|
192
|
+
app_id?: number | undefined;
|
|
193
|
+
}>;
|
|
194
|
+
export type AmplitudeCohortComputedEvent = z.infer<typeof AmplitudeCohortComputedEventSchema>;
|
|
195
|
+
export declare const AmplitudeExperimentExposureEventSchema: z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"experiment.exposure">;
|
|
197
|
+
flag_key: z.ZodString;
|
|
198
|
+
variant: z.ZodString;
|
|
199
|
+
user: z.ZodObject<{
|
|
200
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
201
|
+
device_id: z.ZodOptional<z.ZodString>;
|
|
202
|
+
user_properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
203
|
+
country: z.ZodOptional<z.ZodString>;
|
|
204
|
+
city: z.ZodOptional<z.ZodString>;
|
|
205
|
+
region: z.ZodOptional<z.ZodString>;
|
|
206
|
+
language: z.ZodOptional<z.ZodString>;
|
|
207
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
208
|
+
os: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
user_id?: string | undefined;
|
|
211
|
+
device_id?: string | undefined;
|
|
212
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
213
|
+
platform?: string | undefined;
|
|
214
|
+
country?: string | undefined;
|
|
215
|
+
region?: string | undefined;
|
|
216
|
+
city?: string | undefined;
|
|
217
|
+
language?: string | undefined;
|
|
218
|
+
os?: string | undefined;
|
|
219
|
+
}, {
|
|
220
|
+
user_id?: string | undefined;
|
|
221
|
+
device_id?: string | undefined;
|
|
222
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
223
|
+
platform?: string | undefined;
|
|
224
|
+
country?: string | undefined;
|
|
225
|
+
region?: string | undefined;
|
|
226
|
+
city?: string | undefined;
|
|
227
|
+
language?: string | undefined;
|
|
228
|
+
os?: string | undefined;
|
|
229
|
+
}>;
|
|
230
|
+
time: z.ZodNumber;
|
|
231
|
+
experiment_key: z.ZodOptional<z.ZodString>;
|
|
232
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
233
|
+
deployment_name: z.ZodOptional<z.ZodString>;
|
|
234
|
+
flag_version: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
deployment_name?: string | undefined;
|
|
237
|
+
flag_version?: number | undefined;
|
|
238
|
+
}, {
|
|
239
|
+
deployment_name?: string | undefined;
|
|
240
|
+
flag_version?: number | undefined;
|
|
241
|
+
}>>;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
type: "experiment.exposure";
|
|
244
|
+
time: number;
|
|
245
|
+
user: {
|
|
246
|
+
user_id?: string | undefined;
|
|
247
|
+
device_id?: string | undefined;
|
|
248
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
249
|
+
platform?: string | undefined;
|
|
250
|
+
country?: string | undefined;
|
|
251
|
+
region?: string | undefined;
|
|
252
|
+
city?: string | undefined;
|
|
253
|
+
language?: string | undefined;
|
|
254
|
+
os?: string | undefined;
|
|
255
|
+
};
|
|
256
|
+
flag_key: string;
|
|
257
|
+
variant: string;
|
|
258
|
+
experiment_key?: string | undefined;
|
|
259
|
+
metadata?: {
|
|
260
|
+
deployment_name?: string | undefined;
|
|
261
|
+
flag_version?: number | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
}, {
|
|
264
|
+
type: "experiment.exposure";
|
|
265
|
+
time: number;
|
|
266
|
+
user: {
|
|
267
|
+
user_id?: string | undefined;
|
|
268
|
+
device_id?: string | undefined;
|
|
269
|
+
user_properties?: Record<string, unknown> | undefined;
|
|
270
|
+
platform?: string | undefined;
|
|
271
|
+
country?: string | undefined;
|
|
272
|
+
region?: string | undefined;
|
|
273
|
+
city?: string | undefined;
|
|
274
|
+
language?: string | undefined;
|
|
275
|
+
os?: string | undefined;
|
|
276
|
+
};
|
|
277
|
+
flag_key: string;
|
|
278
|
+
variant: string;
|
|
279
|
+
experiment_key?: string | undefined;
|
|
280
|
+
metadata?: {
|
|
281
|
+
deployment_name?: string | undefined;
|
|
282
|
+
flag_version?: number | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
}>;
|
|
285
|
+
export type AmplitudeExperimentExposureEvent = z.infer<typeof AmplitudeExperimentExposureEventSchema>;
|
|
286
|
+
export type AmplitudeWebhookPayload<TEvent> = {
|
|
287
|
+
type: string;
|
|
288
|
+
created_at: string;
|
|
289
|
+
data: TEvent;
|
|
290
|
+
};
|
|
291
|
+
export type AmplitudeWebhookOutputs = {
|
|
292
|
+
eventsTrack: AmplitudeTrackEvent;
|
|
293
|
+
eventsIdentify: AmplitudeIdentifyEvent;
|
|
294
|
+
annotationsCreated: AmplitudeAnnotationCreatedEvent;
|
|
295
|
+
annotationsUpdated: AmplitudeAnnotationUpdatedEvent;
|
|
296
|
+
monitorsAlert: AmplitudeMonitorAlertEvent;
|
|
297
|
+
cohortsComputed: AmplitudeCohortComputedEvent;
|
|
298
|
+
experimentsExposure: AmplitudeExperimentExposureEvent;
|
|
299
|
+
};
|
|
300
|
+
export declare function createAmplitudeMatch(eventType: string): CorsairWebhookMatcher;
|
|
301
|
+
export declare function verifyAmplitudeWebhookSignature(request: WebhookRequest, secret?: string): {
|
|
302
|
+
valid: boolean;
|
|
303
|
+
error?: string;
|
|
304
|
+
};
|
|
305
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACX,qBAAqB,EAErB,cAAc,EACd,MAAM,cAAc,CAAC;AAuBtB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAepC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,4BAA4B,CACnC,CAAC;AAMF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;EAShD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,qCAAqC,CAC5C,CAAC;AAMF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;EAShD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,qCAAqC,CAC5C,CAAC;AAMF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,gCAAgC,CACvC,CAAC;AAMF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;EAQ7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CACjD,OAAO,kCAAkC,CACzC,CAAC;AAMF,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAajD,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,sCAAsC,CAC7C,CAAC;AAMF,MAAM,MAAM,uBAAuB,CAAC,MAAM,IAAI;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAMF,MAAM,MAAM,uBAAuB,GAAG;IACrC,WAAW,EAAE,mBAAmB,CAAC;IACjC,cAAc,EAAE,sBAAsB,CAAC;IACvC,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,kBAAkB,EAAE,+BAA+B,CAAC;IACpD,aAAa,EAAE,0BAA0B,CAAC;IAC1C,eAAe,EAAE,4BAA4B,CAAC;IAC9C,mBAAmB,EAAE,gCAAgC,CAAC;CACtD,CAAC;AAYF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,CAM7E;AAED,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,cAAc,EACvB,MAAM,CAAC,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA4BpC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@corsair-dev/amplitude",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Amplitude plugin for Corsair",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"dev-source": "./index.ts",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"corsair": ">=0.1.0",
|
|
18
|
+
"zod": "^3.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tsup": "^8.0.1",
|
|
22
|
+
"typescript": "^5.9.3",
|
|
23
|
+
"zod": "^3.25.76",
|
|
24
|
+
"corsair": "0.1.48"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"corsair",
|
|
28
|
+
"amplitude",
|
|
29
|
+
"plugin"
|
|
30
|
+
],
|
|
31
|
+
"author": "",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "rm -rf dist && tsc --build --force && tsup",
|
|
38
|
+
"typecheck": "tsc --noEmit"
|
|
39
|
+
}
|
|
40
|
+
}
|