@innet/server 2.0.0-alpha.23 → 2.0.0-alpha.25

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 (132) hide show
  1. package/handler/handler.d.ts +5 -5
  2. package/handler/handler.es6.js +3 -3
  3. package/handler/handler.js +3 -3
  4. package/hooks/index.d.ts +1 -0
  5. package/hooks/index.es6.js +1 -0
  6. package/hooks/index.js +1 -0
  7. package/hooks/useClientIp/useClientIp.d.ts +1 -1
  8. package/hooks/useEndpoint/useEndpoint.d.ts +1 -1
  9. package/hooks/useSchemaType/useSchemaType.d.ts +3 -3
  10. package/hooks/useSchemaType/useSchemaType.es6.js +5 -5
  11. package/hooks/useSchemaType/useSchemaType.js +5 -5
  12. package/hooks/useServer/useServer.d.ts +1 -1
  13. package/hooks/useServerPort/index.d.ts +1 -0
  14. package/hooks/useServerPort/index.es6.js +1 -0
  15. package/hooks/useServerPort/index.js +10 -0
  16. package/hooks/useServerPort/useServerPort.d.ts +3 -0
  17. package/hooks/useServerPort/useServerPort.es6.js +14 -0
  18. package/hooks/useServerPort/useServerPort.js +19 -0
  19. package/index.es6.js +1 -0
  20. package/index.js +3 -0
  21. package/package.json +1 -1
  22. package/plugins/main/api/api.d.ts +10 -10
  23. package/plugins/main/api/api.es6.js +7 -7
  24. package/plugins/main/api/api.js +7 -7
  25. package/plugins/main/contact/contact.d.ts +2 -2
  26. package/plugins/main/endpoint/endpoint.d.ts +15 -15
  27. package/plugins/main/endpoint/endpoint.es6.js +3 -3
  28. package/plugins/main/endpoint/endpoint.js +3 -3
  29. package/plugins/main/host/host.d.ts +5 -5
  30. package/plugins/main/license/license.d.ts +5 -5
  31. package/plugins/main/param/param.d.ts +11 -11
  32. package/plugins/main/param/param.es6.js +3 -3
  33. package/plugins/main/param/param.js +3 -3
  34. package/plugins/main/response/response.d.ts +1 -1
  35. package/plugins/main/response/response.es6.js +2 -2
  36. package/plugins/main/response/response.js +2 -2
  37. package/plugins/main/server/server.d.ts +4 -4
  38. package/plugins/main/server/server.es6.js +9 -7
  39. package/plugins/main/server/server.js +9 -7
  40. package/plugins/main/tag/tag.d.ts +2 -2
  41. package/plugins/main/tag/tag.es6.js +1 -1
  42. package/plugins/main/tag/tag.js +1 -1
  43. package/plugins/main/variable/variable.d.ts +5 -5
  44. package/plugins/main/variable/variable.es6.js +3 -1
  45. package/plugins/main/variable/variable.js +3 -1
  46. package/plugins/request/cms/cms.es6.js +2 -2
  47. package/plugins/request/cms/cms.js +2 -2
  48. package/plugins/request/error/error.d.ts +40 -40
  49. package/plugins/request/error/error.es6.js +42 -42
  50. package/plugins/request/error/error.js +42 -42
  51. package/plugins/request/file/file.es6.js +2 -3
  52. package/plugins/request/file/file.js +2 -3
  53. package/plugins/request/header/header.es6.js +1 -1
  54. package/plugins/request/header/header.js +1 -1
  55. package/plugins/request/proxy/proxy.d.ts +2 -2
  56. package/plugins/request/proxy/proxy.es6.js +2 -2
  57. package/plugins/request/proxy/proxy.js +2 -2
  58. package/plugins/request/redirect/redirect.d.ts +7 -7
  59. package/plugins/request/redirect/redirect.es6.js +7 -7
  60. package/plugins/request/redirect/redirect.js +7 -7
  61. package/plugins/request/success/success.d.ts +6 -6
  62. package/plugins/request/success/success.es6.js +8 -8
  63. package/plugins/request/success/success.js +8 -8
  64. package/plugins/schema/binary/binary.d.ts +3 -3
  65. package/plugins/schema/date/date.d.ts +1 -1
  66. package/plugins/schema/date/date.es6.js +3 -3
  67. package/plugins/schema/date/date.js +3 -3
  68. package/plugins/schema/field/field.es6.js +1 -1
  69. package/plugins/schema/field/field.js +1 -1
  70. package/plugins/schema/integer/integer.d.ts +3 -3
  71. package/plugins/schema/integer/integer.es6.js +1 -1
  72. package/plugins/schema/integer/integer.js +1 -1
  73. package/plugins/schema/number/number.d.ts +2 -2
  74. package/plugins/schema/number/number.es6.js +1 -1
  75. package/plugins/schema/number/number.js +1 -1
  76. package/plugins/schema/string/string.d.ts +2 -2
  77. package/plugins/schema/string/string.es6.js +1 -1
  78. package/plugins/schema/string/string.js +1 -1
  79. package/plugins/utils/dts/dts.d.ts +1 -1
  80. package/plugins/utils/dts/dts.es6.js +1 -1
  81. package/plugins/utils/dts/dts.js +1 -1
  82. package/plugins/utils/env/env.d.ts +1 -1
  83. package/plugins/utils/env/env.es6.js +1 -1
  84. package/plugins/utils/env/env.js +1 -1
  85. package/plugins/utils/protection/protection.d.ts +3 -3
  86. package/plugins/utils/protection/protection.es6.js +3 -3
  87. package/plugins/utils/protection/protection.js +3 -3
  88. package/plugins/utils/swagger/swagger.es6.js +1 -1
  89. package/plugins/utils/swagger/swagger.js +1 -1
  90. package/types.d.ts +13 -13
  91. package/utils/FileData/Bin.d.ts +13 -13
  92. package/utils/FileData/Bin.es6.js +2 -2
  93. package/utils/FileData/Bin.js +2 -2
  94. package/utils/action/Action.d.ts +12 -12
  95. package/utils/action/Action.es6.js +80 -80
  96. package/utils/action/Action.js +79 -79
  97. package/utils/dateFormat/dateFormat.d.ts +1 -1
  98. package/utils/dateFormat/dateFormat.es6.js +1 -1
  99. package/utils/dateFormat/dateFormat.js +1 -1
  100. package/utils/generateTypes/generateTypes.es6.js +3 -3
  101. package/utils/generateTypes/generateTypes.js +3 -3
  102. package/utils/getOrAdd/getOrAdd.d.ts +1 -1
  103. package/utils/httpOnStart/httpOnStart.d.ts +1 -1
  104. package/utils/httpOnStart/httpOnStart.es6.js +1 -1
  105. package/utils/httpOnStart/httpOnStart.js +1 -1
  106. package/utils/rules/binaryAccept/binaryAccept.es6.js +2 -2
  107. package/utils/rules/binaryAccept/binaryAccept.js +2 -2
  108. package/utils/rules/dateTo/dateTo.d.ts +1 -1
  109. package/utils/rules/helpers.d.ts +1 -1
  110. package/utils/rules/int/int.es6.js +2 -2
  111. package/utils/rules/int/int.js +2 -2
  112. package/utils/rules/max/max.d.ts +1 -1
  113. package/utils/rules/max/max.es6.js +3 -3
  114. package/utils/rules/max/max.js +3 -3
  115. package/utils/rules/maxBin/maxBin.es6.js +2 -2
  116. package/utils/rules/maxBin/maxBin.js +2 -2
  117. package/utils/rules/maxDate/maxDate.es6.js +1 -1
  118. package/utils/rules/maxDate/maxDate.js +1 -1
  119. package/utils/rules/maxLength/maxLength.es6.js +2 -2
  120. package/utils/rules/maxLength/maxLength.js +2 -2
  121. package/utils/rules/min/min.d.ts +1 -1
  122. package/utils/rules/min/min.es6.js +3 -3
  123. package/utils/rules/min/min.js +3 -3
  124. package/utils/rules/minBin/minBin.es6.js +2 -2
  125. package/utils/rules/minBin/minBin.js +2 -2
  126. package/utils/rules/minDate/minDate.es6.js +1 -1
  127. package/utils/rules/minDate/minDate.js +1 -1
  128. package/utils/rules/minLength/minLength.es6.js +2 -2
  129. package/utils/rules/minLength/minLength.js +2 -2
  130. package/utils/rules/pattern/pattern.d.ts +1 -1
  131. package/utils/rules/pattern/pattern.es6.js +2 -1
  132. package/utils/rules/pattern/pattern.js +2 -1
@@ -1 +1 @@
1
- export declare function getOrAdd<R = any>(target: object, path: string | number, defaultValues: any[]): R;
1
+ export declare function getOrAdd<R = any>(target: object, path: number | string, defaultValues: any[]): R;
@@ -1,2 +1,2 @@
1
1
  import { type ServerStartParams } from '../../types';
2
- export declare function httpOnStart({ port, https }: ServerStartParams): void;
2
+ export declare function httpOnStart({ https, port, }: ServerStartParams): void;
@@ -1,4 +1,4 @@
1
- function httpOnStart({ port, https }) {
1
+ function httpOnStart({ https, port, }) {
2
2
  console.log(`http${https ? 's' : ''}://localhost:${port}`);
3
3
  }
4
4
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function httpOnStart({ port, https }) {
5
+ function httpOnStart({ https, port, }) {
6
6
  console.log(`http${https ? 's' : ''}://localhost:${port}`);
7
7
  }
8
8
 
@@ -24,8 +24,8 @@ function binaryAccept(accept) {
24
24
  continue;
25
25
  return value;
26
26
  }
27
- throw new RulesError('binaryAccept', Object.assign({ value,
28
- accept }, data));
27
+ throw new RulesError('binaryAccept', Object.assign({ accept,
28
+ value }, data));
29
29
  };
30
30
  }
31
31
 
@@ -28,8 +28,8 @@ function binaryAccept(accept) {
28
28
  continue;
29
29
  return value;
30
30
  }
31
- throw new helpers.RulesError('binaryAccept', Object.assign({ value,
32
- accept }, data));
31
+ throw new helpers.RulesError('binaryAccept', Object.assign({ accept,
32
+ value }, data));
33
33
  };
34
34
  }
35
35
 
@@ -1,2 +1,2 @@
1
- export type DateFormat = 'now' | string | number | Date;
1
+ export type DateFormat = 'now' | Date | number | string;
2
2
  export declare function dateTo(value: any, data?: object): Date;
@@ -5,4 +5,4 @@ export declare class RulesError extends Error {
5
5
  } & object;
6
6
  constructor(error: RulesErrors, data?: object);
7
7
  }
8
- export declare function addKey(key: string | number, data?: any): string | number;
8
+ export declare function addKey(key: number | string, data?: any): string | number;
@@ -24,10 +24,10 @@ function int(format) {
24
24
  value }, data));
25
25
  }
26
26
  if (result > sizes[format]) {
27
- throw new RulesError('integer', Object.assign({ format, value: result, max: sizes[format] }, data));
27
+ throw new RulesError('integer', Object.assign({ format, max: sizes[format], value: result }, data));
28
28
  }
29
29
  if (result < -sizes[format]) {
30
- throw new RulesError('integer', Object.assign({ format, value: result, min: -sizes[format] }, data));
30
+ throw new RulesError('integer', Object.assign({ format, min: -sizes[format], value: result }, data));
31
31
  }
32
32
  return result;
33
33
  };
@@ -28,10 +28,10 @@ function int(format) {
28
28
  value }, data));
29
29
  }
30
30
  if (result > sizes[format]) {
31
- throw new helpers.RulesError('integer', Object.assign({ format, value: result, max: sizes[format] }, data));
31
+ throw new helpers.RulesError('integer', Object.assign({ format, max: sizes[format], value: result }, data));
32
32
  }
33
33
  if (result < -sizes[format]) {
34
- throw new helpers.RulesError('integer', Object.assign({ format, value: result, min: -sizes[format] }, data));
34
+ throw new helpers.RulesError('integer', Object.assign({ format, min: -sizes[format], value: result }, data));
35
35
  }
36
36
  return result;
37
37
  };
@@ -1 +1 @@
1
- export declare function max(max: number | bigint): (value: any, data?: object) => any;
1
+ export declare function max(max: bigint | number): (value: any, data?: object) => any;
@@ -2,12 +2,12 @@ import { RulesError } from '../helpers.es6.js';
2
2
 
3
3
  function max(max) {
4
4
  return (value, data) => {
5
- if (!['number', 'bigint'].includes(typeof value)) {
5
+ if (!['bigint', 'number'].includes(typeof value)) {
6
6
  throw new RulesError('number', Object.assign(Object.assign({}, data), { value }));
7
7
  }
8
8
  if (value > max) {
9
- throw new RulesError('maximum', Object.assign(Object.assign({}, data), { value,
10
- max }));
9
+ throw new RulesError('maximum', Object.assign(Object.assign({}, data), { max,
10
+ value }));
11
11
  }
12
12
  return value;
13
13
  };
@@ -6,12 +6,12 @@ var helpers = require('../helpers.js');
6
6
 
7
7
  function max(max) {
8
8
  return (value, data) => {
9
- if (!['number', 'bigint'].includes(typeof value)) {
9
+ if (!['bigint', 'number'].includes(typeof value)) {
10
10
  throw new helpers.RulesError('number', Object.assign(Object.assign({}, data), { value }));
11
11
  }
12
12
  if (value > max) {
13
- throw new helpers.RulesError('maximum', Object.assign(Object.assign({}, data), { value,
14
- max }));
13
+ throw new helpers.RulesError('maximum', Object.assign(Object.assign({}, data), { max,
14
+ value }));
15
15
  }
16
16
  return value;
17
17
  };
@@ -3,8 +3,8 @@ import { RulesError } from '../helpers.es6.js';
3
3
  function maxBin(max) {
4
4
  return (value, data) => {
5
5
  if (value.size > max) {
6
- throw new RulesError('maxBin', Object.assign({ value,
7
- max }, data));
6
+ throw new RulesError('maxBin', Object.assign({ max,
7
+ value }, data));
8
8
  }
9
9
  return value;
10
10
  };
@@ -7,8 +7,8 @@ var helpers = require('../helpers.js');
7
7
  function maxBin(max) {
8
8
  return (value, data) => {
9
9
  if (value.size > max) {
10
- throw new helpers.RulesError('maxBin', Object.assign({ value,
11
- max }, data));
10
+ throw new helpers.RulesError('maxBin', Object.assign({ max,
11
+ value }, data));
12
12
  }
13
13
  return value;
14
14
  };
@@ -6,7 +6,7 @@ function maxDate(max) {
6
6
  throw new RulesError('date', data);
7
7
  }
8
8
  if (value > max) {
9
- throw new RulesError('maxDate', Object.assign(Object.assign({}, data), { value, max: max.toISOString() }));
9
+ throw new RulesError('maxDate', Object.assign(Object.assign({}, data), { max: max.toISOString(), value }));
10
10
  }
11
11
  return value;
12
12
  };
@@ -10,7 +10,7 @@ function maxDate(max) {
10
10
  throw new helpers.RulesError('date', data);
11
11
  }
12
12
  if (value > max) {
13
- throw new helpers.RulesError('maxDate', Object.assign(Object.assign({}, data), { value, max: max.toISOString() }));
13
+ throw new helpers.RulesError('maxDate', Object.assign(Object.assign({}, data), { max: max.toISOString(), value }));
14
14
  }
15
15
  return value;
16
16
  };
@@ -6,8 +6,8 @@ function maxLength(max) {
6
6
  throw new RulesError('string', data);
7
7
  }
8
8
  if (value.length > max) {
9
- throw new RulesError('maxLength', Object.assign(Object.assign({}, data), { value,
10
- max }));
9
+ throw new RulesError('maxLength', Object.assign(Object.assign({}, data), { max,
10
+ value }));
11
11
  }
12
12
  return value;
13
13
  };
@@ -10,8 +10,8 @@ function maxLength(max) {
10
10
  throw new helpers.RulesError('string', data);
11
11
  }
12
12
  if (value.length > max) {
13
- throw new helpers.RulesError('maxLength', Object.assign(Object.assign({}, data), { value,
14
- max }));
13
+ throw new helpers.RulesError('maxLength', Object.assign(Object.assign({}, data), { max,
14
+ value }));
15
15
  }
16
16
  return value;
17
17
  };
@@ -1 +1 @@
1
- export declare function min(min: number | bigint): (value: any, data?: object) => any;
1
+ export declare function min(min: bigint | number): (value: any, data?: object) => any;
@@ -2,12 +2,12 @@ import { RulesError } from '../helpers.es6.js';
2
2
 
3
3
  function min(min) {
4
4
  return (value, data) => {
5
- if (!['number', 'bigint'].includes(typeof value)) {
5
+ if (!['bigint', 'number'].includes(typeof value)) {
6
6
  throw new RulesError('number', Object.assign(Object.assign({}, data), { value }));
7
7
  }
8
8
  if (value < min) {
9
- throw new RulesError('minimum', Object.assign(Object.assign({}, data), { value,
10
- min }));
9
+ throw new RulesError('minimum', Object.assign(Object.assign({}, data), { min,
10
+ value }));
11
11
  }
12
12
  return value;
13
13
  };
@@ -6,12 +6,12 @@ var helpers = require('../helpers.js');
6
6
 
7
7
  function min(min) {
8
8
  return (value, data) => {
9
- if (!['number', 'bigint'].includes(typeof value)) {
9
+ if (!['bigint', 'number'].includes(typeof value)) {
10
10
  throw new helpers.RulesError('number', Object.assign(Object.assign({}, data), { value }));
11
11
  }
12
12
  if (value < min) {
13
- throw new helpers.RulesError('minimum', Object.assign(Object.assign({}, data), { value,
14
- min }));
13
+ throw new helpers.RulesError('minimum', Object.assign(Object.assign({}, data), { min,
14
+ value }));
15
15
  }
16
16
  return value;
17
17
  };
@@ -3,8 +3,8 @@ import { RulesError } from '../helpers.es6.js';
3
3
  function minBin(min) {
4
4
  return (value, data) => {
5
5
  if (value.size < min) {
6
- throw new RulesError('minBin', Object.assign({ value,
7
- min }, data));
6
+ throw new RulesError('minBin', Object.assign({ min,
7
+ value }, data));
8
8
  }
9
9
  return value;
10
10
  };
@@ -7,8 +7,8 @@ var helpers = require('../helpers.js');
7
7
  function minBin(min) {
8
8
  return (value, data) => {
9
9
  if (value.size < min) {
10
- throw new helpers.RulesError('minBin', Object.assign({ value,
11
- min }, data));
10
+ throw new helpers.RulesError('minBin', Object.assign({ min,
11
+ value }, data));
12
12
  }
13
13
  return value;
14
14
  };
@@ -6,7 +6,7 @@ function minDate(min) {
6
6
  throw new RulesError('date', data);
7
7
  }
8
8
  if (value < min) {
9
- throw new RulesError('minDate', Object.assign(Object.assign({}, data), { value, min: min.toISOString() }));
9
+ throw new RulesError('minDate', Object.assign(Object.assign({}, data), { min: min.toISOString(), value }));
10
10
  }
11
11
  return value;
12
12
  };
@@ -10,7 +10,7 @@ function minDate(min) {
10
10
  throw new helpers.RulesError('date', data);
11
11
  }
12
12
  if (value < min) {
13
- throw new helpers.RulesError('minDate', Object.assign(Object.assign({}, data), { value, min: min.toISOString() }));
13
+ throw new helpers.RulesError('minDate', Object.assign(Object.assign({}, data), { min: min.toISOString(), value }));
14
14
  }
15
15
  return value;
16
16
  };
@@ -6,8 +6,8 @@ function minLength(min) {
6
6
  throw new RulesError('string', data);
7
7
  }
8
8
  if (value.length < min) {
9
- throw new RulesError('minLength', Object.assign(Object.assign({}, data), { value,
10
- min }));
9
+ throw new RulesError('minLength', Object.assign(Object.assign({}, data), { min,
10
+ value }));
11
11
  }
12
12
  return value;
13
13
  };
@@ -10,8 +10,8 @@ function minLength(min) {
10
10
  throw new helpers.RulesError('string', data);
11
11
  }
12
12
  if (value.length < min) {
13
- throw new helpers.RulesError('minLength', Object.assign(Object.assign({}, data), { value,
14
- min }));
13
+ throw new helpers.RulesError('minLength', Object.assign(Object.assign({}, data), { min,
14
+ value }));
15
15
  }
16
16
  return value;
17
17
  };
@@ -1 +1 @@
1
- export declare function pattern(pattern: string | RegExp, patternId?: string): (value: any, data?: object) => any;
1
+ export declare function pattern(pattern: RegExp | string, patternId?: string): (value: any, data?: object) => any;
@@ -4,7 +4,8 @@ function pattern(pattern, patternId = String(pattern)) {
4
4
  const normPattern = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
5
5
  return (value, data) => {
6
6
  if (!normPattern.test(value)) {
7
- throw new RulesError('pattern', Object.assign({ value, pattern: String(normPattern), patternId }, data));
7
+ throw new RulesError('pattern', Object.assign({ pattern: String(normPattern), patternId,
8
+ value }, data));
8
9
  }
9
10
  return value;
10
11
  };
@@ -8,7 +8,8 @@ function pattern(pattern, patternId = String(pattern)) {
8
8
  const normPattern = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
9
9
  return (value, data) => {
10
10
  if (!normPattern.test(value)) {
11
- throw new helpers.RulesError('pattern', Object.assign({ value, pattern: String(normPattern), patternId }, data));
11
+ throw new helpers.RulesError('pattern', Object.assign({ pattern: String(normPattern), patternId,
12
+ value }, data));
12
13
  }
13
14
  return value;
14
15
  };