beddel 0.1.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 +297 -0
- package/dist/agents/agentRegistry.d.ts +68 -0
- package/dist/agents/agentRegistry.d.ts.map +1 -0
- package/dist/agents/agentRegistry.js +222 -0
- package/dist/agents/agentRegistry.js.map +1 -0
- package/dist/agents/formatter-agent.d.ts +10 -0
- package/dist/agents/formatter-agent.d.ts.map +1 -0
- package/dist/agents/formatter-agent.js +49 -0
- package/dist/agents/formatter-agent.js.map +1 -0
- package/dist/agents/genkit-agent.d.ts +12 -0
- package/dist/agents/genkit-agent.d.ts.map +1 -0
- package/dist/agents/genkit-agent.js +119 -0
- package/dist/agents/genkit-agent.js.map +1 -0
- package/dist/agents/i18n-messages.d.ts +17 -0
- package/dist/agents/i18n-messages.d.ts.map +1 -0
- package/dist/agents/i18n-messages.js +92 -0
- package/dist/agents/i18n-messages.js.map +1 -0
- package/dist/agents/index.d.ts +10 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +26 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/pipeline.d.ts +15 -0
- package/dist/agents/pipeline.d.ts.map +1 -0
- package/dist/agents/pipeline.js +45 -0
- package/dist/agents/pipeline.js.map +1 -0
- package/dist/agents/schema-factory.d.ts +40 -0
- package/dist/agents/schema-factory.d.ts.map +1 -0
- package/dist/agents/schema-factory.js +121 -0
- package/dist/agents/schema-factory.js.map +1 -0
- package/dist/agents/translation-validators.d.ts +26 -0
- package/dist/agents/translation-validators.d.ts.map +1 -0
- package/dist/agents/translation-validators.js +77 -0
- package/dist/agents/translation-validators.js.map +1 -0
- package/dist/agents/translator-agents.d.ts +184 -0
- package/dist/agents/translator-agents.d.ts.map +1 -0
- package/dist/agents/translator-agents.js +613 -0
- package/dist/agents/translator-agents.js.map +1 -0
- package/dist/agents/types/translation.types.d.ts +100 -0
- package/dist/agents/types/translation.types.d.ts.map +1 -0
- package/dist/agents/types/translation.types.js +3 -0
- package/dist/agents/types/translation.types.js.map +1 -0
- package/dist/agents/validator-agent.d.ts +42 -0
- package/dist/agents/validator-agent.d.ts.map +1 -0
- package/dist/agents/validator-agent.js +122 -0
- package/dist/agents/validator-agent.js.map +1 -0
- package/dist/audit/auditTrail.d.ts +55 -0
- package/dist/audit/auditTrail.d.ts.map +1 -0
- package/dist/audit/auditTrail.js +93 -0
- package/dist/audit/auditTrail.js.map +1 -0
- package/dist/compliance/gdprEngine.d.ts +44 -0
- package/dist/compliance/gdprEngine.d.ts.map +1 -0
- package/dist/compliance/gdprEngine.js +178 -0
- package/dist/compliance/gdprEngine.js.map +1 -0
- package/dist/compliance/lgpdEngine.d.ts +51 -0
- package/dist/compliance/lgpdEngine.d.ts.map +1 -0
- package/dist/compliance/lgpdEngine.js +221 -0
- package/dist/compliance/lgpdEngine.js.map +1 -0
- package/dist/config.d.ts +78 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +77 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/firebase/tenantManager.d.ts +84 -0
- package/dist/firebase/tenantManager.d.ts.map +1 -0
- package/dist/firebase/tenantManager.js +378 -0
- package/dist/firebase/tenantManager.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/secure-yaml-runtime.d.ts +68 -0
- package/dist/integration/secure-yaml-runtime.d.ts.map +1 -0
- package/dist/integration/secure-yaml-runtime.js +245 -0
- package/dist/integration/secure-yaml-runtime.js.map +1 -0
- package/dist/parser/secure-yaml-parser.d.ts +62 -0
- package/dist/parser/secure-yaml-parser.d.ts.map +1 -0
- package/dist/parser/secure-yaml-parser.js +234 -0
- package/dist/parser/secure-yaml-parser.js.map +1 -0
- package/dist/performance/autoscaling.d.ts +100 -0
- package/dist/performance/autoscaling.d.ts.map +1 -0
- package/dist/performance/autoscaling.js +339 -0
- package/dist/performance/autoscaling.js.map +1 -0
- package/dist/performance/benchmark.d.ts +104 -0
- package/dist/performance/benchmark.d.ts.map +1 -0
- package/dist/performance/benchmark.js +514 -0
- package/dist/performance/benchmark.js.map +1 -0
- package/dist/performance/index.d.ts +14 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +35 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/monitor.d.ts +126 -0
- package/dist/performance/monitor.d.ts.map +1 -0
- package/dist/performance/monitor.js +324 -0
- package/dist/performance/monitor.js.map +1 -0
- package/dist/performance/streaming.d.ts +82 -0
- package/dist/performance/streaming.d.ts.map +1 -0
- package/dist/performance/streaming.js +287 -0
- package/dist/performance/streaming.js.map +1 -0
- package/dist/runtime/audit.d.ts +240 -0
- package/dist/runtime/audit.d.ts.map +1 -0
- package/dist/runtime/audit.js +641 -0
- package/dist/runtime/audit.js.map +1 -0
- package/dist/runtime/declarativeAgentRuntime.d.ts +123 -0
- package/dist/runtime/declarativeAgentRuntime.d.ts.map +1 -0
- package/dist/runtime/declarativeAgentRuntime.js +576 -0
- package/dist/runtime/declarativeAgentRuntime.js.map +1 -0
- package/dist/runtime/isolatedRuntime.d.ts +119 -0
- package/dist/runtime/isolatedRuntime.d.ts.map +1 -0
- package/dist/runtime/isolatedRuntime.js +425 -0
- package/dist/runtime/isolatedRuntime.js.map +1 -0
- package/dist/runtime/schemaCompiler.d.ts +35 -0
- package/dist/runtime/schemaCompiler.d.ts.map +1 -0
- package/dist/runtime/schemaCompiler.js +151 -0
- package/dist/runtime/schemaCompiler.js.map +1 -0
- package/dist/runtime/simpleRuntime.d.ts +57 -0
- package/dist/runtime/simpleRuntime.d.ts.map +1 -0
- package/dist/runtime/simpleRuntime.js +187 -0
- package/dist/runtime/simpleRuntime.js.map +1 -0
- package/dist/security/dashboard.d.ts +89 -0
- package/dist/security/dashboard.d.ts.map +1 -0
- package/dist/security/dashboard.js +300 -0
- package/dist/security/dashboard.js.map +1 -0
- package/dist/security/hardening.d.ts +130 -0
- package/dist/security/hardening.d.ts.map +1 -0
- package/dist/security/hardening.js +414 -0
- package/dist/security/hardening.js.map +1 -0
- package/dist/security/index.d.ts +128 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +353 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/monitor.d.ts +88 -0
- package/dist/security/monitor.d.ts.map +1 -0
- package/dist/security/monitor.js +356 -0
- package/dist/security/monitor.js.map +1 -0
- package/dist/security/scanner.d.ts +104 -0
- package/dist/security/scanner.d.ts.map +1 -0
- package/dist/security/scanner.js +298 -0
- package/dist/security/scanner.js.map +1 -0
- package/dist/security/score.d.ts +150 -0
- package/dist/security/score.d.ts.map +1 -0
- package/dist/security/score.js +983 -0
- package/dist/security/score.js.map +1 -0
- package/dist/security/test-security.d.ts +22 -0
- package/dist/security/test-security.d.ts.map +1 -0
- package/dist/security/test-security.js +154 -0
- package/dist/security/test-security.js.map +1 -0
- package/dist/security/threatDetector.d.ts +39 -0
- package/dist/security/threatDetector.d.ts.map +1 -0
- package/dist/security/threatDetector.js +354 -0
- package/dist/security/threatDetector.js.map +1 -0
- package/dist/security/validation.d.ts +69 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +286 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/server/api/clientsRoute.d.ts +9 -0
- package/dist/server/api/clientsRoute.d.ts.map +1 -0
- package/dist/server/api/clientsRoute.js +71 -0
- package/dist/server/api/clientsRoute.js.map +1 -0
- package/dist/server/api/endpointsRoute.d.ts +8 -0
- package/dist/server/api/endpointsRoute.d.ts.map +1 -0
- package/dist/server/api/endpointsRoute.js +76 -0
- package/dist/server/api/endpointsRoute.js.map +1 -0
- package/dist/server/api/graphql.d.ts +9 -0
- package/dist/server/api/graphql.d.ts.map +1 -0
- package/dist/server/api/graphql.js +180 -0
- package/dist/server/api/graphql.js.map +1 -0
- package/dist/server/errors.d.ts +19 -0
- package/dist/server/errors.d.ts.map +1 -0
- package/dist/server/errors.js +42 -0
- package/dist/server/errors.js.map +1 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +24 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/kvStore.d.ts +27 -0
- package/dist/server/kvStore.d.ts.map +1 -0
- package/dist/server/kvStore.js +128 -0
- package/dist/server/kvStore.js.map +1 -0
- package/dist/server/runtimeSecurity.d.ts +28 -0
- package/dist/server/runtimeSecurity.d.ts.map +1 -0
- package/dist/server/runtimeSecurity.js +85 -0
- package/dist/server/runtimeSecurity.js.map +1 -0
- package/dist/server/types.d.ts +53 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/types.js +8 -0
- package/dist/server/types.js.map +1 -0
- package/dist/types/executionContext.d.ts +16 -0
- package/dist/types/executionContext.d.ts.map +1 -0
- package/dist/types/executionContext.js +3 -0
- package/dist/types/executionContext.js.map +1 -0
- package/package.json +77 -0
- package/src/agents/agentRegistry.ts +272 -0
- package/src/agents/image-agent.yaml +86 -0
- package/src/agents/joker-agent.yaml +47 -0
- package/src/agents/translator-agent.yaml +80 -0
- package/src/audit/auditTrail.ts +134 -0
- package/src/compliance/gdprEngine.ts +209 -0
- package/src/compliance/lgpdEngine.ts +268 -0
- package/src/config.ts +179 -0
- package/src/errors.ts +35 -0
- package/src/firebase/tenantManager.ts +443 -0
- package/src/index.ts +125 -0
- package/src/integration/secure-yaml-runtime.ts +341 -0
- package/src/parser/secure-yaml-parser.ts +273 -0
- package/src/performance/autoscaling.ts +495 -0
- package/src/performance/benchmark.ts +644 -0
- package/src/performance/index.ts +34 -0
- package/src/performance/monitor.ts +469 -0
- package/src/performance/streaming.ts +317 -0
- package/src/runtime/audit.ts +907 -0
- package/src/runtime/declarativeAgentRuntime.ts +836 -0
- package/src/runtime/isolatedRuntime.ts +572 -0
- package/src/runtime/schemaCompiler.ts +228 -0
- package/src/runtime/simpleRuntime.ts +201 -0
- package/src/security/dashboard.ts +462 -0
- package/src/security/hardening.ts +560 -0
- package/src/security/index.ts +439 -0
- package/src/security/monitor.ts +490 -0
- package/src/security/scanner.ts +368 -0
- package/src/security/score.ts +1138 -0
- package/src/security/threatDetector.ts +481 -0
- package/src/security/validation.ts +365 -0
- package/src/server/api/clientsRoute.ts +92 -0
- package/src/server/api/endpointsRoute.ts +97 -0
- package/src/server/api/graphql.ts +249 -0
- package/src/server/errors.ts +38 -0
- package/src/server/index.ts +6 -0
- package/src/server/kvStore.ts +152 -0
- package/src/server/runtimeSecurity.ts +102 -0
- package/src/server/types.ts +60 -0
- package/src/types/executionContext.ts +16 -0
- package/tools/seed.ts +365 -0
- package/tools/test-endpoints.ts +174 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Multi-Tenant Firebase Manager v2025
|
|
4
|
+
* Isolamento completo de tenants com LGPD/GDPR compliance automático
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.MultiTenantFirebaseManager = void 0;
|
|
41
|
+
const admin = __importStar(require("firebase-admin"));
|
|
42
|
+
const config_1 = require("../config");
|
|
43
|
+
const auditTrail_1 = require("../audit/auditTrail");
|
|
44
|
+
const gdprEngine_1 = require("../compliance/gdprEngine");
|
|
45
|
+
const lgpdEngine_1 = require("../compliance/lgpdEngine");
|
|
46
|
+
class MultiTenantFirebaseManager {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.tenants = new Map();
|
|
49
|
+
this.auditTrail = new auditTrail_1.AuditTrail();
|
|
50
|
+
this.gdprCompliance = new gdprEngine_1.GDPRCompliance();
|
|
51
|
+
this.lgpdCompliance = new lgpdEngine_1.LGPDCompliance();
|
|
52
|
+
}
|
|
53
|
+
static getInstance() {
|
|
54
|
+
if (!this.instance) {
|
|
55
|
+
this.instance = new MultiTenantFirebaseManager();
|
|
56
|
+
}
|
|
57
|
+
return this.instance;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Initialize tenant with complete isolation
|
|
61
|
+
*/
|
|
62
|
+
async initializeTenant(config) {
|
|
63
|
+
const startTime = Date.now();
|
|
64
|
+
try {
|
|
65
|
+
// Validate tenant configuration
|
|
66
|
+
this.validateTenantConfig(config);
|
|
67
|
+
// Check if tenant already exists
|
|
68
|
+
if (this.tenants.has(config.tenantId)) {
|
|
69
|
+
throw new Error(`Tenant ${config.tenantId} already initialized`);
|
|
70
|
+
}
|
|
71
|
+
// Initialize Firebase app for this tenant
|
|
72
|
+
const app = admin.initializeApp({
|
|
73
|
+
credential: admin.credential.applicationDefault(),
|
|
74
|
+
projectId: config.projectId,
|
|
75
|
+
databaseURL: config.databaseURL,
|
|
76
|
+
storageBucket: config.storageBucket,
|
|
77
|
+
}, `tenant-${config.tenantId}`);
|
|
78
|
+
// Configure security rules
|
|
79
|
+
await this.configureSecurityRules(app, config);
|
|
80
|
+
// Store tenant app
|
|
81
|
+
this.tenants.set(config.tenantId, app);
|
|
82
|
+
// Generate audit trail
|
|
83
|
+
const operationId = `init-${config.tenantId}-${Date.now()}`;
|
|
84
|
+
const auditHash = await this.auditTrail.logOperation({
|
|
85
|
+
operationId,
|
|
86
|
+
tenantId: config.tenantId,
|
|
87
|
+
operation: "tenant_init",
|
|
88
|
+
data: this.sanitizeForAudit(config),
|
|
89
|
+
timestamp: new Date(),
|
|
90
|
+
});
|
|
91
|
+
// Verify compliance
|
|
92
|
+
const complianceStatus = await this.verifyCompliance(config);
|
|
93
|
+
const executionTime = Date.now() - startTime;
|
|
94
|
+
// Calculate security score
|
|
95
|
+
const securityScore = this.calculateSecurityScore(config);
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
tenantId: config.tenantId,
|
|
99
|
+
securityScore,
|
|
100
|
+
auditHash,
|
|
101
|
+
executionTime,
|
|
102
|
+
complianceStatus,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const executionTime = Date.now() - startTime;
|
|
107
|
+
await this.auditTrail.logOperation({
|
|
108
|
+
operationId: `error-${config.tenantId}-${Date.now()}`,
|
|
109
|
+
tenantId: config.tenantId,
|
|
110
|
+
operation: "tenant_init_error",
|
|
111
|
+
data: {
|
|
112
|
+
error: error instanceof Error ? error.message : String(error),
|
|
113
|
+
config: this.sanitizeForAudit(config),
|
|
114
|
+
},
|
|
115
|
+
timestamp: new Date(),
|
|
116
|
+
success: false,
|
|
117
|
+
});
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get isolated tenant app with security profile
|
|
123
|
+
*/
|
|
124
|
+
getTenantApp(tenantId) {
|
|
125
|
+
if (!this.tenants.has(tenantId)) {
|
|
126
|
+
throw new Error(`Tenant ${tenantId} not found or not initialized`);
|
|
127
|
+
}
|
|
128
|
+
return this.tenants.get(tenantId);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Execute operation in tenant context
|
|
132
|
+
*/
|
|
133
|
+
async executeInTenant(tenantId, operation, data, callback) {
|
|
134
|
+
const startTime = Date.now();
|
|
135
|
+
try {
|
|
136
|
+
const app = this.getTenantApp(tenantId);
|
|
137
|
+
// Generate audit trail
|
|
138
|
+
const operationId = `${operation}-${tenantId}-${Date.now()}`;
|
|
139
|
+
const auditHash = await this.auditTrail.logOperation({
|
|
140
|
+
operationId,
|
|
141
|
+
tenantId,
|
|
142
|
+
operation,
|
|
143
|
+
data: this.sanitizeForAudit(data),
|
|
144
|
+
timestamp: new Date(),
|
|
145
|
+
});
|
|
146
|
+
// Execute operation
|
|
147
|
+
const result = await callback();
|
|
148
|
+
// Record successful operation
|
|
149
|
+
const executionTime = Date.now() - startTime;
|
|
150
|
+
await this.auditTrail.logOperation({
|
|
151
|
+
operationId: `${operationId}-complete`,
|
|
152
|
+
tenantId,
|
|
153
|
+
operation: `${operation}_complete`,
|
|
154
|
+
data: { result: this.sanitizeForAudit(result), executionTime },
|
|
155
|
+
timestamp: new Date(),
|
|
156
|
+
success: true,
|
|
157
|
+
});
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
const executionTime = Date.now() - startTime;
|
|
162
|
+
await this.auditTrail.logOperation({
|
|
163
|
+
operationId: `${operation}-${tenantId}-${Date.now()}-error`,
|
|
164
|
+
tenantId,
|
|
165
|
+
operation: `${operation}_error`,
|
|
166
|
+
data: {
|
|
167
|
+
error: error instanceof Error ? error.message : String(error),
|
|
168
|
+
executionTime,
|
|
169
|
+
},
|
|
170
|
+
timestamp: new Date(),
|
|
171
|
+
success: false,
|
|
172
|
+
});
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Configure security rules for tenant
|
|
178
|
+
*/
|
|
179
|
+
async configureSecurityRules(app, config) {
|
|
180
|
+
// Configure Firestore security rules based on profile
|
|
181
|
+
const db = app.firestore();
|
|
182
|
+
// Tenant-isolated rules
|
|
183
|
+
const rules = this.generateSecurityRules(config);
|
|
184
|
+
// Apply security configuration
|
|
185
|
+
// Note: In production, this would be set via Firebase console or API
|
|
186
|
+
await this.auditTrail.logOperation({
|
|
187
|
+
operationId: `security-${config.tenantId}-${Date.now()}`,
|
|
188
|
+
tenantId: config.tenantId,
|
|
189
|
+
operation: "security_config",
|
|
190
|
+
data: { securityLevel: config.securityProfile },
|
|
191
|
+
timestamp: new Date(),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Generate security rules based on profile
|
|
196
|
+
*/
|
|
197
|
+
generateSecurityRules(config) {
|
|
198
|
+
switch (config.securityProfile) {
|
|
199
|
+
case "ultra-secure":
|
|
200
|
+
return `
|
|
201
|
+
rules_version = '2';
|
|
202
|
+
service cloud.firestore {
|
|
203
|
+
match /databases/{database}/documents {
|
|
204
|
+
match /{document=**} {
|
|
205
|
+
allow read, write: if false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
case "tenant-isolated":
|
|
211
|
+
return `
|
|
212
|
+
rules_version = '2';
|
|
213
|
+
service cloud.firestore {
|
|
214
|
+
match /databases/{database}/documents {
|
|
215
|
+
match /tenants/${config.tenantId}/{document=**} {
|
|
216
|
+
allow read, write: if request.auth.uid != null;
|
|
217
|
+
}
|
|
218
|
+
match /{document=**} {
|
|
219
|
+
allow read, write: if false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
default:
|
|
225
|
+
throw new Error(`Unknown security profile: ${config.securityProfile}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Verify LGPD/GDPR compliance for tenant
|
|
230
|
+
*/
|
|
231
|
+
async verifyCompliance(config) {
|
|
232
|
+
let lgpd = false;
|
|
233
|
+
let gdpr = false;
|
|
234
|
+
if (config.lgpdEnabled) {
|
|
235
|
+
lgpd = await this.lgpdCompliance.verifyCompliance({
|
|
236
|
+
tenantId: config.tenantId,
|
|
237
|
+
dataConsent: true,
|
|
238
|
+
dataAnonymization: true,
|
|
239
|
+
dataRetentionDays: config.dataRetentionDays,
|
|
240
|
+
brazilianDataResidency: true,
|
|
241
|
+
rightToDelete: true,
|
|
242
|
+
dataOwnerRights: true,
|
|
243
|
+
automaticDeletion: true,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (config.gdprEnabled) {
|
|
247
|
+
gdpr = await this.gdprCompliance.verifyCompliance({
|
|
248
|
+
tenantId: config.tenantId,
|
|
249
|
+
dataAnonymization: true,
|
|
250
|
+
consentManagement: true,
|
|
251
|
+
rightToBeForgotten: true,
|
|
252
|
+
dataPortability: true,
|
|
253
|
+
dataRetentionDays: config.dataRetentionDays,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return { lgpd, gdpr };
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Calculate security score based on configuration
|
|
260
|
+
*/
|
|
261
|
+
calculateSecurityScore(config) {
|
|
262
|
+
let score = 5.0; // Base score
|
|
263
|
+
// Multi-tenant isolation
|
|
264
|
+
if (this.tenants.has(config.tenantId)) {
|
|
265
|
+
score += 1.0;
|
|
266
|
+
}
|
|
267
|
+
// Security profile
|
|
268
|
+
switch (config.securityProfile) {
|
|
269
|
+
case "ultra-secure":
|
|
270
|
+
score += 2.0;
|
|
271
|
+
break;
|
|
272
|
+
case "tenant-isolated":
|
|
273
|
+
score += 1.5;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
// Compliance features
|
|
277
|
+
if (config.lgpdEnabled) {
|
|
278
|
+
score += 0.5;
|
|
279
|
+
}
|
|
280
|
+
if (config.gdprEnabled) {
|
|
281
|
+
score += 0.5;
|
|
282
|
+
}
|
|
283
|
+
// Audit trail
|
|
284
|
+
if (config_1.runtimeConfig.auditEnabled) {
|
|
285
|
+
score += 1.0;
|
|
286
|
+
}
|
|
287
|
+
// Memory limit enforcement (1MB para multi-tenant)
|
|
288
|
+
const memoryLimit = config_1.runtimeConfig.memoryLimit;
|
|
289
|
+
if (memoryLimit <= 1) {
|
|
290
|
+
score += 0.5;
|
|
291
|
+
}
|
|
292
|
+
return Math.min(score, 10.0); // Máximo 10.0
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Validate tenant configuration
|
|
296
|
+
*/
|
|
297
|
+
validateTenantConfig(config) {
|
|
298
|
+
if (!config.tenantId || config.tenantId.length < 3) {
|
|
299
|
+
throw new Error("Invalid tenant ID - must be at least 3 characters");
|
|
300
|
+
}
|
|
301
|
+
if (!config.projectId) {
|
|
302
|
+
throw new Error("Project ID is required");
|
|
303
|
+
}
|
|
304
|
+
if (!config.securityProfile) {
|
|
305
|
+
config.securityProfile = "tenant-isolated";
|
|
306
|
+
}
|
|
307
|
+
if (!config.dataRetentionDays) {
|
|
308
|
+
config.dataRetentionDays = 365; // 1 ano padrão LGPD
|
|
309
|
+
}
|
|
310
|
+
if (config.dataRetentionDays < 90) {
|
|
311
|
+
throw new Error("Data retention minimum 90 days for LGPD compliance");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Sanitize data for audit trail
|
|
316
|
+
*/
|
|
317
|
+
sanitizeForAudit(data) {
|
|
318
|
+
return JSON.parse(JSON.stringify(data, (key, value) => {
|
|
319
|
+
// Remove sensitive information
|
|
320
|
+
if (key.includes("password") ||
|
|
321
|
+
key.includes("secret") ||
|
|
322
|
+
key.includes("key")) {
|
|
323
|
+
return "[REDACTED]";
|
|
324
|
+
}
|
|
325
|
+
return value;
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Get all active tenants
|
|
330
|
+
*/
|
|
331
|
+
getActiveTenants() {
|
|
332
|
+
return Array.from(this.tenants.keys());
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Get statistics for all tenants
|
|
336
|
+
*/
|
|
337
|
+
async getTenantStats() {
|
|
338
|
+
const stats = new Map();
|
|
339
|
+
for (const tenantId of this.tenants.keys()) {
|
|
340
|
+
// Simulate getting stats (in real implementation, would query actual metrics)
|
|
341
|
+
const mockStats = {
|
|
342
|
+
success: true,
|
|
343
|
+
tenantId,
|
|
344
|
+
securityScore: 9.5, // Target 9.5/10
|
|
345
|
+
auditHash: "SHA256-" + Math.random().toString(36),
|
|
346
|
+
executionTime: 95, // Target <100ms
|
|
347
|
+
complianceStatus: {
|
|
348
|
+
lgpd: true,
|
|
349
|
+
gdpr: true,
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
stats.set(tenantId, mockStats);
|
|
353
|
+
}
|
|
354
|
+
return stats;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Safely remove tenant
|
|
358
|
+
*/
|
|
359
|
+
async removeTenant(tenantId) {
|
|
360
|
+
if (!this.tenants.has(tenantId)) {
|
|
361
|
+
throw new Error(`Tenant ${tenantId} not found`);
|
|
362
|
+
}
|
|
363
|
+
const app = this.tenants.get(tenantId);
|
|
364
|
+
// Log removal
|
|
365
|
+
await this.auditTrail.logOperation({
|
|
366
|
+
operationId: `remove-${tenantId}-${Date.now()}`,
|
|
367
|
+
tenantId,
|
|
368
|
+
operation: "tenant_removal",
|
|
369
|
+
data: { reason: "admin_removal" },
|
|
370
|
+
timestamp: new Date(),
|
|
371
|
+
});
|
|
372
|
+
// Delete tenant app
|
|
373
|
+
await app.delete();
|
|
374
|
+
this.tenants.delete(tenantId);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
exports.MultiTenantFirebaseManager = MultiTenantFirebaseManager;
|
|
378
|
+
//# sourceMappingURL=tenantManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenantManager.js","sourceRoot":"","sources":["../../src/firebase/tenantManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAwC;AACxC,sCAA0C;AAC1C,oDAAiD;AACjD,yDAA0D;AAC1D,yDAA0D;AAyB1D,MAAa,0BAA0B;IAOrC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,EAAE,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,IAAI,2BAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,IAAI,2BAAc,EAAE,CAAC;IAC7C,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,0BAA0B,EAAE,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,gBAAgB,CAC3B,MAAoB;QAEpB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC;YACH,gCAAgC;YAChC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAElC,iCAAiC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,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAE,CAAC;QAExC,cAAc;QACd,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACjC,WAAW,EAAE,UAAU,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;YAC/C,QAAQ;YACR,SAAS,EAAE,gBAAgB;YAC3B,IAAI,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;YACjC,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CAAC;QAEH,oBAAoB;QACpB,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;CACF;AAxZD,gEAwZC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel - Parser YAML seguro com FAILSAFE_SCHEMA e Runtime Isolado
|
|
3
|
+
*
|
|
4
|
+
* Open source package para parsing YAML com foco máximo em segurança
|
|
5
|
+
* Implementa FAILSAFE_SCHEMA, validações rigorosas, runtime isolado e multi-tenant isolation
|
|
6
|
+
*/
|
|
7
|
+
export { SecureYamlParser, createSecureYamlParser, parseSecureYaml, } from "./parser/secure-yaml-parser";
|
|
8
|
+
export { IsolatedRuntimeManager, runtimeManager, } from "./runtime/isolatedRuntime";
|
|
9
|
+
export type { ExecutionOptions, ExecutionResult, RuntimeContext, } from "./runtime/isolatedRuntime";
|
|
10
|
+
export { SimpleIsolatedRuntimeManager, runtimeManager as simpleRuntimeManager, IsolatedRuntimeError as SimpleRuntimeError, } from "./runtime/simpleRuntime";
|
|
11
|
+
export type { ExecutionOptions as SimpleExecutionOptions, ExecutionResult as SimpleExecutionResult, } from "./runtime/simpleRuntime";
|
|
12
|
+
export { DeclarativeAgentInterpreter, declarativeInterpreter, } from "./runtime/declarativeAgentRuntime";
|
|
13
|
+
export type { YamlAgentDefinition, YamlAgentInterpreterOptions, YamlExecutionResult, } from "./runtime/declarativeAgentRuntime";
|
|
14
|
+
export { DeclarativeSchemaCompiler, DeclarativeSchemaValidationError, SchemaCompilationError, } from "./runtime/schemaCompiler";
|
|
15
|
+
export { AgentRegistry, agentRegistry } from "./agents/agentRegistry";
|
|
16
|
+
export type { AgentRegistration } from "./agents/agentRegistry";
|
|
17
|
+
export { runtimeConfig, securityProfiles, performanceTargets, auditConfig, } from "./config";
|
|
18
|
+
export type { RuntimeConfig, SecurityProfile, PerformanceTarget, AuditConfig, } from "./config";
|
|
19
|
+
export { YAMLBaseError, YAMLParseError, YAMLSecurityError, YAMLPerformanceError, } from "./errors";
|
|
20
|
+
export { SecurityScanner } from "./security/scanner";
|
|
21
|
+
export { SecurityScore } from "./security/score";
|
|
22
|
+
export { SecurityManager, SecurityMonitor, securityMonitor, SecurityDashboard, securityDashboard, ThreatDetectionEngine, AnomalyDetector, ThreatMLModel, } from "./security";
|
|
23
|
+
export type { AlertLevel, SecurityEvent, ThreatAnalysis, DashboardConfig, SecurityMetric, } from "./security";
|
|
24
|
+
export { AuditService } from "./runtime/audit";
|
|
25
|
+
export { PerformanceMonitor } from "./performance/monitor";
|
|
26
|
+
export { default as AutoScaler } from "./performance/autoscaling";
|
|
27
|
+
export { MultiTenantFirebaseManager } from "./firebase/tenantManager";
|
|
28
|
+
export type { TenantConfig, TenantIsolationResult, } from "./firebase/tenantManager";
|
|
29
|
+
export { GDPRCompliance } from "./compliance/gdprEngine";
|
|
30
|
+
export { LGPDCompliance } from "./compliance/lgpdEngine";
|
|
31
|
+
export type { GDPRConfig, GDPRComplianceResult } from "./compliance/gdprEngine";
|
|
32
|
+
export type { LGPDConfig, LGPDComplianceResult } from "./compliance/lgpdEngine";
|
|
33
|
+
export { SecureYamlRuntime } from "./integration/secure-yaml-runtime";
|
|
34
|
+
export type { ExecutionContext } from "./types/executionContext";
|
|
35
|
+
export * as Server from "./server";
|
|
36
|
+
//# sourceMappingURL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E,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EACV,YAAY,EACZ,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAChF,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Beddel - Parser YAML seguro com FAILSAFE_SCHEMA e Runtime Isolado
|
|
4
|
+
*
|
|
5
|
+
* Open source package para parsing YAML com foco máximo em segurança
|
|
6
|
+
* Implementa FAILSAFE_SCHEMA, validações rigorosas, runtime isolado e multi-tenant isolation
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.Server = exports.SecureYamlRuntime = exports.LGPDCompliance = exports.GDPRCompliance = exports.MultiTenantFirebaseManager = exports.AutoScaler = exports.PerformanceMonitor = exports.AuditService = exports.ThreatMLModel = exports.AnomalyDetector = exports.ThreatDetectionEngine = exports.securityDashboard = exports.SecurityDashboard = exports.securityMonitor = exports.SecurityMonitor = exports.SecurityManager = exports.SecurityScore = exports.SecurityScanner = exports.YAMLPerformanceError = exports.YAMLSecurityError = exports.YAMLParseError = exports.YAMLBaseError = exports.auditConfig = exports.performanceTargets = exports.securityProfiles = exports.runtimeConfig = exports.agentRegistry = exports.AgentRegistry = exports.SchemaCompilationError = exports.DeclarativeSchemaValidationError = exports.DeclarativeSchemaCompiler = exports.declarativeInterpreter = exports.DeclarativeAgentInterpreter = exports.SimpleRuntimeError = exports.simpleRuntimeManager = exports.SimpleIsolatedRuntimeManager = exports.runtimeManager = exports.IsolatedRuntimeManager = exports.parseSecureYaml = exports.createSecureYamlParser = exports.SecureYamlParser = void 0;
|
|
46
|
+
// YAML Parser exports
|
|
47
|
+
var secure_yaml_parser_1 = require("./parser/secure-yaml-parser");
|
|
48
|
+
Object.defineProperty(exports, "SecureYamlParser", { enumerable: true, get: function () { return secure_yaml_parser_1.SecureYamlParser; } });
|
|
49
|
+
Object.defineProperty(exports, "createSecureYamlParser", { enumerable: true, get: function () { return secure_yaml_parser_1.createSecureYamlParser; } });
|
|
50
|
+
Object.defineProperty(exports, "parseSecureYaml", { enumerable: true, get: function () { return secure_yaml_parser_1.parseSecureYaml; } });
|
|
51
|
+
// Runtime Isolado exports
|
|
52
|
+
var isolatedRuntime_1 = require("./runtime/isolatedRuntime");
|
|
53
|
+
Object.defineProperty(exports, "IsolatedRuntimeManager", { enumerable: true, get: function () { return isolatedRuntime_1.IsolatedRuntimeManager; } });
|
|
54
|
+
Object.defineProperty(exports, "runtimeManager", { enumerable: true, get: function () { return isolatedRuntime_1.runtimeManager; } });
|
|
55
|
+
// Simple Runtime exports
|
|
56
|
+
var simpleRuntime_1 = require("./runtime/simpleRuntime");
|
|
57
|
+
Object.defineProperty(exports, "SimpleIsolatedRuntimeManager", { enumerable: true, get: function () { return simpleRuntime_1.SimpleIsolatedRuntimeManager; } });
|
|
58
|
+
Object.defineProperty(exports, "simpleRuntimeManager", { enumerable: true, get: function () { return simpleRuntime_1.runtimeManager; } });
|
|
59
|
+
Object.defineProperty(exports, "SimpleRuntimeError", { enumerable: true, get: function () { return simpleRuntime_1.IsolatedRuntimeError; } });
|
|
60
|
+
// Declarative runtime exports
|
|
61
|
+
var declarativeAgentRuntime_1 = require("./runtime/declarativeAgentRuntime");
|
|
62
|
+
Object.defineProperty(exports, "DeclarativeAgentInterpreter", { enumerable: true, get: function () { return declarativeAgentRuntime_1.DeclarativeAgentInterpreter; } });
|
|
63
|
+
Object.defineProperty(exports, "declarativeInterpreter", { enumerable: true, get: function () { return declarativeAgentRuntime_1.declarativeInterpreter; } });
|
|
64
|
+
var schemaCompiler_1 = require("./runtime/schemaCompiler");
|
|
65
|
+
Object.defineProperty(exports, "DeclarativeSchemaCompiler", { enumerable: true, get: function () { return schemaCompiler_1.DeclarativeSchemaCompiler; } });
|
|
66
|
+
Object.defineProperty(exports, "DeclarativeSchemaValidationError", { enumerable: true, get: function () { return schemaCompiler_1.DeclarativeSchemaValidationError; } });
|
|
67
|
+
Object.defineProperty(exports, "SchemaCompilationError", { enumerable: true, get: function () { return schemaCompiler_1.SchemaCompilationError; } });
|
|
68
|
+
// Agent registry exports
|
|
69
|
+
var agentRegistry_1 = require("./agents/agentRegistry");
|
|
70
|
+
Object.defineProperty(exports, "AgentRegistry", { enumerable: true, get: function () { return agentRegistry_1.AgentRegistry; } });
|
|
71
|
+
Object.defineProperty(exports, "agentRegistry", { enumerable: true, get: function () { return agentRegistry_1.agentRegistry; } });
|
|
72
|
+
// Configuration exports
|
|
73
|
+
var config_1 = require("./config");
|
|
74
|
+
Object.defineProperty(exports, "runtimeConfig", { enumerable: true, get: function () { return config_1.runtimeConfig; } });
|
|
75
|
+
Object.defineProperty(exports, "securityProfiles", { enumerable: true, get: function () { return config_1.securityProfiles; } });
|
|
76
|
+
Object.defineProperty(exports, "performanceTargets", { enumerable: true, get: function () { return config_1.performanceTargets; } });
|
|
77
|
+
Object.defineProperty(exports, "auditConfig", { enumerable: true, get: function () { return config_1.auditConfig; } });
|
|
78
|
+
// Error exports
|
|
79
|
+
var errors_1 = require("./errors");
|
|
80
|
+
Object.defineProperty(exports, "YAMLBaseError", { enumerable: true, get: function () { return errors_1.YAMLBaseError; } });
|
|
81
|
+
Object.defineProperty(exports, "YAMLParseError", { enumerable: true, get: function () { return errors_1.YAMLParseError; } });
|
|
82
|
+
Object.defineProperty(exports, "YAMLSecurityError", { enumerable: true, get: function () { return errors_1.YAMLSecurityError; } });
|
|
83
|
+
Object.defineProperty(exports, "YAMLPerformanceError", { enumerable: true, get: function () { return errors_1.YAMLPerformanceError; } });
|
|
84
|
+
// Security exports
|
|
85
|
+
var scanner_1 = require("./security/scanner");
|
|
86
|
+
Object.defineProperty(exports, "SecurityScanner", { enumerable: true, get: function () { return scanner_1.SecurityScanner; } });
|
|
87
|
+
var score_1 = require("./security/score");
|
|
88
|
+
Object.defineProperty(exports, "SecurityScore", { enumerable: true, get: function () { return score_1.SecurityScore; } });
|
|
89
|
+
var security_1 = require("./security");
|
|
90
|
+
Object.defineProperty(exports, "SecurityManager", { enumerable: true, get: function () { return security_1.SecurityManager; } });
|
|
91
|
+
Object.defineProperty(exports, "SecurityMonitor", { enumerable: true, get: function () { return security_1.SecurityMonitor; } });
|
|
92
|
+
Object.defineProperty(exports, "securityMonitor", { enumerable: true, get: function () { return security_1.securityMonitor; } });
|
|
93
|
+
Object.defineProperty(exports, "SecurityDashboard", { enumerable: true, get: function () { return security_1.SecurityDashboard; } });
|
|
94
|
+
Object.defineProperty(exports, "securityDashboard", { enumerable: true, get: function () { return security_1.securityDashboard; } });
|
|
95
|
+
Object.defineProperty(exports, "ThreatDetectionEngine", { enumerable: true, get: function () { return security_1.ThreatDetectionEngine; } });
|
|
96
|
+
Object.defineProperty(exports, "AnomalyDetector", { enumerable: true, get: function () { return security_1.AnomalyDetector; } });
|
|
97
|
+
Object.defineProperty(exports, "ThreatMLModel", { enumerable: true, get: function () { return security_1.ThreatMLModel; } });
|
|
98
|
+
var audit_1 = require("./runtime/audit");
|
|
99
|
+
Object.defineProperty(exports, "AuditService", { enumerable: true, get: function () { return audit_1.AuditService; } });
|
|
100
|
+
// Performance exports
|
|
101
|
+
var monitor_1 = require("./performance/monitor");
|
|
102
|
+
Object.defineProperty(exports, "PerformanceMonitor", { enumerable: true, get: function () { return monitor_1.PerformanceMonitor; } });
|
|
103
|
+
var autoscaling_1 = require("./performance/autoscaling");
|
|
104
|
+
Object.defineProperty(exports, "AutoScaler", { enumerable: true, get: function () { return __importDefault(autoscaling_1).default; } });
|
|
105
|
+
// Multi-Tenant Firebase exports
|
|
106
|
+
var tenantManager_1 = require("./firebase/tenantManager");
|
|
107
|
+
Object.defineProperty(exports, "MultiTenantFirebaseManager", { enumerable: true, get: function () { return tenantManager_1.MultiTenantFirebaseManager; } });
|
|
108
|
+
// Compliance exports
|
|
109
|
+
var gdprEngine_1 = require("./compliance/gdprEngine");
|
|
110
|
+
Object.defineProperty(exports, "GDPRCompliance", { enumerable: true, get: function () { return gdprEngine_1.GDPRCompliance; } });
|
|
111
|
+
var lgpdEngine_1 = require("./compliance/lgpdEngine");
|
|
112
|
+
Object.defineProperty(exports, "LGPDCompliance", { enumerable: true, get: function () { return lgpdEngine_1.LGPDCompliance; } });
|
|
113
|
+
// Integration: Secure YAML Parser with Isolated Runtime
|
|
114
|
+
var secure_yaml_runtime_1 = require("./integration/secure-yaml-runtime");
|
|
115
|
+
Object.defineProperty(exports, "SecureYamlRuntime", { enumerable: true, get: function () { return secure_yaml_runtime_1.SecureYamlRuntime; } });
|
|
116
|
+
// Server/runtime exports
|
|
117
|
+
exports.Server = __importStar(require("./server"));
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js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,eAAe,OAAA;AACf,yGAAA,aAAa,OAAA;AASf,yCAA+C;AAAtC,qGAAA,YAAY,OAAA;AAErB,sBAAsB;AACtB,iDAA2D;AAAlD,6GAAA,kBAAkB,OAAA;AAC3B,yDAAkE;AAAzD,0HAAA,OAAO,OAAc;AAE9B,gCAAgC;AAChC,0DAAsE;AAA7D,2HAAA,0BAA0B,OAAA;AAMnC,qBAAqB;AACrB,sDAAyD;AAAhD,4GAAA,cAAc,OAAA;AACvB,sDAAyD;AAAhD,4GAAA,cAAc,OAAA;AAIvB,wDAAwD;AACxD,yEAAsE;AAA7D,wHAAA,iBAAiB,OAAA;AAK1B,yBAAyB;AACzB,mDAAmC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IsolatedRuntimeManager } from "../runtime/isolatedRuntime";
|
|
2
|
+
export interface RuntimeYAMLConfig {
|
|
3
|
+
securityProfile?: string;
|
|
4
|
+
tenantId?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
memoryLimit?: number;
|
|
7
|
+
validateSecurity?: boolean;
|
|
8
|
+
auditEnabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RuntimeYAMLResult {
|
|
11
|
+
success: boolean;
|
|
12
|
+
result?: any;
|
|
13
|
+
error?: Error;
|
|
14
|
+
executionTime: number;
|
|
15
|
+
memoryUsed: number;
|
|
16
|
+
securityScore?: number;
|
|
17
|
+
auditHash?: string;
|
|
18
|
+
tenantId?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class SecureYamlRuntime {
|
|
21
|
+
private runtimeManagerInstance;
|
|
22
|
+
private readonly runtimeManager;
|
|
23
|
+
private readonly securityScanner;
|
|
24
|
+
constructor(runtimeManagerInstance: IsolatedRuntimeManager);
|
|
25
|
+
/**
|
|
26
|
+
* Parse YAML in isolated runtime environment
|
|
27
|
+
*/
|
|
28
|
+
parseYamlSecureRuntime(yamlContent: string, config?: RuntimeYAMLConfig): Promise<RuntimeYAMLResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Multi-tenant YAML processing with isolation
|
|
31
|
+
*/
|
|
32
|
+
parseYamlMultiTenant(yamlContent: string, tenantId: string, config?: RuntimeYAMLConfig): Promise<RuntimeYAMLResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Batch process YAML for multiple tenants
|
|
35
|
+
*/
|
|
36
|
+
parseYamlBatch(yamlContents: Array<{
|
|
37
|
+
content: string;
|
|
38
|
+
tenantId: string;
|
|
39
|
+
}>, config?: RuntimeYAMLConfig): Promise<Map<string, RuntimeYAMLResult>>;
|
|
40
|
+
/**
|
|
41
|
+
* Test multi-tenant isolation
|
|
42
|
+
*/
|
|
43
|
+
testTenantIsolation(tenantIds: string[]): Promise<{
|
|
44
|
+
[tenantId: string]: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Validate performance targets
|
|
48
|
+
*/
|
|
49
|
+
private validatePerformanceTargets;
|
|
50
|
+
/**
|
|
51
|
+
* Calculate security score
|
|
52
|
+
*/
|
|
53
|
+
private calculateSecurityScore;
|
|
54
|
+
/**
|
|
55
|
+
* Validate input
|
|
56
|
+
*/
|
|
57
|
+
private validateInput;
|
|
58
|
+
/**
|
|
59
|
+
* Build execution code for YAML parsing
|
|
60
|
+
*/
|
|
61
|
+
private buildYamlExecutionCode;
|
|
62
|
+
/**
|
|
63
|
+
* Generate audit hash
|
|
64
|
+
*/
|
|
65
|
+
private generateAuditHash;
|
|
66
|
+
}
|
|
67
|
+
export default SecureYamlRuntime;
|
|
68
|
+
//# sourceMappingURL=secure-yaml-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-yaml-runtime.d.ts","sourceRoot":"","sources":["../../src/integration/secure-yaml-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAIpE,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC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