bt-core-app 2.2.27 → 2.2.29

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.
@@ -33,7 +33,9 @@ export interface UseCronOptions {
33
33
  }
34
34
  export interface PredictOptions {
35
35
  adjustments?: string;
36
- futureCount: number;
36
+ futureCount?: number;
37
+ fromDate?: string;
38
+ toDate?: string;
37
39
  cron?: string;
38
40
  }
39
41
  export interface StringCron {
@@ -1,8 +1,9 @@
1
1
  import { useAuth as G } from "./auth.mjs";
2
- import { appendUrl as M, isNullOrEmpty as K, isLengthyArray as L } from "./helpers.mjs";
3
- import { ref as d, computed as $ } from "vue";
2
+ import { appendUrl as o, isNullOrEmpty as K, isLengthyArray as L } from "./helpers.mjs";
3
+ import { ref as p, computed as I } from "vue";
4
4
  import "../bt-core/core/node_modules/@datasert/cronjs-matcher/dist/index.mjs";
5
- import { __exports as Q } from "../_virtual/index.mjs";
5
+ import { useDates as Q } from "./dates.mjs";
6
+ import { __exports as V } from "../_virtual/index.mjs";
6
7
  const w = [
7
8
  { text: "12:00 AM", value: "0.0" },
8
9
  { text: "12:15 AM", value: "0.15" },
@@ -119,7 +120,7 @@ const w = [
119
120
  { text: "3rd", value: "15-21" },
120
121
  { text: "4th", value: "22-28" },
121
122
  { text: "5th", value: "29-31" }
122
- ], D = [
123
+ ], S = [
123
124
  { text: "Sun", value: "0" },
124
125
  { text: "Mon", value: "1" },
125
126
  { text: "Tue", value: "2" },
@@ -159,70 +160,74 @@ const w = [
159
160
  { text: "29th", value: "29" },
160
161
  { text: "30th", value: "30" },
161
162
  { text: "31th", value: "31" }
162
- ], ue = [
163
+ ], ve = [
163
164
  { text: "Daily", value: "Daily" },
164
165
  { text: "Weekly", value: "Weekly" },
165
166
  { text: "Monthly", value: "Monthly" },
166
167
  { text: "Yearly", value: "Yearly" },
167
168
  { text: "Custom", value: "Custom" }
168
169
  ];
169
- function ae() {
170
- const { timeZone: v } = G();
171
- function S(r) {
172
- if (r.cron == null)
170
+ function re() {
171
+ const { timeZone: v } = G(), { utcString: C } = Q();
172
+ function M(d) {
173
+ if (d.cron == null)
173
174
  return [];
174
- const k = r.cron.split(/\s+/).slice(0, 5).join(" ");
175
- return Q.getFutureMatches(k, { matchCount: r.futureCount, formatInTimezone: !1, timezone: v.value });
175
+ const T = d.cron.split(/\s+/).slice(0, 5).join(" ");
176
+ var c = {
177
+ formatInTimezone: !1,
178
+ timezone: v.value
179
+ };
180
+ return d.futureCount != null && (c.matchCount = d.futureCount), d.toDate != null && (c.endAt = d.toDate, c.startAt = d.fromDate ?? C()), V.getFutureMatches(T, c);
176
181
  }
177
182
  return {
178
- predictFuture: S
183
+ predictFuture: M
179
184
  };
180
185
  }
181
- function ve(v) {
186
+ function se(v) {
182
187
  if (v == null)
183
188
  return 0;
184
- const S = v.split(/\s+/);
185
- return S.length > 5 ? Number.parseInt(S[5].split("-")[0]) : 0;
189
+ const C = v.split(/\s+/);
190
+ return C.length > 5 ? Number.parseInt(C[5].split("-")[0]) : 0;
186
191
  }
187
- function se(v) {
188
- function S() {
192
+ function xe(v) {
193
+ function C() {
189
194
  let e = "0 0 * * 1";
190
- return v.useLeadTimeLeft && (v.useLeadTimeRight ? e = M(e, `${E.value.toString()}-${Y.value.toString()}`, " ") : e = M(e, E.value.toString(), " ")), e;
195
+ return v.useLeadTimeLeft && (v.useLeadTimeRight ? e = o(e, `${E.value.toString()}-${Y.value.toString()}`, " ") : e = o(e, E.value.toString(), " ")), e;
191
196
  }
192
- const r = d();
193
- let k = "";
194
- const b = $({
197
+ const M = p();
198
+ let d = "";
199
+ const T = I({
195
200
  get() {
196
- return r.value;
201
+ return M.value;
197
202
  },
198
203
  set(e) {
199
- k = e;
204
+ d = e;
200
205
  }
201
- }), P = d(0), T = d(0), A = d("Custom"), m = $({
206
+ }), c = p(0), $ = p(0), P = p("Custom"), y = I({
202
207
  get() {
203
- return A.value;
208
+ return P.value;
204
209
  },
205
210
  set(e) {
206
- A.value !== e && (A.value = e, O(e));
211
+ P.value !== e && (P.value = e, O(e));
207
212
  }
208
- }), F = $(() => v.useLeadTimeInHours ? P.value : P.value / 60), E = $(() => v.useLeadTimeInHours ? P.value * 60 : P.value), Y = $(() => v.useLeadTimeInHours ? T.value * 60 : T.value), y = d(), c = d(), p = d(), h = d(), C = d();
213
+ }), F = I(() => v.useLeadTimeInHours ? c.value : c.value / 60), E = I(() => v.useLeadTimeInHours ? c.value * 60 : c.value), Y = I(() => v.useLeadTimeInHours ? $.value * 60 : $.value), A = p(), h = p(), g = p(), m = p(), k = p();
209
214
  function J() {
210
- I(k ?? b.value);
215
+ N(d ?? T.value);
211
216
  }
212
217
  function O(e) {
213
- e == "Daily" ? (c.value = ["*"], p.value = ["*"], h.value = ["*"]) : e == "Weekly" ? (c.value = ["*"], p.value = ["*"], h.value = ["0"]) : e == "Monthly" ? (c.value = ["*"], p.value = [U[0].value], h.value = [D[0].value]) : e == "Yearly" && (c.value = ["1"], C.value = [Z[0].value], h.value = ["*"]);
218
+ e == "Daily" ? (h.value = ["*"], g.value = ["*"], m.value = ["*"]) : e == "Weekly" ? (h.value = ["*"], g.value = ["*"], m.value = ["0"]) : e == "Monthly" ? (h.value = ["*"], g.value = [U[0].value], m.value = [S[0].value]) : e == "Yearly" && (h.value = ["1"], k.value = [Z[0].value], m.value = ["*"]);
214
219
  }
215
220
  function q(e, l) {
216
- var i, s;
221
+ var x, r;
217
222
  e ?? (e = "0");
218
- const u = D.findIndex((n) => n.value == e || n.text == e);
223
+ const u = S.findIndex((n) => n.value == e || n.text == e);
219
224
  l ?? (l = 0);
220
- const a = (u + l) % 7, x = Math.ceil(l / 7);
221
- return x > 1 ? `${x} ${(i = D[a]) == null ? void 0 : i.text} Later` : (s = D[a]) == null ? void 0 : s.text;
225
+ const a = (u + l) % 7, s = Math.ceil(l / 7);
226
+ return s > 1 ? `${s} ${(x = S[a]) == null ? void 0 : x.text} Later` : (r = S[a]) == null ? void 0 : r.text;
222
227
  }
223
228
  function z(e) {
224
- if (y.value != null) {
225
- var l = w.find((x) => x.value == y.value);
229
+ if (A.value != null) {
230
+ var l = w.find((s) => s.value == A.value);
226
231
  if (l != null) {
227
232
  var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
228
233
  return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : q(e, a);
@@ -230,142 +235,142 @@ function se(v) {
230
235
  }
231
236
  }
232
237
  function B() {
233
- var x, i;
238
+ var s, x;
234
239
  var e = {
235
- regularity: m.value,
240
+ regularity: y.value,
236
241
  orderDays: [],
237
242
  deliveryDays: []
238
243
  };
239
- if (m.value == "Daily") {
240
- if (y.value != null) {
241
- var l = w.find((s) => s.value == y.value);
244
+ if (y.value == "Daily") {
245
+ if (A.value != null) {
246
+ var l = w.find((r) => r.value == A.value);
242
247
  if (l != null) {
243
- m.value == "Daily" && e.orderDays.push(l.text);
248
+ y.value == "Daily" && e.orderDays.push(l.text);
244
249
  var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
245
250
  a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
246
251
  }
247
252
  }
248
253
  } else
249
- m.value == "Weekly" ? (x = h.value) == null || x.forEach((s) => {
250
- var n = D.find((o) => o.value == s);
251
- n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(s) ?? ""));
252
- }) : m.value == "Monthly" && ((i = c.value) == null || i.forEach((s) => {
253
- var n = j.find((o) => o.value == s);
254
+ y.value == "Weekly" ? (s = m.value) == null || s.forEach((r) => {
255
+ var n = S.find((i) => i.value == r);
256
+ n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(r) ?? ""));
257
+ }) : y.value == "Monthly" && ((x = h.value) == null || x.forEach((r) => {
258
+ var n = j.find((i) => i.value == r);
254
259
  n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(void 0) ?? ""));
255
260
  }));
256
261
  return e;
257
262
  }
258
263
  function H() {
259
264
  var e;
260
- return (e = r.value) == null ? void 0 : e.split(/\s+/);
265
+ return (e = M.value) == null ? void 0 : e.split(/\s+/);
261
266
  }
262
- function I(e) {
263
- if (r.value != e) {
264
- r.value = e;
265
- let u = !1, a = !1, x = !1, i = !1, s = !1, n = !1;
266
- if (K(r.value) || !L(H(), 4))
267
+ function N(e) {
268
+ if (M.value != e) {
269
+ M.value = e;
270
+ let u = !1, a = !1, s = !1, x = !1, r = !1, n = !1;
271
+ if (K(M.value) || !L(H(), 4))
267
272
  u = !0;
268
273
  else {
269
- const o = H();
270
- var l = `${o[1]}.${o[0]}`;
271
- l.includes(",") || l.includes("-") || l.includes("/") ? u = !0 : w.some((t) => t.value == l) ? y.value = l : u = !0;
272
- const N = o[2];
273
- if (N.includes("/"))
274
+ const i = H();
275
+ var l = `${i[1]}.${i[0]}`;
276
+ l.includes(",") || l.includes("-") || l.includes("/") ? u = !0 : w.some((t) => t.value == l) ? A.value = l : u = !0;
277
+ const R = i[2];
278
+ if (R.includes("/"))
274
279
  u = !0;
275
- else if (N == "*")
280
+ else if (R == "*")
276
281
  a = !0;
277
282
  else {
278
283
  a = !1;
279
- const t = N.split(",");
280
- t.some((f) => !U.some((g) => g.value == f)) ? n = !0 : p.value = t;
281
- }
282
- const R = o[3];
283
- if (R.includes("-") || R.includes("/"))
284
- u = !0;
285
- else if (R == "*")
286
- i = !0;
287
- else {
288
- i = !1, s = !0;
289
284
  const t = R.split(",");
290
- t.some((f) => !j.some((g) => g.value == f)) ? u = !0 : c.value = t;
291
- }
292
- if (s && n) {
293
- const t = N.split(",");
294
- t.some((f) => !Z.some((g) => g.value == f)) ? u = !0 : C.value = t;
285
+ t.some((f) => !U.some((D) => D.value == f)) ? n = !0 : g.value = t;
295
286
  }
296
- const W = o[4];
287
+ const W = i[3];
297
288
  if (W.includes("-") || W.includes("/"))
298
289
  u = !0;
299
290
  else if (W == "*")
300
- x = !0, h.value = D.map((t) => t.value);
291
+ x = !0;
301
292
  else {
302
- x = !1;
293
+ x = !1, r = !0;
303
294
  const t = W.split(",");
304
- t.some((f) => !D.some((g) => g.value == f)) ? u = !0 : h.value = t;
295
+ t.some((f) => !j.some((D) => D.value == f)) ? u = !0 : h.value = t;
296
+ }
297
+ if (r && n) {
298
+ const t = R.split(",");
299
+ t.some((f) => !Z.some((D) => D.value == f)) ? u = !0 : k.value = t;
300
+ }
301
+ const b = i[4];
302
+ if (b.includes("-") || b.includes("/"))
303
+ u = !0;
304
+ else if (b == "*")
305
+ s = !0, m.value = S.map((t) => t.value);
306
+ else {
307
+ s = !1;
308
+ const t = b.split(",");
309
+ t.some((f) => !S.some((D) => D.value == f)) ? u = !0 : m.value = t;
305
310
  }
306
- if (L(o, 5) && v.useLeadTimeLeft) {
307
- const t = o[5].split("-");
311
+ if (L(i, 5) && v.useLeadTimeLeft) {
312
+ const t = i[5].split("-");
308
313
  if (v.useLeadTimeRight && t.length > 1) {
309
314
  const f = Number.parseInt(t[1]);
310
- T.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
315
+ $.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
311
316
  }
312
317
  if (t.length > 0) {
313
318
  const f = Number.parseInt(t[0]);
314
- P.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
319
+ c.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
315
320
  }
316
321
  }
317
322
  }
318
- u ? m.value = "Custom" : s ? A.value = "Yearly" : i && a && x ? A.value = "Daily" : i && a ? A.value = "Weekly" : i ? A.value = "Monthly" : A.value = "Custom";
323
+ u ? y.value = "Custom" : r ? P.value = "Yearly" : x && a && s ? P.value = "Daily" : x && a ? P.value = "Weekly" : x ? P.value = "Monthly" : P.value = "Custom";
319
324
  }
320
325
  return {
321
326
  applyRawExpression: J,
322
327
  applyRegularity: O,
323
- cronExpression: r,
324
- hour: y,
325
- leadTimeLeft: P,
326
- leadTimeRight: T,
327
- months: c,
328
+ cronExpression: M,
329
+ hour: A,
330
+ leadTimeLeft: c,
331
+ leadTimeRight: $,
332
+ months: h,
328
333
  pack: _,
329
- rawExpression: b,
330
- regularity: m,
331
- unpack: I,
332
- weekdays: h,
333
- weeks: p
334
+ rawExpression: T,
335
+ regularity: y,
336
+ unpack: N,
337
+ weekdays: m,
338
+ weeks: g
334
339
  };
335
340
  }
336
341
  function _() {
337
- var l, u, a, x, i, s, n, o;
338
- if (m.value == "Custom")
339
- return r.value;
340
- let e = `${(l = y.value) == null ? void 0 : l.split(".")[1]} ${(u = y.value) == null ? void 0 : u.split(".")[0]}`;
341
- return m.value == "Yearly" ? (L(C.value) ? e = M(e, (a = C.value) == null ? void 0 : a.toString(), " ") : e = M(e, "*", " "), L(c.value) ? e = M(e, (x = c.value) == null ? void 0 : x.toString(), " ") : e = M(e, "*", " "), e = M(e, "*", " ")) : (L(p.value) ? e = M(e, (i = p.value) == null ? void 0 : i.toString(), " ") : e = M(e, "*", " "), L(c.value) ? e = M(e, (s = c.value) == null ? void 0 : s.toString(), " ") : e = M(e, "*", " "), ((n = h.value) == null ? void 0 : n.length) == 7 ? e = M(e, "*", " ") : e = M(e, (o = h.value) == null ? void 0 : o.toString(), " ")), e = M(e, `${E.value}-${Y.value}`, " "), r.value = e, r.value;
342
+ var l, u, a, s, x, r, n, i;
343
+ if (y.value == "Custom")
344
+ return M.value;
345
+ let e = `${(l = A.value) == null ? void 0 : l.split(".")[1]} ${(u = A.value) == null ? void 0 : u.split(".")[0]}`;
346
+ return y.value == "Yearly" ? (L(k.value) ? e = o(e, (a = k.value) == null ? void 0 : a.toString(), " ") : e = o(e, "*", " "), L(h.value) ? e = o(e, (s = h.value) == null ? void 0 : s.toString(), " ") : e = o(e, "*", " "), e = o(e, "*", " ")) : (L(g.value) ? e = o(e, (x = g.value) == null ? void 0 : x.toString(), " ") : e = o(e, "*", " "), L(h.value) ? e = o(e, (r = h.value) == null ? void 0 : r.toString(), " ") : e = o(e, "*", " "), ((n = m.value) == null ? void 0 : n.length) == 7 ? e = o(e, "*", " ") : e = o(e, (i = m.value) == null ? void 0 : i.toString(), " ")), e = o(e, `${E.value}-${Y.value}`, " "), M.value = e, M.value;
342
347
  }
343
- return I(v.value ?? v.defaultExpression ?? S()), {
348
+ return N(v.value ?? v.defaultExpression ?? C()), {
344
349
  applyRawExpression: J,
345
350
  applyRegularity: O,
346
- cronExpression: r,
351
+ cronExpression: M,
347
352
  getRegularityAndOrderAndDeliveryDays: B,
348
- hour: y,
349
- leadTimeLeft: P,
350
- leadTimeRight: T,
351
- months: c,
352
- monthdays: C,
353
+ hour: A,
354
+ leadTimeLeft: c,
355
+ leadTimeRight: $,
356
+ months: h,
357
+ monthdays: k,
353
358
  pack: _,
354
- rawExpression: b,
355
- regularity: m,
356
- unpack: I,
357
- weekdays: h,
358
- weeks: p
359
+ rawExpression: T,
360
+ regularity: y,
361
+ unpack: N,
362
+ weekdays: m,
363
+ weeks: g
359
364
  };
360
365
  }
361
366
  export {
362
- ve as getLeadTime,
367
+ se as getLeadTime,
363
368
  w as hourOptions,
364
369
  j as monthOptions,
365
370
  Z as monthdayOptions,
366
- ue as regularityOptions,
367
- se as useCron,
368
- ae as useCronPredictor,
371
+ ve as regularityOptions,
372
+ xe as useCron,
373
+ re as useCronPredictor,
369
374
  U as weekOptions,
370
- D as weekdayOptions
375
+ S as weekdayOptions
371
376
  };
@@ -2,7 +2,7 @@ import { Ref, ComputedRef } from 'vue';
2
2
 
3
3
  export interface MenuGroup {
4
4
  displayName: string;
5
- hide: boolean;
5
+ hide?: boolean;
6
6
  icon?: string;
7
7
  id?: string;
8
8
  isGroup?: boolean;
@@ -32,7 +32,6 @@ function k() {
32
32
  return {
33
33
  ...m,
34
34
  hideItem: F,
35
- // hiding: settings.value.hide,
36
35
  isHiding: y,
37
36
  showItem: G,
38
37
  sidebarNavItems: I(() => {