snow-flow 2.0.2 → 2.0.3
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/mcp-config.json → .mcp.json} +13 -12
- package/.releaserc.json +47 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/.claude/claude-settings.json +0 -15
- package/.claude/commands/analysis/README.md +0 -9
- package/.claude/commands/automation/README.md +0 -9
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/monitoring/README.md +0 -9
- package/.claude/commands/optimization/README.md +0 -9
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/config.json +0 -36
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/settings.json +0 -114
- package/.claude/settings.local.json +0 -33
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -9
- package/.claude-flow/metrics/system-metrics.json +0 -15986
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.roo/README.md +0 -402
- package/.roo/mcp-list.txt +0 -257
- package/.roo/mcp.json +0 -32
- package/.roo/workflows/basic-tdd.json +0 -32
- package/.roomodes +0 -201
- package/CLAUDE.md +0 -393
- package/bin/snow-flow.js +0 -3
- package/dist/cli.js.bak +0 -2052
- package/dist/config/snow-flow-config.d.ts +0 -1492
- package/dist/config/snow-flow-config.js +0 -938
- package/scripts/create-env.js +0 -91
- package/scripts/postinstall.js +0 -30
- package/scripts/register-mcp-servers.js +0 -210
- package/scripts/reset-mcp-servers.js +0 -246
- package/scripts/setup-mcp.js +0 -106
- package/scripts/update-version.js +0 -31
- package/src/agents/README.md +0 -192
- package/src/agents/base-agent.ts +0 -251
- package/src/agents/coordinator.ts +0 -971
- package/src/agents/index.ts +0 -18
- package/src/agents/queen-403-handler.ts +0 -230
- package/src/agents/queen-agent.ts +0 -1399
- package/src/agents/script-writer-agent.ts +0 -769
- package/src/agents/security-agent.ts +0 -726
- package/src/agents/widget-creator-agent.ts +0 -568
- package/src/api/error-handling.ts +0 -1758
- package/src/api/natural-language-mapper.ts +0 -630
- package/src/api/performance-optimizer.ts +0 -891
- package/src/api/transaction-manager.ts +0 -754
- package/src/cli/deploy-artifact.ts +0 -304
- package/src/cli/snow-flow-cli-integration.ts +0 -434
- package/src/cli.ts +0 -4455
- package/src/cli.ts.bak +0 -5616
- package/src/compliance/advanced-compliance-system.ts +0 -1268
- package/src/compliance/index.ts +0 -19
- package/src/config/snow-flow-config.ts +0 -1019
- package/src/documentation/index.ts +0 -16
- package/src/documentation/self-documenting-system.ts +0 -1421
- package/src/dynamic-version.ts +0 -44
- package/src/healing/index.ts +0 -20
- package/src/healing/self-healing-system.ts +0 -1435
- package/src/health/README.md +0 -161
- package/src/health/system-health.ts +0 -995
- package/src/index.ts +0 -60
- package/src/intelligence/acl-analyzer.ts +0 -377
- package/src/intelligence/auto-resolution-engine.ts +0 -643
- package/src/intelligence/gap-analysis-engine.ts +0 -488
- package/src/intelligence/manual-instructions-generator.ts +0 -744
- package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
- package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
- package/src/intelligence/performance-recommendations-engine.ts +0 -1223
- package/src/intelligence/requirements-analyzer.ts +0 -1148
- package/src/intelligence/task-analyzer.ts +0 -628
- package/src/managers/scope-manager.ts +0 -555
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
- package/src/mcp/base-mcp-server.ts +0 -660
- package/src/mcp/http-transport-wrapper.ts +0 -426
- package/src/mcp/service-discovery-client.ts +0 -312
- package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
- package/src/mcp/servicenow-automation-mcp.ts +0 -838
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
- package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
- package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
- package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
- package/src/mcp/servicenow-integration-mcp.ts +0 -819
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
- package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
- package/src/mcp/servicenow-mcp-server.ts +0 -728
- package/src/mcp/servicenow-memory-mcp.ts +0 -474
- package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
- package/src/mcp/servicenow-operations-mcp.ts +0 -3384
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
- package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
- package/src/mcp/servicenow-progressive-indexer.ts +0 -370
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
- package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
- package/src/mcp/servicenow-update-set-mcp.ts +0 -811
- package/src/mcp/shared/agent-context-provider.ts +0 -365
- package/src/mcp/shared/base-mcp-server.ts +0 -2463
- package/src/mcp/shared/mcp-memory-manager.ts +0 -540
- package/src/mcp/shared/mcp-resource-manager.ts +0 -367
- package/src/mcp/snow-flow-mcp.ts +0 -911
- package/src/mcp/start-all-mcp-servers.ts +0 -102
- package/src/mcp/start-servicenow-mcp.ts +0 -67
- package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
- package/src/monitoring/performance-tracker.ts +0 -777
- package/src/optimization/cost-optimization-engine.ts +0 -1125
- package/src/optimization/index.ts +0 -10
- package/src/queen/README.md +0 -403
- package/src/queen/agent-factory.ts +0 -574
- package/src/queen/index.ts +0 -94
- package/src/queen/mcp-execution-bridge.ts +0 -681
- package/src/queen/neural-learning.ts +0 -319
- package/src/queen/parallel-agent-engine.ts +0 -848
- package/src/queen/queen-memory-system.ts +0 -490
- package/src/queen/queen-memory.ts +0 -456
- package/src/queen/servicenow-queen.ts +0 -1029
- package/src/queen/types.ts +0 -87
- package/src/rollback/smart-rollback-system.ts +0 -866
- package/src/schemas/deployment.schema.json +0 -58
- package/src/schemas/flow.schema.json +0 -79
- package/src/schemas/widget.schema.json +0 -72
- package/src/snow-flow-system.ts +0 -541
- package/src/sparc/sparc-help.ts +0 -49
- package/src/sparc/team-sparc.ts +0 -88
- package/src/strategies/global-scope-strategy.ts +0 -736
- package/src/templates/base/application.template.json +0 -45
- package/src/templates/base/business_rule.template.json +0 -33
- package/src/templates/base/script_include.template.json +0 -18
- package/src/templates/base/table.template.json +0 -64
- package/src/templates/base/widget.template.json +0 -25
- package/src/templates/patterns/composite.incident-management.template.json +0 -140
- package/src/templates/patterns/widget.dashboard.template.json +0 -238
- package/src/templates/patterns/widget.datatable.template.json +0 -292
- package/src/testing/integration-test-suite.ts +0 -1276
- package/src/types/index.ts +0 -183
- package/src/types/neo4j-driver.d.ts +0 -23
- package/src/types/servicenow.types.ts +0 -307
- package/src/types/snow-flow.types.ts +0 -186
- package/src/types/todo.types.ts +0 -70
- package/src/utils/action-type-cache.ts +0 -286
- package/src/utils/agent-detector.ts +0 -573
- package/src/utils/artifact-tracker.ts +0 -379
- package/src/utils/dependency-detector.ts +0 -233
- package/src/utils/deployment-metadata-handler.ts +0 -518
- package/src/utils/error-recovery.ts +0 -680
- package/src/utils/logger.ts +0 -60
- package/src/utils/mcp-auth-middleware.ts +0 -262
- package/src/utils/mcp-config-manager.ts +0 -270
- package/src/utils/mcp-server-manager.ts +0 -446
- package/src/utils/mcp-tool-registry.ts +0 -298
- package/src/utils/migrate-snow-flow.ts +0 -98
- package/src/utils/oauth-html-templates.ts +0 -188
- package/src/utils/scope-utils.ts +0 -443
- package/src/utils/servicenow-client.ts +0 -3321
- package/src/utils/servicenow-id-generator.ts +0 -181
- package/src/utils/snow-memory-manager.ts +0 -605
- package/src/utils/snow-oauth.ts +0 -797
- package/src/utils/template-engine.ts +0 -463
- package/src/utils/theme-manager.ts +0 -295
- package/src/utils/unified-auth-store.ts +0 -222
- package/src/utils/update-set-importer.ts +0 -422
- package/src/utils/update-set-xml-packager.ts +0 -371
- package/src/utils/widget-template-generator.ts +0 -1744
- package/src/version.ts +0 -1950
package/src/types/todo.types.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TodoWrite Integration Types
|
|
3
|
-
* Types for integrating with Claude Code's TodoWrite tool
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface TodoItem {
|
|
7
|
-
id: string;
|
|
8
|
-
content: string;
|
|
9
|
-
status: TodoStatus;
|
|
10
|
-
priority: TodoPriority;
|
|
11
|
-
assignedAgent?: string;
|
|
12
|
-
dependencies?: string[];
|
|
13
|
-
metadata?: Record<string, any>;
|
|
14
|
-
createdAt?: Date;
|
|
15
|
-
updatedAt?: Date;
|
|
16
|
-
completedAt?: Date;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
20
|
-
|
|
21
|
-
export type TodoPriority = 'low' | 'medium' | 'high' | 'critical';
|
|
22
|
-
|
|
23
|
-
export interface TodoCoordination {
|
|
24
|
-
taskId: string;
|
|
25
|
-
todos: TodoItem[];
|
|
26
|
-
agentAssignments: Map<string, string>; // todoId -> agentId
|
|
27
|
-
dependencies: Map<string, string[]>; // todoId -> [dependencyIds]
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TodoUpdate {
|
|
31
|
-
todoId: string;
|
|
32
|
-
updates: Partial<TodoItem>;
|
|
33
|
-
updatedBy: string;
|
|
34
|
-
timestamp: Date;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TodoProgress {
|
|
38
|
-
total: number;
|
|
39
|
-
pending: number;
|
|
40
|
-
inProgress: number;
|
|
41
|
-
completed: number;
|
|
42
|
-
cancelled: number;
|
|
43
|
-
percentComplete: number;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface TodoAgentAssignment {
|
|
47
|
-
todoId: string;
|
|
48
|
-
agentId: string;
|
|
49
|
-
agentType: string;
|
|
50
|
-
assignedAt: Date;
|
|
51
|
-
estimatedDuration?: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface TodoDependencyGraph {
|
|
55
|
-
nodes: TodoNode[];
|
|
56
|
-
edges: TodoEdge[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface TodoNode {
|
|
60
|
-
id: string;
|
|
61
|
-
todo: TodoItem;
|
|
62
|
-
level: number; // Dependency depth
|
|
63
|
-
criticalPath: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface TodoEdge {
|
|
67
|
-
from: string;
|
|
68
|
-
to: string;
|
|
69
|
-
type: 'blocks' | 'requires' | 'optional';
|
|
70
|
-
}
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ServiceNow Action Type Cache
|
|
3
|
-
* Dynamically discovers and caches Flow Designer action types
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import os from 'os';
|
|
9
|
-
import { ServiceNowClient } from './servicenow-client.js';
|
|
10
|
-
import { Logger } from './logger.js';
|
|
11
|
-
|
|
12
|
-
export interface ActionType {
|
|
13
|
-
sys_id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
label: string;
|
|
16
|
-
category?: string;
|
|
17
|
-
inputs?: any;
|
|
18
|
-
outputs?: any;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface TriggerType {
|
|
22
|
-
sys_id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
label: string;
|
|
25
|
-
table_name?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export class ActionTypeCache {
|
|
29
|
-
private logger: Logger;
|
|
30
|
-
private client: ServiceNowClient;
|
|
31
|
-
private cacheDir: string;
|
|
32
|
-
private actionTypesCache: Map<string, ActionType> = new Map();
|
|
33
|
-
private triggerTypesCache: Map<string, TriggerType> = new Map();
|
|
34
|
-
private cacheLoaded = false;
|
|
35
|
-
|
|
36
|
-
constructor(client: ServiceNowClient) {
|
|
37
|
-
this.logger = new Logger('ActionTypeCache');
|
|
38
|
-
this.client = client;
|
|
39
|
-
this.cacheDir = path.join(process.env.SNOW_FLOW_HOME || path.join(os.homedir(), '.snow-flow'), 'cache');
|
|
40
|
-
this.ensureCacheDir();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private ensureCacheDir() {
|
|
44
|
-
if (!fs.existsSync(this.cacheDir)) {
|
|
45
|
-
fs.mkdirSync(this.cacheDir, { recursive: true });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Get action type by name or label
|
|
51
|
-
*/
|
|
52
|
-
async getActionType(nameOrLabel: string): Promise<ActionType | null> {
|
|
53
|
-
await this.ensureCache();
|
|
54
|
-
|
|
55
|
-
// First try exact match
|
|
56
|
-
for (const [_, actionType] of this.actionTypesCache) {
|
|
57
|
-
if (actionType.name === nameOrLabel || actionType.label === nameOrLabel) {
|
|
58
|
-
return actionType;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Then try case-insensitive match
|
|
63
|
-
const lowerSearch = nameOrLabel.toLowerCase();
|
|
64
|
-
for (const [_, actionType] of this.actionTypesCache) {
|
|
65
|
-
if (actionType.name.toLowerCase() === lowerSearch ||
|
|
66
|
-
actionType.label.toLowerCase() === lowerSearch) {
|
|
67
|
-
return actionType;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Finally try partial match
|
|
72
|
-
for (const [_, actionType] of this.actionTypesCache) {
|
|
73
|
-
if (actionType.name.toLowerCase().includes(lowerSearch) ||
|
|
74
|
-
actionType.label.toLowerCase().includes(lowerSearch)) {
|
|
75
|
-
return actionType;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Get trigger type by name or label
|
|
84
|
-
*/
|
|
85
|
-
async getTriggerType(nameOrLabel: string): Promise<TriggerType | null> {
|
|
86
|
-
await this.ensureCache();
|
|
87
|
-
|
|
88
|
-
// Map common names to actual trigger names
|
|
89
|
-
const triggerMap: Record<string, string> = {
|
|
90
|
-
'record_created': 'Created',
|
|
91
|
-
'record_updated': 'Updated',
|
|
92
|
-
'record_deleted': 'Deleted',
|
|
93
|
-
'created_or_updated': 'Created or Updated',
|
|
94
|
-
'scheduled': 'Scheduled',
|
|
95
|
-
'manual': 'Manual'
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const searchName = triggerMap[nameOrLabel] || nameOrLabel;
|
|
99
|
-
|
|
100
|
-
// Try exact match
|
|
101
|
-
for (const [_, triggerType] of this.triggerTypesCache) {
|
|
102
|
-
if (triggerType.name === searchName || triggerType.label === searchName) {
|
|
103
|
-
return triggerType;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Try case-insensitive match
|
|
108
|
-
const lowerSearch = searchName.toLowerCase();
|
|
109
|
-
for (const [_, triggerType] of this.triggerTypesCache) {
|
|
110
|
-
if (triggerType.name.toLowerCase() === lowerSearch ||
|
|
111
|
-
triggerType.label.toLowerCase() === lowerSearch) {
|
|
112
|
-
return triggerType;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Ensure cache is loaded
|
|
121
|
-
*/
|
|
122
|
-
private async ensureCache() {
|
|
123
|
-
if (this.cacheLoaded) return;
|
|
124
|
-
|
|
125
|
-
// Try to load from file cache first
|
|
126
|
-
if (this.loadFromFile()) {
|
|
127
|
-
this.cacheLoaded = true;
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Otherwise fetch from ServiceNow
|
|
132
|
-
await this.refreshCache();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Load cache from file
|
|
137
|
-
*/
|
|
138
|
-
private loadFromFile(): boolean {
|
|
139
|
-
try {
|
|
140
|
-
const actionTypesFile = path.join(this.cacheDir, 'action_types.json');
|
|
141
|
-
const triggerTypesFile = path.join(this.cacheDir, 'trigger_types.json');
|
|
142
|
-
|
|
143
|
-
if (fs.existsSync(actionTypesFile) && fs.existsSync(triggerTypesFile)) {
|
|
144
|
-
const actionTypes = JSON.parse(fs.readFileSync(actionTypesFile, 'utf-8'));
|
|
145
|
-
const triggerTypes = JSON.parse(fs.readFileSync(triggerTypesFile, 'utf-8'));
|
|
146
|
-
|
|
147
|
-
// Check if cache is recent (less than 24 hours old)
|
|
148
|
-
const stats = fs.statSync(actionTypesFile);
|
|
149
|
-
const ageInHours = (Date.now() - stats.mtime.getTime()) / (1000 * 60 * 60);
|
|
150
|
-
|
|
151
|
-
if (ageInHours < 24) {
|
|
152
|
-
// Load into memory
|
|
153
|
-
actionTypes.forEach((at: ActionType) => {
|
|
154
|
-
this.actionTypesCache.set(at.sys_id, at);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
triggerTypes.forEach((tt: TriggerType) => {
|
|
158
|
-
this.triggerTypesCache.set(tt.sys_id, tt);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
this.logger.info(`Loaded ${actionTypes.length} action types and ${triggerTypes.length} trigger types from cache`);
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
} catch (error) {
|
|
166
|
-
this.logger.warn('Failed to load cache from file:', error);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Save cache to file
|
|
174
|
-
*/
|
|
175
|
-
private saveToFile() {
|
|
176
|
-
try {
|
|
177
|
-
const actionTypesFile = path.join(this.cacheDir, 'action_types.json');
|
|
178
|
-
const triggerTypesFile = path.join(this.cacheDir, 'trigger_types.json');
|
|
179
|
-
|
|
180
|
-
const actionTypes = Array.from(this.actionTypesCache.values());
|
|
181
|
-
const triggerTypes = Array.from(this.triggerTypesCache.values());
|
|
182
|
-
|
|
183
|
-
fs.writeFileSync(actionTypesFile, JSON.stringify(actionTypes, null, 2));
|
|
184
|
-
fs.writeFileSync(triggerTypesFile, JSON.stringify(triggerTypes, null, 2));
|
|
185
|
-
|
|
186
|
-
this.logger.info('Saved cache to file');
|
|
187
|
-
} catch (error) {
|
|
188
|
-
this.logger.warn('Failed to save cache to file:', error);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Refresh cache from ServiceNow
|
|
194
|
-
*/
|
|
195
|
-
async refreshCache() {
|
|
196
|
-
this.logger.info('Refreshing action type cache from ServiceNow...');
|
|
197
|
-
|
|
198
|
-
try {
|
|
199
|
-
// Fetch all action types
|
|
200
|
-
const actionTypesResponse = await this.client.getRecords('sys_hub_action_type_base', {
|
|
201
|
-
sysparm_limit: 1000,
|
|
202
|
-
sysparm_fields: 'sys_id,name,label,category,active',
|
|
203
|
-
sysparm_query: 'active=true'
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
if (actionTypesResponse.success && actionTypesResponse.data) {
|
|
207
|
-
this.actionTypesCache.clear();
|
|
208
|
-
actionTypesResponse.data.forEach((at: any) => {
|
|
209
|
-
this.actionTypesCache.set(at.sys_id, {
|
|
210
|
-
sys_id: at.sys_id,
|
|
211
|
-
name: at.name,
|
|
212
|
-
label: at.label || at.name,
|
|
213
|
-
category: at.category
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
this.logger.info(`Cached ${actionTypesResponse.data.length} action types`);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Fetch all trigger types
|
|
221
|
-
const triggerTypesResponse = await this.client.getRecords('sys_hub_trigger_type', {
|
|
222
|
-
sysparm_limit: 100,
|
|
223
|
-
sysparm_fields: 'sys_id,name,label,table_name'
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
if (triggerTypesResponse.success && triggerTypesResponse.data) {
|
|
227
|
-
this.triggerTypesCache.clear();
|
|
228
|
-
triggerTypesResponse.data.forEach((tt: any) => {
|
|
229
|
-
this.triggerTypesCache.set(tt.sys_id, {
|
|
230
|
-
sys_id: tt.sys_id,
|
|
231
|
-
name: tt.name,
|
|
232
|
-
label: tt.label || tt.name,
|
|
233
|
-
table_name: tt.table_name
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
this.logger.info(`Cached ${triggerTypesResponse.data.length} trigger types`);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Save to file
|
|
241
|
-
this.saveToFile();
|
|
242
|
-
this.cacheLoaded = true;
|
|
243
|
-
|
|
244
|
-
} catch (error) {
|
|
245
|
-
this.logger.error('Failed to refresh cache:', error);
|
|
246
|
-
// Try to continue with empty cache
|
|
247
|
-
this.cacheLoaded = true;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Get all action types (for debugging/listing)
|
|
253
|
-
*/
|
|
254
|
-
async getAllActionTypes(): Promise<ActionType[]> {
|
|
255
|
-
await this.ensureCache();
|
|
256
|
-
return Array.from(this.actionTypesCache.values());
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Get all trigger types (for debugging/listing)
|
|
261
|
-
*/
|
|
262
|
-
async getAllTriggerTypes(): Promise<TriggerType[]> {
|
|
263
|
-
await this.ensureCache();
|
|
264
|
-
return Array.from(this.triggerTypesCache.values());
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Clear cache (force refresh on next access)
|
|
269
|
-
*/
|
|
270
|
-
clearCache() {
|
|
271
|
-
this.actionTypesCache.clear();
|
|
272
|
-
this.triggerTypesCache.clear();
|
|
273
|
-
this.cacheLoaded = false;
|
|
274
|
-
|
|
275
|
-
// Also remove cache files
|
|
276
|
-
try {
|
|
277
|
-
const actionTypesFile = path.join(this.cacheDir, 'action_types.json');
|
|
278
|
-
const triggerTypesFile = path.join(this.cacheDir, 'trigger_types.json');
|
|
279
|
-
|
|
280
|
-
if (fs.existsSync(actionTypesFile)) fs.unlinkSync(actionTypesFile);
|
|
281
|
-
if (fs.existsSync(triggerTypesFile)) fs.unlinkSync(triggerTypesFile);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
// Ignore errors
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|