@discover-cloud/shared 1.0.9 → 1.0.10

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.
@@ -1,4 +1,5 @@
1
1
  export * from "./user-service.dto";
2
2
  export * from "./auth-service.dto";
3
3
  export * from "./cloud-service.dto";
4
+ export * from "./insights-service.dto";
4
5
  export * from "./response.dto";
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./user-service.dto"), exports);
18
18
  __exportStar(require("./auth-service.dto"), exports);
19
19
  __exportStar(require("./cloud-service.dto"), exports);
20
+ __exportStar(require("./insights-service.dto"), exports);
20
21
  __exportStar(require("./response.dto"), exports);
@@ -0,0 +1,118 @@
1
+ import { CloudProvider } from "../enums";
2
+ /**
3
+ * INSIGHTS SERVICE DTOs
4
+ * ──────────────────────
5
+ * Push payloads: cloud-service → insights-service (internal, over HTTP)
6
+ * Record DTOs: insights-service → frontend (public, over HTTP)
7
+ * Query DTOs: internal query params (never cross HTTP, Date is fine)
8
+ * Summary DTOs: assembled aggregations (no domain model, no mapper)
9
+ */
10
+ export interface PushCostItem {
11
+ service: string;
12
+ region: string;
13
+ amount: number;
14
+ currency: string;
15
+ usageType: string;
16
+ periodStart: string;
17
+ periodEnd: string;
18
+ }
19
+ export interface PushResourceItem {
20
+ resourceType: string;
21
+ resourceId: string;
22
+ region: string;
23
+ name: string | null;
24
+ status: string;
25
+ tags: Record<string, string>;
26
+ metadata: Record<string, unknown>;
27
+ }
28
+ export interface PushBudgetItem {
29
+ name: string;
30
+ limitAmount: number;
31
+ currency: string;
32
+ actualSpend: number;
33
+ forecastSpend: number;
34
+ period: string;
35
+ }
36
+ export interface PushCostPayload {
37
+ cloudAccountId: string;
38
+ userId: string;
39
+ provider: CloudProvider;
40
+ costs: PushCostItem[];
41
+ }
42
+ export interface PushResourcePayload {
43
+ cloudAccountId: string;
44
+ userId: string;
45
+ provider: CloudProvider;
46
+ resources: PushResourceItem[];
47
+ }
48
+ export interface PushBudgetPayload {
49
+ cloudAccountId: string;
50
+ userId: string;
51
+ budgets: PushBudgetItem[];
52
+ }
53
+ export interface CostRecordDto {
54
+ id: string;
55
+ cloudAccountId: string;
56
+ userId: string;
57
+ provider: string;
58
+ service: string;
59
+ region: string;
60
+ amount: number;
61
+ currency: string;
62
+ usageType: string;
63
+ periodStart: string;
64
+ periodEnd: string;
65
+ recordedAt: string;
66
+ }
67
+ export interface ResourceRecordDto {
68
+ id: string;
69
+ cloudAccountId: string;
70
+ userId: string;
71
+ provider: string;
72
+ resourceType: string;
73
+ resourceId: string;
74
+ region: string;
75
+ name: string | null;
76
+ status: string;
77
+ tags: Record<string, string>;
78
+ metadata: Record<string, unknown>;
79
+ recordedAt: string;
80
+ }
81
+ export interface BudgetRecordDto {
82
+ id: string;
83
+ cloudAccountId: string;
84
+ userId: string;
85
+ name: string;
86
+ limitAmount: number;
87
+ currency: string;
88
+ actualSpend: number;
89
+ forecastSpend: number;
90
+ period: string;
91
+ utilizationPct: number;
92
+ isOverBudget: boolean;
93
+ isForecastOver: boolean;
94
+ recordedAt: string;
95
+ }
96
+ export interface CostQueryDto {
97
+ userId?: string;
98
+ cloudAccountId?: string;
99
+ provider?: CloudProvider;
100
+ from?: Date;
101
+ to?: Date;
102
+ groupBy?: "service" | "region" | "provider" | "day" | "month";
103
+ }
104
+ export interface DashboardSummaryDto {
105
+ totalSpend: number;
106
+ currency: string;
107
+ resourceCount: number;
108
+ budgetCount: number;
109
+ overBudgetCount: number;
110
+ topServices: {
111
+ label: string;
112
+ amount: number;
113
+ }[];
114
+ costTrend: {
115
+ date: string;
116
+ amount: number;
117
+ }[];
118
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discover-cloud/shared",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",