powr-sdk-api 4.3.3 → 4.3.5
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/managers/index.js +26 -5
- package/dist/managers/tasks.js +6 -5
- package/dist/managers/tools.js +7 -1
- package/dist/routes/tasks.js +3 -1
- package/package.json +1 -1
package/dist/managers/index.js
CHANGED
|
@@ -2,10 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
const functionsManager = require('./functions');
|
|
4
4
|
const toolsManager = require('./tools');
|
|
5
|
-
const
|
|
5
|
+
const scheduledTasksManager = require('./tasks');
|
|
6
|
+
|
|
7
|
+
// Async Functions initialization function
|
|
8
|
+
const initializeFunctions = async (options = {}) => {
|
|
9
|
+
// Initialize Functions manager with options
|
|
10
|
+
await functionsManager.initialize(options);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Async Tools initialization function
|
|
14
|
+
const initializeTools = async (options = {}) => {
|
|
15
|
+
// Initialize Tools manager with options
|
|
16
|
+
await toolsManager.initialize(options);
|
|
17
|
+
};
|
|
18
|
+
const executeTool = async (options = {}) => {
|
|
19
|
+
// Execute tool action
|
|
20
|
+
return await toolsManager.executeToolAction(options);
|
|
21
|
+
};
|
|
22
|
+
const executeTasks = async (options = {}) => {
|
|
23
|
+
// Execute scheduled tasks
|
|
24
|
+
await scheduledTasksManager.executeScheduledTasks(options);
|
|
25
|
+
};
|
|
6
26
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
27
|
+
// Initialization/Execution methods
|
|
28
|
+
initializeFunctions,
|
|
29
|
+
initializeTools,
|
|
30
|
+
executeTasks,
|
|
31
|
+
executeTool
|
|
11
32
|
};
|
package/dist/managers/tasks.js
CHANGED
|
@@ -309,7 +309,10 @@ class TasksManager {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
// Execute scheduled tasks (called by MongoDB Atlas Scheduled Trigger)
|
|
312
|
-
async executeScheduledTasks(
|
|
312
|
+
async executeScheduledTasks(options = {}) {
|
|
313
|
+
const {
|
|
314
|
+
projectId
|
|
315
|
+
} = options;
|
|
313
316
|
try {
|
|
314
317
|
const db = await getDb();
|
|
315
318
|
const query = {
|
|
@@ -366,12 +369,10 @@ class TasksManager {
|
|
|
366
369
|
async executeTaskAction(task) {
|
|
367
370
|
try {
|
|
368
371
|
// Import tools manager
|
|
369
|
-
const
|
|
370
|
-
toolsManager
|
|
371
|
-
} = require('./index');
|
|
372
|
+
const toolsManager = require('./tools');
|
|
372
373
|
|
|
373
374
|
// Execute the tool action
|
|
374
|
-
const result = await toolsManager.executeToolAction(task
|
|
375
|
+
const result = await toolsManager.executeToolAction(task);
|
|
375
376
|
|
|
376
377
|
// Log execution
|
|
377
378
|
await this.logTaskExecution(task, result);
|
package/dist/managers/tools.js
CHANGED
|
@@ -150,7 +150,13 @@ class ToolsManager {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Execute tool action
|
|
153
|
-
async executeToolAction(
|
|
153
|
+
async executeToolAction(options = {}) {
|
|
154
|
+
const {
|
|
155
|
+
userId,
|
|
156
|
+
toolId,
|
|
157
|
+
actionId,
|
|
158
|
+
params
|
|
159
|
+
} = options;
|
|
154
160
|
if (!this.isEnabled) {
|
|
155
161
|
return {
|
|
156
162
|
success: false,
|
package/dist/routes/tasks.js
CHANGED
|
@@ -282,7 +282,9 @@ router.post("/execute-scheduled", async (req, res) => {
|
|
|
282
282
|
console.log(`🔍 API: Executing scheduled tasks for project: ${projectId}`);
|
|
283
283
|
|
|
284
284
|
// Execute all scheduled tasks for this project
|
|
285
|
-
const result = await tasksManager.executeScheduledTasks(
|
|
285
|
+
const result = await tasksManager.executeScheduledTasks({
|
|
286
|
+
projectId
|
|
287
|
+
});
|
|
286
288
|
console.log(`✅ API: Scheduled tasks execution completed for project: ${projectId}`);
|
|
287
289
|
res.json({
|
|
288
290
|
success: true,
|