bt-core-app 2.2.19 → 2.2.21

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.
@@ -14,7 +14,11 @@ export declare const weekdayOptions: {
14
14
  text: string;
15
15
  value: string;
16
16
  }[];
17
- export type CronRegularity = 'Daily' | 'Weekly' | 'Monthly' | 'Custom';
17
+ export declare const monthdayOptions: {
18
+ text: string;
19
+ value: string;
20
+ }[];
21
+ export type CronRegularity = 'Daily' | 'Weekly' | 'Monthly' | 'Yearly' | 'Custom';
18
22
  export declare const regularityOptions: {
19
23
  text: string;
20
24
  value: string;
@@ -40,6 +44,7 @@ export interface StringCron {
40
44
  export declare function useCronPredictor(): {
41
45
  predictFuture: (options: PredictOptions) => string[];
42
46
  };
47
+ export declare function getLeadTime(cronExp?: string): number;
43
48
  export declare function useCron(options: UseCronOptions): {
44
49
  applyRawExpression: () => void;
45
50
  applyRegularity: (v: any) => void;
@@ -49,6 +54,7 @@ export declare function useCron(options: UseCronOptions): {
49
54
  leadTimeLeft: import('vue').Ref<number, number>;
50
55
  leadTimeRight: import('vue').Ref<number, number>;
51
56
  months: import('vue').Ref<string[] | undefined, string[] | undefined>;
57
+ monthdays: import('vue').Ref<string[] | undefined, string[] | undefined>;
52
58
  pack: () => string | undefined;
53
59
  rawExpression: import('vue').WritableComputedRef<string | undefined, string | undefined>;
54
60
  regularity: import('vue').WritableComputedRef<CronRegularity, CronRegularity>;
@@ -1,8 +1,8 @@
1
- import { useAuth as Z } from "./auth.mjs";
2
- import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as C } from "./helpers.mjs";
3
- import { ref as P, computed as k } from "vue";
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";
4
4
  import "../bt-core/core/node_modules/@datasert/cronjs-matcher/dist/index.mjs";
5
- import { __exports as B } from "../_virtual/index.mjs";
5
+ import { __exports as Q } from "../_virtual/index.mjs";
6
6
  const w = [
7
7
  { text: "12:00 AM", value: "0.0" },
8
8
  { text: "12:15 AM", value: "0.15" },
@@ -100,7 +100,7 @@ const w = [
100
100
  { text: "11:15 PM", value: "23.15" },
101
101
  { text: "11:30 PM", value: "23.30" },
102
102
  { text: "11:45 PM", value: "23.45" }
103
- ], H = [
103
+ ], j = [
104
104
  { text: "Jan", value: "1" },
105
105
  { text: "Feb", value: "2" },
106
106
  { text: "Mar", value: "3" },
@@ -113,13 +113,13 @@ const w = [
113
113
  { text: "Oct", value: "10" },
114
114
  { text: "Nov", value: "11" },
115
115
  { text: "Dec", value: "12" }
116
- ], _ = [
116
+ ], U = [
117
117
  { text: "1st", value: "1-7" },
118
118
  { text: "2nd", value: "8-14" },
119
119
  { text: "3rd", value: "15-21" },
120
120
  { text: "4th", value: "22-28" },
121
121
  { text: "5th", value: "29-31" }
122
- ], g = [
122
+ ], D = [
123
123
  { text: "Sun", value: "0" },
124
124
  { text: "Mon", value: "1" },
125
125
  { text: "Tue", value: "2" },
@@ -127,200 +127,245 @@ const w = [
127
127
  { text: "Thu", value: "4" },
128
128
  { text: "Fri", value: "5" },
129
129
  { text: "Sat", value: "6" }
130
- ], Y = [
130
+ ], Z = [
131
+ { text: "1st", value: "1" },
132
+ { text: "2nd", value: "2" },
133
+ { text: "3rd", value: "3" },
134
+ { text: "4th", value: "4" },
135
+ { text: "5th", value: "5" },
136
+ { text: "6th", value: "6" },
137
+ { text: "7th", value: "7" },
138
+ { text: "8th", value: "8" },
139
+ { text: "9th", value: "9" },
140
+ { text: "10th", value: "10" },
141
+ { text: "11th", value: "11" },
142
+ { text: "12th", value: "12" },
143
+ { text: "13th", value: "13" },
144
+ { text: "14th", value: "14" },
145
+ { text: "15th", value: "15" },
146
+ { text: "16th", value: "16" },
147
+ { text: "17th", value: "17" },
148
+ { text: "18th", value: "18" },
149
+ { text: "19th", value: "19" },
150
+ { text: "20th", value: "20" },
151
+ { text: "21th", value: "21" },
152
+ { text: "22th", value: "22" },
153
+ { text: "23th", value: "23" },
154
+ { text: "24th", value: "24" },
155
+ { text: "25th", value: "25" },
156
+ { text: "26th", value: "26" },
157
+ { text: "27th", value: "27" },
158
+ { text: "28th", value: "28" },
159
+ { text: "29th", value: "29" },
160
+ { text: "30th", value: "30" },
161
+ { text: "31th", value: "31" }
162
+ ], ue = [
131
163
  { text: "Daily", value: "Daily" },
132
164
  { text: "Weekly", value: "Weekly" },
133
165
  { text: "Monthly", value: "Monthly" },
166
+ { text: "Yearly", value: "Yearly" },
134
167
  { text: "Custom", value: "Custom" }
135
168
  ];
136
- function ee() {
137
- const { timeZone: i } = Z();
138
- function I(s) {
139
- if (s.cron == null)
169
+ function ae() {
170
+ const { timeZone: v } = G();
171
+ function S(r) {
172
+ if (r.cron == null)
140
173
  return [];
141
- const L = s.cron.split(/\s+/).slice(0, 5).join(" ");
142
- return B.getFutureMatches(L, { matchCount: s.futureCount, formatInTimezone: !1, timezone: i.value });
174
+ const k = r.cron.split(/\s+/).slice(0, 5).join(" ");
175
+ return Q.getFutureMatches(k, { matchCount: r.futureCount, formatInTimezone: !1, timezone: v.value });
143
176
  }
144
177
  return {
145
- predictFuture: I
178
+ predictFuture: S
146
179
  };
147
180
  }
148
- function te(i) {
149
- function I() {
181
+ function ve(v) {
182
+ if (v == null)
183
+ return 0;
184
+ const S = v.split(/\s+/);
185
+ return S.length > 5 ? Number.parseInt(S[5].split("-")[0]) : 0;
186
+ }
187
+ function se(v) {
188
+ function S() {
150
189
  let e = "0 0 * * 1";
151
- return i.useLeadTimeLeft && (i.useLeadTimeRight ? e = A(e, `${R.value.toString()}-${O.value.toString()}`, " ") : e = A(e, R.value.toString(), " ")), e;
190
+ return v.useLeadTimeLeft && (v.useLeadTimeRight ? e = M(e, `${E.value.toString()}-${Y.value.toString()}`, " ") : e = M(e, E.value.toString(), " ")), e;
152
191
  }
153
- const s = P();
154
- let L = "";
155
- const E = k({
192
+ const r = d();
193
+ let k = "";
194
+ const b = $({
156
195
  get() {
157
- return s.value;
196
+ return r.value;
158
197
  },
159
198
  set(e) {
160
- L = e;
199
+ k = e;
161
200
  }
162
- }), p = P(0), D = P(0), h = P("Custom"), f = k({
201
+ }), P = d(0), T = d(0), A = d("Custom"), m = $({
163
202
  get() {
164
- return h.value;
203
+ return A.value;
165
204
  },
166
205
  set(e) {
167
- h.value !== e && (h.value = e, W(e));
206
+ A.value !== e && (A.value = e, O(e));
168
207
  }
169
- }), N = k(() => i.useLeadTimeInHours ? p.value : p.value / 60), R = k(() => i.useLeadTimeInHours ? p.value * 60 : p.value), O = k(() => i.useLeadTimeInHours ? D.value * 60 : D.value), c = P(), m = P(), d = P(), M = P();
170
- function b() {
171
- T(L ?? E.value);
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();
209
+ function J() {
210
+ I(k ?? b.value);
172
211
  }
173
- function W(e) {
174
- e == "Daily" ? (m.value = ["*"], d.value = ["*"], M.value = ["*"]) : e == "Weekly" ? (console.log("weeklying"), m.value = ["*"], d.value = ["*"], M.value = ["0"]) : e == "Monthly" && (m.value = ["*"], d.value = [_[0].value], M.value = [g[0].value]);
212
+ 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 = ["*"]);
175
214
  }
176
- function j(e, u) {
177
- var n, l;
215
+ function q(e, l) {
216
+ var i, s;
178
217
  e ?? (e = "0");
179
- const t = g.findIndex((x) => x.value == e || x.text == e);
180
- u ?? (u = 0);
181
- const a = (t + u) % 7, r = Math.ceil(u / 7);
182
- return r > 1 ? `${r} ${(n = g[a]) == null ? void 0 : n.text} Later` : (l = g[a]) == null ? void 0 : l.text;
218
+ const u = D.findIndex((n) => n.value == e || n.text == e);
219
+ 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;
183
222
  }
184
- function F(e) {
185
- if (c.value != null) {
186
- var u = w.find((r) => r.value == c.value);
187
- if (u != null) {
188
- var t = Number.parseFloat(u.value) + N.value, a = Math.floor(t / 24);
189
- return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : j(e, a);
223
+ function z(e) {
224
+ if (y.value != null) {
225
+ var l = w.find((x) => x.value == y.value);
226
+ if (l != null) {
227
+ var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
228
+ return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : q(e, a);
190
229
  }
191
230
  }
192
231
  }
193
- function U() {
194
- var r, n;
232
+ function B() {
233
+ var x, i;
195
234
  var e = {
196
- regularity: f.value,
235
+ regularity: m.value,
197
236
  orderDays: [],
198
237
  deliveryDays: []
199
238
  };
200
- if (f.value == "Daily") {
201
- if (c.value != null) {
202
- var u = w.find((l) => l.value == c.value);
203
- if (u != null) {
204
- f.value == "Daily" && e.orderDays.push(u.text);
205
- var t = Number.parseFloat(u.value) + N.value, a = Math.floor(t / 24);
239
+ if (m.value == "Daily") {
240
+ if (y.value != null) {
241
+ var l = w.find((s) => s.value == y.value);
242
+ if (l != null) {
243
+ m.value == "Daily" && e.orderDays.push(l.text);
244
+ var u = Number.parseFloat(l.value) + F.value, a = Math.floor(u / 24);
206
245
  a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
207
246
  }
208
247
  }
209
248
  } else
210
- f.value == "Weekly" ? (r = M.value) == null || r.forEach((l) => {
211
- var x = g.find((y) => y.value == l);
212
- x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(l) ?? ""));
213
- }) : f.value == "Monthly" && ((n = m.value) == null || n.forEach((l) => {
214
- var x = H.find((y) => y.value == l);
215
- x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(void 0) ?? ""));
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
+ n != null && (e.orderDays.push(n.text), e.deliveryDays.push(z(void 0) ?? ""));
216
255
  }));
217
256
  return e;
218
257
  }
219
- function J() {
258
+ function H() {
220
259
  var e;
221
- return (e = s.value) == null ? void 0 : e.split(/\s+/);
260
+ return (e = r.value) == null ? void 0 : e.split(/\s+/);
222
261
  }
223
- function T(e) {
224
- if (s.value != e) {
225
- s.value = e;
226
- let t = !1, a = !1, r = !1, n = !1;
227
- if (q(s.value) || !C(J(), 4))
228
- t = !0;
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
+ u = !0;
229
268
  else {
230
- const l = J();
231
- t = !1;
232
- var u = `${l[1]}.${l[0]}`;
233
- u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 : w.some((v) => v.value == u) ? c.value = u : t = !0;
234
- const x = l[2];
235
- if (x.includes("/"))
236
- t = !0;
237
- else if (x == "*")
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
+ u = !0;
275
+ else if (N == "*")
238
276
  a = !0;
239
277
  else {
240
278
  a = !1;
241
- const v = x.split(",");
242
- v.some((o) => !_.some((S) => S.value == o)) ? t = !0 : d.value = v;
279
+ const t = N.split(",");
280
+ t.some((f) => !U.some((g) => g.value == f)) ? n = !0 : p.value = t;
243
281
  }
244
- const y = l[3];
245
- if (y.includes("-") || y.includes("/"))
246
- t = !0;
247
- else if (y == "*")
248
- n = !0;
282
+ const R = o[3];
283
+ if (R.includes("-") || R.includes("/"))
284
+ u = !0;
285
+ else if (R == "*")
286
+ i = !0;
249
287
  else {
250
- n = !1;
251
- const v = y.split(",");
252
- v.some((o) => !H.some((S) => S.value == o)) ? t = !0 : m.value = v;
288
+ i = !1, s = !0;
289
+ 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;
253
295
  }
254
- const $ = l[4];
255
- if ($.includes("-") || $.includes("/"))
256
- t = !0;
257
- else if ($ == "*")
258
- r = !0, M.value = g.map((v) => v.value);
296
+ const W = o[4];
297
+ if (W.includes("-") || W.includes("/"))
298
+ u = !0;
299
+ else if (W == "*")
300
+ x = !0, h.value = D.map((t) => t.value);
259
301
  else {
260
- r = !1;
261
- const v = $.split(",");
262
- v.some((o) => !g.some((S) => S.value == o)) ? t = !0 : M.value = v;
302
+ x = !1;
303
+ const t = W.split(",");
304
+ t.some((f) => !D.some((g) => g.value == f)) ? u = !0 : h.value = t;
263
305
  }
264
- if (C(l, 5) && i.useLeadTimeLeft) {
265
- const v = l[5].split("-");
266
- if (i.useLeadTimeRight && v.length > 1) {
267
- const o = Number.parseInt(v[1]);
268
- D.value = i.useLeadTimeInHours ? Math.round(o / 60) : o;
306
+ if (L(o, 5) && v.useLeadTimeLeft) {
307
+ const t = o[5].split("-");
308
+ if (v.useLeadTimeRight && t.length > 1) {
309
+ const f = Number.parseInt(t[1]);
310
+ T.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
269
311
  }
270
- if (v.length > 0) {
271
- const o = Number.parseInt(v[0]);
272
- p.value = i.useLeadTimeInHours ? Math.round(o / 60) : o;
312
+ if (t.length > 0) {
313
+ const f = Number.parseInt(t[0]);
314
+ P.value = v.useLeadTimeInHours ? Math.round(f / 60) : f;
273
315
  }
274
316
  }
275
317
  }
276
- t ? f.value = "Custom" : n && a && r ? h.value = "Daily" : n && a ? h.value = "Weekly" : n ? h.value = "Monthly" : h.value = "Custom";
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";
277
319
  }
278
320
  return {
279
- applyRawExpression: b,
280
- applyRegularity: W,
281
- cronExpression: s,
282
- hour: c,
283
- leadTimeLeft: p,
284
- leadTimeRight: D,
285
- months: m,
286
- pack: z,
287
- rawExpression: E,
288
- regularity: f,
289
- unpack: T,
290
- weekdays: M,
291
- weeks: d
321
+ applyRawExpression: J,
322
+ applyRegularity: O,
323
+ cronExpression: r,
324
+ hour: y,
325
+ leadTimeLeft: P,
326
+ leadTimeRight: T,
327
+ months: c,
328
+ pack: _,
329
+ rawExpression: b,
330
+ regularity: m,
331
+ unpack: I,
332
+ weekdays: h,
333
+ weeks: p
292
334
  };
293
335
  }
294
- function z() {
295
- var u, t, a, r, n, l;
296
- if (f.value == "Custom")
297
- return s.value;
298
- let e = `${(u = c.value) == null ? void 0 : u.split(".")[1]} ${(t = c.value) == null ? void 0 : t.split(".")[0]}`;
299
- return C(d.value) ? e = A(e, (a = d.value) == null ? void 0 : a.toString(), " ") : e = A(e, "*", " "), C(m.value) ? e = A(e, (r = m.value) == null ? void 0 : r.toString(), " ") : e = A(e, "*", " "), ((n = M.value) == null ? void 0 : n.length) == 7 ? e = A(e, "*", " ") : e = A(e, (l = M.value) == null ? void 0 : l.toString(), " "), e = A(e, `${R.value}-${O.value}`, " "), s.value = e, s.value;
336
+ 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;
300
342
  }
301
- return T(i.value ?? i.defaultExpression ?? I()), {
302
- applyRawExpression: b,
303
- applyRegularity: W,
304
- cronExpression: s,
305
- getRegularityAndOrderAndDeliveryDays: U,
306
- hour: c,
307
- leadTimeLeft: p,
308
- leadTimeRight: D,
309
- months: m,
310
- pack: z,
311
- rawExpression: E,
312
- regularity: f,
313
- unpack: T,
314
- weekdays: M,
315
- weeks: d
343
+ return I(v.value ?? v.defaultExpression ?? S()), {
344
+ applyRawExpression: J,
345
+ applyRegularity: O,
346
+ cronExpression: r,
347
+ getRegularityAndOrderAndDeliveryDays: B,
348
+ hour: y,
349
+ leadTimeLeft: P,
350
+ leadTimeRight: T,
351
+ months: c,
352
+ monthdays: C,
353
+ pack: _,
354
+ rawExpression: b,
355
+ regularity: m,
356
+ unpack: I,
357
+ weekdays: h,
358
+ weeks: p
316
359
  };
317
360
  }
318
361
  export {
362
+ ve as getLeadTime,
319
363
  w as hourOptions,
320
- H as monthOptions,
321
- Y as regularityOptions,
322
- te as useCron,
323
- ee as useCronPredictor,
324
- _ as weekOptions,
325
- g as weekdayOptions
364
+ j as monthOptions,
365
+ Z as monthdayOptions,
366
+ ue as regularityOptions,
367
+ se as useCron,
368
+ ae as useCronPredictor,
369
+ U as weekOptions,
370
+ D as weekdayOptions
326
371
  };