@finnair/v-validation-luxon 1.1.0 → 3.0.0-alpha.0
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/CHANGELOG.md +33 -0
- package/dist/Vluxon.d.ts +1 -1
- package/dist/Vluxon.js +21 -23
- package/dist/index.js +5 -1
- package/dist/luxon.d.ts +1 -0
- package/dist/luxon.js +3 -0
- package/dist/test-luxon.js +4 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.0) (2022-09-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Use SyncPromise also in schema and luxon ([e8590b8](https://github.com/finnair/v-validation/commit/e8590b8c2a44ad28fde88f8682f53628ecf74a0f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.0.0](https://github.com/finnair/v-validation/compare/v1.1.0...v2.0.0) (2022-09-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* Upgrade All Dependencies (#80) ([fb6309c](https://github.com/finnair/v-validation/commit/fb6309cc1d9fd90f3e8c5ba79798fae1450b66a6)), closes [#80](https://github.com/finnair/v-validation/issues/80)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* Implement toString in Luxon wrapper types ([#79](https://github.com/finnair/v-validation/issues/79)) ([3f3f3e8](https://github.com/finnair/v-validation/commit/3f3f3e8a4172c7803a7be4809f06aba554f7090f))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
* Drop Node 12 support
|
|
31
|
+
* Add .nvmrc
|
|
32
|
+
* Introduce CI build for Node 18
|
|
33
|
+
* Upgrade All Dependencies
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
# [1.1.0](https://github.com/finnair/v-validation/compare/v1.0.1...v1.1.0) (2022-08-29)
|
|
7
40
|
|
|
8
41
|
|
package/dist/Vluxon.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface ValidateLuxonParams {
|
|
|
12
12
|
proto?: any;
|
|
13
13
|
parser: (value: string, match: RegExpExecArray) => DateTime;
|
|
14
14
|
}
|
|
15
|
-
export declare function validateLuxon({ value, path, ctx, type, proto, pattern, parser }: ValidateLuxonParams):
|
|
15
|
+
export declare function validateLuxon({ value, path, ctx, type, proto, pattern, parser }: ValidateLuxonParams): PromiseLike<ValidationResult>;
|
|
16
16
|
declare function localDate(options?: DateTimeOptions): import("@finnair/v-validation").ValidatorFnWrapper;
|
|
17
17
|
declare function localTime(options?: DateTimeOptions): import("@finnair/v-validation").ValidatorFnWrapper;
|
|
18
18
|
declare function dateTime(options?: DateTimeOptions): import("@finnair/v-validation").ValidatorFnWrapper;
|
package/dist/Vluxon.js
CHANGED
|
@@ -14,32 +14,30 @@ const v_validation_1 = require("@finnair/v-validation");
|
|
|
14
14
|
const luxon_1 = require("luxon");
|
|
15
15
|
const luxon_2 = require("./luxon");
|
|
16
16
|
function validateLuxon({ value, path, ctx, type, proto, pattern, parser }) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return success(value);
|
|
27
|
-
}
|
|
17
|
+
if ((0, v_validation_1.isNullOrUndefined)(value)) {
|
|
18
|
+
return ctx.failurePromise(v_validation_1.defaultViolations.notNull(path), value);
|
|
19
|
+
}
|
|
20
|
+
if (proto && value instanceof proto) {
|
|
21
|
+
return ctx.successPromise(value);
|
|
22
|
+
}
|
|
23
|
+
else if (luxon_1.DateTime.isDateTime(value)) {
|
|
24
|
+
if (value.isValid) {
|
|
25
|
+
return success(value);
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
}
|
|
28
|
+
else if ((0, v_validation_1.isString)(value)) {
|
|
29
|
+
const match = pattern.exec(value);
|
|
30
|
+
if (match) {
|
|
31
|
+
const dateTime = parser(value, match);
|
|
32
|
+
if (dateTime.isValid) {
|
|
33
|
+
return success(dateTime);
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
36
|
+
}
|
|
37
|
+
return ctx.failurePromise(v_validation_1.defaultViolations.date(value, path, type), value);
|
|
38
|
+
function success(dateTime) {
|
|
39
|
+
return ctx.successPromise(proto ? new proto(dateTime) : dateTime);
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
exports.validateLuxon = validateLuxon;
|
|
45
43
|
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/luxon.d.ts
CHANGED
package/dist/luxon.js
CHANGED
package/dist/test-luxon.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a, _b;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
const luxon_1 = require("luxon");
|
|
4
|
-
console.log(luxon_1.DateTime.
|
|
5
|
+
console.log(luxon_1.DateTime.fromMillis(luxon_1.DateTime.fromISO('2022-08-30T23:00:00Z').toMillis(), { zone: luxon_1.FixedOffsetZone.instance(180) }).toJSON());
|
|
6
|
+
let o = { foo: 1 };
|
|
7
|
+
console.log((_b = (_a = o.foo) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : 'not found');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finnair/v-validation-luxon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Luxon validators",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"build": "tsc -b ."
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@finnair/path": "^
|
|
29
|
-
"@finnair/v-validation": "^
|
|
30
|
-
"luxon": "3.0.
|
|
28
|
+
"@finnair/path": "^2.0.0",
|
|
29
|
+
"@finnair/v-validation": "^3.0.0-alpha.0",
|
|
30
|
+
"luxon": "3.0.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/luxon": "3.0.
|
|
33
|
+
"@types/luxon": "3.0.1"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f41f76dbe0365314dc15c07d3db2ad5a7b5e4109"
|
|
36
36
|
}
|