@innet/server 2.0.0-beta.8 → 2.0.0-beta.9

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 (273) hide show
  1. package/constants.d.ts +4 -0
  2. package/handler/handler.d.ts +106 -0
  3. package/handler/index.d.ts +1 -0
  4. package/hooks/index.d.ts +33 -0
  5. package/hooks/useAction/index.d.ts +1 -0
  6. package/hooks/useAction/useAction.d.ts +4 -0
  7. package/hooks/useApi/index.d.ts +1 -0
  8. package/hooks/useApi/useApi.d.ts +11 -0
  9. package/hooks/useBlock/index.d.ts +1 -0
  10. package/hooks/useBlock/useBlock.d.ts +2 -0
  11. package/hooks/useBody/index.d.ts +1 -0
  12. package/hooks/useBody/useBody.d.ts +1 -0
  13. package/hooks/useBodyFile/index.d.ts +1 -0
  14. package/hooks/useBodyFile/useBodyFile.d.ts +3 -0
  15. package/hooks/useClientIp/index.d.ts +1 -0
  16. package/hooks/useClientIp/useClientIp.d.ts +1 -0
  17. package/hooks/useComponentName/index.d.ts +1 -0
  18. package/hooks/useComponentName/useComponentName.d.ts +1 -0
  19. package/hooks/useCookies/index.d.ts +1 -0
  20. package/hooks/useCookies/useCookies.d.ts +1 -0
  21. package/hooks/useEffect/index.d.ts +1 -0
  22. package/hooks/useEffect/useEffect.d.ts +2 -0
  23. package/hooks/useEndpoint/index.d.ts +1 -0
  24. package/hooks/useEndpoint/useEndpoint.d.ts +10 -0
  25. package/hooks/useHeaders/index.d.ts +1 -0
  26. package/hooks/useHeaders/useHeaders.d.ts +2 -0
  27. package/hooks/useHost/index.d.ts +1 -0
  28. package/hooks/useHost/useHost.d.ts +7 -0
  29. package/hooks/useIsServerHttps/index.d.ts +1 -0
  30. package/hooks/useIsServerHttps/useIsServerHttps.d.ts +3 -0
  31. package/hooks/useNewSchema/index.d.ts +1 -0
  32. package/hooks/useNewSchema/useNewSchema.d.ts +2 -0
  33. package/hooks/useNewSchema/useNewSchema.es6.js +1 -0
  34. package/hooks/useNewSchema/useNewSchema.js +1 -0
  35. package/hooks/useObjectRule/index.d.ts +1 -0
  36. package/hooks/useObjectRule/useObjectRule.d.ts +4 -0
  37. package/hooks/useObjectSchemaContext/index.d.ts +1 -0
  38. package/hooks/useObjectSchemaContext/useObjectSchemaContext.d.ts +3 -0
  39. package/hooks/useOneElementError/index.d.ts +1 -0
  40. package/hooks/useOneElementError/useOneElementError.d.ts +1 -0
  41. package/hooks/useParam/index.d.ts +1 -0
  42. package/hooks/useParam/useParam.d.ts +7 -0
  43. package/hooks/useParams/index.d.ts +1 -0
  44. package/hooks/useParams/useParams.d.ts +3 -0
  45. package/hooks/useParentRule/index.d.ts +1 -0
  46. package/hooks/useParentRule/useParentRule.d.ts +4 -0
  47. package/hooks/usePath/index.d.ts +1 -0
  48. package/hooks/usePath/usePath.d.ts +1 -0
  49. package/hooks/useRequest/index.d.ts +1 -0
  50. package/hooks/useRequest/useRequest.d.ts +1 -0
  51. package/hooks/useRequestHandler/index.d.ts +1 -0
  52. package/hooks/useRequestHandler/useRequestHandler.d.ts +4 -0
  53. package/hooks/useResponse/index.d.ts +1 -0
  54. package/hooks/useResponse/useResponse.d.ts +1 -0
  55. package/hooks/useRule/index.d.ts +1 -0
  56. package/hooks/useRule/useRule.d.ts +6 -0
  57. package/hooks/useSchemaContext/index.d.ts +1 -0
  58. package/hooks/useSchemaContext/useSchemaContext.d.ts +5 -0
  59. package/hooks/useSchemaType/index.d.ts +1 -0
  60. package/hooks/useSchemaType/useSchemaType.d.ts +5 -0
  61. package/hooks/useSearch/index.d.ts +1 -0
  62. package/hooks/useSearch/useSearch.d.ts +1 -0
  63. package/hooks/useServer/index.d.ts +1 -0
  64. package/hooks/useServer/useServer.d.ts +10 -0
  65. package/hooks/useServerPlugin/index.d.ts +1 -0
  66. package/hooks/useServerPlugin/useServerPlugin.d.ts +2 -0
  67. package/hooks/useServerPlugins/index.d.ts +1 -0
  68. package/hooks/useServerPlugins/useServerPlugins.d.ts +4 -0
  69. package/hooks/useServerPort/index.d.ts +1 -0
  70. package/hooks/useServerPort/useServerPort.d.ts +3 -0
  71. package/hooks/useTag/index.d.ts +1 -0
  72. package/hooks/useTag/useTag.d.ts +3 -0
  73. package/hooks/useThrow/index.d.ts +1 -0
  74. package/hooks/useThrow/useThrow.d.ts +1 -0
  75. package/index.d.ts +6 -0
  76. package/package.json +1 -1
  77. package/plugins/handler/index.d.ts +1 -0
  78. package/plugins/handler/serverFn/index.d.ts +1 -0
  79. package/plugins/handler/serverFn/serverFn.d.ts +2 -0
  80. package/plugins/index.d.ts +5 -0
  81. package/plugins/main/api/api.d.ts +25 -0
  82. package/plugins/main/api/index.d.ts +1 -0
  83. package/plugins/main/body/body.d.ts +5 -0
  84. package/plugins/main/body/index.d.ts +1 -0
  85. package/plugins/main/contact/contact.d.ts +10 -0
  86. package/plugins/main/contact/index.d.ts +1 -0
  87. package/plugins/main/endpoint/endpoint.d.ts +43 -0
  88. package/plugins/main/endpoint/endpoint.es6.js +2 -0
  89. package/plugins/main/endpoint/endpoint.js +2 -0
  90. package/plugins/main/endpoint/index.d.ts +1 -0
  91. package/plugins/main/host/host.d.ts +16 -0
  92. package/plugins/main/host/host.es6.js +1 -0
  93. package/plugins/main/host/host.js +1 -0
  94. package/plugins/main/host/index.d.ts +1 -0
  95. package/plugins/main/index.d.ts +13 -0
  96. package/plugins/main/license/index.d.ts +1 -0
  97. package/plugins/main/license/license.d.ts +21 -0
  98. package/plugins/main/param/index.d.ts +1 -0
  99. package/plugins/main/param/param.d.ts +36 -0
  100. package/plugins/main/preset/index.d.ts +1 -0
  101. package/plugins/main/preset/preset.d.ts +3 -0
  102. package/plugins/main/response/index.d.ts +1 -0
  103. package/plugins/main/response/response.d.ts +21 -0
  104. package/plugins/main/return/index.d.ts +1 -0
  105. package/plugins/main/return/return.d.ts +4 -0
  106. package/plugins/main/server/index.d.ts +1 -0
  107. package/plugins/main/server/server.d.ts +13 -0
  108. package/plugins/main/tag/index.d.ts +1 -0
  109. package/plugins/main/tag/tag.d.ts +19 -0
  110. package/plugins/main/tag/tag.es6.js +1 -0
  111. package/plugins/main/tag/tag.js +1 -0
  112. package/plugins/main/variable/index.d.ts +1 -0
  113. package/plugins/main/variable/variable.d.ts +24 -0
  114. package/plugins/main/variable/variable.es6.js +4 -1
  115. package/plugins/main/variable/variable.js +4 -1
  116. package/plugins/request/cms/cms.d.ts +6 -0
  117. package/plugins/request/cms/index.d.ts +1 -0
  118. package/plugins/request/cookie/cookie.d.ts +7 -0
  119. package/plugins/request/cookie/index.d.ts +1 -0
  120. package/plugins/request/error/error.d.ts +61 -0
  121. package/plugins/request/error/index.d.ts +1 -0
  122. package/plugins/request/file/file.d.ts +5 -0
  123. package/plugins/request/file/index.d.ts +1 -0
  124. package/plugins/request/header/header.d.ts +6 -0
  125. package/plugins/request/header/index.d.ts +1 -0
  126. package/plugins/request/index.d.ts +8 -0
  127. package/plugins/request/proxy/index.d.ts +1 -0
  128. package/plugins/request/proxy/proxy.d.ts +8 -0
  129. package/plugins/request/redirect/index.d.ts +1 -0
  130. package/plugins/request/redirect/redirect.d.ts +18 -0
  131. package/plugins/request/redirect/redirect.es6.js +1 -0
  132. package/plugins/request/redirect/redirect.js +1 -0
  133. package/plugins/request/success/index.d.ts +1 -0
  134. package/plugins/request/success/success.d.ts +19 -0
  135. package/plugins/schema/any/any.d.ts +5 -0
  136. package/plugins/schema/any/index.d.ts +1 -0
  137. package/plugins/schema/array/array.d.ts +9 -0
  138. package/plugins/schema/array/index.d.ts +1 -0
  139. package/plugins/schema/binary/binary.d.ts +9 -0
  140. package/plugins/schema/binary/index.d.ts +1 -0
  141. package/plugins/schema/boolean/boolean.d.ts +5 -0
  142. package/plugins/schema/boolean/index.d.ts +1 -0
  143. package/plugins/schema/date/date.d.ts +8 -0
  144. package/plugins/schema/date/date.es6.js +6 -0
  145. package/plugins/schema/date/date.js +6 -0
  146. package/plugins/schema/date/index.d.ts +1 -0
  147. package/plugins/schema/field/field.d.ts +10 -0
  148. package/plugins/schema/field/index.d.ts +1 -0
  149. package/plugins/schema/index.d.ts +13 -0
  150. package/plugins/schema/integer/index.d.ts +1 -0
  151. package/plugins/schema/integer/integer.d.ts +45 -0
  152. package/plugins/schema/null/index.d.ts +1 -0
  153. package/plugins/schema/null/null.d.ts +5 -0
  154. package/plugins/schema/number/index.d.ts +1 -0
  155. package/plugins/schema/number/number.d.ts +41 -0
  156. package/plugins/schema/object/index.d.ts +1 -0
  157. package/plugins/schema/object/object.d.ts +6 -0
  158. package/plugins/schema/string/index.d.ts +1 -0
  159. package/plugins/schema/string/string.d.ts +36 -0
  160. package/plugins/schema/tuple/index.d.ts +1 -0
  161. package/plugins/schema/tuple/tuple.d.ts +6 -0
  162. package/plugins/schema/tuple/tuple.es6.js +1 -0
  163. package/plugins/schema/tuple/tuple.js +1 -0
  164. package/plugins/schema/uuid/index.d.ts +1 -0
  165. package/plugins/schema/uuid/uuid.d.ts +6 -0
  166. package/plugins/schema/uuid/uuid.es6.js +2 -0
  167. package/plugins/schema/uuid/uuid.js +2 -0
  168. package/plugins/utils/blacklist/blacklist.d.ts +5 -0
  169. package/plugins/utils/blacklist/index.d.ts +1 -0
  170. package/plugins/utils/dts/dts.d.ts +6 -0
  171. package/plugins/utils/dts/index.d.ts +1 -0
  172. package/plugins/utils/env/env.d.ts +7 -0
  173. package/plugins/utils/env/index.d.ts +1 -0
  174. package/plugins/utils/index.d.ts +7 -0
  175. package/plugins/utils/protection/index.d.ts +1 -0
  176. package/plugins/utils/protection/protection.d.ts +9 -0
  177. package/plugins/utils/swagger/index.d.ts +1 -0
  178. package/plugins/utils/swagger/swagger.d.ts +6 -0
  179. package/plugins/utils/swagger/swagger.es6.js +1 -0
  180. package/plugins/utils/swagger/swagger.js +1 -0
  181. package/plugins/utils/ui/index.d.ts +1 -0
  182. package/plugins/utils/ui/ui.d.ts +13 -0
  183. package/plugins/utils/whitelist/index.d.ts +1 -0
  184. package/plugins/utils/whitelist/whitelist.d.ts +5 -0
  185. package/types.d.ts +69 -0
  186. package/utils/FileData/Bin.d.ts +47 -0
  187. package/utils/FileData/index.d.ts +1 -0
  188. package/utils/JSONString/JSONString.d.ts +1 -0
  189. package/utils/JSONString/index.d.ts +1 -0
  190. package/utils/action/Action.d.ts +31 -0
  191. package/utils/action/index.d.ts +1 -0
  192. package/utils/dateFormat/dateFormat.d.ts +2 -0
  193. package/utils/dateFormat/index.d.ts +1 -0
  194. package/utils/decorators/index.d.ts +1 -0
  195. package/utils/decorators/once/index.d.ts +1 -0
  196. package/utils/decorators/once/once.d.ts +4 -0
  197. package/utils/decorators/once/once.es6.js +4 -0
  198. package/utils/decorators/once/once.js +4 -0
  199. package/utils/generateTypes/generateTypes.d.ts +3 -0
  200. package/utils/generateTypes/generateTypes.es6.js +1 -0
  201. package/utils/generateTypes/generateTypes.js +1 -0
  202. package/utils/generateTypes/index.d.ts +1 -0
  203. package/utils/getEndpoint/getEndpoint.d.ts +2 -0
  204. package/utils/getEndpoint/index.d.ts +1 -0
  205. package/utils/getOrAdd/getOrAdd.d.ts +1 -0
  206. package/utils/getOrAdd/index.d.ts +1 -0
  207. package/utils/getSafeSchema/getSafeSchema.d.ts +2 -0
  208. package/utils/getSafeSchema/index.d.ts +1 -0
  209. package/utils/httpOnStart/httpOnStart.d.ts +2 -0
  210. package/utils/httpOnStart/index.d.ts +1 -0
  211. package/utils/index.d.ts +14 -0
  212. package/utils/parseBody/index.d.ts +1 -0
  213. package/utils/parseBody/parseBody.d.ts +2 -0
  214. package/utils/parseFormBody/index.d.ts +1 -0
  215. package/utils/parseFormBody/parseFormBody.d.ts +2 -0
  216. package/utils/parseSearch/index.d.ts +1 -0
  217. package/utils/parseSearch/parseSearch.d.ts +3 -0
  218. package/utils/rules/arrayOf/arrayOf.d.ts +2 -0
  219. package/utils/rules/arrayOf/index.d.ts +1 -0
  220. package/utils/rules/bin/bin.d.ts +2 -0
  221. package/utils/rules/bin/index.d.ts +1 -0
  222. package/utils/rules/binaryAccept/binaryAccept.d.ts +2 -0
  223. package/utils/rules/binaryAccept/index.d.ts +1 -0
  224. package/utils/rules/constants.d.ts +1 -0
  225. package/utils/rules/dateTo/dateTo.d.ts +2 -0
  226. package/utils/rules/dateTo/index.d.ts +1 -0
  227. package/utils/rules/defaultTo/defaultTo.d.ts +1 -0
  228. package/utils/rules/defaultTo/index.d.ts +1 -0
  229. package/utils/rules/helpers.d.ts +8 -0
  230. package/utils/rules/index.d.ts +28 -0
  231. package/utils/rules/int/index.d.ts +1 -0
  232. package/utils/rules/int/int.d.ts +2 -0
  233. package/utils/rules/max/index.d.ts +1 -0
  234. package/utils/rules/max/max.d.ts +1 -0
  235. package/utils/rules/maxBin/index.d.ts +1 -0
  236. package/utils/rules/maxBin/maxBin.d.ts +2 -0
  237. package/utils/rules/maxDate/index.d.ts +1 -0
  238. package/utils/rules/maxDate/maxDate.d.ts +1 -0
  239. package/utils/rules/maxLength/index.d.ts +1 -0
  240. package/utils/rules/maxLength/maxLength.d.ts +1 -0
  241. package/utils/rules/min/index.d.ts +1 -0
  242. package/utils/rules/min/min.d.ts +1 -0
  243. package/utils/rules/minBin/index.d.ts +1 -0
  244. package/utils/rules/minBin/minBin.d.ts +2 -0
  245. package/utils/rules/minDate/index.d.ts +1 -0
  246. package/utils/rules/minDate/minDate.d.ts +1 -0
  247. package/utils/rules/minLength/index.d.ts +1 -0
  248. package/utils/rules/minLength/minLength.d.ts +1 -0
  249. package/utils/rules/nullable/index.d.ts +1 -0
  250. package/utils/rules/nullable/nullable.d.ts +1 -0
  251. package/utils/rules/num/index.d.ts +1 -0
  252. package/utils/rules/num/num.d.ts +1 -0
  253. package/utils/rules/objectOf/index.d.ts +1 -0
  254. package/utils/rules/objectOf/objectOf.d.ts +3 -0
  255. package/utils/rules/oneOf/index.d.ts +1 -0
  256. package/utils/rules/oneOf/oneOf.d.ts +2 -0
  257. package/utils/rules/optional/index.d.ts +1 -0
  258. package/utils/rules/optional/optional.d.ts +2 -0
  259. package/utils/rules/pattern/index.d.ts +1 -0
  260. package/utils/rules/pattern/pattern.d.ts +1 -0
  261. package/utils/rules/pipe/index.d.ts +1 -0
  262. package/utils/rules/pipe/pipe.d.ts +2 -0
  263. package/utils/rules/required/index.d.ts +1 -0
  264. package/utils/rules/required/required.d.ts +2 -0
  265. package/utils/rules/tupleOf/index.d.ts +1 -0
  266. package/utils/rules/tupleOf/tupleOf.d.ts +2 -0
  267. package/utils/rules/types.d.ts +4 -0
  268. package/utils/rules/uuidTo/index.d.ts +1 -0
  269. package/utils/rules/uuidTo/uuidTo.d.ts +1 -0
  270. package/utils/rules/values/index.d.ts +1 -0
  271. package/utils/rules/values/values.d.ts +1 -0
  272. package/utils/stringifySearch/index.d.ts +1 -0
  273. package/utils/stringifySearch/stringifySearch.d.ts +2 -0
@@ -0,0 +1,10 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ export interface FieldProps {
3
+ children?: any;
4
+ deprecated?: boolean;
5
+ key: string;
6
+ optional?: boolean;
7
+ readOnly?: boolean;
8
+ writeOnly?: boolean;
9
+ }
10
+ export declare const field: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './field';
@@ -0,0 +1,13 @@
1
+ export * from './any';
2
+ export * from './array';
3
+ export * from './binary';
4
+ export * from './boolean';
5
+ export * from './date';
6
+ export * from './field';
7
+ export * from './integer';
8
+ export * from './null';
9
+ export * from './number';
10
+ export * from './object';
11
+ export * from './string';
12
+ export * from './tuple';
13
+ export * from './uuid';
@@ -0,0 +1 @@
1
+ export * from './integer';
@@ -0,0 +1,45 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type IntegerFormats, type ValuesSchemaProps } from '../../../types';
3
+ export interface IntegerProps extends ValuesSchemaProps<bigint | 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
+ * <integer exclusiveMaximum={10} />
9
+ * ```
10
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
11
+ * */
12
+ exclusiveMaximum?: bigint | boolean | number;
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
+ * <integer exclusiveMinimum={10} />
18
+ * ```
19
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
20
+ * */
21
+ exclusiveMinimum?: bigint | boolean | number;
22
+ /**
23
+ * An optional format modifier serves as a hint at the contents and format of the string.
24
+ * @example For example, the following value is valid:
25
+ * ```tsx
26
+ * <integer format='int64' />
27
+ * ```
28
+ * @see https://swagger.io/docs/specification/data-models/data-types/#numbers
29
+ * */
30
+ format?: IntegerFormats;
31
+ /** Validate the integer number value by maximum. */
32
+ max?: bigint | number;
33
+ /** Validate the integer number value by minimum. */
34
+ min?: bigint | number;
35
+ /**
36
+ * The `multipleOf` keyword is used to restrict the value to be a multiple of the specified number.
37
+ * @example For example, the following value is valid:
38
+ * ```tsx
39
+ * <number multipleOf={2} />
40
+ * ```
41
+ * @see https://swagger.io/docs/specification/v3_0/data-models/data-types/#numbers
42
+ * */
43
+ multipleOf?: bigint | number;
44
+ }
45
+ export declare const integer: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './null';
@@ -0,0 +1,5 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type BaseSchemaProps } from '../../../types';
3
+ export interface NullProps extends BaseSchemaProps<null> {
4
+ }
5
+ export declare const nullPlugin: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './number';
@@ -0,0 +1,41 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type ValuesSchemaProps } from '../../../types';
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 & {});
27
+ /** Validate the number value by maximum. */
28
+ max?: number;
29
+ /** Validate the number value by minimum. */
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;
40
+ }
41
+ export declare const number: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './object';
@@ -0,0 +1,6 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type BaseSchemaProps } from '../../../types';
3
+ export interface ObjectProps extends BaseSchemaProps<object> {
4
+ children?: any;
5
+ }
6
+ export declare const object: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './string';
@@ -0,0 +1,36 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type ValuesSchemaProps } from '../../../types';
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
+ * */
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
+ * */
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
+ * */
30
+ pattern?: RegExp | string;
31
+ /**
32
+ * The `patternId` keyword is used to reference a pattern from the OpenAPI specification.
33
+ * */
34
+ patternId?: string;
35
+ }
36
+ export declare const string: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './tuple';
@@ -0,0 +1,6 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type BaseSchemaProps } from '../../../types';
3
+ export interface TupleProps extends BaseSchemaProps<any[]> {
4
+ children?: any;
5
+ }
6
+ export declare const tuple: HandlerPlugin;
@@ -22,6 +22,7 @@ const tuple = () => {
22
22
  if (schema) {
23
23
  const schemas = [];
24
24
  handler[schemaContext.key] = schemas;
25
+ // @ts-expect-error: FIXME
25
26
  schema.prefixItems = schemas;
26
27
  const rulesMap = [];
27
28
  const rules = [];
@@ -26,6 +26,7 @@ const tuple = () => {
26
26
  if (schema) {
27
27
  const schemas = [];
28
28
  handler[useSchemaContext.schemaContext.key] = schemas;
29
+ // @ts-expect-error: FIXME
29
30
  schema.prefixItems = schemas;
30
31
  const rulesMap = [];
31
32
  const rules = [];
@@ -0,0 +1 @@
1
+ export * from './uuid';
@@ -0,0 +1,6 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ import { type ValuesSchemaProps } from '../../../types';
3
+ export interface UuidProps extends ValuesSchemaProps<string> {
4
+ default?: 'new' | string;
5
+ }
6
+ export declare const uuid: HandlerPlugin;
@@ -16,8 +16,10 @@ const uuid = () => {
16
16
  ...props,
17
17
  default: defaultValue === 'new' ? undefined : defaultValue,
18
18
  });
19
+ // @ts-expect-error: FIXME
19
20
  schema.format = 'uuid';
20
21
  if (defaultValue === 'new') {
22
+ // @ts-expect-error: FIXME
21
23
  schema['x-default'] = defaultValue;
22
24
  }
23
25
  const rules = [];
@@ -20,8 +20,10 @@ const uuid = () => {
20
20
  ...props,
21
21
  default: defaultValue === 'new' ? undefined : defaultValue,
22
22
  });
23
+ // @ts-expect-error: FIXME
23
24
  schema.format = 'uuid';
24
25
  if (defaultValue === 'new') {
26
+ // @ts-expect-error: FIXME
25
27
  schema['x-default'] = defaultValue;
26
28
  }
27
29
  const rules = [];
@@ -0,0 +1,5 @@
1
+ export interface BlacklistProps {
2
+ children?: any;
3
+ ip?: string | string[];
4
+ }
5
+ export declare function blacklist(): void;
@@ -0,0 +1 @@
1
+ export * from './blacklist';
@@ -0,0 +1,6 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ export interface DtsProps {
3
+ namespace?: string;
4
+ path?: string;
5
+ }
6
+ export declare const dts: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './dts';
@@ -0,0 +1,7 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ export interface EnvProps {
3
+ children?: any;
4
+ is: string | string[];
5
+ of?: string;
6
+ }
7
+ export declare const env: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './env';
@@ -0,0 +1,7 @@
1
+ export * from './blacklist';
2
+ export * from './dts';
3
+ export * from './env';
4
+ export * from './protection';
5
+ export * from './swagger';
6
+ export * from './ui';
7
+ export * from './whitelist';
@@ -0,0 +1 @@
1
+ export * from './protection';
@@ -0,0 +1,9 @@
1
+ export interface ProtectionProps {
2
+ children?: any;
3
+ cookieKey?: string;
4
+ excludeIp?: string | string[];
5
+ maxAge?: number;
6
+ searchKey?: string;
7
+ value?: string;
8
+ }
9
+ export declare function protection(): void;
@@ -0,0 +1 @@
1
+ export * from './swagger';
@@ -0,0 +1,6 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ export interface SwaggerProps {
3
+ path?: string;
4
+ }
5
+ /** @deprecated Use <ui> */
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,13 @@
1
+ import { type HandlerPlugin } from 'innet';
2
+ export declare const uiPresets: {
3
+ rapidoc: string;
4
+ redoc: string;
5
+ scalar: string;
6
+ swagger: string;
7
+ };
8
+ export interface UiProps {
9
+ html?: string;
10
+ params?: Record<string, any>;
11
+ path?: string;
12
+ }
13
+ export declare const ui: HandlerPlugin;
@@ -0,0 +1 @@
1
+ export * from './whitelist';
@@ -0,0 +1,5 @@
1
+ export interface WhitelistProps {
2
+ children?: any;
3
+ ip?: string | string[];
4
+ }
5
+ export declare function whitelist(): void;
package/types.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ import type { OpenAPIV3_1 as API } from 'openapi-types';
2
+ import type { ApiErrorValue } from './constants';
3
+ import { type ServerPlugin } from './hooks';
4
+ import { type Rule, type RulesErrors } from './utils/rules';
5
+ export type TagObject = API.TagObject;
6
+ export type Document = API.Document;
7
+ export type ServerObject = API.ServerObject;
8
+ export type OperationObject = API.OperationObject;
9
+ export type ResponseObject = API.ResponseObject;
10
+ export type SchemaObject = API.SchemaObject;
11
+ export type ArraySchemaObjectType = API.ArraySchemaObjectType;
12
+ export type NonArraySchemaObjectType = API.NonArraySchemaObjectType;
13
+ export type ArraySchemaObject = API.ArraySchemaObject;
14
+ export type ReferenceObject = API.ReferenceObject;
15
+ export type ParameterObject = API.ParameterObject;
16
+ export type RequestBodyObject = API.RequestBodyObject;
17
+ export type ObjectType = ArraySchemaObjectType | NonArraySchemaObjectType;
18
+ export type RefSchemaObject = ReferenceObject | SchemaObject;
19
+ export type Effect = () => void;
20
+ export interface IValidationErrorData extends Record<string, any> {
21
+ error: RulesErrors;
22
+ }
23
+ export type ValidationErrorData = IValidationErrorData | undefined;
24
+ export interface EndpointRules {
25
+ body?: Rule;
26
+ cookie?: Rule;
27
+ header?: Rule;
28
+ path?: Rule;
29
+ response?: Rule;
30
+ search?: Rule;
31
+ }
32
+ export interface EndpointRulesMaps {
33
+ cookie?: Record<string, Rule>;
34
+ header?: Record<string, Rule>;
35
+ path?: Record<string, Rule>;
36
+ search?: Record<string, Rule>;
37
+ }
38
+ export interface Endpoint<I = unknown, O = unknown, E extends ApiErrorValue = ApiErrorValue, P extends InValidationErrorParam = InValidationErrorParam, D extends ValidationErrorData = ValidationErrorData> {
39
+ dynamic?: Endpoint<I, O, E, P, D>[];
40
+ key: string;
41
+ plugins: Set<ServerPlugin>;
42
+ rules?: EndpointRules;
43
+ rulesMaps?: EndpointRulesMaps;
44
+ static?: Record<string, Endpoint<I, O, E, P, D>>;
45
+ }
46
+ export type IntegerFormats = 'int32' | 'int64';
47
+ export type EndpointsMethods = 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
48
+ export type InParam = 'cookie' | 'header' | 'path' | 'query';
49
+ export type InValidationErrorParam = 'body' | InParam;
50
+ export type BodyType = 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data';
51
+ export type Endpoints<I = unknown, O = unknown, E extends ApiErrorValue = ApiErrorValue, P extends InValidationErrorParam = InValidationErrorParam, D extends ValidationErrorData = ValidationErrorData> = Partial<Record<EndpointsMethods, Endpoint<I, O, E, P, D>>>;
52
+ export interface SSL {
53
+ cert: string;
54
+ key: string;
55
+ }
56
+ export interface ServerStartParams {
57
+ https: boolean;
58
+ port: number;
59
+ }
60
+ export interface BaseSchemaProps<T> {
61
+ default?: T;
62
+ description?: string;
63
+ example?: T;
64
+ examples?: T[];
65
+ ref?: string;
66
+ }
67
+ export interface ValuesSchemaProps<T> extends BaseSchemaProps<T> {
68
+ values?: T[];
69
+ }
@@ -0,0 +1,47 @@
1
+ export interface BinOptions {
2
+ disposition: string;
3
+ /**
4
+ * A field name of FormData request
5
+ */
6
+ fieldName: string;
7
+ /**
8
+ * Full origin file name
9
+ */
10
+ originalFilename: string;
11
+ /**
12
+ * Full path to the file on server, you MUST use it only on server side for the safe
13
+ */
14
+ path: string;
15
+ /**
16
+ * The file size
17
+ */
18
+ size: number;
19
+ /**
20
+ * MIME-type of the file
21
+ */
22
+ type: string;
23
+ }
24
+ export declare class Bin implements BinOptions {
25
+ disposition: string;
26
+ /**
27
+ * The extension of the origin file from originalFilename
28
+ */
29
+ extension?: string;
30
+ fieldName: string;
31
+ /**
32
+ * A file name, without extension
33
+ */
34
+ filename: string;
35
+ originalFilename: string;
36
+ path: string;
37
+ size: number;
38
+ type: string;
39
+ constructor(options: BinOptions);
40
+ toJSON(): {
41
+ $: string;
42
+ disposition: string;
43
+ originalFilename: string;
44
+ size: number;
45
+ type: string;
46
+ };
47
+ }
@@ -0,0 +1 @@
1
+ export * from './Bin';
@@ -0,0 +1 @@
1
+ export declare function JSONString(target: any): string;
@@ -0,0 +1 @@
1
+ export * from './JSONString';
@@ -0,0 +1,31 @@
1
+ import { type Cookies, type SerializeOptions } from 'cookie';
2
+ import { type IncomingHttpHeaders, type IncomingMessage, type ServerResponse } from 'http';
3
+ import { type ParsedQs } from 'qs';
4
+ import { type BodyType } from '../../types';
5
+ export declare const URL_PARSER: RegExp;
6
+ export interface ParsedUrl {
7
+ path: string;
8
+ search?: string;
9
+ }
10
+ export declare class Action {
11
+ #private;
12
+ readonly req: IncomingMessage;
13
+ readonly res: ServerResponse;
14
+ body?: object;
15
+ constructor(req: IncomingMessage, res: ServerResponse);
16
+ parseBody(): Promise<void>;
17
+ setCookie(name: string, value?: string, options?: SerializeOptions): void;
18
+ get bodyType(): BodyType | undefined;
19
+ get clientIp(): string | null;
20
+ get cookies(): Cookies;
21
+ set cookies(value: Record<string, string>);
22
+ get headers(): IncomingHttpHeaders;
23
+ set headers(value: IncomingHttpHeaders);
24
+ get originCookies(): Cookies;
25
+ get originHeaders(): IncomingHttpHeaders;
26
+ get originSearch(): ParsedQs;
27
+ get parsedUrl(): ParsedUrl;
28
+ get path(): string;
29
+ get search(): ParsedQs;
30
+ set search(value: ParsedQs);
31
+ }
@@ -0,0 +1 @@
1
+ export * from './Action';
@@ -0,0 +1,2 @@
1
+ export type DateFormat = 'now' | Date | number | string;
2
+ export declare function dateFormat(date?: DateFormat): Date | undefined;
@@ -0,0 +1 @@
1
+ export * from './dateFormat';
@@ -0,0 +1 @@
1
+ export * from './once';
@@ -0,0 +1 @@
1
+ export * from './once';
@@ -0,0 +1,4 @@
1
+ export declare function once<This, Args extends any[], Result = unknown>(target: (this: This, ...args: Args) => Result, context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Result>): any;
2
+ export declare function once<This, Args extends any[]>(target: (this: This, value: Args[0]) => void, context: ClassSetterDecoratorContext<This, Args[0]>): any;
3
+ export declare function once<This, Value>(value: () => Value, context: ClassGetterDecoratorContext<This, Value>): any;
4
+ export declare function once<This, Args extends any[], Result = unknown>(target: undefined, context: ClassFieldDecoratorContext<This, (...args: Args) => Result>): any;
@@ -1,5 +1,6 @@
1
1
  const secretKey = Symbol('once');
2
2
  function getCacheObject(target) {
3
+ // @ts-expect-error: FIXME
3
4
  return target[secretKey] || (target[secretKey] = {});
4
5
  }
5
6
  function once(target, context) {
@@ -9,14 +10,17 @@ function once(target, context) {
9
10
  return function () {
10
11
  if (cache !== secretKey)
11
12
  return cache;
13
+ // @ts-expect-error: FIXME
12
14
  return (cache = ('apply' in fn ? fn.apply(this, arguments) : fn(...arguments)));
13
15
  };
14
16
  }
15
17
  : function once() {
18
+ // @ts-expect-error: FIXME
16
19
  const map = getCacheObject(this);
17
20
  if (context.name in map) {
18
21
  return map[context.name];
19
22
  }
23
+ // @ts-expect-error: FIXME
20
24
  return (map[context.name] = target.apply(this, arguments));
21
25
  };
22
26
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const secretKey = Symbol('once');
6
6
  function getCacheObject(target) {
7
+ // @ts-expect-error: FIXME
7
8
  return target[secretKey] || (target[secretKey] = {});
8
9
  }
9
10
  function once(target, context) {
@@ -13,14 +14,17 @@ function once(target, context) {
13
14
  return function () {
14
15
  if (cache !== secretKey)
15
16
  return cache;
17
+ // @ts-expect-error: FIXME
16
18
  return (cache = ('apply' in fn ? fn.apply(this, arguments) : fn(...arguments)));
17
19
  };
18
20
  }
19
21
  : function once() {
22
+ // @ts-expect-error: FIXME
20
23
  const map = getCacheObject(this);
21
24
  if (context.name in map) {
22
25
  return map[context.name];
23
26
  }
27
+ // @ts-expect-error: FIXME
24
28
  return (map[context.name] = target.apply(this, arguments));
25
29
  };
26
30
  }
@@ -0,0 +1,3 @@
1
+ import { type Document, type SchemaObject } from '../../types';
2
+ export declare function generateSchemaTypes(schema: SchemaObject, spaces?: number, lastChar?: string): string;
3
+ export declare function generateTypes(docs: Document, namespace?: string): string;
@@ -95,6 +95,7 @@ function generateTypes(docs, namespace = 'Api') {
95
95
  for (const path in paths) {
96
96
  const pathObject = paths[path];
97
97
  for (const method in pathObject) {
98
+ // @ts-expect-error: FIXME
98
99
  const endpoint = pathObject[method];
99
100
  const parameters = endpoint.parameters;
100
101
  const requestBody = endpoint.requestBody;
@@ -99,6 +99,7 @@ function generateTypes(docs, namespace = 'Api') {
99
99
  for (const path in paths) {
100
100
  const pathObject = paths[path];
101
101
  for (const method in pathObject) {
102
+ // @ts-expect-error: FIXME
102
103
  const endpoint = pathObject[method];
103
104
  const parameters = endpoint.parameters;
104
105
  const requestBody = endpoint.requestBody;
@@ -0,0 +1 @@
1
+ export * from './generateTypes';
@@ -0,0 +1,2 @@
1
+ import { type Endpoint } from '../../types';
2
+ export declare function getEndpoint(path: string, parentEndpoint: Endpoint): Endpoint<unknown, unknown, "requestValidation" | "requestBodyContentType", import("../../types").InValidationErrorParam, import("../../types").ValidationErrorData> | undefined;
@@ -0,0 +1 @@
1
+ export * from './getEndpoint';
@@ -0,0 +1 @@
1
+ export declare function getOrAdd<R = any>(target: object, path: number | string, defaultValues: any[]): R;