@innet/server 2.0.0-beta.2 → 2.0.0-beta.20

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.
Files changed (149) hide show
  1. package/README.md +1869 -3651
  2. package/handler/handler.d.ts +5 -2
  3. package/handler/handler.es6.js +2 -0
  4. package/handler/handler.js +2 -0
  5. package/hooks/index.d.ts +25 -23
  6. package/hooks/index.es6.js +25 -23
  7. package/hooks/index.js +25 -23
  8. package/hooks/useAction/useAction.es6.js +1 -1
  9. package/hooks/useAction/useAction.js +1 -1
  10. package/hooks/useApi/useApi.d.ts +2 -0
  11. package/hooks/useData/index.d.ts +1 -0
  12. package/hooks/useData/index.es6.js +1 -0
  13. package/hooks/useData/index.js +9 -0
  14. package/hooks/useData/useData.d.ts +6 -0
  15. package/hooks/useData/useData.es6.js +29 -0
  16. package/hooks/useData/useData.js +33 -0
  17. package/hooks/useEffect/index.d.ts +1 -0
  18. package/hooks/useEffect/index.es6.js +1 -0
  19. package/hooks/useEffect/index.js +9 -0
  20. package/hooks/useEffect/useEffect.d.ts +2 -0
  21. package/hooks/useEffect/useEffect.es6.js +8 -0
  22. package/hooks/useEffect/useEffect.js +12 -0
  23. package/hooks/useSchemaType/useSchemaType.d.ts +1 -1
  24. package/hooks/useSchemaType/useSchemaType.es6.js +13 -4
  25. package/hooks/useSchemaType/useSchemaType.js +13 -4
  26. package/hooks/useSearch/useSearch.es6.js +1 -1
  27. package/hooks/useSearch/useSearch.js +1 -1
  28. package/hooks/useServer/useServer.d.ts +2 -0
  29. package/index.d.ts +2 -2
  30. package/index.es6.js +90 -86
  31. package/index.js +204 -193
  32. package/package.json +5 -4
  33. package/plugins/handler/serverFn/serverFn.es6.js +1 -1
  34. package/plugins/handler/serverFn/serverFn.js +1 -5
  35. package/plugins/index.d.ts +2 -2
  36. package/plugins/index.es6.js +2 -2
  37. package/plugins/index.js +2 -2
  38. package/plugins/main/api/api.es6.js +6 -5
  39. package/plugins/main/api/api.js +8 -11
  40. package/plugins/main/body/body.es6.js +4 -4
  41. package/plugins/main/body/body.js +4 -8
  42. package/plugins/main/endpoint/endpoint.es6.js +4 -4
  43. package/plugins/main/endpoint/endpoint.js +4 -8
  44. package/plugins/main/host/host.es6.js +1 -1
  45. package/plugins/main/host/host.js +1 -5
  46. package/plugins/main/index.d.ts +8 -8
  47. package/plugins/main/index.es6.js +8 -8
  48. package/plugins/main/index.js +8 -8
  49. package/plugins/main/param/param.es6.js +1 -1
  50. package/plugins/main/param/param.js +1 -5
  51. package/plugins/main/preset/preset.es6.js +1 -1
  52. package/plugins/main/preset/preset.js +1 -5
  53. package/plugins/main/response/response.d.ts +2 -1
  54. package/plugins/main/response/response.es6.js +1 -1
  55. package/plugins/main/response/response.js +1 -5
  56. package/plugins/main/server/server.d.ts +4 -0
  57. package/plugins/main/server/server.es6.js +5 -3
  58. package/plugins/main/server/server.js +6 -5
  59. package/plugins/main/tag/index.es6.js +1 -1
  60. package/plugins/main/tag/index.js +1 -0
  61. package/plugins/main/tag/tag.d.ts +8 -1
  62. package/plugins/main/tag/tag.es6.js +20 -3
  63. package/plugins/main/tag/tag.js +20 -6
  64. package/plugins/request/cms/cms.es6.js +1 -1
  65. package/plugins/request/cms/cms.js +2 -3
  66. package/plugins/request/error/error.es6.js +7 -3
  67. package/plugins/request/error/error.js +7 -3
  68. package/plugins/request/file/file.es6.js +2 -2
  69. package/plugins/request/file/file.js +2 -3
  70. package/plugins/request/header/header.es6.js +1 -1
  71. package/plugins/request/header/header.js +1 -1
  72. package/plugins/request/index.d.ts +5 -5
  73. package/plugins/request/index.es6.js +5 -5
  74. package/plugins/request/index.js +5 -5
  75. package/plugins/request/success/success.es6.js +6 -4
  76. package/plugins/request/success/success.js +6 -4
  77. package/plugins/schema/array/array.d.ts +3 -0
  78. package/plugins/schema/array/array.es6.js +14 -5
  79. package/plugins/schema/array/array.js +15 -10
  80. package/plugins/schema/binary/binary.d.ts +4 -0
  81. package/plugins/schema/boolean/boolean.d.ts +1 -0
  82. package/plugins/schema/date/date.d.ts +2 -1
  83. package/plugins/schema/date/date.es6.js +2 -2
  84. package/plugins/schema/date/date.js +2 -2
  85. package/plugins/schema/field/field.d.ts +4 -0
  86. package/plugins/schema/field/field.es6.js +16 -3
  87. package/plugins/schema/field/field.js +16 -7
  88. package/plugins/schema/index.d.ts +8 -8
  89. package/plugins/schema/index.es6.js +8 -8
  90. package/plugins/schema/index.js +8 -8
  91. package/plugins/schema/integer/integer.d.ts +37 -0
  92. package/plugins/schema/integer/integer.es6.js +25 -10
  93. package/plugins/schema/integer/integer.js +25 -10
  94. package/plugins/schema/number/number.d.ts +32 -0
  95. package/plugins/schema/number/number.es6.js +23 -7
  96. package/plugins/schema/number/number.js +22 -6
  97. package/plugins/schema/object/object.es6.js +8 -6
  98. package/plugins/schema/object/object.js +8 -10
  99. package/plugins/schema/string/string.d.ts +27 -0
  100. package/plugins/schema/string/string.es6.js +11 -5
  101. package/plugins/schema/string/string.js +10 -4
  102. package/plugins/schema/tuple/tuple.es6.js +4 -4
  103. package/plugins/schema/tuple/tuple.js +4 -8
  104. package/plugins/schema/uuid/uuid.es6.js +2 -2
  105. package/plugins/schema/uuid/uuid.js +1 -1
  106. package/plugins/utils/dts/dts.es6.js +5 -2
  107. package/plugins/utils/dts/dts.js +5 -2
  108. package/plugins/utils/env/env.es6.js +1 -1
  109. package/plugins/utils/env/env.js +1 -5
  110. package/plugins/utils/index.d.ts +3 -2
  111. package/plugins/utils/index.es6.js +3 -2
  112. package/plugins/utils/index.js +3 -2
  113. package/plugins/utils/swagger/swagger.d.ts +1 -0
  114. package/plugins/utils/swagger/swagger.es6.js +1 -0
  115. package/plugins/utils/swagger/swagger.js +1 -0
  116. package/plugins/utils/ui/index.d.ts +1 -0
  117. package/plugins/utils/ui/index.es6.js +1 -0
  118. package/plugins/utils/ui/index.js +10 -0
  119. package/plugins/utils/ui/rapidoc.html.es6.js +3 -0
  120. package/plugins/utils/ui/rapidoc.html.js +7 -0
  121. package/plugins/utils/ui/redoc.html.es6.js +3 -0
  122. package/plugins/utils/ui/redoc.html.js +7 -0
  123. package/plugins/utils/ui/scalar.html.es6.js +3 -0
  124. package/plugins/utils/ui/scalar.html.js +7 -0
  125. package/plugins/utils/ui/swagger.html.es6.js +3 -0
  126. package/plugins/utils/ui/swagger.html.js +7 -0
  127. package/plugins/utils/ui/ui.d.ts +13 -0
  128. package/plugins/utils/ui/ui.es6.js +45 -0
  129. package/plugins/utils/ui/ui.js +50 -0
  130. package/types.d.ts +23 -1
  131. package/utils/generateTypes/generateTypes.es6.js +105 -76
  132. package/utils/generateTypes/generateTypes.js +105 -76
  133. package/utils/getSafeSchema/getSafeSchema.d.ts +2 -0
  134. package/utils/getSafeSchema/getSafeSchema.es6.js +5 -0
  135. package/utils/getSafeSchema/getSafeSchema.js +9 -0
  136. package/utils/getSafeSchema/index.d.ts +1 -0
  137. package/utils/getSafeSchema/index.es6.js +1 -0
  138. package/utils/getSafeSchema/index.js +9 -0
  139. package/utils/index.d.ts +9 -8
  140. package/utils/index.es6.js +9 -8
  141. package/utils/index.js +9 -8
  142. package/utils/rules/index.d.ts +17 -17
  143. package/utils/rules/index.es6.js +17 -17
  144. package/utils/rules/index.js +18 -18
  145. package/utils/rules/values/index.es6.js +1 -1
  146. package/utils/rules/values/index.js +1 -0
  147. package/utils/rules/values/values.d.ts +3 -1
  148. package/utils/rules/values/values.es6.js +4 -1
  149. package/utils/rules/values/values.js +4 -0
@@ -6,9 +6,9 @@ var jsx = require('@innet/jsx');
6
6
  require('../../../hooks/index.js');
7
7
  require('../../../utils/index.js');
8
8
  var useSchemaType = require('../../../hooks/useSchemaType/useSchemaType.js');
9
+ var values = require('../../../utils/rules/values/values.js');
9
10
  var defaultTo = require('../../../utils/rules/defaultTo/defaultTo.js');
10
11
  var int = require('../../../utils/rules/int/int.js');
11
- var values = require('../../../utils/rules/values/values.js');
12
12
  var min = require('../../../utils/rules/min/min.js');
13
13
  var max = require('../../../utils/rules/max/max.js');
14
14
  var useRule = require('../../../hooks/useRule/useRule.js');
@@ -16,27 +16,42 @@ var optional = require('../../../utils/rules/optional/optional.js');
16
16
  var pipe = require('../../../utils/rules/pipe/pipe.js');
17
17
 
18
18
  const integer = () => {
19
- const { default: defaultValue, example, examples, format = 'int32', max: max$1, min: min$1, values: values$1, ...props } = jsx.useProps() || {};
19
+ const { default: defaultValue, example, examples, exclusiveMaximum, exclusiveMinimum, format = 'int32', max: max$1, min: min$1, multipleOf, values: values$1, ...props } = jsx.useProps() || {};
20
20
  const schema = useSchemaType.useSchemaType('integer', {
21
21
  ...props,
22
22
  default: defaultValue !== undefined ? Number(defaultValue) : undefined,
23
23
  example: example !== undefined ? Number(example) : undefined,
24
24
  examples: examples === null || examples === void 0 ? void 0 : examples.map(Number),
25
- values: values$1 === null || values$1 === void 0 ? void 0 : values$1.map(Number),
25
+ value: props.value !== undefined ? Number(props.value) : undefined,
26
+ values: values$1 && values.getArrayValues(values$1, Number),
26
27
  });
27
- // @ts-expect-error: FIXME
28
- schema.format = format;
29
- // @ts-expect-error: FIXME
30
- schema.minimum = min$1 !== undefined ? Number(min$1) : undefined;
31
- // @ts-expect-error: FIXME
32
- schema.maximum = max$1 !== undefined ? Number(max$1) : undefined;
28
+ if (schema) {
29
+ if (format) {
30
+ schema.format = format;
31
+ }
32
+ if (min$1 !== undefined) {
33
+ schema.minimum = Number(min$1);
34
+ }
35
+ if (max$1 !== undefined) {
36
+ schema.maximum = Number(max$1);
37
+ }
38
+ if (exclusiveMinimum) {
39
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
40
+ }
41
+ if (exclusiveMaximum) {
42
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
43
+ }
44
+ if (multipleOf !== undefined) {
45
+ schema.multipleOf = Number(multipleOf);
46
+ }
47
+ }
33
48
  const rules = [];
34
49
  if (defaultValue !== undefined) {
35
50
  rules.push(defaultTo.defaultTo(defaultValue));
36
51
  }
37
52
  rules.push(int.int(format));
38
53
  if (values$1) {
39
- rules.push(values.values(values$1.map(value => int.int(format)(value))));
54
+ rules.push(values.values(values.getArrayValues(values$1, int.int(format))));
40
55
  }
41
56
  if (min$1 !== undefined) {
42
57
  rules.push(min.min(min$1));
@@ -1,9 +1,41 @@
1
1
  import { type HandlerPlugin } from 'innet';
2
2
  import { type ValuesSchemaProps } from '../../../types';
3
3
  export interface NumberProps extends ValuesSchemaProps<number> {
4
+ /**
5
+ * The `exclusiveMaximum` keyword is used to restrict the value to be less than the specified number.
6
+ * @example For example, the following value is valid:
7
+ * ```tsx
8
+ * <number exclusiveMaximum={10} />
9
+ * ```
10
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
11
+ * */
12
+ exclusiveMaximum?: boolean;
13
+ /**
14
+ * The `exclusiveMinimum` keyword is used to restrict the value to be greater than the specified number.
15
+ * @example For example, the following value is valid:
16
+ * ```tsx
17
+ * <number exclusiveMinimum={10} />
18
+ * ```
19
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
20
+ * */
21
+ exclusiveMinimum?: boolean;
22
+ /**
23
+ * An optional format modifier serves as a hint at the contents and format of the string.
24
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
25
+ * */
26
+ format?: 'double' | 'float' | (string & {});
4
27
  /** Validate the number value by maximum. */
5
28
  max?: number;
6
29
  /** Validate the number value by minimum. */
7
30
  min?: number;
31
+ /**
32
+ * The `multipleOf` keyword is used to restrict the value to be a multiple of the specified number.
33
+ * @example For example, the following value is valid:
34
+ * ```tsx
35
+ * <number multipleOf={2} />
36
+ * ```
37
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
38
+ * */
39
+ multipleOf?: number;
8
40
  }
9
41
  export declare const number: HandlerPlugin;
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
5
5
  import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
6
6
  import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
7
7
  import { num } from '../../../utils/rules/num/num.es6.js';
8
- import { values } from '../../../utils/rules/values/values.es6.js';
8
+ import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
9
9
  import { min } from '../../../utils/rules/min/min.es6.js';
10
10
  import { max } from '../../../utils/rules/max/max.es6.js';
11
11
  import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
@@ -13,19 +13,35 @@ import { useRule } from '../../../hooks/useRule/useRule.es6.js';
13
13
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
14
14
 
15
15
  const number = () => {
16
- const { max: max$1, min: min$1, ...props } = useProps() || {};
16
+ const { exclusiveMaximum, exclusiveMinimum, format, max: max$1, min: min$1, multipleOf, ...props } = useProps() || {};
17
17
  const schema = useSchemaType('number', props);
18
- // @ts-expect-error: FIXME
19
- schema.minimum = min$1;
20
- // @ts-expect-error: FIXME
21
- schema.maximum = max$1;
18
+ if (schema) {
19
+ if (format !== undefined) {
20
+ schema.format = format;
21
+ }
22
+ if (min$1 !== undefined) {
23
+ schema.minimum = min$1;
24
+ }
25
+ if (max$1 !== undefined) {
26
+ schema.maximum = max$1;
27
+ }
28
+ if (exclusiveMinimum) {
29
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
30
+ }
31
+ if (exclusiveMaximum) {
32
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
33
+ }
34
+ if (multipleOf !== undefined) {
35
+ schema.multipleOf = Number(multipleOf);
36
+ }
37
+ }
22
38
  const rules = [];
23
39
  if (props.default !== undefined) {
24
40
  rules.push(defaultTo(props.default));
25
41
  }
26
42
  rules.push(num);
27
43
  if (props.values) {
28
- rules.push(values(props.values));
44
+ rules.push(values(getArrayValues(props.values, Number)));
29
45
  }
30
46
  if (min$1 !== undefined) {
31
47
  rules.push(min(min$1));
@@ -17,19 +17,35 @@ var useRule = require('../../../hooks/useRule/useRule.js');
17
17
  var pipe = require('../../../utils/rules/pipe/pipe.js');
18
18
 
19
19
  const number = () => {
20
- const { max: max$1, min: min$1, ...props } = jsx.useProps() || {};
20
+ const { exclusiveMaximum, exclusiveMinimum, format, max: max$1, min: min$1, multipleOf, ...props } = jsx.useProps() || {};
21
21
  const schema = useSchemaType.useSchemaType('number', props);
22
- // @ts-expect-error: FIXME
23
- schema.minimum = min$1;
24
- // @ts-expect-error: FIXME
25
- schema.maximum = max$1;
22
+ if (schema) {
23
+ if (format !== undefined) {
24
+ schema.format = format;
25
+ }
26
+ if (min$1 !== undefined) {
27
+ schema.minimum = min$1;
28
+ }
29
+ if (max$1 !== undefined) {
30
+ schema.maximum = max$1;
31
+ }
32
+ if (exclusiveMinimum) {
33
+ schema.exclusiveMinimum = typeof exclusiveMinimum === 'boolean' ? exclusiveMinimum : Number(exclusiveMinimum);
34
+ }
35
+ if (exclusiveMaximum) {
36
+ schema.exclusiveMaximum = typeof exclusiveMaximum === 'boolean' ? exclusiveMaximum : Number(exclusiveMaximum);
37
+ }
38
+ if (multipleOf !== undefined) {
39
+ schema.multipleOf = Number(multipleOf);
40
+ }
41
+ }
26
42
  const rules = [];
27
43
  if (props.default !== undefined) {
28
44
  rules.push(defaultTo.defaultTo(props.default));
29
45
  }
30
46
  rules.push(num.num);
31
47
  if (props.values) {
32
- rules.push(values.values(props.values));
48
+ rules.push(values.values(values.getArrayValues(props.values, Number)));
33
49
  }
34
50
  if (min$1 !== undefined) {
35
51
  rules.push(min.min(min$1));
@@ -1,6 +1,5 @@
1
- import innet, { useNewHandler } from 'innet';
1
+ import { useNewHandler, innet } from 'innet';
2
2
  import { useProps } from '@innet/jsx';
3
- import { callHandler } from '@innet/utils';
4
3
  import '../../../hooks/index.es6.js';
5
4
  import '../../../hooks/useParentRule/index.es6.js';
6
5
  import '../../../utils/index.es6.js';
@@ -15,6 +14,8 @@ import { objectOf } from '../../../utils/rules/objectOf/objectOf.es6.js';
15
14
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
16
15
  import { useRule, ruleContext } from '../../../hooks/useRule/useRule.es6.js';
17
16
  import { objectRuleContext } from '../../../hooks/useObjectRule/useObjectRule.es6.js';
17
+ import { useEffect } from '../../../hooks/useEffect/useEffect.es6.js';
18
+ import { getSafeSchema } from '../../../utils/getSafeSchema/getSafeSchema.es6.js';
18
19
 
19
20
  const object = () => {
20
21
  useBlock('path');
@@ -52,11 +53,12 @@ const object = () => {
52
53
  });
53
54
  parentRuleContext.reset(handler);
54
55
  innet(children, handler);
55
- innet(() => {
56
- if (!Object.keys(schema.additionalProperties).length) {
57
- delete schema.additionalProperties;
56
+ useEffect(() => {
57
+ const safeSchema = getSafeSchema(schema);
58
+ if (!Object.keys(safeSchema.additionalProperties).length) {
59
+ delete safeSchema.additionalProperties;
58
60
  }
59
- }, callHandler);
61
+ });
60
62
  }
61
63
  else if (props.ref) {
62
64
  useRule(refRules[props.ref]);
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var innet = require('innet');
6
6
  var jsx = require('@innet/jsx');
7
- var utils = require('@innet/utils');
8
7
  require('../../../hooks/index.js');
9
8
  require('../../../hooks/useParentRule/index.js');
10
9
  require('../../../utils/index.js');
@@ -19,10 +18,8 @@ var objectOf = require('../../../utils/rules/objectOf/objectOf.js');
19
18
  var pipe = require('../../../utils/rules/pipe/pipe.js');
20
19
  var useRule = require('../../../hooks/useRule/useRule.js');
21
20
  var useObjectRule = require('../../../hooks/useObjectRule/useObjectRule.js');
22
-
23
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
24
-
25
- var innet__default = /*#__PURE__*/_interopDefaultLegacy(innet);
21
+ var useEffect = require('../../../hooks/useEffect/useEffect.js');
22
+ var getSafeSchema = require('../../../utils/getSafeSchema/getSafeSchema.js');
26
23
 
27
24
  const object = () => {
28
25
  useBlock.useBlock('path');
@@ -59,12 +56,13 @@ const object = () => {
59
56
  childRule = rule;
60
57
  });
61
58
  useParentRule.parentRuleContext.reset(handler);
62
- innet__default["default"](children, handler);
63
- innet__default["default"](() => {
64
- if (!Object.keys(schema.additionalProperties).length) {
65
- delete schema.additionalProperties;
59
+ innet.innet(children, handler);
60
+ useEffect.useEffect(() => {
61
+ const safeSchema = getSafeSchema.getSafeSchema(schema);
62
+ if (!Object.keys(safeSchema.additionalProperties).length) {
63
+ delete safeSchema.additionalProperties;
66
64
  }
67
- }, utils.callHandler);
65
+ });
68
66
  }
69
67
  else if (props.ref) {
70
68
  useRule.useRule(refRules[props.ref]);
@@ -1,9 +1,36 @@
1
1
  import { type HandlerPlugin } from 'innet';
2
2
  import { type ValuesSchemaProps } from '../../../types';
3
3
  export interface StringProps extends ValuesSchemaProps<string> {
4
+ /**
5
+ * An optional format modifier serves as a hint at the contents and format of the string.
6
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
7
+ * */
8
+ format?: 'binary' | 'byte' | 'date' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'password' | 'uri' | 'uuid' | (string & {});
9
+ /**
10
+ * String length can be restricted using `min` and `max`.
11
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
12
+ * */
4
13
  max?: number;
14
+ /**
15
+ * String length can be restricted using `min` and `max`.
16
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
17
+ * */
5
18
  min?: number;
19
+ /**
20
+ * The pattern keyword lets you define a regular expression template for the string value.
21
+ * Only the values that match this template will be accepted.
22
+ * The regular expression syntax used is from JavaScript (more specifically, ECMA 262).
23
+ * Regular expressions are case-sensitive, that is, [a-z] and [A-Z] are different expressions.
24
+ * @example For example, the following pattern matches a Social Security Number (SSN) in the 123-45-6789 format:
25
+ * ```tsx
26
+ * <string pattern='^\d{3}-\d{2}-\d{4}$' />
27
+ * ```
28
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
29
+ * */
6
30
  pattern?: RegExp | string;
31
+ /**
32
+ * The `patternId` keyword is used to reference a pattern from the OpenAPI specification.
33
+ * */
7
34
  patternId?: string;
8
35
  }
9
36
  export declare const string: HandlerPlugin;
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
5
5
  import { useApi } from '../../../hooks/useApi/useApi.es6.js';
6
6
  import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
7
7
  import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
8
- import { values } from '../../../utils/rules/values/values.es6.js';
8
+ import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
9
9
  import { minLength } from '../../../utils/rules/minLength/minLength.es6.js';
10
10
  import { maxLength } from '../../../utils/rules/maxLength/maxLength.es6.js';
11
11
  import { pattern } from '../../../utils/rules/pattern/pattern.es6.js';
@@ -14,24 +14,30 @@ import { useRule } from '../../../hooks/useRule/useRule.es6.js';
14
14
  import { useParentRule } from '../../../hooks/useParentRule/useParentRule.es6.js';
15
15
 
16
16
  const string = () => {
17
- const { max, min, pattern: pattern$1, patternId, ...props } = useProps() || {};
17
+ const { format, max, min, pattern: pattern$1, patternId, ...props } = useProps() || {};
18
18
  const { refRules } = useApi();
19
19
  const schema = useSchemaType('string', props);
20
20
  if (schema) {
21
21
  const rules = [];
22
+ if (format !== undefined) {
23
+ schema.format = format;
24
+ }
22
25
  if (props.default !== undefined) {
23
26
  rules.push(defaultTo(props.default));
24
27
  }
25
28
  rules.push(String);
26
29
  if (props.values) {
27
- rules.push(values(props.values));
30
+ rules.push(values(getArrayValues(props.values)));
31
+ }
32
+ if (format !== undefined) {
33
+ schema.format = format;
28
34
  }
29
35
  if (min !== undefined) {
30
- schema.minimum = min;
36
+ schema.minLength = min;
31
37
  rules.push(minLength(min));
32
38
  }
33
39
  if (max !== undefined) {
34
- schema.maximum = max;
40
+ schema.maxLength = max;
35
41
  rules.push(maxLength(max));
36
42
  }
37
43
  if (pattern$1 !== undefined) {
@@ -18,24 +18,30 @@ var useRule = require('../../../hooks/useRule/useRule.js');
18
18
  var useParentRule = require('../../../hooks/useParentRule/useParentRule.js');
19
19
 
20
20
  const string = () => {
21
- const { max, min, pattern: pattern$1, patternId, ...props } = jsx.useProps() || {};
21
+ const { format, max, min, pattern: pattern$1, patternId, ...props } = jsx.useProps() || {};
22
22
  const { refRules } = useApi.useApi();
23
23
  const schema = useSchemaType.useSchemaType('string', props);
24
24
  if (schema) {
25
25
  const rules = [];
26
+ if (format !== undefined) {
27
+ schema.format = format;
28
+ }
26
29
  if (props.default !== undefined) {
27
30
  rules.push(defaultTo.defaultTo(props.default));
28
31
  }
29
32
  rules.push(String);
30
33
  if (props.values) {
31
- rules.push(values.values(props.values));
34
+ rules.push(values.values(values.getArrayValues(props.values)));
35
+ }
36
+ if (format !== undefined) {
37
+ schema.format = format;
32
38
  }
33
39
  if (min !== undefined) {
34
- schema.minimum = min;
40
+ schema.minLength = min;
35
41
  rules.push(minLength.minLength(min));
36
42
  }
37
43
  if (max !== undefined) {
38
- schema.maximum = max;
44
+ schema.maxLength = max;
39
45
  rules.push(maxLength.maxLength(max));
40
46
  }
41
47
  if (pattern$1 !== undefined) {
@@ -1,6 +1,5 @@
1
- import innet, { useNewHandler } from 'innet';
1
+ import { useNewHandler, innet } from 'innet';
2
2
  import { useProps } from '@innet/jsx';
3
- import { callHandler } from '@innet/utils';
4
3
  import '../../../hooks/index.es6.js';
5
4
  import '../../../hooks/useParentRule/index.es6.js';
6
5
  import '../../../utils/index.es6.js';
@@ -13,6 +12,7 @@ import { useParentRule, parentRuleContext } from '../../../hooks/useParentRule/u
13
12
  import { useRule, ruleContext } from '../../../hooks/useRule/useRule.es6.js';
14
13
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
15
14
  import { required } from '../../../utils/rules/required/required.es6.js';
15
+ import { useEffect } from '../../../hooks/useEffect/useEffect.es6.js';
16
16
 
17
17
  const tuple = () => {
18
18
  useBlock('path');
@@ -42,11 +42,11 @@ const tuple = () => {
42
42
  rulesMap.push(rule);
43
43
  });
44
44
  innet(children, handler);
45
- innet(() => {
45
+ useEffect(() => {
46
46
  if (!rulesMap.length) {
47
47
  throw Error('<tuple> MUST have content');
48
48
  }
49
- }, callHandler);
49
+ });
50
50
  }
51
51
  };
52
52
 
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var innet = require('innet');
6
6
  var jsx = require('@innet/jsx');
7
- var utils = require('@innet/utils');
8
7
  require('../../../hooks/index.js');
9
8
  require('../../../hooks/useParentRule/index.js');
10
9
  require('../../../utils/index.js');
@@ -17,10 +16,7 @@ var useParentRule = require('../../../hooks/useParentRule/useParentRule.js');
17
16
  var useRule = require('../../../hooks/useRule/useRule.js');
18
17
  var pipe = require('../../../utils/rules/pipe/pipe.js');
19
18
  var required = require('../../../utils/rules/required/required.js');
20
-
21
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
-
23
- var innet__default = /*#__PURE__*/_interopDefaultLegacy(innet);
19
+ var useEffect = require('../../../hooks/useEffect/useEffect.js');
24
20
 
25
21
  const tuple = () => {
26
22
  useBlock.useBlock('path');
@@ -49,12 +45,12 @@ const tuple = () => {
49
45
  useRule.ruleContext.set(handler, rule => {
50
46
  rulesMap.push(rule);
51
47
  });
52
- innet__default["default"](children, handler);
53
- innet__default["default"](() => {
48
+ innet.innet(children, handler);
49
+ useEffect.useEffect(() => {
54
50
  if (!rulesMap.length) {
55
51
  throw Error('<tuple> MUST have content');
56
52
  }
57
- }, utils.callHandler);
53
+ });
58
54
  }
59
55
  };
60
56
 
@@ -5,7 +5,7 @@ import '../../../utils/index.es6.js';
5
5
  import { useSchemaType } from '../../../hooks/useSchemaType/useSchemaType.es6.js';
6
6
  import { defaultTo } from '../../../utils/rules/defaultTo/defaultTo.es6.js';
7
7
  import { uuidTo } from '../../../utils/rules/uuidTo/uuidTo.es6.js';
8
- import { values } from '../../../utils/rules/values/values.es6.js';
8
+ import { values, getArrayValues } from '../../../utils/rules/values/values.es6.js';
9
9
  import { useRule } from '../../../hooks/useRule/useRule.es6.js';
10
10
  import { optional } from '../../../utils/rules/optional/optional.es6.js';
11
11
  import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
@@ -28,7 +28,7 @@ const uuid = () => {
28
28
  }
29
29
  rules.push(uuidTo);
30
30
  if (props.values) {
31
- rules.push(values(props.values));
31
+ rules.push(values(getArrayValues(props.values)));
32
32
  }
33
33
  if (defaultValue === undefined) {
34
34
  useRule(optional(pipe(...rules)));
@@ -32,7 +32,7 @@ const uuid = () => {
32
32
  }
33
33
  rules.push(uuidTo.uuidTo);
34
34
  if (props.values) {
35
- rules.push(values.values(props.values));
35
+ rules.push(values.values(values.getArrayValues(props.values)));
36
36
  }
37
37
  if (defaultValue === undefined) {
38
38
  useRule.useRule(optional.optional(pipe.pipe(...rules)));
@@ -3,13 +3,16 @@ import { promises } from 'node:fs';
3
3
  import '../../../hooks/index.es6.js';
4
4
  import '../../../utils/index.es6.js';
5
5
  import { useApi } from '../../../hooks/useApi/useApi.es6.js';
6
+ import { useEffect } from '../../../hooks/useEffect/useEffect.es6.js';
6
7
  import { generateTypes } from '../../../utils/generateTypes/generateTypes.es6.js';
7
8
 
8
9
  const dts = () => {
9
10
  const { namespace = process.env.INNET_DTS_NAMESPACE, path = process.env.INNET_DTS_PATH || 'src/apiTypes.d.ts', } = useProps() || {};
10
11
  const { docs } = useApi();
11
- promises.writeFile(path, generateTypes(docs, namespace)).catch(e => {
12
- console.error(e);
12
+ useEffect(() => {
13
+ promises.writeFile(path, generateTypes(docs, namespace)).catch(e => {
14
+ console.error(e);
15
+ });
13
16
  });
14
17
  };
15
18
 
@@ -7,13 +7,16 @@ var fs = require('node:fs');
7
7
  require('../../../hooks/index.js');
8
8
  require('../../../utils/index.js');
9
9
  var useApi = require('../../../hooks/useApi/useApi.js');
10
+ var useEffect = require('../../../hooks/useEffect/useEffect.js');
10
11
  var generateTypes = require('../../../utils/generateTypes/generateTypes.js');
11
12
 
12
13
  const dts = () => {
13
14
  const { namespace = process.env.INNET_DTS_NAMESPACE, path = process.env.INNET_DTS_PATH || 'src/apiTypes.d.ts', } = jsx.useProps() || {};
14
15
  const { docs } = useApi.useApi();
15
- fs.promises.writeFile(path, generateTypes.generateTypes(docs, namespace)).catch(e => {
16
- console.error(e);
16
+ useEffect.useEffect(() => {
17
+ fs.promises.writeFile(path, generateTypes.generateTypes(docs, namespace)).catch(e => {
18
+ console.error(e);
19
+ });
17
20
  });
18
21
  };
19
22
 
@@ -1,4 +1,4 @@
1
- import innet, { useHandler } from 'innet';
1
+ import { innet, useHandler } from 'innet';
2
2
  import { useProps } from '@innet/jsx';
3
3
 
4
4
  const env = () => {
@@ -5,14 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var innet = require('innet');
6
6
  var jsx = require('@innet/jsx');
7
7
 
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var innet__default = /*#__PURE__*/_interopDefaultLegacy(innet);
11
-
12
8
  const env = () => {
13
9
  const { children, is, of = 'NODE_ENV', } = jsx.useProps();
14
10
  if (Array.isArray(is) ? is.includes(process.env[of]) : process.env[of] === is) {
15
- innet__default["default"](children, innet.useHandler());
11
+ innet.innet(children, innet.useHandler());
16
12
  }
17
13
  };
18
14
 
@@ -1,6 +1,7 @@
1
- export * from './swagger';
1
+ export * from './blacklist';
2
2
  export * from './dts';
3
3
  export * from './env';
4
4
  export * from './protection';
5
- export * from './blacklist';
5
+ export * from './swagger';
6
+ export * from './ui';
6
7
  export * from './whitelist';
@@ -1,6 +1,7 @@
1
- import './swagger/index.es6.js';
1
+ import './blacklist/index.es6.js';
2
2
  import './dts/index.es6.js';
3
3
  import './env/index.es6.js';
4
4
  import './protection/index.es6.js';
5
- import './blacklist/index.es6.js';
5
+ import './swagger/index.es6.js';
6
+ import './ui/index.es6.js';
6
7
  import './whitelist/index.es6.js';
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- require('./swagger/index.js');
3
+ require('./blacklist/index.js');
4
4
  require('./dts/index.js');
5
5
  require('./env/index.js');
6
6
  require('./protection/index.js');
7
- require('./blacklist/index.js');
7
+ require('./swagger/index.js');
8
+ require('./ui/index.js');
8
9
  require('./whitelist/index.js');
9
10
 
@@ -2,4 +2,5 @@ import { type HandlerPlugin } from 'innet';
2
2
  export interface SwaggerProps {
3
3
  path?: string;
4
4
  }
5
+ /** @deprecated Use <ui> */
5
6
  export declare const swagger: HandlerPlugin;
@@ -5,6 +5,7 @@ import { useApi } from '../../../hooks/useApi/useApi.es6.js';
5
5
  import { useServerPlugin } from '../../../hooks/useServerPlugin/useServerPlugin.es6.js';
6
6
  import { useAction } from '../../../hooks/useAction/useAction.es6.js';
7
7
 
8
+ /** @deprecated Use <ui> */
8
9
  const swagger = () => {
9
10
  const { path = process.env.INNET_SWAGGER_PATH || '/swagger-ui', } = useProps() || {};
10
11
  const { docs, prefix, } = useApi();
@@ -9,6 +9,7 @@ var useApi = require('../../../hooks/useApi/useApi.js');
9
9
  var useServerPlugin = require('../../../hooks/useServerPlugin/useServerPlugin.js');
10
10
  var useAction = require('../../../hooks/useAction/useAction.js');
11
11
 
12
+ /** @deprecated Use <ui> */
12
13
  const swagger = () => {
13
14
  const { path = process.env.INNET_SWAGGER_PATH || '/swagger-ui', } = jsx.useProps() || {};
14
15
  const { docs, prefix, } = useApi.useApi();
@@ -0,0 +1 @@
1
+ export * from './ui';
@@ -0,0 +1 @@
1
+ export { ui, uiPresets } from './ui.es6.js';
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var ui = require('./ui.js');
6
+
7
+
8
+
9
+ exports.ui = ui.ui;
10
+ exports.uiPresets = ui.uiPresets;
@@ -0,0 +1,3 @@
1
+ var rapidoc = "<!doctype html>\n<html>\n<head>\n <script type=\"module\" src=\"https://unpkg.com/rapidoc/dist/rapidoc-min.js\"></script>\n</head>\n<body>\n<rapi-doc spec-url=\"{apiUrl}\" {attributes}></rapi-doc>\n</body>\n</html>\n";
2
+
3
+ export { rapidoc as default };