@powersync/management-types 0.0.0-dev-20260225124534 → 0.0.0-dev.6f42cb4c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/routes/dev-routes.d.ts +14 -0
- package/dist/routes/manage-routes.d.ts +39 -0
- package/dist/routes/reporting-routes.d.ts +107 -26
- package/dist/routes/reporting-routes.js +43 -18
- package/dist/routes/reporting-routes.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ import { routes } from '@powersync/management-types';
|
|
|
41
41
|
routes.MANAGE_ROUTES.LIST;
|
|
42
42
|
routes.DEV_ROUTES.TEST_CONNECTION;
|
|
43
43
|
routes.GENERAL_ROUTES.LIST_REGIONS;
|
|
44
|
-
routes.REPORT_ROUTES.
|
|
44
|
+
routes.REPORT_ROUTES.GET_CONNECTIONS_SUMMARY;
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Request/Response Types
|
package/dist/errors.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare enum PowerSyncErrorCodes {
|
|
|
5
5
|
INVALID_REGION = "INVALID_REGION",
|
|
6
6
|
INVALID_CONFIG = "INVALID_CONFIG",
|
|
7
7
|
PROJECT_NOT_FOUND = "PROJECT_NOT_FOUND",
|
|
8
|
+
REGION_AT_CAPACITY = "REGION_AT_CAPACITY",
|
|
8
9
|
PSYNC_M1202_CONNECTION_TEST_TIMEOUT = "PSYNC_M1202",
|
|
9
10
|
PSYNC_M1203_CONNECTION_TEST_FAILED = "PSYNC_M1203",
|
|
10
11
|
PSYNC_M1204_CONNECTION_TEST_BUSY = "PSYNC_M1204"
|
package/dist/errors.js
CHANGED
|
@@ -7,6 +7,7 @@ export var PowerSyncErrorCodes;
|
|
|
7
7
|
PowerSyncErrorCodes["INVALID_REGION"] = "INVALID_REGION";
|
|
8
8
|
PowerSyncErrorCodes["INVALID_CONFIG"] = "INVALID_CONFIG";
|
|
9
9
|
PowerSyncErrorCodes["PROJECT_NOT_FOUND"] = "PROJECT_NOT_FOUND";
|
|
10
|
+
PowerSyncErrorCodes["REGION_AT_CAPACITY"] = "REGION_AT_CAPACITY";
|
|
10
11
|
PowerSyncErrorCodes["PSYNC_M1202_CONNECTION_TEST_TIMEOUT"] = "PSYNC_M1202";
|
|
11
12
|
PowerSyncErrorCodes["PSYNC_M1203_CONNECTION_TEST_FAILED"] = "PSYNC_M1203";
|
|
12
13
|
PowerSyncErrorCodes["PSYNC_M1204_CONNECTION_TEST_BUSY"] = "PSYNC_M1204";
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,wDAAiC,CAAA;IACjC,gEAAyC,CAAA;IACzC,4DAAqC,CAAA;IACrC,wDAAiC,CAAA;IACjC,wDAAiC,CAAA;IACjC,8DAAuC,CAAA;IACvC,gEAAyC,CAAA;IAEzC,0EAAmD,CAAA;IACnD,yEAAkD,CAAA;IAClD,uEAAgD,CAAA;AAClD,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B"}
|
|
@@ -540,6 +540,13 @@ export declare const ValidateSyncRulesResponse: t.ObjectCodec<{
|
|
|
540
540
|
errors: t.ArrayCodec<t.ObjectCodec<{
|
|
541
541
|
level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
|
|
542
542
|
message: t.IdentityCodec<t.CodecType.String>;
|
|
543
|
+
location: t.OptionalCodec<t.Codec<{
|
|
544
|
+
start_offset: number;
|
|
545
|
+
end_offset: number;
|
|
546
|
+
}, {
|
|
547
|
+
start_offset: number;
|
|
548
|
+
end_offset: number;
|
|
549
|
+
}, string, t.CodecProps>>;
|
|
543
550
|
ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
544
551
|
}>>;
|
|
545
552
|
}>>;
|
|
@@ -547,6 +554,13 @@ export declare const ValidateSyncRulesResponse: t.ObjectCodec<{
|
|
|
547
554
|
errors: t.ArrayCodec<t.ObjectCodec<{
|
|
548
555
|
level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
|
|
549
556
|
message: t.IdentityCodec<t.CodecType.String>;
|
|
557
|
+
location: t.OptionalCodec<t.Codec<{
|
|
558
|
+
start_offset: number;
|
|
559
|
+
end_offset: number;
|
|
560
|
+
}, {
|
|
561
|
+
start_offset: number;
|
|
562
|
+
end_offset: number;
|
|
563
|
+
}, string, t.CodecProps>>;
|
|
550
564
|
ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
551
565
|
}>>;
|
|
552
566
|
}>;
|
|
@@ -926,6 +926,13 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
926
926
|
errors: t.ArrayCodec<t.ObjectCodec<{
|
|
927
927
|
level: t.Union<t.Codec<"warning", "warning", string, t.CodecProps>, t.LiteralCodec<"fatal">>;
|
|
928
928
|
message: t.IdentityCodec<t.CodecType.String>;
|
|
929
|
+
location: t.OptionalCodec<t.Codec<{
|
|
930
|
+
start_offset: number;
|
|
931
|
+
end_offset: number;
|
|
932
|
+
}, {
|
|
933
|
+
start_offset: number;
|
|
934
|
+
end_offset: number;
|
|
935
|
+
}, string, t.CodecProps>>;
|
|
929
936
|
ts: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
930
937
|
}>>;
|
|
931
938
|
}>>;
|
|
@@ -933,6 +940,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
933
940
|
errors: {
|
|
934
941
|
level: "warning" | "fatal";
|
|
935
942
|
message: string;
|
|
943
|
+
location?: {
|
|
944
|
+
start_offset: number;
|
|
945
|
+
end_offset: number;
|
|
946
|
+
} | undefined;
|
|
936
947
|
ts?: string | undefined;
|
|
937
948
|
}[];
|
|
938
949
|
connections: {
|
|
@@ -949,6 +960,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
949
960
|
errors: {
|
|
950
961
|
level: "warning" | "fatal";
|
|
951
962
|
message: string;
|
|
963
|
+
location?: {
|
|
964
|
+
start_offset: number;
|
|
965
|
+
end_offset: number;
|
|
966
|
+
} | undefined;
|
|
952
967
|
ts?: string | undefined;
|
|
953
968
|
}[];
|
|
954
969
|
pattern?: string | undefined;
|
|
@@ -963,6 +978,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
963
978
|
errors: {
|
|
964
979
|
level: "warning" | "fatal";
|
|
965
980
|
message: string;
|
|
981
|
+
location?: {
|
|
982
|
+
start_offset: number;
|
|
983
|
+
end_offset: number;
|
|
984
|
+
} | undefined;
|
|
966
985
|
ts?: string | undefined;
|
|
967
986
|
}[];
|
|
968
987
|
connections: {
|
|
@@ -979,6 +998,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
979
998
|
errors: {
|
|
980
999
|
level: "warning" | "fatal";
|
|
981
1000
|
message: string;
|
|
1001
|
+
location?: {
|
|
1002
|
+
start_offset: number;
|
|
1003
|
+
end_offset: number;
|
|
1004
|
+
} | undefined;
|
|
982
1005
|
ts?: string | undefined;
|
|
983
1006
|
}[];
|
|
984
1007
|
pattern?: string | undefined;
|
|
@@ -994,6 +1017,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
994
1017
|
errors: {
|
|
995
1018
|
level: "warning" | "fatal";
|
|
996
1019
|
message: string;
|
|
1020
|
+
location?: {
|
|
1021
|
+
start_offset: number;
|
|
1022
|
+
end_offset: number;
|
|
1023
|
+
} | undefined;
|
|
997
1024
|
ts?: string | undefined;
|
|
998
1025
|
}[];
|
|
999
1026
|
connections: {
|
|
@@ -1010,6 +1037,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
1010
1037
|
errors: {
|
|
1011
1038
|
level: "warning" | "fatal";
|
|
1012
1039
|
message: string;
|
|
1040
|
+
location?: {
|
|
1041
|
+
start_offset: number;
|
|
1042
|
+
end_offset: number;
|
|
1043
|
+
} | undefined;
|
|
1013
1044
|
ts?: string | undefined;
|
|
1014
1045
|
}[];
|
|
1015
1046
|
pattern?: string | undefined;
|
|
@@ -1024,6 +1055,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
1024
1055
|
errors: {
|
|
1025
1056
|
level: "warning" | "fatal";
|
|
1026
1057
|
message: string;
|
|
1058
|
+
location?: {
|
|
1059
|
+
start_offset: number;
|
|
1060
|
+
end_offset: number;
|
|
1061
|
+
} | undefined;
|
|
1027
1062
|
ts?: string | undefined;
|
|
1028
1063
|
}[];
|
|
1029
1064
|
connections: {
|
|
@@ -1040,6 +1075,10 @@ export declare const InstanceDiagnosticsResponse: t.ObjectCodec<{
|
|
|
1040
1075
|
errors: {
|
|
1041
1076
|
level: "warning" | "fatal";
|
|
1042
1077
|
message: string;
|
|
1078
|
+
location?: {
|
|
1079
|
+
start_offset: number;
|
|
1080
|
+
end_offset: number;
|
|
1081
|
+
} | undefined;
|
|
1043
1082
|
ts?: string | undefined;
|
|
1044
1083
|
}[];
|
|
1045
1084
|
pattern?: string | undefined;
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import * as t from 'ts-codec';
|
|
2
2
|
export declare enum REPORT_ROUTES {
|
|
3
|
-
|
|
4
|
-
GET_CURRENT_CONNECTIONS = "/api/v1/
|
|
5
|
-
|
|
3
|
+
GET_CONNECTIONS_SUMMARY = "/api/v1/connections/summary",
|
|
4
|
+
GET_CURRENT_CONNECTIONS = "/api/v1/connections/current",
|
|
5
|
+
GET_CLIENT_SESSIONS = "/api/v1/client/sessions",
|
|
6
|
+
/** @deprecated Use GET_CONNECTIONS_SUMMARY instead. */
|
|
7
|
+
DEPRECATED_GET_CLIENT_CONNECTION_DATA = "/api/admin/v1/connections/reports",
|
|
8
|
+
/** @deprecated Use GET_CURRENT_CONNECTIONS instead. */
|
|
9
|
+
DEPRECATED_GET_CONNECTED_CLIENTS = "/api/admin/v1/connections/current",
|
|
10
|
+
/** @deprecated Use GET_CLIENT_SESSIONS instead. */
|
|
11
|
+
DEPRECATED_GET_GENERAL_CLIENT_ANALYTICS = "/api/v1/report/connection/general/analytics"
|
|
6
12
|
}
|
|
7
|
-
export declare const ClientConnectionsReportRequest: t.
|
|
13
|
+
export declare const ClientConnectionsReportRequest: t.ObjectCodec<{
|
|
14
|
+
start: t.IdentityCodec<t.CodecType.String>;
|
|
15
|
+
end: t.IdentityCodec<t.CodecType.String>;
|
|
16
|
+
scrape_ttl: t.OptionalCodec<t.Codec<{
|
|
17
|
+
date: string;
|
|
18
|
+
}, {
|
|
19
|
+
date: string;
|
|
20
|
+
}, string, t.CodecProps>>;
|
|
21
|
+
}>;
|
|
22
|
+
export type ClientConnectionsReportRequest = t.Encoded<typeof ClientConnectionsReportRequest>;
|
|
23
|
+
export declare const HostedInstanceId: t.ObjectCodec<{
|
|
24
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
25
|
+
app_id: t.IdentityCodec<t.CodecType.String>;
|
|
26
|
+
id: t.IdentityCodec<t.CodecType.String>;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const CurrentConnectionsRequest: t.ObjectCodec<{
|
|
29
|
+
org_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
30
|
+
app_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
31
|
+
id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
32
|
+
}>;
|
|
33
|
+
export type CurrentConnectionsRequest = t.Encoded<typeof CurrentConnectionsRequest>;
|
|
34
|
+
export type CurrentConnectionsRequestDecoded = t.Decoded<typeof CurrentConnectionsRequest>;
|
|
35
|
+
export declare const HostedClientConnectionsReportRequest: t.Intersection<t.Codec<{
|
|
8
36
|
start: string;
|
|
9
37
|
end: string;
|
|
10
38
|
scrape_ttl?: {
|
|
@@ -17,24 +45,43 @@ export declare const ClientConnectionsReportRequest: t.Intersection<t.Codec<{
|
|
|
17
45
|
date: string;
|
|
18
46
|
} | undefined;
|
|
19
47
|
}, string, t.CodecProps>, t.ObjectCodec<{
|
|
20
|
-
org_id: t.
|
|
21
|
-
app_id: t.
|
|
48
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
49
|
+
app_id: t.IdentityCodec<t.CodecType.String>;
|
|
22
50
|
id: t.IdentityCodec<t.CodecType.String>;
|
|
23
51
|
}>>;
|
|
24
|
-
export type
|
|
25
|
-
export declare const
|
|
26
|
-
|
|
27
|
-
|
|
52
|
+
export type HostedClientConnectionsReportRequest = t.Encoded<typeof HostedClientConnectionsReportRequest>;
|
|
53
|
+
export declare const HostedCurrentConnectionsRequest: t.Intersection<t.Codec<{
|
|
54
|
+
id?: string | undefined;
|
|
55
|
+
org_id?: string | undefined;
|
|
56
|
+
app_id?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
id?: string | undefined;
|
|
59
|
+
org_id?: string | undefined;
|
|
60
|
+
app_id?: string | undefined;
|
|
61
|
+
}, string, t.CodecProps>, t.ObjectCodec<{
|
|
62
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
63
|
+
app_id: t.IdentityCodec<t.CodecType.String>;
|
|
28
64
|
id: t.IdentityCodec<t.CodecType.String>;
|
|
29
|
-
}
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export declare const
|
|
65
|
+
}>>;
|
|
66
|
+
export type HostedCurrentConnectionsRequest = t.Encoded<typeof HostedCurrentConnectionsRequest>;
|
|
67
|
+
export type HostedInstanceId = t.Encoded<typeof HostedInstanceId>;
|
|
68
|
+
export declare const SDKConnectionBreakdown: t.ObjectCodec<{
|
|
33
69
|
sdk: t.IdentityCodec<t.CodecType.String>;
|
|
34
70
|
users: t.IdentityCodec<t.CodecType.Number>;
|
|
35
71
|
clients: t.IdentityCodec<t.CodecType.Number>;
|
|
36
72
|
}>;
|
|
37
|
-
export declare const
|
|
73
|
+
export declare const ClientConnectionsSummary: t.ObjectCodec<{
|
|
74
|
+
total_users: t.IdentityCodec<t.CodecType.Number>;
|
|
75
|
+
sdk_breakdown: t.ArrayCodec<t.ObjectCodec<{
|
|
76
|
+
sdk: t.IdentityCodec<t.CodecType.String>;
|
|
77
|
+
users: t.IdentityCodec<t.CodecType.Number>;
|
|
78
|
+
clients: t.IdentityCodec<t.CodecType.Number>;
|
|
79
|
+
}>>;
|
|
80
|
+
}>;
|
|
81
|
+
export type ClientConnectionsSummaryResponse = t.Encoded<typeof ClientConnectionsSummary>;
|
|
82
|
+
export type ClientConnectionsSummaryResponseDecoded = t.Decoded<typeof ClientConnectionsSummary>;
|
|
83
|
+
/** @deprecated Use ClientConnectionsSummaryResponse instead. */
|
|
84
|
+
export declare const DeprecatedClientConnectionsReport: t.ObjectCodec<{
|
|
38
85
|
users: t.IdentityCodec<t.CodecType.Number>;
|
|
39
86
|
sdks: t.ArrayCodec<t.ObjectCodec<{
|
|
40
87
|
sdk: t.IdentityCodec<t.CodecType.String>;
|
|
@@ -42,12 +89,14 @@ export declare const ClientConnectionsReport: t.ObjectCodec<{
|
|
|
42
89
|
clients: t.IdentityCodec<t.CodecType.Number>;
|
|
43
90
|
}>>;
|
|
44
91
|
}>;
|
|
45
|
-
|
|
46
|
-
export type
|
|
92
|
+
/** @deprecated Use ClientConnectionsSummaryResponse instead. */
|
|
93
|
+
export type DeprecatedClientConnectionsReportResponse = t.Encoded<typeof DeprecatedClientConnectionsReport>;
|
|
94
|
+
/** @deprecated Use ClientConnectionsSummaryResponseDecoded instead. */
|
|
95
|
+
export type DeprecatedClientConnectionsReportResponseDecoded = t.Decoded<typeof DeprecatedClientConnectionsReport>;
|
|
47
96
|
export declare const AnalyticsRequestData: t.ObjectCodec<{
|
|
48
|
-
org_id: t.
|
|
49
|
-
app_id: t.
|
|
50
|
-
id: t.
|
|
97
|
+
org_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
98
|
+
app_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
99
|
+
id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
51
100
|
client_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
52
101
|
user_id: t.OptionalCodec<t.Codec<string, string, string, t.CodecProps>>;
|
|
53
102
|
date_range: t.OptionalCodec<t.Codec<{
|
|
@@ -59,9 +108,9 @@ export declare const AnalyticsRequestData: t.ObjectCodec<{
|
|
|
59
108
|
}, string, t.CodecProps>>;
|
|
60
109
|
}>;
|
|
61
110
|
export declare const ClientConnectionAnalyticsRequest: t.Intersection<t.Codec<{
|
|
62
|
-
id
|
|
63
|
-
org_id
|
|
64
|
-
app_id
|
|
111
|
+
id?: string | undefined;
|
|
112
|
+
org_id?: string | undefined;
|
|
113
|
+
app_id?: string | undefined;
|
|
65
114
|
user_id?: string | undefined;
|
|
66
115
|
client_id?: string | undefined;
|
|
67
116
|
date_range?: {
|
|
@@ -69,9 +118,9 @@ export declare const ClientConnectionAnalyticsRequest: t.Intersection<t.Codec<{
|
|
|
69
118
|
end: string;
|
|
70
119
|
} | undefined;
|
|
71
120
|
}, {
|
|
72
|
-
id
|
|
73
|
-
org_id
|
|
74
|
-
app_id
|
|
121
|
+
id?: string | undefined;
|
|
122
|
+
org_id?: string | undefined;
|
|
123
|
+
app_id?: string | undefined;
|
|
75
124
|
user_id?: string | undefined;
|
|
76
125
|
client_id?: string | undefined;
|
|
77
126
|
date_range?: {
|
|
@@ -84,6 +133,38 @@ export declare const ClientConnectionAnalyticsRequest: t.Intersection<t.Codec<{
|
|
|
84
133
|
}>>;
|
|
85
134
|
export type ClientConnectionAnalyticsRequest = t.Encoded<typeof ClientConnectionAnalyticsRequest>;
|
|
86
135
|
export type ClientConnectionAnalyticsRequestDecoded = t.Decoded<typeof ClientConnectionAnalyticsRequest>;
|
|
136
|
+
export declare const HostedClientConnectionAnalyticsRequest: t.Intersection<t.Codec<{
|
|
137
|
+
id?: string | undefined;
|
|
138
|
+
org_id?: string | undefined;
|
|
139
|
+
app_id?: string | undefined;
|
|
140
|
+
user_id?: string | undefined;
|
|
141
|
+
client_id?: string | undefined;
|
|
142
|
+
date_range?: {
|
|
143
|
+
start: string;
|
|
144
|
+
end: string;
|
|
145
|
+
} | undefined;
|
|
146
|
+
} & {
|
|
147
|
+
cursor?: string | undefined;
|
|
148
|
+
limit?: number | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
id?: string | undefined;
|
|
151
|
+
org_id?: string | undefined;
|
|
152
|
+
app_id?: string | undefined;
|
|
153
|
+
user_id?: string | undefined;
|
|
154
|
+
client_id?: string | undefined;
|
|
155
|
+
date_range?: {
|
|
156
|
+
start: string;
|
|
157
|
+
end: string;
|
|
158
|
+
} | undefined;
|
|
159
|
+
} & {
|
|
160
|
+
cursor?: string | undefined;
|
|
161
|
+
limit?: number | undefined;
|
|
162
|
+
}, string, t.CodecProps>, t.ObjectCodec<{
|
|
163
|
+
org_id: t.IdentityCodec<t.CodecType.String>;
|
|
164
|
+
app_id: t.IdentityCodec<t.CodecType.String>;
|
|
165
|
+
id: t.IdentityCodec<t.CodecType.String>;
|
|
166
|
+
}>>;
|
|
167
|
+
export type HostedClientConnectionAnalyticsRequest = t.Encoded<typeof HostedClientConnectionAnalyticsRequest>;
|
|
87
168
|
export declare const ClientConnectionAnalyticsEvent: t.ObjectCodec<{
|
|
88
169
|
user_id: t.IdentityCodec<t.CodecType.String>;
|
|
89
170
|
client_id: t.IdentityCodec<t.CodecType.String>;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { date } from '@journeyapps-labs/micro-codecs';
|
|
2
2
|
import * as t from 'ts-codec';
|
|
3
|
-
import { InstanceId } from '../shared.js';
|
|
4
3
|
import { PaginationRequest, PaginationResponse } from '../utils/pagination.js';
|
|
5
4
|
export var REPORT_ROUTES;
|
|
6
5
|
(function (REPORT_ROUTES) {
|
|
7
|
-
REPORT_ROUTES["
|
|
8
|
-
REPORT_ROUTES["GET_CURRENT_CONNECTIONS"] = "/api/v1/
|
|
9
|
-
REPORT_ROUTES["
|
|
6
|
+
REPORT_ROUTES["GET_CONNECTIONS_SUMMARY"] = "/api/v1/connections/summary";
|
|
7
|
+
REPORT_ROUTES["GET_CURRENT_CONNECTIONS"] = "/api/v1/connections/current";
|
|
8
|
+
REPORT_ROUTES["GET_CLIENT_SESSIONS"] = "/api/v1/client/sessions";
|
|
9
|
+
// Deprecated routes kept temporarily for backwards compatibility.
|
|
10
|
+
/** @deprecated Use GET_CONNECTIONS_SUMMARY instead. */
|
|
11
|
+
REPORT_ROUTES["DEPRECATED_GET_CLIENT_CONNECTION_DATA"] = "/api/admin/v1/connections/reports";
|
|
12
|
+
/** @deprecated Use GET_CURRENT_CONNECTIONS instead. */
|
|
13
|
+
REPORT_ROUTES["DEPRECATED_GET_CONNECTED_CLIENTS"] = "/api/admin/v1/connections/current";
|
|
14
|
+
/** @deprecated Use GET_CLIENT_SESSIONS instead. */
|
|
15
|
+
REPORT_ROUTES["DEPRECATED_GET_GENERAL_CLIENT_ANALYTICS"] = "/api/v1/report/connection/general/analytics";
|
|
10
16
|
})(REPORT_ROUTES || (REPORT_ROUTES = {}));
|
|
11
|
-
// POST /api/v1/
|
|
12
|
-
// Returns
|
|
17
|
+
// POST /api/v1/connections/summary
|
|
18
|
+
// Returns a summary of client connections for the requested time range
|
|
13
19
|
const ConnectionsInfo = t.object({
|
|
14
20
|
start: t.string,
|
|
15
21
|
end: t.string,
|
|
@@ -19,25 +25,43 @@ const ConnectionsInfo = t.object({
|
|
|
19
25
|
})
|
|
20
26
|
.optional()
|
|
21
27
|
});
|
|
22
|
-
export const ClientConnectionsReportRequest = ConnectionsInfo
|
|
23
|
-
// POST /api/v1/
|
|
24
|
-
// Returns
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
export const ClientConnectionsReportRequest = ConnectionsInfo;
|
|
29
|
+
// POST /api/v1/connections/current
|
|
30
|
+
// Returns a summary of currently connected clients
|
|
31
|
+
const OptionalInstanceId = t.object({
|
|
32
|
+
org_id: t.string.optional(),
|
|
33
|
+
app_id: t.string.optional(),
|
|
34
|
+
id: t.string.optional()
|
|
35
|
+
});
|
|
36
|
+
export const HostedInstanceId = t.object({
|
|
37
|
+
org_id: t.string,
|
|
38
|
+
app_id: t.string,
|
|
39
|
+
id: t.string
|
|
40
|
+
});
|
|
41
|
+
export const CurrentConnectionsRequest = OptionalInstanceId;
|
|
42
|
+
export const HostedClientConnectionsReportRequest = ClientConnectionsReportRequest.and(HostedInstanceId);
|
|
43
|
+
export const HostedCurrentConnectionsRequest = CurrentConnectionsRequest.and(HostedInstanceId);
|
|
44
|
+
export const SDKConnectionBreakdown = t.object({
|
|
27
45
|
sdk: t.string,
|
|
28
46
|
users: t.number,
|
|
29
47
|
clients: t.number
|
|
30
48
|
});
|
|
31
|
-
export const
|
|
49
|
+
export const ClientConnectionsSummary = t.object({
|
|
50
|
+
total_users: t.number,
|
|
51
|
+
sdk_breakdown: t.array(SDKConnectionBreakdown)
|
|
52
|
+
});
|
|
53
|
+
// Deprecated response types kept temporarily for backwards compatibility.
|
|
54
|
+
/** @deprecated Use ClientConnectionsSummaryResponse instead. */
|
|
55
|
+
export const DeprecatedClientConnectionsReport = t.object({
|
|
32
56
|
users: t.number,
|
|
33
|
-
sdks: t.array(
|
|
57
|
+
sdks: t.array(SDKConnectionBreakdown)
|
|
34
58
|
});
|
|
35
|
-
// POST /api/v1/
|
|
36
|
-
// Returns paginated list of client
|
|
59
|
+
// POST /api/v1/client/sessions
|
|
60
|
+
// Returns paginated list of client session events
|
|
37
61
|
export const AnalyticsRequestData = t.object({
|
|
38
|
-
org_id: t.string,
|
|
39
|
-
app_id: t.string,
|
|
40
|
-
id: t.string,
|
|
62
|
+
org_id: t.string.optional(),
|
|
63
|
+
app_id: t.string.optional(),
|
|
64
|
+
id: t.string.optional(),
|
|
41
65
|
client_id: t.string.optional(),
|
|
42
66
|
user_id: t.string.optional(),
|
|
43
67
|
date_range: t
|
|
@@ -48,6 +72,7 @@ export const AnalyticsRequestData = t.object({
|
|
|
48
72
|
.optional()
|
|
49
73
|
});
|
|
50
74
|
export const ClientConnectionAnalyticsRequest = AnalyticsRequestData.and(PaginationRequest);
|
|
75
|
+
export const HostedClientConnectionAnalyticsRequest = ClientConnectionAnalyticsRequest.and(HostedInstanceId);
|
|
51
76
|
export const ClientConnectionAnalyticsEvent = t.object({
|
|
52
77
|
user_id: t.string,
|
|
53
78
|
client_id: t.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporting-routes.js","sourceRoot":"","sources":["../../src/routes/reporting-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reporting-routes.js","sourceRoot":"","sources":["../../src/routes/reporting-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,wEAAuD,CAAA;IACvD,wEAAuD,CAAA;IACvD,gEAA+C,CAAA;IAE/C,kEAAkE;IAClE,uDAAuD;IACvD,4FAA2E,CAAA;IAC3E,uDAAuD;IACvD,uFAAsE,CAAA;IACtE,mDAAmD;IACnD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ACnB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM;IACpB,GAAG,EAAE,CAAC,CAAC,MAAM;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sCAAsC,GAAG,kBAAkB,CAAC,8BAA8B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/management-types",
|
|
3
|
-
"version": "0.0.0-dev
|
|
3
|
+
"version": "0.0.0-dev.6f42cb4c",
|
|
4
4
|
"description": "Common TypeScript types for PowerSync Management Service API requests",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@journeyapps-labs/micro-codecs": "^1.0.1",
|
|
32
|
-
"@powersync/service-module-mssql": "
|
|
33
|
-
"@powersync/service-types": "
|
|
32
|
+
"@powersync/service-module-mssql": "0.0.0-dev-20260313100403",
|
|
33
|
+
"@powersync/service-types": "0.0.0-dev-20260313100403",
|
|
34
34
|
"bson": "^6.10.4",
|
|
35
35
|
"ts-codec": "^1.3.0"
|
|
36
36
|
},
|