@discover-cloud/shared 1.0.8 → 1.0.9

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.
@@ -4,41 +4,41 @@ export interface AccountDto {
4
4
  email: string;
5
5
  isVerified: boolean;
6
6
  status: AccountStatus;
7
- createdAt: Date;
8
- updatedAt: Date;
7
+ createdAt: string;
8
+ updatedAt: string;
9
9
  }
10
10
  export interface EmailVerificationDto {
11
11
  id: string;
12
12
  accountId: string;
13
13
  token: string;
14
- expiresAt: Date;
14
+ expiresAt: string;
15
15
  isUsed: boolean;
16
- createdAt: Date;
16
+ createdAt: string;
17
17
  }
18
18
  export interface OAuthIdentityDto {
19
19
  id: string;
20
20
  accountId: string;
21
21
  provider: string;
22
22
  providerId: string;
23
- createdAt: Date;
24
- updatedAt: Date;
23
+ createdAt: string;
24
+ updatedAt: string;
25
25
  }
26
26
  export interface PasswordResetDto {
27
27
  id: string;
28
28
  accountId: string;
29
29
  token: string;
30
- expiresAt: Date;
30
+ expiresAt: string;
31
31
  isUsed: boolean;
32
- createdAt: Date;
32
+ createdAt: string;
33
33
  }
34
34
  export interface SessionDto {
35
35
  id: string;
36
36
  accountId: string;
37
- expiresAt: Date;
38
- revokedAt: Date | null;
37
+ expiresAt: string;
38
+ revokedAt: string | null;
39
39
  ipAddress: string | null;
40
40
  userAgent: string | null;
41
41
  device: string | null;
42
- createdAt: Date;
43
- updatedAt: Date;
42
+ createdAt: string;
43
+ updatedAt: string;
44
44
  }
@@ -4,41 +4,29 @@ import { CloudProvider, CloudAccountStatus, AwsAuthMethod, GcpAuthMethod, AzureA
4
4
  * ───────────────────
5
5
  * Shapes returned by the cloud service over HTTP.
6
6
  *
7
- * CloudAccountDto never includes encryptedCredentials credentials
8
- * are write-only. authMethod is the resolved union of whichever
9
- * provider-specific method is set (only one is ever non-null).
7
+ * Date fields are ISO 8601 strings at the HTTP boundary
8
+ * JSON has no Date type. Domain models use Date internally;
9
+ * these DTOs are the serialized form sent to clients.
10
10
  *
11
- * SyncJobDto is read-only sync jobs are created internally by the
12
- * orchestrator and exposed for status polling only.
11
+ * CloudAccountDto never includes encryptedCredentials
12
+ * credentials are write-only.
13
+ *
14
+ * SyncJobDto is read-only — sync jobs are created internally
15
+ * by the orchestrator and exposed for status polling only.
13
16
  */
14
- export type CloudAuthMethod = AwsAuthMethod | GcpAuthMethod | AzureAuthMethod;
15
17
  export interface CloudAccountDto {
16
18
  id: string;
17
19
  userId: string;
18
20
  alias: string;
19
21
  provider: CloudProvider;
20
22
  status: CloudAccountStatus;
21
- authMethod: CloudAuthMethod | null;
23
+ authMethod: AwsAuthMethod | GcpAuthMethod | AzureAuthMethod | null;
22
24
  lastSyncAt: string | null;
23
25
  lastErrorAt: string | null;
24
26
  lastErrorMsg: string | null;
25
27
  createdAt: string;
26
28
  updatedAt: string;
27
29
  }
28
- export interface SyncJobDto {
29
- id: string;
30
- cloudAccountId: string;
31
- type: SyncType;
32
- status: SyncStatus;
33
- startedAt: string | null;
34
- completedAt: string | null;
35
- errorMessage: string | null;
36
- resourcesSynced: number;
37
- costRecords: number;
38
- budgetsSynced: number;
39
- createdAt: string;
40
- updatedAt: string;
41
- }
42
30
  export interface ConnectAwsAccountDto {
43
31
  alias: string;
44
32
  authMethod: AwsAuthMethod;
@@ -54,6 +42,20 @@ export interface ConnectAzureAccountDto {
54
42
  authMethod: AzureAuthMethod;
55
43
  credentials: unknown;
56
44
  }
45
+ export interface SyncJobDto {
46
+ id: string;
47
+ cloudAccountId: string;
48
+ type: SyncType;
49
+ status: SyncStatus;
50
+ startedAt: string | null;
51
+ completedAt: string | null;
52
+ errorMessage: string | null;
53
+ resourcesSynced: number;
54
+ costRecords: number;
55
+ budgetsSynced: number;
56
+ createdAt: string;
57
+ updatedAt: string;
58
+ }
57
59
  export interface CloudCostRecordDto {
58
60
  provider: CloudProvider;
59
61
  service: string;
@@ -75,9 +77,10 @@ export interface CloudResourceDto {
75
77
  metadata: Record<string, unknown>;
76
78
  }
77
79
  export interface CloudBudgetDto {
78
- provider: CloudProvider;
79
80
  name: string;
80
81
  limitAmount: number;
81
82
  currency: string;
83
+ actualSpend: number;
84
+ forecastSpend: number;
82
85
  period: string;
83
86
  }
@@ -1,19 +1,9 @@
1
1
  import { OrganizationRole, MembershipStatus, OrganizationStatus, Theme, Currency } from "../enums";
2
- /**
3
- * USER SERVICE DTOs
4
- * ──────────────────
5
- * Shapes returned by the user service over HTTP.
6
- *
7
- * UserDto has no status field — the user service DB does not store
8
- * account lifecycle state. Status is owned by the auth service and
9
- * available in the internal JWT's accessContext.accountRole, or by
10
- * calling the auth service directly.
11
- */
12
2
  export interface UserDto {
13
3
  id: string;
14
4
  email: string;
15
- createdAt: Date;
16
- updatedAt: Date;
5
+ createdAt: string;
6
+ updatedAt: string;
17
7
  }
18
8
  export interface UserProfileDto {
19
9
  id: string;
@@ -26,8 +16,8 @@ export interface UserProfileDto {
26
16
  locale: string;
27
17
  country: string | null;
28
18
  pronouns: string | null;
29
- createdAt: Date;
30
- updatedAt: Date;
19
+ createdAt: string;
20
+ updatedAt: string;
31
21
  }
32
22
  export interface UserPreferencesDto {
33
23
  id: string;
@@ -36,17 +26,17 @@ export interface UserPreferencesDto {
36
26
  language: string;
37
27
  currency: Currency;
38
28
  emailAlerts: boolean;
39
- createdAt: Date;
40
- updatedAt: Date;
29
+ createdAt: string;
30
+ updatedAt: string;
41
31
  }
42
32
  export interface OrganizationDto {
43
33
  id: string;
44
34
  name: string;
45
35
  slug: string;
46
36
  status: OrganizationStatus;
47
- createdAt: Date;
48
- updatedAt: Date;
49
- deletedAt: Date | null;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ deletedAt: string | null;
50
40
  }
51
41
  export interface OrganizationMemberDto {
52
42
  id: string;
@@ -54,6 +44,6 @@ export interface OrganizationMemberDto {
54
44
  organizationId: string;
55
45
  role: OrganizationRole;
56
46
  status: MembershipStatus;
57
- createdAt: Date;
58
- updatedAt: Date;
47
+ createdAt: string;
48
+ updatedAt: string;
59
49
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * DATE SERIALIZATION UTILS
3
+ * ─────────────────────────
4
+ * Converts Date objects to ISO 8601 strings for HTTP responses.
5
+ * Use these in toDto() mappers — never call .toISOString() inline.
6
+ *
7
+ * Why: DTOs cross HTTP boundaries where JSON has no Date type.
8
+ * Domain models keep Date internally; these helpers handle the boundary.
9
+ */
10
+ export declare const toIso: (date: Date) => string;
11
+ export declare const toIsoOrNull: (date: Date | null | undefined) => string | null;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * DATE SERIALIZATION UTILS
4
+ * ─────────────────────────
5
+ * Converts Date objects to ISO 8601 strings for HTTP responses.
6
+ * Use these in toDto() mappers — never call .toISOString() inline.
7
+ *
8
+ * Why: DTOs cross HTTP boundaries where JSON has no Date type.
9
+ * Domain models keep Date internally; these helpers handle the boundary.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.toIsoOrNull = exports.toIso = void 0;
13
+ const toIso = (date) => date.toISOString();
14
+ exports.toIso = toIso;
15
+ const toIsoOrNull = (date) => date ? date.toISOString() : null;
16
+ exports.toIsoOrNull = toIsoOrNull;
@@ -1,2 +1,3 @@
1
1
  export * from "./response.utils";
2
2
  export * from "./logger.utils";
3
+ export * from "./date.utils";
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./response.utils"), exports);
18
18
  __exportStar(require("./logger.utils"), exports);
19
+ __exportStar(require("./date.utils"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@discover-cloud/shared",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",