commit
This commit is contained in:
parent
68f4b60012
commit
41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions
8
node_modules/@sapphire/shapeshift/dist/index.d.ts
generated
vendored
8
node_modules/@sapphire/shapeshift/dist/index.d.ts
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
import { InspectOptionsStylized } from 'node:util';
|
||||
import { InspectOptionsStylized } from 'util';
|
||||
|
||||
declare class Result<T, E extends Error = Error> {
|
||||
readonly success: boolean;
|
||||
|
@ -301,7 +301,7 @@ declare class ObjectValidator<T extends object, I = UndefinedToOptional<T>> exte
|
|||
private handleStrictStrategy;
|
||||
private handlePassthroughStrategy;
|
||||
}
|
||||
declare const enum ObjectValidatorStrategy {
|
||||
declare enum ObjectValidatorStrategy {
|
||||
Ignore = 0,
|
||||
Strict = 1,
|
||||
Passthrough = 2
|
||||
|
@ -500,6 +500,7 @@ declare class ArrayValidator<T extends unknown[], I = T[number]> extends BaseVal
|
|||
}
|
||||
|
||||
declare abstract class BaseValidator<T> {
|
||||
description?: string;
|
||||
protected parent?: object;
|
||||
protected constraints: readonly IConstraint<T>[];
|
||||
protected isValidationEnabled: boolean | (() => boolean) | null;
|
||||
|
@ -517,6 +518,7 @@ declare abstract class BaseValidator<T> {
|
|||
reshape<R extends Result<unknown>, O = InferResultType<R>>(cb: (input: T) => R): BaseValidator<O>;
|
||||
default(value: Exclude<T, undefined> | (() => Exclude<T, undefined>)): DefaultValidator<Exclude<T, undefined>>;
|
||||
when<Key extends WhenKey, This extends BaseValidator<any> = this>(key: Key, options: WhenOptions<This, Key>): this;
|
||||
describe(description: string): this;
|
||||
run(value: unknown): Result<T, BaseError>;
|
||||
parse<R extends T = T>(value: unknown): R;
|
||||
is<R extends T = T>(value: unknown): value is R;
|
||||
|
@ -650,7 +652,7 @@ type ExpandSmallerTuples<T extends [...any[]]> = T extends [T[0], ...infer Tail]
|
|||
type Shift<A extends Array<any>> = ((...args: A) => void) extends (...args: [A[0], ...infer R]) => void ? R : never;
|
||||
type GrowExpRev<A extends Array<any>, N extends number, P extends Array<Array<any>>> = A['length'] extends N ? A : GrowExpRev<[...A, ...P[0]][N] extends undefined ? [...A, ...P[0]] : A, N, Shift<P>>;
|
||||
type GrowExp<A extends Array<any>, N extends number, P extends Array<Array<any>>> = [...A, ...A][N] extends undefined ? GrowExp<[...A, ...A], N, [A, ...P]> : GrowExpRev<A, N, P>;
|
||||
type Tuple<T, N extends number> = number extends N ? Array<T> : N extends 0 ? [] : N extends 1 ? [T] : GrowExp<[T], N, [[]]>;
|
||||
type Tuple<T, N extends number> = N extends number ? number extends N ? Array<T> : N extends 0 ? [] : N extends 1 ? [T] : GrowExp<[T], N, [[]]> : never;
|
||||
|
||||
declare class LazyValidator<T extends BaseValidator<unknown>, R = Unwrap<T>> extends BaseValidator<R> {
|
||||
private readonly validator;
|
||||
|
|
40
node_modules/@sapphire/shapeshift/dist/index.global.js
generated
vendored
40
node_modules/@sapphire/shapeshift/dist/index.global.js
generated
vendored
|
@ -20,6 +20,10 @@ var SapphireShapeshift = (function (exports) {
|
|||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
|
@ -1255,7 +1259,7 @@ var SapphireShapeshift = (function (exports) {
|
|||
// src/constraints/ObjectConstrains.ts
|
||||
var import_get = __toESM(require_get());
|
||||
|
||||
// node-modules-polyfills:node:util
|
||||
// node-modules-polyfills:util
|
||||
var e;
|
||||
var t;
|
||||
var n;
|
||||
|
@ -1823,7 +1827,7 @@ var SapphireShapeshift = (function (exports) {
|
|||
}, X.isBuffer = i$1;
|
||||
var Se = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
function Be() {
|
||||
var e3 = new Date(), t3 = [Oe(e3.getHours()), Oe(e3.getMinutes()), Oe(e3.getSeconds())].join(":");
|
||||
var e3 = /* @__PURE__ */ new Date(), t3 = [Oe(e3.getHours()), Oe(e3.getMinutes()), Oe(e3.getSeconds())].join(":");
|
||||
return [e3.getDate(), Se[e3.getMonth()], t3].join(" ");
|
||||
}
|
||||
__name(Be, "Be");
|
||||
|
@ -2101,6 +2105,11 @@ ${givenBlock}`;
|
|||
when(key, options) {
|
||||
return this.addConstraint(whenConstraint(key, options, this));
|
||||
}
|
||||
describe(description) {
|
||||
const clone = this.clone();
|
||||
clone.description = description;
|
||||
return clone;
|
||||
}
|
||||
run(value) {
|
||||
let result = this.handle(value);
|
||||
if (result.isErr())
|
||||
|
@ -2121,6 +2130,11 @@ ${givenBlock}`;
|
|||
is(value) {
|
||||
return this.run(value).isOk();
|
||||
}
|
||||
/**
|
||||
* Sets if the validator should also run constraints or just do basic checks.
|
||||
* @param isValidationEnabled Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing.
|
||||
* Set to `null` to go off of the global configuration.
|
||||
*/
|
||||
setValidationEnabled(isValidationEnabled) {
|
||||
const clone = this.clone();
|
||||
clone.isValidationEnabled = isValidationEnabled;
|
||||
|
@ -3020,7 +3034,7 @@ ${errors}`;
|
|||
|
||||
// src/validators/ObjectValidator.ts
|
||||
var ObjectValidator = class extends BaseValidator {
|
||||
constructor(shape, strategy = ObjectValidatorStrategy.Ignore, constraints = []) {
|
||||
constructor(shape, strategy = 0 /* Ignore */, constraints = []) {
|
||||
super(constraints);
|
||||
this.keys = [];
|
||||
this.requiredKeys = /* @__PURE__ */ new Map();
|
||||
|
@ -3029,14 +3043,14 @@ ${errors}`;
|
|||
this.shape = shape;
|
||||
this.strategy = strategy;
|
||||
switch (this.strategy) {
|
||||
case ObjectValidatorStrategy.Ignore:
|
||||
case 0 /* Ignore */:
|
||||
this.handleStrategy = (value) => this.handleIgnoreStrategy(value);
|
||||
break;
|
||||
case ObjectValidatorStrategy.Strict: {
|
||||
case 1 /* Strict */: {
|
||||
this.handleStrategy = (value) => this.handleStrictStrategy(value);
|
||||
break;
|
||||
}
|
||||
case ObjectValidatorStrategy.Passthrough:
|
||||
case 2 /* Passthrough */:
|
||||
this.handleStrategy = (value) => this.handlePassthroughStrategy(value);
|
||||
break;
|
||||
}
|
||||
|
@ -3074,13 +3088,13 @@ ${errors}`;
|
|||
}
|
||||
}
|
||||
get strict() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Strict, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 1 /* Strict */, this.constraints]);
|
||||
}
|
||||
get ignore() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Ignore, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 0 /* Ignore */, this.constraints]);
|
||||
}
|
||||
get passthrough() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Passthrough, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 2 /* Passthrough */, this.constraints]);
|
||||
}
|
||||
get partial() {
|
||||
const shape = Object.fromEntries(this.keys.map((key) => [key, this.shape[key].optional]));
|
||||
|
@ -3224,12 +3238,6 @@ ${errors}`;
|
|||
}
|
||||
};
|
||||
__name(ObjectValidator, "ObjectValidator");
|
||||
var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => {
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Strict"] = 1] = "Strict";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Passthrough"] = 2] = "Passthrough";
|
||||
return ObjectValidatorStrategy2;
|
||||
})(ObjectValidatorStrategy || {});
|
||||
|
||||
// src/validators/PassthroughValidator.ts
|
||||
var PassthroughValidator = class extends BaseValidator {
|
||||
|
@ -3522,7 +3530,7 @@ ${givenBlock}`;
|
|||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match an URL"));
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match a URL"));
|
||||
}
|
||||
const validatorFnResult = validatorFn(input, url);
|
||||
if (validatorFnResult === null)
|
||||
|
|
2
node_modules/@sapphire/shapeshift/dist/index.global.js.map
generated
vendored
2
node_modules/@sapphire/shapeshift/dist/index.global.js.map
generated
vendored
File diff suppressed because one or more lines are too long
42
node_modules/@sapphire/shapeshift/dist/index.js
generated
vendored
42
node_modules/@sapphire/shapeshift/dist/index.js
generated
vendored
|
@ -5,6 +5,12 @@ var util = require('util');
|
|||
var fastDeepEqual = require('fast-deep-equal/es6/index.js');
|
||||
var uniqWith = require('lodash/uniqWith.js');
|
||||
|
||||
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
||||
|
||||
var get__default = /*#__PURE__*/_interopDefault(get);
|
||||
var fastDeepEqual__default = /*#__PURE__*/_interopDefault(fastDeepEqual);
|
||||
var uniqWith__default = /*#__PURE__*/_interopDefault(uniqWith);
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
|
||||
|
@ -121,7 +127,7 @@ function whenConstraint(key, options, validator) {
|
|||
return Result.err(new ExpectedConstraintError("s.object(T.when)", "Validator has no parent", parent, "Validator to have a parent"));
|
||||
}
|
||||
const isKeyArray = Array.isArray(key);
|
||||
const value = isKeyArray ? key.map((k) => get(parent, k)) : get(parent, key);
|
||||
const value = isKeyArray ? key.map((k) => get__default.default(parent, k)) : get__default.default(parent, key);
|
||||
const predicate = resolveBooleanIs(options, value, isKeyArray) ? options.then : options.otherwise;
|
||||
if (predicate) {
|
||||
return predicate(validator).run(input);
|
||||
|
@ -183,6 +189,11 @@ var BaseValidator = class {
|
|||
when(key, options) {
|
||||
return this.addConstraint(whenConstraint(key, options, this));
|
||||
}
|
||||
describe(description) {
|
||||
const clone = this.clone();
|
||||
clone.description = description;
|
||||
return clone;
|
||||
}
|
||||
run(value) {
|
||||
let result = this.handle(value);
|
||||
if (result.isErr())
|
||||
|
@ -203,6 +214,11 @@ var BaseValidator = class {
|
|||
is(value) {
|
||||
return this.run(value).isOk();
|
||||
}
|
||||
/**
|
||||
* Sets if the validator should also run constraints or just do basic checks.
|
||||
* @param isValidationEnabled Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing.
|
||||
* Set to `null` to go off of the global configuration.
|
||||
*/
|
||||
setValidationEnabled(isValidationEnabled) {
|
||||
const clone = this.clone();
|
||||
clone.isValidationEnabled = isValidationEnabled;
|
||||
|
@ -229,7 +245,7 @@ __name(BaseValidator, "BaseValidator");
|
|||
function isUnique(input) {
|
||||
if (input.length < 2)
|
||||
return true;
|
||||
const uniqueArray2 = uniqWith(input, fastDeepEqual);
|
||||
const uniqueArray2 = uniqWith__default.default(input, fastDeepEqual__default.default);
|
||||
return uniqueArray2.length === input.length;
|
||||
}
|
||||
__name(isUnique, "isUnique");
|
||||
|
@ -1092,7 +1108,7 @@ __name(UnionValidator, "UnionValidator");
|
|||
|
||||
// src/validators/ObjectValidator.ts
|
||||
var ObjectValidator = class extends BaseValidator {
|
||||
constructor(shape, strategy = ObjectValidatorStrategy.Ignore, constraints = []) {
|
||||
constructor(shape, strategy = 0 /* Ignore */, constraints = []) {
|
||||
super(constraints);
|
||||
this.keys = [];
|
||||
this.requiredKeys = /* @__PURE__ */ new Map();
|
||||
|
@ -1101,14 +1117,14 @@ var ObjectValidator = class extends BaseValidator {
|
|||
this.shape = shape;
|
||||
this.strategy = strategy;
|
||||
switch (this.strategy) {
|
||||
case ObjectValidatorStrategy.Ignore:
|
||||
case 0 /* Ignore */:
|
||||
this.handleStrategy = (value) => this.handleIgnoreStrategy(value);
|
||||
break;
|
||||
case ObjectValidatorStrategy.Strict: {
|
||||
case 1 /* Strict */: {
|
||||
this.handleStrategy = (value) => this.handleStrictStrategy(value);
|
||||
break;
|
||||
}
|
||||
case ObjectValidatorStrategy.Passthrough:
|
||||
case 2 /* Passthrough */:
|
||||
this.handleStrategy = (value) => this.handlePassthroughStrategy(value);
|
||||
break;
|
||||
}
|
||||
|
@ -1146,13 +1162,13 @@ var ObjectValidator = class extends BaseValidator {
|
|||
}
|
||||
}
|
||||
get strict() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Strict, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 1 /* Strict */, this.constraints]);
|
||||
}
|
||||
get ignore() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Ignore, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 0 /* Ignore */, this.constraints]);
|
||||
}
|
||||
get passthrough() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Passthrough, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 2 /* Passthrough */, this.constraints]);
|
||||
}
|
||||
get partial() {
|
||||
const shape = Object.fromEntries(this.keys.map((key) => [key, this.shape[key].optional]));
|
||||
|
@ -1296,12 +1312,6 @@ var ObjectValidator = class extends BaseValidator {
|
|||
}
|
||||
};
|
||||
__name(ObjectValidator, "ObjectValidator");
|
||||
var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => {
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Strict"] = 1] = "Strict";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Passthrough"] = 2] = "Passthrough";
|
||||
return ObjectValidatorStrategy2;
|
||||
})(ObjectValidatorStrategy || {});
|
||||
|
||||
// src/validators/PassthroughValidator.ts
|
||||
var PassthroughValidator = class extends BaseValidator {
|
||||
|
@ -1592,7 +1602,7 @@ function stringUrl(options) {
|
|||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match an URL"));
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match a URL"));
|
||||
}
|
||||
const validatorFnResult = validatorFn(input, url);
|
||||
if (validatorFnResult === null)
|
||||
|
|
2
node_modules/@sapphire/shapeshift/dist/index.js.map
generated
vendored
2
node_modules/@sapphire/shapeshift/dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
34
node_modules/@sapphire/shapeshift/dist/index.mjs
generated
vendored
34
node_modules/@sapphire/shapeshift/dist/index.mjs
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
import get from 'lodash/get.js';
|
||||
import { inspect } from 'node:util';
|
||||
import { inspect } from 'util';
|
||||
import fastDeepEqual from 'fast-deep-equal/es6/index.js';
|
||||
import uniqWith from 'lodash/uniqWith.js';
|
||||
|
||||
|
@ -181,6 +181,11 @@ var BaseValidator = class {
|
|||
when(key, options) {
|
||||
return this.addConstraint(whenConstraint(key, options, this));
|
||||
}
|
||||
describe(description) {
|
||||
const clone = this.clone();
|
||||
clone.description = description;
|
||||
return clone;
|
||||
}
|
||||
run(value) {
|
||||
let result = this.handle(value);
|
||||
if (result.isErr())
|
||||
|
@ -201,6 +206,11 @@ var BaseValidator = class {
|
|||
is(value) {
|
||||
return this.run(value).isOk();
|
||||
}
|
||||
/**
|
||||
* Sets if the validator should also run constraints or just do basic checks.
|
||||
* @param isValidationEnabled Whether this validator should be enabled or disabled. You can pass boolean or a function returning boolean which will be called just before parsing.
|
||||
* Set to `null` to go off of the global configuration.
|
||||
*/
|
||||
setValidationEnabled(isValidationEnabled) {
|
||||
const clone = this.clone();
|
||||
clone.isValidationEnabled = isValidationEnabled;
|
||||
|
@ -1090,7 +1100,7 @@ __name(UnionValidator, "UnionValidator");
|
|||
|
||||
// src/validators/ObjectValidator.ts
|
||||
var ObjectValidator = class extends BaseValidator {
|
||||
constructor(shape, strategy = ObjectValidatorStrategy.Ignore, constraints = []) {
|
||||
constructor(shape, strategy = 0 /* Ignore */, constraints = []) {
|
||||
super(constraints);
|
||||
this.keys = [];
|
||||
this.requiredKeys = /* @__PURE__ */ new Map();
|
||||
|
@ -1099,14 +1109,14 @@ var ObjectValidator = class extends BaseValidator {
|
|||
this.shape = shape;
|
||||
this.strategy = strategy;
|
||||
switch (this.strategy) {
|
||||
case ObjectValidatorStrategy.Ignore:
|
||||
case 0 /* Ignore */:
|
||||
this.handleStrategy = (value) => this.handleIgnoreStrategy(value);
|
||||
break;
|
||||
case ObjectValidatorStrategy.Strict: {
|
||||
case 1 /* Strict */: {
|
||||
this.handleStrategy = (value) => this.handleStrictStrategy(value);
|
||||
break;
|
||||
}
|
||||
case ObjectValidatorStrategy.Passthrough:
|
||||
case 2 /* Passthrough */:
|
||||
this.handleStrategy = (value) => this.handlePassthroughStrategy(value);
|
||||
break;
|
||||
}
|
||||
|
@ -1144,13 +1154,13 @@ var ObjectValidator = class extends BaseValidator {
|
|||
}
|
||||
}
|
||||
get strict() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Strict, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 1 /* Strict */, this.constraints]);
|
||||
}
|
||||
get ignore() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Ignore, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 0 /* Ignore */, this.constraints]);
|
||||
}
|
||||
get passthrough() {
|
||||
return Reflect.construct(this.constructor, [this.shape, ObjectValidatorStrategy.Passthrough, this.constraints]);
|
||||
return Reflect.construct(this.constructor, [this.shape, 2 /* Passthrough */, this.constraints]);
|
||||
}
|
||||
get partial() {
|
||||
const shape = Object.fromEntries(this.keys.map((key) => [key, this.shape[key].optional]));
|
||||
|
@ -1294,12 +1304,6 @@ var ObjectValidator = class extends BaseValidator {
|
|||
}
|
||||
};
|
||||
__name(ObjectValidator, "ObjectValidator");
|
||||
var ObjectValidatorStrategy = /* @__PURE__ */ ((ObjectValidatorStrategy2) => {
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Ignore"] = 0] = "Ignore";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Strict"] = 1] = "Strict";
|
||||
ObjectValidatorStrategy2[ObjectValidatorStrategy2["Passthrough"] = 2] = "Passthrough";
|
||||
return ObjectValidatorStrategy2;
|
||||
})(ObjectValidatorStrategy || {});
|
||||
|
||||
// src/validators/PassthroughValidator.ts
|
||||
var PassthroughValidator = class extends BaseValidator {
|
||||
|
@ -1590,7 +1594,7 @@ function stringUrl(options) {
|
|||
try {
|
||||
url = new URL(input);
|
||||
} catch {
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match an URL"));
|
||||
return Result.err(new ExpectedConstraintError("s.string.url", "Invalid URL", input, "expected to match a URL"));
|
||||
}
|
||||
const validatorFnResult = validatorFn(input, url);
|
||||
if (validatorFnResult === null)
|
||||
|
|
2
node_modules/@sapphire/shapeshift/dist/index.mjs.map
generated
vendored
2
node_modules/@sapphire/shapeshift/dist/index.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue