@wzyjs/utils 0.2.67 → 0.2.71
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/browser.cjs.js +556 -496
- package/dist/browser.esm.js +556 -496
- package/dist/node/cron/index.d.ts +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node.cjs.js +1277 -296
- package/dist/node.esm.js +1279 -296
- package/package.json +2 -2
package/dist/node.cjs.js
CHANGED
|
@@ -738,7 +738,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
738
738
|
var objectCtorString = funcToString.call(Object2);
|
|
739
739
|
var oldDash = root._;
|
|
740
740
|
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
741
|
-
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol,
|
|
741
|
+
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
|
|
742
742
|
var defineProperty = function() {
|
|
743
743
|
try {
|
|
744
744
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -1983,7 +1983,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
1983
1983
|
end = end === undefined2 ? length : end;
|
|
1984
1984
|
return !start && end >= length ? array : baseSlice(array, start, end);
|
|
1985
1985
|
}
|
|
1986
|
-
var
|
|
1986
|
+
var clearTimeout2 = ctxClearTimeout || function(id) {
|
|
1987
1987
|
return root.clearTimeout(id);
|
|
1988
1988
|
};
|
|
1989
1989
|
function cloneBuffer(buffer, isDeep) {
|
|
@@ -1996,7 +1996,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
1996
1996
|
}
|
|
1997
1997
|
function cloneArrayBuffer(arrayBuffer) {
|
|
1998
1998
|
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
1999
|
-
new
|
|
1999
|
+
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
|
|
2000
2000
|
return result2;
|
|
2001
2001
|
}
|
|
2002
2002
|
function cloneDataView(dataView, isDeep) {
|
|
@@ -2578,7 +2578,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
2578
2578
|
object = object.buffer;
|
|
2579
2579
|
other = other.buffer;
|
|
2580
2580
|
case arrayBufferTag:
|
|
2581
|
-
if (object.byteLength != other.byteLength || !equalFunc(new
|
|
2581
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
|
|
2582
2582
|
return false;
|
|
2583
2583
|
}
|
|
2584
2584
|
return true;
|
|
@@ -3831,7 +3831,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
3831
3831
|
}
|
|
3832
3832
|
function cancel() {
|
|
3833
3833
|
if (timerId !== undefined2) {
|
|
3834
|
-
|
|
3834
|
+
clearTimeout2(timerId);
|
|
3835
3835
|
}
|
|
3836
3836
|
lastInvokeTime = 0;
|
|
3837
3837
|
lastArgs = lastCallTime = lastThis = timerId = undefined2;
|
|
@@ -3849,7 +3849,7 @@ var require_lodash = __commonJS((exports2, module2) => {
|
|
|
3849
3849
|
return leadingEdge(lastCallTime);
|
|
3850
3850
|
}
|
|
3851
3851
|
if (maxing) {
|
|
3852
|
-
|
|
3852
|
+
clearTimeout2(timerId);
|
|
3853
3853
|
timerId = setTimeout2(timerExpired, wait);
|
|
3854
3854
|
return invokeFunc(lastCallTime);
|
|
3855
3855
|
}
|
|
@@ -5456,10 +5456,998 @@ __p += '`;
|
|
|
5456
5456
|
}).call(exports2);
|
|
5457
5457
|
});
|
|
5458
5458
|
|
|
5459
|
+
// ../../node_modules/node-cron/src/task.js
|
|
5460
|
+
var require_task = __commonJS((exports2, module2) => {
|
|
5461
|
+
var EventEmitter = require("events");
|
|
5462
|
+
|
|
5463
|
+
class Task extends EventEmitter {
|
|
5464
|
+
constructor(execution) {
|
|
5465
|
+
super();
|
|
5466
|
+
if (typeof execution !== "function") {
|
|
5467
|
+
throw "execution must be a function";
|
|
5468
|
+
}
|
|
5469
|
+
this._execution = execution;
|
|
5470
|
+
}
|
|
5471
|
+
execute(now) {
|
|
5472
|
+
let exec;
|
|
5473
|
+
try {
|
|
5474
|
+
exec = this._execution(now);
|
|
5475
|
+
} catch (error) {
|
|
5476
|
+
return this.emit("task-failed", error);
|
|
5477
|
+
}
|
|
5478
|
+
if (exec instanceof Promise) {
|
|
5479
|
+
return exec.then(() => this.emit("task-finished")).catch((error) => this.emit("task-failed", error));
|
|
5480
|
+
} else {
|
|
5481
|
+
this.emit("task-finished");
|
|
5482
|
+
return exec;
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5485
|
+
}
|
|
5486
|
+
module2.exports = Task;
|
|
5487
|
+
});
|
|
5488
|
+
|
|
5489
|
+
// ../../node_modules/node-cron/src/convert-expression/month-names-conversion.js
|
|
5490
|
+
var require_month_names_conversion = __commonJS((exports2, module2) => {
|
|
5491
|
+
module2.exports = (() => {
|
|
5492
|
+
const months = [
|
|
5493
|
+
"january",
|
|
5494
|
+
"february",
|
|
5495
|
+
"march",
|
|
5496
|
+
"april",
|
|
5497
|
+
"may",
|
|
5498
|
+
"june",
|
|
5499
|
+
"july",
|
|
5500
|
+
"august",
|
|
5501
|
+
"september",
|
|
5502
|
+
"october",
|
|
5503
|
+
"november",
|
|
5504
|
+
"december"
|
|
5505
|
+
];
|
|
5506
|
+
const shortMonths = [
|
|
5507
|
+
"jan",
|
|
5508
|
+
"feb",
|
|
5509
|
+
"mar",
|
|
5510
|
+
"apr",
|
|
5511
|
+
"may",
|
|
5512
|
+
"jun",
|
|
5513
|
+
"jul",
|
|
5514
|
+
"aug",
|
|
5515
|
+
"sep",
|
|
5516
|
+
"oct",
|
|
5517
|
+
"nov",
|
|
5518
|
+
"dec"
|
|
5519
|
+
];
|
|
5520
|
+
function convertMonthName(expression, items) {
|
|
5521
|
+
for (let i = 0;i < items.length; i++) {
|
|
5522
|
+
expression = expression.replace(new RegExp(items[i], "gi"), parseInt(i, 10) + 1);
|
|
5523
|
+
}
|
|
5524
|
+
return expression;
|
|
5525
|
+
}
|
|
5526
|
+
function interprete(monthExpression) {
|
|
5527
|
+
monthExpression = convertMonthName(monthExpression, months);
|
|
5528
|
+
monthExpression = convertMonthName(monthExpression, shortMonths);
|
|
5529
|
+
return monthExpression;
|
|
5530
|
+
}
|
|
5531
|
+
return interprete;
|
|
5532
|
+
})();
|
|
5533
|
+
});
|
|
5534
|
+
|
|
5535
|
+
// ../../node_modules/node-cron/src/convert-expression/week-day-names-conversion.js
|
|
5536
|
+
var require_week_day_names_conversion = __commonJS((exports2, module2) => {
|
|
5537
|
+
module2.exports = (() => {
|
|
5538
|
+
const weekDays = [
|
|
5539
|
+
"sunday",
|
|
5540
|
+
"monday",
|
|
5541
|
+
"tuesday",
|
|
5542
|
+
"wednesday",
|
|
5543
|
+
"thursday",
|
|
5544
|
+
"friday",
|
|
5545
|
+
"saturday"
|
|
5546
|
+
];
|
|
5547
|
+
const shortWeekDays = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
5548
|
+
function convertWeekDayName(expression, items) {
|
|
5549
|
+
for (let i = 0;i < items.length; i++) {
|
|
5550
|
+
expression = expression.replace(new RegExp(items[i], "gi"), parseInt(i, 10));
|
|
5551
|
+
}
|
|
5552
|
+
return expression;
|
|
5553
|
+
}
|
|
5554
|
+
function convertWeekDays(expression) {
|
|
5555
|
+
expression = expression.replace("7", "0");
|
|
5556
|
+
expression = convertWeekDayName(expression, weekDays);
|
|
5557
|
+
return convertWeekDayName(expression, shortWeekDays);
|
|
5558
|
+
}
|
|
5559
|
+
return convertWeekDays;
|
|
5560
|
+
})();
|
|
5561
|
+
});
|
|
5562
|
+
|
|
5563
|
+
// ../../node_modules/node-cron/src/convert-expression/asterisk-to-range-conversion.js
|
|
5564
|
+
var require_asterisk_to_range_conversion = __commonJS((exports2, module2) => {
|
|
5565
|
+
module2.exports = (() => {
|
|
5566
|
+
function convertAsterisk(expression, replecement) {
|
|
5567
|
+
if (expression.indexOf("*") !== -1) {
|
|
5568
|
+
return expression.replace("*", replecement);
|
|
5569
|
+
}
|
|
5570
|
+
return expression;
|
|
5571
|
+
}
|
|
5572
|
+
function convertAsterisksToRanges(expressions) {
|
|
5573
|
+
expressions[0] = convertAsterisk(expressions[0], "0-59");
|
|
5574
|
+
expressions[1] = convertAsterisk(expressions[1], "0-59");
|
|
5575
|
+
expressions[2] = convertAsterisk(expressions[2], "0-23");
|
|
5576
|
+
expressions[3] = convertAsterisk(expressions[3], "1-31");
|
|
5577
|
+
expressions[4] = convertAsterisk(expressions[4], "1-12");
|
|
5578
|
+
expressions[5] = convertAsterisk(expressions[5], "0-6");
|
|
5579
|
+
return expressions;
|
|
5580
|
+
}
|
|
5581
|
+
return convertAsterisksToRanges;
|
|
5582
|
+
})();
|
|
5583
|
+
});
|
|
5584
|
+
|
|
5585
|
+
// ../../node_modules/node-cron/src/convert-expression/range-conversion.js
|
|
5586
|
+
var require_range_conversion = __commonJS((exports2, module2) => {
|
|
5587
|
+
module2.exports = (() => {
|
|
5588
|
+
function replaceWithRange(expression, text, init, end) {
|
|
5589
|
+
const numbers = [];
|
|
5590
|
+
let last = parseInt(end);
|
|
5591
|
+
let first = parseInt(init);
|
|
5592
|
+
if (first > last) {
|
|
5593
|
+
last = parseInt(init);
|
|
5594
|
+
first = parseInt(end);
|
|
5595
|
+
}
|
|
5596
|
+
for (let i = first;i <= last; i++) {
|
|
5597
|
+
numbers.push(i);
|
|
5598
|
+
}
|
|
5599
|
+
return expression.replace(new RegExp(text, "i"), numbers.join());
|
|
5600
|
+
}
|
|
5601
|
+
function convertRange(expression) {
|
|
5602
|
+
const rangeRegEx = /(\d+)-(\d+)/;
|
|
5603
|
+
let match = rangeRegEx.exec(expression);
|
|
5604
|
+
while (match !== null && match.length > 0) {
|
|
5605
|
+
expression = replaceWithRange(expression, match[0], match[1], match[2]);
|
|
5606
|
+
match = rangeRegEx.exec(expression);
|
|
5607
|
+
}
|
|
5608
|
+
return expression;
|
|
5609
|
+
}
|
|
5610
|
+
function convertAllRanges(expressions) {
|
|
5611
|
+
for (let i = 0;i < expressions.length; i++) {
|
|
5612
|
+
expressions[i] = convertRange(expressions[i]);
|
|
5613
|
+
}
|
|
5614
|
+
return expressions;
|
|
5615
|
+
}
|
|
5616
|
+
return convertAllRanges;
|
|
5617
|
+
})();
|
|
5618
|
+
});
|
|
5619
|
+
|
|
5620
|
+
// ../../node_modules/node-cron/src/convert-expression/step-values-conversion.js
|
|
5621
|
+
var require_step_values_conversion = __commonJS((exports2, module2) => {
|
|
5622
|
+
module2.exports = (() => {
|
|
5623
|
+
function convertSteps(expressions) {
|
|
5624
|
+
var stepValuePattern = /^(.+)\/(\w+)$/;
|
|
5625
|
+
for (var i = 0;i < expressions.length; i++) {
|
|
5626
|
+
var match = stepValuePattern.exec(expressions[i]);
|
|
5627
|
+
var isStepValue = match !== null && match.length > 0;
|
|
5628
|
+
if (isStepValue) {
|
|
5629
|
+
var baseDivider = match[2];
|
|
5630
|
+
if (isNaN(baseDivider)) {
|
|
5631
|
+
throw baseDivider + " is not a valid step value";
|
|
5632
|
+
}
|
|
5633
|
+
var values = match[1].split(",");
|
|
5634
|
+
var stepValues = [];
|
|
5635
|
+
var divider = parseInt(baseDivider, 10);
|
|
5636
|
+
for (var j = 0;j <= values.length; j++) {
|
|
5637
|
+
var value = parseInt(values[j], 10);
|
|
5638
|
+
if (value % divider === 0) {
|
|
5639
|
+
stepValues.push(value);
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
expressions[i] = stepValues.join(",");
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
return expressions;
|
|
5646
|
+
}
|
|
5647
|
+
return convertSteps;
|
|
5648
|
+
})();
|
|
5649
|
+
});
|
|
5650
|
+
|
|
5651
|
+
// ../../node_modules/node-cron/src/convert-expression/index.js
|
|
5652
|
+
var require_convert_expression = __commonJS((exports2, module2) => {
|
|
5653
|
+
var monthNamesConversion = require_month_names_conversion();
|
|
5654
|
+
var weekDayNamesConversion = require_week_day_names_conversion();
|
|
5655
|
+
var convertAsterisksToRanges = require_asterisk_to_range_conversion();
|
|
5656
|
+
var convertRanges = require_range_conversion();
|
|
5657
|
+
var convertSteps = require_step_values_conversion();
|
|
5658
|
+
module2.exports = (() => {
|
|
5659
|
+
function appendSeccondExpression(expressions) {
|
|
5660
|
+
if (expressions.length === 5) {
|
|
5661
|
+
return ["0"].concat(expressions);
|
|
5662
|
+
}
|
|
5663
|
+
return expressions;
|
|
5664
|
+
}
|
|
5665
|
+
function removeSpaces(str) {
|
|
5666
|
+
return str.replace(/\s{2,}/g, " ").trim();
|
|
5667
|
+
}
|
|
5668
|
+
function normalizeIntegers(expressions) {
|
|
5669
|
+
for (let i = 0;i < expressions.length; i++) {
|
|
5670
|
+
const numbers = expressions[i].split(",");
|
|
5671
|
+
for (let j = 0;j < numbers.length; j++) {
|
|
5672
|
+
numbers[j] = parseInt(numbers[j]);
|
|
5673
|
+
}
|
|
5674
|
+
expressions[i] = numbers;
|
|
5675
|
+
}
|
|
5676
|
+
return expressions;
|
|
5677
|
+
}
|
|
5678
|
+
function interprete(expression) {
|
|
5679
|
+
let expressions = removeSpaces(expression).split(" ");
|
|
5680
|
+
expressions = appendSeccondExpression(expressions);
|
|
5681
|
+
expressions[4] = monthNamesConversion(expressions[4]);
|
|
5682
|
+
expressions[5] = weekDayNamesConversion(expressions[5]);
|
|
5683
|
+
expressions = convertAsterisksToRanges(expressions);
|
|
5684
|
+
expressions = convertRanges(expressions);
|
|
5685
|
+
expressions = convertSteps(expressions);
|
|
5686
|
+
expressions = normalizeIntegers(expressions);
|
|
5687
|
+
return expressions.join(" ");
|
|
5688
|
+
}
|
|
5689
|
+
return interprete;
|
|
5690
|
+
})();
|
|
5691
|
+
});
|
|
5692
|
+
|
|
5693
|
+
// ../../node_modules/node-cron/src/pattern-validation.js
|
|
5694
|
+
var require_pattern_validation = __commonJS((exports2, module2) => {
|
|
5695
|
+
var convertExpression = require_convert_expression();
|
|
5696
|
+
var validationRegex = /^(?:\d+|\*|\*\/\d+)$/;
|
|
5697
|
+
function isValidExpression(expression, min2, max2) {
|
|
5698
|
+
const options = expression.split(",");
|
|
5699
|
+
for (const option of options) {
|
|
5700
|
+
const optionAsInt = parseInt(option, 10);
|
|
5701
|
+
if (!Number.isNaN(optionAsInt) && (optionAsInt < min2 || optionAsInt > max2) || !validationRegex.test(option))
|
|
5702
|
+
return false;
|
|
5703
|
+
}
|
|
5704
|
+
return true;
|
|
5705
|
+
}
|
|
5706
|
+
function isInvalidSecond(expression) {
|
|
5707
|
+
return !isValidExpression(expression, 0, 59);
|
|
5708
|
+
}
|
|
5709
|
+
function isInvalidMinute(expression) {
|
|
5710
|
+
return !isValidExpression(expression, 0, 59);
|
|
5711
|
+
}
|
|
5712
|
+
function isInvalidHour(expression) {
|
|
5713
|
+
return !isValidExpression(expression, 0, 23);
|
|
5714
|
+
}
|
|
5715
|
+
function isInvalidDayOfMonth(expression) {
|
|
5716
|
+
return !isValidExpression(expression, 1, 31);
|
|
5717
|
+
}
|
|
5718
|
+
function isInvalidMonth(expression) {
|
|
5719
|
+
return !isValidExpression(expression, 1, 12);
|
|
5720
|
+
}
|
|
5721
|
+
function isInvalidWeekDay(expression) {
|
|
5722
|
+
return !isValidExpression(expression, 0, 7);
|
|
5723
|
+
}
|
|
5724
|
+
function validateFields(patterns, executablePatterns) {
|
|
5725
|
+
if (isInvalidSecond(executablePatterns[0]))
|
|
5726
|
+
throw new Error(`${patterns[0]} is a invalid expression for second`);
|
|
5727
|
+
if (isInvalidMinute(executablePatterns[1]))
|
|
5728
|
+
throw new Error(`${patterns[1]} is a invalid expression for minute`);
|
|
5729
|
+
if (isInvalidHour(executablePatterns[2]))
|
|
5730
|
+
throw new Error(`${patterns[2]} is a invalid expression for hour`);
|
|
5731
|
+
if (isInvalidDayOfMonth(executablePatterns[3]))
|
|
5732
|
+
throw new Error(`${patterns[3]} is a invalid expression for day of month`);
|
|
5733
|
+
if (isInvalidMonth(executablePatterns[4]))
|
|
5734
|
+
throw new Error(`${patterns[4]} is a invalid expression for month`);
|
|
5735
|
+
if (isInvalidWeekDay(executablePatterns[5]))
|
|
5736
|
+
throw new Error(`${patterns[5]} is a invalid expression for week day`);
|
|
5737
|
+
}
|
|
5738
|
+
function validate(pattern) {
|
|
5739
|
+
if (typeof pattern !== "string")
|
|
5740
|
+
throw new TypeError("pattern must be a string!");
|
|
5741
|
+
const patterns = pattern.split(" ");
|
|
5742
|
+
const executablePatterns = convertExpression(pattern).split(" ");
|
|
5743
|
+
if (patterns.length === 5)
|
|
5744
|
+
patterns.unshift("0");
|
|
5745
|
+
validateFields(patterns, executablePatterns);
|
|
5746
|
+
}
|
|
5747
|
+
module2.exports = validate;
|
|
5748
|
+
});
|
|
5749
|
+
|
|
5750
|
+
// ../../node_modules/node-cron/src/time-matcher.js
|
|
5751
|
+
var require_time_matcher = __commonJS((exports2, module2) => {
|
|
5752
|
+
var validatePattern = require_pattern_validation();
|
|
5753
|
+
var convertExpression = require_convert_expression();
|
|
5754
|
+
function matchPattern(pattern, value) {
|
|
5755
|
+
if (pattern.indexOf(",") !== -1) {
|
|
5756
|
+
const patterns = pattern.split(",");
|
|
5757
|
+
return patterns.indexOf(value.toString()) !== -1;
|
|
5758
|
+
}
|
|
5759
|
+
return pattern === value.toString();
|
|
5760
|
+
}
|
|
5761
|
+
|
|
5762
|
+
class TimeMatcher {
|
|
5763
|
+
constructor(pattern, timezone2) {
|
|
5764
|
+
validatePattern(pattern);
|
|
5765
|
+
this.pattern = convertExpression(pattern);
|
|
5766
|
+
this.timezone = timezone2;
|
|
5767
|
+
this.expressions = this.pattern.split(" ");
|
|
5768
|
+
this.dtf = this.timezone ? new Intl.DateTimeFormat("en-US", {
|
|
5769
|
+
year: "numeric",
|
|
5770
|
+
month: "2-digit",
|
|
5771
|
+
day: "2-digit",
|
|
5772
|
+
hour: "2-digit",
|
|
5773
|
+
minute: "2-digit",
|
|
5774
|
+
second: "2-digit",
|
|
5775
|
+
hourCycle: "h23",
|
|
5776
|
+
fractionalSecondDigits: 3,
|
|
5777
|
+
timeZone: this.timezone
|
|
5778
|
+
}) : null;
|
|
5779
|
+
}
|
|
5780
|
+
match(date) {
|
|
5781
|
+
date = this.apply(date);
|
|
5782
|
+
const runOnSecond = matchPattern(this.expressions[0], date.getSeconds());
|
|
5783
|
+
const runOnMinute = matchPattern(this.expressions[1], date.getMinutes());
|
|
5784
|
+
const runOnHour = matchPattern(this.expressions[2], date.getHours());
|
|
5785
|
+
const runOnDay = matchPattern(this.expressions[3], date.getDate());
|
|
5786
|
+
const runOnMonth = matchPattern(this.expressions[4], date.getMonth() + 1);
|
|
5787
|
+
const runOnWeekDay = matchPattern(this.expressions[5], date.getDay());
|
|
5788
|
+
return runOnSecond && runOnMinute && runOnHour && runOnDay && runOnMonth && runOnWeekDay;
|
|
5789
|
+
}
|
|
5790
|
+
apply(date) {
|
|
5791
|
+
if (this.dtf) {
|
|
5792
|
+
return new Date(this.dtf.format(date));
|
|
5793
|
+
}
|
|
5794
|
+
return date;
|
|
5795
|
+
}
|
|
5796
|
+
}
|
|
5797
|
+
module2.exports = TimeMatcher;
|
|
5798
|
+
});
|
|
5799
|
+
|
|
5800
|
+
// ../../node_modules/node-cron/src/scheduler.js
|
|
5801
|
+
var require_scheduler = __commonJS((exports2, module2) => {
|
|
5802
|
+
var EventEmitter = require("events");
|
|
5803
|
+
var TimeMatcher = require_time_matcher();
|
|
5804
|
+
|
|
5805
|
+
class Scheduler extends EventEmitter {
|
|
5806
|
+
constructor(pattern, timezone2, autorecover) {
|
|
5807
|
+
super();
|
|
5808
|
+
this.timeMatcher = new TimeMatcher(pattern, timezone2);
|
|
5809
|
+
this.autorecover = autorecover;
|
|
5810
|
+
}
|
|
5811
|
+
start() {
|
|
5812
|
+
this.stop();
|
|
5813
|
+
let lastCheck = process.hrtime();
|
|
5814
|
+
let lastExecution = this.timeMatcher.apply(new Date);
|
|
5815
|
+
const matchTime = () => {
|
|
5816
|
+
const delay2 = 1000;
|
|
5817
|
+
const elapsedTime = process.hrtime(lastCheck);
|
|
5818
|
+
const elapsedMs = (elapsedTime[0] * 1e9 + elapsedTime[1]) / 1e6;
|
|
5819
|
+
const missedExecutions = Math.floor(elapsedMs / 1000);
|
|
5820
|
+
for (let i = missedExecutions;i >= 0; i--) {
|
|
5821
|
+
const date = new Date(new Date().getTime() - i * 1000);
|
|
5822
|
+
let date_tmp = this.timeMatcher.apply(date);
|
|
5823
|
+
if (lastExecution.getTime() < date_tmp.getTime() && (i === 0 || this.autorecover) && this.timeMatcher.match(date)) {
|
|
5824
|
+
this.emit("scheduled-time-matched", date_tmp);
|
|
5825
|
+
date_tmp.setMilliseconds(0);
|
|
5826
|
+
lastExecution = date_tmp;
|
|
5827
|
+
}
|
|
5828
|
+
}
|
|
5829
|
+
lastCheck = process.hrtime();
|
|
5830
|
+
this.timeout = setTimeout(matchTime, delay2);
|
|
5831
|
+
};
|
|
5832
|
+
matchTime();
|
|
5833
|
+
}
|
|
5834
|
+
stop() {
|
|
5835
|
+
if (this.timeout) {
|
|
5836
|
+
clearTimeout(this.timeout);
|
|
5837
|
+
}
|
|
5838
|
+
this.timeout = null;
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
module2.exports = Scheduler;
|
|
5842
|
+
});
|
|
5843
|
+
|
|
5844
|
+
// ../../node_modules/uuid/dist/rng.js
|
|
5845
|
+
var require_rng = __commonJS((exports2) => {
|
|
5846
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5847
|
+
value: true
|
|
5848
|
+
});
|
|
5849
|
+
exports2.default = rng;
|
|
5850
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
5851
|
+
function _interopRequireDefault(obj) {
|
|
5852
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5853
|
+
}
|
|
5854
|
+
var rnds8Pool = new Uint8Array(256);
|
|
5855
|
+
var poolPtr = rnds8Pool.length;
|
|
5856
|
+
function rng() {
|
|
5857
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
5858
|
+
_crypto.default.randomFillSync(rnds8Pool);
|
|
5859
|
+
poolPtr = 0;
|
|
5860
|
+
}
|
|
5861
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
5862
|
+
}
|
|
5863
|
+
});
|
|
5864
|
+
|
|
5865
|
+
// ../../node_modules/uuid/dist/regex.js
|
|
5866
|
+
var require_regex = __commonJS((exports2) => {
|
|
5867
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5868
|
+
value: true
|
|
5869
|
+
});
|
|
5870
|
+
exports2.default = undefined;
|
|
5871
|
+
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
5872
|
+
exports2.default = _default;
|
|
5873
|
+
});
|
|
5874
|
+
|
|
5875
|
+
// ../../node_modules/uuid/dist/validate.js
|
|
5876
|
+
var require_validate = __commonJS((exports2) => {
|
|
5877
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5878
|
+
value: true
|
|
5879
|
+
});
|
|
5880
|
+
exports2.default = undefined;
|
|
5881
|
+
var _regex = _interopRequireDefault(require_regex());
|
|
5882
|
+
function _interopRequireDefault(obj) {
|
|
5883
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5884
|
+
}
|
|
5885
|
+
function validate(uuid) {
|
|
5886
|
+
return typeof uuid === "string" && _regex.default.test(uuid);
|
|
5887
|
+
}
|
|
5888
|
+
var _default = validate;
|
|
5889
|
+
exports2.default = _default;
|
|
5890
|
+
});
|
|
5891
|
+
|
|
5892
|
+
// ../../node_modules/uuid/dist/stringify.js
|
|
5893
|
+
var require_stringify = __commonJS((exports2) => {
|
|
5894
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5895
|
+
value: true
|
|
5896
|
+
});
|
|
5897
|
+
exports2.default = undefined;
|
|
5898
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
5899
|
+
function _interopRequireDefault(obj) {
|
|
5900
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5901
|
+
}
|
|
5902
|
+
var byteToHex = [];
|
|
5903
|
+
for (let i = 0;i < 256; ++i) {
|
|
5904
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
|
5905
|
+
}
|
|
5906
|
+
function stringify(arr, offset = 0) {
|
|
5907
|
+
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
5908
|
+
if (!(0, _validate.default)(uuid)) {
|
|
5909
|
+
throw TypeError("Stringified UUID is invalid");
|
|
5910
|
+
}
|
|
5911
|
+
return uuid;
|
|
5912
|
+
}
|
|
5913
|
+
var _default = stringify;
|
|
5914
|
+
exports2.default = _default;
|
|
5915
|
+
});
|
|
5916
|
+
|
|
5917
|
+
// ../../node_modules/uuid/dist/v1.js
|
|
5918
|
+
var require_v1 = __commonJS((exports2) => {
|
|
5919
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5920
|
+
value: true
|
|
5921
|
+
});
|
|
5922
|
+
exports2.default = undefined;
|
|
5923
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
5924
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
5925
|
+
function _interopRequireDefault(obj) {
|
|
5926
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5927
|
+
}
|
|
5928
|
+
var _nodeId;
|
|
5929
|
+
var _clockseq;
|
|
5930
|
+
var _lastMSecs = 0;
|
|
5931
|
+
var _lastNSecs = 0;
|
|
5932
|
+
function v1(options, buf, offset) {
|
|
5933
|
+
let i = buf && offset || 0;
|
|
5934
|
+
const b = buf || new Array(16);
|
|
5935
|
+
options = options || {};
|
|
5936
|
+
let node = options.node || _nodeId;
|
|
5937
|
+
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
5938
|
+
if (node == null || clockseq == null) {
|
|
5939
|
+
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
5940
|
+
if (node == null) {
|
|
5941
|
+
node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
5942
|
+
}
|
|
5943
|
+
if (clockseq == null) {
|
|
5944
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5947
|
+
let msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
|
5948
|
+
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
5949
|
+
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
|
|
5950
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
5951
|
+
clockseq = clockseq + 1 & 16383;
|
|
5952
|
+
}
|
|
5953
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
5954
|
+
nsecs = 0;
|
|
5955
|
+
}
|
|
5956
|
+
if (nsecs >= 1e4) {
|
|
5957
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
5958
|
+
}
|
|
5959
|
+
_lastMSecs = msecs;
|
|
5960
|
+
_lastNSecs = nsecs;
|
|
5961
|
+
_clockseq = clockseq;
|
|
5962
|
+
msecs += 12219292800000;
|
|
5963
|
+
const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
|
|
5964
|
+
b[i++] = tl >>> 24 & 255;
|
|
5965
|
+
b[i++] = tl >>> 16 & 255;
|
|
5966
|
+
b[i++] = tl >>> 8 & 255;
|
|
5967
|
+
b[i++] = tl & 255;
|
|
5968
|
+
const tmh = msecs / 4294967296 * 1e4 & 268435455;
|
|
5969
|
+
b[i++] = tmh >>> 8 & 255;
|
|
5970
|
+
b[i++] = tmh & 255;
|
|
5971
|
+
b[i++] = tmh >>> 24 & 15 | 16;
|
|
5972
|
+
b[i++] = tmh >>> 16 & 255;
|
|
5973
|
+
b[i++] = clockseq >>> 8 | 128;
|
|
5974
|
+
b[i++] = clockseq & 255;
|
|
5975
|
+
for (let n = 0;n < 6; ++n) {
|
|
5976
|
+
b[i + n] = node[n];
|
|
5977
|
+
}
|
|
5978
|
+
return buf || (0, _stringify.default)(b);
|
|
5979
|
+
}
|
|
5980
|
+
var _default = v1;
|
|
5981
|
+
exports2.default = _default;
|
|
5982
|
+
});
|
|
5983
|
+
|
|
5984
|
+
// ../../node_modules/uuid/dist/parse.js
|
|
5985
|
+
var require_parse = __commonJS((exports2) => {
|
|
5986
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
5987
|
+
value: true
|
|
5988
|
+
});
|
|
5989
|
+
exports2.default = undefined;
|
|
5990
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
5991
|
+
function _interopRequireDefault(obj) {
|
|
5992
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5993
|
+
}
|
|
5994
|
+
function parse(uuid) {
|
|
5995
|
+
if (!(0, _validate.default)(uuid)) {
|
|
5996
|
+
throw TypeError("Invalid UUID");
|
|
5997
|
+
}
|
|
5998
|
+
let v;
|
|
5999
|
+
const arr = new Uint8Array(16);
|
|
6000
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
6001
|
+
arr[1] = v >>> 16 & 255;
|
|
6002
|
+
arr[2] = v >>> 8 & 255;
|
|
6003
|
+
arr[3] = v & 255;
|
|
6004
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
6005
|
+
arr[5] = v & 255;
|
|
6006
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
6007
|
+
arr[7] = v & 255;
|
|
6008
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
6009
|
+
arr[9] = v & 255;
|
|
6010
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
|
|
6011
|
+
arr[11] = v / 4294967296 & 255;
|
|
6012
|
+
arr[12] = v >>> 24 & 255;
|
|
6013
|
+
arr[13] = v >>> 16 & 255;
|
|
6014
|
+
arr[14] = v >>> 8 & 255;
|
|
6015
|
+
arr[15] = v & 255;
|
|
6016
|
+
return arr;
|
|
6017
|
+
}
|
|
6018
|
+
var _default = parse;
|
|
6019
|
+
exports2.default = _default;
|
|
6020
|
+
});
|
|
6021
|
+
|
|
6022
|
+
// ../../node_modules/uuid/dist/v35.js
|
|
6023
|
+
var require_v35 = __commonJS((exports2) => {
|
|
6024
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6025
|
+
value: true
|
|
6026
|
+
});
|
|
6027
|
+
exports2.default = _default;
|
|
6028
|
+
exports2.URL = exports2.DNS = undefined;
|
|
6029
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6030
|
+
var _parse = _interopRequireDefault(require_parse());
|
|
6031
|
+
function _interopRequireDefault(obj) {
|
|
6032
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6033
|
+
}
|
|
6034
|
+
function stringToBytes(str) {
|
|
6035
|
+
str = unescape(encodeURIComponent(str));
|
|
6036
|
+
const bytes = [];
|
|
6037
|
+
for (let i = 0;i < str.length; ++i) {
|
|
6038
|
+
bytes.push(str.charCodeAt(i));
|
|
6039
|
+
}
|
|
6040
|
+
return bytes;
|
|
6041
|
+
}
|
|
6042
|
+
var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
6043
|
+
exports2.DNS = DNS;
|
|
6044
|
+
var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
6045
|
+
exports2.URL = URL2;
|
|
6046
|
+
function _default(name, version, hashfunc) {
|
|
6047
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
6048
|
+
if (typeof value === "string") {
|
|
6049
|
+
value = stringToBytes(value);
|
|
6050
|
+
}
|
|
6051
|
+
if (typeof namespace === "string") {
|
|
6052
|
+
namespace = (0, _parse.default)(namespace);
|
|
6053
|
+
}
|
|
6054
|
+
if (namespace.length !== 16) {
|
|
6055
|
+
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
6056
|
+
}
|
|
6057
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
6058
|
+
bytes.set(namespace);
|
|
6059
|
+
bytes.set(value, namespace.length);
|
|
6060
|
+
bytes = hashfunc(bytes);
|
|
6061
|
+
bytes[6] = bytes[6] & 15 | version;
|
|
6062
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
6063
|
+
if (buf) {
|
|
6064
|
+
offset = offset || 0;
|
|
6065
|
+
for (let i = 0;i < 16; ++i) {
|
|
6066
|
+
buf[offset + i] = bytes[i];
|
|
6067
|
+
}
|
|
6068
|
+
return buf;
|
|
6069
|
+
}
|
|
6070
|
+
return (0, _stringify.default)(bytes);
|
|
6071
|
+
}
|
|
6072
|
+
try {
|
|
6073
|
+
generateUUID.name = name;
|
|
6074
|
+
} catch (err) {}
|
|
6075
|
+
generateUUID.DNS = DNS;
|
|
6076
|
+
generateUUID.URL = URL2;
|
|
6077
|
+
return generateUUID;
|
|
6078
|
+
}
|
|
6079
|
+
});
|
|
6080
|
+
|
|
6081
|
+
// ../../node_modules/uuid/dist/md5.js
|
|
6082
|
+
var require_md5 = __commonJS((exports2) => {
|
|
6083
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6084
|
+
value: true
|
|
6085
|
+
});
|
|
6086
|
+
exports2.default = undefined;
|
|
6087
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
6088
|
+
function _interopRequireDefault(obj) {
|
|
6089
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6090
|
+
}
|
|
6091
|
+
function md5(bytes) {
|
|
6092
|
+
if (Array.isArray(bytes)) {
|
|
6093
|
+
bytes = Buffer.from(bytes);
|
|
6094
|
+
} else if (typeof bytes === "string") {
|
|
6095
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
6096
|
+
}
|
|
6097
|
+
return _crypto.default.createHash("md5").update(bytes).digest();
|
|
6098
|
+
}
|
|
6099
|
+
var _default = md5;
|
|
6100
|
+
exports2.default = _default;
|
|
6101
|
+
});
|
|
6102
|
+
|
|
6103
|
+
// ../../node_modules/uuid/dist/v3.js
|
|
6104
|
+
var require_v3 = __commonJS((exports2) => {
|
|
6105
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6106
|
+
value: true
|
|
6107
|
+
});
|
|
6108
|
+
exports2.default = undefined;
|
|
6109
|
+
var _v = _interopRequireDefault(require_v35());
|
|
6110
|
+
var _md = _interopRequireDefault(require_md5());
|
|
6111
|
+
function _interopRequireDefault(obj) {
|
|
6112
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6113
|
+
}
|
|
6114
|
+
var v3 = (0, _v.default)("v3", 48, _md.default);
|
|
6115
|
+
var _default = v3;
|
|
6116
|
+
exports2.default = _default;
|
|
6117
|
+
});
|
|
6118
|
+
|
|
6119
|
+
// ../../node_modules/uuid/dist/v4.js
|
|
6120
|
+
var require_v4 = __commonJS((exports2) => {
|
|
6121
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6122
|
+
value: true
|
|
6123
|
+
});
|
|
6124
|
+
exports2.default = undefined;
|
|
6125
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
6126
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6127
|
+
function _interopRequireDefault(obj) {
|
|
6128
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6129
|
+
}
|
|
6130
|
+
function v4(options, buf, offset) {
|
|
6131
|
+
options = options || {};
|
|
6132
|
+
const rnds = options.random || (options.rng || _rng.default)();
|
|
6133
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
6134
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
6135
|
+
if (buf) {
|
|
6136
|
+
offset = offset || 0;
|
|
6137
|
+
for (let i = 0;i < 16; ++i) {
|
|
6138
|
+
buf[offset + i] = rnds[i];
|
|
6139
|
+
}
|
|
6140
|
+
return buf;
|
|
6141
|
+
}
|
|
6142
|
+
return (0, _stringify.default)(rnds);
|
|
6143
|
+
}
|
|
6144
|
+
var _default = v4;
|
|
6145
|
+
exports2.default = _default;
|
|
6146
|
+
});
|
|
6147
|
+
|
|
6148
|
+
// ../../node_modules/uuid/dist/sha1.js
|
|
6149
|
+
var require_sha1 = __commonJS((exports2) => {
|
|
6150
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6151
|
+
value: true
|
|
6152
|
+
});
|
|
6153
|
+
exports2.default = undefined;
|
|
6154
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
6155
|
+
function _interopRequireDefault(obj) {
|
|
6156
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6157
|
+
}
|
|
6158
|
+
function sha1(bytes) {
|
|
6159
|
+
if (Array.isArray(bytes)) {
|
|
6160
|
+
bytes = Buffer.from(bytes);
|
|
6161
|
+
} else if (typeof bytes === "string") {
|
|
6162
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
6163
|
+
}
|
|
6164
|
+
return _crypto.default.createHash("sha1").update(bytes).digest();
|
|
6165
|
+
}
|
|
6166
|
+
var _default = sha1;
|
|
6167
|
+
exports2.default = _default;
|
|
6168
|
+
});
|
|
6169
|
+
|
|
6170
|
+
// ../../node_modules/uuid/dist/v5.js
|
|
6171
|
+
var require_v5 = __commonJS((exports2) => {
|
|
6172
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6173
|
+
value: true
|
|
6174
|
+
});
|
|
6175
|
+
exports2.default = undefined;
|
|
6176
|
+
var _v = _interopRequireDefault(require_v35());
|
|
6177
|
+
var _sha = _interopRequireDefault(require_sha1());
|
|
6178
|
+
function _interopRequireDefault(obj) {
|
|
6179
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6180
|
+
}
|
|
6181
|
+
var v5 = (0, _v.default)("v5", 80, _sha.default);
|
|
6182
|
+
var _default = v5;
|
|
6183
|
+
exports2.default = _default;
|
|
6184
|
+
});
|
|
6185
|
+
|
|
6186
|
+
// ../../node_modules/uuid/dist/nil.js
|
|
6187
|
+
var require_nil = __commonJS((exports2) => {
|
|
6188
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6189
|
+
value: true
|
|
6190
|
+
});
|
|
6191
|
+
exports2.default = undefined;
|
|
6192
|
+
var _default = "00000000-0000-0000-0000-000000000000";
|
|
6193
|
+
exports2.default = _default;
|
|
6194
|
+
});
|
|
6195
|
+
|
|
6196
|
+
// ../../node_modules/uuid/dist/version.js
|
|
6197
|
+
var require_version = __commonJS((exports2) => {
|
|
6198
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6199
|
+
value: true
|
|
6200
|
+
});
|
|
6201
|
+
exports2.default = undefined;
|
|
6202
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
6203
|
+
function _interopRequireDefault(obj) {
|
|
6204
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6205
|
+
}
|
|
6206
|
+
function version(uuid) {
|
|
6207
|
+
if (!(0, _validate.default)(uuid)) {
|
|
6208
|
+
throw TypeError("Invalid UUID");
|
|
6209
|
+
}
|
|
6210
|
+
return parseInt(uuid.substr(14, 1), 16);
|
|
6211
|
+
}
|
|
6212
|
+
var _default = version;
|
|
6213
|
+
exports2.default = _default;
|
|
6214
|
+
});
|
|
6215
|
+
|
|
6216
|
+
// ../../node_modules/uuid/dist/index.js
|
|
6217
|
+
var require_dist = __commonJS((exports2) => {
|
|
6218
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
6219
|
+
value: true
|
|
6220
|
+
});
|
|
6221
|
+
Object.defineProperty(exports2, "v1", {
|
|
6222
|
+
enumerable: true,
|
|
6223
|
+
get: function() {
|
|
6224
|
+
return _v.default;
|
|
6225
|
+
}
|
|
6226
|
+
});
|
|
6227
|
+
Object.defineProperty(exports2, "v3", {
|
|
6228
|
+
enumerable: true,
|
|
6229
|
+
get: function() {
|
|
6230
|
+
return _v2.default;
|
|
6231
|
+
}
|
|
6232
|
+
});
|
|
6233
|
+
Object.defineProperty(exports2, "v4", {
|
|
6234
|
+
enumerable: true,
|
|
6235
|
+
get: function() {
|
|
6236
|
+
return _v3.default;
|
|
6237
|
+
}
|
|
6238
|
+
});
|
|
6239
|
+
Object.defineProperty(exports2, "v5", {
|
|
6240
|
+
enumerable: true,
|
|
6241
|
+
get: function() {
|
|
6242
|
+
return _v4.default;
|
|
6243
|
+
}
|
|
6244
|
+
});
|
|
6245
|
+
Object.defineProperty(exports2, "NIL", {
|
|
6246
|
+
enumerable: true,
|
|
6247
|
+
get: function() {
|
|
6248
|
+
return _nil.default;
|
|
6249
|
+
}
|
|
6250
|
+
});
|
|
6251
|
+
Object.defineProperty(exports2, "version", {
|
|
6252
|
+
enumerable: true,
|
|
6253
|
+
get: function() {
|
|
6254
|
+
return _version.default;
|
|
6255
|
+
}
|
|
6256
|
+
});
|
|
6257
|
+
Object.defineProperty(exports2, "validate", {
|
|
6258
|
+
enumerable: true,
|
|
6259
|
+
get: function() {
|
|
6260
|
+
return _validate.default;
|
|
6261
|
+
}
|
|
6262
|
+
});
|
|
6263
|
+
Object.defineProperty(exports2, "stringify", {
|
|
6264
|
+
enumerable: true,
|
|
6265
|
+
get: function() {
|
|
6266
|
+
return _stringify.default;
|
|
6267
|
+
}
|
|
6268
|
+
});
|
|
6269
|
+
Object.defineProperty(exports2, "parse", {
|
|
6270
|
+
enumerable: true,
|
|
6271
|
+
get: function() {
|
|
6272
|
+
return _parse.default;
|
|
6273
|
+
}
|
|
6274
|
+
});
|
|
6275
|
+
var _v = _interopRequireDefault(require_v1());
|
|
6276
|
+
var _v2 = _interopRequireDefault(require_v3());
|
|
6277
|
+
var _v3 = _interopRequireDefault(require_v4());
|
|
6278
|
+
var _v4 = _interopRequireDefault(require_v5());
|
|
6279
|
+
var _nil = _interopRequireDefault(require_nil());
|
|
6280
|
+
var _version = _interopRequireDefault(require_version());
|
|
6281
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
6282
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6283
|
+
var _parse = _interopRequireDefault(require_parse());
|
|
6284
|
+
function _interopRequireDefault(obj) {
|
|
6285
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6286
|
+
}
|
|
6287
|
+
});
|
|
6288
|
+
|
|
6289
|
+
// ../../node_modules/node-cron/src/scheduled-task.js
|
|
6290
|
+
var require_scheduled_task = __commonJS((exports2, module2) => {
|
|
6291
|
+
var EventEmitter = require("events");
|
|
6292
|
+
var Task = require_task();
|
|
6293
|
+
var Scheduler = require_scheduler();
|
|
6294
|
+
var uuid = require_dist();
|
|
6295
|
+
|
|
6296
|
+
class ScheduledTask extends EventEmitter {
|
|
6297
|
+
constructor(cronExpression, func, options) {
|
|
6298
|
+
super();
|
|
6299
|
+
if (!options) {
|
|
6300
|
+
options = {
|
|
6301
|
+
scheduled: true,
|
|
6302
|
+
recoverMissedExecutions: false
|
|
6303
|
+
};
|
|
6304
|
+
}
|
|
6305
|
+
this.options = options;
|
|
6306
|
+
this.options.name = this.options.name || uuid.v4();
|
|
6307
|
+
this._task = new Task(func);
|
|
6308
|
+
this._scheduler = new Scheduler(cronExpression, options.timezone, options.recoverMissedExecutions);
|
|
6309
|
+
this._scheduler.on("scheduled-time-matched", (now) => {
|
|
6310
|
+
this.now(now);
|
|
6311
|
+
});
|
|
6312
|
+
if (options.scheduled !== false) {
|
|
6313
|
+
this._scheduler.start();
|
|
6314
|
+
}
|
|
6315
|
+
if (options.runOnInit === true) {
|
|
6316
|
+
this.now("init");
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
now(now = "manual") {
|
|
6320
|
+
let result = this._task.execute(now);
|
|
6321
|
+
this.emit("task-done", result);
|
|
6322
|
+
}
|
|
6323
|
+
start() {
|
|
6324
|
+
this._scheduler.start();
|
|
6325
|
+
}
|
|
6326
|
+
stop() {
|
|
6327
|
+
this._scheduler.stop();
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
module2.exports = ScheduledTask;
|
|
6331
|
+
});
|
|
6332
|
+
|
|
6333
|
+
// ../../node_modules/node-cron/src/background-scheduled-task/index.js
|
|
6334
|
+
var require_background_scheduled_task = __commonJS((exports2, module2) => {
|
|
6335
|
+
var __dirname = "/Users/wangzhenyu/Code/work/node_modules/node-cron/src/background-scheduled-task";
|
|
6336
|
+
var EventEmitter = require("events");
|
|
6337
|
+
var path3 = require("path");
|
|
6338
|
+
var { fork } = require("child_process");
|
|
6339
|
+
var uuid = require_dist();
|
|
6340
|
+
var daemonPath = `${__dirname}/daemon.js`;
|
|
6341
|
+
|
|
6342
|
+
class BackgroundScheduledTask extends EventEmitter {
|
|
6343
|
+
constructor(cronExpression, taskPath, options) {
|
|
6344
|
+
super();
|
|
6345
|
+
if (!options) {
|
|
6346
|
+
options = {
|
|
6347
|
+
scheduled: true,
|
|
6348
|
+
recoverMissedExecutions: false
|
|
6349
|
+
};
|
|
6350
|
+
}
|
|
6351
|
+
this.cronExpression = cronExpression;
|
|
6352
|
+
this.taskPath = taskPath;
|
|
6353
|
+
this.options = options;
|
|
6354
|
+
this.options.name = this.options.name || uuid.v4();
|
|
6355
|
+
if (options.scheduled) {
|
|
6356
|
+
this.start();
|
|
6357
|
+
}
|
|
6358
|
+
}
|
|
6359
|
+
start() {
|
|
6360
|
+
this.stop();
|
|
6361
|
+
this.forkProcess = fork(daemonPath);
|
|
6362
|
+
this.forkProcess.on("message", (message) => {
|
|
6363
|
+
switch (message.type) {
|
|
6364
|
+
case "task-done":
|
|
6365
|
+
this.emit("task-done", message.result);
|
|
6366
|
+
break;
|
|
6367
|
+
}
|
|
6368
|
+
});
|
|
6369
|
+
let options = this.options;
|
|
6370
|
+
options.scheduled = true;
|
|
6371
|
+
this.forkProcess.send({
|
|
6372
|
+
type: "register",
|
|
6373
|
+
path: path3.resolve(this.taskPath),
|
|
6374
|
+
cron: this.cronExpression,
|
|
6375
|
+
options
|
|
6376
|
+
});
|
|
6377
|
+
}
|
|
6378
|
+
stop() {
|
|
6379
|
+
if (this.forkProcess) {
|
|
6380
|
+
this.forkProcess.kill();
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
pid() {
|
|
6384
|
+
if (this.forkProcess) {
|
|
6385
|
+
return this.forkProcess.pid;
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6388
|
+
isRunning() {
|
|
6389
|
+
return !this.forkProcess.killed;
|
|
6390
|
+
}
|
|
6391
|
+
}
|
|
6392
|
+
module2.exports = BackgroundScheduledTask;
|
|
6393
|
+
});
|
|
6394
|
+
|
|
6395
|
+
// ../../node_modules/node-cron/src/storage.js
|
|
6396
|
+
var require_storage = __commonJS((exports2, module2) => {
|
|
6397
|
+
module2.exports = (() => {
|
|
6398
|
+
if (!global.scheduledTasks) {
|
|
6399
|
+
global.scheduledTasks = new Map;
|
|
6400
|
+
}
|
|
6401
|
+
return {
|
|
6402
|
+
save: (task) => {
|
|
6403
|
+
if (!task.options) {
|
|
6404
|
+
const uuid = require_dist();
|
|
6405
|
+
task.options = {};
|
|
6406
|
+
task.options.name = uuid.v4();
|
|
6407
|
+
}
|
|
6408
|
+
global.scheduledTasks.set(task.options.name, task);
|
|
6409
|
+
},
|
|
6410
|
+
getTasks: () => {
|
|
6411
|
+
return global.scheduledTasks;
|
|
6412
|
+
}
|
|
6413
|
+
};
|
|
6414
|
+
})();
|
|
6415
|
+
});
|
|
6416
|
+
|
|
6417
|
+
// ../../node_modules/node-cron/src/node-cron.js
|
|
6418
|
+
var require_node_cron = __commonJS((exports2, module2) => {
|
|
6419
|
+
var ScheduledTask = require_scheduled_task();
|
|
6420
|
+
var BackgroundScheduledTask = require_background_scheduled_task();
|
|
6421
|
+
var validation = require_pattern_validation();
|
|
6422
|
+
var storage = require_storage();
|
|
6423
|
+
function schedule(expression, func, options) {
|
|
6424
|
+
const task = createTask(expression, func, options);
|
|
6425
|
+
storage.save(task);
|
|
6426
|
+
return task;
|
|
6427
|
+
}
|
|
6428
|
+
function createTask(expression, func, options) {
|
|
6429
|
+
if (typeof func === "string")
|
|
6430
|
+
return new BackgroundScheduledTask(expression, func, options);
|
|
6431
|
+
return new ScheduledTask(expression, func, options);
|
|
6432
|
+
}
|
|
6433
|
+
function validate(expression) {
|
|
6434
|
+
try {
|
|
6435
|
+
validation(expression);
|
|
6436
|
+
return true;
|
|
6437
|
+
} catch (_) {
|
|
6438
|
+
return false;
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
function getTasks() {
|
|
6442
|
+
return storage.getTasks();
|
|
6443
|
+
}
|
|
6444
|
+
module2.exports = { schedule, validate, getTasks };
|
|
6445
|
+
});
|
|
6446
|
+
|
|
5459
6447
|
// src/node.ts
|
|
5460
6448
|
var exports_node = {};
|
|
5461
6449
|
__export(exports_node, {
|
|
5462
|
-
z: () =>
|
|
6450
|
+
z: () => exports_external,
|
|
5463
6451
|
watch: () => watch,
|
|
5464
6452
|
void: () => voidType,
|
|
5465
6453
|
util: () => util,
|
|
@@ -5477,6 +6465,7 @@ __export(exports_node, {
|
|
|
5477
6465
|
setErrorMap: () => setErrorMap,
|
|
5478
6466
|
set: () => setType,
|
|
5479
6467
|
sendMail: () => sendMail,
|
|
6468
|
+
schedule: () => schedule,
|
|
5480
6469
|
replaceContentInFile: () => replaceContentInFile,
|
|
5481
6470
|
replaceByVariables: () => replaceByVariables,
|
|
5482
6471
|
replaceByRules: () => replaceByRules,
|
|
@@ -5518,6 +6507,7 @@ __export(exports_node, {
|
|
|
5518
6507
|
isDirty: () => isDirty,
|
|
5519
6508
|
isAsync: () => isAsync,
|
|
5520
6509
|
isAborted: () => isAborted,
|
|
6510
|
+
interval: () => interval,
|
|
5521
6511
|
intersection: () => intersectionType,
|
|
5522
6512
|
instanceof: () => instanceOfType,
|
|
5523
6513
|
initChinaDayjs: () => initChinaDayjs,
|
|
@@ -5547,7 +6537,7 @@ __export(exports_node, {
|
|
|
5547
6537
|
downloadFile: () => downloadFile,
|
|
5548
6538
|
discriminatedUnion: () => discriminatedUnionType,
|
|
5549
6539
|
delay: () => delay,
|
|
5550
|
-
defaultErrorMap: () =>
|
|
6540
|
+
defaultErrorMap: () => en_default,
|
|
5551
6541
|
dayjs: () => dayjs_default,
|
|
5552
6542
|
datetimeRegex: () => datetimeRegex,
|
|
5553
6543
|
date: () => dateType,
|
|
@@ -5631,10 +6621,122 @@ var import_axios2 = __toESM(require("axios"));
|
|
|
5631
6621
|
var import_json5 = __toESM(require("json5"));
|
|
5632
6622
|
var import_consola = __toESM(require("consola"));
|
|
5633
6623
|
|
|
5634
|
-
// ../../node_modules/zod/
|
|
6624
|
+
// ../../node_modules/zod/v3/external.js
|
|
6625
|
+
var exports_external = {};
|
|
6626
|
+
__export(exports_external, {
|
|
6627
|
+
void: () => voidType,
|
|
6628
|
+
util: () => util,
|
|
6629
|
+
unknown: () => unknownType,
|
|
6630
|
+
union: () => unionType,
|
|
6631
|
+
undefined: () => undefinedType,
|
|
6632
|
+
tuple: () => tupleType,
|
|
6633
|
+
transformer: () => effectsType,
|
|
6634
|
+
symbol: () => symbolType,
|
|
6635
|
+
string: () => stringType,
|
|
6636
|
+
strictObject: () => strictObjectType,
|
|
6637
|
+
setErrorMap: () => setErrorMap,
|
|
6638
|
+
set: () => setType,
|
|
6639
|
+
record: () => recordType,
|
|
6640
|
+
quotelessJson: () => quotelessJson,
|
|
6641
|
+
promise: () => promiseType,
|
|
6642
|
+
preprocess: () => preprocessType,
|
|
6643
|
+
pipeline: () => pipelineType,
|
|
6644
|
+
ostring: () => ostring,
|
|
6645
|
+
optional: () => optionalType,
|
|
6646
|
+
onumber: () => onumber,
|
|
6647
|
+
oboolean: () => oboolean,
|
|
6648
|
+
objectUtil: () => objectUtil,
|
|
6649
|
+
object: () => objectType,
|
|
6650
|
+
number: () => numberType,
|
|
6651
|
+
nullable: () => nullableType,
|
|
6652
|
+
null: () => nullType,
|
|
6653
|
+
never: () => neverType,
|
|
6654
|
+
nativeEnum: () => nativeEnumType,
|
|
6655
|
+
nan: () => nanType,
|
|
6656
|
+
map: () => mapType,
|
|
6657
|
+
makeIssue: () => makeIssue,
|
|
6658
|
+
literal: () => literalType,
|
|
6659
|
+
lazy: () => lazyType,
|
|
6660
|
+
late: () => late,
|
|
6661
|
+
isValid: () => isValid,
|
|
6662
|
+
isDirty: () => isDirty,
|
|
6663
|
+
isAsync: () => isAsync,
|
|
6664
|
+
isAborted: () => isAborted,
|
|
6665
|
+
intersection: () => intersectionType,
|
|
6666
|
+
instanceof: () => instanceOfType,
|
|
6667
|
+
getParsedType: () => getParsedType,
|
|
6668
|
+
getErrorMap: () => getErrorMap,
|
|
6669
|
+
function: () => functionType,
|
|
6670
|
+
enum: () => enumType,
|
|
6671
|
+
effect: () => effectsType,
|
|
6672
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
6673
|
+
defaultErrorMap: () => en_default,
|
|
6674
|
+
datetimeRegex: () => datetimeRegex,
|
|
6675
|
+
date: () => dateType,
|
|
6676
|
+
custom: () => custom,
|
|
6677
|
+
coerce: () => coerce,
|
|
6678
|
+
boolean: () => booleanType,
|
|
6679
|
+
bigint: () => bigIntType,
|
|
6680
|
+
array: () => arrayType,
|
|
6681
|
+
any: () => anyType,
|
|
6682
|
+
addIssueToContext: () => addIssueToContext,
|
|
6683
|
+
ZodVoid: () => ZodVoid,
|
|
6684
|
+
ZodUnknown: () => ZodUnknown,
|
|
6685
|
+
ZodUnion: () => ZodUnion,
|
|
6686
|
+
ZodUndefined: () => ZodUndefined,
|
|
6687
|
+
ZodType: () => ZodType,
|
|
6688
|
+
ZodTuple: () => ZodTuple,
|
|
6689
|
+
ZodTransformer: () => ZodEffects,
|
|
6690
|
+
ZodSymbol: () => ZodSymbol,
|
|
6691
|
+
ZodString: () => ZodString,
|
|
6692
|
+
ZodSet: () => ZodSet,
|
|
6693
|
+
ZodSchema: () => ZodType,
|
|
6694
|
+
ZodRecord: () => ZodRecord,
|
|
6695
|
+
ZodReadonly: () => ZodReadonly,
|
|
6696
|
+
ZodPromise: () => ZodPromise,
|
|
6697
|
+
ZodPipeline: () => ZodPipeline,
|
|
6698
|
+
ZodParsedType: () => ZodParsedType,
|
|
6699
|
+
ZodOptional: () => ZodOptional,
|
|
6700
|
+
ZodObject: () => ZodObject,
|
|
6701
|
+
ZodNumber: () => ZodNumber,
|
|
6702
|
+
ZodNullable: () => ZodNullable,
|
|
6703
|
+
ZodNull: () => ZodNull,
|
|
6704
|
+
ZodNever: () => ZodNever,
|
|
6705
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
6706
|
+
ZodNaN: () => ZodNaN,
|
|
6707
|
+
ZodMap: () => ZodMap,
|
|
6708
|
+
ZodLiteral: () => ZodLiteral,
|
|
6709
|
+
ZodLazy: () => ZodLazy,
|
|
6710
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
6711
|
+
ZodIntersection: () => ZodIntersection,
|
|
6712
|
+
ZodFunction: () => ZodFunction,
|
|
6713
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
6714
|
+
ZodError: () => ZodError,
|
|
6715
|
+
ZodEnum: () => ZodEnum,
|
|
6716
|
+
ZodEffects: () => ZodEffects,
|
|
6717
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
6718
|
+
ZodDefault: () => ZodDefault,
|
|
6719
|
+
ZodDate: () => ZodDate,
|
|
6720
|
+
ZodCatch: () => ZodCatch,
|
|
6721
|
+
ZodBranded: () => ZodBranded,
|
|
6722
|
+
ZodBoolean: () => ZodBoolean,
|
|
6723
|
+
ZodBigInt: () => ZodBigInt,
|
|
6724
|
+
ZodArray: () => ZodArray,
|
|
6725
|
+
ZodAny: () => ZodAny,
|
|
6726
|
+
Schema: () => ZodType,
|
|
6727
|
+
ParseStatus: () => ParseStatus,
|
|
6728
|
+
OK: () => OK,
|
|
6729
|
+
NEVER: () => NEVER,
|
|
6730
|
+
INVALID: () => INVALID,
|
|
6731
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
6732
|
+
DIRTY: () => DIRTY,
|
|
6733
|
+
BRAND: () => BRAND
|
|
6734
|
+
});
|
|
6735
|
+
|
|
6736
|
+
// ../../node_modules/zod/v3/helpers/util.js
|
|
5635
6737
|
var util;
|
|
5636
6738
|
(function(util2) {
|
|
5637
|
-
util2.assertEqual = (
|
|
6739
|
+
util2.assertEqual = (_) => {};
|
|
5638
6740
|
function assertIs(_arg) {}
|
|
5639
6741
|
util2.assertIs = assertIs;
|
|
5640
6742
|
function assertNever(_x) {
|
|
@@ -5677,7 +6779,7 @@ var util;
|
|
|
5677
6779
|
}
|
|
5678
6780
|
return;
|
|
5679
6781
|
};
|
|
5680
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
6782
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
5681
6783
|
function joinValues(array, separator = " | ") {
|
|
5682
6784
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
5683
6785
|
}
|
|
@@ -5728,7 +6830,7 @@ var getParsedType = (data) => {
|
|
|
5728
6830
|
case "string":
|
|
5729
6831
|
return ZodParsedType.string;
|
|
5730
6832
|
case "number":
|
|
5731
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
6833
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
5732
6834
|
case "boolean":
|
|
5733
6835
|
return ZodParsedType.boolean;
|
|
5734
6836
|
case "function":
|
|
@@ -5761,6 +6863,8 @@ var getParsedType = (data) => {
|
|
|
5761
6863
|
return ZodParsedType.unknown;
|
|
5762
6864
|
}
|
|
5763
6865
|
};
|
|
6866
|
+
|
|
6867
|
+
// ../../node_modules/zod/v3/ZodError.js
|
|
5764
6868
|
var ZodIssueCode = util.arrayToEnum([
|
|
5765
6869
|
"invalid_type",
|
|
5766
6870
|
"invalid_literal",
|
|
@@ -5861,8 +6965,9 @@ class ZodError extends Error {
|
|
|
5861
6965
|
const formErrors = [];
|
|
5862
6966
|
for (const sub of this.issues) {
|
|
5863
6967
|
if (sub.path.length > 0) {
|
|
5864
|
-
|
|
5865
|
-
fieldErrors[
|
|
6968
|
+
const firstEl = sub.path[0];
|
|
6969
|
+
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
6970
|
+
fieldErrors[firstEl].push(mapper(sub));
|
|
5866
6971
|
} else {
|
|
5867
6972
|
formErrors.push(mapper(sub));
|
|
5868
6973
|
}
|
|
@@ -5877,6 +6982,8 @@ ZodError.create = (issues) => {
|
|
|
5877
6982
|
const error = new ZodError(issues);
|
|
5878
6983
|
return error;
|
|
5879
6984
|
};
|
|
6985
|
+
|
|
6986
|
+
// ../../node_modules/zod/v3/locales/en.js
|
|
5880
6987
|
var errorMap = (issue, _ctx) => {
|
|
5881
6988
|
let message;
|
|
5882
6989
|
switch (issue.code) {
|
|
@@ -5938,6 +7045,8 @@ var errorMap = (issue, _ctx) => {
|
|
|
5938
7045
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
5939
7046
|
else if (issue.type === "number")
|
|
5940
7047
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
7048
|
+
else if (issue.type === "bigint")
|
|
7049
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
5941
7050
|
else if (issue.type === "date")
|
|
5942
7051
|
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
5943
7052
|
else
|
|
@@ -5975,13 +7084,17 @@ var errorMap = (issue, _ctx) => {
|
|
|
5975
7084
|
}
|
|
5976
7085
|
return { message };
|
|
5977
7086
|
};
|
|
5978
|
-
var
|
|
7087
|
+
var en_default = errorMap;
|
|
7088
|
+
|
|
7089
|
+
// ../../node_modules/zod/v3/errors.js
|
|
7090
|
+
var overrideErrorMap = en_default;
|
|
5979
7091
|
function setErrorMap(map) {
|
|
5980
7092
|
overrideErrorMap = map;
|
|
5981
7093
|
}
|
|
5982
7094
|
function getErrorMap() {
|
|
5983
7095
|
return overrideErrorMap;
|
|
5984
7096
|
}
|
|
7097
|
+
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
5985
7098
|
var makeIssue = (params) => {
|
|
5986
7099
|
const { data, path, errorMaps, issueData } = params;
|
|
5987
7100
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -6018,7 +7131,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
6018
7131
|
ctx.common.contextualErrorMap,
|
|
6019
7132
|
ctx.schemaErrorMap,
|
|
6020
7133
|
overrideMap,
|
|
6021
|
-
overrideMap ===
|
|
7134
|
+
overrideMap === en_default ? undefined : en_default
|
|
6022
7135
|
].filter((x) => !!x)
|
|
6023
7136
|
});
|
|
6024
7137
|
ctx.common.issues.push(issue);
|
|
@@ -6087,30 +7200,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
6087
7200
|
var isDirty = (x) => x.status === "dirty";
|
|
6088
7201
|
var isValid = (x) => x.status === "valid";
|
|
6089
7202
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
6090
|
-
|
|
6091
|
-
if (kind === "a" && !f)
|
|
6092
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
6093
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
6094
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6095
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6096
|
-
}
|
|
6097
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
6098
|
-
if (kind === "m")
|
|
6099
|
-
throw new TypeError("Private method is not writable");
|
|
6100
|
-
if (kind === "a" && !f)
|
|
6101
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
6102
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
6103
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6104
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
6105
|
-
}
|
|
7203
|
+
// ../../node_modules/zod/v3/helpers/errorUtil.js
|
|
6106
7204
|
var errorUtil;
|
|
6107
7205
|
(function(errorUtil2) {
|
|
6108
7206
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
6109
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
|
7207
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
6110
7208
|
})(errorUtil || (errorUtil = {}));
|
|
6111
|
-
var _ZodEnum_cache;
|
|
6112
|
-
var _ZodNativeEnum_cache;
|
|
6113
7209
|
|
|
7210
|
+
// ../../node_modules/zod/v3/types.js
|
|
6114
7211
|
class ParseInputLazyPath {
|
|
6115
7212
|
constructor(parent, value, path, key) {
|
|
6116
7213
|
this._cachedPath = [];
|
|
@@ -6121,7 +7218,7 @@ class ParseInputLazyPath {
|
|
|
6121
7218
|
}
|
|
6122
7219
|
get path() {
|
|
6123
7220
|
if (!this._cachedPath.length) {
|
|
6124
|
-
if (this._key
|
|
7221
|
+
if (Array.isArray(this._key)) {
|
|
6125
7222
|
this._cachedPath.push(...this._path, ...this._key);
|
|
6126
7223
|
} else {
|
|
6127
7224
|
this._cachedPath.push(...this._path, this._key);
|
|
@@ -6159,17 +7256,16 @@ function processCreateParams(params) {
|
|
|
6159
7256
|
if (errorMap2)
|
|
6160
7257
|
return { errorMap: errorMap2, description };
|
|
6161
7258
|
const customMap = (iss, ctx) => {
|
|
6162
|
-
var _a, _b;
|
|
6163
7259
|
const { message } = params;
|
|
6164
7260
|
if (iss.code === "invalid_enum_value") {
|
|
6165
|
-
return { message: message
|
|
7261
|
+
return { message: message ?? ctx.defaultError };
|
|
6166
7262
|
}
|
|
6167
7263
|
if (typeof ctx.data === "undefined") {
|
|
6168
|
-
return { message:
|
|
7264
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
6169
7265
|
}
|
|
6170
7266
|
if (iss.code !== "invalid_type")
|
|
6171
7267
|
return { message: ctx.defaultError };
|
|
6172
|
-
return { message:
|
|
7268
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
6173
7269
|
};
|
|
6174
7270
|
return { errorMap: customMap, description };
|
|
6175
7271
|
}
|
|
@@ -6222,14 +7318,13 @@ class ZodType {
|
|
|
6222
7318
|
throw result.error;
|
|
6223
7319
|
}
|
|
6224
7320
|
safeParse(data, params) {
|
|
6225
|
-
var _a;
|
|
6226
7321
|
const ctx = {
|
|
6227
7322
|
common: {
|
|
6228
7323
|
issues: [],
|
|
6229
|
-
async:
|
|
6230
|
-
contextualErrorMap: params
|
|
7324
|
+
async: params?.async ?? false,
|
|
7325
|
+
contextualErrorMap: params?.errorMap
|
|
6231
7326
|
},
|
|
6232
|
-
path:
|
|
7327
|
+
path: params?.path || [],
|
|
6233
7328
|
schemaErrorMap: this._def.errorMap,
|
|
6234
7329
|
parent: null,
|
|
6235
7330
|
data,
|
|
@@ -6239,7 +7334,6 @@ class ZodType {
|
|
|
6239
7334
|
return handleResult(ctx, result);
|
|
6240
7335
|
}
|
|
6241
7336
|
"~validate"(data) {
|
|
6242
|
-
var _a, _b;
|
|
6243
7337
|
const ctx = {
|
|
6244
7338
|
common: {
|
|
6245
7339
|
issues: [],
|
|
@@ -6260,7 +7354,7 @@ class ZodType {
|
|
|
6260
7354
|
issues: ctx.common.issues
|
|
6261
7355
|
};
|
|
6262
7356
|
} catch (err) {
|
|
6263
|
-
if (
|
|
7357
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
6264
7358
|
this["~standard"].async = true;
|
|
6265
7359
|
}
|
|
6266
7360
|
ctx.common = {
|
|
@@ -6285,10 +7379,10 @@ class ZodType {
|
|
|
6285
7379
|
const ctx = {
|
|
6286
7380
|
common: {
|
|
6287
7381
|
issues: [],
|
|
6288
|
-
contextualErrorMap: params
|
|
7382
|
+
contextualErrorMap: params?.errorMap,
|
|
6289
7383
|
async: true
|
|
6290
7384
|
},
|
|
6291
|
-
path:
|
|
7385
|
+
path: params?.path || [],
|
|
6292
7386
|
schemaErrorMap: this._def.errorMap,
|
|
6293
7387
|
parent: null,
|
|
6294
7388
|
data,
|
|
@@ -6478,13 +7572,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
|
|
|
6478
7572
|
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
6479
7573
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
6480
7574
|
function timeRegexSource(args) {
|
|
6481
|
-
let
|
|
7575
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
6482
7576
|
if (args.precision) {
|
|
6483
|
-
|
|
7577
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
6484
7578
|
} else if (args.precision == null) {
|
|
6485
|
-
|
|
7579
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
6486
7580
|
}
|
|
6487
|
-
|
|
7581
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
7582
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
6488
7583
|
}
|
|
6489
7584
|
function timeRegex(args) {
|
|
6490
7585
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -6512,16 +7607,20 @@ function isValidJWT(jwt, alg) {
|
|
|
6512
7607
|
return false;
|
|
6513
7608
|
try {
|
|
6514
7609
|
const [header] = jwt.split(".");
|
|
7610
|
+
if (!header)
|
|
7611
|
+
return false;
|
|
6515
7612
|
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
6516
7613
|
const decoded = JSON.parse(atob(base64));
|
|
6517
7614
|
if (typeof decoded !== "object" || decoded === null)
|
|
6518
7615
|
return false;
|
|
6519
|
-
if (
|
|
7616
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
7617
|
+
return false;
|
|
7618
|
+
if (!decoded.alg)
|
|
6520
7619
|
return false;
|
|
6521
7620
|
if (alg && decoded.alg !== alg)
|
|
6522
7621
|
return false;
|
|
6523
7622
|
return true;
|
|
6524
|
-
} catch
|
|
7623
|
+
} catch {
|
|
6525
7624
|
return false;
|
|
6526
7625
|
}
|
|
6527
7626
|
}
|
|
@@ -6681,7 +7780,7 @@ class ZodString extends ZodType {
|
|
|
6681
7780
|
} else if (check.kind === "url") {
|
|
6682
7781
|
try {
|
|
6683
7782
|
new URL(input.data);
|
|
6684
|
-
} catch
|
|
7783
|
+
} catch {
|
|
6685
7784
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
6686
7785
|
addIssueToContext(ctx, {
|
|
6687
7786
|
validation: "url",
|
|
@@ -6893,7 +7992,6 @@ class ZodString extends ZodType {
|
|
|
6893
7992
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
6894
7993
|
}
|
|
6895
7994
|
datetime(options) {
|
|
6896
|
-
var _a, _b;
|
|
6897
7995
|
if (typeof options === "string") {
|
|
6898
7996
|
return this._addCheck({
|
|
6899
7997
|
kind: "datetime",
|
|
@@ -6905,10 +8003,10 @@ class ZodString extends ZodType {
|
|
|
6905
8003
|
}
|
|
6906
8004
|
return this._addCheck({
|
|
6907
8005
|
kind: "datetime",
|
|
6908
|
-
precision: typeof
|
|
6909
|
-
offset:
|
|
6910
|
-
local:
|
|
6911
|
-
...errorUtil.errToObj(options
|
|
8006
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
8007
|
+
offset: options?.offset ?? false,
|
|
8008
|
+
local: options?.local ?? false,
|
|
8009
|
+
...errorUtil.errToObj(options?.message)
|
|
6912
8010
|
});
|
|
6913
8011
|
}
|
|
6914
8012
|
date(message) {
|
|
@@ -6924,8 +8022,8 @@ class ZodString extends ZodType {
|
|
|
6924
8022
|
}
|
|
6925
8023
|
return this._addCheck({
|
|
6926
8024
|
kind: "time",
|
|
6927
|
-
precision: typeof
|
|
6928
|
-
...errorUtil.errToObj(options
|
|
8025
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
8026
|
+
...errorUtil.errToObj(options?.message)
|
|
6929
8027
|
});
|
|
6930
8028
|
}
|
|
6931
8029
|
duration(message) {
|
|
@@ -6942,8 +8040,8 @@ class ZodString extends ZodType {
|
|
|
6942
8040
|
return this._addCheck({
|
|
6943
8041
|
kind: "includes",
|
|
6944
8042
|
value,
|
|
6945
|
-
position: options
|
|
6946
|
-
...errorUtil.errToObj(options
|
|
8043
|
+
position: options?.position,
|
|
8044
|
+
...errorUtil.errToObj(options?.message)
|
|
6947
8045
|
});
|
|
6948
8046
|
}
|
|
6949
8047
|
startsWith(value, message) {
|
|
@@ -7072,11 +8170,10 @@ class ZodString extends ZodType {
|
|
|
7072
8170
|
}
|
|
7073
8171
|
}
|
|
7074
8172
|
ZodString.create = (params) => {
|
|
7075
|
-
var _a;
|
|
7076
8173
|
return new ZodString({
|
|
7077
8174
|
checks: [],
|
|
7078
8175
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
7079
|
-
coerce:
|
|
8176
|
+
coerce: params?.coerce ?? false,
|
|
7080
8177
|
...processCreateParams(params)
|
|
7081
8178
|
});
|
|
7082
8179
|
};
|
|
@@ -7084,9 +8181,9 @@ function floatSafeRemainder(val, step) {
|
|
|
7084
8181
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
7085
8182
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
7086
8183
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
7087
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
7088
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
7089
|
-
return valInt % stepInt /
|
|
8184
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
8185
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
8186
|
+
return valInt % stepInt / 10 ** decCount;
|
|
7090
8187
|
}
|
|
7091
8188
|
|
|
7092
8189
|
class ZodNumber extends ZodType {
|
|
@@ -7297,7 +8394,8 @@ class ZodNumber extends ZodType {
|
|
|
7297
8394
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
7298
8395
|
}
|
|
7299
8396
|
get isFinite() {
|
|
7300
|
-
let max = null
|
|
8397
|
+
let max = null;
|
|
8398
|
+
let min = null;
|
|
7301
8399
|
for (const ch of this._def.checks) {
|
|
7302
8400
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
7303
8401
|
return true;
|
|
@@ -7316,7 +8414,7 @@ ZodNumber.create = (params) => {
|
|
|
7316
8414
|
return new ZodNumber({
|
|
7317
8415
|
checks: [],
|
|
7318
8416
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
7319
|
-
coerce:
|
|
8417
|
+
coerce: params?.coerce || false,
|
|
7320
8418
|
...processCreateParams(params)
|
|
7321
8419
|
});
|
|
7322
8420
|
};
|
|
@@ -7331,7 +8429,7 @@ class ZodBigInt extends ZodType {
|
|
|
7331
8429
|
if (this._def.coerce) {
|
|
7332
8430
|
try {
|
|
7333
8431
|
input.data = BigInt(input.data);
|
|
7334
|
-
} catch
|
|
8432
|
+
} catch {
|
|
7335
8433
|
return this._getInvalidInput(input);
|
|
7336
8434
|
}
|
|
7337
8435
|
}
|
|
@@ -7486,11 +8584,10 @@ class ZodBigInt extends ZodType {
|
|
|
7486
8584
|
}
|
|
7487
8585
|
}
|
|
7488
8586
|
ZodBigInt.create = (params) => {
|
|
7489
|
-
var _a;
|
|
7490
8587
|
return new ZodBigInt({
|
|
7491
8588
|
checks: [],
|
|
7492
8589
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
7493
|
-
coerce:
|
|
8590
|
+
coerce: params?.coerce ?? false,
|
|
7494
8591
|
...processCreateParams(params)
|
|
7495
8592
|
});
|
|
7496
8593
|
};
|
|
@@ -7516,7 +8613,7 @@ class ZodBoolean extends ZodType {
|
|
|
7516
8613
|
ZodBoolean.create = (params) => {
|
|
7517
8614
|
return new ZodBoolean({
|
|
7518
8615
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
7519
|
-
coerce:
|
|
8616
|
+
coerce: params?.coerce || false,
|
|
7520
8617
|
...processCreateParams(params)
|
|
7521
8618
|
});
|
|
7522
8619
|
};
|
|
@@ -7536,7 +8633,7 @@ class ZodDate extends ZodType {
|
|
|
7536
8633
|
});
|
|
7537
8634
|
return INVALID;
|
|
7538
8635
|
}
|
|
7539
|
-
if (isNaN(input.data.getTime())) {
|
|
8636
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
7540
8637
|
const ctx2 = this._getOrReturnCtx(input);
|
|
7541
8638
|
addIssueToContext(ctx2, {
|
|
7542
8639
|
code: ZodIssueCode.invalid_date
|
|
@@ -7625,7 +8722,7 @@ class ZodDate extends ZodType {
|
|
|
7625
8722
|
ZodDate.create = (params) => {
|
|
7626
8723
|
return new ZodDate({
|
|
7627
8724
|
checks: [],
|
|
7628
|
-
coerce:
|
|
8725
|
+
coerce: params?.coerce || false,
|
|
7629
8726
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
7630
8727
|
...processCreateParams(params)
|
|
7631
8728
|
});
|
|
@@ -7909,7 +9006,8 @@ class ZodObject extends ZodType {
|
|
|
7909
9006
|
return this._cached;
|
|
7910
9007
|
const shape = this._def.shape();
|
|
7911
9008
|
const keys = util.objectKeys(shape);
|
|
7912
|
-
|
|
9009
|
+
this._cached = { shape, keys };
|
|
9010
|
+
return this._cached;
|
|
7913
9011
|
}
|
|
7914
9012
|
_parse(input) {
|
|
7915
9013
|
const parsedType = this._getType(input);
|
|
@@ -7959,9 +9057,7 @@ class ZodObject extends ZodType {
|
|
|
7959
9057
|
});
|
|
7960
9058
|
status.dirty();
|
|
7961
9059
|
}
|
|
7962
|
-
} else if (unknownKeys === "strip")
|
|
7963
|
-
;
|
|
7964
|
-
else {
|
|
9060
|
+
} else if (unknownKeys === "strip") {} else {
|
|
7965
9061
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
7966
9062
|
}
|
|
7967
9063
|
} else {
|
|
@@ -8005,11 +9101,10 @@ class ZodObject extends ZodType {
|
|
|
8005
9101
|
unknownKeys: "strict",
|
|
8006
9102
|
...message !== undefined ? {
|
|
8007
9103
|
errorMap: (issue, ctx) => {
|
|
8008
|
-
|
|
8009
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === undefined ? undefined : _b.call(_a, issue, ctx).message) !== null && _c !== undefined ? _c : ctx.defaultError;
|
|
9104
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
8010
9105
|
if (issue.code === "unrecognized_keys")
|
|
8011
9106
|
return {
|
|
8012
|
-
message:
|
|
9107
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
|
8013
9108
|
};
|
|
8014
9109
|
return {
|
|
8015
9110
|
message: defaultError
|
|
@@ -8062,11 +9157,11 @@ class ZodObject extends ZodType {
|
|
|
8062
9157
|
}
|
|
8063
9158
|
pick(mask) {
|
|
8064
9159
|
const shape = {};
|
|
8065
|
-
util.objectKeys(mask)
|
|
9160
|
+
for (const key of util.objectKeys(mask)) {
|
|
8066
9161
|
if (mask[key] && this.shape[key]) {
|
|
8067
9162
|
shape[key] = this.shape[key];
|
|
8068
9163
|
}
|
|
8069
|
-
}
|
|
9164
|
+
}
|
|
8070
9165
|
return new ZodObject({
|
|
8071
9166
|
...this._def,
|
|
8072
9167
|
shape: () => shape
|
|
@@ -8074,11 +9169,11 @@ class ZodObject extends ZodType {
|
|
|
8074
9169
|
}
|
|
8075
9170
|
omit(mask) {
|
|
8076
9171
|
const shape = {};
|
|
8077
|
-
util.objectKeys(this.shape)
|
|
9172
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
8078
9173
|
if (!mask[key]) {
|
|
8079
9174
|
shape[key] = this.shape[key];
|
|
8080
9175
|
}
|
|
8081
|
-
}
|
|
9176
|
+
}
|
|
8082
9177
|
return new ZodObject({
|
|
8083
9178
|
...this._def,
|
|
8084
9179
|
shape: () => shape
|
|
@@ -8089,14 +9184,14 @@ class ZodObject extends ZodType {
|
|
|
8089
9184
|
}
|
|
8090
9185
|
partial(mask) {
|
|
8091
9186
|
const newShape = {};
|
|
8092
|
-
util.objectKeys(this.shape)
|
|
9187
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
8093
9188
|
const fieldSchema = this.shape[key];
|
|
8094
9189
|
if (mask && !mask[key]) {
|
|
8095
9190
|
newShape[key] = fieldSchema;
|
|
8096
9191
|
} else {
|
|
8097
9192
|
newShape[key] = fieldSchema.optional();
|
|
8098
9193
|
}
|
|
8099
|
-
}
|
|
9194
|
+
}
|
|
8100
9195
|
return new ZodObject({
|
|
8101
9196
|
...this._def,
|
|
8102
9197
|
shape: () => newShape
|
|
@@ -8104,7 +9199,7 @@ class ZodObject extends ZodType {
|
|
|
8104
9199
|
}
|
|
8105
9200
|
required(mask) {
|
|
8106
9201
|
const newShape = {};
|
|
8107
|
-
util.objectKeys(this.shape)
|
|
9202
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
8108
9203
|
if (mask && !mask[key]) {
|
|
8109
9204
|
newShape[key] = this.shape[key];
|
|
8110
9205
|
} else {
|
|
@@ -8115,7 +9210,7 @@ class ZodObject extends ZodType {
|
|
|
8115
9210
|
}
|
|
8116
9211
|
newShape[key] = newField;
|
|
8117
9212
|
}
|
|
8118
|
-
}
|
|
9213
|
+
}
|
|
8119
9214
|
return new ZodObject({
|
|
8120
9215
|
...this._def,
|
|
8121
9216
|
shape: () => newShape
|
|
@@ -8731,12 +9826,7 @@ class ZodFunction extends ZodType {
|
|
|
8731
9826
|
return makeIssue({
|
|
8732
9827
|
data: args,
|
|
8733
9828
|
path: ctx.path,
|
|
8734
|
-
errorMaps: [
|
|
8735
|
-
ctx.common.contextualErrorMap,
|
|
8736
|
-
ctx.schemaErrorMap,
|
|
8737
|
-
getErrorMap(),
|
|
8738
|
-
errorMap
|
|
8739
|
-
].filter((x) => !!x),
|
|
9829
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
8740
9830
|
issueData: {
|
|
8741
9831
|
code: ZodIssueCode.invalid_arguments,
|
|
8742
9832
|
argumentsError: error
|
|
@@ -8747,12 +9837,7 @@ class ZodFunction extends ZodType {
|
|
|
8747
9837
|
return makeIssue({
|
|
8748
9838
|
data: returns,
|
|
8749
9839
|
path: ctx.path,
|
|
8750
|
-
errorMaps: [
|
|
8751
|
-
ctx.common.contextualErrorMap,
|
|
8752
|
-
ctx.schemaErrorMap,
|
|
8753
|
-
getErrorMap(),
|
|
8754
|
-
errorMap
|
|
8755
|
-
].filter((x) => !!x),
|
|
9840
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
8756
9841
|
issueData: {
|
|
8757
9842
|
code: ZodIssueCode.invalid_return_type,
|
|
8758
9843
|
returnTypeError: error
|
|
@@ -8879,10 +9964,6 @@ function createZodEnum(values, params) {
|
|
|
8879
9964
|
}
|
|
8880
9965
|
|
|
8881
9966
|
class ZodEnum extends ZodType {
|
|
8882
|
-
constructor() {
|
|
8883
|
-
super(...arguments);
|
|
8884
|
-
_ZodEnum_cache.set(this, undefined);
|
|
8885
|
-
}
|
|
8886
9967
|
_parse(input) {
|
|
8887
9968
|
if (typeof input.data !== "string") {
|
|
8888
9969
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -8894,10 +9975,10 @@ class ZodEnum extends ZodType {
|
|
|
8894
9975
|
});
|
|
8895
9976
|
return INVALID;
|
|
8896
9977
|
}
|
|
8897
|
-
if (!
|
|
8898
|
-
|
|
9978
|
+
if (!this._cache) {
|
|
9979
|
+
this._cache = new Set(this._def.values);
|
|
8899
9980
|
}
|
|
8900
|
-
if (!
|
|
9981
|
+
if (!this._cache.has(input.data)) {
|
|
8901
9982
|
const ctx = this._getOrReturnCtx(input);
|
|
8902
9983
|
const expectedValues = this._def.values;
|
|
8903
9984
|
addIssueToContext(ctx, {
|
|
@@ -8946,14 +10027,9 @@ class ZodEnum extends ZodType {
|
|
|
8946
10027
|
});
|
|
8947
10028
|
}
|
|
8948
10029
|
}
|
|
8949
|
-
_ZodEnum_cache = new WeakMap;
|
|
8950
10030
|
ZodEnum.create = createZodEnum;
|
|
8951
10031
|
|
|
8952
10032
|
class ZodNativeEnum extends ZodType {
|
|
8953
|
-
constructor() {
|
|
8954
|
-
super(...arguments);
|
|
8955
|
-
_ZodNativeEnum_cache.set(this, undefined);
|
|
8956
|
-
}
|
|
8957
10033
|
_parse(input) {
|
|
8958
10034
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
8959
10035
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -8966,10 +10042,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
8966
10042
|
});
|
|
8967
10043
|
return INVALID;
|
|
8968
10044
|
}
|
|
8969
|
-
if (!
|
|
8970
|
-
|
|
10045
|
+
if (!this._cache) {
|
|
10046
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
8971
10047
|
}
|
|
8972
|
-
if (!
|
|
10048
|
+
if (!this._cache.has(input.data)) {
|
|
8973
10049
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
8974
10050
|
addIssueToContext(ctx, {
|
|
8975
10051
|
received: ctx.data,
|
|
@@ -8984,7 +10060,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
8984
10060
|
return this._def.values;
|
|
8985
10061
|
}
|
|
8986
10062
|
}
|
|
8987
|
-
_ZodNativeEnum_cache = new WeakMap;
|
|
8988
10063
|
ZodNativeEnum.create = (values, params) => {
|
|
8989
10064
|
return new ZodNativeEnum({
|
|
8990
10065
|
values,
|
|
@@ -9127,7 +10202,7 @@ class ZodEffects extends ZodType {
|
|
|
9127
10202
|
parent: ctx
|
|
9128
10203
|
});
|
|
9129
10204
|
if (!isValid(base))
|
|
9130
|
-
return
|
|
10205
|
+
return INVALID;
|
|
9131
10206
|
const result = effect.transform(base.value, checkCtx);
|
|
9132
10207
|
if (result instanceof Promise) {
|
|
9133
10208
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -9136,8 +10211,11 @@ class ZodEffects extends ZodType {
|
|
|
9136
10211
|
} else {
|
|
9137
10212
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
9138
10213
|
if (!isValid(base))
|
|
9139
|
-
return
|
|
9140
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
10214
|
+
return INVALID;
|
|
10215
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
10216
|
+
status: status.value,
|
|
10217
|
+
value: result
|
|
10218
|
+
}));
|
|
9141
10219
|
});
|
|
9142
10220
|
}
|
|
9143
10221
|
}
|
|
@@ -9160,7 +10238,6 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
9160
10238
|
...processCreateParams(params)
|
|
9161
10239
|
});
|
|
9162
10240
|
};
|
|
9163
|
-
|
|
9164
10241
|
class ZodOptional extends ZodType {
|
|
9165
10242
|
_parse(input) {
|
|
9166
10243
|
const parsedType = this._getType(input);
|
|
@@ -9405,21 +10482,19 @@ function cleanParams(params, data) {
|
|
|
9405
10482
|
function custom(check, _params = {}, fatal) {
|
|
9406
10483
|
if (check)
|
|
9407
10484
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
9408
|
-
var _a, _b;
|
|
9409
10485
|
const r = check(data);
|
|
9410
10486
|
if (r instanceof Promise) {
|
|
9411
10487
|
return r.then((r2) => {
|
|
9412
|
-
var _a2, _b2;
|
|
9413
10488
|
if (!r2) {
|
|
9414
10489
|
const params = cleanParams(_params, data);
|
|
9415
|
-
const _fatal =
|
|
10490
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
9416
10491
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
9417
10492
|
}
|
|
9418
10493
|
});
|
|
9419
10494
|
}
|
|
9420
10495
|
if (!r) {
|
|
9421
10496
|
const params = cleanParams(_params, data);
|
|
9422
|
-
const _fatal =
|
|
10497
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
9423
10498
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
9424
10499
|
}
|
|
9425
10500
|
return;
|
|
@@ -9519,122 +10594,6 @@ var coerce = {
|
|
|
9519
10594
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
9520
10595
|
};
|
|
9521
10596
|
var NEVER = INVALID;
|
|
9522
|
-
var z = /* @__PURE__ */ Object.freeze({
|
|
9523
|
-
__proto__: null,
|
|
9524
|
-
defaultErrorMap: errorMap,
|
|
9525
|
-
setErrorMap,
|
|
9526
|
-
getErrorMap,
|
|
9527
|
-
makeIssue,
|
|
9528
|
-
EMPTY_PATH,
|
|
9529
|
-
addIssueToContext,
|
|
9530
|
-
ParseStatus,
|
|
9531
|
-
INVALID,
|
|
9532
|
-
DIRTY,
|
|
9533
|
-
OK,
|
|
9534
|
-
isAborted,
|
|
9535
|
-
isDirty,
|
|
9536
|
-
isValid,
|
|
9537
|
-
isAsync,
|
|
9538
|
-
get util() {
|
|
9539
|
-
return util;
|
|
9540
|
-
},
|
|
9541
|
-
get objectUtil() {
|
|
9542
|
-
return objectUtil;
|
|
9543
|
-
},
|
|
9544
|
-
ZodParsedType,
|
|
9545
|
-
getParsedType,
|
|
9546
|
-
ZodType,
|
|
9547
|
-
datetimeRegex,
|
|
9548
|
-
ZodString,
|
|
9549
|
-
ZodNumber,
|
|
9550
|
-
ZodBigInt,
|
|
9551
|
-
ZodBoolean,
|
|
9552
|
-
ZodDate,
|
|
9553
|
-
ZodSymbol,
|
|
9554
|
-
ZodUndefined,
|
|
9555
|
-
ZodNull,
|
|
9556
|
-
ZodAny,
|
|
9557
|
-
ZodUnknown,
|
|
9558
|
-
ZodNever,
|
|
9559
|
-
ZodVoid,
|
|
9560
|
-
ZodArray,
|
|
9561
|
-
ZodObject,
|
|
9562
|
-
ZodUnion,
|
|
9563
|
-
ZodDiscriminatedUnion,
|
|
9564
|
-
ZodIntersection,
|
|
9565
|
-
ZodTuple,
|
|
9566
|
-
ZodRecord,
|
|
9567
|
-
ZodMap,
|
|
9568
|
-
ZodSet,
|
|
9569
|
-
ZodFunction,
|
|
9570
|
-
ZodLazy,
|
|
9571
|
-
ZodLiteral,
|
|
9572
|
-
ZodEnum,
|
|
9573
|
-
ZodNativeEnum,
|
|
9574
|
-
ZodPromise,
|
|
9575
|
-
ZodEffects,
|
|
9576
|
-
ZodTransformer: ZodEffects,
|
|
9577
|
-
ZodOptional,
|
|
9578
|
-
ZodNullable,
|
|
9579
|
-
ZodDefault,
|
|
9580
|
-
ZodCatch,
|
|
9581
|
-
ZodNaN,
|
|
9582
|
-
BRAND,
|
|
9583
|
-
ZodBranded,
|
|
9584
|
-
ZodPipeline,
|
|
9585
|
-
ZodReadonly,
|
|
9586
|
-
custom,
|
|
9587
|
-
Schema: ZodType,
|
|
9588
|
-
ZodSchema: ZodType,
|
|
9589
|
-
late,
|
|
9590
|
-
get ZodFirstPartyTypeKind() {
|
|
9591
|
-
return ZodFirstPartyTypeKind;
|
|
9592
|
-
},
|
|
9593
|
-
coerce,
|
|
9594
|
-
any: anyType,
|
|
9595
|
-
array: arrayType,
|
|
9596
|
-
bigint: bigIntType,
|
|
9597
|
-
boolean: booleanType,
|
|
9598
|
-
date: dateType,
|
|
9599
|
-
discriminatedUnion: discriminatedUnionType,
|
|
9600
|
-
effect: effectsType,
|
|
9601
|
-
enum: enumType,
|
|
9602
|
-
function: functionType,
|
|
9603
|
-
instanceof: instanceOfType,
|
|
9604
|
-
intersection: intersectionType,
|
|
9605
|
-
lazy: lazyType,
|
|
9606
|
-
literal: literalType,
|
|
9607
|
-
map: mapType,
|
|
9608
|
-
nan: nanType,
|
|
9609
|
-
nativeEnum: nativeEnumType,
|
|
9610
|
-
never: neverType,
|
|
9611
|
-
null: nullType,
|
|
9612
|
-
nullable: nullableType,
|
|
9613
|
-
number: numberType,
|
|
9614
|
-
object: objectType,
|
|
9615
|
-
oboolean,
|
|
9616
|
-
onumber,
|
|
9617
|
-
optional: optionalType,
|
|
9618
|
-
ostring,
|
|
9619
|
-
pipeline: pipelineType,
|
|
9620
|
-
preprocess: preprocessType,
|
|
9621
|
-
promise: promiseType,
|
|
9622
|
-
record: recordType,
|
|
9623
|
-
set: setType,
|
|
9624
|
-
strictObject: strictObjectType,
|
|
9625
|
-
string: stringType,
|
|
9626
|
-
symbol: symbolType,
|
|
9627
|
-
transformer: effectsType,
|
|
9628
|
-
tuple: tupleType,
|
|
9629
|
-
undefined: undefinedType,
|
|
9630
|
-
union: unionType,
|
|
9631
|
-
unknown: unknownType,
|
|
9632
|
-
void: voidType,
|
|
9633
|
-
NEVER,
|
|
9634
|
-
ZodIssueCode,
|
|
9635
|
-
quotelessJson,
|
|
9636
|
-
ZodError
|
|
9637
|
-
});
|
|
9638
10597
|
// src/common/string.ts
|
|
9639
10598
|
var getChineseByStr = (str) => {
|
|
9640
10599
|
if (!str) {
|
|
@@ -9813,7 +10772,7 @@ var watch = {
|
|
|
9813
10772
|
};
|
|
9814
10773
|
// ../../node_modules/decimal.js/decimal.mjs
|
|
9815
10774
|
/*!
|
|
9816
|
-
* decimal.js v10.
|
|
10775
|
+
* decimal.js v10.6.0
|
|
9817
10776
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
9818
10777
|
* https://github.com/MikeMcl/decimal.js
|
|
9819
10778
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
@@ -9836,7 +10795,7 @@ var DEFAULTS = {
|
|
|
9836
10795
|
};
|
|
9837
10796
|
var inexact;
|
|
9838
10797
|
var quadrant;
|
|
9839
|
-
var
|
|
10798
|
+
var external2 = true;
|
|
9840
10799
|
var decimalError = "[DecimalError] ";
|
|
9841
10800
|
var invalidArgument = decimalError + "Invalid argument: ";
|
|
9842
10801
|
var precisionLimitExceeded = decimalError + "Precision limit exceeded";
|
|
@@ -9912,7 +10871,7 @@ P.cubeRoot = P.cbrt = function() {
|
|
|
9912
10871
|
var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor;
|
|
9913
10872
|
if (!x.isFinite() || x.isZero())
|
|
9914
10873
|
return new Ctor(x);
|
|
9915
|
-
|
|
10874
|
+
external2 = false;
|
|
9916
10875
|
s = x.s * mathpow(x.s * x, 1 / 3);
|
|
9917
10876
|
if (!s || Math.abs(s) == 1 / 0) {
|
|
9918
10877
|
n = digitsToString(x.d);
|
|
@@ -9959,7 +10918,7 @@ P.cubeRoot = P.cbrt = function() {
|
|
|
9959
10918
|
}
|
|
9960
10919
|
}
|
|
9961
10920
|
}
|
|
9962
|
-
|
|
10921
|
+
external2 = true;
|
|
9963
10922
|
return finalise(r, e, Ctor.rounding, m);
|
|
9964
10923
|
};
|
|
9965
10924
|
P.decimalPlaces = P.dp = function() {
|
|
@@ -10084,9 +11043,9 @@ P.inverseHyperbolicCosine = P.acosh = function() {
|
|
|
10084
11043
|
rm = Ctor.rounding;
|
|
10085
11044
|
Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
|
|
10086
11045
|
Ctor.rounding = 1;
|
|
10087
|
-
|
|
11046
|
+
external2 = false;
|
|
10088
11047
|
x = x.times(x).minus(1).sqrt().plus(x);
|
|
10089
|
-
|
|
11048
|
+
external2 = true;
|
|
10090
11049
|
Ctor.precision = pr;
|
|
10091
11050
|
Ctor.rounding = rm;
|
|
10092
11051
|
return x.ln();
|
|
@@ -10099,9 +11058,9 @@ P.inverseHyperbolicSine = P.asinh = function() {
|
|
|
10099
11058
|
rm = Ctor.rounding;
|
|
10100
11059
|
Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
|
|
10101
11060
|
Ctor.rounding = 1;
|
|
10102
|
-
|
|
11061
|
+
external2 = false;
|
|
10103
11062
|
x = x.times(x).plus(1).sqrt().plus(x);
|
|
10104
|
-
|
|
11063
|
+
external2 = true;
|
|
10105
11064
|
Ctor.precision = pr;
|
|
10106
11065
|
Ctor.rounding = rm;
|
|
10107
11066
|
return x.ln();
|
|
@@ -10170,7 +11129,7 @@ P.inverseTangent = P.atan = function() {
|
|
|
10170
11129
|
k = Math.min(28, wpr / LOG_BASE + 2 | 0);
|
|
10171
11130
|
for (i = k;i; --i)
|
|
10172
11131
|
x = x.div(x.times(x).plus(1).sqrt().plus(1));
|
|
10173
|
-
|
|
11132
|
+
external2 = false;
|
|
10174
11133
|
j = Math.ceil(wpr / LOG_BASE);
|
|
10175
11134
|
n = 1;
|
|
10176
11135
|
x2 = x.times(x);
|
|
@@ -10187,7 +11146,7 @@ P.inverseTangent = P.atan = function() {
|
|
|
10187
11146
|
}
|
|
10188
11147
|
if (k)
|
|
10189
11148
|
r = r.times(2 << k - 1);
|
|
10190
|
-
|
|
11149
|
+
external2 = true;
|
|
10191
11150
|
return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
|
|
10192
11151
|
};
|
|
10193
11152
|
P.isFinite = function() {
|
|
@@ -10239,7 +11198,7 @@ P.logarithm = P.log = function(base) {
|
|
|
10239
11198
|
inf = k !== 1;
|
|
10240
11199
|
}
|
|
10241
11200
|
}
|
|
10242
|
-
|
|
11201
|
+
external2 = false;
|
|
10243
11202
|
sd = pr + guard;
|
|
10244
11203
|
num = naturalLogarithm(arg, sd);
|
|
10245
11204
|
denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
|
|
@@ -10258,7 +11217,7 @@ P.logarithm = P.log = function(base) {
|
|
|
10258
11217
|
}
|
|
10259
11218
|
} while (checkRoundingDigits(r.d, k += 10, rm));
|
|
10260
11219
|
}
|
|
10261
|
-
|
|
11220
|
+
external2 = true;
|
|
10262
11221
|
return finalise(r, pr, rm);
|
|
10263
11222
|
};
|
|
10264
11223
|
P.minus = P.sub = function(y) {
|
|
@@ -10288,7 +11247,7 @@ P.minus = P.sub = function(y) {
|
|
|
10288
11247
|
y = new Ctor(x);
|
|
10289
11248
|
else
|
|
10290
11249
|
return new Ctor(rm === 3 ? -0 : 0);
|
|
10291
|
-
return
|
|
11250
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10292
11251
|
}
|
|
10293
11252
|
e = mathfloor(y.e / LOG_BASE);
|
|
10294
11253
|
xe = mathfloor(x.e / LOG_BASE);
|
|
@@ -10354,7 +11313,7 @@ P.minus = P.sub = function(y) {
|
|
|
10354
11313
|
return new Ctor(rm === 3 ? -0 : 0);
|
|
10355
11314
|
y.d = xd;
|
|
10356
11315
|
y.e = getBase10Exponent(xd, e);
|
|
10357
|
-
return
|
|
11316
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10358
11317
|
};
|
|
10359
11318
|
P.modulo = P.mod = function(y) {
|
|
10360
11319
|
var q, x = this, Ctor = x.constructor;
|
|
@@ -10364,7 +11323,7 @@ P.modulo = P.mod = function(y) {
|
|
|
10364
11323
|
if (!y.d || x.d && !x.d[0]) {
|
|
10365
11324
|
return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
|
|
10366
11325
|
}
|
|
10367
|
-
|
|
11326
|
+
external2 = false;
|
|
10368
11327
|
if (Ctor.modulo == 9) {
|
|
10369
11328
|
q = divide(x, y.abs(), 0, 3, 1);
|
|
10370
11329
|
q.s *= y.s;
|
|
@@ -10372,7 +11331,7 @@ P.modulo = P.mod = function(y) {
|
|
|
10372
11331
|
q = divide(x, y, 0, Ctor.modulo, 1);
|
|
10373
11332
|
}
|
|
10374
11333
|
q = q.times(y);
|
|
10375
|
-
|
|
11334
|
+
external2 = true;
|
|
10376
11335
|
return x.minus(q);
|
|
10377
11336
|
};
|
|
10378
11337
|
P.naturalExponential = P.exp = function() {
|
|
@@ -10407,7 +11366,7 @@ P.plus = P.add = function(y) {
|
|
|
10407
11366
|
if (!xd[0] || !yd[0]) {
|
|
10408
11367
|
if (!yd[0])
|
|
10409
11368
|
y = new Ctor(x);
|
|
10410
|
-
return
|
|
11369
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10411
11370
|
}
|
|
10412
11371
|
k = mathfloor(x.e / LOG_BASE);
|
|
10413
11372
|
e = mathfloor(y.e / LOG_BASE);
|
|
@@ -10454,15 +11413,15 @@ P.plus = P.add = function(y) {
|
|
|
10454
11413
|
xd.pop();
|
|
10455
11414
|
y.d = xd;
|
|
10456
11415
|
y.e = getBase10Exponent(xd, e);
|
|
10457
|
-
return
|
|
11416
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10458
11417
|
};
|
|
10459
|
-
P.precision = P.sd = function(
|
|
11418
|
+
P.precision = P.sd = function(z) {
|
|
10460
11419
|
var k, x = this;
|
|
10461
|
-
if (
|
|
10462
|
-
throw Error(invalidArgument +
|
|
11420
|
+
if (z !== undefined && z !== !!z && z !== 1 && z !== 0)
|
|
11421
|
+
throw Error(invalidArgument + z);
|
|
10463
11422
|
if (x.d) {
|
|
10464
11423
|
k = getPrecision(x.d);
|
|
10465
|
-
if (
|
|
11424
|
+
if (z && x.e + 1 > k)
|
|
10466
11425
|
k = x.e + 1;
|
|
10467
11426
|
} else {
|
|
10468
11427
|
k = NaN;
|
|
@@ -10493,7 +11452,7 @@ P.squareRoot = P.sqrt = function() {
|
|
|
10493
11452
|
if (s !== 1 || !d || !d[0]) {
|
|
10494
11453
|
return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
|
|
10495
11454
|
}
|
|
10496
|
-
|
|
11455
|
+
external2 = false;
|
|
10497
11456
|
s = Math.sqrt(+x);
|
|
10498
11457
|
if (s == 0 || s == 1 / 0) {
|
|
10499
11458
|
n = digitsToString(d);
|
|
@@ -10536,7 +11495,7 @@ P.squareRoot = P.sqrt = function() {
|
|
|
10536
11495
|
}
|
|
10537
11496
|
}
|
|
10538
11497
|
}
|
|
10539
|
-
|
|
11498
|
+
external2 = true;
|
|
10540
11499
|
return finalise(r, e, Ctor.rounding, m);
|
|
10541
11500
|
};
|
|
10542
11501
|
P.tangent = P.tan = function() {
|
|
@@ -10594,7 +11553,7 @@ P.times = P.mul = function(y) {
|
|
|
10594
11553
|
r.shift();
|
|
10595
11554
|
y.d = r;
|
|
10596
11555
|
y.e = getBase10Exponent(r, e);
|
|
10597
|
-
return
|
|
11556
|
+
return external2 ? finalise(y, Ctor.precision, Ctor.rounding) : y;
|
|
10598
11557
|
};
|
|
10599
11558
|
P.toBinary = function(sd, rm) {
|
|
10600
11559
|
return toStringBinary(this, 2, sd, rm);
|
|
@@ -10659,7 +11618,7 @@ P.toFraction = function(maxD) {
|
|
|
10659
11618
|
throw Error(invalidArgument + n);
|
|
10660
11619
|
maxD = n.gt(d) ? e > 0 ? d : n1 : n;
|
|
10661
11620
|
}
|
|
10662
|
-
|
|
11621
|
+
external2 = false;
|
|
10663
11622
|
n = new Ctor(digitsToString(xd));
|
|
10664
11623
|
pr = Ctor.precision;
|
|
10665
11624
|
Ctor.precision = e = xd.length * LOG_BASE * 2;
|
|
@@ -10683,7 +11642,7 @@ P.toFraction = function(maxD) {
|
|
|
10683
11642
|
n0.s = n1.s = x.s;
|
|
10684
11643
|
r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
|
|
10685
11644
|
Ctor.precision = pr;
|
|
10686
|
-
|
|
11645
|
+
external2 = true;
|
|
10687
11646
|
return r;
|
|
10688
11647
|
};
|
|
10689
11648
|
P.toHexadecimal = P.toHex = function(sd, rm) {
|
|
@@ -10713,9 +11672,9 @@ P.toNearest = function(y, rm) {
|
|
|
10713
11672
|
}
|
|
10714
11673
|
}
|
|
10715
11674
|
if (y.d[0]) {
|
|
10716
|
-
|
|
11675
|
+
external2 = false;
|
|
10717
11676
|
x = divide(x, y, 0, rm, 1).times(y);
|
|
10718
|
-
|
|
11677
|
+
external2 = true;
|
|
10719
11678
|
finalise(x);
|
|
10720
11679
|
} else {
|
|
10721
11680
|
y.s = x.s;
|
|
@@ -10760,7 +11719,7 @@ P.toPower = P.pow = function(y) {
|
|
|
10760
11719
|
e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e;
|
|
10761
11720
|
if (e > Ctor.maxE + 1 || e < Ctor.minE - 1)
|
|
10762
11721
|
return new Ctor(e > 0 ? s / 0 : 0);
|
|
10763
|
-
|
|
11722
|
+
external2 = false;
|
|
10764
11723
|
Ctor.rounding = x.s = 1;
|
|
10765
11724
|
k = Math.min(12, (e + "").length);
|
|
10766
11725
|
r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
|
|
@@ -10775,7 +11734,7 @@ P.toPower = P.pow = function(y) {
|
|
|
10775
11734
|
}
|
|
10776
11735
|
}
|
|
10777
11736
|
r.s = s;
|
|
10778
|
-
|
|
11737
|
+
external2 = true;
|
|
10779
11738
|
Ctor.rounding = rm;
|
|
10780
11739
|
return finalise(r, pr, rm);
|
|
10781
11740
|
};
|
|
@@ -11174,7 +12133,7 @@ function finalise(x, sd, rm, isTruncated) {
|
|
|
11174
12133
|
for (i = xd.length;xd[--i] === 0; )
|
|
11175
12134
|
xd.pop();
|
|
11176
12135
|
}
|
|
11177
|
-
if (
|
|
12136
|
+
if (external2) {
|
|
11178
12137
|
if (x.e > Ctor.maxE) {
|
|
11179
12138
|
x.d = null;
|
|
11180
12139
|
x.e = NaN;
|
|
@@ -11223,7 +12182,7 @@ function getBase10Exponent(digits, e) {
|
|
|
11223
12182
|
}
|
|
11224
12183
|
function getLn10(Ctor, sd, pr) {
|
|
11225
12184
|
if (sd > LN10_PRECISION) {
|
|
11226
|
-
|
|
12185
|
+
external2 = true;
|
|
11227
12186
|
if (pr)
|
|
11228
12187
|
Ctor.precision = pr;
|
|
11229
12188
|
throw Error(precisionLimitExceeded);
|
|
@@ -11254,7 +12213,7 @@ function getZeroString(k) {
|
|
|
11254
12213
|
}
|
|
11255
12214
|
function intPow(Ctor, x, n, pr) {
|
|
11256
12215
|
var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4);
|
|
11257
|
-
|
|
12216
|
+
external2 = false;
|
|
11258
12217
|
for (;; ) {
|
|
11259
12218
|
if (n % 2) {
|
|
11260
12219
|
r = r.times(x);
|
|
@@ -11271,7 +12230,7 @@ function intPow(Ctor, x, n, pr) {
|
|
|
11271
12230
|
x = x.times(x);
|
|
11272
12231
|
truncate(x.d, k);
|
|
11273
12232
|
}
|
|
11274
|
-
|
|
12233
|
+
external2 = true;
|
|
11275
12234
|
return r;
|
|
11276
12235
|
}
|
|
11277
12236
|
function isOdd(n) {
|
|
@@ -11298,7 +12257,7 @@ function naturalExponential(x, sd) {
|
|
|
11298
12257
|
return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
|
|
11299
12258
|
}
|
|
11300
12259
|
if (sd == null) {
|
|
11301
|
-
|
|
12260
|
+
external2 = false;
|
|
11302
12261
|
wpr = pr;
|
|
11303
12262
|
} else {
|
|
11304
12263
|
wpr = sd;
|
|
@@ -11327,7 +12286,7 @@ function naturalExponential(x, sd) {
|
|
|
11327
12286
|
i = 0;
|
|
11328
12287
|
rep++;
|
|
11329
12288
|
} else {
|
|
11330
|
-
return finalise(sum, Ctor.precision = pr, rm,
|
|
12289
|
+
return finalise(sum, Ctor.precision = pr, rm, external2 = true);
|
|
11331
12290
|
}
|
|
11332
12291
|
} else {
|
|
11333
12292
|
Ctor.precision = pr;
|
|
@@ -11343,7 +12302,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11343
12302
|
return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
|
|
11344
12303
|
}
|
|
11345
12304
|
if (sd == null) {
|
|
11346
|
-
|
|
12305
|
+
external2 = false;
|
|
11347
12306
|
wpr = pr;
|
|
11348
12307
|
} else {
|
|
11349
12308
|
wpr = sd;
|
|
@@ -11369,7 +12328,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11369
12328
|
t = getLn10(Ctor, wpr + 2, pr).times(e + "");
|
|
11370
12329
|
x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t);
|
|
11371
12330
|
Ctor.precision = pr;
|
|
11372
|
-
return sd == null ? finalise(x, pr, rm,
|
|
12331
|
+
return sd == null ? finalise(x, pr, rm, external2 = true) : x;
|
|
11373
12332
|
}
|
|
11374
12333
|
x1 = x;
|
|
11375
12334
|
sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
|
|
@@ -11390,7 +12349,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11390
12349
|
x2 = finalise(x.times(x), wpr, 1);
|
|
11391
12350
|
denominator = rep = 1;
|
|
11392
12351
|
} else {
|
|
11393
|
-
return finalise(sum, Ctor.precision = pr, rm,
|
|
12352
|
+
return finalise(sum, Ctor.precision = pr, rm, external2 = true);
|
|
11394
12353
|
}
|
|
11395
12354
|
} else {
|
|
11396
12355
|
Ctor.precision = pr;
|
|
@@ -11441,7 +12400,7 @@ function parseDecimal(x, str) {
|
|
|
11441
12400
|
for (;i--; )
|
|
11442
12401
|
str += "0";
|
|
11443
12402
|
x.d.push(+str);
|
|
11444
|
-
if (
|
|
12403
|
+
if (external2) {
|
|
11445
12404
|
if (x.e > x.constructor.maxE) {
|
|
11446
12405
|
x.d = null;
|
|
11447
12406
|
x.e = NaN;
|
|
@@ -11503,12 +12462,12 @@ function parseOther(x, str) {
|
|
|
11503
12462
|
return new Ctor(x.s * 0);
|
|
11504
12463
|
x.e = getBase10Exponent(xd, xe);
|
|
11505
12464
|
x.d = xd;
|
|
11506
|
-
|
|
12465
|
+
external2 = false;
|
|
11507
12466
|
if (isFloat)
|
|
11508
12467
|
x = divide(x, divisor, len * 4);
|
|
11509
12468
|
if (p)
|
|
11510
12469
|
x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
|
|
11511
|
-
|
|
12470
|
+
external2 = true;
|
|
11512
12471
|
return x;
|
|
11513
12472
|
}
|
|
11514
12473
|
function sine(Ctor, x) {
|
|
@@ -11529,7 +12488,7 @@ function sine(Ctor, x) {
|
|
|
11529
12488
|
}
|
|
11530
12489
|
function taylorSeries(Ctor, n, x, y, isHyperbolic) {
|
|
11531
12490
|
var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE);
|
|
11532
|
-
|
|
12491
|
+
external2 = false;
|
|
11533
12492
|
x2 = x.times(x);
|
|
11534
12493
|
u = new Ctor(y);
|
|
11535
12494
|
for (;; ) {
|
|
@@ -11549,7 +12508,7 @@ function taylorSeries(Ctor, n, x, y, isHyperbolic) {
|
|
|
11549
12508
|
t = j;
|
|
11550
12509
|
i++;
|
|
11551
12510
|
}
|
|
11552
|
-
|
|
12511
|
+
external2 = true;
|
|
11553
12512
|
t.d.length = k + 1;
|
|
11554
12513
|
return t;
|
|
11555
12514
|
}
|
|
@@ -11818,7 +12777,7 @@ function clone(obj) {
|
|
|
11818
12777
|
x.constructor = Decimal;
|
|
11819
12778
|
if (isDecimalInstance(v)) {
|
|
11820
12779
|
x.s = v.s;
|
|
11821
|
-
if (
|
|
12780
|
+
if (external2) {
|
|
11822
12781
|
if (!v.d || v.e > Decimal.maxE) {
|
|
11823
12782
|
x.e = NaN;
|
|
11824
12783
|
x.d = null;
|
|
@@ -11852,7 +12811,7 @@ function clone(obj) {
|
|
|
11852
12811
|
if (v === ~~v && v < 1e7) {
|
|
11853
12812
|
for (e = 0, i2 = v;i2 >= 10; i2 /= 10)
|
|
11854
12813
|
e++;
|
|
11855
|
-
if (
|
|
12814
|
+
if (external2) {
|
|
11856
12815
|
if (e > Decimal.maxE) {
|
|
11857
12816
|
x.e = NaN;
|
|
11858
12817
|
x.d = null;
|
|
@@ -11976,12 +12935,12 @@ function floor(x) {
|
|
|
11976
12935
|
}
|
|
11977
12936
|
function hypot() {
|
|
11978
12937
|
var i, n, t = new this(0);
|
|
11979
|
-
|
|
12938
|
+
external2 = false;
|
|
11980
12939
|
for (i = 0;i < arguments.length; ) {
|
|
11981
12940
|
n = new this(arguments[i++]);
|
|
11982
12941
|
if (!n.d) {
|
|
11983
12942
|
if (n.s) {
|
|
11984
|
-
|
|
12943
|
+
external2 = true;
|
|
11985
12944
|
return new this(1 / 0);
|
|
11986
12945
|
}
|
|
11987
12946
|
t = n;
|
|
@@ -11989,7 +12948,7 @@ function hypot() {
|
|
|
11989
12948
|
t = t.plus(n.times(n));
|
|
11990
12949
|
}
|
|
11991
12950
|
}
|
|
11992
|
-
|
|
12951
|
+
external2 = true;
|
|
11993
12952
|
return t.sqrt();
|
|
11994
12953
|
}
|
|
11995
12954
|
function isDecimalInstance(obj) {
|
|
@@ -12102,10 +13061,10 @@ function sub(x, y) {
|
|
|
12102
13061
|
}
|
|
12103
13062
|
function sum() {
|
|
12104
13063
|
var i = 0, args = arguments, x = new this(args[i]);
|
|
12105
|
-
|
|
13064
|
+
external2 = false;
|
|
12106
13065
|
for (;x.s && ++i < args.length; )
|
|
12107
13066
|
x = x.plus(args[i]);
|
|
12108
|
-
|
|
13067
|
+
external2 = true;
|
|
12109
13068
|
return finalise(x, this.precision, this.rounding);
|
|
12110
13069
|
}
|
|
12111
13070
|
function tan(x) {
|
|
@@ -12550,6 +13509,28 @@ async function uploadFile(file, filename) {
|
|
|
12550
13509
|
throw new Error(`上传到 OSS 失败: ${error}`);
|
|
12551
13510
|
}
|
|
12552
13511
|
}
|
|
13512
|
+
// src/node/cron/index.ts
|
|
13513
|
+
var import_node_cron = __toESM(require_node_cron());
|
|
13514
|
+
var interval = (intervalMinutes, immediately, fn) => {
|
|
13515
|
+
console.log(`定时任务已启动,将每${intervalMinutes}分钟执行一次`);
|
|
13516
|
+
if (immediately) {
|
|
13517
|
+
fn();
|
|
13518
|
+
}
|
|
13519
|
+
setInterval(() => {
|
|
13520
|
+
fn();
|
|
13521
|
+
}, intervalMinutes * 60 * 1000);
|
|
13522
|
+
};
|
|
13523
|
+
var schedule = (cronExpression, immediately, fn) => {
|
|
13524
|
+
console.log(`定时任务已启动,cron表达式: ${cronExpression}`);
|
|
13525
|
+
if (immediately) {
|
|
13526
|
+
fn();
|
|
13527
|
+
}
|
|
13528
|
+
import_node_cron.default.schedule(cronExpression, () => {
|
|
13529
|
+
fn();
|
|
13530
|
+
}, {
|
|
13531
|
+
timezone: "Asia/Shanghai"
|
|
13532
|
+
});
|
|
13533
|
+
};
|
|
12553
13534
|
|
|
12554
13535
|
// src/node/index.ts
|
|
12555
13536
|
var import_nedb = __toESM(require("nedb"));
|