@opra/common 0.14.0 → 0.16.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 (596) hide show
  1. package/cjs/document/api-document.js +211 -0
  2. package/cjs/document/constants.js +6 -0
  3. package/cjs/document/data-type/api-field.js +82 -0
  4. package/cjs/document/data-type/builtin/any.type.js +14 -0
  5. package/cjs/document/data-type/builtin/base64.type.js +38 -0
  6. package/cjs/document/data-type/builtin/bigint.type.js +33 -0
  7. package/cjs/document/data-type/builtin/boolean.type.js +28 -0
  8. package/cjs/document/data-type/builtin/date.type.js +18 -0
  9. package/cjs/document/data-type/builtin/guid.type.js +35 -0
  10. package/cjs/document/data-type/builtin/index.js +13 -0
  11. package/cjs/document/data-type/builtin/integer.type.js +28 -0
  12. package/cjs/document/data-type/builtin/number.type.js +33 -0
  13. package/cjs/document/data-type/builtin/object.type.js +20 -0
  14. package/cjs/document/data-type/builtin/string.type.js +24 -0
  15. package/cjs/document/data-type/builtin/time.type.js +32 -0
  16. package/cjs/document/data-type/builtin/timestamp.type.js +29 -0
  17. package/cjs/document/data-type/complex-type.js +154 -0
  18. package/cjs/document/data-type/data-type.js +46 -0
  19. package/cjs/document/data-type/enum-type.js +62 -0
  20. package/cjs/document/data-type/mapped-type.js +96 -0
  21. package/cjs/document/data-type/simple-type.js +61 -0
  22. package/cjs/document/data-type/union-type.js +81 -0
  23. package/cjs/document/factory/add-references.js +20 -0
  24. package/cjs/document/factory/create-document.js +81 -0
  25. package/cjs/document/factory/factory.js +62 -0
  26. package/cjs/document/factory/import-resource-class.js +54 -0
  27. package/cjs/document/factory/import-type-class.js +137 -0
  28. package/cjs/document/factory/index.js +4 -0
  29. package/cjs/document/factory/process-resources.js +55 -0
  30. package/cjs/document/factory/process-types.js +191 -0
  31. package/cjs/document/index.js +17 -0
  32. package/cjs/document/resource/collection.js +185 -0
  33. package/cjs/document/resource/resource.js +38 -0
  34. package/cjs/document/resource/singleton.js +91 -0
  35. package/cjs/exception/opra-exception.js +2 -0
  36. package/cjs/exception/resource-errors/resource-not-found.error.js +4 -0
  37. package/cjs/filter/parse.js +3 -1
  38. package/cjs/helpers/function-utils.js +25 -0
  39. package/cjs/helpers/get-stack-filename.js +24 -0
  40. package/cjs/helpers/index.js +7 -0
  41. package/cjs/{utils → helpers}/is-url.js +2 -2
  42. package/cjs/{schema/utils/clone-object.util.js → helpers/object-utils.js} +13 -1
  43. package/cjs/{utils/path-to-tree.js → helpers/path-to-object-tree.js} +9 -9
  44. package/cjs/helpers/responsive-map.js +62 -14
  45. package/cjs/{utils → helpers}/type-guards.js +12 -5
  46. package/cjs/http/{param-codec → codecs}/boolean-codec.js +1 -2
  47. package/{esm/http/param-codec → cjs/http/codecs}/date-codec.js +5 -4
  48. package/cjs/http/{param-codec → codecs}/filter-codec.js +1 -2
  49. package/cjs/http/{param-codec → codecs}/number-codec.js +1 -3
  50. package/cjs/http/{param-codec → codecs}/string-codec.js +1 -3
  51. package/cjs/http/enums/http-headers-codes.enum.js +13 -4
  52. package/cjs/http/enums/http-status-messages.js +68 -0
  53. package/cjs/http/http-headers.js +138 -124
  54. package/cjs/http/http-message.host.js +251 -0
  55. package/cjs/http/http-params.js +78 -45
  56. package/cjs/http/http-request-message.js +152 -0
  57. package/cjs/http/http-response-message.js +238 -0
  58. package/cjs/http/index.js +8 -11
  59. package/cjs/http/multipart/batch-multipart.js +169 -153
  60. package/cjs/http/multipart/http-request-content.js +16 -11
  61. package/cjs/http/multipart/http-response-content.js +13 -10
  62. package/cjs/http/multipart/index.js +1 -3
  63. package/cjs/i18n/i18n.js +1 -1
  64. package/cjs/index.js +6 -5
  65. package/cjs/schema/constants.js +2 -9
  66. package/cjs/schema/data-type/complex-type.interface.js +7 -0
  67. package/cjs/schema/data-type/enum-type.interface.js +7 -0
  68. package/cjs/schema/data-type/mapped-type.interface.js +7 -0
  69. package/cjs/schema/data-type/simple-type.interface.js +7 -0
  70. package/cjs/schema/data-type/union-type.interface.js +7 -0
  71. package/cjs/schema/index.js +42 -26
  72. package/cjs/schema/resource/collection.interface.js +7 -0
  73. package/cjs/schema/resource/container.interface.js +7 -0
  74. package/cjs/schema/resource/resource.interface.js +2 -0
  75. package/cjs/schema/resource/singleton.interface.js +7 -0
  76. package/cjs/schema/type-guards.js +59 -0
  77. package/cjs/types.js +2 -0
  78. package/cjs/url/index.js +2 -2
  79. package/cjs/url/opra-url-path-component.js +2 -2
  80. package/cjs/url/opra-url-path.js +7 -4
  81. package/cjs/url/opra-url.js +86 -117
  82. package/cjs/url/utils/{path-utils.js → decode-path-component.js} +1 -46
  83. package/cjs/url/utils/encode-path-component.js +27 -0
  84. package/cjs/utils/path-utils.js +24 -0
  85. package/esm/document/api-document.js +211 -0
  86. package/esm/document/constants.js +6 -0
  87. package/esm/document/data-type/api-field.js +82 -0
  88. package/esm/document/data-type/builtin/any.type.js +14 -0
  89. package/esm/document/data-type/builtin/base64.type.js +38 -0
  90. package/esm/document/data-type/builtin/bigint.type.js +33 -0
  91. package/esm/document/data-type/builtin/boolean.type.js +28 -0
  92. package/esm/document/data-type/builtin/date.type.js +18 -0
  93. package/esm/document/data-type/builtin/guid.type.js +35 -0
  94. package/esm/document/data-type/builtin/index.js +13 -0
  95. package/esm/document/data-type/builtin/integer.type.js +28 -0
  96. package/esm/document/data-type/builtin/number.type.js +33 -0
  97. package/esm/document/data-type/builtin/object.type.js +20 -0
  98. package/esm/document/data-type/builtin/string.type.js +24 -0
  99. package/esm/document/data-type/builtin/time.type.js +32 -0
  100. package/esm/document/data-type/builtin/timestamp.type.js +29 -0
  101. package/esm/document/data-type/complex-type.js +154 -0
  102. package/esm/document/data-type/data-type.js +46 -0
  103. package/esm/document/data-type/enum-type.js +62 -0
  104. package/esm/document/data-type/mapped-type.js +96 -0
  105. package/esm/document/data-type/simple-type.js +61 -0
  106. package/esm/document/data-type/union-type.js +81 -0
  107. package/esm/document/factory/add-references.js +20 -0
  108. package/esm/document/factory/create-document.js +81 -0
  109. package/esm/document/factory/factory.js +62 -0
  110. package/esm/document/factory/import-resource-class.js +54 -0
  111. package/esm/document/factory/import-type-class.js +137 -0
  112. package/esm/document/factory/index.js +4 -0
  113. package/esm/document/factory/process-resources.js +55 -0
  114. package/esm/document/factory/process-types.js +191 -0
  115. package/esm/document/index.js +17 -0
  116. package/esm/document/resource/collection.js +185 -0
  117. package/esm/document/resource/resource.js +38 -0
  118. package/esm/document/resource/singleton.js +91 -0
  119. package/esm/document/utils/inspect.util.js +7 -0
  120. package/esm/document/utils/string-compare.util.js +11 -0
  121. package/esm/exception/enums/issue-severity.enum.js +5 -2
  122. package/esm/exception/error-issue.js +2 -1
  123. package/esm/exception/http-errors/bad-request.error.js +8 -4
  124. package/esm/exception/http-errors/failed-dependency.error.js +8 -4
  125. package/esm/exception/http-errors/forbidden.error.js +8 -4
  126. package/esm/exception/http-errors/internal-server.error.js +8 -4
  127. package/esm/exception/http-errors/method-not-allowed.error.js +8 -4
  128. package/esm/exception/http-errors/not-acceptable.error.js +8 -4
  129. package/esm/exception/http-errors/not-found.error.js +8 -4
  130. package/esm/exception/http-errors/unauthorized.error.js +8 -4
  131. package/esm/exception/http-errors/unprocessable-entity.error.js +8 -4
  132. package/esm/exception/index.js +18 -15
  133. package/esm/exception/opra-exception.js +9 -3
  134. package/esm/exception/resource-errors/resource-conflict.error.js +8 -4
  135. package/esm/exception/resource-errors/resource-not-found.error.js +12 -4
  136. package/esm/exception/wrap-exception.js +24 -20
  137. package/esm/filter/antlr/OpraFilterLexer.js +9 -6
  138. package/esm/filter/antlr/OpraFilterListener.js +5 -2
  139. package/esm/filter/antlr/OpraFilterParser.js +126 -79
  140. package/esm/filter/antlr/OpraFilterVisitor.js +5 -2
  141. package/esm/filter/ast/abstract/ast.js +5 -1
  142. package/esm/filter/ast/abstract/expression.js +6 -2
  143. package/esm/filter/ast/abstract/literal.js +6 -2
  144. package/esm/filter/ast/abstract/term.js +6 -2
  145. package/esm/filter/ast/expressions/arithmetic-expression.js +8 -3
  146. package/esm/filter/ast/expressions/array-expression.js +6 -2
  147. package/esm/filter/ast/expressions/comparison-expression.js +6 -2
  148. package/esm/filter/ast/expressions/logical-expression.js +6 -2
  149. package/esm/filter/ast/expressions/parentheses-expression.js +6 -2
  150. package/esm/filter/ast/index.js +19 -16
  151. package/esm/filter/ast/terms/boolean-literal.js +6 -2
  152. package/esm/filter/ast/terms/date-literal.js +12 -8
  153. package/esm/filter/ast/terms/external-constant.js +6 -2
  154. package/esm/filter/ast/terms/null-literal.js +6 -2
  155. package/esm/filter/ast/terms/number-literal.js +8 -4
  156. package/esm/filter/ast/terms/qualified-identifier.js +6 -2
  157. package/esm/filter/ast/terms/string-literal.js +8 -4
  158. package/esm/filter/ast/terms/time-literal.js +10 -6
  159. package/esm/filter/build.js +69 -45
  160. package/esm/filter/errors.js +9 -3
  161. package/esm/filter/filter-tree-visitor.js +31 -26
  162. package/esm/filter/index.js +8 -5
  163. package/esm/filter/opra-error-listener.js +8 -4
  164. package/esm/filter/parse.js +22 -15
  165. package/esm/filter/utils.js +7 -2
  166. package/esm/helpers/function-utils.js +25 -0
  167. package/esm/helpers/get-stack-filename.js +24 -0
  168. package/esm/helpers/index.js +11 -1
  169. package/esm/helpers/is-url.js +8 -0
  170. package/esm/{schema/type-helpers/mixin.utils.js → helpers/mixin-utils.js} +7 -2
  171. package/esm/helpers/object-utils.js +31 -0
  172. package/esm/helpers/path-to-object-tree.js +28 -0
  173. package/esm/helpers/responsive-map.js +67 -15
  174. package/esm/{utils → helpers}/type-guards.js +24 -8
  175. package/esm/http/{param-codec → codecs}/boolean-codec.js +5 -2
  176. package/{cjs/http/param-codec → esm/http/codecs}/date-codec.js +1 -4
  177. package/{cjs/url/formats/filter-format.js → esm/http/codecs/filter-codec.js} +5 -6
  178. package/{cjs/url/formats/integer-format.js → esm/http/codecs/integer-codec.js} +6 -6
  179. package/esm/http/{param-codec → codecs}/number-codec.js +5 -3
  180. package/esm/http/{param-codec → codecs}/string-codec.js +5 -3
  181. package/esm/http/enums/http-headers-codes.enum.js +18 -6
  182. package/esm/http/enums/http-status-codes.enum.js +5 -2
  183. package/esm/http/enums/http-status-messages.js +68 -0
  184. package/esm/http/http-headers.js +144 -126
  185. package/esm/http/http-message.host.js +251 -0
  186. package/esm/http/http-params.js +86 -49
  187. package/esm/http/http-request-message.js +152 -0
  188. package/esm/http/http-response-message.js +238 -0
  189. package/esm/http/index.js +17 -17
  190. package/esm/http/interfaces/client-http-headers.interface.js +2 -1
  191. package/esm/http/interfaces/cookie-options.interface.js +2 -0
  192. package/esm/http/interfaces/server-http-headers.interface.js +2 -1
  193. package/esm/http/multipart/batch-multipart.js +170 -149
  194. package/esm/http/multipart/http-request-content.js +17 -8
  195. package/esm/http/multipart/http-response-content.js +14 -7
  196. package/esm/http/multipart/index.js +2 -1
  197. package/esm/i18n/i18n.js +28 -23
  198. package/esm/i18n/index.js +9 -5
  199. package/esm/i18n/string-utils.js +7 -2
  200. package/esm/i18n/translate.js +7 -3
  201. package/esm/index.js +16 -10
  202. package/esm/schema/constants.js +4 -8
  203. package/esm/schema/data-type/complex-type.interface.js +7 -0
  204. package/esm/schema/data-type/data-type.interface.js +2 -0
  205. package/esm/schema/data-type/enum-type.interface.js +7 -0
  206. package/esm/schema/data-type/field.interface.js +2 -0
  207. package/esm/schema/data-type/mapped-type.interface.js +7 -0
  208. package/esm/schema/data-type/simple-type.interface.js +7 -0
  209. package/esm/schema/data-type/union-type.interface.js +7 -0
  210. package/esm/schema/document.interface.js +2 -0
  211. package/esm/schema/index.js +44 -25
  212. package/esm/schema/resource/collection.interface.js +7 -0
  213. package/esm/schema/resource/container.interface.js +7 -0
  214. package/esm/schema/resource/endpoint.interface.js +2 -0
  215. package/esm/schema/resource/resource.interface.js +2 -0
  216. package/esm/schema/resource/singleton.interface.js +7 -0
  217. package/esm/schema/type-guards.js +59 -0
  218. package/esm/types.js +2 -0
  219. package/esm/url/index.js +8 -5
  220. package/esm/url/opra-url-path-component.js +7 -3
  221. package/esm/url/opra-url-path.js +19 -12
  222. package/esm/url/opra-url.js +100 -127
  223. package/esm/url/utils/decode-path-component.js +41 -0
  224. package/esm/url/utils/encode-path-component.js +27 -0
  225. package/esm/utils/path-utils.js +24 -0
  226. package/package.json +23 -7
  227. package/types/document/api-document.d.ts +102 -0
  228. package/types/document/constants.d.ts +3 -0
  229. package/types/document/data-type/api-field.d.ts +41 -0
  230. package/types/document/data-type/builtin/any.type.d.ts +2 -0
  231. package/types/document/data-type/builtin/base64.type.d.ts +6 -0
  232. package/types/document/data-type/builtin/bigint.type.d.ts +6 -0
  233. package/types/document/data-type/builtin/boolean.type.d.ts +5 -0
  234. package/types/document/data-type/builtin/date.type.d.ts +4 -0
  235. package/types/document/data-type/builtin/guid.type.d.ts +7 -0
  236. package/types/document/data-type/builtin/index.d.ts +10 -0
  237. package/types/document/data-type/builtin/integer.type.d.ts +6 -0
  238. package/types/document/data-type/builtin/number.type.d.ts +6 -0
  239. package/types/document/data-type/builtin/object.type.d.ts +3 -0
  240. package/types/document/data-type/builtin/string.type.d.ts +5 -0
  241. package/types/document/data-type/builtin/time.type.d.ts +7 -0
  242. package/types/document/data-type/builtin/timestamp.type.d.ts +5 -0
  243. package/types/document/data-type/complex-type.d.ts +50 -0
  244. package/types/document/data-type/data-type.d.ts +33 -0
  245. package/types/document/data-type/enum-type.d.ts +32 -0
  246. package/types/document/data-type/mapped-type.d.ts +53 -0
  247. package/types/document/data-type/simple-type.d.ts +33 -0
  248. package/types/document/data-type/union-type.d.ts +42 -0
  249. package/types/document/factory/add-references.d.ts +4 -0
  250. package/types/document/factory/create-document.d.ts +12 -0
  251. package/types/document/factory/factory.d.ts +61 -0
  252. package/types/document/factory/import-resource-class.d.ts +10 -0
  253. package/types/document/factory/import-type-class.d.ts +17 -0
  254. package/types/document/factory/index.d.ts +1 -0
  255. package/types/document/factory/process-resources.d.ts +7 -0
  256. package/types/document/factory/process-types.d.ts +6 -0
  257. package/types/document/index.d.ts +14 -0
  258. package/types/document/resource/collection.d.ts +67 -0
  259. package/types/document/resource/resource.d.ts +29 -0
  260. package/types/document/resource/singleton.d.ts +49 -0
  261. package/{esm → types}/exception/resource-errors/resource-not-found.error.d.ts +4 -0
  262. package/types/helpers/function-utils.d.ts +4 -0
  263. package/types/helpers/get-stack-filename.d.ts +1 -0
  264. package/types/helpers/index.d.ts +8 -0
  265. package/types/helpers/is-url.d.ts +1 -0
  266. package/{esm/schema/utils/clone-object.util.d.ts → types/helpers/object-utils.d.ts} +1 -0
  267. package/types/helpers/path-to-object-tree.d.ts +4 -0
  268. package/types/helpers/responsive-map.d.ts +34 -0
  269. package/{esm/utils → types/helpers}/type-guards.d.ts +3 -1
  270. package/types/http/codecs/boolean-codec.d.ts +5 -0
  271. package/{esm/http/param-codec → types/http/codecs}/date-codec.d.ts +2 -2
  272. package/{esm/http/param-codec → types/http/codecs}/filter-codec.d.ts +2 -2
  273. package/types/http/codecs/integer-codec.d.ts +11 -0
  274. package/types/http/codecs/number-codec.d.ts +14 -0
  275. package/types/http/codecs/string-codec.d.ts +16 -0
  276. package/{esm → types}/http/enums/http-headers-codes.enum.d.ts +13 -4
  277. package/types/http/enums/http-status-messages.d.ts +65 -0
  278. package/types/http/http-headers.d.ts +86 -0
  279. package/types/http/http-message.host.d.ts +122 -0
  280. package/{esm → types}/http/http-params.d.ts +43 -29
  281. package/types/http/http-request-message.d.ts +213 -0
  282. package/types/http/http-response-message.d.ts +318 -0
  283. package/types/http/index.d.ts +14 -0
  284. package/types/http/interfaces/cookie-options.interface.d.ts +4 -0
  285. package/types/http/multipart/http-request-content.d.ts +0 -0
  286. package/types/http/multipart/http-response-content.d.ts +0 -0
  287. package/types/http/multipart/index.d.ts +0 -0
  288. package/{esm → types}/index.d.ts +6 -5
  289. package/types/schema/constants.d.ts +2 -0
  290. package/types/schema/data-type/complex-type.interface.d.ts +16 -0
  291. package/types/schema/data-type/data-type.interface.d.ts +14 -0
  292. package/types/schema/data-type/enum-type.interface.d.ts +15 -0
  293. package/types/schema/data-type/field.interface.d.ts +21 -0
  294. package/types/schema/data-type/mapped-type.interface.d.ts +11 -0
  295. package/types/schema/data-type/simple-type.interface.d.ts +18 -0
  296. package/types/schema/data-type/union-type.interface.d.ts +10 -0
  297. package/types/schema/document.interface.d.ts +34 -0
  298. package/types/schema/index.d.ts +51 -0
  299. package/types/schema/resource/collection.interface.d.ts +33 -0
  300. package/types/schema/resource/container.interface.d.ts +9 -0
  301. package/types/schema/resource/endpoint.interface.d.ts +29 -0
  302. package/types/schema/resource/resource.interface.d.ts +12 -0
  303. package/types/schema/resource/singleton.interface.d.ts +22 -0
  304. package/types/schema/type-guards.d.ts +20 -0
  305. package/{esm/schema → types}/types.d.ts +0 -3
  306. package/{esm → types}/url/index.d.ts +2 -2
  307. package/{esm → types}/url/opra-url.d.ts +10 -29
  308. package/types/url/utils/decode-path-component.d.ts +5 -0
  309. package/types/url/utils/encode-path-component.d.ts +1 -0
  310. package/types/utils/path-utils.d.ts +2 -0
  311. package/cjs/constants.js +0 -1
  312. package/cjs/http/http-param-codec.js +0 -6
  313. package/cjs/http/http-request-node.js +0 -105
  314. package/cjs/http/http-request.js +0 -89
  315. package/cjs/http/http-response.js +0 -23
  316. package/cjs/http/utils/encodeURIParam.js +0 -21
  317. package/cjs/http/utils/normalize-headers.js +0 -28
  318. package/cjs/schema/decorators/opr-collection-resource.decorator.js +0 -24
  319. package/cjs/schema/decorators/opr-complex-type.decorator.js +0 -28
  320. package/cjs/schema/decorators/opr-field.decorator.js +0 -29
  321. package/cjs/schema/decorators/opr-resolver.decorator.js +0 -81
  322. package/cjs/schema/decorators/opr-simple-type.decorator.js +0 -19
  323. package/cjs/schema/decorators/opr-singleton-resource.decorator.js +0 -24
  324. package/cjs/schema/implementation/data-type/builtin/any.type.js +0 -9
  325. package/cjs/schema/implementation/data-type/builtin/base64-binary.type.js +0 -15
  326. package/cjs/schema/implementation/data-type/builtin/bigint.type.js +0 -15
  327. package/cjs/schema/implementation/data-type/builtin/boolean.type.js +0 -15
  328. package/cjs/schema/implementation/data-type/builtin/date-string.type.js +0 -15
  329. package/cjs/schema/implementation/data-type/builtin/date.type.js +0 -15
  330. package/cjs/schema/implementation/data-type/builtin/guid.type.js +0 -15
  331. package/cjs/schema/implementation/data-type/builtin/integer.type.js +0 -15
  332. package/cjs/schema/implementation/data-type/builtin/number.type.js +0 -15
  333. package/cjs/schema/implementation/data-type/builtin/object.type.js +0 -15
  334. package/cjs/schema/implementation/data-type/builtin/string.type.js +0 -15
  335. package/cjs/schema/implementation/data-type/builtin-data-types.js +0 -37
  336. package/cjs/schema/implementation/data-type/complex-type.js +0 -110
  337. package/cjs/schema/implementation/data-type/data-type.js +0 -37
  338. package/cjs/schema/implementation/data-type/simple-type.js +0 -21
  339. package/cjs/schema/implementation/data-type/union-type.js +0 -24
  340. package/cjs/schema/implementation/document-builder.js +0 -140
  341. package/cjs/schema/implementation/opra-document.js +0 -183
  342. package/cjs/schema/implementation/query/collection-count-query.js +0 -17
  343. package/cjs/schema/implementation/query/collection-create-query.js +0 -23
  344. package/cjs/schema/implementation/query/collection-delete-many-query.js +0 -17
  345. package/cjs/schema/implementation/query/collection-delete-query.js +0 -25
  346. package/cjs/schema/implementation/query/collection-get-query.js +0 -32
  347. package/cjs/schema/implementation/query/collection-search-query.js +0 -45
  348. package/cjs/schema/implementation/query/collection-update-many-query.js +0 -18
  349. package/cjs/schema/implementation/query/collection-update-query.js +0 -33
  350. package/cjs/schema/implementation/query/field-get-query.js +0 -34
  351. package/cjs/schema/implementation/query/index.js +0 -22
  352. package/cjs/schema/implementation/query/singleton-get-query.js +0 -22
  353. package/cjs/schema/implementation/resource/collection-resource-info.js +0 -72
  354. package/cjs/schema/implementation/resource/container-resource-info.js +0 -30
  355. package/cjs/schema/implementation/resource/resource-info.js +0 -35
  356. package/cjs/schema/implementation/resource/singleton-resource-info.js +0 -44
  357. package/cjs/schema/implementation/schema-builder/extract-resource-metadata.util.js +0 -84
  358. package/cjs/schema/implementation/schema-builder/extract-type-metadata.util.js +0 -94
  359. package/cjs/schema/opra-schema.definition.js +0 -49
  360. package/cjs/schema/type-helpers/extend-type.helper.js +0 -65
  361. package/cjs/schema/type-helpers/mixin-type.helper.js +0 -46
  362. package/cjs/schema/utils/class.utils.js +0 -8
  363. package/cjs/schema/utils/normalize-field-array.util.js +0 -44
  364. package/cjs/schema/utils/path-to-tree.util.js +0 -26
  365. package/cjs/url/formats/boolean-format.js +0 -25
  366. package/cjs/url/formats/date-format.js +0 -44
  367. package/cjs/url/formats/format.js +0 -6
  368. package/cjs/url/formats/number-format.js +0 -26
  369. package/cjs/url/formats/string-format.js +0 -25
  370. package/cjs/url/opra-url-search-params.js +0 -28
  371. package/cjs/utils/index.js +0 -6
  372. package/esm/constants.js +0 -1
  373. package/esm/helpers/index.d.ts +0 -1
  374. package/esm/helpers/responsive-map.d.ts +0 -32
  375. package/esm/http/http-headers.d.ts +0 -70
  376. package/esm/http/http-param-codec.d.ts +0 -4
  377. package/esm/http/http-param-codec.js +0 -2
  378. package/esm/http/http-request-node.d.ts +0 -34
  379. package/esm/http/http-request-node.js +0 -101
  380. package/esm/http/http-request.d.ts +0 -76
  381. package/esm/http/http-request.js +0 -85
  382. package/esm/http/http-response.d.ts +0 -41
  383. package/esm/http/http-response.js +0 -19
  384. package/esm/http/index.d.ts +0 -17
  385. package/esm/http/multipart/batch-multipart.d.ts +0 -31
  386. package/esm/http/multipart/http-request-content.d.ts +0 -8
  387. package/esm/http/multipart/http-response-content.d.ts +0 -7
  388. package/esm/http/multipart/index.d.ts +0 -1
  389. package/esm/http/param-codec/boolean-codec.d.ts +0 -5
  390. package/esm/http/param-codec/filter-codec.js +0 -14
  391. package/esm/http/param-codec/integer-codec.d.ts +0 -9
  392. package/esm/http/param-codec/integer-codec.js +0 -15
  393. package/esm/http/param-codec/number-codec.d.ts +0 -12
  394. package/esm/http/param-codec/string-codec.d.ts +0 -14
  395. package/esm/http/utils/encodeURIParam.d.ts +0 -1
  396. package/esm/http/utils/encodeURIParam.js +0 -17
  397. package/esm/http/utils/normalize-headers.d.ts +0 -1
  398. package/esm/http/utils/normalize-headers.js +0 -24
  399. package/esm/schema/constants.d.ts +0 -8
  400. package/esm/schema/decorators/opr-collection-resource.decorator.d.ts +0 -8
  401. package/esm/schema/decorators/opr-collection-resource.decorator.js +0 -19
  402. package/esm/schema/decorators/opr-complex-type.decorator.d.ts +0 -6
  403. package/esm/schema/decorators/opr-complex-type.decorator.js +0 -23
  404. package/esm/schema/decorators/opr-field.decorator.d.ts +0 -3
  405. package/esm/schema/decorators/opr-field.decorator.js +0 -24
  406. package/esm/schema/decorators/opr-resolver.decorator.d.ts +0 -8
  407. package/esm/schema/decorators/opr-resolver.decorator.js +0 -71
  408. package/esm/schema/decorators/opr-simple-type.decorator.d.ts +0 -6
  409. package/esm/schema/decorators/opr-simple-type.decorator.js +0 -14
  410. package/esm/schema/decorators/opr-singleton-resource.decorator.d.ts +0 -8
  411. package/esm/schema/decorators/opr-singleton-resource.decorator.js +0 -19
  412. package/esm/schema/implementation/data-type/builtin/any.type.d.ts +0 -2
  413. package/esm/schema/implementation/data-type/builtin/any.type.js +0 -6
  414. package/esm/schema/implementation/data-type/builtin/base64-binary.type.d.ts +0 -2
  415. package/esm/schema/implementation/data-type/builtin/base64-binary.type.js +0 -12
  416. package/esm/schema/implementation/data-type/builtin/bigint.type.d.ts +0 -2
  417. package/esm/schema/implementation/data-type/builtin/bigint.type.js +0 -12
  418. package/esm/schema/implementation/data-type/builtin/boolean.type.d.ts +0 -2
  419. package/esm/schema/implementation/data-type/builtin/boolean.type.js +0 -12
  420. package/esm/schema/implementation/data-type/builtin/date-string.type.d.ts +0 -2
  421. package/esm/schema/implementation/data-type/builtin/date-string.type.js +0 -12
  422. package/esm/schema/implementation/data-type/builtin/date.type.d.ts +0 -2
  423. package/esm/schema/implementation/data-type/builtin/date.type.js +0 -12
  424. package/esm/schema/implementation/data-type/builtin/guid.type.d.ts +0 -2
  425. package/esm/schema/implementation/data-type/builtin/guid.type.js +0 -12
  426. package/esm/schema/implementation/data-type/builtin/integer.type.d.ts +0 -2
  427. package/esm/schema/implementation/data-type/builtin/integer.type.js +0 -12
  428. package/esm/schema/implementation/data-type/builtin/number.type.d.ts +0 -2
  429. package/esm/schema/implementation/data-type/builtin/number.type.js +0 -12
  430. package/esm/schema/implementation/data-type/builtin/object.type.d.ts +0 -2
  431. package/esm/schema/implementation/data-type/builtin/object.type.js +0 -12
  432. package/esm/schema/implementation/data-type/builtin/string.type.d.ts +0 -2
  433. package/esm/schema/implementation/data-type/builtin/string.type.js +0 -12
  434. package/esm/schema/implementation/data-type/builtin-data-types.d.ts +0 -4
  435. package/esm/schema/implementation/data-type/builtin-data-types.js +0 -34
  436. package/esm/schema/implementation/data-type/complex-type.d.ts +0 -29
  437. package/esm/schema/implementation/data-type/complex-type.js +0 -106
  438. package/esm/schema/implementation/data-type/data-type.d.ts +0 -17
  439. package/esm/schema/implementation/data-type/data-type.js +0 -33
  440. package/esm/schema/implementation/data-type/simple-type.d.ts +0 -12
  441. package/esm/schema/implementation/data-type/simple-type.js +0 -17
  442. package/esm/schema/implementation/data-type/union-type.d.ts +0 -16
  443. package/esm/schema/implementation/data-type/union-type.js +0 -19
  444. package/esm/schema/implementation/document-builder.d.ts +0 -16
  445. package/esm/schema/implementation/document-builder.js +0 -135
  446. package/esm/schema/implementation/opra-document.d.ts +0 -44
  447. package/esm/schema/implementation/opra-document.js +0 -178
  448. package/esm/schema/implementation/query/collection-count-query.d.ts +0 -14
  449. package/esm/schema/implementation/query/collection-count-query.js +0 -13
  450. package/esm/schema/implementation/query/collection-create-query.d.ts +0 -18
  451. package/esm/schema/implementation/query/collection-create-query.js +0 -19
  452. package/esm/schema/implementation/query/collection-delete-many-query.d.ts +0 -14
  453. package/esm/schema/implementation/query/collection-delete-many-query.js +0 -13
  454. package/esm/schema/implementation/query/collection-delete-query.d.ts +0 -10
  455. package/esm/schema/implementation/query/collection-delete-query.js +0 -21
  456. package/esm/schema/implementation/query/collection-get-query.d.ts +0 -21
  457. package/esm/schema/implementation/query/collection-get-query.js +0 -28
  458. package/esm/schema/implementation/query/collection-search-query.d.ts +0 -30
  459. package/esm/schema/implementation/query/collection-search-query.js +0 -41
  460. package/esm/schema/implementation/query/collection-update-many-query.d.ts +0 -15
  461. package/esm/schema/implementation/query/collection-update-many-query.js +0 -14
  462. package/esm/schema/implementation/query/collection-update-query.d.ts +0 -19
  463. package/esm/schema/implementation/query/collection-update-query.js +0 -29
  464. package/esm/schema/implementation/query/field-get-query.d.ts +0 -30
  465. package/esm/schema/implementation/query/field-get-query.js +0 -30
  466. package/esm/schema/implementation/query/index.d.ts +0 -27
  467. package/esm/schema/implementation/query/index.js +0 -17
  468. package/esm/schema/implementation/query/singleton-get-query.d.ts +0 -20
  469. package/esm/schema/implementation/query/singleton-get-query.js +0 -18
  470. package/esm/schema/implementation/resource/collection-resource-info.d.ts +0 -22
  471. package/esm/schema/implementation/resource/collection-resource-info.js +0 -68
  472. package/esm/schema/implementation/resource/container-resource-info.d.ts +0 -13
  473. package/esm/schema/implementation/resource/container-resource-info.js +0 -26
  474. package/esm/schema/implementation/resource/resource-info.d.ts +0 -17
  475. package/esm/schema/implementation/resource/resource-info.js +0 -31
  476. package/esm/schema/implementation/resource/singleton-resource-info.d.ts +0 -15
  477. package/esm/schema/implementation/resource/singleton-resource-info.js +0 -40
  478. package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.d.ts +0 -3
  479. package/esm/schema/implementation/schema-builder/extract-resource-metadata.util.js +0 -80
  480. package/esm/schema/implementation/schema-builder/extract-type-metadata.util.d.ts +0 -4
  481. package/esm/schema/implementation/schema-builder/extract-type-metadata.util.js +0 -90
  482. package/esm/schema/index.d.ts +0 -25
  483. package/esm/schema/interfaces/child-field-query.interface.d.ts +0 -4
  484. package/esm/schema/interfaces/child-field-query.interface.js +0 -1
  485. package/esm/schema/interfaces/data-type.metadata.d.ts +0 -18
  486. package/esm/schema/interfaces/data-type.metadata.js +0 -1
  487. package/esm/schema/interfaces/resource-container.interface.d.ts +0 -8
  488. package/esm/schema/interfaces/resource-container.interface.js +0 -1
  489. package/esm/schema/interfaces/resource.metadata.d.ts +0 -18
  490. package/esm/schema/interfaces/resource.metadata.js +0 -1
  491. package/esm/schema/opra-schema.definition.d.ts +0 -178
  492. package/esm/schema/opra-schema.definition.js +0 -46
  493. package/esm/schema/type-helpers/extend-type.helper.d.ts +0 -3
  494. package/esm/schema/type-helpers/extend-type.helper.js +0 -60
  495. package/esm/schema/type-helpers/mixin-type.helper.d.ts +0 -2
  496. package/esm/schema/type-helpers/mixin-type.helper.js +0 -42
  497. package/esm/schema/types.js +0 -1
  498. package/esm/schema/utils/class.utils.d.ts +0 -2
  499. package/esm/schema/utils/class.utils.js +0 -4
  500. package/esm/schema/utils/clone-object.util.js +0 -14
  501. package/esm/schema/utils/inspect.util.js +0 -4
  502. package/esm/schema/utils/normalize-field-array.util.d.ts +0 -3
  503. package/esm/schema/utils/normalize-field-array.util.js +0 -40
  504. package/esm/schema/utils/path-to-tree.util.d.ts +0 -4
  505. package/esm/schema/utils/path-to-tree.util.js +0 -22
  506. package/esm/schema/utils/string-compare.util.js +0 -7
  507. package/esm/url/formats/boolean-format.d.ts +0 -5
  508. package/esm/url/formats/boolean-format.js +0 -21
  509. package/esm/url/formats/date-format.d.ts +0 -16
  510. package/esm/url/formats/date-format.js +0 -40
  511. package/esm/url/formats/filter-format.d.ts +0 -6
  512. package/esm/url/formats/filter-format.js +0 -14
  513. package/esm/url/formats/format.d.ts +0 -4
  514. package/esm/url/formats/format.js +0 -2
  515. package/esm/url/formats/integer-format.d.ts +0 -9
  516. package/esm/url/formats/integer-format.js +0 -15
  517. package/esm/url/formats/number-format.d.ts +0 -12
  518. package/esm/url/formats/number-format.js +0 -22
  519. package/esm/url/formats/string-format.d.ts +0 -14
  520. package/esm/url/formats/string-format.js +0 -21
  521. package/esm/url/opra-url-search-params.d.ts +0 -5
  522. package/esm/url/opra-url-search-params.js +0 -24
  523. package/esm/url/utils/path-utils.d.ts +0 -8
  524. package/esm/url/utils/path-utils.js +0 -78
  525. package/esm/utils/index.d.ts +0 -3
  526. package/esm/utils/index.js +0 -3
  527. package/esm/utils/is-url.d.ts +0 -1
  528. package/esm/utils/is-url.js +0 -4
  529. package/esm/utils/path-to-tree.d.ts +0 -4
  530. package/esm/utils/path-to-tree.js +0 -24
  531. /package/cjs/{schema → document}/utils/inspect.util.js +0 -0
  532. /package/cjs/{schema → document}/utils/string-compare.util.js +0 -0
  533. /package/cjs/{schema/type-helpers/mixin.utils.js → helpers/mixin-utils.js} +0 -0
  534. /package/cjs/http/{param-codec → codecs}/integer-codec.js +0 -0
  535. /package/cjs/{schema/interfaces/child-field-query.interface.js → http/interfaces/cookie-options.interface.js} +0 -0
  536. /package/cjs/schema/{interfaces/data-type.metadata.js → data-type/data-type.interface.js} +0 -0
  537. /package/cjs/schema/{interfaces/resource-container.interface.js → data-type/field.interface.js} +0 -0
  538. /package/cjs/schema/{interfaces/resource.metadata.js → document.interface.js} +0 -0
  539. /package/cjs/schema/{types.js → resource/endpoint.interface.js} +0 -0
  540. /package/{esm/schema → types/document}/utils/inspect.util.d.ts +0 -0
  541. /package/{esm/schema → types/document}/utils/string-compare.util.d.ts +0 -0
  542. /package/{esm → types}/exception/enums/issue-severity.enum.d.ts +0 -0
  543. /package/{esm → types}/exception/error-issue.d.ts +0 -0
  544. /package/{esm → types}/exception/http-errors/bad-request.error.d.ts +0 -0
  545. /package/{esm → types}/exception/http-errors/failed-dependency.error.d.ts +0 -0
  546. /package/{esm → types}/exception/http-errors/forbidden.error.d.ts +0 -0
  547. /package/{esm → types}/exception/http-errors/internal-server.error.d.ts +0 -0
  548. /package/{esm → types}/exception/http-errors/method-not-allowed.error.d.ts +0 -0
  549. /package/{esm → types}/exception/http-errors/not-acceptable.error.d.ts +0 -0
  550. /package/{esm → types}/exception/http-errors/not-found.error.d.ts +0 -0
  551. /package/{esm → types}/exception/http-errors/unauthorized.error.d.ts +0 -0
  552. /package/{esm → types}/exception/http-errors/unprocessable-entity.error.d.ts +0 -0
  553. /package/{esm → types}/exception/index.d.ts +0 -0
  554. /package/{esm → types}/exception/opra-exception.d.ts +0 -0
  555. /package/{esm → types}/exception/resource-errors/resource-conflict.error.d.ts +0 -0
  556. /package/{esm → types}/exception/wrap-exception.d.ts +0 -0
  557. /package/{esm → types}/filter/antlr/OpraFilterLexer.d.ts +0 -0
  558. /package/{esm → types}/filter/antlr/OpraFilterListener.d.ts +0 -0
  559. /package/{esm → types}/filter/antlr/OpraFilterParser.d.ts +0 -0
  560. /package/{esm → types}/filter/antlr/OpraFilterVisitor.d.ts +0 -0
  561. /package/{esm → types}/filter/ast/abstract/ast.d.ts +0 -0
  562. /package/{esm → types}/filter/ast/abstract/expression.d.ts +0 -0
  563. /package/{esm → types}/filter/ast/abstract/literal.d.ts +0 -0
  564. /package/{esm → types}/filter/ast/abstract/term.d.ts +0 -0
  565. /package/{esm → types}/filter/ast/expressions/arithmetic-expression.d.ts +0 -0
  566. /package/{esm → types}/filter/ast/expressions/array-expression.d.ts +0 -0
  567. /package/{esm → types}/filter/ast/expressions/comparison-expression.d.ts +0 -0
  568. /package/{esm → types}/filter/ast/expressions/logical-expression.d.ts +0 -0
  569. /package/{esm → types}/filter/ast/expressions/parentheses-expression.d.ts +0 -0
  570. /package/{esm → types}/filter/ast/index.d.ts +0 -0
  571. /package/{esm → types}/filter/ast/terms/boolean-literal.d.ts +0 -0
  572. /package/{esm → types}/filter/ast/terms/date-literal.d.ts +0 -0
  573. /package/{esm → types}/filter/ast/terms/external-constant.d.ts +0 -0
  574. /package/{esm → types}/filter/ast/terms/null-literal.d.ts +0 -0
  575. /package/{esm → types}/filter/ast/terms/number-literal.d.ts +0 -0
  576. /package/{esm → types}/filter/ast/terms/qualified-identifier.d.ts +0 -0
  577. /package/{esm → types}/filter/ast/terms/string-literal.d.ts +0 -0
  578. /package/{esm → types}/filter/ast/terms/time-literal.d.ts +0 -0
  579. /package/{esm → types}/filter/build.d.ts +0 -0
  580. /package/{esm → types}/filter/errors.d.ts +0 -0
  581. /package/{esm → types}/filter/filter-tree-visitor.d.ts +0 -0
  582. /package/{esm → types}/filter/index.d.ts +0 -0
  583. /package/{esm → types}/filter/opra-error-listener.d.ts +0 -0
  584. /package/{esm → types}/filter/parse.d.ts +0 -0
  585. /package/{esm → types}/filter/utils.d.ts +0 -0
  586. /package/{esm/schema/type-helpers/mixin.utils.d.ts → types/helpers/mixin-utils.d.ts} +0 -0
  587. /package/{esm → types}/http/enums/http-status-codes.enum.d.ts +0 -0
  588. /package/{esm → types}/http/interfaces/client-http-headers.interface.d.ts +0 -0
  589. /package/{esm → types}/http/interfaces/server-http-headers.interface.d.ts +0 -0
  590. /package/{esm/constants.d.ts → types/http/multipart/batch-multipart.d.ts} +0 -0
  591. /package/{esm → types}/i18n/i18n.d.ts +0 -0
  592. /package/{esm → types}/i18n/index.d.ts +0 -0
  593. /package/{esm → types}/i18n/string-utils.d.ts +0 -0
  594. /package/{esm → types}/i18n/translate.d.ts +0 -0
  595. /package/{esm → types}/url/opra-url-path-component.d.ts +0 -0
  596. /package/{esm → types}/url/opra-url-path.d.ts +0 -0
@@ -1,154 +1,170 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BatchMultipart = void 0;
4
- const tslib_1 = require("tslib");
5
- const highland_1 = tslib_1.__importDefault(require("highland"));
6
- const uid_1 = require("uid");
7
- const type_guards_js_1 = require("../../utils/type-guards.js");
8
- const http_headers_codes_enum_js_1 = require("../enums/http-headers-codes.enum.js");
9
- const http_status_codes_enum_js_1 = require("../enums/http-status-codes.enum.js");
10
- const normalize_headers_js_1 = require("../utils/normalize-headers.js");
11
- const http_request_content_js_1 = require("./http-request-content.js");
12
- const http_response_content_js_1 = require("./http-response-content.js");
13
- const CRLF = '\r\n';
14
- const CHARSET_PATTERN = / *charset=./i;
15
- class BatchMultipart {
16
- constructor() {
17
- this._parts = [];
18
- this.boundary = 'batch_' + (0, uid_1.uid)(12);
19
- }
20
- addRequestPart(content, part) {
21
- const headers = {
22
- ...(0, normalize_headers_js_1.normalizeHeaders)(part?.headers || {}, true),
23
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Type]: 'application/http',
24
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
25
- };
26
- if (part?.contentId)
27
- headers[http_headers_codes_enum_js_1.HttpHeaderCodes.Content_ID] = part.contentId;
28
- this._parts.push({
29
- headers,
30
- contentId: part?.contentId,
31
- content: new http_request_content_js_1.HttpRequestContent(content)
32
- });
33
- return this;
34
- }
35
- addHttpResponse(content, part) {
36
- const headers = {
37
- ...(0, normalize_headers_js_1.normalizeHeaders)(part?.headers || {}, true),
38
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Type]: 'application/http',
39
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
40
- };
41
- if (part?.contentId)
42
- headers[http_headers_codes_enum_js_1.HttpHeaderCodes.Content_ID] = part.contentId;
43
- this._parts.push({
44
- headers,
45
- contentId: part?.contentId,
46
- content: new http_response_content_js_1.HttpResponseContent(content)
47
- });
48
- return this;
49
- }
50
- addBatch(batch, part) {
51
- const headers = {
52
- ...(0, normalize_headers_js_1.normalizeHeaders)(part?.headers || {}, true),
53
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Type]: 'application/http',
54
- [http_headers_codes_enum_js_1.HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
55
- };
56
- if (part?.contentId)
57
- headers[http_headers_codes_enum_js_1.HttpHeaderCodes.Content_ID] = part.contentId;
58
- this._parts.push({
59
- headers,
60
- contentId: part?.contentId,
61
- content: batch
62
- });
63
- return this;
64
- }
65
- stream() {
66
- const chunks = [];
67
- this._build(chunks);
68
- return (0, highland_1.default)(chunks).flatten().toNodeStream();
69
- }
70
- _build(target) {
71
- for (const part of this._parts) {
72
- if (part.content instanceof http_request_content_js_1.HttpRequestContent || part.content instanceof http_response_content_js_1.HttpResponseContent) {
73
- let contentBody = part.content.data;
74
- let contentLength = 0;
75
- const contentHeaders = (0, normalize_headers_js_1.normalizeHeaders)(part.content.headers);
76
- if (contentBody) {
77
- const contentType = String(contentHeaders['content-type'] || '').split(/\s*;\s*/);
78
- let charset = '';
79
- if ((0, type_guards_js_1.isReadable)(contentBody)) {
80
- contentLength = parseInt(String(contentHeaders['content-length']), 10) || 0;
81
- // const l = parseInt(String(contentHeaders['content-length']), 10);
82
- // if (isNaN(l))
83
- // throw new TypeError('"content-length" header required for streamed responses');
84
- }
85
- else if (typeof contentBody === 'object') {
86
- if (typeof contentBody.stream === 'function') { // File and Blob
87
- contentType[0] = contentBody.type || 'binary';
88
- contentLength = contentBody.size;
89
- contentBody = contentBody.stream();
90
- }
91
- else if (Buffer.isBuffer(contentBody)) {
92
- contentHeaders['content-length'] = String(contentBody.length);
93
- }
94
- else {
95
- contentType[0] = contentType[0] || 'application/json';
96
- charset = 'utf-8';
97
- contentBody = Buffer.from(JSON.stringify(contentBody), 'utf-8');
98
- contentLength = contentBody.length;
99
- }
100
- }
101
- else {
102
- contentType[0] = contentType[0] || 'text/plain';
103
- charset = 'utf-8';
104
- contentBody = Buffer.from(String(contentBody), 'utf-8');
105
- contentLength = contentBody.length;
106
- }
107
- if (contentType[0]) {
108
- if (charset) {
109
- const i = contentType.findIndex(x => CHARSET_PATTERN.test(String(x)));
110
- if (i > 0)
111
- contentType[i] = 'charset=' + charset;
112
- else
113
- contentType.join('charset=' + charset);
114
- }
115
- contentHeaders['content-type'] = contentType.join(';');
116
- }
117
- if (contentLength)
118
- contentHeaders['content-length'] = String(contentLength);
119
- }
120
- let s = '--' + this.boundary + CRLF;
121
- for (const [k, v] of Object.entries(part.headers)) {
122
- if (!(v === '' || v == null))
123
- s += k + ': ' + (Array.isArray(v) ? v.join(';') : v) + CRLF;
124
- }
125
- s += CRLF;
126
- if (part.content instanceof http_request_content_js_1.HttpRequestContent)
127
- s += (part.content.method || 'GET').toUpperCase() + ' ' + part.content.url + ' HTTP/1.1' + CRLF;
128
- else
129
- s += 'HTTP/1.1 ' + part.content.status + (http_status_codes_enum_js_1.HttpStatusCodes[part.content.status] || 'Unknown') + CRLF;
130
- if (part.content.headers) {
131
- for (const [k, v] of Object.entries(part.content.headers)) {
132
- if (v === '' || v == null)
133
- continue;
134
- if (k === 'set-cookie' && Array.isArray(v)) {
135
- v.forEach(x => s += k + ': ' + x);
136
- }
137
- else
138
- s += k + ': ' + (Array.isArray(v) ? v.join(';') : v) + CRLF;
139
- }
140
- }
141
- s += CRLF;
142
- target.push(Buffer.from(s, 'utf-8'));
143
- if (contentBody) {
144
- target.push(contentBody);
145
- target.push(Buffer.from(CRLF + CRLF));
146
- }
147
- }
148
- else
149
- throw new Error('Not implemented yet');
150
- }
151
- target.push(Buffer.from('--' + this.boundary + '--' + CRLF, 'utf-8'));
152
- }
153
- }
154
- exports.BatchMultipart = BatchMultipart;
2
+ // import Highland from 'highland';
3
+ // import { Readable } from 'stream';
4
+ // import { uid } from 'uid';
5
+ // import { isReadable } from '../../helpers/index.js';
6
+ // import { HttpHeaderCodes } from '../enums/http-headers-codes.enum.js';
7
+ // import { HttpStatusCodes } from '../enums/http-status-codes.enum.js';
8
+ // import { normalizeHeaders } from '../utils/normalize-headers.js';
9
+ // import { HttpRequestContent, IHttpRequestContent } from './http-request-content.js';
10
+ // import { HttpResponseContent, IHttpResponseContent } from './http-response-content.js';
11
+ //
12
+ // const CRLF = '\r\n';
13
+ // const CHARSET_PATTERN = / *charset=./i;
14
+ //
15
+ // type Part = {
16
+ // headers: Record<string, string | string[]>;
17
+ // contentId?: string;
18
+ // content: HttpRequestContent | HttpResponseContent | BatchMultipart;
19
+ // }
20
+ //
21
+ // export class BatchMultipart {
22
+ // protected _parts: Part[] = [];
23
+ // readonly boundary: string;
24
+ //
25
+ // constructor() {
26
+ // this.boundary = 'batch_' + uid(12);
27
+ // }
28
+ //
29
+ // addRequestPart(content: IHttpRequestContent, part?: {
30
+ // contentId?: string;
31
+ // headers?: Record<string, string | string[]>;
32
+ // }): this {
33
+ // const headers: any = {
34
+ // ...normalizeHeaders(part?.headers || {}, true),
35
+ // [HttpHeaderCodes.Content_Type]: 'application/http',
36
+ // [HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
37
+ // };
38
+ // if (part?.contentId)
39
+ // headers[HttpHeaderCodes.Content_ID] = part.contentId;
40
+ // this._parts.push({
41
+ // headers,
42
+ // contentId: part?.contentId,
43
+ // content: new HttpRequestContent(content)
44
+ // });
45
+ // return this;
46
+ // }
47
+ //
48
+ // addHttpResponse(content: IHttpResponseContent, part?: {
49
+ // contentId?: string;
50
+ // headers?: Record<string, string | string[]>;
51
+ // }): this {
52
+ // const headers: any = {
53
+ // ...normalizeHeaders(part?.headers || {}, true),
54
+ // [HttpHeaderCodes.Content_Type]: 'application/http',
55
+ // [HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
56
+ // };
57
+ // if (part?.contentId)
58
+ // headers[HttpHeaderCodes.Content_ID] = part.contentId;
59
+ // this._parts.push({
60
+ // headers,
61
+ // contentId: part?.contentId,
62
+ // content: new HttpResponseContent(content)
63
+ // });
64
+ // return this;
65
+ // }
66
+ //
67
+ // addBatch(batch: BatchMultipart, part?: {
68
+ // contentId?: string;
69
+ // headers?: Record<string, string | string[]>;
70
+ // }): this {
71
+ // const headers: any = {
72
+ // ...normalizeHeaders(part?.headers || {}, true),
73
+ // [HttpHeaderCodes.Content_Type]: 'application/http',
74
+ // [HttpHeaderCodes.Content_Transfer_Encoding]: 'binary'
75
+ // };
76
+ // if (part?.contentId)
77
+ // headers[HttpHeaderCodes.Content_ID] = part.contentId;
78
+ // this._parts.push({
79
+ // headers,
80
+ // contentId: part?.contentId,
81
+ // content: batch
82
+ // });
83
+ // return this;
84
+ // }
85
+ //
86
+ // stream(): NodeJS.ReadableStream {
87
+ // const chunks: (Buffer | Readable)[] = [];
88
+ // this._build(chunks);
89
+ // return Highland(chunks).flatten().toNodeStream();
90
+ // }
91
+ //
92
+ // protected _build(target: (Buffer | Readable)[]) {
93
+ // for (const part of this._parts) {
94
+ // if (part.content instanceof HttpRequestContent || part.content instanceof HttpResponseContent) {
95
+ // let contentBody = part.content.data;
96
+ // let contentLength = 0;
97
+ // const contentHeaders = normalizeHeaders(part.content.headers);
98
+ // if (contentBody) {
99
+ // const contentType = String(contentHeaders['content-type'] || '').split(/\s*;\s*/);
100
+ // let charset = '';
101
+ // if (isReadable(contentBody)) {
102
+ // contentLength = parseInt(String(contentHeaders['content-length']), 10) || 0;
103
+ // // const l = parseInt(String(contentHeaders['content-length']), 10);
104
+ // // if (isNaN(l))
105
+ // // throw new TypeError('"content-length" header required for streamed responses');
106
+ // } else if (typeof contentBody === 'object') {
107
+ // if (typeof contentBody.stream === 'function') { // File and Blob
108
+ // contentType[0] = contentBody.type || 'binary';
109
+ // contentLength = contentBody.size;
110
+ // contentBody = contentBody.stream();
111
+ // } else if (Buffer.isBuffer(contentBody)) {
112
+ // contentHeaders['content-length'] = String(contentBody.length);
113
+ // } else {
114
+ // contentType[0] = contentType[0] || 'application/json';
115
+ // charset = 'utf-8';
116
+ // contentBody = Buffer.from(JSON.stringify(contentBody), 'utf-8');
117
+ // contentLength = contentBody.length;
118
+ // }
119
+ // } else {
120
+ // contentType[0] = contentType[0] || 'text/plain';
121
+ // charset = 'utf-8';
122
+ // contentBody = Buffer.from(String(contentBody), 'utf-8');
123
+ // contentLength = contentBody.length;
124
+ // }
125
+ // if (contentType[0]) {
126
+ // if (charset) {
127
+ // const i = contentType.findIndex(x => CHARSET_PATTERN.test(String(x)));
128
+ // if (i > 0) contentType[i] = 'charset=' + charset;
129
+ // else contentType.join('charset=' + charset);
130
+ // }
131
+ // contentHeaders['content-type'] = contentType.join(';');
132
+ // }
133
+ // if (contentLength)
134
+ // contentHeaders['content-length'] = String(contentLength);
135
+ // }
136
+ //
137
+ // let s = '--' + this.boundary + CRLF;
138
+ // for (const [k, v] of Object.entries(part.headers)) {
139
+ // if (!(v === '' || v == null))
140
+ // s += k + ': ' + (Array.isArray(v) ? v.join(';') : v) + CRLF;
141
+ // }
142
+ // s += CRLF;
143
+ //
144
+ // if (part.content instanceof HttpRequestContent)
145
+ // s += (part.content.method || 'GET').toUpperCase() + ' ' + part.content.url + ' HTTP/1.1' + CRLF;
146
+ // else
147
+ // s += 'HTTP/1.1 ' + part.content.status + (HttpStatusCodes[part.content.status] || 'Unknown') + CRLF;
148
+ // if (part.content.headers) {
149
+ // for (const [k, v] of Object.entries(part.content.headers)) {
150
+ // if (v === '' || v == null)
151
+ // continue;
152
+ // if (k === 'set-cookie' && Array.isArray(v)) {
153
+ // v.forEach(x => s += k + ': ' + x);
154
+ // } else
155
+ // s += k + ': ' + (Array.isArray(v) ? v.join(';') : v) + CRLF;
156
+ // }
157
+ // }
158
+ // s += CRLF;
159
+ // target.push(Buffer.from(s, 'utf-8'));
160
+ //
161
+ // if (contentBody) {
162
+ // target.push(contentBody);
163
+ // target.push(Buffer.from(CRLF + CRLF));
164
+ // }
165
+ // } else throw new Error('Not implemented yet');
166
+ // }
167
+ // target.push(Buffer.from('--' + this.boundary + '--' + CRLF, 'utf-8'));
168
+ // }
169
+ //
170
+ // }
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpRequestContent = void 0;
4
- class HttpRequestContent {
5
- constructor(init) {
6
- this.method = init.method;
7
- this.url = encodeURI(decodeURI(init.url));
8
- this.headers = init.headers;
9
- this.data = init.data;
10
- }
11
- }
12
- exports.HttpRequestContent = HttpRequestContent;
2
+ //
3
+ // export type IHttpRequestContent = Pick<HttpRequestContent, 'method' | 'url' | 'headers' | 'data'>;
4
+ //
5
+ // export class HttpRequestContent {
6
+ // method: string;
7
+ // url: string;
8
+ // headers?: Record<string, string | string[]>;
9
+ // data?: any;
10
+ //
11
+ // constructor(init: IHttpRequestContent) {
12
+ // this.method = init.method;
13
+ // this.url = encodeURI(decodeURI(init.url));
14
+ // this.headers = init.headers;
15
+ // this.data = init.data;
16
+ // }
17
+ // }
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpResponseContent = void 0;
4
- class HttpResponseContent {
5
- constructor(init) {
6
- this.status = init.status;
7
- this.headers = init.headers;
8
- this.data = init.data;
9
- }
10
- }
11
- exports.HttpResponseContent = HttpResponseContent;
2
+ // export type IHttpResponseContent = Pick<HttpResponseContent, 'status' | 'headers' | 'data'>;
3
+ //
4
+ // export class HttpResponseContent {
5
+ // status: number;
6
+ // headers?: Record<string, string | string[]>;
7
+ // data?: any;
8
+ //
9
+ // constructor(init: IHttpResponseContent) {
10
+ // this.status = init.status;
11
+ // this.headers = init.headers;
12
+ // this.data = init.data;
13
+ // }
14
+ // }
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./batch-multipart.js"), exports);
2
+ // export * from './batch-multipart.js';
package/cjs/i18n/i18n.js CHANGED
@@ -6,7 +6,7 @@ const fast_tokenizer_1 = require("fast-tokenizer");
6
6
  const fs_1 = tslib_1.__importDefault(require("fs"));
7
7
  const i18next_1 = tslib_1.__importDefault(require("i18next"));
8
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
- const index_js_1 = require("../utils/index.js");
9
+ const index_js_1 = require("../helpers/index.js");
10
10
  const string_utils_js_1 = require("./string-utils.js");
11
11
  exports.BaseI18n = Object.getPrototypeOf(i18next_1.default).constructor;
12
12
  const globalLocaleDirs = [];
package/cjs/index.js CHANGED
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uid = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./types.js"), exports);
6
+ tslib_1.__exportStar(require("./document/index.js"), exports);
5
7
  tslib_1.__exportStar(require("./exception/index.js"), exports);
8
+ tslib_1.__exportStar(require("./filter/index.js"), exports); // todo review
9
+ tslib_1.__exportStar(require("./helpers/index.js"), exports);
10
+ tslib_1.__exportStar(require("./http/index.js"), exports);
6
11
  tslib_1.__exportStar(require("./i18n/index.js"), exports);
7
- tslib_1.__exportStar(require("./filter/index.js"), exports); // todo. review
8
- tslib_1.__exportStar(require("./http/multipart/index.js"), exports);
9
12
  tslib_1.__exportStar(require("./schema/index.js"), exports);
10
13
  tslib_1.__exportStar(require("./url/index.js"), exports);
11
- tslib_1.__exportStar(require("./http/index.js"), exports);
12
- tslib_1.__exportStar(require("./helpers/index.js"), exports);
13
- tslib_1.__exportStar(require("./utils/index.js"), exports);
14
+ tslib_1.__exportStar(require("./utils/path-utils.js"), exports);
14
15
  var uid_1 = require("uid");
15
16
  Object.defineProperty(exports, "uid", { enumerable: true, get: function () { return uid_1.uid; } });
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectionMethods = exports.singletonMethods = exports.MAPPED_TYPE_METADATA = exports.IGNORE_RESOLVER_METHOD = exports.RESOLVER_METADATA = exports.RESOURCE_METADATA = exports.COMPLEXTYPE_FIELDS = exports.DATATYPE_METADATA = void 0;
4
- exports.DATATYPE_METADATA = 'opra:data_type.metadata';
5
- exports.COMPLEXTYPE_FIELDS = 'opra:complex_type.fields';
6
- exports.RESOURCE_METADATA = 'opra:resource.metadata';
7
- exports.RESOLVER_METADATA = 'opra:resolver.metadata';
8
- exports.IGNORE_RESOLVER_METHOD = 'opra:ignore_resolver-method';
9
- exports.MAPPED_TYPE_METADATA = 'opra:mapped_type.metadata';
10
- exports.singletonMethods = ['create', 'delete', 'get', 'update'];
11
- exports.collectionMethods = [...exports.singletonMethods, 'count', 'deleteMany', 'updateMany', 'search'];
3
+ exports.SpecVersion = void 0;
4
+ exports.SpecVersion = '1.0';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComplexType = void 0;
4
+ var ComplexType;
5
+ (function (ComplexType) {
6
+ ComplexType.Kind = 'ComplexType';
7
+ })(ComplexType = exports.ComplexType || (exports.ComplexType = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumType = void 0;
4
+ var EnumType;
5
+ (function (EnumType) {
6
+ EnumType.Kind = 'EnumType';
7
+ })(EnumType = exports.EnumType || (exports.EnumType = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MappedType = void 0;
4
+ var MappedType;
5
+ (function (MappedType) {
6
+ MappedType.Kind = 'MappedType';
7
+ })(MappedType = exports.MappedType || (exports.MappedType = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleType = void 0;
4
+ var SimpleType;
5
+ (function (SimpleType) {
6
+ SimpleType.Kind = 'SimpleType';
7
+ })(SimpleType = exports.SimpleType || (exports.SimpleType = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnionType = void 0;
4
+ var UnionType;
5
+ (function (UnionType) {
6
+ UnionType.Kind = 'UnionType';
7
+ })(UnionType = exports.UnionType || (exports.UnionType = {}));
@@ -1,28 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- require("reflect-metadata");
5
- tslib_1.__exportStar(require("./constants.js"), exports);
6
- tslib_1.__exportStar(require("./types.js"), exports);
7
- tslib_1.__exportStar(require("./opra-schema.definition.js"), exports);
8
- tslib_1.__exportStar(require("./decorators/opr-complex-type.decorator.js"), exports);
9
- tslib_1.__exportStar(require("./decorators/opr-field.decorator.js"), exports);
10
- tslib_1.__exportStar(require("./decorators/opr-collection-resource.decorator.js"), exports);
11
- tslib_1.__exportStar(require("./decorators/opr-singleton-resource.decorator.js"), exports);
12
- tslib_1.__exportStar(require("./decorators/opr-resolver.decorator.js"), exports);
13
- tslib_1.__exportStar(require("./interfaces/resource-container.interface.js"), exports);
14
- tslib_1.__exportStar(require("./implementation/document-builder.js"), exports);
15
- tslib_1.__exportStar(require("./implementation/opra-document.js"), exports);
16
- tslib_1.__exportStar(require("./implementation/data-type/data-type.js"), exports);
17
- tslib_1.__exportStar(require("./implementation/data-type/complex-type.js"), exports);
18
- tslib_1.__exportStar(require("./implementation/data-type/simple-type.js"), exports);
19
- tslib_1.__exportStar(require("./implementation/data-type/union-type.js"), exports);
20
- tslib_1.__exportStar(require("./implementation/resource/resource-info.js"), exports);
21
- tslib_1.__exportStar(require("./implementation/resource/container-resource-info.js"), exports);
22
- tslib_1.__exportStar(require("./implementation/resource/collection-resource-info.js"), exports);
23
- tslib_1.__exportStar(require("./implementation/resource/singleton-resource-info.js"), exports);
24
- tslib_1.__exportStar(require("./implementation/query/index.js"), exports);
25
- tslib_1.__exportStar(require("./type-helpers/mixin-type.helper.js"), exports);
26
- tslib_1.__exportStar(require("./type-helpers/extend-type.helper.js"), exports);
27
- tslib_1.__exportStar(require("./implementation/schema-builder/extract-type-metadata.util.js"), exports);
28
- tslib_1.__exportStar(require("./implementation/schema-builder/extract-resource-metadata.util.js"), exports);
3
+ exports.OpraSchema = void 0;
4
+ const constants_js_1 = require("./constants.js");
5
+ const complex_type_interface_js_1 = require("./data-type/complex-type.interface.js");
6
+ const enum_type_interface_js_1 = require("./data-type/enum-type.interface.js");
7
+ const mapped_type_interface_js_1 = require("./data-type/mapped-type.interface.js");
8
+ const simple_type_interface_js_1 = require("./data-type/simple-type.interface.js");
9
+ const union_type_interface_js_1 = require("./data-type/union-type.interface.js");
10
+ const collection_interface_js_1 = require("./resource/collection.interface.js");
11
+ const container_interface_js_1 = require("./resource/container.interface.js");
12
+ const singleton_interface_js_1 = require("./resource/singleton.interface.js");
13
+ const type_guards_js_1 = require("./type-guards.js");
14
+ var OpraSchema;
15
+ (function (OpraSchema) {
16
+ // Re-export constants and types
17
+ OpraSchema.SpecVersion = constants_js_1.SpecVersion;
18
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
+ OpraSchema.ComplexType = complex_type_interface_js_1.ComplexType;
20
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
+ OpraSchema.EnumType = enum_type_interface_js_1.EnumType;
22
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
+ OpraSchema.MappedType = mapped_type_interface_js_1.MappedType;
24
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ OpraSchema.SimpleType = simple_type_interface_js_1.SimpleType;
26
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
+ OpraSchema.UnionType = union_type_interface_js_1.UnionType;
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ OpraSchema.Collection = collection_interface_js_1.Collection;
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ OpraSchema.Container = container_interface_js_1.Container;
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ OpraSchema.Singleton = singleton_interface_js_1.Singleton;
34
+ OpraSchema.isDataType = type_guards_js_1.isDataType;
35
+ OpraSchema.isComplexType = type_guards_js_1.isComplexType;
36
+ OpraSchema.isEnumType = type_guards_js_1.isEnumType;
37
+ OpraSchema.isMappedType = type_guards_js_1.isMappedType;
38
+ OpraSchema.isSimpleType = type_guards_js_1.isSimpleType;
39
+ OpraSchema.isUnionType = type_guards_js_1.isUnionType;
40
+ OpraSchema.isResource = type_guards_js_1.isResource;
41
+ OpraSchema.isCollection = type_guards_js_1.isCollection;
42
+ OpraSchema.isContainer = type_guards_js_1.isContainer;
43
+ OpraSchema.isSingleton = type_guards_js_1.isSingleton;
44
+ })(OpraSchema = exports.OpraSchema || (exports.OpraSchema = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collection = void 0;
4
+ var Collection;
5
+ (function (Collection) {
6
+ Collection.Kind = 'Collection';
7
+ })(Collection = exports.Collection || (exports.Collection = {}));
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Container = void 0;
4
+ var Container;
5
+ (function (Container) {
6
+ Container.Kind = 'Container';
7
+ })(Container = exports.Container || (exports.Container = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Singleton = void 0;
4
+ var Singleton;
5
+ (function (Singleton) {
6
+ Singleton.Kind = 'Singleton';
7
+ })(Singleton = exports.Singleton || (exports.Singleton = {}));