@opra/common 0.5.0 → 0.6.0

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 (419) hide show
  1. package/cjs/constants.js +1 -0
  2. package/cjs/exception/enums/issue-severity.enum.js +23 -0
  3. package/cjs/{types.js → exception/error-issue.js} +0 -0
  4. package/cjs/exception/http-errors/bad-request.error.js +22 -0
  5. package/cjs/exception/http-errors/failed-dependency.error.js +21 -0
  6. package/cjs/exception/http-errors/forbidden.error.js +23 -0
  7. package/cjs/exception/http-errors/internal-server.error.js +21 -0
  8. package/cjs/exception/http-errors/method-not-allowed.error.js +22 -0
  9. package/cjs/exception/http-errors/not-acceptable.error.js +22 -0
  10. package/cjs/exception/http-errors/not-found.error.js +25 -0
  11. package/cjs/exception/http-errors/unauthorized.error.js +22 -0
  12. package/cjs/exception/http-errors/unprocessable-entity.error.js +21 -0
  13. package/cjs/exception/index.js +18 -0
  14. package/cjs/exception/opra-exception.js +56 -0
  15. package/cjs/exception/resource-errors/resource-conflict.error.js +20 -0
  16. package/cjs/exception/resource-errors/resource-not-found.error.js +20 -0
  17. package/cjs/exception/wrap-exception.js +42 -0
  18. package/cjs/filter/antlr/OpraFilterLexer.js +386 -0
  19. package/cjs/filter/antlr/OpraFilterParser.js +2070 -0
  20. package/cjs/filter/antlr/OpraFilterVisitor.js +3 -0
  21. package/cjs/filter/ast/abstract/ast.js +10 -0
  22. package/cjs/filter/ast/abstract/expression.js +7 -0
  23. package/cjs/filter/ast/abstract/literal.js +14 -0
  24. package/cjs/filter/ast/abstract/term.js +7 -0
  25. package/cjs/filter/ast/expressions/arithmetic-expression.js +29 -0
  26. package/cjs/filter/ast/expressions/array-expression.js +15 -0
  27. package/cjs/filter/ast/expressions/comparison-expression.js +18 -0
  28. package/cjs/filter/ast/expressions/logical-expression.js +18 -0
  29. package/cjs/filter/ast/expressions/parentheses-expression.js +15 -0
  30. package/cjs/filter/ast/index.js +19 -0
  31. package/cjs/filter/ast/terms/boolean-literal.js +10 -0
  32. package/cjs/filter/ast/terms/date-literal.js +28 -0
  33. package/cjs/filter/ast/terms/external-constant.js +13 -0
  34. package/cjs/filter/ast/terms/null-literal.js +11 -0
  35. package/cjs/filter/ast/terms/number-literal.js +40 -0
  36. package/cjs/filter/ast/terms/qualified-identifier.js +10 -0
  37. package/cjs/filter/ast/terms/string-literal.js +14 -0
  38. package/cjs/filter/ast/terms/time-literal.js +33 -0
  39. package/cjs/filter/build.js +129 -0
  40. package/cjs/filter/error-listener.js +14 -0
  41. package/cjs/filter/errors.js +21 -0
  42. package/cjs/filter/filter-tree-visitor.js +113 -0
  43. package/cjs/filter/index.js +8 -0
  44. package/cjs/filter/parse.js +37 -0
  45. package/cjs/filter/utils.js +26 -0
  46. package/cjs/helpers/index.js +4 -0
  47. package/cjs/{classes → helpers}/responsive-map.js +1 -1
  48. package/cjs/{enums → http/enums}/http-headers.enum.js +9 -0
  49. package/cjs/{enums → http/enums}/http-status.enum.js +0 -0
  50. package/cjs/http/http-request.js +118 -0
  51. package/cjs/http/index.js +9 -0
  52. package/cjs/http/interfaces/client-http-headers.interface.js +2 -0
  53. package/cjs/http/interfaces/server-http-headers.interface.js +2 -0
  54. package/cjs/http/multipart/batch-multipart.js +155 -0
  55. package/cjs/http/multipart/http-request-content.js +16 -0
  56. package/cjs/http/multipart/http-response-content.js +14 -0
  57. package/cjs/http/multipart/index.js +4 -0
  58. package/cjs/http/utils/normalize-headers.js +28 -0
  59. package/cjs/i18n/i18n.js +175 -0
  60. package/cjs/i18n/index.js +10 -0
  61. package/cjs/i18n/string-utils.js +13 -0
  62. package/cjs/i18n/translate.js +15 -0
  63. package/cjs/index.js +12 -5
  64. package/cjs/schema/constants.js +11 -0
  65. package/cjs/schema/decorators/opr-collection-resource.decorator.js +23 -0
  66. package/cjs/schema/decorators/opr-complex-type.decorator.js +27 -0
  67. package/cjs/schema/decorators/opr-field.decorator.js +28 -0
  68. package/cjs/schema/decorators/opr-resolver.decorator.js +81 -0
  69. package/cjs/schema/decorators/opr-simple-type.decorator.js +18 -0
  70. package/cjs/schema/decorators/opr-singleton-resource.decorator.js +23 -0
  71. package/cjs/schema/implementation/data-type/builtin/any.type.js +9 -0
  72. package/cjs/schema/implementation/data-type/builtin/base64-binary.type.js +15 -0
  73. package/cjs/schema/implementation/data-type/builtin/bigint.type.js +15 -0
  74. package/cjs/schema/implementation/data-type/builtin/boolean.type.js +15 -0
  75. package/cjs/schema/implementation/data-type/builtin/date-string.type.js +15 -0
  76. package/cjs/schema/implementation/data-type/builtin/date.type.js +15 -0
  77. package/cjs/schema/implementation/data-type/builtin/guid.type.js +15 -0
  78. package/cjs/schema/implementation/data-type/builtin/integer.type.js +15 -0
  79. package/cjs/schema/implementation/data-type/builtin/number.type.js +15 -0
  80. package/cjs/schema/implementation/data-type/builtin/object.type.js +15 -0
  81. package/cjs/schema/implementation/data-type/builtin/string.type.js +15 -0
  82. package/cjs/schema/implementation/data-type/builtin-data-types.js +37 -0
  83. package/cjs/schema/implementation/data-type/complex-type.js +111 -0
  84. package/cjs/schema/implementation/data-type/data-type.js +36 -0
  85. package/cjs/schema/implementation/data-type/simple-type.js +21 -0
  86. package/cjs/schema/implementation/data-type/union-type.js +25 -0
  87. package/cjs/schema/implementation/document-builder.js +140 -0
  88. package/cjs/schema/implementation/opra-document.js +181 -0
  89. package/cjs/schema/implementation/query/collection-count-query.js +19 -0
  90. package/cjs/schema/implementation/query/collection-create-query.js +28 -0
  91. package/cjs/schema/implementation/query/collection-delete-many-query.js +19 -0
  92. package/cjs/schema/implementation/query/collection-delete-query.js +27 -0
  93. package/cjs/schema/implementation/query/collection-get-query.js +38 -0
  94. package/cjs/schema/implementation/query/collection-search-query.js +55 -0
  95. package/cjs/schema/implementation/query/collection-update-many-query.js +21 -0
  96. package/cjs/schema/implementation/query/collection-update-query.js +39 -0
  97. package/cjs/schema/implementation/query/field-get-query.js +45 -0
  98. package/cjs/schema/implementation/query/index.js +22 -0
  99. package/cjs/schema/implementation/query/singleton-get-query.js +27 -0
  100. package/cjs/schema/implementation/resource/collection-resource-info.js +58 -0
  101. package/cjs/schema/implementation/resource/container-resource-info.js +30 -0
  102. package/cjs/schema/implementation/resource/resource-info.js +39 -0
  103. package/cjs/schema/implementation/resource/singleton-resource-info.js +37 -0
  104. package/cjs/schema/implementation/schema-builder/extract-resource-metadata.util.js +84 -0
  105. package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +94 -0
  106. package/cjs/schema/index.js +28 -0
  107. package/cjs/schema/interfaces/child-field-query.interface.js +2 -0
  108. package/cjs/schema/interfaces/data-type.metadata.js +2 -0
  109. package/cjs/schema/interfaces/resource-container.interface.js +2 -0
  110. package/cjs/schema/interfaces/resource.metadata.js +2 -0
  111. package/cjs/schema/opra-schema.definition.js +49 -0
  112. package/cjs/schema/type-helpers/extend-type.helper.js +65 -0
  113. package/cjs/schema/type-helpers/mixin-type.helper.js +46 -0
  114. package/cjs/schema/type-helpers/mixin.utils.js +32 -0
  115. package/cjs/schema/types.js +2 -0
  116. package/cjs/schema/utils/class.utils.js +8 -0
  117. package/cjs/schema/utils/clone-object.util.js +19 -0
  118. package/cjs/schema/utils/inspect.util.js +7 -0
  119. package/cjs/schema/utils/normalize-field-array.util.js +44 -0
  120. package/cjs/schema/utils/path-to-tree.util.js +26 -0
  121. package/cjs/schema/utils/string-compare.util.js +11 -0
  122. package/cjs/url/formats/boolean-format.js +25 -0
  123. package/cjs/url/formats/date-format.js +48 -0
  124. package/cjs/url/formats/filter-format.js +18 -0
  125. package/cjs/url/formats/format.js +6 -0
  126. package/cjs/url/formats/integer-format.js +20 -0
  127. package/cjs/url/formats/number-format.js +28 -0
  128. package/cjs/url/formats/string-format.js +28 -0
  129. package/cjs/url/index.js +8 -0
  130. package/cjs/url/opra-url-path-component.js +33 -0
  131. package/cjs/url/opra-url-path.js +128 -0
  132. package/cjs/url/opra-url-search-params.js +247 -0
  133. package/cjs/url/opra-url.js +299 -0
  134. package/cjs/url/utils/path-utils.js +86 -0
  135. package/cjs/utils/index.js +6 -0
  136. package/cjs/utils/is-url.js +8 -0
  137. package/cjs/utils/path-to-tree.js +28 -0
  138. package/cjs/utils/type-guards.js +46 -0
  139. package/esm/constants.d.ts +0 -0
  140. package/esm/constants.js +1 -0
  141. package/esm/exception/enums/issue-severity.enum.d.ts +13 -0
  142. package/esm/exception/enums/issue-severity.enum.js +20 -0
  143. package/esm/exception/error-issue.d.ts +9 -0
  144. package/esm/{types.js → exception/error-issue.js} +0 -0
  145. package/esm/exception/http-errors/bad-request.error.d.ts +10 -0
  146. package/esm/exception/http-errors/bad-request.error.js +18 -0
  147. package/esm/exception/http-errors/failed-dependency.error.d.ts +9 -0
  148. package/esm/exception/http-errors/failed-dependency.error.js +17 -0
  149. package/esm/exception/http-errors/forbidden.error.d.ts +11 -0
  150. package/esm/exception/http-errors/forbidden.error.js +19 -0
  151. package/esm/exception/http-errors/internal-server.error.d.ts +9 -0
  152. package/esm/exception/http-errors/internal-server.error.js +17 -0
  153. package/esm/exception/http-errors/method-not-allowed.error.d.ts +10 -0
  154. package/esm/exception/http-errors/method-not-allowed.error.js +18 -0
  155. package/esm/exception/http-errors/not-acceptable.error.d.ts +10 -0
  156. package/esm/exception/http-errors/not-acceptable.error.js +18 -0
  157. package/esm/exception/http-errors/not-found.error.d.ts +13 -0
  158. package/esm/exception/http-errors/not-found.error.js +21 -0
  159. package/esm/exception/http-errors/unauthorized.error.d.ts +10 -0
  160. package/esm/exception/http-errors/unauthorized.error.js +18 -0
  161. package/esm/exception/http-errors/unprocessable-entity.error.d.ts +9 -0
  162. package/esm/exception/http-errors/unprocessable-entity.error.js +17 -0
  163. package/esm/exception/index.d.ts +15 -0
  164. package/esm/exception/index.js +15 -0
  165. package/esm/exception/opra-exception.d.ts +15 -0
  166. package/esm/exception/opra-exception.js +52 -0
  167. package/esm/exception/resource-errors/resource-conflict.error.d.ts +5 -0
  168. package/esm/exception/resource-errors/resource-conflict.error.js +16 -0
  169. package/esm/exception/resource-errors/resource-not-found.error.d.ts +4 -0
  170. package/esm/exception/resource-errors/resource-not-found.error.js +16 -0
  171. package/esm/exception/wrap-exception.d.ts +2 -0
  172. package/esm/exception/wrap-exception.js +38 -0
  173. package/esm/filter/antlr/OpraFilterLexer.d.ts +78 -0
  174. package/esm/filter/antlr/OpraFilterLexer.js +381 -0
  175. package/esm/filter/antlr/OpraFilterParser.d.ts +365 -0
  176. package/esm/filter/antlr/OpraFilterParser.js +2022 -0
  177. package/esm/filter/antlr/OpraFilterVisitor.d.ts +290 -0
  178. package/esm/filter/antlr/OpraFilterVisitor.js +2 -0
  179. package/esm/filter/ast/abstract/ast.d.ts +5 -0
  180. package/esm/filter/ast/abstract/ast.js +6 -0
  181. package/esm/filter/ast/abstract/expression.d.ts +3 -0
  182. package/esm/filter/ast/abstract/expression.js +3 -0
  183. package/esm/filter/ast/abstract/literal.d.ts +6 -0
  184. package/esm/filter/ast/abstract/literal.js +10 -0
  185. package/esm/filter/ast/abstract/term.d.ts +3 -0
  186. package/esm/filter/ast/abstract/term.js +3 -0
  187. package/esm/filter/ast/expressions/arithmetic-expression.d.ts +13 -0
  188. package/esm/filter/ast/expressions/arithmetic-expression.js +24 -0
  189. package/esm/filter/ast/expressions/array-expression.d.ts +7 -0
  190. package/esm/filter/ast/expressions/array-expression.js +11 -0
  191. package/esm/filter/ast/expressions/comparison-expression.d.ts +10 -0
  192. package/esm/filter/ast/expressions/comparison-expression.js +14 -0
  193. package/esm/filter/ast/expressions/logical-expression.d.ts +8 -0
  194. package/esm/filter/ast/expressions/logical-expression.js +14 -0
  195. package/esm/filter/ast/expressions/parentheses-expression.d.ts +6 -0
  196. package/esm/filter/ast/expressions/parentheses-expression.js +11 -0
  197. package/esm/filter/ast/index.d.ts +16 -0
  198. package/esm/filter/ast/index.js +16 -0
  199. package/esm/filter/ast/terms/boolean-literal.d.ts +5 -0
  200. package/esm/filter/ast/terms/boolean-literal.js +6 -0
  201. package/esm/filter/ast/terms/date-literal.d.ts +6 -0
  202. package/esm/filter/ast/terms/date-literal.js +24 -0
  203. package/esm/filter/ast/terms/external-constant.d.ts +5 -0
  204. package/esm/filter/ast/terms/external-constant.js +9 -0
  205. package/esm/filter/ast/terms/null-literal.d.ts +5 -0
  206. package/esm/filter/ast/terms/null-literal.js +7 -0
  207. package/esm/filter/ast/terms/number-literal.d.ts +6 -0
  208. package/esm/filter/ast/terms/number-literal.js +36 -0
  209. package/esm/filter/ast/terms/qualified-identifier.d.ts +4 -0
  210. package/esm/filter/ast/terms/qualified-identifier.js +6 -0
  211. package/esm/filter/ast/terms/string-literal.d.ts +5 -0
  212. package/esm/filter/ast/terms/string-literal.js +10 -0
  213. package/esm/filter/ast/terms/time-literal.d.ts +6 -0
  214. package/esm/filter/ast/terms/time-literal.js +29 -0
  215. package/esm/filter/build.d.ts +31 -0
  216. package/esm/filter/build.js +105 -0
  217. package/esm/filter/error-listener.d.ts +8 -0
  218. package/esm/filter/error-listener.js +10 -0
  219. package/esm/filter/errors.d.ts +20 -0
  220. package/esm/filter/errors.js +15 -0
  221. package/esm/filter/filter-tree-visitor.d.ts +30 -0
  222. package/esm/filter/filter-tree-visitor.js +109 -0
  223. package/esm/filter/index.d.ts +5 -0
  224. package/esm/filter/index.js +5 -0
  225. package/esm/filter/parse.d.ts +2 -0
  226. package/esm/filter/parse.js +33 -0
  227. package/esm/filter/utils.d.ts +2 -0
  228. package/esm/filter/utils.js +21 -0
  229. package/esm/helpers/index.d.ts +1 -0
  230. package/esm/helpers/index.js +1 -0
  231. package/esm/{classes → helpers}/responsive-map.d.ts +0 -0
  232. package/esm/{classes → helpers}/responsive-map.js +1 -1
  233. package/esm/{enums → http/enums}/http-headers.enum.d.ts +9 -0
  234. package/esm/{enums → http/enums}/http-headers.enum.js +9 -0
  235. package/esm/{enums → http/enums}/http-status.enum.d.ts +0 -0
  236. package/esm/{enums → http/enums}/http-status.enum.js +0 -0
  237. package/esm/http/http-request.d.ts +34 -0
  238. package/esm/http/http-request.js +114 -0
  239. package/esm/http/index.d.ts +6 -0
  240. package/esm/http/index.js +6 -0
  241. package/esm/http/interfaces/client-http-headers.interface.d.ts +65 -0
  242. package/esm/http/interfaces/client-http-headers.interface.js +1 -0
  243. package/esm/http/interfaces/server-http-headers.interface.d.ts +1 -0
  244. package/esm/http/interfaces/server-http-headers.interface.js +1 -0
  245. package/esm/http/multipart/batch-multipart.d.ts +30 -0
  246. package/esm/http/multipart/batch-multipart.js +150 -0
  247. package/esm/http/multipart/http-request-content.d.ts +8 -0
  248. package/esm/http/multipart/http-request-content.js +12 -0
  249. package/esm/http/multipart/http-response-content.d.ts +7 -0
  250. package/esm/http/multipart/http-response-content.js +10 -0
  251. package/esm/http/multipart/index.d.ts +1 -0
  252. package/esm/http/multipart/index.js +1 -0
  253. package/esm/http/utils/normalize-headers.d.ts +1 -0
  254. package/esm/http/utils/normalize-headers.js +24 -0
  255. package/esm/i18n/i18n.d.ts +28 -0
  256. package/esm/i18n/i18n.js +170 -0
  257. package/esm/i18n/index.d.ts +5 -0
  258. package/esm/i18n/index.js +6 -0
  259. package/esm/i18n/string-utils.d.ts +2 -0
  260. package/esm/i18n/string-utils.js +8 -0
  261. package/esm/i18n/translate.d.ts +4 -0
  262. package/esm/i18n/translate.js +11 -0
  263. package/esm/index.d.ts +10 -5
  264. package/esm/index.js +10 -5
  265. package/esm/schema/constants.d.ts +8 -0
  266. package/esm/schema/constants.js +8 -0
  267. package/esm/schema/decorators/opr-collection-resource.decorator.d.ts +8 -0
  268. package/esm/schema/decorators/opr-collection-resource.decorator.js +19 -0
  269. package/esm/schema/decorators/opr-complex-type.decorator.d.ts +6 -0
  270. package/esm/schema/decorators/opr-complex-type.decorator.js +23 -0
  271. package/esm/schema/decorators/opr-field.decorator.d.ts +3 -0
  272. package/esm/schema/decorators/opr-field.decorator.js +24 -0
  273. package/esm/schema/decorators/opr-resolver.decorator.d.ts +8 -0
  274. package/esm/schema/decorators/opr-resolver.decorator.js +71 -0
  275. package/esm/schema/decorators/opr-simple-type.decorator.d.ts +6 -0
  276. package/esm/schema/decorators/opr-simple-type.decorator.js +14 -0
  277. package/esm/schema/decorators/opr-singleton-resource.decorator.d.ts +8 -0
  278. package/esm/schema/decorators/opr-singleton-resource.decorator.js +19 -0
  279. package/esm/schema/implementation/data-type/builtin/any.type.d.ts +2 -0
  280. package/esm/schema/implementation/data-type/builtin/any.type.js +6 -0
  281. package/esm/schema/implementation/data-type/builtin/base64-binary.type.d.ts +2 -0
  282. package/esm/schema/implementation/data-type/builtin/base64-binary.type.js +12 -0
  283. package/esm/schema/implementation/data-type/builtin/bigint.type.d.ts +2 -0
  284. package/esm/schema/implementation/data-type/builtin/bigint.type.js +12 -0
  285. package/esm/schema/implementation/data-type/builtin/boolean.type.d.ts +2 -0
  286. package/esm/schema/implementation/data-type/builtin/boolean.type.js +12 -0
  287. package/esm/schema/implementation/data-type/builtin/date-string.type.d.ts +2 -0
  288. package/esm/schema/implementation/data-type/builtin/date-string.type.js +12 -0
  289. package/esm/schema/implementation/data-type/builtin/date.type.d.ts +2 -0
  290. package/esm/schema/implementation/data-type/builtin/date.type.js +12 -0
  291. package/esm/schema/implementation/data-type/builtin/guid.type.d.ts +2 -0
  292. package/esm/schema/implementation/data-type/builtin/guid.type.js +12 -0
  293. package/esm/schema/implementation/data-type/builtin/integer.type.d.ts +2 -0
  294. package/esm/schema/implementation/data-type/builtin/integer.type.js +12 -0
  295. package/esm/schema/implementation/data-type/builtin/number.type.d.ts +2 -0
  296. package/esm/schema/implementation/data-type/builtin/number.type.js +12 -0
  297. package/esm/schema/implementation/data-type/builtin/object.type.d.ts +2 -0
  298. package/esm/schema/implementation/data-type/builtin/object.type.js +12 -0
  299. package/esm/schema/implementation/data-type/builtin/string.type.d.ts +2 -0
  300. package/esm/schema/implementation/data-type/builtin/string.type.js +12 -0
  301. package/esm/schema/implementation/data-type/builtin-data-types.d.ts +4 -0
  302. package/esm/schema/implementation/data-type/builtin-data-types.js +34 -0
  303. package/esm/schema/implementation/data-type/complex-type.d.ts +29 -0
  304. package/esm/schema/implementation/data-type/complex-type.js +107 -0
  305. package/esm/schema/implementation/data-type/data-type.d.ts +16 -0
  306. package/esm/schema/implementation/data-type/data-type.js +32 -0
  307. package/esm/schema/implementation/data-type/simple-type.d.ts +12 -0
  308. package/esm/schema/implementation/data-type/simple-type.js +17 -0
  309. package/esm/schema/implementation/data-type/union-type.d.ts +16 -0
  310. package/esm/schema/implementation/data-type/union-type.js +21 -0
  311. package/esm/schema/implementation/document-builder.d.ts +16 -0
  312. package/esm/schema/implementation/document-builder.js +135 -0
  313. package/esm/schema/implementation/opra-document.d.ts +44 -0
  314. package/esm/schema/implementation/opra-document.js +177 -0
  315. package/esm/schema/implementation/query/collection-count-query.d.ts +14 -0
  316. package/esm/schema/implementation/query/collection-count-query.js +15 -0
  317. package/esm/schema/implementation/query/collection-create-query.d.ts +18 -0
  318. package/esm/schema/implementation/query/collection-create-query.js +24 -0
  319. package/esm/schema/implementation/query/collection-delete-many-query.d.ts +14 -0
  320. package/esm/schema/implementation/query/collection-delete-many-query.js +15 -0
  321. package/esm/schema/implementation/query/collection-delete-query.d.ts +10 -0
  322. package/esm/schema/implementation/query/collection-delete-query.js +23 -0
  323. package/esm/schema/implementation/query/collection-get-query.d.ts +21 -0
  324. package/esm/schema/implementation/query/collection-get-query.js +34 -0
  325. package/esm/schema/implementation/query/collection-search-query.d.ts +30 -0
  326. package/esm/schema/implementation/query/collection-search-query.js +51 -0
  327. package/esm/schema/implementation/query/collection-update-many-query.d.ts +15 -0
  328. package/esm/schema/implementation/query/collection-update-many-query.js +17 -0
  329. package/esm/schema/implementation/query/collection-update-query.d.ts +19 -0
  330. package/esm/schema/implementation/query/collection-update-query.js +35 -0
  331. package/esm/schema/implementation/query/field-get-query.d.ts +30 -0
  332. package/esm/schema/implementation/query/field-get-query.js +41 -0
  333. package/esm/schema/implementation/query/index.d.ts +27 -0
  334. package/esm/schema/implementation/query/index.js +17 -0
  335. package/esm/schema/implementation/query/singleton-get-query.d.ts +20 -0
  336. package/esm/schema/implementation/query/singleton-get-query.js +23 -0
  337. package/esm/schema/implementation/resource/collection-resource-info.d.ts +19 -0
  338. package/esm/schema/implementation/resource/collection-resource-info.js +54 -0
  339. package/esm/schema/implementation/resource/container-resource-info.d.ts +13 -0
  340. package/esm/schema/implementation/resource/container-resource-info.js +26 -0
  341. package/esm/schema/implementation/resource/resource-info.d.ts +17 -0
  342. package/esm/schema/implementation/resource/resource-info.js +35 -0
  343. package/esm/schema/implementation/resource/singleton-resource-info.d.ts +14 -0
  344. package/esm/schema/implementation/resource/singleton-resource-info.js +33 -0
  345. package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +3 -0
  346. package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.js +80 -0
  347. package/esm/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +4 -0
  348. package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +89 -0
  349. package/esm/schema/index.d.ts +25 -0
  350. package/esm/schema/index.js +25 -0
  351. package/esm/schema/interfaces/child-field-query.interface.d.ts +4 -0
  352. package/esm/schema/interfaces/child-field-query.interface.js +1 -0
  353. package/esm/schema/interfaces/data-type.metadata.d.ts +18 -0
  354. package/esm/schema/interfaces/data-type.metadata.js +1 -0
  355. package/esm/schema/interfaces/resource-container.interface.d.ts +8 -0
  356. package/esm/schema/interfaces/resource-container.interface.js +1 -0
  357. package/esm/schema/interfaces/resource.metadata.d.ts +18 -0
  358. package/esm/schema/interfaces/resource.metadata.js +1 -0
  359. package/esm/schema/opra-schema.definition.d.ts +178 -0
  360. package/esm/schema/opra-schema.definition.js +46 -0
  361. package/esm/schema/type-helpers/extend-type.helper.d.ts +3 -0
  362. package/esm/schema/type-helpers/extend-type.helper.js +59 -0
  363. package/esm/schema/type-helpers/mixin-type.helper.d.ts +2 -0
  364. package/esm/schema/type-helpers/mixin-type.helper.js +41 -0
  365. package/esm/schema/type-helpers/mixin.utils.d.ts +3 -0
  366. package/esm/schema/type-helpers/mixin.utils.js +27 -0
  367. package/esm/{types.d.ts → schema/types.d.ts} +8 -1
  368. package/esm/schema/types.js +1 -0
  369. package/esm/schema/utils/class.utils.d.ts +2 -0
  370. package/esm/schema/utils/class.utils.js +4 -0
  371. package/esm/schema/utils/clone-object.util.d.ts +1 -0
  372. package/esm/schema/utils/clone-object.util.js +14 -0
  373. package/esm/schema/utils/inspect.util.d.ts +4 -0
  374. package/esm/schema/utils/inspect.util.js +4 -0
  375. package/esm/schema/utils/normalize-field-array.util.d.ts +3 -0
  376. package/esm/schema/utils/normalize-field-array.util.js +40 -0
  377. package/esm/schema/utils/path-to-tree.util.d.ts +4 -0
  378. package/esm/schema/utils/path-to-tree.util.js +22 -0
  379. package/esm/schema/utils/string-compare.util.d.ts +1 -0
  380. package/esm/schema/utils/string-compare.util.js +7 -0
  381. package/esm/url/formats/boolean-format.d.ts +5 -0
  382. package/esm/url/formats/boolean-format.js +21 -0
  383. package/esm/url/formats/date-format.d.ts +16 -0
  384. package/esm/url/formats/date-format.js +44 -0
  385. package/esm/url/formats/filter-format.d.ts +6 -0
  386. package/esm/url/formats/filter-format.js +14 -0
  387. package/esm/url/formats/format.d.ts +4 -0
  388. package/esm/url/formats/format.js +2 -0
  389. package/esm/url/formats/integer-format.d.ts +9 -0
  390. package/esm/url/formats/integer-format.js +16 -0
  391. package/esm/url/formats/number-format.d.ts +12 -0
  392. package/esm/url/formats/number-format.js +24 -0
  393. package/esm/url/formats/string-format.d.ts +14 -0
  394. package/esm/url/formats/string-format.js +24 -0
  395. package/esm/url/index.d.ts +5 -0
  396. package/esm/url/index.js +5 -0
  397. package/esm/url/opra-url-path-component.d.ts +15 -0
  398. package/esm/url/opra-url-path-component.js +29 -0
  399. package/esm/url/opra-url-path.d.ts +30 -0
  400. package/esm/url/opra-url-path.js +124 -0
  401. package/esm/url/opra-url-search-params.d.ts +46 -0
  402. package/esm/url/opra-url-search-params.js +243 -0
  403. package/esm/url/opra-url.d.ts +79 -0
  404. package/esm/url/opra-url.js +295 -0
  405. package/esm/url/utils/path-utils.d.ts +8 -0
  406. package/esm/url/utils/path-utils.js +78 -0
  407. package/esm/utils/index.d.ts +3 -0
  408. package/esm/utils/index.js +3 -0
  409. package/esm/utils/is-url.d.ts +1 -0
  410. package/esm/utils/is-url.js +4 -0
  411. package/esm/utils/path-to-tree.d.ts +4 -0
  412. package/esm/utils/path-to-tree.js +24 -0
  413. package/esm/utils/type-guards.d.ts +9 -0
  414. package/esm/utils/type-guards.js +37 -0
  415. package/package.json +30 -10
  416. package/umd/opra-common.umd.min.js +1 -0
  417. package/cjs/classes/headers-map.js +0 -18
  418. package/esm/classes/headers-map.d.ts +0 -5
  419. package/esm/classes/headers-map.js +0 -14
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IssueSeverity = void 0;
4
+ var IssueSeverity;
5
+ (function (IssueSeverity) {
6
+ let Enum;
7
+ (function (Enum) {
8
+ Enum["fatal"] = "fatal";
9
+ Enum["error"] = "error";
10
+ Enum["warning"] = "warning";
11
+ Enum["info"] = "info";
12
+ })(Enum = IssueSeverity.Enum || (IssueSeverity.Enum = {}));
13
+ IssueSeverity.name = 'IssueSeverity';
14
+ IssueSeverity.description = 'Severity of the issue';
15
+ IssueSeverity.Keys = Object.keys(IssueSeverity);
16
+ IssueSeverity.descriptions = {
17
+ fatal: 'The issue caused the action to fail and no further checking could be performed',
18
+ error: 'The issue is sufficiently important to cause the action to fail',
19
+ warning: 'The issue is not important enough to cause the action to fail but ' +
20
+ 'may cause it to be performed suboptimally or in a way that is not as desired',
21
+ info: 'The issue has no relation to the degree of success of the action'
22
+ };
23
+ })(IssueSeverity = exports.IssueSeverity || (exports.IssueSeverity = {}));
File without changes
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 400 Bad Request
8
+ * The server cannot or will not process the request due to something that is perceived to be a client error
9
+ * (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
10
+ */
11
+ class BadRequestError extends opra_exception_js_1.OpraException {
12
+ status = 400;
13
+ setIssue(issue) {
14
+ super.setIssue({
15
+ message: (0, index_js_1.translate)('error:BAD_REQUEST', 'Bad request'),
16
+ severity: 'error',
17
+ code: 'BAD_REQUEST',
18
+ ...issue
19
+ });
20
+ }
21
+ }
22
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FailedDependencyError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 424 Failed Dependency
8
+ * The request failed due to failure of a previous request.
9
+ */
10
+ class FailedDependencyError extends opra_exception_js_1.OpraException {
11
+ status = 424;
12
+ setIssue(issue) {
13
+ super.setIssue({
14
+ message: (0, index_js_1.translate)('error:FAILED_DEPENDENCY', 'The request failed due to failure of a previous request'),
15
+ severity: 'error',
16
+ code: 'FAILED_DEPENDENCY',
17
+ ...issue
18
+ });
19
+ }
20
+ }
21
+ exports.FailedDependencyError = FailedDependencyError;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 403 Forbidden
8
+ * The client does not have access rights to the content; that is, it is unauthorized,
9
+ * so the server is refusing to give the requested resource. Unlike 401 Unauthorized,
10
+ * the client's identity is known to the server.
11
+ */
12
+ class ForbiddenError extends opra_exception_js_1.OpraException {
13
+ status = 403;
14
+ setIssue(issue) {
15
+ super.setIssue({
16
+ message: (0, index_js_1.translate)('error:FORBIDDEN', 'You are not authorized to perform this action'),
17
+ severity: 'error',
18
+ code: 'FORBIDDEN',
19
+ ...issue
20
+ });
21
+ }
22
+ }
23
+ exports.ForbiddenError = ForbiddenError;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalServerError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 500 Internal Server Error
8
+ * The server has encountered a situation it does not know how to handle.
9
+ */
10
+ class InternalServerError extends opra_exception_js_1.OpraException {
11
+ status = 500;
12
+ setIssue(issue) {
13
+ super.setIssue({
14
+ message: (0, index_js_1.translate)('error:INTERNAL_SERVER_ERROR', 'Internal server error'),
15
+ severity: 'error',
16
+ code: 'INTERNAL_SERVER_ERROR',
17
+ ...issue
18
+ });
19
+ }
20
+ }
21
+ exports.InternalServerError = InternalServerError;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MethodNotAllowedError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 405 Method Not Allowed
8
+ * The request method is known by the server but is not supported by the target resource.
9
+ * For example, an API may not allow calling DELETE to remove a resource.
10
+ */
11
+ class MethodNotAllowedError extends opra_exception_js_1.OpraException {
12
+ status = 405;
13
+ setIssue(issue) {
14
+ super.setIssue({
15
+ message: (0, index_js_1.translate)('error:METHOD_NOT_ALLOWED', 'Method not allowed'),
16
+ severity: 'error',
17
+ code: 'METHOD_NOT_ALLOWED',
18
+ ...issue
19
+ });
20
+ }
21
+ }
22
+ exports.MethodNotAllowedError = MethodNotAllowedError;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotAcceptableError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 406 Not Acceptable
8
+ * This response is sent when the web server, after performing server-driven content negotiation,
9
+ * doesn't find any content that conforms to the criteria given by the user agent.
10
+ */
11
+ class NotAcceptableError extends opra_exception_js_1.OpraException {
12
+ status = 406;
13
+ setIssue(issue) {
14
+ super.setIssue({
15
+ message: (0, index_js_1.translate)('error:NOT_ACCEPTABLE', 'Not Acceptable'),
16
+ severity: 'error',
17
+ code: 'NOT_ACCEPTABLE',
18
+ ...issue
19
+ });
20
+ }
21
+ }
22
+ exports.NotAcceptableError = NotAcceptableError;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 404 Not Found
8
+ * The server can not find the requested resource. In the browser, this means the URL is not recognized.
9
+ * In an API, this can also mean that the endpoint is valid but the resource itself does not exist.
10
+ * Servers may also send this response instead of 403 Forbidden to hide the existence of a resource
11
+ * from an unauthorized client. This response code is probably the most well known due to its
12
+ * frequent occurrence on the web.
13
+ */
14
+ class NotFoundError extends opra_exception_js_1.OpraException {
15
+ status = 404;
16
+ setIssue(issue) {
17
+ super.setIssue({
18
+ message: (0, index_js_1.translate)('error:NOT_FOUND', 'Not found'),
19
+ severity: 'error',
20
+ code: 'NOT_FOUND',
21
+ ...issue
22
+ });
23
+ }
24
+ }
25
+ exports.NotFoundError = NotFoundError;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnauthorizedError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 401 Unauthorized
8
+ * Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated".
9
+ * That is, the client must authenticate itself to get the requested response.
10
+ */
11
+ class UnauthorizedError extends opra_exception_js_1.OpraException {
12
+ status = 401;
13
+ setIssue(issue) {
14
+ super.setIssue({
15
+ message: (0, index_js_1.translate)('error:UNAUTHORIZED', 'You have not been authenticated to perform this action'),
16
+ severity: 'error',
17
+ code: 'UNAUTHORIZED',
18
+ ...issue
19
+ });
20
+ }
21
+ }
22
+ exports.UnauthorizedError = UnauthorizedError;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnprocessableEntityError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ /**
7
+ * 422 Unprocessable Entity
8
+ * The request was well-formed but was unable to be followed due to semantic errors.
9
+ */
10
+ class UnprocessableEntityError extends opra_exception_js_1.OpraException {
11
+ status = 422;
12
+ setIssue(issue) {
13
+ super.setIssue({
14
+ message: (0, index_js_1.translate)('error:UNPROCESSABLE_ENTITY', 'Unprocessable entity'),
15
+ severity: 'error',
16
+ code: 'UNPROCESSABLE_ENTITY',
17
+ ...issue
18
+ });
19
+ }
20
+ }
21
+ exports.UnprocessableEntityError = UnprocessableEntityError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./opra-exception.js"), exports);
5
+ tslib_1.__exportStar(require("./error-issue.js"), exports);
6
+ tslib_1.__exportStar(require("./wrap-exception.js"), exports);
7
+ tslib_1.__exportStar(require("./enums/issue-severity.enum.js"), exports);
8
+ tslib_1.__exportStar(require("./http-errors/bad-request.error.js"), exports);
9
+ tslib_1.__exportStar(require("./http-errors/failed-dependency.error.js"), exports);
10
+ tslib_1.__exportStar(require("./http-errors/forbidden.error.js"), exports);
11
+ tslib_1.__exportStar(require("./http-errors/internal-server.error.js"), exports);
12
+ tslib_1.__exportStar(require("./http-errors/method-not-allowed.error.js"), exports);
13
+ tslib_1.__exportStar(require("./http-errors/not-acceptable.error.js"), exports);
14
+ tslib_1.__exportStar(require("./http-errors/not-found.error.js"), exports);
15
+ tslib_1.__exportStar(require("./http-errors/unauthorized.error.js"), exports);
16
+ tslib_1.__exportStar(require("./http-errors/unprocessable-entity.error.js"), exports);
17
+ tslib_1.__exportStar(require("./resource-errors/resource-conflict.error.js"), exports);
18
+ tslib_1.__exportStar(require("./resource-errors/resource-not-found.error.js"), exports);
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpraException = void 0;
4
+ const index_js_1 = require("../i18n/index.js");
5
+ /**
6
+ * Defines the base Opra exception, which is handled by the default Exceptions Handler.
7
+ */
8
+ class OpraException extends Error {
9
+ _issue;
10
+ status = 500;
11
+ cause;
12
+ constructor(issue, cause) {
13
+ super('');
14
+ this._initName();
15
+ if (cause) {
16
+ this.cause = cause;
17
+ if (cause.stack)
18
+ this.stack = cause.stack;
19
+ }
20
+ this._init(issue || cause || 'Unknown error');
21
+ this.message = index_js_1.i18n.deep(this.issue.message);
22
+ }
23
+ get issue() {
24
+ return this._issue;
25
+ }
26
+ setIssue(issue) {
27
+ this._issue = {
28
+ message: 'Unknown error',
29
+ severity: 'error',
30
+ ...issue,
31
+ };
32
+ }
33
+ setStatus(status) {
34
+ this.status = status;
35
+ return this;
36
+ }
37
+ _initName() {
38
+ this.name = this.constructor.name;
39
+ }
40
+ _init(issue) {
41
+ if (issue instanceof Error) {
42
+ if (typeof issue.status === 'number')
43
+ this.status = issue.status;
44
+ else if (typeof issue.getStatus === 'function')
45
+ this.status = issue.getStatus();
46
+ this.setIssue({ message: issue.message });
47
+ }
48
+ else if (typeof issue === 'object') {
49
+ this.setIssue(issue);
50
+ }
51
+ else {
52
+ this.setIssue({ message: String(issue) });
53
+ }
54
+ }
55
+ }
56
+ exports.OpraException = OpraException;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceConflictError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ class ResourceConflictError extends opra_exception_js_1.OpraException {
7
+ status = 409;
8
+ constructor(resource, fields, cause) {
9
+ super({
10
+ message: (0, index_js_1.translate)(`error:RESOURCE_CONFLICT`, { resource, fields }, `There is already an other {{resource}} resource with same field values ({{fields}})`),
11
+ severity: 'error',
12
+ code: 'RESOURCE_CONFLICT',
13
+ details: {
14
+ resource,
15
+ location: fields
16
+ },
17
+ }, cause);
18
+ }
19
+ }
20
+ exports.ResourceConflictError = ResourceConflictError;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResourceNotFoundError = void 0;
4
+ const index_js_1 = require("../../i18n/index.js");
5
+ const opra_exception_js_1 = require("../opra-exception.js");
6
+ class ResourceNotFoundError extends opra_exception_js_1.OpraException {
7
+ constructor(resource, keyValue, cause) {
8
+ super({
9
+ message: (0, index_js_1.translate)(`error:RESOURCE_NOT_FOUND`, { resource: resource + (keyValue ? '@' + keyValue : '') }, `The resource '{{resource}}' could not be found`),
10
+ severity: 'error',
11
+ code: 'RESOURCE_NOT_FOUND',
12
+ details: {
13
+ resource,
14
+ key: keyValue
15
+ }
16
+ }, cause);
17
+ this.status = 404;
18
+ }
19
+ }
20
+ exports.ResourceNotFoundError = ResourceNotFoundError;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapException = void 0;
4
+ const bad_request_error_js_1 = require("./http-errors/bad-request.error.js");
5
+ const failed_dependency_error_js_1 = require("./http-errors/failed-dependency.error.js");
6
+ const forbidden_error_js_1 = require("./http-errors/forbidden.error.js");
7
+ const method_not_allowed_error_js_1 = require("./http-errors/method-not-allowed.error.js");
8
+ const not_acceptable_error_js_1 = require("./http-errors/not-acceptable.error.js");
9
+ const not_found_error_js_1 = require("./http-errors/not-found.error.js");
10
+ const unauthorized_error_js_1 = require("./http-errors/unauthorized.error.js");
11
+ const unprocessable_entity_error_js_1 = require("./http-errors/unprocessable-entity.error.js");
12
+ const opra_exception_js_1 = require("./opra-exception.js");
13
+ function wrapException(e) {
14
+ if (e instanceof opra_exception_js_1.OpraException)
15
+ return e;
16
+ let status = 500;
17
+ if (typeof e.status === 'number')
18
+ status = e.status;
19
+ else if (typeof e.getStatus === 'function')
20
+ status = e.getStatus();
21
+ switch (status) {
22
+ case 400:
23
+ return new bad_request_error_js_1.BadRequestError(e);
24
+ case 401:
25
+ return new unauthorized_error_js_1.UnauthorizedError(e);
26
+ case 403:
27
+ return new forbidden_error_js_1.ForbiddenError(e);
28
+ case 404:
29
+ return new not_found_error_js_1.NotFoundError(e);
30
+ case 405:
31
+ return new method_not_allowed_error_js_1.MethodNotAllowedError(e);
32
+ case 406:
33
+ return new not_acceptable_error_js_1.NotAcceptableError(e);
34
+ case 422:
35
+ return new unprocessable_entity_error_js_1.UnprocessableEntityError(e);
36
+ case 424:
37
+ return new failed_dependency_error_js_1.FailedDependencyError(e);
38
+ default:
39
+ return new failed_dependency_error_js_1.FailedDependencyError(e);
40
+ }
41
+ }
42
+ exports.wrapException = wrapException;