1. 调整计划列表展示项
2. 调整设备列表展示项
This commit is contained in:
44
node_modules/cron-parser/dist/fields/CronDayOfMonth.js
generated
vendored
Normal file
44
node_modules/cron-parser/dist/fields/CronDayOfMonth.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronDayOfMonth = void 0;
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_DAY = 1;
|
||||
const MAX_DAY = 31;
|
||||
const DAY_CHARS = Object.freeze(['L']);
|
||||
/**
|
||||
* Represents the "day of the month" field within a cron expression.
|
||||
* @class CronDayOfMonth
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronDayOfMonth extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_DAY;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_DAY;
|
||||
}
|
||||
static get chars() {
|
||||
return DAY_CHARS;
|
||||
}
|
||||
static get validChars() {
|
||||
return /^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/;
|
||||
}
|
||||
/**
|
||||
* CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
|
||||
* @param {DayOfMonthRange[]} values - Values for the "day of the month" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
* @throws {Error} if validation fails
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "day of the month" field.
|
||||
* @returns {DayOfMonthRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
}
|
||||
exports.CronDayOfMonth = CronDayOfMonth;
|
||||
51
node_modules/cron-parser/dist/fields/CronDayOfWeek.js
generated
vendored
Normal file
51
node_modules/cron-parser/dist/fields/CronDayOfWeek.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronDayOfWeek = void 0;
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_DAY = 0;
|
||||
const MAX_DAY = 7;
|
||||
const DAY_CHARS = Object.freeze(['L']);
|
||||
/**
|
||||
* Represents the "day of the week" field within a cron expression.
|
||||
* @class CronDayOfTheWeek
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronDayOfWeek extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_DAY;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_DAY;
|
||||
}
|
||||
static get chars() {
|
||||
return DAY_CHARS;
|
||||
}
|
||||
static get validChars() {
|
||||
return /^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/;
|
||||
}
|
||||
/**
|
||||
* CronDayOfTheWeek constructor. Initializes the "day of the week" field with the provided values.
|
||||
* @param {DayOfWeekRange[]} values - Values for the "day of the week" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "day of the week" field.
|
||||
* @returns {DayOfWeekRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
/**
|
||||
* Returns the nth day of the week if specified in the cron expression.
|
||||
* This is used for the '#' character in the cron expression.
|
||||
* @returns {number} The nth day of the week (1-5) or 0 if not specified.
|
||||
*/
|
||||
get nthDay() {
|
||||
return this.options.nthDayOfWeek ?? 0;
|
||||
}
|
||||
}
|
||||
exports.CronDayOfWeek = CronDayOfWeek;
|
||||
183
node_modules/cron-parser/dist/fields/CronField.js
generated
vendored
Normal file
183
node_modules/cron-parser/dist/fields/CronField.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronField = void 0;
|
||||
/**
|
||||
* Represents a field within a cron expression.
|
||||
* This is a base class and should not be instantiated directly.
|
||||
* @class CronField
|
||||
*/
|
||||
class CronField {
|
||||
#hasLastChar = false;
|
||||
#hasQuestionMarkChar = false;
|
||||
#wildcard = false;
|
||||
#values = [];
|
||||
options = { rawValue: '' };
|
||||
/**
|
||||
* Returns the minimum value allowed for this field.
|
||||
*/
|
||||
/* istanbul ignore next */ static get min() {
|
||||
/* istanbul ignore next */
|
||||
throw new Error('min must be overridden');
|
||||
}
|
||||
/**
|
||||
* Returns the maximum value allowed for this field.
|
||||
*/
|
||||
/* istanbul ignore next */ static get max() {
|
||||
/* istanbul ignore next */
|
||||
throw new Error('max must be overridden');
|
||||
}
|
||||
/**
|
||||
* Returns the allowed characters for this field.
|
||||
*/
|
||||
/* istanbul ignore next */ static get chars() {
|
||||
/* istanbul ignore next - this is overridden */
|
||||
return Object.freeze([]);
|
||||
}
|
||||
/**
|
||||
* Returns the regular expression used to validate this field.
|
||||
*/
|
||||
static get validChars() {
|
||||
return /^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/;
|
||||
}
|
||||
/**
|
||||
* Returns the constraints for this field.
|
||||
*/
|
||||
static get constraints() {
|
||||
return { min: this.min, max: this.max, chars: this.chars, validChars: this.validChars };
|
||||
}
|
||||
/**
|
||||
* CronField constructor. Initializes the field with the provided values.
|
||||
* @param {number[] | string[]} values - Values for this field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
* @throws {TypeError} if the constructor is called directly
|
||||
* @throws {Error} if validation fails
|
||||
*/
|
||||
constructor(values, options = { rawValue: '' }) {
|
||||
if (!Array.isArray(values)) {
|
||||
throw new Error(`${this.constructor.name} Validation error, values is not an array`);
|
||||
}
|
||||
if (!(values.length > 0)) {
|
||||
throw new Error(`${this.constructor.name} Validation error, values contains no values`);
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
this.options = {
|
||||
...options,
|
||||
rawValue: options.rawValue ?? '',
|
||||
};
|
||||
this.#values = values.sort(CronField.sorter);
|
||||
this.#wildcard = this.options.wildcard !== undefined ? this.options.wildcard : this.#isWildcardValue();
|
||||
this.#hasLastChar = this.options.rawValue.includes('L') || values.includes('L');
|
||||
this.#hasQuestionMarkChar = this.options.rawValue.includes('?') || values.includes('?');
|
||||
}
|
||||
/**
|
||||
* Returns the minimum value allowed for this field.
|
||||
* @returns {number}
|
||||
*/
|
||||
get min() {
|
||||
// return the static value from the child class
|
||||
return this.constructor.min;
|
||||
}
|
||||
/**
|
||||
* Returns the maximum value allowed for this field.
|
||||
* @returns {number}
|
||||
*/
|
||||
get max() {
|
||||
// return the static value from the child class
|
||||
return this.constructor.max;
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed special characters for this field.
|
||||
* @returns {string[]}
|
||||
*/
|
||||
get chars() {
|
||||
// return the frozen static value from the child class
|
||||
return this.constructor.chars;
|
||||
}
|
||||
/**
|
||||
* Indicates whether this field has a "last" character.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get hasLastChar() {
|
||||
return this.#hasLastChar;
|
||||
}
|
||||
/**
|
||||
* Indicates whether this field has a "question mark" character.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get hasQuestionMarkChar() {
|
||||
return this.#hasQuestionMarkChar;
|
||||
}
|
||||
/**
|
||||
* Indicates whether this field is a wildcard.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
get isWildcard() {
|
||||
return this.#wildcard;
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for this field.
|
||||
* @returns {CronFieldType}
|
||||
*/
|
||||
get values() {
|
||||
return this.#values;
|
||||
}
|
||||
/**
|
||||
* Helper function to sort values in ascending order.
|
||||
* @param {number | string} a - First value to compare
|
||||
* @param {number | string} b - Second value to compare
|
||||
* @returns {number} - A negative, zero, or positive value, depending on the sort order
|
||||
*/
|
||||
static sorter(a, b) {
|
||||
const aIsNumber = typeof a === 'number';
|
||||
const bIsNumber = typeof b === 'number';
|
||||
if (aIsNumber && bIsNumber)
|
||||
return a - b;
|
||||
if (!aIsNumber && !bIsNumber)
|
||||
return a.localeCompare(b);
|
||||
return aIsNumber ? /* istanbul ignore next - A will always be a number until L-2 is supported */ -1 : 1;
|
||||
}
|
||||
/**
|
||||
* Serializes the field to an object.
|
||||
* @returns {SerializedCronField}
|
||||
*/
|
||||
serialize() {
|
||||
return {
|
||||
wildcard: this.#wildcard,
|
||||
values: this.#values,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Validates the field values against the allowed range and special characters.
|
||||
* @throws {Error} if validation fails
|
||||
*/
|
||||
validate() {
|
||||
let badValue;
|
||||
const charsString = this.chars.length > 0 ? ` or chars ${this.chars.join('')}` : '';
|
||||
const charTest = (value) => (char) => new RegExp(`^\\d{0,2}${char}$`).test(value);
|
||||
const rangeTest = (value) => {
|
||||
badValue = value;
|
||||
return typeof value === 'number' ? value >= this.min && value <= this.max : this.chars.some(charTest(value));
|
||||
};
|
||||
const isValidRange = this.#values.every(rangeTest);
|
||||
if (!isValidRange) {
|
||||
throw new Error(`${this.constructor.name} Validation error, got value ${badValue} expected range ${this.min}-${this.max}${charsString}`);
|
||||
}
|
||||
// check for duplicate value in this.#values array
|
||||
const duplicate = this.#values.find((value, index) => this.#values.indexOf(value) !== index);
|
||||
if (duplicate) {
|
||||
throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${duplicate}`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determines if the field is a wildcard based on the values.
|
||||
* When options.rawValue is not empty, it checks if the raw value is a wildcard, otherwise it checks if all values in the range are included.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
#isWildcardValue() {
|
||||
if (this.options.rawValue.length > 0) {
|
||||
return ['*', '?'].includes(this.options.rawValue);
|
||||
}
|
||||
return Array.from({ length: this.max - this.min + 1 }, (_, i) => i + this.min).every((value) => this.#values.includes(value));
|
||||
}
|
||||
}
|
||||
exports.CronField = CronField;
|
||||
40
node_modules/cron-parser/dist/fields/CronHour.js
generated
vendored
Normal file
40
node_modules/cron-parser/dist/fields/CronHour.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronHour = void 0;
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_HOUR = 0;
|
||||
const MAX_HOUR = 23;
|
||||
const HOUR_CHARS = Object.freeze([]);
|
||||
/**
|
||||
* Represents the "hour" field within a cron expression.
|
||||
* @class CronHour
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronHour extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_HOUR;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_HOUR;
|
||||
}
|
||||
static get chars() {
|
||||
return HOUR_CHARS;
|
||||
}
|
||||
/**
|
||||
* CronHour constructor. Initializes the "hour" field with the provided values.
|
||||
* @param {HourRange[]} values - Values for the "hour" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "hour" field.
|
||||
* @returns {HourRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
}
|
||||
exports.CronHour = CronHour;
|
||||
40
node_modules/cron-parser/dist/fields/CronMinute.js
generated
vendored
Normal file
40
node_modules/cron-parser/dist/fields/CronMinute.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronMinute = void 0;
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_MINUTE = 0;
|
||||
const MAX_MINUTE = 59;
|
||||
const MINUTE_CHARS = Object.freeze([]);
|
||||
/**
|
||||
* Represents the "second" field within a cron expression.
|
||||
* @class CronSecond
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronMinute extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_MINUTE;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_MINUTE;
|
||||
}
|
||||
static get chars() {
|
||||
return MINUTE_CHARS;
|
||||
}
|
||||
/**
|
||||
* CronSecond constructor. Initializes the "second" field with the provided values.
|
||||
* @param {SixtyRange[]} values - Values for the "second" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "second" field.
|
||||
* @returns {SixtyRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
}
|
||||
exports.CronMinute = CronMinute;
|
||||
44
node_modules/cron-parser/dist/fields/CronMonth.js
generated
vendored
Normal file
44
node_modules/cron-parser/dist/fields/CronMonth.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronMonth = void 0;
|
||||
const CronDate_1 = require("../CronDate");
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_MONTH = 1;
|
||||
const MAX_MONTH = 12;
|
||||
const MONTH_CHARS = Object.freeze([]);
|
||||
/**
|
||||
* Represents the "day of the month" field within a cron expression.
|
||||
* @class CronDayOfMonth
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronMonth extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_MONTH;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_MONTH;
|
||||
}
|
||||
static get chars() {
|
||||
return MONTH_CHARS;
|
||||
}
|
||||
static get daysInMonth() {
|
||||
return CronDate_1.DAYS_IN_MONTH;
|
||||
}
|
||||
/**
|
||||
* CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
|
||||
* @param {MonthRange[]} values - Values for the "day of the month" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "day of the month" field.
|
||||
* @returns {MonthRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
}
|
||||
exports.CronMonth = CronMonth;
|
||||
40
node_modules/cron-parser/dist/fields/CronSecond.js
generated
vendored
Normal file
40
node_modules/cron-parser/dist/fields/CronSecond.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CronSecond = void 0;
|
||||
const CronField_1 = require("./CronField");
|
||||
const MIN_SECOND = 0;
|
||||
const MAX_SECOND = 59;
|
||||
const SECOND_CHARS = Object.freeze([]);
|
||||
/**
|
||||
* Represents the "second" field within a cron expression.
|
||||
* @class CronSecond
|
||||
* @extends CronField
|
||||
*/
|
||||
class CronSecond extends CronField_1.CronField {
|
||||
static get min() {
|
||||
return MIN_SECOND;
|
||||
}
|
||||
static get max() {
|
||||
return MAX_SECOND;
|
||||
}
|
||||
static get chars() {
|
||||
return SECOND_CHARS;
|
||||
}
|
||||
/**
|
||||
* CronSecond constructor. Initializes the "second" field with the provided values.
|
||||
* @param {SixtyRange[]} values - Values for the "second" field
|
||||
* @param {CronFieldOptions} [options] - Options provided by the parser
|
||||
*/
|
||||
constructor(values, options) {
|
||||
super(values, options);
|
||||
this.validate();
|
||||
}
|
||||
/**
|
||||
* Returns an array of allowed values for the "second" field.
|
||||
* @returns {SixtyRange[]}
|
||||
*/
|
||||
get values() {
|
||||
return super.values;
|
||||
}
|
||||
}
|
||||
exports.CronSecond = CronSecond;
|
||||
24
node_modules/cron-parser/dist/fields/index.js
generated
vendored
Normal file
24
node_modules/cron-parser/dist/fields/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./CronDayOfMonth"), exports);
|
||||
__exportStar(require("./CronDayOfWeek"), exports);
|
||||
__exportStar(require("./CronField"), exports);
|
||||
__exportStar(require("./CronHour"), exports);
|
||||
__exportStar(require("./CronMinute"), exports);
|
||||
__exportStar(require("./CronMonth"), exports);
|
||||
__exportStar(require("./CronSecond"), exports);
|
||||
2
node_modules/cron-parser/dist/fields/types.js
generated
vendored
Normal file
2
node_modules/cron-parser/dist/fields/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
Reference in New Issue
Block a user