@corsair-dev/amplitude 0.1.0 → 0.1.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/dist/api.test.d.ts +2 -0
- package/dist/api.test.d.ts.map +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/endpoints/annotations.d.ts +1 -1
- package/dist/endpoints/annotations.d.ts.map +1 -1
- package/dist/endpoints/charts.d.ts +1 -1
- package/dist/endpoints/charts.d.ts.map +1 -1
- package/dist/endpoints/cohorts.d.ts +1 -1
- package/dist/endpoints/cohorts.d.ts.map +1 -1
- package/dist/endpoints/dashboards.d.ts +1 -1
- package/dist/endpoints/dashboards.d.ts.map +1 -1
- package/dist/endpoints/events.d.ts +1 -1
- package/dist/endpoints/events.d.ts.map +1 -1
- package/dist/endpoints/exports.d.ts +1 -1
- package/dist/endpoints/exports.d.ts.map +1 -1
- package/dist/endpoints/index.d.ts +3 -3
- package/dist/endpoints/types.d.ts +20 -20
- package/dist/endpoints/users.d.ts +1 -1
- package/dist/endpoints/users.d.ts.map +1 -1
- package/dist/index.d.ts +17 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/schema/database.d.ts +4 -4
- package/dist/schema/index.d.ts +4 -4
- package/dist/webhooks/annotations.d.ts +1 -1
- package/dist/webhooks/annotations.d.ts.map +1 -1
- package/dist/webhooks/cohorts.d.ts +1 -1
- package/dist/webhooks/cohorts.d.ts.map +1 -1
- package/dist/webhooks/events.d.ts +1 -1
- package/dist/webhooks/events.d.ts.map +1 -1
- package/dist/webhooks/experiments.d.ts +1 -1
- package/dist/webhooks/experiments.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +10 -10
- package/dist/webhooks/monitors.d.ts +1 -1
- package/dist/webhooks/monitors.d.ts.map +1 -1
- package/dist/webhooks/types.d.ts +11 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.test.d.ts","sourceRoot":"","sources":["../api.test.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAGA,qBAAa,iBAAkB,SAAQ,KAAK;aAG1B,IAAI,CAAC,EAAE,MAAM;gBAD7B,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA;CAK9B;AAED,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,4BAA4B,0BAA0B,CAAC;AAEpE,wBAAsB,oBAAoB,CAAC,CAAC,EAC3C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACR,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;CACZ,GACJ,OAAO,CAAC,CAAC,CAAC,CAuCZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeEndpoints } from '
|
|
1
|
+
import type { AmplitudeEndpoints } from '../index';
|
|
2
2
|
export declare const list: AmplitudeEndpoints['annotationsList'];
|
|
3
3
|
export declare const create: AmplitudeEndpoints['annotationsCreate'];
|
|
4
4
|
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../endpoints/annotations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../endpoints/annotations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,IAAI,EAAE,kBAAkB,CAAC,iBAAiB,CAoBtD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,mBAAmB,CAuB1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../endpoints/charts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../endpoints/charts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,GAAG,EAAE,kBAAkB,CAAC,WAAW,CAY/C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeEndpoints } from '
|
|
1
|
+
import type { AmplitudeEndpoints } from '../index';
|
|
2
2
|
export declare const list: AmplitudeEndpoints['cohortsList'];
|
|
3
3
|
export declare const get: AmplitudeEndpoints['cohortsGet'];
|
|
4
4
|
export declare const create: AmplitudeEndpoints['cohortsCreate'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohorts.d.ts","sourceRoot":"","sources":["../../endpoints/cohorts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cohorts.d.ts","sourceRoot":"","sources":["../../endpoints/cohorts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,IAAI,EAAE,kBAAkB,CAAC,aAAa,CA4BlD,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,kBAAkB,CAAC,YAAY,CAwBhD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,eAAe,CAoCtD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,kBAAkB,CAAC,mBAAmB,CAe9D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeEndpoints } from '
|
|
1
|
+
import type { AmplitudeEndpoints } from '../index';
|
|
2
2
|
export declare const list: AmplitudeEndpoints['dashboardsList'];
|
|
3
3
|
export declare const get: AmplitudeEndpoints['dashboardsGet'];
|
|
4
4
|
//# sourceMappingURL=dashboards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboards.d.ts","sourceRoot":"","sources":["../../endpoints/dashboards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dashboards.d.ts","sourceRoot":"","sources":["../../endpoints/dashboards.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,IAAI,EAAE,kBAAkB,CAAC,gBAAgB,CAerD,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,kBAAkB,CAAC,eAAe,CAYnD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeEndpoints } from '
|
|
1
|
+
import type { AmplitudeEndpoints } from '../index';
|
|
2
2
|
export declare const upload: AmplitudeEndpoints['eventsUpload'];
|
|
3
3
|
export declare const uploadBatch: AmplitudeEndpoints['eventsUploadBatch'];
|
|
4
4
|
export declare const identifyUser: AmplitudeEndpoints['eventsIdentifyUser'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../endpoints/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../endpoints/events.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,cAAc,CA4CrD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,kBAAkB,CAAC,mBAAmB,CA4C/D,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,oBAAoB,CAwCjE,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,kBAAkB,CAAC,eAAe,CAevD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../endpoints/exports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../endpoints/exports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAqBxD,CAAC"}
|
|
@@ -157,8 +157,8 @@ export declare const Cohorts: {
|
|
|
157
157
|
id: string;
|
|
158
158
|
name: string;
|
|
159
159
|
type?: string | undefined;
|
|
160
|
-
description?: string | null | undefined;
|
|
161
160
|
owners?: string[] | undefined;
|
|
161
|
+
description?: string | null | undefined;
|
|
162
162
|
published?: boolean | undefined;
|
|
163
163
|
archived?: boolean | undefined;
|
|
164
164
|
app_id?: number | undefined;
|
|
@@ -175,8 +175,8 @@ export declare const Cohorts: {
|
|
|
175
175
|
id: string;
|
|
176
176
|
name: string;
|
|
177
177
|
type?: string | undefined;
|
|
178
|
-
description?: string | null | undefined;
|
|
179
178
|
owners?: string[] | undefined;
|
|
179
|
+
description?: string | null | undefined;
|
|
180
180
|
published?: boolean | undefined;
|
|
181
181
|
archived?: boolean | undefined;
|
|
182
182
|
app_id?: number | undefined;
|
|
@@ -191,8 +191,8 @@ export declare const Cohorts: {
|
|
|
191
191
|
app_id: number;
|
|
192
192
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
193
193
|
ids: string[];
|
|
194
|
-
description?: string | undefined;
|
|
195
194
|
owners?: string[] | undefined;
|
|
195
|
+
description?: string | undefined;
|
|
196
196
|
published?: boolean | undefined;
|
|
197
197
|
}) => Promise<{
|
|
198
198
|
cohort?: {
|
|
@@ -666,8 +666,8 @@ declare const CohortsListResponseSchema: z.ZodObject<{
|
|
|
666
666
|
id: string;
|
|
667
667
|
name: string;
|
|
668
668
|
type?: string | undefined;
|
|
669
|
-
description?: string | null | undefined;
|
|
670
669
|
owners?: string[] | undefined;
|
|
670
|
+
description?: string | null | undefined;
|
|
671
671
|
published?: boolean | undefined;
|
|
672
672
|
archived?: boolean | undefined;
|
|
673
673
|
app_id?: number | undefined;
|
|
@@ -679,8 +679,8 @@ declare const CohortsListResponseSchema: z.ZodObject<{
|
|
|
679
679
|
id: string;
|
|
680
680
|
name: string;
|
|
681
681
|
type?: string | undefined;
|
|
682
|
-
description?: string | null | undefined;
|
|
683
682
|
owners?: string[] | undefined;
|
|
683
|
+
description?: string | null | undefined;
|
|
684
684
|
published?: boolean | undefined;
|
|
685
685
|
archived?: boolean | undefined;
|
|
686
686
|
app_id?: number | undefined;
|
|
@@ -694,8 +694,8 @@ declare const CohortsListResponseSchema: z.ZodObject<{
|
|
|
694
694
|
id: string;
|
|
695
695
|
name: string;
|
|
696
696
|
type?: string | undefined;
|
|
697
|
-
description?: string | null | undefined;
|
|
698
697
|
owners?: string[] | undefined;
|
|
698
|
+
description?: string | null | undefined;
|
|
699
699
|
published?: boolean | undefined;
|
|
700
700
|
archived?: boolean | undefined;
|
|
701
701
|
app_id?: number | undefined;
|
|
@@ -709,8 +709,8 @@ declare const CohortsListResponseSchema: z.ZodObject<{
|
|
|
709
709
|
id: string;
|
|
710
710
|
name: string;
|
|
711
711
|
type?: string | undefined;
|
|
712
|
-
description?: string | null | undefined;
|
|
713
712
|
owners?: string[] | undefined;
|
|
713
|
+
description?: string | null | undefined;
|
|
714
714
|
published?: boolean | undefined;
|
|
715
715
|
archived?: boolean | undefined;
|
|
716
716
|
app_id?: number | undefined;
|
|
@@ -747,8 +747,8 @@ declare const CohortsGetResponseSchema: z.ZodObject<{
|
|
|
747
747
|
id: string;
|
|
748
748
|
name: string;
|
|
749
749
|
type?: string | undefined;
|
|
750
|
-
description?: string | null | undefined;
|
|
751
750
|
owners?: string[] | undefined;
|
|
751
|
+
description?: string | null | undefined;
|
|
752
752
|
published?: boolean | undefined;
|
|
753
753
|
archived?: boolean | undefined;
|
|
754
754
|
app_id?: number | undefined;
|
|
@@ -760,8 +760,8 @@ declare const CohortsGetResponseSchema: z.ZodObject<{
|
|
|
760
760
|
id: string;
|
|
761
761
|
name: string;
|
|
762
762
|
type?: string | undefined;
|
|
763
|
-
description?: string | null | undefined;
|
|
764
763
|
owners?: string[] | undefined;
|
|
764
|
+
description?: string | null | undefined;
|
|
765
765
|
published?: boolean | undefined;
|
|
766
766
|
archived?: boolean | undefined;
|
|
767
767
|
app_id?: number | undefined;
|
|
@@ -775,8 +775,8 @@ declare const CohortsGetResponseSchema: z.ZodObject<{
|
|
|
775
775
|
id: string;
|
|
776
776
|
name: string;
|
|
777
777
|
type?: string | undefined;
|
|
778
|
-
description?: string | null | undefined;
|
|
779
778
|
owners?: string[] | undefined;
|
|
779
|
+
description?: string | null | undefined;
|
|
780
780
|
published?: boolean | undefined;
|
|
781
781
|
archived?: boolean | undefined;
|
|
782
782
|
app_id?: number | undefined;
|
|
@@ -790,8 +790,8 @@ declare const CohortsGetResponseSchema: z.ZodObject<{
|
|
|
790
790
|
id: string;
|
|
791
791
|
name: string;
|
|
792
792
|
type?: string | undefined;
|
|
793
|
-
description?: string | null | undefined;
|
|
794
793
|
owners?: string[] | undefined;
|
|
794
|
+
description?: string | null | undefined;
|
|
795
795
|
published?: boolean | undefined;
|
|
796
796
|
archived?: boolean | undefined;
|
|
797
797
|
app_id?: number | undefined;
|
|
@@ -816,16 +816,16 @@ declare const CohortsCreateInputSchema: z.ZodObject<{
|
|
|
816
816
|
app_id: number;
|
|
817
817
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
818
818
|
ids: string[];
|
|
819
|
-
description?: string | undefined;
|
|
820
819
|
owners?: string[] | undefined;
|
|
820
|
+
description?: string | undefined;
|
|
821
821
|
published?: boolean | undefined;
|
|
822
822
|
}, {
|
|
823
823
|
name: string;
|
|
824
824
|
app_id: number;
|
|
825
825
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
826
826
|
ids: string[];
|
|
827
|
-
description?: string | undefined;
|
|
828
827
|
owners?: string[] | undefined;
|
|
828
|
+
description?: string | undefined;
|
|
829
829
|
published?: boolean | undefined;
|
|
830
830
|
}>;
|
|
831
831
|
declare const CohortsCreateResponseSchema: z.ZodObject<{
|
|
@@ -1592,16 +1592,16 @@ export declare const AmplitudeEndpointInputSchemas: {
|
|
|
1592
1592
|
app_id: number;
|
|
1593
1593
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
1594
1594
|
ids: string[];
|
|
1595
|
-
description?: string | undefined;
|
|
1596
1595
|
owners?: string[] | undefined;
|
|
1596
|
+
description?: string | undefined;
|
|
1597
1597
|
published?: boolean | undefined;
|
|
1598
1598
|
}, {
|
|
1599
1599
|
name: string;
|
|
1600
1600
|
app_id: number;
|
|
1601
1601
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
1602
1602
|
ids: string[];
|
|
1603
|
-
description?: string | undefined;
|
|
1604
1603
|
owners?: string[] | undefined;
|
|
1604
|
+
description?: string | undefined;
|
|
1605
1605
|
published?: boolean | undefined;
|
|
1606
1606
|
}>;
|
|
1607
1607
|
readonly cohortsGetMembers: z.ZodObject<{
|
|
@@ -1980,8 +1980,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
1980
1980
|
id: string;
|
|
1981
1981
|
name: string;
|
|
1982
1982
|
type?: string | undefined;
|
|
1983
|
-
description?: string | null | undefined;
|
|
1984
1983
|
owners?: string[] | undefined;
|
|
1984
|
+
description?: string | null | undefined;
|
|
1985
1985
|
published?: boolean | undefined;
|
|
1986
1986
|
archived?: boolean | undefined;
|
|
1987
1987
|
app_id?: number | undefined;
|
|
@@ -1993,8 +1993,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
1993
1993
|
id: string;
|
|
1994
1994
|
name: string;
|
|
1995
1995
|
type?: string | undefined;
|
|
1996
|
-
description?: string | null | undefined;
|
|
1997
1996
|
owners?: string[] | undefined;
|
|
1997
|
+
description?: string | null | undefined;
|
|
1998
1998
|
published?: boolean | undefined;
|
|
1999
1999
|
archived?: boolean | undefined;
|
|
2000
2000
|
app_id?: number | undefined;
|
|
@@ -2008,8 +2008,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2008
2008
|
id: string;
|
|
2009
2009
|
name: string;
|
|
2010
2010
|
type?: string | undefined;
|
|
2011
|
-
description?: string | null | undefined;
|
|
2012
2011
|
owners?: string[] | undefined;
|
|
2012
|
+
description?: string | null | undefined;
|
|
2013
2013
|
published?: boolean | undefined;
|
|
2014
2014
|
archived?: boolean | undefined;
|
|
2015
2015
|
app_id?: number | undefined;
|
|
@@ -2023,8 +2023,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2023
2023
|
id: string;
|
|
2024
2024
|
name: string;
|
|
2025
2025
|
type?: string | undefined;
|
|
2026
|
-
description?: string | null | undefined;
|
|
2027
2026
|
owners?: string[] | undefined;
|
|
2027
|
+
description?: string | null | undefined;
|
|
2028
2028
|
published?: boolean | undefined;
|
|
2029
2029
|
archived?: boolean | undefined;
|
|
2030
2030
|
app_id?: number | undefined;
|
|
@@ -2052,8 +2052,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2052
2052
|
id: string;
|
|
2053
2053
|
name: string;
|
|
2054
2054
|
type?: string | undefined;
|
|
2055
|
-
description?: string | null | undefined;
|
|
2056
2055
|
owners?: string[] | undefined;
|
|
2056
|
+
description?: string | null | undefined;
|
|
2057
2057
|
published?: boolean | undefined;
|
|
2058
2058
|
archived?: boolean | undefined;
|
|
2059
2059
|
app_id?: number | undefined;
|
|
@@ -2065,8 +2065,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2065
2065
|
id: string;
|
|
2066
2066
|
name: string;
|
|
2067
2067
|
type?: string | undefined;
|
|
2068
|
-
description?: string | null | undefined;
|
|
2069
2068
|
owners?: string[] | undefined;
|
|
2069
|
+
description?: string | null | undefined;
|
|
2070
2070
|
published?: boolean | undefined;
|
|
2071
2071
|
archived?: boolean | undefined;
|
|
2072
2072
|
app_id?: number | undefined;
|
|
@@ -2080,8 +2080,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2080
2080
|
id: string;
|
|
2081
2081
|
name: string;
|
|
2082
2082
|
type?: string | undefined;
|
|
2083
|
-
description?: string | null | undefined;
|
|
2084
2083
|
owners?: string[] | undefined;
|
|
2084
|
+
description?: string | null | undefined;
|
|
2085
2085
|
published?: boolean | undefined;
|
|
2086
2086
|
archived?: boolean | undefined;
|
|
2087
2087
|
app_id?: number | undefined;
|
|
@@ -2095,8 +2095,8 @@ export declare const AmplitudeEndpointOutputSchemas: {
|
|
|
2095
2095
|
id: string;
|
|
2096
2096
|
name: string;
|
|
2097
2097
|
type?: string | undefined;
|
|
2098
|
-
description?: string | null | undefined;
|
|
2099
2098
|
owners?: string[] | undefined;
|
|
2099
|
+
description?: string | null | undefined;
|
|
2100
2100
|
published?: boolean | undefined;
|
|
2101
2101
|
archived?: boolean | undefined;
|
|
2102
2102
|
app_id?: number | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeEndpoints } from '
|
|
1
|
+
import type { AmplitudeEndpoints } from '../index';
|
|
2
2
|
export declare const search: AmplitudeEndpoints['usersSearch'];
|
|
3
3
|
export declare const getProfile: AmplitudeEndpoints['usersGetProfile'];
|
|
4
4
|
export declare const getActivity: AmplitudeEndpoints['usersGetActivity'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../endpoints/users.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../endpoints/users.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,kBAAkB,CAAC,aAAa,CAkCpD,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,kBAAkB,CAAC,iBAAiB,CAwC5D,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,kBAAkB,CAAC,kBAAkB,CA0C9D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { BindEndpoints, BindWebhooks, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, CorsairWebhook, KeyBuilderContext, PluginPermissionsConfig } from 'corsair/core';
|
|
2
|
-
import type { AuthTypes, PickAuth } from 'corsair/core';
|
|
1
|
+
import type { AuthTypes, BindEndpoints, BindWebhooks, CorsairEndpoint, CorsairErrorHandler, CorsairPlugin, CorsairPluginContext, CorsairWebhook, KeyBuilderContext, PickAuth, PluginPermissionsConfig } from 'corsair/core';
|
|
3
2
|
import type { AmplitudeEndpointInputs, AmplitudeEndpointOutputs } from './endpoints/types';
|
|
4
3
|
import { AmplitudeSchema } from './schema';
|
|
5
4
|
import type { AmplitudeAnnotationCreatedEvent, AmplitudeAnnotationUpdatedEvent, AmplitudeCohortComputedEvent, AmplitudeExperimentExposureEvent, AmplitudeIdentifyEvent, AmplitudeMonitorAlertEvent, AmplitudeTrackEvent, AmplitudeWebhookOutputs, AmplitudeWebhookPayload } from './webhooks/types';
|
|
@@ -142,8 +141,8 @@ declare const amplitudeEndpointsNested: {
|
|
|
142
141
|
app_id: number;
|
|
143
142
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
144
143
|
ids: string[];
|
|
145
|
-
description?: string | undefined;
|
|
146
144
|
owners?: string[] | undefined;
|
|
145
|
+
description?: string | undefined;
|
|
147
146
|
published?: boolean | undefined;
|
|
148
147
|
}>;
|
|
149
148
|
readonly getMembers: AmplitudeEndpoint<"cohortsGetMembers", {
|
|
@@ -182,9 +181,9 @@ declare const amplitudeEndpointsNested: {
|
|
|
182
181
|
declare const amplitudeWebhooksNested: {
|
|
183
182
|
readonly events: {
|
|
184
183
|
readonly track: AmplitudeWebhook<"eventsTrack", {
|
|
185
|
-
type: "event.track";
|
|
186
184
|
event_type: string;
|
|
187
185
|
time: number;
|
|
186
|
+
type: "event.track";
|
|
188
187
|
event_id: string;
|
|
189
188
|
user_id?: string | undefined;
|
|
190
189
|
device_id?: string | undefined;
|
|
@@ -196,8 +195,8 @@ declare const amplitudeWebhooksNested: {
|
|
|
196
195
|
session_id?: number | undefined;
|
|
197
196
|
}>;
|
|
198
197
|
readonly identify: AmplitudeWebhook<"eventsIdentify", {
|
|
199
|
-
type: "event.identify";
|
|
200
198
|
time: number;
|
|
199
|
+
type: "event.identify";
|
|
201
200
|
user_id?: string | undefined;
|
|
202
201
|
device_id?: string | undefined;
|
|
203
202
|
user_properties?: Record<string, unknown> | undefined;
|
|
@@ -209,9 +208,9 @@ declare const amplitudeWebhooksNested: {
|
|
|
209
208
|
readonly annotations: {
|
|
210
209
|
readonly created: AmplitudeWebhook<"annotationsCreated", {
|
|
211
210
|
date: string;
|
|
212
|
-
created_at: string;
|
|
213
211
|
type: "annotation.created";
|
|
214
212
|
label: string;
|
|
213
|
+
created_at: string;
|
|
215
214
|
annotation_id: number;
|
|
216
215
|
app_id?: number | undefined;
|
|
217
216
|
details?: string | undefined;
|
|
@@ -219,9 +218,9 @@ declare const amplitudeWebhooksNested: {
|
|
|
219
218
|
}>;
|
|
220
219
|
readonly updated: AmplitudeWebhook<"annotationsUpdated", {
|
|
221
220
|
date: string;
|
|
222
|
-
updated_at: string;
|
|
223
221
|
type: "annotation.updated";
|
|
224
222
|
label: string;
|
|
223
|
+
updated_at: string;
|
|
225
224
|
annotation_id: number;
|
|
226
225
|
app_id?: number | undefined;
|
|
227
226
|
details?: string | undefined;
|
|
@@ -256,8 +255,8 @@ declare const amplitudeWebhooksNested: {
|
|
|
256
255
|
};
|
|
257
256
|
readonly experiments: {
|
|
258
257
|
readonly exposure: AmplitudeWebhook<"experimentsExposure", {
|
|
259
|
-
type: "experiment.exposure";
|
|
260
258
|
time: number;
|
|
259
|
+
type: "experiment.exposure";
|
|
261
260
|
user: {
|
|
262
261
|
user_id?: string | undefined;
|
|
263
262
|
device_id?: string | undefined;
|
|
@@ -948,8 +947,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
948
947
|
id: string;
|
|
949
948
|
name: string;
|
|
950
949
|
type?: string | undefined;
|
|
951
|
-
description?: string | null | undefined;
|
|
952
950
|
owners?: string[] | undefined;
|
|
951
|
+
description?: string | null | undefined;
|
|
953
952
|
published?: boolean | undefined;
|
|
954
953
|
archived?: boolean | undefined;
|
|
955
954
|
app_id?: number | undefined;
|
|
@@ -961,8 +960,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
961
960
|
id: string;
|
|
962
961
|
name: string;
|
|
963
962
|
type?: string | undefined;
|
|
964
|
-
description?: string | null | undefined;
|
|
965
963
|
owners?: string[] | undefined;
|
|
964
|
+
description?: string | null | undefined;
|
|
966
965
|
published?: boolean | undefined;
|
|
967
966
|
archived?: boolean | undefined;
|
|
968
967
|
app_id?: number | undefined;
|
|
@@ -976,8 +975,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
976
975
|
id: string;
|
|
977
976
|
name: string;
|
|
978
977
|
type?: string | undefined;
|
|
979
|
-
description?: string | null | undefined;
|
|
980
978
|
owners?: string[] | undefined;
|
|
979
|
+
description?: string | null | undefined;
|
|
981
980
|
published?: boolean | undefined;
|
|
982
981
|
archived?: boolean | undefined;
|
|
983
982
|
app_id?: number | undefined;
|
|
@@ -991,8 +990,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
991
990
|
id: string;
|
|
992
991
|
name: string;
|
|
993
992
|
type?: string | undefined;
|
|
994
|
-
description?: string | null | undefined;
|
|
995
993
|
owners?: string[] | undefined;
|
|
994
|
+
description?: string | null | undefined;
|
|
996
995
|
published?: boolean | undefined;
|
|
997
996
|
archived?: boolean | undefined;
|
|
998
997
|
app_id?: number | undefined;
|
|
@@ -1029,8 +1028,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
1029
1028
|
id: string;
|
|
1030
1029
|
name: string;
|
|
1031
1030
|
type?: string | undefined;
|
|
1032
|
-
description?: string | null | undefined;
|
|
1033
1031
|
owners?: string[] | undefined;
|
|
1032
|
+
description?: string | null | undefined;
|
|
1034
1033
|
published?: boolean | undefined;
|
|
1035
1034
|
archived?: boolean | undefined;
|
|
1036
1035
|
app_id?: number | undefined;
|
|
@@ -1042,8 +1041,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
1042
1041
|
id: string;
|
|
1043
1042
|
name: string;
|
|
1044
1043
|
type?: string | undefined;
|
|
1045
|
-
description?: string | null | undefined;
|
|
1046
1044
|
owners?: string[] | undefined;
|
|
1045
|
+
description?: string | null | undefined;
|
|
1047
1046
|
published?: boolean | undefined;
|
|
1048
1047
|
archived?: boolean | undefined;
|
|
1049
1048
|
app_id?: number | undefined;
|
|
@@ -1057,8 +1056,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
1057
1056
|
id: string;
|
|
1058
1057
|
name: string;
|
|
1059
1058
|
type?: string | undefined;
|
|
1060
|
-
description?: string | null | undefined;
|
|
1061
1059
|
owners?: string[] | undefined;
|
|
1060
|
+
description?: string | null | undefined;
|
|
1062
1061
|
published?: boolean | undefined;
|
|
1063
1062
|
archived?: boolean | undefined;
|
|
1064
1063
|
app_id?: number | undefined;
|
|
@@ -1072,8 +1071,8 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
1072
1071
|
id: string;
|
|
1073
1072
|
name: string;
|
|
1074
1073
|
type?: string | undefined;
|
|
1075
|
-
description?: string | null | undefined;
|
|
1076
1074
|
owners?: string[] | undefined;
|
|
1075
|
+
description?: string | null | undefined;
|
|
1077
1076
|
published?: boolean | undefined;
|
|
1078
1077
|
archived?: boolean | undefined;
|
|
1079
1078
|
app_id?: number | undefined;
|
|
@@ -1098,16 +1097,16 @@ export declare const amplitudeEndpointSchemas: {
|
|
|
1098
1097
|
app_id: number;
|
|
1099
1098
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
1100
1099
|
ids: string[];
|
|
1101
|
-
description?: string | undefined;
|
|
1102
1100
|
owners?: string[] | undefined;
|
|
1101
|
+
description?: string | undefined;
|
|
1103
1102
|
published?: boolean | undefined;
|
|
1104
1103
|
}, {
|
|
1105
1104
|
name: string;
|
|
1106
1105
|
app_id: number;
|
|
1107
1106
|
id_type: "BY_AMP_ID" | "BY_USER_ID" | "BY_DEVICE_ID";
|
|
1108
1107
|
ids: string[];
|
|
1109
|
-
description?: string | undefined;
|
|
1110
1108
|
owners?: string[] | undefined;
|
|
1109
|
+
description?: string | undefined;
|
|
1111
1110
|
published?: boolean | undefined;
|
|
1112
1111
|
}>;
|
|
1113
1112
|
readonly output: import("zod").ZodObject<{
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logEventFromContext as j}from"corsair/core";import{request as kt}from"corsair/http";var v=class extends Error{constructor(s,o){super(s);this.code=o;this.name="AmplitudeAPIError"}},g="https://api2.amplitude.com",Ct="https://amplitude.com";async function d(e,n,s={}){let{method:o="GET",body:a,query:p,baseUrl:b=Ct}=s,Et={BASE:b,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{"Content-Type":"application/json",Authorization:`Basic ${Buffer.from(n).toString("base64")}`}},_t={method:o,url:e,body:o==="POST"||o==="PUT"||o==="PATCH"?a:void 0,mediaType:"application/json; charset=utf-8",query:o==="GET"?p:void 0};try{return await kt(Et,_t)}catch(k){throw k instanceof Error?new v(k.message):new v("Unknown error")}}var B=async(e,n)=>{let s=await d("/api/2/annotations",e.key,{method:"GET",query:{app_id:n.app_id}});return await j(e,"amplitude.annotations.list",{...n},"completed"),s},M=async(e,n)=>{let s=await d("/api/2/annotations",e.key,{method:"POST",body:{date:n.date,label:n.label,details:n.details,app_id:n.app_id}});return await j(e,"amplitude.annotations.create",{...n},"completed"),s};import{logEventFromContext as xt}from"corsair/core";var O=async(e,n)=>{let s=await d(`/api/3/chart/${n.chart_id}`,e.key,{method:"GET"});return await xt(e,"amplitude.charts.get",{...n},"completed"),s};import{logEventFromContext as A}from"corsair/core";var W=async(e,n)=>{let s=await d("/api/3/cohorts",e.key,{method:"GET"});if(s.cohorts&&e.db.cohorts)try{for(let o of s.cohorts)o.id&&await e.db.cohorts.upsertByEntityId(o.id,{...o,description:o.description??void 0,size:o.size??void 0})}catch(o){console.warn("Failed to save cohorts to database:",o)}return await A(e,"amplitude.cohorts.list",{...n},"completed"),s},z=async(e,n)=>{let s=await d(`/api/3/cohorts/${n.cohort_id}`,e.key,{method:"GET"});if(s.cohort&&e.db.cohorts)try{let{description:o,...a}=s.cohort;await e.db.cohorts.upsertByEntityId(s.cohort.id,{...a,description:o??void 0})}catch(o){console.warn("Failed to save cohort to database:",o)}return await A(e,"amplitude.cohorts.get",{...n},"completed"),s},F=async(e,n)=>{let s=await d("/api/3/cohorts",e.key,{method:"POST",body:{name:n.name,app_id:n.app_id,id_type:n.id_type,ids:n.ids,owners:n.owners,description:n.description,published:n.published}});if(s.cohort&&e.db.cohorts)try{await e.db.cohorts.upsertByEntityId(s.cohort.id,{...s.cohort})}catch(o){console.warn("Failed to save cohort to database:",o)}return await A(e,"amplitude.cohorts.create",{...n},"completed"),s},q=async(e,n)=>{let s=await d(`/api/5/cohorts/request/${n.request_id}`,e.key,{method:"GET"});return await A(e,"amplitude.cohorts.getMembers",{...n},"completed"),s};import{logEventFromContext as H}from"corsair/core";var N=async(e,n)=>{let s=await d("/api/3/dashboards",e.key,{method:"GET"});return await H(e,"amplitude.dashboards.list",{...n},"completed"),s},$=async(e,n)=>{let s=await d(`/api/3/dashboards/${n.dashboard_id}`,e.key,{method:"GET"});return await H(e,"amplitude.dashboards.get",{...n},"completed"),s};import{logEventFromContext as E}from"corsair/core";var K=async(e,n)=>{let s=await d("/2/httpapi",e.key,{method:"POST",body:{api_key:n.api_key,events:n.events,options:n.options},baseUrl:g});if(e.db.events&&n.events.length>0)try{for(let o of n.events){let a=o.insert_id??[o.event_type,o.user_id??o.device_id??"",String(o.time??Date.now())].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,createdAt:o.time?new Date(o.time):new Date})}}catch(o){console.warn("Failed to save events to database:",o)}return await E(e,"amplitude.events.upload",{...n},"completed"),s},V=async(e,n)=>{let s=await d("/batch",e.key,{method:"POST",body:{api_key:n.api_key,events:n.events,options:n.options},baseUrl:g});if(e.db.events&&n.events.length>0)try{for(let o of n.events){let a=o.insert_id??[o.event_type,o.user_id??o.device_id??"",String(o.time??Date.now())].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,createdAt:o.time?new Date(o.time):new Date})}}catch(o){console.warn("Failed to save events to database:",o)}return await E(e,"amplitude.events.uploadBatch",{...n},"completed"),s},Y=async(e,n)=>{let s=await d("/identify",e.key,{method:"POST",body:{api_key:n.api_key,identification:n.identification},baseUrl:g});if(e.db.users&&n.identification.length>0)try{for(let o of n.identification){let a=o.user_id??o.device_id;a&&await e.db.users.upsertByEntityId(a,{id:a,user_id:o.user_id,user_properties:o.user_properties,createdAt:new Date})}}catch(o){console.warn("Failed to save users to database:",o)}return await E(e,"amplitude.events.identifyUser",{...n},"completed"),s},J=async(e,n)=>{let s=await d("/api/2/events/list",e.key,{method:"GET"});return await E(e,"amplitude.events.getList",{...n},"completed"),s};import{logEventFromContext as It}from"corsair/core";var Q=async(e,n)=>{let s=await d("/api/2/export",e.key,{method:"GET",query:{start:n.start,end:n.end}});return await It(e,"amplitude.exports.getData",{...n},"completed"),s};import{logEventFromContext as C}from"corsair/core";var X=async(e,n)=>{let s=await d("/api/2/usersearch",e.key,{method:"GET",query:{user:n.user,limit:n.limit,offset:n.offset}});if(s.matches&&e.db.users)try{for(let o of s.matches){let a=o.user_id??String(o.amplitude_id);await e.db.users.upsertByEntityId(a,{...o,id:a,canonical_amplitude_id:o.amplitude_id})}}catch(o){console.warn("Failed to save users to database:",o)}return await C(e,"amplitude.users.search",{...n},"completed"),s},Z=async(e,n)=>{let s=await d("/api/2/userprofile",e.key,{method:"GET",query:{user_id:n.user_id,amplitude_id:n.amplitude_id}});if(s.userData)try{let o=s.userData.user_id??(s.userData.amplitude_id?String(s.userData.amplitude_id):void 0);o&&e.db.users&&await e.db.users.upsertByEntityId(o,{...s.userData,id:o})}catch(o){console.warn("Failed to save user to database:",o)}return await C(e,"amplitude.users.getProfile",{...n},"completed"),s},tt=async(e,n)=>{let s=await d("/api/2/useractivity",e.key,{method:"GET",query:{user:n.user,limit:n.limit,offset:n.offset}});if(s.events&&e.db.events)try{for(let o of s.events){let a=[String(o.amplitude_id??n.user),o.event_time??"",o.event_type??""].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,event_type:o.event_type??"",createdAt:o.event_time?new Date(o.event_time):new Date})}}catch(o){console.warn("Failed to save activity events to database:",o)}return await C(e,"amplitude.users.getActivity",{...n},"completed"),s};import{z as t}from"zod";var et=t.object({event_type:t.string(),user_id:t.string().optional(),device_id:t.string().optional(),time:t.number().optional(),event_properties:t.record(t.string(),t.unknown()).optional(),user_properties:t.record(t.string(),t.unknown()).optional(),app_version:t.string().optional(),platform:t.string().optional(),os_name:t.string().optional(),os_version:t.string().optional(),device_brand:t.string().optional(),device_manufacturer:t.string().optional(),device_model:t.string().optional(),carrier:t.string().optional(),country:t.string().optional(),region:t.string().optional(),city:t.string().optional(),language:t.string().optional(),ip:t.string().optional(),insert_id:t.string().optional(),session_id:t.number().optional()}),Gt=t.object({api_key:t.string(),events:t.array(et),options:t.object({min_id_length:t.number().optional()}).optional()}),St=t.object({code:t.number(),events_ingested:t.number().optional(),payload_size_bytes:t.number().optional(),server_upload_time:t.number().optional()}),wt=t.object({api_key:t.string(),events:t.array(et),options:t.object({min_id_length:t.number().optional()}).optional()}),Rt=t.object({code:t.number(),events_ingested:t.number().optional(),payload_size_bytes:t.number().optional(),server_upload_time:t.number().optional()}),Ut=t.object({user_id:t.string().optional(),device_id:t.string().optional(),user_properties:t.record(t.string(),t.unknown())}),Lt=t.object({api_key:t.string(),identification:t.array(Ut)}),Pt=t.object({code:t.number(),error:t.string().optional()}),Dt=t.object({}),Tt=t.object({data:t.array(t.object({event_type:t.string().optional(),display_name:t.string().optional(),totals:t.number().optional(),totals_delta:t.number().optional(),hidden:t.boolean().optional(),deleted:t.boolean().optional(),non_active:t.boolean().optional()})).optional()}),jt=t.object({user:t.string(),limit:t.number().optional(),offset:t.number().optional()}),Bt=t.object({matches:t.array(t.object({amplitude_id:t.number(),user_id:t.string().optional(),last_seen:t.number().optional(),is_identified:t.boolean().optional(),country:t.string().optional(),city:t.string().optional(),platform:t.string().optional(),os:t.string().optional(),device:t.string().optional()})).optional(),next:t.string().optional()}),Mt=t.object({user_id:t.string().optional(),amplitude_id:t.number().optional()}),Ot=t.object({userData:t.object({user_id:t.string().optional(),amplitude_id:t.number().optional(),canonical_amplitude_id:t.number().optional(),merged_amplitude_ids:t.array(t.number()).optional(),is_identified:t.boolean().optional(),user_properties:t.record(t.string(),t.unknown()).optional(),country:t.string().optional(),region:t.string().optional(),city:t.string().optional(),language:t.string().optional(),platform:t.string().optional(),os:t.string().optional(),device:t.string().optional(),last_seen:t.number().optional()}).optional()}),Wt=t.object({user:t.number(),limit:t.number().optional(),offset:t.number().optional()}),zt=t.object({events:t.array(t.object({event_type:t.string().optional(),event_time:t.string().optional(),event_properties:t.record(t.string(),t.unknown()).optional(),session_id:t.number().optional(),amplitude_id:t.number().optional()})).optional(),userData:t.object({num_events:t.number().optional(),num_sessions:t.number().optional(),first_used:t.string().optional(),last_used:t.string().optional(),canonical_amplitude_id:t.number().optional()}).optional()}),Ft=t.object({}),qt=t.object({cohorts:t.array(t.object({id:t.string(),name:t.string(),owners:t.array(t.string()).optional(),description:t.string().nullable().optional(),published:t.boolean().optional(),archived:t.boolean().optional(),app_id:t.number().optional(),size:t.number().nullable().optional(),last_computed:t.number().optional(),last_modified:t.number().optional(),is_predefined:t.boolean().optional(),type:t.string().optional()})).optional()}),Ht=t.object({cohort_id:t.string()}),Nt=t.object({cohort:t.object({id:t.string(),name:t.string(),owners:t.array(t.string()).optional(),description:t.string().nullable().optional(),published:t.boolean().optional(),archived:t.boolean().optional(),app_id:t.number().optional(),size:t.number().optional(),last_computed:t.number().optional(),last_modified:t.number().optional(),is_predefined:t.boolean().optional(),type:t.string().optional()}).optional()}),$t=t.object({name:t.string(),app_id:t.number(),id_type:t.enum(["BY_AMP_ID","BY_USER_ID","BY_DEVICE_ID"]),ids:t.array(t.string()),owners:t.array(t.string()).optional(),description:t.string().optional(),published:t.boolean().optional()}),Kt=t.object({cohort:t.object({id:t.string(),name:t.string(),size:t.number().optional(),last_computed:t.number().optional()}).optional()}),Vt=t.object({request_id:t.string()}),Yt=t.object({status:t.string().optional(),zip_url:t.string().optional()}),Jt=t.object({chart_id:t.string()}),Qt=t.object({data:t.object({series:t.array(t.object({type:t.string().optional(),values:t.array(t.unknown()).optional()})).optional(),xValues:t.array(t.string()).optional()}).optional(),seriesLabels:t.array(t.string()).optional(),title:t.string().optional()}),Xt=t.object({}),Zt=t.object({dashboards:t.array(t.object({id:t.number(),name:t.string(),description:t.string().optional(),created:t.string().optional(),lastUpdated:t.string().optional(),createdBy:t.string().optional(),published:t.boolean().optional()})).optional()}),te=t.object({dashboard_id:t.number()}),ee=t.object({dashboard:t.object({id:t.number(),name:t.string(),description:t.string().optional(),created:t.string().optional(),lastUpdated:t.string().optional(),createdBy:t.string().optional(),published:t.boolean().optional(),charts:t.array(t.object({id:t.string(),name:t.string().optional()})).optional()}).optional()}),oe=t.object({app_id:t.number().optional()}),ne=t.object({data:t.array(t.object({id:t.number(),date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional(),source:t.string().optional()})).optional()}),se=t.object({date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional()}),ie=t.object({data:t.object({id:t.number(),date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional()}).optional()}),re=t.object({start:t.string(),end:t.string()}),ae=t.object({status:t.string().optional(),url:t.string().optional()}),u={eventsUpload:Gt,eventsUploadBatch:wt,eventsIdentifyUser:Lt,eventsGetList:Dt,usersSearch:jt,usersGetProfile:Mt,usersGetActivity:Wt,cohortsList:Ft,cohortsGet:Ht,cohortsCreate:$t,cohortsGetMembers:Vt,chartsGet:Jt,dashboardsList:Xt,dashboardsGet:te,annotationsList:oe,annotationsCreate:se,exportsGetData:re},l={eventsUpload:St,eventsUploadBatch:Rt,eventsIdentifyUser:Pt,eventsGetList:Tt,usersSearch:Bt,usersGetProfile:Ot,usersGetActivity:zt,cohortsList:qt,cohortsGet:Nt,cohortsCreate:Kt,cohortsGetMembers:Yt,chartsGet:Qt,dashboardsList:Zt,dashboardsGet:ee,annotationsList:ne,annotationsCreate:ie,exportsGetData:ae};var h={upload:K,uploadBatch:V,identifyUser:Y,getList:J},_={search:X,getProfile:Z,getActivity:tt},y={list:W,get:z,create:F,getMembers:q},ot={get:O},x={list:N,get:$},I={list:B,create:M},nt={getData:Q};import{ApiError as f}from"corsair/http";var st={RATE_LIMIT_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===429)return!0;let s=e.message.toLowerCase();return s.includes("rate_limited")||s.includes("ratelimited")||e.message.includes("429")},handler:async(e,n)=>{let s;return e instanceof f&&e.retryAfter!==void 0&&(s=e.retryAfter),{maxRetries:5,headersRetryAfterMs:s}}},AUTH_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===401)return!0;let s=e.message.toLowerCase();return s.includes("invalid_api_key")||s.includes("unauthorized")||s.includes("authentication failed")},handler:async(e,n)=>(console.log(`[AMPLITUDE:${n.operation}] Authentication failed - check your API key`),{maxRetries:0})},PERMISSION_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===403)return!0;let s=e.message.toLowerCase();return s.includes("permission_denied")||s.includes("forbidden")||s.includes("access_denied")||s.includes("insufficient_permissions")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Permission denied: ${e.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(e,n)=>{let s=e.message.toLowerCase();return s.includes("network")||s.includes("connection")||s.includes("econnrefused")||s.includes("enotfound")||s.includes("etimedout")||s.includes("fetch failed")||s.includes("network error")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Network error: ${e.message}`),{maxRetries:3})},NOT_FOUND_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===404)return!0;let s=e.message.toLowerCase();return s.includes("not_found")||s.includes("cohort_not_found")||s.includes("chart_not_found")||s.includes("dashboard_not_found")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Resource not found: ${e.message}`),{maxRetries:0})},DEFAULT:{match:(e,n)=>!0,handler:async(e,n)=>(console.error(`[AMPLITUDE:${n.operation}] Unhandled error: ${e.message}`),{maxRetries:0})}};import{z as r}from"zod";var it=r.object({id:r.string(),event_type:r.string(),user_id:r.string().optional(),device_id:r.string().optional(),time:r.number().optional(),event_properties:r.record(r.string(),r.unknown()).optional(),user_properties:r.record(r.string(),r.unknown()).optional(),app_version:r.string().optional(),platform:r.string().optional(),os_name:r.string().optional(),os_version:r.string().optional(),device_brand:r.string().optional(),device_manufacturer:r.string().optional(),device_model:r.string().optional(),carrier:r.string().optional(),country:r.string().optional(),region:r.string().optional(),city:r.string().optional(),dma:r.string().optional(),language:r.string().optional(),ip:r.string().optional(),insert_id:r.string().optional(),session_id:r.number().optional(),createdAt:r.coerce.date().nullable().optional()}),rt=r.object({id:r.string(),user_id:r.string().optional(),user_properties:r.record(r.string(),r.unknown()).optional(),canonical_amplitude_id:r.number().optional(),last_seen:r.number().optional(),is_identified:r.boolean().optional(),country:r.string().optional(),region:r.string().optional(),city:r.string().optional(),language:r.string().optional(),platform:r.string().optional(),os:r.string().optional(),device:r.string().optional(),createdAt:r.coerce.date().nullable().optional()}),at=r.object({id:r.string(),name:r.string(),description:r.string().optional(),app_id:r.number().optional(),owners:r.array(r.string()).optional(),published:r.boolean().optional(),archived:r.boolean().optional(),size:r.number().optional(),last_computed:r.number().optional(),last_modified:r.number().optional(),is_predefined:r.boolean().optional(),type:r.string().optional(),createdAt:r.coerce.date().nullable().optional()});var pt={version:"1.0.0",entities:{events:it,users:rt,cohorts:at}};import{logEventFromContext as dt}from"corsair/core";import{z as i}from"zod";import{verifyHmacSignature as pe}from"corsair/http";var de=i.object({user_id:i.string().optional(),device_id:i.string().optional(),user_properties:i.record(i.string(),i.unknown()).optional(),country:i.string().optional(),city:i.string().optional(),region:i.string().optional(),language:i.string().optional(),platform:i.string().optional(),os:i.string().optional()}),G=i.object({type:i.literal("event.track"),event_id:i.string(),event_type:i.string(),user_id:i.string().optional(),device_id:i.string().optional(),time:i.number(),event_properties:i.record(i.string(),i.unknown()).optional(),user_properties:i.record(i.string(),i.unknown()).optional(),app_version:i.string().optional(),platform:i.string().optional(),session_id:i.number().optional(),insert_id:i.string().optional()}),S=i.object({type:i.literal("event.identify"),user_id:i.string().optional(),device_id:i.string().optional(),time:i.number(),user_properties:i.record(i.string(),i.unknown()).optional(),app_version:i.string().optional(),platform:i.string().optional(),insert_id:i.string().optional()}),w=i.object({type:i.literal("annotation.created"),annotation_id:i.number(),date:i.string(),label:i.string(),details:i.string().optional(),app_id:i.number().optional(),source:i.string().optional(),created_at:i.string()}),R=i.object({type:i.literal("annotation.updated"),annotation_id:i.number(),date:i.string(),label:i.string(),details:i.string().optional(),app_id:i.number().optional(),source:i.string().optional(),updated_at:i.string()}),U=i.object({type:i.literal("monitor.alert"),monitor_id:i.string(),monitor_name:i.string(),alert_type:i.string(),condition:i.string().optional(),value:i.number().optional(),threshold:i.number().optional(),triggered_at:i.string(),chart_id:i.string().optional(),dashboard_id:i.number().optional(),recipients:i.array(i.string()).optional()}),L=i.object({type:i.literal("cohort.computed"),cohort_id:i.string(),cohort_name:i.string(),app_id:i.number().optional(),size:i.number(),computed_at:i.string(),published:i.boolean().optional()}),P=i.object({type:i.literal("experiment.exposure"),flag_key:i.string(),variant:i.string(),user:de,time:i.number(),experiment_key:i.string().optional(),metadata:i.object({deployment_name:i.string().optional(),flag_version:i.number().optional()}).optional()});function ue(e){return typeof e=="string"?JSON.parse(e):e}function c(e){return n=>ue(n.body).type===e}function m(e,n){if(!n)return{valid:!1,error:"Missing webhook secret"};let s=e.rawBody;if(!s)return{valid:!1,error:"Missing raw body for signature verification"};let o=e.headers,a=Array.isArray(o["x-amplitude-signature"])?o["x-amplitude-signature"][0]:o["x-amplitude-signature"];return a?pe(s,n,a)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing x-amplitude-signature header"}}var ut={match:c("annotation.created"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await dt(e,"amplitude.webhook.annotations.created",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}},lt={match:c("annotation.updated"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await dt(e,"amplitude.webhook.annotations.updated",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}};import{logEventFromContext as le}from"corsair/core";var ct={match:c("cohort.computed"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.cohorts)try{a=(await e.db.cohorts.upsertByEntityId(o.cohort_id,{...o,name:o.cohort_name,id:o.cohort_id,last_computed:o.computed_at?new Date(o.computed_at).getTime():void 0,createdAt:new Date(o.computed_at)}))?.id||""}catch(p){console.warn("Failed to save cohort to database:",p)}return await le(e,"amplitude.webhook.cohorts.computed",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as mt}from"corsair/core";var ht={match:c("event.track"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.events)try{let p=o.event_id??o.insert_id??String(o.time);a=(await e.db.events.upsertByEntityId(p,{...o,id:p,createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save event to database:",p)}return await mt(e,"amplitude.webhook.events.track",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}},yt={match:c("event.identify"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.users)try{let p=o.user_id??o.device_id??o.insert_id??String(o.time);a=(await e.db.users.upsertByEntityId(p,{id:p,user_id:o.user_id,user_properties:o.user_properties,platform:o.platform,createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save user to database:",p)}return await mt(e,"amplitude.webhook.events.identify",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as ce}from"corsair/core";var ft={match:c("experiment.exposure"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.events)try{let p=[o.flag_key,o.variant,String(o.time)].join(":");a=(await e.db.events.upsertByEntityId(p,{...o,id:p,event_type:"experiment.exposure",event_properties:{flag_key:o.flag_key,variant:o.variant,experiment_key:o.experiment_key,...o.metadata},createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save experiment exposure event to database:",p)}if(e.db.users)try{let p=o.user.user_id??o.user.device_id;p&&await e.db.users.upsertByEntityId(p,{...o.user,id:p,createdAt:new Date(o.time)})}catch(p){console.warn("Failed to save user from experiment exposure to database:",p)}return await ce(e,"amplitude.webhook.experiments.exposure",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as me}from"corsair/core";var bt={match:c("monitor.alert"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await me(e,"amplitude.webhook.monitors.alert",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}};var D={track:ht,identify:yt},T={created:ut,updated:lt},vt={alert:bt},gt={computed:ct},At={exposure:ft};var he={events:{upload:h.upload,uploadBatch:h.uploadBatch,identifyUser:h.identifyUser,getList:h.getList},users:{search:_.search,getProfile:_.getProfile,getActivity:_.getActivity},cohorts:{list:y.list,get:y.get,create:y.create,getMembers:y.getMembers},charts:{get:ot.get},dashboards:{list:x.list,get:x.get},annotations:{list:I.list,create:I.create},exports:{getData:nt.getData}},ye={events:{track:D.track,identify:D.identify},annotations:{created:T.created,updated:T.updated},monitors:{alert:vt.alert},cohorts:{computed:gt.computed},experiments:{exposure:At.exposure}},fe={"events.upload":{input:u.eventsUpload,output:l.eventsUpload},"events.uploadBatch":{input:u.eventsUploadBatch,output:l.eventsUploadBatch},"events.identifyUser":{input:u.eventsIdentifyUser,output:l.eventsIdentifyUser},"events.getList":{input:u.eventsGetList,output:l.eventsGetList},"users.search":{input:u.usersSearch,output:l.usersSearch},"users.getProfile":{input:u.usersGetProfile,output:l.usersGetProfile},"users.getActivity":{input:u.usersGetActivity,output:l.usersGetActivity},"cohorts.list":{input:u.cohortsList,output:l.cohortsList},"cohorts.get":{input:u.cohortsGet,output:l.cohortsGet},"cohorts.create":{input:u.cohortsCreate,output:l.cohortsCreate},"cohorts.getMembers":{input:u.cohortsGetMembers,output:l.cohortsGetMembers},"charts.get":{input:u.chartsGet,output:l.chartsGet},"dashboards.list":{input:u.dashboardsList,output:l.dashboardsList},"dashboards.get":{input:u.dashboardsGet,output:l.dashboardsGet},"annotations.list":{input:u.annotationsList,output:l.annotationsList},"annotations.create":{input:u.annotationsCreate,output:l.annotationsCreate},"exports.getData":{input:u.exportsGetData,output:l.exportsGetData}},be={"events.upload":{riskLevel:"write",description:"Upload one or more events to Amplitude via HTTP API v2"},"events.uploadBatch":{riskLevel:"write",description:"Batch upload events to Amplitude"},"events.identifyUser":{riskLevel:"write",description:"Set or update user properties via the Identify API"},"events.getList":{riskLevel:"read",description:"List all event types tracked in the project"},"users.search":{riskLevel:"read",description:"Search for users by user ID or device ID"},"users.getProfile":{riskLevel:"read",description:"Get the profile and properties for a specific user"},"users.getActivity":{riskLevel:"read",description:"Get recent event activity for a specific user"},"cohorts.list":{riskLevel:"read",description:"List all cohorts in the project"},"cohorts.get":{riskLevel:"read",description:"Get details for a specific cohort by ID"},"cohorts.create":{riskLevel:"write",description:"Create a new static cohort from a list of user or device IDs"},"cohorts.getMembers":{riskLevel:"read",description:"Retrieve the member download for a cohort export request"},"charts.get":{riskLevel:"read",description:"Get the data results for a specific chart by ID"},"dashboards.list":{riskLevel:"read",description:"List all dashboards in the project"},"dashboards.get":{riskLevel:"read",description:"Get details and chart list for a specific dashboard"},"annotations.list":{riskLevel:"read",description:"List all chart annotations for the project"},"annotations.create":{riskLevel:"write",description:"Create a new chart annotation on a specific date"},"exports.getData":{riskLevel:"read",description:"Export raw event data for a given time range as a zip archive"}},ve={"events.track":{description:"An event was tracked by Amplitude",payload:G,response:G},"events.identify":{description:"A user identify call was received by Amplitude",payload:S,response:S},"annotations.created":{description:"A new chart annotation was created",payload:w,response:w},"annotations.updated":{description:"A chart annotation was updated",payload:R,response:R},"monitors.alert":{description:"An alert monitor threshold was triggered",payload:U,response:U},"cohorts.computed":{description:"A cohort finished computing",payload:L,response:L},"experiments.exposure":{description:"An experiment exposure was tracked for a user",payload:P,response:P}},ge="api_key",Mo={api_key:{account:["one"]}};function Oo(e={}){let n={...e,authType:e.authType??ge};return{id:"amplitude",schema:pt,options:n,hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:he,webhooks:ye,endpointMeta:be,endpointSchemas:fe,webhookSchemas:ve,pluginWebhookMatcher:s=>"x-amplitude-signature"in s.headers,errorHandlers:{...st,...n.errorHandlers},keyBuilder:async(s,o)=>{if(o==="webhook"&&n.webhookSecret)return n.webhookSecret;if(o==="webhook"){let a=await s.keys.get_webhook_signature();return a||""}if(o==="endpoint"&&n.key)return n.key;if(o==="endpoint"&&s.authType==="api_key"){let a=await s.keys.get_api_key();return a||""}return""}}}export{Oo as amplitude,Mo as amplitudeAuthConfig,fe as amplitudeEndpointSchemas,c as createAmplitudeMatch};
|
|
1
|
+
import{logEventFromContext as j}from"corsair/core";import{request as kt}from"corsair/http";var v=class extends Error{constructor(s,o){super(s);this.code=o;this.name="AmplitudeAPIError"}},g="https://api2.amplitude.com",xt="https://amplitude.com";async function d(e,n,s={}){let{method:o="GET",body:a,query:p,baseUrl:b=xt}=s,Et={BASE:b,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{"Content-Type":"application/json",Authorization:`Basic ${Buffer.from(n).toString("base64")}`}},_t={method:o,url:e,body:o==="POST"||o==="PUT"||o==="PATCH"?a:void 0,mediaType:"application/json; charset=utf-8",query:o==="GET"?p:void 0};try{return await kt(Et,_t)}catch(k){throw k instanceof Error?new v(k.message):new v("Unknown error")}}var B=async(e,n)=>{let s=await d("/api/2/annotations",e.key,{method:"GET",query:{app_id:n.app_id}});return await j(e,"amplitude.annotations.list",{...n},"completed"),s},M=async(e,n)=>{let s=await d("/api/2/annotations",e.key,{method:"POST",body:{date:n.date,label:n.label,details:n.details,app_id:n.app_id}});return await j(e,"amplitude.annotations.create",{...n},"completed"),s};import{logEventFromContext as Ct}from"corsair/core";var O=async(e,n)=>{let s=await d(`/api/3/chart/${n.chart_id}`,e.key,{method:"GET"});return await Ct(e,"amplitude.charts.get",{...n},"completed"),s};import{logEventFromContext as A}from"corsair/core";var W=async(e,n)=>{let s=await d("/api/3/cohorts",e.key,{method:"GET"});if(s.cohorts&&e.db.cohorts)try{for(let o of s.cohorts)o.id&&await e.db.cohorts.upsertByEntityId(o.id,{...o,description:o.description??void 0,size:o.size??void 0})}catch(o){console.warn("Failed to save cohorts to database:",o)}return await A(e,"amplitude.cohorts.list",{...n},"completed"),s},z=async(e,n)=>{let s=await d(`/api/3/cohorts/${n.cohort_id}`,e.key,{method:"GET"});if(s.cohort&&e.db.cohorts)try{let{description:o,...a}=s.cohort;await e.db.cohorts.upsertByEntityId(s.cohort.id,{...a,description:o??void 0})}catch(o){console.warn("Failed to save cohort to database:",o)}return await A(e,"amplitude.cohorts.get",{...n},"completed"),s},F=async(e,n)=>{let s=await d("/api/3/cohorts",e.key,{method:"POST",body:{name:n.name,app_id:n.app_id,id_type:n.id_type,ids:n.ids,owners:n.owners,description:n.description,published:n.published}});if(s.cohort&&e.db.cohorts)try{await e.db.cohorts.upsertByEntityId(s.cohort.id,{...s.cohort})}catch(o){console.warn("Failed to save cohort to database:",o)}return await A(e,"amplitude.cohorts.create",{...n},"completed"),s},H=async(e,n)=>{let s=await d(`/api/5/cohorts/request/${n.request_id}`,e.key,{method:"GET"});return await A(e,"amplitude.cohorts.getMembers",{...n},"completed"),s};import{logEventFromContext as q}from"corsair/core";var N=async(e,n)=>{let s=await d("/api/3/dashboards",e.key,{method:"GET"});return await q(e,"amplitude.dashboards.list",{...n},"completed"),s},$=async(e,n)=>{let s=await d(`/api/3/dashboards/${n.dashboard_id}`,e.key,{method:"GET"});return await q(e,"amplitude.dashboards.get",{...n},"completed"),s};import{logEventFromContext as E}from"corsair/core";var K=async(e,n)=>{let s=await d("/2/httpapi",e.key,{method:"POST",body:{api_key:n.api_key,events:n.events,options:n.options},baseUrl:g});if(e.db.events&&n.events.length>0)try{for(let o of n.events){let a=o.insert_id??[o.event_type,o.user_id??o.device_id??"",String(o.time??Date.now())].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,createdAt:o.time?new Date(o.time):new Date})}}catch(o){console.warn("Failed to save events to database:",o)}return await E(e,"amplitude.events.upload",{...n},"completed"),s},V=async(e,n)=>{let s=await d("/batch",e.key,{method:"POST",body:{api_key:n.api_key,events:n.events,options:n.options},baseUrl:g});if(e.db.events&&n.events.length>0)try{for(let o of n.events){let a=o.insert_id??[o.event_type,o.user_id??o.device_id??"",String(o.time??Date.now())].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,createdAt:o.time?new Date(o.time):new Date})}}catch(o){console.warn("Failed to save events to database:",o)}return await E(e,"amplitude.events.uploadBatch",{...n},"completed"),s},Y=async(e,n)=>{let s=await d("/identify",e.key,{method:"POST",body:{api_key:n.api_key,identification:n.identification},baseUrl:g});if(e.db.users&&n.identification.length>0)try{for(let o of n.identification){let a=o.user_id??o.device_id;a&&await e.db.users.upsertByEntityId(a,{id:a,user_id:o.user_id,user_properties:o.user_properties,createdAt:new Date})}}catch(o){console.warn("Failed to save users to database:",o)}return await E(e,"amplitude.events.identifyUser",{...n},"completed"),s},J=async(e,n)=>{let s=await d("/api/2/events/list",e.key,{method:"GET"});return await E(e,"amplitude.events.getList",{...n},"completed"),s};import{logEventFromContext as It}from"corsair/core";var Q=async(e,n)=>{let s=await d("/api/2/export",e.key,{method:"GET",query:{start:n.start,end:n.end}});return await It(e,"amplitude.exports.getData",{...n},"completed"),s};import{logEventFromContext as x}from"corsair/core";var X=async(e,n)=>{let s=await d("/api/2/usersearch",e.key,{method:"GET",query:{user:n.user,limit:n.limit,offset:n.offset}});if(s.matches&&e.db.users)try{for(let o of s.matches){let a=o.user_id??String(o.amplitude_id);await e.db.users.upsertByEntityId(a,{...o,id:a,canonical_amplitude_id:o.amplitude_id})}}catch(o){console.warn("Failed to save users to database:",o)}return await x(e,"amplitude.users.search",{...n},"completed"),s},Z=async(e,n)=>{let s=await d("/api/2/userprofile",e.key,{method:"GET",query:{user_id:n.user_id,amplitude_id:n.amplitude_id}});if(s.userData)try{let o=s.userData.user_id??(s.userData.amplitude_id?String(s.userData.amplitude_id):void 0);o&&e.db.users&&await e.db.users.upsertByEntityId(o,{...s.userData,id:o})}catch(o){console.warn("Failed to save user to database:",o)}return await x(e,"amplitude.users.getProfile",{...n},"completed"),s},tt=async(e,n)=>{let s=await d("/api/2/useractivity",e.key,{method:"GET",query:{user:n.user,limit:n.limit,offset:n.offset}});if(s.events&&e.db.events)try{for(let o of s.events){let a=[String(o.amplitude_id??n.user),o.event_time??"",o.event_type??""].join(":");await e.db.events.upsertByEntityId(a,{...o,id:a,event_type:o.event_type??"",createdAt:o.event_time?new Date(o.event_time):new Date})}}catch(o){console.warn("Failed to save activity events to database:",o)}return await x(e,"amplitude.users.getActivity",{...n},"completed"),s};import{z as t}from"zod";var et=t.object({event_type:t.string(),user_id:t.string().optional(),device_id:t.string().optional(),time:t.number().optional(),event_properties:t.record(t.string(),t.unknown()).optional(),user_properties:t.record(t.string(),t.unknown()).optional(),app_version:t.string().optional(),platform:t.string().optional(),os_name:t.string().optional(),os_version:t.string().optional(),device_brand:t.string().optional(),device_manufacturer:t.string().optional(),device_model:t.string().optional(),carrier:t.string().optional(),country:t.string().optional(),region:t.string().optional(),city:t.string().optional(),language:t.string().optional(),ip:t.string().optional(),insert_id:t.string().optional(),session_id:t.number().optional()}),Gt=t.object({api_key:t.string(),events:t.array(et),options:t.object({min_id_length:t.number().optional()}).optional()}),wt=t.object({code:t.number(),events_ingested:t.number().optional(),payload_size_bytes:t.number().optional(),server_upload_time:t.number().optional()}),St=t.object({api_key:t.string(),events:t.array(et),options:t.object({min_id_length:t.number().optional()}).optional()}),Ut=t.object({code:t.number(),events_ingested:t.number().optional(),payload_size_bytes:t.number().optional(),server_upload_time:t.number().optional()}),Rt=t.object({user_id:t.string().optional(),device_id:t.string().optional(),user_properties:t.record(t.string(),t.unknown())}),Lt=t.object({api_key:t.string(),identification:t.array(Rt)}),Pt=t.object({code:t.number(),error:t.string().optional()}),Dt=t.object({}),Tt=t.object({data:t.array(t.object({event_type:t.string().optional(),display_name:t.string().optional(),totals:t.number().optional(),totals_delta:t.number().optional(),hidden:t.boolean().optional(),deleted:t.boolean().optional(),non_active:t.boolean().optional()})).optional()}),jt=t.object({user:t.string(),limit:t.number().optional(),offset:t.number().optional()}),Bt=t.object({matches:t.array(t.object({amplitude_id:t.number(),user_id:t.string().optional(),last_seen:t.number().optional(),is_identified:t.boolean().optional(),country:t.string().optional(),city:t.string().optional(),platform:t.string().optional(),os:t.string().optional(),device:t.string().optional()})).optional(),next:t.string().optional()}),Mt=t.object({user_id:t.string().optional(),amplitude_id:t.number().optional()}),Ot=t.object({userData:t.object({user_id:t.string().optional(),amplitude_id:t.number().optional(),canonical_amplitude_id:t.number().optional(),merged_amplitude_ids:t.array(t.number()).optional(),is_identified:t.boolean().optional(),user_properties:t.record(t.string(),t.unknown()).optional(),country:t.string().optional(),region:t.string().optional(),city:t.string().optional(),language:t.string().optional(),platform:t.string().optional(),os:t.string().optional(),device:t.string().optional(),last_seen:t.number().optional()}).optional()}),Wt=t.object({user:t.number(),limit:t.number().optional(),offset:t.number().optional()}),zt=t.object({events:t.array(t.object({event_type:t.string().optional(),event_time:t.string().optional(),event_properties:t.record(t.string(),t.unknown()).optional(),session_id:t.number().optional(),amplitude_id:t.number().optional()})).optional(),userData:t.object({num_events:t.number().optional(),num_sessions:t.number().optional(),first_used:t.string().optional(),last_used:t.string().optional(),canonical_amplitude_id:t.number().optional()}).optional()}),Ft=t.object({}),Ht=t.object({cohorts:t.array(t.object({id:t.string(),name:t.string(),owners:t.array(t.string()).optional(),description:t.string().nullable().optional(),published:t.boolean().optional(),archived:t.boolean().optional(),app_id:t.number().optional(),size:t.number().nullable().optional(),last_computed:t.number().optional(),last_modified:t.number().optional(),is_predefined:t.boolean().optional(),type:t.string().optional()})).optional()}),qt=t.object({cohort_id:t.string()}),Nt=t.object({cohort:t.object({id:t.string(),name:t.string(),owners:t.array(t.string()).optional(),description:t.string().nullable().optional(),published:t.boolean().optional(),archived:t.boolean().optional(),app_id:t.number().optional(),size:t.number().optional(),last_computed:t.number().optional(),last_modified:t.number().optional(),is_predefined:t.boolean().optional(),type:t.string().optional()}).optional()}),$t=t.object({name:t.string(),app_id:t.number(),id_type:t.enum(["BY_AMP_ID","BY_USER_ID","BY_DEVICE_ID"]),ids:t.array(t.string()),owners:t.array(t.string()).optional(),description:t.string().optional(),published:t.boolean().optional()}),Kt=t.object({cohort:t.object({id:t.string(),name:t.string(),size:t.number().optional(),last_computed:t.number().optional()}).optional()}),Vt=t.object({request_id:t.string()}),Yt=t.object({status:t.string().optional(),zip_url:t.string().optional()}),Jt=t.object({chart_id:t.string()}),Qt=t.object({data:t.object({series:t.array(t.object({type:t.string().optional(),values:t.array(t.unknown()).optional()})).optional(),xValues:t.array(t.string()).optional()}).optional(),seriesLabels:t.array(t.string()).optional(),title:t.string().optional()}),Xt=t.object({}),Zt=t.object({dashboards:t.array(t.object({id:t.number(),name:t.string(),description:t.string().optional(),created:t.string().optional(),lastUpdated:t.string().optional(),createdBy:t.string().optional(),published:t.boolean().optional()})).optional()}),te=t.object({dashboard_id:t.number()}),ee=t.object({dashboard:t.object({id:t.number(),name:t.string(),description:t.string().optional(),created:t.string().optional(),lastUpdated:t.string().optional(),createdBy:t.string().optional(),published:t.boolean().optional(),charts:t.array(t.object({id:t.string(),name:t.string().optional()})).optional()}).optional()}),oe=t.object({app_id:t.number().optional()}),ne=t.object({data:t.array(t.object({id:t.number(),date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional(),source:t.string().optional()})).optional()}),se=t.object({date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional()}),ie=t.object({data:t.object({id:t.number(),date:t.string(),label:t.string(),details:t.string().optional(),app_id:t.number().optional()}).optional()}),re=t.object({start:t.string(),end:t.string()}),ae=t.object({status:t.string().optional(),url:t.string().optional()}),u={eventsUpload:Gt,eventsUploadBatch:St,eventsIdentifyUser:Lt,eventsGetList:Dt,usersSearch:jt,usersGetProfile:Mt,usersGetActivity:Wt,cohortsList:Ft,cohortsGet:qt,cohortsCreate:$t,cohortsGetMembers:Vt,chartsGet:Jt,dashboardsList:Xt,dashboardsGet:te,annotationsList:oe,annotationsCreate:se,exportsGetData:re},l={eventsUpload:wt,eventsUploadBatch:Ut,eventsIdentifyUser:Pt,eventsGetList:Tt,usersSearch:Bt,usersGetProfile:Ot,usersGetActivity:zt,cohortsList:Ht,cohortsGet:Nt,cohortsCreate:Kt,cohortsGetMembers:Yt,chartsGet:Qt,dashboardsList:Zt,dashboardsGet:ee,annotationsList:ne,annotationsCreate:ie,exportsGetData:ae};var h={upload:K,uploadBatch:V,identifyUser:Y,getList:J},_={search:X,getProfile:Z,getActivity:tt},y={list:W,get:z,create:F,getMembers:H},ot={get:O},C={list:N,get:$},I={list:B,create:M},nt={getData:Q};import{ApiError as f}from"corsair/http";var st={RATE_LIMIT_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===429)return!0;let s=e.message.toLowerCase();return s.includes("rate_limited")||s.includes("ratelimited")||e.message.includes("429")},handler:async(e,n)=>{let s;return e instanceof f&&e.retryAfter!==void 0&&(s=e.retryAfter),{maxRetries:5,headersRetryAfterMs:s}}},AUTH_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===401)return!0;let s=e.message.toLowerCase();return s.includes("invalid_api_key")||s.includes("unauthorized")||s.includes("authentication failed")},handler:async(e,n)=>(console.log(`[AMPLITUDE:${n.operation}] Authentication failed - check your API key`),{maxRetries:0})},PERMISSION_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===403)return!0;let s=e.message.toLowerCase();return s.includes("permission_denied")||s.includes("forbidden")||s.includes("access_denied")||s.includes("insufficient_permissions")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Permission denied: ${e.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(e,n)=>{let s=e.message.toLowerCase();return s.includes("network")||s.includes("connection")||s.includes("econnrefused")||s.includes("enotfound")||s.includes("etimedout")||s.includes("fetch failed")||s.includes("network error")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Network error: ${e.message}`),{maxRetries:3})},NOT_FOUND_ERROR:{match:(e,n)=>{if(e instanceof f&&e.status===404)return!0;let s=e.message.toLowerCase();return s.includes("not_found")||s.includes("cohort_not_found")||s.includes("chart_not_found")||s.includes("dashboard_not_found")},handler:async(e,n)=>(console.warn(`[AMPLITUDE:${n.operation}] Resource not found: ${e.message}`),{maxRetries:0})},DEFAULT:{match:(e,n)=>!0,handler:async(e,n)=>(console.error(`[AMPLITUDE:${n.operation}] Unhandled error: ${e.message}`),{maxRetries:0})}};import{z as r}from"zod";var it=r.object({id:r.string(),event_type:r.string(),user_id:r.string().optional(),device_id:r.string().optional(),time:r.number().optional(),event_properties:r.record(r.string(),r.unknown()).optional(),user_properties:r.record(r.string(),r.unknown()).optional(),app_version:r.string().optional(),platform:r.string().optional(),os_name:r.string().optional(),os_version:r.string().optional(),device_brand:r.string().optional(),device_manufacturer:r.string().optional(),device_model:r.string().optional(),carrier:r.string().optional(),country:r.string().optional(),region:r.string().optional(),city:r.string().optional(),dma:r.string().optional(),language:r.string().optional(),ip:r.string().optional(),insert_id:r.string().optional(),session_id:r.number().optional(),createdAt:r.coerce.date().nullable().optional()}),rt=r.object({id:r.string(),user_id:r.string().optional(),user_properties:r.record(r.string(),r.unknown()).optional(),canonical_amplitude_id:r.number().optional(),last_seen:r.number().optional(),is_identified:r.boolean().optional(),country:r.string().optional(),region:r.string().optional(),city:r.string().optional(),language:r.string().optional(),platform:r.string().optional(),os:r.string().optional(),device:r.string().optional(),createdAt:r.coerce.date().nullable().optional()}),at=r.object({id:r.string(),name:r.string(),description:r.string().optional(),app_id:r.number().optional(),owners:r.array(r.string()).optional(),published:r.boolean().optional(),archived:r.boolean().optional(),size:r.number().optional(),last_computed:r.number().optional(),last_modified:r.number().optional(),is_predefined:r.boolean().optional(),type:r.string().optional(),createdAt:r.coerce.date().nullable().optional()});var pt={version:"1.0.0",entities:{events:it,users:rt,cohorts:at}};import{logEventFromContext as dt}from"corsair/core";import{verifyHmacSignature as pe}from"corsair/http";import{z as i}from"zod";var de=i.object({user_id:i.string().optional(),device_id:i.string().optional(),user_properties:i.record(i.string(),i.unknown()).optional(),country:i.string().optional(),city:i.string().optional(),region:i.string().optional(),language:i.string().optional(),platform:i.string().optional(),os:i.string().optional()}),G=i.object({type:i.literal("event.track"),event_id:i.string(),event_type:i.string(),user_id:i.string().optional(),device_id:i.string().optional(),time:i.number(),event_properties:i.record(i.string(),i.unknown()).optional(),user_properties:i.record(i.string(),i.unknown()).optional(),app_version:i.string().optional(),platform:i.string().optional(),session_id:i.number().optional(),insert_id:i.string().optional()}),w=i.object({type:i.literal("event.identify"),user_id:i.string().optional(),device_id:i.string().optional(),time:i.number(),user_properties:i.record(i.string(),i.unknown()).optional(),app_version:i.string().optional(),platform:i.string().optional(),insert_id:i.string().optional()}),S=i.object({type:i.literal("annotation.created"),annotation_id:i.number(),date:i.string(),label:i.string(),details:i.string().optional(),app_id:i.number().optional(),source:i.string().optional(),created_at:i.string()}),U=i.object({type:i.literal("annotation.updated"),annotation_id:i.number(),date:i.string(),label:i.string(),details:i.string().optional(),app_id:i.number().optional(),source:i.string().optional(),updated_at:i.string()}),R=i.object({type:i.literal("monitor.alert"),monitor_id:i.string(),monitor_name:i.string(),alert_type:i.string(),condition:i.string().optional(),value:i.number().optional(),threshold:i.number().optional(),triggered_at:i.string(),chart_id:i.string().optional(),dashboard_id:i.number().optional(),recipients:i.array(i.string()).optional()}),L=i.object({type:i.literal("cohort.computed"),cohort_id:i.string(),cohort_name:i.string(),app_id:i.number().optional(),size:i.number(),computed_at:i.string(),published:i.boolean().optional()}),P=i.object({type:i.literal("experiment.exposure"),flag_key:i.string(),variant:i.string(),user:de,time:i.number(),experiment_key:i.string().optional(),metadata:i.object({deployment_name:i.string().optional(),flag_version:i.number().optional()}).optional()});function ue(e){return typeof e=="string"?JSON.parse(e):e}function c(e){return n=>ue(n.body).type===e}function m(e,n){if(!n)return{valid:!1,error:"Missing webhook secret"};let s=e.rawBody;if(!s)return{valid:!1,error:"Missing raw body for signature verification"};let o=e.headers,a=Array.isArray(o["x-amplitude-signature"])?o["x-amplitude-signature"][0]:o["x-amplitude-signature"];return a?pe(s,n,a)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing x-amplitude-signature header"}}var ut={match:c("annotation.created"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await dt(e,"amplitude.webhook.annotations.created",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}},lt={match:c("annotation.updated"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await dt(e,"amplitude.webhook.annotations.updated",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}};import{logEventFromContext as le}from"corsair/core";var ct={match:c("cohort.computed"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.cohorts)try{a=(await e.db.cohorts.upsertByEntityId(o.cohort_id,{...o,name:o.cohort_name,id:o.cohort_id,last_computed:o.computed_at?new Date(o.computed_at).getTime():void 0,createdAt:new Date(o.computed_at)}))?.id||""}catch(p){console.warn("Failed to save cohort to database:",p)}return await le(e,"amplitude.webhook.cohorts.computed",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as mt}from"corsair/core";var ht={match:c("event.track"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.events)try{let p=o.event_id??o.insert_id??String(o.time);a=(await e.db.events.upsertByEntityId(p,{...o,id:p,createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save event to database:",p)}return await mt(e,"amplitude.webhook.events.track",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}},yt={match:c("event.identify"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.users)try{let p=o.user_id??o.device_id??o.insert_id??String(o.time);a=(await e.db.users.upsertByEntityId(p,{id:p,user_id:o.user_id,user_properties:o.user_properties,platform:o.platform,createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save user to database:",p)}return await mt(e,"amplitude.webhook.events.identify",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as ce}from"corsair/core";var ft={match:c("experiment.exposure"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;if(!o)return{success:!0,data:void 0};let a="";if(e.db.events)try{let p=[o.flag_key,o.variant,String(o.time)].join(":");a=(await e.db.events.upsertByEntityId(p,{...o,id:p,event_type:"experiment.exposure",event_properties:{flag_key:o.flag_key,variant:o.variant,experiment_key:o.experiment_key,...o.metadata},createdAt:new Date(o.time)}))?.id||""}catch(p){console.warn("Failed to save experiment exposure event to database:",p)}if(e.db.users)try{let p=o.user.user_id??o.user.device_id;p&&await e.db.users.upsertByEntityId(p,{...o.user,id:p,createdAt:new Date(o.time)})}catch(p){console.warn("Failed to save user from experiment exposure to database:",p)}return await ce(e,"amplitude.webhook.experiments.exposure",{...o},"completed"),{success:!0,corsairEntityId:a,data:o}}};import{logEventFromContext as me}from"corsair/core";var bt={match:c("monitor.alert"),handler:async(e,n)=>{let s=m(n,e.key);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload.data;return o?(await me(e,"amplitude.webhook.monitors.alert",{...o},"completed"),{success:!0,data:o}):{success:!0,data:void 0}}};var D={track:ht,identify:yt},T={created:ut,updated:lt},vt={alert:bt},gt={computed:ct},At={exposure:ft};var he={events:{upload:h.upload,uploadBatch:h.uploadBatch,identifyUser:h.identifyUser,getList:h.getList},users:{search:_.search,getProfile:_.getProfile,getActivity:_.getActivity},cohorts:{list:y.list,get:y.get,create:y.create,getMembers:y.getMembers},charts:{get:ot.get},dashboards:{list:C.list,get:C.get},annotations:{list:I.list,create:I.create},exports:{getData:nt.getData}},ye={events:{track:D.track,identify:D.identify},annotations:{created:T.created,updated:T.updated},monitors:{alert:vt.alert},cohorts:{computed:gt.computed},experiments:{exposure:At.exposure}},fe={"events.upload":{input:u.eventsUpload,output:l.eventsUpload},"events.uploadBatch":{input:u.eventsUploadBatch,output:l.eventsUploadBatch},"events.identifyUser":{input:u.eventsIdentifyUser,output:l.eventsIdentifyUser},"events.getList":{input:u.eventsGetList,output:l.eventsGetList},"users.search":{input:u.usersSearch,output:l.usersSearch},"users.getProfile":{input:u.usersGetProfile,output:l.usersGetProfile},"users.getActivity":{input:u.usersGetActivity,output:l.usersGetActivity},"cohorts.list":{input:u.cohortsList,output:l.cohortsList},"cohorts.get":{input:u.cohortsGet,output:l.cohortsGet},"cohorts.create":{input:u.cohortsCreate,output:l.cohortsCreate},"cohorts.getMembers":{input:u.cohortsGetMembers,output:l.cohortsGetMembers},"charts.get":{input:u.chartsGet,output:l.chartsGet},"dashboards.list":{input:u.dashboardsList,output:l.dashboardsList},"dashboards.get":{input:u.dashboardsGet,output:l.dashboardsGet},"annotations.list":{input:u.annotationsList,output:l.annotationsList},"annotations.create":{input:u.annotationsCreate,output:l.annotationsCreate},"exports.getData":{input:u.exportsGetData,output:l.exportsGetData}},be={"events.upload":{riskLevel:"write",description:"Upload one or more events to Amplitude via HTTP API v2"},"events.uploadBatch":{riskLevel:"write",description:"Batch upload events to Amplitude"},"events.identifyUser":{riskLevel:"write",description:"Set or update user properties via the Identify API"},"events.getList":{riskLevel:"read",description:"List all event types tracked in the project"},"users.search":{riskLevel:"read",description:"Search for users by user ID or device ID"},"users.getProfile":{riskLevel:"read",description:"Get the profile and properties for a specific user"},"users.getActivity":{riskLevel:"read",description:"Get recent event activity for a specific user"},"cohorts.list":{riskLevel:"read",description:"List all cohorts in the project"},"cohorts.get":{riskLevel:"read",description:"Get details for a specific cohort by ID"},"cohorts.create":{riskLevel:"write",description:"Create a new static cohort from a list of user or device IDs"},"cohorts.getMembers":{riskLevel:"read",description:"Retrieve the member download for a cohort export request"},"charts.get":{riskLevel:"read",description:"Get the data results for a specific chart by ID"},"dashboards.list":{riskLevel:"read",description:"List all dashboards in the project"},"dashboards.get":{riskLevel:"read",description:"Get details and chart list for a specific dashboard"},"annotations.list":{riskLevel:"read",description:"List all chart annotations for the project"},"annotations.create":{riskLevel:"write",description:"Create a new chart annotation on a specific date"},"exports.getData":{riskLevel:"read",description:"Export raw event data for a given time range as a zip archive"}},ve={"events.track":{description:"An event was tracked by Amplitude",payload:G,response:G},"events.identify":{description:"A user identify call was received by Amplitude",payload:w,response:w},"annotations.created":{description:"A new chart annotation was created",payload:S,response:S},"annotations.updated":{description:"A chart annotation was updated",payload:U,response:U},"monitors.alert":{description:"An alert monitor threshold was triggered",payload:R,response:R},"cohorts.computed":{description:"A cohort finished computing",payload:L,response:L},"experiments.exposure":{description:"An experiment exposure was tracked for a user",payload:P,response:P}},ge="api_key",Mo={api_key:{account:["one"]}};function Oo(e={}){let n={...e,authType:e.authType??ge};return{id:"amplitude",schema:pt,options:n,hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:he,webhooks:ye,endpointMeta:be,endpointSchemas:fe,webhookSchemas:ve,pluginWebhookMatcher:s=>"x-amplitude-signature"in s.headers,errorHandlers:{...st,...n.errorHandlers},keyBuilder:async(s,o)=>{let a=s.authType;if(o==="webhook"&&n.webhookSecret)return n.webhookSecret;if(o==="webhook"){let p=await s.keys.get_webhook_signature();if(!p)throw new Error("[auth-missing:amplitude:webhook_signature]: Amplitude webhook signature is missing");return p}if(o==="endpoint"&&n.key)return n.key;if(o==="endpoint"&&s.authType==="api_key"){let p=await s.keys.get_api_key();if(!p)throw new Error("[auth-missing:amplitude:api_key]: Amplitude API Key is missing");return p}throw new Error(`[auth-missing:amplitude:${a}]: Amplitude key is missing`)}}}export{Oo as amplitude,Mo as amplitudeAuthConfig,fe as amplitudeEndpointSchemas,c as createAmplitudeMatch};
|
|
@@ -25,8 +25,8 @@ export declare const AmplitudeEvent: z.ZodObject<{
|
|
|
25
25
|
session_id: z.ZodOptional<z.ZodNumber>;
|
|
26
26
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
27
27
|
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
id: string;
|
|
29
28
|
event_type: string;
|
|
29
|
+
id: string;
|
|
30
30
|
user_id?: string | undefined;
|
|
31
31
|
device_id?: string | undefined;
|
|
32
32
|
time?: number | undefined;
|
|
@@ -50,8 +50,8 @@ export declare const AmplitudeEvent: z.ZodObject<{
|
|
|
50
50
|
dma?: string | undefined;
|
|
51
51
|
createdAt?: Date | null | undefined;
|
|
52
52
|
}, {
|
|
53
|
-
id: string;
|
|
54
53
|
event_type: string;
|
|
54
|
+
id: string;
|
|
55
55
|
user_id?: string | undefined;
|
|
56
56
|
device_id?: string | undefined;
|
|
57
57
|
time?: number | undefined;
|
|
@@ -139,8 +139,8 @@ export declare const AmplitudeCohort: z.ZodObject<{
|
|
|
139
139
|
id: string;
|
|
140
140
|
name: string;
|
|
141
141
|
type?: string | undefined;
|
|
142
|
-
description?: string | undefined;
|
|
143
142
|
owners?: string[] | undefined;
|
|
143
|
+
description?: string | undefined;
|
|
144
144
|
published?: boolean | undefined;
|
|
145
145
|
archived?: boolean | undefined;
|
|
146
146
|
app_id?: number | undefined;
|
|
@@ -153,8 +153,8 @@ export declare const AmplitudeCohort: z.ZodObject<{
|
|
|
153
153
|
id: string;
|
|
154
154
|
name: string;
|
|
155
155
|
type?: string | undefined;
|
|
156
|
-
description?: string | undefined;
|
|
157
156
|
owners?: string[] | undefined;
|
|
157
|
+
description?: string | undefined;
|
|
158
158
|
published?: boolean | undefined;
|
|
159
159
|
archived?: boolean | undefined;
|
|
160
160
|
app_id?: number | undefined;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ export declare const AmplitudeSchema: {
|
|
|
27
27
|
session_id: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
28
28
|
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
29
29
|
}, "strip", import("zod").ZodTypeAny, {
|
|
30
|
-
id: string;
|
|
31
30
|
event_type: string;
|
|
31
|
+
id: string;
|
|
32
32
|
user_id?: string | undefined;
|
|
33
33
|
device_id?: string | undefined;
|
|
34
34
|
time?: number | undefined;
|
|
@@ -52,8 +52,8 @@ export declare const AmplitudeSchema: {
|
|
|
52
52
|
dma?: string | undefined;
|
|
53
53
|
createdAt?: Date | null | undefined;
|
|
54
54
|
}, {
|
|
55
|
-
id: string;
|
|
56
55
|
event_type: string;
|
|
56
|
+
id: string;
|
|
57
57
|
user_id?: string | undefined;
|
|
58
58
|
device_id?: string | undefined;
|
|
59
59
|
time?: number | undefined;
|
|
@@ -141,8 +141,8 @@ export declare const AmplitudeSchema: {
|
|
|
141
141
|
id: string;
|
|
142
142
|
name: string;
|
|
143
143
|
type?: string | undefined;
|
|
144
|
-
description?: string | undefined;
|
|
145
144
|
owners?: string[] | undefined;
|
|
145
|
+
description?: string | undefined;
|
|
146
146
|
published?: boolean | undefined;
|
|
147
147
|
archived?: boolean | undefined;
|
|
148
148
|
app_id?: number | undefined;
|
|
@@ -155,8 +155,8 @@ export declare const AmplitudeSchema: {
|
|
|
155
155
|
id: string;
|
|
156
156
|
name: string;
|
|
157
157
|
type?: string | undefined;
|
|
158
|
-
description?: string | undefined;
|
|
159
158
|
owners?: string[] | undefined;
|
|
159
|
+
description?: string | undefined;
|
|
160
160
|
published?: boolean | undefined;
|
|
161
161
|
archived?: boolean | undefined;
|
|
162
162
|
app_id?: number | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AmplitudeWebhooks } from '
|
|
1
|
+
import type { AmplitudeWebhooks } from '../index';
|
|
2
2
|
export declare const created: AmplitudeWebhooks['annotationsCreated'];
|
|
3
3
|
export declare const updated: AmplitudeWebhooks['annotationsUpdated'];
|
|
4
4
|
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../webhooks/annotations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../webhooks/annotations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CA4B3D,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,oBAAoB,CA4B3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cohorts.d.ts","sourceRoot":"","sources":["../../webhooks/cohorts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cohorts.d.ts","sourceRoot":"","sources":["../../webhooks/cohorts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,iBAAiB,CA+CzD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../webhooks/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../webhooks/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,aAAa,CA6ClD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,CAkDxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../webhooks/experiments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"experiments.d.ts","sourceRoot":"","sources":["../../webhooks/experiments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,qBAAqB,CA4E7D,CAAC"}
|
package/dist/webhooks/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export declare const EventWebhooks: {
|
|
|
2
2
|
track: {
|
|
3
3
|
match: import("corsair/core").CorsairWebhookMatcher;
|
|
4
4
|
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
5
|
-
type: "event.track";
|
|
6
5
|
event_type: string;
|
|
7
6
|
time: number;
|
|
7
|
+
type: "event.track";
|
|
8
8
|
event_id: string;
|
|
9
9
|
user_id?: string | undefined;
|
|
10
10
|
device_id?: string | undefined;
|
|
@@ -15,9 +15,9 @@ export declare const EventWebhooks: {
|
|
|
15
15
|
insert_id?: string | undefined;
|
|
16
16
|
session_id?: number | undefined;
|
|
17
17
|
}>, {
|
|
18
|
-
type: "event.track";
|
|
19
18
|
event_type: string;
|
|
20
19
|
time: number;
|
|
20
|
+
type: "event.track";
|
|
21
21
|
event_id: string;
|
|
22
22
|
user_id?: string | undefined;
|
|
23
23
|
device_id?: string | undefined;
|
|
@@ -32,8 +32,8 @@ export declare const EventWebhooks: {
|
|
|
32
32
|
identify: {
|
|
33
33
|
match: import("corsair/core").CorsairWebhookMatcher;
|
|
34
34
|
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
35
|
-
type: "event.identify";
|
|
36
35
|
time: number;
|
|
36
|
+
type: "event.identify";
|
|
37
37
|
user_id?: string | undefined;
|
|
38
38
|
device_id?: string | undefined;
|
|
39
39
|
user_properties?: Record<string, unknown> | undefined;
|
|
@@ -41,8 +41,8 @@ export declare const EventWebhooks: {
|
|
|
41
41
|
platform?: string | undefined;
|
|
42
42
|
insert_id?: string | undefined;
|
|
43
43
|
}>, {
|
|
44
|
-
type: "event.identify";
|
|
45
44
|
time: number;
|
|
45
|
+
type: "event.identify";
|
|
46
46
|
user_id?: string | undefined;
|
|
47
47
|
device_id?: string | undefined;
|
|
48
48
|
user_properties?: Record<string, unknown> | undefined;
|
|
@@ -57,18 +57,18 @@ export declare const AnnotationWebhooks: {
|
|
|
57
57
|
match: import("corsair/core").CorsairWebhookMatcher;
|
|
58
58
|
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
59
59
|
date: string;
|
|
60
|
-
created_at: string;
|
|
61
60
|
type: "annotation.created";
|
|
62
61
|
label: string;
|
|
62
|
+
created_at: string;
|
|
63
63
|
annotation_id: number;
|
|
64
64
|
app_id?: number | undefined;
|
|
65
65
|
details?: string | undefined;
|
|
66
66
|
source?: string | undefined;
|
|
67
67
|
}>, {
|
|
68
68
|
date: string;
|
|
69
|
-
created_at: string;
|
|
70
69
|
type: "annotation.created";
|
|
71
70
|
label: string;
|
|
71
|
+
created_at: string;
|
|
72
72
|
annotation_id: number;
|
|
73
73
|
app_id?: number | undefined;
|
|
74
74
|
details?: string | undefined;
|
|
@@ -79,18 +79,18 @@ export declare const AnnotationWebhooks: {
|
|
|
79
79
|
match: import("corsair/core").CorsairWebhookMatcher;
|
|
80
80
|
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
81
81
|
date: string;
|
|
82
|
-
updated_at: string;
|
|
83
82
|
type: "annotation.updated";
|
|
84
83
|
label: string;
|
|
84
|
+
updated_at: string;
|
|
85
85
|
annotation_id: number;
|
|
86
86
|
app_id?: number | undefined;
|
|
87
87
|
details?: string | undefined;
|
|
88
88
|
source?: string | undefined;
|
|
89
89
|
}>, {
|
|
90
90
|
date: string;
|
|
91
|
-
updated_at: string;
|
|
92
91
|
type: "annotation.updated";
|
|
93
92
|
label: string;
|
|
93
|
+
updated_at: string;
|
|
94
94
|
annotation_id: number;
|
|
95
95
|
app_id?: number | undefined;
|
|
96
96
|
details?: string | undefined;
|
|
@@ -154,8 +154,8 @@ export declare const ExperimentWebhooks: {
|
|
|
154
154
|
exposure: {
|
|
155
155
|
match: import("corsair/core").CorsairWebhookMatcher;
|
|
156
156
|
handler: import("corsair/core").CorsairWebhookHandler<import("..").AmplitudeContext, import("./types").AmplitudeWebhookPayload<{
|
|
157
|
-
type: "experiment.exposure";
|
|
158
157
|
time: number;
|
|
158
|
+
type: "experiment.exposure";
|
|
159
159
|
user: {
|
|
160
160
|
user_id?: string | undefined;
|
|
161
161
|
device_id?: string | undefined;
|
|
@@ -175,8 +175,8 @@ export declare const ExperimentWebhooks: {
|
|
|
175
175
|
flag_version?: number | undefined;
|
|
176
176
|
} | undefined;
|
|
177
177
|
}>, {
|
|
178
|
-
type: "experiment.exposure";
|
|
179
178
|
time: number;
|
|
179
|
+
type: "experiment.exposure";
|
|
180
180
|
user: {
|
|
181
181
|
user_id?: string | undefined;
|
|
182
182
|
device_id?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../webhooks/monitors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"monitors.d.ts","sourceRoot":"","sources":["../../webhooks/monitors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,eAAe,CA4BpD,CAAC"}
|
package/dist/webhooks/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import type { CorsairWebhookMatcher, WebhookRequest } from 'corsair/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
export declare const AmplitudeTrackEventSchema: z.ZodObject<{
|
|
4
4
|
type: z.ZodLiteral<"event.track">;
|
|
5
5
|
event_id: z.ZodString;
|
|
@@ -14,9 +14,9 @@ export declare const AmplitudeTrackEventSchema: z.ZodObject<{
|
|
|
14
14
|
session_id: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
insert_id: z.ZodOptional<z.ZodString>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
type: "event.track";
|
|
18
17
|
event_type: string;
|
|
19
18
|
time: number;
|
|
19
|
+
type: "event.track";
|
|
20
20
|
event_id: string;
|
|
21
21
|
user_id?: string | undefined;
|
|
22
22
|
device_id?: string | undefined;
|
|
@@ -27,9 +27,9 @@ export declare const AmplitudeTrackEventSchema: z.ZodObject<{
|
|
|
27
27
|
insert_id?: string | undefined;
|
|
28
28
|
session_id?: number | undefined;
|
|
29
29
|
}, {
|
|
30
|
-
type: "event.track";
|
|
31
30
|
event_type: string;
|
|
32
31
|
time: number;
|
|
32
|
+
type: "event.track";
|
|
33
33
|
event_id: string;
|
|
34
34
|
user_id?: string | undefined;
|
|
35
35
|
device_id?: string | undefined;
|
|
@@ -51,8 +51,8 @@ export declare const AmplitudeIdentifyEventSchema: z.ZodObject<{
|
|
|
51
51
|
platform: z.ZodOptional<z.ZodString>;
|
|
52
52
|
insert_id: z.ZodOptional<z.ZodString>;
|
|
53
53
|
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
type: "event.identify";
|
|
55
54
|
time: number;
|
|
55
|
+
type: "event.identify";
|
|
56
56
|
user_id?: string | undefined;
|
|
57
57
|
device_id?: string | undefined;
|
|
58
58
|
user_properties?: Record<string, unknown> | undefined;
|
|
@@ -60,8 +60,8 @@ export declare const AmplitudeIdentifyEventSchema: z.ZodObject<{
|
|
|
60
60
|
platform?: string | undefined;
|
|
61
61
|
insert_id?: string | undefined;
|
|
62
62
|
}, {
|
|
63
|
-
type: "event.identify";
|
|
64
63
|
time: number;
|
|
64
|
+
type: "event.identify";
|
|
65
65
|
user_id?: string | undefined;
|
|
66
66
|
device_id?: string | undefined;
|
|
67
67
|
user_properties?: Record<string, unknown> | undefined;
|
|
@@ -81,18 +81,18 @@ export declare const AmplitudeAnnotationCreatedEventSchema: z.ZodObject<{
|
|
|
81
81
|
created_at: z.ZodString;
|
|
82
82
|
}, "strip", z.ZodTypeAny, {
|
|
83
83
|
date: string;
|
|
84
|
-
created_at: string;
|
|
85
84
|
type: "annotation.created";
|
|
86
85
|
label: string;
|
|
86
|
+
created_at: string;
|
|
87
87
|
annotation_id: number;
|
|
88
88
|
app_id?: number | undefined;
|
|
89
89
|
details?: string | undefined;
|
|
90
90
|
source?: string | undefined;
|
|
91
91
|
}, {
|
|
92
92
|
date: string;
|
|
93
|
-
created_at: string;
|
|
94
93
|
type: "annotation.created";
|
|
95
94
|
label: string;
|
|
95
|
+
created_at: string;
|
|
96
96
|
annotation_id: number;
|
|
97
97
|
app_id?: number | undefined;
|
|
98
98
|
details?: string | undefined;
|
|
@@ -110,18 +110,18 @@ export declare const AmplitudeAnnotationUpdatedEventSchema: z.ZodObject<{
|
|
|
110
110
|
updated_at: z.ZodString;
|
|
111
111
|
}, "strip", z.ZodTypeAny, {
|
|
112
112
|
date: string;
|
|
113
|
-
updated_at: string;
|
|
114
113
|
type: "annotation.updated";
|
|
115
114
|
label: string;
|
|
115
|
+
updated_at: string;
|
|
116
116
|
annotation_id: number;
|
|
117
117
|
app_id?: number | undefined;
|
|
118
118
|
details?: string | undefined;
|
|
119
119
|
source?: string | undefined;
|
|
120
120
|
}, {
|
|
121
121
|
date: string;
|
|
122
|
-
updated_at: string;
|
|
123
122
|
type: "annotation.updated";
|
|
124
123
|
label: string;
|
|
124
|
+
updated_at: string;
|
|
125
125
|
annotation_id: number;
|
|
126
126
|
app_id?: number | undefined;
|
|
127
127
|
details?: string | undefined;
|
|
@@ -240,8 +240,8 @@ export declare const AmplitudeExperimentExposureEventSchema: z.ZodObject<{
|
|
|
240
240
|
flag_version?: number | undefined;
|
|
241
241
|
}>>;
|
|
242
242
|
}, "strip", z.ZodTypeAny, {
|
|
243
|
-
type: "experiment.exposure";
|
|
244
243
|
time: number;
|
|
244
|
+
type: "experiment.exposure";
|
|
245
245
|
user: {
|
|
246
246
|
user_id?: string | undefined;
|
|
247
247
|
device_id?: string | undefined;
|
|
@@ -261,8 +261,8 @@ export declare const AmplitudeExperimentExposureEventSchema: z.ZodObject<{
|
|
|
261
261
|
flag_version?: number | undefined;
|
|
262
262
|
} | undefined;
|
|
263
263
|
}, {
|
|
264
|
-
type: "experiment.exposure";
|
|
265
264
|
time: number;
|
|
265
|
+
type: "experiment.exposure";
|
|
266
266
|
user: {
|
|
267
267
|
user_id?: string | undefined;
|
|
268
268
|
device_id?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,qBAAqB,EAErB,cAAc,EACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/amplitude",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Amplitude plugin for Corsair",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,10 +18,12 @@
|
|
|
18
18
|
"zod": "^3.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.5.14",
|
|
22
|
+
"ts-jest": "^29.4.9",
|
|
21
23
|
"tsup": "^8.0.1",
|
|
22
24
|
"typescript": "^5.9.3",
|
|
23
25
|
"zod": "^3.25.76",
|
|
24
|
-
"corsair": "0.1.
|
|
26
|
+
"corsair": "0.1.67"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
27
29
|
"corsair",
|
|
@@ -33,8 +35,12 @@
|
|
|
33
35
|
"files": [
|
|
34
36
|
"dist"
|
|
35
37
|
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"jest": "^29.7.0"
|
|
40
|
+
},
|
|
36
41
|
"scripts": {
|
|
37
42
|
"build": "rm -rf dist && tsc --build --force && tsup",
|
|
38
|
-
"typecheck": "tsc --noEmit"
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
44
|
+
"test": "jest"
|
|
39
45
|
}
|
|
40
46
|
}
|