snow-flow 3.0.9 โ 3.0.13
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/claude-flow.bat +0 -0
- package/claude-flow.ps1 +0 -0
- package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
- package/dist/mcp/intelligent-reporting-mcp.js +379 -0
- package/dist/mcp/servicenow-automation-mcp.js +0 -0
- package/dist/mcp/servicenow-deployment-mcp.js +0 -0
- package/dist/mcp/servicenow-integration-mcp.js +0 -0
- package/dist/mcp/servicenow-mcp-server.js +0 -0
- package/dist/mcp/servicenow-operations-mcp.js +0 -0
- package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
- package/dist/mcp/servicenow-progressive-indexer.js +0 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
- package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
- package/dist/mcp/servicenow-update-set-mcp.js +0 -0
- package/dist/mcp/start-all-mcp-servers.js +0 -0
- package/dist/mcp/start-servicenow-mcp.js +0 -0
- package/dist/services/widget-deployment-service.d.ts +2 -1
- package/dist/services/widget-deployment-service.js +17 -16
- package/dist/utils/anti-mock-data-validator.d.ts +66 -0
- package/dist/utils/anti-mock-data-validator.js +316 -0
- package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
- package/dist/utils/servicenow-eventual-consistency.js +220 -0
- package/memory/agents/README.md +1 -1
- package/memory/claude-flow-data.json +1 -1
- package/memory/sessions/README.md +1 -1
- package/package.json +4 -3
- package/.mcp.json +0 -22
- package/claude-flow.config.json +0 -20
- package/dist/agents/app-creator.agent.d.ts +0 -55
- package/dist/agents/app-creator.agent.js +0 -1292
- package/dist/agents/base/base-snow-agent.d.ts +0 -75
- package/dist/agents/base/base-snow-agent.js +0 -169
- package/dist/agents/base-snow-agent.d.ts +0 -63
- package/dist/agents/base-snow-agent.js +0 -296
- package/dist/agents/coordinator.d.ts +0 -200
- package/dist/agents/coordinator.js +0 -777
- package/dist/agents/flow-builder-agent.d.ts +0 -18
- package/dist/agents/flow-builder-agent.js +0 -197
- package/dist/agents/queen-403-handler.d.ts +0 -47
- package/dist/agents/queen-403-handler.js +0 -175
- package/dist/agents/queen-agent-example.d.ts +0 -23
- package/dist/agents/queen-agent-example.js +0 -240
- package/dist/agents/queen-agent.test.d.ts +0 -6
- package/dist/agents/script-generator.agent.d.ts +0 -32
- package/dist/agents/script-generator.agent.js +0 -772
- package/dist/agents/script-writer-agent.d.ts +0 -22
- package/dist/agents/script-writer-agent.js +0 -695
- package/dist/agents/security-agent.d.ts +0 -23
- package/dist/agents/security-agent.js +0 -619
- package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
- package/dist/agents/specialists/automation-specialist.agent.js +0 -204
- package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
- package/dist/agents/specialists/data-specialist.agent.js +0 -484
- package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
- package/dist/agents/specialists/integration-specialist.agent.js +0 -725
- package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
- package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
- package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
- package/dist/agents/specialists/security-specialist.agent.js +0 -309
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
- package/dist/agents/teams/base-team.d.ts +0 -72
- package/dist/agents/teams/base-team.js +0 -253
- package/dist/agents/teams/team-types.d.ts +0 -265
- package/dist/agents/teams/team-types.js +0 -3
- package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
- package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
- package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
- package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
- package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
- package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
- package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
- package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
- package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
- package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
- package/dist/agents/test-agent.d.ts +0 -26
- package/dist/agents/test-agent.js +0 -734
- package/dist/agents/test-agents.d.ts +0 -7
- package/dist/agents/test-agents.js +0 -64
- package/dist/agents/ui-builder.agent.d.ts +0 -50
- package/dist/agents/ui-builder.agent.js +0 -1539
- package/dist/agents/widget-builder.agent.d.ts +0 -32
- package/dist/agents/widget-builder.agent.js +0 -439
- package/dist/agents/widget-creator-agent.d.ts +0 -18
- package/dist/agents/widget-creator-agent.js +0 -498
- package/dist/agents/workflow-designer.agent.d.ts +0 -31
- package/dist/agents/workflow-designer.agent.js +0 -583
- package/dist/api/error-handling.d.ts +0 -325
- package/dist/api/error-handling.js +0 -1488
- package/dist/api/flow-designer-api.d.ts +0 -167
- package/dist/api/flow-designer-api.js +0 -554
- package/dist/api/natural-language-mapper.d.ts +0 -124
- package/dist/api/natural-language-mapper.js +0 -501
- package/dist/api/performance-optimizer.d.ts +0 -240
- package/dist/api/performance-optimizer.js +0 -706
- package/dist/api/transaction-manager.d.ts +0 -189
- package/dist/api/transaction-manager.js +0 -576
- package/dist/assembly/team-assembler.d.ts +0 -140
- package/dist/assembly/team-assembler.js +0 -502
- package/dist/benchmark-performance.d.ts +0 -41
- package/dist/benchmark-performance.js +0 -230
- package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
- package/dist/cli/snow-flow-cli-integration.js +0 -396
- package/dist/coordination/coordination-engine.d.ts +0 -41
- package/dist/coordination/coordination-engine.js +0 -324
- package/dist/coordination/coordination.test.d.ts +0 -6
- package/dist/coordination/example.d.ts +0 -31
- package/dist/coordination/example.js +0 -394
- package/dist/coordination/execution-patterns.d.ts +0 -43
- package/dist/coordination/execution-patterns.js +0 -507
- package/dist/coordination/factory.d.ts +0 -94
- package/dist/coordination/factory.js +0 -433
- package/dist/coordination/index.d.ts +0 -71
- package/dist/coordination/index.js +0 -135
- package/dist/coordination/progress-monitor.d.ts +0 -71
- package/dist/coordination/progress-monitor.js +0 -505
- package/dist/coordination/quality-gates.d.ts +0 -124
- package/dist/coordination/quality-gates.js +0 -577
- package/dist/coordination/shared-memory.d.ts +0 -39
- package/dist/coordination/shared-memory.js +0 -289
- package/dist/coordination/task-dependencies.d.ts +0 -50
- package/dist/coordination/task-dependencies.js +0 -407
- package/dist/coordination/team-coordinator.d.ts +0 -59
- package/dist/coordination/team-coordinator.js +0 -550
- package/dist/coordination/types.d.ts +0 -152
- package/dist/coordination/types.js +0 -3
- package/dist/mcp/mcp-wrapper.d.ts +0 -8
- package/dist/mcp/mcp-wrapper.js +0 -77
- package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
- package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
- package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
- package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
- package/dist/mcp/singleton-check.js +0 -31
- package/dist/mcp/test-simple-mcp.d.ts +0 -6
- package/dist/mcp/test-simple-mcp.js +0 -63
- package/dist/memory/hierarchical-memory-system.d.ts +0 -90
- package/dist/memory/hierarchical-memory-system.js +0 -400
- package/dist/memory/index.d.ts +0 -9
- package/dist/memory/index.js +0 -20
- package/dist/memory/mcp-integration-example.d.ts +0 -6
- package/dist/memory/mcp-integration-example.js +0 -281
- package/dist/memory/memory-client.d.ts +0 -199
- package/dist/memory/memory-client.js +0 -364
- package/dist/memory/memory-manager.d.ts +0 -29
- package/dist/memory/memory-manager.js +0 -280
- package/dist/memory/memory-operations.d.ts +0 -179
- package/dist/memory/memory-operations.js +0 -691
- package/dist/memory/memory-system.d.ts +0 -153
- package/dist/memory/memory-system.js +0 -651
- package/dist/memory/memory-test.d.ts +0 -6
- package/dist/memory/memory-test.js +0 -161
- package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
- package/dist/memory/snow-flow-memory-patterns.js +0 -200
- package/dist/memory/snow-memory.d.ts +0 -54
- package/dist/memory/snow-memory.js +0 -301
- package/dist/memory/swarm-memory.d.ts +0 -135
- package/dist/memory/swarm-memory.js +0 -378
- package/dist/optimization/flow-performance-optimizer.js +0 -723
- package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
- package/dist/orchestration/discovery/service-discovery.js +0 -808
- package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
- package/dist/orchestration/distributed-orchestrator.js +0 -712
- package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
- package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
- package/dist/orchestration/flow-update-orchestrator.js +0 -648
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
- package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
- package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
- package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
- package/dist/orchestration/state/distributed-state-manager.js +0 -716
- package/dist/orchestrator/flow-composer.d.ts +0 -105
- package/dist/orchestrator/flow-composer.js +0 -404
- package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
- package/dist/orchestrator/flow-pattern-templates.js +0 -908
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
- package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
- package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
- package/dist/orchestrator/flow-validation-engine.js +0 -913
- package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
- package/dist/orchestrator/snow-orchestrator.js +0 -235
- package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
- package/dist/orchestrator/subflow-creation-handler.js +0 -791
- package/dist/patterns/adaptive-patterns.d.ts +0 -140
- package/dist/patterns/adaptive-patterns.js +0 -549
- package/dist/queen/advanced-integration-test.d.ts +0 -48
- package/dist/queen/advanced-integration-test.js +0 -473
- package/dist/queen/integration-example.d.ts +0 -82
- package/dist/queen/integration-example.js +0 -219
- package/dist/queen/integration-test.d.ts +0 -72
- package/dist/queen/integration-test.js +0 -563
- package/dist/queen/mock-mcp-client.d.ts +0 -71
- package/dist/queen/mock-mcp-client.js +0 -317
- package/dist/queen/run-integration-tests.d.ts +0 -9
- package/dist/queen/run-integration-tests.js +0 -27
- package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
- package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
- package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
- package/dist/sparc/coordinators/team-coordinator.js +0 -402
- package/dist/sparc/modes/team-modes.d.ts +0 -33
- package/dist/sparc/modes/team-modes.js +0 -399
- package/dist/sparc/teams/application-team.d.ts +0 -73
- package/dist/sparc/teams/application-team.js +0 -463
- package/dist/sparc/teams/flow-team.d.ts +0 -67
- package/dist/sparc/teams/flow-team.js +0 -373
- package/dist/sparc/teams/widget-team.d.ts +0 -61
- package/dist/sparc/teams/widget-team.js +0 -280
- package/dist/specialists/app-specialists.d.ts +0 -93
- package/dist/specialists/app-specialists.js +0 -1639
- package/dist/specialists/base-specialist.d.ts +0 -19
- package/dist/specialists/base-specialist.js +0 -54
- package/dist/specialists/flow-specialists.d.ts +0 -113
- package/dist/specialists/flow-specialists.js +0 -1787
- package/dist/specialists/individual-specialists.d.ts +0 -67
- package/dist/specialists/individual-specialists.js +0 -632
- package/dist/specialists/widget-specialists.d.ts +0 -70
- package/dist/specialists/widget-specialists.js +0 -1264
- package/dist/src/utils/agent-detector.js +0 -655
- package/dist/teams/adaptive-team.d.ts +0 -81
- package/dist/teams/adaptive-team.js +0 -1153
- package/dist/teams/application-team.d.ts +0 -30
- package/dist/teams/application-team.js +0 -547
- package/dist/teams/base-team.d.ts +0 -55
- package/dist/teams/base-team.js +0 -243
- package/dist/teams/flow-team.d.ts +0 -28
- package/dist/teams/flow-team.js +0 -525
- package/dist/teams/widget-team.d.ts +0 -26
- package/dist/teams/widget-team.js +0 -459
- package/dist/templates/flow-template-system.js +0 -625
- package/dist/test-fetch-incidents.d.ts +0 -2
- package/dist/test-fetch-incidents.js +0 -84
- package/dist/test-incident-access.d.ts +0 -2
- package/dist/test-incident-access.js +0 -72
- package/dist/test-iphone-flow.js +0 -189
- package/dist/test-limit-problem.d.ts +0 -2
- package/dist/test-limit-problem.js +0 -60
- package/dist/test-ml-batch-fix.d.ts +0 -2
- package/dist/test-ml-batch-fix.js +0 -104
- package/dist/test-ml-batch.d.ts +0 -2
- package/dist/test-ml-batch.js +0 -87
- package/dist/test-ml-query.d.ts +0 -2
- package/dist/test-ml-query.js +0 -100
- package/dist/test-ml-training-fix.d.ts +0 -12
- package/dist/test-ml-training-fix.js +0 -113
- package/dist/test-ml-training.d.ts +0 -2
- package/dist/test-ml-training.js +0 -32
- package/dist/test-operations-query.d.ts +0 -2
- package/dist/test-operations-query.js +0 -84
- package/dist/test-performance-query.d.ts +0 -2
- package/dist/test-performance-query.js +0 -52
- package/dist/test-singleton-protection.d.ts +0 -8
- package/dist/test-singleton-protection.js +0 -110
- package/dist/test-smart-limits.d.ts +0 -13
- package/dist/test-smart-limits.js +0 -100
- package/dist/test-snow-query-incidents.d.ts +0 -2
- package/dist/test-snow-query-incidents.js +0 -66
- package/dist/test-universal-query.d.ts +0 -2
- package/dist/test-universal-query.js +0 -106
- package/dist/testing/flow-testing-automation.js +0 -641
- package/dist/utils/complete-flow-xml-generator.js +0 -1285
- package/dist/utils/file-storage-fallback.d.ts +0 -62
- package/dist/utils/file-storage-fallback.js +0 -289
- package/dist/utils/flow-api-discovery.d.ts +0 -151
- package/dist/utils/flow-api-discovery.js +0 -439
- package/dist/utils/flow-examples.js +0 -720
- package/dist/utils/flow-structure-builder.js +0 -677
- package/dist/utils/flow-xml-generator.d.ts +0 -41
- package/dist/utils/flow-xml-generator.js +0 -258
- package/dist/utils/improved-flow-xml-generator.js +0 -820
- package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
- package/dist/utils/mcp-process-manager.backup.js +0 -220
- package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
- package/dist/utils/mcp-singleton-enforcer.js +0 -201
- package/dist/utils/mcp-timeout-fix.d.ts +0 -53
- package/dist/utils/mcp-timeout-fix.js +0 -221
- package/dist/utils/migrate-claude-flow.d.ts +0 -22
- package/dist/utils/migrate-claude-flow.js +0 -120
- package/dist/utils/scope-utils.d.ts +0 -72
- package/dist/utils/scope-utils.js +0 -386
- package/dist/utils/snow-oauth-old.d.ts +0 -65
- package/dist/utils/snow-oauth-old.js +0 -345
- package/dist/utils/xml-first-flow-generator.js +0 -513
- package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
- package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
- package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
- package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
- package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
- package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
- package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
- package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
- package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
- package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
- package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
- package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
- package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
- package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
- package/reports/swarm-auto-centralized-1752649029776.json +0 -13
- package/src/memory/README.md +0 -240
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
// Test fetchIncidentData like the ML MCP does
|
|
6
|
-
async function testFetchIncidents() {
|
|
7
|
-
const logger = new logger_js_1.Logger('FetchIncidentsTest');
|
|
8
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
9
|
-
console.log('๐ฅ Testing fetchIncidentData with 2000 samples...');
|
|
10
|
-
// Simulate exactly what the ML MCP fetchIncidentData method does
|
|
11
|
-
const sample_size = 2000;
|
|
12
|
-
const intelligent_selection = true;
|
|
13
|
-
const focus_categories = [];
|
|
14
|
-
const query = '';
|
|
15
|
-
let finalQuery = query;
|
|
16
|
-
// If intelligent selection is enabled and no custom query provided
|
|
17
|
-
if (intelligent_selection && !query) {
|
|
18
|
-
// Build an intelligent query that gets a balanced dataset
|
|
19
|
-
const queries = [];
|
|
20
|
-
// Get mix of recent and older incidents
|
|
21
|
-
queries.push('sys_created_onONLast 6 months');
|
|
22
|
-
// Get mix of priorities
|
|
23
|
-
queries.push('(priority=1^ORpriority=2^ORpriority=3^ORpriority=4)');
|
|
24
|
-
// Get mix of active and resolved
|
|
25
|
-
queries.push('(active=true^ORactive=false)');
|
|
26
|
-
// Focus on specific categories if provided
|
|
27
|
-
if (focus_categories.length > 0) {
|
|
28
|
-
const categoryQuery = focus_categories.map(cat => `category=${cat}`).join('^OR');
|
|
29
|
-
queries.push(`(${categoryQuery})`);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// Get diverse categories
|
|
33
|
-
queries.push('categoryISNOTEMPTY');
|
|
34
|
-
}
|
|
35
|
-
// Combine all queries
|
|
36
|
-
finalQuery = queries.join('^');
|
|
37
|
-
logger.info(`Using intelligent query selection: ${finalQuery}`);
|
|
38
|
-
}
|
|
39
|
-
else if (query) {
|
|
40
|
-
logger.info(`Using custom query: ${query}`);
|
|
41
|
-
}
|
|
42
|
-
// Always order by sys_created_on DESC to get most recent first
|
|
43
|
-
if (finalQuery && !finalQuery.includes('ORDERBY')) {
|
|
44
|
-
finalQuery += '^ORDERBYDESCsys_created_on';
|
|
45
|
-
}
|
|
46
|
-
else if (!finalQuery) {
|
|
47
|
-
finalQuery = 'ORDERBYDESCsys_created_on';
|
|
48
|
-
}
|
|
49
|
-
logger.info(`Attempting to fetch ${sample_size} incidents with query: ${finalQuery}`);
|
|
50
|
-
try {
|
|
51
|
-
// ๐ด CRITICAL: Use the actual sample_size parameter, not default of 10
|
|
52
|
-
const response = await client.searchRecords('incident', finalQuery, sample_size);
|
|
53
|
-
if (!response.success || !response.data?.result) {
|
|
54
|
-
throw new Error('Failed to fetch incident data. Ensure you have read access to the incident table.');
|
|
55
|
-
}
|
|
56
|
-
logger.info(`โ
SUCCESS: Fetched ${response.data.result.length} incidents for ML training (requested: ${sample_size})`);
|
|
57
|
-
// Show data distribution like the ML MCP does
|
|
58
|
-
if (response.data.result.length > 0) {
|
|
59
|
-
const categoryDistribution = {};
|
|
60
|
-
const priorityDistribution = {};
|
|
61
|
-
response.data.result.forEach((inc) => {
|
|
62
|
-
const category = inc.category || 'uncategorized';
|
|
63
|
-
const priority = inc.priority || '3';
|
|
64
|
-
categoryDistribution[category] = (categoryDistribution[category] || 0) + 1;
|
|
65
|
-
priorityDistribution[priority] = (priorityDistribution[priority] || 0) + 1;
|
|
66
|
-
});
|
|
67
|
-
logger.info('Data distribution:');
|
|
68
|
-
logger.info(`Categories: ${JSON.stringify(categoryDistribution)}`);
|
|
69
|
-
logger.info(`Priorities: ${JSON.stringify(priorityDistribution)}`);
|
|
70
|
-
// Check if we have enough for training
|
|
71
|
-
if (response.data.result.length >= 100) {
|
|
72
|
-
logger.info('โ
Sufficient data for ML training (need at least 100 incidents)');
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
logger.warn(`โ ๏ธ Insufficient data for training (need at least 100 incidents, got ${response.data.result.length})`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
logger.error('โ fetchIncidentData failed:', error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
testFetchIncidents().catch(console.error);
|
|
84
|
-
//# sourceMappingURL=test-fetch-incidents.js.map
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
async function testIncidentAccess() {
|
|
6
|
-
const logger = new logger_js_1.Logger('IncidentAccessTest');
|
|
7
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
8
|
-
logger.info('Testing incident table access...');
|
|
9
|
-
// Test 1: Empty query (get all)
|
|
10
|
-
try {
|
|
11
|
-
logger.info('Test 1: Fetching ALL incidents with empty query...');
|
|
12
|
-
const allIncidents = await client.searchRecords('incident', '', 10);
|
|
13
|
-
logger.info(`Result: ${allIncidents.success ? 'SUCCESS' : 'FAILED'}`);
|
|
14
|
-
logger.info(`Count: ${allIncidents.data?.result?.length || 0}`);
|
|
15
|
-
if (allIncidents.data?.result?.length > 0) {
|
|
16
|
-
logger.info('Sample incident states:');
|
|
17
|
-
allIncidents.data.result.slice(0, 5).forEach((inc) => {
|
|
18
|
-
logger.info(`- ${inc.number}: state=${inc.state}, active=${inc.active}`);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
logger.error('Test 1 failed:', error);
|
|
24
|
-
}
|
|
25
|
-
// Test 2: State not equal to 7
|
|
26
|
-
try {
|
|
27
|
-
logger.info('\nTest 2: Fetching incidents where state!=7...');
|
|
28
|
-
const notClosedIncidents = await client.searchRecords('incident', 'state!=7', 10);
|
|
29
|
-
logger.info(`Result: ${notClosedIncidents.success ? 'SUCCESS' : 'FAILED'}`);
|
|
30
|
-
logger.info(`Count: ${notClosedIncidents.data?.result?.length || 0}`);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
logger.error('Test 2 failed:', error);
|
|
34
|
-
}
|
|
35
|
-
// Test 3: Active incidents
|
|
36
|
-
try {
|
|
37
|
-
logger.info('\nTest 3: Fetching active incidents...');
|
|
38
|
-
const activeIncidents = await client.searchRecords('incident', 'active=true', 10);
|
|
39
|
-
logger.info(`Result: ${activeIncidents.success ? 'SUCCESS' : 'FAILED'}`);
|
|
40
|
-
logger.info(`Count: ${activeIncidents.data?.result?.length || 0}`);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
logger.error('Test 3 failed:', error);
|
|
44
|
-
}
|
|
45
|
-
// Test 4: All states
|
|
46
|
-
try {
|
|
47
|
-
logger.info('\nTest 4: Checking incident states...');
|
|
48
|
-
const states = ['1', '2', '3', '4', '5', '6', '7', '8'];
|
|
49
|
-
for (const state of states) {
|
|
50
|
-
const stateIncidents = await client.searchRecords('incident', `state=${state}`, 1);
|
|
51
|
-
if (stateIncidents.success && stateIncidents.data?.result?.length > 0) {
|
|
52
|
-
logger.info(`State ${state}: Found incidents`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
logger.error('Test 4 failed:', error);
|
|
58
|
-
}
|
|
59
|
-
// Test 5: User permissions
|
|
60
|
-
try {
|
|
61
|
-
logger.info('\nTest 5: Testing user permissions...');
|
|
62
|
-
const userInfo = await client.get('/api/now/table/sys_user/me');
|
|
63
|
-
logger.info(`Current user: ${userInfo.data?.result?.user_name || 'Unknown'}`);
|
|
64
|
-
logger.info(`Roles: ${userInfo.data?.result?.roles || 'Unknown'}`);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
logger.error('Failed to get user info:', error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Run the test
|
|
71
|
-
testIncidentAccess().catch(console.error);
|
|
72
|
-
//# sourceMappingURL=test-incident-access.js.map
|
package/dist/test-iphone-flow.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* Test script for iPhone Request Approval Flow
|
|
5
|
-
* Demonstrates the complete integrated solution with all fixes
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.testIPhoneRequestApprovalFlow = testIPhoneRequestApprovalFlow;
|
|
9
|
-
const servicenow_client_1 = require("./utils/servicenow-client");
|
|
10
|
-
const flow_structure_builder_1 = require("./utils/flow-structure-builder");
|
|
11
|
-
async function testIPhoneRequestApprovalFlow() {
|
|
12
|
-
console.log('๐งช Testing iPhone Request Approval Flow Integration');
|
|
13
|
-
console.log('================================================');
|
|
14
|
-
try {
|
|
15
|
-
// Initialize ServiceNow client
|
|
16
|
-
const client = new servicenow_client_1.ServiceNowClient();
|
|
17
|
-
// Define the iPhone Request Approval flow
|
|
18
|
-
const iPhoneFlowDefinition = {
|
|
19
|
-
name: 'iPhone Request Approval',
|
|
20
|
-
description: 'Approval workflow for iPhone equipment requests with admin approval and requester notification',
|
|
21
|
-
table: 'sc_request',
|
|
22
|
-
trigger: {
|
|
23
|
-
type: 'record_created',
|
|
24
|
-
table: 'sc_request',
|
|
25
|
-
condition: 'request_itemCONTAINSiPhone^ORcatalogue_itemLIKEiPhone'
|
|
26
|
-
},
|
|
27
|
-
activities: [
|
|
28
|
-
{
|
|
29
|
-
id: 'approval_admin',
|
|
30
|
-
name: 'Admin Approval',
|
|
31
|
-
type: 'approval',
|
|
32
|
-
inputs: {
|
|
33
|
-
approver: 'admin',
|
|
34
|
-
approval_question: 'Approve iPhone request for ${trigger.requested_for.name}?',
|
|
35
|
-
instructions: 'Please review the iPhone request and approve or reject based on company policy.',
|
|
36
|
-
timeout: '7 days'
|
|
37
|
-
},
|
|
38
|
-
outputs: {
|
|
39
|
-
approval_decision: 'string',
|
|
40
|
-
approved_by: 'string',
|
|
41
|
-
approval_comments: 'string'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'notify_requester',
|
|
46
|
-
name: 'Notify Requester',
|
|
47
|
-
type: 'notification',
|
|
48
|
-
inputs: {
|
|
49
|
-
recipient: '${trigger.requested_for.email}',
|
|
50
|
-
subject: 'iPhone Request ${approval_admin.approval_decision}',
|
|
51
|
-
message: `Dear ${trigger.requested_for.name},
|
|
52
|
-
|
|
53
|
-
Your iPhone request has been ${approval_admin.approval_decision}.
|
|
54
|
-
|
|
55
|
-
Request Details:
|
|
56
|
-
- Item: ${trigger.request_item.short_description}
|
|
57
|
-
- Requested: ${trigger.sys_created_on}
|
|
58
|
-
- Decision by: ${approval_admin.approved_by}
|
|
59
|
-
- Comments: ${approval_admin.approval_comments}
|
|
60
|
-
|
|
61
|
-
${approval_admin.approval_decision === 'approved' ?
|
|
62
|
-
'Your iPhone will be processed and delivered according to standard procedures.' :
|
|
63
|
-
'Please contact your manager if you have questions about this decision.'}
|
|
64
|
-
|
|
65
|
-
Best regards,
|
|
66
|
-
IT Support Team`
|
|
67
|
-
},
|
|
68
|
-
condition: 'approval_admin.approval_decision != null'
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
variables: [
|
|
72
|
-
{
|
|
73
|
-
name: 'approval_decision',
|
|
74
|
-
label: 'Approval Decision',
|
|
75
|
-
type: 'string',
|
|
76
|
-
required: false,
|
|
77
|
-
default: ''
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'requester_email',
|
|
81
|
-
label: 'Requester Email',
|
|
82
|
-
type: 'string',
|
|
83
|
-
required: true,
|
|
84
|
-
default: '${trigger.requested_for.email}'
|
|
85
|
-
}
|
|
86
|
-
],
|
|
87
|
-
connections: [
|
|
88
|
-
{
|
|
89
|
-
from: 'trigger',
|
|
90
|
-
to: 'approval_admin',
|
|
91
|
-
condition: ''
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
from: 'approval_admin',
|
|
95
|
-
to: 'notify_requester',
|
|
96
|
-
condition: 'approval_admin.approval_decision != null'
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
error_handling: []
|
|
100
|
-
};
|
|
101
|
-
console.log('โ
Step 1: Flow definition created');
|
|
102
|
-
console.log(` - Name: ${iPhoneFlowDefinition.name}`);
|
|
103
|
-
console.log(` - Trigger: ${iPhoneFlowDefinition.trigger.type} on ${iPhoneFlowDefinition.trigger.table}`);
|
|
104
|
-
console.log(` - Activities: ${iPhoneFlowDefinition.activities.length}`);
|
|
105
|
-
console.log(` - Variables: ${iPhoneFlowDefinition.variables.length}`);
|
|
106
|
-
// Test 1: Create complete flow components using enhanced utilities
|
|
107
|
-
console.log('\n๐ง Step 2: Creating complete flow components...');
|
|
108
|
-
const flowComponents = (0, flow_structure_builder_1.createCompleteFlowComponents)(iPhoneFlowDefinition);
|
|
109
|
-
console.log('โ
Flow components generated:');
|
|
110
|
-
console.log(` - Flow Record: ${flowComponents.flowRecord.sys_id}`);
|
|
111
|
-
console.log(` - Trigger Instance: ${flowComponents.triggerInstance.sys_id}`);
|
|
112
|
-
console.log(` - Action Instances: ${flowComponents.actionInstances.length}`);
|
|
113
|
-
console.log(` - Logic Chain: ${flowComponents.logicChain.length}`);
|
|
114
|
-
console.log(` - Variables: ${flowComponents.variables.length}`);
|
|
115
|
-
// Test 2: Generate enhanced XML
|
|
116
|
-
console.log('\n๐ Step 3: Generating enhanced XML...');
|
|
117
|
-
const flowXML = (0, flow_structure_builder_1.generateFlowXML)(flowComponents, {
|
|
118
|
-
includeMetadata: true,
|
|
119
|
-
validateBeforeExport: true,
|
|
120
|
-
compactFormat: false
|
|
121
|
-
});
|
|
122
|
-
console.log('โ
XML generated successfully');
|
|
123
|
-
console.log(` - Size: ${flowXML.length} characters`);
|
|
124
|
-
console.log(` - Contains flow record: ${flowXML.includes('<sys_hub_flow>')}`);
|
|
125
|
-
console.log(` - Contains trigger: ${flowXML.includes('<sys_hub_trigger_instance>')}`);
|
|
126
|
-
console.log(` - Contains actions: ${flowXML.includes('<sys_hub_action_instance>')}`);
|
|
127
|
-
// Test 3: Deploy to ServiceNow using integrated client
|
|
128
|
-
console.log('\n๐ Step 4: Deploying to ServiceNow...');
|
|
129
|
-
const flowData = {
|
|
130
|
-
name: iPhoneFlowDefinition.name,
|
|
131
|
-
description: iPhoneFlowDefinition.description,
|
|
132
|
-
trigger_type: iPhoneFlowDefinition.trigger.type,
|
|
133
|
-
table: iPhoneFlowDefinition.trigger.table,
|
|
134
|
-
condition: iPhoneFlowDefinition.trigger.condition,
|
|
135
|
-
activities: iPhoneFlowDefinition.activities,
|
|
136
|
-
variables: iPhoneFlowDefinition.variables
|
|
137
|
-
};
|
|
138
|
-
const deploymentResult = await client.createFlow(flowData);
|
|
139
|
-
if (deploymentResult.success) {
|
|
140
|
-
console.log('โ
Flow deployed successfully!');
|
|
141
|
-
console.log(` - Flow ID: ${deploymentResult.data.sys_id}`);
|
|
142
|
-
console.log(` - Flow Name: ${deploymentResult.data.name}`);
|
|
143
|
-
console.log(` - Status: ${deploymentResult.data.status || 'published'}`);
|
|
144
|
-
console.log(` - Activities Created: ${deploymentResult.data.activities_created || 'N/A'}`);
|
|
145
|
-
console.log(` - Flow Designer URL: ${deploymentResult.data.flow_designer_url || 'N/A'}`);
|
|
146
|
-
// Test 4: Verify deployment
|
|
147
|
-
console.log('\n๐ Step 5: Verifying deployment...');
|
|
148
|
-
const flowContent = await client.checkFlowContent(deploymentResult.data.sys_id);
|
|
149
|
-
if (flowContent.hasContent) {
|
|
150
|
-
console.log('โ
Flow verification successful!');
|
|
151
|
-
console.log(` - Has Content: ${flowContent.hasContent}`);
|
|
152
|
-
console.log(` - Activities Count: ${flowContent.details.activities_count}`);
|
|
153
|
-
console.log(` - Has Trigger: ${flowContent.details.has_trigger}`);
|
|
154
|
-
console.log(` - Active: ${flowContent.details.active}`);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
console.log('โ ๏ธ Flow deployed but verification shows no content');
|
|
158
|
-
console.log(` - Details: ${flowContent.details}`);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
console.error('โ Flow deployment failed:', deploymentResult.error);
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
console.log('\n๐ Integration test completed successfully!');
|
|
166
|
-
console.log('All components are working together properly:');
|
|
167
|
-
console.log('โ
Flow structure builder - generates complete components');
|
|
168
|
-
console.log('โ
Enhanced XML generation - produces valid update sets');
|
|
169
|
-
console.log('โ
ServiceNow client - creates flow with activities');
|
|
170
|
-
console.log('โ
Activity creation integration - flow and action instances');
|
|
171
|
-
console.log('โ
Verification system - confirms deployment success');
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
console.error('โ Integration test failed:', error);
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Run the test if this file is executed directly
|
|
180
|
-
if (require.main === module) {
|
|
181
|
-
testIPhoneRequestApprovalFlow()
|
|
182
|
-
.then(success => {
|
|
183
|
-
process.exit(success ? 0 : 1);
|
|
184
|
-
})
|
|
185
|
-
.catch(error => {
|
|
186
|
-
console.error('Fatal error:', error);
|
|
187
|
-
process.exit(1);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
async function testLimitProblem() {
|
|
6
|
-
const logger = new logger_js_1.Logger('LimitTest');
|
|
7
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
8
|
-
logger.info('Testing incident limits...');
|
|
9
|
-
// Test different limits
|
|
10
|
-
const limits = [10, 50, 100, 500, 1000];
|
|
11
|
-
for (const limit of limits) {
|
|
12
|
-
try {
|
|
13
|
-
logger.info(`\nTesting with limit ${limit}...`);
|
|
14
|
-
const result = await client.searchRecords('incident', 'state!=7', limit);
|
|
15
|
-
logger.info(`Result: ${result.success ? 'SUCCESS' : 'FAILED'}`);
|
|
16
|
-
logger.info(`Requested: ${limit}, Got: ${result.data?.result?.length || 0}`);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
logger.error(`Test with limit ${limit} failed:`, error);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// Test with empty query (should get all incidents)
|
|
23
|
-
try {
|
|
24
|
-
logger.info(`\nTesting all incidents with limit 1000...`);
|
|
25
|
-
const result = await client.searchRecords('incident', '', 1000);
|
|
26
|
-
logger.info(`Result: ${result.success ? 'SUCCESS' : 'FAILED'}`);
|
|
27
|
-
logger.info(`Total incidents found: ${result.data?.result?.length || 0}`);
|
|
28
|
-
if (result.data?.result?.length > 0) {
|
|
29
|
-
const states = new Map();
|
|
30
|
-
const priorities = new Map();
|
|
31
|
-
result.data.result.forEach((inc) => {
|
|
32
|
-
const state = inc.state || 'unknown';
|
|
33
|
-
const priority = inc.priority || 'unknown';
|
|
34
|
-
states.set(state, (states.get(state) || 0) + 1);
|
|
35
|
-
priorities.set(priority, (priorities.get(priority) || 0) + 1);
|
|
36
|
-
});
|
|
37
|
-
logger.info('State distribution:', Object.fromEntries(states));
|
|
38
|
-
logger.info('Priority distribution:', Object.fromEntries(priorities));
|
|
39
|
-
// Count active incidents (state != 6 and state != 7)
|
|
40
|
-
const activeIncidents = result.data.result.filter((inc) => inc.state !== '6' && inc.state !== '7');
|
|
41
|
-
logger.info(`Active incidents (state not 6 or 7): ${activeIncidents.length}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
logger.error('All incidents test failed:', error);
|
|
46
|
-
}
|
|
47
|
-
// Test what the ML training was actually requesting
|
|
48
|
-
try {
|
|
49
|
-
logger.info(`\nTesting ML training scenario (sample_size 2000)...`);
|
|
50
|
-
const result = await client.searchRecords('incident', 'state!=7', 2000);
|
|
51
|
-
logger.info(`ML training result: ${result.success ? 'SUCCESS' : 'FAILED'}`);
|
|
52
|
-
logger.info(`ML would get: ${result.data?.result?.length || 0} incidents out of requested 2000`);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
logger.error('ML training test failed:', error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Run the test
|
|
59
|
-
testLimitProblem().catch(console.error);
|
|
60
|
-
//# sourceMappingURL=test-limit-problem.js.map
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
// Test of ML training nu correct batch sizes gebruikt
|
|
6
|
-
async function testMLBatchFix() {
|
|
7
|
-
const logger = new logger_js_1.Logger('MLBatchFixTest');
|
|
8
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
9
|
-
console.log('๐ Testing ML training batch size fix...');
|
|
10
|
-
// Simuleer ML fetchIncidentData methode met verschillende batch sizes
|
|
11
|
-
async function testFetchIncidentData(sample_size, description) {
|
|
12
|
-
logger.info(`\n--- ${description} ---`);
|
|
13
|
-
logger.info(`Requesting ${sample_size} incidents`);
|
|
14
|
-
const intelligent_selection = true;
|
|
15
|
-
const focus_categories = [];
|
|
16
|
-
const query = '';
|
|
17
|
-
let finalQuery = '';
|
|
18
|
-
if (intelligent_selection && !query) {
|
|
19
|
-
const queries = [];
|
|
20
|
-
queries.push('sys_created_onONLast 6 months');
|
|
21
|
-
queries.push('(priority=1^ORpriority=2^ORpriority=3^ORpriority=4)');
|
|
22
|
-
queries.push('(active=true^ORactive=false)');
|
|
23
|
-
queries.push('categoryISNOTEMPTY');
|
|
24
|
-
finalQuery = queries.join('^') + '^ORDERBYDESCsys_created_on';
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
const start = Date.now();
|
|
28
|
-
// ๐ด KEY TEST: Use the actual sample_size parameter
|
|
29
|
-
const response = await client.searchRecords('incident', finalQuery, sample_size);
|
|
30
|
-
const duration = Date.now() - start;
|
|
31
|
-
if (response.success) {
|
|
32
|
-
const actualCount = response.data?.result?.length || 0;
|
|
33
|
-
logger.info(`โ
SUCCESS: Got ${actualCount}/${sample_size} incidents (${duration}ms)`);
|
|
34
|
-
if (actualCount === Math.min(sample_size, 1000)) { // ServiceNow might limit to 1000
|
|
35
|
-
logger.info(`โ
Correct batch size used`);
|
|
36
|
-
}
|
|
37
|
-
else if (actualCount === 10) {
|
|
38
|
-
logger.error(`โ STILL USING DEFAULT LIMIT OF 10!`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
logger.info(`โน๏ธ Got ${actualCount} incidents (might be limited by data available)`);
|
|
42
|
-
}
|
|
43
|
-
return actualCount;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
logger.error(`โ FAILED: Could not fetch incidents`);
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
logger.error(`โ ERROR:`, error);
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Test verschillende batch sizes
|
|
56
|
-
const testCases = [
|
|
57
|
-
{ size: 50, desc: "Small batch (50)" },
|
|
58
|
-
{ size: 100, desc: "Medium batch (100)" },
|
|
59
|
-
{ size: 200, desc: "Large batch (200)" },
|
|
60
|
-
{ size: 500, desc: "XL batch (500)" }
|
|
61
|
-
];
|
|
62
|
-
console.log(`\n๐งช Testing different batch sizes:`);
|
|
63
|
-
const results = [];
|
|
64
|
-
for (const testCase of testCases) {
|
|
65
|
-
const count = await testFetchIncidentData(testCase.size, testCase.desc);
|
|
66
|
-
results.push({ requested: testCase.size, actual: count });
|
|
67
|
-
}
|
|
68
|
-
console.log(`\n๐ Batch Size Results:`);
|
|
69
|
-
results.forEach(r => {
|
|
70
|
-
const success = r.actual > 10 && r.actual >= Math.min(r.requested, 100); // At least more than default 10
|
|
71
|
-
console.log(` ${r.requested} requested โ ${r.actual} actual ${success ? 'โ
' : 'โ'}`);
|
|
72
|
-
});
|
|
73
|
-
// Test streaming batches
|
|
74
|
-
console.log(`\n๐ Testing streaming batch functionality:`);
|
|
75
|
-
const totalSample = 300;
|
|
76
|
-
const batchSize = 100;
|
|
77
|
-
const totalBatches = Math.ceil(totalSample / batchSize);
|
|
78
|
-
let streamingTotal = 0;
|
|
79
|
-
for (let batchNum = 0; batchNum < totalBatches; batchNum++) {
|
|
80
|
-
const offset = batchNum * batchSize;
|
|
81
|
-
const currentBatchSize = Math.min(batchSize, totalSample - offset);
|
|
82
|
-
logger.info(`Streaming batch ${batchNum + 1}/${totalBatches}: offset=${offset}, size=${currentBatchSize}`);
|
|
83
|
-
try {
|
|
84
|
-
const response = await client.searchRecordsWithOffset('incident', 'sys_created_onONLast 6 months^categoryISNOTEMPTY^ORDERBYDESCsys_created_on', currentBatchSize, offset);
|
|
85
|
-
if (response.success) {
|
|
86
|
-
const batchActual = response.data?.result?.length || 0;
|
|
87
|
-
streamingTotal += batchActual;
|
|
88
|
-
logger.info(` โ
Batch got ${batchActual}/${currentBatchSize} incidents`);
|
|
89
|
-
if (batchActual < currentBatchSize) {
|
|
90
|
-
logger.info(` ๐ End of data reached`);
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
logger.error(` โ Streaming batch ${batchNum + 1} failed:`, error);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
console.log(`\n๐ฏ Streaming Results:`);
|
|
100
|
-
console.log(` Total streamed: ${streamingTotal}/${totalSample}`);
|
|
101
|
-
console.log(` Batch functionality: ${streamingTotal > 10 ? 'โ
Working' : 'โ Still limited to 10'}`);
|
|
102
|
-
}
|
|
103
|
-
testMLBatchFix().catch(console.error);
|
|
104
|
-
//# sourceMappingURL=test-ml-batch-fix.js.map
|
package/dist/test-ml-batch.d.ts
DELETED
package/dist/test-ml-batch.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
// Test ML batch functionality met realistische sizes
|
|
6
|
-
async function testMLBatch() {
|
|
7
|
-
const logger = new logger_js_1.Logger('MLBatchTest');
|
|
8
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
9
|
-
console.log('๐ฅ Testing ML batch functionality with realistic batch sizes...');
|
|
10
|
-
// ML training parameters (zoals ML daadwerkelijk gebruikt)
|
|
11
|
-
const sample_size = 1000; // Totaal aantal incidenten
|
|
12
|
-
const batch_size = 200; // Per batch
|
|
13
|
-
const intelligent_selection = true;
|
|
14
|
-
const focus_categories = [];
|
|
15
|
-
const query = '';
|
|
16
|
-
// Build intelligent query (zoals ML doet)
|
|
17
|
-
let finalQuery = '';
|
|
18
|
-
if (intelligent_selection && !query) {
|
|
19
|
-
const queries = [];
|
|
20
|
-
queries.push('sys_created_onONLast 6 months');
|
|
21
|
-
queries.push('(priority=1^ORpriority=2^ORpriority=3^ORpriority=4)');
|
|
22
|
-
queries.push('(active=true^ORactive=false)');
|
|
23
|
-
queries.push('categoryISNOTEMPTY');
|
|
24
|
-
finalQuery = queries.join('^') + '^ORDERBYDESCsys_created_on';
|
|
25
|
-
}
|
|
26
|
-
logger.info(`Testing ML batch training:`);
|
|
27
|
-
logger.info(`- Sample size: ${sample_size}`);
|
|
28
|
-
logger.info(`- Batch size: ${batch_size}`);
|
|
29
|
-
logger.info(`- Query: ${finalQuery}`);
|
|
30
|
-
// Test batch processing zoals ML training doet
|
|
31
|
-
const totalBatches = Math.ceil(sample_size / batch_size);
|
|
32
|
-
let totalProcessed = 0;
|
|
33
|
-
console.log(`\n๐ฆ Processing ${totalBatches} batches...`);
|
|
34
|
-
for (let batchNum = 0; batchNum < totalBatches; batchNum++) {
|
|
35
|
-
const offset = batchNum * batch_size;
|
|
36
|
-
const currentBatchSize = Math.min(batch_size, sample_size - offset);
|
|
37
|
-
logger.info(`\n--- Batch ${batchNum + 1}/${totalBatches} ---`);
|
|
38
|
-
logger.info(`Offset: ${offset}, Size: ${currentBatchSize}`);
|
|
39
|
-
try {
|
|
40
|
-
// Test searchRecordsWithOffset (zoals ML streaming doet)
|
|
41
|
-
const start = Date.now();
|
|
42
|
-
const response = await client.searchRecordsWithOffset('incident', finalQuery, currentBatchSize, offset);
|
|
43
|
-
const duration = Date.now() - start;
|
|
44
|
-
if (response.success && response.data?.result) {
|
|
45
|
-
const actualCount = response.data.result.length;
|
|
46
|
-
totalProcessed += actualCount;
|
|
47
|
-
logger.info(`โ
Success: ${actualCount}/${currentBatchSize} incidents (${duration}ms)`);
|
|
48
|
-
// Sample categories for this batch
|
|
49
|
-
const categories = new Set(response.data.result.slice(0, 5).map((inc) => inc.category || 'none'));
|
|
50
|
-
logger.info(`Categories sample: ${Array.from(categories).join(', ')}`);
|
|
51
|
-
// If we got fewer than requested, we've reached the end
|
|
52
|
-
if (actualCount < currentBatchSize) {
|
|
53
|
-
logger.info(`๐ Reached end of data (got ${actualCount} < ${currentBatchSize})`);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
logger.error(`โ Batch ${batchNum + 1} failed`);
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
logger.error(`โ Batch ${batchNum + 1} error:`, error);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
console.log(`\n๐ฏ ML Batch Results:`);
|
|
68
|
-
console.log(`- Total processed: ${totalProcessed}/${sample_size} incidents`);
|
|
69
|
-
console.log(`- Success rate: ${((totalProcessed / sample_size) * 100).toFixed(1)}%`);
|
|
70
|
-
console.log(`- Ready for ML training: ${totalProcessed >= 100 ? 'โ
Yes' : 'โ No (need 100+ incidents)'}`);
|
|
71
|
-
// Test normal single batch (non-streaming)
|
|
72
|
-
console.log(`\n๐ Testing single batch (non-streaming mode):`);
|
|
73
|
-
try {
|
|
74
|
-
const singleBatch = await client.searchRecords('incident', finalQuery, batch_size);
|
|
75
|
-
if (singleBatch.success) {
|
|
76
|
-
logger.info(`โ
Single batch: ${singleBatch.data?.result?.length || 0}/${batch_size} incidents`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
logger.error(`โ Single batch failed`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
logger.error(`โ Single batch error:`, error);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
testMLBatch().catch(console.error);
|
|
87
|
-
//# sourceMappingURL=test-ml-batch.js.map
|
package/dist/test-ml-query.d.ts
DELETED