@benchcubed/today-cli 1.0.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/README.md +296 -0
- package/dist/ai/bedrock-client.d.ts +1 -0
- package/dist/ai/bedrock-client.d.ts.map +1 -0
- package/dist/ai/bedrock-client.js +2 -0
- package/dist/ai/bedrock-client.js.map +1 -0
- package/dist/ai/knowledge-processor.d.ts +1 -0
- package/dist/ai/knowledge-processor.d.ts.map +1 -0
- package/dist/ai/knowledge-processor.js +2 -0
- package/dist/ai/knowledge-processor.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +70 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ask.d.ts +3 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +217 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +153 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +114 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +72 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/embeddings.d.ts +3 -0
- package/dist/commands/embeddings.d.ts.map +1 -0
- package/dist/commands/embeddings.js +118 -0
- package/dist/commands/embeddings.js.map +1 -0
- package/dist/commands/experts.d.ts +3 -0
- package/dist/commands/experts.d.ts.map +1 -0
- package/dist/commands/experts.js +129 -0
- package/dist/commands/experts.js.map +1 -0
- package/dist/commands/export-import.d.ts +4 -0
- package/dist/commands/export-import.d.ts.map +1 -0
- package/dist/commands/export-import.js +285 -0
- package/dist/commands/export-import.js.map +1 -0
- package/dist/commands/git.d.ts +4 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +274 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/impact.d.ts +3 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +121 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/insights.d.ts +3 -0
- package/dist/commands/insights.d.ts.map +1 -0
- package/dist/commands/insights.js +113 -0
- package/dist/commands/insights.js.map +1 -0
- package/dist/commands/learned.d.ts +3 -0
- package/dist/commands/learned.d.ts.map +1 -0
- package/dist/commands/learned.js +355 -0
- package/dist/commands/learned.js.map +1 -0
- package/dist/commands/onboard.d.ts +3 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +141 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/recent.d.ts +3 -0
- package/dist/commands/recent.d.ts.map +1 -0
- package/dist/commands/recent.js +83 -0
- package/dist/commands/recent.js.map +1 -0
- package/dist/commands/secrets.d.ts +3 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +203 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/stats.d.ts +3 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +120 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/config/index.d.ts +12 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +46 -0
- package/dist/config/index.js.map +1 -0
- package/dist/database/migrations.d.ts +13 -0
- package/dist/database/migrations.d.ts.map +1 -0
- package/dist/database/migrations.js +190 -0
- package/dist/database/migrations.js.map +1 -0
- package/dist/database/postgresql.d.ts +92 -0
- package/dist/database/postgresql.d.ts.map +1 -0
- package/dist/database/postgresql.js +382 -0
- package/dist/database/postgresql.js.map +1 -0
- package/dist/database/sqlite.d.ts +54 -0
- package/dist/database/sqlite.d.ts.map +1 -0
- package/dist/database/sqlite.js +337 -0
- package/dist/database/sqlite.js.map +1 -0
- package/dist/lambda/admin.d.ts +3 -0
- package/dist/lambda/admin.d.ts.map +1 -0
- package/dist/lambda/admin.js +818 -0
- package/dist/lambda/admin.js.map +1 -0
- package/dist/lambda/ai-services.d.ts +6 -0
- package/dist/lambda/ai-services.d.ts.map +1 -0
- package/dist/lambda/ai-services.js +472 -0
- package/dist/lambda/ai-services.js.map +1 -0
- package/dist/lambda/analytics.d.ts +3 -0
- package/dist/lambda/analytics.d.ts.map +1 -0
- package/dist/lambda/analytics.js +481 -0
- package/dist/lambda/analytics.js.map +1 -0
- package/dist/lambda/api-router.d.ts +3 -0
- package/dist/lambda/api-router.d.ts.map +1 -0
- package/dist/lambda/api-router.js +162 -0
- package/dist/lambda/api-router.js.map +1 -0
- package/dist/lambda/custom-topics.d.ts +3 -0
- package/dist/lambda/custom-topics.d.ts.map +1 -0
- package/dist/lambda/custom-topics.js +425 -0
- package/dist/lambda/custom-topics.js.map +1 -0
- package/dist/lambda/graph-builder.d.ts +3 -0
- package/dist/lambda/graph-builder.d.ts.map +1 -0
- package/dist/lambda/graph-builder.js +442 -0
- package/dist/lambda/graph-builder.js.map +1 -0
- package/dist/lambda/knowledge-ai.d.ts +3 -0
- package/dist/lambda/knowledge-ai.d.ts.map +1 -0
- package/dist/lambda/knowledge-ai.js +849 -0
- package/dist/lambda/knowledge-ai.js.map +1 -0
- package/dist/lambda/post-confirmation.d.ts +8 -0
- package/dist/lambda/post-confirmation.d.ts.map +1 -0
- package/dist/lambda/post-confirmation.js +92 -0
- package/dist/lambda/post-confirmation.js.map +1 -0
- package/dist/lambda/teams.d.ts +3 -0
- package/dist/lambda/teams.d.ts.map +1 -0
- package/dist/lambda/teams.js +568 -0
- package/dist/lambda/teams.js.map +1 -0
- package/dist/lib/export-helpers.d.ts +5 -0
- package/dist/lib/export-helpers.d.ts.map +1 -0
- package/dist/lib/export-helpers.js +137 -0
- package/dist/lib/export-helpers.js.map +1 -0
- package/dist/lib/import-helpers.d.ts +5 -0
- package/dist/lib/import-helpers.d.ts.map +1 -0
- package/dist/lib/import-helpers.js +185 -0
- package/dist/lib/import-helpers.js.map +1 -0
- package/dist/lib/insights-helpers.d.ts +123 -0
- package/dist/lib/insights-helpers.d.ts.map +1 -0
- package/dist/lib/insights-helpers.js +374 -0
- package/dist/lib/insights-helpers.js.map +1 -0
- package/dist/lib/search-helpers.d.ts +4 -0
- package/dist/lib/search-helpers.d.ts.map +1 -0
- package/dist/lib/search-helpers.js +124 -0
- package/dist/lib/search-helpers.js.map +1 -0
- package/dist/lib/secret-helpers.d.ts +2 -0
- package/dist/lib/secret-helpers.d.ts.map +1 -0
- package/dist/lib/secret-helpers.js +85 -0
- package/dist/lib/secret-helpers.js.map +1 -0
- package/dist/lib/stats-helpers.d.ts +41 -0
- package/dist/lib/stats-helpers.d.ts.map +1 -0
- package/dist/lib/stats-helpers.js +263 -0
- package/dist/lib/stats-helpers.js.map +1 -0
- package/dist/services/aws-api.d.ts +81 -0
- package/dist/services/aws-api.d.ts.map +1 -0
- package/dist/services/aws-api.js +388 -0
- package/dist/services/aws-api.js.map +1 -0
- package/dist/services/bedrock.d.ts +83 -0
- package/dist/services/bedrock.d.ts.map +1 -0
- package/dist/services/bedrock.js +434 -0
- package/dist/services/bedrock.js.map +1 -0
- package/dist/services/commit-learnings.d.ts +25 -0
- package/dist/services/commit-learnings.d.ts.map +1 -0
- package/dist/services/commit-learnings.js +180 -0
- package/dist/services/commit-learnings.js.map +1 -0
- package/dist/services/embedding-storage.d.ts +42 -0
- package/dist/services/embedding-storage.d.ts.map +1 -0
- package/dist/services/embedding-storage.js +124 -0
- package/dist/services/embedding-storage.js.map +1 -0
- package/dist/services/expert-engine.d.ts +21 -0
- package/dist/services/expert-engine.d.ts.map +1 -0
- package/dist/services/expert-engine.js +58 -0
- package/dist/services/expert-engine.js.map +1 -0
- package/dist/services/onboarding-accelerator.d.ts +118 -0
- package/dist/services/onboarding-accelerator.d.ts.map +1 -0
- package/dist/services/onboarding-accelerator.js +403 -0
- package/dist/services/onboarding-accelerator.js.map +1 -0
- package/dist/services/secret-detection.d.ts +46 -0
- package/dist/services/secret-detection.d.ts.map +1 -0
- package/dist/services/secret-detection.js +75 -0
- package/dist/services/secret-detection.js.map +1 -0
- package/dist/services/secret-manager-simple.d.ts +51 -0
- package/dist/services/secret-manager-simple.d.ts.map +1 -0
- package/dist/services/secret-manager-simple.js +119 -0
- package/dist/services/secret-manager-simple.js.map +1 -0
- package/dist/services/secret-manager.d.ts +150 -0
- package/dist/services/secret-manager.d.ts.map +1 -0
- package/dist/services/secret-manager.js +287 -0
- package/dist/services/secret-manager.js.map +1 -0
- package/dist/services/vector-embeddings.d.ts +70 -0
- package/dist/services/vector-embeddings.d.ts.map +1 -0
- package/dist/services/vector-embeddings.js +167 -0
- package/dist/services/vector-embeddings.js.map +1 -0
- package/dist/services/vector-search.d.ts +28 -0
- package/dist/services/vector-search.d.ts.map +1 -0
- package/dist/services/vector-search.js +192 -0
- package/dist/services/vector-search.js.map +1 -0
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/formatting.d.ts +10 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +82 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/git.d.ts +52 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +182 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/validation.d.ts +17 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +187 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Enterprise Secret Management & Discovery Service (Simplified)
|
|
4
|
+
* Routes through authenticated backend API
|
|
5
|
+
*
|
|
6
|
+
* SECURITY-FIRST APPROACH:
|
|
7
|
+
* - Never stores actual secret values externally
|
|
8
|
+
* - Provides discovery, cataloging, and workflow management
|
|
9
|
+
* - Generates secure deployment templates
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.enterpriseSecretManagerService = exports.EnterpriseSecretManagerService = void 0;
|
|
13
|
+
const aws_api_1 = require("./aws-api");
|
|
14
|
+
class EnterpriseSecretManagerService {
|
|
15
|
+
constructor() {
|
|
16
|
+
// API endpoint managed by awsApiService
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Process detected secrets - DISCOVERY ONLY, no storage of actual values
|
|
20
|
+
*/
|
|
21
|
+
async processDetectedSecrets(detections, originalContent, context) {
|
|
22
|
+
const discoveries = [];
|
|
23
|
+
for (const detection of detections) {
|
|
24
|
+
// Skip low-risk detections that don't need management
|
|
25
|
+
if (detection.riskLevel === 'low' && detection.type === 'pii') {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const discovery = this.createSecretDiscovery(detection, originalContent, context);
|
|
29
|
+
discoveries.push(discovery);
|
|
30
|
+
}
|
|
31
|
+
return discoveries;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a secret discovery record - METADATA ONLY
|
|
35
|
+
*/
|
|
36
|
+
createSecretDiscovery(detection, originalContent, context) {
|
|
37
|
+
const secretName = this.generateSecretName(detection, context.teamId);
|
|
38
|
+
const environment = this.detectEnvironment(detection.value, originalContent);
|
|
39
|
+
return {
|
|
40
|
+
id: `disc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
41
|
+
discoveredBy: context.authorId,
|
|
42
|
+
teamId: context.teamId,
|
|
43
|
+
secretType: this.mapDetectionToSecretType(detection),
|
|
44
|
+
secretName,
|
|
45
|
+
description: this.generateSecretDescription(detection, originalContent),
|
|
46
|
+
environment,
|
|
47
|
+
status: detection.riskLevel === 'low' ? 'approved' : 'discovered',
|
|
48
|
+
riskLevel: detection.riskLevel,
|
|
49
|
+
valuePreview: this.createSecretPreview(detection.value),
|
|
50
|
+
discoveredAt: new Date()
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* SECURITY: Create safe preview of secret value
|
|
55
|
+
*/
|
|
56
|
+
createSecretPreview(value) {
|
|
57
|
+
if (value.length <= 8) {
|
|
58
|
+
return '***';
|
|
59
|
+
}
|
|
60
|
+
else if (value.length <= 16) {
|
|
61
|
+
return value.substring(0, 2) + '***' + value.substring(value.length - 2);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return value.substring(0, 4) + '***' + value.substring(value.length - 4);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
generateSecretName(detection, teamId) {
|
|
68
|
+
const type = detection.type.replace('_', '-');
|
|
69
|
+
const env = this.detectEnvironment(detection.value, '');
|
|
70
|
+
const timestamp = Date.now().toString().slice(-6);
|
|
71
|
+
return `${teamId}/${env}/${type}-${timestamp}`;
|
|
72
|
+
}
|
|
73
|
+
detectEnvironment(value, content) {
|
|
74
|
+
const lowerValue = value.toLowerCase();
|
|
75
|
+
const lowerContent = content.toLowerCase();
|
|
76
|
+
if (lowerValue.includes('prod') || lowerValue.includes('live') || lowerContent.includes('production')) {
|
|
77
|
+
return 'production';
|
|
78
|
+
}
|
|
79
|
+
else if (lowerValue.includes('staging') || lowerValue.includes('stage') || lowerContent.includes('staging')) {
|
|
80
|
+
return 'staging';
|
|
81
|
+
}
|
|
82
|
+
else if (lowerValue.includes('test') || lowerContent.includes('test')) {
|
|
83
|
+
return 'test';
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return 'development';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
mapDetectionToSecretType(detection) {
|
|
90
|
+
if (detection.value.startsWith('http')) {
|
|
91
|
+
return 'url';
|
|
92
|
+
}
|
|
93
|
+
return detection.type;
|
|
94
|
+
}
|
|
95
|
+
generateSecretDescription(detection, content) {
|
|
96
|
+
const context = detection.context || 'Detected in knowledge entry';
|
|
97
|
+
const preview = content.substring(0, 100).replace(/\n/g, ' ');
|
|
98
|
+
return `${context}. Found in: "${preview}..."`;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if service is available (authenticated backend API)
|
|
102
|
+
*/
|
|
103
|
+
async isAvailable() {
|
|
104
|
+
try {
|
|
105
|
+
if (!aws_api_1.awsApiService.isAuthenticated()) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const response = await aws_api_1.awsApiService.callAPI('/secrets/list', 'GET');
|
|
109
|
+
return response.success;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
console.warn('Enterprise Secret Manager service not available:', error);
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.EnterpriseSecretManagerService = EnterpriseSecretManagerService;
|
|
118
|
+
exports.enterpriseSecretManagerService = new EnterpriseSecretManagerService();
|
|
119
|
+
//# sourceMappingURL=secret-manager-simple.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-manager-simple.js","sourceRoot":"","sources":["../../src/services/secret-manager-simple.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,uCAA0C;AAiB1C,MAAa,8BAA8B;IACzC;QACE,wCAAwC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAC1B,UAAqC,EACrC,eAAuB,EACvB,OAA6C;QAE7C,MAAM,WAAW,GAAsB,EAAE,CAAC;QAE1C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,sDAAsD;YACtD,IAAI,SAAS,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC9D,SAAS;YACX,CAAC;YAED,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;YAClF,WAAW,CAAC,IAAI,CAAC,SAAS,CA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PROACH:
|
|
5
|
+
* - Never stores actual secret values externally
|
|
6
|
+
* - Deploys to customer's own AWS account
|
|
7
|
+
* - Provides discovery, cataloging, and workflow management
|
|
8
|
+
* - Generates secure deployment templates
|
|
9
|
+
* - Maintains compliance with enterprise security policies
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* 1. Secret Discovery & Cataloging (metadata only)
|
|
13
|
+
* 2. Approval Workflow Management
|
|
14
|
+
* 3. AWS Secrets Manager Template Generation
|
|
15
|
+
* 4. Team Secret Registry (references only)
|
|
16
|
+
* 5. Compliance & Audit Trail
|
|
17
|
+
*/
|
|
18
|
+
import { EnhancedSecretDetection } from './secret-detection';
|
|
19
|
+
export interface SecretDiscovery {
|
|
20
|
+
id: string;
|
|
21
|
+
discoveredBy: string;
|
|
22
|
+
teamId: string;
|
|
23
|
+
secretType: 'api_key' | 'password' | 'token' | 'connection_string' | 'url' | 'endpoint';
|
|
24
|
+
secretName: string;
|
|
25
|
+
description: string;
|
|
26
|
+
context: string;
|
|
27
|
+
environment: 'production' | 'staging' | 'development' | 'test';
|
|
28
|
+
status: 'discovered' | 'approval_requested' | 'approved' | 'managed' | 'deprecated';
|
|
29
|
+
approvalRequired: boolean;
|
|
30
|
+
approvedBy?: string;
|
|
31
|
+
approvedAt?: Date;
|
|
32
|
+
discoveredAt: Date;
|
|
33
|
+
tags: string[];
|
|
34
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
35
|
+
valueHash: string;
|
|
36
|
+
valuePreview: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SecretTemplate {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
environment: string;
|
|
42
|
+
secretType: string;
|
|
43
|
+
terraformTemplate: string;
|
|
44
|
+
cloudFormationTemplate: string;
|
|
45
|
+
awsCliCommands: string[];
|
|
46
|
+
tags: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
export interface TeamSecretRegistry {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
environment: string;
|
|
53
|
+
secretType: string;
|
|
54
|
+
teamId: string;
|
|
55
|
+
awsSecretArn?: string;
|
|
56
|
+
status: 'active' | 'deprecated' | 'rotated';
|
|
57
|
+
createdBy: string;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
lastRotated?: Date;
|
|
60
|
+
rotationSchedule?: string;
|
|
61
|
+
accessInstructions: string;
|
|
62
|
+
tags: string[];
|
|
63
|
+
}
|
|
64
|
+
export interface URLRegistry {
|
|
65
|
+
id: string;
|
|
66
|
+
url: string;
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
environment: string;
|
|
70
|
+
teamId: string;
|
|
71
|
+
category: 'api' | 'webhook' | 'database' | 'service' | 'documentation' | 'other';
|
|
72
|
+
status: 'active' | 'deprecated' | 'testing';
|
|
73
|
+
addedBy: string;
|
|
74
|
+
addedAt: Date;
|
|
75
|
+
lastVerified?: Date;
|
|
76
|
+
tags: string[];
|
|
77
|
+
accessInstructions?: string;
|
|
78
|
+
}
|
|
79
|
+
export declare class EnterpriseSecretManagerService {
|
|
80
|
+
constructor();
|
|
81
|
+
/**
|
|
82
|
+
* Process detected secrets - DISCOVERY ONLY, no storage of actual values
|
|
83
|
+
*/
|
|
84
|
+
processDetectedSecrets(detections: EnhancedSecretDetection[], originalContent: string, context: {
|
|
85
|
+
authorId: string;
|
|
86
|
+
teamId: string;
|
|
87
|
+
}): Promise<SecretDiscovery[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Create a secret discovery record - METADATA ONLY
|
|
90
|
+
*/
|
|
91
|
+
private createSecretDiscovery;
|
|
92
|
+
/**
|
|
93
|
+
* Send approval notification for high-risk secrets
|
|
94
|
+
*/
|
|
95
|
+
private sendApprovalNotification;
|
|
96
|
+
/**
|
|
97
|
+
* Generate secret name for cataloging
|
|
98
|
+
*/
|
|
99
|
+
private generateSecretName;
|
|
100
|
+
/**
|
|
101
|
+
* Detect environment from secret value and content
|
|
102
|
+
*/
|
|
103
|
+
private detectEnvironment;
|
|
104
|
+
/**
|
|
105
|
+
* Map detection type to secret type
|
|
106
|
+
*/
|
|
107
|
+
private mapDetectionToSecretType;
|
|
108
|
+
/**
|
|
109
|
+
* Generate description for secret
|
|
110
|
+
*/
|
|
111
|
+
private generateSecretDescription;
|
|
112
|
+
/**
|
|
113
|
+
* Generate tags for secret
|
|
114
|
+
*/
|
|
115
|
+
private generateSecretTags;
|
|
116
|
+
/**
|
|
117
|
+
* Hash secret value for duplicate detection
|
|
118
|
+
*/
|
|
119
|
+
private hashSecretValue;
|
|
120
|
+
/**
|
|
121
|
+
* Create safe preview of secret value
|
|
122
|
+
*/
|
|
123
|
+
private createSecretPreview;
|
|
124
|
+
/**
|
|
125
|
+
* Store secret discovery (metadata only)
|
|
126
|
+
*/
|
|
127
|
+
private storeSecretDiscovery;
|
|
128
|
+
/**
|
|
129
|
+
* Generate deployment templates for customer's AWS account
|
|
130
|
+
*/
|
|
131
|
+
generateSecretTemplate(discovery: SecretDiscovery): Promise<SecretTemplate>;
|
|
132
|
+
/**
|
|
133
|
+
* Generate Terraform template for customer deployment
|
|
134
|
+
*/
|
|
135
|
+
private generateTerraformTemplate;
|
|
136
|
+
/**
|
|
137
|
+
* Generate CloudFormation template
|
|
138
|
+
*/
|
|
139
|
+
private generateCloudFormationTemplate;
|
|
140
|
+
/**
|
|
141
|
+
* Generate AWS CLI commands for manual deployment
|
|
142
|
+
*/
|
|
143
|
+
private generateAWSCliCommands;
|
|
144
|
+
/**
|
|
145
|
+
* Check if service is available (authenticated backend API)
|
|
146
|
+
*/
|
|
147
|
+
isAvailable(): Promise<boolean>;
|
|
148
|
+
}
|
|
149
|
+
export declare const enterpriseSecretManagerService: EnterpriseSecretManagerService;
|
|
150
|
+
//# sourceMappingURL=secret-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-manager.d.ts","sourceRoot":"","sources":["../../src/services/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AiCnC;;OAEG;YACW,wBAAwB;IAKtC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAQ1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAezB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAOjC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;YACW,oBAAoB;IAMlC;;OAEG;IACG,sBAAsB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAsBjF;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAqCjC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAoBtC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAYtC;AAED,eAAO,MAAM,8BAA8B,gCAAuC,CAAC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Enterprise Secret Management & Discovery Service
|
|
4
|
+
*
|
|
5
|
+
* SECURITY-FIRST APPROACH:
|
|
6
|
+
* - Never stores actual secret values externally
|
|
7
|
+
* - Deploys to customer's own AWS account
|
|
8
|
+
* - Provides discovery, cataloging, and workflow management
|
|
9
|
+
* - Generates secure deployment templates
|
|
10
|
+
* - Maintains compliance with enterprise security policies
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* 1. Secret Discovery & Cataloging (metadata only)
|
|
14
|
+
* 2. Approval Workflow Management
|
|
15
|
+
* 3. AWS Secrets Manager Template Generation
|
|
16
|
+
* 4. Team Secret Registry (references only)
|
|
17
|
+
* 5. Compliance & Audit Trail
|
|
18
|
+
*/
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.enterpriseSecretManagerService = exports.EnterpriseSecretManagerService = void 0;
|
|
24
|
+
const aws_api_1 = require("./aws-api");
|
|
25
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
26
|
+
class EnterpriseSecretManagerService {
|
|
27
|
+
constructor() {
|
|
28
|
+
// API endpoint managed by awsApiService
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Process detected secrets - DISCOVERY ONLY, no storage of actual values
|
|
32
|
+
*/
|
|
33
|
+
async processDetectedSecrets(detections, originalContent, context) {
|
|
34
|
+
const discoveries = [];
|
|
35
|
+
for (const detection of detections) {
|
|
36
|
+
// Skip low-risk detections that don't need management
|
|
37
|
+
if (detection.riskLevel === 'low' && detection.type === 'pii') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const discovery = await this.createSecretDiscovery(detection, originalContent, context);
|
|
41
|
+
discoveries.push(discovery);
|
|
42
|
+
// Send approval notification for high-risk secrets
|
|
43
|
+
if (detection.riskLevel === 'critical' || detection.riskLevel === 'high') {
|
|
44
|
+
await this.sendApprovalNotification(discovery);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return discoveries;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a secret discovery record - METADATA ONLY
|
|
51
|
+
*/
|
|
52
|
+
async createSecretDiscovery(detection, originalContent, context) {
|
|
53
|
+
const secretName = this.generateSecretName(detection, context.teamId);
|
|
54
|
+
const environment = this.detectEnvironment(detection.value, originalContent);
|
|
55
|
+
const discovery = {
|
|
56
|
+
id: `disc_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
|
|
57
|
+
discoveredBy: context.authorId,
|
|
58
|
+
teamId: context.teamId,
|
|
59
|
+
secretType: this.mapDetectionToSecretType(detection),
|
|
60
|
+
secretName,
|
|
61
|
+
description: this.generateSecretDescription(detection, originalContent),
|
|
62
|
+
context: detection.context || 'Detected in knowledge entry',
|
|
63
|
+
environment,
|
|
64
|
+
approvalRequired: detection.riskLevel === 'critical' || detection.riskLevel === 'high',
|
|
65
|
+
status: detection.riskLevel === 'low' ? 'approved' : 'discovered',
|
|
66
|
+
discoveredAt: new Date(),
|
|
67
|
+
tags: this.generateSecretTags(detection, originalContent),
|
|
68
|
+
riskLevel: detection.riskLevel,
|
|
69
|
+
// SECURITY: Only store hash and preview, never full value
|
|
70
|
+
valueHash: this.hashSecretValue(detection.value),
|
|
71
|
+
valuePreview: this.createSecretPreview(detection.value)
|
|
72
|
+
};
|
|
73
|
+
// Store discovery record (metadata only)
|
|
74
|
+
await this.storeSecretDiscovery(discovery);
|
|
75
|
+
return discovery;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Send approval notification for high-risk secrets
|
|
79
|
+
*/
|
|
80
|
+
async sendApprovalNotification(discovery) {
|
|
81
|
+
// Log the notification for tracking
|
|
82
|
+
console.log(`📧 Approval notification sent for ${discovery.secretName} (${discovery.riskLevel} risk)`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Generate secret name for cataloging
|
|
86
|
+
*/
|
|
87
|
+
generateSecretName(detection, teamId) {
|
|
88
|
+
const type = detection.type.replace('_', '-');
|
|
89
|
+
const env = this.detectEnvironment(detection.value, '');
|
|
90
|
+
const timestamp = Date.now().toString().slice(-6);
|
|
91
|
+
return `${teamId}/${env}/${type}-${timestamp}`;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Detect environment from secret value and content
|
|
95
|
+
*/
|
|
96
|
+
detectEnvironment(value, content) {
|
|
97
|
+
const lowerValue = value.toLowerCase();
|
|
98
|
+
const lowerContent = content.toLowerCase();
|
|
99
|
+
if (lowerValue.includes('prod') || lowerValue.includes('live') || lowerContent.includes('production')) {
|
|
100
|
+
return 'production';
|
|
101
|
+
}
|
|
102
|
+
else if (lowerValue.includes('staging') || lowerValue.includes('stage') || lowerContent.includes('staging')) {
|
|
103
|
+
return 'staging';
|
|
104
|
+
}
|
|
105
|
+
else if (lowerValue.includes('test') || lowerContent.includes('test')) {
|
|
106
|
+
return 'test';
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return 'development';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Map detection type to secret type
|
|
114
|
+
*/
|
|
115
|
+
mapDetectionToSecretType(detection) {
|
|
116
|
+
if (detection.value.startsWith('http')) {
|
|
117
|
+
return 'url';
|
|
118
|
+
}
|
|
119
|
+
return detection.type;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generate description for secret
|
|
123
|
+
*/
|
|
124
|
+
generateSecretDescription(detection, content) {
|
|
125
|
+
const context = detection.context || 'Detected in knowledge entry';
|
|
126
|
+
const preview = content.substring(0, 100).replace(/\n/g, ' ');
|
|
127
|
+
return `${context}. Found in: "${preview}..."`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Generate tags for secret
|
|
131
|
+
*/
|
|
132
|
+
generateSecretTags(detection, content) {
|
|
133
|
+
const tags = [];
|
|
134
|
+
// Add risk level tag
|
|
135
|
+
tags.push(`risk-${detection.riskLevel}`);
|
|
136
|
+
// Add source tag
|
|
137
|
+
tags.push(`source-${detection.source || 'pattern'}`);
|
|
138
|
+
// Add content-based tags
|
|
139
|
+
if (content.toLowerCase().includes('api'))
|
|
140
|
+
tags.push('api');
|
|
141
|
+
if (content.toLowerCase().includes('database'))
|
|
142
|
+
tags.push('database');
|
|
143
|
+
if (content.toLowerCase().includes('auth'))
|
|
144
|
+
tags.push('authentication');
|
|
145
|
+
return tags;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Hash secret value for duplicate detection
|
|
149
|
+
*/
|
|
150
|
+
hashSecretValue(value) {
|
|
151
|
+
return crypto_1.default.createHash('sha256').update(value).digest('hex');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create safe preview of secret value
|
|
155
|
+
*/
|
|
156
|
+
createSecretPreview(value) {
|
|
157
|
+
if (value.length <= 8) {
|
|
158
|
+
return '***';
|
|
159
|
+
}
|
|
160
|
+
else if (value.length <= 16) {
|
|
161
|
+
return value.substring(0, 2) + '***' + value.substring(value.length - 2);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return value.substring(0, 4) + '***' + value.substring(value.length - 4);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Store secret discovery (metadata only)
|
|
169
|
+
*/
|
|
170
|
+
async storeSecretDiscovery(discovery) {
|
|
171
|
+
// Store in customer's cloud infrastructure
|
|
172
|
+
// This would integrate with the team's DynamoDB or other storage
|
|
173
|
+
console.log(`🔍 Secret discovery stored: ${discovery.secretName}`);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Generate deployment templates for customer's AWS account
|
|
177
|
+
*/
|
|
178
|
+
async generateSecretTemplate(discovery) {
|
|
179
|
+
const template = {
|
|
180
|
+
name: discovery.secretName,
|
|
181
|
+
description: discovery.description,
|
|
182
|
+
environment: discovery.environment,
|
|
183
|
+
secretType: discovery.secretType,
|
|
184
|
+
terraformTemplate: this.generateTerraformTemplate(discovery),
|
|
185
|
+
cloudFormationTemplate: this.generateCloudFormationTemplate(discovery),
|
|
186
|
+
awsCliCommands: this.generateAWSCliCommands(discovery),
|
|
187
|
+
tags: {
|
|
188
|
+
Environment: discovery.environment,
|
|
189
|
+
Team: discovery.teamId,
|
|
190
|
+
Type: discovery.secretType,
|
|
191
|
+
RiskLevel: discovery.riskLevel,
|
|
192
|
+
ManagedBy: 'today-cli',
|
|
193
|
+
...discovery.tags.reduce((acc, tag) => ({ ...acc, [tag]: 'true' }), {})
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
return template;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Generate Terraform template for customer deployment
|
|
200
|
+
*/
|
|
201
|
+
generateTerraformTemplate(discovery) {
|
|
202
|
+
const secretNameSafe = discovery.secretName.replace(/[^a-zA-Z0-9]/g, '_');
|
|
203
|
+
return `# Terraform template for ${discovery.secretName}
|
|
204
|
+
# Deploy this in your own AWS account
|
|
205
|
+
|
|
206
|
+
resource "aws_secretsmanager_secret" "${secretNameSafe}" {
|
|
207
|
+
name = "${discovery.secretName}"
|
|
208
|
+
description = "${discovery.description}"
|
|
209
|
+
|
|
210
|
+
tags = {
|
|
211
|
+
Environment = "${discovery.environment}"
|
|
212
|
+
Team = "${discovery.teamId}"
|
|
213
|
+
Type = "${discovery.secretType}"
|
|
214
|
+
RiskLevel = "${discovery.riskLevel}"
|
|
215
|
+
ManagedBy = "today-cli"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
resource "aws_secretsmanager_secret_version" "${secretNameSafe}_version" {
|
|
220
|
+
secret_id = aws_secretsmanager_secret.${secretNameSafe}.id
|
|
221
|
+
|
|
222
|
+
# SECURITY: You must manually set the secret value
|
|
223
|
+
secret_string = jsonencode({
|
|
224
|
+
value = "YOUR_ACTUAL_SECRET_VALUE_HERE"
|
|
225
|
+
type = "${discovery.secretType}"
|
|
226
|
+
environment = "${discovery.environment}"
|
|
227
|
+
created_by = "${discovery.discoveredBy}"
|
|
228
|
+
team_id = "${discovery.teamId}"
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
output "${secretNameSafe}_arn" {
|
|
233
|
+
description = "ARN of the created secret"
|
|
234
|
+
value = aws_secretsmanager_secret.${secretNameSafe}.arn
|
|
235
|
+
}`;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Generate CloudFormation template
|
|
239
|
+
*/
|
|
240
|
+
generateCloudFormationTemplate(discovery) {
|
|
241
|
+
const secretNameSafe = discovery.secretName.replace(/[^a-zA-Z0-9]/g, '');
|
|
242
|
+
return `AWSTemplateFormatVersion: '2010-09-09'
|
|
243
|
+
Description: 'Secret management for ${discovery.secretName}'
|
|
244
|
+
Resources:
|
|
245
|
+
${secretNameSafe}Secret:
|
|
246
|
+
Type: AWS::SecretsManager::Secret
|
|
247
|
+
Properties:
|
|
248
|
+
Name: ${discovery.secretName}
|
|
249
|
+
Description: ${discovery.description}
|
|
250
|
+
Tags:
|
|
251
|
+
- Key: Environment
|
|
252
|
+
Value: ${discovery.environment}
|
|
253
|
+
- Key: Team
|
|
254
|
+
Value: ${discovery.teamId}
|
|
255
|
+
Outputs:
|
|
256
|
+
SecretArn:
|
|
257
|
+
Value: !Ref ${secretNameSafe}Secret`;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Generate AWS CLI commands for manual deployment
|
|
261
|
+
*/
|
|
262
|
+
generateAWSCliCommands(discovery) {
|
|
263
|
+
return [
|
|
264
|
+
'# Create the secret in your AWS account',
|
|
265
|
+
`aws secretsmanager create-secret --name "${discovery.secretName}" --description "${discovery.description}"`
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Check if service is available (authenticated backend API)
|
|
270
|
+
*/
|
|
271
|
+
async isAvailable() {
|
|
272
|
+
try {
|
|
273
|
+
if (!aws_api_1.awsApiService.isAuthenticated()) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
const response = await aws_api_1.awsApiService.callAPI('/secrets/list', 'GET');
|
|
277
|
+
return response.success;
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
console.warn('Enterprise Secret Manager service not available:', error);
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.EnterpriseSecretManagerService = EnterpriseSecretManagerService;
|
|
286
|
+
exports.enterpriseSecretManagerService = new EnterpriseSecretManagerService();
|
|
287
|
+
//# sourceMappingURL=secret-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-manager.js","sourceRoot":"","sources":["../../src/services/secret-manager.ts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uBAAa,CAAC,eAAe,EAAE,EAAE,CAAC;gBACrC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,uBAAa,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;YACrE,OAAO,QAAQ,CAAC,OAAO,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,kDAAkD,EAAE,KAAK,CAAC,CAAC;YACxE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAhSD,wEAgSC;AAEY,QAAA,8BAA8B,GAAG,IAAI,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface EmbeddingResult {
|
|
2
|
+
embedding: number[];
|
|
3
|
+
model: string;
|
|
4
|
+
dimensions: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class VectorEmbeddingService {
|
|
7
|
+
private embeddingCache;
|
|
8
|
+
private readonly embeddingModel;
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Generate embedding for a single text
|
|
12
|
+
* Routes through authenticated backend API
|
|
13
|
+
*/
|
|
14
|
+
generateEmbedding(text: string): Promise<number[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Generate embeddings for multiple texts in batches
|
|
17
|
+
* Routes through authenticated backend API
|
|
18
|
+
*/
|
|
19
|
+
batchGenerateEmbeddings(texts: string[]): Promise<number[][]>;
|
|
20
|
+
/**
|
|
21
|
+
* Calculate cosine similarity between two vectors
|
|
22
|
+
*/
|
|
23
|
+
cosineSimilarity(a: number[], b: number[]): number;
|
|
24
|
+
/**
|
|
25
|
+
* Find most similar embeddings from a collection
|
|
26
|
+
*/
|
|
27
|
+
findMostSimilar(queryEmbedding: number[], candidateEmbeddings: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
embedding: number[];
|
|
30
|
+
}>, topK?: number, threshold?: number): Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
similarity: number;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Preprocess text for better embedding quality
|
|
36
|
+
*/
|
|
37
|
+
private _preprocessText;
|
|
38
|
+
/**
|
|
39
|
+
* Generate cache key for text
|
|
40
|
+
*/
|
|
41
|
+
private getCacheKey;
|
|
42
|
+
/**
|
|
43
|
+
* Utility delay function
|
|
44
|
+
*/
|
|
45
|
+
private _delay;
|
|
46
|
+
/**
|
|
47
|
+
* Check if embedding service is available
|
|
48
|
+
*/
|
|
49
|
+
isAvailable(): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Get embedding model information
|
|
52
|
+
*/
|
|
53
|
+
getModelInfo(): {
|
|
54
|
+
model: string;
|
|
55
|
+
dimensions: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Clear embedding cache
|
|
59
|
+
*/
|
|
60
|
+
clearCache(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get cache statistics
|
|
63
|
+
*/
|
|
64
|
+
getCacheStats(): {
|
|
65
|
+
size: number;
|
|
66
|
+
hitRate?: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export declare const vectorEmbeddingService: VectorEmbeddingService;
|
|
70
|
+
//# sourceMappingURL=vector-embeddings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-embeddings.d.ts","sourceRoot":"","sources":["../../src/services/vector-embeddings.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,sBAAsB;IACjC,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkC;;IAMjE;;;OAGG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;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