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.
Files changed (121) hide show
  1. package/.claude/launch.json +11 -0
  2. package/.claude/ultravisor-dev-config.json +3 -0
  3. package/.ultravisor.json +426 -0
  4. package/docs/README.md +63 -0
  5. package/package.json +12 -8
  6. package/source/Ultravisor.cjs +22 -3
  7. package/source/cli/Ultravisor-CLIProgram.cjs +35 -23
  8. package/source/cli/commands/Ultravisor-Command-SingleOperation.cjs +29 -18
  9. package/source/cli/commands/Ultravisor-Command-SingleTask.cjs +62 -19
  10. package/source/cli/commands/Ultravisor-Command-UpdateTask.cjs +27 -15
  11. package/source/config/Ultravisor-Default-Command-Configuration.cjs +5 -3
  12. package/source/services/Ultravisor-ExecutionEngine.cjs +1039 -0
  13. package/source/services/Ultravisor-ExecutionManifest.cjs +399 -0
  14. package/source/services/Ultravisor-Hypervisor-State.cjs +270 -97
  15. package/source/services/Ultravisor-Hypervisor.cjs +38 -83
  16. package/source/services/Ultravisor-StateManager.cjs +241 -0
  17. package/source/services/Ultravisor-TaskTypeRegistry.cjs +143 -0
  18. package/source/services/tasks/Ultravisor-TaskType-Base.cjs +105 -0
  19. package/source/services/tasks/control/Ultravisor-TaskType-IfConditional.cjs +148 -0
  20. package/source/services/tasks/control/Ultravisor-TaskType-LaunchOperation.cjs +187 -0
  21. package/source/services/tasks/control/Ultravisor-TaskType-SplitExecute.cjs +184 -0
  22. package/source/services/tasks/data/Ultravisor-TaskType-ReplaceString.cjs +82 -0
  23. package/source/services/tasks/data/Ultravisor-TaskType-SetValues.cjs +81 -0
  24. package/source/services/tasks/data/Ultravisor-TaskType-StringAppender.cjs +101 -0
  25. package/source/services/tasks/file-io/Ultravisor-TaskType-ReadFile.cjs +103 -0
  26. package/source/services/tasks/file-io/Ultravisor-TaskType-WriteFile.cjs +117 -0
  27. package/source/services/tasks/interaction/Ultravisor-TaskType-ErrorMessage.cjs +54 -0
  28. package/source/services/tasks/interaction/Ultravisor-TaskType-ValueInput.cjs +62 -0
  29. package/source/web_server/Ultravisor-API-Server.cjs +237 -124
  30. package/test/Ultravisor_browser_tests.js +2226 -0
  31. package/test/Ultravisor_tests.js +1143 -5830
  32. package/webinterface/css/ultravisor.css +23 -0
  33. package/webinterface/package.json +6 -3
  34. package/webinterface/source/Pict-Application-Ultravisor.js +93 -73
  35. package/webinterface/source/cards/FlowCard-CSVTransform.js +43 -0
  36. package/webinterface/source/cards/FlowCard-Command.js +86 -0
  37. package/webinterface/source/cards/FlowCard-ComprehensionIntersect.js +40 -0
  38. package/webinterface/source/cards/FlowCard-Conditional.js +87 -0
  39. package/webinterface/source/cards/FlowCard-CopyFile.js +55 -0
  40. package/webinterface/source/cards/FlowCard-End.js +29 -0
  41. package/webinterface/source/cards/FlowCard-GetJSON.js +55 -0
  42. package/webinterface/source/cards/FlowCard-GetText.js +54 -0
  43. package/webinterface/source/cards/FlowCard-Histogram.js +176 -0
  44. package/webinterface/source/cards/FlowCard-LaunchOperation.js +82 -0
  45. package/webinterface/source/cards/FlowCard-ListFiles.js +55 -0
  46. package/webinterface/source/cards/FlowCard-MeadowCount.js +44 -0
  47. package/webinterface/source/cards/FlowCard-MeadowCreate.js +44 -0
  48. package/webinterface/source/cards/FlowCard-MeadowDelete.js +45 -0
  49. package/webinterface/source/cards/FlowCard-MeadowRead.js +46 -0
  50. package/webinterface/source/cards/FlowCard-MeadowReads.js +46 -0
  51. package/webinterface/source/cards/FlowCard-MeadowUpdate.js +44 -0
  52. package/webinterface/source/cards/FlowCard-ParseCSV.js +85 -0
  53. package/webinterface/source/cards/FlowCard-ReadJSON.js +54 -0
  54. package/webinterface/source/cards/FlowCard-ReadText.js +54 -0
  55. package/webinterface/source/cards/FlowCard-RestRequest.js +59 -0
  56. package/webinterface/source/cards/FlowCard-SendJSON.js +57 -0
  57. package/webinterface/source/cards/FlowCard-Solver.js +77 -0
  58. package/webinterface/source/cards/FlowCard-Start.js +29 -0
  59. package/webinterface/source/cards/FlowCard-TemplateString.js +77 -0
  60. package/webinterface/source/cards/FlowCard-WriteJSON.js +54 -0
  61. package/webinterface/source/cards/FlowCard-WriteText.js +54 -0
  62. package/webinterface/source/data/ExampleFlow-CSVPipeline.js +231 -0
  63. package/webinterface/source/data/ExampleFlow-FileProcessor.js +315 -0
  64. package/webinterface/source/data/ExampleFlow-MeadowPipeline.js +328 -0
  65. package/webinterface/source/providers/PictRouter-Ultravisor-Configuration.json +8 -8
  66. package/webinterface/source/views/PictView-Ultravisor-Dashboard.js +6 -6
  67. package/webinterface/source/views/PictView-Ultravisor-FlowEditor.js +436 -0
  68. package/webinterface/source/views/PictView-Ultravisor-ManifestList.js +45 -43
  69. package/webinterface/source/views/PictView-Ultravisor-OperationEdit.js +34 -89
  70. package/webinterface/source/views/PictView-Ultravisor-OperationList.js +128 -13
  71. package/webinterface/source/views/PictView-Ultravisor-PendingInput.js +314 -0
  72. package/webinterface/source/views/PictView-Ultravisor-Schedule.js +18 -53
  73. package/webinterface/source/views/PictView-Ultravisor-TimingView.js +27 -14
  74. package/webinterface/source/views/PictView-Ultravisor-TopBar.js +2 -1
  75. package/.babelrc +0 -6
  76. package/.browserslistrc +0 -1
  77. package/.browserslistrc-BACKUP +0 -1
  78. package/.gulpfile-quackage-config.json +0 -7
  79. package/.gulpfile-quackage.js +0 -2
  80. package/debug/Harness.js +0 -5
  81. package/source/services/Ultravisor-Operation-Manifest.cjs +0 -160
  82. package/source/services/Ultravisor-Operation.cjs +0 -200
  83. package/source/services/Ultravisor-Task.cjs +0 -349
  84. package/source/services/events/Ultravisor-Hypervisor-Event-Solver.cjs +0 -11
  85. package/source/services/tasks/Ultravisor-Task-Base.cjs +0 -264
  86. package/source/services/tasks/Ultravisor-Task-CollectValues.cjs +0 -188
  87. package/source/services/tasks/Ultravisor-Task-Command.cjs +0 -65
  88. package/source/services/tasks/Ultravisor-Task-CommandEach.cjs +0 -190
  89. package/source/services/tasks/Ultravisor-Task-Conditional.cjs +0 -104
  90. package/source/services/tasks/Ultravisor-Task-DateWindow.cjs +0 -72
  91. package/source/services/tasks/Ultravisor-Task-GeneratePagedOperation.cjs +0 -336
  92. package/source/services/tasks/Ultravisor-Task-LaunchOperation.cjs +0 -143
  93. package/source/services/tasks/Ultravisor-Task-LaunchTask.cjs +0 -146
  94. package/source/services/tasks/Ultravisor-Task-LineMatch.cjs +0 -158
  95. package/source/services/tasks/Ultravisor-Task-Request.cjs +0 -56
  96. package/source/services/tasks/Ultravisor-Task-Solver.cjs +0 -89
  97. package/source/services/tasks/Ultravisor-Task-TemplateString.cjs +0 -93
  98. package/source/services/tasks/rest/Ultravisor-Task-GetBinary.cjs +0 -127
  99. package/source/services/tasks/rest/Ultravisor-Task-GetJSON.cjs +0 -119
  100. package/source/services/tasks/rest/Ultravisor-Task-GetText.cjs +0 -109
  101. package/source/services/tasks/rest/Ultravisor-Task-GetXML.cjs +0 -112
  102. package/source/services/tasks/rest/Ultravisor-Task-RestRequest.cjs +0 -499
  103. package/source/services/tasks/rest/Ultravisor-Task-SendJSON.cjs +0 -150
  104. package/source/services/tasks/stagingfiles/Ultravisor-Task-CopyFile.cjs +0 -110
  105. package/source/services/tasks/stagingfiles/Ultravisor-Task-ListFiles.cjs +0 -89
  106. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadBinary.cjs +0 -87
  107. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadJSON.cjs +0 -67
  108. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadText.cjs +0 -66
  109. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadXML.cjs +0 -69
  110. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteBinary.cjs +0 -95
  111. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteJSON.cjs +0 -96
  112. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteText.cjs +0 -99
  113. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteXML.cjs +0 -102
  114. package/webinterface/.babelrc +0 -6
  115. package/webinterface/.browserslistrc +0 -1
  116. package/webinterface/.browserslistrc-BACKUP +0 -1
  117. package/webinterface/.gulpfile-quackage-config.json +0 -7
  118. package/webinterface/.gulpfile-quackage.js +0 -2
  119. package/webinterface/source/views/PictView-Ultravisor-TaskEdit.js +0 -220
  120. package/webinterface/source/views/PictView-Ultravisor-TaskList.js +0 -248
  121. /package/docs/{cover.md → _cover.md} +0 -0
@@ -18,6 +18,16 @@ class UltravisorAPIServer extends libPictService
18
18
  this.fable.addServiceTypeIfNotExists('Orator', libOrator);
19
19
  }
20
20
 
21
+ /**
22
+ * Get a service instance from the fable services map.
23
+ */
24
+ _getService(pTypeName)
25
+ {
26
+ return this.fable.servicesMap[pTypeName]
27
+ ? Object.values(this.fable.servicesMap[pTypeName])[0]
28
+ : null;
29
+ }
30
+
21
31
  wireEndpoints(fCallback)
22
32
  {
23
33
  if (!this._Orator)
@@ -41,11 +51,11 @@ class UltravisorAPIServer extends libPictService
41
51
  '/status',
42
52
  function (pRequest, pResponse, fNext)
43
53
  {
44
- let tmpHypervisor = this.fable['Ultravisor-Hypervisor'];
54
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
45
55
  pResponse.send({
46
56
  Status: 'Running',
47
- ScheduleEntries: tmpHypervisor.getSchedule().length,
48
- ScheduleRunning: tmpHypervisor._Running
57
+ ScheduleEntries: tmpHypervisor ? tmpHypervisor.getSchedule().length : 0,
58
+ ScheduleRunning: tmpHypervisor ? tmpHypervisor._Running : false
49
59
  });
50
60
  return fNext();
51
61
  }.bind(this)
@@ -57,29 +67,33 @@ class UltravisorAPIServer extends libPictService
57
67
  function (pRequest, pResponse, fNext)
58
68
  {
59
69
  this.log.info(`Ultravisor API Server: Received stop request via API; stopping server.`);
60
- let tmpHypervisor = this.fable['Ultravisor-Hypervisor'];
61
- tmpHypervisor.stopSchedule();
70
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
71
+ if (tmpHypervisor)
72
+ {
73
+ tmpHypervisor.stopSchedule();
74
+ }
62
75
  pResponse.send({ "Status": "STOPPING" });
63
76
  pResponse.end();
64
77
  return this._Orator.stopService(fNext);
65
78
  }.bind(this)
66
79
  );
67
80
 
68
- // --- Task CRUD ---
81
+ // --- Node Template CRUD ---
69
82
  this._OratorServer.get
70
83
  (
71
- '/Task',
84
+ '/NodeTemplate',
72
85
  function (pRequest, pResponse, fNext)
73
86
  {
74
- this.fable['Ultravisor-Hypervisor-State'].getTaskList({},
75
- function (pError, pTasks)
87
+ let tmpState = this._getService('UltravisorHypervisorState');
88
+ tmpState.getNodeTemplateList(
89
+ function (pError, pTemplates)
76
90
  {
77
91
  if (pError)
78
92
  {
79
93
  pResponse.send(500, { Error: pError.message });
80
94
  return fNext();
81
95
  }
82
- pResponse.send(pTasks);
96
+ pResponse.send(pTemplates);
83
97
  return fNext();
84
98
  });
85
99
  }.bind(this)
@@ -87,18 +101,19 @@ class UltravisorAPIServer extends libPictService
87
101
 
88
102
  this._OratorServer.get
89
103
  (
90
- '/Task/:GUIDTask',
104
+ '/NodeTemplate/:Hash',
91
105
  function (pRequest, pResponse, fNext)
92
106
  {
93
- this.fable['Ultravisor-Hypervisor-State'].getTask(pRequest.params.GUIDTask,
94
- function (pError, pTask)
107
+ let tmpState = this._getService('UltravisorHypervisorState');
108
+ tmpState.getNodeTemplate(pRequest.params.Hash,
109
+ function (pError, pTemplate)
95
110
  {
96
111
  if (pError)
97
112
  {
98
113
  pResponse.send(404, { Error: pError.message });
99
114
  return fNext();
100
115
  }
101
- pResponse.send(pTask);
116
+ pResponse.send(pTemplate);
102
117
  return fNext();
103
118
  });
104
119
  }.bind(this)
@@ -106,18 +121,19 @@ class UltravisorAPIServer extends libPictService
106
121
 
107
122
  this._OratorServer.post
108
123
  (
109
- '/Task',
124
+ '/NodeTemplate',
110
125
  function (pRequest, pResponse, fNext)
111
126
  {
112
- this.fable['Ultravisor-Hypervisor-State'].updateTask(pRequest.body,
113
- function (pError, pTask)
127
+ let tmpState = this._getService('UltravisorHypervisorState');
128
+ tmpState.updateNodeTemplate(pRequest.body,
129
+ function (pError, pTemplate)
114
130
  {
115
131
  if (pError)
116
132
  {
117
133
  pResponse.send(400, { Error: pError.message });
118
134
  return fNext();
119
135
  }
120
- pResponse.send(pTask);
136
+ pResponse.send(pTemplate);
121
137
  return fNext();
122
138
  });
123
139
  }.bind(this)
@@ -125,20 +141,21 @@ class UltravisorAPIServer extends libPictService
125
141
 
126
142
  this._OratorServer.put
127
143
  (
128
- '/Task/:GUIDTask',
144
+ '/NodeTemplate/:Hash',
129
145
  function (pRequest, pResponse, fNext)
130
146
  {
131
- let tmpTaskData = pRequest.body || {};
132
- tmpTaskData.GUIDTask = pRequest.params.GUIDTask;
133
- this.fable['Ultravisor-Hypervisor-State'].updateTask(tmpTaskData,
134
- function (pError, pTask)
147
+ let tmpTemplateData = pRequest.body || {};
148
+ tmpTemplateData.Hash = pRequest.params.Hash;
149
+ let tmpState = this._getService('UltravisorHypervisorState');
150
+ tmpState.updateNodeTemplate(tmpTemplateData,
151
+ function (pError, pTemplate)
135
152
  {
136
153
  if (pError)
137
154
  {
138
155
  pResponse.send(400, { Error: pError.message });
139
156
  return fNext();
140
157
  }
141
- pResponse.send(pTask);
158
+ pResponse.send(pTemplate);
142
159
  return fNext();
143
160
  });
144
161
  }.bind(this)
@@ -146,21 +163,21 @@ class UltravisorAPIServer extends libPictService
146
163
 
147
164
  this._OratorServer.del
148
165
  (
149
- '/Task/:GUIDTask',
166
+ '/NodeTemplate/:Hash',
150
167
  function (pRequest, pResponse, fNext)
151
168
  {
152
- let tmpState = this.fable['Ultravisor-Hypervisor-State'];
153
- if (tmpState._Tasks.hasOwnProperty(pRequest.params.GUIDTask))
154
- {
155
- delete tmpState._Tasks[pRequest.params.GUIDTask];
156
- tmpState.persistState();
157
- pResponse.send({ Status: 'Deleted', GUIDTask: pRequest.params.GUIDTask });
158
- }
159
- else
160
- {
161
- pResponse.send(404, { Error: `Task ${pRequest.params.GUIDTask} not found.` });
162
- }
163
- return fNext();
169
+ let tmpState = this._getService('UltravisorHypervisorState');
170
+ tmpState.deleteNodeTemplate(pRequest.params.Hash,
171
+ function (pError)
172
+ {
173
+ if (pError)
174
+ {
175
+ pResponse.send(404, { Error: pError.message });
176
+ return fNext();
177
+ }
178
+ pResponse.send({ Status: 'Deleted', Hash: pRequest.params.Hash });
179
+ return fNext();
180
+ });
164
181
  }.bind(this)
165
182
  );
166
183
 
@@ -170,7 +187,8 @@ class UltravisorAPIServer extends libPictService
170
187
  '/Operation',
171
188
  function (pRequest, pResponse, fNext)
172
189
  {
173
- this.fable['Ultravisor-Hypervisor-State'].getOperationList({},
190
+ let tmpState = this._getService('UltravisorHypervisorState');
191
+ tmpState.getOperationList(
174
192
  function (pError, pOperations)
175
193
  {
176
194
  if (pError)
@@ -186,10 +204,11 @@ class UltravisorAPIServer extends libPictService
186
204
 
187
205
  this._OratorServer.get
188
206
  (
189
- '/Operation/:GUIDOperation',
207
+ '/Operation/:Hash',
190
208
  function (pRequest, pResponse, fNext)
191
209
  {
192
- this.fable['Ultravisor-Hypervisor-State'].getOperation(pRequest.params.GUIDOperation,
210
+ let tmpState = this._getService('UltravisorHypervisorState');
211
+ tmpState.getOperation(pRequest.params.Hash,
193
212
  function (pError, pOperation)
194
213
  {
195
214
  if (pError)
@@ -208,7 +227,8 @@ class UltravisorAPIServer extends libPictService
208
227
  '/Operation',
209
228
  function (pRequest, pResponse, fNext)
210
229
  {
211
- this.fable['Ultravisor-Hypervisor-State'].updateOperation(pRequest.body,
230
+ let tmpState = this._getService('UltravisorHypervisorState');
231
+ tmpState.updateOperation(pRequest.body,
212
232
  function (pError, pOperation)
213
233
  {
214
234
  if (pError)
@@ -224,12 +244,13 @@ class UltravisorAPIServer extends libPictService
224
244
 
225
245
  this._OratorServer.put
226
246
  (
227
- '/Operation/:GUIDOperation',
247
+ '/Operation/:Hash',
228
248
  function (pRequest, pResponse, fNext)
229
249
  {
230
250
  let tmpOperationData = pRequest.body || {};
231
- tmpOperationData.GUIDOperation = pRequest.params.GUIDOperation;
232
- this.fable['Ultravisor-Hypervisor-State'].updateOperation(tmpOperationData,
251
+ tmpOperationData.Hash = pRequest.params.Hash;
252
+ let tmpState = this._getService('UltravisorHypervisorState');
253
+ tmpState.updateOperation(tmpOperationData,
233
254
  function (pError, pOperation)
234
255
  {
235
256
  if (pError)
@@ -245,69 +266,34 @@ class UltravisorAPIServer extends libPictService
245
266
 
246
267
  this._OratorServer.del
247
268
  (
248
- '/Operation/:GUIDOperation',
249
- function (pRequest, pResponse, fNext)
250
- {
251
- let tmpState = this.fable['Ultravisor-Hypervisor-State'];
252
- if (tmpState._Operations.hasOwnProperty(pRequest.params.GUIDOperation))
253
- {
254
- delete tmpState._Operations[pRequest.params.GUIDOperation];
255
- tmpState.persistState();
256
- pResponse.send({ Status: 'Deleted', GUIDOperation: pRequest.params.GUIDOperation });
257
- }
258
- else
259
- {
260
- pResponse.send(404, { Error: `Operation ${pRequest.params.GUIDOperation} not found.` });
261
- }
262
- return fNext();
263
- }.bind(this)
264
- );
265
-
266
- // --- Task Execution ---
267
- this._OratorServer.get
268
- (
269
- '/Task/:GUIDTask/Execute',
269
+ '/Operation/:Hash',
270
270
  function (pRequest, pResponse, fNext)
271
271
  {
272
- let tmpState = this.fable['Ultravisor-Hypervisor-State'];
273
- let tmpTaskService = this.fable['Ultravisor-Task'];
274
-
275
- tmpState.getTask(pRequest.params.GUIDTask,
276
- function (pError, pTask)
272
+ let tmpState = this._getService('UltravisorHypervisorState');
273
+ tmpState.deleteOperation(pRequest.params.Hash,
274
+ function (pError)
277
275
  {
278
276
  if (pError)
279
277
  {
280
278
  pResponse.send(404, { Error: pError.message });
281
279
  return fNext();
282
280
  }
283
- tmpTaskService.executeTask(pTask, {},
284
- function (pExecError, pManifestEntry)
285
- {
286
- if (pExecError)
287
- {
288
- pResponse.send(500, { Error: pExecError.message });
289
- return fNext();
290
- }
291
- // Store the task result as a manifest so it appears in /Manifest
292
- let tmpManifestService = this.fable['Ultravisor-Operation-Manifest'];
293
- tmpManifestService.createTaskManifest(pManifestEntry);
294
- pResponse.send(pManifestEntry);
295
- return fNext();
296
- }.bind(this));
297
- }.bind(this));
281
+ pResponse.send({ Status: 'Deleted', Hash: pRequest.params.Hash });
282
+ return fNext();
283
+ });
298
284
  }.bind(this)
299
285
  );
300
286
 
301
287
  // --- Operation Execution ---
302
288
  this._OratorServer.get
303
289
  (
304
- '/Operation/:GUIDOperation/Execute',
290
+ '/Operation/:Hash/Execute',
305
291
  function (pRequest, pResponse, fNext)
306
292
  {
307
- let tmpState = this.fable['Ultravisor-Hypervisor-State'];
308
- let tmpOperationService = this.fable['Ultravisor-Operation'];
293
+ let tmpState = this._getService('UltravisorHypervisorState');
294
+ let tmpEngine = this._getService('UltravisorExecutionEngine');
309
295
 
310
- tmpState.getOperation(pRequest.params.GUIDOperation,
296
+ tmpState.getOperation(pRequest.params.Hash,
311
297
  function (pError, pOperation)
312
298
  {
313
299
  if (pError)
@@ -315,51 +301,62 @@ class UltravisorAPIServer extends libPictService
315
301
  pResponse.send(404, { Error: pError.message });
316
302
  return fNext();
317
303
  }
318
- tmpOperationService.executeOperation(pOperation,
319
- function (pExecError, pManifest)
304
+
305
+ tmpEngine.executeOperation(pOperation,
306
+ function (pExecError, pContext)
320
307
  {
321
308
  if (pExecError)
322
309
  {
323
310
  pResponse.send(500, { Error: pExecError.message });
324
311
  return fNext();
325
312
  }
326
- pResponse.send(pManifest);
313
+ pResponse.send({
314
+ Status: pContext.Status,
315
+ Hash: pContext.Hash,
316
+ OperationHash: pContext.OperationHash,
317
+ TaskOutputs: pContext.TaskOutputs,
318
+ Log: pContext.Log,
319
+ Errors: pContext.Errors,
320
+ StartTime: pContext.StartTime,
321
+ StopTime: pContext.StopTime,
322
+ ElapsedMs: pContext.ElapsedMs,
323
+ TaskManifests: pContext.TaskManifests,
324
+ WaitingTasks: pContext.WaitingTasks
325
+ });
327
326
  return fNext();
328
327
  });
329
328
  });
330
329
  }.bind(this)
331
330
  );
332
331
 
333
- // --- Schedule ---
332
+ // --- Task Types ---
334
333
  this._OratorServer.get
335
334
  (
336
- '/Schedule',
335
+ '/TaskType',
337
336
  function (pRequest, pResponse, fNext)
338
337
  {
339
- pResponse.send(this.fable['Ultravisor-Hypervisor'].getSchedule());
338
+ let tmpRegistry = this._getService('UltravisorTaskTypeRegistry');
339
+ if (tmpRegistry)
340
+ {
341
+ pResponse.send(tmpRegistry.listDefinitions());
342
+ }
343
+ else
344
+ {
345
+ pResponse.send([]);
346
+ }
340
347
  return fNext();
341
348
  }.bind(this)
342
349
  );
343
350
 
344
- this._OratorServer.post
351
+ // --- Schedule ---
352
+ this._OratorServer.get
345
353
  (
346
- '/Schedule/Task',
354
+ '/Schedule',
347
355
  function (pRequest, pResponse, fNext)
348
356
  {
349
- let tmpBody = pRequest.body || {};
350
- let tmpHypervisor = this.fable['Ultravisor-Hypervisor'];
351
-
352
- tmpHypervisor.scheduleTask(tmpBody.GUIDTask, tmpBody.ScheduleType, tmpBody.Parameters,
353
- function (pError, pEntry)
354
- {
355
- if (pError)
356
- {
357
- pResponse.send(400, { Error: pError.message });
358
- return fNext();
359
- }
360
- pResponse.send(pEntry);
361
- return fNext();
362
- });
357
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
358
+ pResponse.send(tmpHypervisor ? tmpHypervisor.getSchedule() : []);
359
+ return fNext();
363
360
  }.bind(this)
364
361
  );
365
362
 
@@ -369,9 +366,9 @@ class UltravisorAPIServer extends libPictService
369
366
  function (pRequest, pResponse, fNext)
370
367
  {
371
368
  let tmpBody = pRequest.body || {};
372
- let tmpHypervisor = this.fable['Ultravisor-Hypervisor'];
369
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
373
370
 
374
- tmpHypervisor.scheduleOperation(tmpBody.GUIDOperation, tmpBody.ScheduleType, tmpBody.Parameters,
371
+ tmpHypervisor.scheduleOperation(tmpBody.Hash, tmpBody.ScheduleType, tmpBody.Parameters,
375
372
  function (pError, pEntry)
376
373
  {
377
374
  if (pError)
@@ -390,7 +387,8 @@ class UltravisorAPIServer extends libPictService
390
387
  '/Schedule/:GUID',
391
388
  function (pRequest, pResponse, fNext)
392
389
  {
393
- this.fable['Ultravisor-Hypervisor'].removeScheduleEntry(pRequest.params.GUID,
390
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
391
+ tmpHypervisor.removeScheduleEntry(pRequest.params.GUID,
394
392
  function (pError, pResult)
395
393
  {
396
394
  if (pError)
@@ -409,7 +407,8 @@ class UltravisorAPIServer extends libPictService
409
407
  '/Schedule/Start',
410
408
  function (pRequest, pResponse, fNext)
411
409
  {
412
- this.fable['Ultravisor-Hypervisor'].startSchedule(
410
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
411
+ tmpHypervisor.startSchedule(
413
412
  function ()
414
413
  {
415
414
  pResponse.send({ Status: 'Schedule Started' });
@@ -423,7 +422,8 @@ class UltravisorAPIServer extends libPictService
423
422
  '/Schedule/Stop',
424
423
  function (pRequest, pResponse, fNext)
425
424
  {
426
- this.fable['Ultravisor-Hypervisor'].stopSchedule(
425
+ let tmpHypervisor = this._getService('UltravisorHypervisor');
426
+ tmpHypervisor.stopSchedule(
427
427
  function ()
428
428
  {
429
429
  pResponse.send({ Status: 'Schedule Stopped' });
@@ -438,29 +438,142 @@ class UltravisorAPIServer extends libPictService
438
438
  '/Manifest',
439
439
  function (pRequest, pResponse, fNext)
440
440
  {
441
- pResponse.send(this.fable['Ultravisor-Operation-Manifest'].getManifestList());
441
+ let tmpManifest = this._getService('UltravisorExecutionManifest');
442
+ pResponse.send(tmpManifest ? tmpManifest.listRuns() : []);
442
443
  return fNext();
443
444
  }.bind(this)
444
445
  );
445
446
 
446
447
  this._OratorServer.get
447
448
  (
448
- '/Manifest/:GUIDRun',
449
+ '/Manifest/:RunHash',
449
450
  function (pRequest, pResponse, fNext)
450
451
  {
451
- let tmpManifest = this.fable['Ultravisor-Operation-Manifest'].getManifest(pRequest.params.GUIDRun);
452
- if (tmpManifest)
452
+ let tmpManifest = this._getService('UltravisorExecutionManifest');
453
+ let tmpRun = tmpManifest ? tmpManifest.getRun(pRequest.params.RunHash) : null;
454
+ if (tmpRun)
453
455
  {
454
- pResponse.send(tmpManifest);
456
+ pResponse.send(tmpRun);
455
457
  }
456
458
  else
457
459
  {
458
- pResponse.send(404, { Error: `Manifest ${pRequest.params.GUIDRun} not found.` });
460
+ pResponse.send(404, { Error: `Manifest ${pRequest.params.RunHash} not found.` });
459
461
  }
460
462
  return fNext();
461
463
  }.bind(this)
462
464
  );
463
465
 
466
+ // --- Pending Inputs ---
467
+ this._OratorServer.get
468
+ (
469
+ '/PendingInput',
470
+ function (pRequest, pResponse, fNext)
471
+ {
472
+ let tmpManifest = this._getService('UltravisorExecutionManifest');
473
+ if (!tmpManifest)
474
+ {
475
+ pResponse.send([]);
476
+ return fNext();
477
+ }
478
+
479
+ let tmpRuns = tmpManifest.listRuns();
480
+ let tmpPending = [];
481
+
482
+ for (let i = 0; i < tmpRuns.length; i++)
483
+ {
484
+ if (tmpRuns[i].Status === 'WaitingForInput')
485
+ {
486
+ let tmpFullRun = tmpManifest.getRun(tmpRuns[i].Hash);
487
+ if (tmpFullRun)
488
+ {
489
+ tmpPending.push({
490
+ RunHash: tmpFullRun.Hash,
491
+ OperationHash: tmpFullRun.OperationHash,
492
+ OperationName: tmpFullRun.OperationName,
493
+ StartTime: tmpFullRun.StartTime,
494
+ WaitingTasks: tmpFullRun.WaitingTasks
495
+ });
496
+ }
497
+ }
498
+ }
499
+
500
+ pResponse.send(tmpPending);
501
+ return fNext();
502
+ }.bind(this)
503
+ );
504
+
505
+ this._OratorServer.post
506
+ (
507
+ '/PendingInput/:RunHash',
508
+ function (pRequest, pResponse, fNext)
509
+ {
510
+ let tmpBody = pRequest.body || {};
511
+ let tmpEngine = this._getService('UltravisorExecutionEngine');
512
+ let tmpRunHash = pRequest.params.RunHash;
513
+
514
+ if (!tmpBody.NodeHash)
515
+ {
516
+ pResponse.send(400, { Error: 'NodeHash is required.' });
517
+ return fNext();
518
+ }
519
+
520
+ tmpEngine.resumeOperation(tmpRunHash, tmpBody.NodeHash, tmpBody.Value,
521
+ function (pError, pContext)
522
+ {
523
+ if (pError)
524
+ {
525
+ pResponse.send(400, { Error: pError.message });
526
+ return fNext();
527
+ }
528
+ pResponse.send({
529
+ Status: pContext.Status,
530
+ Hash: pContext.Hash,
531
+ TaskOutputs: pContext.TaskOutputs,
532
+ Log: pContext.Log,
533
+ Errors: pContext.Errors,
534
+ WaitingTasks: pContext.WaitingTasks
535
+ });
536
+ return fNext();
537
+ });
538
+ }.bind(this)
539
+ );
540
+
541
+ // --- Operation Resume (for value-input tasks) ---
542
+ this._OratorServer.post
543
+ (
544
+ '/Operation/Resume',
545
+ function (pRequest, pResponse, fNext)
546
+ {
547
+ let tmpBody = pRequest.body || {};
548
+ let tmpEngine = this._getService('UltravisorExecutionEngine');
549
+
550
+ if (!tmpBody.RunHash || !tmpBody.NodeHash)
551
+ {
552
+ pResponse.send(400, { Error: 'RunHash and NodeHash are required.' });
553
+ return fNext();
554
+ }
555
+
556
+ tmpEngine.resumeOperation(tmpBody.RunHash, tmpBody.NodeHash, tmpBody.Value,
557
+ function (pError, pContext)
558
+ {
559
+ if (pError)
560
+ {
561
+ pResponse.send(400, { Error: pError.message });
562
+ return fNext();
563
+ }
564
+ pResponse.send({
565
+ Status: pContext.Status,
566
+ Hash: pContext.Hash,
567
+ TaskOutputs: pContext.TaskOutputs,
568
+ Log: pContext.Log,
569
+ Errors: pContext.Errors,
570
+ WaitingTasks: pContext.WaitingTasks
571
+ });
572
+ return fNext();
573
+ });
574
+ }.bind(this)
575
+ );
576
+
464
577
  return fCallback();
465
578
  }
466
579
 
@@ -576,4 +689,4 @@ class UltravisorAPIServer extends libPictService
576
689
  }
577
690
  }
578
691
 
579
- module.exports = UltravisorAPIServer;
692
+ module.exports = UltravisorAPIServer;