@sonisoft/now-sdk-ext-core 3.9.0 → 5.0.1
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/README.md +732 -732
- package/dist/PublicApi.d.ts +43 -0
- package/dist/PublicApi.js +46 -0
- package/dist/PublicApi.js.map +1 -0
- package/dist/cli/export-update-set.d.ts +1 -0
- package/dist/cli/export-update-set.js +45 -0
- package/dist/cli/export-update-set.js.map +1 -0
- package/dist/comm/http/ActiveSessionRegistry.d.ts +91 -0
- package/dist/comm/http/ActiveSessionRegistry.js +132 -0
- package/dist/comm/http/ActiveSessionRegistry.js.map +1 -0
- package/dist/comm/http/RequestHandler.js.map +1 -1
- package/dist/comm/http/SessionManager.d.ts +39 -0
- package/dist/comm/http/SessionManager.js +93 -0
- package/dist/comm/http/SessionManager.js.map +1 -0
- package/dist/comm/http/TableAPIRequest.js +2 -2
- package/dist/comm/http/TableAPIRequest.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/sn/BackgroundScriptExecutor.js +2 -2
- package/dist/sn/BackgroundScriptExecutor.js.map +1 -1
- package/dist/sn/amb/AMBClient.js +8 -4
- package/dist/sn/amb/AMBClient.js.map +1 -1
- package/dist/sn/amb/Channel.js +1 -1
- package/dist/sn/amb/Channel.js.map +1 -1
- package/dist/sn/amb/ChannelListener.js.map +1 -1
- package/dist/sn/amb/ChannelRedirect.js.map +1 -1
- package/dist/sn/amb/GraphQLSubscriptionExtension.js.map +1 -1
- package/dist/sn/amb/MessageClient.js +2 -2
- package/dist/sn/amb/MessageClient.js.map +1 -1
- package/dist/sn/amb/ServerConnection.d.ts +3 -1
- package/dist/sn/amb/ServerConnection.js +21 -15
- package/dist/sn/amb/ServerConnection.js.map +1 -1
- package/dist/sn/amb/SessionExtension.js.map +1 -1
- package/dist/sn/amb/SubscriptionCommandSender.js +2 -2
- package/dist/sn/amb/SubscriptionCommandSender.js.map +1 -1
- package/dist/sn/amb/TokenManagementExtension.js.map +1 -1
- package/dist/sn/amb/index.d.ts +1 -1
- package/dist/sn/amb/index.js +13 -1
- package/dist/sn/amb/index.js.map +1 -1
- package/dist/sn/application/ApplicationDetailModel.js.map +1 -1
- package/dist/sn/flow/FlowManager.d.ts +12 -1
- package/dist/sn/flow/FlowManager.js +245 -194
- package/dist/sn/flow/FlowManager.js.map +1 -1
- package/dist/sn/flow/FlowModels.d.ts +16 -0
- package/dist/sn/scripttracer/ScriptTracer.d.ts +27 -0
- package/dist/sn/scripttracer/ScriptTracer.js +173 -0
- package/dist/sn/scripttracer/ScriptTracer.js.map +1 -0
- package/dist/sn/scripttracer/ScriptTracerModels.d.ts +66 -0
- package/dist/sn/scripttracer/ScriptTracerModels.js +2 -0
- package/dist/sn/scripttracer/ScriptTracerModels.js.map +1 -0
- package/dist/sn/updateset/UpdateSetManager.d.ts +7 -0
- package/dist/sn/updateset/UpdateSetManager.js +76 -0
- package/dist/sn/updateset/UpdateSetManager.js.map +1 -1
- package/package.json +148 -166
- package/dist/encryption/decrypt.d.ts +0 -1
- package/dist/encryption/decrypt.js +0 -10
- package/dist/encryption/decrypt.js.map +0 -1
- package/dist/encryption/encrypt.d.ts +0 -1
- package/dist/encryption/encrypt.js +0 -13
- package/dist/encryption/encrypt.js.map +0 -1
- package/dist/sn/amb/Helper.d.ts +0 -5
- package/dist/sn/amb/Helper.js +0 -6
- package/dist/sn/amb/Helper.js.map +0 -1
- package/dist/sn/atf/ATFTestStep.d.ts +0 -0
- package/dist/sn/atf/ATFTestStep.js +0 -1
- package/dist/sn/atf/ATFTestStep.js.map +0 -1
- package/dist/sn/atf/ATFTestSuite.d.ts +0 -0
- package/dist/sn/atf/ATFTestSuite.js +0 -1
- package/dist/sn/atf/ATFTestSuite.js.map +0 -1
- package/dist/sn/atf/TestStepFactory.d.ts +0 -0
- package/dist/sn/atf/TestStepFactory.js +0 -1
- package/dist/sn/atf/TestStepFactory.js.map +0 -1
- package/dist/sn/atf/TestSuiteFactory.d.ts +0 -0
- package/dist/sn/atf/TestSuiteFactory.js +0 -1
- package/dist/sn/atf/TestSuiteFactory.js.map +0 -1
- package/dist/sn/factory/ISNFactory.d.ts +0 -0
- package/dist/sn/factory/ISNFactory.js +0 -1
- package/dist/sn/factory/ISNFactory.js.map +0 -1
- package/dist/sn/factory/SNFactoryBase.d.ts +0 -0
- package/dist/sn/factory/SNFactoryBase.js +0 -1
- package/dist/sn/factory/SNFactoryBase.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenManagementExtension.js","sourceRoot":"","sources":["../../../src/sn/amb/TokenManagementExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"TokenManagementExtension.js","sourceRoot":"","sources":["../../../src/sn/amb/TokenManagementExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,UAAU,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AAItD,MAAM,OAAO,wBAAwB;IACnC,OAAO,GAAU,IAAI,MAAM,CAAC,8BAA8B,CAAC,CAAC;IAC5D,MAAM,CAAC,cAAc,GAAG,iBAAiB,CAAC;IAC1C,MAAM,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;IAC/C,MAAM,CAAE,cAAc,GAAG,iBAAiB,CAAC;IAC1C,UAAU,GAAO,UAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,WAAW,CAAC;IACvE,mBAAmB,GAAS,EAAE,CAAC;IAEhC,gBAAgB,CAAC,KAAS;QACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,YAAY;QACX,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,WAAW,CAAC;QACxE,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAI,CAAC,OAA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AI,CAAC,UAAU,CAAC,CAAC;QAC3F,IAAI,CAAC;YACJ,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,QAAY,EAAE,EAAE;gBACjD,QAAQ,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,oFAAoF,GAAG,KAAK,CAAC,CAAC;QAC5H,CAAC;IACF,CAAC"}
|
package/dist/sn/amb/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from './CrossClientChannel.js';
|
|
|
8
8
|
export * from './EventManager.js';
|
|
9
9
|
export * from './FunctionQueue.js';
|
|
10
10
|
export * from './GraphQLSubscriptionExtension.js';
|
|
11
|
-
export * from './Helper.js';
|
|
12
11
|
export * from './MessageClient.js';
|
|
13
12
|
export * from './MessageClientBuilder.js';
|
|
14
13
|
export * from './Properties.js';
|
|
@@ -17,3 +16,4 @@ export * from './SessionExtension.js';
|
|
|
17
16
|
export * from './SubscriptionCommandSender.js';
|
|
18
17
|
export * from './TokenManagementExtension.js';
|
|
19
18
|
export * from './XMLHttpRequest.js';
|
|
19
|
+
export * from './AuthenticatedWebSocket.js';
|
package/dist/sn/amb/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Directory index for the AMB (CometD) subsystem.
|
|
2
|
+
//
|
|
3
|
+
// This file is load-bearing for barrel generation, not just convenience. ctix
|
|
4
|
+
// skips a source file if — and only if — its own directory's index.ts
|
|
5
|
+
// re-exports it, so covering EVERY module here is what keeps the ~2,900 lines
|
|
6
|
+
// of transport internals out of the generated public barrel. Emptying this
|
|
7
|
+
// file, or omitting a module from it, makes ctix export that module publicly:
|
|
8
|
+
// that is exactly how `AuthenticatedWebSocket` used to leak out on its own
|
|
9
|
+
// while the rest of the folder stayed private.
|
|
10
|
+
//
|
|
11
|
+
// The curated public AMB surface is declared in src/PublicApi.ts and appended
|
|
12
|
+
// to the barrel by scripts/finalize-barrel.mjs.
|
|
1
13
|
export * from './AMBClient.js';
|
|
2
14
|
export * from './AMBConstants.js';
|
|
3
15
|
export * from './Channel.js';
|
|
@@ -8,7 +20,6 @@ export * from './CrossClientChannel.js';
|
|
|
8
20
|
export * from './EventManager.js';
|
|
9
21
|
export * from './FunctionQueue.js';
|
|
10
22
|
export * from './GraphQLSubscriptionExtension.js';
|
|
11
|
-
export * from './Helper.js';
|
|
12
23
|
export * from './MessageClient.js';
|
|
13
24
|
export * from './MessageClientBuilder.js';
|
|
14
25
|
export * from './Properties.js';
|
|
@@ -17,4 +28,5 @@ export * from './SessionExtension.js';
|
|
|
17
28
|
export * from './SubscriptionCommandSender.js';
|
|
18
29
|
export * from './TokenManagementExtension.js';
|
|
19
30
|
export * from './XMLHttpRequest.js';
|
|
31
|
+
export * from './AuthenticatedWebSocket.js';
|
|
20
32
|
//# sourceMappingURL=index.js.map
|
package/dist/sn/amb/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sn/amb/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sn/amb/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,2EAA2E;AAC3E,+CAA+C;AAC/C,EAAE;AACF,8EAA8E;AAC9E,gDAA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ExecuteFlowOptions, ExecuteFlowByNameOptions, ExecuteSubflowOptions, ExecuteActionOptions, FlowExecutionResult, FlowScriptResultEnvelope, FlowContextStatusResult, FlowOutputsResult, FlowErrorResult, FlowCancelResult, FlowSendMessageResult, FlowPublishResult, TestFlowOptions, FlowTestResult, FlowDefinitionResult, CopyFlowOptions, FlowCopyResult, FlowContextDetailsResult, FlowLogOptions, FlowLogResult } from './FlowModels.js';
|
|
3
|
+
import { ExecuteFlowOptions, ExecuteFlowByNameOptions, ExecuteSubflowOptions, ExecuteActionOptions, FlowExecutionResult, FlowScriptResultEnvelope, FlowContextStatusResult, FlowOutputsResult, FlowErrorResult, FlowCancelResult, FlowSendMessageResult, FlowPublishResult, TestFlowOptions, FlowTestResult, FlowDefinitionResult, FlowActionResult, CopyFlowOptions, FlowCopyResult, FlowContextDetailsResult, FlowLogOptions, FlowLogResult } from './FlowModels.js';
|
|
4
4
|
/**
|
|
5
5
|
* Provides operations for executing ServiceNow Flow Designer flows,
|
|
6
6
|
* subflows, and actions remotely via BackgroundScriptExecutor.
|
|
@@ -59,6 +59,17 @@ export declare class FlowManager {
|
|
|
59
59
|
* @returns FlowDefinitionResult containing the raw flow definition object
|
|
60
60
|
*/
|
|
61
61
|
getFlowDefinition(flowSysId: string, scope?: string): Promise<FlowDefinitionResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Fetch flow action (action type) data from the ProcessFlow REST API.
|
|
64
|
+
*
|
|
65
|
+
* Calls `GET /api/now/processflow/action/action_type/{action_sys_id}` to retrieve
|
|
66
|
+
* action type metadata used by Flow Designer.
|
|
67
|
+
*
|
|
68
|
+
* @param actionSysId The sys_id of the action (action type) to fetch
|
|
69
|
+
* @param scope Optional scope sys_id for the transaction scope query parameter
|
|
70
|
+
* @returns FlowActionResult containing the raw action data
|
|
71
|
+
*/
|
|
72
|
+
getFlowActions(actionSysId: string, scope?: string): Promise<FlowActionResult>;
|
|
62
73
|
/**
|
|
63
74
|
* Test a flow as if running it from Flow Designer, without requiring it to be published.
|
|
64
75
|
*
|
|
@@ -383,6 +383,57 @@ export class FlowManager {
|
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Fetch flow action (action type) data from the ProcessFlow REST API.
|
|
388
|
+
*
|
|
389
|
+
* Calls `GET /api/now/processflow/action/action_type/{action_sys_id}` to retrieve
|
|
390
|
+
* action type metadata used by Flow Designer.
|
|
391
|
+
*
|
|
392
|
+
* @param actionSysId The sys_id of the action (action type) to fetch
|
|
393
|
+
* @param scope Optional scope sys_id for the transaction scope query parameter
|
|
394
|
+
* @returns FlowActionResult containing the raw action data
|
|
395
|
+
*/
|
|
396
|
+
async getFlowActions(actionSysId, scope) {
|
|
397
|
+
if (!actionSysId || actionSysId.trim().length === 0) {
|
|
398
|
+
throw new Error('Action sys_id is required');
|
|
399
|
+
}
|
|
400
|
+
this._logger.info(`Fetching flow action: ${actionSysId}`);
|
|
401
|
+
const pfr = new ProcessFlowRequest(this._instance);
|
|
402
|
+
const query = scope ? { sysparm_transaction_scope: scope } : undefined;
|
|
403
|
+
try {
|
|
404
|
+
const response = await pfr.get('action/action_types/{action_sys_id}/step_instances', { action_sys_id: actionSysId }, query);
|
|
405
|
+
const apiResult = this._extractProcessFlowResult(response);
|
|
406
|
+
if ((apiResult.errorCode != null && apiResult.errorCode !== 0) || (apiResult.errorCode == null && apiResult.errorMessage)) {
|
|
407
|
+
return {
|
|
408
|
+
success: false,
|
|
409
|
+
errorMessage: apiResult.errorMessage || 'Unknown error from processflow API',
|
|
410
|
+
rawResponse: apiResult
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
const action = apiResult.steps;
|
|
414
|
+
if (action == null || (typeof action !== 'object')) {
|
|
415
|
+
return {
|
|
416
|
+
success: false,
|
|
417
|
+
errorMessage: 'ProcessFlow API returned no action data',
|
|
418
|
+
rawResponse: apiResult
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
this._logger.info(`Flow action fetched: ${actionSysId}`);
|
|
422
|
+
return {
|
|
423
|
+
success: true,
|
|
424
|
+
action,
|
|
425
|
+
rawResponse: apiResult
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
const err = error;
|
|
430
|
+
this._logger.error(`Error fetching flow action "${actionSysId}": ${err.message}`);
|
|
431
|
+
return {
|
|
432
|
+
success: false,
|
|
433
|
+
errorMessage: `Failed to fetch flow action: ${err.message}`
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
386
437
|
/**
|
|
387
438
|
* Test a flow as if running it from Flow Designer, without requiring it to be published.
|
|
388
439
|
*
|
|
@@ -794,60 +845,60 @@ export class FlowManager {
|
|
|
794
845
|
}
|
|
795
846
|
const hasInputs = options.inputs && Object.keys(options.inputs).length > 0;
|
|
796
847
|
const inputsChain = hasInputs ? `\n .withInputs(inputs)` : '';
|
|
797
|
-
return `(function() {
|
|
798
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
799
|
-
try {
|
|
800
|
-
var inputs = ${inputsJson};
|
|
801
|
-
|
|
802
|
-
var result = sn_fd.FlowAPI.getRunner()
|
|
803
|
-
.${type}('${scopedName}')
|
|
804
|
-
.${modeMethod}()${optionalChain}${inputsChain}
|
|
805
|
-
.run();
|
|
806
|
-
|
|
807
|
-
var envelope = {
|
|
808
|
-
__flowResult: true,
|
|
809
|
-
success: true,
|
|
810
|
-
flowObjectName: '' + result.getFlowObjectName(),
|
|
811
|
-
flowObjectType: '' + result.getFlowObjectType(),
|
|
812
|
-
contextId: result.getContextId() ? '' + result.getContextId() : null,
|
|
813
|
-
executionDate: result.getDate() ? '' + result.getDate() : null,
|
|
814
|
-
domainId: result.getDomainId() ? '' + result.getDomainId() : null,
|
|
815
|
-
outputs: null,
|
|
816
|
-
debugOutput: '' + result.debug(),
|
|
817
|
-
errorMessage: null
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
try {
|
|
821
|
-
var rawOutputs = result.getOutputs();
|
|
822
|
-
if (rawOutputs) {
|
|
823
|
-
var outputObj = {};
|
|
824
|
-
for (var key in rawOutputs) {
|
|
825
|
-
if (rawOutputs.hasOwnProperty(key)) {
|
|
826
|
-
outputObj[key] = '' + rawOutputs[key];
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
envelope.outputs = outputObj;
|
|
830
|
-
}
|
|
831
|
-
} catch (outErr) {
|
|
832
|
-
envelope.outputs = null;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
gs.info(__RESULT_MARKER + JSON.stringify(envelope));
|
|
836
|
-
} catch (ex) {
|
|
837
|
-
var errorEnvelope = {
|
|
838
|
-
__flowResult: true,
|
|
839
|
-
success: false,
|
|
840
|
-
flowObjectName: '${scopedName}',
|
|
841
|
-
flowObjectType: '${type}',
|
|
842
|
-
contextId: null,
|
|
843
|
-
executionDate: null,
|
|
844
|
-
domainId: null,
|
|
845
|
-
outputs: null,
|
|
846
|
-
debugOutput: '',
|
|
847
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
848
|
-
};
|
|
849
|
-
gs.info(__RESULT_MARKER + JSON.stringify(errorEnvelope));
|
|
850
|
-
}
|
|
848
|
+
return `(function() {
|
|
849
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
850
|
+
try {
|
|
851
|
+
var inputs = ${inputsJson};
|
|
852
|
+
|
|
853
|
+
var result = sn_fd.FlowAPI.getRunner()
|
|
854
|
+
.${type}('${scopedName}')
|
|
855
|
+
.${modeMethod}()${optionalChain}${inputsChain}
|
|
856
|
+
.run();
|
|
857
|
+
|
|
858
|
+
var envelope = {
|
|
859
|
+
__flowResult: true,
|
|
860
|
+
success: true,
|
|
861
|
+
flowObjectName: '' + result.getFlowObjectName(),
|
|
862
|
+
flowObjectType: '' + result.getFlowObjectType(),
|
|
863
|
+
contextId: result.getContextId() ? '' + result.getContextId() : null,
|
|
864
|
+
executionDate: result.getDate() ? '' + result.getDate() : null,
|
|
865
|
+
domainId: result.getDomainId() ? '' + result.getDomainId() : null,
|
|
866
|
+
outputs: null,
|
|
867
|
+
debugOutput: '' + result.debug(),
|
|
868
|
+
errorMessage: null
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
try {
|
|
872
|
+
var rawOutputs = result.getOutputs();
|
|
873
|
+
if (rawOutputs) {
|
|
874
|
+
var outputObj = {};
|
|
875
|
+
for (var key in rawOutputs) {
|
|
876
|
+
if (rawOutputs.hasOwnProperty(key)) {
|
|
877
|
+
outputObj[key] = '' + rawOutputs[key];
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
envelope.outputs = outputObj;
|
|
881
|
+
}
|
|
882
|
+
} catch (outErr) {
|
|
883
|
+
envelope.outputs = null;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
gs.info(__RESULT_MARKER + JSON.stringify(envelope));
|
|
887
|
+
} catch (ex) {
|
|
888
|
+
var errorEnvelope = {
|
|
889
|
+
__flowResult: true,
|
|
890
|
+
success: false,
|
|
891
|
+
flowObjectName: '${scopedName}',
|
|
892
|
+
flowObjectType: '${type}',
|
|
893
|
+
contextId: null,
|
|
894
|
+
executionDate: null,
|
|
895
|
+
domainId: null,
|
|
896
|
+
outputs: null,
|
|
897
|
+
debugOutput: '',
|
|
898
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
899
|
+
};
|
|
900
|
+
gs.info(__RESULT_MARKER + JSON.stringify(errorEnvelope));
|
|
901
|
+
}
|
|
851
902
|
})();`;
|
|
852
903
|
}
|
|
853
904
|
/** Serialize inputs for embedding in the generated script. */
|
|
@@ -960,149 +1011,149 @@ export class FlowManager {
|
|
|
960
1011
|
/** Build script to query sys_flow_context status. */
|
|
961
1012
|
_buildContextStatusScript(contextId) {
|
|
962
1013
|
const escapedId = this._escapeForScript(contextId);
|
|
963
|
-
return `(function() {
|
|
964
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
965
|
-
try {
|
|
966
|
-
var gr = new GlideRecord('sys_flow_context');
|
|
967
|
-
if (gr.get('${escapedId}')) {
|
|
968
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
969
|
-
__flowResult: true,
|
|
970
|
-
success: true,
|
|
971
|
-
contextId: '${escapedId}',
|
|
972
|
-
found: true,
|
|
973
|
-
state: '' + gr.getValue('state'),
|
|
974
|
-
name: '' + gr.getValue('name'),
|
|
975
|
-
started: gr.getValue('started') ? '' + gr.getValue('started') : null,
|
|
976
|
-
ended: gr.getValue('ended') ? '' + gr.getValue('ended') : null,
|
|
977
|
-
errorMessage: null
|
|
978
|
-
}));
|
|
979
|
-
} else {
|
|
980
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
981
|
-
__flowResult: true,
|
|
982
|
-
success: true,
|
|
983
|
-
contextId: '${escapedId}',
|
|
984
|
-
found: false,
|
|
985
|
-
state: null,
|
|
986
|
-
name: null,
|
|
987
|
-
started: null,
|
|
988
|
-
ended: null,
|
|
989
|
-
errorMessage: null
|
|
990
|
-
}));
|
|
991
|
-
}
|
|
992
|
-
} catch (ex) {
|
|
993
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
994
|
-
__flowResult: true,
|
|
995
|
-
success: false,
|
|
996
|
-
contextId: '${escapedId}',
|
|
997
|
-
found: false,
|
|
998
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
999
|
-
}));
|
|
1000
|
-
}
|
|
1014
|
+
return `(function() {
|
|
1015
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1016
|
+
try {
|
|
1017
|
+
var gr = new GlideRecord('sys_flow_context');
|
|
1018
|
+
if (gr.get('${escapedId}')) {
|
|
1019
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1020
|
+
__flowResult: true,
|
|
1021
|
+
success: true,
|
|
1022
|
+
contextId: '${escapedId}',
|
|
1023
|
+
found: true,
|
|
1024
|
+
state: '' + gr.getValue('state'),
|
|
1025
|
+
name: '' + gr.getValue('name'),
|
|
1026
|
+
started: gr.getValue('started') ? '' + gr.getValue('started') : null,
|
|
1027
|
+
ended: gr.getValue('ended') ? '' + gr.getValue('ended') : null,
|
|
1028
|
+
errorMessage: null
|
|
1029
|
+
}));
|
|
1030
|
+
} else {
|
|
1031
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1032
|
+
__flowResult: true,
|
|
1033
|
+
success: true,
|
|
1034
|
+
contextId: '${escapedId}',
|
|
1035
|
+
found: false,
|
|
1036
|
+
state: null,
|
|
1037
|
+
name: null,
|
|
1038
|
+
started: null,
|
|
1039
|
+
ended: null,
|
|
1040
|
+
errorMessage: null
|
|
1041
|
+
}));
|
|
1042
|
+
}
|
|
1043
|
+
} catch (ex) {
|
|
1044
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1045
|
+
__flowResult: true,
|
|
1046
|
+
success: false,
|
|
1047
|
+
contextId: '${escapedId}',
|
|
1048
|
+
found: false,
|
|
1049
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1050
|
+
}));
|
|
1051
|
+
}
|
|
1001
1052
|
})();`;
|
|
1002
1053
|
}
|
|
1003
1054
|
/** Build script to retrieve flow outputs via FlowAPI.getOutputs(). */
|
|
1004
1055
|
_buildGetOutputsScript(contextId) {
|
|
1005
1056
|
const escapedId = this._escapeForScript(contextId);
|
|
1006
|
-
return `(function() {
|
|
1007
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1008
|
-
try {
|
|
1009
|
-
var outputs = sn_fd.FlowAPI.getOutputs('${escapedId}');
|
|
1010
|
-
var outputObj = {};
|
|
1011
|
-
if (outputs) {
|
|
1012
|
-
for (var key in outputs) {
|
|
1013
|
-
if (outputs.hasOwnProperty(key)) {
|
|
1014
|
-
outputObj[key] = '' + outputs[key];
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1019
|
-
__flowResult: true,
|
|
1020
|
-
success: true,
|
|
1021
|
-
contextId: '${escapedId}',
|
|
1022
|
-
outputs: outputObj,
|
|
1023
|
-
errorMessage: null
|
|
1024
|
-
}));
|
|
1025
|
-
} catch (ex) {
|
|
1026
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1027
|
-
__flowResult: true,
|
|
1028
|
-
success: false,
|
|
1029
|
-
contextId: '${escapedId}',
|
|
1030
|
-
outputs: null,
|
|
1031
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1032
|
-
}));
|
|
1033
|
-
}
|
|
1057
|
+
return `(function() {
|
|
1058
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1059
|
+
try {
|
|
1060
|
+
var outputs = sn_fd.FlowAPI.getOutputs('${escapedId}');
|
|
1061
|
+
var outputObj = {};
|
|
1062
|
+
if (outputs) {
|
|
1063
|
+
for (var key in outputs) {
|
|
1064
|
+
if (outputs.hasOwnProperty(key)) {
|
|
1065
|
+
outputObj[key] = '' + outputs[key];
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1070
|
+
__flowResult: true,
|
|
1071
|
+
success: true,
|
|
1072
|
+
contextId: '${escapedId}',
|
|
1073
|
+
outputs: outputObj,
|
|
1074
|
+
errorMessage: null
|
|
1075
|
+
}));
|
|
1076
|
+
} catch (ex) {
|
|
1077
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1078
|
+
__flowResult: true,
|
|
1079
|
+
success: false,
|
|
1080
|
+
contextId: '${escapedId}',
|
|
1081
|
+
outputs: null,
|
|
1082
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1083
|
+
}));
|
|
1084
|
+
}
|
|
1034
1085
|
})();`;
|
|
1035
1086
|
}
|
|
1036
1087
|
/** Build script to retrieve flow error via FlowAPI.getErrorMessage(). */
|
|
1037
1088
|
_buildGetErrorScript(contextId) {
|
|
1038
1089
|
const escapedId = this._escapeForScript(contextId);
|
|
1039
|
-
return `(function() {
|
|
1040
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1041
|
-
try {
|
|
1042
|
-
var errorMsg = sn_fd.FlowAPI.getErrorMessage('${escapedId}');
|
|
1043
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1044
|
-
__flowResult: true,
|
|
1045
|
-
success: true,
|
|
1046
|
-
contextId: '${escapedId}',
|
|
1047
|
-
flowErrorMessage: errorMsg ? '' + errorMsg : null,
|
|
1048
|
-
errorMessage: null
|
|
1049
|
-
}));
|
|
1050
|
-
} catch (ex) {
|
|
1051
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1052
|
-
__flowResult: true,
|
|
1053
|
-
success: false,
|
|
1054
|
-
contextId: '${escapedId}',
|
|
1055
|
-
flowErrorMessage: null,
|
|
1056
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1057
|
-
}));
|
|
1058
|
-
}
|
|
1090
|
+
return `(function() {
|
|
1091
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1092
|
+
try {
|
|
1093
|
+
var errorMsg = sn_fd.FlowAPI.getErrorMessage('${escapedId}');
|
|
1094
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1095
|
+
__flowResult: true,
|
|
1096
|
+
success: true,
|
|
1097
|
+
contextId: '${escapedId}',
|
|
1098
|
+
flowErrorMessage: errorMsg ? '' + errorMsg : null,
|
|
1099
|
+
errorMessage: null
|
|
1100
|
+
}));
|
|
1101
|
+
} catch (ex) {
|
|
1102
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1103
|
+
__flowResult: true,
|
|
1104
|
+
success: false,
|
|
1105
|
+
contextId: '${escapedId}',
|
|
1106
|
+
flowErrorMessage: null,
|
|
1107
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1108
|
+
}));
|
|
1109
|
+
}
|
|
1059
1110
|
})();`;
|
|
1060
1111
|
}
|
|
1061
1112
|
/** Build script to cancel a flow via FlowAPI.cancel(). */
|
|
1062
1113
|
_buildCancelScript(contextId, reason) {
|
|
1063
1114
|
const escapedId = this._escapeForScript(contextId);
|
|
1064
1115
|
const escapedReason = this._escapeForScript(reason);
|
|
1065
|
-
return `(function() {
|
|
1066
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1067
|
-
try {
|
|
1068
|
-
sn_fd.FlowAPI.cancel('${escapedId}', '${escapedReason}');
|
|
1069
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1070
|
-
__flowResult: true,
|
|
1071
|
-
success: true,
|
|
1072
|
-
contextId: '${escapedId}',
|
|
1073
|
-
errorMessage: null
|
|
1074
|
-
}));
|
|
1075
|
-
} catch (ex) {
|
|
1076
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1077
|
-
__flowResult: true,
|
|
1078
|
-
success: false,
|
|
1079
|
-
contextId: '${escapedId}',
|
|
1080
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1081
|
-
}));
|
|
1082
|
-
}
|
|
1116
|
+
return `(function() {
|
|
1117
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1118
|
+
try {
|
|
1119
|
+
sn_fd.FlowAPI.cancel('${escapedId}', '${escapedReason}');
|
|
1120
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1121
|
+
__flowResult: true,
|
|
1122
|
+
success: true,
|
|
1123
|
+
contextId: '${escapedId}',
|
|
1124
|
+
errorMessage: null
|
|
1125
|
+
}));
|
|
1126
|
+
} catch (ex) {
|
|
1127
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1128
|
+
__flowResult: true,
|
|
1129
|
+
success: false,
|
|
1130
|
+
contextId: '${escapedId}',
|
|
1131
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1132
|
+
}));
|
|
1133
|
+
}
|
|
1083
1134
|
})();`;
|
|
1084
1135
|
}
|
|
1085
1136
|
/** Build script to publish a flow via FlowAPI.publish(). */
|
|
1086
1137
|
_buildPublishScript(flowSysId) {
|
|
1087
1138
|
const escapedId = this._escapeForScript(flowSysId);
|
|
1088
|
-
return `(function() {
|
|
1089
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1090
|
-
try {
|
|
1091
|
-
sn_fd.FlowAPI.publish('${escapedId}');
|
|
1092
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1093
|
-
__flowResult: true,
|
|
1094
|
-
success: true,
|
|
1095
|
-
flowSysId: '${escapedId}',
|
|
1096
|
-
errorMessage: null
|
|
1097
|
-
}));
|
|
1098
|
-
} catch (ex) {
|
|
1099
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1100
|
-
__flowResult: true,
|
|
1101
|
-
success: false,
|
|
1102
|
-
flowSysId: '${escapedId}',
|
|
1103
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1104
|
-
}));
|
|
1105
|
-
}
|
|
1139
|
+
return `(function() {
|
|
1140
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1141
|
+
try {
|
|
1142
|
+
sn_fd.FlowAPI.publish('${escapedId}');
|
|
1143
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1144
|
+
__flowResult: true,
|
|
1145
|
+
success: true,
|
|
1146
|
+
flowSysId: '${escapedId}',
|
|
1147
|
+
errorMessage: null
|
|
1148
|
+
}));
|
|
1149
|
+
} catch (ex) {
|
|
1150
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1151
|
+
__flowResult: true,
|
|
1152
|
+
success: false,
|
|
1153
|
+
flowSysId: '${escapedId}',
|
|
1154
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1155
|
+
}));
|
|
1156
|
+
}
|
|
1106
1157
|
})();`;
|
|
1107
1158
|
}
|
|
1108
1159
|
/** Build script to send a message to a paused flow via FlowAPI.sendMessage(). */
|
|
@@ -1110,24 +1161,24 @@ export class FlowManager {
|
|
|
1110
1161
|
const escapedId = this._escapeForScript(contextId);
|
|
1111
1162
|
const escapedMessage = this._escapeForScript(message);
|
|
1112
1163
|
const escapedPayload = this._escapeForScript(payload);
|
|
1113
|
-
return `(function() {
|
|
1114
|
-
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1115
|
-
try {
|
|
1116
|
-
sn_fd.FlowAPI.sendMessage('${escapedId}', '${escapedMessage}', '${escapedPayload}');
|
|
1117
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1118
|
-
__flowResult: true,
|
|
1119
|
-
success: true,
|
|
1120
|
-
contextId: '${escapedId}',
|
|
1121
|
-
errorMessage: null
|
|
1122
|
-
}));
|
|
1123
|
-
} catch (ex) {
|
|
1124
|
-
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1125
|
-
__flowResult: true,
|
|
1126
|
-
success: false,
|
|
1127
|
-
contextId: '${escapedId}',
|
|
1128
|
-
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1129
|
-
}));
|
|
1130
|
-
}
|
|
1164
|
+
return `(function() {
|
|
1165
|
+
var __RESULT_MARKER = '${RESULT_MARKER}';
|
|
1166
|
+
try {
|
|
1167
|
+
sn_fd.FlowAPI.sendMessage('${escapedId}', '${escapedMessage}', '${escapedPayload}');
|
|
1168
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1169
|
+
__flowResult: true,
|
|
1170
|
+
success: true,
|
|
1171
|
+
contextId: '${escapedId}',
|
|
1172
|
+
errorMessage: null
|
|
1173
|
+
}));
|
|
1174
|
+
} catch (ex) {
|
|
1175
|
+
gs.info(__RESULT_MARKER + JSON.stringify({
|
|
1176
|
+
__flowResult: true,
|
|
1177
|
+
success: false,
|
|
1178
|
+
contextId: '${escapedId}',
|
|
1179
|
+
errorMessage: '' + (ex.getMessage ? ex.getMessage() : ex)
|
|
1180
|
+
}));
|
|
1181
|
+
}
|
|
1131
1182
|
})();`;
|
|
1132
1183
|
}
|
|
1133
1184
|
}
|