@discover-cloud/shared 1.0.6 → 1.0.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.
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { CloudProvider, CloudAccountStatus, AwsAuthMethod, GcpAuthMethod, AzureAuthMethod, SyncStatus, SyncType } from "../enums";
|
|
2
|
+
/**
|
|
3
|
+
* CLOUD SERVICE DTOs
|
|
4
|
+
* ───────────────────
|
|
5
|
+
* Shapes returned by the cloud service over HTTP.
|
|
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).
|
|
10
|
+
*
|
|
11
|
+
* SyncJobDto is read-only — sync jobs are created internally by the
|
|
12
|
+
* orchestrator and exposed for status polling only.
|
|
13
|
+
*/
|
|
14
|
+
export type CloudAuthMethod = AwsAuthMethod | GcpAuthMethod | AzureAuthMethod;
|
|
15
|
+
export interface CloudAccountDto {
|
|
16
|
+
id: string;
|
|
17
|
+
userId: string;
|
|
18
|
+
alias: string;
|
|
19
|
+
provider: CloudProvider;
|
|
20
|
+
status: CloudAccountStatus;
|
|
21
|
+
authMethod: CloudAuthMethod | null;
|
|
22
|
+
lastSyncAt: string | null;
|
|
23
|
+
lastErrorAt: string | null;
|
|
24
|
+
lastErrorMsg: string | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
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
|
+
export interface ConnectAwsAccountDto {
|
|
43
|
+
alias: string;
|
|
44
|
+
authMethod: AwsAuthMethod;
|
|
45
|
+
credentials: unknown;
|
|
46
|
+
}
|
|
47
|
+
export interface ConnectGcpAccountDto {
|
|
48
|
+
alias: string;
|
|
49
|
+
authMethod: GcpAuthMethod;
|
|
50
|
+
credentials: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface ConnectAzureAccountDto {
|
|
53
|
+
alias: string;
|
|
54
|
+
authMethod: AzureAuthMethod;
|
|
55
|
+
credentials: unknown;
|
|
56
|
+
}
|
|
57
|
+
export interface CloudCostRecordDto {
|
|
58
|
+
provider: CloudProvider;
|
|
59
|
+
service: string;
|
|
60
|
+
region: string;
|
|
61
|
+
amount: number;
|
|
62
|
+
currency: string;
|
|
63
|
+
periodStart: string;
|
|
64
|
+
periodEnd: string;
|
|
65
|
+
usageType: string;
|
|
66
|
+
}
|
|
67
|
+
export interface CloudResourceDto {
|
|
68
|
+
provider: CloudProvider;
|
|
69
|
+
resourceType: string;
|
|
70
|
+
resourceId: string;
|
|
71
|
+
region: string;
|
|
72
|
+
name: string | null;
|
|
73
|
+
status: string;
|
|
74
|
+
tags: Record<string, string>;
|
|
75
|
+
metadata: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
export interface CloudBudgetDto {
|
|
78
|
+
provider: CloudProvider;
|
|
79
|
+
name: string;
|
|
80
|
+
limitAmount: number;
|
|
81
|
+
currency: string;
|
|
82
|
+
period: string;
|
|
83
|
+
}
|
package/dist/dtos/index.d.ts
CHANGED
package/dist/dtos/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./user-service.dto"), exports);
|
|
18
18
|
__exportStar(require("./auth-service.dto"), exports);
|
|
19
|
+
__exportStar(require("./cloud-service.dto"), exports);
|
|
19
20
|
__exportStar(require("./response.dto"), exports);
|
|
@@ -6,19 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare enum AccountStatus {
|
|
8
8
|
ACTIVE = "ACTIVE",
|
|
9
|
-
SUSPENDED = "SUSPENDED"
|
|
9
|
+
SUSPENDED = "SUSPENDED",
|
|
10
10
|
DELETED = "DELETED"
|
|
11
11
|
}
|
|
12
12
|
export declare enum OrganizationStatus {
|
|
13
13
|
ACTIVE = "ACTIVE",
|
|
14
|
-
SUSPENDED = "SUSPENDED"
|
|
14
|
+
SUSPENDED = "SUSPENDED",
|
|
15
15
|
CLOSED = "CLOSED"
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* OrganizationRole lives in permissions.types.ts alongside OrgPermission
|
|
19
|
-
* so the role → permission map stays co-located with the role definition.
|
|
20
|
-
* Re-exported from enums/index.ts for convenience.
|
|
21
|
-
*/
|
|
22
17
|
export declare enum MembershipStatus {
|
|
23
18
|
PENDING = "PENDING",
|
|
24
19
|
ACTIVE = "ACTIVE",
|
|
@@ -31,12 +26,53 @@ export declare enum Theme {
|
|
|
31
26
|
SYSTEM = "SYSTEM"
|
|
32
27
|
}
|
|
33
28
|
export declare enum Currency {
|
|
34
|
-
USD = "USD"
|
|
35
|
-
EUR = "EUR"
|
|
36
|
-
GBP = "GBP"
|
|
37
|
-
INR = "INR"
|
|
38
|
-
AUD = "AUD"
|
|
39
|
-
CAD = "CAD"
|
|
40
|
-
JPY = "JPY"
|
|
29
|
+
USD = "USD",
|
|
30
|
+
EUR = "EUR",
|
|
31
|
+
GBP = "GBP",
|
|
32
|
+
INR = "INR",
|
|
33
|
+
AUD = "AUD",
|
|
34
|
+
CAD = "CAD",
|
|
35
|
+
JPY = "JPY",
|
|
41
36
|
SGD = "SGD"
|
|
42
37
|
}
|
|
38
|
+
export declare enum CloudProvider {
|
|
39
|
+
AWS = "AWS",
|
|
40
|
+
GCP = "GCP",
|
|
41
|
+
AZURE = "AZURE"
|
|
42
|
+
}
|
|
43
|
+
export declare enum AwsAuthMethod {
|
|
44
|
+
ACCESS_KEY = "ACCESS_KEY",// Access Key ID + Secret
|
|
45
|
+
IAM_ROLE = "IAM_ROLE",// Role ARN + External ID
|
|
46
|
+
IAM_IDENTITY_CENTER = "IAM_IDENTITY_CENTER",// SSO
|
|
47
|
+
IAM_ROLES_ANYWHERE = "IAM_ROLES_ANYWHERE"
|
|
48
|
+
}
|
|
49
|
+
export declare enum GcpAuthMethod {
|
|
50
|
+
SERVICE_ACCOUNT_KEY = "SERVICE_ACCOUNT_KEY",
|
|
51
|
+
WORKLOAD_IDENTITY = "WORKLOAD_IDENTITY",
|
|
52
|
+
SERVICE_ACCOUNT_IMPERSONATION = "SERVICE_ACCOUNT_IMPERSONATION"
|
|
53
|
+
}
|
|
54
|
+
export declare enum AzureAuthMethod {
|
|
55
|
+
SERVICE_PRINCIPAL_SECRET = "SERVICE_PRINCIPAL_SECRET",
|
|
56
|
+
SERVICE_PRINCIPAL_CERTIFICATE = "SERVICE_PRINCIPAL_CERTIFICATE",
|
|
57
|
+
MANAGED_IDENTITY_USER = "MANAGED_IDENTITY_USER",
|
|
58
|
+
MANAGED_IDENTITY_SYSTEM = "MANAGED_IDENTITY_SYSTEM"
|
|
59
|
+
}
|
|
60
|
+
export declare enum CloudAccountStatus {
|
|
61
|
+
PENDING = "PENDING",// Connected, never synced
|
|
62
|
+
ACTIVE = "ACTIVE",// Last sync succeeded
|
|
63
|
+
ERROR = "ERROR",// Last sync failed
|
|
64
|
+
INACTIVE = "INACTIVE"
|
|
65
|
+
}
|
|
66
|
+
export declare enum SyncStatus {
|
|
67
|
+
PENDING = "PENDING",
|
|
68
|
+
RUNNING = "RUNNING",
|
|
69
|
+
SUCCESS = "SUCCESS",
|
|
70
|
+
FAILED = "FAILED",
|
|
71
|
+
PARTIAL = "PARTIAL"
|
|
72
|
+
}
|
|
73
|
+
export declare enum SyncType {
|
|
74
|
+
FULL = "FULL",// All data types
|
|
75
|
+
COSTS = "COSTS",// Cost records only
|
|
76
|
+
RESOURCES = "RESOURCES",// Resource inventory only
|
|
77
|
+
BUDGETS = "BUDGETS"
|
|
78
|
+
}
|
|
@@ -6,11 +6,9 @@
|
|
|
6
6
|
* configuration. Permission-related enums live in permissions.types.ts.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.Currency = exports.Theme = exports.MembershipStatus = exports.OrganizationStatus = exports.AccountStatus = void 0;
|
|
9
|
+
exports.SyncType = exports.SyncStatus = exports.CloudAccountStatus = exports.AzureAuthMethod = exports.GcpAuthMethod = exports.AwsAuthMethod = exports.CloudProvider = exports.Currency = exports.Theme = exports.MembershipStatus = exports.OrganizationStatus = exports.AccountStatus = void 0;
|
|
10
10
|
/* ====================================================================
|
|
11
11
|
ACCOUNT
|
|
12
|
-
Lifecycle states for a platform account (auth domain).
|
|
13
|
-
Replaces the duplicate UserStatus — there is only Account in auth.
|
|
14
12
|
==================================================================== */
|
|
15
13
|
var AccountStatus;
|
|
16
14
|
(function (AccountStatus) {
|
|
@@ -19,7 +17,7 @@ var AccountStatus;
|
|
|
19
17
|
AccountStatus["DELETED"] = "DELETED";
|
|
20
18
|
})(AccountStatus || (exports.AccountStatus = AccountStatus = {}));
|
|
21
19
|
/* ====================================================================
|
|
22
|
-
ORGANIZATION
|
|
20
|
+
ORGANIZATION
|
|
23
21
|
==================================================================== */
|
|
24
22
|
var OrganizationStatus;
|
|
25
23
|
(function (OrganizationStatus) {
|
|
@@ -27,21 +25,6 @@ var OrganizationStatus;
|
|
|
27
25
|
OrganizationStatus["SUSPENDED"] = "SUSPENDED";
|
|
28
26
|
OrganizationStatus["CLOSED"] = "CLOSED";
|
|
29
27
|
})(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
|
|
30
|
-
/**
|
|
31
|
-
* OrganizationRole lives in permissions.types.ts alongside OrgPermission
|
|
32
|
-
* so the role → permission map stays co-located with the role definition.
|
|
33
|
-
* Re-exported from enums/index.ts for convenience.
|
|
34
|
-
*/
|
|
35
|
-
/* ====================================================================
|
|
36
|
-
MEMBERSHIP (future work)
|
|
37
|
-
Tracks a user's membership state within an organization.
|
|
38
|
-
|
|
39
|
-
PENDING — invite sent, not yet accepted
|
|
40
|
-
ACTIVE — full org member
|
|
41
|
-
SUSPENDED — access revoked by org admin, invite not cancelled
|
|
42
|
-
REMOVED — explicitly removed by admin (different from suspended —
|
|
43
|
-
removed members must be re-invited to regain access)
|
|
44
|
-
==================================================================== */
|
|
45
28
|
var MembershipStatus;
|
|
46
29
|
(function (MembershipStatus) {
|
|
47
30
|
MembershipStatus["PENDING"] = "PENDING";
|
|
@@ -58,14 +41,6 @@ var Theme;
|
|
|
58
41
|
Theme["DARK"] = "DARK";
|
|
59
42
|
Theme["SYSTEM"] = "SYSTEM";
|
|
60
43
|
})(Theme || (exports.Theme = Theme = {}));
|
|
61
|
-
/* ====================================================================
|
|
62
|
-
CURRENCY
|
|
63
|
-
Cloud cost monitoring — users see costs in their preferred currency.
|
|
64
|
-
Amounts are stored in USD (base currency) and converted at display time.
|
|
65
|
-
|
|
66
|
-
Expand this list as you add cloud provider regions:
|
|
67
|
-
AUD, CAD, JPY, SGD, BRL, KRW, SEK, NOK, CHF, MXN ...
|
|
68
|
-
==================================================================== */
|
|
69
44
|
var Currency;
|
|
70
45
|
(function (Currency) {
|
|
71
46
|
Currency["USD"] = "USD";
|
|
@@ -77,3 +52,67 @@ var Currency;
|
|
|
77
52
|
Currency["JPY"] = "JPY";
|
|
78
53
|
Currency["SGD"] = "SGD";
|
|
79
54
|
})(Currency || (exports.Currency = Currency = {}));
|
|
55
|
+
/* ====================================================================
|
|
56
|
+
CLOUD PROVIDERS
|
|
57
|
+
Used by cloud-service for account connections and insights-service
|
|
58
|
+
for storing normalized cost/resource data.
|
|
59
|
+
==================================================================== */
|
|
60
|
+
var CloudProvider;
|
|
61
|
+
(function (CloudProvider) {
|
|
62
|
+
CloudProvider["AWS"] = "AWS";
|
|
63
|
+
CloudProvider["GCP"] = "GCP";
|
|
64
|
+
CloudProvider["AZURE"] = "AZURE";
|
|
65
|
+
})(CloudProvider || (exports.CloudProvider = CloudProvider = {}));
|
|
66
|
+
/* ====================================================================
|
|
67
|
+
CLOUD ACCOUNT AUTH METHODS
|
|
68
|
+
Discriminator for which credential shape is stored per provider.
|
|
69
|
+
Each provider has its own enum — only one is set per CloudAccount.
|
|
70
|
+
==================================================================== */
|
|
71
|
+
var AwsAuthMethod;
|
|
72
|
+
(function (AwsAuthMethod) {
|
|
73
|
+
AwsAuthMethod["ACCESS_KEY"] = "ACCESS_KEY";
|
|
74
|
+
AwsAuthMethod["IAM_ROLE"] = "IAM_ROLE";
|
|
75
|
+
AwsAuthMethod["IAM_IDENTITY_CENTER"] = "IAM_IDENTITY_CENTER";
|
|
76
|
+
AwsAuthMethod["IAM_ROLES_ANYWHERE"] = "IAM_ROLES_ANYWHERE";
|
|
77
|
+
})(AwsAuthMethod || (exports.AwsAuthMethod = AwsAuthMethod = {}));
|
|
78
|
+
var GcpAuthMethod;
|
|
79
|
+
(function (GcpAuthMethod) {
|
|
80
|
+
GcpAuthMethod["SERVICE_ACCOUNT_KEY"] = "SERVICE_ACCOUNT_KEY";
|
|
81
|
+
GcpAuthMethod["WORKLOAD_IDENTITY"] = "WORKLOAD_IDENTITY";
|
|
82
|
+
GcpAuthMethod["SERVICE_ACCOUNT_IMPERSONATION"] = "SERVICE_ACCOUNT_IMPERSONATION";
|
|
83
|
+
})(GcpAuthMethod || (exports.GcpAuthMethod = GcpAuthMethod = {}));
|
|
84
|
+
var AzureAuthMethod;
|
|
85
|
+
(function (AzureAuthMethod) {
|
|
86
|
+
AzureAuthMethod["SERVICE_PRINCIPAL_SECRET"] = "SERVICE_PRINCIPAL_SECRET";
|
|
87
|
+
AzureAuthMethod["SERVICE_PRINCIPAL_CERTIFICATE"] = "SERVICE_PRINCIPAL_CERTIFICATE";
|
|
88
|
+
AzureAuthMethod["MANAGED_IDENTITY_USER"] = "MANAGED_IDENTITY_USER";
|
|
89
|
+
AzureAuthMethod["MANAGED_IDENTITY_SYSTEM"] = "MANAGED_IDENTITY_SYSTEM";
|
|
90
|
+
})(AzureAuthMethod || (exports.AzureAuthMethod = AzureAuthMethod = {}));
|
|
91
|
+
/* ====================================================================
|
|
92
|
+
CLOUD ACCOUNT STATUS
|
|
93
|
+
==================================================================== */
|
|
94
|
+
var CloudAccountStatus;
|
|
95
|
+
(function (CloudAccountStatus) {
|
|
96
|
+
CloudAccountStatus["PENDING"] = "PENDING";
|
|
97
|
+
CloudAccountStatus["ACTIVE"] = "ACTIVE";
|
|
98
|
+
CloudAccountStatus["ERROR"] = "ERROR";
|
|
99
|
+
CloudAccountStatus["INACTIVE"] = "INACTIVE";
|
|
100
|
+
})(CloudAccountStatus || (exports.CloudAccountStatus = CloudAccountStatus = {}));
|
|
101
|
+
/* ====================================================================
|
|
102
|
+
SYNC JOB
|
|
103
|
+
==================================================================== */
|
|
104
|
+
var SyncStatus;
|
|
105
|
+
(function (SyncStatus) {
|
|
106
|
+
SyncStatus["PENDING"] = "PENDING";
|
|
107
|
+
SyncStatus["RUNNING"] = "RUNNING";
|
|
108
|
+
SyncStatus["SUCCESS"] = "SUCCESS";
|
|
109
|
+
SyncStatus["FAILED"] = "FAILED";
|
|
110
|
+
SyncStatus["PARTIAL"] = "PARTIAL";
|
|
111
|
+
})(SyncStatus || (exports.SyncStatus = SyncStatus = {}));
|
|
112
|
+
var SyncType;
|
|
113
|
+
(function (SyncType) {
|
|
114
|
+
SyncType["FULL"] = "FULL";
|
|
115
|
+
SyncType["COSTS"] = "COSTS";
|
|
116
|
+
SyncType["RESOURCES"] = "RESOURCES";
|
|
117
|
+
SyncType["BUDGETS"] = "BUDGETS";
|
|
118
|
+
})(SyncType || (exports.SyncType = SyncType = {}));
|