@opra/common 0.15.0 → 0.16.1

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 (284) hide show
  1. package/cjs/document/factory/import-resource-class.js +1 -0
  2. package/cjs/document/factory/import-type-class.js +9 -2
  3. package/cjs/document/resource/collection.js +9 -9
  4. package/cjs/document/resource/singleton.js +4 -4
  5. package/cjs/url/opra-url.js +7 -7
  6. package/esm/document/api-document.js +37 -33
  7. package/esm/document/constants.js +6 -3
  8. package/esm/document/data-type/api-field.js +15 -12
  9. package/esm/document/data-type/builtin/any.type.js +8 -5
  10. package/esm/document/data-type/builtin/base64.type.js +8 -5
  11. package/esm/document/data-type/builtin/bigint.type.js +8 -5
  12. package/esm/document/data-type/builtin/boolean.type.js +11 -8
  13. package/esm/document/data-type/builtin/date.type.js +10 -7
  14. package/esm/document/data-type/builtin/guid.type.js +12 -9
  15. package/esm/document/data-type/builtin/index.js +13 -10
  16. package/esm/document/data-type/builtin/integer.type.js +13 -10
  17. package/esm/document/data-type/builtin/number.type.js +10 -7
  18. package/esm/document/data-type/builtin/object.type.js +8 -5
  19. package/esm/document/data-type/builtin/string.type.js +11 -8
  20. package/esm/document/data-type/builtin/time.type.js +10 -7
  21. package/esm/document/data-type/builtin/timestamp.type.js +12 -9
  22. package/esm/document/data-type/complex-type.js +34 -30
  23. package/esm/document/data-type/data-type.js +12 -9
  24. package/esm/document/data-type/enum-type.js +19 -15
  25. package/esm/document/data-type/mapped-type.js +29 -24
  26. package/esm/document/data-type/simple-type.js +21 -17
  27. package/esm/document/data-type/union-type.js +29 -26
  28. package/esm/document/factory/add-references.js +7 -3
  29. package/esm/document/factory/create-document.js +16 -10
  30. package/esm/document/factory/factory.js +37 -33
  31. package/esm/document/factory/import-resource-class.js +22 -15
  32. package/esm/document/factory/import-type-class.js +43 -26
  33. package/esm/document/factory/index.js +4 -1
  34. package/esm/document/factory/process-resources.js +16 -10
  35. package/esm/document/factory/process-types.js +37 -31
  36. package/esm/document/index.js +17 -14
  37. package/esm/document/resource/collection.js +50 -46
  38. package/esm/document/resource/resource.js +12 -9
  39. package/esm/document/resource/singleton.js +29 -25
  40. package/esm/document/utils/inspect.util.js +7 -4
  41. package/esm/document/utils/string-compare.util.js +5 -1
  42. package/esm/exception/enums/issue-severity.enum.js +5 -2
  43. package/esm/exception/error-issue.js +2 -1
  44. package/esm/exception/http-errors/bad-request.error.js +8 -4
  45. package/esm/exception/http-errors/failed-dependency.error.js +8 -4
  46. package/esm/exception/http-errors/forbidden.error.js +8 -4
  47. package/esm/exception/http-errors/internal-server.error.js +8 -4
  48. package/esm/exception/http-errors/method-not-allowed.error.js +8 -4
  49. package/esm/exception/http-errors/not-acceptable.error.js +8 -4
  50. package/esm/exception/http-errors/not-found.error.js +8 -4
  51. package/esm/exception/http-errors/unauthorized.error.js +8 -4
  52. package/esm/exception/http-errors/unprocessable-entity.error.js +8 -4
  53. package/esm/exception/index.js +18 -15
  54. package/esm/exception/opra-exception.js +7 -3
  55. package/esm/exception/resource-errors/resource-conflict.error.js +8 -4
  56. package/esm/exception/resource-errors/resource-not-found.error.js +8 -4
  57. package/esm/exception/wrap-exception.js +24 -20
  58. package/esm/filter/antlr/OpraFilterLexer.js +9 -6
  59. package/esm/filter/antlr/OpraFilterListener.js +5 -2
  60. package/esm/filter/antlr/OpraFilterParser.js +126 -79
  61. package/esm/filter/antlr/OpraFilterVisitor.js +5 -2
  62. package/esm/filter/ast/abstract/ast.js +5 -1
  63. package/esm/filter/ast/abstract/expression.js +6 -2
  64. package/esm/filter/ast/abstract/literal.js +6 -2
  65. package/esm/filter/ast/abstract/term.js +6 -2
  66. package/esm/filter/ast/expressions/arithmetic-expression.js +8 -3
  67. package/esm/filter/ast/expressions/array-expression.js +6 -2
  68. package/esm/filter/ast/expressions/comparison-expression.js +6 -2
  69. package/esm/filter/ast/expressions/logical-expression.js +6 -2
  70. package/esm/filter/ast/expressions/parentheses-expression.js +6 -2
  71. package/esm/filter/ast/index.js +19 -16
  72. package/esm/filter/ast/terms/boolean-literal.js +6 -2
  73. package/esm/filter/ast/terms/date-literal.js +12 -8
  74. package/esm/filter/ast/terms/external-constant.js +6 -2
  75. package/esm/filter/ast/terms/null-literal.js +6 -2
  76. package/esm/filter/ast/terms/number-literal.js +8 -4
  77. package/esm/filter/ast/terms/qualified-identifier.js +6 -2
  78. package/esm/filter/ast/terms/string-literal.js +8 -4
  79. package/esm/filter/ast/terms/time-literal.js +10 -6
  80. package/esm/filter/build.js +69 -45
  81. package/esm/filter/errors.js +9 -3
  82. package/esm/filter/filter-tree-visitor.js +31 -26
  83. package/esm/filter/index.js +8 -5
  84. package/esm/filter/opra-error-listener.js +8 -4
  85. package/esm/filter/parse.js +19 -14
  86. package/esm/filter/utils.js +7 -2
  87. package/esm/helpers/function-utils.js +14 -8
  88. package/esm/helpers/get-stack-filename.js +5 -1
  89. package/esm/helpers/index.js +11 -8
  90. package/esm/helpers/is-url.js +5 -1
  91. package/esm/helpers/mixin-utils.js +7 -2
  92. package/esm/helpers/object-utils.js +12 -6
  93. package/esm/helpers/path-to-object-tree.js +5 -1
  94. package/esm/helpers/responsive-map.js +5 -1
  95. package/esm/helpers/type-guards.js +17 -7
  96. package/esm/http/codecs/boolean-codec.js +5 -1
  97. package/esm/http/codecs/date-codec.js +5 -1
  98. package/esm/http/codecs/filter-codec.js +9 -5
  99. package/esm/http/codecs/integer-codec.js +6 -2
  100. package/esm/http/codecs/number-codec.js +5 -1
  101. package/esm/http/codecs/string-codec.js +5 -1
  102. package/esm/http/enums/http-headers-codes.enum.js +5 -2
  103. package/esm/http/enums/http-status-codes.enum.js +5 -2
  104. package/esm/http/enums/http-status-messages.js +4 -1
  105. package/esm/http/http-headers.js +9 -5
  106. package/esm/http/http-message.host.js +18 -13
  107. package/esm/http/http-params.js +25 -20
  108. package/esm/http/http-request-message.js +22 -18
  109. package/esm/http/http-response-message.js +28 -23
  110. package/esm/http/index.js +17 -14
  111. package/esm/http/interfaces/client-http-headers.interface.js +2 -1
  112. package/esm/http/interfaces/cookie-options.interface.js +2 -1
  113. package/esm/http/interfaces/server-http-headers.interface.js +2 -1
  114. package/esm/i18n/i18n.js +28 -23
  115. package/esm/i18n/index.js +9 -5
  116. package/esm/i18n/string-utils.js +7 -2
  117. package/esm/i18n/translate.js +7 -3
  118. package/esm/index.js +16 -11
  119. package/esm/schema/constants.js +4 -1
  120. package/esm/schema/data-type/complex-type.interface.js +5 -2
  121. package/esm/schema/data-type/data-type.interface.js +2 -1
  122. package/esm/schema/data-type/enum-type.interface.js +5 -2
  123. package/esm/schema/data-type/field.interface.js +2 -1
  124. package/esm/schema/data-type/mapped-type.interface.js +5 -2
  125. package/esm/schema/data-type/simple-type.interface.js +5 -2
  126. package/esm/schema/data-type/union-type.interface.js +5 -2
  127. package/esm/schema/document.interface.js +2 -1
  128. package/esm/schema/index.js +34 -31
  129. package/esm/schema/resource/collection.interface.js +5 -2
  130. package/esm/schema/resource/container.interface.js +5 -2
  131. package/esm/schema/resource/endpoint.interface.js +2 -1
  132. package/esm/schema/resource/resource.interface.js +2 -1
  133. package/esm/schema/resource/singleton.interface.js +5 -2
  134. package/esm/schema/type-guards.js +53 -40
  135. package/esm/types.js +2 -1
  136. package/esm/url/index.js +8 -5
  137. package/esm/url/opra-url-path-component.js +7 -3
  138. package/esm/url/opra-url-path.js +18 -14
  139. package/esm/url/opra-url.js +25 -21
  140. package/esm/url/utils/decode-path-component.js +8 -4
  141. package/esm/url/utils/encode-path-component.js +8 -3
  142. package/esm/utils/path-utils.js +7 -2
  143. package/package.json +5 -4
  144. package/{esm → types}/document/factory/import-resource-class.d.ts +1 -0
  145. package/{esm → types}/document/resource/collection.d.ts +10 -10
  146. package/{esm → types}/document/resource/singleton.d.ts +4 -4
  147. package/{esm → types}/schema/resource/collection.interface.d.ts +6 -6
  148. package/{esm → types}/url/opra-url.d.ts +3 -3
  149. package/{esm → types}/document/api-document.d.ts +0 -0
  150. package/{esm → types}/document/constants.d.ts +0 -0
  151. package/{esm → types}/document/data-type/api-field.d.ts +0 -0
  152. package/{esm → types}/document/data-type/builtin/any.type.d.ts +0 -0
  153. package/{esm → types}/document/data-type/builtin/base64.type.d.ts +0 -0
  154. package/{esm → types}/document/data-type/builtin/bigint.type.d.ts +0 -0
  155. package/{esm → types}/document/data-type/builtin/boolean.type.d.ts +0 -0
  156. package/{esm → types}/document/data-type/builtin/date.type.d.ts +0 -0
  157. package/{esm → types}/document/data-type/builtin/guid.type.d.ts +0 -0
  158. package/{esm → types}/document/data-type/builtin/index.d.ts +0 -0
  159. package/{esm → types}/document/data-type/builtin/integer.type.d.ts +0 -0
  160. package/{esm → types}/document/data-type/builtin/number.type.d.ts +0 -0
  161. package/{esm → types}/document/data-type/builtin/object.type.d.ts +0 -0
  162. package/{esm → types}/document/data-type/builtin/string.type.d.ts +0 -0
  163. package/{esm → types}/document/data-type/builtin/time.type.d.ts +0 -0
  164. package/{esm → types}/document/data-type/builtin/timestamp.type.d.ts +0 -0
  165. package/{esm → types}/document/data-type/complex-type.d.ts +0 -0
  166. package/{esm → types}/document/data-type/data-type.d.ts +0 -0
  167. package/{esm → types}/document/data-type/enum-type.d.ts +0 -0
  168. package/{esm → types}/document/data-type/mapped-type.d.ts +0 -0
  169. package/{esm → types}/document/data-type/simple-type.d.ts +0 -0
  170. package/{esm → types}/document/data-type/union-type.d.ts +0 -0
  171. package/{esm → types}/document/factory/add-references.d.ts +0 -0
  172. package/{esm → types}/document/factory/create-document.d.ts +0 -0
  173. package/{esm → types}/document/factory/factory.d.ts +0 -0
  174. package/{esm → types}/document/factory/import-type-class.d.ts +0 -0
  175. package/{esm → types}/document/factory/index.d.ts +0 -0
  176. package/{esm → types}/document/factory/process-resources.d.ts +0 -0
  177. package/{esm → types}/document/factory/process-types.d.ts +0 -0
  178. package/{esm → types}/document/index.d.ts +0 -0
  179. package/{esm → types}/document/resource/resource.d.ts +0 -0
  180. package/{esm → types}/document/utils/inspect.util.d.ts +0 -0
  181. package/{esm → types}/document/utils/string-compare.util.d.ts +0 -0
  182. package/{esm → types}/exception/enums/issue-severity.enum.d.ts +0 -0
  183. package/{esm → types}/exception/error-issue.d.ts +0 -0
  184. package/{esm → types}/exception/http-errors/bad-request.error.d.ts +0 -0
  185. package/{esm → types}/exception/http-errors/failed-dependency.error.d.ts +0 -0
  186. package/{esm → types}/exception/http-errors/forbidden.error.d.ts +0 -0
  187. package/{esm → types}/exception/http-errors/internal-server.error.d.ts +0 -0
  188. package/{esm → types}/exception/http-errors/method-not-allowed.error.d.ts +0 -0
  189. package/{esm → types}/exception/http-errors/not-acceptable.error.d.ts +0 -0
  190. package/{esm → types}/exception/http-errors/not-found.error.d.ts +0 -0
  191. package/{esm → types}/exception/http-errors/unauthorized.error.d.ts +0 -0
  192. package/{esm → types}/exception/http-errors/unprocessable-entity.error.d.ts +0 -0
  193. package/{esm → types}/exception/index.d.ts +0 -0
  194. package/{esm → types}/exception/opra-exception.d.ts +0 -0
  195. package/{esm → types}/exception/resource-errors/resource-conflict.error.d.ts +0 -0
  196. package/{esm → types}/exception/resource-errors/resource-not-found.error.d.ts +0 -0
  197. package/{esm → types}/exception/wrap-exception.d.ts +0 -0
  198. package/{esm → types}/filter/antlr/OpraFilterLexer.d.ts +0 -0
  199. package/{esm → types}/filter/antlr/OpraFilterListener.d.ts +0 -0
  200. package/{esm → types}/filter/antlr/OpraFilterParser.d.ts +0 -0
  201. package/{esm → types}/filter/antlr/OpraFilterVisitor.d.ts +0 -0
  202. package/{esm → types}/filter/ast/abstract/ast.d.ts +0 -0
  203. package/{esm → types}/filter/ast/abstract/expression.d.ts +0 -0
  204. package/{esm → types}/filter/ast/abstract/literal.d.ts +0 -0
  205. package/{esm → types}/filter/ast/abstract/term.d.ts +0 -0
  206. package/{esm → types}/filter/ast/expressions/arithmetic-expression.d.ts +0 -0
  207. package/{esm → types}/filter/ast/expressions/array-expression.d.ts +0 -0
  208. package/{esm → types}/filter/ast/expressions/comparison-expression.d.ts +0 -0
  209. package/{esm → types}/filter/ast/expressions/logical-expression.d.ts +0 -0
  210. package/{esm → types}/filter/ast/expressions/parentheses-expression.d.ts +0 -0
  211. package/{esm → types}/filter/ast/index.d.ts +0 -0
  212. package/{esm → types}/filter/ast/terms/boolean-literal.d.ts +0 -0
  213. package/{esm → types}/filter/ast/terms/date-literal.d.ts +0 -0
  214. package/{esm → types}/filter/ast/terms/external-constant.d.ts +0 -0
  215. package/{esm → types}/filter/ast/terms/null-literal.d.ts +0 -0
  216. package/{esm → types}/filter/ast/terms/number-literal.d.ts +0 -0
  217. package/{esm → types}/filter/ast/terms/qualified-identifier.d.ts +0 -0
  218. package/{esm → types}/filter/ast/terms/string-literal.d.ts +0 -0
  219. package/{esm → types}/filter/ast/terms/time-literal.d.ts +0 -0
  220. package/{esm → types}/filter/build.d.ts +0 -0
  221. package/{esm → types}/filter/errors.d.ts +0 -0
  222. package/{esm → types}/filter/filter-tree-visitor.d.ts +0 -0
  223. package/{esm → types}/filter/index.d.ts +0 -0
  224. package/{esm → types}/filter/opra-error-listener.d.ts +0 -0
  225. package/{esm → types}/filter/parse.d.ts +0 -0
  226. package/{esm → types}/filter/utils.d.ts +0 -0
  227. package/{esm → types}/helpers/function-utils.d.ts +0 -0
  228. package/{esm → types}/helpers/get-stack-filename.d.ts +0 -0
  229. package/{esm → types}/helpers/index.d.ts +0 -0
  230. package/{esm → types}/helpers/is-url.d.ts +0 -0
  231. package/{esm → types}/helpers/mixin-utils.d.ts +0 -0
  232. package/{esm → types}/helpers/object-utils.d.ts +0 -0
  233. package/{esm → types}/helpers/path-to-object-tree.d.ts +0 -0
  234. package/{esm → types}/helpers/responsive-map.d.ts +0 -0
  235. package/{esm → types}/helpers/type-guards.d.ts +0 -0
  236. package/{esm → types}/http/codecs/boolean-codec.d.ts +0 -0
  237. package/{esm → types}/http/codecs/date-codec.d.ts +0 -0
  238. package/{esm → types}/http/codecs/filter-codec.d.ts +0 -0
  239. package/{esm → types}/http/codecs/integer-codec.d.ts +0 -0
  240. package/{esm → types}/http/codecs/number-codec.d.ts +0 -0
  241. package/{esm → types}/http/codecs/string-codec.d.ts +0 -0
  242. package/{esm → types}/http/enums/http-headers-codes.enum.d.ts +0 -0
  243. package/{esm → types}/http/enums/http-status-codes.enum.d.ts +0 -0
  244. package/{esm → types}/http/enums/http-status-messages.d.ts +0 -0
  245. package/{esm → types}/http/http-headers.d.ts +0 -0
  246. package/{esm → types}/http/http-message.host.d.ts +0 -0
  247. package/{esm → types}/http/http-params.d.ts +0 -0
  248. package/{esm → types}/http/http-request-message.d.ts +0 -0
  249. package/{esm → types}/http/http-response-message.d.ts +0 -0
  250. package/{esm → types}/http/index.d.ts +0 -0
  251. package/{esm → types}/http/interfaces/client-http-headers.interface.d.ts +0 -0
  252. package/{esm → types}/http/interfaces/cookie-options.interface.d.ts +0 -0
  253. package/{esm → types}/http/interfaces/server-http-headers.interface.d.ts +0 -0
  254. package/{esm → types}/http/multipart/batch-multipart.d.ts +0 -0
  255. package/{esm → types}/http/multipart/http-request-content.d.ts +0 -0
  256. package/{esm → types}/http/multipart/http-response-content.d.ts +0 -0
  257. package/{esm → types}/http/multipart/index.d.ts +0 -0
  258. package/{esm → types}/i18n/i18n.d.ts +0 -0
  259. package/{esm → types}/i18n/index.d.ts +0 -0
  260. package/{esm → types}/i18n/string-utils.d.ts +0 -0
  261. package/{esm → types}/i18n/translate.d.ts +0 -0
  262. package/{esm → types}/index.d.ts +0 -0
  263. package/{esm → types}/schema/constants.d.ts +0 -0
  264. package/{esm → types}/schema/data-type/complex-type.interface.d.ts +0 -0
  265. package/{esm → types}/schema/data-type/data-type.interface.d.ts +0 -0
  266. package/{esm → types}/schema/data-type/enum-type.interface.d.ts +0 -0
  267. package/{esm → types}/schema/data-type/field.interface.d.ts +0 -0
  268. package/{esm → types}/schema/data-type/mapped-type.interface.d.ts +0 -0
  269. package/{esm → types}/schema/data-type/simple-type.interface.d.ts +0 -0
  270. package/{esm → types}/schema/data-type/union-type.interface.d.ts +0 -0
  271. package/{esm → types}/schema/document.interface.d.ts +0 -0
  272. package/{esm → types}/schema/index.d.ts +0 -0
  273. package/{esm → types}/schema/resource/container.interface.d.ts +0 -0
  274. package/{esm → types}/schema/resource/endpoint.interface.d.ts +0 -0
  275. package/{esm → types}/schema/resource/resource.interface.d.ts +0 -0
  276. package/{esm → types}/schema/resource/singleton.interface.d.ts +2 -2
  277. /package/{esm → types}/schema/type-guards.d.ts +0 -0
  278. /package/{esm → types}/types.d.ts +0 -0
  279. /package/{esm → types}/url/index.d.ts +0 -0
  280. /package/{esm → types}/url/opra-url-path-component.d.ts +0 -0
  281. /package/{esm → types}/url/opra-url-path.d.ts +0 -0
  282. /package/{esm → types}/url/utils/decode-path-component.d.ts +0 -0
  283. /package/{esm → types}/url/utils/encode-path-component.d.ts +0 -0
  284. /package/{esm → types}/utils/path-utils.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractCollectionSchema = exports.extractSingletonSchema = exports.importResourceClass = void 0;
4
+ require("reflect-metadata");
4
5
  const index_js_1 = require("../../helpers/index.js");
5
6
  const index_js_2 = require("../../schema/index.js");
6
7
  const constants_js_1 = require("../constants.js");
@@ -26,6 +26,8 @@ async function importTypeClass(typeThunk) {
26
26
  const schema = (0, index_js_1.cloneObject)(metadata);
27
27
  const result = name || schema;
28
28
  if (name) {
29
+ if (this.document.types.has(name) || typeQueue.has(name))
30
+ throw new TypeError(`Type "${name}" already imported`);
29
31
  cache.set(thunk, result);
30
32
  typeQueue.set(name, schema);
31
33
  }
@@ -58,6 +60,7 @@ async function importTypeClass(typeThunk) {
58
60
  throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(enumObject).substring(0, 20)}...`);
59
61
  }
60
62
  exports.importTypeClass = importTypeClass;
63
+ // noinspection JSUnusedLocalSymbols
61
64
  async function extractSimpleTypeSchema(target, ctor,
62
65
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
66
  metadata) {
@@ -85,12 +88,14 @@ async function extractComplexTypeSchema(target, ctor, metadata) {
85
88
  ...elemMeta,
86
89
  type
87
90
  };
88
- if (elemMeta.enum) {
91
+ if (elemMeta.enum)
89
92
  elemSchema.type = await this.importTypeClass(elemMeta.enum);
90
- }
91
93
  if (!elemSchema.type && elemMeta.designType)
92
94
  elemSchema.type = await this.importTypeClass(elemMeta.designType);
93
95
  await this.extractFieldSchema(elemSchema, ctor, elemMeta, elemName);
96
+ // Check enum again. External packages may modify enum value
97
+ if (elemMeta.enum)
98
+ elemSchema.type = await this.importTypeClass(elemMeta.enum);
94
99
  if (typeof elemSchema.type === 'function')
95
100
  elemSchema.type = await this.importTypeClass(elemSchema.type);
96
101
  if (elemSchema.isArray && !elemSchema.type)
@@ -116,12 +121,14 @@ async function extractUnionTypeSchema(target, ctor, metadata) {
116
121
  target.types.push(await this.importTypeClass(type));
117
122
  }
118
123
  exports.extractUnionTypeSchema = extractUnionTypeSchema;
124
+ // noinspection JSUnusedLocalSymbols
119
125
  async function extractEnumTypeSchema(
120
126
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
121
127
  target, enumObject, metadata) {
122
128
  // Do nothing. This method is used by external modules for extending the factory
123
129
  }
124
130
  exports.extractEnumTypeSchema = extractEnumTypeSchema;
131
+ // noinspection JSUnusedLocalSymbols
125
132
  async function extractFieldSchema(
126
133
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
127
134
  target, ctor, metadata, name) {
@@ -129,8 +129,8 @@ const proto = {
129
129
  const normalized = this.normalizeFieldNames(fields);
130
130
  if (!normalized)
131
131
  return;
132
- const searchEndpoint = this.operations.search;
133
- const sortFields = searchEndpoint && searchEndpoint.sortFields;
132
+ const findManyEndpoint = this.operations.findMany;
133
+ const sortFields = findManyEndpoint && findManyEndpoint.sortFields;
134
134
  normalized.forEach(field => {
135
135
  if (!sortFields?.find(x => x === field))
136
136
  throw new index_js_1.BadRequestError({
@@ -176,10 +176,10 @@ function createOperationDecorator(operation) {
176
176
  Reflect.defineMetadata(constants_js_1.METADATA_KEY, resourceMetadata, target.constructor);
177
177
  });
178
178
  }
179
- exports.Collection.CreateOperation = createOperationDecorator('create');
180
- exports.Collection.GetOperation = createOperationDecorator('get');
181
- exports.Collection.DeleteOperation = createOperationDecorator('delete');
182
- exports.Collection.UpdateOperation = createOperationDecorator('update');
183
- exports.Collection.SearchOperation = createOperationDecorator('search');
184
- exports.Collection.UpdateManyOperation = createOperationDecorator('updateMany');
185
- exports.Collection.DeleteManyOperation = createOperationDecorator('deleteMany');
179
+ exports.Collection.Create = createOperationDecorator('create');
180
+ exports.Collection.Delete = createOperationDecorator('delete');
181
+ exports.Collection.DeleteMany = createOperationDecorator('deleteMany');
182
+ exports.Collection.Get = createOperationDecorator('get');
183
+ exports.Collection.FindMany = createOperationDecorator('findMany');
184
+ exports.Collection.Update = createOperationDecorator('update');
185
+ exports.Collection.UpdateMany = createOperationDecorator('updateMany');
@@ -85,7 +85,7 @@ function createOperationDecorator(operation) {
85
85
  Reflect.defineMetadata(constants_js_1.METADATA_KEY, resourceMetadata, target.constructor);
86
86
  });
87
87
  }
88
- exports.Singleton.CreateOperation = createOperationDecorator('create');
89
- exports.Singleton.GetOperation = createOperationDecorator('get');
90
- exports.Singleton.DeleteOperation = createOperationDecorator('delete');
91
- exports.Singleton.UpdateOperation = createOperationDecorator('update');
88
+ exports.Singleton.Create = createOperationDecorator('create');
89
+ exports.Singleton.Get = createOperationDecorator('get');
90
+ exports.Singleton.Delete = createOperationDecorator('delete');
91
+ exports.Singleton.Update = createOperationDecorator('update');
@@ -14,7 +14,7 @@ const hostRegEx = /^([^/:]+)(?::(\d+))?$/;
14
14
  const hostnameRegEx = /^([^/:]+)$/;
15
15
  const kContext = Symbol('kContext');
16
16
  const kPath = Symbol('kPath');
17
- const kSearchParams = Symbol('kSearchParams');
17
+ const kParams = Symbol('kParams');
18
18
  class OpraURL {
19
19
  constructor(input, base) {
20
20
  this[_a] = {
@@ -32,7 +32,7 @@ class OpraURL {
32
32
  this[kContext].address = undefined;
33
33
  }
34
34
  });
35
- this[kSearchParams] = new index_js_1.HttpParams('', {
35
+ this[kParams] = new index_js_1.HttpParams('', {
36
36
  onChange: () => {
37
37
  this[kContext].search = undefined;
38
38
  }
@@ -182,20 +182,20 @@ class OpraURL {
182
182
  }
183
183
  get search() {
184
184
  if (this[kContext].search == null) {
185
- const s = this[kSearchParams].toString();
185
+ const s = this[kParams].toString();
186
186
  this[kContext].search = s ? ('?' + s) : '';
187
187
  }
188
188
  return this[kContext].search;
189
189
  }
190
190
  set search(v) {
191
191
  if (v) {
192
- this[kSearchParams].clear();
193
- this[kSearchParams].appendAll(v);
192
+ this[kParams].clear();
193
+ this[kParams].appendAll(v);
194
194
  }
195
195
  this[kContext].search = undefined;
196
196
  }
197
197
  get searchParams() {
198
- return this[kSearchParams];
198
+ return this[kParams];
199
199
  }
200
200
  parse(input) {
201
201
  const m = urlRegEx.exec(input);
@@ -303,4 +303,4 @@ class OpraURL {
303
303
  exports.OpraURL = OpraURL;
304
304
  OpraURL.kContext = kContext;
305
305
  OpraURL.kPath = kPath;
306
- OpraURL.kSearchParams = kSearchParams;
306
+ OpraURL.kParams = kParams;
@@ -1,16 +1,19 @@
1
- import { NotAcceptableError, NotFoundError } from '../exception/index.js';
2
- import { cloneObject, omitUndefined, ResponsiveMap } from '../helpers/index.js';
3
- import { OpraSchema } from '../schema/index.js';
4
- import { NAMESPACE_PATTERN } from './constants.js';
5
- import { ComplexType } from './data-type/complex-type.js';
6
- import { SimpleType } from './data-type/simple-type.js';
7
- export class ApiDocument {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiDocument = void 0;
4
+ const index_js_1 = require("../exception/index.js");
5
+ const index_js_2 = require("../helpers/index.js");
6
+ const index_js_3 = require("../schema/index.js");
7
+ const constants_js_1 = require("./constants.js");
8
+ const complex_type_js_1 = require("./data-type/complex-type.js");
9
+ const simple_type_js_1 = require("./data-type/simple-type.js");
10
+ class ApiDocument {
8
11
  constructor() {
9
- this._typeCache = new ResponsiveMap();
12
+ this._typeCache = new index_js_2.ResponsiveMap();
10
13
  this._typesCacheByCtor = new Map();
11
- this.references = new ResponsiveMap();
12
- this.types = new ResponsiveMap();
13
- this.resources = new ResponsiveMap();
14
+ this.references = new index_js_2.ResponsiveMap();
15
+ this.types = new index_js_2.ResponsiveMap();
16
+ this.resources = new index_js_2.ResponsiveMap();
14
17
  this.info = {
15
18
  version: '',
16
19
  title: ''
@@ -30,19 +33,19 @@ export class ApiDocument {
30
33
  if (t === null) {
31
34
  if (silent)
32
35
  return;
33
- throw new NotFoundError(`Data type "${nameOrCtorName}" does not exists`);
36
+ throw new index_js_1.NotFoundError(`Data type "${nameOrCtorName}" does not exists`);
34
37
  }
35
38
  if (typeof nameOrCtor === 'string') {
36
- const m = NAMESPACE_PATTERN.exec(nameOrCtor);
39
+ const m = constants_js_1.NAMESPACE_PATTERN.exec(nameOrCtor);
37
40
  if (!m)
38
- throw new NotFoundError(`Invalid data type name "${nameOrCtorName}"`);
41
+ throw new index_js_1.NotFoundError(`Invalid data type name "${nameOrCtorName}"`);
39
42
  // If given string has namespace pattern (ns:type_name)
40
43
  if (m[2]) {
41
44
  const ref = this.references.get(m[1]);
42
45
  if (!ref) {
43
46
  if (silent)
44
47
  return;
45
- throw new NotFoundError(`Reference "${m[1]}" not found`);
48
+ throw new index_js_1.NotFoundError(`Reference "${m[1]}" not found`);
46
49
  }
47
50
  dataType = ref.getDataType(m[2]);
48
51
  this._typeCache.set(nameOrCtor, dataType);
@@ -67,7 +70,7 @@ export class ApiDocument {
67
70
  else if (typeof nameOrCtor === 'function') {
68
71
  const types = Array.from(this.types.values()).reverse();
69
72
  for (const dt of types) {
70
- if ((dt instanceof ComplexType || dt instanceof SimpleType) && dt.own.ctor === nameOrCtor) {
73
+ if ((dt instanceof complex_type_js_1.ComplexType || dt instanceof simple_type_js_1.SimpleType) && dt.own.ctor === nameOrCtor) {
71
74
  dataType = dt;
72
75
  break;
73
76
  }
@@ -83,7 +86,7 @@ export class ApiDocument {
83
86
  }
84
87
  }
85
88
  if (dataType) {
86
- if ((dataType instanceof ComplexType || dataType instanceof SimpleType) &&
89
+ if ((dataType instanceof complex_type_js_1.ComplexType || dataType instanceof simple_type_js_1.SimpleType) &&
87
90
  dataType.own?.ctor && dataType.own.ctor !== Object)
88
91
  this._typesCacheByCtor.set(dataType.own.ctor, dataType);
89
92
  return dataType;
@@ -96,7 +99,7 @@ export class ApiDocument {
96
99
  }
97
100
  if (silent)
98
101
  return;
99
- throw new NotFoundError(`Data type "${nameOrCtorName}" does not exists`);
102
+ throw new index_js_1.NotFoundError(`Data type "${nameOrCtorName}" does not exists`);
100
103
  }
101
104
  getComplexType(nameOrCtor, silent) {
102
105
  if (nameOrCtor === Object)
@@ -104,30 +107,30 @@ export class ApiDocument {
104
107
  const t = this.getDataType(nameOrCtor);
105
108
  if (!t && silent)
106
109
  return;
107
- if (t && t.kind === OpraSchema.ComplexType.Kind)
110
+ if (t && t.kind === index_js_3.OpraSchema.ComplexType.Kind)
108
111
  return t;
109
- throw new NotAcceptableError(`Data type "${t.name}" is not a ComplexType`);
112
+ throw new index_js_1.NotAcceptableError(`Data type "${t.name}" is not a ComplexType`);
110
113
  }
111
114
  getSimpleType(nameOrCtor, silent) {
112
115
  const t = this.getDataType(nameOrCtor);
113
116
  if (!t && silent)
114
117
  return;
115
- if (t && t.kind === OpraSchema.SimpleType.Kind)
118
+ if (t && t.kind === index_js_3.OpraSchema.SimpleType.Kind)
116
119
  return t;
117
- throw new NotAcceptableError(`Data type "${t.name || t}" is not a SimpleType`);
120
+ throw new index_js_1.NotAcceptableError(`Data type "${t.name || t}" is not a SimpleType`);
118
121
  }
119
122
  getResource(path, silent) {
120
123
  let resource;
121
- const m = NAMESPACE_PATTERN.exec(path);
124
+ const m = constants_js_1.NAMESPACE_PATTERN.exec(path);
122
125
  if (!m)
123
- throw new NotFoundError(`Invalid resource path "${path}"`);
126
+ throw new index_js_1.NotFoundError(`Invalid resource path "${path}"`);
124
127
  // If given string has namespace pattern (ns:type_name)
125
128
  if (m[2]) {
126
129
  const ref = this.references.get(m[1]);
127
130
  if (!ref) {
128
131
  if (silent)
129
132
  return;
130
- throw new NotFoundError(`Reference "${m[1]}" not found`);
133
+ throw new index_js_1.NotFoundError(`Reference "${m[1]}" not found`);
131
134
  }
132
135
  return ref.getResource(m[2]);
133
136
  }
@@ -147,32 +150,32 @@ export class ApiDocument {
147
150
  }
148
151
  if (silent)
149
152
  return;
150
- throw new NotFoundError(`Resource not found (${path})`);
153
+ throw new index_js_1.NotFoundError(`Resource not found (${path})`);
151
154
  }
152
155
  getCollection(path, silent) {
153
156
  const t = this.getResource(path);
154
157
  if (!t && silent)
155
158
  return;
156
- if (t && t.kind === OpraSchema.Collection.Kind)
159
+ if (t && t.kind === index_js_3.OpraSchema.Collection.Kind)
157
160
  return t;
158
- throw new NotAcceptableError(`Resource type "${t.name}" is not a Collection`);
161
+ throw new index_js_1.NotAcceptableError(`Resource type "${t.name}" is not a Collection`);
159
162
  }
160
163
  getSingleton(path, silent) {
161
164
  const t = this.getResource(path);
162
165
  if (!t && silent)
163
166
  return;
164
- if (t && t.kind === OpraSchema.Singleton.Kind)
167
+ if (t && t.kind === index_js_3.OpraSchema.Singleton.Kind)
165
168
  return t;
166
- throw new NotAcceptableError(`Resource type "${t.name}" is not a Singleton`);
169
+ throw new index_js_1.NotAcceptableError(`Resource type "${t.name}" is not a Singleton`);
167
170
  }
168
171
  /**
169
172
  * Export as Opra schema definition object
170
173
  */
171
174
  exportSchema() {
172
175
  const schema = {
173
- version: OpraSchema.SpecVersion,
176
+ version: index_js_3.OpraSchema.SpecVersion,
174
177
  url: this.url,
175
- info: cloneObject(this.info)
178
+ info: (0, index_js_2.cloneObject)(this.info)
176
179
  };
177
180
  if (this.references.size) {
178
181
  const references = {};
@@ -198,10 +201,11 @@ export class ApiDocument {
198
201
  types[name] = r.exportSchema();
199
202
  }
200
203
  }
201
- return omitUndefined(schema);
204
+ return (0, index_js_2.omitUndefined)(schema);
202
205
  }
203
206
  invalidate() {
204
207
  this._typeCache.clear();
205
208
  this._typesCacheByCtor.clear();
206
209
  }
207
210
  }
211
+ exports.ApiDocument = ApiDocument;
@@ -1,3 +1,6 @@
1
- export const METADATA_KEY = Symbol.for('opra.metadata');
2
- export const NAMESPACE_PATTERN = /([A-Z$_]\w+)(?::.+)?/i;
3
- export const TYPENAME_PATTERN = /^(.*)Type$/;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPENAME_PATTERN = exports.NAMESPACE_PATTERN = exports.METADATA_KEY = void 0;
4
+ exports.METADATA_KEY = Symbol.for('opra.metadata');
5
+ exports.NAMESPACE_PATTERN = /([A-Z$_]\w+)(?::.+)?/i;
6
+ exports.TYPENAME_PATTERN = /^(.*)Type$/;
@@ -1,19 +1,22 @@
1
- import { omitUndefined } from '../../helpers/index.js';
2
- import { OpraSchema } from '../../schema/index.js';
3
- import { METADATA_KEY } from '../constants.js';
4
- import { EnumType } from './enum-type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiField = void 0;
4
+ const index_js_1 = require("../../helpers/index.js");
5
+ const index_js_2 = require("../../schema/index.js");
6
+ const constants_js_1 = require("../constants.js");
7
+ const enum_type_js_1 = require("./enum-type.js");
5
8
  /**
6
9
  * @class ComplexType
7
10
  */
8
- export const ApiField = function (...args) {
11
+ exports.ApiField = function (...args) {
9
12
  // ClassDecorator
10
13
  if (!this) {
11
14
  const [options] = args;
12
15
  return function (target, propertyKey) {
13
16
  if (typeof propertyKey !== 'string')
14
17
  throw new TypeError(`Symbol properties can't be used as a field`);
15
- const metadata = Reflect.getOwnMetadata(METADATA_KEY, target.constructor) || {};
16
- metadata.kind = OpraSchema.ComplexType.Kind;
18
+ const metadata = Reflect.getOwnMetadata(constants_js_1.METADATA_KEY, target.constructor) || {};
19
+ metadata.kind = index_js_2.OpraSchema.ComplexType.Kind;
17
20
  metadata.fields = metadata.fields || {};
18
21
  const designType = Reflect.getMetadata('design:type', target, propertyKey);
19
22
  const isArray = designType === Array;
@@ -31,17 +34,17 @@ export const ApiField = function (...args) {
31
34
  o[v] = v;
32
35
  return o;
33
36
  }, {});
34
- EnumType(enumObj);
37
+ (0, enum_type_js_1.EnumType)(enumObj);
35
38
  elemMeta.enum = enumObj;
36
39
  }
37
40
  else {
38
- const m = Reflect.getOwnMetadata(METADATA_KEY, options?.enum);
39
- if (!OpraSchema.isEnumType(m))
41
+ const m = Reflect.getOwnMetadata(constants_js_1.METADATA_KEY, options?.enum);
42
+ if (!index_js_2.OpraSchema.isEnumType(m))
40
43
  throw new TypeError(`Invalid "enum" value. Did you forget to set metadata using EnumType() method?`);
41
44
  elemMeta.enum = options.enum;
42
45
  }
43
46
  }
44
- Reflect.defineMetadata(METADATA_KEY, omitUndefined(metadata), target.constructor);
47
+ Reflect.defineMetadata(constants_js_1.METADATA_KEY, (0, index_js_1.omitUndefined)(metadata), target.constructor);
45
48
  };
46
49
  }
47
50
  // Constructor
@@ -76,4 +79,4 @@ const proto = {
76
79
  return out;
77
80
  }
78
81
  };
79
- Object.assign(ApiField.prototype, proto);
82
+ Object.assign(exports.ApiField.prototype, proto);
@@ -1,11 +1,14 @@
1
- import { __decorate } from "tslib";
2
- import { SimpleType } from '../simple-type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnyType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const simple_type_js_1 = require("../simple-type.js");
3
6
  let AnyType = class AnyType {
4
7
  };
5
- AnyType = __decorate([
6
- SimpleType({
8
+ AnyType = tslib_1.__decorate([
9
+ (0, simple_type_js_1.SimpleType)({
7
10
  description: 'Any value',
8
11
  ctor: Object
9
12
  })
10
13
  ], AnyType);
11
- export { AnyType };
14
+ exports.AnyType = AnyType;
@@ -1,5 +1,8 @@
1
- import { __decorate } from "tslib";
2
- import { SimpleType } from '../simple-type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Base64Type = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const simple_type_js_1 = require("../simple-type.js");
3
6
  const BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:(?:[A-Za-z0-9+/][AQgw](:?==)?)|(?:[A-Za-z0-9+/]{2}[AEIMQUYcgkosw048]=?))?$/;
4
7
  let Base64Type = class Base64Type {
5
8
  decode(v) {
@@ -26,10 +29,10 @@ let Base64Type = class Base64Type {
26
29
  throw new TypeError(`Invalid base64 value "${String(v).substring(0, 10)}..."`);
27
30
  }
28
31
  };
29
- Base64Type = __decorate([
30
- SimpleType({
32
+ Base64Type = tslib_1.__decorate([
33
+ (0, simple_type_js_1.SimpleType)({
31
34
  description: 'A stream of bytes, base64 encoded',
32
35
  ctor: ArrayBuffer
33
36
  })
34
37
  ], Base64Type);
35
- export { Base64Type };
38
+ exports.Base64Type = Base64Type;
@@ -1,5 +1,8 @@
1
- import { __decorate } from "tslib";
2
- import { SimpleType } from '../simple-type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BigIntType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const simple_type_js_1 = require("../simple-type.js");
3
6
  const BigIntConstructor = Object.getPrototypeOf(BigInt(0)).constructor;
4
7
  let BigIntType = class BigIntType {
5
8
  decode(v) {
@@ -20,11 +23,11 @@ let BigIntType = class BigIntType {
20
23
  throw new TypeError(`Invalid number value "${v}"`);
21
24
  }
22
25
  };
23
- BigIntType = __decorate([
24
- SimpleType({
26
+ BigIntType = tslib_1.__decorate([
27
+ (0, simple_type_js_1.SimpleType)({
25
28
  name: 'bigint',
26
29
  description: 'BigInt number',
27
30
  ctor: BigIntConstructor
28
31
  })
29
32
  ], BigIntType);
30
- export { BigIntType };
33
+ exports.BigIntType = BigIntType;
@@ -1,25 +1,28 @@
1
- import { __decorate } from "tslib";
2
- import { toBoolean } from 'putil-varhelpers';
3
- import { SimpleType } from '../simple-type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BooleanType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const putil_varhelpers_1 = require("putil-varhelpers");
6
+ const simple_type_js_1 = require("../simple-type.js");
4
7
  let BooleanType = class BooleanType {
5
8
  decode(v) {
6
9
  if (v == null)
7
10
  return v;
8
- return toBoolean(v);
11
+ return (0, putil_varhelpers_1.toBoolean)(v);
9
12
  }
10
13
  encode(v) {
11
14
  if (v == null)
12
15
  return v;
13
- return toBoolean(v);
16
+ return (0, putil_varhelpers_1.toBoolean)(v);
14
17
  }
15
18
  coerce(v) {
16
19
  return this.decode(v);
17
20
  }
18
21
  };
19
- BooleanType = __decorate([
20
- SimpleType({
22
+ BooleanType = tslib_1.__decorate([
23
+ (0, simple_type_js_1.SimpleType)({
21
24
  description: 'Simple true/false value',
22
25
  ctor: Boolean
23
26
  })
24
27
  ], BooleanType);
25
- export { BooleanType };
28
+ exports.BooleanType = BooleanType;
@@ -1,15 +1,18 @@
1
- import { __decorate } from "tslib";
2
- import { SimpleType } from '../simple-type.js';
3
- import { TimestampType } from './timestamp.type.js';
4
- let DateType = class DateType extends TimestampType {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const simple_type_js_1 = require("../simple-type.js");
6
+ const timestamp_type_js_1 = require("./timestamp.type.js");
7
+ let DateType = class DateType extends timestamp_type_js_1.TimestampType {
5
8
  constructor() {
6
9
  super(...arguments);
7
10
  this.format = 'YYYY-MM-DD';
8
11
  }
9
12
  };
10
- DateType = __decorate([
11
- SimpleType({
13
+ DateType = tslib_1.__decorate([
14
+ (0, simple_type_js_1.SimpleType)({
12
15
  description: 'full-date notation as defined by RFC 3339, section 5.6, for example, 2021-04-18',
13
16
  })
14
17
  ], DateType);
15
- export { DateType };
18
+ exports.DateType = DateType;
@@ -1,13 +1,16 @@
1
- import { __decorate } from "tslib";
2
- import { toString } from 'putil-varhelpers';
3
- import { SimpleType } from '../simple-type.js';
4
- import { StringType } from './string.type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuidType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const putil_varhelpers_1 = require("putil-varhelpers");
6
+ const simple_type_js_1 = require("../simple-type.js");
7
+ const string_type_js_1 = require("./string.type.js");
5
8
  const GUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
6
- let GuidType = class GuidType extends StringType {
9
+ let GuidType = class GuidType extends string_type_js_1.StringType {
7
10
  decode(v) {
8
11
  if (v == null)
9
12
  return v;
10
- const s = toString(v);
13
+ const s = (0, putil_varhelpers_1.toString)(v);
11
14
  if (s)
12
15
  this.validate(s);
13
16
  return s;
@@ -24,9 +27,9 @@ let GuidType = class GuidType extends StringType {
24
27
  throw new TypeError(`Invalid GUID value "${v}"`);
25
28
  }
26
29
  };
27
- GuidType = __decorate([
28
- SimpleType({
30
+ GuidType = tslib_1.__decorate([
31
+ (0, simple_type_js_1.SimpleType)({
29
32
  description: 'A Globally Unique Identifier (GUID) value',
30
33
  })
31
34
  ], GuidType);
32
- export { GuidType };
35
+ exports.GuidType = GuidType;
@@ -1,10 +1,13 @@
1
- export * from './any.type.js';
2
- export * from './base64.type.js';
3
- export * from './bigint.type.js';
4
- export * from './boolean.type.js';
5
- export * from './date.type.js';
6
- export * from './guid.type.js';
7
- export * from './integer.type.js';
8
- export * from './number.type.js';
9
- export * from './object.type.js';
10
- export * from './string.type.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./any.type.js"), exports);
5
+ tslib_1.__exportStar(require("./base64.type.js"), exports);
6
+ tslib_1.__exportStar(require("./bigint.type.js"), exports);
7
+ tslib_1.__exportStar(require("./boolean.type.js"), exports);
8
+ tslib_1.__exportStar(require("./date.type.js"), exports);
9
+ tslib_1.__exportStar(require("./guid.type.js"), exports);
10
+ tslib_1.__exportStar(require("./integer.type.js"), exports);
11
+ tslib_1.__exportStar(require("./number.type.js"), exports);
12
+ tslib_1.__exportStar(require("./object.type.js"), exports);
13
+ tslib_1.__exportStar(require("./string.type.js"), exports);
@@ -1,25 +1,28 @@
1
- import { __decorate } from "tslib";
2
- import { toInt } from 'putil-varhelpers';
3
- import { SimpleType } from '../simple-type.js';
4
- import { NumberType } from './number.type.js';
5
- let IntegerType = class IntegerType extends NumberType {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegerType = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const putil_varhelpers_1 = require("putil-varhelpers");
6
+ const simple_type_js_1 = require("../simple-type.js");
7
+ const number_type_js_1 = require("./number.type.js");
8
+ let IntegerType = class IntegerType extends number_type_js_1.NumberType {
6
9
  decode(v) {
7
10
  if (v == null)
8
11
  return v;
9
- return toInt(super.decode(v));
12
+ return (0, putil_varhelpers_1.toInt)(super.decode(v));
10
13
  }
11
14
  encode(v) {
12
15
  if (v == null)
13
16
  return v;
14
- return toInt(super.encode(v));
17
+ return (0, putil_varhelpers_1.toInt)(super.encode(v));
15
18
  }
16
19
  coerce(v) {
17
20
  return this.decode(v);
18
21
  }
19
22
  };
20
- IntegerType = __decorate([
21
- SimpleType({
23
+ IntegerType = tslib_1.__decorate([
24
+ (0, simple_type_js_1.SimpleType)({
22
25
  description: 'An integer number',
23
26
  })
24
27
  ], IntegerType);
25
- export { IntegerType };
28
+ exports.IntegerType = IntegerType;