@centrali-io/centrali-sdk 2.3.0 → 2.3.2

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.js CHANGED
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.CentraliSDK = exports.SmartQueriesManager = exports.TriggersManager = exports.RealtimeManager = void 0;
21
+ exports.CentraliSDK = exports.ValidationManager = exports.AnomalyInsightsManager = exports.SmartQueriesManager = exports.TriggersManager = exports.RealtimeManager = void 0;
22
22
  exports.getApiUrl = getApiUrl;
23
23
  exports.getAuthUrl = getAuthUrl;
24
24
  exports.getRealtimeUrl = getRealtimeUrl;
@@ -34,6 +34,22 @@ exports.getSmartQueriesStructureApiPath = getSmartQueriesStructureApiPath;
34
34
  exports.getSmartQueryByNameApiPath = getSmartQueryByNameApiPath;
35
35
  exports.getSmartQueryExecuteApiPath = getSmartQueryExecuteApiPath;
36
36
  exports.getSearchApiPath = getSearchApiPath;
37
+ exports.getAnomalyInsightsApiPath = getAnomalyInsightsApiPath;
38
+ exports.getAnomalyInsightsSummaryApiPath = getAnomalyInsightsSummaryApiPath;
39
+ exports.getAnomalyInsightAcknowledgeApiPath = getAnomalyInsightAcknowledgeApiPath;
40
+ exports.getAnomalyInsightDismissApiPath = getAnomalyInsightDismissApiPath;
41
+ exports.getAnomalyInsightsBulkAcknowledgeApiPath = getAnomalyInsightsBulkAcknowledgeApiPath;
42
+ exports.getAnomalyAnalysisTriggerApiPath = getAnomalyAnalysisTriggerApiPath;
43
+ exports.getStructureInsightsApiPath = getStructureInsightsApiPath;
44
+ exports.getValidationSuggestionsApiPath = getValidationSuggestionsApiPath;
45
+ exports.getValidationSuggestionAcceptApiPath = getValidationSuggestionAcceptApiPath;
46
+ exports.getValidationSuggestionRejectApiPath = getValidationSuggestionRejectApiPath;
47
+ exports.getValidationBulkAcceptApiPath = getValidationBulkAcceptApiPath;
48
+ exports.getValidationBulkRejectApiPath = getValidationBulkRejectApiPath;
49
+ exports.getValidationSummaryApiPath = getValidationSummaryApiPath;
50
+ exports.getValidationRecordSuggestionsApiPath = getValidationRecordSuggestionsApiPath;
51
+ exports.getValidationPendingCountApiPath = getValidationPendingCountApiPath;
52
+ exports.getValidationScanApiPath = getValidationScanApiPath;
37
53
  const axios_1 = __importDefault(require("axios"));
38
54
  const qs_1 = __importDefault(require("qs"));
39
55
  const eventsource_1 = require("eventsource");
@@ -382,6 +398,109 @@ function getSmartQueryExecuteApiPath(workspaceId, structureSlug, queryId) {
382
398
  function getSearchApiPath(workspaceId) {
383
399
  return `search/workspace/${workspaceId}/api/v1/records/search`;
384
400
  }
401
+ /**
402
+ * Generate Anomaly Insights base API URL PATH.
403
+ */
404
+ function getAnomalyInsightsApiPath(workspaceId, insightId) {
405
+ const basePath = `data/workspace/${workspaceId}/api/v1/ai/insights`;
406
+ return insightId ? `${basePath}/${insightId}` : basePath;
407
+ }
408
+ /**
409
+ * Generate Anomaly Insights summary API URL PATH.
410
+ */
411
+ function getAnomalyInsightsSummaryApiPath(workspaceId) {
412
+ return `data/workspace/${workspaceId}/api/v1/ai/insights/summary`;
413
+ }
414
+ /**
415
+ * Generate Anomaly Insights acknowledge API URL PATH.
416
+ */
417
+ function getAnomalyInsightAcknowledgeApiPath(workspaceId, insightId) {
418
+ return `data/workspace/${workspaceId}/api/v1/ai/insights/${insightId}/acknowledge`;
419
+ }
420
+ /**
421
+ * Generate Anomaly Insights dismiss API URL PATH.
422
+ */
423
+ function getAnomalyInsightDismissApiPath(workspaceId, insightId) {
424
+ return `data/workspace/${workspaceId}/api/v1/ai/insights/${insightId}/dismiss`;
425
+ }
426
+ /**
427
+ * Generate Anomaly Insights bulk acknowledge API URL PATH.
428
+ */
429
+ function getAnomalyInsightsBulkAcknowledgeApiPath(workspaceId) {
430
+ return `data/workspace/${workspaceId}/api/v1/ai/insights/bulk-acknowledge`;
431
+ }
432
+ /**
433
+ * Generate Anomaly analysis trigger API URL PATH.
434
+ */
435
+ function getAnomalyAnalysisTriggerApiPath(workspaceId) {
436
+ return `data/workspace/${workspaceId}/api/v1/ai/anomalies/analyze`;
437
+ }
438
+ /**
439
+ * Generate structure-scoped anomaly insights API URL PATH.
440
+ */
441
+ function getStructureInsightsApiPath(workspaceId, structureSlug) {
442
+ return `data/workspace/${workspaceId}/api/v1/structures/${structureSlug}/insights`;
443
+ }
444
+ // =====================================================
445
+ // Validation API Path Helpers
446
+ // =====================================================
447
+ /**
448
+ * Generate Validation suggestions base API URL PATH.
449
+ */
450
+ function getValidationSuggestionsApiPath(workspaceId, suggestionId) {
451
+ const basePath = `data/workspace/${workspaceId}/api/v1/ai/validation/suggestions`;
452
+ return suggestionId ? `${basePath}/${suggestionId}` : basePath;
453
+ }
454
+ /**
455
+ * Generate Validation suggestion accept API URL PATH.
456
+ */
457
+ function getValidationSuggestionAcceptApiPath(workspaceId, suggestionId) {
458
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/suggestions/${suggestionId}/accept`;
459
+ }
460
+ /**
461
+ * Generate Validation suggestion reject API URL PATH.
462
+ */
463
+ function getValidationSuggestionRejectApiPath(workspaceId, suggestionId) {
464
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/suggestions/${suggestionId}/reject`;
465
+ }
466
+ /**
467
+ * Generate Validation bulk accept API URL PATH.
468
+ */
469
+ function getValidationBulkAcceptApiPath(workspaceId) {
470
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/suggestions/bulk-accept`;
471
+ }
472
+ /**
473
+ * Generate Validation bulk reject API URL PATH.
474
+ */
475
+ function getValidationBulkRejectApiPath(workspaceId) {
476
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/suggestions/bulk-reject`;
477
+ }
478
+ /**
479
+ * Generate Validation summary API URL PATH.
480
+ */
481
+ function getValidationSummaryApiPath(workspaceId) {
482
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/summary`;
483
+ }
484
+ /**
485
+ * Generate Validation record suggestions API URL PATH.
486
+ */
487
+ function getValidationRecordSuggestionsApiPath(workspaceId, recordId) {
488
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/records/${recordId}/suggestions`;
489
+ }
490
+ /**
491
+ * Generate Validation structure pending count API URL PATH.
492
+ */
493
+ function getValidationPendingCountApiPath(workspaceId, structureId) {
494
+ return `data/workspace/${workspaceId}/api/v1/ai/validation/structures/${structureId}/pending-count`;
495
+ }
496
+ /**
497
+ * Generate Validation batch scan API URL PATH (AI Service).
498
+ * Note: This routes to the AI service, not the Data service.
499
+ */
500
+ function getValidationScanApiPath(workspaceId, batchId) {
501
+ const basePath = `ai/workspace/${workspaceId}/api/v1/validate/scan`;
502
+ return batchId ? `${basePath}/${batchId}` : basePath;
503
+ }
385
504
  // =====================================================
386
505
  // Triggers Manager
387
506
  // =====================================================
@@ -663,6 +782,425 @@ class SmartQueriesManager {
663
782
  }
664
783
  }
665
784
  exports.SmartQueriesManager = SmartQueriesManager;
785
+ // =====================================================
786
+ // Anomaly Insights Manager
787
+ // =====================================================
788
+ /**
789
+ * AnomalyInsightsManager provides methods for querying and managing AI-generated anomaly insights.
790
+ * Access via `client.anomalyInsights`.
791
+ *
792
+ * Usage:
793
+ * ```ts
794
+ * // List all active insights
795
+ * const insights = await client.anomalyInsights.list({ status: 'active' });
796
+ *
797
+ * // Get insights for a specific structure
798
+ * const orderInsights = await client.anomalyInsights.listByStructure('orders');
799
+ *
800
+ * // Get insight summary
801
+ * const summary = await client.anomalyInsights.getSummary();
802
+ *
803
+ * // Acknowledge an insight
804
+ * await client.anomalyInsights.acknowledge('insight-id');
805
+ *
806
+ * // Dismiss an insight
807
+ * await client.anomalyInsights.dismiss('insight-id');
808
+ * ```
809
+ */
810
+ class AnomalyInsightsManager {
811
+ constructor(workspaceId, requestFn) {
812
+ this.workspaceId = workspaceId;
813
+ this.requestFn = requestFn;
814
+ }
815
+ /**
816
+ * List anomaly insights with optional filters.
817
+ *
818
+ * @param options - Optional filter and pagination options
819
+ * @returns List of anomaly insights
820
+ *
821
+ * @example
822
+ * ```ts
823
+ * // List all active critical insights
824
+ * const insights = await client.anomalyInsights.list({
825
+ * status: 'active',
826
+ * severity: 'critical'
827
+ * });
828
+ *
829
+ * // List insights for a specific structure
830
+ * const orderInsights = await client.anomalyInsights.list({
831
+ * structureSlug: 'orders'
832
+ * });
833
+ * ```
834
+ */
835
+ list(options) {
836
+ const path = getAnomalyInsightsApiPath(this.workspaceId);
837
+ return this.requestFn('GET', path, null, options);
838
+ }
839
+ /**
840
+ * List insights for a specific structure.
841
+ *
842
+ * @param structureSlug - The structure's record slug
843
+ * @param options - Optional filter options
844
+ * @returns List of insights for the structure
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * const insights = await client.anomalyInsights.listByStructure('orders');
849
+ * ```
850
+ */
851
+ listByStructure(structureSlug, options) {
852
+ const path = getStructureInsightsApiPath(this.workspaceId, structureSlug);
853
+ return this.requestFn('GET', path, null, options);
854
+ }
855
+ /**
856
+ * Get a single insight by ID.
857
+ *
858
+ * @param insightId - The insight UUID
859
+ * @returns The insight details
860
+ *
861
+ * @example
862
+ * ```ts
863
+ * const insight = await client.anomalyInsights.get('insight-id');
864
+ * console.log('Insight:', insight.data.title);
865
+ * ```
866
+ */
867
+ get(insightId) {
868
+ const path = getAnomalyInsightsApiPath(this.workspaceId, insightId);
869
+ return this.requestFn('GET', path);
870
+ }
871
+ /**
872
+ * Acknowledge an insight.
873
+ * Marks the insight as reviewed/handled.
874
+ *
875
+ * @param insightId - The insight UUID
876
+ * @returns The updated insight
877
+ *
878
+ * @example
879
+ * ```ts
880
+ * await client.anomalyInsights.acknowledge('insight-id');
881
+ * ```
882
+ */
883
+ acknowledge(insightId) {
884
+ const path = getAnomalyInsightAcknowledgeApiPath(this.workspaceId, insightId);
885
+ return this.requestFn('POST', path);
886
+ }
887
+ /**
888
+ * Dismiss an insight.
889
+ * Marks the insight as not relevant/false positive.
890
+ *
891
+ * @param insightId - The insight UUID
892
+ * @returns The updated insight
893
+ *
894
+ * @example
895
+ * ```ts
896
+ * await client.anomalyInsights.dismiss('insight-id');
897
+ * ```
898
+ */
899
+ dismiss(insightId) {
900
+ const path = getAnomalyInsightDismissApiPath(this.workspaceId, insightId);
901
+ return this.requestFn('POST', path);
902
+ }
903
+ /**
904
+ * Bulk acknowledge multiple insights.
905
+ *
906
+ * @param ids - Array of insight IDs to acknowledge
907
+ * @returns Result with count of updated insights
908
+ *
909
+ * @example
910
+ * ```ts
911
+ * const result = await client.anomalyInsights.bulkAcknowledge(['id1', 'id2']);
912
+ * console.log('Acknowledged:', result.data.updated);
913
+ * ```
914
+ */
915
+ bulkAcknowledge(ids) {
916
+ const path = getAnomalyInsightsBulkAcknowledgeApiPath(this.workspaceId);
917
+ return this.requestFn('POST', path, { ids });
918
+ }
919
+ /**
920
+ * Get insights summary/statistics.
921
+ *
922
+ * @param structureSlug - Optional structure to filter summary
923
+ * @returns Summary of insights by status and severity
924
+ *
925
+ * @example
926
+ * ```ts
927
+ * // Get overall summary
928
+ * const summary = await client.anomalyInsights.getSummary();
929
+ * console.log('Critical insights:', summary.data.bySeverity.critical);
930
+ *
931
+ * // Get summary for a specific structure
932
+ * const orderSummary = await client.anomalyInsights.getSummary('orders');
933
+ * ```
934
+ */
935
+ getSummary(structureSlug) {
936
+ const path = getAnomalyInsightsSummaryApiPath(this.workspaceId);
937
+ const params = structureSlug ? { structureSlug } : undefined;
938
+ return this.requestFn('GET', path, null, params);
939
+ }
940
+ /**
941
+ * Trigger anomaly analysis for a structure.
942
+ * Starts an AI-powered analysis to detect anomalies in the structure's data.
943
+ *
944
+ * @param structureSlug - The structure's record slug to analyze
945
+ * @returns Result indicating if analysis was triggered and the batch ID
946
+ *
947
+ * @example
948
+ * ```ts
949
+ * const result = await client.anomalyInsights.triggerAnalysis('orders');
950
+ * if (result.data.success) {
951
+ * console.log('Analysis started:', result.data.batchId);
952
+ * }
953
+ * ```
954
+ */
955
+ triggerAnalysis(structureSlug) {
956
+ const path = getAnomalyAnalysisTriggerApiPath(this.workspaceId);
957
+ return this.requestFn('POST', path, { structureSlug });
958
+ }
959
+ }
960
+ exports.AnomalyInsightsManager = AnomalyInsightsManager;
961
+ // =====================================================
962
+ // Validation Manager (Data Quality)
963
+ // =====================================================
964
+ /**
965
+ * ValidationManager provides methods for AI-powered data quality validation.
966
+ * Access via `client.validation`.
967
+ *
968
+ * Features:
969
+ * - Trigger batch validation scans on structures
970
+ * - List and manage validation suggestions (typos, format issues, duplicates)
971
+ * - Accept or reject suggestions to fix data
972
+ * - Get validation summaries and statistics
973
+ *
974
+ * Usage:
975
+ * ```ts
976
+ * // Trigger a batch scan
977
+ * const batch = await client.validation.triggerScan('orders');
978
+ * console.log('Scan started:', batch.data.batchId);
979
+ *
980
+ * // Wait for completion
981
+ * const result = await client.validation.waitForScan(batch.data.batchId);
982
+ *
983
+ * // List pending suggestions
984
+ * const suggestions = await client.validation.listSuggestions({ status: 'pending' });
985
+ *
986
+ * // Accept a suggestion (applies the fix)
987
+ * await client.validation.accept('suggestion-id');
988
+ *
989
+ * // Bulk accept high-confidence suggestions
990
+ * const highConfidence = suggestions.data.filter(s => s.confidence >= 0.95);
991
+ * await client.validation.bulkAccept(highConfidence.map(s => s.id));
992
+ * ```
993
+ */
994
+ class ValidationManager {
995
+ constructor(workspaceId, requestFn) {
996
+ this.workspaceId = workspaceId;
997
+ this.requestFn = requestFn;
998
+ }
999
+ /**
1000
+ * Trigger a batch validation scan on a structure.
1001
+ *
1002
+ * @param structureSlug - The structure's slug to scan
1003
+ * @param options - Optional scan configuration
1004
+ * @returns The batch scan result with batchId for tracking
1005
+ *
1006
+ * @example
1007
+ * ```ts
1008
+ * const batch = await client.validation.triggerScan('orders');
1009
+ * console.log('Batch ID:', batch.data.batchId);
1010
+ * console.log('Records to scan:', batch.data.total);
1011
+ * ```
1012
+ */
1013
+ triggerScan(structureSlug, options) {
1014
+ const path = getValidationScanApiPath(this.workspaceId);
1015
+ // Note: workspaceSlug is in URL path, not body
1016
+ return this.requestFn('POST', path, {
1017
+ structureSlug,
1018
+ validationTypes: options === null || options === void 0 ? void 0 : options.validationTypes,
1019
+ });
1020
+ }
1021
+ /**
1022
+ * Get the status of a batch validation scan.
1023
+ *
1024
+ * @param batchId - The batch scan ID
1025
+ * @returns Current scan status and progress
1026
+ *
1027
+ * @example
1028
+ * ```ts
1029
+ * const status = await client.validation.getScanStatus('batch-id');
1030
+ * console.log('Progress:', status.data.processed, '/', status.data.total);
1031
+ * ```
1032
+ */
1033
+ getScanStatus(batchId) {
1034
+ const path = getValidationScanApiPath(this.workspaceId, batchId);
1035
+ return this.requestFn('GET', path);
1036
+ }
1037
+ /**
1038
+ * Wait for a batch scan to complete with polling.
1039
+ *
1040
+ * @param batchId - The batch scan ID
1041
+ * @param options - Polling configuration
1042
+ * @returns The final scan result
1043
+ * @throws Error if scan fails or times out
1044
+ *
1045
+ * @example
1046
+ * ```ts
1047
+ * const result = await client.validation.waitForScan('batch-id', {
1048
+ * pollInterval: 5000, // 5 seconds
1049
+ * timeout: 300000 // 5 minutes
1050
+ * });
1051
+ * console.log('Scan complete:', result.data.issuesFound, 'issues found');
1052
+ * ```
1053
+ */
1054
+ waitForScan(batchId, options) {
1055
+ return __awaiter(this, void 0, void 0, function* () {
1056
+ var _a, _b;
1057
+ const pollInterval = (_a = options === null || options === void 0 ? void 0 : options.pollInterval) !== null && _a !== void 0 ? _a : 5000;
1058
+ const timeout = (_b = options === null || options === void 0 ? void 0 : options.timeout) !== null && _b !== void 0 ? _b : 300000;
1059
+ const startTime = Date.now();
1060
+ while (true) {
1061
+ const result = yield this.getScanStatus(batchId);
1062
+ const status = result.data.status;
1063
+ if (status === 'completed') {
1064
+ return result;
1065
+ }
1066
+ if (status === 'failed') {
1067
+ throw new Error(`Scan failed: ${result.data.error || 'Unknown error'}`);
1068
+ }
1069
+ if (Date.now() - startTime > timeout) {
1070
+ throw new Error(`Scan timed out after ${timeout}ms`);
1071
+ }
1072
+ yield new Promise(resolve => setTimeout(resolve, pollInterval));
1073
+ }
1074
+ });
1075
+ }
1076
+ /**
1077
+ * List validation suggestions with optional filters.
1078
+ *
1079
+ * @param options - Filter and pagination options
1080
+ * @returns List of validation suggestions
1081
+ *
1082
+ * @example
1083
+ * ```ts
1084
+ * // List all pending suggestions
1085
+ * const pending = await client.validation.listSuggestions({ status: 'pending' });
1086
+ *
1087
+ * // List high-confidence typo suggestions
1088
+ * const typos = await client.validation.listSuggestions({
1089
+ * issueType: 'typo',
1090
+ * minConfidence: 0.9
1091
+ * });
1092
+ * ```
1093
+ */
1094
+ listSuggestions(options) {
1095
+ const path = getValidationSuggestionsApiPath(this.workspaceId);
1096
+ return this.requestFn('GET', path, null, options);
1097
+ }
1098
+ /**
1099
+ * Get a single validation suggestion by ID.
1100
+ *
1101
+ * @param suggestionId - The suggestion UUID
1102
+ * @returns The suggestion details
1103
+ */
1104
+ getSuggestion(suggestionId) {
1105
+ const path = getValidationSuggestionsApiPath(this.workspaceId, suggestionId);
1106
+ return this.requestFn('GET', path);
1107
+ }
1108
+ /**
1109
+ * Get all suggestions for a specific record.
1110
+ *
1111
+ * @param recordId - The record UUID
1112
+ * @param status - Optional status filter
1113
+ * @returns List of suggestions for the record
1114
+ */
1115
+ getRecordSuggestions(recordId, status) {
1116
+ const path = getValidationRecordSuggestionsApiPath(this.workspaceId, recordId);
1117
+ const params = status ? { status } : undefined;
1118
+ return this.requestFn('GET', path, null, params);
1119
+ }
1120
+ /**
1121
+ * Accept a validation suggestion and apply the fix to the record.
1122
+ *
1123
+ * @param suggestionId - The suggestion UUID
1124
+ * @returns Result with updated suggestion and record status
1125
+ *
1126
+ * @example
1127
+ * ```ts
1128
+ * const result = await client.validation.accept('suggestion-id');
1129
+ * if (result.data.recordUpdated) {
1130
+ * console.log('Fix applied successfully');
1131
+ * }
1132
+ * ```
1133
+ */
1134
+ accept(suggestionId) {
1135
+ const path = getValidationSuggestionAcceptApiPath(this.workspaceId, suggestionId);
1136
+ return this.requestFn('POST', path);
1137
+ }
1138
+ /**
1139
+ * Reject a validation suggestion.
1140
+ *
1141
+ * @param suggestionId - The suggestion UUID
1142
+ * @returns The updated suggestion
1143
+ */
1144
+ reject(suggestionId) {
1145
+ const path = getValidationSuggestionRejectApiPath(this.workspaceId, suggestionId);
1146
+ return this.requestFn('POST', path);
1147
+ }
1148
+ /**
1149
+ * Bulk accept multiple suggestions.
1150
+ *
1151
+ * @param ids - Array of suggestion IDs to accept (max 100)
1152
+ * @returns Result with count and any errors
1153
+ *
1154
+ * @example
1155
+ * ```ts
1156
+ * const result = await client.validation.bulkAccept(['id1', 'id2', 'id3']);
1157
+ * console.log('Accepted:', result.data.count);
1158
+ * ```
1159
+ */
1160
+ bulkAccept(ids) {
1161
+ const path = getValidationBulkAcceptApiPath(this.workspaceId);
1162
+ return this.requestFn('POST', path, { ids });
1163
+ }
1164
+ /**
1165
+ * Bulk reject multiple suggestions.
1166
+ *
1167
+ * @param ids - Array of suggestion IDs to reject (max 100)
1168
+ * @returns Result with count and any errors
1169
+ */
1170
+ bulkReject(ids) {
1171
+ const path = getValidationBulkRejectApiPath(this.workspaceId);
1172
+ return this.requestFn('POST', path, { ids });
1173
+ }
1174
+ /**
1175
+ * Get validation summary statistics.
1176
+ *
1177
+ * @param structureId - Optional structure ID to filter summary
1178
+ * @returns Summary of suggestions by status and type
1179
+ *
1180
+ * @example
1181
+ * ```ts
1182
+ * const summary = await client.validation.getSummary();
1183
+ * console.log('Pending:', summary.data.pending);
1184
+ * console.log('By type:', summary.data.byIssueType);
1185
+ * ```
1186
+ */
1187
+ getSummary(structureId) {
1188
+ const path = getValidationSummaryApiPath(this.workspaceId);
1189
+ const params = structureId ? { structureId } : undefined;
1190
+ return this.requestFn('GET', path, null, params);
1191
+ }
1192
+ /**
1193
+ * Get the count of pending suggestions for a structure.
1194
+ *
1195
+ * @param structureId - The structure UUID
1196
+ * @returns Object with pending count
1197
+ */
1198
+ getPendingCount(structureId) {
1199
+ const path = getValidationPendingCountApiPath(this.workspaceId, structureId);
1200
+ return this.requestFn('GET', path);
1201
+ }
1202
+ }
1203
+ exports.ValidationManager = ValidationManager;
666
1204
  /**
667
1205
  * Main Centrali SDK client.
668
1206
  */
@@ -672,6 +1210,8 @@ class CentraliSDK {
672
1210
  this._realtime = null;
673
1211
  this._triggers = null;
674
1212
  this._smartQueries = null;
1213
+ this._anomalyInsights = null;
1214
+ this._validation = null;
675
1215
  this.options = options;
676
1216
  this.token = options.token || null;
677
1217
  const apiUrl = getApiUrl(options.baseUrl);
@@ -782,6 +1322,66 @@ class CentraliSDK {
782
1322
  }
783
1323
  return this._smartQueries;
784
1324
  }
1325
+ /**
1326
+ * Anomaly Insights namespace for querying and managing AI-generated insights.
1327
+ *
1328
+ * Usage:
1329
+ * ```ts
1330
+ * // List all active critical insights
1331
+ * const insights = await client.anomalyInsights.list({
1332
+ * status: 'active',
1333
+ * severity: 'critical'
1334
+ * });
1335
+ *
1336
+ * // Get insights for a specific structure
1337
+ * const orderInsights = await client.anomalyInsights.listByStructure('orders');
1338
+ *
1339
+ * // Get insight summary
1340
+ * const summary = await client.anomalyInsights.getSummary();
1341
+ * console.log('Critical:', summary.data.bySeverity.critical);
1342
+ *
1343
+ * // Acknowledge an insight
1344
+ * await client.anomalyInsights.acknowledge('insight-id');
1345
+ *
1346
+ * // Dismiss an insight
1347
+ * await client.anomalyInsights.dismiss('insight-id');
1348
+ * ```
1349
+ */
1350
+ get anomalyInsights() {
1351
+ if (!this._anomalyInsights) {
1352
+ this._anomalyInsights = new AnomalyInsightsManager(this.options.workspaceId, this.request.bind(this));
1353
+ }
1354
+ return this._anomalyInsights;
1355
+ }
1356
+ /**
1357
+ * Validation namespace for AI-powered data quality validation.
1358
+ *
1359
+ * Features:
1360
+ * - Trigger batch validation scans on structures
1361
+ * - List and manage validation suggestions (typos, format issues, duplicates)
1362
+ * - Accept or reject suggestions to fix data
1363
+ *
1364
+ * Usage:
1365
+ * ```ts
1366
+ * // Trigger a batch scan
1367
+ * const batch = await client.validation.triggerScan('orders');
1368
+ *
1369
+ * // Wait for completion
1370
+ * const result = await client.validation.waitForScan(batch.data.batchId);
1371
+ *
1372
+ * // List pending suggestions
1373
+ * const suggestions = await client.validation.listSuggestions({ status: 'pending' });
1374
+ *
1375
+ * // Accept a suggestion (applies the fix)
1376
+ * await client.validation.accept('suggestion-id');
1377
+ * ```
1378
+ */
1379
+ get validation() {
1380
+ if (!this._validation) {
1381
+ this._validation = new ValidationManager(this.options.workspaceId, this.request.bind(this));
1382
+ }
1383
+ return this._validation;
1384
+ }
785
1385
  /**
786
1386
  * Manually set or update the bearer token for subsequent requests.
787
1387
  */