@outfoxx/sunday 1.1.0-beta.6 → 1.1.0-beta.7

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 (403) hide show
  1. package/{dist → build/esm}/any-type.d.ts +0 -0
  2. package/{dist → build/esm}/any-type.js +0 -0
  3. package/build/esm/any-type.js.map +1 -0
  4. package/{dist → build/esm}/class-type.d.ts +0 -0
  5. package/{dist → build/esm}/class-type.js +0 -0
  6. package/build/esm/class-type.js.map +1 -0
  7. package/{dist → build/esm}/date-time-types.d.ts +0 -0
  8. package/{dist → build/esm}/date-time-types.js +0 -0
  9. package/build/esm/date-time-types.js.map +1 -0
  10. package/{dist → build/esm}/event-parser.d.ts +0 -0
  11. package/{dist → build/esm}/event-parser.js +0 -0
  12. package/build/esm/event-parser.js.map +1 -0
  13. package/{dist → build/esm}/fetch-event-source.d.ts +0 -0
  14. package/{dist → build/esm}/fetch-event-source.js +0 -0
  15. package/build/esm/fetch-event-source.js.map +1 -0
  16. package/{dist → build/esm}/fetch-request-factory.d.ts +0 -0
  17. package/{dist → build/esm}/fetch-request-factory.js +17 -8
  18. package/build/esm/fetch-request-factory.js.map +1 -0
  19. package/{dist → build/esm}/fetch.d.ts +0 -0
  20. package/build/esm/fetch.js +103 -0
  21. package/build/esm/fetch.js.map +1 -0
  22. package/{dist → build/esm}/header-parameters.d.ts +0 -0
  23. package/{dist → build/esm}/header-parameters.js +0 -0
  24. package/build/esm/header-parameters.js.map +1 -0
  25. package/{dist → build/esm}/index.d.ts +0 -0
  26. package/{dist → build/esm}/index.js +0 -0
  27. package/build/esm/index.js.map +1 -0
  28. package/{dist → build/esm}/logger.d.ts +0 -0
  29. package/{dist → build/esm}/logger.js +0 -0
  30. package/build/esm/logger.js.map +1 -0
  31. package/{dist → build/esm}/media-type-codecs/any-text-decoder.d.ts +0 -0
  32. package/build/esm/media-type-codecs/any-text-decoder.js +40 -0
  33. package/build/esm/media-type-codecs/any-text-decoder.js.map +1 -0
  34. package/{dist → build/esm}/media-type-codecs/any-text-encoder.d.ts +0 -0
  35. package/{dist → build/esm}/media-type-codecs/any-text-encoder.js +0 -0
  36. package/build/esm/media-type-codecs/any-text-encoder.js.map +1 -0
  37. package/{dist → build/esm}/media-type-codecs/binary-decoder.d.ts +0 -0
  38. package/build/esm/media-type-codecs/binary-decoder.js +40 -0
  39. package/build/esm/media-type-codecs/binary-decoder.js.map +1 -0
  40. package/{dist → build/esm}/media-type-codecs/binary-encoder.d.ts +0 -0
  41. package/{dist → build/esm}/media-type-codecs/binary-encoder.js +0 -0
  42. package/build/esm/media-type-codecs/binary-encoder.js.map +1 -0
  43. package/{dist → build/esm}/media-type-codecs/cbor-decoder.d.ts +0 -0
  44. package/{dist → build/esm}/media-type-codecs/cbor-decoder.js +13 -2
  45. package/build/esm/media-type-codecs/cbor-decoder.js.map +1 -0
  46. package/{dist → build/esm}/media-type-codecs/cbor-encoder.d.ts +0 -0
  47. package/{dist → build/esm}/media-type-codecs/cbor-encoder.js +0 -0
  48. package/build/esm/media-type-codecs/cbor-encoder.js.map +1 -0
  49. package/{dist → build/esm}/media-type-codecs/cbor-tags.d.ts +0 -0
  50. package/{dist → build/esm}/media-type-codecs/cbor-tags.js +0 -0
  51. package/build/esm/media-type-codecs/cbor-tags.js.map +1 -0
  52. package/{dist → build/esm}/media-type-codecs/json-decoder.d.ts +0 -0
  53. package/{dist → build/esm}/media-type-codecs/json-decoder.js +13 -2
  54. package/build/esm/media-type-codecs/json-decoder.js.map +1 -0
  55. package/{dist → build/esm}/media-type-codecs/json-encoder.d.ts +0 -0
  56. package/{dist → build/esm}/media-type-codecs/json-encoder.js +0 -0
  57. package/build/esm/media-type-codecs/json-encoder.js.map +1 -0
  58. package/{dist → build/esm}/media-type-codecs/media-type-decoder.d.ts +0 -0
  59. package/{dist → build/esm}/media-type-codecs/media-type-decoder.js +0 -0
  60. package/build/esm/media-type-codecs/media-type-decoder.js.map +1 -0
  61. package/{dist → build/esm}/media-type-codecs/media-type-decoders.d.ts +0 -0
  62. package/{dist → build/esm}/media-type-codecs/media-type-decoders.js +0 -0
  63. package/build/esm/media-type-codecs/media-type-decoders.js.map +1 -0
  64. package/{dist → build/esm}/media-type-codecs/media-type-encoder.d.ts +0 -0
  65. package/{dist → build/esm}/media-type-codecs/media-type-encoder.js +0 -0
  66. package/build/esm/media-type-codecs/media-type-encoder.js.map +1 -0
  67. package/{dist → build/esm}/media-type-codecs/media-type-encoders.d.ts +0 -0
  68. package/{dist → build/esm}/media-type-codecs/media-type-encoders.js +0 -0
  69. package/build/esm/media-type-codecs/media-type-encoders.js.map +1 -0
  70. package/{dist → build/esm}/media-type-codecs/www-form-url-encoder.d.ts +0 -0
  71. package/{dist → build/esm}/media-type-codecs/www-form-url-encoder.js +0 -0
  72. package/build/esm/media-type-codecs/www-form-url-encoder.js.map +1 -0
  73. package/{dist → build/esm}/media-type.d.ts +0 -0
  74. package/{dist → build/esm}/media-type.js +0 -0
  75. package/build/esm/media-type.js.map +1 -0
  76. package/{dist → build/esm}/problem.d.ts +0 -0
  77. package/{dist → build/esm}/problem.js +30 -19
  78. package/build/esm/problem.js.map +1 -0
  79. package/{dist → build/esm}/request-factory.d.ts +0 -0
  80. package/{dist → build/esm}/request-factory.js +0 -0
  81. package/build/esm/request-factory.js.map +1 -0
  82. package/{dist → build/esm}/result-response.d.ts +0 -0
  83. package/{dist → build/esm}/result-response.js +0 -0
  84. package/build/esm/result-response.js.map +1 -0
  85. package/{dist → build/esm}/sunday-error.d.ts +0 -0
  86. package/build/esm/sunday-error.js +42 -0
  87. package/build/esm/sunday-error.js.map +1 -0
  88. package/{dist → build/esm}/url-template.d.ts +0 -0
  89. package/{dist → build/esm}/url-template.js +0 -0
  90. package/build/esm/url-template.js.map +1 -0
  91. package/{dist → build/esm}/util/any.d.ts +0 -0
  92. package/{dist → build/esm}/util/any.js +0 -0
  93. package/build/esm/util/any.js.map +1 -0
  94. package/{dist → build/esm}/util/base64.d.ts +0 -0
  95. package/{dist → build/esm}/util/base64.js +0 -0
  96. package/build/esm/util/base64.js.map +1 -0
  97. package/{dist → build/esm}/util/error.d.ts +0 -0
  98. package/{dist → build/esm}/util/error.js +0 -0
  99. package/build/esm/util/error.js.map +1 -0
  100. package/{dist → build/esm}/util/hex.d.ts +0 -0
  101. package/{dist → build/esm}/util/hex.js +0 -0
  102. package/build/esm/util/hex.js.map +1 -0
  103. package/{dist → build/esm}/util/rxjs.d.ts +0 -0
  104. package/{dist → build/esm}/util/rxjs.js +0 -0
  105. package/build/esm/util/rxjs.js.map +1 -0
  106. package/{dist → build/esm}/util/stream-rxjs.d.ts +0 -0
  107. package/build/esm/util/stream-rxjs.js +50 -0
  108. package/build/esm/util/stream-rxjs.js.map +1 -0
  109. package/{dist → build/esm}/util/temporal.d.ts +0 -0
  110. package/{dist → build/esm}/util/temporal.js +0 -0
  111. package/build/esm/util/temporal.js.map +1 -0
  112. package/build/esnext/any-type.d.ts +4 -0
  113. package/build/esnext/any-type.js +15 -0
  114. package/build/esnext/any-type.js.map +1 -0
  115. package/build/esnext/class-type.d.ts +2 -0
  116. package/build/esnext/class-type.js +15 -0
  117. package/build/esnext/class-type.js.map +1 -0
  118. package/build/esnext/date-time-types.d.ts +2 -0
  119. package/build/esnext/date-time-types.js +16 -0
  120. package/build/esnext/date-time-types.js.map +1 -0
  121. package/build/esnext/event-parser.d.ts +17 -0
  122. package/build/esnext/event-parser.js +153 -0
  123. package/build/esnext/event-parser.js.map +1 -0
  124. package/build/esnext/fetch-event-source.d.ts +58 -0
  125. package/build/esnext/fetch-event-source.js +290 -0
  126. package/build/esnext/fetch-event-source.js.map +1 -0
  127. package/build/esnext/fetch-request-factory.d.ts +34 -0
  128. package/build/esnext/fetch-request-factory.js +190 -0
  129. package/build/esnext/fetch-request-factory.js.map +1 -0
  130. package/build/esnext/fetch.d.ts +7 -0
  131. package/build/esnext/fetch.js +103 -0
  132. package/build/esnext/fetch.js.map +1 -0
  133. package/build/esnext/header-parameters.d.ts +3 -0
  134. package/build/esnext/header-parameters.js +53 -0
  135. package/build/esnext/header-parameters.js.map +1 -0
  136. package/build/esnext/index.d.ts +26 -0
  137. package/{src/index.ts → build/esnext/index.js} +1 -2
  138. package/build/esnext/index.js.map +1 -0
  139. package/build/esnext/logger.d.ts +8 -0
  140. package/build/esnext/logger.js +15 -0
  141. package/build/esnext/logger.js.map +1 -0
  142. package/build/esnext/media-type-codecs/any-text-decoder.d.ts +7 -0
  143. package/build/esnext/media-type-codecs/any-text-decoder.js +40 -0
  144. package/build/esnext/media-type-codecs/any-text-decoder.js.map +1 -0
  145. package/build/esnext/media-type-codecs/any-text-encoder.d.ts +5 -0
  146. package/build/esnext/media-type-codecs/any-text-encoder.js +23 -0
  147. package/build/esnext/media-type-codecs/any-text-encoder.js.map +1 -0
  148. package/build/esnext/media-type-codecs/binary-decoder.d.ts +6 -0
  149. package/build/esnext/media-type-codecs/binary-decoder.js +40 -0
  150. package/build/esnext/media-type-codecs/binary-decoder.js.map +1 -0
  151. package/build/esnext/media-type-codecs/binary-encoder.d.ts +5 -0
  152. package/build/esnext/media-type-codecs/binary-encoder.js +26 -0
  153. package/build/esnext/media-type-codecs/binary-encoder.js.map +1 -0
  154. package/build/esnext/media-type-codecs/cbor-decoder.d.ts +39 -0
  155. package/build/esnext/media-type-codecs/cbor-decoder.js +437 -0
  156. package/build/esnext/media-type-codecs/cbor-decoder.js.map +1 -0
  157. package/build/esnext/media-type-codecs/cbor-encoder.d.ts +43 -0
  158. package/build/esnext/media-type-codecs/cbor-encoder.js +236 -0
  159. package/build/esnext/media-type-codecs/cbor-encoder.js.map +1 -0
  160. package/build/esnext/media-type-codecs/cbor-tags.d.ts +4 -0
  161. package/{src/media-type-codecs/cbor-tags.ts → build/esnext/media-type-codecs/cbor-tags.js} +1 -1
  162. package/build/esnext/media-type-codecs/cbor-tags.js.map +1 -0
  163. package/build/esnext/media-type-codecs/json-decoder.d.ts +39 -0
  164. package/build/esnext/media-type-codecs/json-decoder.js +391 -0
  165. package/build/esnext/media-type-codecs/json-decoder.js.map +1 -0
  166. package/build/esnext/media-type-codecs/json-encoder.d.ts +44 -0
  167. package/build/esnext/media-type-codecs/json-encoder.js +273 -0
  168. package/build/esnext/media-type-codecs/json-encoder.js.map +1 -0
  169. package/build/esnext/media-type-codecs/media-type-decoder.d.ts +11 -0
  170. package/{src/result-response.ts → build/esnext/media-type-codecs/media-type-decoder.js} +5 -4
  171. package/build/esnext/media-type-codecs/media-type-decoder.js.map +1 -0
  172. package/build/esnext/media-type-codecs/media-type-decoders.d.ts +18 -0
  173. package/build/esnext/media-type-codecs/media-type-decoders.js +58 -0
  174. package/build/esnext/media-type-codecs/media-type-decoders.js.map +1 -0
  175. package/build/esnext/media-type-codecs/media-type-encoder.d.ts +12 -0
  176. package/{src/util/any.ts → build/esnext/media-type-codecs/media-type-encoder.js} +9 -9
  177. package/build/esnext/media-type-codecs/media-type-encoder.js.map +1 -0
  178. package/build/esnext/media-type-codecs/media-type-encoders.d.ts +18 -0
  179. package/build/esnext/media-type-codecs/media-type-encoders.js +60 -0
  180. package/build/esnext/media-type-codecs/media-type-encoders.js.map +1 -0
  181. package/build/esnext/media-type-codecs/www-form-url-encoder.d.ts +59 -0
  182. package/build/esnext/media-type-codecs/www-form-url-encoder.js +192 -0
  183. package/build/esnext/media-type-codecs/www-form-url-encoder.js.map +1 -0
  184. package/build/esnext/media-type.d.ts +94 -0
  185. package/build/esnext/media-type.js +305 -0
  186. package/build/esnext/media-type.js.map +1 -0
  187. package/build/esnext/problem.d.ts +31 -0
  188. package/build/esnext/problem.js +169 -0
  189. package/build/esnext/problem.js.map +1 -0
  190. package/build/esnext/request-factory.d.ts +44 -0
  191. package/build/esnext/request-factory.js +15 -0
  192. package/build/esnext/request-factory.js.map +1 -0
  193. package/build/esnext/result-response.d.ts +4 -0
  194. package/build/esnext/result-response.js +15 -0
  195. package/build/esnext/result-response.js.map +1 -0
  196. package/build/esnext/sunday-error.d.ts +11 -0
  197. package/build/esnext/sunday-error.js +42 -0
  198. package/build/esnext/sunday-error.js.map +1 -0
  199. package/build/esnext/url-template.d.ts +6 -0
  200. package/{src/url-template.ts → build/esnext/url-template.js} +15 -19
  201. package/build/esnext/url-template.js.map +1 -0
  202. package/build/esnext/util/any.d.ts +2 -0
  203. package/{src/logger.ts → build/esnext/util/any.js} +10 -8
  204. package/build/esnext/util/any.js.map +1 -0
  205. package/build/esnext/util/base64.d.ts +5 -0
  206. package/build/esnext/util/base64.js +77 -0
  207. package/build/esnext/util/base64.js.map +1 -0
  208. package/build/esnext/util/error.d.ts +2 -0
  209. package/{src/media-type-codecs/any-text-encoder.ts → build/esnext/util/error.js} +11 -11
  210. package/build/esnext/util/error.js.map +1 -0
  211. package/build/esnext/util/hex.d.ts +4 -0
  212. package/build/esnext/util/hex.js +32 -0
  213. package/build/esnext/util/hex.js.map +1 -0
  214. package/build/esnext/util/rxjs.d.ts +5 -0
  215. package/build/esnext/util/rxjs.js +31 -0
  216. package/build/esnext/util/rxjs.js.map +1 -0
  217. package/build/esnext/util/stream-rxjs.d.ts +2 -0
  218. package/build/esnext/util/stream-rxjs.js +50 -0
  219. package/build/esnext/util/stream-rxjs.js.map +1 -0
  220. package/build/esnext/util/temporal.d.ts +2 -0
  221. package/{dist/media-type-codecs/any-text-decoder.js → build/esnext/util/temporal.js} +14 -12
  222. package/build/esnext/util/temporal.js.map +1 -0
  223. package/build/main/any-type.d.ts +4 -0
  224. package/build/main/any-type.js +16 -0
  225. package/build/main/any-type.js.map +1 -0
  226. package/build/main/class-type.d.ts +2 -0
  227. package/build/main/class-type.js +16 -0
  228. package/build/main/class-type.js.map +1 -0
  229. package/build/main/date-time-types.d.ts +2 -0
  230. package/build/main/date-time-types.js +27 -0
  231. package/build/main/date-time-types.js.map +1 -0
  232. package/build/main/event-parser.d.ts +17 -0
  233. package/build/main/event-parser.js +157 -0
  234. package/build/main/event-parser.js.map +1 -0
  235. package/build/main/fetch-event-source.d.ts +58 -0
  236. package/build/main/fetch-event-source.js +294 -0
  237. package/build/main/fetch-event-source.js.map +1 -0
  238. package/build/main/fetch-request-factory.d.ts +34 -0
  239. package/build/main/fetch-request-factory.js +194 -0
  240. package/build/main/fetch-request-factory.js.map +1 -0
  241. package/build/main/fetch.d.ts +7 -0
  242. package/build/main/fetch.js +107 -0
  243. package/build/main/fetch.js.map +1 -0
  244. package/build/main/header-parameters.d.ts +3 -0
  245. package/build/main/header-parameters.js +56 -0
  246. package/build/main/header-parameters.js.map +1 -0
  247. package/build/main/index.d.ts +26 -0
  248. package/build/main/index.js +52 -0
  249. package/build/main/index.js.map +1 -0
  250. package/build/main/logger.d.ts +8 -0
  251. package/build/main/logger.js +16 -0
  252. package/build/main/logger.js.map +1 -0
  253. package/build/main/media-type-codecs/any-text-decoder.d.ts +7 -0
  254. package/build/main/media-type-codecs/any-text-decoder.js +44 -0
  255. package/build/main/media-type-codecs/any-text-decoder.js.map +1 -0
  256. package/build/main/media-type-codecs/any-text-encoder.d.ts +5 -0
  257. package/build/main/media-type-codecs/any-text-encoder.js +27 -0
  258. package/build/main/media-type-codecs/any-text-encoder.js.map +1 -0
  259. package/build/main/media-type-codecs/binary-decoder.d.ts +6 -0
  260. package/build/main/media-type-codecs/binary-decoder.js +44 -0
  261. package/build/main/media-type-codecs/binary-decoder.js.map +1 -0
  262. package/build/main/media-type-codecs/binary-encoder.d.ts +5 -0
  263. package/{dist/media-type-codecs/binary-decoder.js → build/main/media-type-codecs/binary-encoder.js} +14 -13
  264. package/build/main/media-type-codecs/binary-encoder.js.map +1 -0
  265. package/build/main/media-type-codecs/cbor-decoder.d.ts +39 -0
  266. package/build/main/media-type-codecs/cbor-decoder.js +441 -0
  267. package/build/main/media-type-codecs/cbor-decoder.js.map +1 -0
  268. package/build/main/media-type-codecs/cbor-encoder.d.ts +43 -0
  269. package/build/main/media-type-codecs/cbor-encoder.js +240 -0
  270. package/build/main/media-type-codecs/cbor-encoder.js.map +1 -0
  271. package/build/main/media-type-codecs/cbor-tags.d.ts +4 -0
  272. package/build/main/media-type-codecs/cbor-tags.js +21 -0
  273. package/build/main/media-type-codecs/cbor-tags.js.map +1 -0
  274. package/build/main/media-type-codecs/json-decoder.d.ts +39 -0
  275. package/build/main/media-type-codecs/json-decoder.js +395 -0
  276. package/build/main/media-type-codecs/json-decoder.js.map +1 -0
  277. package/build/main/media-type-codecs/json-encoder.d.ts +44 -0
  278. package/build/main/media-type-codecs/json-encoder.js +277 -0
  279. package/build/main/media-type-codecs/json-encoder.js.map +1 -0
  280. package/build/main/media-type-codecs/media-type-decoder.d.ts +11 -0
  281. package/build/main/media-type-codecs/media-type-decoder.js +23 -0
  282. package/build/main/media-type-codecs/media-type-decoder.js.map +1 -0
  283. package/build/main/media-type-codecs/media-type-decoders.d.ts +18 -0
  284. package/build/main/media-type-codecs/media-type-decoders.js +62 -0
  285. package/build/main/media-type-codecs/media-type-decoders.js.map +1 -0
  286. package/build/main/media-type-codecs/media-type-encoder.d.ts +12 -0
  287. package/build/main/media-type-codecs/media-type-encoder.js +29 -0
  288. package/build/main/media-type-codecs/media-type-encoder.js.map +1 -0
  289. package/build/main/media-type-codecs/media-type-encoders.d.ts +18 -0
  290. package/build/main/media-type-codecs/media-type-encoders.js +64 -0
  291. package/build/main/media-type-codecs/media-type-encoders.js.map +1 -0
  292. package/build/main/media-type-codecs/www-form-url-encoder.d.ts +59 -0
  293. package/build/main/media-type-codecs/www-form-url-encoder.js +196 -0
  294. package/build/main/media-type-codecs/www-form-url-encoder.js.map +1 -0
  295. package/build/main/media-type.d.ts +94 -0
  296. package/build/main/media-type.js +309 -0
  297. package/build/main/media-type.js.map +1 -0
  298. package/build/main/problem.d.ts +31 -0
  299. package/build/main/problem.js +172 -0
  300. package/build/main/problem.js.map +1 -0
  301. package/build/main/request-factory.d.ts +44 -0
  302. package/build/main/request-factory.js +16 -0
  303. package/build/main/request-factory.js.map +1 -0
  304. package/build/main/result-response.d.ts +4 -0
  305. package/build/main/result-response.js +16 -0
  306. package/build/main/result-response.js.map +1 -0
  307. package/build/main/sunday-error.d.ts +11 -0
  308. package/build/main/sunday-error.js +46 -0
  309. package/build/main/sunday-error.js.map +1 -0
  310. package/build/main/url-template.d.ts +6 -0
  311. package/build/main/url-template.js +35 -0
  312. package/build/main/url-template.js.map +1 -0
  313. package/build/main/util/any.d.ts +2 -0
  314. package/build/main/util/any.js +29 -0
  315. package/build/main/util/any.js.map +1 -0
  316. package/build/main/util/base64.d.ts +5 -0
  317. package/build/main/util/base64.js +80 -0
  318. package/build/main/util/base64.js.map +1 -0
  319. package/build/main/util/error.d.ts +2 -0
  320. package/{src/util/temporal.ts → build/main/util/error.js} +15 -16
  321. package/build/main/util/error.js.map +1 -0
  322. package/build/main/util/hex.d.ts +4 -0
  323. package/build/main/util/hex.js +35 -0
  324. package/build/main/util/hex.js.map +1 -0
  325. package/build/main/util/rxjs.d.ts +5 -0
  326. package/build/main/util/rxjs.js +36 -0
  327. package/build/main/util/rxjs.js.map +1 -0
  328. package/build/main/util/stream-rxjs.d.ts +2 -0
  329. package/build/main/util/stream-rxjs.js +54 -0
  330. package/build/main/util/stream-rxjs.js.map +1 -0
  331. package/build/main/util/temporal.d.ts +2 -0
  332. package/build/main/util/temporal.js +36 -0
  333. package/build/main/util/temporal.js.map +1 -0
  334. package/package.json +37 -27
  335. package/dist/any-type.js.map +0 -1
  336. package/dist/class-type.js.map +0 -1
  337. package/dist/date-time-types.js.map +0 -1
  338. package/dist/event-parser.js.map +0 -1
  339. package/dist/fetch-event-source.js.map +0 -1
  340. package/dist/fetch-request-factory.js.map +0 -1
  341. package/dist/fetch.js +0 -90
  342. package/dist/fetch.js.map +0 -1
  343. package/dist/header-parameters.js.map +0 -1
  344. package/dist/index.js.map +0 -1
  345. package/dist/logger.js.map +0 -1
  346. package/dist/media-type-codecs/any-text-decoder.js.map +0 -1
  347. package/dist/media-type-codecs/any-text-encoder.js.map +0 -1
  348. package/dist/media-type-codecs/binary-decoder.js.map +0 -1
  349. package/dist/media-type-codecs/binary-encoder.js.map +0 -1
  350. package/dist/media-type-codecs/cbor-decoder.js.map +0 -1
  351. package/dist/media-type-codecs/cbor-encoder.js.map +0 -1
  352. package/dist/media-type-codecs/cbor-tags.js.map +0 -1
  353. package/dist/media-type-codecs/json-decoder.js.map +0 -1
  354. package/dist/media-type-codecs/json-encoder.js.map +0 -1
  355. package/dist/media-type-codecs/media-type-decoder.js.map +0 -1
  356. package/dist/media-type-codecs/media-type-decoders.js.map +0 -1
  357. package/dist/media-type-codecs/media-type-encoder.js.map +0 -1
  358. package/dist/media-type-codecs/media-type-encoders.js.map +0 -1
  359. package/dist/media-type-codecs/www-form-url-encoder.js.map +0 -1
  360. package/dist/media-type.js.map +0 -1
  361. package/dist/problem.js.map +0 -1
  362. package/dist/request-factory.js.map +0 -1
  363. package/dist/result-response.js.map +0 -1
  364. package/dist/sunday-error.js +0 -31
  365. package/dist/sunday-error.js.map +0 -1
  366. package/dist/url-template.js.map +0 -1
  367. package/dist/util/any.js.map +0 -1
  368. package/dist/util/base64.js.map +0 -1
  369. package/dist/util/error.js.map +0 -1
  370. package/dist/util/hex.js.map +0 -1
  371. package/dist/util/rxjs.js.map +0 -1
  372. package/dist/util/stream-rxjs.js +0 -39
  373. package/dist/util/stream-rxjs.js.map +0 -1
  374. package/dist/util/temporal.js.map +0 -1
  375. package/src/any-type.ts +0 -22
  376. package/src/class-type.ts +0 -21
  377. package/src/date-time-types.ts +0 -37
  378. package/src/event-parser.ts +0 -204
  379. package/src/fetch-event-source.ts +0 -406
  380. package/src/fetch-request-factory.ts +0 -315
  381. package/src/fetch.ts +0 -99
  382. package/src/header-parameters.ts +0 -66
  383. package/src/media-type-codecs/any-text-decoder.ts +0 -34
  384. package/src/media-type-codecs/binary-decoder.ts +0 -38
  385. package/src/media-type-codecs/binary-encoder.ts +0 -33
  386. package/src/media-type-codecs/cbor-decoder.ts +0 -529
  387. package/src/media-type-codecs/cbor-encoder.ts +0 -314
  388. package/src/media-type-codecs/json-decoder.ts +0 -484
  389. package/src/media-type-codecs/json-encoder.ts +0 -335
  390. package/src/media-type-codecs/media-type-decoder.ts +0 -34
  391. package/src/media-type-codecs/media-type-decoders.ts +0 -86
  392. package/src/media-type-codecs/media-type-encoder.ts +0 -45
  393. package/src/media-type-codecs/media-type-encoders.ts +0 -88
  394. package/src/media-type-codecs/www-form-url-encoder.ts +0 -243
  395. package/src/media-type.ts +0 -362
  396. package/src/problem.ts +0 -171
  397. package/src/request-factory.ts +0 -124
  398. package/src/sunday-error.ts +0 -51
  399. package/src/util/base64.ts +0 -91
  400. package/src/util/error.ts +0 -28
  401. package/src/util/hex.ts +0 -30
  402. package/src/util/rxjs.ts +0 -43
  403. package/src/util/stream-rxjs.ts +0 -42
@@ -1,335 +0,0 @@
1
- // Copyright 2020 Outfox, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import {
16
- ChronoField,
17
- DateTimeFormatter,
18
- DateTimeFormatterBuilder,
19
- Instant,
20
- LocalDate,
21
- LocalDateTime,
22
- LocalTime,
23
- OffsetDateTime,
24
- OffsetTime,
25
- ResolverStyle,
26
- ZonedDateTime,
27
- } from '@js-joda/core';
28
- import { JsonIncludeType, JsonStringifier } from '@outfoxx/jackson-js';
29
- import { CustomMapper, Serializer } from '@outfoxx/jackson-js/dist/@types';
30
- import 'reflect-metadata';
31
- import { AnyType } from '../any-type';
32
- import { Base64 } from '../util/base64';
33
- import { encodeSeconds, secondsToNumber } from '../util/temporal';
34
- import { StructuredMediaTypeEncoder } from './media-type-encoder';
35
-
36
- export class JSONEncoder implements StructuredMediaTypeEncoder {
37
- static get default(): JSONEncoder {
38
- return new JSONEncoder(
39
- JSONEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH,
40
- );
41
- }
42
-
43
- private readonly customSerializers: CustomMapper<Serializer>[];
44
- private stringifier = new JsonStringifier();
45
-
46
- constructor(readonly dateEncoding: JSONEncoder.DateEncoding) {
47
- this.customSerializers = [
48
- {
49
- type: () => Date,
50
- mapper: this.dateSerializer,
51
- },
52
- {
53
- type: () => Instant,
54
- mapper: this.instantSerializer,
55
- },
56
- {
57
- type: () => ZonedDateTime,
58
- mapper: this.zonedDateTimeSerializer,
59
- },
60
- {
61
- type: () => OffsetDateTime,
62
- mapper: this.offsetDateTimeSerializer,
63
- },
64
- {
65
- type: () => OffsetTime,
66
- mapper: this.offsetTimeSerializer,
67
- },
68
- {
69
- type: () => LocalDateTime,
70
- mapper: this.localDateTimeSerializer,
71
- },
72
- {
73
- type: () => LocalDate,
74
- mapper: this.localDateSerializer,
75
- },
76
- {
77
- type: () => LocalTime,
78
- mapper: this.localTimeSerializer,
79
- },
80
- {
81
- type: () => URL,
82
- mapper: this.urlSerializer,
83
- },
84
- {
85
- type: () => ArrayBuffer,
86
- mapper: this.arrayBufferSerializer,
87
- },
88
- ];
89
- }
90
-
91
- encode<T>(value: T, type?: AnyType, includeNulls = false): string {
92
- // Use natural type when subtypes exist
93
- if (
94
- Reflect.hasMetadata(
95
- 'jackson:defaultContextGroup:JsonSubTypes',
96
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
- (value as any).constructor ?? {},
98
- )
99
- ) {
100
- type = [Object];
101
- }
102
-
103
- return this.stringifier.stringify(value, {
104
- serializers: this.customSerializers,
105
- features: {
106
- serialization: {
107
- DEFAULT_PROPERTY_INCLUSION: {
108
- value: includeNulls
109
- ? JsonIncludeType.ALWAYS
110
- : JsonIncludeType.NON_NULL,
111
- },
112
- },
113
- },
114
- mainCreator: () => type ?? [Object],
115
- });
116
- }
117
-
118
- encodeObject<T>(
119
- value: T,
120
- type?: AnyType,
121
- includeNulls = false,
122
- ): Record<string, unknown> {
123
- // Use natural type when subtypes exist
124
- if (
125
- Reflect.hasMetadata(
126
- 'jackson:defaultContextGroup:JsonSubTypes',
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
- (value as any).constructor ?? {},
129
- )
130
- ) {
131
- type = [Object];
132
- }
133
-
134
- return this.stringifier.transform(value, {
135
- serializers: this.customSerializers,
136
- features: {
137
- serialization: {
138
- DEFAULT_PROPERTY_INCLUSION: {
139
- value: includeNulls
140
- ? JsonIncludeType.ALWAYS
141
- : JsonIncludeType.NON_NULL,
142
- },
143
- },
144
- },
145
- mainCreator: () => type ?? [Object],
146
- });
147
- }
148
-
149
- private instantSerializer: Serializer = (_, value: Instant) => {
150
- if (value == null) {
151
- return null;
152
- }
153
-
154
- switch (this.dateEncoding) {
155
- case JSONEncoder.DateEncoding.ISO8601:
156
- return DateTimeFormatter.ISO_INSTANT.format(value);
157
- case JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH:
158
- return value.toEpochMilli();
159
- case JSONEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH:
160
- return secondsToNumber(value.epochSecond(), value.nano());
161
- }
162
- };
163
-
164
- private zonedDateTimeSerializer: Serializer = (_, value: ZonedDateTime) => {
165
- if (value == null) {
166
- return null;
167
- }
168
-
169
- switch (this.dateEncoding) {
170
- case JSONEncoder.DateEncoding.ISO8601:
171
- return DateTimeFormatter.ISO_ZONED_DATE_TIME.format(value);
172
- case JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH:
173
- return value.toInstant().toEpochMilli();
174
- case JSONEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH:
175
- const instant = value.toInstant();
176
- return secondsToNumber(instant.epochSecond(), instant.nano());
177
- }
178
- };
179
-
180
- private offsetDateTimeSerializer: Serializer = (_, value: OffsetDateTime) => {
181
- if (value == null) {
182
- return null;
183
- }
184
-
185
- switch (this.dateEncoding) {
186
- case JSONEncoder.DateEncoding.ISO8601:
187
- return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value);
188
- case JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH:
189
- return value.toInstant().toEpochMilli();
190
- case JSONEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH:
191
- const instant = value.toInstant();
192
- return secondsToNumber(instant.epochSecond(), instant.nano());
193
- }
194
- };
195
-
196
- private offsetTimeFormatter = new DateTimeFormatterBuilder()
197
- .parseCaseInsensitive()
198
- .append(DateTimeFormatter.ISO_LOCAL_TIME)
199
- .appendOffsetId()
200
- .toFormatter(ResolverStyle.STRICT);
201
-
202
- private offsetTimeSerializer: Serializer = (_, value: OffsetTime) => {
203
- if (value == null) {
204
- return null;
205
- }
206
-
207
- if (this.dateEncoding == JSONEncoder.DateEncoding.ISO8601) {
208
- return this.offsetTimeFormatter.format(value);
209
- } else {
210
- return [
211
- value.hour(),
212
- value.minute(),
213
- ...encodeSeconds(
214
- value.second(),
215
- this.dateEncoding == JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH
216
- ? value.get(ChronoField.MILLI_OF_SECOND)
217
- : value.nano(),
218
- ),
219
- value.offset().toString(),
220
- ];
221
- }
222
- };
223
-
224
- private localDateTimeSerializer: Serializer = (_, value: LocalDateTime) => {
225
- if (value == null) {
226
- return null;
227
- }
228
-
229
- if (this.dateEncoding == JSONEncoder.DateEncoding.ISO8601) {
230
- return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value);
231
- } else {
232
- return [
233
- value.year(),
234
- value.monthValue(),
235
- value.dayOfMonth(),
236
- value.hour(),
237
- value.minute(),
238
- ...encodeSeconds(
239
- value.second(),
240
- this.dateEncoding == JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH
241
- ? value.get(ChronoField.MILLI_OF_SECOND)
242
- : value.nano(),
243
- ),
244
- ];
245
- }
246
- };
247
-
248
- private localDateSerializer: Serializer = (_, value: LocalDate) => {
249
- if (value == null) {
250
- return null;
251
- }
252
-
253
- if (this.dateEncoding == JSONEncoder.DateEncoding.ISO8601) {
254
- return DateTimeFormatter.ISO_LOCAL_DATE.format(value);
255
- } else {
256
- return [value.year(), value.monthValue(), value.dayOfMonth()];
257
- }
258
- };
259
-
260
- private localTimeSerializer: Serializer = (_, value: LocalTime) => {
261
- if (value == null) {
262
- return null;
263
- }
264
-
265
- if (this.dateEncoding == JSONEncoder.DateEncoding.ISO8601) {
266
- return DateTimeFormatter.ISO_LOCAL_TIME.format(value);
267
- } else {
268
- return [
269
- value.hour(),
270
- value.minute(),
271
- ...encodeSeconds(
272
- value.second(),
273
- this.dateEncoding == JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH
274
- ? value.get(ChronoField.MILLI_OF_SECOND)
275
- : value.nano(),
276
- ),
277
- ];
278
- }
279
- };
280
-
281
- private dateSerializer: Serializer = (_, value: Date) => {
282
- if (value == null) {
283
- return null;
284
- }
285
-
286
- switch (this.dateEncoding) {
287
- case JSONEncoder.DateEncoding.ISO8601:
288
- return value.toISOString();
289
- case JSONEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH:
290
- return value.getTime();
291
- case JSONEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH:
292
- return value.getTime() / 1000.0;
293
- }
294
- };
295
-
296
- private urlSerializer: Serializer = (_, value: URL) => {
297
- if (value == null) {
298
- return null;
299
- }
300
-
301
- return value.toString();
302
- };
303
-
304
- private arrayBufferSerializer: Serializer = (_, value: ArrayBuffer) => {
305
- if (value == null) {
306
- return null;
307
- }
308
-
309
- return Base64.encode(value);
310
- };
311
- }
312
-
313
- export namespace JSONEncoder {
314
- /**
315
- * Configures how temporal values are encoded.
316
- */
317
- export enum DateEncoding {
318
- /**
319
- * Encode temporal values numerically using seconds with decimal
320
- * sub-second precision.
321
- */
322
- DECIMAL_SECONDS_SINCE_EPOCH,
323
-
324
- /**
325
- * Encode temporal values numerically using integer milliseconds.
326
- */
327
- MILLISECONDS_SINCE_EPOCH,
328
-
329
- /**
330
- * Encode temporal values values as an ISO-8601-formatted string (in
331
- * RFC 3339 format). This is the default behavior.
332
- */
333
- ISO8601,
334
- }
335
- }
@@ -1,34 +0,0 @@
1
- // Copyright 2020 Outfox, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import { AnyType } from '../any-type';
16
-
17
- export interface MediaTypeDecoder {
18
- decode<T>(response: Response, type: AnyType): Promise<T>;
19
- }
20
-
21
- export interface TextMediaTypeDecoder extends MediaTypeDecoder {
22
- decodeText<T>(text: string, type: AnyType): T;
23
- }
24
-
25
- export interface StructuredMediaTypeDecoder extends MediaTypeDecoder {
26
- decodeObject<T>(data: unknown, type: AnyType): T;
27
- }
28
-
29
- export function isStructuredMediaTypeDecoder(
30
- decoder: MediaTypeDecoder | StructuredMediaTypeDecoder | undefined,
31
- ): decoder is StructuredMediaTypeDecoder {
32
- const rec = decoder as unknown as Record<string, unknown>;
33
- return !!rec.decodeObject ?? false;
34
- }
@@ -1,86 +0,0 @@
1
- // Copyright 2020 Outfox, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import { AnyTextDecoder } from './any-text-decoder';
16
- import { BinaryDecoder } from './binary-decoder';
17
- import { CBORDecoder } from './cbor-decoder';
18
- import { JSONDecoder } from './json-decoder';
19
- import { MediaType } from '../media-type';
20
- import { MediaTypeDecoder } from './media-type-decoder';
21
-
22
- export interface MediaTypeDecodersBuilder {
23
- addDefaults(): MediaTypeDecodersBuilder;
24
-
25
- add(
26
- mediaType: MediaType,
27
- decoder: MediaTypeDecoder,
28
- ): MediaTypeDecodersBuilder;
29
-
30
- build(): MediaTypeDecoders;
31
- }
32
- export interface MediaTypeDecodersBuilderConstructor {
33
- new (): MediaTypeDecodersBuilder;
34
- }
35
-
36
- export class MediaTypeDecoders {
37
- static Builder: MediaTypeDecodersBuilderConstructor = class Builder
38
- implements MediaTypeDecodersBuilder
39
- {
40
- decoders = new Map<MediaType, MediaTypeDecoder>();
41
-
42
- add(
43
- mediaType: MediaType,
44
- decoder: MediaTypeDecoder,
45
- ): MediaTypeDecodersBuilder {
46
- this.decoders.set(mediaType, decoder);
47
- return this;
48
- }
49
-
50
- addDefaults(): MediaTypeDecodersBuilder {
51
- return this.add(MediaType.OctetStream, BinaryDecoder.default)
52
- .add(MediaType.JSON, JSONDecoder.default)
53
- .add(MediaType.CBOR, CBORDecoder.default)
54
- .add(MediaType.EventStream, BinaryDecoder.default)
55
- .add(MediaType.AnyText, AnyTextDecoder.default)
56
- .add(MediaType.X509CACert, BinaryDecoder.default)
57
- .add(MediaType.X509UserCert, BinaryDecoder.default);
58
- }
59
-
60
- build(): MediaTypeDecoders {
61
- return new MediaTypeDecoders(this.decoders);
62
- }
63
- };
64
-
65
- static DEFAULT: MediaTypeDecoders = new MediaTypeDecoders.Builder()
66
- .addDefaults()
67
- .build();
68
-
69
- constructor(private decoders: Map<MediaType, MediaTypeDecoder>) {}
70
-
71
- supports(mediaType: MediaType): boolean {
72
- return Array.from(this.decoders.keys()).some((key) =>
73
- key.compatible(mediaType),
74
- );
75
- }
76
-
77
- find(mediaType: MediaType): MediaTypeDecoder {
78
- const found = Array.from(this.decoders.entries()).find(([type]) =>
79
- type.compatible(mediaType),
80
- );
81
- if (!found) {
82
- throw Error(`Unsupported media type - ${mediaType}`);
83
- }
84
- return found[1];
85
- }
86
- }
@@ -1,45 +0,0 @@
1
- // Copyright 2020 Outfox, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import { AnyType } from '../any-type';
16
-
17
- export interface MediaTypeEncoder {
18
- encode<T = unknown>(value: T, type: AnyType | undefined): BodyInit;
19
- }
20
-
21
- export interface URLQueryParamsEncoder extends MediaTypeEncoder {
22
- encodeQueryString(value: Record<string, unknown>): string;
23
- }
24
-
25
- export function isURLQueryParamsEncoder(
26
- encoder: MediaTypeEncoder | URLQueryParamsEncoder | undefined,
27
- ): encoder is URLQueryParamsEncoder {
28
- const rec = encoder as unknown as Record<string, unknown>;
29
- return !!rec.encodeQueryString ?? false;
30
- }
31
-
32
- export interface StructuredMediaTypeEncoder extends MediaTypeEncoder {
33
- encodeObject<T = unknown>(
34
- value: T,
35
- type?: AnyType,
36
- includeNulls?: boolean,
37
- ): Record<string, unknown>;
38
- }
39
-
40
- export function isStructuredMediaTypeEncoder(
41
- encoder: MediaTypeEncoder | StructuredMediaTypeEncoder | undefined,
42
- ): encoder is StructuredMediaTypeEncoder {
43
- const rec = encoder as unknown as Record<string, unknown>;
44
- return !!rec.encodeObject ?? false;
45
- }
@@ -1,88 +0,0 @@
1
- // Copyright 2020 Outfox, Inc.
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- import { MediaType } from '../media-type';
16
- import { AnyTextEncoder } from './any-text-encoder';
17
- import { BinaryEncoder } from './binary-encoder';
18
- import { CBOREncoder } from './cbor-encoder';
19
- import { JSONEncoder } from './json-encoder';
20
- import { MediaTypeEncoder } from './media-type-encoder';
21
- import { WWWFormUrlEncoder } from './www-form-url-encoder';
22
-
23
- export interface MediaTypeEncodersBuilder {
24
- addDefaults(): MediaTypeEncodersBuilder;
25
-
26
- add(
27
- mediaType: MediaType,
28
- encoder: MediaTypeEncoder,
29
- ): MediaTypeEncodersBuilder;
30
-
31
- build(): MediaTypeEncoders;
32
- }
33
- export interface MediaTypeEncodersBuilderConstructor {
34
- new (): MediaTypeEncodersBuilder;
35
- }
36
-
37
- export class MediaTypeEncoders {
38
- static Builder: MediaTypeEncodersBuilderConstructor = class Builder
39
- implements MediaTypeEncodersBuilder
40
- {
41
- encoders = new Map<MediaType, MediaTypeEncoder>();
42
-
43
- add(
44
- mediaType: MediaType,
45
- encoder: MediaTypeEncoder,
46
- ): MediaTypeEncodersBuilder {
47
- this.encoders.set(mediaType, encoder);
48
- return this;
49
- }
50
-
51
- addDefaults(): MediaTypeEncodersBuilder {
52
- return this.add(MediaType.OctetStream, BinaryEncoder.default)
53
- .add(MediaType.WWWFormUrlEncoded, WWWFormUrlEncoder.default)
54
- .add(MediaType.JSON, JSONEncoder.default)
55
- .add(MediaType.JSONStructured, JSONEncoder.default)
56
- .add(MediaType.CBOR, CBOREncoder.default)
57
- .add(MediaType.AnyText, AnyTextEncoder.default)
58
- .add(MediaType.X509CACert, BinaryEncoder.default)
59
- .add(MediaType.X509UserCert, BinaryEncoder.default);
60
- }
61
-
62
- build(): MediaTypeEncoders {
63
- return new MediaTypeEncoders(this.encoders);
64
- }
65
- };
66
-
67
- static DEFAULT: MediaTypeEncoders = new MediaTypeEncoders.Builder()
68
- .addDefaults()
69
- .build();
70
-
71
- constructor(private encoders: Map<MediaType, MediaTypeEncoder>) {}
72
-
73
- supports(mediaType: MediaType): boolean {
74
- return Array.from(this.encoders.keys()).some((key) =>
75
- key.compatible(mediaType),
76
- );
77
- }
78
-
79
- find(mediaType: MediaType): MediaTypeEncoder {
80
- const found = Array.from(this.encoders.entries()).find(([type]) =>
81
- type.compatible(mediaType),
82
- );
83
- if (!found) {
84
- throw Error(`Unsupported media type - ${mediaType}`);
85
- }
86
- return found[1];
87
- }
88
- }