@oscarpalmer/jhunal 0.14.0 → 0.16.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/dist/constants.d.mts +27 -0
- package/dist/{constants.js → constants.mjs} +2 -0
- package/dist/helpers.d.mts +19 -0
- package/dist/helpers.mjs +25 -0
- package/dist/index.d.mts +553 -0
- package/dist/{jhunal.full.js → index.mjs} +49 -67
- package/dist/models.d.mts +507 -0
- package/dist/models.mjs +18 -0
- package/dist/schematic.d.mts +36 -0
- package/dist/{schematic.js → schematic.mjs} +9 -5
- package/dist/validation/property.validation.d.mts +7 -0
- package/dist/validation/{property.validation.js → property.validation.mjs} +6 -4
- package/dist/validation/value.validation.d.mts +6 -0
- package/dist/validation/{value.validation.js → value.validation.mjs} +4 -2
- package/package.json +53 -48
- package/src/constants.ts +1 -2
- package/src/helpers.ts +12 -1
- package/src/index.ts +1 -1
- package/src/models.ts +394 -36
- package/src/schematic.ts +10 -0
- package/src/validation/property.validation.ts +1 -1
- package/dist/helpers.js +0 -12
- package/dist/index.js +0 -4
- package/dist/models.js +0 -8
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/array/compact.js +0 -12
- package/dist/node_modules/@oscarpalmer/atoms/dist/internal/string.js +0 -24
- package/types/constants.d.ts +0 -22
- package/types/helpers.d.ts +0 -4
- package/types/index.d.ts +0 -3
- package/types/models.d.ts +0 -158
- package/types/schematic.d.ts +0 -22
- package/types/validation/property.validation.d.ts +0 -3
- package/types/validation/value.validation.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,49 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2
|
+
"name": "@oscarpalmer/jhunal",
|
|
3
|
+
"version": "0.16.0",
|
|
4
|
+
"description": "Flies free beneath the glistening moons…",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"schema",
|
|
7
|
+
"validation"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Oscar Palmér",
|
|
12
|
+
"url": "https://oscarpalmer.se"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/oscarpalmer/jhunal.git"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"module": "./dist/index.mjs",
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "npx vp pack && npm run tsdown:build",
|
|
34
|
+
"tsdown:build": "npx tsdown -c ./tsdown.config.ts",
|
|
35
|
+
"tsdown:watch": "npx tsdown -c ./tsdown.config.ts --watch",
|
|
36
|
+
"test": "npx vp test run --coverage",
|
|
37
|
+
"test:leak": "npx vp test run --detect-async-leaks --coverage",
|
|
38
|
+
"watch": "npx vite build --watch"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@oscarpalmer/atoms": "^0.166"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^25.5",
|
|
45
|
+
"@vitest/coverage-istanbul": "^4.1",
|
|
46
|
+
"jsdom": "^29.0",
|
|
47
|
+
"tsdown": "^0.21",
|
|
48
|
+
"typescript": "^5.9",
|
|
49
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
50
|
+
"vite-plus": "latest",
|
|
51
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
|
|
52
|
+
},
|
|
53
|
+
"packageManager": "npm@11.11.1"
|
|
54
|
+
}
|
package/src/constants.ts
CHANGED
|
@@ -11,8 +11,7 @@ export const MESSAGE_SCHEMA_INVALID_EMPTY = 'Schema must have at least one prope
|
|
|
11
11
|
export const MESSAGE_SCHEMA_INVALID_PROPERTY_DISALLOWED =
|
|
12
12
|
"'<key>.<property>' property is not allowed for schemas in $type";
|
|
13
13
|
|
|
14
|
-
export const MESSAGE_SCHEMA_INVALID_PROPERTY_REQUIRED =
|
|
15
|
-
"'<>.$required' property must be a boolean";
|
|
14
|
+
export const MESSAGE_SCHEMA_INVALID_PROPERTY_REQUIRED = "'<>.$required' property must be a boolean";
|
|
16
15
|
|
|
17
16
|
export const MESSAGE_SCHEMA_INVALID_PROPERTY_TYPE = "'<>' property must be of a valid type";
|
|
18
17
|
|
package/src/helpers.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import {isConstructor} from '@oscarpalmer/atoms/is';
|
|
2
|
+
import type {Constructor} from '@oscarpalmer/atoms/models';
|
|
2
3
|
import {MESSAGE_CONSTRUCTOR, SCHEMATIC_NAME} from './constants';
|
|
3
|
-
import type {Constructor} from './models';
|
|
4
4
|
import type {Schematic} from './schematic';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Creates a validator function for a given constructor
|
|
8
|
+
* @param constructor - Constructor to check against
|
|
9
|
+
* @throws Will throw a `TypeError` if the provided argument is not a valid constructor
|
|
10
|
+
* @returns Validator function that checks if a value is an instance of the constructor
|
|
11
|
+
*/
|
|
6
12
|
export function instanceOf<Instance>(
|
|
7
13
|
constructor: Constructor<Instance>,
|
|
8
14
|
): (value: unknown) => value is Instance {
|
|
@@ -15,6 +21,11 @@ export function instanceOf<Instance>(
|
|
|
15
21
|
};
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Is the value a schematic?
|
|
26
|
+
* @param value Value to check
|
|
27
|
+
* @returns `true` if the value is a schematic, `false` otherwise
|
|
28
|
+
*/
|
|
18
29
|
export function isSchematic(value: unknown): value is Schematic<never> {
|
|
19
30
|
return (
|
|
20
31
|
typeof value === 'object' &&
|
package/src/index.ts
CHANGED