@ancon/wildcat-utils 1.44.0-terminal-refactor.6 → 1.44.0-terminal-refactor.7

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.
@@ -38,11 +38,11 @@ declare class HangfirePoller {
38
38
  private waitForNetworkOnline;
39
39
  private executeWorkerRequest;
40
40
  private deleteWorker;
41
- createWorker(groupId: string, { workerId, url, headers, onResolved, }: {
41
+ createWorker(groupId: string, { workerId, url, headers, onFinished, }: {
42
42
  workerId: string;
43
43
  url: string;
44
44
  headers?: APIHeaders;
45
- onResolved?: (forced: boolean) => void | Promise<void>;
45
+ onFinished?: (forced: boolean) => void | Promise<void>;
46
46
  }): Promise<unknown>;
47
47
  /** Trigger a worker to execute immediately, ignoring busy state */
48
48
  triggerWorker(workerId: string): void;
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var b=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r;var o=(i,e,r)=>(b(i,typeof e!="symbol"?e+"":e,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("axios"),u=require("@ancon/wildcat-types"),a=require("../error/createCodedError.js"),W=require("../error/isNotFoundError.js"),m=require("../error/serializeError.js"),w=require("../error/isErrorWithStatusCode.js"),x=require("../api/isNoContentResponse.js"),y=require("../shared/wait.js");require("../error/isCodedError.js");require("../error/isAPIError.js");class f{constructor(e){o(this,"busyWorkers",new Set);o(this,"enabledGroups",new Set);o(this,"groups",new Map);o(this,"workerByIdMap",new Map);o(this,"timer",null);o(this,"config",{pollerInterval:5e3,maxGroupsSize:50,maxWorkersSize:20,responseInterceptor:void 0,responseRejectionInterceptor:void 0,getIsNetworkOnline(){return!0},async getRequestHeaders(){return{}},debug(...e){console.log(...e)}});o(this,"axiosInstance");this.config={...this.config,...e??null},this.axiosInstance=k.create(),(this.config.responseInterceptor||this.config.responseRejectionInterceptor)&&this.axiosInstance.interceptors.response.use(this.config.responseInterceptor,this.config.responseRejectionInterceptor)}stopTimer(){this.timer!=null&&(this.config.debug("*stop timer*"),clearInterval(this.timer),this.timer=null)}startTimer(){if(this.timer!=null)throw a(new Error("Timer already started"),u.ErrorCode.GenericUnexpectedHangfireError);this.config.debug("*start timer*"),this.timer=setInterval(()=>{this.config.debug("*tick*",{busyWorkers:this.busyWorkers.size,enabledGroups:this.enabledGroups.size,groups:this.groups}),this.enabledGroups.forEach(e=>{const r=this.groups.get(e);r&&r.forEach(t=>this.executeWorkerRequest(t))}),this.groups.size<1&&this.stopTimer()},this.config.pollerInterval)}async waitForNetworkOnline(e=5){let r=0;for(;!this.config.getIsNetworkOnline()&&r<e+1;)r+=1,await y(1e3)}async executeWorkerRequest(e,r=!1){const t=r!==!0&&this.busyWorkers.has(e.workerId);this.config.debug("*executeWorkerRequest*",{workerId:e.workerId,isBusy:t,force:r}),t?this.config.debug("*executeWorkerRequest* worker is busy",e.workerId):(this.busyWorkers.add(e.workerId),await this.waitForNetworkOnline(),this.config.debug("*executeWorkerRequest* request",{isNetworkOnline:this.config.getIsNetworkOnline()}),this.axiosInstance({url:e.url,method:"get",timeout:this.config.pollerInterval,headers:{...await this.config.getRequestHeaders(),...e.headers}}).then(s=>{var n;s&&!x(s)?(e.resolve(s),(n=e.onResolved)==null||n.call(e,r),this.deleteWorker(e.groupId,e.workerId)):this.busyWorkers.delete(e.workerId)}).catch(s=>{if(w(s)){if(W(s)){this.config.debug("*executeWorkerRequest* worker is expired or invalid",e.workerId);const n=m(a(new Error("The Hangfire worker is expired or invalid"),u.ErrorCode.HangfireWorkerExpiredOrInvalid));e.reject(n)}else e.reject(s);this.deleteWorker(e.groupId,e.workerId)}else this.config.debug("*executeWorkerRequest* not an api error"),this.busyWorkers.delete(e.workerId)}))}deleteWorker(e,r){const t=this.groups.get(e);t&&(this.config.debug("*delete worker*",t.size,t),t.delete(r),this.workerByIdMap.delete(r),this.busyWorkers.delete(r),t.size<1&&(this.groups.delete(e),this.enabledGroups.delete(e),this.enabledGroups.size<1&&this.stopTimer()))}createWorker(e,{workerId:r,url:t,headers:s,onResolved:n}){if(!this.groups.has(e)){if(this.groups.size>=this.config.maxGroupsSize){const h=a(new Error("Max number of Hangfire groups exceeded"),u.ErrorCode.GenericUnexpectedHangfireError,{count:this.groups.size});throw this.destroy(),h}this.groups.set(e,new Map)}const c=this.groups.get(e);return new Promise((h,l)=>{if(c.has(r))throw a(new Error("Duplicate Hangfire worker ID"),u.ErrorCode.GenericUnexpectedHangfireError);if(c.size>=this.config.maxWorkersSize){const g=a(new Error("Max number of Hangfire workers in group exceeded"),u.ErrorCode.GenericUnexpectedHangfireError,{groupId:e,count:c.size});throw l(g),this.destroy(),g}const d={workerId:r,groupId:e,url:t,resolve:h,reject:l,headers:s,onResolved:n};c.set(r,d),this.workerByIdMap.set(r,d),this.enabledGroups.has(e)||this.enabledGroups.add(e),this.timer==null&&this.enabledGroups.size>0&&this.startTimer()})}triggerWorker(e){this.config.debug("*triggerWorker*");const r=this.workerByIdMap.get(e);r?this.executeWorkerRequest(r,!0):this.config.debug("*triggerWorker* worker not found",e)}triggerAllWorkers(){this.config.debug("*triggerAllWorkers*");for(const e of this.workerByIdMap.values())this.executeWorkerRequest(e)}enableWorkers(e){this.config.debug("*enable*",e),this.enabledGroups.add(e),this.groups.has(e)&&this.timer==null&&this.startTimer()}disableWorkers(e){this.config.debug("*disable*",e),this.enabledGroups.delete(e),this.enabledGroups.size<1&&this.stopTimer()}destroy(){this.config.debug("*destroy*"),this.groups.clear(),this.stopTimer()}}function E(i){return new f(i)}exports.HangfirePoller=f;exports.default=E;
1
+ "use strict";var p=Object.defineProperty;var b=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r;var o=(i,e,r)=>(b(i,typeof e!="symbol"?e+"":e,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const W=require("axios"),h=require("@ancon/wildcat-types"),c=require("../error/createCodedError.js"),m=require("../error/isNotFoundError.js"),x=require("../error/serializeError.js"),k=require("../error/isErrorWithStatusCode.js"),y=require("../api/isNoContentResponse.js"),E=require("../shared/wait.js");require("../error/isCodedError.js");require("../error/isAPIError.js");class f{constructor(e){o(this,"busyWorkers",new Set);o(this,"enabledGroups",new Set);o(this,"groups",new Map);o(this,"workerByIdMap",new Map);o(this,"timer",null);o(this,"config",{pollerInterval:5e3,maxGroupsSize:50,maxWorkersSize:20,responseInterceptor:void 0,responseRejectionInterceptor:void 0,getIsNetworkOnline(){return!0},async getRequestHeaders(){return{}},debug(...e){console.log(...e)}});o(this,"axiosInstance");this.config={...this.config,...e??null},this.axiosInstance=W.create(),(this.config.responseInterceptor||this.config.responseRejectionInterceptor)&&this.axiosInstance.interceptors.response.use(this.config.responseInterceptor,this.config.responseRejectionInterceptor)}stopTimer(){this.timer!=null&&(this.config.debug("*stop timer*"),clearInterval(this.timer),this.timer=null)}startTimer(){if(this.timer!=null)throw c(new Error("Timer already started"),h.ErrorCode.GenericUnexpectedHangfireError);this.config.debug("*start timer*"),this.timer=setInterval(()=>{this.config.debug("*tick*",{busyWorkers:this.busyWorkers.size,enabledGroups:this.enabledGroups.size,groups:this.groups}),this.enabledGroups.forEach(e=>{const r=this.groups.get(e);r&&r.forEach(t=>this.executeWorkerRequest(t))}),this.groups.size<1&&this.stopTimer()},this.config.pollerInterval)}async waitForNetworkOnline(e=5){let r=0;for(;!this.config.getIsNetworkOnline()&&r<e+1;)r+=1,await E(1e3)}async executeWorkerRequest(e,r=!1){const t=r!==!0&&this.busyWorkers.has(e.workerId);this.config.debug("*executeWorkerRequest*",{workerId:e.workerId,isBusy:t,force:r}),t?this.config.debug("*executeWorkerRequest* worker is busy",e.workerId):(this.busyWorkers.add(e.workerId),await this.waitForNetworkOnline(),this.config.debug("*executeWorkerRequest* request",{isNetworkOnline:this.config.getIsNetworkOnline()}),this.axiosInstance({url:e.url,method:"get",timeout:this.config.pollerInterval,headers:{...await this.config.getRequestHeaders(),...e.headers}}).then(s=>{var n;s&&!y(s)?(e.resolve(s),(n=e.onFinished)==null||n.call(e,r),this.deleteWorker(e.groupId,e.workerId)):this.busyWorkers.delete(e.workerId)}).catch(s=>{var n,u;if(k(s)){if(m(s)){this.config.debug("*executeWorkerRequest* worker is expired or invalid",e.workerId);const a=x(c(new Error("The Hangfire worker is expired or invalid"),h.ErrorCode.HangfireWorkerExpiredOrInvalid));e.reject(a),(n=e.onFinished)==null||n.call(e,r)}else e.reject(s),(u=e.onFinished)==null||u.call(e,r);this.deleteWorker(e.groupId,e.workerId)}else this.config.debug("*executeWorkerRequest* not an api error"),this.busyWorkers.delete(e.workerId)}))}deleteWorker(e,r){const t=this.groups.get(e);t&&(this.config.debug("*delete worker*",t.size,t),t.delete(r),this.workerByIdMap.delete(r),this.busyWorkers.delete(r),t.size<1&&(this.groups.delete(e),this.enabledGroups.delete(e),this.enabledGroups.size<1&&this.stopTimer()))}createWorker(e,{workerId:r,url:t,headers:s,onFinished:n}){if(!this.groups.has(e)){if(this.groups.size>=this.config.maxGroupsSize){const a=c(new Error("Max number of Hangfire groups exceeded"),h.ErrorCode.GenericUnexpectedHangfireError,{count:this.groups.size});throw this.destroy(),a}this.groups.set(e,new Map)}const u=this.groups.get(e);return new Promise((a,l)=>{if(u.has(r))throw c(new Error("Duplicate Hangfire worker ID"),h.ErrorCode.GenericUnexpectedHangfireError);if(u.size>=this.config.maxWorkersSize){const g=c(new Error("Max number of Hangfire workers in group exceeded"),h.ErrorCode.GenericUnexpectedHangfireError,{groupId:e,count:u.size});throw l(g),this.destroy(),g}const d={workerId:r,groupId:e,url:t,resolve:a,reject:l,headers:s,onFinished:n};u.set(r,d),this.workerByIdMap.set(r,d),this.enabledGroups.has(e)||this.enabledGroups.add(e),this.timer==null&&this.enabledGroups.size>0&&this.startTimer()})}triggerWorker(e){this.config.debug("*triggerWorker*");const r=this.workerByIdMap.get(e);r?this.executeWorkerRequest(r,!0):this.config.debug("*triggerWorker* worker not found",e)}triggerAllWorkers(){this.config.debug("*triggerAllWorkers*");for(const e of this.workerByIdMap.values())this.executeWorkerRequest(e)}enableWorkers(e){this.config.debug("*enable*",e),this.enabledGroups.add(e),this.groups.has(e)&&this.timer==null&&this.startTimer()}disableWorkers(e){this.config.debug("*disable*",e),this.enabledGroups.delete(e),this.enabledGroups.size<1&&this.stopTimer()}destroy(){this.config.debug("*destroy*"),this.groups.clear(),this.stopTimer()}}function q(i){return new f(i)}exports.HangfirePoller=f;exports.default=q;
@@ -1,17 +1,17 @@
1
- var f = Object.defineProperty;
2
- var p = (i, e, r) => e in i ? f(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
- var o = (i, e, r) => (p(i, typeof e != "symbol" ? e + "" : e, r), r);
1
+ var p = Object.defineProperty;
2
+ var f = (i, e, t) => e in i ? p(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var o = (i, e, t) => (f(i, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import m from "axios";
5
- import { ErrorCode as a } from "@ancon/wildcat-types";
6
- import h from "../error/createCodedError.mjs";
5
+ import { ErrorCode as u } from "@ancon/wildcat-types";
6
+ import c from "../error/createCodedError.mjs";
7
7
  import b from "../error/isNotFoundError.mjs";
8
- import k from "../error/serializeError.mjs";
9
- import W from "../error/isErrorWithStatusCode.mjs";
10
- import x from "../api/isNoContentResponse.mjs";
11
- import w from "../shared/wait.mjs";
8
+ import W from "../error/serializeError.mjs";
9
+ import x from "../error/isErrorWithStatusCode.mjs";
10
+ import k from "../api/isNoContentResponse.mjs";
11
+ import y from "../shared/wait.mjs";
12
12
  import "../error/isCodedError.mjs";
13
13
  import "../error/isAPIError.mjs";
14
- class y {
14
+ class I {
15
15
  constructor(e) {
16
16
  /** Workers currently executing a request */
17
17
  o(this, "busyWorkers", /* @__PURE__ */ new Set());
@@ -52,9 +52,9 @@ class y {
52
52
  }
53
53
  startTimer() {
54
54
  if (this.timer != null)
55
- throw h(
55
+ throw c(
56
56
  new Error("Timer already started"),
57
- a.GenericUnexpectedHangfireError
57
+ u.GenericUnexpectedHangfireError
58
58
  );
59
59
  this.config.debug("*start timer*"), this.timer = setInterval(() => {
60
60
  this.config.debug("*tick*", {
@@ -62,23 +62,23 @@ class y {
62
62
  enabledGroups: this.enabledGroups.size,
63
63
  groups: this.groups
64
64
  }), this.enabledGroups.forEach((e) => {
65
- const r = this.groups.get(e);
66
- r && r.forEach((t) => this.executeWorkerRequest(t));
65
+ const t = this.groups.get(e);
66
+ t && t.forEach((r) => this.executeWorkerRequest(r));
67
67
  }), this.groups.size < 1 && this.stopTimer();
68
68
  }, this.config.pollerInterval);
69
69
  }
70
70
  async waitForNetworkOnline(e = 5) {
71
- let r = 0;
72
- for (; !this.config.getIsNetworkOnline() && r < e + 1; )
73
- r += 1, await w(1e3);
71
+ let t = 0;
72
+ for (; !this.config.getIsNetworkOnline() && t < e + 1; )
73
+ t += 1, await y(1e3);
74
74
  }
75
- async executeWorkerRequest(e, r = !1) {
76
- const t = r !== !0 && this.busyWorkers.has(e.workerId);
75
+ async executeWorkerRequest(e, t = !1) {
76
+ const r = t !== !0 && this.busyWorkers.has(e.workerId);
77
77
  this.config.debug("*executeWorkerRequest*", {
78
78
  workerId: e.workerId,
79
- isBusy: t,
80
- force: r
81
- }), t ? this.config.debug(
79
+ isBusy: r,
80
+ force: t
81
+ }), r ? this.config.debug(
82
82
  "*executeWorkerRequest* worker is busy",
83
83
  e.workerId
84
84
  ) : (this.busyWorkers.add(e.workerId), await this.waitForNetworkOnline(), this.config.debug("*executeWorkerRequest* request", {
@@ -93,81 +93,82 @@ class y {
93
93
  }
94
94
  }).then((s) => {
95
95
  var n;
96
- s && !x(s) ? (e.resolve(s), (n = e.onResolved) == null || n.call(e, r), this.deleteWorker(e.groupId, e.workerId)) : this.busyWorkers.delete(e.workerId);
96
+ s && !k(s) ? (e.resolve(s), (n = e.onFinished) == null || n.call(e, t), this.deleteWorker(e.groupId, e.workerId)) : this.busyWorkers.delete(e.workerId);
97
97
  }).catch((s) => {
98
- if (W(s)) {
98
+ var n, a;
99
+ if (x(s)) {
99
100
  if (b(s)) {
100
101
  this.config.debug(
101
102
  "*executeWorkerRequest* worker is expired or invalid",
102
103
  e.workerId
103
104
  );
104
- const n = k(
105
- h(
105
+ const h = W(
106
+ c(
106
107
  new Error("The Hangfire worker is expired or invalid"),
107
- a.HangfireWorkerExpiredOrInvalid
108
+ u.HangfireWorkerExpiredOrInvalid
108
109
  )
109
110
  );
110
- e.reject(n);
111
+ e.reject(h), (n = e.onFinished) == null || n.call(e, t);
111
112
  } else
112
- e.reject(s);
113
+ e.reject(s), (a = e.onFinished) == null || a.call(e, t);
113
114
  this.deleteWorker(e.groupId, e.workerId);
114
115
  } else
115
116
  this.config.debug("*executeWorkerRequest* not an api error"), this.busyWorkers.delete(e.workerId);
116
117
  }));
117
118
  }
118
- deleteWorker(e, r) {
119
- const t = this.groups.get(e);
120
- t && (this.config.debug("*delete worker*", t.size, t), t.delete(r), this.workerByIdMap.delete(r), this.busyWorkers.delete(r), t.size < 1 && (this.groups.delete(e), this.enabledGroups.delete(e), this.enabledGroups.size < 1 && this.stopTimer()));
119
+ deleteWorker(e, t) {
120
+ const r = this.groups.get(e);
121
+ r && (this.config.debug("*delete worker*", r.size, r), r.delete(t), this.workerByIdMap.delete(t), this.busyWorkers.delete(t), r.size < 1 && (this.groups.delete(e), this.enabledGroups.delete(e), this.enabledGroups.size < 1 && this.stopTimer()));
121
122
  }
122
123
  createWorker(e, {
123
- workerId: r,
124
- url: t,
124
+ workerId: t,
125
+ url: r,
125
126
  headers: s,
126
- onResolved: n
127
+ onFinished: n
127
128
  }) {
128
129
  if (!this.groups.has(e)) {
129
130
  if (this.groups.size >= this.config.maxGroupsSize) {
130
- const c = h(
131
+ const h = c(
131
132
  new Error("Max number of Hangfire groups exceeded"),
132
- a.GenericUnexpectedHangfireError,
133
+ u.GenericUnexpectedHangfireError,
133
134
  { count: this.groups.size }
134
135
  );
135
- throw this.destroy(), c;
136
+ throw this.destroy(), h;
136
137
  }
137
138
  this.groups.set(e, /* @__PURE__ */ new Map());
138
139
  }
139
- const u = this.groups.get(e);
140
- return new Promise((c, l) => {
141
- if (u.has(r))
142
- throw h(
140
+ const a = this.groups.get(e);
141
+ return new Promise((h, l) => {
142
+ if (a.has(t))
143
+ throw c(
143
144
  new Error("Duplicate Hangfire worker ID"),
144
- a.GenericUnexpectedHangfireError
145
+ u.GenericUnexpectedHangfireError
145
146
  );
146
- if (u.size >= this.config.maxWorkersSize) {
147
- const d = h(
147
+ if (a.size >= this.config.maxWorkersSize) {
148
+ const d = c(
148
149
  new Error("Max number of Hangfire workers in group exceeded"),
149
- a.GenericUnexpectedHangfireError,
150
- { groupId: e, count: u.size }
150
+ u.GenericUnexpectedHangfireError,
151
+ { groupId: e, count: a.size }
151
152
  );
152
153
  throw l(d), this.destroy(), d;
153
154
  }
154
155
  const g = {
155
- workerId: r,
156
+ workerId: t,
156
157
  groupId: e,
157
- url: t,
158
- resolve: c,
158
+ url: r,
159
+ resolve: h,
159
160
  reject: l,
160
161
  headers: s,
161
- onResolved: n
162
+ onFinished: n
162
163
  };
163
- u.set(r, g), this.workerByIdMap.set(r, g), this.enabledGroups.has(e) || this.enabledGroups.add(e), this.timer == null && this.enabledGroups.size > 0 && this.startTimer();
164
+ a.set(t, g), this.workerByIdMap.set(t, g), this.enabledGroups.has(e) || this.enabledGroups.add(e), this.timer == null && this.enabledGroups.size > 0 && this.startTimer();
164
165
  });
165
166
  }
166
167
  /** Trigger a worker to execute immediately, ignoring busy state */
167
168
  triggerWorker(e) {
168
169
  this.config.debug("*triggerWorker*");
169
- const r = this.workerByIdMap.get(e);
170
- r ? this.executeWorkerRequest(r, !0) : this.config.debug("*triggerWorker* worker not found", e);
170
+ const t = this.workerByIdMap.get(e);
171
+ t ? this.executeWorkerRequest(t, !0) : this.config.debug("*triggerWorker* worker not found", e);
171
172
  }
172
173
  /** Trigger all workers to execute immediately */
173
174
  triggerAllWorkers() {
@@ -187,9 +188,9 @@ class y {
187
188
  }
188
189
  }
189
190
  function O(i) {
190
- return new y(i);
191
+ return new I(i);
191
192
  }
192
193
  export {
193
- y as HangfirePoller,
194
+ I as HangfirePoller,
194
195
  O as default
195
196
  };
@@ -1,17 +1,14 @@
1
1
  import type { APIHeaders, APIParams, APIPostRequest, APIPutRequest } from '@ancon/wildcat-types';
2
2
  import type { AxiosResponse } from 'axios';
3
3
  import { HangfirePoller } from './createHangfirePoller';
4
- declare type MakeHangfireRequestWorkerOptions = {
4
+ declare type MakeHangfireRequestOptions = {
5
5
  headers?: APIHeaders;
6
+ /** Optional callback on successful init response */
7
+ onInitResponse?: () => void | Promise<void>;
6
8
  /**
7
9
  * @param forced Forced indicates it was triggered by an event rather than via polling
8
10
  */
9
- onWorkerResolved?: (forced: boolean) => void | Promise<void>;
10
- };
11
- declare type MakeHangfireRequestOptions = {
12
- /** Optional callback on successful init response */
13
- onInitResponse?: () => void | Promise<void>;
14
- workerOptions?: MakeHangfireRequestWorkerOptions;
11
+ onWorkerFinished: (forced: boolean) => void | Promise<void>;
15
12
  };
16
13
  /**
17
14
  *
@@ -1 +1 @@
1
- "use strict";const h=require("./isHangfireResponse.js");require("../api/isAcceptedResponse.js");function q(r,u){return`${r.config.baseURL??""}/${r.config.url??""}/status/${u}`}function t(r){return async function(R,n,w,l,e){var c,f,k,d;const a=await R(n,w,(c=e==null?void 0:e.workerOptions)==null?void 0:c.headers);if(await((f=e==null?void 0:e.onInitResponse)==null?void 0:f.call(e)),h(a)){const g=a.data.id;return r.createWorker(l,{workerId:g,url:q(a,g),headers:(k=e==null?void 0:e.workerOptions)==null?void 0:k.headers,onResolved:(d=e==null?void 0:e.workerOptions)==null?void 0:d.onWorkerResolved})}return a}}module.exports=t;
1
+ "use strict";const n=require("./isHangfireResponse.js");require("../api/isAcceptedResponse.js");function R(r,u){return`${r.config.baseURL??""}/${r.config.url??""}/status/${u}`}function q(r){return async function(d,g,h,k,e){var c;const a=await d(g,h,e==null?void 0:e.headers);if(await((c=e==null?void 0:e.onInitResponse)==null?void 0:c.call(e)),n(a)){const f=a.data.id;return r.createWorker(k,{workerId:f,url:R(a,f),headers:e==null?void 0:e.headers,onFinished:e==null?void 0:e.onWorkerFinished})}return a}}module.exports=q;
@@ -1,24 +1,24 @@
1
- import n from "./isHangfireResponse.mjs";
1
+ import R from "./isHangfireResponse.mjs";
2
2
  import "../api/isAcceptedResponse.mjs";
3
- function t(r, u) {
3
+ function l(r, u) {
4
4
  return `${r.config.baseURL ?? ""}/${r.config.url ?? ""}/status/${u}`;
5
5
  }
6
- function O(r) {
7
- return async function(g, l, w, m, e) {
8
- var f, c, d, k;
9
- const a = await g(l, w, (f = e == null ? void 0 : e.workerOptions) == null ? void 0 : f.headers);
10
- if (await ((c = e == null ? void 0 : e.onInitResponse) == null ? void 0 : c.call(e)), n(a)) {
11
- const R = a.data.id;
12
- return r.createWorker(m, {
13
- workerId: R,
14
- url: t(a, R),
15
- headers: (d = e == null ? void 0 : e.workerOptions) == null ? void 0 : d.headers,
16
- onResolved: (k = e == null ? void 0 : e.workerOptions) == null ? void 0 : k.onWorkerResolved
6
+ function w(r) {
7
+ return async function(d, g, k, h, e) {
8
+ var f;
9
+ const a = await d(g, k, e == null ? void 0 : e.headers);
10
+ if (await ((f = e == null ? void 0 : e.onInitResponse) == null ? void 0 : f.call(e)), R(a)) {
11
+ const c = a.data.id;
12
+ return r.createWorker(h, {
13
+ workerId: c,
14
+ url: l(a, c),
15
+ headers: e == null ? void 0 : e.headers,
16
+ onFinished: e == null ? void 0 : e.onWorkerFinished
17
17
  });
18
18
  }
19
19
  return a;
20
20
  };
21
21
  }
22
22
  export {
23
- O as default
23
+ w as default
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.44.0-terminal-refactor.6",
3
+ "version": "1.44.0-terminal-refactor.7",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",