@elliemae/ds-props-helpers 2.2.0 → 2.3.0-alpha.3
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/cjs/defaultProps/index.js +28 -9
- package/cjs/defaultProps/index.js.map +7 -0
- package/cjs/defaultProps/useMemoMergePropsWithDefault.js +44 -44
- package/cjs/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/cjs/getProps/index.js +37 -20
- package/cjs/getProps/index.js.map +7 -0
- package/cjs/globalProps/constants.js +398 -0
- package/cjs/globalProps/constants.js.map +7 -0
- package/cjs/globalProps/globalAttributesPropTypes.js +398 -0
- package/cjs/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/cjs/globalProps/index.js +29 -0
- package/cjs/globalProps/index.js.map +7 -0
- package/cjs/globalProps/useGetGlobalAttributes.js +56 -0
- package/cjs/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/cjs/index.js +32 -20
- package/cjs/index.js.map +7 -0
- package/cjs/propTypes/PropTypes.js +136 -0
- package/cjs/propTypes/PropTypes.js.map +7 -0
- package/cjs/propTypes/customPropTypes.js +38 -0
- package/cjs/propTypes/customPropTypes.js.map +7 -0
- package/cjs/propTypes/describe.js +81 -0
- package/cjs/propTypes/describe.js.map +7 -0
- package/cjs/propTypes/describeConversions.js +96 -0
- package/cjs/propTypes/describeConversions.js.map +7 -0
- package/cjs/propTypes/describeGuards.js +49 -0
- package/cjs/propTypes/describeGuards.js.map +7 -0
- package/cjs/propTypes/index.js +37 -0
- package/cjs/propTypes/index.js.map +7 -0
- package/cjs/propTypes/toTypescript.js +139 -0
- package/cjs/propTypes/toTypescript.js.map +7 -0
- package/cjs/propTypes/types.js +27 -0
- package/cjs/propTypes/types.js.map +7 -0
- package/cjs/tests/globalProps/TestComponent.js +42 -0
- package/cjs/tests/globalProps/TestComponent.js.map +7 -0
- package/cjs/tests/validation/test.schema.js +67 -0
- package/cjs/tests/validation/test.schema.js.map +7 -0
- package/cjs/validation/errorTemplates.js +44 -12
- package/cjs/validation/errorTemplates.js.map +7 -0
- package/cjs/validation/index.js +30 -15
- package/cjs/validation/index.js.map +7 -0
- package/cjs/validation/typescriptGuards.js +60 -31
- package/cjs/validation/typescriptGuards.js.map +7 -0
- package/cjs/validation/typescriptParsers.js +65 -34
- package/cjs/validation/typescriptParsers.js.map +7 -0
- package/cjs/validation/typescriptValidator.js +99 -135
- package/cjs/validation/typescriptValidator.js.map +7 -0
- package/cjs/validation/validator.js +43 -24
- package/cjs/validation/validator.js.map +7 -0
- package/esm/defaultProps/index.js +3 -1
- package/esm/defaultProps/index.js.map +7 -0
- package/esm/defaultProps/useMemoMergePropsWithDefault.js +14 -34
- package/esm/defaultProps/useMemoMergePropsWithDefault.js.map +7 -0
- package/esm/getProps/index.js +8 -15
- package/esm/getProps/index.js.map +7 -0
- package/esm/globalProps/constants.js +369 -0
- package/esm/globalProps/constants.js.map +7 -0
- package/esm/globalProps/globalAttributesPropTypes.js +369 -0
- package/esm/globalProps/globalAttributesPropTypes.js.map +7 -0
- package/esm/globalProps/index.js +4 -0
- package/esm/globalProps/index.js.map +7 -0
- package/esm/globalProps/useGetGlobalAttributes.js +27 -0
- package/esm/globalProps/useGetGlobalAttributes.js.map +7 -0
- package/esm/index.js +7 -5
- package/esm/index.js.map +7 -0
- package/esm/propTypes/PropTypes.js +107 -0
- package/esm/propTypes/PropTypes.js.map +7 -0
- package/esm/propTypes/customPropTypes.js +9 -0
- package/esm/propTypes/customPropTypes.js.map +7 -0
- package/esm/propTypes/describe.js +52 -0
- package/esm/propTypes/describe.js.map +7 -0
- package/esm/propTypes/describeConversions.js +76 -0
- package/esm/propTypes/describeConversions.js.map +7 -0
- package/esm/propTypes/describeGuards.js +20 -0
- package/esm/propTypes/describeGuards.js.map +7 -0
- package/esm/propTypes/index.js +8 -0
- package/esm/propTypes/index.js.map +7 -0
- package/esm/propTypes/toTypescript.js +110 -0
- package/esm/propTypes/toTypescript.js.map +7 -0
- package/esm/propTypes/types.js +2 -0
- package/esm/propTypes/types.js.map +7 -0
- package/esm/tests/globalProps/TestComponent.js +13 -0
- package/esm/tests/globalProps/TestComponent.js.map +7 -0
- package/esm/tests/validation/test.schema.js +38 -0
- package/esm/tests/validation/test.schema.js.map +7 -0
- package/esm/validation/errorTemplates.js +15 -7
- package/esm/validation/errorTemplates.js.map +7 -0
- package/esm/validation/index.js +5 -3
- package/esm/validation/index.js.map +7 -0
- package/esm/validation/typescriptGuards.js +31 -18
- package/esm/validation/typescriptGuards.js.map +7 -0
- package/esm/validation/typescriptParsers.js +36 -30
- package/esm/validation/typescriptParsers.js.map +7 -0
- package/esm/validation/typescriptValidator.js +57 -106
- package/esm/validation/typescriptValidator.js.map +7 -0
- package/esm/validation/validator.js +12 -18
- package/esm/validation/validator.js.map +7 -0
- package/package.json +56 -4
- package/types/globalProps/constants.d.ts +3 -0
- package/types/globalProps/globalAttributesPropTypes.d.ts +363 -0
- package/types/globalProps/index.d.ts +2 -0
- package/types/globalProps/useGetGlobalAttributes.d.ts +5 -0
- package/types/index.d.ts +2 -0
- package/types/propTypes/PropTypes.d.ts +3 -0
- package/types/propTypes/customPropTypes.d.ts +2 -0
- package/types/propTypes/describe.d.ts +3 -0
- package/types/propTypes/describeConversions.d.ts +3 -0
- package/types/propTypes/describeGuards.d.ts +9 -0
- package/types/propTypes/index.d.ts +3 -0
- package/types/propTypes/toTypescript.d.ts +3 -0
- package/types/propTypes/types.d.ts +96 -0
- package/types/tests/globalProps/TestComponent.d.ts +1 -0
- package/types/tests/{any.validation.test.d.ts → globalProps/globalAttributes.test.d.ts} +0 -0
- package/types/tests/{array.validation.test.d.ts → validation/any.validation.test.d.ts} +0 -0
- package/types/tests/{boolean.validation.test.d.ts → validation/array.validation.test.d.ts} +0 -0
- package/types/tests/{function.validation.test.d.ts → validation/boolean.validation.test.d.ts} +0 -0
- package/types/tests/{number.validation.test.d.ts → validation/function.validation.test.d.ts} +0 -0
- package/types/tests/{object.validation.test.d.ts → validation/number.validation.test.d.ts} +0 -0
- package/types/tests/{schema.validation.test.d.ts → validation/object.validation.test.d.ts} +0 -0
- package/types/tests/{string.validation.test.d.ts → validation/schema.validation.test.d.ts} +0 -0
- package/types/tests/{union.validation.test.d.ts → validation/string.validation.test.d.ts} +0 -0
- package/types/tests/{test.schema.d.ts → validation/test.schema.d.ts} +0 -0
- package/types/tests/validation/union.validation.test.d.ts +1 -0
- package/types/validation/typescriptValidator.d.ts +2 -2
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const typescriptObjectParser = format => {
|
|
7
|
-
const keyValuePairs = []; // State of the algorithm
|
|
8
|
-
|
|
9
|
-
let lastKey = '';
|
|
10
|
-
let lastValue = '';
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const typescriptObjectParser = (format) => {
|
|
3
|
+
const keyValuePairs = [];
|
|
4
|
+
let lastKey = "";
|
|
5
|
+
let lastValue = "";
|
|
11
6
|
let shouldAppendToKey = true;
|
|
12
|
-
|
|
13
7
|
const pushPair = () => {
|
|
14
|
-
if (lastKey)
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
if (lastKey)
|
|
9
|
+
keyValuePairs.push([lastKey, lastValue]);
|
|
10
|
+
lastKey = "";
|
|
11
|
+
lastValue = "";
|
|
17
12
|
shouldAppendToKey = true;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
};
|
|
21
14
|
let depth = 0;
|
|
22
|
-
format.split(
|
|
23
|
-
if (char ===
|
|
15
|
+
format.split("").forEach((char) => {
|
|
16
|
+
if (char === "{") {
|
|
24
17
|
depth += 1;
|
|
25
|
-
if (depth > 1)
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
if (depth > 1)
|
|
19
|
+
lastValue += char;
|
|
20
|
+
} else if (char === "}") {
|
|
21
|
+
if (depth > 1)
|
|
22
|
+
lastValue += char;
|
|
28
23
|
depth -= 1;
|
|
29
|
-
if (depth === 1)
|
|
30
|
-
|
|
24
|
+
if (depth === 1)
|
|
25
|
+
pushPair();
|
|
26
|
+
} else if (char === ":") {
|
|
31
27
|
shouldAppendToKey = false;
|
|
32
|
-
if (depth > 1)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
if (depth > 1)
|
|
29
|
+
lastValue += char;
|
|
30
|
+
} else if (char === ",") {
|
|
31
|
+
if (depth === 1)
|
|
32
|
+
pushPair();
|
|
33
|
+
else
|
|
34
|
+
lastValue += char;
|
|
35
|
+
} else if (char === " ") {
|
|
36
|
+
} else if (shouldAppendToKey)
|
|
37
|
+
lastKey += char;
|
|
38
|
+
else
|
|
39
|
+
lastValue += char;
|
|
36
40
|
});
|
|
37
41
|
pushPair();
|
|
38
42
|
return keyValuePairs;
|
|
39
43
|
};
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
export {
|
|
45
|
+
typescriptObjectParser
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=typescriptParsers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/validation/typescriptParsers.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nexport const typescriptObjectParser = (format: string): [string, string][] => {\n const keyValuePairs: [string, string][] = [];\n\n // State of the algorithm\n let lastKey = '';\n let lastValue = '';\n let shouldAppendToKey = true;\n\n const pushPair = () => {\n if (lastKey) keyValuePairs.push([lastKey, lastValue]);\n lastKey = '';\n lastValue = '';\n shouldAppendToKey = true;\n };\n\n // Complex -- but working -- logic\n let depth = 0;\n format.split('').forEach((char) => {\n if (char === '{') {\n depth += 1;\n if (depth > 1) lastValue += char;\n } else if (char === '}') {\n if (depth > 1) lastValue += char;\n depth -= 1;\n if (depth === 1) pushPair();\n } else if (char === ':') {\n shouldAppendToKey = false;\n if (depth > 1) lastValue += char;\n } else if (char === ',') {\n if (depth === 1) pushPair();\n else lastValue += char;\n } else if (char === ' ') {\n // Do nothing\n } else if (shouldAppendToKey) lastKey += char;\n else lastValue += char;\n });\n pushPair();\n\n return keyValuePairs;\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACCO,MAAM,yBAAyB,CAAC,WAAuC;AAC5E,QAAM,gBAAoC;AAG1C,MAAI,UAAU;AACd,MAAI,YAAY;AAChB,MAAI,oBAAoB;AAExB,QAAM,WAAW,MAAM;AACrB,QAAI;AAAS,oBAAc,KAAK,CAAC,SAAS;AAC1C,cAAU;AACV,gBAAY;AACZ,wBAAoB;AAAA;AAItB,MAAI,QAAQ;AACZ,SAAO,MAAM,IAAI,QAAQ,CAAC,SAAS;AACjC,QAAI,SAAS,KAAK;AAChB,eAAS;AACT,UAAI,QAAQ;AAAG,qBAAa;AAAA,eACnB,SAAS,KAAK;AACvB,UAAI,QAAQ;AAAG,qBAAa;AAC5B,eAAS;AACT,UAAI,UAAU;AAAG;AAAA,eACR,SAAS,KAAK;AACvB,0BAAoB;AACpB,UAAI,QAAQ;AAAG,qBAAa;AAAA,eACnB,SAAS,KAAK;AACvB,UAAI,UAAU;AAAG;AAAA;AACZ,qBAAa;AAAA,eACT,SAAS,KAAK;AAAA,eAEd;AAAmB,iBAAW;AAAA;AACpC,mBAAa;AAAA;AAEpB;AAEA,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,202 +1,153 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { describe } from "../propTypes";
|
|
4
|
+
import { throwRequiredError, throwTypeError } from "./errorTemplates";
|
|
5
|
+
import {
|
|
6
|
+
isArray,
|
|
7
|
+
isFunction,
|
|
8
|
+
isJSXorNode,
|
|
9
|
+
isObject,
|
|
10
|
+
isPrimitiveType,
|
|
11
|
+
isSomethingWithParenthesis,
|
|
12
|
+
isString,
|
|
13
|
+
isUnion,
|
|
14
|
+
isUndefined,
|
|
15
|
+
isNull
|
|
16
|
+
} from "./typescriptGuards";
|
|
17
|
+
import { typescriptObjectParser } from "./typescriptParsers";
|
|
17
18
|
const validateUndefined = (schemaName, key, value, format) => {
|
|
18
|
-
if (value !==
|
|
19
|
+
if (value !== void 0 || value === "undefined") {
|
|
19
20
|
throwTypeError(schemaName, key, value, format);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
|
-
|
|
23
23
|
const validateNull = (schemaName, key, value, format) => {
|
|
24
|
-
if (value !== null || value ===
|
|
24
|
+
if (value !== null || value === "null") {
|
|
25
25
|
throwTypeError(schemaName, key, value, format);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
|
|
29
28
|
const validatePrimitiveType = (schemaName, key, value, format) => {
|
|
30
29
|
if (typeof value !== format) {
|
|
31
30
|
throwTypeError(schemaName, key, value, format);
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
|
-
|
|
35
33
|
const validateString = (schemaName, key, value, format) => {
|
|
36
34
|
if (value !== format.slice(1, -1)) {
|
|
37
35
|
throwTypeError(schemaName, key, value, format);
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
|
-
|
|
41
38
|
const validateArray = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
|
|
42
|
-
// Check that we have an array
|
|
43
39
|
if (!Array.isArray(value)) {
|
|
44
40
|
throwTypeError(schemaName, key, value, format);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
}
|
|
48
42
|
value.forEach((val, index) => {
|
|
49
|
-
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
51
|
-
validateValueWithFormat(schemaName, "".concat(key, "[").concat(index, "]"), val, format.slice(0, -2), validationsMemo, nextValidationsMemo);
|
|
43
|
+
validateValueWithFormat(schemaName, `${key}[${index}]`, val, format.slice(0, -2), validationsMemo, nextValidationsMemo);
|
|
52
44
|
});
|
|
53
45
|
};
|
|
54
|
-
|
|
55
46
|
function isObjectType(value) {
|
|
56
|
-
return !(typeof value !==
|
|
47
|
+
return !(typeof value !== "object" || Array.isArray(value));
|
|
57
48
|
}
|
|
58
|
-
|
|
59
49
|
const validateObject = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
|
|
60
|
-
const valuesIsObject = isObjectType(value);
|
|
61
|
-
|
|
50
|
+
const valuesIsObject = isObjectType(value);
|
|
62
51
|
if (!valuesIsObject) {
|
|
63
52
|
throwTypeError(schemaName, key, value, format);
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const keyValuePairs = typescriptObjectParser(format);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
keyValuePairs.forEach(_ref => {
|
|
73
|
-
let [objectKey, objectValue] = _ref;
|
|
74
|
-
const trueKey = objectKey.slice(-1) === '?' ? objectKey.slice(0, -1) : objectKey;
|
|
75
|
-
|
|
55
|
+
if (format === "object")
|
|
56
|
+
return;
|
|
57
|
+
const keyValuePairs = typescriptObjectParser(format);
|
|
58
|
+
keyValuePairs.forEach(([objectKey, objectValue]) => {
|
|
59
|
+
const trueKey = objectKey.slice(-1) === "?" ? objectKey.slice(0, -1) : objectKey;
|
|
76
60
|
if (trueKey === objectKey && !(trueKey in value)) {
|
|
77
61
|
throwRequiredError(schemaName, key);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
if (trueKey in value) {
|
|
81
|
-
|
|
82
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
83
|
-
validateValueWithFormat(schemaName, "".concat(key, "[").concat(trueKey, "]"), value[trueKey], objectValue, validationsMemo, nextValidationsMemo);
|
|
64
|
+
validateValueWithFormat(schemaName, `${key}[${trueKey}]`, value[trueKey], objectValue, validationsMemo, nextValidationsMemo);
|
|
84
65
|
}
|
|
85
66
|
});
|
|
86
67
|
};
|
|
87
|
-
|
|
88
68
|
const validateUnion = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
|
|
89
69
|
const possibilities = format.split(/\s?\|\s?/);
|
|
90
70
|
const errors = [];
|
|
91
|
-
possibilities.forEach(possibility => {
|
|
71
|
+
possibilities.forEach((possibility) => {
|
|
92
72
|
try {
|
|
93
|
-
// this is a recursive func, we need to invoke it before it's defined.
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
95
73
|
validateValueWithFormat(schemaName, key, value, possibility, validationsMemo, nextValidationsMemo);
|
|
96
74
|
} catch (e) {
|
|
97
75
|
errors.push(e);
|
|
98
76
|
}
|
|
99
77
|
});
|
|
100
|
-
|
|
101
78
|
if (errors.length === possibilities.length) {
|
|
102
79
|
throwTypeError(schemaName, key, value, format);
|
|
103
80
|
}
|
|
104
81
|
};
|
|
105
|
-
|
|
106
82
|
const validateFunction = (schemaName, key, value, format) => {
|
|
107
|
-
|
|
108
|
-
if (typeof value !== 'function') {
|
|
83
|
+
if (typeof value !== "function") {
|
|
109
84
|
throwTypeError(schemaName, key, value, format);
|
|
110
85
|
}
|
|
111
86
|
};
|
|
112
|
-
|
|
113
87
|
function isJSXElement(value) {
|
|
114
|
-
return value === null || typeof value ===
|
|
88
|
+
return value === null || typeof value === "object" && value !== null && "$$typeof" in value;
|
|
115
89
|
}
|
|
116
|
-
|
|
117
90
|
const validateJSXorNode = (schemaName, key, value, format) => {
|
|
118
91
|
const valueIsJSX = isJSXElement(value);
|
|
119
|
-
|
|
120
|
-
if (format === 'JSX.Element' && !valueIsJSX) {
|
|
92
|
+
if (format === "JSX.Element" && !valueIsJSX) {
|
|
121
93
|
throwTypeError(schemaName, key, value, format);
|
|
122
94
|
}
|
|
123
|
-
};
|
|
124
|
-
// Schema validator
|
|
125
|
-
// =============================================================================
|
|
126
|
-
|
|
127
|
-
|
|
95
|
+
};
|
|
128
96
|
const validateValueWithFormat = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {
|
|
129
97
|
nextValidationsMemo[value] = format;
|
|
130
|
-
|
|
131
98
|
if (value in validationsMemo) {
|
|
132
|
-
// We already validated this value on this format
|
|
133
99
|
return;
|
|
134
100
|
}
|
|
135
|
-
|
|
136
101
|
if (isUndefined(format)) {
|
|
137
|
-
validateUndefined(schemaName, key, value, format);
|
|
102
|
+
validateUndefined(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
138
103
|
} else if (isNull(format)) {
|
|
139
|
-
validateNull(schemaName, key, value, format);
|
|
104
|
+
validateNull(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
140
105
|
} else if (isPrimitiveType(format)) {
|
|
141
|
-
validatePrimitiveType(schemaName, key, value, format);
|
|
106
|
+
validatePrimitiveType(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
142
107
|
} else if (isUnion(format)) {
|
|
143
108
|
validateUnion(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
144
109
|
} else if (isString(format)) {
|
|
145
|
-
validateString(schemaName, key, value, format);
|
|
110
|
+
validateString(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
146
111
|
} else if (isArray(format)) {
|
|
147
112
|
validateArray(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
148
113
|
} else if (isObject(format)) {
|
|
149
114
|
validateObject(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
150
115
|
} else if (isFunction(format)) {
|
|
151
|
-
validateFunction(schemaName, key, value, format);
|
|
116
|
+
validateFunction(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
152
117
|
} else if (isJSXorNode(format)) {
|
|
153
|
-
validateJSXorNode(schemaName, key, value, format);
|
|
118
|
+
validateJSXorNode(schemaName, key, value, format, validationsMemo, nextValidationsMemo);
|
|
154
119
|
} else if (isSomethingWithParenthesis(format)) {
|
|
155
120
|
validateValueWithFormat(schemaName, key, value, format.slice(1, -1), validationsMemo, nextValidationsMemo);
|
|
156
121
|
}
|
|
157
122
|
};
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const {
|
|
163
|
-
properties,
|
|
164
|
-
name: schemaName
|
|
165
|
-
} = schema;
|
|
166
|
-
properties.forEach(property => {
|
|
167
|
-
const {
|
|
168
|
-
name,
|
|
169
|
-
format,
|
|
170
|
-
required
|
|
171
|
-
} = property;
|
|
172
|
-
|
|
123
|
+
const validateTypescriptPropTypesImplementation = (props, schema, validationsMemo = {}, nextValidationsMemo = {}) => {
|
|
124
|
+
const { properties, name: schemaName } = schema;
|
|
125
|
+
properties.forEach((property) => {
|
|
126
|
+
const { name, format, required } = property;
|
|
173
127
|
if (required && !(name in props)) {
|
|
174
128
|
throwRequiredError(schema.name, name);
|
|
175
129
|
}
|
|
176
|
-
|
|
177
|
-
if (name in props && (props[name] !== undefined || required)) {
|
|
130
|
+
if (name in props && (props[name] !== void 0 || required)) {
|
|
178
131
|
validateValueWithFormat(schemaName, name, props[name], format, validationsMemo, nextValidationsMemo);
|
|
179
132
|
}
|
|
180
133
|
});
|
|
181
|
-
};
|
|
182
|
-
|
|
134
|
+
};
|
|
183
135
|
const useValidateTypescriptPropTypes = (props, propTypes) => {
|
|
184
|
-
const [validationsMemo, setValidationsMemo] = useState({});
|
|
185
|
-
|
|
136
|
+
const [validationsMemo, setValidationsMemo] = useState({});
|
|
186
137
|
const ComponentWithSchema = useMemo(() => {
|
|
187
|
-
const Component = () => {
|
|
188
|
-
|
|
189
|
-
|
|
138
|
+
const Component = () => {
|
|
139
|
+
};
|
|
190
140
|
return describe(Component);
|
|
191
|
-
}, []);
|
|
192
|
-
|
|
141
|
+
}, []);
|
|
193
142
|
ComponentWithSchema.propTypes = propTypes;
|
|
194
143
|
useMemo(() => {
|
|
195
144
|
const nextValidationsMemo = {};
|
|
196
|
-
validateTypescriptPropTypesImplementation(props,
|
|
197
|
-
|
|
198
|
-
setValidationsMemo(nextValidationsMemo); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
145
|
+
validateTypescriptPropTypesImplementation(props, ComponentWithSchema.toTypescript(), validationsMemo, nextValidationsMemo);
|
|
146
|
+
setValidationsMemo(nextValidationsMemo);
|
|
199
147
|
}, [props]);
|
|
200
148
|
};
|
|
201
|
-
|
|
202
|
-
|
|
149
|
+
export {
|
|
150
|
+
useValidateTypescriptPropTypes,
|
|
151
|
+
validateTypescriptPropTypesImplementation
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=typescriptValidator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/validation/typescriptValidator.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport React, { PropsWithChildren, useMemo, useState } from 'react';\nimport { describe } from '../propTypes';\nimport { throwRequiredError, throwTypeError } from './errorTemplates';\nimport {\n isArray,\n isFunction,\n isJSXorNode,\n isObject,\n isPrimitiveType,\n isSomethingWithParenthesis,\n isString,\n isUnion,\n isUndefined,\n isNull,\n} from './typescriptGuards';\nimport { typescriptObjectParser } from './typescriptParsers';\n\ninterface TypescriptSchema {\n description: string;\n name: string;\n properties: { name: string; description: string; defaultValue?: unknown; format: string; required?: boolean }[];\n}\n\ntype ValidatorFn = (\n schemaName: string,\n key: string,\n value: unknown,\n format: string,\n validationsMemo: Record<symbol, string>,\n nextValidationsMemo: Record<symbol, string>,\n) => void;\n\n// =============================================================================\n// Atom Validators\n// =============================================================================\n\n// This functions will validate something from the data\n// and optionally recursively apply `validateValueWithFormat`\n// in smaller parts\n\nconst validateUndefined: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== undefined || value === 'undefined') {\n throwTypeError(schemaName, key, value, format);\n }\n};\nconst validateNull: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== null || value === 'null') {\n throwTypeError(schemaName, key, value, format);\n }\n};\nconst validatePrimitiveType: ValidatorFn = (schemaName, key, value, format) => {\n if (typeof value !== format) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateString: ValidatorFn = (schemaName, key, value, format) => {\n if (value !== format.slice(1, -1)) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateArray: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n // Check that we have an array\n if (!Array.isArray(value)) {\n throwTypeError(schemaName, key, value, format);\n }\n\n // Check that each element inside satisfies the format\n (value as unknown[]).forEach((val, index) => {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(\n schemaName,\n `${key}[${index}]`,\n val,\n format.slice(0, -2),\n validationsMemo,\n nextValidationsMemo,\n );\n });\n};\nfunction isObjectType(value: unknown | Record<string, unknown>): value is Record<string, unknown> {\n return !(typeof value !== 'object' || Array.isArray(value));\n}\nconst validateObject: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n const valuesIsObject = isObjectType(value);\n // Check that we have an object\n if (!valuesIsObject) {\n throwTypeError(schemaName, key, value, format);\n return;\n }\n\n if (format === 'object') return;\n\n const keyValuePairs = typescriptObjectParser(format);\n // Now we have the key - value pairs\n // Each key could either be required or not\n // Just recursively check the object\n\n keyValuePairs.forEach(([objectKey, objectValue]) => {\n const trueKey = objectKey.slice(-1) === '?' ? objectKey.slice(0, -1) : objectKey;\n\n if (trueKey === objectKey && !(trueKey in value)) {\n throwRequiredError(schemaName, key);\n }\n\n if (trueKey in value) {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(\n schemaName,\n `${key}[${trueKey}]`,\n value[trueKey],\n objectValue,\n validationsMemo,\n nextValidationsMemo,\n );\n }\n });\n};\n\nconst validateUnion: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n const possibilities = format.split(/\\s?\\|\\s?/);\n\n const errors = [];\n\n possibilities.forEach((possibility) => {\n try {\n // this is a recursive func, we need to invoke it before it's defined.\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n validateValueWithFormat(schemaName, key, value, possibility, validationsMemo, nextValidationsMemo);\n } catch (e) {\n errors.push(e);\n }\n });\n\n if (errors.length === possibilities.length) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nconst validateFunction: ValidatorFn = (schemaName, key, value, format) => {\n // Check that we have a function\n if (typeof value !== 'function') {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\nfunction isJSXElement(value: unknown | JSX.Element): value is JSX.Element {\n return value === null || (typeof value === 'object' && value !== null && '$$typeof' in value);\n}\nconst validateJSXorNode: ValidatorFn = (schemaName, key, value, format) => {\n const valueIsJSX = isJSXElement(value);\n if (format === 'JSX.Element' && !valueIsJSX) {\n throwTypeError(schemaName, key, value, format);\n }\n};\n\n// =============================================================================\n// Schema validator\n// =============================================================================\n\nconst validateValueWithFormat: ValidatorFn = (schemaName, key, value, format, validationsMemo, nextValidationsMemo) => {\n nextValidationsMemo[value as symbol] = format;\n\n if ((value as symbol) in validationsMemo) {\n // We already validated this value on this format\n return;\n }\n\n if (isUndefined(format)) {\n validateUndefined(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isNull(format)) {\n validateNull(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isPrimitiveType(format)) {\n validatePrimitiveType(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isUnion(format)) {\n validateUnion(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isString(format)) {\n validateString(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isArray(format)) {\n validateArray(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isObject(format)) {\n validateObject(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isFunction(format)) {\n validateFunction(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isJSXorNode(format)) {\n validateJSXorNode(schemaName, key, value, format, validationsMemo, nextValidationsMemo);\n } else if (isSomethingWithParenthesis(format)) {\n validateValueWithFormat(schemaName, key, value, format.slice(1, -1), validationsMemo, nextValidationsMemo);\n }\n};\n\nexport const validateTypescriptPropTypesImplementation = (\n props: PropsWithChildren<Record<string, unknown>>,\n schema: TypescriptSchema,\n validationsMemo: Record<string, string> = {},\n nextValidationsMemo: Record<string, string> = {},\n): void => {\n const { properties, name: schemaName } = schema;\n\n properties.forEach((property) => {\n const { name, format, required } = property;\n\n if (required && !(name in props)) {\n throwRequiredError(schema.name, name);\n }\n\n if (name in props && (props[name] !== undefined || required)) {\n validateValueWithFormat(schemaName, name, props[name], format, validationsMemo, nextValidationsMemo);\n }\n });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const useValidateTypescriptPropTypes = <T = Record<string, any>>(\n props: PropsWithChildren<T>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n propTypes: any,\n): void => {\n const [validationsMemo, setValidationsMemo] = useState({});\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const ComponentWithSchema = useMemo(() => {\n const Component = () => {};\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return describe(Component);\n }, []);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n ComponentWithSchema.propTypes = propTypes;\n\n useMemo(() => {\n const nextValidationsMemo = {};\n\n validateTypescriptPropTypesImplementation(\n props,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n ComponentWithSchema.toTypescript(),\n validationsMemo,\n nextValidationsMemo,\n );\n\n setValidationsMemo(nextValidationsMemo);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props]);\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
|
-
import { throwRequiredError, throwTypeError } from './errorTemplates.js';
|
|
5
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { throwRequiredError, throwTypeError } from "./errorTemplates";
|
|
6
3
|
const useValidatePropTypes = (props, schema) => {
|
|
7
|
-
schema.properties.forEach(property => {
|
|
4
|
+
schema.properties.forEach((property) => {
|
|
8
5
|
const propertyName = property.name;
|
|
9
6
|
const currentProp = props[propertyName];
|
|
10
|
-
const currentPropTypeOf = typeof currentProp;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let isValidReactElement = false; // this depends on react desc definition
|
|
15
|
-
|
|
7
|
+
const currentPropTypeOf = typeof currentProp;
|
|
8
|
+
const currentFormat = property.format;
|
|
9
|
+
let isValidReactElement = false;
|
|
16
10
|
if (property.required && !Object.prototype.hasOwnProperty.call(props, property.name)) {
|
|
17
11
|
throwRequiredError(schema.name, property.name);
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (currentPropTypeOf === 'object' && Object.prototype.hasOwnProperty.call(currentProp, '$$typeof') && (currentFormat.includes('node') || currentFormat.includes('element'))) {
|
|
13
|
+
if (currentPropTypeOf !== "undefined" && currentProp !== null) {
|
|
14
|
+
if (currentPropTypeOf === "object" && Object.prototype.hasOwnProperty.call(currentProp, "$$typeof") && (currentFormat.includes("node") || currentFormat.includes("element"))) {
|
|
22
15
|
isValidReactElement = true;
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
if (!currentFormat.includes(currentPropTypeOf) && !currentFormat.includes(currentProp) && !isValidReactElement) {
|
|
26
18
|
throwTypeError(schema.name, propertyName, currentProp, currentFormat);
|
|
27
19
|
}
|
|
28
20
|
}
|
|
29
21
|
});
|
|
30
22
|
};
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
export {
|
|
24
|
+
useValidatePropTypes
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/validation/validator.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { throwRequiredError, throwTypeError } from './errorTemplates';\n\nexport const useValidatePropTypes = (props: Record<string, unknown>, schema): void => {\n schema.properties.forEach((property) => {\n const propertyName = property.name;\n const currentProp = props[propertyName];\n const currentPropTypeOf = typeof currentProp;\n // eslint-disable-next-line max-len\n const currentFormat = property.format; // this is csv representing types e.g.: \"string\"/\"string,number\"/\"[object],string\"\n let isValidReactElement = false;\n // this depends on react desc definition\n if (property.required && !Object.prototype.hasOwnProperty.call(props, property.name)) {\n throwRequiredError(schema.name, property.name);\n }\n if (currentPropTypeOf !== 'undefined' && currentProp !== null) {\n if (\n currentPropTypeOf === 'object' &&\n Object.prototype.hasOwnProperty.call(currentProp, '$$typeof') &&\n (currentFormat.includes('node') || currentFormat.includes('element'))\n ) {\n isValidReactElement = true;\n }\n\n if (!currentFormat.includes(currentPropTypeOf) && !currentFormat.includes(currentProp) && !isValidReactElement) {\n throwTypeError(schema.name, propertyName, currentProp, currentFormat);\n }\n }\n });\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AAEO,MAAM,uBAAuB,CAAC,OAAgC,WAAiB;AACpF,SAAO,WAAW,QAAQ,CAAC,aAAa;AACtC,UAAM,eAAe,SAAS;AAC9B,UAAM,cAAc,MAAM;AAC1B,UAAM,oBAAoB,OAAO;AAEjC,UAAM,gBAAgB,SAAS;AAC/B,QAAI,sBAAsB;AAE1B,QAAI,SAAS,YAAY,CAAC,OAAO,UAAU,eAAe,KAAK,OAAO,SAAS,OAAO;AACpF,yBAAmB,OAAO,MAAM,SAAS;AAAA;AAE3C,QAAI,sBAAsB,eAAe,gBAAgB,MAAM;AAC7D,UACE,sBAAsB,YACtB,OAAO,UAAU,eAAe,KAAK,aAAa,eACjD,eAAc,SAAS,WAAW,cAAc,SAAS,aAC1D;AACA,8BAAsB;AAAA;AAGxB,UAAI,CAAC,cAAc,SAAS,sBAAsB,CAAC,cAAc,SAAS,gBAAgB,CAAC,qBAAqB;AAC9G,uBAAe,OAAO,MAAM,cAAc,aAAa;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-props-helpers",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Props Helpers",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -35,9 +35,61 @@
|
|
|
35
35
|
"import": "./esm/validation/errorTemplates.js",
|
|
36
36
|
"require": "./cjs/validation/errorTemplates.js"
|
|
37
37
|
},
|
|
38
|
-
"./tests/test.schema": {
|
|
39
|
-
"import": "./esm/tests/test.schema.js",
|
|
40
|
-
"require": "./cjs/tests/test.schema.js"
|
|
38
|
+
"./tests/validation/test.schema": {
|
|
39
|
+
"import": "./esm/tests/validation/test.schema.js",
|
|
40
|
+
"require": "./cjs/tests/validation/test.schema.js"
|
|
41
|
+
},
|
|
42
|
+
"./tests/globalProps/TestComponent": {
|
|
43
|
+
"import": "./esm/tests/globalProps/TestComponent.js",
|
|
44
|
+
"require": "./cjs/tests/globalProps/TestComponent.js"
|
|
45
|
+
},
|
|
46
|
+
"./propTypes/types": {
|
|
47
|
+
"import": "./esm/propTypes/types.js",
|
|
48
|
+
"require": "./cjs/propTypes/types.js"
|
|
49
|
+
},
|
|
50
|
+
"./propTypes/toTypescript": {
|
|
51
|
+
"import": "./esm/propTypes/toTypescript.js",
|
|
52
|
+
"require": "./cjs/propTypes/toTypescript.js"
|
|
53
|
+
},
|
|
54
|
+
"./propTypes/PropTypes": {
|
|
55
|
+
"import": "./esm/propTypes/PropTypes.js",
|
|
56
|
+
"require": "./cjs/propTypes/PropTypes.js"
|
|
57
|
+
},
|
|
58
|
+
"./propTypes": {
|
|
59
|
+
"import": "./esm/propTypes/index.js",
|
|
60
|
+
"require": "./cjs/propTypes/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./propTypes/describeGuards": {
|
|
63
|
+
"import": "./esm/propTypes/describeGuards.js",
|
|
64
|
+
"require": "./cjs/propTypes/describeGuards.js"
|
|
65
|
+
},
|
|
66
|
+
"./propTypes/describeConversions": {
|
|
67
|
+
"import": "./esm/propTypes/describeConversions.js",
|
|
68
|
+
"require": "./cjs/propTypes/describeConversions.js"
|
|
69
|
+
},
|
|
70
|
+
"./propTypes/describe": {
|
|
71
|
+
"import": "./esm/propTypes/describe.js",
|
|
72
|
+
"require": "./cjs/propTypes/describe.js"
|
|
73
|
+
},
|
|
74
|
+
"./propTypes/customPropTypes": {
|
|
75
|
+
"import": "./esm/propTypes/customPropTypes.js",
|
|
76
|
+
"require": "./cjs/propTypes/customPropTypes.js"
|
|
77
|
+
},
|
|
78
|
+
"./globalProps/useGetGlobalAttributes": {
|
|
79
|
+
"import": "./esm/globalProps/useGetGlobalAttributes.js",
|
|
80
|
+
"require": "./cjs/globalProps/useGetGlobalAttributes.js"
|
|
81
|
+
},
|
|
82
|
+
"./globalProps": {
|
|
83
|
+
"import": "./esm/globalProps/index.js",
|
|
84
|
+
"require": "./cjs/globalProps/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./globalProps/globalAttributesPropTypes": {
|
|
87
|
+
"import": "./esm/globalProps/globalAttributesPropTypes.js",
|
|
88
|
+
"require": "./cjs/globalProps/globalAttributesPropTypes.js"
|
|
89
|
+
},
|
|
90
|
+
"./globalProps/constants": {
|
|
91
|
+
"import": "./esm/globalProps/constants.js",
|
|
92
|
+
"require": "./cjs/globalProps/constants.js"
|
|
41
93
|
},
|
|
42
94
|
"./getProps": {
|
|
43
95
|
"import": "./esm/getProps/index.js",
|