@k-msg/analytics 0.7.2 → 0.7.3
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 +50 -67
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -43
- package/dist/index.js.map +5 -4
- package/dist/index.mjs +43 -43
- package/dist/index.mjs.map +5 -4
- package/dist/services/delivery-tracking.analytics.d.ts +37 -0
- package/package.json +9 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DeliveryStatus, MessageType } from "@k-msg/core";
|
|
2
|
+
import type { DeliveryTrackingStore } from "@k-msg/messaging";
|
|
3
|
+
export interface DeliveryTrackingAnalyticsQuery {
|
|
4
|
+
requestedAt: {
|
|
5
|
+
start: Date;
|
|
6
|
+
end: Date;
|
|
7
|
+
};
|
|
8
|
+
providerId?: string | string[];
|
|
9
|
+
type?: MessageType | MessageType[];
|
|
10
|
+
}
|
|
11
|
+
export interface DeliveryTrackingAnalyticsBreakdown {
|
|
12
|
+
total: number;
|
|
13
|
+
byStatus: Record<DeliveryStatus, number>;
|
|
14
|
+
rates: {
|
|
15
|
+
deliveredOfTotalPct: number;
|
|
16
|
+
failedOfTotalPct: number;
|
|
17
|
+
deliveredOfFinalizedPct: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface DeliveryTrackingAnalyticsSummary extends DeliveryTrackingAnalyticsBreakdown {
|
|
21
|
+
byProviderId?: Record<string, DeliveryTrackingAnalyticsBreakdown>;
|
|
22
|
+
byType?: Record<string, DeliveryTrackingAnalyticsBreakdown>;
|
|
23
|
+
}
|
|
24
|
+
export declare class DeliveryTrackingAnalyticsService {
|
|
25
|
+
private readonly store;
|
|
26
|
+
private initPromise?;
|
|
27
|
+
constructor(config: {
|
|
28
|
+
store: DeliveryTrackingStore;
|
|
29
|
+
});
|
|
30
|
+
init(): Promise<void>;
|
|
31
|
+
getSummary(query: DeliveryTrackingAnalyticsQuery, options?: {
|
|
32
|
+
includeByProviderId?: boolean;
|
|
33
|
+
includeByType?: boolean;
|
|
34
|
+
}): Promise<DeliveryTrackingAnalyticsSummary>;
|
|
35
|
+
private buildBreakdownMap;
|
|
36
|
+
private ensureInit;
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k-msg/analytics",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"packageManager": "bun@1.3.8",
|
|
5
5
|
"description": "Analytics and reporting engine for message tracking and insights",
|
|
6
6
|
"type": "module",
|
|
@@ -23,14 +23,20 @@
|
|
|
23
23
|
"build:cjs": "bun build ./src/index.ts --outdir ./dist --format cjs --minify --sourcemap --entry-naming '[name].js' --external 'bun:test'",
|
|
24
24
|
"build:types": "tsc",
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
|
-
"test": "bun test",
|
|
26
|
+
"test": "bun run test:unit",
|
|
27
|
+
"test:unit": "bun test --testPathPattern='.*\\.test\\.(ts|js)$' --testTimeout=5000",
|
|
28
|
+
"test:integration": "bun test --testPathPattern='.*\\.integration\\.(ts|js)$' --testTimeout=10000",
|
|
29
|
+
"test:e2e": "bun test --testPathPattern='.*\\.e2e\\.(ts|js)$' --testTimeout=30000",
|
|
30
|
+
"test:coverage": "bun test --coverage",
|
|
31
|
+
"test:watch": "bun test --watch",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
27
33
|
"clean": "rm -rf dist",
|
|
28
34
|
"pack": "bun pm pack",
|
|
29
35
|
"publish": "bun publish --access public"
|
|
30
36
|
},
|
|
31
37
|
"dependencies": {
|
|
32
38
|
"zod": "^4.0.14",
|
|
33
|
-
"@k-msg/messaging": "0.7.
|
|
39
|
+
"@k-msg/messaging": "0.7.3"
|
|
34
40
|
},
|
|
35
41
|
"devDependencies": {
|
|
36
42
|
"typescript": "^5.7.2",
|