@pogodisco/val 0.0.1 → 0.0.3

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 CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./rules";
2
- export * from "./utils";
3
- export * from "./types";
1
+ export * from "./rules/index.js";
2
+ export * from "./utils/index.js";
3
+ export * from "./types/index.js";
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./rules";
2
- export * from "./utils";
3
- export * from "./types";
1
+ export * from "./rules/index.js";
2
+ export * from "./utils/index.js";
3
+ export * from "./types/index.js";
@@ -1,7 +1,7 @@
1
- export * from "./number";
2
- export * from "./array";
3
- export * from "./string";
4
- export * from "./boolean";
5
- export * from "./helpers";
6
- export * from "./date";
7
- export * from "./object";
1
+ export * from "./number.js";
2
+ export * from "./array.js";
3
+ export * from "./string.js";
4
+ export * from "./boolean.js";
5
+ export * from "./helpers.js";
6
+ export * from "./date.js";
7
+ export * from "./object.js";
@@ -1,7 +1,7 @@
1
- export * from "./number";
2
- export * from "./array";
3
- export * from "./string";
4
- export * from "./boolean";
5
- export * from "./helpers";
6
- export * from "./date";
7
- export * from "./object";
1
+ export * from "./number.js";
2
+ export * from "./array.js";
3
+ export * from "./string.js";
4
+ export * from "./boolean.js";
5
+ export * from "./helpers.js";
6
+ export * from "./date.js";
7
+ export * from "./object.js";
@@ -1,4 +1,4 @@
1
- import type { ValidationRule } from "../utils/validation-rule";
1
+ import type { ValidationRule } from "../utils/validation-rule.js";
2
2
  export type ValidationResult = {
3
3
  ok: boolean;
4
4
  errors: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  interface Validator {
3
3
  format: {
4
4
  date: {
@@ -1,5 +1,5 @@
1
- import { allEqual, each, arrayMax, arrayMin, charsMin, isEmail, isNotEmpty, isOneOf, mustBeEmptyIf, numberMax, numberMin, requiredIfElseEmpty, requiredIf, requiredUnless, numberGt, numberLt, isOptional, isTrue, isFalse, matchesRegex, isAlphanumeric, isAlpha, isSlug, hasLength, startsWith, endsWith, contains, isLowerCase, isUpperCase, isOdd, isEven, isFloat, isInteger, isPositive, isMultipleOf, isNegative, isDate, isBefore, isAfter, isBetween, isFutureDate, isPastDate, isObject, isArray, hasKeys, maxKeys, minKeys, } from "../rules";
2
- import { wrapSyncRule } from "./wrap-sync-rule";
1
+ import { allEqual, each, arrayMax, arrayMin, charsMin, isEmail, isNotEmpty, isOneOf, mustBeEmptyIf, numberMax, numberMin, requiredIfElseEmpty, requiredIf, requiredUnless, numberGt, numberLt, isOptional, isTrue, isFalse, matchesRegex, isAlphanumeric, isAlpha, isSlug, hasLength, startsWith, endsWith, contains, isLowerCase, isUpperCase, isOdd, isEven, isFloat, isInteger, isPositive, isMultipleOf, isNegative, isDate, isBefore, isAfter, isBetween, isFutureDate, isPastDate, isObject, isArray, hasKeys, maxKeys, minKeys, } from "../rules/index.js";
2
+ import { wrapSyncRule } from "./wrap-sync-rule.js";
3
3
  export const v = {
4
4
  format: {
5
5
  date: {
@@ -1,2 +1,2 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export declare function flattenRuleBuilders(obj: unknown): ValidationRuleBuilder[];
@@ -1,4 +1,4 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export function flattenRuleBuilders(obj) {
3
3
  const result = [];
4
4
  function walk(o) {
@@ -1,8 +1,8 @@
1
- export * from "./validate";
2
- export * from "./schema";
3
- export * from "./core-rules";
4
- export * from "./wrap-async-rule";
5
- export * from "./wrap-sync-rule";
6
- export * from "./flatten-rules";
7
- export * from "./validation-rule";
8
- export * from "./validation-rule-builder";
1
+ export * from "./validate.js";
2
+ export * from "./schema.js";
3
+ export * from "./core-rules.js";
4
+ export * from "./wrap-async-rule.js";
5
+ export * from "./wrap-sync-rule.js";
6
+ export * from "./flatten-rules.js";
7
+ export * from "./validation-rule.js";
8
+ export * from "./validation-rule-builder.js";
@@ -1,8 +1,8 @@
1
- export * from "./validate";
2
- export * from "./schema";
3
- export * from "./core-rules";
4
- export * from "./wrap-async-rule";
5
- export * from "./wrap-sync-rule";
6
- export * from "./flatten-rules";
7
- export * from "./validation-rule";
8
- export * from "./validation-rule-builder";
1
+ export * from "./validate.js";
2
+ export * from "./schema.js";
3
+ export * from "./core-rules.js";
4
+ export * from "./wrap-async-rule.js";
5
+ export * from "./wrap-sync-rule.js";
6
+ export * from "./flatten-rules.js";
7
+ export * from "./validation-rule.js";
8
+ export * from "./validation-rule-builder.js";
@@ -1,3 +1,3 @@
1
- import type { RuleBuilder } from "../types";
2
- import { ValidationRule } from "./validation-rule";
1
+ import type { RuleBuilder } from "../types/index.js";
2
+ import { ValidationRule } from "./validation-rule.js";
3
3
  export declare function schema<Ctx>(factory: (ctx: Ctx) => RuleBuilder[]): (ctx: Ctx) => ValidationRule[];
@@ -1,4 +1,4 @@
1
- import type { ValidationRule } from "./validation-rule";
1
+ import type { ValidationRule } from "./validation-rule.js";
2
2
  import { type TResponse } from "@pogodisco/response";
3
3
  export declare function validate({ rules, }: {
4
4
  rules: ValidationRule[];
@@ -1,5 +1,5 @@
1
- import type { RuleResult } from "../types";
2
- import { ValidationRule } from "./validation-rule";
1
+ import type { RuleResult } from "../types/index.js";
2
+ import { ValidationRule } from "./validation-rule.js";
3
3
  export declare class ValidationRuleBuilder {
4
4
  private _rule;
5
5
  private _bail?;
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from "./validation-rule";
1
+ import { ValidationRule } from "./validation-rule.js";
2
2
  export class ValidationRuleBuilder {
3
3
  constructor(rule) {
4
4
  this._errors = {};
@@ -1,4 +1,4 @@
1
- import type { RuleResult } from "../types";
1
+ import type { RuleResult } from "../types/index.js";
2
2
  export declare class ValidationRule {
3
3
  rule: () => RuleResult | Promise<RuleResult>;
4
4
  bail?: boolean;
@@ -1,4 +1,4 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export declare function wrapAsyncRule<T extends any[]>(fn: (...args: T) => Promise<{
3
3
  ok: boolean;
4
4
  }>): (...args: T) => ValidationRuleBuilder;
@@ -1,4 +1,4 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export function wrapAsyncRule(fn) {
3
3
  return (...args) => {
4
4
  const ruleFn = async () => {
@@ -1,2 +1,2 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export declare function wrapSyncRule<T extends any[]>(fn: (...args: T) => boolean): (...args: T) => ValidationRuleBuilder;
@@ -1,4 +1,4 @@
1
- import { ValidationRuleBuilder } from "./validation-rule-builder";
1
+ import { ValidationRuleBuilder } from "./validation-rule-builder.js";
2
2
  export function wrapSyncRule(fn) {
3
3
  return (...args) => {
4
4
  const ruleFn = () => fn(...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pogodisco/val",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,10 +28,10 @@
28
28
  "prepublishOnly": "npm run build"
29
29
  },
30
30
  "peerDependencies": {
31
- "@pogodisco/response": "^0.0.1",
31
+ "@pogodisco/response": "~0.0.1",
32
32
  "typescript": "^5.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@pogodisco/response": "^0.0.1"
35
+ "@pogodisco/response": "~0.0.1"
36
36
  }
37
37
  }