snow-flow 8.41.9 → 8.41.15

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.
@@ -0,0 +1,125 @@
1
+ /**
2
+ * snow_manage_flow - Unified Flow Designer Management via Direct Table API
3
+ *
4
+ * ⚠️ EXPERIMENTAL: Manages flows by directly manipulating Flow Designer tables.
5
+ * This approach is NOT officially supported by ServiceNow but enables programmatic flow management.
6
+ *
7
+ * Supported Actions:
8
+ * - create: Create a new flow with triggers, actions, conditions, loops, variables
9
+ * - update: Update an existing flow's properties
10
+ * - delete: Delete a flow and all related records
11
+ * - clone: Clone an existing flow
12
+ * - activate: Activate a flow
13
+ * - deactivate: Deactivate a flow
14
+ * - add_action: Add an action to an existing flow
15
+ * - remove_action: Remove an action from a flow
16
+ * - add_condition: Add a conditional logic block (if/then/else)
17
+ * - add_loop: Add a loop construct (for_each/do_until)
18
+ * - get_details: Get detailed flow structure including decompressed values
19
+ *
20
+ * Features:
21
+ * - Xanadu+ compression support (GlideCompressionUtil compatible)
22
+ * - Nested actions within conditions and loops
23
+ * - Parent-child relationship management
24
+ * - Version detection for table compatibility
25
+ *
26
+ * Flow Designer Table Structure:
27
+ * - sys_hub_flow: Main flow record
28
+ * - sys_hub_flow_snapshot: Flow version/snapshot
29
+ * - sys_hub_trigger_instance_v2: Trigger configuration
30
+ * - sys_hub_action_instance_v2: Action instances (with compressed values)
31
+ * - sys_hub_flow_logic_instance_v2: Conditions, loops (with parent_logic_instance)
32
+ * - sys_hub_flow_variable: Input/output variables
33
+ * - sys_hub_sub_flow_instance: Subflow references
34
+ *
35
+ * @version 2.0.0-experimental
36
+ * @author Snow-Flow v8.3.0 - Flow Designer Direct Table API
37
+ */
38
+ import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
39
+ type ManageFlowAction = 'create' | 'update' | 'delete' | 'clone' | 'activate' | 'deactivate' | 'add_action' | 'remove_action' | 'add_condition' | 'add_loop' | 'add_variable' | 'get_details' | 'publish';
40
+ interface FlowConfig {
41
+ name: string;
42
+ internal_name?: string;
43
+ description?: string;
44
+ active?: boolean;
45
+ application_scope?: string;
46
+ run_as?: 'system' | 'user_who_triggers' | 'specific_user';
47
+ run_as_user?: string;
48
+ }
49
+ interface TriggerConfig {
50
+ type: 'record' | 'scheduled' | 'api' | 'inbound_email' | 'service_catalog';
51
+ table?: string;
52
+ condition?: string;
53
+ when?: 'created' | 'updated' | 'deleted' | 'created_or_updated';
54
+ schedule?: {
55
+ frequency: 'daily' | 'weekly' | 'monthly' | 'custom';
56
+ time?: string;
57
+ days?: number[];
58
+ cron?: string;
59
+ };
60
+ }
61
+ interface ActionConfig {
62
+ type: string;
63
+ name?: string;
64
+ description?: string;
65
+ order?: number;
66
+ inputs?: Record<string, any>;
67
+ parent_logic_instance?: string;
68
+ branch?: 'then' | 'else';
69
+ }
70
+ interface ConditionConfig {
71
+ name?: string;
72
+ condition: string;
73
+ order?: number;
74
+ then_actions?: ActionConfig[];
75
+ else_actions?: ActionConfig[];
76
+ parent_logic_instance?: string;
77
+ }
78
+ interface LoopConfig {
79
+ name?: string;
80
+ type: 'for_each' | 'do_until';
81
+ data_source?: string;
82
+ condition?: string;
83
+ max_iterations?: number;
84
+ order?: number;
85
+ actions?: ActionConfig[];
86
+ parent_logic_instance?: string;
87
+ }
88
+ interface VariableConfig {
89
+ name: string;
90
+ type: 'string' | 'integer' | 'boolean' | 'reference' | 'object' | 'array' | 'glide_date_time';
91
+ direction: 'input' | 'output' | 'scratch';
92
+ label?: string;
93
+ description?: string;
94
+ mandatory?: boolean;
95
+ default_value?: string;
96
+ reference_table?: string;
97
+ }
98
+ interface ManageFlowArgs {
99
+ action: ManageFlowAction;
100
+ flow?: FlowConfig;
101
+ trigger?: TriggerConfig;
102
+ actions?: ActionConfig[];
103
+ conditions?: ConditionConfig[];
104
+ loops?: LoopConfig[];
105
+ variables?: VariableConfig[];
106
+ flow_id?: string;
107
+ flow_name?: string;
108
+ updates?: Partial<FlowConfig>;
109
+ new_name?: string;
110
+ action_config?: ActionConfig;
111
+ condition_config?: ConditionConfig;
112
+ loop_config?: LoopConfig;
113
+ variable_config?: VariableConfig;
114
+ action_id?: string;
115
+ auto_activate?: boolean;
116
+ create_snapshot?: boolean;
117
+ use_compression?: boolean;
118
+ validate_only?: boolean;
119
+ }
120
+ export declare const toolDefinition: MCPToolDefinition;
121
+ export declare function execute(args: ManageFlowArgs, context: ServiceNowContext): Promise<ToolResult>;
122
+ export declare const version = "2.1.0";
123
+ export declare const author = "Snow-Flow v8.41.13 - Flow Designer Management (snapshot fix)";
124
+ export {};
125
+ //# sourceMappingURL=snow_manage_flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snow_manage_flow.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/flow-designer/snow_manage_flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAyEzF,KAAK,gBAAgB,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,eAAe,GACf,UAAU,GACV,cAAc,GACd,aAAa,GACb,SAAS,CAAC;AAEd,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,eAAe,CAAC;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,KA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