bt-core-app 2.2.20 → 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;
@@ -50,6 +54,7 @@ export declare function useCron(options: UseCronOptions): {
50
54
  leadTimeLeft: import('vue').Ref<number, number>;
51
55
  leadTimeRight: import('vue').Ref<number, number>;
52
56
  months: import('vue').Ref<string[] | undefined, string[] | undefined>;
57
+ monthdays: import('vue').Ref<string[] | undefined, string[] | undefined>;
53
58
  pack: () => string | undefined;
54
59
  rawExpression: import('vue').WritableComputedRef<string | undefined, string | undefined>;
55
60
  regularity: import('vue').WritableComputedRef<CronRegularity, CronRegularity>;
@@ -1,9 +1,9 @@
1
- import { useAuth as Z } from "./auth.mjs";
2
- import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as I } from "./helpers.mjs";
3
- import { ref as P, computed as T } 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";
6
- const b = [
5
+ import { __exports as Q } from "../_virtual/index.mjs";
6
+ const w = [
7
7
  { text: "12:00 AM", value: "0.0" },
8
8
  { text: "12:15 AM", value: "0.15" },
9
9
  { text: "12:30 AM", value: "0.30" },
@@ -100,7 +100,7 @@ const b = [
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 b = [
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,207 +127,245 @@ const b = [
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: r } = Z();
138
- function D(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 k = s.cron.split(/\s+/).slice(0, 5).join(" ");
142
- return B.getFutureMatches(k, { matchCount: s.futureCount, formatInTimezone: !1, timezone: r.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: D
178
+ predictFuture: S
146
179
  };
147
180
  }
148
- function te(r) {
149
- if (r == null)
181
+ function ve(v) {
182
+ if (v == null)
150
183
  return 0;
151
- const D = r.split(/\s+/);
152
- return D.length > 5 ? Number.parseInt(D[5].split("-")[0]) : 0;
184
+ const S = v.split(/\s+/);
185
+ return S.length > 5 ? Number.parseInt(S[5].split("-")[0]) : 0;
153
186
  }
154
- function le(r) {
155
- function D() {
187
+ function se(v) {
188
+ function S() {
156
189
  let e = "0 0 * * 1";
157
- return r.useLeadTimeLeft && (r.useLeadTimeRight ? e = A(e, `${R.value.toString()}-${E.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;
158
191
  }
159
- const s = P();
192
+ const r = d();
160
193
  let k = "";
161
- const N = T({
194
+ const b = $({
162
195
  get() {
163
- return s.value;
196
+ return r.value;
164
197
  },
165
198
  set(e) {
166
199
  k = e;
167
200
  }
168
- }), p = P(0), S = P(0), h = P("Custom"), f = T({
201
+ }), P = d(0), T = d(0), A = d("Custom"), m = $({
169
202
  get() {
170
- return h.value;
203
+ return A.value;
171
204
  },
172
205
  set(e) {
173
- h.value !== e && (h.value = e, W(e));
206
+ A.value !== e && (A.value = e, O(e));
174
207
  }
175
- }), w = T(() => r.useLeadTimeInHours ? p.value : p.value / 60), R = T(() => r.useLeadTimeInHours ? p.value * 60 : p.value), E = T(() => r.useLeadTimeInHours ? S.value * 60 : S.value), c = P(), m = P(), d = P(), M = P();
176
- function O() {
177
- C(k ?? N.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);
178
211
  }
179
- function W(e) {
180
- 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 = ["*"]);
181
214
  }
182
- function j(e, u) {
183
- var i, l;
215
+ function q(e, l) {
216
+ var i, s;
184
217
  e ?? (e = "0");
185
- const t = g.findIndex((x) => x.value == e || x.text == e);
186
- u ?? (u = 0);
187
- const a = (t + u) % 7, n = Math.ceil(u / 7);
188
- return n > 1 ? `${n} ${(i = g[a]) == null ? void 0 : i.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;
189
222
  }
190
- function F(e) {
191
- if (c.value != null) {
192
- var u = b.find((n) => n.value == c.value);
193
- if (u != null) {
194
- var t = Number.parseFloat(u.value) + w.value, a = Math.floor(t / 24);
195
- 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);
196
229
  }
197
230
  }
198
231
  }
199
- function U() {
200
- var n, i;
232
+ function B() {
233
+ var x, i;
201
234
  var e = {
202
- regularity: f.value,
235
+ regularity: m.value,
203
236
  orderDays: [],
204
237
  deliveryDays: []
205
238
  };
206
- if (f.value == "Daily") {
207
- if (c.value != null) {
208
- var u = b.find((l) => l.value == c.value);
209
- if (u != null) {
210
- f.value == "Daily" && e.orderDays.push(u.text);
211
- var t = Number.parseFloat(u.value) + w.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);
212
245
  a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
213
246
  }
214
247
  }
215
248
  } else
216
- f.value == "Weekly" ? (n = M.value) == null || n.forEach((l) => {
217
- var x = g.find((y) => y.value == l);
218
- x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(l) ?? ""));
219
- }) : f.value == "Monthly" && ((i = m.value) == null || i.forEach((l) => {
220
- var x = H.find((y) => y.value == l);
221
- 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) ?? ""));
222
255
  }));
223
256
  return e;
224
257
  }
225
- function J() {
258
+ function H() {
226
259
  var e;
227
- return (e = s.value) == null ? void 0 : e.split(/\s+/);
260
+ return (e = r.value) == null ? void 0 : e.split(/\s+/);
228
261
  }
229
- function C(e) {
230
- if (s.value != e) {
231
- s.value = e;
232
- let t = !1, a = !1, n = !1, i = !1;
233
- if (q(s.value) || !I(J(), 4))
234
- 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;
235
268
  else {
236
- const l = J();
237
- t = !1;
238
- var u = `${l[1]}.${l[0]}`;
239
- u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 : b.some((v) => v.value == u) ? c.value = u : t = !0;
240
- const x = l[2];
241
- if (x.includes("/"))
242
- t = !0;
243
- 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 == "*")
244
276
  a = !0;
245
277
  else {
246
278
  a = !1;
247
- const v = x.split(",");
248
- v.some((o) => !_.some((L) => L.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;
249
281
  }
250
- const y = l[3];
251
- if (y.includes("-") || y.includes("/"))
252
- t = !0;
253
- else if (y == "*")
282
+ const R = o[3];
283
+ if (R.includes("-") || R.includes("/"))
284
+ u = !0;
285
+ else if (R == "*")
254
286
  i = !0;
255
287
  else {
256
- i = !1;
257
- const v = y.split(",");
258
- v.some((o) => !H.some((L) => L.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;
259
295
  }
260
- const $ = l[4];
261
- if ($.includes("-") || $.includes("/"))
262
- t = !0;
263
- else if ($ == "*")
264
- n = !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);
265
301
  else {
266
- n = !1;
267
- const v = $.split(",");
268
- v.some((o) => !g.some((L) => L.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;
269
305
  }
270
- if (I(l, 5) && r.useLeadTimeLeft) {
271
- const v = l[5].split("-");
272
- if (r.useLeadTimeRight && v.length > 1) {
273
- const o = Number.parseInt(v[1]);
274
- S.value = r.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;
275
311
  }
276
- if (v.length > 0) {
277
- const o = Number.parseInt(v[0]);
278
- p.value = r.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;
279
315
  }
280
316
  }
281
317
  }
282
- t ? f.value = "Custom" : i && a && n ? h.value = "Daily" : i && a ? h.value = "Weekly" : i ? 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";
283
319
  }
284
320
  return {
285
- applyRawExpression: O,
286
- applyRegularity: W,
287
- cronExpression: s,
288
- hour: c,
289
- leadTimeLeft: p,
290
- leadTimeRight: S,
291
- months: m,
292
- pack: z,
293
- rawExpression: N,
294
- regularity: f,
295
- unpack: C,
296
- weekdays: M,
297
- 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
298
334
  };
299
335
  }
300
- function z() {
301
- var u, t, a, n, i, l;
302
- if (f.value == "Custom")
303
- return s.value;
304
- let e = `${(u = c.value) == null ? void 0 : u.split(".")[1]} ${(t = c.value) == null ? void 0 : t.split(".")[0]}`;
305
- return I(d.value) ? e = A(e, (a = d.value) == null ? void 0 : a.toString(), " ") : e = A(e, "*", " "), I(m.value) ? e = A(e, (n = m.value) == null ? void 0 : n.toString(), " ") : e = A(e, "*", " "), ((i = M.value) == null ? void 0 : i.length) == 7 ? e = A(e, "*", " ") : e = A(e, (l = M.value) == null ? void 0 : l.toString(), " "), e = A(e, `${R.value}-${E.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;
306
342
  }
307
- return C(r.value ?? r.defaultExpression ?? D()), {
308
- applyRawExpression: O,
309
- applyRegularity: W,
310
- cronExpression: s,
311
- getRegularityAndOrderAndDeliveryDays: U,
312
- hour: c,
313
- leadTimeLeft: p,
314
- leadTimeRight: S,
315
- months: m,
316
- pack: z,
317
- rawExpression: N,
318
- regularity: f,
319
- unpack: C,
320
- weekdays: M,
321
- 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
322
359
  };
323
360
  }
324
361
  export {
325
- te as getLeadTime,
326
- b as hourOptions,
327
- H as monthOptions,
328
- Y as regularityOptions,
329
- le as useCron,
330
- ee as useCronPredictor,
331
- _ as weekOptions,
332
- g as weekdayOptions
362
+ ve as getLeadTime,
363
+ w as hourOptions,
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
333
371
  };