snow-flow 8.41.14 → 8.41.16
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/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.d.ts +11 -2
- package/dist/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.js +180 -19
- package/dist/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.js.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.d.ts +2 -2
- package/dist/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.d.ts.map +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.js +23 -6
- package/dist/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* snow_create_business_rule
|
|
3
|
+
*
|
|
4
|
+
* Creates server-side business rules in ServiceNow.
|
|
5
|
+
* Supports all major business rule configurations including:
|
|
6
|
+
* - Trigger conditions (insert/update/delete/query)
|
|
7
|
+
* - Filter conditions (encoded query)
|
|
8
|
+
* - Script conditions
|
|
9
|
+
* - Execution order
|
|
10
|
+
* - Role conditions
|
|
11
|
+
* - Abort actions and messages
|
|
3
12
|
*/
|
|
4
13
|
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
5
14
|
export declare const toolDefinition: MCPToolDefinition;
|
|
6
15
|
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
7
|
-
export declare const version = "
|
|
8
|
-
export declare const author = "Snow-Flow
|
|
16
|
+
export declare const version = "2.0.0";
|
|
17
|
+
export declare const author = "Snow-Flow v8.41.15";
|
|
9
18
|
//# sourceMappingURL=snow_create_business_rule.d.ts.map
|
package/dist/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow_create_business_rule.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"snow_create_business_rule.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBAyH5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAqGxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* snow_create_business_rule
|
|
4
|
+
*
|
|
5
|
+
* Creates server-side business rules in ServiceNow.
|
|
6
|
+
* Supports all major business rule configurations including:
|
|
7
|
+
* - Trigger conditions (insert/update/delete/query)
|
|
8
|
+
* - Filter conditions (encoded query)
|
|
9
|
+
* - Script conditions
|
|
10
|
+
* - Execution order
|
|
11
|
+
* - Role conditions
|
|
12
|
+
* - Abort actions and messages
|
|
4
13
|
*/
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
@@ -9,7 +18,7 @@ const auth_js_1 = require("../../shared/auth.js");
|
|
|
9
18
|
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
10
19
|
exports.toolDefinition = {
|
|
11
20
|
name: 'snow_create_business_rule',
|
|
12
|
-
description: 'Create server-side business rule (ES5 only!)',
|
|
21
|
+
description: 'Create server-side business rule with full configuration options (ES5 only for scripts!)',
|
|
13
22
|
// Metadata for tool discovery (not sent to LLM)
|
|
14
23
|
category: 'development',
|
|
15
24
|
subcategory: 'platform',
|
|
@@ -23,44 +32,196 @@ exports.toolDefinition = {
|
|
|
23
32
|
inputSchema: {
|
|
24
33
|
type: 'object',
|
|
25
34
|
properties: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
// Basic Info
|
|
36
|
+
name: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'Business rule name'
|
|
39
|
+
},
|
|
40
|
+
table: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Table name (e.g., incident, task, sys_user)'
|
|
43
|
+
},
|
|
44
|
+
description: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Description of what this business rule does'
|
|
47
|
+
},
|
|
48
|
+
// When to Run
|
|
49
|
+
when: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
enum: ['before', 'after', 'async', 'display'],
|
|
52
|
+
default: 'before',
|
|
53
|
+
description: 'When to execute: before (before DB), after (after DB), async (scheduled), display (form load)'
|
|
54
|
+
},
|
|
55
|
+
order: {
|
|
56
|
+
type: 'number',
|
|
57
|
+
default: 100,
|
|
58
|
+
description: 'Execution order (lower = runs first). Default: 100'
|
|
59
|
+
},
|
|
60
|
+
// Trigger Operations
|
|
61
|
+
insert: {
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
description: 'Run on insert operations'
|
|
65
|
+
},
|
|
66
|
+
update: {
|
|
67
|
+
type: 'boolean',
|
|
68
|
+
default: false,
|
|
69
|
+
description: 'Run on update operations'
|
|
70
|
+
},
|
|
71
|
+
delete: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
default: false,
|
|
74
|
+
description: 'Run on delete operations'
|
|
75
|
+
},
|
|
76
|
+
query: {
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
default: false,
|
|
79
|
+
description: 'Run on query operations'
|
|
80
|
+
},
|
|
81
|
+
// Conditions
|
|
82
|
+
filter_condition: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Encoded query filter (e.g., "active=true^priority=1"). Record must match this to trigger the rule.'
|
|
85
|
+
},
|
|
86
|
+
condition: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Script condition that must return true (ES5 only!). E.g., "current.priority == 1"'
|
|
89
|
+
},
|
|
90
|
+
role_conditions: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
description: 'Comma-separated role sys_ids. Only users with these roles trigger the rule.'
|
|
93
|
+
},
|
|
94
|
+
// Script
|
|
95
|
+
script: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'Script to execute (ES5 ONLY! No const/let/arrow functions). Use current/previous objects.'
|
|
98
|
+
},
|
|
99
|
+
// Actions
|
|
100
|
+
abort_action: {
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
default: false,
|
|
103
|
+
description: 'Abort the database action (only works with "before" rules)'
|
|
104
|
+
},
|
|
105
|
+
add_message: {
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
default: false,
|
|
108
|
+
description: 'Add an info message to the user'
|
|
109
|
+
},
|
|
110
|
+
message: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'Message text to display (requires add_message=true)'
|
|
113
|
+
},
|
|
114
|
+
// Advanced
|
|
115
|
+
active: {
|
|
116
|
+
type: 'boolean',
|
|
117
|
+
default: true,
|
|
118
|
+
description: 'Whether the business rule is active'
|
|
119
|
+
},
|
|
120
|
+
access: {
|
|
121
|
+
type: 'string',
|
|
122
|
+
enum: ['package_private', 'public'],
|
|
123
|
+
default: 'package_private',
|
|
124
|
+
description: 'Access level for the business rule'
|
|
125
|
+
},
|
|
126
|
+
application_scope: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
description: 'Application scope sys_id (leave empty for global)'
|
|
129
|
+
}
|
|
36
130
|
},
|
|
37
|
-
required: ['name', 'table'
|
|
131
|
+
required: ['name', 'table']
|
|
38
132
|
}
|
|
39
133
|
};
|
|
40
134
|
async function execute(args, context) {
|
|
41
|
-
const {
|
|
135
|
+
const {
|
|
136
|
+
// Basic
|
|
137
|
+
name, table, description,
|
|
138
|
+
// When
|
|
139
|
+
when = 'before', order = 100,
|
|
140
|
+
// Operations
|
|
141
|
+
insert = false, update = false, delete: del = false, query = false,
|
|
142
|
+
// Conditions
|
|
143
|
+
filter_condition, condition, role_conditions,
|
|
144
|
+
// Script
|
|
145
|
+
script,
|
|
146
|
+
// Actions
|
|
147
|
+
abort_action = false, add_message = false, message,
|
|
148
|
+
// Advanced
|
|
149
|
+
active = true, access = 'package_private', application_scope } = args;
|
|
150
|
+
// Validate: at least one operation must be selected
|
|
151
|
+
if (!insert && !update && !del && !query) {
|
|
152
|
+
return (0, error_handler_js_1.createErrorResult)('At least one operation must be selected: insert, update, delete, or query');
|
|
153
|
+
}
|
|
154
|
+
// Validate: script is required unless it's just an abort action
|
|
155
|
+
if (!script && !abort_action) {
|
|
156
|
+
return (0, error_handler_js_1.createErrorResult)('Either script or abort_action is required');
|
|
157
|
+
}
|
|
42
158
|
try {
|
|
43
159
|
const client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
160
|
+
// Build the business rule data object
|
|
44
161
|
const brData = {
|
|
45
162
|
name,
|
|
46
163
|
collection: table,
|
|
47
164
|
when,
|
|
165
|
+
order,
|
|
48
166
|
action_insert: insert,
|
|
49
167
|
action_update: update,
|
|
50
168
|
action_delete: del,
|
|
51
169
|
action_query: query,
|
|
52
|
-
|
|
53
|
-
|
|
170
|
+
active,
|
|
171
|
+
access
|
|
54
172
|
};
|
|
173
|
+
// Optional fields
|
|
174
|
+
if (description)
|
|
175
|
+
brData.description = description;
|
|
176
|
+
if (filter_condition)
|
|
177
|
+
brData.filter_condition = filter_condition;
|
|
55
178
|
if (condition)
|
|
56
179
|
brData.condition = condition;
|
|
180
|
+
if (role_conditions)
|
|
181
|
+
brData.role_conditions = role_conditions;
|
|
182
|
+
if (script)
|
|
183
|
+
brData.script = script;
|
|
184
|
+
if (abort_action)
|
|
185
|
+
brData.abort_action = abort_action;
|
|
186
|
+
if (add_message)
|
|
187
|
+
brData.add_message = add_message;
|
|
188
|
+
if (message)
|
|
189
|
+
brData.message = message;
|
|
190
|
+
if (application_scope)
|
|
191
|
+
brData.sys_scope = application_scope;
|
|
57
192
|
const response = await client.post('/api/now/table/sys_script', brData);
|
|
58
|
-
|
|
193
|
+
const result = response.data.result;
|
|
194
|
+
// Build response with helpful info
|
|
195
|
+
const instanceUrl = (client.defaults?.baseURL || '').replace('/api/now', '');
|
|
196
|
+
return (0, error_handler_js_1.createSuccessResult)({
|
|
197
|
+
created: true,
|
|
198
|
+
business_rule: {
|
|
199
|
+
sys_id: result.sys_id,
|
|
200
|
+
name: result.name,
|
|
201
|
+
table: result.collection,
|
|
202
|
+
when: result.when,
|
|
203
|
+
order: result.order,
|
|
204
|
+
operations: {
|
|
205
|
+
insert: result.action_insert === 'true',
|
|
206
|
+
update: result.action_update === 'true',
|
|
207
|
+
delete: result.action_delete === 'true',
|
|
208
|
+
query: result.action_query === 'true'
|
|
209
|
+
},
|
|
210
|
+
active: result.active === 'true',
|
|
211
|
+
url: `${instanceUrl}/sys_script.do?sys_id=${result.sys_id}`
|
|
212
|
+
},
|
|
213
|
+
tips: [
|
|
214
|
+
'Use "current" to access the current record being processed',
|
|
215
|
+
'Use "previous" to access the previous values (on update)',
|
|
216
|
+
'Use "gs" for GlideSystem methods like gs.info(), gs.addInfoMessage()',
|
|
217
|
+
'Remember: ES5 ONLY - no const, let, arrow functions, or template literals!'
|
|
218
|
+
]
|
|
219
|
+
});
|
|
59
220
|
}
|
|
60
221
|
catch (error) {
|
|
61
|
-
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
222
|
+
return (0, error_handler_js_1.createErrorResult)(`Failed to create business rule: ${error.response?.data?.error?.message || error.message}`);
|
|
62
223
|
}
|
|
63
224
|
}
|
|
64
|
-
exports.version = '
|
|
65
|
-
exports.author = 'Snow-Flow
|
|
225
|
+
exports.version = '2.0.0';
|
|
226
|
+
exports.author = 'Snow-Flow v8.41.15';
|
|
66
227
|
//# sourceMappingURL=snow_create_business_rule.js.map
|
package/dist/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow_create_business_rule.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"snow_create_business_rule.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/business-rules/snow_create_business_rule.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAiIH,0BAqGC;AAnOD,kDAA8D;AAC9D,oEAAuF;AAE1E,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,2BAA2B;IACjC,WAAW,EAAE,0FAA0F;IACvG,gDAAgD;IAChD,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,CAAC,gBAAgB,EAAE,aAAa,EAAE,YAAY,CAAC;IAC1D,UAAU,EAAE,cAAc;IAC1B,SAAS,EAAE,MAAM;IAEjB,yBAAyB;IACzB,2DAA2D;IAC3D,UAAU,EAAE,OAAO;IACnB,YAAY,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;IACpC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa;YACb,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oBAAoB;aAClC;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd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,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAE7E,OAAO,IAAA,sCAAmB,EAAC;YACzB,OAAO,EAAE,IAAI;YACb,aAAa,EAAE;gBACb,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,UAAU,EAAE;oBACV,MAAM,EAAE,MAAM,CAAC,aAAa,KAAK,MAAM;oBACvC,MAAM,EAAE,MAAM,CAAC,aAAa,KAAK,MAAM;oBACvC,MAAM,EAAE,MAAM,CAAC,aAAa,KAAK,MAAM;oBACvC,KAAK,EAAE,MAAM,CAAC,YAAY,KAAK,MAAM;iBACtC;gBACD,MAAM,EAAE,MAAM,CAAC,MAAM,KAAK,MAAM;gBAChC,GAAG,EAAE,GAAG,WAAW,yBAAyB,MAAM,CAAC,MAAM,EAAE;aAC5D;YACD,IAAI,EAAE;gBACJ,4DAA4D;gBAC5D,0DAA0D;gBAC1D,sEAAsE;gBACtE,4EAA4E;aAC7E;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oCAAiB,EAAC,mCAAmC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACvH,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,oBAAoB,CAAC"}
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
8
8
|
export declare const toolDefinition: MCPToolDefinition;
|
|
9
9
|
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
10
|
-
export declare const version = "1.
|
|
11
|
-
export declare const author = "Snow-Flow
|
|
10
|
+
export declare const version = "1.1.0";
|
|
11
|
+
export declare const author = "Snow-Flow v8.41.16";
|
|
12
12
|
//# sourceMappingURL=snow_create_ui_policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow_create_ui_policy.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"snow_create_ui_policy.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAkBzF,eAAO,MAAM,cAAc,EAAE,iBAkE5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAqFxF;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,uBAAuB,CAAC"}
|
|
@@ -10,6 +10,20 @@ exports.author = exports.version = exports.toolDefinition = void 0;
|
|
|
10
10
|
exports.execute = execute;
|
|
11
11
|
const auth_js_1 = require("../../shared/auth.js");
|
|
12
12
|
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
13
|
+
/**
|
|
14
|
+
* Extract sys_id from API response - handles both string and object formats
|
|
15
|
+
* ServiceNow Table API can return sys_id as:
|
|
16
|
+
* - String: "abc123def456"
|
|
17
|
+
* - Object: { value: "abc123def456", link: "...", display_value: "..." }
|
|
18
|
+
*/
|
|
19
|
+
function extractSysId(value) {
|
|
20
|
+
if (!value)
|
|
21
|
+
return '';
|
|
22
|
+
if (typeof value === 'object' && value.value) {
|
|
23
|
+
return value.value;
|
|
24
|
+
}
|
|
25
|
+
return String(value);
|
|
26
|
+
}
|
|
13
27
|
exports.toolDefinition = {
|
|
14
28
|
name: 'snow_create_ui_policy',
|
|
15
29
|
description: 'Create UI Policy for form field control (visibility, mandatory, readonly)',
|
|
@@ -95,11 +109,13 @@ async function execute(args, context) {
|
|
|
95
109
|
};
|
|
96
110
|
const policyResponse = await client.post('/api/now/table/sys_ui_policy', uiPolicyData);
|
|
97
111
|
const uiPolicy = policyResponse.data.result;
|
|
112
|
+
// Extract the sys_id properly - API can return string or object
|
|
113
|
+
const policySysId = extractSysId(uiPolicy.sys_id);
|
|
98
114
|
// Create UI Policy Actions
|
|
99
115
|
const createdActions = [];
|
|
100
116
|
for (const action of actions) {
|
|
101
117
|
const actionData = {
|
|
102
|
-
ui_policy:
|
|
118
|
+
ui_policy: policySysId,
|
|
103
119
|
field: action.field_name,
|
|
104
120
|
visible: action.visible !== undefined ? action.visible : true,
|
|
105
121
|
mandatory: action.mandatory || false,
|
|
@@ -112,7 +128,7 @@ async function execute(args, context) {
|
|
|
112
128
|
return (0, error_handler_js_1.createSuccessResult)({
|
|
113
129
|
created: true,
|
|
114
130
|
ui_policy: {
|
|
115
|
-
sys_id:
|
|
131
|
+
sys_id: policySysId,
|
|
116
132
|
name: uiPolicy.short_description,
|
|
117
133
|
table: uiPolicy.table,
|
|
118
134
|
condition: uiPolicy.conditions,
|
|
@@ -121,12 +137,13 @@ async function execute(args, context) {
|
|
|
121
137
|
active: uiPolicy.active === 'true'
|
|
122
138
|
},
|
|
123
139
|
actions: createdActions.map(action => ({
|
|
124
|
-
sys_id: action.sys_id,
|
|
140
|
+
sys_id: extractSysId(action.sys_id),
|
|
125
141
|
field: action.field,
|
|
126
142
|
visible: action.visible === 'true',
|
|
127
143
|
mandatory: action.mandatory === 'true',
|
|
128
144
|
readonly: action.readonly === 'true',
|
|
129
|
-
cleared: action.cleared === 'true'
|
|
145
|
+
cleared: action.cleared === 'true',
|
|
146
|
+
ui_policy_reference: policySysId
|
|
130
147
|
})),
|
|
131
148
|
total_actions: createdActions.length,
|
|
132
149
|
best_practices: [
|
|
@@ -142,6 +159,6 @@ async function execute(args, context) {
|
|
|
142
159
|
return (0, error_handler_js_1.createErrorResult)(error.message);
|
|
143
160
|
}
|
|
144
161
|
}
|
|
145
|
-
exports.version = '1.
|
|
146
|
-
exports.author = 'Snow-Flow
|
|
162
|
+
exports.version = '1.1.0';
|
|
163
|
+
exports.author = 'Snow-Flow v8.41.16';
|
|
147
164
|
//# sourceMappingURL=snow_create_ui_policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snow_create_ui_policy.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"snow_create_ui_policy.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/platform/snow_create_ui_policy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAwFH,0BAqFC;AA1KD,kDAA8D;AAC9D,oEAAuF;AAEvF;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAU;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAEY,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,2EAA2E;IACxF,gDAAgD;IAChD,QAAQ,EAAE,aAAa;I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,QAAQ,KAAK,MAAM;gBACpC,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,MAAM;gBAClC,mBAAmB,EAAE,WAAW;aACjC,CAAC,CAAC;YACH,aAAa,EAAE,cAAc,CAAC,MAAM;YACpC,cAAc,EAAE;gBACd,2EAA2E;gBAC3E,8CAA8C;gBAC9C,6CAA6C;gBAC7C,wDAAwD;gBACxD,yCAAyC;aAC1C;SACF,CAAC,CAAC;IAEL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "8.41.
|
|
3
|
+
"version": "8.41.16",
|
|
4
4
|
"description": "ServiceNow development with SnowCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 395 Optimized Tools • 2 MCP Servers • Multi-agent orchestration • Use ANY AI coding assistant (ML tools moved to Enterprise)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|