@schemashift/core 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -297,6 +297,12 @@ declare class MigrationAuditLog {
297
297
  * Clear the audit log.
298
298
  */
299
299
  clear(): void;
300
+ /**
301
+ * Export a compliance report in SOC2 or HIPAA format.
302
+ */
303
+ exportComplianceReport(format: 'soc2' | 'hipaa'): string;
304
+ private generateSoc2Report;
305
+ private generateHipaaReport;
300
306
  private collectMetadata;
301
307
  private write;
302
308
  private hashContent;
@@ -457,8 +463,13 @@ interface ComplexityEstimate {
457
463
  warnings: ComplexityWarning[];
458
464
  riskAreas: string[];
459
465
  }
466
+ interface DurationEstimate {
467
+ label: string;
468
+ rangeMinutes: [number, number];
469
+ }
460
470
  declare class ComplexityEstimator {
461
471
  estimate(files: SourceFile[]): ComplexityEstimate;
472
+ estimateDuration(estimate: ComplexityEstimate): DurationEstimate;
462
473
  private calculateEffort;
463
474
  }
464
475
 
@@ -937,6 +948,11 @@ declare class IncrementalTracker {
937
948
  total: number;
938
949
  percent: number;
939
950
  } | null;
951
+ /**
952
+ * Get a canary batch — a percentage of remaining files, sorted simplest first.
953
+ * Used for phased rollouts where you migrate a small batch, verify, then continue.
954
+ */
955
+ getCanaryBatch(percent: number, fileSizes?: Map<string, number>): string[];
940
956
  clear(): void;
941
957
  private saveState;
942
958
  }
@@ -1012,11 +1028,13 @@ interface NotificationResult {
1012
1028
  statusCode?: number;
1013
1029
  error?: string;
1014
1030
  }
1031
+ type WebhookType = 'generic' | 'slack' | 'teams';
1015
1032
  interface WebhookConfig {
1016
1033
  url: string;
1017
1034
  events?: MigrationEventType[];
1018
1035
  headers?: Record<string, string>;
1019
1036
  secret?: string;
1037
+ type?: WebhookType;
1020
1038
  }
1021
1039
  /**
1022
1040
  * Send migration event notifications via webhooks.
@@ -1032,6 +1050,16 @@ declare class WebhookNotifier {
1032
1050
  * Send an event to all matching webhooks.
1033
1051
  */
1034
1052
  send(event: MigrationEvent): Promise<NotificationResult[]>;
1053
+ /**
1054
+ * Format event as Slack Block Kit message.
1055
+ */
1056
+ formatSlackPayload(event: MigrationEvent): Record<string, unknown>;
1057
+ /**
1058
+ * Format event as Microsoft Teams Adaptive Card.
1059
+ */
1060
+ formatTeamsPayload(event: MigrationEvent): Record<string, unknown>;
1061
+ private getEventEmoji;
1062
+ private getEventTitle;
1035
1063
  /**
1036
1064
  * Send event to a single webhook endpoint.
1037
1065
  */
@@ -1124,6 +1152,56 @@ declare class PluginLoader {
1124
1152
  private validatePlugin;
1125
1153
  }
1126
1154
 
1155
+ interface VerificationSample {
1156
+ name: string;
1157
+ input: unknown;
1158
+ expectedValid: boolean;
1159
+ }
1160
+ interface SchemaVerificationResult {
1161
+ schemaName: string;
1162
+ filePath: string;
1163
+ totalSamples: number;
1164
+ matchingSamples: number;
1165
+ mismatches: VerificationMismatch[];
1166
+ parityScore: number;
1167
+ }
1168
+ interface VerificationMismatch {
1169
+ sampleName: string;
1170
+ input: unknown;
1171
+ sourceResult: {
1172
+ valid: boolean;
1173
+ error?: string;
1174
+ };
1175
+ targetResult: {
1176
+ valid: boolean;
1177
+ error?: string;
1178
+ };
1179
+ }
1180
+ interface VerificationReport {
1181
+ from: string;
1182
+ to: string;
1183
+ totalSchemas: number;
1184
+ results: SchemaVerificationResult[];
1185
+ overallParityScore: number;
1186
+ timestamp: string;
1187
+ }
1188
+ /**
1189
+ * Extracts schema definition names from source file text.
1190
+ */
1191
+ declare function extractSchemaNames(sourceText: string): string[];
1192
+ /**
1193
+ * Generates test samples based on detected schema patterns.
1194
+ */
1195
+ declare function generateSamples(sourceText: string, schemaName: string, maxSamples: number): VerificationSample[];
1196
+ /**
1197
+ * Creates a verification report comparing source and target schemas.
1198
+ */
1199
+ declare function createVerificationReport(from: string, to: string, results: SchemaVerificationResult[]): VerificationReport;
1200
+ /**
1201
+ * Format verification report for terminal output.
1202
+ */
1203
+ declare function formatVerificationReport(report: VerificationReport): string;
1204
+
1127
1205
  interface StandardSchemaInfo {
1128
1206
  detected: boolean;
1129
1207
  compatibleLibraries: Array<{
@@ -1228,4 +1306,4 @@ declare class TypeDedupDetector {
1228
1306
  private namesRelated;
1229
1307
  }
1230
1308
 
1231
- export { type AnalysisResult, type ApprovalDecision, ApprovalManager, type ApprovalStatus, type ApprovalSummary, type AuditEntry, type AuditEntryMetadata, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CrossFieldPattern, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, DriftDetector, type DriftModification, type DriftResult, type DuplicateTypeCandidate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FixResult, type FixSummary, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GOVERNANCE_TEMPLATES, GovernanceEngine, GovernanceFixer, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceTemplate, type GovernanceViolation, type GraphExportOptions, GraphExporter, type GraphNode, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationEvent, type MigrationEventType, type MigrationReadiness, type MigrationRequest, type MigrationTemplate, type MigrationTemplateStep, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type NotificationResult, type PackageChange, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaFileSnapshot, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type SchemaSnapshot, StandardSchemaAdvisor, type StandardSchemaAdvisory, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VersionIssue, type WarningSuppressionRule, type WebhookConfig, WebhookNotifier, type WorkspaceManager, buildCallChain, computeParallelBatches, conditionalValidation, dependentFields, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, getAllMigrationTemplates, getGovernanceTemplate, getGovernanceTemplateNames, getGovernanceTemplatesByCategory, getMigrationTemplate, getMigrationTemplateNames, getMigrationTemplatesByCategory, isInsideComment, isInsideStringLiteral, loadConfig, mutuallyExclusive, parseCallChain, requireIf, requireOneOf, shouldSuppressWarning, startsWithBase, suggestCrossFieldPattern, transformMethodChain, validateConfig, validateMigrationTemplate };
1309
+ export { type AnalysisResult, type ApprovalDecision, ApprovalManager, type ApprovalStatus, type ApprovalSummary, type AuditEntry, type AuditEntryMetadata, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CrossFieldPattern, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, DriftDetector, type DriftModification, type DriftResult, type DuplicateTypeCandidate, type DurationEstimate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FixResult, type FixSummary, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GOVERNANCE_TEMPLATES, GovernanceEngine, GovernanceFixer, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceTemplate, type GovernanceViolation, type GraphExportOptions, GraphExporter, type GraphNode, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationEvent, type MigrationEventType, type MigrationReadiness, type MigrationRequest, type MigrationTemplate, type MigrationTemplateStep, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type NotificationResult, type PackageChange, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaFileSnapshot, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type SchemaSnapshot, type SchemaVerificationResult, StandardSchemaAdvisor, type StandardSchemaAdvisory, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VerificationMismatch, type VerificationReport, type VerificationSample, type VersionIssue, type WarningSuppressionRule, type WebhookConfig, WebhookNotifier, type WebhookType, type WorkspaceManager, buildCallChain, computeParallelBatches, conditionalValidation, createVerificationReport, dependentFields, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, extractSchemaNames, formatVerificationReport, generateSamples, getAllMigrationTemplates, getGovernanceTemplate, getGovernanceTemplateNames, getGovernanceTemplatesByCategory, getMigrationTemplate, getMigrationTemplateNames, getMigrationTemplatesByCategory, isInsideComment, isInsideStringLiteral, loadConfig, mutuallyExclusive, parseCallChain, requireIf, requireOneOf, shouldSuppressWarning, startsWithBase, suggestCrossFieldPattern, transformMethodChain, validateConfig, validateMigrationTemplate };
package/dist/index.d.ts CHANGED
@@ -297,6 +297,12 @@ declare class MigrationAuditLog {
297
297
  * Clear the audit log.
298
298
  */
299
299
  clear(): void;
300
+ /**
301
+ * Export a compliance report in SOC2 or HIPAA format.
302
+ */
303
+ exportComplianceReport(format: 'soc2' | 'hipaa'): string;
304
+ private generateSoc2Report;
305
+ private generateHipaaReport;
300
306
  private collectMetadata;
301
307
  private write;
302
308
  private hashContent;
@@ -457,8 +463,13 @@ interface ComplexityEstimate {
457
463
  warnings: ComplexityWarning[];
458
464
  riskAreas: string[];
459
465
  }
466
+ interface DurationEstimate {
467
+ label: string;
468
+ rangeMinutes: [number, number];
469
+ }
460
470
  declare class ComplexityEstimator {
461
471
  estimate(files: SourceFile[]): ComplexityEstimate;
472
+ estimateDuration(estimate: ComplexityEstimate): DurationEstimate;
462
473
  private calculateEffort;
463
474
  }
464
475
 
@@ -937,6 +948,11 @@ declare class IncrementalTracker {
937
948
  total: number;
938
949
  percent: number;
939
950
  } | null;
951
+ /**
952
+ * Get a canary batch — a percentage of remaining files, sorted simplest first.
953
+ * Used for phased rollouts where you migrate a small batch, verify, then continue.
954
+ */
955
+ getCanaryBatch(percent: number, fileSizes?: Map<string, number>): string[];
940
956
  clear(): void;
941
957
  private saveState;
942
958
  }
@@ -1012,11 +1028,13 @@ interface NotificationResult {
1012
1028
  statusCode?: number;
1013
1029
  error?: string;
1014
1030
  }
1031
+ type WebhookType = 'generic' | 'slack' | 'teams';
1015
1032
  interface WebhookConfig {
1016
1033
  url: string;
1017
1034
  events?: MigrationEventType[];
1018
1035
  headers?: Record<string, string>;
1019
1036
  secret?: string;
1037
+ type?: WebhookType;
1020
1038
  }
1021
1039
  /**
1022
1040
  * Send migration event notifications via webhooks.
@@ -1032,6 +1050,16 @@ declare class WebhookNotifier {
1032
1050
  * Send an event to all matching webhooks.
1033
1051
  */
1034
1052
  send(event: MigrationEvent): Promise<NotificationResult[]>;
1053
+ /**
1054
+ * Format event as Slack Block Kit message.
1055
+ */
1056
+ formatSlackPayload(event: MigrationEvent): Record<string, unknown>;
1057
+ /**
1058
+ * Format event as Microsoft Teams Adaptive Card.
1059
+ */
1060
+ formatTeamsPayload(event: MigrationEvent): Record<string, unknown>;
1061
+ private getEventEmoji;
1062
+ private getEventTitle;
1035
1063
  /**
1036
1064
  * Send event to a single webhook endpoint.
1037
1065
  */
@@ -1124,6 +1152,56 @@ declare class PluginLoader {
1124
1152
  private validatePlugin;
1125
1153
  }
1126
1154
 
1155
+ interface VerificationSample {
1156
+ name: string;
1157
+ input: unknown;
1158
+ expectedValid: boolean;
1159
+ }
1160
+ interface SchemaVerificationResult {
1161
+ schemaName: string;
1162
+ filePath: string;
1163
+ totalSamples: number;
1164
+ matchingSamples: number;
1165
+ mismatches: VerificationMismatch[];
1166
+ parityScore: number;
1167
+ }
1168
+ interface VerificationMismatch {
1169
+ sampleName: string;
1170
+ input: unknown;
1171
+ sourceResult: {
1172
+ valid: boolean;
1173
+ error?: string;
1174
+ };
1175
+ targetResult: {
1176
+ valid: boolean;
1177
+ error?: string;
1178
+ };
1179
+ }
1180
+ interface VerificationReport {
1181
+ from: string;
1182
+ to: string;
1183
+ totalSchemas: number;
1184
+ results: SchemaVerificationResult[];
1185
+ overallParityScore: number;
1186
+ timestamp: string;
1187
+ }
1188
+ /**
1189
+ * Extracts schema definition names from source file text.
1190
+ */
1191
+ declare function extractSchemaNames(sourceText: string): string[];
1192
+ /**
1193
+ * Generates test samples based on detected schema patterns.
1194
+ */
1195
+ declare function generateSamples(sourceText: string, schemaName: string, maxSamples: number): VerificationSample[];
1196
+ /**
1197
+ * Creates a verification report comparing source and target schemas.
1198
+ */
1199
+ declare function createVerificationReport(from: string, to: string, results: SchemaVerificationResult[]): VerificationReport;
1200
+ /**
1201
+ * Format verification report for terminal output.
1202
+ */
1203
+ declare function formatVerificationReport(report: VerificationReport): string;
1204
+
1127
1205
  interface StandardSchemaInfo {
1128
1206
  detected: boolean;
1129
1207
  compatibleLibraries: Array<{
@@ -1228,4 +1306,4 @@ declare class TypeDedupDetector {
1228
1306
  private namesRelated;
1229
1307
  }
1230
1308
 
1231
- export { type AnalysisResult, type ApprovalDecision, ApprovalManager, type ApprovalStatus, type ApprovalSummary, type AuditEntry, type AuditEntryMetadata, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CrossFieldPattern, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, DriftDetector, type DriftModification, type DriftResult, type DuplicateTypeCandidate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FixResult, type FixSummary, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GOVERNANCE_TEMPLATES, GovernanceEngine, GovernanceFixer, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceTemplate, type GovernanceViolation, type GraphExportOptions, GraphExporter, type GraphNode, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationEvent, type MigrationEventType, type MigrationReadiness, type MigrationRequest, type MigrationTemplate, type MigrationTemplateStep, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type NotificationResult, type PackageChange, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaFileSnapshot, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type SchemaSnapshot, StandardSchemaAdvisor, type StandardSchemaAdvisory, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VersionIssue, type WarningSuppressionRule, type WebhookConfig, WebhookNotifier, type WorkspaceManager, buildCallChain, computeParallelBatches, conditionalValidation, dependentFields, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, getAllMigrationTemplates, getGovernanceTemplate, getGovernanceTemplateNames, getGovernanceTemplatesByCategory, getMigrationTemplate, getMigrationTemplateNames, getMigrationTemplatesByCategory, isInsideComment, isInsideStringLiteral, loadConfig, mutuallyExclusive, parseCallChain, requireIf, requireOneOf, shouldSuppressWarning, startsWithBase, suggestCrossFieldPattern, transformMethodChain, validateConfig, validateMigrationTemplate };
1309
+ export { type AnalysisResult, type ApprovalDecision, ApprovalManager, type ApprovalStatus, type ApprovalSummary, type AuditEntry, type AuditEntryMetadata, type AuditLog, type BehavioralAnalysisResult, type BehavioralCategory, type BehavioralWarning, BehavioralWarningAnalyzer, BundleEstimator, type BundleSizeEstimate, type CallChainInfo, type ChainResult, type ChainStep, type ChainStepResult, type ChainValidation, CompatibilityAnalyzer, type CompatibilityResult, type ComplexityEstimate, ComplexityEstimator, type ComplexityWarning, type CrossFieldPattern, type CustomRule, type DependencyGraphResult, type DetailedAnalysisResult, DetailedAnalyzer, DriftDetector, type DriftModification, type DriftResult, type DuplicateTypeCandidate, type DurationEstimate, EcosystemAnalyzer, type EcosystemIssue, type EcosystemReport, type EffortLevel, type FileComplexity, type FixResult, type FixSummary, type FormLibraryDetection, FormResolverMigrator, type FormResolverResult, GOVERNANCE_TEMPLATES, GovernanceEngine, GovernanceFixer, type GovernanceResult, type GovernanceRuleConfig, type GovernanceRuleFunction, type GovernanceTemplate, type GovernanceViolation, type GraphExportOptions, GraphExporter, type GraphNode, type IncrementalState, IncrementalTracker, type LibraryBundleInfo, type LibraryVersionInfo, type MethodCallInfo, MigrationAuditLog, MigrationChain, type MigrationEvent, type MigrationEventType, type MigrationReadiness, type MigrationRequest, type MigrationTemplate, type MigrationTemplateStep, type MonorepoInfo, type MonorepoPackage, MonorepoResolver, type NotificationResult, type PackageChange, type PackageUpdatePlan, PackageUpdater, type ParallelBatch, type PerformanceAnalysisResult, PerformanceAnalyzer, type PerformanceCategory, type PerformanceWarning, type PluginLoadResult, PluginLoader, type ScaffoldedTest, SchemaAnalyzer, type SchemaComplexity, SchemaDependencyResolver, type SchemaFileSnapshot, type SchemaInfo, type SchemaLibrary, type SchemaShiftConfig, type SchemaShiftPlugin, type SchemaSnapshot, type SchemaVerificationResult, StandardSchemaAdvisor, type StandardSchemaAdvisory, type StandardSchemaInfo, type TestScaffoldResult, TestScaffolder, TransformEngine, type TransformError, type TransformHandler, type TransformOptions, type TransformResult, TypeDedupDetector, type TypeDedupResult, type VerificationMismatch, type VerificationReport, type VerificationSample, type VersionIssue, type WarningSuppressionRule, type WebhookConfig, WebhookNotifier, type WebhookType, type WorkspaceManager, buildCallChain, computeParallelBatches, conditionalValidation, createVerificationReport, dependentFields, detectFormLibraries, detectSchemaLibrary, detectStandardSchema, extractSchemaNames, formatVerificationReport, generateSamples, getAllMigrationTemplates, getGovernanceTemplate, getGovernanceTemplateNames, getGovernanceTemplatesByCategory, getMigrationTemplate, getMigrationTemplateNames, getMigrationTemplatesByCategory, isInsideComment, isInsideStringLiteral, loadConfig, mutuallyExclusive, parseCallChain, requireIf, requireOneOf, shouldSuppressWarning, startsWithBase, suggestCrossFieldPattern, transformMethodChain, validateConfig, validateMigrationTemplate };