@budibase/shared-core 2.13.13 → 2.13.15
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 +308 -1
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -30,6 +30,301 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
+
// ../../node_modules/dayjs/dayjs.min.js
|
|
34
|
+
var require_dayjs_min = __commonJS({
|
|
35
|
+
"../../node_modules/dayjs/dayjs.min.js"(exports, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
!function(t, e) {
|
|
38
|
+
"object" == typeof exports && "undefined" != typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
39
|
+
}(exports, function() {
|
|
40
|
+
"use strict";
|
|
41
|
+
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
|
42
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
43
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
44
|
+
} }, m = function(t2, e2, n2) {
|
|
45
|
+
var r2 = String(t2);
|
|
46
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
47
|
+
}, v = { s: m, z: function(t2) {
|
|
48
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
49
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
50
|
+
}, m: function t2(e2, n2) {
|
|
51
|
+
if (e2.date() < n2.date())
|
|
52
|
+
return -t2(n2, e2);
|
|
53
|
+
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
54
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
55
|
+
}, a: function(t2) {
|
|
56
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
57
|
+
}, p: function(t2) {
|
|
58
|
+
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
59
|
+
}, u: function(t2) {
|
|
60
|
+
return void 0 === t2;
|
|
61
|
+
} }, g = "en", D = {};
|
|
62
|
+
D[g] = M;
|
|
63
|
+
var p = function(t2) {
|
|
64
|
+
return t2 instanceof b;
|
|
65
|
+
}, S = function t2(e2, n2, r2) {
|
|
66
|
+
var i2;
|
|
67
|
+
if (!e2)
|
|
68
|
+
return g;
|
|
69
|
+
if ("string" == typeof e2) {
|
|
70
|
+
var s2 = e2.toLowerCase();
|
|
71
|
+
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
72
|
+
var u2 = e2.split("-");
|
|
73
|
+
if (!i2 && u2.length > 1)
|
|
74
|
+
return t2(u2[0]);
|
|
75
|
+
} else {
|
|
76
|
+
var a2 = e2.name;
|
|
77
|
+
D[a2] = e2, i2 = a2;
|
|
78
|
+
}
|
|
79
|
+
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
80
|
+
}, w = function(t2, e2) {
|
|
81
|
+
if (p(t2))
|
|
82
|
+
return t2.clone();
|
|
83
|
+
var n2 = "object" == typeof e2 ? e2 : {};
|
|
84
|
+
return n2.date = t2, n2.args = arguments, new b(n2);
|
|
85
|
+
}, O = v;
|
|
86
|
+
O.l = S, O.i = p, O.w = function(t2, e2) {
|
|
87
|
+
return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
88
|
+
};
|
|
89
|
+
var b = function() {
|
|
90
|
+
function M2(t2) {
|
|
91
|
+
this.$L = S(t2.locale, null, true), this.parse(t2);
|
|
92
|
+
}
|
|
93
|
+
var m2 = M2.prototype;
|
|
94
|
+
return m2.parse = function(t2) {
|
|
95
|
+
this.$d = function(t3) {
|
|
96
|
+
var e2 = t3.date, n2 = t3.utc;
|
|
97
|
+
if (null === e2)
|
|
98
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
99
|
+
if (O.u(e2))
|
|
100
|
+
return /* @__PURE__ */ new Date();
|
|
101
|
+
if (e2 instanceof Date)
|
|
102
|
+
return new Date(e2);
|
|
103
|
+
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
104
|
+
var r2 = e2.match($);
|
|
105
|
+
if (r2) {
|
|
106
|
+
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
107
|
+
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return new Date(e2);
|
|
111
|
+
}(t2), this.$x = t2.x || {}, this.init();
|
|
112
|
+
}, m2.init = function() {
|
|
113
|
+
var t2 = this.$d;
|
|
114
|
+
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
115
|
+
}, m2.$utils = function() {
|
|
116
|
+
return O;
|
|
117
|
+
}, m2.isValid = function() {
|
|
118
|
+
return !(this.$d.toString() === l);
|
|
119
|
+
}, m2.isSame = function(t2, e2) {
|
|
120
|
+
var n2 = w(t2);
|
|
121
|
+
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
122
|
+
}, m2.isAfter = function(t2, e2) {
|
|
123
|
+
return w(t2) < this.startOf(e2);
|
|
124
|
+
}, m2.isBefore = function(t2, e2) {
|
|
125
|
+
return this.endOf(e2) < w(t2);
|
|
126
|
+
}, m2.$g = function(t2, e2, n2) {
|
|
127
|
+
return O.u(t2) ? this[e2] : this.set(n2, t2);
|
|
128
|
+
}, m2.unix = function() {
|
|
129
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
130
|
+
}, m2.valueOf = function() {
|
|
131
|
+
return this.$d.getTime();
|
|
132
|
+
}, m2.startOf = function(t2, e2) {
|
|
133
|
+
var n2 = this, r2 = !!O.u(e2) || e2, f2 = O.p(t2), l2 = function(t3, e3) {
|
|
134
|
+
var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
135
|
+
return r2 ? i2 : i2.endOf(a);
|
|
136
|
+
}, $2 = function(t3, e3) {
|
|
137
|
+
return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
138
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
139
|
+
switch (f2) {
|
|
140
|
+
case h:
|
|
141
|
+
return r2 ? l2(1, 0) : l2(31, 11);
|
|
142
|
+
case c:
|
|
143
|
+
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
144
|
+
case o:
|
|
145
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
146
|
+
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
147
|
+
case a:
|
|
148
|
+
case d:
|
|
149
|
+
return $2(v2 + "Hours", 0);
|
|
150
|
+
case u:
|
|
151
|
+
return $2(v2 + "Minutes", 1);
|
|
152
|
+
case s:
|
|
153
|
+
return $2(v2 + "Seconds", 2);
|
|
154
|
+
case i:
|
|
155
|
+
return $2(v2 + "Milliseconds", 3);
|
|
156
|
+
default:
|
|
157
|
+
return this.clone();
|
|
158
|
+
}
|
|
159
|
+
}, m2.endOf = function(t2) {
|
|
160
|
+
return this.startOf(t2, false);
|
|
161
|
+
}, m2.$set = function(t2, e2) {
|
|
162
|
+
var n2, o2 = O.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
163
|
+
if (o2 === c || o2 === h) {
|
|
164
|
+
var y2 = this.clone().set(d, 1);
|
|
165
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
166
|
+
} else
|
|
167
|
+
l2 && this.$d[l2]($2);
|
|
168
|
+
return this.init(), this;
|
|
169
|
+
}, m2.set = function(t2, e2) {
|
|
170
|
+
return this.clone().$set(t2, e2);
|
|
171
|
+
}, m2.get = function(t2) {
|
|
172
|
+
return this[O.p(t2)]();
|
|
173
|
+
}, m2.add = function(r2, f2) {
|
|
174
|
+
var d2, l2 = this;
|
|
175
|
+
r2 = Number(r2);
|
|
176
|
+
var $2 = O.p(f2), y2 = function(t2) {
|
|
177
|
+
var e2 = w(l2);
|
|
178
|
+
return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
179
|
+
};
|
|
180
|
+
if ($2 === c)
|
|
181
|
+
return this.set(c, this.$M + r2);
|
|
182
|
+
if ($2 === h)
|
|
183
|
+
return this.set(h, this.$y + r2);
|
|
184
|
+
if ($2 === a)
|
|
185
|
+
return y2(1);
|
|
186
|
+
if ($2 === o)
|
|
187
|
+
return y2(7);
|
|
188
|
+
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
189
|
+
return O.w(m3, this);
|
|
190
|
+
}, m2.subtract = function(t2, e2) {
|
|
191
|
+
return this.add(-1 * t2, e2);
|
|
192
|
+
}, m2.format = function(t2) {
|
|
193
|
+
var e2 = this, n2 = this.$locale();
|
|
194
|
+
if (!this.isValid())
|
|
195
|
+
return n2.invalidDate || l;
|
|
196
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
197
|
+
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
198
|
+
}, d2 = function(t3) {
|
|
199
|
+
return O.s(s2 % 12 || 12, t3, "0");
|
|
200
|
+
}, $2 = f2 || function(t3, e3, n3) {
|
|
201
|
+
var r3 = t3 < 12 ? "AM" : "PM";
|
|
202
|
+
return n3 ? r3.toLowerCase() : r3;
|
|
203
|
+
};
|
|
204
|
+
return r2.replace(y, function(t3, r3) {
|
|
205
|
+
return r3 || function(t4) {
|
|
206
|
+
switch (t4) {
|
|
207
|
+
case "YY":
|
|
208
|
+
return String(e2.$y).slice(-2);
|
|
209
|
+
case "YYYY":
|
|
210
|
+
return O.s(e2.$y, 4, "0");
|
|
211
|
+
case "M":
|
|
212
|
+
return a2 + 1;
|
|
213
|
+
case "MM":
|
|
214
|
+
return O.s(a2 + 1, 2, "0");
|
|
215
|
+
case "MMM":
|
|
216
|
+
return h2(n2.monthsShort, a2, c2, 3);
|
|
217
|
+
case "MMMM":
|
|
218
|
+
return h2(c2, a2);
|
|
219
|
+
case "D":
|
|
220
|
+
return e2.$D;
|
|
221
|
+
case "DD":
|
|
222
|
+
return O.s(e2.$D, 2, "0");
|
|
223
|
+
case "d":
|
|
224
|
+
return String(e2.$W);
|
|
225
|
+
case "dd":
|
|
226
|
+
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
227
|
+
case "ddd":
|
|
228
|
+
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
229
|
+
case "dddd":
|
|
230
|
+
return o2[e2.$W];
|
|
231
|
+
case "H":
|
|
232
|
+
return String(s2);
|
|
233
|
+
case "HH":
|
|
234
|
+
return O.s(s2, 2, "0");
|
|
235
|
+
case "h":
|
|
236
|
+
return d2(1);
|
|
237
|
+
case "hh":
|
|
238
|
+
return d2(2);
|
|
239
|
+
case "a":
|
|
240
|
+
return $2(s2, u2, true);
|
|
241
|
+
case "A":
|
|
242
|
+
return $2(s2, u2, false);
|
|
243
|
+
case "m":
|
|
244
|
+
return String(u2);
|
|
245
|
+
case "mm":
|
|
246
|
+
return O.s(u2, 2, "0");
|
|
247
|
+
case "s":
|
|
248
|
+
return String(e2.$s);
|
|
249
|
+
case "ss":
|
|
250
|
+
return O.s(e2.$s, 2, "0");
|
|
251
|
+
case "SSS":
|
|
252
|
+
return O.s(e2.$ms, 3, "0");
|
|
253
|
+
case "Z":
|
|
254
|
+
return i2;
|
|
255
|
+
}
|
|
256
|
+
return null;
|
|
257
|
+
}(t3) || i2.replace(":", "");
|
|
258
|
+
});
|
|
259
|
+
}, m2.utcOffset = function() {
|
|
260
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
261
|
+
}, m2.diff = function(r2, d2, l2) {
|
|
262
|
+
var $2, y2 = this, M3 = O.p(d2), m3 = w(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
263
|
+
return O.m(y2, m3);
|
|
264
|
+
};
|
|
265
|
+
switch (M3) {
|
|
266
|
+
case h:
|
|
267
|
+
$2 = D2() / 12;
|
|
268
|
+
break;
|
|
269
|
+
case c:
|
|
270
|
+
$2 = D2();
|
|
271
|
+
break;
|
|
272
|
+
case f:
|
|
273
|
+
$2 = D2() / 3;
|
|
274
|
+
break;
|
|
275
|
+
case o:
|
|
276
|
+
$2 = (g2 - v2) / 6048e5;
|
|
277
|
+
break;
|
|
278
|
+
case a:
|
|
279
|
+
$2 = (g2 - v2) / 864e5;
|
|
280
|
+
break;
|
|
281
|
+
case u:
|
|
282
|
+
$2 = g2 / n;
|
|
283
|
+
break;
|
|
284
|
+
case s:
|
|
285
|
+
$2 = g2 / e;
|
|
286
|
+
break;
|
|
287
|
+
case i:
|
|
288
|
+
$2 = g2 / t;
|
|
289
|
+
break;
|
|
290
|
+
default:
|
|
291
|
+
$2 = g2;
|
|
292
|
+
}
|
|
293
|
+
return l2 ? $2 : O.a($2);
|
|
294
|
+
}, m2.daysInMonth = function() {
|
|
295
|
+
return this.endOf(c).$D;
|
|
296
|
+
}, m2.$locale = function() {
|
|
297
|
+
return D[this.$L];
|
|
298
|
+
}, m2.locale = function(t2, e2) {
|
|
299
|
+
if (!t2)
|
|
300
|
+
return this.$L;
|
|
301
|
+
var n2 = this.clone(), r2 = S(t2, e2, true);
|
|
302
|
+
return r2 && (n2.$L = r2), n2;
|
|
303
|
+
}, m2.clone = function() {
|
|
304
|
+
return O.w(this.$d, this);
|
|
305
|
+
}, m2.toDate = function() {
|
|
306
|
+
return new Date(this.valueOf());
|
|
307
|
+
}, m2.toJSON = function() {
|
|
308
|
+
return this.isValid() ? this.toISOString() : null;
|
|
309
|
+
}, m2.toISOString = function() {
|
|
310
|
+
return this.$d.toISOString();
|
|
311
|
+
}, m2.toString = function() {
|
|
312
|
+
return this.$d.toUTCString();
|
|
313
|
+
}, M2;
|
|
314
|
+
}(), _2 = b.prototype;
|
|
315
|
+
return w.prototype = _2, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
316
|
+
_2[t2[1]] = function(e2) {
|
|
317
|
+
return this.$g(e2, t2[0], t2[1]);
|
|
318
|
+
};
|
|
319
|
+
}), w.extend = function(t2, e2) {
|
|
320
|
+
return t2.$i || (t2(e2, b, w), t2.$i = true), w;
|
|
321
|
+
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
|
|
322
|
+
return w(1e3 * t2);
|
|
323
|
+
}, w.en = D[g], w.Ls = D, w.p = {}, w;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
33
328
|
// ../../node_modules/lodash/lodash.min.js
|
|
34
329
|
var require_lodash_min = __commonJS({
|
|
35
330
|
"../../node_modules/lodash/lodash.min.js"(exports, module2) {
|
|
@@ -4504,6 +4799,9 @@ var BREAKDOWN_QUOTA_NAMES = [
|
|
|
4504
4799
|
"automations" /* AUTOMATIONS */
|
|
4505
4800
|
];
|
|
4506
4801
|
|
|
4802
|
+
// src/filters.ts
|
|
4803
|
+
var import_dayjs = __toESM(require_dayjs_min());
|
|
4804
|
+
|
|
4507
4805
|
// src/helpers/index.ts
|
|
4508
4806
|
var helpers_exports = {};
|
|
4509
4807
|
__export(helpers_exports, {
|
|
@@ -4789,7 +5087,16 @@ var runLuceneQuery = (docs, query) => {
|
|
|
4789
5087
|
const rangeMatch = match(
|
|
4790
5088
|
"range" /* RANGE */,
|
|
4791
5089
|
(docValue, testValue) => {
|
|
4792
|
-
|
|
5090
|
+
if (docValue == null || docValue === "") {
|
|
5091
|
+
return true;
|
|
5092
|
+
}
|
|
5093
|
+
if (!isNaN(+docValue)) {
|
|
5094
|
+
return +docValue < testValue.low || +docValue > testValue.high;
|
|
5095
|
+
}
|
|
5096
|
+
if ((0, import_dayjs.default)(docValue).isValid()) {
|
|
5097
|
+
return new Date(docValue).getTime() < new Date(testValue.low).getTime() || new Date(docValue).getTime() > new Date(testValue.high).getTime();
|
|
5098
|
+
}
|
|
5099
|
+
throw "Cannot perform range filter - invalid type.";
|
|
4793
5100
|
}
|
|
4794
5101
|
);
|
|
4795
5102
|
const equalMatch = match(
|