@budibase/backend-core 2.18.2 → 2.19.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/dist/index.js CHANGED
@@ -54608,6 +54608,8 @@ function logWarn(message, e) {
54608
54608
  // src/timers/index.ts
54609
54609
  var timers_exports = {};
54610
54610
  __export(timers_exports, {
54611
+ ExecutionTimeTracker: () => ExecutionTimeTracker,
54612
+ ExecutionTimeoutError: () => ExecutionTimeoutError,
54611
54613
  cleanup: () => cleanup,
54612
54614
  clear: () => clear,
54613
54615
  set: () => set
@@ -54633,6 +54635,42 @@ function cleanup() {
54633
54635
  }
54634
54636
  intervals = [];
54635
54637
  }
54638
+ var ExecutionTimeoutError = class extends Error {
54639
+ constructor() {
54640
+ super(...arguments);
54641
+ this.name = "ExecutionTimeoutError";
54642
+ }
54643
+ };
54644
+ var ExecutionTimeTracker = class _ExecutionTimeTracker {
54645
+ constructor(limitMs) {
54646
+ this.limitMs = limitMs;
54647
+ this.totalTimeMs = 0;
54648
+ }
54649
+ static withLimit(limitMs) {
54650
+ return new _ExecutionTimeTracker(limitMs);
54651
+ }
54652
+ track(f) {
54653
+ this.checkLimit();
54654
+ const start2 = process.hrtime.bigint();
54655
+ try {
54656
+ return f();
54657
+ } finally {
54658
+ const end2 = process.hrtime.bigint();
54659
+ this.totalTimeMs += Number(end2 - start2) / 1e6;
54660
+ this.checkLimit();
54661
+ }
54662
+ }
54663
+ get elapsedMS() {
54664
+ return this.totalTimeMs;
54665
+ }
54666
+ checkLimit() {
54667
+ if (this.totalTimeMs > this.limitMs) {
54668
+ throw new ExecutionTimeoutError(
54669
+ `Execution time limit of ${this.limitMs}ms exceeded: ${this.totalTimeMs}ms`
54670
+ );
54671
+ }
54672
+ }
54673
+ };
54636
54674
 
54637
54675
  // src/redis/redis.ts
54638
54676
  var MockRedis;