Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/yup/es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import inherits from './util/inherits';
import MixedSchema from './mixed';
import { string as locale } from './locale';
import isAbsent from './util/isAbsent'; // eslint-disable-next-line
var rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; // eslint-disable-next-line
var rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
var isTrimmed = function isTrimmed(value) {
return isAbsent(value) || value === value.trim();
};
export default function StringSchema() {
var _this = this;
if (!(this instanceof StringSchema)) return new StringSchema();
MixedSchema.call(this, {
type: 'string'
});
this.withMutation(function () {
_this.transform(function (value) {
if (this.isType(value)) return value;
return value != null && value.toString ? value.toString() : value;
});
});
}
inherits(StringSchema, MixedSchema, {
_typeCheck: function _typeCheck(value) {
if (value instanceof String) value = value.valueOf();
return typeof value === 'string';
},
_isPresent: function _isPresent(value) {
return MixedSchema.prototype._cast.call(this, value) && value.length > 0;
},
length: function length(_length, message) {
if (message === void 0) {
message = locale.length;
}
return this.test({
message: message,
name: 'length',
exclusive: true,
params: {
length: _length
},
test: function test(value) {
return isAbsent(value) || value.length === this.resolve(_length);
}
});
},
min: function min(_min, message) {
if (message === void 0) {
message = locale.min;
}
return this.test({
message: message,
name: 'min',
exclusive: true,
params: {
min: _min
},
test: function test(value) {
return isAbsent(value) || value.length >= this.resolve(_min);
}
});
},
max: function max(_max, message) {
if (message === void 0) {
message = locale.max;
}
return this.test({
name: 'max',
exclusive: true,
message: message,
params: {
max: _max
},
test: function test(value) {
return isAbsent(value) || value.length <= this.resolve(_max);
}
});
},
matches: function matches(regex, options) {
var excludeEmptyString = false;
var message;
var name;
if (options) {
if (options.message || options.hasOwnProperty('excludeEmptyString') || options.name) {
excludeEmptyString = options.excludeEmptyString;
message = options.message;
name = options.name;
} else message = options;
}
return this.test({
name: name || 'matches',
message: message || locale.matches,
params: {
regex: regex
},
test: function test(value) {
return isAbsent(value) || value === '' && excludeEmptyString || value.search(regex) !== -1;
}
});
},
email: function email(message) {
if (message === void 0) {
message = locale.email;
}
return this.matches(rEmail, {
name: 'email',
message: message,
excludeEmptyString: true
});
},
url: function url(message) {
if (message === void 0) {
message = locale.url;
}
return this.matches(rUrl, {
name: 'url',
message: message,
excludeEmptyString: true
});
},
//-- transforms --
ensure: function ensure() {
return this.default('').transform(function (val) {
return val === null ? '' : val;
});
},
trim: function trim(message) {
if (message === void 0) {
message = locale.trim;
}
return this.transform(function (val) {
return val != null ? val.trim() : val;
}).test({
message: message,
name: 'trim',
test: isTrimmed
});
},
lowercase: function lowercase(message) {
if (message === void 0) {
message = locale.lowercase;
}
return this.transform(function (value) {
return !isAbsent(value) ? value.toLowerCase() : value;
}).test({
message: message,
name: 'string_case',
exclusive: true,
test: function test(value) {
return isAbsent(value) || value === value.toLowerCase();
}
});
},
uppercase: function uppercase(message) {
if (message === void 0) {
message = locale.uppercase;
}
return this.transform(function (value) {
return !isAbsent(value) ? value.toUpperCase() : value;
}).test({
message: message,
name: 'string_case',
exclusive: true,
test: function test(value) {
return isAbsent(value) || value === value.toUpperCase();
}
});
}
}); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0115 ]-- |