@k-msg/analytics 0.29.6 → 0.29.8
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/index.js +70 -45
- package/dist/index.mjs +70 -45
- package/dist/services/analytics.service.d.ts +15 -1
- package/dist/types/analytics.types.d.ts +12 -48
- package/package.json +9 -8
|
@@ -37,7 +37,21 @@ export declare class AnalyticsService {
|
|
|
37
37
|
clickRate: number;
|
|
38
38
|
};
|
|
39
39
|
metrics: AggregatedMetric[];
|
|
40
|
-
insights:
|
|
40
|
+
insights: {
|
|
41
|
+
id: string;
|
|
42
|
+
type: "anomaly" | "recommendation" | "trend";
|
|
43
|
+
title: string;
|
|
44
|
+
description: string;
|
|
45
|
+
severity: "critical" | "high" | "low" | "medium";
|
|
46
|
+
metric: MetricType;
|
|
47
|
+
dimensions: Record<string, string>;
|
|
48
|
+
value: number;
|
|
49
|
+
expectedValue?: number | undefined;
|
|
50
|
+
confidence: number;
|
|
51
|
+
actionable: boolean;
|
|
52
|
+
recommendations?: string[] | undefined;
|
|
53
|
+
detectedAt: Date;
|
|
54
|
+
}[] | undefined;
|
|
41
55
|
trends: {};
|
|
42
56
|
}>;
|
|
43
57
|
/**
|
|
@@ -17,14 +17,6 @@ export declare enum MetricType {
|
|
|
17
17
|
DELIVERY_RATE = "delivery_rate",
|
|
18
18
|
CLICK_RATE = "click_rate"
|
|
19
19
|
}
|
|
20
|
-
export interface MetricData {
|
|
21
|
-
id: string;
|
|
22
|
-
type: MetricType;
|
|
23
|
-
timestamp: Date;
|
|
24
|
-
value: number;
|
|
25
|
-
dimensions: Record<string, string>;
|
|
26
|
-
metadata?: Record<string, any>;
|
|
27
|
-
}
|
|
28
20
|
export interface AggregatedMetric {
|
|
29
21
|
type: MetricType;
|
|
30
22
|
interval: "minute" | "hour" | "day" | "week" | "month";
|
|
@@ -58,37 +50,6 @@ export interface ReportMetric {
|
|
|
58
50
|
trend?: "up" | "down" | "stable";
|
|
59
51
|
breakdown?: Record<string, number>;
|
|
60
52
|
}
|
|
61
|
-
export interface InsightData {
|
|
62
|
-
id: string;
|
|
63
|
-
type: "anomaly" | "trend" | "recommendation";
|
|
64
|
-
title: string;
|
|
65
|
-
description: string;
|
|
66
|
-
severity: "low" | "medium" | "high" | "critical";
|
|
67
|
-
metric: MetricType;
|
|
68
|
-
dimensions: Record<string, string>;
|
|
69
|
-
value: number;
|
|
70
|
-
expectedValue?: number;
|
|
71
|
-
confidence: number;
|
|
72
|
-
actionable: boolean;
|
|
73
|
-
recommendations?: string[];
|
|
74
|
-
detectedAt: Date;
|
|
75
|
-
}
|
|
76
|
-
export interface AnalyticsQuery {
|
|
77
|
-
metrics: MetricType[];
|
|
78
|
-
dateRange: {
|
|
79
|
-
start: Date;
|
|
80
|
-
end: Date;
|
|
81
|
-
};
|
|
82
|
-
interval?: "minute" | "hour" | "day" | "week" | "month";
|
|
83
|
-
filters?: Record<string, any>;
|
|
84
|
-
groupBy?: string[];
|
|
85
|
-
orderBy?: {
|
|
86
|
-
field: string;
|
|
87
|
-
direction: "asc" | "desc";
|
|
88
|
-
}[];
|
|
89
|
-
limit?: number;
|
|
90
|
-
offset?: number;
|
|
91
|
-
}
|
|
92
53
|
export interface AnalyticsResult {
|
|
93
54
|
query: AnalyticsQuery;
|
|
94
55
|
data: AggregatedMetric[];
|
|
@@ -117,11 +78,11 @@ export declare const AnalyticsQuerySchema: z.ZodMiniObject<{
|
|
|
117
78
|
end: z.ZodMiniDate<Date>;
|
|
118
79
|
}, z.core.$strip>;
|
|
119
80
|
interval: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
120
|
-
minute: "minute";
|
|
121
|
-
hour: "hour";
|
|
122
81
|
day: "day";
|
|
123
|
-
|
|
82
|
+
hour: "hour";
|
|
83
|
+
minute: "minute";
|
|
124
84
|
month: "month";
|
|
85
|
+
week: "week";
|
|
125
86
|
}>>;
|
|
126
87
|
filters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniAny>>;
|
|
127
88
|
groupBy: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
@@ -139,16 +100,16 @@ export declare const InsightDataSchema: z.ZodMiniObject<{
|
|
|
139
100
|
id: z.ZodMiniString<string>;
|
|
140
101
|
type: z.ZodMiniEnum<{
|
|
141
102
|
anomaly: "anomaly";
|
|
142
|
-
trend: "trend";
|
|
143
103
|
recommendation: "recommendation";
|
|
104
|
+
trend: "trend";
|
|
144
105
|
}>;
|
|
145
106
|
title: z.ZodMiniString<string>;
|
|
146
107
|
description: z.ZodMiniString<string>;
|
|
147
108
|
severity: z.ZodMiniEnum<{
|
|
109
|
+
critical: "critical";
|
|
110
|
+
high: "high";
|
|
148
111
|
low: "low";
|
|
149
112
|
medium: "medium";
|
|
150
|
-
high: "high";
|
|
151
|
-
critical: "critical";
|
|
152
113
|
}>;
|
|
153
114
|
metric: z.ZodMiniEnum<typeof MetricType>;
|
|
154
115
|
dimensions: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
@@ -159,6 +120,9 @@ export declare const InsightDataSchema: z.ZodMiniObject<{
|
|
|
159
120
|
recommendations: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
|
|
160
121
|
detectedAt: z.ZodMiniDate<Date>;
|
|
161
122
|
}, z.core.$strip>;
|
|
162
|
-
export type
|
|
163
|
-
export type
|
|
164
|
-
export type
|
|
123
|
+
export type MetricData = z.infer<typeof MetricDataSchema>;
|
|
124
|
+
export type AnalyticsQuery = z.infer<typeof AnalyticsQuerySchema>;
|
|
125
|
+
export type InsightData = z.infer<typeof InsightDataSchema>;
|
|
126
|
+
export type MetricDataType = MetricData;
|
|
127
|
+
export type AnalyticsQueryType = AnalyticsQuery;
|
|
128
|
+
export type InsightDataType = InsightData;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-msg/analytics",
|
|
3
|
-
"version": "0.29.
|
|
4
|
-
"packageManager": "bun@1.3.
|
|
3
|
+
"version": "0.29.8",
|
|
4
|
+
"packageManager": "bun@1.3.13",
|
|
5
5
|
"description": "Analytics and reporting engine for message tracking and insights",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -29,19 +29,20 @@
|
|
|
29
29
|
"test:e2e": "bun test --testPathPattern='.*\\.e2e\\.(ts|js)$' --testTimeout=30000",
|
|
30
30
|
"test:coverage": "bun test --coverage",
|
|
31
31
|
"test:watch": "bun test --watch",
|
|
32
|
-
"typecheck": "
|
|
32
|
+
"typecheck": "ttsc --noEmit",
|
|
33
33
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
34
34
|
"pack": "bun pm pack",
|
|
35
35
|
"publish": "bun publish --access public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@k-msg/core": "0.29.
|
|
39
|
-
"zod": "^4.
|
|
40
|
-
"@k-msg/messaging": "0.29.
|
|
38
|
+
"@k-msg/core": "0.29.8",
|
|
39
|
+
"zod": "^4.4.3",
|
|
40
|
+
"@k-msg/messaging": "0.29.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
43
|
+
"ttsc": "^0.18.1",
|
|
44
|
+
"typescript": "^7.0.2",
|
|
45
|
+
"@types/bun": "^1.3.14"
|
|
45
46
|
},
|
|
46
47
|
"keywords": [
|
|
47
48
|
"analytics",
|