ultravisor 1.0.2 → 1.0.4
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/launch.json +11 -0
- package/.claude/ultravisor-dev-config.json +3 -0
- package/.ultravisor.json +426 -0
- package/docs/README.md +63 -0
- package/package.json +12 -8
- package/source/Ultravisor.cjs +22 -3
- package/source/cli/Ultravisor-CLIProgram.cjs +35 -23
- package/source/cli/commands/Ultravisor-Command-SingleOperation.cjs +29 -18
- package/source/cli/commands/Ultravisor-Command-SingleTask.cjs +62 -19
- package/source/cli/commands/Ultravisor-Command-UpdateTask.cjs +27 -15
- package/source/config/Ultravisor-Default-Command-Configuration.cjs +5 -3
- package/source/services/Ultravisor-ExecutionEngine.cjs +1039 -0
- package/source/services/Ultravisor-ExecutionManifest.cjs +399 -0
- package/source/services/Ultravisor-Hypervisor-State.cjs +270 -97
- package/source/services/Ultravisor-Hypervisor.cjs +38 -83
- package/source/services/Ultravisor-StateManager.cjs +241 -0
- package/source/services/Ultravisor-TaskTypeRegistry.cjs +143 -0
- package/source/services/tasks/Ultravisor-TaskType-Base.cjs +105 -0
- package/source/services/tasks/control/Ultravisor-TaskType-IfConditional.cjs +148 -0
- package/source/services/tasks/control/Ultravisor-TaskType-LaunchOperation.cjs +187 -0
- package/source/services/tasks/control/Ultravisor-TaskType-SplitExecute.cjs +184 -0
- package/source/services/tasks/data/Ultravisor-TaskType-ReplaceString.cjs +82 -0
- package/source/services/tasks/data/Ultravisor-TaskType-SetValues.cjs +81 -0
- package/source/services/tasks/data/Ultravisor-TaskType-StringAppender.cjs +101 -0
- package/source/services/tasks/file-io/Ultravisor-TaskType-ReadFile.cjs +103 -0
- package/source/services/tasks/file-io/Ultravisor-TaskType-WriteFile.cjs +117 -0
- package/source/services/tasks/interaction/Ultravisor-TaskType-ErrorMessage.cjs +54 -0
- package/source/services/tasks/interaction/Ultravisor-TaskType-ValueInput.cjs +62 -0
- package/source/web_server/Ultravisor-API-Server.cjs +237 -124
- package/test/Ultravisor_browser_tests.js +2226 -0
- package/test/Ultravisor_tests.js +1143 -5830
- package/webinterface/css/ultravisor.css +23 -0
- package/webinterface/package.json +6 -3
- package/webinterface/source/Pict-Application-Ultravisor.js +93 -73
- package/webinterface/source/cards/FlowCard-CSVTransform.js +43 -0
- package/webinterface/source/cards/FlowCard-Command.js +86 -0
- package/webinterface/source/cards/FlowCard-ComprehensionIntersect.js +40 -0
- package/webinterface/source/cards/FlowCard-Conditional.js +87 -0
- package/webinterface/source/cards/FlowCard-CopyFile.js +55 -0
- package/webinterface/source/cards/FlowCard-End.js +29 -0
- package/webinterface/source/cards/FlowCard-GetJSON.js +55 -0
- package/webinterface/source/cards/FlowCard-GetText.js +54 -0
- package/webinterface/source/cards/FlowCard-Histogram.js +176 -0
- package/webinterface/source/cards/FlowCard-LaunchOperation.js +82 -0
- package/webinterface/source/cards/FlowCard-ListFiles.js +55 -0
- package/webinterface/source/cards/FlowCard-MeadowCount.js +44 -0
- package/webinterface/source/cards/FlowCard-MeadowCreate.js +44 -0
- package/webinterface/source/cards/FlowCard-MeadowDelete.js +45 -0
- package/webinterface/source/cards/FlowCard-MeadowRead.js +46 -0
- package/webinterface/source/cards/FlowCard-MeadowReads.js +46 -0
- package/webinterface/source/cards/FlowCard-MeadowUpdate.js +44 -0
- package/webinterface/source/cards/FlowCard-ParseCSV.js +85 -0
- package/webinterface/source/cards/FlowCard-ReadJSON.js +54 -0
- package/webinterface/source/cards/FlowCard-ReadText.js +54 -0
- package/webinterface/source/cards/FlowCard-RestRequest.js +59 -0
- package/webinterface/source/cards/FlowCard-SendJSON.js +57 -0
- package/webinterface/source/cards/FlowCard-Solver.js +77 -0
- package/webinterface/source/cards/FlowCard-Start.js +29 -0
- package/webinterface/source/cards/FlowCard-TemplateString.js +77 -0
- package/webinterface/source/cards/FlowCard-WriteJSON.js +54 -0
- package/webinterface/source/cards/FlowCard-WriteText.js +54 -0
- package/webinterface/source/data/ExampleFlow-CSVPipeline.js +231 -0
- package/webinterface/source/data/ExampleFlow-FileProcessor.js +315 -0
- package/webinterface/source/data/ExampleFlow-MeadowPipeline.js +328 -0
- package/webinterface/source/providers/PictRouter-Ultravisor-Configuration.json +8 -8
- package/webinterface/source/views/PictView-Ultravisor-Dashboard.js +6 -6
- package/webinterface/source/views/PictView-Ultravisor-FlowEditor.js +436 -0
- package/webinterface/source/views/PictView-Ultravisor-ManifestList.js +45 -43
- package/webinterface/source/views/PictView-Ultravisor-OperationEdit.js +34 -89
- package/webinterface/source/views/PictView-Ultravisor-OperationList.js +128 -13
- package/webinterface/source/views/PictView-Ultravisor-PendingInput.js +314 -0
- package/webinterface/source/views/PictView-Ultravisor-Schedule.js +18 -53
- package/webinterface/source/views/PictView-Ultravisor-TimingView.js +27 -14
- package/webinterface/source/views/PictView-Ultravisor-TopBar.js +2 -1
- package/.babelrc +0 -6
- package/.browserslistrc +0 -1
- package/.browserslistrc-BACKUP +0 -1
- package/.gulpfile-quackage-config.json +0 -7
- package/.gulpfile-quackage.js +0 -2
- package/debug/Harness.js +0 -5
- package/source/services/Ultravisor-Operation-Manifest.cjs +0 -160
- package/source/services/Ultravisor-Operation.cjs +0 -200
- package/source/services/Ultravisor-Task.cjs +0 -349
- package/source/services/events/Ultravisor-Hypervisor-Event-Solver.cjs +0 -11
- package/source/services/tasks/Ultravisor-Task-Base.cjs +0 -264
- package/source/services/tasks/Ultravisor-Task-CollectValues.cjs +0 -188
- package/source/services/tasks/Ultravisor-Task-Command.cjs +0 -65
- package/source/services/tasks/Ultravisor-Task-CommandEach.cjs +0 -190
- package/source/services/tasks/Ultravisor-Task-Conditional.cjs +0 -104
- package/source/services/tasks/Ultravisor-Task-DateWindow.cjs +0 -72
- package/source/services/tasks/Ultravisor-Task-GeneratePagedOperation.cjs +0 -336
- package/source/services/tasks/Ultravisor-Task-LaunchOperation.cjs +0 -143
- package/source/services/tasks/Ultravisor-Task-LaunchTask.cjs +0 -146
- package/source/services/tasks/Ultravisor-Task-LineMatch.cjs +0 -158
- package/source/services/tasks/Ultravisor-Task-Request.cjs +0 -56
- package/source/services/tasks/Ultravisor-Task-Solver.cjs +0 -89
- package/source/services/tasks/Ultravisor-Task-TemplateString.cjs +0 -93
- package/source/services/tasks/rest/Ultravisor-Task-GetBinary.cjs +0 -127
- package/source/services/tasks/rest/Ultravisor-Task-GetJSON.cjs +0 -119
- package/source/services/tasks/rest/Ultravisor-Task-GetText.cjs +0 -109
- package/source/services/tasks/rest/Ultravisor-Task-GetXML.cjs +0 -112
- package/source/services/tasks/rest/Ultravisor-Task-RestRequest.cjs +0 -499
- package/source/services/tasks/rest/Ultravisor-Task-SendJSON.cjs +0 -150
- package/source/services/tasks/stagingfiles/Ultravisor-Task-CopyFile.cjs +0 -110
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ListFiles.cjs +0 -89
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadBinary.cjs +0 -87
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadJSON.cjs +0 -67
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadText.cjs +0 -66
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadXML.cjs +0 -69
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteBinary.cjs +0 -95
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteJSON.cjs +0 -96
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteText.cjs +0 -99
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteXML.cjs +0 -102
- package/webinterface/.babelrc +0 -6
- package/webinterface/.browserslistrc +0 -1
- package/webinterface/.browserslistrc-BACKUP +0 -1
- package/webinterface/.gulpfile-quackage-config.json +0 -7
- package/webinterface/.gulpfile-quackage.js +0 -2
- package/webinterface/source/views/PictView-Ultravisor-TaskEdit.js +0 -220
- package/webinterface/source/views/PictView-Ultravisor-TaskList.js +0 -248
- /package/docs/{cover.md → _cover.md} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const libUltravisorTaskType = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
const libFS = require('fs');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Read File task type.
|
|
6
|
+
*
|
|
7
|
+
* Reads a file from disk into state. The file path can be absolute or
|
|
8
|
+
* relative to the operation's staging folder.
|
|
9
|
+
*/
|
|
10
|
+
class UltravisorTaskTypeReadFile extends libUltravisorTaskType
|
|
11
|
+
{
|
|
12
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
13
|
+
{
|
|
14
|
+
super(pFable, pOptions, pServiceHash);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get definition()
|
|
18
|
+
{
|
|
19
|
+
return {
|
|
20
|
+
Hash: 'read-file',
|
|
21
|
+
Name: 'Read File',
|
|
22
|
+
Description: 'Reads a file from disk into state.',
|
|
23
|
+
Category: 'file-io',
|
|
24
|
+
|
|
25
|
+
EventInputs:
|
|
26
|
+
[
|
|
27
|
+
{ Name: 'BeginRead', Description: 'Triggers the file read' }
|
|
28
|
+
],
|
|
29
|
+
EventOutputs:
|
|
30
|
+
[
|
|
31
|
+
{ Name: 'ReadComplete', Description: 'Fires when file is read successfully' },
|
|
32
|
+
{ Name: 'Error', Description: 'Fires on read failure', IsError: true }
|
|
33
|
+
],
|
|
34
|
+
SettingsInputs:
|
|
35
|
+
[
|
|
36
|
+
{ Name: 'FilePath', DataType: 'String', Required: true, Description: 'Path to the file to read' },
|
|
37
|
+
{ Name: 'Encoding', DataType: 'String', Required: false, Default: 'utf8', Description: 'File encoding' }
|
|
38
|
+
],
|
|
39
|
+
StateOutputs:
|
|
40
|
+
[
|
|
41
|
+
{ Name: 'FileContent', DataType: 'String', Description: 'Contents of the file' },
|
|
42
|
+
{ Name: 'BytesRead', DataType: 'Number', Description: 'Number of bytes read' }
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
DefaultSettings:
|
|
46
|
+
{
|
|
47
|
+
FilePath: '',
|
|
48
|
+
Encoding: 'utf8'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
54
|
+
{
|
|
55
|
+
let tmpFilePath = pResolvedSettings.FilePath || '';
|
|
56
|
+
let tmpEncoding = pResolvedSettings.Encoding || 'utf8';
|
|
57
|
+
|
|
58
|
+
if (!tmpFilePath)
|
|
59
|
+
{
|
|
60
|
+
return fCallback(null, {
|
|
61
|
+
EventToFire: 'Error',
|
|
62
|
+
Outputs: {},
|
|
63
|
+
Log: ['ReadFile: no FilePath specified.']
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Resolve relative paths against the staging folder
|
|
68
|
+
tmpFilePath = this.resolveFilePath(tmpFilePath, pExecutionContext.StagingPath);
|
|
69
|
+
|
|
70
|
+
try
|
|
71
|
+
{
|
|
72
|
+
let tmpContent = libFS.readFileSync(tmpFilePath, tmpEncoding);
|
|
73
|
+
|
|
74
|
+
// Write output to the configured address if specified
|
|
75
|
+
let tmpStateWrites = {};
|
|
76
|
+
if (pResolvedSettings.OutputAddress)
|
|
77
|
+
{
|
|
78
|
+
tmpStateWrites[pResolvedSettings.OutputAddress] = tmpContent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return fCallback(null, {
|
|
82
|
+
EventToFire: 'ReadComplete',
|
|
83
|
+
Outputs:
|
|
84
|
+
{
|
|
85
|
+
FileContent: tmpContent,
|
|
86
|
+
BytesRead: Buffer.byteLength(tmpContent, tmpEncoding)
|
|
87
|
+
},
|
|
88
|
+
StateWrites: tmpStateWrites,
|
|
89
|
+
Log: [`ReadFile: read ${Buffer.byteLength(tmpContent, tmpEncoding)} bytes from ${tmpFilePath}`]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (pError)
|
|
93
|
+
{
|
|
94
|
+
return fCallback(null, {
|
|
95
|
+
EventToFire: 'Error',
|
|
96
|
+
Outputs: {},
|
|
97
|
+
Log: [`ReadFile: failed to read ${tmpFilePath}: ${pError.message}`]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
module.exports = UltravisorTaskTypeReadFile;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const libUltravisorTaskType = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
const libFS = require('fs');
|
|
3
|
+
const libPath = require('path');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Write File task type.
|
|
7
|
+
*
|
|
8
|
+
* Writes content from state to a file on disk. The file path can be
|
|
9
|
+
* absolute or relative to the operation's staging folder.
|
|
10
|
+
*/
|
|
11
|
+
class UltravisorTaskTypeWriteFile extends libUltravisorTaskType
|
|
12
|
+
{
|
|
13
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
14
|
+
{
|
|
15
|
+
super(pFable, pOptions, pServiceHash);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get definition()
|
|
19
|
+
{
|
|
20
|
+
return {
|
|
21
|
+
Hash: 'write-file',
|
|
22
|
+
Name: 'Write File',
|
|
23
|
+
Description: 'Writes content to a file on disk.',
|
|
24
|
+
Category: 'file-io',
|
|
25
|
+
|
|
26
|
+
EventInputs:
|
|
27
|
+
[
|
|
28
|
+
{ Name: 'BeginWrite', Description: 'Triggers the file write' }
|
|
29
|
+
],
|
|
30
|
+
EventOutputs:
|
|
31
|
+
[
|
|
32
|
+
{ Name: 'WriteComplete', Description: 'Fires when file is written successfully' },
|
|
33
|
+
{ Name: 'Error', Description: 'Fires on write failure', IsError: true }
|
|
34
|
+
],
|
|
35
|
+
SettingsInputs:
|
|
36
|
+
[
|
|
37
|
+
{ Name: 'FilePath', DataType: 'String', Required: true, Description: 'Path to the output file' },
|
|
38
|
+
{ Name: 'Content', DataType: 'String', Required: true, Description: 'Content to write' },
|
|
39
|
+
{ Name: 'Encoding', DataType: 'String', Required: false, Default: 'utf8', Description: 'File encoding' }
|
|
40
|
+
],
|
|
41
|
+
StateOutputs:
|
|
42
|
+
[
|
|
43
|
+
{ Name: 'BytesWritten', DataType: 'Number', Description: 'Number of bytes written' }
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
DefaultSettings:
|
|
47
|
+
{
|
|
48
|
+
FilePath: '',
|
|
49
|
+
Content: '',
|
|
50
|
+
Encoding: 'utf8'
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
56
|
+
{
|
|
57
|
+
let tmpFilePath = pResolvedSettings.FilePath || '';
|
|
58
|
+
let tmpContent = pResolvedSettings.Content;
|
|
59
|
+
let tmpEncoding = pResolvedSettings.Encoding || 'utf8';
|
|
60
|
+
|
|
61
|
+
if (!tmpFilePath)
|
|
62
|
+
{
|
|
63
|
+
return fCallback(null, {
|
|
64
|
+
EventToFire: 'Error',
|
|
65
|
+
Outputs: {},
|
|
66
|
+
Log: ['WriteFile: no FilePath specified.']
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (tmpContent === undefined || tmpContent === null)
|
|
71
|
+
{
|
|
72
|
+
tmpContent = '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Ensure content is a string
|
|
76
|
+
if (typeof(tmpContent) !== 'string')
|
|
77
|
+
{
|
|
78
|
+
tmpContent = JSON.stringify(tmpContent, null, '\t');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Resolve relative paths against the staging folder
|
|
82
|
+
tmpFilePath = this.resolveFilePath(tmpFilePath, pExecutionContext.StagingPath);
|
|
83
|
+
|
|
84
|
+
try
|
|
85
|
+
{
|
|
86
|
+
// Ensure the directory exists
|
|
87
|
+
let tmpDir = libPath.dirname(tmpFilePath);
|
|
88
|
+
if (!libFS.existsSync(tmpDir))
|
|
89
|
+
{
|
|
90
|
+
libFS.mkdirSync(tmpDir, { recursive: true });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
libFS.writeFileSync(tmpFilePath, tmpContent, tmpEncoding);
|
|
94
|
+
|
|
95
|
+
let tmpBytesWritten = Buffer.byteLength(tmpContent, tmpEncoding);
|
|
96
|
+
|
|
97
|
+
return fCallback(null, {
|
|
98
|
+
EventToFire: 'WriteComplete',
|
|
99
|
+
Outputs:
|
|
100
|
+
{
|
|
101
|
+
BytesWritten: tmpBytesWritten
|
|
102
|
+
},
|
|
103
|
+
Log: [`WriteFile: wrote ${tmpBytesWritten} bytes to ${tmpFilePath}`]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (pError)
|
|
107
|
+
{
|
|
108
|
+
return fCallback(null, {
|
|
109
|
+
EventToFire: 'Error',
|
|
110
|
+
Outputs: {},
|
|
111
|
+
Log: [`WriteFile: failed to write ${tmpFilePath}: ${pError.message}`]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module.exports = UltravisorTaskTypeWriteFile;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const libTaskTypeBase = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ErrorMessage Task Type
|
|
5
|
+
*
|
|
6
|
+
* Logs an error/warning message to the execution context.
|
|
7
|
+
* Useful for dead-end branches or error handling paths.
|
|
8
|
+
* The MessageTemplate can contain {~D:Address~} patterns
|
|
9
|
+
* that are resolved against the execution context.
|
|
10
|
+
*/
|
|
11
|
+
class UltravisorTaskTypeErrorMessage extends libTaskTypeBase
|
|
12
|
+
{
|
|
13
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
14
|
+
{
|
|
15
|
+
super(pFable, pOptions, pServiceHash);
|
|
16
|
+
|
|
17
|
+
this.serviceType = 'UltravisorTaskTypeErrorMessage';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get definition()
|
|
21
|
+
{
|
|
22
|
+
return {
|
|
23
|
+
Hash: 'error-message',
|
|
24
|
+
Type: 'error-message',
|
|
25
|
+
Name: 'Error Message',
|
|
26
|
+
Description: 'Logs an error or warning message to the execution log.',
|
|
27
|
+
Category: 'interaction',
|
|
28
|
+
|
|
29
|
+
EventInputs: [{ Name: 'Trigger' }],
|
|
30
|
+
EventOutputs: [{ Name: 'Complete' }],
|
|
31
|
+
SettingsInputs: [
|
|
32
|
+
{ Name: 'MessageTemplate', DataType: 'String', Required: true }
|
|
33
|
+
],
|
|
34
|
+
StateOutputs: [],
|
|
35
|
+
|
|
36
|
+
DefaultSettings: { MessageTemplate: 'An error occurred.' }
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
41
|
+
{
|
|
42
|
+
let tmpMessage = pResolvedSettings.MessageTemplate || 'An error occurred.';
|
|
43
|
+
|
|
44
|
+
this.log.error(`ErrorMessage task [${pExecutionContext.NodeHash}]: ${tmpMessage}`);
|
|
45
|
+
|
|
46
|
+
return fCallback(null, {
|
|
47
|
+
EventToFire: 'Complete',
|
|
48
|
+
Outputs: {},
|
|
49
|
+
Log: [`ERROR: ${tmpMessage}`]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = UltravisorTaskTypeErrorMessage;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const libTaskTypeBase = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ValueInput Task Type
|
|
5
|
+
*
|
|
6
|
+
* Pauses operation execution and waits for user input.
|
|
7
|
+
* When triggered, sets the run to WaitingForInput status.
|
|
8
|
+
* The ExecutionEngine resumes when input is provided via
|
|
9
|
+
* POST /Run/:RunHash/Input/:NodeHash.
|
|
10
|
+
*
|
|
11
|
+
* The provided value is written to the specified OutputAddress.
|
|
12
|
+
*/
|
|
13
|
+
class UltravisorTaskTypeValueInput extends libTaskTypeBase
|
|
14
|
+
{
|
|
15
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
16
|
+
{
|
|
17
|
+
super(pFable, pOptions, pServiceHash);
|
|
18
|
+
|
|
19
|
+
this.serviceType = 'UltravisorTaskTypeValueInput';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get definition()
|
|
23
|
+
{
|
|
24
|
+
return {
|
|
25
|
+
Hash: 'value-input',
|
|
26
|
+
Type: 'value-input',
|
|
27
|
+
Name: 'Value Input',
|
|
28
|
+
Description: 'Pauses execution and waits for user-provided input.',
|
|
29
|
+
Category: 'interaction',
|
|
30
|
+
|
|
31
|
+
EventInputs: [{ Name: 'RequestInput' }],
|
|
32
|
+
EventOutputs: [{ Name: 'ValueInputComplete' }],
|
|
33
|
+
SettingsInputs: [
|
|
34
|
+
{ Name: 'PromptMessage', DataType: 'String', Required: false },
|
|
35
|
+
{ Name: 'OutputAddress', DataType: 'String', Required: true }
|
|
36
|
+
],
|
|
37
|
+
StateOutputs: [
|
|
38
|
+
{ Name: 'InputValue', DataType: 'String' }
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
DefaultSettings: { PromptMessage: 'Please provide a value:', OutputAddress: '' }
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
46
|
+
{
|
|
47
|
+
let tmpPromptMessage = pResolvedSettings.PromptMessage || 'Please provide a value:';
|
|
48
|
+
let tmpOutputAddress = pResolvedSettings.OutputAddress || '';
|
|
49
|
+
|
|
50
|
+
// Signal that this task is waiting for input
|
|
51
|
+
// The ExecutionEngine will set the run to WaitingForInput status
|
|
52
|
+
return fCallback(null, {
|
|
53
|
+
WaitingForInput: true,
|
|
54
|
+
PromptMessage: tmpPromptMessage,
|
|
55
|
+
OutputAddress: tmpOutputAddress,
|
|
56
|
+
Outputs: {},
|
|
57
|
+
Log: [`Waiting for input: "${tmpPromptMessage}" (-> ${tmpOutputAddress})`]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = UltravisorTaskTypeValueInput;
|