@innet/server 2.0.0-alpha.22 → 2.0.0-alpha.24
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/package.json +1 -1
- package/plugins/request/file/file.es6.js +2 -3
- package/plugins/request/file/file.js +2 -3
- package/plugins/schema/string/string.es6.js +43 -29
- package/plugins/schema/string/string.js +43 -29
- /package/example/{requests → return}/index.d.ts +0 -0
- /package/example/{requests → return}/todo/AddTodo/AddTodo.d.ts +0 -0
- /package/example/{requests → return}/todo/AddTodo/index.d.ts +0 -0
- /package/example/{requests → return}/todo/DeleteTodo/DeleteTodo.d.ts +0 -0
- /package/example/{requests → return}/todo/DeleteTodo/index.d.ts +0 -0
- /package/example/{requests → return}/todo/EditTodo/EditTodo.d.ts +0 -0
- /package/example/{requests → return}/todo/EditTodo/index.d.ts +0 -0
- /package/example/{requests → return}/todo/GetTodo/GetTodo.d.ts +0 -0
- /package/example/{requests → return}/todo/GetTodo/index.d.ts +0 -0
- /package/example/{requests → return}/todo/GetTodos/GetTodos.d.ts +0 -0
- /package/example/{requests → return}/todo/GetTodos/index.d.ts +0 -0
- /package/example/{requests → return}/todo/index.d.ts +0 -0
- /package/example/{requests → return}/todo/todos.d.ts +0 -0
package/package.json
CHANGED
|
@@ -3,48 +3,62 @@ import { useProps } from '@innet/jsx';
|
|
|
3
3
|
import '../../../hooks/index.es6.js';
|
|
4
4
|
import '../../../hooks/useParentRule/index.es6.js';
|
|
5
5
|
import '../../../utils/index.es6.js';
|
|
6
|
+
import { useApi } from '../../../hooks/useApi/useApi.es6.js';
|
|
6
7
|
import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
|
|
7
8
|
import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
|
|
8
9
|
import { values } from '../../../utils/rules/values/values.es6.js';
|
|
9
10
|
import { minLength } from '../../../utils/rules/minLength/minLength.es6.js';
|
|
10
11
|
import { maxLength } from '../../../utils/rules/maxLength/maxLength.es6.js';
|
|
11
12
|
import { pattern } from '../../../utils/rules/pattern/pattern.es6.js';
|
|
12
|
-
import { useRule } from '../../../hooks/useRule/useRule.es6.js';
|
|
13
13
|
import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
|
|
14
|
+
import { useRule } from '../../../hooks/useRule/useRule.es6.js';
|
|
14
15
|
import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
|
|
15
16
|
|
|
16
17
|
const string = () => {
|
|
17
18
|
const _a = useProps() || {}, { min, max, pattern: pattern$1, patternId } = _a, props = __rest(_a, ["min", "max", "pattern", "patternId"]);
|
|
19
|
+
const { refRules } = useApi();
|
|
18
20
|
const schema = useSchemaType('string', props);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
rules
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
if (schema) {
|
|
22
|
+
const rules = [];
|
|
23
|
+
if (props.default !== undefined) {
|
|
24
|
+
rules.push(defaultTo(props.default));
|
|
25
|
+
}
|
|
26
|
+
rules.push(String);
|
|
27
|
+
if (props.values) {
|
|
28
|
+
rules.push(values(props.values));
|
|
29
|
+
}
|
|
30
|
+
if (min !== undefined) {
|
|
31
|
+
schema.minimum = min;
|
|
32
|
+
rules.push(minLength(min));
|
|
33
|
+
}
|
|
34
|
+
if (max !== undefined) {
|
|
35
|
+
schema.maximum = max;
|
|
36
|
+
rules.push(maxLength(max));
|
|
37
|
+
}
|
|
38
|
+
if (pattern$1 !== undefined) {
|
|
39
|
+
schema.pattern = String(pattern$1);
|
|
40
|
+
rules.push(pattern(pattern$1, patternId));
|
|
41
|
+
}
|
|
42
|
+
const rule = pipe(...rules);
|
|
43
|
+
if (props.ref) {
|
|
44
|
+
refRules[props.ref] = rule;
|
|
45
|
+
}
|
|
46
|
+
if (props.default) {
|
|
47
|
+
useRule(rule);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const parentRule = useParentRule();
|
|
51
|
+
useRule(parentRule(rule));
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
|
-
else {
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
else if (props.ref) {
|
|
55
|
+
if (props.default) {
|
|
56
|
+
useRule(refRules[props.ref]);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const parentRule = useParentRule();
|
|
60
|
+
useRule(parentRule(refRules[props.ref]));
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
};
|
|
50
64
|
|
|
@@ -7,48 +7,62 @@ var jsx = require('@innet/jsx');
|
|
|
7
7
|
require('../../../hooks/index.js');
|
|
8
8
|
require('../../../hooks/useParentRule/index.js');
|
|
9
9
|
require('../../../utils/index.js');
|
|
10
|
+
var useApi = require('../../../hooks/useApi/useApi.js');
|
|
10
11
|
var useSchemaType = require('../../../hooks/useSchemaType/useSchemaType.js');
|
|
11
12
|
var defaultTo = require('../../../utils/rules/defaultTo/defaultTo.js');
|
|
12
13
|
var values = require('../../../utils/rules/values/values.js');
|
|
13
14
|
var minLength = require('../../../utils/rules/minLength/minLength.js');
|
|
14
15
|
var maxLength = require('../../../utils/rules/maxLength/maxLength.js');
|
|
15
16
|
var pattern = require('../../../utils/rules/pattern/pattern.js');
|
|
16
|
-
var useRule = require('../../../hooks/useRule/useRule.js');
|
|
17
17
|
var pipe = require('../../../utils/rules/pipe/pipe.js');
|
|
18
|
+
var useRule = require('../../../hooks/useRule/useRule.js');
|
|
18
19
|
var useParentRule = require('../../../hooks/useParentRule/useParentRule.js');
|
|
19
20
|
|
|
20
21
|
const string = () => {
|
|
21
22
|
const _a = jsx.useProps() || {}, { min, max, pattern: pattern$1, patternId } = _a, props = tslib.__rest(_a, ["min", "max", "pattern", "patternId"]);
|
|
23
|
+
const { refRules } = useApi.useApi();
|
|
22
24
|
const schema = useSchemaType.useSchemaType('string', props);
|
|
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
|
-
|
|
25
|
+
if (schema) {
|
|
26
|
+
const rules = [];
|
|
27
|
+
if (props.default !== undefined) {
|
|
28
|
+
rules.push(defaultTo.defaultTo(props.default));
|
|
29
|
+
}
|
|
30
|
+
rules.push(String);
|
|
31
|
+
if (props.values) {
|
|
32
|
+
rules.push(values.values(props.values));
|
|
33
|
+
}
|
|
34
|
+
if (min !== undefined) {
|
|
35
|
+
schema.minimum = min;
|
|
36
|
+
rules.push(minLength.minLength(min));
|
|
37
|
+
}
|
|
38
|
+
if (max !== undefined) {
|
|
39
|
+
schema.maximum = max;
|
|
40
|
+
rules.push(maxLength.maxLength(max));
|
|
41
|
+
}
|
|
42
|
+
if (pattern$1 !== undefined) {
|
|
43
|
+
schema.pattern = String(pattern$1);
|
|
44
|
+
rules.push(pattern.pattern(pattern$1, patternId));
|
|
45
|
+
}
|
|
46
|
+
const rule = pipe.pipe(...rules);
|
|
47
|
+
if (props.ref) {
|
|
48
|
+
refRules[props.ref] = rule;
|
|
49
|
+
}
|
|
50
|
+
if (props.default) {
|
|
51
|
+
useRule.useRule(rule);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const parentRule = useParentRule.useParentRule();
|
|
55
|
+
useRule.useRule(parentRule(rule));
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
|
-
else {
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
else if (props.ref) {
|
|
59
|
+
if (props.default) {
|
|
60
|
+
useRule.useRule(refRules[props.ref]);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const parentRule = useParentRule.useParentRule();
|
|
64
|
+
useRule.useRule(parentRule(refRules[props.ref]));
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
67
|
};
|
|
54
68
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|