@finnair/v-validation-moment
Advanced tools
Comparing version 6.1.0 to 7.0.0-alpha.0
@@ -6,2 +6,6 @@ # Change Log | ||
# [7.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v6.1.0...v7.0.0-alpha.0) (2024-11-08) | ||
**Note:** Version bump only for package @finnair/v-validation-moment | ||
# [6.1.0](https://github.com/finnair/v-validation/compare/v6.0.2...v6.1.0) (2024-10-21) | ||
@@ -8,0 +12,0 @@ |
@@ -1,12 +0,12 @@ | ||
import { Validator, ValidationContext, ValidationResult } from '@finnair/v-validation'; | ||
import { Validator, ValidationContext } from '@finnair/v-validation'; | ||
import { Path } from '@finnair/path'; | ||
import { Moment, MomentInput } from 'moment'; | ||
export declare class MomentValidator extends Validator { | ||
import moment, { Moment, MomentInput } from 'moment'; | ||
export declare class MomentValidator extends Validator<Moment, string | Moment> { | ||
readonly type: string; | ||
readonly parse: (value?: MomentInput) => Moment; | ||
constructor(type: string, parse: (value?: MomentInput) => Moment); | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<ValidationResult>; | ||
validatePath(value: string | Moment, path: Path, ctx: ValidationContext): Promise<Moment>; | ||
} | ||
export declare class DurationValidator extends Validator { | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<ValidationResult>; | ||
export declare class DurationValidator extends Validator<moment.Duration> { | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<moment.Duration>; | ||
} | ||
@@ -13,0 +13,0 @@ export declare function dateMoment(value?: MomentInput): Moment; |
@@ -6,3 +6,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Vmoment = exports.timeMoment = exports.dateTimeMillisUtcMoment = exports.dateTimeMillisMoment = exports.dateTimeUtcMoment = exports.dateTimeMoment = exports.dateUtcMoment = exports.dateMoment = exports.DurationValidator = exports.MomentValidator = void 0; | ||
exports.Vmoment = exports.DurationValidator = exports.MomentValidator = void 0; | ||
exports.dateMoment = dateMoment; | ||
exports.dateUtcMoment = dateUtcMoment; | ||
exports.dateTimeMoment = dateTimeMoment; | ||
exports.dateTimeUtcMoment = dateTimeUtcMoment; | ||
exports.dateTimeMillisMoment = dateTimeMillisMoment; | ||
exports.dateTimeMillisUtcMoment = dateTimeMillisUtcMoment; | ||
exports.timeMoment = timeMoment; | ||
const v_validation_1 = require("@finnair/v-validation"); | ||
@@ -26,6 +33,6 @@ const moment_1 = __importDefault(require("moment")); | ||
if (convertedValue.isValid()) { | ||
return ctx.success(convertedValue); | ||
return Promise.resolve(convertedValue); | ||
} | ||
} | ||
return ctx.failure(v_validation_1.defaultViolations.date(value, path, this.type), value); | ||
throw v_validation_1.defaultViolations.date(value, path, this.type); | ||
} | ||
@@ -43,3 +50,3 @@ } | ||
if (convertedValue.isValid()) { | ||
return ctx.success(convertedValue); | ||
return Promise.resolve(convertedValue); | ||
} | ||
@@ -58,3 +65,2 @@ } | ||
} | ||
exports.dateMoment = dateMoment; | ||
Object.setPrototypeOf(dateMoment.prototype, moment_1.default.prototype); | ||
@@ -71,3 +77,2 @@ Object.setPrototypeOf(dateMoment, moment_1.default); | ||
} | ||
exports.dateUtcMoment = dateUtcMoment; | ||
Object.setPrototypeOf(dateUtcMoment.prototype, moment_1.default.prototype); | ||
@@ -86,3 +91,2 @@ Object.setPrototypeOf(dateUtcMoment, moment_1.default); | ||
} | ||
exports.dateTimeMoment = dateTimeMoment; | ||
Object.setPrototypeOf(dateTimeMoment.prototype, moment_1.default.prototype); | ||
@@ -102,3 +106,2 @@ Object.setPrototypeOf(dateTimeMoment, moment_1.default); | ||
} | ||
exports.dateTimeUtcMoment = dateTimeUtcMoment; | ||
Object.setPrototypeOf(dateTimeUtcMoment.prototype, moment_1.default.prototype); | ||
@@ -125,3 +128,2 @@ Object.setPrototypeOf(dateTimeUtcMoment, moment_1.default); | ||
} | ||
exports.dateTimeMillisMoment = dateTimeMillisMoment; | ||
Object.setPrototypeOf(dateTimeMillisMoment.prototype, moment_1.default.prototype); | ||
@@ -141,3 +143,2 @@ Object.setPrototypeOf(dateTimeMillisMoment, moment_1.default); | ||
} | ||
exports.dateTimeMillisUtcMoment = dateTimeMillisUtcMoment; | ||
Object.setPrototypeOf(dateTimeMillisUtcMoment.prototype, moment_1.default.prototype); | ||
@@ -163,3 +164,2 @@ Object.setPrototypeOf(dateTimeMillisUtcMoment, moment_1.default); | ||
} | ||
exports.timeMoment = timeMoment; | ||
Object.setPrototypeOf(timeMoment.prototype, moment_1.default.prototype); | ||
@@ -166,0 +166,0 @@ Object.setPrototypeOf(timeMoment, moment_1.default); |
@@ -1,12 +0,12 @@ | ||
import { Validator, ValidationContext, ValidationResult } from '@finnair/v-validation'; | ||
import { Validator, ValidationContext } from '@finnair/v-validation'; | ||
import { Path } from '@finnair/path'; | ||
import { Moment, MomentInput } from 'moment'; | ||
export declare class MomentValidator extends Validator { | ||
import moment, { Moment, MomentInput } from 'moment'; | ||
export declare class MomentValidator extends Validator<Moment, string | Moment> { | ||
readonly type: string; | ||
readonly parse: (value?: MomentInput) => Moment; | ||
constructor(type: string, parse: (value?: MomentInput) => Moment); | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<ValidationResult>; | ||
validatePath(value: string | Moment, path: Path, ctx: ValidationContext): Promise<Moment>; | ||
} | ||
export declare class DurationValidator extends Validator { | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<ValidationResult>; | ||
export declare class DurationValidator extends Validator<moment.Duration> { | ||
validatePath(value: any, path: Path, ctx: ValidationContext): Promise<moment.Duration>; | ||
} | ||
@@ -13,0 +13,0 @@ export declare function dateMoment(value?: MomentInput): Moment; |
@@ -19,6 +19,6 @@ import { Validator, isNullOrUndefined, defaultViolations, isString, TypeMismatch } from '@finnair/v-validation'; | ||
if (convertedValue.isValid()) { | ||
return ctx.success(convertedValue); | ||
return Promise.resolve(convertedValue); | ||
} | ||
} | ||
return ctx.failure(defaultViolations.date(value, path, this.type), value); | ||
throw defaultViolations.date(value, path, this.type); | ||
} | ||
@@ -35,3 +35,3 @@ } | ||
if (convertedValue.isValid()) { | ||
return ctx.success(convertedValue); | ||
return Promise.resolve(convertedValue); | ||
} | ||
@@ -38,0 +38,0 @@ } |
{ | ||
"name": "@finnair/v-validation-moment", | ||
"version": "6.1.0", | ||
"version": "7.0.0-alpha.0", | ||
"private": false, | ||
@@ -43,11 +43,11 @@ "description": "Moment validators", | ||
"peerDependencies": { | ||
"@finnair/path": "~6.0", | ||
"@finnair/v-validation": "~6.0", | ||
"@finnair/path": "=>6", | ||
"@finnair/v-validation": ">=6", | ||
"moment": "^2.30.0" | ||
}, | ||
"devDependencies": { | ||
"@finnair/path": "^6.1.0", | ||
"@finnair/v-validation": "^6.1.0" | ||
"@finnair/path": "^7.0.0-alpha.0", | ||
"@finnair/v-validation": "^7.0.0-alpha.0" | ||
}, | ||
"gitHead": "24a7a43d0a5201a29d650e8bb767195d14af9784" | ||
"gitHead": "9070e0d4d554bae9bb499ac5163a65adbe52dd65" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63337
1