@fixefy/fixefy-ui-utils 0.2.57 → 0.2.59
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/commander/index.js +9 -8
- package/dist/graphql/index.js +3 -1
- package/dist/headers/index.js +3 -2
- package/dist/json/index.js +13 -13
- package/dist/makeStyles/index.d.ts +3 -6
- package/dist/makeStyles/index.js +1 -1
- package/dist/page_context/index.d.ts +0 -6
- package/dist/page_context/index.js +538 -535
- package/dist/validate/index.d.ts +6 -5
- package/dist/validate/index.js +42 -34
- package/package.json +31 -22
package/dist/validate/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
import { MaybeN } from '@fixefy/fixefy-entities';
|
|
2
|
+
export declare const is_array_valid: (arr: unknown, min_length?: MaybeN<number>, max_length?: MaybeN<number>) => arr is Array<unknown>;
|
|
3
|
+
export declare const is_date_valid: (d: unknown) => d is Date;
|
|
4
|
+
export declare const is_object_valid: (obj: unknown) => obj is Record<string, unknown>;
|
|
5
|
+
export declare const is_string_valid: (str: unknown, minLength?: MaybeN<number>, maxLength?: MaybeN<number>) => str is string;
|
|
6
|
+
export declare const is_object_id: (value: unknown) => value is string;
|
package/dist/validate/index.js
CHANGED
|
@@ -9,60 +9,68 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
is_array_valid: function() {
|
|
13
|
+
return is_array_valid;
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
is_date_valid: function() {
|
|
16
|
+
return is_date_valid;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
is_object_id: function() {
|
|
19
|
+
return is_object_id;
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
return
|
|
21
|
+
is_object_valid: function() {
|
|
22
|
+
return is_object_valid;
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
is_string_valid: function() {
|
|
25
|
+
return is_string_valid;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
28
|
+
const is_array_valid = (arr, min_length = 1, max_length = null)=>{
|
|
29
|
+
if (null == arr) return false;
|
|
30
|
+
if (false == Array.isArray(arr)) return false;
|
|
31
|
+
if (min_length) {
|
|
32
|
+
if (arr.length < min_length) return false;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
if (max_length) {
|
|
35
|
+
if (arr.length > max_length) return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
35
38
|
};
|
|
36
|
-
const
|
|
37
|
-
return false;
|
|
39
|
+
const is_date_valid = (d)=>{
|
|
40
|
+
if (!d) return false;
|
|
41
|
+
if (Object.prototype.toString.call(d) != '[object Date]') return false;
|
|
42
|
+
return true;
|
|
38
43
|
};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
const is_object_valid = (obj)=>{
|
|
45
|
+
if (null == obj) return false;
|
|
46
|
+
if (typeof obj != 'object') return false;
|
|
47
|
+
if (Object.keys(obj).length == 0) return false;
|
|
48
|
+
if (Object.getOwnPropertyNames(obj).length == 0) return false;
|
|
49
|
+
const rv = true;
|
|
44
50
|
return rv;
|
|
45
51
|
};
|
|
46
|
-
const
|
|
52
|
+
const is_string_valid = (str, minLength = null, maxLength = null)=>{
|
|
47
53
|
if (str == null) return false;
|
|
48
|
-
if (
|
|
49
|
-
if (str.
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
if (typeof str != 'string') return false;
|
|
55
|
+
if (str.length == 0) return false;
|
|
56
|
+
let rv = true;
|
|
57
|
+
if (minLength && minLength > 0 && isNaN(minLength) == false) {
|
|
58
|
+
rv = rv && str.length >= minLength;
|
|
52
59
|
}
|
|
53
|
-
if (
|
|
54
|
-
|
|
60
|
+
if (rv == false) return false;
|
|
61
|
+
if (maxLength && maxLength > 0 && isNaN(maxLength) == false) {
|
|
62
|
+
rv = rv && str.length <= maxLength;
|
|
55
63
|
}
|
|
56
|
-
return
|
|
64
|
+
return rv;
|
|
57
65
|
};
|
|
58
|
-
const
|
|
66
|
+
const is_object_id = (value)=>{
|
|
59
67
|
///!* input check - if value is invalid - return false *!/
|
|
60
|
-
if (
|
|
68
|
+
if (false == is_string_valid(value, 1, 24)) return false;
|
|
61
69
|
///!* set the regex *!/
|
|
62
70
|
const regex = /^[0-9a-fA-F]{24}$/;
|
|
63
71
|
//!* get the match *!/
|
|
64
72
|
const matches = regex.exec(value);
|
|
65
73
|
//!* check is null *!/
|
|
66
|
-
const rv = matches != null &&
|
|
74
|
+
const rv = matches != null && is_array_valid(matches);
|
|
67
75
|
return rv;
|
|
68
76
|
};
|
package/package.json
CHANGED
|
@@ -3,34 +3,42 @@
|
|
|
3
3
|
"browser": {
|
|
4
4
|
"fs": false
|
|
5
5
|
},
|
|
6
|
-
"
|
|
7
|
-
"@
|
|
8
|
-
"@
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@fixefy/fixefy-entities": ">=0.1.20",
|
|
8
|
+
"@fixefy/fixefy-numeric": ">=0.1.3",
|
|
9
|
+
"@mui/material": ">=5.16.12",
|
|
10
|
+
"@mui/styles": ">=5.16.12",
|
|
11
|
+
"convert-excel-to-json": ">=1.7.0",
|
|
12
|
+
"csvtojson": ">=2.0.10",
|
|
13
|
+
"date-fns": ">=3.6.0",
|
|
14
|
+
"graphql-tag": ">=2.12.6",
|
|
15
|
+
"jss": ">=10.11.1",
|
|
16
|
+
"next": ">=14.2.26",
|
|
17
|
+
"nookies": ">=2.5.2",
|
|
18
|
+
"pluralize": ">=8.0.0",
|
|
19
|
+
"react": ">=18.3.1",
|
|
20
|
+
"react-dom": ">=18.3.1",
|
|
21
|
+
"regenerator-runtime": ">=0.13.11",
|
|
22
|
+
"tss-react": ">=4.8.6"
|
|
13
23
|
},
|
|
24
|
+
"dependencies": {},
|
|
14
25
|
"devDependencies": {
|
|
15
26
|
"@types/convert-excel-to-json": "1.7.4",
|
|
16
27
|
"@types/node": "20.14.0",
|
|
17
|
-
"@types/nookies": "2.0.3",
|
|
18
28
|
"@types/react": "18.3.3",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"eslint": "
|
|
22
|
-
"eslint-
|
|
23
|
-
"eslint-plugin-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"prettier": "3.3.0",
|
|
27
|
-
"typescript": "5.4.5"
|
|
29
|
+
"eslint": "9.34.0",
|
|
30
|
+
"eslint-config-next": "15.5.2",
|
|
31
|
+
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
32
|
+
"eslint-plugin-react": "7.37.5",
|
|
33
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
34
|
+
"prettier": "3.6.2",
|
|
35
|
+
"typescript": "5.9.2"
|
|
28
36
|
},
|
|
29
37
|
"license": "MIT",
|
|
30
38
|
"name": "@fixefy/fixefy-ui-utils",
|
|
31
39
|
"repository": {
|
|
32
40
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/Fixefy/fixefy-
|
|
41
|
+
"url": "https://github.com/Fixefy/fixefy-fixefy-ui-utils.git"
|
|
34
42
|
},
|
|
35
43
|
"scripts": {
|
|
36
44
|
"build": "swc src -d dist --strip-leading-paths && tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
@@ -38,8 +46,9 @@
|
|
|
38
46
|
"raw_publish": "npm publish --userconfig ./.npmrc --otp 000000",
|
|
39
47
|
"clean": "rm -rf build && rm -rf dist-* && yarn clean:node",
|
|
40
48
|
"clean:node": "rm -rf node_modules",
|
|
41
|
-
"lint": "eslint \"{
|
|
42
|
-
"
|
|
49
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
50
|
+
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
|
|
51
|
+
"prettier": "prettier --write \"src/**/*.{js,ts,jsx,tsx}\""
|
|
43
52
|
},
|
|
44
53
|
"engines": {
|
|
45
54
|
"node": "20"
|
|
@@ -56,5 +65,5 @@
|
|
|
56
65
|
"require": "./dist/index.js"
|
|
57
66
|
}
|
|
58
67
|
},
|
|
59
|
-
"version": "0.2.
|
|
60
|
-
}
|
|
68
|
+
"version": "0.2.59"
|
|
69
|
+
}
|