@orieljs/validation 0.1.0-alpha.8 → 0.1.0-alpha.9
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/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -442,6 +442,8 @@ declare class ValidatorImpl<R extends Rules = Rules> implements Validator$1<R> {
|
|
|
442
442
|
declare class ValidationFactoryImpl implements ValidationFactory {
|
|
443
443
|
private readonly extended;
|
|
444
444
|
make<const R extends Rules>(data: Record<string, unknown>, rules: R, messages?: Record<string, string>, attributes?: Record<string, string>): ValidatorImpl<R>;
|
|
445
|
+
/** Every rule this factory knows, built-in and extend()ed, sorted (for editors: `oriel ide:info`). */
|
|
446
|
+
ruleNames(): string[];
|
|
445
447
|
extend(name: string, callback: RuleCallback, message?: string): void;
|
|
446
448
|
}
|
|
447
449
|
|
package/dist/index.js
CHANGED
|
@@ -2560,6 +2560,10 @@ var ValidationFactoryImpl = class {
|
|
|
2560
2560
|
make(data, rules, messages = {}, attributes = {}) {
|
|
2561
2561
|
return new ValidatorImpl(data, rules, messages, attributes, { ...builtinRules, ...this.extended });
|
|
2562
2562
|
}
|
|
2563
|
+
/** Every rule this factory knows, built-in and extend()ed, sorted (for editors: `oriel ide:info`). */
|
|
2564
|
+
ruleNames() {
|
|
2565
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(builtinRules), ...Object.keys(this.extended)])].sort();
|
|
2566
|
+
}
|
|
2563
2567
|
extend(name, callback, message) {
|
|
2564
2568
|
this.extended[name] = {
|
|
2565
2569
|
validate: (ctx) => callback(ctx.attribute, ctx.value, ctx.parameters, ctx.data),
|