@innet/server 2.0.0-beta.1 → 2.0.0-beta.11

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 (193) hide show
  1. package/README.md +385 -9
  2. package/handler/handler.d.ts +6 -9
  3. package/handler/handler.es6.js +3 -4
  4. package/handler/handler.js +2 -3
  5. package/hooks/index.d.ts +24 -23
  6. package/hooks/index.es6.js +24 -23
  7. package/hooks/index.js +24 -23
  8. package/hooks/useEffect/index.d.ts +1 -0
  9. package/hooks/useEffect/index.es6.js +1 -0
  10. package/hooks/useEffect/index.js +9 -0
  11. package/hooks/useEffect/useEffect.d.ts +2 -0
  12. package/hooks/useEffect/useEffect.es6.js +8 -0
  13. package/hooks/useEffect/useEffect.js +12 -0
  14. package/hooks/useHeaders/useHeaders.d.ts +0 -1
  15. package/hooks/useNewSchema/useNewSchema.es6.js +1 -1
  16. package/hooks/useNewSchema/useNewSchema.js +1 -1
  17. package/hooks/useRequest/useRequest.d.ts +0 -1
  18. package/hooks/useResponse/useResponse.d.ts +0 -1
  19. package/hooks/useSchemaType/useSchemaType.es6.js +26 -9
  20. package/hooks/useSchemaType/useSchemaType.js +26 -9
  21. package/hooks/useServer/useServer.d.ts +0 -2
  22. package/index.d.ts +2 -2
  23. package/index.es6.js +89 -87
  24. package/index.js +202 -194
  25. package/package.json +16 -15
  26. package/plugins/handler/serverFn/serverFn.es6.js +2 -2
  27. package/plugins/handler/serverFn/serverFn.js +2 -6
  28. package/plugins/index.d.ts +2 -2
  29. package/plugins/index.es6.js +2 -2
  30. package/plugins/index.js +2 -2
  31. package/plugins/main/api/api.es6.js +74 -74
  32. package/plugins/main/api/api.js +75 -79
  33. package/plugins/main/body/body.es6.js +4 -4
  34. package/plugins/main/body/body.js +4 -8
  35. package/plugins/main/endpoint/endpoint.d.ts +5 -0
  36. package/plugins/main/endpoint/endpoint.es6.js +5 -5
  37. package/plugins/main/endpoint/endpoint.js +5 -9
  38. package/plugins/main/host/host.es6.js +4 -2
  39. package/plugins/main/host/host.js +4 -6
  40. package/plugins/main/index.d.ts +8 -8
  41. package/plugins/main/index.es6.js +8 -8
  42. package/plugins/main/index.js +8 -8
  43. package/plugins/main/param/param.es6.js +3 -4
  44. package/plugins/main/param/param.js +3 -8
  45. package/plugins/main/preset/preset.es6.js +1 -1
  46. package/plugins/main/preset/preset.js +1 -5
  47. package/plugins/main/response/response.es6.js +11 -4
  48. package/plugins/main/response/response.js +11 -8
  49. package/plugins/main/server/server.d.ts +0 -1
  50. package/plugins/main/server/server.es6.js +7 -10
  51. package/plugins/main/server/server.js +8 -12
  52. package/plugins/main/tag/index.es6.js +1 -1
  53. package/plugins/main/tag/index.js +1 -0
  54. package/plugins/main/tag/tag.d.ts +8 -1
  55. package/plugins/main/tag/tag.es6.js +20 -3
  56. package/plugins/main/tag/tag.js +20 -6
  57. package/plugins/main/variable/variable.es6.js +3 -4
  58. package/plugins/main/variable/variable.js +3 -4
  59. package/plugins/request/cms/cms.es6.js +1 -1
  60. package/plugins/request/cms/cms.js +2 -3
  61. package/plugins/request/cookie/cookie.d.ts +2 -2
  62. package/plugins/request/cookie/cookie.es6.js +1 -2
  63. package/plugins/request/cookie/cookie.js +1 -2
  64. package/plugins/request/error/error.es6.js +1 -2
  65. package/plugins/request/error/error.js +1 -2
  66. package/plugins/request/file/file.es6.js +2 -3
  67. package/plugins/request/file/file.js +2 -4
  68. package/plugins/request/index.d.ts +5 -5
  69. package/plugins/request/index.es6.js +5 -5
  70. package/plugins/request/index.js +5 -5
  71. package/plugins/request/proxy/proxy.d.ts +0 -1
  72. package/plugins/schema/array/array.d.ts +3 -0
  73. package/plugins/schema/array/array.es6.js +14 -6
  74. package/plugins/schema/array/array.js +15 -11
  75. package/plugins/schema/binary/binary.d.ts +4 -0
  76. package/plugins/schema/boolean/boolean.d.ts +1 -0
  77. package/plugins/schema/date/date.d.ts +2 -1
  78. package/plugins/schema/date/date.es6.js +10 -6
  79. package/plugins/schema/date/date.js +10 -6
  80. package/plugins/schema/field/field.d.ts +4 -0
  81. package/plugins/schema/field/field.es6.js +16 -3
  82. package/plugins/schema/field/field.js +16 -7
  83. package/plugins/schema/index.d.ts +8 -8
  84. package/plugins/schema/index.es6.js +8 -8
  85. package/plugins/schema/index.js +8 -8
  86. package/plugins/schema/integer/integer.d.ts +37 -0
  87. package/plugins/schema/integer/integer.es6.js +31 -11
  88. package/plugins/schema/integer/integer.js +31 -11
  89. package/plugins/schema/number/number.d.ts +32 -0
  90. package/plugins/schema/number/number.es6.js +23 -8
  91. package/plugins/schema/number/number.js +22 -7
  92. package/plugins/schema/object/object.es6.js +9 -8
  93. package/plugins/schema/object/object.js +9 -12
  94. package/plugins/schema/string/string.d.ts +27 -0
  95. package/plugins/schema/string/string.es6.js +11 -6
  96. package/plugins/schema/string/string.js +10 -5
  97. package/plugins/schema/tuple/tuple.es6.js +5 -6
  98. package/plugins/schema/tuple/tuple.js +5 -10
  99. package/plugins/schema/uuid/uuid.es6.js +7 -5
  100. package/plugins/schema/uuid/uuid.js +6 -4
  101. package/plugins/utils/dts/dts.es6.js +5 -2
  102. package/plugins/utils/dts/dts.js +5 -2
  103. package/plugins/utils/env/env.es6.js +1 -1
  104. package/plugins/utils/env/env.js +1 -5
  105. package/plugins/utils/index.d.ts +3 -2
  106. package/plugins/utils/index.es6.js +3 -2
  107. package/plugins/utils/index.js +3 -2
  108. package/plugins/utils/swagger/swagger.d.ts +1 -0
  109. package/plugins/utils/swagger/swagger.es6.js +1 -0
  110. package/plugins/utils/swagger/swagger.js +1 -0
  111. package/plugins/utils/ui/index.d.ts +1 -0
  112. package/plugins/utils/ui/index.es6.js +1 -0
  113. package/plugins/utils/ui/index.js +10 -0
  114. package/plugins/utils/ui/rapidoc.html.es6.js +3 -0
  115. package/plugins/utils/ui/rapidoc.html.js +7 -0
  116. package/plugins/utils/ui/redoc.html.es6.js +3 -0
  117. package/plugins/utils/ui/redoc.html.js +7 -0
  118. package/plugins/utils/ui/scalar.html.es6.js +3 -0
  119. package/plugins/utils/ui/scalar.html.js +7 -0
  120. package/plugins/utils/ui/swagger.html.es6.js +3 -0
  121. package/plugins/utils/ui/swagger.html.js +7 -0
  122. package/plugins/utils/ui/ui.d.ts +13 -0
  123. package/plugins/utils/ui/ui.es6.js +45 -0
  124. package/plugins/utils/ui/ui.js +50 -0
  125. package/types.d.ts +8 -1
  126. package/utils/action/Action.d.ts +4 -5
  127. package/utils/action/Action.es6.js +14 -16
  128. package/utils/action/Action.js +13 -15
  129. package/utils/getSafeSchema/getSafeSchema.d.ts +2 -0
  130. package/utils/getSafeSchema/getSafeSchema.es6.js +5 -0
  131. package/utils/getSafeSchema/getSafeSchema.js +9 -0
  132. package/utils/getSafeSchema/index.d.ts +1 -0
  133. package/utils/getSafeSchema/index.es6.js +1 -0
  134. package/utils/getSafeSchema/index.js +9 -0
  135. package/utils/index.d.ts +9 -8
  136. package/utils/index.es6.js +9 -8
  137. package/utils/index.js +9 -8
  138. package/utils/parseBody/parseBody.d.ts +0 -1
  139. package/utils/parseBody/parseBody.es6.js +13 -16
  140. package/utils/parseBody/parseBody.js +13 -16
  141. package/utils/parseFormBody/parseFormBody.d.ts +0 -1
  142. package/utils/parseFormBody/parseFormBody.es6.js +41 -41
  143. package/utils/parseFormBody/parseFormBody.js +41 -41
  144. package/utils/parseSearch/parseSearch.es6.js +4 -1
  145. package/utils/parseSearch/parseSearch.js +4 -1
  146. package/utils/rules/arrayOf/arrayOf.es6.js +1 -1
  147. package/utils/rules/arrayOf/arrayOf.js +1 -1
  148. package/utils/rules/bin/bin.es6.js +4 -1
  149. package/utils/rules/bin/bin.js +4 -1
  150. package/utils/rules/binaryAccept/binaryAccept.es6.js +5 -2
  151. package/utils/rules/binaryAccept/binaryAccept.js +5 -2
  152. package/utils/rules/dateTo/dateTo.es6.js +4 -1
  153. package/utils/rules/dateTo/dateTo.js +4 -1
  154. package/utils/rules/helpers.es6.js +4 -1
  155. package/utils/rules/helpers.js +4 -1
  156. package/utils/rules/index.d.ts +17 -17
  157. package/utils/rules/index.es6.js +17 -17
  158. package/utils/rules/index.js +18 -18
  159. package/utils/rules/int/int.es6.js +17 -4
  160. package/utils/rules/int/int.js +17 -4
  161. package/utils/rules/max/max.es6.js +9 -3
  162. package/utils/rules/max/max.js +9 -3
  163. package/utils/rules/maxBin/maxBin.es6.js +5 -2
  164. package/utils/rules/maxBin/maxBin.js +5 -2
  165. package/utils/rules/maxDate/maxDate.es6.js +5 -1
  166. package/utils/rules/maxDate/maxDate.js +5 -1
  167. package/utils/rules/maxLength/maxLength.es6.js +5 -2
  168. package/utils/rules/maxLength/maxLength.js +5 -2
  169. package/utils/rules/min/min.es6.js +9 -3
  170. package/utils/rules/min/min.js +9 -3
  171. package/utils/rules/minBin/minBin.es6.js +5 -2
  172. package/utils/rules/minBin/minBin.js +5 -2
  173. package/utils/rules/minDate/minDate.es6.js +5 -1
  174. package/utils/rules/minDate/minDate.js +5 -1
  175. package/utils/rules/minLength/minLength.es6.js +5 -2
  176. package/utils/rules/minLength/minLength.js +5 -2
  177. package/utils/rules/num/num.es6.js +4 -1
  178. package/utils/rules/num/num.js +4 -1
  179. package/utils/rules/objectOf/objectOf.es6.js +6 -3
  180. package/utils/rules/objectOf/objectOf.js +6 -3
  181. package/utils/rules/pattern/pattern.es6.js +6 -2
  182. package/utils/rules/pattern/pattern.js +6 -2
  183. package/utils/rules/tupleOf/tupleOf.es6.js +1 -1
  184. package/utils/rules/tupleOf/tupleOf.js +1 -1
  185. package/utils/rules/values/index.es6.js +1 -1
  186. package/utils/rules/values/index.js +1 -0
  187. package/utils/rules/values/values.d.ts +3 -1
  188. package/utils/rules/values/values.es6.js +9 -3
  189. package/utils/rules/values/values.js +9 -2
  190. package/utils/stringifySearch/stringifySearch.es6.js +4 -1
  191. package/utils/stringifySearch/stringifySearch.js +4 -1
  192. package/_virtual/_rollup-plugin-process-env.es6.js +0 -10
  193. package/_virtual/_rollup-plugin-process-env.js +0 -12
@@ -10,7 +10,11 @@ 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), { max: max.toISOString(), value }));
13
+ throw new helpers.RulesError('maxDate', {
14
+ ...data,
15
+ max: max.toISOString(),
16
+ value,
17
+ });
14
18
  }
15
19
  return value;
16
20
  };
@@ -6,8 +6,11 @@ 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), { max,
10
- value }));
9
+ throw new RulesError('maxLength', {
10
+ ...data,
11
+ max,
12
+ value,
13
+ });
11
14
  }
12
15
  return value;
13
16
  };
@@ -10,8 +10,11 @@ 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), { max,
14
- value }));
13
+ throw new helpers.RulesError('maxLength', {
14
+ ...data,
15
+ max,
16
+ value,
17
+ });
15
18
  }
16
19
  return value;
17
20
  };
@@ -3,11 +3,17 @@ import { RulesError } from '../helpers.es6.js';
3
3
  function min(min) {
4
4
  return (value, data) => {
5
5
  if (!['bigint', 'number'].includes(typeof value)) {
6
- throw new RulesError('number', Object.assign(Object.assign({}, data), { value }));
6
+ throw new RulesError('number', {
7
+ ...data,
8
+ value,
9
+ });
7
10
  }
8
11
  if (value < min) {
9
- throw new RulesError('minimum', Object.assign(Object.assign({}, data), { min,
10
- value }));
12
+ throw new RulesError('minimum', {
13
+ ...data,
14
+ min,
15
+ value,
16
+ });
11
17
  }
12
18
  return value;
13
19
  };
@@ -7,11 +7,17 @@ var helpers = require('../helpers.js');
7
7
  function min(min) {
8
8
  return (value, data) => {
9
9
  if (!['bigint', 'number'].includes(typeof value)) {
10
- throw new helpers.RulesError('number', Object.assign(Object.assign({}, data), { value }));
10
+ throw new helpers.RulesError('number', {
11
+ ...data,
12
+ value,
13
+ });
11
14
  }
12
15
  if (value < min) {
13
- throw new helpers.RulesError('minimum', Object.assign(Object.assign({}, data), { min,
14
- value }));
16
+ throw new helpers.RulesError('minimum', {
17
+ ...data,
18
+ min,
19
+ value,
20
+ });
15
21
  }
16
22
  return value;
17
23
  };
@@ -3,8 +3,11 @@ 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({ min,
7
- value }, data));
6
+ throw new RulesError('minBin', {
7
+ min,
8
+ value,
9
+ ...data,
10
+ });
8
11
  }
9
12
  return value;
10
13
  };
@@ -7,8 +7,11 @@ 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({ min,
11
- value }, data));
10
+ throw new helpers.RulesError('minBin', {
11
+ min,
12
+ value,
13
+ ...data,
14
+ });
12
15
  }
13
16
  return value;
14
17
  };
@@ -6,7 +6,11 @@ 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), { min: min.toISOString(), value }));
9
+ throw new RulesError('minDate', {
10
+ ...data,
11
+ min: min.toISOString(),
12
+ value,
13
+ });
10
14
  }
11
15
  return value;
12
16
  };
@@ -10,7 +10,11 @@ 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), { min: min.toISOString(), value }));
13
+ throw new helpers.RulesError('minDate', {
14
+ ...data,
15
+ min: min.toISOString(),
16
+ value,
17
+ });
14
18
  }
15
19
  return value;
16
20
  };
@@ -6,8 +6,11 @@ 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), { min,
10
- value }));
9
+ throw new RulesError('minLength', {
10
+ ...data,
11
+ min,
12
+ value,
13
+ });
11
14
  }
12
15
  return value;
13
16
  };
@@ -10,8 +10,11 @@ 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), { min,
14
- value }));
13
+ throw new helpers.RulesError('minLength', {
14
+ ...data,
15
+ min,
16
+ value,
17
+ });
15
18
  }
16
19
  return value;
17
20
  };
@@ -3,7 +3,10 @@ import { RulesError } from '../helpers.es6.js';
3
3
  function num(value, data) {
4
4
  const result = Number(value);
5
5
  if (isNaN(result) || result > Number.MAX_SAFE_INTEGER || result < -Number.MAX_SAFE_INTEGER) {
6
- throw new RulesError('number', Object.assign({ value }, data));
6
+ throw new RulesError('number', {
7
+ value,
8
+ ...data,
9
+ });
7
10
  }
8
11
  return result;
9
12
  }
@@ -7,7 +7,10 @@ var helpers = require('../helpers.js');
7
7
  function num(value, data) {
8
8
  const result = Number(value);
9
9
  if (isNaN(result) || result > Number.MAX_SAFE_INTEGER || result < -Number.MAX_SAFE_INTEGER) {
10
- throw new helpers.RulesError('number', Object.assign({ value }, data));
10
+ throw new helpers.RulesError('number', {
11
+ value,
12
+ ...data,
13
+ });
11
14
  }
12
15
  return result;
13
16
  }
@@ -3,11 +3,14 @@ import { RulesError, addKey } from '../helpers.es6.js';
3
3
  function objectOf(map, rest) {
4
4
  return (value, data) => {
5
5
  if (value === null || typeof value !== 'object') {
6
- throw new RulesError('object', Object.assign({ value }, data));
6
+ throw new RulesError('object', {
7
+ value,
8
+ ...data,
9
+ });
7
10
  }
8
11
  const result = {};
9
12
  for (const key in map) {
10
- const val = map[key](value[key], Object.assign(Object.assign({}, data), { key: addKey(key, data) }));
13
+ const val = map[key](value[key], { ...data, key: addKey(key, data) });
11
14
  if (val !== undefined) {
12
15
  result[key] = val;
13
16
  }
@@ -16,7 +19,7 @@ function objectOf(map, rest) {
16
19
  for (const key in value) {
17
20
  if (key in map)
18
21
  continue;
19
- const val = rest(value[key], Object.assign(Object.assign({}, data), { key: addKey(key, data) }));
22
+ const val = rest(value[key], { ...data, key: addKey(key, data) });
20
23
  if (val !== undefined) {
21
24
  result[key] = val;
22
25
  }
@@ -7,11 +7,14 @@ var helpers = require('../helpers.js');
7
7
  function objectOf(map, rest) {
8
8
  return (value, data) => {
9
9
  if (value === null || typeof value !== 'object') {
10
- throw new helpers.RulesError('object', Object.assign({ value }, data));
10
+ throw new helpers.RulesError('object', {
11
+ value,
12
+ ...data,
13
+ });
11
14
  }
12
15
  const result = {};
13
16
  for (const key in map) {
14
- const val = map[key](value[key], Object.assign(Object.assign({}, data), { key: helpers.addKey(key, data) }));
17
+ const val = map[key](value[key], { ...data, key: helpers.addKey(key, data) });
15
18
  if (val !== undefined) {
16
19
  result[key] = val;
17
20
  }
@@ -20,7 +23,7 @@ function objectOf(map, rest) {
20
23
  for (const key in value) {
21
24
  if (key in map)
22
25
  continue;
23
- const val = rest(value[key], Object.assign(Object.assign({}, data), { key: helpers.addKey(key, data) }));
26
+ const val = rest(value[key], { ...data, key: helpers.addKey(key, data) });
24
27
  if (val !== undefined) {
25
28
  result[key] = val;
26
29
  }
@@ -4,8 +4,12 @@ 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({ pattern: String(normPattern), patternId,
8
- value }, data));
7
+ throw new RulesError('pattern', {
8
+ pattern: String(normPattern),
9
+ patternId,
10
+ value,
11
+ ...data,
12
+ });
9
13
  }
10
14
  return value;
11
15
  };
@@ -8,8 +8,12 @@ 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({ pattern: String(normPattern), patternId,
12
- value }, data));
11
+ throw new helpers.RulesError('pattern', {
12
+ pattern: String(normPattern),
13
+ patternId,
14
+ value,
15
+ ...data,
16
+ });
13
17
  }
14
18
  return value;
15
19
  };
@@ -10,7 +10,7 @@ function tupleOf(rules) {
10
10
  }
11
11
  const result = [];
12
12
  for (let index = 0; index < rules.length; index++) {
13
- result.push(rules[index](value[index], Object.assign(Object.assign({}, data), { key: addKey(index, data) })));
13
+ result.push(rules[index](value[index], { ...data, key: addKey(index, data) }));
14
14
  }
15
15
  return result;
16
16
  };
@@ -14,7 +14,7 @@ function tupleOf(rules) {
14
14
  }
15
15
  const result = [];
16
16
  for (let index = 0; index < rules.length; index++) {
17
- result.push(rules[index](value[index], Object.assign(Object.assign({}, data), { key: helpers.addKey(index, data) })));
17
+ result.push(rules[index](value[index], { ...data, key: helpers.addKey(index, data) }));
18
18
  }
19
19
  return result;
20
20
  };
@@ -1 +1 @@
1
- export { values } from './values.es6.js';
1
+ export { getArrayValues, values } from './values.es6.js';
@@ -6,4 +6,5 @@ var values = require('./values.js');
6
6
 
7
7
 
8
8
 
9
+ exports.getArrayValues = values.getArrayValues;
9
10
  exports.values = values.values;
@@ -1 +1,3 @@
1
- export declare function values(values: any[]): (value: any, data?: object) => any;
1
+ import { type SchemaValues } from '../../../types';
2
+ export declare function getArrayValues<T, F extends (value: T | string) => any = () => T>(values: SchemaValues<T>, format?: F): ReturnType<F>[];
3
+ export declare function values<T>(values: T[]): (value: any, data?: object) => any;
@@ -1,13 +1,19 @@
1
1
  import { RulesError } from '../helpers.es6.js';
2
2
 
3
+ function getArrayValues(values, format = (value => value)) {
4
+ return Array.isArray(values) ? values.map(format) : Object.keys(values).map(format);
5
+ }
3
6
  function values(values) {
4
7
  return (value, data) => {
5
8
  if (!values.includes(value)) {
6
- throw new RulesError('values', Object.assign(Object.assign({}, data), { value,
7
- values }));
9
+ throw new RulesError('values', {
10
+ ...data,
11
+ value,
12
+ values,
13
+ });
8
14
  }
9
15
  return value;
10
16
  };
11
17
  }
12
18
 
13
- export { values };
19
+ export { getArrayValues, values };
@@ -4,14 +4,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var helpers = require('../helpers.js');
6
6
 
7
+ function getArrayValues(values, format = (value => value)) {
8
+ return Array.isArray(values) ? values.map(format) : Object.keys(values).map(format);
9
+ }
7
10
  function values(values) {
8
11
  return (value, data) => {
9
12
  if (!values.includes(value)) {
10
- throw new helpers.RulesError('values', Object.assign(Object.assign({}, data), { value,
11
- values }));
13
+ throw new helpers.RulesError('values', {
14
+ ...data,
15
+ value,
16
+ values,
17
+ });
12
18
  }
13
19
  return value;
14
20
  };
15
21
  }
16
22
 
23
+ exports.getArrayValues = getArrayValues;
17
24
  exports.values = values;
@@ -1,7 +1,10 @@
1
1
  import qs from 'qs';
2
2
 
3
3
  function stringifySearch(search, options) {
4
- return qs.stringify(search, Object.assign({ encode: false }, options));
4
+ return qs.stringify(search, {
5
+ encode: false,
6
+ ...options,
7
+ });
5
8
  }
6
9
 
7
10
  export { stringifySearch };
@@ -9,7 +9,10 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
  var qs__default = /*#__PURE__*/_interopDefaultLegacy(qs);
10
10
 
11
11
  function stringifySearch(search, options) {
12
- return qs__default["default"].stringify(search, Object.assign({ encode: false }, options));
12
+ return qs__default["default"].stringify(search, {
13
+ encode: false,
14
+ ...options,
15
+ });
13
16
  }
14
17
 
15
18
  exports.stringifySearch = stringifySearch;
@@ -1,10 +0,0 @@
1
- ;(function () {
2
- const env = {"INNETJS_JSX_PACKAGE_VERSION":"1.4.0"};
3
- if (typeof process === 'undefined') {
4
- globalThis.process = { env: env };
5
- } else if (process.env) {
6
- Object.assign(process.env, env);
7
- } else {
8
- process.env = env;
9
- }
10
- })();
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- ;(function () {
4
- const env = {"INNETJS_JSX_PACKAGE_VERSION":"1.4.0"};
5
- if (typeof process === 'undefined') {
6
- globalThis.process = { env: env };
7
- } else if (process.env) {
8
- Object.assign(process.env, env);
9
- } else {
10
- process.env = env;
11
- }
12
- })();