@discover-cloud/shared 1.3.0 → 1.5.0
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/authorization/index.d.ts +2 -2
- package/dist/authorization/permission-cache.service.js +27 -11
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.js +17 -0
- package/dist/context/request-context.storage.d.ts +21 -0
- package/dist/context/request-context.storage.js +37 -0
- package/dist/contracts/auth-service/account.dto.d.ts +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +17 -0
- package/dist/contracts/visibility.d.ts +63 -0
- package/dist/contracts/visibility.js +10 -0
- package/dist/dtos/audit-service.types.d.ts +42 -0
- package/dist/dtos/audit-service.types.js +31 -0
- package/dist/dtos/auth-service.dto.d.ts +16 -1
- package/dist/dtos/cloud-service.dto.d.ts +9 -3
- package/dist/dtos/index.d.ts +6 -5
- package/dist/dtos/index.js +1 -0
- package/dist/dtos/insights-service.dto.d.ts +174 -13
- package/dist/dtos/response.dto.d.ts +6 -0
- package/dist/dtos/user-service.dto.d.ts +52 -7
- package/dist/enums/domain.enums.d.ts +52 -26
- package/dist/enums/domain.enums.js +64 -40
- package/dist/enums/index.d.ts +2 -2
- package/dist/errors/app-error.js +1 -1
- package/dist/errors/http-errors.d.ts +1 -1
- package/dist/errors/http-errors.js +26 -26
- package/dist/errors/index.d.ts +2 -2
- package/dist/http/index.d.ts +2 -2
- package/dist/http/request-context.d.ts +2 -2
- package/dist/http/request-context.js +5 -5
- package/dist/http/service-client.d.ts +2 -2
- package/dist/http/service-client.js +2 -2
- package/dist/index.d.ts +11 -10
- package/dist/index.js +1 -0
- package/dist/jwt/index.d.ts +3 -3
- package/dist/jwt/machine-jwt-verifier.d.ts +1 -1
- package/dist/jwt/machine-jwt-verifier.js +13 -14
- package/dist/jwt/machine-token-client.d.ts +1 -1
- package/dist/jwt/machine-token-client.js +8 -8
- package/dist/jwt/user-jwt-verifier.d.ts +1 -1
- package/dist/jwt/user-jwt-verifier.js +17 -16
- package/dist/messaging/audit.publisher.d.ts +14 -0
- package/dist/messaging/audit.publisher.js +49 -0
- package/dist/messaging/index.d.ts +1 -0
- package/dist/messaging/index.js +1 -0
- package/dist/messaging/rabbitmq.client.d.ts +17 -5
- package/dist/messaging/rabbitmq.client.js +83 -36
- package/dist/middleware/error-handler.middleware.d.ts +2 -2
- package/dist/middleware/error-handler.middleware.js +10 -10
- package/dist/middleware/index.d.ts +10 -10
- package/dist/middleware/request-context.middleware.d.ts +1 -12
- package/dist/middleware/request-context.middleware.js +17 -42
- package/dist/middleware/require-auth.middleware.d.ts +3 -19
- package/dist/middleware/require-auth.middleware.js +17 -26
- package/dist/middleware/require-machine.middleware.d.ts +2 -27
- package/dist/middleware/require-machine.middleware.js +30 -25
- package/dist/middleware/require-org-permission-from-body.middleware.js +1 -2
- package/dist/middleware/require-org-permission.middleware.d.ts +3 -3
- package/dist/middleware/require-org-permission.middleware.js +28 -28
- package/dist/middleware/require-platform-permission.middleware.d.ts +3 -3
- package/dist/middleware/require-platform-permission.middleware.js +10 -10
- package/dist/middleware/require-user.middleware.d.ts +1 -1
- package/dist/middleware/require-user.middleware.js +2 -2
- package/dist/middleware/require-workspace-permission.middleware.d.ts +3 -3
- package/dist/middleware/require-workspace-permission.middleware.js +25 -25
- package/dist/middleware/validate.middleware.d.ts +3 -3
- package/dist/middleware/validate.middleware.js +1 -1
- package/dist/types/audit.types.d.ts +39 -0
- package/dist/types/audit.types.js +30 -0
- package/dist/types/express.types.d.ts +14 -7
- package/dist/types/express.types.js +10 -10
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/env.util.js +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/logger.util.d.ts +5 -0
- package/dist/utils/logger.util.js +46 -8
- package/dist/utils/request-context.als.d.ts +10 -0
- package/dist/utils/request-context.als.js +5 -0
- package/dist/utils/response.util.d.ts +1 -1
- package/dist/utils/url-safety.util.js +4 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './permission-cache.service';
|
|
2
|
+
export * from './permission-checker';
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.PermissionCacheService = void 0;
|
|
10
10
|
const redis_1 = require("redis");
|
|
11
|
+
const env_util_1 = require("../utils/env.util");
|
|
11
12
|
const CACHE_TTL_SECONDS = 24 * 60 * 60; // 24 hours
|
|
12
|
-
const PLATFORM_PREFIX =
|
|
13
|
-
const ORG_PREFIX =
|
|
14
|
-
const WORKSPACE_PREFIX =
|
|
13
|
+
const PLATFORM_PREFIX = 'perms:platform';
|
|
14
|
+
const ORG_PREFIX = 'perms:org';
|
|
15
|
+
const WORKSPACE_PREFIX = 'perms:workspace';
|
|
15
16
|
/**
|
|
16
17
|
* Redis-backed permission cache.
|
|
17
18
|
*
|
|
@@ -33,19 +34,19 @@ class PermissionCacheService {
|
|
|
33
34
|
*/
|
|
34
35
|
constructor() {
|
|
35
36
|
this.client = (0, redis_1.createClient)({
|
|
36
|
-
url:
|
|
37
|
+
url: (0, env_util_1.getEnv)('REDIS_URL'),
|
|
37
38
|
});
|
|
38
|
-
this.client.on(
|
|
39
|
-
console.error(
|
|
39
|
+
this.client.on('error', (err) => {
|
|
40
|
+
console.error('[PermissionCache] Redis error', err);
|
|
40
41
|
});
|
|
41
|
-
this.client.on(
|
|
42
|
-
console.info(
|
|
42
|
+
this.client.on('ready', () => {
|
|
43
|
+
console.info('[PermissionCache] Redis ready');
|
|
43
44
|
});
|
|
44
|
-
this.client.on(
|
|
45
|
-
console.warn(
|
|
45
|
+
this.client.on('reconnecting', () => {
|
|
46
|
+
console.warn('[PermissionCache] Redis reconnecting...');
|
|
46
47
|
});
|
|
47
48
|
this.client.connect().catch((err) => {
|
|
48
|
-
console.error(
|
|
49
|
+
console.error('[PermissionCache] Redis connection failed', err);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
/* ---------------------------------------------------------------------------
|
|
@@ -61,6 +62,9 @@ class PermissionCacheService {
|
|
|
61
62
|
async resolvePlatformPermissions(accountId, resolver) {
|
|
62
63
|
return this.resolve(this.platformKey(accountId), resolver);
|
|
63
64
|
}
|
|
65
|
+
/* --------------------------------------------------------------------------
|
|
66
|
+
resolveOrganizationPermissions
|
|
67
|
+
-------------------------------------------------------------------------- */
|
|
64
68
|
/**
|
|
65
69
|
* Resolves organization-scoped permissions.
|
|
66
70
|
*
|
|
@@ -72,6 +76,9 @@ class PermissionCacheService {
|
|
|
72
76
|
async resolveOrganizationPermissions(userId, organizationId, resolver) {
|
|
73
77
|
return this.resolve(this.organizationKey(userId, organizationId), resolver);
|
|
74
78
|
}
|
|
79
|
+
/* --------------------------------------------------------------------------
|
|
80
|
+
resolveWorkspacePermissions
|
|
81
|
+
-------------------------------------------------------------------------- */
|
|
75
82
|
/**
|
|
76
83
|
* Resolves workspace-scoped permissions.
|
|
77
84
|
*
|
|
@@ -94,6 +101,9 @@ class PermissionCacheService {
|
|
|
94
101
|
async invalidatePlatform(accountId) {
|
|
95
102
|
await this.delete(this.platformKey(accountId));
|
|
96
103
|
}
|
|
104
|
+
/* --------------------------------------------------------------------------
|
|
105
|
+
invalidateOrganization
|
|
106
|
+
-------------------------------------------------------------------------- */
|
|
97
107
|
/**
|
|
98
108
|
* Invalidates organization permission cache.
|
|
99
109
|
*
|
|
@@ -103,6 +113,9 @@ class PermissionCacheService {
|
|
|
103
113
|
async invalidateOrganization(userId, organizationId) {
|
|
104
114
|
await this.delete(this.organizationKey(userId, organizationId));
|
|
105
115
|
}
|
|
116
|
+
/* --------------------------------------------------------------------------
|
|
117
|
+
invalidateWorkspace
|
|
118
|
+
-------------------------------------------------------------------------- */
|
|
106
119
|
/**
|
|
107
120
|
* Invalidates workspace permission cache.
|
|
108
121
|
*
|
|
@@ -112,6 +125,9 @@ class PermissionCacheService {
|
|
|
112
125
|
async invalidateWorkspace(userId, workspaceId) {
|
|
113
126
|
await this.delete(this.workspaceKey(userId, workspaceId));
|
|
114
127
|
}
|
|
128
|
+
/* --------------------------------------------------------------------------
|
|
129
|
+
disconnect
|
|
130
|
+
-------------------------------------------------------------------------- */
|
|
115
131
|
/**
|
|
116
132
|
* Gracefully closes Redis connection.
|
|
117
133
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './request-context.storage';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./request-context.storage"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
|
+
import { RequestMetadataContext, UserContext, MachineContext } from '../types';
|
|
3
|
+
export type AuditRequestContext = RequestMetadataContext & {
|
|
4
|
+
actor?: UserContext | MachineContext;
|
|
5
|
+
};
|
|
6
|
+
export declare const requestContextStorage: AsyncLocalStorage<AuditRequestContext>;
|
|
7
|
+
export declare class RequestContextProvider {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves the current context if it exists.
|
|
10
|
+
*/
|
|
11
|
+
static get(): AuditRequestContext | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the current context or throws an error.
|
|
14
|
+
* Use this in deeper repositories where context is strictly required.
|
|
15
|
+
*/
|
|
16
|
+
static getOrThrow(): AuditRequestContext;
|
|
17
|
+
/**
|
|
18
|
+
* Attaches the authenticated actor to the current request context.
|
|
19
|
+
*/
|
|
20
|
+
static setActor(actor: UserContext | MachineContext): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestContextProvider = exports.requestContextStorage = void 0;
|
|
4
|
+
const async_hooks_1 = require("async_hooks");
|
|
5
|
+
exports.requestContextStorage = new async_hooks_1.AsyncLocalStorage();
|
|
6
|
+
class RequestContextProvider {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the current context if it exists.
|
|
9
|
+
*/
|
|
10
|
+
static get() {
|
|
11
|
+
return exports.requestContextStorage.getStore();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the current context or throws an error.
|
|
15
|
+
* Use this in deeper repositories where context is strictly required.
|
|
16
|
+
*/
|
|
17
|
+
static getOrThrow() {
|
|
18
|
+
const ctx = exports.requestContextStorage.getStore();
|
|
19
|
+
if (!ctx) {
|
|
20
|
+
throw new Error('AuditRequestContext is missing. Ensure the context middleware is active.');
|
|
21
|
+
}
|
|
22
|
+
return ctx;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Attaches the authenticated actor to the current request context.
|
|
26
|
+
*/
|
|
27
|
+
static setActor(actor) {
|
|
28
|
+
const ctx = exports.requestContextStorage.getStore();
|
|
29
|
+
if (!ctx) {
|
|
30
|
+
// Fail-fast: If we reach the authentication layer but have no context,
|
|
31
|
+
// the middleware pipeline is fundamentally broken.
|
|
32
|
+
throw new Error('Cannot set actor: AuditRequestContext is not initialized.');
|
|
33
|
+
}
|
|
34
|
+
ctx.actor = actor;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.RequestContextProvider = RequestContextProvider;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @description Data transfer objects (DTOs) for account management resources.
|
|
4
4
|
* Public DTOs never expose credentials, hashes, or encrypted secrets.
|
|
5
5
|
*/
|
|
6
|
-
import { AccountStatus } from
|
|
6
|
+
import { AccountStatus } from '../../enums';
|
|
7
7
|
/** Public account representation. */
|
|
8
8
|
export interface AccountDto {
|
|
9
9
|
id: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './visibility';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./visibility"), exports);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file visibility.ts
|
|
3
|
+
* @description Shared contracts for the Workspace-Centric Visibility Architecture.
|
|
4
|
+
*
|
|
5
|
+
* These are pure type definitions with no business logic.
|
|
6
|
+
* The VisibilityResolver lives in User Service behind the internal Visibility API.
|
|
7
|
+
* Insights Service repositories consume ResourceQueryScope, never VisibilityContext directly.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Defines the resource-level filters that narrow which cloud resources
|
|
11
|
+
* belong to a workspace beyond just cloud account membership.
|
|
12
|
+
*
|
|
13
|
+
* All fields are optional — a null/empty ResourceFilter means no additional
|
|
14
|
+
* narrowing beyond cloud account membership.
|
|
15
|
+
*/
|
|
16
|
+
export interface ResourceFilter {
|
|
17
|
+
/** Match resources with these exact tag key-value pairs. */
|
|
18
|
+
tags?: Record<string, string>;
|
|
19
|
+
/** Restrict to these resource groups (Azure-specific). */
|
|
20
|
+
resourceGroups?: string[];
|
|
21
|
+
/** Restrict to these cloud provider regions. */
|
|
22
|
+
regions?: string[];
|
|
23
|
+
/** Restrict to these cloud service types (e.g. 'ec2', 's3', 'lambda'). */
|
|
24
|
+
services?: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The resolved visibility boundary for a workspace.
|
|
28
|
+
* Produced by the User Service VisibilityResolver and returned by
|
|
29
|
+
* GET /internal/v1/workspaces/{workspaceId}/visibility.
|
|
30
|
+
*
|
|
31
|
+
* Must not be passed directly to repositories — application services
|
|
32
|
+
* must first map it to a ResourceQueryScope.
|
|
33
|
+
*/
|
|
34
|
+
export interface VisibilityContext {
|
|
35
|
+
/** The workspace this context belongs to. */
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Monotonically increasing version, incremented whenever
|
|
39
|
+
* WorkspaceCloudAccounts or resourceFilter changes.
|
|
40
|
+
* Used for cache validation.
|
|
41
|
+
*/
|
|
42
|
+
version: number;
|
|
43
|
+
/** IDs of all cloud accounts this workspace is allowed to access. */
|
|
44
|
+
cloudAccountIds: string[];
|
|
45
|
+
/** Additional resource-level narrowing applied on top of account membership. */
|
|
46
|
+
resourceFilter: ResourceFilter;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Repository-specific query object derived from VisibilityContext.
|
|
50
|
+
* Application services transform VisibilityContext → ResourceQueryScope
|
|
51
|
+
* before passing it to repositories.
|
|
52
|
+
*
|
|
53
|
+
* Repositories must never receive VisibilityContext or call HTTP APIs.
|
|
54
|
+
* They only consume this scope object.
|
|
55
|
+
*/
|
|
56
|
+
export interface ResourceQueryScope {
|
|
57
|
+
/** The workspace whose data is being queried. */
|
|
58
|
+
workspaceId: string;
|
|
59
|
+
/** Cloud accounts whose data is visible in this scope. */
|
|
60
|
+
cloudAccountIds: string[];
|
|
61
|
+
/** Resource-level filter predicates. */
|
|
62
|
+
resourceFilter: ResourceFilter;
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file visibility.ts
|
|
4
|
+
* @description Shared contracts for the Workspace-Centric Visibility Architecture.
|
|
5
|
+
*
|
|
6
|
+
* These are pure type definitions with no business logic.
|
|
7
|
+
* The VisibilityResolver lives in User Service behind the internal Visibility API.
|
|
8
|
+
* Insights Service repositories consume ResourceQueryScope, never VisibilityContext directly.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare enum AuditActorType {
|
|
2
|
+
USER = "USER",
|
|
3
|
+
SERVICE = "SERVICE",
|
|
4
|
+
SYSTEM = "SYSTEM",
|
|
5
|
+
ANONYMOUS = "ANONYMOUS"
|
|
6
|
+
}
|
|
7
|
+
export declare enum AuditResourceType {
|
|
8
|
+
ACCOUNT = "ACCOUNT",
|
|
9
|
+
USER = "USER",
|
|
10
|
+
ORGANIZATION = "ORGANIZATION",
|
|
11
|
+
WORKSPACE = "WORKSPACE",
|
|
12
|
+
ROLE = "ROLE",
|
|
13
|
+
PERMISSION = "PERMISSION",
|
|
14
|
+
SERVICE_CLIENT = "SERVICE_CLIENT",
|
|
15
|
+
ALERT_RULE = "ALERT_RULE",
|
|
16
|
+
CLOUD_ACCOUNT = "CLOUD_ACCOUNT",
|
|
17
|
+
SYNC_JOB = "SYNC_JOB",
|
|
18
|
+
SYSTEM = "SYSTEM"
|
|
19
|
+
}
|
|
20
|
+
export declare enum AuditSeverity {
|
|
21
|
+
INFO = "info",
|
|
22
|
+
WARNING = "warning",
|
|
23
|
+
ERROR = "error",
|
|
24
|
+
CRITICAL = "critical"
|
|
25
|
+
}
|
|
26
|
+
export interface RecordAuditActionInput {
|
|
27
|
+
actorId?: string | null;
|
|
28
|
+
actorType?: AuditActorType;
|
|
29
|
+
action: string;
|
|
30
|
+
severity?: AuditSeverity;
|
|
31
|
+
resourceType: AuditResourceType;
|
|
32
|
+
resourceId?: string | null;
|
|
33
|
+
organizationId?: string | null;
|
|
34
|
+
workspaceId?: string | null;
|
|
35
|
+
/** For resources (like CloudAccount) owned by an org or personal workspace rather than a workspace directly. */
|
|
36
|
+
ownerId?: string | null;
|
|
37
|
+
ipAddress?: string | null;
|
|
38
|
+
userAgent?: string | null;
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
requestId?: string | null;
|
|
41
|
+
traceId?: string | null;
|
|
42
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditSeverity = exports.AuditResourceType = exports.AuditActorType = void 0;
|
|
4
|
+
var AuditActorType;
|
|
5
|
+
(function (AuditActorType) {
|
|
6
|
+
AuditActorType["USER"] = "USER";
|
|
7
|
+
AuditActorType["SERVICE"] = "SERVICE";
|
|
8
|
+
AuditActorType["SYSTEM"] = "SYSTEM";
|
|
9
|
+
AuditActorType["ANONYMOUS"] = "ANONYMOUS";
|
|
10
|
+
})(AuditActorType || (exports.AuditActorType = AuditActorType = {}));
|
|
11
|
+
var AuditResourceType;
|
|
12
|
+
(function (AuditResourceType) {
|
|
13
|
+
AuditResourceType["ACCOUNT"] = "ACCOUNT";
|
|
14
|
+
AuditResourceType["USER"] = "USER";
|
|
15
|
+
AuditResourceType["ORGANIZATION"] = "ORGANIZATION";
|
|
16
|
+
AuditResourceType["WORKSPACE"] = "WORKSPACE";
|
|
17
|
+
AuditResourceType["ROLE"] = "ROLE";
|
|
18
|
+
AuditResourceType["PERMISSION"] = "PERMISSION";
|
|
19
|
+
AuditResourceType["SERVICE_CLIENT"] = "SERVICE_CLIENT";
|
|
20
|
+
AuditResourceType["ALERT_RULE"] = "ALERT_RULE";
|
|
21
|
+
AuditResourceType["CLOUD_ACCOUNT"] = "CLOUD_ACCOUNT";
|
|
22
|
+
AuditResourceType["SYNC_JOB"] = "SYNC_JOB";
|
|
23
|
+
AuditResourceType["SYSTEM"] = "SYSTEM";
|
|
24
|
+
})(AuditResourceType || (exports.AuditResourceType = AuditResourceType = {}));
|
|
25
|
+
var AuditSeverity;
|
|
26
|
+
(function (AuditSeverity) {
|
|
27
|
+
AuditSeverity["INFO"] = "info";
|
|
28
|
+
AuditSeverity["WARNING"] = "warning";
|
|
29
|
+
AuditSeverity["ERROR"] = "error";
|
|
30
|
+
AuditSeverity["CRITICAL"] = "critical";
|
|
31
|
+
})(AuditSeverity || (exports.AuditSeverity = AuditSeverity = {}));
|
|
@@ -34,7 +34,7 @@ export interface ServiceClientDto {
|
|
|
34
34
|
serviceId: string;
|
|
35
35
|
name: string;
|
|
36
36
|
scopes: string[];
|
|
37
|
-
|
|
37
|
+
status: string;
|
|
38
38
|
lastUsedAt: string | null;
|
|
39
39
|
rotatedAt: string | null;
|
|
40
40
|
expiresAt: string | null;
|
|
@@ -101,3 +101,18 @@ export interface MfaSetupDto {
|
|
|
101
101
|
export interface MfaBackupCodesDto {
|
|
102
102
|
backupCodes: string[];
|
|
103
103
|
}
|
|
104
|
+
export interface AuthResponseDto {
|
|
105
|
+
tokens: AuthTokensDto;
|
|
106
|
+
account: AccountDto;
|
|
107
|
+
}
|
|
108
|
+
export interface PlatformPermissionCheckDto {
|
|
109
|
+
accountId: string;
|
|
110
|
+
permissionKey: string;
|
|
111
|
+
}
|
|
112
|
+
export interface PlatformPermissionCheckResultDto extends PlatformPermissionCheckDto {
|
|
113
|
+
granted: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface ServiceClientCreatedResponseDto {
|
|
116
|
+
client: ServiceClientDto;
|
|
117
|
+
secret: string;
|
|
118
|
+
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* @description Data transfer objects (DTOs) for cloud accounts,
|
|
4
4
|
* sync jobs, provider ingestion, and insights communication.
|
|
5
5
|
*/
|
|
6
|
-
import { CloudProvider, CloudAccountStatus, AwsAuthMethod, GcpAuthMethod, AzureAuthMethod, SyncStatus, SyncType } from
|
|
6
|
+
import { CloudProvider, CloudAccountStatus, CloudAccountOwnerType, AwsAuthMethod, GcpAuthMethod, AzureAuthMethod, SyncStatus, SyncType } from '../enums';
|
|
7
7
|
/** Public representation of a connected cloud account. */
|
|
8
8
|
export interface CloudAccountDto {
|
|
9
9
|
id: string;
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/** Whether this account belongs to an Organization or a Personal Workspace. */
|
|
11
|
+
ownerType: CloudAccountOwnerType;
|
|
12
|
+
/** The ID of the owning entity (organizationId or workspaceId depending on ownerType). */
|
|
13
|
+
ownerId: string;
|
|
12
14
|
/** User who originally connected this account. */
|
|
13
15
|
createdBy: string;
|
|
14
16
|
alias: string;
|
|
@@ -123,3 +125,7 @@ export interface CloudBudgetDto {
|
|
|
123
125
|
forecastSpend: number;
|
|
124
126
|
period: string;
|
|
125
127
|
}
|
|
128
|
+
export interface BulkDeleteCloudAccountsResponseDto {
|
|
129
|
+
deletedCount: number;
|
|
130
|
+
skippedAccountIds: string[];
|
|
131
|
+
}
|
package/dist/dtos/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './user-service.dto';
|
|
2
|
+
export * from './auth-service.dto';
|
|
3
|
+
export * from './cloud-service.dto';
|
|
4
|
+
export * from './insights-service.dto';
|
|
5
|
+
export * from './audit-service.types';
|
|
6
|
+
export * from './response.dto';
|
package/dist/dtos/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./user-service.dto"), exports);
|
|
|
18
18
|
__exportStar(require("./auth-service.dto"), exports);
|
|
19
19
|
__exportStar(require("./cloud-service.dto"), exports);
|
|
20
20
|
__exportStar(require("./insights-service.dto"), exports);
|
|
21
|
+
__exportStar(require("./audit-service.types"), exports);
|
|
21
22
|
__exportStar(require("./response.dto"), exports);
|