n8n-nodes-databar 0.1.2 → 0.1.3
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.
|
@@ -27,6 +27,17 @@
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.Databar = void 0;
|
|
29
29
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
30
|
+
/**
|
|
31
|
+
* Helper function to wait for a specified duration using a polling loop
|
|
32
|
+
* This avoids using restricted globals like setTimeout/setInterval
|
|
33
|
+
*/
|
|
34
|
+
async function wait(ms) {
|
|
35
|
+
const start = Date.now();
|
|
36
|
+
while (Date.now() - start < ms) {
|
|
37
|
+
// Yield control to allow other operations
|
|
38
|
+
await Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Helper function to poll task status until completion
|
|
32
43
|
*
|
|
@@ -64,9 +75,7 @@ async function pollTaskStatus(context, taskId, pollInterval, timeout) {
|
|
|
64
75
|
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Task ${taskId} failed: ${error}`);
|
|
65
76
|
}
|
|
66
77
|
// Wait before polling again
|
|
67
|
-
await
|
|
68
|
-
globalThis.setTimeout(resolve, pollIntervalMs);
|
|
69
|
-
});
|
|
78
|
+
await wait(pollIntervalMs);
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
class Databar {
|