@wzyjs/utils 0.2.67 → 0.2.69
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.esm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -24,6 +25,7 @@ var __export = (target, all) => {
|
|
|
24
25
|
set: (newValue) => all[name] = () => newValue
|
|
25
26
|
});
|
|
26
27
|
};
|
|
28
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
27
29
|
|
|
28
30
|
// ../../node_modules/lodash/lodash.js
|
|
29
31
|
var require_lodash = __commonJS((exports, module) => {
|
|
@@ -723,7 +725,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
723
725
|
var objectCtorString = funcToString.call(Object2);
|
|
724
726
|
var oldDash = root._;
|
|
725
727
|
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
726
|
-
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol,
|
|
728
|
+
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;
|
|
727
729
|
var defineProperty = function() {
|
|
728
730
|
try {
|
|
729
731
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -1968,7 +1970,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
1968
1970
|
end = end === undefined2 ? length : end;
|
|
1969
1971
|
return !start && end >= length ? array : baseSlice(array, start, end);
|
|
1970
1972
|
}
|
|
1971
|
-
var
|
|
1973
|
+
var clearTimeout2 = ctxClearTimeout || function(id) {
|
|
1972
1974
|
return root.clearTimeout(id);
|
|
1973
1975
|
};
|
|
1974
1976
|
function cloneBuffer(buffer, isDeep) {
|
|
@@ -1981,7 +1983,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
1981
1983
|
}
|
|
1982
1984
|
function cloneArrayBuffer(arrayBuffer) {
|
|
1983
1985
|
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
1984
|
-
new
|
|
1986
|
+
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
|
|
1985
1987
|
return result2;
|
|
1986
1988
|
}
|
|
1987
1989
|
function cloneDataView(dataView, isDeep) {
|
|
@@ -2563,7 +2565,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
2563
2565
|
object = object.buffer;
|
|
2564
2566
|
other = other.buffer;
|
|
2565
2567
|
case arrayBufferTag:
|
|
2566
|
-
if (object.byteLength != other.byteLength || !equalFunc(new
|
|
2568
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
|
|
2567
2569
|
return false;
|
|
2568
2570
|
}
|
|
2569
2571
|
return true;
|
|
@@ -3816,7 +3818,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
3816
3818
|
}
|
|
3817
3819
|
function cancel() {
|
|
3818
3820
|
if (timerId !== undefined2) {
|
|
3819
|
-
|
|
3821
|
+
clearTimeout2(timerId);
|
|
3820
3822
|
}
|
|
3821
3823
|
lastInvokeTime = 0;
|
|
3822
3824
|
lastArgs = lastCallTime = lastThis = timerId = undefined2;
|
|
@@ -3834,7 +3836,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
3834
3836
|
return leadingEdge(lastCallTime);
|
|
3835
3837
|
}
|
|
3836
3838
|
if (maxing) {
|
|
3837
|
-
|
|
3839
|
+
clearTimeout2(timerId);
|
|
3838
3840
|
timerId = setTimeout2(timerExpired, wait);
|
|
3839
3841
|
return invokeFunc(lastCallTime);
|
|
3840
3842
|
}
|
|
@@ -5441,16 +5443,1116 @@ __p += '`;
|
|
|
5441
5443
|
}).call(exports);
|
|
5442
5444
|
});
|
|
5443
5445
|
|
|
5446
|
+
// ../../node_modules/node-cron/src/task.js
|
|
5447
|
+
var require_task = __commonJS((exports, module) => {
|
|
5448
|
+
var EventEmitter = __require("events");
|
|
5449
|
+
|
|
5450
|
+
class Task extends EventEmitter {
|
|
5451
|
+
constructor(execution) {
|
|
5452
|
+
super();
|
|
5453
|
+
if (typeof execution !== "function") {
|
|
5454
|
+
throw "execution must be a function";
|
|
5455
|
+
}
|
|
5456
|
+
this._execution = execution;
|
|
5457
|
+
}
|
|
5458
|
+
execute(now) {
|
|
5459
|
+
let exec;
|
|
5460
|
+
try {
|
|
5461
|
+
exec = this._execution(now);
|
|
5462
|
+
} catch (error) {
|
|
5463
|
+
return this.emit("task-failed", error);
|
|
5464
|
+
}
|
|
5465
|
+
if (exec instanceof Promise) {
|
|
5466
|
+
return exec.then(() => this.emit("task-finished")).catch((error) => this.emit("task-failed", error));
|
|
5467
|
+
} else {
|
|
5468
|
+
this.emit("task-finished");
|
|
5469
|
+
return exec;
|
|
5470
|
+
}
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
module.exports = Task;
|
|
5474
|
+
});
|
|
5475
|
+
|
|
5476
|
+
// ../../node_modules/node-cron/src/convert-expression/month-names-conversion.js
|
|
5477
|
+
var require_month_names_conversion = __commonJS((exports, module) => {
|
|
5478
|
+
module.exports = (() => {
|
|
5479
|
+
const months = [
|
|
5480
|
+
"january",
|
|
5481
|
+
"february",
|
|
5482
|
+
"march",
|
|
5483
|
+
"april",
|
|
5484
|
+
"may",
|
|
5485
|
+
"june",
|
|
5486
|
+
"july",
|
|
5487
|
+
"august",
|
|
5488
|
+
"september",
|
|
5489
|
+
"october",
|
|
5490
|
+
"november",
|
|
5491
|
+
"december"
|
|
5492
|
+
];
|
|
5493
|
+
const shortMonths = [
|
|
5494
|
+
"jan",
|
|
5495
|
+
"feb",
|
|
5496
|
+
"mar",
|
|
5497
|
+
"apr",
|
|
5498
|
+
"may",
|
|
5499
|
+
"jun",
|
|
5500
|
+
"jul",
|
|
5501
|
+
"aug",
|
|
5502
|
+
"sep",
|
|
5503
|
+
"oct",
|
|
5504
|
+
"nov",
|
|
5505
|
+
"dec"
|
|
5506
|
+
];
|
|
5507
|
+
function convertMonthName(expression, items) {
|
|
5508
|
+
for (let i = 0;i < items.length; i++) {
|
|
5509
|
+
expression = expression.replace(new RegExp(items[i], "gi"), parseInt(i, 10) + 1);
|
|
5510
|
+
}
|
|
5511
|
+
return expression;
|
|
5512
|
+
}
|
|
5513
|
+
function interprete(monthExpression) {
|
|
5514
|
+
monthExpression = convertMonthName(monthExpression, months);
|
|
5515
|
+
monthExpression = convertMonthName(monthExpression, shortMonths);
|
|
5516
|
+
return monthExpression;
|
|
5517
|
+
}
|
|
5518
|
+
return interprete;
|
|
5519
|
+
})();
|
|
5520
|
+
});
|
|
5521
|
+
|
|
5522
|
+
// ../../node_modules/node-cron/src/convert-expression/week-day-names-conversion.js
|
|
5523
|
+
var require_week_day_names_conversion = __commonJS((exports, module) => {
|
|
5524
|
+
module.exports = (() => {
|
|
5525
|
+
const weekDays = [
|
|
5526
|
+
"sunday",
|
|
5527
|
+
"monday",
|
|
5528
|
+
"tuesday",
|
|
5529
|
+
"wednesday",
|
|
5530
|
+
"thursday",
|
|
5531
|
+
"friday",
|
|
5532
|
+
"saturday"
|
|
5533
|
+
];
|
|
5534
|
+
const shortWeekDays = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
5535
|
+
function convertWeekDayName(expression, items) {
|
|
5536
|
+
for (let i = 0;i < items.length; i++) {
|
|
5537
|
+
expression = expression.replace(new RegExp(items[i], "gi"), parseInt(i, 10));
|
|
5538
|
+
}
|
|
5539
|
+
return expression;
|
|
5540
|
+
}
|
|
5541
|
+
function convertWeekDays(expression) {
|
|
5542
|
+
expression = expression.replace("7", "0");
|
|
5543
|
+
expression = convertWeekDayName(expression, weekDays);
|
|
5544
|
+
return convertWeekDayName(expression, shortWeekDays);
|
|
5545
|
+
}
|
|
5546
|
+
return convertWeekDays;
|
|
5547
|
+
})();
|
|
5548
|
+
});
|
|
5549
|
+
|
|
5550
|
+
// ../../node_modules/node-cron/src/convert-expression/asterisk-to-range-conversion.js
|
|
5551
|
+
var require_asterisk_to_range_conversion = __commonJS((exports, module) => {
|
|
5552
|
+
module.exports = (() => {
|
|
5553
|
+
function convertAsterisk(expression, replecement) {
|
|
5554
|
+
if (expression.indexOf("*") !== -1) {
|
|
5555
|
+
return expression.replace("*", replecement);
|
|
5556
|
+
}
|
|
5557
|
+
return expression;
|
|
5558
|
+
}
|
|
5559
|
+
function convertAsterisksToRanges(expressions) {
|
|
5560
|
+
expressions[0] = convertAsterisk(expressions[0], "0-59");
|
|
5561
|
+
expressions[1] = convertAsterisk(expressions[1], "0-59");
|
|
5562
|
+
expressions[2] = convertAsterisk(expressions[2], "0-23");
|
|
5563
|
+
expressions[3] = convertAsterisk(expressions[3], "1-31");
|
|
5564
|
+
expressions[4] = convertAsterisk(expressions[4], "1-12");
|
|
5565
|
+
expressions[5] = convertAsterisk(expressions[5], "0-6");
|
|
5566
|
+
return expressions;
|
|
5567
|
+
}
|
|
5568
|
+
return convertAsterisksToRanges;
|
|
5569
|
+
})();
|
|
5570
|
+
});
|
|
5571
|
+
|
|
5572
|
+
// ../../node_modules/node-cron/src/convert-expression/range-conversion.js
|
|
5573
|
+
var require_range_conversion = __commonJS((exports, module) => {
|
|
5574
|
+
module.exports = (() => {
|
|
5575
|
+
function replaceWithRange(expression, text, init, end) {
|
|
5576
|
+
const numbers = [];
|
|
5577
|
+
let last = parseInt(end);
|
|
5578
|
+
let first = parseInt(init);
|
|
5579
|
+
if (first > last) {
|
|
5580
|
+
last = parseInt(init);
|
|
5581
|
+
first = parseInt(end);
|
|
5582
|
+
}
|
|
5583
|
+
for (let i = first;i <= last; i++) {
|
|
5584
|
+
numbers.push(i);
|
|
5585
|
+
}
|
|
5586
|
+
return expression.replace(new RegExp(text, "i"), numbers.join());
|
|
5587
|
+
}
|
|
5588
|
+
function convertRange(expression) {
|
|
5589
|
+
const rangeRegEx = /(\d+)-(\d+)/;
|
|
5590
|
+
let match = rangeRegEx.exec(expression);
|
|
5591
|
+
while (match !== null && match.length > 0) {
|
|
5592
|
+
expression = replaceWithRange(expression, match[0], match[1], match[2]);
|
|
5593
|
+
match = rangeRegEx.exec(expression);
|
|
5594
|
+
}
|
|
5595
|
+
return expression;
|
|
5596
|
+
}
|
|
5597
|
+
function convertAllRanges(expressions) {
|
|
5598
|
+
for (let i = 0;i < expressions.length; i++) {
|
|
5599
|
+
expressions[i] = convertRange(expressions[i]);
|
|
5600
|
+
}
|
|
5601
|
+
return expressions;
|
|
5602
|
+
}
|
|
5603
|
+
return convertAllRanges;
|
|
5604
|
+
})();
|
|
5605
|
+
});
|
|
5606
|
+
|
|
5607
|
+
// ../../node_modules/node-cron/src/convert-expression/step-values-conversion.js
|
|
5608
|
+
var require_step_values_conversion = __commonJS((exports, module) => {
|
|
5609
|
+
module.exports = (() => {
|
|
5610
|
+
function convertSteps(expressions) {
|
|
5611
|
+
var stepValuePattern = /^(.+)\/(\w+)$/;
|
|
5612
|
+
for (var i = 0;i < expressions.length; i++) {
|
|
5613
|
+
var match = stepValuePattern.exec(expressions[i]);
|
|
5614
|
+
var isStepValue = match !== null && match.length > 0;
|
|
5615
|
+
if (isStepValue) {
|
|
5616
|
+
var baseDivider = match[2];
|
|
5617
|
+
if (isNaN(baseDivider)) {
|
|
5618
|
+
throw baseDivider + " is not a valid step value";
|
|
5619
|
+
}
|
|
5620
|
+
var values = match[1].split(",");
|
|
5621
|
+
var stepValues = [];
|
|
5622
|
+
var divider = parseInt(baseDivider, 10);
|
|
5623
|
+
for (var j = 0;j <= values.length; j++) {
|
|
5624
|
+
var value = parseInt(values[j], 10);
|
|
5625
|
+
if (value % divider === 0) {
|
|
5626
|
+
stepValues.push(value);
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
expressions[i] = stepValues.join(",");
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
return expressions;
|
|
5633
|
+
}
|
|
5634
|
+
return convertSteps;
|
|
5635
|
+
})();
|
|
5636
|
+
});
|
|
5637
|
+
|
|
5638
|
+
// ../../node_modules/node-cron/src/convert-expression/index.js
|
|
5639
|
+
var require_convert_expression = __commonJS((exports, module) => {
|
|
5640
|
+
var monthNamesConversion = require_month_names_conversion();
|
|
5641
|
+
var weekDayNamesConversion = require_week_day_names_conversion();
|
|
5642
|
+
var convertAsterisksToRanges = require_asterisk_to_range_conversion();
|
|
5643
|
+
var convertRanges = require_range_conversion();
|
|
5644
|
+
var convertSteps = require_step_values_conversion();
|
|
5645
|
+
module.exports = (() => {
|
|
5646
|
+
function appendSeccondExpression(expressions) {
|
|
5647
|
+
if (expressions.length === 5) {
|
|
5648
|
+
return ["0"].concat(expressions);
|
|
5649
|
+
}
|
|
5650
|
+
return expressions;
|
|
5651
|
+
}
|
|
5652
|
+
function removeSpaces(str) {
|
|
5653
|
+
return str.replace(/\s{2,}/g, " ").trim();
|
|
5654
|
+
}
|
|
5655
|
+
function normalizeIntegers(expressions) {
|
|
5656
|
+
for (let i = 0;i < expressions.length; i++) {
|
|
5657
|
+
const numbers = expressions[i].split(",");
|
|
5658
|
+
for (let j = 0;j < numbers.length; j++) {
|
|
5659
|
+
numbers[j] = parseInt(numbers[j]);
|
|
5660
|
+
}
|
|
5661
|
+
expressions[i] = numbers;
|
|
5662
|
+
}
|
|
5663
|
+
return expressions;
|
|
5664
|
+
}
|
|
5665
|
+
function interprete(expression) {
|
|
5666
|
+
let expressions = removeSpaces(expression).split(" ");
|
|
5667
|
+
expressions = appendSeccondExpression(expressions);
|
|
5668
|
+
expressions[4] = monthNamesConversion(expressions[4]);
|
|
5669
|
+
expressions[5] = weekDayNamesConversion(expressions[5]);
|
|
5670
|
+
expressions = convertAsterisksToRanges(expressions);
|
|
5671
|
+
expressions = convertRanges(expressions);
|
|
5672
|
+
expressions = convertSteps(expressions);
|
|
5673
|
+
expressions = normalizeIntegers(expressions);
|
|
5674
|
+
return expressions.join(" ");
|
|
5675
|
+
}
|
|
5676
|
+
return interprete;
|
|
5677
|
+
})();
|
|
5678
|
+
});
|
|
5679
|
+
|
|
5680
|
+
// ../../node_modules/node-cron/src/pattern-validation.js
|
|
5681
|
+
var require_pattern_validation = __commonJS((exports, module) => {
|
|
5682
|
+
var convertExpression = require_convert_expression();
|
|
5683
|
+
var validationRegex = /^(?:\d+|\*|\*\/\d+)$/;
|
|
5684
|
+
function isValidExpression(expression, min2, max2) {
|
|
5685
|
+
const options = expression.split(",");
|
|
5686
|
+
for (const option of options) {
|
|
5687
|
+
const optionAsInt = parseInt(option, 10);
|
|
5688
|
+
if (!Number.isNaN(optionAsInt) && (optionAsInt < min2 || optionAsInt > max2) || !validationRegex.test(option))
|
|
5689
|
+
return false;
|
|
5690
|
+
}
|
|
5691
|
+
return true;
|
|
5692
|
+
}
|
|
5693
|
+
function isInvalidSecond(expression) {
|
|
5694
|
+
return !isValidExpression(expression, 0, 59);
|
|
5695
|
+
}
|
|
5696
|
+
function isInvalidMinute(expression) {
|
|
5697
|
+
return !isValidExpression(expression, 0, 59);
|
|
5698
|
+
}
|
|
5699
|
+
function isInvalidHour(expression) {
|
|
5700
|
+
return !isValidExpression(expression, 0, 23);
|
|
5701
|
+
}
|
|
5702
|
+
function isInvalidDayOfMonth(expression) {
|
|
5703
|
+
return !isValidExpression(expression, 1, 31);
|
|
5704
|
+
}
|
|
5705
|
+
function isInvalidMonth(expression) {
|
|
5706
|
+
return !isValidExpression(expression, 1, 12);
|
|
5707
|
+
}
|
|
5708
|
+
function isInvalidWeekDay(expression) {
|
|
5709
|
+
return !isValidExpression(expression, 0, 7);
|
|
5710
|
+
}
|
|
5711
|
+
function validateFields(patterns, executablePatterns) {
|
|
5712
|
+
if (isInvalidSecond(executablePatterns[0]))
|
|
5713
|
+
throw new Error(`${patterns[0]} is a invalid expression for second`);
|
|
5714
|
+
if (isInvalidMinute(executablePatterns[1]))
|
|
5715
|
+
throw new Error(`${patterns[1]} is a invalid expression for minute`);
|
|
5716
|
+
if (isInvalidHour(executablePatterns[2]))
|
|
5717
|
+
throw new Error(`${patterns[2]} is a invalid expression for hour`);
|
|
5718
|
+
if (isInvalidDayOfMonth(executablePatterns[3]))
|
|
5719
|
+
throw new Error(`${patterns[3]} is a invalid expression for day of month`);
|
|
5720
|
+
if (isInvalidMonth(executablePatterns[4]))
|
|
5721
|
+
throw new Error(`${patterns[4]} is a invalid expression for month`);
|
|
5722
|
+
if (isInvalidWeekDay(executablePatterns[5]))
|
|
5723
|
+
throw new Error(`${patterns[5]} is a invalid expression for week day`);
|
|
5724
|
+
}
|
|
5725
|
+
function validate(pattern) {
|
|
5726
|
+
if (typeof pattern !== "string")
|
|
5727
|
+
throw new TypeError("pattern must be a string!");
|
|
5728
|
+
const patterns = pattern.split(" ");
|
|
5729
|
+
const executablePatterns = convertExpression(pattern).split(" ");
|
|
5730
|
+
if (patterns.length === 5)
|
|
5731
|
+
patterns.unshift("0");
|
|
5732
|
+
validateFields(patterns, executablePatterns);
|
|
5733
|
+
}
|
|
5734
|
+
module.exports = validate;
|
|
5735
|
+
});
|
|
5736
|
+
|
|
5737
|
+
// ../../node_modules/node-cron/src/time-matcher.js
|
|
5738
|
+
var require_time_matcher = __commonJS((exports, module) => {
|
|
5739
|
+
var validatePattern = require_pattern_validation();
|
|
5740
|
+
var convertExpression = require_convert_expression();
|
|
5741
|
+
function matchPattern(pattern, value) {
|
|
5742
|
+
if (pattern.indexOf(",") !== -1) {
|
|
5743
|
+
const patterns = pattern.split(",");
|
|
5744
|
+
return patterns.indexOf(value.toString()) !== -1;
|
|
5745
|
+
}
|
|
5746
|
+
return pattern === value.toString();
|
|
5747
|
+
}
|
|
5748
|
+
|
|
5749
|
+
class TimeMatcher {
|
|
5750
|
+
constructor(pattern, timezone2) {
|
|
5751
|
+
validatePattern(pattern);
|
|
5752
|
+
this.pattern = convertExpression(pattern);
|
|
5753
|
+
this.timezone = timezone2;
|
|
5754
|
+
this.expressions = this.pattern.split(" ");
|
|
5755
|
+
this.dtf = this.timezone ? new Intl.DateTimeFormat("en-US", {
|
|
5756
|
+
year: "numeric",
|
|
5757
|
+
month: "2-digit",
|
|
5758
|
+
day: "2-digit",
|
|
5759
|
+
hour: "2-digit",
|
|
5760
|
+
minute: "2-digit",
|
|
5761
|
+
second: "2-digit",
|
|
5762
|
+
hourCycle: "h23",
|
|
5763
|
+
fractionalSecondDigits: 3,
|
|
5764
|
+
timeZone: this.timezone
|
|
5765
|
+
}) : null;
|
|
5766
|
+
}
|
|
5767
|
+
match(date) {
|
|
5768
|
+
date = this.apply(date);
|
|
5769
|
+
const runOnSecond = matchPattern(this.expressions[0], date.getSeconds());
|
|
5770
|
+
const runOnMinute = matchPattern(this.expressions[1], date.getMinutes());
|
|
5771
|
+
const runOnHour = matchPattern(this.expressions[2], date.getHours());
|
|
5772
|
+
const runOnDay = matchPattern(this.expressions[3], date.getDate());
|
|
5773
|
+
const runOnMonth = matchPattern(this.expressions[4], date.getMonth() + 1);
|
|
5774
|
+
const runOnWeekDay = matchPattern(this.expressions[5], date.getDay());
|
|
5775
|
+
return runOnSecond && runOnMinute && runOnHour && runOnDay && runOnMonth && runOnWeekDay;
|
|
5776
|
+
}
|
|
5777
|
+
apply(date) {
|
|
5778
|
+
if (this.dtf) {
|
|
5779
|
+
return new Date(this.dtf.format(date));
|
|
5780
|
+
}
|
|
5781
|
+
return date;
|
|
5782
|
+
}
|
|
5783
|
+
}
|
|
5784
|
+
module.exports = TimeMatcher;
|
|
5785
|
+
});
|
|
5786
|
+
|
|
5787
|
+
// ../../node_modules/node-cron/src/scheduler.js
|
|
5788
|
+
var require_scheduler = __commonJS((exports, module) => {
|
|
5789
|
+
var EventEmitter = __require("events");
|
|
5790
|
+
var TimeMatcher = require_time_matcher();
|
|
5791
|
+
|
|
5792
|
+
class Scheduler extends EventEmitter {
|
|
5793
|
+
constructor(pattern, timezone2, autorecover) {
|
|
5794
|
+
super();
|
|
5795
|
+
this.timeMatcher = new TimeMatcher(pattern, timezone2);
|
|
5796
|
+
this.autorecover = autorecover;
|
|
5797
|
+
}
|
|
5798
|
+
start() {
|
|
5799
|
+
this.stop();
|
|
5800
|
+
let lastCheck = process.hrtime();
|
|
5801
|
+
let lastExecution = this.timeMatcher.apply(new Date);
|
|
5802
|
+
const matchTime = () => {
|
|
5803
|
+
const delay2 = 1000;
|
|
5804
|
+
const elapsedTime = process.hrtime(lastCheck);
|
|
5805
|
+
const elapsedMs = (elapsedTime[0] * 1e9 + elapsedTime[1]) / 1e6;
|
|
5806
|
+
const missedExecutions = Math.floor(elapsedMs / 1000);
|
|
5807
|
+
for (let i = missedExecutions;i >= 0; i--) {
|
|
5808
|
+
const date = new Date(new Date().getTime() - i * 1000);
|
|
5809
|
+
let date_tmp = this.timeMatcher.apply(date);
|
|
5810
|
+
if (lastExecution.getTime() < date_tmp.getTime() && (i === 0 || this.autorecover) && this.timeMatcher.match(date)) {
|
|
5811
|
+
this.emit("scheduled-time-matched", date_tmp);
|
|
5812
|
+
date_tmp.setMilliseconds(0);
|
|
5813
|
+
lastExecution = date_tmp;
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
lastCheck = process.hrtime();
|
|
5817
|
+
this.timeout = setTimeout(matchTime, delay2);
|
|
5818
|
+
};
|
|
5819
|
+
matchTime();
|
|
5820
|
+
}
|
|
5821
|
+
stop() {
|
|
5822
|
+
if (this.timeout) {
|
|
5823
|
+
clearTimeout(this.timeout);
|
|
5824
|
+
}
|
|
5825
|
+
this.timeout = null;
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5828
|
+
module.exports = Scheduler;
|
|
5829
|
+
});
|
|
5830
|
+
|
|
5831
|
+
// ../../node_modules/uuid/dist/rng.js
|
|
5832
|
+
var require_rng = __commonJS((exports) => {
|
|
5833
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5834
|
+
value: true
|
|
5835
|
+
});
|
|
5836
|
+
exports.default = rng;
|
|
5837
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
5838
|
+
function _interopRequireDefault(obj) {
|
|
5839
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5840
|
+
}
|
|
5841
|
+
var rnds8Pool = new Uint8Array(256);
|
|
5842
|
+
var poolPtr = rnds8Pool.length;
|
|
5843
|
+
function rng() {
|
|
5844
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
5845
|
+
_crypto.default.randomFillSync(rnds8Pool);
|
|
5846
|
+
poolPtr = 0;
|
|
5847
|
+
}
|
|
5848
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
5849
|
+
}
|
|
5850
|
+
});
|
|
5851
|
+
|
|
5852
|
+
// ../../node_modules/uuid/dist/regex.js
|
|
5853
|
+
var require_regex = __commonJS((exports) => {
|
|
5854
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5855
|
+
value: true
|
|
5856
|
+
});
|
|
5857
|
+
exports.default = undefined;
|
|
5858
|
+
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;
|
|
5859
|
+
exports.default = _default;
|
|
5860
|
+
});
|
|
5861
|
+
|
|
5862
|
+
// ../../node_modules/uuid/dist/validate.js
|
|
5863
|
+
var require_validate = __commonJS((exports) => {
|
|
5864
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5865
|
+
value: true
|
|
5866
|
+
});
|
|
5867
|
+
exports.default = undefined;
|
|
5868
|
+
var _regex = _interopRequireDefault(require_regex());
|
|
5869
|
+
function _interopRequireDefault(obj) {
|
|
5870
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5871
|
+
}
|
|
5872
|
+
function validate(uuid) {
|
|
5873
|
+
return typeof uuid === "string" && _regex.default.test(uuid);
|
|
5874
|
+
}
|
|
5875
|
+
var _default = validate;
|
|
5876
|
+
exports.default = _default;
|
|
5877
|
+
});
|
|
5878
|
+
|
|
5879
|
+
// ../../node_modules/uuid/dist/stringify.js
|
|
5880
|
+
var require_stringify = __commonJS((exports) => {
|
|
5881
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5882
|
+
value: true
|
|
5883
|
+
});
|
|
5884
|
+
exports.default = undefined;
|
|
5885
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
5886
|
+
function _interopRequireDefault(obj) {
|
|
5887
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5888
|
+
}
|
|
5889
|
+
var byteToHex = [];
|
|
5890
|
+
for (let i = 0;i < 256; ++i) {
|
|
5891
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
|
5892
|
+
}
|
|
5893
|
+
function stringify(arr, offset = 0) {
|
|
5894
|
+
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();
|
|
5895
|
+
if (!(0, _validate.default)(uuid)) {
|
|
5896
|
+
throw TypeError("Stringified UUID is invalid");
|
|
5897
|
+
}
|
|
5898
|
+
return uuid;
|
|
5899
|
+
}
|
|
5900
|
+
var _default = stringify;
|
|
5901
|
+
exports.default = _default;
|
|
5902
|
+
});
|
|
5903
|
+
|
|
5904
|
+
// ../../node_modules/uuid/dist/v1.js
|
|
5905
|
+
var require_v1 = __commonJS((exports) => {
|
|
5906
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5907
|
+
value: true
|
|
5908
|
+
});
|
|
5909
|
+
exports.default = undefined;
|
|
5910
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
5911
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
5912
|
+
function _interopRequireDefault(obj) {
|
|
5913
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5914
|
+
}
|
|
5915
|
+
var _nodeId;
|
|
5916
|
+
var _clockseq;
|
|
5917
|
+
var _lastMSecs = 0;
|
|
5918
|
+
var _lastNSecs = 0;
|
|
5919
|
+
function v1(options, buf, offset) {
|
|
5920
|
+
let i = buf && offset || 0;
|
|
5921
|
+
const b = buf || new Array(16);
|
|
5922
|
+
options = options || {};
|
|
5923
|
+
let node = options.node || _nodeId;
|
|
5924
|
+
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
5925
|
+
if (node == null || clockseq == null) {
|
|
5926
|
+
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
5927
|
+
if (node == null) {
|
|
5928
|
+
node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
5929
|
+
}
|
|
5930
|
+
if (clockseq == null) {
|
|
5931
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
let msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
|
5935
|
+
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
5936
|
+
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4;
|
|
5937
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
5938
|
+
clockseq = clockseq + 1 & 16383;
|
|
5939
|
+
}
|
|
5940
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
5941
|
+
nsecs = 0;
|
|
5942
|
+
}
|
|
5943
|
+
if (nsecs >= 1e4) {
|
|
5944
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
5945
|
+
}
|
|
5946
|
+
_lastMSecs = msecs;
|
|
5947
|
+
_lastNSecs = nsecs;
|
|
5948
|
+
_clockseq = clockseq;
|
|
5949
|
+
msecs += 12219292800000;
|
|
5950
|
+
const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296;
|
|
5951
|
+
b[i++] = tl >>> 24 & 255;
|
|
5952
|
+
b[i++] = tl >>> 16 & 255;
|
|
5953
|
+
b[i++] = tl >>> 8 & 255;
|
|
5954
|
+
b[i++] = tl & 255;
|
|
5955
|
+
const tmh = msecs / 4294967296 * 1e4 & 268435455;
|
|
5956
|
+
b[i++] = tmh >>> 8 & 255;
|
|
5957
|
+
b[i++] = tmh & 255;
|
|
5958
|
+
b[i++] = tmh >>> 24 & 15 | 16;
|
|
5959
|
+
b[i++] = tmh >>> 16 & 255;
|
|
5960
|
+
b[i++] = clockseq >>> 8 | 128;
|
|
5961
|
+
b[i++] = clockseq & 255;
|
|
5962
|
+
for (let n = 0;n < 6; ++n) {
|
|
5963
|
+
b[i + n] = node[n];
|
|
5964
|
+
}
|
|
5965
|
+
return buf || (0, _stringify.default)(b);
|
|
5966
|
+
}
|
|
5967
|
+
var _default = v1;
|
|
5968
|
+
exports.default = _default;
|
|
5969
|
+
});
|
|
5970
|
+
|
|
5971
|
+
// ../../node_modules/uuid/dist/parse.js
|
|
5972
|
+
var require_parse = __commonJS((exports) => {
|
|
5973
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5974
|
+
value: true
|
|
5975
|
+
});
|
|
5976
|
+
exports.default = undefined;
|
|
5977
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
5978
|
+
function _interopRequireDefault(obj) {
|
|
5979
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5980
|
+
}
|
|
5981
|
+
function parse(uuid) {
|
|
5982
|
+
if (!(0, _validate.default)(uuid)) {
|
|
5983
|
+
throw TypeError("Invalid UUID");
|
|
5984
|
+
}
|
|
5985
|
+
let v;
|
|
5986
|
+
const arr = new Uint8Array(16);
|
|
5987
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
5988
|
+
arr[1] = v >>> 16 & 255;
|
|
5989
|
+
arr[2] = v >>> 8 & 255;
|
|
5990
|
+
arr[3] = v & 255;
|
|
5991
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
5992
|
+
arr[5] = v & 255;
|
|
5993
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
5994
|
+
arr[7] = v & 255;
|
|
5995
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
5996
|
+
arr[9] = v & 255;
|
|
5997
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
|
|
5998
|
+
arr[11] = v / 4294967296 & 255;
|
|
5999
|
+
arr[12] = v >>> 24 & 255;
|
|
6000
|
+
arr[13] = v >>> 16 & 255;
|
|
6001
|
+
arr[14] = v >>> 8 & 255;
|
|
6002
|
+
arr[15] = v & 255;
|
|
6003
|
+
return arr;
|
|
6004
|
+
}
|
|
6005
|
+
var _default = parse;
|
|
6006
|
+
exports.default = _default;
|
|
6007
|
+
});
|
|
6008
|
+
|
|
6009
|
+
// ../../node_modules/uuid/dist/v35.js
|
|
6010
|
+
var require_v35 = __commonJS((exports) => {
|
|
6011
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6012
|
+
value: true
|
|
6013
|
+
});
|
|
6014
|
+
exports.default = _default;
|
|
6015
|
+
exports.URL = exports.DNS = undefined;
|
|
6016
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6017
|
+
var _parse = _interopRequireDefault(require_parse());
|
|
6018
|
+
function _interopRequireDefault(obj) {
|
|
6019
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6020
|
+
}
|
|
6021
|
+
function stringToBytes(str) {
|
|
6022
|
+
str = unescape(encodeURIComponent(str));
|
|
6023
|
+
const bytes = [];
|
|
6024
|
+
for (let i = 0;i < str.length; ++i) {
|
|
6025
|
+
bytes.push(str.charCodeAt(i));
|
|
6026
|
+
}
|
|
6027
|
+
return bytes;
|
|
6028
|
+
}
|
|
6029
|
+
var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
6030
|
+
exports.DNS = DNS;
|
|
6031
|
+
var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
6032
|
+
exports.URL = URL2;
|
|
6033
|
+
function _default(name, version, hashfunc) {
|
|
6034
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
6035
|
+
if (typeof value === "string") {
|
|
6036
|
+
value = stringToBytes(value);
|
|
6037
|
+
}
|
|
6038
|
+
if (typeof namespace === "string") {
|
|
6039
|
+
namespace = (0, _parse.default)(namespace);
|
|
6040
|
+
}
|
|
6041
|
+
if (namespace.length !== 16) {
|
|
6042
|
+
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
6043
|
+
}
|
|
6044
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
6045
|
+
bytes.set(namespace);
|
|
6046
|
+
bytes.set(value, namespace.length);
|
|
6047
|
+
bytes = hashfunc(bytes);
|
|
6048
|
+
bytes[6] = bytes[6] & 15 | version;
|
|
6049
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
6050
|
+
if (buf) {
|
|
6051
|
+
offset = offset || 0;
|
|
6052
|
+
for (let i = 0;i < 16; ++i) {
|
|
6053
|
+
buf[offset + i] = bytes[i];
|
|
6054
|
+
}
|
|
6055
|
+
return buf;
|
|
6056
|
+
}
|
|
6057
|
+
return (0, _stringify.default)(bytes);
|
|
6058
|
+
}
|
|
6059
|
+
try {
|
|
6060
|
+
generateUUID.name = name;
|
|
6061
|
+
} catch (err) {}
|
|
6062
|
+
generateUUID.DNS = DNS;
|
|
6063
|
+
generateUUID.URL = URL2;
|
|
6064
|
+
return generateUUID;
|
|
6065
|
+
}
|
|
6066
|
+
});
|
|
6067
|
+
|
|
6068
|
+
// ../../node_modules/uuid/dist/md5.js
|
|
6069
|
+
var require_md5 = __commonJS((exports) => {
|
|
6070
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6071
|
+
value: true
|
|
6072
|
+
});
|
|
6073
|
+
exports.default = undefined;
|
|
6074
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
6075
|
+
function _interopRequireDefault(obj) {
|
|
6076
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6077
|
+
}
|
|
6078
|
+
function md5(bytes) {
|
|
6079
|
+
if (Array.isArray(bytes)) {
|
|
6080
|
+
bytes = Buffer.from(bytes);
|
|
6081
|
+
} else if (typeof bytes === "string") {
|
|
6082
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
6083
|
+
}
|
|
6084
|
+
return _crypto.default.createHash("md5").update(bytes).digest();
|
|
6085
|
+
}
|
|
6086
|
+
var _default = md5;
|
|
6087
|
+
exports.default = _default;
|
|
6088
|
+
});
|
|
6089
|
+
|
|
6090
|
+
// ../../node_modules/uuid/dist/v3.js
|
|
6091
|
+
var require_v3 = __commonJS((exports) => {
|
|
6092
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6093
|
+
value: true
|
|
6094
|
+
});
|
|
6095
|
+
exports.default = undefined;
|
|
6096
|
+
var _v = _interopRequireDefault(require_v35());
|
|
6097
|
+
var _md = _interopRequireDefault(require_md5());
|
|
6098
|
+
function _interopRequireDefault(obj) {
|
|
6099
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6100
|
+
}
|
|
6101
|
+
var v3 = (0, _v.default)("v3", 48, _md.default);
|
|
6102
|
+
var _default = v3;
|
|
6103
|
+
exports.default = _default;
|
|
6104
|
+
});
|
|
6105
|
+
|
|
6106
|
+
// ../../node_modules/uuid/dist/v4.js
|
|
6107
|
+
var require_v4 = __commonJS((exports) => {
|
|
6108
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6109
|
+
value: true
|
|
6110
|
+
});
|
|
6111
|
+
exports.default = undefined;
|
|
6112
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
6113
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6114
|
+
function _interopRequireDefault(obj) {
|
|
6115
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6116
|
+
}
|
|
6117
|
+
function v4(options, buf, offset) {
|
|
6118
|
+
options = options || {};
|
|
6119
|
+
const rnds = options.random || (options.rng || _rng.default)();
|
|
6120
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
6121
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
6122
|
+
if (buf) {
|
|
6123
|
+
offset = offset || 0;
|
|
6124
|
+
for (let i = 0;i < 16; ++i) {
|
|
6125
|
+
buf[offset + i] = rnds[i];
|
|
6126
|
+
}
|
|
6127
|
+
return buf;
|
|
6128
|
+
}
|
|
6129
|
+
return (0, _stringify.default)(rnds);
|
|
6130
|
+
}
|
|
6131
|
+
var _default = v4;
|
|
6132
|
+
exports.default = _default;
|
|
6133
|
+
});
|
|
6134
|
+
|
|
6135
|
+
// ../../node_modules/uuid/dist/sha1.js
|
|
6136
|
+
var require_sha1 = __commonJS((exports) => {
|
|
6137
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6138
|
+
value: true
|
|
6139
|
+
});
|
|
6140
|
+
exports.default = undefined;
|
|
6141
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
6142
|
+
function _interopRequireDefault(obj) {
|
|
6143
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6144
|
+
}
|
|
6145
|
+
function sha1(bytes) {
|
|
6146
|
+
if (Array.isArray(bytes)) {
|
|
6147
|
+
bytes = Buffer.from(bytes);
|
|
6148
|
+
} else if (typeof bytes === "string") {
|
|
6149
|
+
bytes = Buffer.from(bytes, "utf8");
|
|
6150
|
+
}
|
|
6151
|
+
return _crypto.default.createHash("sha1").update(bytes).digest();
|
|
6152
|
+
}
|
|
6153
|
+
var _default = sha1;
|
|
6154
|
+
exports.default = _default;
|
|
6155
|
+
});
|
|
6156
|
+
|
|
6157
|
+
// ../../node_modules/uuid/dist/v5.js
|
|
6158
|
+
var require_v5 = __commonJS((exports) => {
|
|
6159
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6160
|
+
value: true
|
|
6161
|
+
});
|
|
6162
|
+
exports.default = undefined;
|
|
6163
|
+
var _v = _interopRequireDefault(require_v35());
|
|
6164
|
+
var _sha = _interopRequireDefault(require_sha1());
|
|
6165
|
+
function _interopRequireDefault(obj) {
|
|
6166
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6167
|
+
}
|
|
6168
|
+
var v5 = (0, _v.default)("v5", 80, _sha.default);
|
|
6169
|
+
var _default = v5;
|
|
6170
|
+
exports.default = _default;
|
|
6171
|
+
});
|
|
6172
|
+
|
|
6173
|
+
// ../../node_modules/uuid/dist/nil.js
|
|
6174
|
+
var require_nil = __commonJS((exports) => {
|
|
6175
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6176
|
+
value: true
|
|
6177
|
+
});
|
|
6178
|
+
exports.default = undefined;
|
|
6179
|
+
var _default = "00000000-0000-0000-0000-000000000000";
|
|
6180
|
+
exports.default = _default;
|
|
6181
|
+
});
|
|
6182
|
+
|
|
6183
|
+
// ../../node_modules/uuid/dist/version.js
|
|
6184
|
+
var require_version = __commonJS((exports) => {
|
|
6185
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6186
|
+
value: true
|
|
6187
|
+
});
|
|
6188
|
+
exports.default = undefined;
|
|
6189
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
6190
|
+
function _interopRequireDefault(obj) {
|
|
6191
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6192
|
+
}
|
|
6193
|
+
function version(uuid) {
|
|
6194
|
+
if (!(0, _validate.default)(uuid)) {
|
|
6195
|
+
throw TypeError("Invalid UUID");
|
|
6196
|
+
}
|
|
6197
|
+
return parseInt(uuid.substr(14, 1), 16);
|
|
6198
|
+
}
|
|
6199
|
+
var _default = version;
|
|
6200
|
+
exports.default = _default;
|
|
6201
|
+
});
|
|
6202
|
+
|
|
6203
|
+
// ../../node_modules/uuid/dist/index.js
|
|
6204
|
+
var require_dist = __commonJS((exports) => {
|
|
6205
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6206
|
+
value: true
|
|
6207
|
+
});
|
|
6208
|
+
Object.defineProperty(exports, "v1", {
|
|
6209
|
+
enumerable: true,
|
|
6210
|
+
get: function() {
|
|
6211
|
+
return _v.default;
|
|
6212
|
+
}
|
|
6213
|
+
});
|
|
6214
|
+
Object.defineProperty(exports, "v3", {
|
|
6215
|
+
enumerable: true,
|
|
6216
|
+
get: function() {
|
|
6217
|
+
return _v2.default;
|
|
6218
|
+
}
|
|
6219
|
+
});
|
|
6220
|
+
Object.defineProperty(exports, "v4", {
|
|
6221
|
+
enumerable: true,
|
|
6222
|
+
get: function() {
|
|
6223
|
+
return _v3.default;
|
|
6224
|
+
}
|
|
6225
|
+
});
|
|
6226
|
+
Object.defineProperty(exports, "v5", {
|
|
6227
|
+
enumerable: true,
|
|
6228
|
+
get: function() {
|
|
6229
|
+
return _v4.default;
|
|
6230
|
+
}
|
|
6231
|
+
});
|
|
6232
|
+
Object.defineProperty(exports, "NIL", {
|
|
6233
|
+
enumerable: true,
|
|
6234
|
+
get: function() {
|
|
6235
|
+
return _nil.default;
|
|
6236
|
+
}
|
|
6237
|
+
});
|
|
6238
|
+
Object.defineProperty(exports, "version", {
|
|
6239
|
+
enumerable: true,
|
|
6240
|
+
get: function() {
|
|
6241
|
+
return _version.default;
|
|
6242
|
+
}
|
|
6243
|
+
});
|
|
6244
|
+
Object.defineProperty(exports, "validate", {
|
|
6245
|
+
enumerable: true,
|
|
6246
|
+
get: function() {
|
|
6247
|
+
return _validate.default;
|
|
6248
|
+
}
|
|
6249
|
+
});
|
|
6250
|
+
Object.defineProperty(exports, "stringify", {
|
|
6251
|
+
enumerable: true,
|
|
6252
|
+
get: function() {
|
|
6253
|
+
return _stringify.default;
|
|
6254
|
+
}
|
|
6255
|
+
});
|
|
6256
|
+
Object.defineProperty(exports, "parse", {
|
|
6257
|
+
enumerable: true,
|
|
6258
|
+
get: function() {
|
|
6259
|
+
return _parse.default;
|
|
6260
|
+
}
|
|
6261
|
+
});
|
|
6262
|
+
var _v = _interopRequireDefault(require_v1());
|
|
6263
|
+
var _v2 = _interopRequireDefault(require_v3());
|
|
6264
|
+
var _v3 = _interopRequireDefault(require_v4());
|
|
6265
|
+
var _v4 = _interopRequireDefault(require_v5());
|
|
6266
|
+
var _nil = _interopRequireDefault(require_nil());
|
|
6267
|
+
var _version = _interopRequireDefault(require_version());
|
|
6268
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
6269
|
+
var _stringify = _interopRequireDefault(require_stringify());
|
|
6270
|
+
var _parse = _interopRequireDefault(require_parse());
|
|
6271
|
+
function _interopRequireDefault(obj) {
|
|
6272
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
6273
|
+
}
|
|
6274
|
+
});
|
|
6275
|
+
|
|
6276
|
+
// ../../node_modules/node-cron/src/scheduled-task.js
|
|
6277
|
+
var require_scheduled_task = __commonJS((exports, module) => {
|
|
6278
|
+
var EventEmitter = __require("events");
|
|
6279
|
+
var Task = require_task();
|
|
6280
|
+
var Scheduler = require_scheduler();
|
|
6281
|
+
var uuid = require_dist();
|
|
6282
|
+
|
|
6283
|
+
class ScheduledTask extends EventEmitter {
|
|
6284
|
+
constructor(cronExpression, func, options) {
|
|
6285
|
+
super();
|
|
6286
|
+
if (!options) {
|
|
6287
|
+
options = {
|
|
6288
|
+
scheduled: true,
|
|
6289
|
+
recoverMissedExecutions: false
|
|
6290
|
+
};
|
|
6291
|
+
}
|
|
6292
|
+
this.options = options;
|
|
6293
|
+
this.options.name = this.options.name || uuid.v4();
|
|
6294
|
+
this._task = new Task(func);
|
|
6295
|
+
this._scheduler = new Scheduler(cronExpression, options.timezone, options.recoverMissedExecutions);
|
|
6296
|
+
this._scheduler.on("scheduled-time-matched", (now) => {
|
|
6297
|
+
this.now(now);
|
|
6298
|
+
});
|
|
6299
|
+
if (options.scheduled !== false) {
|
|
6300
|
+
this._scheduler.start();
|
|
6301
|
+
}
|
|
6302
|
+
if (options.runOnInit === true) {
|
|
6303
|
+
this.now("init");
|
|
6304
|
+
}
|
|
6305
|
+
}
|
|
6306
|
+
now(now = "manual") {
|
|
6307
|
+
let result = this._task.execute(now);
|
|
6308
|
+
this.emit("task-done", result);
|
|
6309
|
+
}
|
|
6310
|
+
start() {
|
|
6311
|
+
this._scheduler.start();
|
|
6312
|
+
}
|
|
6313
|
+
stop() {
|
|
6314
|
+
this._scheduler.stop();
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
module.exports = ScheduledTask;
|
|
6318
|
+
});
|
|
6319
|
+
|
|
6320
|
+
// ../../node_modules/node-cron/src/background-scheduled-task/index.js
|
|
6321
|
+
var require_background_scheduled_task = __commonJS((exports, module) => {
|
|
6322
|
+
var __dirname = "/Users/wangzhenyu/Code/work/node_modules/node-cron/src/background-scheduled-task";
|
|
6323
|
+
var EventEmitter = __require("events");
|
|
6324
|
+
var path3 = __require("path");
|
|
6325
|
+
var { fork } = __require("child_process");
|
|
6326
|
+
var uuid = require_dist();
|
|
6327
|
+
var daemonPath = `${__dirname}/daemon.js`;
|
|
6328
|
+
|
|
6329
|
+
class BackgroundScheduledTask extends EventEmitter {
|
|
6330
|
+
constructor(cronExpression, taskPath, options) {
|
|
6331
|
+
super();
|
|
6332
|
+
if (!options) {
|
|
6333
|
+
options = {
|
|
6334
|
+
scheduled: true,
|
|
6335
|
+
recoverMissedExecutions: false
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
this.cronExpression = cronExpression;
|
|
6339
|
+
this.taskPath = taskPath;
|
|
6340
|
+
this.options = options;
|
|
6341
|
+
this.options.name = this.options.name || uuid.v4();
|
|
6342
|
+
if (options.scheduled) {
|
|
6343
|
+
this.start();
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6346
|
+
start() {
|
|
6347
|
+
this.stop();
|
|
6348
|
+
this.forkProcess = fork(daemonPath);
|
|
6349
|
+
this.forkProcess.on("message", (message) => {
|
|
6350
|
+
switch (message.type) {
|
|
6351
|
+
case "task-done":
|
|
6352
|
+
this.emit("task-done", message.result);
|
|
6353
|
+
break;
|
|
6354
|
+
}
|
|
6355
|
+
});
|
|
6356
|
+
let options = this.options;
|
|
6357
|
+
options.scheduled = true;
|
|
6358
|
+
this.forkProcess.send({
|
|
6359
|
+
type: "register",
|
|
6360
|
+
path: path3.resolve(this.taskPath),
|
|
6361
|
+
cron: this.cronExpression,
|
|
6362
|
+
options
|
|
6363
|
+
});
|
|
6364
|
+
}
|
|
6365
|
+
stop() {
|
|
6366
|
+
if (this.forkProcess) {
|
|
6367
|
+
this.forkProcess.kill();
|
|
6368
|
+
}
|
|
6369
|
+
}
|
|
6370
|
+
pid() {
|
|
6371
|
+
if (this.forkProcess) {
|
|
6372
|
+
return this.forkProcess.pid;
|
|
6373
|
+
}
|
|
6374
|
+
}
|
|
6375
|
+
isRunning() {
|
|
6376
|
+
return !this.forkProcess.killed;
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
6379
|
+
module.exports = BackgroundScheduledTask;
|
|
6380
|
+
});
|
|
6381
|
+
|
|
6382
|
+
// ../../node_modules/node-cron/src/storage.js
|
|
6383
|
+
var require_storage = __commonJS((exports, module) => {
|
|
6384
|
+
module.exports = (() => {
|
|
6385
|
+
if (!global.scheduledTasks) {
|
|
6386
|
+
global.scheduledTasks = new Map;
|
|
6387
|
+
}
|
|
6388
|
+
return {
|
|
6389
|
+
save: (task) => {
|
|
6390
|
+
if (!task.options) {
|
|
6391
|
+
const uuid = require_dist();
|
|
6392
|
+
task.options = {};
|
|
6393
|
+
task.options.name = uuid.v4();
|
|
6394
|
+
}
|
|
6395
|
+
global.scheduledTasks.set(task.options.name, task);
|
|
6396
|
+
},
|
|
6397
|
+
getTasks: () => {
|
|
6398
|
+
return global.scheduledTasks;
|
|
6399
|
+
}
|
|
6400
|
+
};
|
|
6401
|
+
})();
|
|
6402
|
+
});
|
|
6403
|
+
|
|
6404
|
+
// ../../node_modules/node-cron/src/node-cron.js
|
|
6405
|
+
var require_node_cron = __commonJS((exports, module) => {
|
|
6406
|
+
var ScheduledTask = require_scheduled_task();
|
|
6407
|
+
var BackgroundScheduledTask = require_background_scheduled_task();
|
|
6408
|
+
var validation = require_pattern_validation();
|
|
6409
|
+
var storage = require_storage();
|
|
6410
|
+
function schedule(expression, func, options) {
|
|
6411
|
+
const task = createTask(expression, func, options);
|
|
6412
|
+
storage.save(task);
|
|
6413
|
+
return task;
|
|
6414
|
+
}
|
|
6415
|
+
function createTask(expression, func, options) {
|
|
6416
|
+
if (typeof func === "string")
|
|
6417
|
+
return new BackgroundScheduledTask(expression, func, options);
|
|
6418
|
+
return new ScheduledTask(expression, func, options);
|
|
6419
|
+
}
|
|
6420
|
+
function validate(expression) {
|
|
6421
|
+
try {
|
|
6422
|
+
validation(expression);
|
|
6423
|
+
return true;
|
|
6424
|
+
} catch (_) {
|
|
6425
|
+
return false;
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
function getTasks() {
|
|
6429
|
+
return storage.getTasks();
|
|
6430
|
+
}
|
|
6431
|
+
module.exports = { schedule, validate, getTasks };
|
|
6432
|
+
});
|
|
6433
|
+
|
|
5444
6434
|
// src/common/index.ts
|
|
5445
6435
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
5446
6436
|
import { default as default3 } from "axios";
|
|
5447
6437
|
import { default as default4 } from "json5";
|
|
5448
6438
|
import { default as default5 } from "consola";
|
|
5449
6439
|
|
|
5450
|
-
// ../../node_modules/zod/
|
|
6440
|
+
// ../../node_modules/zod/v3/external.js
|
|
6441
|
+
var exports_external = {};
|
|
6442
|
+
__export(exports_external, {
|
|
6443
|
+
void: () => voidType,
|
|
6444
|
+
util: () => util,
|
|
6445
|
+
unknown: () => unknownType,
|
|
6446
|
+
union: () => unionType,
|
|
6447
|
+
undefined: () => undefinedType,
|
|
6448
|
+
tuple: () => tupleType,
|
|
6449
|
+
transformer: () => effectsType,
|
|
6450
|
+
symbol: () => symbolType,
|
|
6451
|
+
string: () => stringType,
|
|
6452
|
+
strictObject: () => strictObjectType,
|
|
6453
|
+
setErrorMap: () => setErrorMap,
|
|
6454
|
+
set: () => setType,
|
|
6455
|
+
record: () => recordType,
|
|
6456
|
+
quotelessJson: () => quotelessJson,
|
|
6457
|
+
promise: () => promiseType,
|
|
6458
|
+
preprocess: () => preprocessType,
|
|
6459
|
+
pipeline: () => pipelineType,
|
|
6460
|
+
ostring: () => ostring,
|
|
6461
|
+
optional: () => optionalType,
|
|
6462
|
+
onumber: () => onumber,
|
|
6463
|
+
oboolean: () => oboolean,
|
|
6464
|
+
objectUtil: () => objectUtil,
|
|
6465
|
+
object: () => objectType,
|
|
6466
|
+
number: () => numberType,
|
|
6467
|
+
nullable: () => nullableType,
|
|
6468
|
+
null: () => nullType,
|
|
6469
|
+
never: () => neverType,
|
|
6470
|
+
nativeEnum: () => nativeEnumType,
|
|
6471
|
+
nan: () => nanType,
|
|
6472
|
+
map: () => mapType,
|
|
6473
|
+
makeIssue: () => makeIssue,
|
|
6474
|
+
literal: () => literalType,
|
|
6475
|
+
lazy: () => lazyType,
|
|
6476
|
+
late: () => late,
|
|
6477
|
+
isValid: () => isValid,
|
|
6478
|
+
isDirty: () => isDirty,
|
|
6479
|
+
isAsync: () => isAsync,
|
|
6480
|
+
isAborted: () => isAborted,
|
|
6481
|
+
intersection: () => intersectionType,
|
|
6482
|
+
instanceof: () => instanceOfType,
|
|
6483
|
+
getParsedType: () => getParsedType,
|
|
6484
|
+
getErrorMap: () => getErrorMap,
|
|
6485
|
+
function: () => functionType,
|
|
6486
|
+
enum: () => enumType,
|
|
6487
|
+
effect: () => effectsType,
|
|
6488
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
6489
|
+
defaultErrorMap: () => en_default,
|
|
6490
|
+
datetimeRegex: () => datetimeRegex,
|
|
6491
|
+
date: () => dateType,
|
|
6492
|
+
custom: () => custom,
|
|
6493
|
+
coerce: () => coerce,
|
|
6494
|
+
boolean: () => booleanType,
|
|
6495
|
+
bigint: () => bigIntType,
|
|
6496
|
+
array: () => arrayType,
|
|
6497
|
+
any: () => anyType,
|
|
6498
|
+
addIssueToContext: () => addIssueToContext,
|
|
6499
|
+
ZodVoid: () => ZodVoid,
|
|
6500
|
+
ZodUnknown: () => ZodUnknown,
|
|
6501
|
+
ZodUnion: () => ZodUnion,
|
|
6502
|
+
ZodUndefined: () => ZodUndefined,
|
|
6503
|
+
ZodType: () => ZodType,
|
|
6504
|
+
ZodTuple: () => ZodTuple,
|
|
6505
|
+
ZodTransformer: () => ZodEffects,
|
|
6506
|
+
ZodSymbol: () => ZodSymbol,
|
|
6507
|
+
ZodString: () => ZodString,
|
|
6508
|
+
ZodSet: () => ZodSet,
|
|
6509
|
+
ZodSchema: () => ZodType,
|
|
6510
|
+
ZodRecord: () => ZodRecord,
|
|
6511
|
+
ZodReadonly: () => ZodReadonly,
|
|
6512
|
+
ZodPromise: () => ZodPromise,
|
|
6513
|
+
ZodPipeline: () => ZodPipeline,
|
|
6514
|
+
ZodParsedType: () => ZodParsedType,
|
|
6515
|
+
ZodOptional: () => ZodOptional,
|
|
6516
|
+
ZodObject: () => ZodObject,
|
|
6517
|
+
ZodNumber: () => ZodNumber,
|
|
6518
|
+
ZodNullable: () => ZodNullable,
|
|
6519
|
+
ZodNull: () => ZodNull,
|
|
6520
|
+
ZodNever: () => ZodNever,
|
|
6521
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
6522
|
+
ZodNaN: () => ZodNaN,
|
|
6523
|
+
ZodMap: () => ZodMap,
|
|
6524
|
+
ZodLiteral: () => ZodLiteral,
|
|
6525
|
+
ZodLazy: () => ZodLazy,
|
|
6526
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
6527
|
+
ZodIntersection: () => ZodIntersection,
|
|
6528
|
+
ZodFunction: () => ZodFunction,
|
|
6529
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
6530
|
+
ZodError: () => ZodError,
|
|
6531
|
+
ZodEnum: () => ZodEnum,
|
|
6532
|
+
ZodEffects: () => ZodEffects,
|
|
6533
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
6534
|
+
ZodDefault: () => ZodDefault,
|
|
6535
|
+
ZodDate: () => ZodDate,
|
|
6536
|
+
ZodCatch: () => ZodCatch,
|
|
6537
|
+
ZodBranded: () => ZodBranded,
|
|
6538
|
+
ZodBoolean: () => ZodBoolean,
|
|
6539
|
+
ZodBigInt: () => ZodBigInt,
|
|
6540
|
+
ZodArray: () => ZodArray,
|
|
6541
|
+
ZodAny: () => ZodAny,
|
|
6542
|
+
Schema: () => ZodType,
|
|
6543
|
+
ParseStatus: () => ParseStatus,
|
|
6544
|
+
OK: () => OK,
|
|
6545
|
+
NEVER: () => NEVER,
|
|
6546
|
+
INVALID: () => INVALID,
|
|
6547
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
6548
|
+
DIRTY: () => DIRTY,
|
|
6549
|
+
BRAND: () => BRAND
|
|
6550
|
+
});
|
|
6551
|
+
|
|
6552
|
+
// ../../node_modules/zod/v3/helpers/util.js
|
|
5451
6553
|
var util;
|
|
5452
6554
|
(function(util2) {
|
|
5453
|
-
util2.assertEqual = (
|
|
6555
|
+
util2.assertEqual = (_) => {};
|
|
5454
6556
|
function assertIs(_arg) {}
|
|
5455
6557
|
util2.assertIs = assertIs;
|
|
5456
6558
|
function assertNever(_x) {
|
|
@@ -5493,7 +6595,7 @@ var util;
|
|
|
5493
6595
|
}
|
|
5494
6596
|
return;
|
|
5495
6597
|
};
|
|
5496
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
6598
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
5497
6599
|
function joinValues(array, separator = " | ") {
|
|
5498
6600
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
5499
6601
|
}
|
|
@@ -5544,7 +6646,7 @@ var getParsedType = (data) => {
|
|
|
5544
6646
|
case "string":
|
|
5545
6647
|
return ZodParsedType.string;
|
|
5546
6648
|
case "number":
|
|
5547
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
6649
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
5548
6650
|
case "boolean":
|
|
5549
6651
|
return ZodParsedType.boolean;
|
|
5550
6652
|
case "function":
|
|
@@ -5577,6 +6679,8 @@ var getParsedType = (data) => {
|
|
|
5577
6679
|
return ZodParsedType.unknown;
|
|
5578
6680
|
}
|
|
5579
6681
|
};
|
|
6682
|
+
|
|
6683
|
+
// ../../node_modules/zod/v3/ZodError.js
|
|
5580
6684
|
var ZodIssueCode = util.arrayToEnum([
|
|
5581
6685
|
"invalid_type",
|
|
5582
6686
|
"invalid_literal",
|
|
@@ -5677,8 +6781,9 @@ class ZodError extends Error {
|
|
|
5677
6781
|
const formErrors = [];
|
|
5678
6782
|
for (const sub of this.issues) {
|
|
5679
6783
|
if (sub.path.length > 0) {
|
|
5680
|
-
|
|
5681
|
-
fieldErrors[
|
|
6784
|
+
const firstEl = sub.path[0];
|
|
6785
|
+
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
6786
|
+
fieldErrors[firstEl].push(mapper(sub));
|
|
5682
6787
|
} else {
|
|
5683
6788
|
formErrors.push(mapper(sub));
|
|
5684
6789
|
}
|
|
@@ -5693,6 +6798,8 @@ ZodError.create = (issues) => {
|
|
|
5693
6798
|
const error = new ZodError(issues);
|
|
5694
6799
|
return error;
|
|
5695
6800
|
};
|
|
6801
|
+
|
|
6802
|
+
// ../../node_modules/zod/v3/locales/en.js
|
|
5696
6803
|
var errorMap = (issue, _ctx) => {
|
|
5697
6804
|
let message;
|
|
5698
6805
|
switch (issue.code) {
|
|
@@ -5754,6 +6861,8 @@ var errorMap = (issue, _ctx) => {
|
|
|
5754
6861
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
5755
6862
|
else if (issue.type === "number")
|
|
5756
6863
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
6864
|
+
else if (issue.type === "bigint")
|
|
6865
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
5757
6866
|
else if (issue.type === "date")
|
|
5758
6867
|
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
5759
6868
|
else
|
|
@@ -5791,13 +6900,17 @@ var errorMap = (issue, _ctx) => {
|
|
|
5791
6900
|
}
|
|
5792
6901
|
return { message };
|
|
5793
6902
|
};
|
|
5794
|
-
var
|
|
6903
|
+
var en_default = errorMap;
|
|
6904
|
+
|
|
6905
|
+
// ../../node_modules/zod/v3/errors.js
|
|
6906
|
+
var overrideErrorMap = en_default;
|
|
5795
6907
|
function setErrorMap(map) {
|
|
5796
6908
|
overrideErrorMap = map;
|
|
5797
6909
|
}
|
|
5798
6910
|
function getErrorMap() {
|
|
5799
6911
|
return overrideErrorMap;
|
|
5800
6912
|
}
|
|
6913
|
+
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
5801
6914
|
var makeIssue = (params) => {
|
|
5802
6915
|
const { data, path, errorMaps, issueData } = params;
|
|
5803
6916
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -5834,7 +6947,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
5834
6947
|
ctx.common.contextualErrorMap,
|
|
5835
6948
|
ctx.schemaErrorMap,
|
|
5836
6949
|
overrideMap,
|
|
5837
|
-
overrideMap ===
|
|
6950
|
+
overrideMap === en_default ? undefined : en_default
|
|
5838
6951
|
].filter((x) => !!x)
|
|
5839
6952
|
});
|
|
5840
6953
|
ctx.common.issues.push(issue);
|
|
@@ -5903,30 +7016,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
5903
7016
|
var isDirty = (x) => x.status === "dirty";
|
|
5904
7017
|
var isValid = (x) => x.status === "valid";
|
|
5905
7018
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
5906
|
-
|
|
5907
|
-
if (kind === "a" && !f)
|
|
5908
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
5909
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
5910
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5911
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5912
|
-
}
|
|
5913
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
5914
|
-
if (kind === "m")
|
|
5915
|
-
throw new TypeError("Private method is not writable");
|
|
5916
|
-
if (kind === "a" && !f)
|
|
5917
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
5918
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
5919
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5920
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
5921
|
-
}
|
|
7019
|
+
// ../../node_modules/zod/v3/helpers/errorUtil.js
|
|
5922
7020
|
var errorUtil;
|
|
5923
7021
|
(function(errorUtil2) {
|
|
5924
7022
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
5925
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
|
7023
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
5926
7024
|
})(errorUtil || (errorUtil = {}));
|
|
5927
|
-
var _ZodEnum_cache;
|
|
5928
|
-
var _ZodNativeEnum_cache;
|
|
5929
7025
|
|
|
7026
|
+
// ../../node_modules/zod/v3/types.js
|
|
5930
7027
|
class ParseInputLazyPath {
|
|
5931
7028
|
constructor(parent, value, path, key) {
|
|
5932
7029
|
this._cachedPath = [];
|
|
@@ -5937,7 +7034,7 @@ class ParseInputLazyPath {
|
|
|
5937
7034
|
}
|
|
5938
7035
|
get path() {
|
|
5939
7036
|
if (!this._cachedPath.length) {
|
|
5940
|
-
if (this._key
|
|
7037
|
+
if (Array.isArray(this._key)) {
|
|
5941
7038
|
this._cachedPath.push(...this._path, ...this._key);
|
|
5942
7039
|
} else {
|
|
5943
7040
|
this._cachedPath.push(...this._path, this._key);
|
|
@@ -5975,17 +7072,16 @@ function processCreateParams(params) {
|
|
|
5975
7072
|
if (errorMap2)
|
|
5976
7073
|
return { errorMap: errorMap2, description };
|
|
5977
7074
|
const customMap = (iss, ctx) => {
|
|
5978
|
-
var _a, _b;
|
|
5979
7075
|
const { message } = params;
|
|
5980
7076
|
if (iss.code === "invalid_enum_value") {
|
|
5981
|
-
return { message: message
|
|
7077
|
+
return { message: message ?? ctx.defaultError };
|
|
5982
7078
|
}
|
|
5983
7079
|
if (typeof ctx.data === "undefined") {
|
|
5984
|
-
return { message:
|
|
7080
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
5985
7081
|
}
|
|
5986
7082
|
if (iss.code !== "invalid_type")
|
|
5987
7083
|
return { message: ctx.defaultError };
|
|
5988
|
-
return { message:
|
|
7084
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
5989
7085
|
};
|
|
5990
7086
|
return { errorMap: customMap, description };
|
|
5991
7087
|
}
|
|
@@ -6038,14 +7134,13 @@ class ZodType {
|
|
|
6038
7134
|
throw result.error;
|
|
6039
7135
|
}
|
|
6040
7136
|
safeParse(data, params) {
|
|
6041
|
-
var _a;
|
|
6042
7137
|
const ctx = {
|
|
6043
7138
|
common: {
|
|
6044
7139
|
issues: [],
|
|
6045
|
-
async:
|
|
6046
|
-
contextualErrorMap: params
|
|
7140
|
+
async: params?.async ?? false,
|
|
7141
|
+
contextualErrorMap: params?.errorMap
|
|
6047
7142
|
},
|
|
6048
|
-
path:
|
|
7143
|
+
path: params?.path || [],
|
|
6049
7144
|
schemaErrorMap: this._def.errorMap,
|
|
6050
7145
|
parent: null,
|
|
6051
7146
|
data,
|
|
@@ -6055,7 +7150,6 @@ class ZodType {
|
|
|
6055
7150
|
return handleResult(ctx, result);
|
|
6056
7151
|
}
|
|
6057
7152
|
"~validate"(data) {
|
|
6058
|
-
var _a, _b;
|
|
6059
7153
|
const ctx = {
|
|
6060
7154
|
common: {
|
|
6061
7155
|
issues: [],
|
|
@@ -6076,7 +7170,7 @@ class ZodType {
|
|
|
6076
7170
|
issues: ctx.common.issues
|
|
6077
7171
|
};
|
|
6078
7172
|
} catch (err) {
|
|
6079
|
-
if (
|
|
7173
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
6080
7174
|
this["~standard"].async = true;
|
|
6081
7175
|
}
|
|
6082
7176
|
ctx.common = {
|
|
@@ -6101,10 +7195,10 @@ class ZodType {
|
|
|
6101
7195
|
const ctx = {
|
|
6102
7196
|
common: {
|
|
6103
7197
|
issues: [],
|
|
6104
|
-
contextualErrorMap: params
|
|
7198
|
+
contextualErrorMap: params?.errorMap,
|
|
6105
7199
|
async: true
|
|
6106
7200
|
},
|
|
6107
|
-
path:
|
|
7201
|
+
path: params?.path || [],
|
|
6108
7202
|
schemaErrorMap: this._def.errorMap,
|
|
6109
7203
|
parent: null,
|
|
6110
7204
|
data,
|
|
@@ -6294,13 +7388,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
|
|
|
6294
7388
|
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])))`;
|
|
6295
7389
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
6296
7390
|
function timeRegexSource(args) {
|
|
6297
|
-
let
|
|
7391
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
6298
7392
|
if (args.precision) {
|
|
6299
|
-
|
|
7393
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
6300
7394
|
} else if (args.precision == null) {
|
|
6301
|
-
|
|
7395
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
6302
7396
|
}
|
|
6303
|
-
|
|
7397
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
7398
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
6304
7399
|
}
|
|
6305
7400
|
function timeRegex(args) {
|
|
6306
7401
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -6328,16 +7423,20 @@ function isValidJWT(jwt, alg) {
|
|
|
6328
7423
|
return false;
|
|
6329
7424
|
try {
|
|
6330
7425
|
const [header] = jwt.split(".");
|
|
7426
|
+
if (!header)
|
|
7427
|
+
return false;
|
|
6331
7428
|
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
6332
7429
|
const decoded = JSON.parse(atob(base64));
|
|
6333
7430
|
if (typeof decoded !== "object" || decoded === null)
|
|
6334
7431
|
return false;
|
|
6335
|
-
if (
|
|
7432
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
7433
|
+
return false;
|
|
7434
|
+
if (!decoded.alg)
|
|
6336
7435
|
return false;
|
|
6337
7436
|
if (alg && decoded.alg !== alg)
|
|
6338
7437
|
return false;
|
|
6339
7438
|
return true;
|
|
6340
|
-
} catch
|
|
7439
|
+
} catch {
|
|
6341
7440
|
return false;
|
|
6342
7441
|
}
|
|
6343
7442
|
}
|
|
@@ -6497,7 +7596,7 @@ class ZodString extends ZodType {
|
|
|
6497
7596
|
} else if (check.kind === "url") {
|
|
6498
7597
|
try {
|
|
6499
7598
|
new URL(input.data);
|
|
6500
|
-
} catch
|
|
7599
|
+
} catch {
|
|
6501
7600
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
6502
7601
|
addIssueToContext(ctx, {
|
|
6503
7602
|
validation: "url",
|
|
@@ -6709,7 +7808,6 @@ class ZodString extends ZodType {
|
|
|
6709
7808
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
6710
7809
|
}
|
|
6711
7810
|
datetime(options) {
|
|
6712
|
-
var _a, _b;
|
|
6713
7811
|
if (typeof options === "string") {
|
|
6714
7812
|
return this._addCheck({
|
|
6715
7813
|
kind: "datetime",
|
|
@@ -6721,10 +7819,10 @@ class ZodString extends ZodType {
|
|
|
6721
7819
|
}
|
|
6722
7820
|
return this._addCheck({
|
|
6723
7821
|
kind: "datetime",
|
|
6724
|
-
precision: typeof
|
|
6725
|
-
offset:
|
|
6726
|
-
local:
|
|
6727
|
-
...errorUtil.errToObj(options
|
|
7822
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
7823
|
+
offset: options?.offset ?? false,
|
|
7824
|
+
local: options?.local ?? false,
|
|
7825
|
+
...errorUtil.errToObj(options?.message)
|
|
6728
7826
|
});
|
|
6729
7827
|
}
|
|
6730
7828
|
date(message) {
|
|
@@ -6740,8 +7838,8 @@ class ZodString extends ZodType {
|
|
|
6740
7838
|
}
|
|
6741
7839
|
return this._addCheck({
|
|
6742
7840
|
kind: "time",
|
|
6743
|
-
precision: typeof
|
|
6744
|
-
...errorUtil.errToObj(options
|
|
7841
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
7842
|
+
...errorUtil.errToObj(options?.message)
|
|
6745
7843
|
});
|
|
6746
7844
|
}
|
|
6747
7845
|
duration(message) {
|
|
@@ -6758,8 +7856,8 @@ class ZodString extends ZodType {
|
|
|
6758
7856
|
return this._addCheck({
|
|
6759
7857
|
kind: "includes",
|
|
6760
7858
|
value,
|
|
6761
|
-
position: options
|
|
6762
|
-
...errorUtil.errToObj(options
|
|
7859
|
+
position: options?.position,
|
|
7860
|
+
...errorUtil.errToObj(options?.message)
|
|
6763
7861
|
});
|
|
6764
7862
|
}
|
|
6765
7863
|
startsWith(value, message) {
|
|
@@ -6888,11 +7986,10 @@ class ZodString extends ZodType {
|
|
|
6888
7986
|
}
|
|
6889
7987
|
}
|
|
6890
7988
|
ZodString.create = (params) => {
|
|
6891
|
-
var _a;
|
|
6892
7989
|
return new ZodString({
|
|
6893
7990
|
checks: [],
|
|
6894
7991
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
6895
|
-
coerce:
|
|
7992
|
+
coerce: params?.coerce ?? false,
|
|
6896
7993
|
...processCreateParams(params)
|
|
6897
7994
|
});
|
|
6898
7995
|
};
|
|
@@ -6900,9 +7997,9 @@ function floatSafeRemainder(val, step) {
|
|
|
6900
7997
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
6901
7998
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
6902
7999
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
6903
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
6904
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
6905
|
-
return valInt % stepInt /
|
|
8000
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
8001
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
8002
|
+
return valInt % stepInt / 10 ** decCount;
|
|
6906
8003
|
}
|
|
6907
8004
|
|
|
6908
8005
|
class ZodNumber extends ZodType {
|
|
@@ -7113,7 +8210,8 @@ class ZodNumber extends ZodType {
|
|
|
7113
8210
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
7114
8211
|
}
|
|
7115
8212
|
get isFinite() {
|
|
7116
|
-
let max = null
|
|
8213
|
+
let max = null;
|
|
8214
|
+
let min = null;
|
|
7117
8215
|
for (const ch of this._def.checks) {
|
|
7118
8216
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
7119
8217
|
return true;
|
|
@@ -7132,7 +8230,7 @@ ZodNumber.create = (params) => {
|
|
|
7132
8230
|
return new ZodNumber({
|
|
7133
8231
|
checks: [],
|
|
7134
8232
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
7135
|
-
coerce:
|
|
8233
|
+
coerce: params?.coerce || false,
|
|
7136
8234
|
...processCreateParams(params)
|
|
7137
8235
|
});
|
|
7138
8236
|
};
|
|
@@ -7147,7 +8245,7 @@ class ZodBigInt extends ZodType {
|
|
|
7147
8245
|
if (this._def.coerce) {
|
|
7148
8246
|
try {
|
|
7149
8247
|
input.data = BigInt(input.data);
|
|
7150
|
-
} catch
|
|
8248
|
+
} catch {
|
|
7151
8249
|
return this._getInvalidInput(input);
|
|
7152
8250
|
}
|
|
7153
8251
|
}
|
|
@@ -7302,11 +8400,10 @@ class ZodBigInt extends ZodType {
|
|
|
7302
8400
|
}
|
|
7303
8401
|
}
|
|
7304
8402
|
ZodBigInt.create = (params) => {
|
|
7305
|
-
var _a;
|
|
7306
8403
|
return new ZodBigInt({
|
|
7307
8404
|
checks: [],
|
|
7308
8405
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
7309
|
-
coerce:
|
|
8406
|
+
coerce: params?.coerce ?? false,
|
|
7310
8407
|
...processCreateParams(params)
|
|
7311
8408
|
});
|
|
7312
8409
|
};
|
|
@@ -7332,7 +8429,7 @@ class ZodBoolean extends ZodType {
|
|
|
7332
8429
|
ZodBoolean.create = (params) => {
|
|
7333
8430
|
return new ZodBoolean({
|
|
7334
8431
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
7335
|
-
coerce:
|
|
8432
|
+
coerce: params?.coerce || false,
|
|
7336
8433
|
...processCreateParams(params)
|
|
7337
8434
|
});
|
|
7338
8435
|
};
|
|
@@ -7352,7 +8449,7 @@ class ZodDate extends ZodType {
|
|
|
7352
8449
|
});
|
|
7353
8450
|
return INVALID;
|
|
7354
8451
|
}
|
|
7355
|
-
if (isNaN(input.data.getTime())) {
|
|
8452
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
7356
8453
|
const ctx2 = this._getOrReturnCtx(input);
|
|
7357
8454
|
addIssueToContext(ctx2, {
|
|
7358
8455
|
code: ZodIssueCode.invalid_date
|
|
@@ -7441,7 +8538,7 @@ class ZodDate extends ZodType {
|
|
|
7441
8538
|
ZodDate.create = (params) => {
|
|
7442
8539
|
return new ZodDate({
|
|
7443
8540
|
checks: [],
|
|
7444
|
-
coerce:
|
|
8541
|
+
coerce: params?.coerce || false,
|
|
7445
8542
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
7446
8543
|
...processCreateParams(params)
|
|
7447
8544
|
});
|
|
@@ -7725,7 +8822,8 @@ class ZodObject extends ZodType {
|
|
|
7725
8822
|
return this._cached;
|
|
7726
8823
|
const shape = this._def.shape();
|
|
7727
8824
|
const keys = util.objectKeys(shape);
|
|
7728
|
-
|
|
8825
|
+
this._cached = { shape, keys };
|
|
8826
|
+
return this._cached;
|
|
7729
8827
|
}
|
|
7730
8828
|
_parse(input) {
|
|
7731
8829
|
const parsedType = this._getType(input);
|
|
@@ -7775,9 +8873,7 @@ class ZodObject extends ZodType {
|
|
|
7775
8873
|
});
|
|
7776
8874
|
status.dirty();
|
|
7777
8875
|
}
|
|
7778
|
-
} else if (unknownKeys === "strip")
|
|
7779
|
-
;
|
|
7780
|
-
else {
|
|
8876
|
+
} else if (unknownKeys === "strip") {} else {
|
|
7781
8877
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
7782
8878
|
}
|
|
7783
8879
|
} else {
|
|
@@ -7821,11 +8917,10 @@ class ZodObject extends ZodType {
|
|
|
7821
8917
|
unknownKeys: "strict",
|
|
7822
8918
|
...message !== undefined ? {
|
|
7823
8919
|
errorMap: (issue, ctx) => {
|
|
7824
|
-
|
|
7825
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === undefined ? undefined : _b.call(_a, issue, ctx).message) !== null && _c !== undefined ? _c : ctx.defaultError;
|
|
8920
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
7826
8921
|
if (issue.code === "unrecognized_keys")
|
|
7827
8922
|
return {
|
|
7828
|
-
message:
|
|
8923
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
|
7829
8924
|
};
|
|
7830
8925
|
return {
|
|
7831
8926
|
message: defaultError
|
|
@@ -7878,11 +8973,11 @@ class ZodObject extends ZodType {
|
|
|
7878
8973
|
}
|
|
7879
8974
|
pick(mask) {
|
|
7880
8975
|
const shape = {};
|
|
7881
|
-
util.objectKeys(mask)
|
|
8976
|
+
for (const key of util.objectKeys(mask)) {
|
|
7882
8977
|
if (mask[key] && this.shape[key]) {
|
|
7883
8978
|
shape[key] = this.shape[key];
|
|
7884
8979
|
}
|
|
7885
|
-
}
|
|
8980
|
+
}
|
|
7886
8981
|
return new ZodObject({
|
|
7887
8982
|
...this._def,
|
|
7888
8983
|
shape: () => shape
|
|
@@ -7890,11 +8985,11 @@ class ZodObject extends ZodType {
|
|
|
7890
8985
|
}
|
|
7891
8986
|
omit(mask) {
|
|
7892
8987
|
const shape = {};
|
|
7893
|
-
util.objectKeys(this.shape)
|
|
8988
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
7894
8989
|
if (!mask[key]) {
|
|
7895
8990
|
shape[key] = this.shape[key];
|
|
7896
8991
|
}
|
|
7897
|
-
}
|
|
8992
|
+
}
|
|
7898
8993
|
return new ZodObject({
|
|
7899
8994
|
...this._def,
|
|
7900
8995
|
shape: () => shape
|
|
@@ -7905,14 +9000,14 @@ class ZodObject extends ZodType {
|
|
|
7905
9000
|
}
|
|
7906
9001
|
partial(mask) {
|
|
7907
9002
|
const newShape = {};
|
|
7908
|
-
util.objectKeys(this.shape)
|
|
9003
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
7909
9004
|
const fieldSchema = this.shape[key];
|
|
7910
9005
|
if (mask && !mask[key]) {
|
|
7911
9006
|
newShape[key] = fieldSchema;
|
|
7912
9007
|
} else {
|
|
7913
9008
|
newShape[key] = fieldSchema.optional();
|
|
7914
9009
|
}
|
|
7915
|
-
}
|
|
9010
|
+
}
|
|
7916
9011
|
return new ZodObject({
|
|
7917
9012
|
...this._def,
|
|
7918
9013
|
shape: () => newShape
|
|
@@ -7920,7 +9015,7 @@ class ZodObject extends ZodType {
|
|
|
7920
9015
|
}
|
|
7921
9016
|
required(mask) {
|
|
7922
9017
|
const newShape = {};
|
|
7923
|
-
util.objectKeys(this.shape)
|
|
9018
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
7924
9019
|
if (mask && !mask[key]) {
|
|
7925
9020
|
newShape[key] = this.shape[key];
|
|
7926
9021
|
} else {
|
|
@@ -7931,7 +9026,7 @@ class ZodObject extends ZodType {
|
|
|
7931
9026
|
}
|
|
7932
9027
|
newShape[key] = newField;
|
|
7933
9028
|
}
|
|
7934
|
-
}
|
|
9029
|
+
}
|
|
7935
9030
|
return new ZodObject({
|
|
7936
9031
|
...this._def,
|
|
7937
9032
|
shape: () => newShape
|
|
@@ -8547,12 +9642,7 @@ class ZodFunction extends ZodType {
|
|
|
8547
9642
|
return makeIssue({
|
|
8548
9643
|
data: args,
|
|
8549
9644
|
path: ctx.path,
|
|
8550
|
-
errorMaps: [
|
|
8551
|
-
ctx.common.contextualErrorMap,
|
|
8552
|
-
ctx.schemaErrorMap,
|
|
8553
|
-
getErrorMap(),
|
|
8554
|
-
errorMap
|
|
8555
|
-
].filter((x) => !!x),
|
|
9645
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
8556
9646
|
issueData: {
|
|
8557
9647
|
code: ZodIssueCode.invalid_arguments,
|
|
8558
9648
|
argumentsError: error
|
|
@@ -8563,12 +9653,7 @@ class ZodFunction extends ZodType {
|
|
|
8563
9653
|
return makeIssue({
|
|
8564
9654
|
data: returns,
|
|
8565
9655
|
path: ctx.path,
|
|
8566
|
-
errorMaps: [
|
|
8567
|
-
ctx.common.contextualErrorMap,
|
|
8568
|
-
ctx.schemaErrorMap,
|
|
8569
|
-
getErrorMap(),
|
|
8570
|
-
errorMap
|
|
8571
|
-
].filter((x) => !!x),
|
|
9656
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
8572
9657
|
issueData: {
|
|
8573
9658
|
code: ZodIssueCode.invalid_return_type,
|
|
8574
9659
|
returnTypeError: error
|
|
@@ -8695,10 +9780,6 @@ function createZodEnum(values, params) {
|
|
|
8695
9780
|
}
|
|
8696
9781
|
|
|
8697
9782
|
class ZodEnum extends ZodType {
|
|
8698
|
-
constructor() {
|
|
8699
|
-
super(...arguments);
|
|
8700
|
-
_ZodEnum_cache.set(this, undefined);
|
|
8701
|
-
}
|
|
8702
9783
|
_parse(input) {
|
|
8703
9784
|
if (typeof input.data !== "string") {
|
|
8704
9785
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -8710,10 +9791,10 @@ class ZodEnum extends ZodType {
|
|
|
8710
9791
|
});
|
|
8711
9792
|
return INVALID;
|
|
8712
9793
|
}
|
|
8713
|
-
if (!
|
|
8714
|
-
|
|
9794
|
+
if (!this._cache) {
|
|
9795
|
+
this._cache = new Set(this._def.values);
|
|
8715
9796
|
}
|
|
8716
|
-
if (!
|
|
9797
|
+
if (!this._cache.has(input.data)) {
|
|
8717
9798
|
const ctx = this._getOrReturnCtx(input);
|
|
8718
9799
|
const expectedValues = this._def.values;
|
|
8719
9800
|
addIssueToContext(ctx, {
|
|
@@ -8762,14 +9843,9 @@ class ZodEnum extends ZodType {
|
|
|
8762
9843
|
});
|
|
8763
9844
|
}
|
|
8764
9845
|
}
|
|
8765
|
-
_ZodEnum_cache = new WeakMap;
|
|
8766
9846
|
ZodEnum.create = createZodEnum;
|
|
8767
9847
|
|
|
8768
9848
|
class ZodNativeEnum extends ZodType {
|
|
8769
|
-
constructor() {
|
|
8770
|
-
super(...arguments);
|
|
8771
|
-
_ZodNativeEnum_cache.set(this, undefined);
|
|
8772
|
-
}
|
|
8773
9849
|
_parse(input) {
|
|
8774
9850
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
8775
9851
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -8782,10 +9858,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
8782
9858
|
});
|
|
8783
9859
|
return INVALID;
|
|
8784
9860
|
}
|
|
8785
|
-
if (!
|
|
8786
|
-
|
|
9861
|
+
if (!this._cache) {
|
|
9862
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
8787
9863
|
}
|
|
8788
|
-
if (!
|
|
9864
|
+
if (!this._cache.has(input.data)) {
|
|
8789
9865
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
8790
9866
|
addIssueToContext(ctx, {
|
|
8791
9867
|
received: ctx.data,
|
|
@@ -8800,7 +9876,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
8800
9876
|
return this._def.values;
|
|
8801
9877
|
}
|
|
8802
9878
|
}
|
|
8803
|
-
_ZodNativeEnum_cache = new WeakMap;
|
|
8804
9879
|
ZodNativeEnum.create = (values, params) => {
|
|
8805
9880
|
return new ZodNativeEnum({
|
|
8806
9881
|
values,
|
|
@@ -8943,7 +10018,7 @@ class ZodEffects extends ZodType {
|
|
|
8943
10018
|
parent: ctx
|
|
8944
10019
|
});
|
|
8945
10020
|
if (!isValid(base))
|
|
8946
|
-
return
|
|
10021
|
+
return INVALID;
|
|
8947
10022
|
const result = effect.transform(base.value, checkCtx);
|
|
8948
10023
|
if (result instanceof Promise) {
|
|
8949
10024
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -8952,8 +10027,11 @@ class ZodEffects extends ZodType {
|
|
|
8952
10027
|
} else {
|
|
8953
10028
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
8954
10029
|
if (!isValid(base))
|
|
8955
|
-
return
|
|
8956
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
10030
|
+
return INVALID;
|
|
10031
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
10032
|
+
status: status.value,
|
|
10033
|
+
value: result
|
|
10034
|
+
}));
|
|
8957
10035
|
});
|
|
8958
10036
|
}
|
|
8959
10037
|
}
|
|
@@ -8976,7 +10054,6 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
8976
10054
|
...processCreateParams(params)
|
|
8977
10055
|
});
|
|
8978
10056
|
};
|
|
8979
|
-
|
|
8980
10057
|
class ZodOptional extends ZodType {
|
|
8981
10058
|
_parse(input) {
|
|
8982
10059
|
const parsedType = this._getType(input);
|
|
@@ -9221,21 +10298,19 @@ function cleanParams(params, data) {
|
|
|
9221
10298
|
function custom(check, _params = {}, fatal) {
|
|
9222
10299
|
if (check)
|
|
9223
10300
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
9224
|
-
var _a, _b;
|
|
9225
10301
|
const r = check(data);
|
|
9226
10302
|
if (r instanceof Promise) {
|
|
9227
10303
|
return r.then((r2) => {
|
|
9228
|
-
var _a2, _b2;
|
|
9229
10304
|
if (!r2) {
|
|
9230
10305
|
const params = cleanParams(_params, data);
|
|
9231
|
-
const _fatal =
|
|
10306
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
9232
10307
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
9233
10308
|
}
|
|
9234
10309
|
});
|
|
9235
10310
|
}
|
|
9236
10311
|
if (!r) {
|
|
9237
10312
|
const params = cleanParams(_params, data);
|
|
9238
|
-
const _fatal =
|
|
10313
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
9239
10314
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
9240
10315
|
}
|
|
9241
10316
|
return;
|
|
@@ -9335,122 +10410,6 @@ var coerce = {
|
|
|
9335
10410
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
9336
10411
|
};
|
|
9337
10412
|
var NEVER = INVALID;
|
|
9338
|
-
var z = /* @__PURE__ */ Object.freeze({
|
|
9339
|
-
__proto__: null,
|
|
9340
|
-
defaultErrorMap: errorMap,
|
|
9341
|
-
setErrorMap,
|
|
9342
|
-
getErrorMap,
|
|
9343
|
-
makeIssue,
|
|
9344
|
-
EMPTY_PATH,
|
|
9345
|
-
addIssueToContext,
|
|
9346
|
-
ParseStatus,
|
|
9347
|
-
INVALID,
|
|
9348
|
-
DIRTY,
|
|
9349
|
-
OK,
|
|
9350
|
-
isAborted,
|
|
9351
|
-
isDirty,
|
|
9352
|
-
isValid,
|
|
9353
|
-
isAsync,
|
|
9354
|
-
get util() {
|
|
9355
|
-
return util;
|
|
9356
|
-
},
|
|
9357
|
-
get objectUtil() {
|
|
9358
|
-
return objectUtil;
|
|
9359
|
-
},
|
|
9360
|
-
ZodParsedType,
|
|
9361
|
-
getParsedType,
|
|
9362
|
-
ZodType,
|
|
9363
|
-
datetimeRegex,
|
|
9364
|
-
ZodString,
|
|
9365
|
-
ZodNumber,
|
|
9366
|
-
ZodBigInt,
|
|
9367
|
-
ZodBoolean,
|
|
9368
|
-
ZodDate,
|
|
9369
|
-
ZodSymbol,
|
|
9370
|
-
ZodUndefined,
|
|
9371
|
-
ZodNull,
|
|
9372
|
-
ZodAny,
|
|
9373
|
-
ZodUnknown,
|
|
9374
|
-
ZodNever,
|
|
9375
|
-
ZodVoid,
|
|
9376
|
-
ZodArray,
|
|
9377
|
-
ZodObject,
|
|
9378
|
-
ZodUnion,
|
|
9379
|
-
ZodDiscriminatedUnion,
|
|
9380
|
-
ZodIntersection,
|
|
9381
|
-
ZodTuple,
|
|
9382
|
-
ZodRecord,
|
|
9383
|
-
ZodMap,
|
|
9384
|
-
ZodSet,
|
|
9385
|
-
ZodFunction,
|
|
9386
|
-
ZodLazy,
|
|
9387
|
-
ZodLiteral,
|
|
9388
|
-
ZodEnum,
|
|
9389
|
-
ZodNativeEnum,
|
|
9390
|
-
ZodPromise,
|
|
9391
|
-
ZodEffects,
|
|
9392
|
-
ZodTransformer: ZodEffects,
|
|
9393
|
-
ZodOptional,
|
|
9394
|
-
ZodNullable,
|
|
9395
|
-
ZodDefault,
|
|
9396
|
-
ZodCatch,
|
|
9397
|
-
ZodNaN,
|
|
9398
|
-
BRAND,
|
|
9399
|
-
ZodBranded,
|
|
9400
|
-
ZodPipeline,
|
|
9401
|
-
ZodReadonly,
|
|
9402
|
-
custom,
|
|
9403
|
-
Schema: ZodType,
|
|
9404
|
-
ZodSchema: ZodType,
|
|
9405
|
-
late,
|
|
9406
|
-
get ZodFirstPartyTypeKind() {
|
|
9407
|
-
return ZodFirstPartyTypeKind;
|
|
9408
|
-
},
|
|
9409
|
-
coerce,
|
|
9410
|
-
any: anyType,
|
|
9411
|
-
array: arrayType,
|
|
9412
|
-
bigint: bigIntType,
|
|
9413
|
-
boolean: booleanType,
|
|
9414
|
-
date: dateType,
|
|
9415
|
-
discriminatedUnion: discriminatedUnionType,
|
|
9416
|
-
effect: effectsType,
|
|
9417
|
-
enum: enumType,
|
|
9418
|
-
function: functionType,
|
|
9419
|
-
instanceof: instanceOfType,
|
|
9420
|
-
intersection: intersectionType,
|
|
9421
|
-
lazy: lazyType,
|
|
9422
|
-
literal: literalType,
|
|
9423
|
-
map: mapType,
|
|
9424
|
-
nan: nanType,
|
|
9425
|
-
nativeEnum: nativeEnumType,
|
|
9426
|
-
never: neverType,
|
|
9427
|
-
null: nullType,
|
|
9428
|
-
nullable: nullableType,
|
|
9429
|
-
number: numberType,
|
|
9430
|
-
object: objectType,
|
|
9431
|
-
oboolean,
|
|
9432
|
-
onumber,
|
|
9433
|
-
optional: optionalType,
|
|
9434
|
-
ostring,
|
|
9435
|
-
pipeline: pipelineType,
|
|
9436
|
-
preprocess: preprocessType,
|
|
9437
|
-
promise: promiseType,
|
|
9438
|
-
record: recordType,
|
|
9439
|
-
set: setType,
|
|
9440
|
-
strictObject: strictObjectType,
|
|
9441
|
-
string: stringType,
|
|
9442
|
-
symbol: symbolType,
|
|
9443
|
-
transformer: effectsType,
|
|
9444
|
-
tuple: tupleType,
|
|
9445
|
-
undefined: undefinedType,
|
|
9446
|
-
union: unionType,
|
|
9447
|
-
unknown: unknownType,
|
|
9448
|
-
void: voidType,
|
|
9449
|
-
NEVER,
|
|
9450
|
-
ZodIssueCode,
|
|
9451
|
-
quotelessJson,
|
|
9452
|
-
ZodError
|
|
9453
|
-
});
|
|
9454
10413
|
// src/common/string.ts
|
|
9455
10414
|
var getChineseByStr = (str) => {
|
|
9456
10415
|
if (!str) {
|
|
@@ -9629,7 +10588,7 @@ var watch = {
|
|
|
9629
10588
|
};
|
|
9630
10589
|
// ../../node_modules/decimal.js/decimal.mjs
|
|
9631
10590
|
/*!
|
|
9632
|
-
* decimal.js v10.
|
|
10591
|
+
* decimal.js v10.6.0
|
|
9633
10592
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
9634
10593
|
* https://github.com/MikeMcl/decimal.js
|
|
9635
10594
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
@@ -9652,7 +10611,7 @@ var DEFAULTS = {
|
|
|
9652
10611
|
};
|
|
9653
10612
|
var inexact;
|
|
9654
10613
|
var quadrant;
|
|
9655
|
-
var
|
|
10614
|
+
var external2 = true;
|
|
9656
10615
|
var decimalError = "[DecimalError] ";
|
|
9657
10616
|
var invalidArgument = decimalError + "Invalid argument: ";
|
|
9658
10617
|
var precisionLimitExceeded = decimalError + "Precision limit exceeded";
|
|
@@ -9728,7 +10687,7 @@ P.cubeRoot = P.cbrt = function() {
|
|
|
9728
10687
|
var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor;
|
|
9729
10688
|
if (!x.isFinite() || x.isZero())
|
|
9730
10689
|
return new Ctor(x);
|
|
9731
|
-
|
|
10690
|
+
external2 = false;
|
|
9732
10691
|
s = x.s * mathpow(x.s * x, 1 / 3);
|
|
9733
10692
|
if (!s || Math.abs(s) == 1 / 0) {
|
|
9734
10693
|
n = digitsToString(x.d);
|
|
@@ -9775,7 +10734,7 @@ P.cubeRoot = P.cbrt = function() {
|
|
|
9775
10734
|
}
|
|
9776
10735
|
}
|
|
9777
10736
|
}
|
|
9778
|
-
|
|
10737
|
+
external2 = true;
|
|
9779
10738
|
return finalise(r, e, Ctor.rounding, m);
|
|
9780
10739
|
};
|
|
9781
10740
|
P.decimalPlaces = P.dp = function() {
|
|
@@ -9900,9 +10859,9 @@ P.inverseHyperbolicCosine = P.acosh = function() {
|
|
|
9900
10859
|
rm = Ctor.rounding;
|
|
9901
10860
|
Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
|
|
9902
10861
|
Ctor.rounding = 1;
|
|
9903
|
-
|
|
10862
|
+
external2 = false;
|
|
9904
10863
|
x = x.times(x).minus(1).sqrt().plus(x);
|
|
9905
|
-
|
|
10864
|
+
external2 = true;
|
|
9906
10865
|
Ctor.precision = pr;
|
|
9907
10866
|
Ctor.rounding = rm;
|
|
9908
10867
|
return x.ln();
|
|
@@ -9915,9 +10874,9 @@ P.inverseHyperbolicSine = P.asinh = function() {
|
|
|
9915
10874
|
rm = Ctor.rounding;
|
|
9916
10875
|
Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
|
|
9917
10876
|
Ctor.rounding = 1;
|
|
9918
|
-
|
|
10877
|
+
external2 = false;
|
|
9919
10878
|
x = x.times(x).plus(1).sqrt().plus(x);
|
|
9920
|
-
|
|
10879
|
+
external2 = true;
|
|
9921
10880
|
Ctor.precision = pr;
|
|
9922
10881
|
Ctor.rounding = rm;
|
|
9923
10882
|
return x.ln();
|
|
@@ -9986,7 +10945,7 @@ P.inverseTangent = P.atan = function() {
|
|
|
9986
10945
|
k = Math.min(28, wpr / LOG_BASE + 2 | 0);
|
|
9987
10946
|
for (i = k;i; --i)
|
|
9988
10947
|
x = x.div(x.times(x).plus(1).sqrt().plus(1));
|
|
9989
|
-
|
|
10948
|
+
external2 = false;
|
|
9990
10949
|
j = Math.ceil(wpr / LOG_BASE);
|
|
9991
10950
|
n = 1;
|
|
9992
10951
|
x2 = x.times(x);
|
|
@@ -10003,7 +10962,7 @@ P.inverseTangent = P.atan = function() {
|
|
|
10003
10962
|
}
|
|
10004
10963
|
if (k)
|
|
10005
10964
|
r = r.times(2 << k - 1);
|
|
10006
|
-
|
|
10965
|
+
external2 = true;
|
|
10007
10966
|
return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
|
|
10008
10967
|
};
|
|
10009
10968
|
P.isFinite = function() {
|
|
@@ -10055,7 +11014,7 @@ P.logarithm = P.log = function(base) {
|
|
|
10055
11014
|
inf = k !== 1;
|
|
10056
11015
|
}
|
|
10057
11016
|
}
|
|
10058
|
-
|
|
11017
|
+
external2 = false;
|
|
10059
11018
|
sd = pr + guard;
|
|
10060
11019
|
num = naturalLogarithm(arg, sd);
|
|
10061
11020
|
denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
|
|
@@ -10074,7 +11033,7 @@ P.logarithm = P.log = function(base) {
|
|
|
10074
11033
|
}
|
|
10075
11034
|
} while (checkRoundingDigits(r.d, k += 10, rm));
|
|
10076
11035
|
}
|
|
10077
|
-
|
|
11036
|
+
external2 = true;
|
|
10078
11037
|
return finalise(r, pr, rm);
|
|
10079
11038
|
};
|
|
10080
11039
|
P.minus = P.sub = function(y) {
|
|
@@ -10104,7 +11063,7 @@ P.minus = P.sub = function(y) {
|
|
|
10104
11063
|
y = new Ctor(x);
|
|
10105
11064
|
else
|
|
10106
11065
|
return new Ctor(rm === 3 ? -0 : 0);
|
|
10107
|
-
return
|
|
11066
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10108
11067
|
}
|
|
10109
11068
|
e = mathfloor(y.e / LOG_BASE);
|
|
10110
11069
|
xe = mathfloor(x.e / LOG_BASE);
|
|
@@ -10170,7 +11129,7 @@ P.minus = P.sub = function(y) {
|
|
|
10170
11129
|
return new Ctor(rm === 3 ? -0 : 0);
|
|
10171
11130
|
y.d = xd;
|
|
10172
11131
|
y.e = getBase10Exponent(xd, e);
|
|
10173
|
-
return
|
|
11132
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10174
11133
|
};
|
|
10175
11134
|
P.modulo = P.mod = function(y) {
|
|
10176
11135
|
var q, x = this, Ctor = x.constructor;
|
|
@@ -10180,7 +11139,7 @@ P.modulo = P.mod = function(y) {
|
|
|
10180
11139
|
if (!y.d || x.d && !x.d[0]) {
|
|
10181
11140
|
return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
|
|
10182
11141
|
}
|
|
10183
|
-
|
|
11142
|
+
external2 = false;
|
|
10184
11143
|
if (Ctor.modulo == 9) {
|
|
10185
11144
|
q = divide(x, y.abs(), 0, 3, 1);
|
|
10186
11145
|
q.s *= y.s;
|
|
@@ -10188,7 +11147,7 @@ P.modulo = P.mod = function(y) {
|
|
|
10188
11147
|
q = divide(x, y, 0, Ctor.modulo, 1);
|
|
10189
11148
|
}
|
|
10190
11149
|
q = q.times(y);
|
|
10191
|
-
|
|
11150
|
+
external2 = true;
|
|
10192
11151
|
return x.minus(q);
|
|
10193
11152
|
};
|
|
10194
11153
|
P.naturalExponential = P.exp = function() {
|
|
@@ -10223,7 +11182,7 @@ P.plus = P.add = function(y) {
|
|
|
10223
11182
|
if (!xd[0] || !yd[0]) {
|
|
10224
11183
|
if (!yd[0])
|
|
10225
11184
|
y = new Ctor(x);
|
|
10226
|
-
return
|
|
11185
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10227
11186
|
}
|
|
10228
11187
|
k = mathfloor(x.e / LOG_BASE);
|
|
10229
11188
|
e = mathfloor(y.e / LOG_BASE);
|
|
@@ -10270,15 +11229,15 @@ P.plus = P.add = function(y) {
|
|
|
10270
11229
|
xd.pop();
|
|
10271
11230
|
y.d = xd;
|
|
10272
11231
|
y.e = getBase10Exponent(xd, e);
|
|
10273
|
-
return
|
|
11232
|
+
return external2 ? finalise(y, pr, rm) : y;
|
|
10274
11233
|
};
|
|
10275
|
-
P.precision = P.sd = function(
|
|
11234
|
+
P.precision = P.sd = function(z) {
|
|
10276
11235
|
var k, x = this;
|
|
10277
|
-
if (
|
|
10278
|
-
throw Error(invalidArgument +
|
|
11236
|
+
if (z !== undefined && z !== !!z && z !== 1 && z !== 0)
|
|
11237
|
+
throw Error(invalidArgument + z);
|
|
10279
11238
|
if (x.d) {
|
|
10280
11239
|
k = getPrecision(x.d);
|
|
10281
|
-
if (
|
|
11240
|
+
if (z && x.e + 1 > k)
|
|
10282
11241
|
k = x.e + 1;
|
|
10283
11242
|
} else {
|
|
10284
11243
|
k = NaN;
|
|
@@ -10309,7 +11268,7 @@ P.squareRoot = P.sqrt = function() {
|
|
|
10309
11268
|
if (s !== 1 || !d || !d[0]) {
|
|
10310
11269
|
return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
|
|
10311
11270
|
}
|
|
10312
|
-
|
|
11271
|
+
external2 = false;
|
|
10313
11272
|
s = Math.sqrt(+x);
|
|
10314
11273
|
if (s == 0 || s == 1 / 0) {
|
|
10315
11274
|
n = digitsToString(d);
|
|
@@ -10352,7 +11311,7 @@ P.squareRoot = P.sqrt = function() {
|
|
|
10352
11311
|
}
|
|
10353
11312
|
}
|
|
10354
11313
|
}
|
|
10355
|
-
|
|
11314
|
+
external2 = true;
|
|
10356
11315
|
return finalise(r, e, Ctor.rounding, m);
|
|
10357
11316
|
};
|
|
10358
11317
|
P.tangent = P.tan = function() {
|
|
@@ -10410,7 +11369,7 @@ P.times = P.mul = function(y) {
|
|
|
10410
11369
|
r.shift();
|
|
10411
11370
|
y.d = r;
|
|
10412
11371
|
y.e = getBase10Exponent(r, e);
|
|
10413
|
-
return
|
|
11372
|
+
return external2 ? finalise(y, Ctor.precision, Ctor.rounding) : y;
|
|
10414
11373
|
};
|
|
10415
11374
|
P.toBinary = function(sd, rm) {
|
|
10416
11375
|
return toStringBinary(this, 2, sd, rm);
|
|
@@ -10475,7 +11434,7 @@ P.toFraction = function(maxD) {
|
|
|
10475
11434
|
throw Error(invalidArgument + n);
|
|
10476
11435
|
maxD = n.gt(d) ? e > 0 ? d : n1 : n;
|
|
10477
11436
|
}
|
|
10478
|
-
|
|
11437
|
+
external2 = false;
|
|
10479
11438
|
n = new Ctor(digitsToString(xd));
|
|
10480
11439
|
pr = Ctor.precision;
|
|
10481
11440
|
Ctor.precision = e = xd.length * LOG_BASE * 2;
|
|
@@ -10499,7 +11458,7 @@ P.toFraction = function(maxD) {
|
|
|
10499
11458
|
n0.s = n1.s = x.s;
|
|
10500
11459
|
r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
|
|
10501
11460
|
Ctor.precision = pr;
|
|
10502
|
-
|
|
11461
|
+
external2 = true;
|
|
10503
11462
|
return r;
|
|
10504
11463
|
};
|
|
10505
11464
|
P.toHexadecimal = P.toHex = function(sd, rm) {
|
|
@@ -10529,9 +11488,9 @@ P.toNearest = function(y, rm) {
|
|
|
10529
11488
|
}
|
|
10530
11489
|
}
|
|
10531
11490
|
if (y.d[0]) {
|
|
10532
|
-
|
|
11491
|
+
external2 = false;
|
|
10533
11492
|
x = divide(x, y, 0, rm, 1).times(y);
|
|
10534
|
-
|
|
11493
|
+
external2 = true;
|
|
10535
11494
|
finalise(x);
|
|
10536
11495
|
} else {
|
|
10537
11496
|
y.s = x.s;
|
|
@@ -10576,7 +11535,7 @@ P.toPower = P.pow = function(y) {
|
|
|
10576
11535
|
e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e;
|
|
10577
11536
|
if (e > Ctor.maxE + 1 || e < Ctor.minE - 1)
|
|
10578
11537
|
return new Ctor(e > 0 ? s / 0 : 0);
|
|
10579
|
-
|
|
11538
|
+
external2 = false;
|
|
10580
11539
|
Ctor.rounding = x.s = 1;
|
|
10581
11540
|
k = Math.min(12, (e + "").length);
|
|
10582
11541
|
r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
|
|
@@ -10591,7 +11550,7 @@ P.toPower = P.pow = function(y) {
|
|
|
10591
11550
|
}
|
|
10592
11551
|
}
|
|
10593
11552
|
r.s = s;
|
|
10594
|
-
|
|
11553
|
+
external2 = true;
|
|
10595
11554
|
Ctor.rounding = rm;
|
|
10596
11555
|
return finalise(r, pr, rm);
|
|
10597
11556
|
};
|
|
@@ -10990,7 +11949,7 @@ function finalise(x, sd, rm, isTruncated) {
|
|
|
10990
11949
|
for (i = xd.length;xd[--i] === 0; )
|
|
10991
11950
|
xd.pop();
|
|
10992
11951
|
}
|
|
10993
|
-
if (
|
|
11952
|
+
if (external2) {
|
|
10994
11953
|
if (x.e > Ctor.maxE) {
|
|
10995
11954
|
x.d = null;
|
|
10996
11955
|
x.e = NaN;
|
|
@@ -11039,7 +11998,7 @@ function getBase10Exponent(digits, e) {
|
|
|
11039
11998
|
}
|
|
11040
11999
|
function getLn10(Ctor, sd, pr) {
|
|
11041
12000
|
if (sd > LN10_PRECISION) {
|
|
11042
|
-
|
|
12001
|
+
external2 = true;
|
|
11043
12002
|
if (pr)
|
|
11044
12003
|
Ctor.precision = pr;
|
|
11045
12004
|
throw Error(precisionLimitExceeded);
|
|
@@ -11070,7 +12029,7 @@ function getZeroString(k) {
|
|
|
11070
12029
|
}
|
|
11071
12030
|
function intPow(Ctor, x, n, pr) {
|
|
11072
12031
|
var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4);
|
|
11073
|
-
|
|
12032
|
+
external2 = false;
|
|
11074
12033
|
for (;; ) {
|
|
11075
12034
|
if (n % 2) {
|
|
11076
12035
|
r = r.times(x);
|
|
@@ -11087,7 +12046,7 @@ function intPow(Ctor, x, n, pr) {
|
|
|
11087
12046
|
x = x.times(x);
|
|
11088
12047
|
truncate(x.d, k);
|
|
11089
12048
|
}
|
|
11090
|
-
|
|
12049
|
+
external2 = true;
|
|
11091
12050
|
return r;
|
|
11092
12051
|
}
|
|
11093
12052
|
function isOdd(n) {
|
|
@@ -11114,7 +12073,7 @@ function naturalExponential(x, sd) {
|
|
|
11114
12073
|
return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
|
|
11115
12074
|
}
|
|
11116
12075
|
if (sd == null) {
|
|
11117
|
-
|
|
12076
|
+
external2 = false;
|
|
11118
12077
|
wpr = pr;
|
|
11119
12078
|
} else {
|
|
11120
12079
|
wpr = sd;
|
|
@@ -11143,7 +12102,7 @@ function naturalExponential(x, sd) {
|
|
|
11143
12102
|
i = 0;
|
|
11144
12103
|
rep++;
|
|
11145
12104
|
} else {
|
|
11146
|
-
return finalise(sum, Ctor.precision = pr, rm,
|
|
12105
|
+
return finalise(sum, Ctor.precision = pr, rm, external2 = true);
|
|
11147
12106
|
}
|
|
11148
12107
|
} else {
|
|
11149
12108
|
Ctor.precision = pr;
|
|
@@ -11159,7 +12118,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11159
12118
|
return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
|
|
11160
12119
|
}
|
|
11161
12120
|
if (sd == null) {
|
|
11162
|
-
|
|
12121
|
+
external2 = false;
|
|
11163
12122
|
wpr = pr;
|
|
11164
12123
|
} else {
|
|
11165
12124
|
wpr = sd;
|
|
@@ -11185,7 +12144,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11185
12144
|
t = getLn10(Ctor, wpr + 2, pr).times(e + "");
|
|
11186
12145
|
x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t);
|
|
11187
12146
|
Ctor.precision = pr;
|
|
11188
|
-
return sd == null ? finalise(x, pr, rm,
|
|
12147
|
+
return sd == null ? finalise(x, pr, rm, external2 = true) : x;
|
|
11189
12148
|
}
|
|
11190
12149
|
x1 = x;
|
|
11191
12150
|
sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
|
|
@@ -11206,7 +12165,7 @@ function naturalLogarithm(y, sd) {
|
|
|
11206
12165
|
x2 = finalise(x.times(x), wpr, 1);
|
|
11207
12166
|
denominator = rep = 1;
|
|
11208
12167
|
} else {
|
|
11209
|
-
return finalise(sum, Ctor.precision = pr, rm,
|
|
12168
|
+
return finalise(sum, Ctor.precision = pr, rm, external2 = true);
|
|
11210
12169
|
}
|
|
11211
12170
|
} else {
|
|
11212
12171
|
Ctor.precision = pr;
|
|
@@ -11257,7 +12216,7 @@ function parseDecimal(x, str) {
|
|
|
11257
12216
|
for (;i--; )
|
|
11258
12217
|
str += "0";
|
|
11259
12218
|
x.d.push(+str);
|
|
11260
|
-
if (
|
|
12219
|
+
if (external2) {
|
|
11261
12220
|
if (x.e > x.constructor.maxE) {
|
|
11262
12221
|
x.d = null;
|
|
11263
12222
|
x.e = NaN;
|
|
@@ -11319,12 +12278,12 @@ function parseOther(x, str) {
|
|
|
11319
12278
|
return new Ctor(x.s * 0);
|
|
11320
12279
|
x.e = getBase10Exponent(xd, xe);
|
|
11321
12280
|
x.d = xd;
|
|
11322
|
-
|
|
12281
|
+
external2 = false;
|
|
11323
12282
|
if (isFloat)
|
|
11324
12283
|
x = divide(x, divisor, len * 4);
|
|
11325
12284
|
if (p)
|
|
11326
12285
|
x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
|
|
11327
|
-
|
|
12286
|
+
external2 = true;
|
|
11328
12287
|
return x;
|
|
11329
12288
|
}
|
|
11330
12289
|
function sine(Ctor, x) {
|
|
@@ -11345,7 +12304,7 @@ function sine(Ctor, x) {
|
|
|
11345
12304
|
}
|
|
11346
12305
|
function taylorSeries(Ctor, n, x, y, isHyperbolic) {
|
|
11347
12306
|
var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE);
|
|
11348
|
-
|
|
12307
|
+
external2 = false;
|
|
11349
12308
|
x2 = x.times(x);
|
|
11350
12309
|
u = new Ctor(y);
|
|
11351
12310
|
for (;; ) {
|
|
@@ -11365,7 +12324,7 @@ function taylorSeries(Ctor, n, x, y, isHyperbolic) {
|
|
|
11365
12324
|
t = j;
|
|
11366
12325
|
i++;
|
|
11367
12326
|
}
|
|
11368
|
-
|
|
12327
|
+
external2 = true;
|
|
11369
12328
|
t.d.length = k + 1;
|
|
11370
12329
|
return t;
|
|
11371
12330
|
}
|
|
@@ -11634,7 +12593,7 @@ function clone(obj) {
|
|
|
11634
12593
|
x.constructor = Decimal;
|
|
11635
12594
|
if (isDecimalInstance(v)) {
|
|
11636
12595
|
x.s = v.s;
|
|
11637
|
-
if (
|
|
12596
|
+
if (external2) {
|
|
11638
12597
|
if (!v.d || v.e > Decimal.maxE) {
|
|
11639
12598
|
x.e = NaN;
|
|
11640
12599
|
x.d = null;
|
|
@@ -11668,7 +12627,7 @@ function clone(obj) {
|
|
|
11668
12627
|
if (v === ~~v && v < 1e7) {
|
|
11669
12628
|
for (e = 0, i2 = v;i2 >= 10; i2 /= 10)
|
|
11670
12629
|
e++;
|
|
11671
|
-
if (
|
|
12630
|
+
if (external2) {
|
|
11672
12631
|
if (e > Decimal.maxE) {
|
|
11673
12632
|
x.e = NaN;
|
|
11674
12633
|
x.d = null;
|
|
@@ -11792,12 +12751,12 @@ function floor(x) {
|
|
|
11792
12751
|
}
|
|
11793
12752
|
function hypot() {
|
|
11794
12753
|
var i, n, t = new this(0);
|
|
11795
|
-
|
|
12754
|
+
external2 = false;
|
|
11796
12755
|
for (i = 0;i < arguments.length; ) {
|
|
11797
12756
|
n = new this(arguments[i++]);
|
|
11798
12757
|
if (!n.d) {
|
|
11799
12758
|
if (n.s) {
|
|
11800
|
-
|
|
12759
|
+
external2 = true;
|
|
11801
12760
|
return new this(1 / 0);
|
|
11802
12761
|
}
|
|
11803
12762
|
t = n;
|
|
@@ -11805,7 +12764,7 @@ function hypot() {
|
|
|
11805
12764
|
t = t.plus(n.times(n));
|
|
11806
12765
|
}
|
|
11807
12766
|
}
|
|
11808
|
-
|
|
12767
|
+
external2 = true;
|
|
11809
12768
|
return t.sqrt();
|
|
11810
12769
|
}
|
|
11811
12770
|
function isDecimalInstance(obj) {
|
|
@@ -11918,10 +12877,10 @@ function sub(x, y) {
|
|
|
11918
12877
|
}
|
|
11919
12878
|
function sum() {
|
|
11920
12879
|
var i = 0, args = arguments, x = new this(args[i]);
|
|
11921
|
-
|
|
12880
|
+
external2 = false;
|
|
11922
12881
|
for (;x.s && ++i < args.length; )
|
|
11923
12882
|
x = x.plus(args[i]);
|
|
11924
|
-
|
|
12883
|
+
external2 = true;
|
|
11925
12884
|
return finalise(x, this.precision, this.rounding);
|
|
11926
12885
|
}
|
|
11927
12886
|
function tan(x) {
|
|
@@ -12366,6 +13325,28 @@ async function uploadFile(file, filename) {
|
|
|
12366
13325
|
throw new Error(`上传到 OSS 失败: ${error}`);
|
|
12367
13326
|
}
|
|
12368
13327
|
}
|
|
13328
|
+
// src/node/cron/index.ts
|
|
13329
|
+
var import_node_cron = __toESM(require_node_cron(), 1);
|
|
13330
|
+
var interval = (intervalMinutes, immediately, fn) => {
|
|
13331
|
+
console.log(`定时任务已启动,将每${intervalMinutes}分钟执行一次`);
|
|
13332
|
+
if (immediately) {
|
|
13333
|
+
fn();
|
|
13334
|
+
}
|
|
13335
|
+
setInterval(() => {
|
|
13336
|
+
fn();
|
|
13337
|
+
}, intervalMinutes * 60 * 1000);
|
|
13338
|
+
};
|
|
13339
|
+
var schedule = (cronExpression, immediately, fn) => {
|
|
13340
|
+
console.log(`定时任务已启动,cron表达式: ${cronExpression}`);
|
|
13341
|
+
if (immediately) {
|
|
13342
|
+
fn();
|
|
13343
|
+
}
|
|
13344
|
+
import_node_cron.default.schedule(cronExpression, () => {
|
|
13345
|
+
fn();
|
|
13346
|
+
}, {
|
|
13347
|
+
timezone: "Asia/Shanghai"
|
|
13348
|
+
});
|
|
13349
|
+
};
|
|
12369
13350
|
|
|
12370
13351
|
// src/node/index.ts
|
|
12371
13352
|
import { default as default6, DataStoreOptions } from "nedb";
|
|
@@ -12373,7 +13354,7 @@ import * as cheerio from "cheerio";
|
|
|
12373
13354
|
var export__ = import_lodash.default;
|
|
12374
13355
|
|
|
12375
13356
|
export {
|
|
12376
|
-
z,
|
|
13357
|
+
exports_external as z,
|
|
12377
13358
|
watch,
|
|
12378
13359
|
voidType as void,
|
|
12379
13360
|
util,
|
|
@@ -12391,6 +13372,7 @@ export {
|
|
|
12391
13372
|
setErrorMap,
|
|
12392
13373
|
setType as set,
|
|
12393
13374
|
sendMail,
|
|
13375
|
+
schedule,
|
|
12394
13376
|
replaceContentInFile,
|
|
12395
13377
|
replaceByVariables,
|
|
12396
13378
|
replaceByRules,
|
|
@@ -12432,6 +13414,7 @@ export {
|
|
|
12432
13414
|
isDirty,
|
|
12433
13415
|
isAsync,
|
|
12434
13416
|
isAborted,
|
|
13417
|
+
interval,
|
|
12435
13418
|
intersectionType as intersection,
|
|
12436
13419
|
instanceOfType as instanceof,
|
|
12437
13420
|
initChinaDayjs,
|
|
@@ -12461,7 +13444,7 @@ export {
|
|
|
12461
13444
|
downloadFile,
|
|
12462
13445
|
discriminatedUnionType as discriminatedUnion,
|
|
12463
13446
|
delay,
|
|
12464
|
-
|
|
13447
|
+
en_default as defaultErrorMap,
|
|
12465
13448
|
dayjs_default as dayjs,
|
|
12466
13449
|
datetimeRegex,
|
|
12467
13450
|
dateType as date,
|