@mcp-consultant-tools/powerplatform 32.0.0 → 33.0.1
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/build/cli/commands/metadata-commands.js +2 -2
- package/build/cli/commands/metadata-commands.js.map +1 -1
- package/build/cli.js +0 -0
- package/build/http-server.js +0 -0
- package/build/index.js +0 -0
- package/build/tools/metadata-tools.js +2 -2
- package/build/tools/metadata-tools.js.map +1 -1
- package/build/tools/solution-tools.js +5 -5
- package/package.json +3 -3
- package/build/auth/index.d.ts +0 -64
- package/build/auth/index.d.ts.map +0 -1
- package/build/auth/index.js +0 -39
- package/build/auth/index.js.map +0 -1
- package/build/auth/interactive-auth.d.ts +0 -60
- package/build/auth/interactive-auth.d.ts.map +0 -1
- package/build/auth/interactive-auth.js +0 -429
- package/build/auth/interactive-auth.js.map +0 -1
- package/build/auth/service-principal-auth.d.ts +0 -26
- package/build/auth/service-principal-auth.d.ts.map +0 -1
- package/build/auth/service-principal-auth.js +0 -60
- package/build/auth/service-principal-auth.js.map +0 -1
- package/build/auth/token-cache.d.ts +0 -40
- package/build/auth/token-cache.d.ts.map +0 -1
- package/build/auth/token-cache.js +0 -108
- package/build/auth/token-cache.js.map +0 -1
- package/build/utils/best-practices-formatters.d.ts +0 -26
- package/build/utils/best-practices-formatters.d.ts.map +0 -1
- package/build/utils/best-practices-formatters.js +0 -238
- package/build/utils/best-practices-formatters.js.map +0 -1
- package/build/utils/bestPractices.d.ts +0 -152
- package/build/utils/bestPractices.d.ts.map +0 -1
- package/build/utils/bestPractices.js +0 -338
- package/build/utils/bestPractices.js.map +0 -1
- package/build/utils/iconManager.d.ts +0 -84
- package/build/utils/iconManager.d.ts.map +0 -1
- package/build/utils/iconManager.js +0 -342
- package/build/utils/iconManager.js.map +0 -1
- package/build/utils/prompt-templates.d.ts +0 -9
- package/build/utils/prompt-templates.d.ts.map +0 -1
- package/build/utils/prompt-templates.js +0 -31
- package/build/utils/prompt-templates.js.map +0 -1
- package/build/utils/rate-limiter.d.ts +0 -108
- package/build/utils/rate-limiter.d.ts.map +0 -1
- package/build/utils/rate-limiter.js +0 -241
- package/build/utils/rate-limiter.js.map +0 -1
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token Cache for Interactive Authentication
|
|
3
|
-
*
|
|
4
|
-
* Provides encrypted file-based storage for MSAL tokens.
|
|
5
|
-
* Tokens are encrypted using AES-256-GCM with a machine-specific key.
|
|
6
|
-
*
|
|
7
|
-
* Storage location: ~/.mcp-consultant-tools/token-cache-{clientId}.enc
|
|
8
|
-
*/
|
|
9
|
-
import fs from 'node:fs';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
import os from 'node:os';
|
|
12
|
-
import crypto from 'node:crypto';
|
|
13
|
-
export class TokenCache {
|
|
14
|
-
cacheFile;
|
|
15
|
-
encryptionKey;
|
|
16
|
-
cacheDir;
|
|
17
|
-
constructor(clientId) {
|
|
18
|
-
this.cacheDir = path.join(os.homedir(), '.mcp-consultant-tools');
|
|
19
|
-
// Create cache directory if it doesn't exist
|
|
20
|
-
if (!fs.existsSync(this.cacheDir)) {
|
|
21
|
-
fs.mkdirSync(this.cacheDir, { recursive: true, mode: 0o700 });
|
|
22
|
-
}
|
|
23
|
-
this.cacheFile = path.join(this.cacheDir, `token-cache-${clientId}.enc`);
|
|
24
|
-
// Derive encryption key from machine-specific data
|
|
25
|
-
// Uses hostname + username as salt for key derivation
|
|
26
|
-
const machineId = os.hostname() + os.userInfo().username;
|
|
27
|
-
this.encryptionKey = crypto.scryptSync(machineId, 'mcp-powerplatform-auth', 32);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Create MSAL cache plugin for automatic token persistence
|
|
31
|
-
*/
|
|
32
|
-
createPlugin() {
|
|
33
|
-
return {
|
|
34
|
-
beforeCacheAccess: async (context) => {
|
|
35
|
-
if (fs.existsSync(this.cacheFile)) {
|
|
36
|
-
try {
|
|
37
|
-
const encrypted = fs.readFileSync(this.cacheFile);
|
|
38
|
-
const decrypted = this.decrypt(encrypted);
|
|
39
|
-
context.tokenCache.deserialize(decrypted);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
// Cache corrupted or from different machine, ignore
|
|
43
|
-
// MSAL will proceed with empty cache
|
|
44
|
-
console.error('Token cache read error (will re-authenticate):', error.message);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
afterCacheAccess: async (context) => {
|
|
49
|
-
if (context.cacheHasChanged) {
|
|
50
|
-
try {
|
|
51
|
-
const data = context.tokenCache.serialize();
|
|
52
|
-
const encrypted = this.encrypt(data);
|
|
53
|
-
fs.writeFileSync(this.cacheFile, encrypted, { mode: 0o600 });
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.error('Token cache write error:', error.message);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Encrypt data using AES-256-GCM
|
|
64
|
-
*/
|
|
65
|
-
encrypt(data) {
|
|
66
|
-
const iv = crypto.randomBytes(16);
|
|
67
|
-
const cipher = crypto.createCipheriv('aes-256-gcm', this.encryptionKey, iv);
|
|
68
|
-
const encrypted = Buffer.concat([cipher.update(data, 'utf8'), cipher.final()]);
|
|
69
|
-
const tag = cipher.getAuthTag();
|
|
70
|
-
// Format: IV (16 bytes) + Auth Tag (16 bytes) + Encrypted Data
|
|
71
|
-
return Buffer.concat([iv, tag, encrypted]);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Decrypt data using AES-256-GCM
|
|
75
|
-
*/
|
|
76
|
-
decrypt(data) {
|
|
77
|
-
if (data.length < 33) {
|
|
78
|
-
throw new Error('Invalid encrypted data: too short');
|
|
79
|
-
}
|
|
80
|
-
const iv = data.subarray(0, 16);
|
|
81
|
-
const tag = data.subarray(16, 32);
|
|
82
|
-
const encrypted = data.subarray(32);
|
|
83
|
-
const decipher = crypto.createDecipheriv('aes-256-gcm', this.encryptionKey, iv);
|
|
84
|
-
decipher.setAuthTag(tag);
|
|
85
|
-
return decipher.update(encrypted) + decipher.final('utf8');
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Clear the token cache (logout)
|
|
89
|
-
*/
|
|
90
|
-
clear() {
|
|
91
|
-
if (fs.existsSync(this.cacheFile)) {
|
|
92
|
-
fs.unlinkSync(this.cacheFile);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Check if a token cache exists
|
|
97
|
-
*/
|
|
98
|
-
exists() {
|
|
99
|
-
return fs.existsSync(this.cacheFile);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Get the cache file path (for diagnostics)
|
|
103
|
-
*/
|
|
104
|
-
getCachePath() {
|
|
105
|
-
return this.cacheFile;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=token-cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-cache.js","sourceRoot":"","sources":["../../src/auth/token-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,OAAO,UAAU;IACb,SAAS,CAAS;IAClB,aAAa,CAAS;IACtB,QAAQ,CAAS;IAEzB,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,uBAAuB,CAAC,CAAC;QAEjE,6CAA6C;QAC7C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,EAAE,CAAC,SAAS,CAAC,I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C,CAAC;QAEpC,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QAChF,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAEzB,OAAO,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatting utilities for best practices validation reports
|
|
3
|
-
* Transforms validation results into human-readable markdown reports
|
|
4
|
-
*/
|
|
5
|
-
import type { BestPracticesValidationResult, EntityValidationResult, Violation } from '../PowerPlatformService.js';
|
|
6
|
-
/**
|
|
7
|
-
* Format complete best practices validation report as markdown
|
|
8
|
-
*/
|
|
9
|
-
export declare function formatBestPracticesReport(result: BestPracticesValidationResult): string;
|
|
10
|
-
/**
|
|
11
|
-
* Format violations grouped by severity
|
|
12
|
-
*/
|
|
13
|
-
export declare function formatViolationsBySeverity(violations: Violation[]): string;
|
|
14
|
-
/**
|
|
15
|
-
* Format compliant entities list
|
|
16
|
-
*/
|
|
17
|
-
export declare function formatCompliantEntities(entities: EntityValidationResult[]): string;
|
|
18
|
-
/**
|
|
19
|
-
* Format execution statistics
|
|
20
|
-
*/
|
|
21
|
-
export declare function formatExecutionStats(result: BestPracticesValidationResult): string;
|
|
22
|
-
/**
|
|
23
|
-
* Generate quick summary for CLI output
|
|
24
|
-
*/
|
|
25
|
-
export declare function formatQuickSummary(result: BestPracticesValidationResult): string;
|
|
26
|
-
//# sourceMappingURL=best-practices-formatters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices-formatters.d.ts","sourceRoot":"","sources":["../../src/utils/best-practices-formatters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEnH;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,6BAA6B,GAAG,MAAM,CA4KvF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CA4B1E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAsBlF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,6BAA6B,GAAG,MAAM,CA0BlF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,6BAA6B,GAAG,MAAM,CAShF"}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatting utilities for best practices validation reports
|
|
3
|
-
* Transforms validation results into human-readable markdown reports
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Format complete best practices validation report as markdown
|
|
7
|
-
*/
|
|
8
|
-
export function formatBestPracticesReport(result) {
|
|
9
|
-
const sections = [];
|
|
10
|
-
// Header
|
|
11
|
-
sections.push('# Dataverse Best Practice Validation Report\n');
|
|
12
|
-
if (result.metadata.solutionName) {
|
|
13
|
-
sections.push(`**Solution**: ${result.metadata.solutionName} (\`${result.metadata.solutionUniqueName}\`)`);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
sections.push(`**Entities**: Custom entity validation`);
|
|
17
|
-
}
|
|
18
|
-
sections.push(`**Generated**: ${new Date(result.metadata.generatedAt).toLocaleString()}`);
|
|
19
|
-
sections.push(`**Publisher Prefix**: \`${result.metadata.publisherPrefix}\``);
|
|
20
|
-
sections.push(`**Time Filter**: Columns created in last ${result.metadata.recentDays} days`);
|
|
21
|
-
sections.push('');
|
|
22
|
-
sections.push('---\n');
|
|
23
|
-
// Summary
|
|
24
|
-
sections.push('## Summary\n');
|
|
25
|
-
sections.push('| Metric | Count |');
|
|
26
|
-
sections.push('|--------|-------|');
|
|
27
|
-
sections.push(`| Entities Checked | ${result.summary.entitiesChecked} |`);
|
|
28
|
-
sections.push(`| Attributes Checked | ${result.summary.attributesChecked} |`);
|
|
29
|
-
sections.push(`| **Total Violations** | **${result.summary.totalViolations}** |`);
|
|
30
|
-
sections.push(`| Critical (MUST) | ${result.summary.criticalViolations} |`);
|
|
31
|
-
sections.push(`| Warnings (SHOULD) | ${result.summary.warnings} |`);
|
|
32
|
-
sections.push(`| Compliant Entities | ${result.summary.compliantEntities} |`);
|
|
33
|
-
sections.push('');
|
|
34
|
-
if (result.summary.totalViolations > 0) {
|
|
35
|
-
sections.push('**Overall Status**: ⚠️ Issues Found\n');
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
sections.push('**Overall Status**: ✅ All Compliant\n');
|
|
39
|
-
}
|
|
40
|
-
sections.push('---\n');
|
|
41
|
-
// Violations Summary - Complete Lists of Affected Items
|
|
42
|
-
if (result.summary.totalViolations > 0) {
|
|
43
|
-
sections.push('## 📋 Violations Summary (Complete Lists)\n');
|
|
44
|
-
sections.push('_This section provides complete lists of ALL affected tables and columns grouped by violation type._\n');
|
|
45
|
-
// Use pre-computed violations summary from the result
|
|
46
|
-
for (const ruleSummary of result.violationsSummary) {
|
|
47
|
-
const severityIcon = ruleSummary.severity === 'MUST' ? '🔴' : '⚠️';
|
|
48
|
-
sections.push(`### ${severityIcon} ${ruleSummary.rule} (${ruleSummary.severity})\n`);
|
|
49
|
-
sections.push(`**Affected Items**: ${ruleSummary.totalCount}\n`);
|
|
50
|
-
// Show affected tables (entity-level violations)
|
|
51
|
-
if (ruleSummary.affectedEntities.length > 0) {
|
|
52
|
-
sections.push(`**Affected Tables**:`);
|
|
53
|
-
const tableList = ruleSummary.affectedEntities.map(e => `\`${e}\``).join(', ');
|
|
54
|
-
sections.push(tableList);
|
|
55
|
-
sections.push('');
|
|
56
|
-
}
|
|
57
|
-
// Show affected columns (column-level violations)
|
|
58
|
-
if (ruleSummary.affectedColumns.length > 0) {
|
|
59
|
-
sections.push(`**Affected Columns**:`);
|
|
60
|
-
const columnList = ruleSummary.affectedColumns.map(c => `\`${c}\``).join(', ');
|
|
61
|
-
sections.push(columnList);
|
|
62
|
-
sections.push('');
|
|
63
|
-
}
|
|
64
|
-
// Add recommended action and recommendation
|
|
65
|
-
sections.push(`**Recommended Action**: ${ruleSummary.action}`);
|
|
66
|
-
if (ruleSummary.recommendation) {
|
|
67
|
-
sections.push(`**Why**: ${ruleSummary.recommendation}`);
|
|
68
|
-
}
|
|
69
|
-
sections.push('');
|
|
70
|
-
}
|
|
71
|
-
sections.push('---\n');
|
|
72
|
-
}
|
|
73
|
-
// Critical Violations (MUST Fix)
|
|
74
|
-
if (result.summary.criticalViolations > 0) {
|
|
75
|
-
sections.push('## 🔴 Critical Violations (MUST Fix)\n');
|
|
76
|
-
for (const entity of result.entities) {
|
|
77
|
-
const criticalViolations = entity.violations.filter(v => v.severity === 'MUST');
|
|
78
|
-
if (criticalViolations.length > 0) {
|
|
79
|
-
sections.push(`### Entity: ${entity.displayName} (\`${entity.logicalName}\`)\n`);
|
|
80
|
-
for (const violation of criticalViolations) {
|
|
81
|
-
if (violation.attributeLogicalName) {
|
|
82
|
-
sections.push(`#### Column: ${violation.attributeLogicalName}${violation.createdOn ? ` (Created: ${new Date(violation.createdOn).toLocaleDateString()})` : ''}\n`);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
sections.push(`#### Entity-Level Issue\n`);
|
|
86
|
-
}
|
|
87
|
-
sections.push(`- **Rule**: ${violation.rule}`);
|
|
88
|
-
sections.push(`- **Issue**: ${violation.message}`);
|
|
89
|
-
sections.push(`- **Current**: \`${violation.currentValue}\``);
|
|
90
|
-
sections.push(`- **Expected**: \`${violation.expectedValue}\``);
|
|
91
|
-
sections.push(`- **Action**: ${violation.action}`);
|
|
92
|
-
if (violation.recommendation) {
|
|
93
|
-
sections.push(`- **Recommendation**: ${violation.recommendation}`);
|
|
94
|
-
}
|
|
95
|
-
sections.push('');
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
sections.push('---\n');
|
|
100
|
-
}
|
|
101
|
-
// Warnings (SHOULD Fix)
|
|
102
|
-
if (result.summary.warnings > 0) {
|
|
103
|
-
sections.push('## ⚠️ Warnings (SHOULD Fix)\n');
|
|
104
|
-
for (const entity of result.entities) {
|
|
105
|
-
const warnings = entity.violations.filter(v => v.severity === 'SHOULD');
|
|
106
|
-
if (warnings.length > 0) {
|
|
107
|
-
sections.push(`### Entity: ${entity.displayName} (\`${entity.logicalName}\`)\n`);
|
|
108
|
-
for (const violation of warnings) {
|
|
109
|
-
if (violation.attributeLogicalName) {
|
|
110
|
-
sections.push(`#### Column: ${violation.attributeLogicalName}${violation.createdOn ? ` (Created: ${new Date(violation.createdOn).toLocaleDateString()})` : ''}\n`);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
sections.push(`#### Entity-Level Issue\n`);
|
|
114
|
-
}
|
|
115
|
-
sections.push(`- **Rule**: ${violation.rule}`);
|
|
116
|
-
sections.push(`- **Issue**: ${violation.message}`);
|
|
117
|
-
sections.push(`- **Current**: \`${violation.currentValue}\``);
|
|
118
|
-
sections.push(`- **Expected**: \`${violation.expectedValue}\``);
|
|
119
|
-
sections.push(`- **Recommendation**: ${violation.recommendation || violation.action}`);
|
|
120
|
-
sections.push('');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
sections.push('---\n');
|
|
125
|
-
}
|
|
126
|
-
// Compliant Entities
|
|
127
|
-
sections.push('## ✅ Compliant Entities\n');
|
|
128
|
-
const compliantEntities = result.entities.filter(e => e.isCompliant);
|
|
129
|
-
if (compliantEntities.length > 0) {
|
|
130
|
-
sections.push('The following entities have no violations:\n');
|
|
131
|
-
for (const entity of compliantEntities) {
|
|
132
|
-
sections.push(`- **${entity.displayName}** (\`${entity.logicalName}\`) - ${entity.attributesChecked} columns checked${entity.isRefData ? ' (RefData table)' : ''}`);
|
|
133
|
-
}
|
|
134
|
-
sections.push('');
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
sections.push('No fully compliant entities found.\n');
|
|
138
|
-
}
|
|
139
|
-
sections.push('---\n');
|
|
140
|
-
// Exclusions and Statistics
|
|
141
|
-
sections.push('## Exclusions\n');
|
|
142
|
-
sections.push(`- System columns excluded: ${result.statistics.systemColumnsExcluded}`);
|
|
143
|
-
sections.push(`- Columns older than ${result.metadata.recentDays} days: ${result.statistics.oldColumnsExcluded}`);
|
|
144
|
-
sections.push(`- RefData tables (updatedbyprocess check skipped): ${result.statistics.refDataTablesSkipped}`);
|
|
145
|
-
sections.push('');
|
|
146
|
-
sections.push('---\n');
|
|
147
|
-
// Footer
|
|
148
|
-
sections.push(`**Execution Time**: ${result.metadata.executionTimeMs}ms`);
|
|
149
|
-
return sections.join('\n');
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Format violations grouped by severity
|
|
153
|
-
*/
|
|
154
|
-
export function formatViolationsBySeverity(violations) {
|
|
155
|
-
const sections = [];
|
|
156
|
-
const critical = violations.filter(v => v.severity === 'MUST');
|
|
157
|
-
const warnings = violations.filter(v => v.severity === 'SHOULD');
|
|
158
|
-
sections.push(`### Violations by Severity\n`);
|
|
159
|
-
sections.push(`- **Critical (MUST)**: ${critical.length}`);
|
|
160
|
-
sections.push(`- **Warnings (SHOULD)**: ${warnings.length}`);
|
|
161
|
-
sections.push(`- **Total**: ${violations.length}\n`);
|
|
162
|
-
if (critical.length > 0) {
|
|
163
|
-
sections.push('#### Critical Issues\n');
|
|
164
|
-
for (const violation of critical) {
|
|
165
|
-
sections.push(`- ${violation.rule}: ${violation.message}`);
|
|
166
|
-
}
|
|
167
|
-
sections.push('');
|
|
168
|
-
}
|
|
169
|
-
if (warnings.length > 0) {
|
|
170
|
-
sections.push('#### Warnings\n');
|
|
171
|
-
for (const violation of warnings) {
|
|
172
|
-
sections.push(`- ${violation.rule}: ${violation.message}`);
|
|
173
|
-
}
|
|
174
|
-
sections.push('');
|
|
175
|
-
}
|
|
176
|
-
return sections.join('\n');
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Format compliant entities list
|
|
180
|
-
*/
|
|
181
|
-
export function formatCompliantEntities(entities) {
|
|
182
|
-
const sections = [];
|
|
183
|
-
const compliant = entities.filter(e => e.isCompliant);
|
|
184
|
-
sections.push('### Compliant Entities\n');
|
|
185
|
-
if (compliant.length > 0) {
|
|
186
|
-
for (const entity of compliant) {
|
|
187
|
-
sections.push(`- **${entity.displayName}** (\`${entity.logicalName}\`)`);
|
|
188
|
-
sections.push(` - Attributes checked: ${entity.attributesChecked}`);
|
|
189
|
-
sections.push(` - Status: ✅ No violations`);
|
|
190
|
-
if (entity.isRefData) {
|
|
191
|
-
sections.push(` - Type: RefData table`);
|
|
192
|
-
}
|
|
193
|
-
sections.push('');
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
sections.push('No compliant entities found.');
|
|
198
|
-
}
|
|
199
|
-
return sections.join('\n');
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Format execution statistics
|
|
203
|
-
*/
|
|
204
|
-
export function formatExecutionStats(result) {
|
|
205
|
-
const sections = [];
|
|
206
|
-
sections.push('### Execution Statistics\n');
|
|
207
|
-
sections.push('| Metric | Value |');
|
|
208
|
-
sections.push('|--------|-------|');
|
|
209
|
-
sections.push(`| Execution Time | ${result.metadata.executionTimeMs}ms |`);
|
|
210
|
-
sections.push(`| Entities Processed | ${result.summary.entitiesChecked} |`);
|
|
211
|
-
sections.push(`| Attributes Analyzed | ${result.summary.attributesChecked} |`);
|
|
212
|
-
sections.push(`| System Columns Excluded | ${result.statistics.systemColumnsExcluded} |`);
|
|
213
|
-
sections.push(`| Old Columns Excluded | ${result.statistics.oldColumnsExcluded} |`);
|
|
214
|
-
sections.push(`| RefData Tables | ${result.statistics.refDataTablesSkipped} |`);
|
|
215
|
-
sections.push('');
|
|
216
|
-
// Performance metrics
|
|
217
|
-
if (result.summary.entitiesChecked > 0) {
|
|
218
|
-
const avgTimePerEntity = Math.round(result.metadata.executionTimeMs / result.summary.entitiesChecked);
|
|
219
|
-
sections.push(`**Average time per entity**: ${avgTimePerEntity}ms`);
|
|
220
|
-
}
|
|
221
|
-
if (result.summary.attributesChecked > 0) {
|
|
222
|
-
const avgTimePerAttribute = Math.round(result.metadata.executionTimeMs / result.summary.attributesChecked);
|
|
223
|
-
sections.push(`**Average time per attribute**: ${avgTimePerAttribute}ms`);
|
|
224
|
-
}
|
|
225
|
-
return sections.join('\n');
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Generate quick summary for CLI output
|
|
229
|
-
*/
|
|
230
|
-
export function formatQuickSummary(result) {
|
|
231
|
-
const lines = [];
|
|
232
|
-
lines.push(`Validation Complete: ${result.summary.entitiesChecked} entities checked`);
|
|
233
|
-
lines.push(`Total Violations: ${result.summary.totalViolations} (${result.summary.criticalViolations} critical, ${result.summary.warnings} warnings)`);
|
|
234
|
-
lines.push(`Compliant Entities: ${result.summary.compliantEntities}/${result.summary.entitiesChecked}`);
|
|
235
|
-
lines.push(`Execution Time: ${result.metadata.executionTimeMs}ms`);
|
|
236
|
-
return lines.join('\n');
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=best-practices-formatters.js.map
|
|
@@ -1 +0,0 @@
|
|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C,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Best Practices Validation Module
|
|
3
|
-
*
|
|
4
|
-
* Hard-coded SmartImpact CRM best practices for entity and attribute customization.
|
|
5
|
-
* These rules are enforced during entity and attribute creation/update operations.
|
|
6
|
-
*/
|
|
7
|
-
export interface ValidationResult {
|
|
8
|
-
isValid: boolean;
|
|
9
|
-
issues: string[];
|
|
10
|
-
warnings: string[];
|
|
11
|
-
missingColumns?: RequiredColumn[];
|
|
12
|
-
}
|
|
13
|
-
export interface RequiredColumn {
|
|
14
|
-
schemaName: string;
|
|
15
|
-
displayName: string;
|
|
16
|
-
description: string;
|
|
17
|
-
type: string;
|
|
18
|
-
maxLength?: number;
|
|
19
|
-
format?: string;
|
|
20
|
-
behavior?: string;
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Hard-coded best practices rules for SmartImpact CRM customizations
|
|
25
|
-
*/
|
|
26
|
-
export declare const BEST_PRACTICES: {
|
|
27
|
-
publisher: {
|
|
28
|
-
prefix: string;
|
|
29
|
-
name: string;
|
|
30
|
-
optionValuePrefix: number;
|
|
31
|
-
};
|
|
32
|
-
entity: {
|
|
33
|
-
ownershipType: {
|
|
34
|
-
allowed: string[];
|
|
35
|
-
forbidden: string[];
|
|
36
|
-
default: string;
|
|
37
|
-
};
|
|
38
|
-
prefix: string;
|
|
39
|
-
refDataInfix: string;
|
|
40
|
-
caseRule: string;
|
|
41
|
-
};
|
|
42
|
-
attribute: {
|
|
43
|
-
lookupSuffix: string;
|
|
44
|
-
caseRule: string;
|
|
45
|
-
avoidBooleans: boolean;
|
|
46
|
-
dateTimeDefaultBehavior: string;
|
|
47
|
-
};
|
|
48
|
-
requiredColumns: {
|
|
49
|
-
allTables: {
|
|
50
|
-
schemaName: string;
|
|
51
|
-
displayName: string;
|
|
52
|
-
description: string;
|
|
53
|
-
type: string;
|
|
54
|
-
maxLength: number;
|
|
55
|
-
}[];
|
|
56
|
-
refDataTables: ({
|
|
57
|
-
schemaName: string;
|
|
58
|
-
displayName: string;
|
|
59
|
-
description: string;
|
|
60
|
-
type: string;
|
|
61
|
-
format: string;
|
|
62
|
-
behavior: string;
|
|
63
|
-
maxLength?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
schemaName: string;
|
|
66
|
-
displayName: string;
|
|
67
|
-
description: string;
|
|
68
|
-
type: string;
|
|
69
|
-
maxLength: number;
|
|
70
|
-
format?: undefined;
|
|
71
|
-
behavior?: undefined;
|
|
72
|
-
})[];
|
|
73
|
-
};
|
|
74
|
-
form: {
|
|
75
|
-
firstColumnMustBeName: boolean;
|
|
76
|
-
standardColumnOrder: string[];
|
|
77
|
-
colorPalette: {
|
|
78
|
-
amber: string;
|
|
79
|
-
green: string;
|
|
80
|
-
red: string;
|
|
81
|
-
grey: string;
|
|
82
|
-
};
|
|
83
|
-
timelineActivityLimit: number;
|
|
84
|
-
};
|
|
85
|
-
status: {
|
|
86
|
-
preferGlobalOptionSets: boolean;
|
|
87
|
-
avoidOOTBStateStatus: boolean;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Best Practices Validator Class
|
|
92
|
-
*/
|
|
93
|
-
export declare class BestPracticesValidator {
|
|
94
|
-
/**
|
|
95
|
-
* Validate entity naming conventions
|
|
96
|
-
* Pattern for RefData: prefix + "ref_" + tablename (e.g., sic_ref_cancellationreason)
|
|
97
|
-
* Pattern for BAU: prefix + tablename (e.g., sic_application)
|
|
98
|
-
*/
|
|
99
|
-
validateEntityName(schemaName: string, isRefData: boolean): ValidationResult;
|
|
100
|
-
/**
|
|
101
|
-
* Validate attribute naming conventions
|
|
102
|
-
*/
|
|
103
|
-
validateAttributeName(schemaName: string, isLookup: boolean): ValidationResult;
|
|
104
|
-
/**
|
|
105
|
-
* Validate entity ownership type
|
|
106
|
-
*/
|
|
107
|
-
validateOwnershipType(ownershipType: string): ValidationResult;
|
|
108
|
-
/**
|
|
109
|
-
* Check if required columns are present
|
|
110
|
-
*/
|
|
111
|
-
validateRequiredColumns(existingColumns: string[], isRefData: boolean): ValidationResult;
|
|
112
|
-
/**
|
|
113
|
-
* Validate boolean usage (discouraged)
|
|
114
|
-
*/
|
|
115
|
-
validateBooleanUsage(attributeType: string, schemaName: string): ValidationResult;
|
|
116
|
-
/**
|
|
117
|
-
* Validate DateTime behavior
|
|
118
|
-
*/
|
|
119
|
-
validateDateTimeBehavior(behavior: string | undefined): ValidationResult;
|
|
120
|
-
/**
|
|
121
|
-
* Get required columns for entity type
|
|
122
|
-
*/
|
|
123
|
-
getRequiredColumns(isRefData: boolean): RequiredColumn[];
|
|
124
|
-
/**
|
|
125
|
-
* Validate option set value prefix
|
|
126
|
-
*/
|
|
127
|
-
validateOptionSetValuePrefix(value: number): ValidationResult;
|
|
128
|
-
/**
|
|
129
|
-
* Generate next option set value with proper prefix
|
|
130
|
-
*/
|
|
131
|
-
getNextOptionSetValue(existingValues: number[]): number;
|
|
132
|
-
/**
|
|
133
|
-
* Comprehensive entity validation
|
|
134
|
-
*/
|
|
135
|
-
validateEntity(params: {
|
|
136
|
-
schemaName: string;
|
|
137
|
-
displayName: string;
|
|
138
|
-
ownershipType: string;
|
|
139
|
-
isRefData: boolean;
|
|
140
|
-
existingColumns?: string[];
|
|
141
|
-
}): ValidationResult;
|
|
142
|
-
/**
|
|
143
|
-
* Comprehensive attribute validation
|
|
144
|
-
*/
|
|
145
|
-
validateAttribute(params: {
|
|
146
|
-
schemaName: string;
|
|
147
|
-
attributeType: string;
|
|
148
|
-
dateTimeBehavior?: string;
|
|
149
|
-
}): ValidationResult;
|
|
150
|
-
}
|
|
151
|
-
export declare const bestPracticesValidator: BestPracticesValidator;
|
|
152
|
-
//# sourceMappingURL=bestPractices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bestPractices.d.ts","sourceRoot":"","sources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