@finnair/v-validation-luxon 3.0.0-alpha.0 → 3.0.0-alpha.2

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 CHANGED
@@ -3,6 +3,28 @@
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.2](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.2) (2022-09-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * Use SyncPromise also in schema and luxon ([792fbb4](https://github.com/finnair/v-validation/commit/792fbb4c78d07ea085d669312fef5e44e7a397fd))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.0.0-alpha.1](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.1) (2022-09-26)
18
+
19
+
20
+ ### Features
21
+
22
+ * Use SyncPromise also in schema and luxon ([792fbb4](https://github.com/finnair/v-validation/commit/792fbb4c78d07ea085d669312fef5e44e7a397fd))
23
+
24
+
25
+
26
+
27
+
6
28
  # [3.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.0) (2022-09-26)
7
29
 
8
30
 
package/dist/Vluxon.js CHANGED
@@ -226,3 +226,4 @@ exports.Vluxon = {
226
226
  dateTimeFromMillis,
227
227
  duration: () => new DurationValidator(),
228
228
  };
229
+ Object.freeze(exports.Vluxon);
package/dist/luxon.js CHANGED
@@ -5,15 +5,22 @@ exports.DateTimeMillisUtcLuxon = exports.DateTimeMillisLuxon = exports.DateTimeU
5
5
  const luxon_1 = require("luxon");
6
6
  class LuxonDateTime {
7
7
  constructor(input) {
8
- if (input instanceof LuxonDateTime) {
8
+ if (input === null || input === undefined) {
9
+ throw new Error('invalid input (null or undefined), expected DateTime or LuxonDateTime');
10
+ }
11
+ else if (input instanceof LuxonDateTime) {
9
12
  this.dateTime = this.normalize(input.dateTime);
10
13
  }
11
- else {
14
+ else if (input instanceof luxon_1.DateTime) {
12
15
  if (!input.isValid) {
13
16
  throw new Error('Invalid DateTime: ' + input.invalidExplanation);
14
17
  }
15
18
  this.dateTime = this.normalize(input);
16
19
  }
20
+ else {
21
+ throw new Error('invalid input, expected DateTime or LuxonDateTime');
22
+ }
23
+ Object.freeze(this);
17
24
  }
18
25
  apply(fn) {
19
26
  return fn(this.dateTime);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finnair/v-validation-luxon",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.2",
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": "^2.0.0",
29
- "@finnair/v-validation": "^3.0.0-alpha.0",
28
+ "@finnair/path": "^3.0.0-alpha.2",
29
+ "@finnair/v-validation": "^3.0.0-alpha.2",
30
30
  "luxon": "3.0.3"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/luxon": "3.0.1"
34
34
  },
35
- "gitHead": "f41f76dbe0365314dc15c07d3db2ad5a7b5e4109"
35
+ "gitHead": "d42bd7583bb684429e48ce8e5db3938cb95ffd5f"
36
36
  }