@sonisoft/now-sdk-ext-core 3.0.2 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/sn/BackgroundScriptExecutor.js +2 -4
- package/dist/sn/BackgroundScriptExecutor.js.map +1 -1
- package/dist/sn/catalog/CatalogManager.d.ts +101 -0
- package/dist/sn/catalog/CatalogManager.js +352 -0
- package/dist/sn/catalog/CatalogManager.js.map +1 -0
- package/dist/sn/catalog/CatalogModels.d.ts +177 -0
- package/dist/sn/catalog/CatalogModels.js +6 -0
- package/dist/sn/catalog/CatalogModels.js.map +1 -0
- package/dist/sn/flow/FlowManager.d.ts +69 -0
- package/dist/sn/flow/FlowManager.js +571 -0
- package/dist/sn/flow/FlowManager.js.map +1 -0
- package/dist/sn/flow/FlowModels.d.ts +146 -0
- package/dist/sn/flow/FlowModels.js +7 -0
- package/dist/sn/flow/FlowModels.js.map +1 -0
- package/dist/sn/knowledge/KnowledgeManager.d.ts +93 -0
- package/dist/sn/knowledge/KnowledgeManager.js +316 -0
- package/dist/sn/knowledge/KnowledgeManager.js.map +1 -0
- package/dist/sn/knowledge/KnowledgeModels.d.ts +234 -0
- package/dist/sn/knowledge/KnowledgeModels.js +6 -0
- package/dist/sn/knowledge/KnowledgeModels.js.map +1 -0
- package/dist/sn/xml/XMLRecordManager.d.ts +35 -0
- package/dist/sn/xml/XMLRecordManager.js +157 -0
- package/dist/sn/xml/XMLRecordManager.js.map +1 -0
- package/dist/sn/xml/XMLRecordModels.d.ts +42 -0
- package/dist/sn/xml/XMLRecordModels.js +2 -0
- package/dist/sn/xml/XMLRecordModels.js.map +1 -0
- package/dist/util/CSRFTokenHelper.d.ts +16 -0
- package/dist/util/CSRFTokenHelper.js +23 -0
- package/dist/util/CSRFTokenHelper.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { BackgroundScriptExecutor } from "../BackgroundScriptExecutor.js";
|
|
2
|
+
import { Logger } from "../../util/Logger.js";
|
|
3
|
+
const RESULT_MARKER = '___FLOW_EXEC_RESULT___';
|
|
4
|
+
const VALID_TYPES = ['flow', 'subflow', 'action'];
|
|
5
|
+
/**
|
|
6
|
+
* Provides operations for executing ServiceNow Flow Designer flows,
|
|
7
|
+
* subflows, and actions remotely via BackgroundScriptExecutor.
|
|
8
|
+
*
|
|
9
|
+
* Uses the sn_fd.FlowAPI.getRunner() (ScriptableFlowRunner) API
|
|
10
|
+
* on the server side to execute and capture results.
|
|
11
|
+
*/
|
|
12
|
+
export class FlowManager {
|
|
13
|
+
_logger = new Logger("FlowManager");
|
|
14
|
+
_bgExecutor;
|
|
15
|
+
_instance;
|
|
16
|
+
_defaultScope;
|
|
17
|
+
/**
|
|
18
|
+
* @param instance ServiceNow instance connection
|
|
19
|
+
* @param scope Default scope for script execution (default: "global")
|
|
20
|
+
*/
|
|
21
|
+
constructor(instance, scope = 'global') {
|
|
22
|
+
this._instance = instance;
|
|
23
|
+
this._defaultScope = scope;
|
|
24
|
+
this._bgExecutor = new BackgroundScriptExecutor(instance, scope);
|
|
25
|
+
}
|
|
26
|
+
// ================================================================
|
|
27
|
+
// Public API
|
|
28
|
+
// ================================================================
|
|
29
|
+
/** Execute any flow object (flow, subflow, or action). */
|
|
30
|
+
async execute(options) {
|
|
31
|
+
if (!options.scopedName || options.scopedName.trim().length === 0) {
|
|
32
|
+
throw new Error('Flow scoped name is required (e.g. "global.my_flow")');
|
|
33
|
+
}
|
|
34
|
+
if (!options.type) {
|
|
35
|
+
throw new Error('Flow object type is required ("flow", "subflow", or "action")');
|
|
36
|
+
}
|
|
37
|
+
if (!VALID_TYPES.includes(options.type)) {
|
|
38
|
+
throw new Error(`Invalid flow object type "${options.type}". Must be one of: ${VALID_TYPES.join(', ')}`);
|
|
39
|
+
}
|
|
40
|
+
this._logger.info(`Executing ${options.type}: ${options.scopedName}`);
|
|
41
|
+
const script = this._buildFlowScript(options);
|
|
42
|
+
const scope = options.scope || this._defaultScope;
|
|
43
|
+
try {
|
|
44
|
+
const bgResult = await this._bgExecutor.executeScript(script, scope, this._instance);
|
|
45
|
+
const flowResult = this._parseFlowResult(bgResult, options);
|
|
46
|
+
this._logger.info(`${options.type} execution complete: ${flowResult.success ? 'SUCCESS' : 'FAILED'}`);
|
|
47
|
+
return flowResult;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const err = error;
|
|
51
|
+
this._logger.error(`Error executing ${options.type} "${options.scopedName}": ${err.message}`);
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
flowObjectName: options.scopedName,
|
|
55
|
+
flowObjectType: options.type,
|
|
56
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
57
|
+
rawScriptResult: null
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Execute a flow by scoped name. */
|
|
62
|
+
async executeFlow(options) {
|
|
63
|
+
return this.execute({ ...options, type: 'flow' });
|
|
64
|
+
}
|
|
65
|
+
/** Execute a subflow by scoped name. */
|
|
66
|
+
async executeSubflow(options) {
|
|
67
|
+
return this.execute({ ...options, type: 'subflow' });
|
|
68
|
+
}
|
|
69
|
+
/** Execute an action by scoped name. */
|
|
70
|
+
async executeAction(options) {
|
|
71
|
+
return this.execute({ ...options, type: 'action' });
|
|
72
|
+
}
|
|
73
|
+
// ================================================================
|
|
74
|
+
// Flow Context Lifecycle API
|
|
75
|
+
// ================================================================
|
|
76
|
+
/** Query the status of a flow context by its sys_id. */
|
|
77
|
+
async getFlowContextStatus(contextId) {
|
|
78
|
+
this._validateContextId(contextId);
|
|
79
|
+
this._logger.info(`Getting context status: ${contextId}`);
|
|
80
|
+
const script = this._buildContextStatusScript(contextId);
|
|
81
|
+
try {
|
|
82
|
+
const bgResult = await this._bgExecutor.executeScript(script, this._defaultScope, this._instance);
|
|
83
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
84
|
+
if (envelope) {
|
|
85
|
+
return {
|
|
86
|
+
success: envelope.success,
|
|
87
|
+
contextId,
|
|
88
|
+
found: envelope.found ?? false,
|
|
89
|
+
state: envelope.state ?? undefined,
|
|
90
|
+
name: envelope.name ?? undefined,
|
|
91
|
+
started: envelope.started ?? undefined,
|
|
92
|
+
ended: envelope.ended ?? undefined,
|
|
93
|
+
errorMessage: envelope.errorMessage ?? undefined,
|
|
94
|
+
rawScriptResult: bgResult
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
success: false, contextId, found: false,
|
|
99
|
+
errorMessage: 'Could not parse context status result from script output.',
|
|
100
|
+
rawScriptResult: bgResult
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const err = error;
|
|
105
|
+
return {
|
|
106
|
+
success: false, contextId, found: false,
|
|
107
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
108
|
+
rawScriptResult: null
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Retrieve outputs from a completed flow/subflow/action by context ID. */
|
|
113
|
+
async getFlowOutputs(contextId) {
|
|
114
|
+
this._validateContextId(contextId);
|
|
115
|
+
this._logger.info(`Getting outputs for context: ${contextId}`);
|
|
116
|
+
const script = this._buildGetOutputsScript(contextId);
|
|
117
|
+
try {
|
|
118
|
+
const bgResult = await this._bgExecutor.executeScript(script, this._defaultScope, this._instance);
|
|
119
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
120
|
+
if (envelope) {
|
|
121
|
+
return {
|
|
122
|
+
success: envelope.success,
|
|
123
|
+
contextId,
|
|
124
|
+
outputs: envelope.outputs ?? undefined,
|
|
125
|
+
errorMessage: envelope.errorMessage ?? undefined,
|
|
126
|
+
rawScriptResult: bgResult
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
success: false, contextId,
|
|
131
|
+
errorMessage: 'Could not parse outputs result from script output.',
|
|
132
|
+
rawScriptResult: bgResult
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
const err = error;
|
|
137
|
+
return {
|
|
138
|
+
success: false, contextId,
|
|
139
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
140
|
+
rawScriptResult: null
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Retrieve error messages from a flow/subflow/action by context ID. */
|
|
145
|
+
async getFlowError(contextId) {
|
|
146
|
+
this._validateContextId(contextId);
|
|
147
|
+
this._logger.info(`Getting error for context: ${contextId}`);
|
|
148
|
+
const script = this._buildGetErrorScript(contextId);
|
|
149
|
+
try {
|
|
150
|
+
const bgResult = await this._bgExecutor.executeScript(script, this._defaultScope, this._instance);
|
|
151
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
152
|
+
if (envelope) {
|
|
153
|
+
return {
|
|
154
|
+
success: envelope.success,
|
|
155
|
+
contextId,
|
|
156
|
+
flowErrorMessage: envelope.flowErrorMessage ?? undefined,
|
|
157
|
+
errorMessage: envelope.errorMessage ?? undefined,
|
|
158
|
+
rawScriptResult: bgResult
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
success: false, contextId,
|
|
163
|
+
errorMessage: 'Could not parse error result from script output.',
|
|
164
|
+
rawScriptResult: bgResult
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
const err = error;
|
|
169
|
+
return {
|
|
170
|
+
success: false, contextId,
|
|
171
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
172
|
+
rawScriptResult: null
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Cancel a running or paused flow/subflow/action. */
|
|
177
|
+
async cancelFlow(contextId, reason) {
|
|
178
|
+
this._validateContextId(contextId);
|
|
179
|
+
this._logger.info(`Cancelling context: ${contextId}`);
|
|
180
|
+
const script = this._buildCancelScript(contextId, reason || 'Cancelled via FlowManager');
|
|
181
|
+
try {
|
|
182
|
+
const bgResult = await this._bgExecutor.executeScript(script, this._defaultScope, this._instance);
|
|
183
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
184
|
+
if (envelope) {
|
|
185
|
+
return {
|
|
186
|
+
success: envelope.success,
|
|
187
|
+
contextId,
|
|
188
|
+
errorMessage: envelope.errorMessage ?? undefined,
|
|
189
|
+
rawScriptResult: bgResult
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
success: false, contextId,
|
|
194
|
+
errorMessage: 'Could not parse cancel result from script output.',
|
|
195
|
+
rawScriptResult: bgResult
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
const err = error;
|
|
200
|
+
return {
|
|
201
|
+
success: false, contextId,
|
|
202
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
203
|
+
rawScriptResult: null
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** Send a message to a paused flow to resume it (for Wait for Message actions). */
|
|
208
|
+
async sendFlowMessage(contextId, message, payload) {
|
|
209
|
+
this._validateContextId(contextId);
|
|
210
|
+
if (!message || message.trim().length === 0) {
|
|
211
|
+
throw new Error('Message is required');
|
|
212
|
+
}
|
|
213
|
+
this._logger.info(`Sending message to context: ${contextId}`);
|
|
214
|
+
const script = this._buildSendMessageScript(contextId, message, payload || '');
|
|
215
|
+
try {
|
|
216
|
+
const bgResult = await this._bgExecutor.executeScript(script, this._defaultScope, this._instance);
|
|
217
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
218
|
+
if (envelope) {
|
|
219
|
+
return {
|
|
220
|
+
success: envelope.success,
|
|
221
|
+
contextId,
|
|
222
|
+
errorMessage: envelope.errorMessage ?? undefined,
|
|
223
|
+
rawScriptResult: bgResult
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
success: false, contextId,
|
|
228
|
+
errorMessage: 'Could not parse send message result from script output.',
|
|
229
|
+
rawScriptResult: bgResult
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
const err = error;
|
|
234
|
+
return {
|
|
235
|
+
success: false, contextId,
|
|
236
|
+
errorMessage: `Script execution error: ${err.message}`,
|
|
237
|
+
rawScriptResult: null
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// ================================================================
|
|
242
|
+
// Internal Methods
|
|
243
|
+
// ================================================================
|
|
244
|
+
/** Build the ServiceNow server-side script string. */
|
|
245
|
+
_buildFlowScript(options) {
|
|
246
|
+
const mode = options.mode || 'foreground';
|
|
247
|
+
const modeMethod = mode === 'background' ? 'inBackground' : 'inForeground';
|
|
248
|
+
const inputsJson = options.inputs ? this._serializeInputs(options.inputs) : '{}';
|
|
249
|
+
const scopedName = options.scopedName.replace(/'/g, "\\'");
|
|
250
|
+
const type = options.type;
|
|
251
|
+
let optionalChain = '';
|
|
252
|
+
if (options.timeout !== undefined && options.timeout !== null) {
|
|
253
|
+
optionalChain += `\n .timeout(${options.timeout})`;
|
|
254
|
+
}
|
|
255
|
+
if (options.quick === true) {
|
|
256
|
+
optionalChain += `\n .quick()`;
|
|
257
|
+
}
|
|
258
|
+
const hasInputs = options.inputs && Object.keys(options.inputs).length > 0;
|
|
259
|
+
const inputsChain = hasInputs ? `\n .withInputs(inputs)` : '';
|
|
260
|
+
return `(function() {
|
|
261
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
262
|
+
try {
|
|
263
|
+
var inputs = ${inputsJson};
|
|
264
|
+
|
|
265
|
+
var result = sn_fd.FlowAPI.getRunner()
|
|
266
|
+
.${type}('${scopedName}')
|
|
267
|
+
.${modeMethod}()${optionalChain}${inputsChain}
|
|
268
|
+
.run();
|
|
269
|
+
|
|
270
|
+
var envelope = {
|
|
271
|
+
__flowResult: true,
|
|
272
|
+
success: true,
|
|
273
|
+
flowObjectName: '' + result.getFlowObjectName(),
|
|
274
|
+
flowObjectType: '' + result.getFlowObjectType(),
|
|
275
|
+
contextId: result.getContextId() ? '' + result.getContextId() : null,
|
|
276
|
+
executionDate: result.getDate() ? '' + result.getDate() : null,
|
|
277
|
+
domainId: result.getDomainId() ? '' + result.getDomainId() : null,
|
|
278
|
+
outputs: null,
|
|
279
|
+
debugOutput: '' + result.debug(),
|
|
280
|
+
errorMessage: null
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
try {
|
|
284
|
+
var rawOutputs = result.getOutputs();
|
|
285
|
+
if (rawOutputs) {
|
|
286
|
+
var outputObj = {};
|
|
287
|
+
for (var key in rawOutputs) {
|
|
288
|
+
if (rawOutputs.hasOwnProperty(key)) {
|
|
289
|
+
outputObj[key] = '' + rawOutputs[key];
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
envelope.outputs = outputObj;
|
|
293
|
+
}
|
|
294
|
+
} catch (outErr) {
|
|
295
|
+
envelope.outputs = null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
gs.info(__RESULT_MARKER + JSON.stringify(envelope));
|
|
299
|
+
} catch (ex) {
|
|
300
|
+
var errorEnvelope = {
|
|
301
|
+
__flowResult: true,
|
|
302
|
+
success: false,
|
|
303
|
+
flowObjectName: '${scopedName}',
|
|
304
|
+
flowObjectType: '${type}',
|
|
305
|
+
contextId: null,
|
|
306
|
+
executionDate: null,
|
|
307
|
+
domainId: null,
|
|
308
|
+
outputs: null,
|
|
309
|
+
debugOutput: '',
|
|
310
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
311
|
+
};
|
|
312
|
+
gs.info(__RESULT_MARKER + JSON.stringify(errorEnvelope));
|
|
313
|
+
}
|
|
314
|
+
})();`;
|
|
315
|
+
}
|
|
316
|
+
/** Serialize inputs for embedding in the generated script. */
|
|
317
|
+
_serializeInputs(inputs) {
|
|
318
|
+
const cleanInputs = {};
|
|
319
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
320
|
+
if (value !== undefined) {
|
|
321
|
+
cleanInputs[key] = value;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return JSON.stringify(cleanInputs);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Decode HTML entities and strip HTML tags from a string.
|
|
328
|
+
* ServiceNow's background script output encodes quotes as "
|
|
329
|
+
* and appends <BR/> tags that must be removed before JSON parsing.
|
|
330
|
+
*/
|
|
331
|
+
_decodeHtmlEntities(str) {
|
|
332
|
+
return str
|
|
333
|
+
.replace(/<BR\s*\/?>/gi, '')
|
|
334
|
+
.replace(/"/g, '"')
|
|
335
|
+
.replace(/&/g, '&')
|
|
336
|
+
.replace(/</g, '<')
|
|
337
|
+
.replace(/>/g, '>')
|
|
338
|
+
.replace(/'/g, "'")
|
|
339
|
+
.replace(/'/g, "'")
|
|
340
|
+
.trim();
|
|
341
|
+
}
|
|
342
|
+
/** Try to parse a line containing the result marker into a FlowScriptResultEnvelope. */
|
|
343
|
+
_tryParseEnvelopeFromLine(line) {
|
|
344
|
+
if (!line || !line.includes(RESULT_MARKER)) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const afterMarker = line.substring(line.indexOf(RESULT_MARKER) + RESULT_MARKER.length);
|
|
348
|
+
const jsonStr = this._decodeHtmlEntities(afterMarker);
|
|
349
|
+
try {
|
|
350
|
+
const parsed = JSON.parse(jsonStr);
|
|
351
|
+
if (parsed && parsed.__flowResult === true) {
|
|
352
|
+
return parsed;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
this._logger.warn(`Failed to parse flow result JSON: ${jsonStr.substring(0, 200)}`);
|
|
357
|
+
}
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
/** Extract the JSON envelope from script output lines. */
|
|
361
|
+
_extractResultEnvelope(bgResult) {
|
|
362
|
+
// Search through scriptResults for our marker line
|
|
363
|
+
if (bgResult.scriptResults && bgResult.scriptResults.length > 0) {
|
|
364
|
+
for (const outputLine of bgResult.scriptResults) {
|
|
365
|
+
const envelope = this._tryParseEnvelopeFromLine(outputLine.line);
|
|
366
|
+
if (envelope)
|
|
367
|
+
return envelope;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Fallback: search through consoleResult string array
|
|
371
|
+
if (bgResult.consoleResult && bgResult.consoleResult.length > 0) {
|
|
372
|
+
for (const line of bgResult.consoleResult) {
|
|
373
|
+
const envelope = this._tryParseEnvelopeFromLine(line);
|
|
374
|
+
if (envelope)
|
|
375
|
+
return envelope;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
/** Parse BackgroundScriptExecutionResult into FlowExecutionResult. */
|
|
381
|
+
_parseFlowResult(bgResult, options) {
|
|
382
|
+
const envelope = this._extractResultEnvelope(bgResult);
|
|
383
|
+
if (envelope) {
|
|
384
|
+
return {
|
|
385
|
+
success: envelope.success,
|
|
386
|
+
flowObjectName: envelope.flowObjectName || options.scopedName,
|
|
387
|
+
flowObjectType: envelope.flowObjectType || options.type,
|
|
388
|
+
contextId: envelope.contextId || undefined,
|
|
389
|
+
executionDate: envelope.executionDate || undefined,
|
|
390
|
+
domainId: envelope.domainId || undefined,
|
|
391
|
+
outputs: envelope.outputs || undefined,
|
|
392
|
+
debugOutput: envelope.debugOutput || undefined,
|
|
393
|
+
errorMessage: envelope.errorMessage || undefined,
|
|
394
|
+
rawScriptResult: bgResult
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
this._logger.warn('Could not extract flow result envelope from script output');
|
|
398
|
+
return {
|
|
399
|
+
success: false,
|
|
400
|
+
flowObjectName: options.scopedName,
|
|
401
|
+
flowObjectType: options.type,
|
|
402
|
+
errorMessage: 'Could not parse flow execution result from script output. ' +
|
|
403
|
+
'The script may have failed before producing output.',
|
|
404
|
+
rawScriptResult: bgResult
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
// ================================================================
|
|
408
|
+
// Lifecycle Script Builders
|
|
409
|
+
// ================================================================
|
|
410
|
+
/** Validate that a context ID is non-empty. */
|
|
411
|
+
_validateContextId(contextId) {
|
|
412
|
+
if (!contextId || contextId.trim().length === 0) {
|
|
413
|
+
throw new Error('Context ID is required');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/** Escape a string for embedding in a generated SN script single-quoted string. */
|
|
417
|
+
_escapeForScript(str) {
|
|
418
|
+
return str.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
419
|
+
}
|
|
420
|
+
/** Build script to query sys_flow_context status. */
|
|
421
|
+
_buildContextStatusScript(contextId) {
|
|
422
|
+
const escapedId = this._escapeForScript(contextId);
|
|
423
|
+
return `(function() {
|
|
424
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
425
|
+
try {
|
|
426
|
+
var gr = new GlideRecord('sys_flow_context');
|
|
427
|
+
if (gr.get('${escapedId}')) {
|
|
428
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
429
|
+
__flowResult: true,
|
|
430
|
+
success: true,
|
|
431
|
+
contextId: '${escapedId}',
|
|
432
|
+
found: true,
|
|
433
|
+
state: '' + gr.getValue('state'),
|
|
434
|
+
name: '' + gr.getValue('name'),
|
|
435
|
+
started: gr.getValue('started') ? '' + gr.getValue('started') : null,
|
|
436
|
+
ended: gr.getValue('ended') ? '' + gr.getValue('ended') : null,
|
|
437
|
+
errorMessage: null
|
|
438
|
+
}));
|
|
439
|
+
} else {
|
|
440
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
441
|
+
__flowResult: true,
|
|
442
|
+
success: true,
|
|
443
|
+
contextId: '${escapedId}',
|
|
444
|
+
found: false,
|
|
445
|
+
state: null,
|
|
446
|
+
name: null,
|
|
447
|
+
started: null,
|
|
448
|
+
ended: null,
|
|
449
|
+
errorMessage: null
|
|
450
|
+
}));
|
|
451
|
+
}
|
|
452
|
+
} catch (ex) {
|
|
453
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
454
|
+
__flowResult: true,
|
|
455
|
+
success: false,
|
|
456
|
+
contextId: '${escapedId}',
|
|
457
|
+
found: false,
|
|
458
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
})();`;
|
|
462
|
+
}
|
|
463
|
+
/** Build script to retrieve flow outputs via FlowAPI.getOutputs(). */
|
|
464
|
+
_buildGetOutputsScript(contextId) {
|
|
465
|
+
const escapedId = this._escapeForScript(contextId);
|
|
466
|
+
return `(function() {
|
|
467
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
468
|
+
try {
|
|
469
|
+
var outputs = sn_fd.FlowAPI.getOutputs('${escapedId}');
|
|
470
|
+
var outputObj = {};
|
|
471
|
+
if (outputs) {
|
|
472
|
+
for (var key in outputs) {
|
|
473
|
+
if (outputs.hasOwnProperty(key)) {
|
|
474
|
+
outputObj[key] = '' + outputs[key];
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
479
|
+
__flowResult: true,
|
|
480
|
+
success: true,
|
|
481
|
+
contextId: '${escapedId}',
|
|
482
|
+
outputs: outputObj,
|
|
483
|
+
errorMessage: null
|
|
484
|
+
}));
|
|
485
|
+
} catch (ex) {
|
|
486
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
487
|
+
__flowResult: true,
|
|
488
|
+
success: false,
|
|
489
|
+
contextId: '${escapedId}',
|
|
490
|
+
outputs: null,
|
|
491
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
492
|
+
}));
|
|
493
|
+
}
|
|
494
|
+
})();`;
|
|
495
|
+
}
|
|
496
|
+
/** Build script to retrieve flow error via FlowAPI.getErrorMessage(). */
|
|
497
|
+
_buildGetErrorScript(contextId) {
|
|
498
|
+
const escapedId = this._escapeForScript(contextId);
|
|
499
|
+
return `(function() {
|
|
500
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
501
|
+
try {
|
|
502
|
+
var errorMsg = sn_fd.FlowAPI.getErrorMessage('${escapedId}');
|
|
503
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
504
|
+
__flowResult: true,
|
|
505
|
+
success: true,
|
|
506
|
+
contextId: '${escapedId}',
|
|
507
|
+
flowErrorMessage: errorMsg ? '' + errorMsg : null,
|
|
508
|
+
errorMessage: null
|
|
509
|
+
}));
|
|
510
|
+
} catch (ex) {
|
|
511
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
512
|
+
__flowResult: true,
|
|
513
|
+
success: false,
|
|
514
|
+
contextId: '${escapedId}',
|
|
515
|
+
flowErrorMessage: null,
|
|
516
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
517
|
+
}));
|
|
518
|
+
}
|
|
519
|
+
})();`;
|
|
520
|
+
}
|
|
521
|
+
/** Build script to cancel a flow via FlowAPI.cancel(). */
|
|
522
|
+
_buildCancelScript(contextId, reason) {
|
|
523
|
+
const escapedId = this._escapeForScript(contextId);
|
|
524
|
+
const escapedReason = this._escapeForScript(reason);
|
|
525
|
+
return `(function() {
|
|
526
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
527
|
+
try {
|
|
528
|
+
sn_fd.FlowAPI.cancel('${escapedId}', '${escapedReason}');
|
|
529
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
530
|
+
__flowResult: true,
|
|
531
|
+
success: true,
|
|
532
|
+
contextId: '${escapedId}',
|
|
533
|
+
errorMessage: null
|
|
534
|
+
}));
|
|
535
|
+
} catch (ex) {
|
|
536
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
537
|
+
__flowResult: true,
|
|
538
|
+
success: false,
|
|
539
|
+
contextId: '${escapedId}',
|
|
540
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
541
|
+
}));
|
|
542
|
+
}
|
|
543
|
+
})();`;
|
|
544
|
+
}
|
|
545
|
+
/** Build script to send a message to a paused flow via FlowAPI.sendMessage(). */
|
|
546
|
+
_buildSendMessageScript(contextId, message, payload) {
|
|
547
|
+
const escapedId = this._escapeForScript(contextId);
|
|
548
|
+
const escapedMessage = this._escapeForScript(message);
|
|
549
|
+
const escapedPayload = this._escapeForScript(payload);
|
|
550
|
+
return `(function() {
|
|
551
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
552
|
+
try {
|
|
553
|
+
sn_fd.FlowAPI.sendMessage('${escapedId}', '${escapedMessage}', '${escapedPayload}');
|
|
554
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
555
|
+
__flowResult: true,
|
|
556
|
+
success: true,
|
|
557
|
+
contextId: '${escapedId}',
|
|
558
|
+
errorMessage: null
|
|
559
|
+
}));
|
|
560
|
+
} catch (ex) {
|
|
561
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
562
|
+
__flowResult: true,
|
|
563
|
+
success: false,
|
|
564
|
+
contextId: '${escapedId}',
|
|
565
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
566
|
+
}));
|
|
567
|
+
}
|
|
568
|
+
})();`;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
//# sourceMappingURL=FlowManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowManager.js","sourceRoot":"","sources":["../../../src/sn/flow/FlowManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAmC,MAAM,6BAA6B,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAiB3C,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,WAAW,GAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACZ,OA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