@lokalise/harmony 2.1.1 → 2.1.2

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 (493) hide show
  1. package/dist/harmony.cjs +135 -135
  2. package/dist/harmony.mjs +79 -79
  3. package/dist/harmony102.cjs +1 -1
  4. package/dist/harmony102.mjs +1 -1
  5. package/dist/harmony103.cjs +7 -7
  6. package/dist/harmony103.mjs +7 -7
  7. package/dist/harmony106.cjs +1 -1
  8. package/dist/harmony106.mjs +1 -1
  9. package/dist/harmony107.cjs +2 -2
  10. package/dist/harmony107.mjs +2 -2
  11. package/dist/harmony108.cjs +2 -2
  12. package/dist/harmony108.mjs +2 -2
  13. package/dist/harmony109.cjs +11 -3
  14. package/dist/harmony109.cjs.map +1 -1
  15. package/dist/harmony109.mjs +11 -3
  16. package/dist/harmony109.mjs.map +1 -1
  17. package/dist/harmony11.cjs +30 -55
  18. package/dist/harmony11.cjs.map +1 -1
  19. package/dist/harmony11.mjs +30 -55
  20. package/dist/harmony11.mjs.map +1 -1
  21. package/dist/harmony110.cjs +21 -18
  22. package/dist/harmony110.cjs.map +1 -1
  23. package/dist/harmony110.mjs +20 -17
  24. package/dist/harmony110.mjs.map +1 -1
  25. package/dist/harmony111.cjs +3 -76
  26. package/dist/harmony111.cjs.map +1 -1
  27. package/dist/harmony111.mjs +3 -76
  28. package/dist/harmony111.mjs.map +1 -1
  29. package/dist/harmony112.cjs +17 -11
  30. package/dist/harmony112.cjs.map +1 -1
  31. package/dist/harmony112.mjs +17 -11
  32. package/dist/harmony112.mjs.map +1 -1
  33. package/dist/harmony113.cjs +76 -34
  34. package/dist/harmony113.cjs.map +1 -1
  35. package/dist/harmony113.mjs +76 -34
  36. package/dist/harmony113.mjs.map +1 -1
  37. package/dist/harmony114.cjs +12 -9
  38. package/dist/harmony114.cjs.map +1 -1
  39. package/dist/harmony114.mjs +12 -9
  40. package/dist/harmony114.mjs.map +1 -1
  41. package/dist/harmony115.cjs +34 -47
  42. package/dist/harmony115.cjs.map +1 -1
  43. package/dist/harmony115.mjs +34 -47
  44. package/dist/harmony115.mjs.map +1 -1
  45. package/dist/harmony116.cjs +10 -10
  46. package/dist/harmony116.cjs.map +1 -1
  47. package/dist/harmony116.mjs +9 -9
  48. package/dist/harmony116.mjs.map +1 -1
  49. package/dist/harmony117.cjs +45 -9
  50. package/dist/harmony117.cjs.map +1 -1
  51. package/dist/harmony117.mjs +47 -11
  52. package/dist/harmony117.mjs.map +1 -1
  53. package/dist/harmony118.cjs +8 -20
  54. package/dist/harmony118.cjs.map +1 -1
  55. package/dist/harmony118.mjs +8 -20
  56. package/dist/harmony118.mjs.map +1 -1
  57. package/dist/harmony12.cjs +22 -30
  58. package/dist/harmony12.cjs.map +1 -1
  59. package/dist/harmony12.mjs +22 -30
  60. package/dist/harmony12.mjs.map +1 -1
  61. package/dist/harmony121.cjs +1 -1
  62. package/dist/harmony121.mjs +1 -1
  63. package/dist/harmony122.cjs +6 -98
  64. package/dist/harmony122.cjs.map +1 -1
  65. package/dist/harmony122.mjs +7 -82
  66. package/dist/harmony122.mjs.map +1 -1
  67. package/dist/harmony123.cjs +16 -86
  68. package/dist/harmony123.cjs.map +1 -1
  69. package/dist/harmony123.mjs +16 -86
  70. package/dist/harmony123.mjs.map +1 -1
  71. package/dist/harmony124.cjs +8 -30
  72. package/dist/harmony124.cjs.map +1 -1
  73. package/dist/harmony124.mjs +8 -30
  74. package/dist/harmony124.mjs.map +1 -1
  75. package/dist/harmony125.cjs +8 -7
  76. package/dist/harmony125.cjs.map +1 -1
  77. package/dist/harmony125.mjs +8 -7
  78. package/dist/harmony125.mjs.map +1 -1
  79. package/dist/harmony126.cjs +14 -16
  80. package/dist/harmony126.cjs.map +1 -1
  81. package/dist/harmony126.mjs +14 -16
  82. package/dist/harmony126.mjs.map +1 -1
  83. package/dist/harmony127.cjs +86 -7
  84. package/dist/harmony127.cjs.map +1 -1
  85. package/dist/harmony127.mjs +86 -7
  86. package/dist/harmony127.mjs.map +1 -1
  87. package/dist/harmony128.cjs +30 -8
  88. package/dist/harmony128.cjs.map +1 -1
  89. package/dist/harmony128.mjs +30 -8
  90. package/dist/harmony128.mjs.map +1 -1
  91. package/dist/harmony129.cjs +98 -14
  92. package/dist/harmony129.cjs.map +1 -1
  93. package/dist/harmony129.mjs +81 -14
  94. package/dist/harmony129.mjs.map +1 -1
  95. package/dist/harmony13.cjs +52 -11
  96. package/dist/harmony13.cjs.map +1 -1
  97. package/dist/harmony13.mjs +52 -11
  98. package/dist/harmony13.mjs.map +1 -1
  99. package/dist/harmony131.cjs +2 -2
  100. package/dist/harmony131.mjs +2 -2
  101. package/dist/harmony132.cjs +2 -2
  102. package/dist/harmony132.mjs +2 -2
  103. package/dist/harmony133.cjs +2 -2
  104. package/dist/harmony133.mjs +2 -2
  105. package/dist/harmony135.cjs +2 -2
  106. package/dist/harmony135.mjs +2 -2
  107. package/dist/harmony136.cjs +2 -2
  108. package/dist/harmony136.mjs +2 -2
  109. package/dist/harmony137.cjs +2 -2
  110. package/dist/harmony137.mjs +2 -2
  111. package/dist/harmony138.cjs +2 -2
  112. package/dist/harmony138.mjs +2 -2
  113. package/dist/harmony139.cjs +1 -1
  114. package/dist/harmony139.mjs +1 -1
  115. package/dist/harmony14.cjs +9 -55
  116. package/dist/harmony14.cjs.map +1 -1
  117. package/dist/harmony14.mjs +9 -55
  118. package/dist/harmony14.mjs.map +1 -1
  119. package/dist/harmony140.cjs +3 -3
  120. package/dist/harmony140.mjs +3 -3
  121. package/dist/harmony145.cjs +4 -6
  122. package/dist/harmony145.cjs.map +1 -1
  123. package/dist/harmony145.mjs +3 -5
  124. package/dist/harmony145.mjs.map +1 -1
  125. package/dist/harmony146.cjs +4 -6
  126. package/dist/harmony146.cjs.map +1 -1
  127. package/dist/harmony146.mjs +3 -5
  128. package/dist/harmony146.mjs.map +1 -1
  129. package/dist/harmony147.cjs +3 -10
  130. package/dist/harmony147.cjs.map +1 -1
  131. package/dist/harmony147.mjs +3 -10
  132. package/dist/harmony147.mjs.map +1 -1
  133. package/dist/harmony148.cjs +14 -3
  134. package/dist/harmony148.cjs.map +1 -1
  135. package/dist/harmony148.mjs +14 -3
  136. package/dist/harmony148.mjs.map +1 -1
  137. package/dist/harmony149.cjs +14 -3
  138. package/dist/harmony149.cjs.map +1 -1
  139. package/dist/harmony149.mjs +14 -3
  140. package/dist/harmony149.mjs.map +1 -1
  141. package/dist/harmony15.cjs +5 -30
  142. package/dist/harmony15.cjs.map +1 -1
  143. package/dist/harmony15.mjs +5 -30
  144. package/dist/harmony15.mjs.map +1 -1
  145. package/dist/harmony150.cjs +3 -3
  146. package/dist/harmony150.cjs.map +1 -1
  147. package/dist/harmony150.mjs +3 -3
  148. package/dist/harmony150.mjs.map +1 -1
  149. package/dist/harmony151.cjs +6 -15
  150. package/dist/harmony151.cjs.map +1 -1
  151. package/dist/harmony151.mjs +5 -14
  152. package/dist/harmony151.mjs.map +1 -1
  153. package/dist/harmony152.cjs +6 -15
  154. package/dist/harmony152.cjs.map +1 -1
  155. package/dist/harmony152.mjs +5 -14
  156. package/dist/harmony152.mjs.map +1 -1
  157. package/dist/harmony153.cjs +10 -3
  158. package/dist/harmony153.cjs.map +1 -1
  159. package/dist/harmony153.mjs +10 -3
  160. package/dist/harmony153.mjs.map +1 -1
  161. package/dist/harmony16.cjs +15 -18
  162. package/dist/harmony16.cjs.map +1 -1
  163. package/dist/harmony16.mjs +15 -18
  164. package/dist/harmony16.mjs.map +1 -1
  165. package/dist/harmony161.cjs +31 -95
  166. package/dist/harmony161.cjs.map +1 -1
  167. package/dist/harmony161.mjs +31 -95
  168. package/dist/harmony161.mjs.map +1 -1
  169. package/dist/harmony162.cjs +94 -11
  170. package/dist/harmony162.cjs.map +1 -1
  171. package/dist/harmony162.mjs +94 -11
  172. package/dist/harmony162.mjs.map +1 -1
  173. package/dist/harmony163.cjs +12 -13
  174. package/dist/harmony163.cjs.map +1 -1
  175. package/dist/harmony163.mjs +12 -13
  176. package/dist/harmony163.mjs.map +1 -1
  177. package/dist/harmony164.cjs +13 -35
  178. package/dist/harmony164.cjs.map +1 -1
  179. package/dist/harmony164.mjs +13 -35
  180. package/dist/harmony164.mjs.map +1 -1
  181. package/dist/harmony165.cjs +32 -24
  182. package/dist/harmony165.cjs.map +1 -1
  183. package/dist/harmony165.mjs +32 -24
  184. package/dist/harmony165.mjs.map +1 -1
  185. package/dist/harmony166.cjs +27 -31
  186. package/dist/harmony166.cjs.map +1 -1
  187. package/dist/harmony166.mjs +27 -31
  188. package/dist/harmony166.mjs.map +1 -1
  189. package/dist/harmony17.cjs +32 -28
  190. package/dist/harmony17.cjs.map +1 -1
  191. package/dist/harmony17.mjs +32 -28
  192. package/dist/harmony17.mjs.map +1 -1
  193. package/dist/harmony18.cjs +5 -14
  194. package/dist/harmony18.cjs.map +1 -1
  195. package/dist/harmony18.mjs +5 -14
  196. package/dist/harmony18.mjs.map +1 -1
  197. package/dist/harmony19.cjs +10 -13
  198. package/dist/harmony19.cjs.map +1 -1
  199. package/dist/harmony19.mjs +10 -13
  200. package/dist/harmony19.mjs.map +1 -1
  201. package/dist/harmony20.cjs +10 -13
  202. package/dist/harmony20.cjs.map +1 -1
  203. package/dist/harmony20.mjs +10 -13
  204. package/dist/harmony20.mjs.map +1 -1
  205. package/dist/harmony21.cjs +17 -13
  206. package/dist/harmony21.cjs.map +1 -1
  207. package/dist/harmony21.mjs +17 -13
  208. package/dist/harmony21.mjs.map +1 -1
  209. package/dist/harmony22.cjs +15 -13
  210. package/dist/harmony22.cjs.map +1 -1
  211. package/dist/harmony22.mjs +15 -13
  212. package/dist/harmony22.mjs.map +1 -1
  213. package/dist/harmony23.cjs +141 -12
  214. package/dist/harmony23.cjs.map +1 -1
  215. package/dist/harmony23.mjs +141 -12
  216. package/dist/harmony23.mjs.map +1 -1
  217. package/dist/harmony24.cjs +20 -22
  218. package/dist/harmony24.cjs.map +1 -1
  219. package/dist/harmony24.mjs +20 -22
  220. package/dist/harmony24.mjs.map +1 -1
  221. package/dist/harmony25.cjs +14 -13
  222. package/dist/harmony25.cjs.map +1 -1
  223. package/dist/harmony25.mjs +14 -13
  224. package/dist/harmony25.mjs.map +1 -1
  225. package/dist/harmony26.cjs +16 -12
  226. package/dist/harmony26.cjs.map +1 -1
  227. package/dist/harmony26.mjs +17 -13
  228. package/dist/harmony26.mjs.map +1 -1
  229. package/dist/harmony27.cjs +16 -15
  230. package/dist/harmony27.cjs.map +1 -1
  231. package/dist/harmony27.mjs +17 -16
  232. package/dist/harmony27.mjs.map +1 -1
  233. package/dist/harmony28.cjs +18 -15
  234. package/dist/harmony28.cjs.map +1 -1
  235. package/dist/harmony28.mjs +18 -15
  236. package/dist/harmony28.mjs.map +1 -1
  237. package/dist/harmony29.cjs +20 -15
  238. package/dist/harmony29.cjs.map +1 -1
  239. package/dist/harmony29.mjs +20 -15
  240. package/dist/harmony29.mjs.map +1 -1
  241. package/dist/harmony30.cjs +10 -15
  242. package/dist/harmony30.cjs.map +1 -1
  243. package/dist/harmony30.mjs +10 -15
  244. package/dist/harmony30.mjs.map +1 -1
  245. package/dist/harmony31.cjs +11 -15
  246. package/dist/harmony31.cjs.map +1 -1
  247. package/dist/harmony31.mjs +11 -15
  248. package/dist/harmony31.mjs.map +1 -1
  249. package/dist/harmony32.cjs +8 -16
  250. package/dist/harmony32.cjs.map +1 -1
  251. package/dist/harmony32.mjs +8 -16
  252. package/dist/harmony32.mjs.map +1 -1
  253. package/dist/harmony33.cjs +8 -16
  254. package/dist/harmony33.cjs.map +1 -1
  255. package/dist/harmony33.mjs +8 -16
  256. package/dist/harmony33.mjs.map +1 -1
  257. package/dist/harmony34.cjs +14 -16
  258. package/dist/harmony34.cjs.map +1 -1
  259. package/dist/harmony34.mjs +14 -16
  260. package/dist/harmony34.mjs.map +1 -1
  261. package/dist/harmony35.cjs +13 -16
  262. package/dist/harmony35.cjs.map +1 -1
  263. package/dist/harmony35.mjs +13 -16
  264. package/dist/harmony35.mjs.map +1 -1
  265. package/dist/harmony36.cjs +13 -16
  266. package/dist/harmony36.cjs.map +1 -1
  267. package/dist/harmony36.mjs +13 -16
  268. package/dist/harmony36.mjs.map +1 -1
  269. package/dist/harmony37.cjs +13 -14
  270. package/dist/harmony37.cjs.map +1 -1
  271. package/dist/harmony37.mjs +13 -14
  272. package/dist/harmony37.mjs.map +1 -1
  273. package/dist/harmony38.cjs +13 -16
  274. package/dist/harmony38.cjs.map +1 -1
  275. package/dist/harmony38.mjs +13 -16
  276. package/dist/harmony38.mjs.map +1 -1
  277. package/dist/harmony39.cjs +7 -16
  278. package/dist/harmony39.cjs.map +1 -1
  279. package/dist/harmony39.mjs +7 -16
  280. package/dist/harmony39.mjs.map +1 -1
  281. package/dist/harmony40.cjs +10 -17
  282. package/dist/harmony40.cjs.map +1 -1
  283. package/dist/harmony40.mjs +10 -17
  284. package/dist/harmony40.mjs.map +1 -1
  285. package/dist/harmony41.cjs +11 -14
  286. package/dist/harmony41.cjs.map +1 -1
  287. package/dist/harmony41.mjs +11 -14
  288. package/dist/harmony41.mjs.map +1 -1
  289. package/dist/harmony42.cjs +9 -14
  290. package/dist/harmony42.cjs.map +1 -1
  291. package/dist/harmony42.mjs +9 -14
  292. package/dist/harmony42.mjs.map +1 -1
  293. package/dist/harmony43.cjs +9 -124
  294. package/dist/harmony43.cjs.map +1 -1
  295. package/dist/harmony43.mjs +9 -124
  296. package/dist/harmony43.mjs.map +1 -1
  297. package/dist/harmony44.cjs +9 -82
  298. package/dist/harmony44.cjs.map +1 -1
  299. package/dist/harmony44.mjs +9 -82
  300. package/dist/harmony44.mjs.map +1 -1
  301. package/dist/harmony45.cjs +88 -6
  302. package/dist/harmony45.cjs.map +1 -1
  303. package/dist/harmony45.mjs +88 -6
  304. package/dist/harmony45.mjs.map +1 -1
  305. package/dist/harmony46.cjs +52 -25
  306. package/dist/harmony46.cjs.map +1 -1
  307. package/dist/harmony46.mjs +52 -25
  308. package/dist/harmony46.mjs.map +1 -1
  309. package/dist/harmony47.cjs +30 -23
  310. package/dist/harmony47.cjs.map +1 -1
  311. package/dist/harmony47.mjs +30 -23
  312. package/dist/harmony47.mjs.map +1 -1
  313. package/dist/harmony48.cjs +11 -141
  314. package/dist/harmony48.cjs.map +1 -1
  315. package/dist/harmony48.mjs +10 -140
  316. package/dist/harmony48.mjs.map +1 -1
  317. package/dist/harmony49.cjs +50 -32
  318. package/dist/harmony49.cjs.map +1 -1
  319. package/dist/harmony49.mjs +50 -32
  320. package/dist/harmony49.mjs.map +1 -1
  321. package/dist/harmony5.cjs +5 -5
  322. package/dist/harmony5.mjs +5 -5
  323. package/dist/harmony50.cjs +30 -26
  324. package/dist/harmony50.cjs.map +1 -1
  325. package/dist/harmony50.mjs +30 -26
  326. package/dist/harmony50.mjs.map +1 -1
  327. package/dist/harmony51.cjs +18 -4
  328. package/dist/harmony51.cjs.map +1 -1
  329. package/dist/harmony51.mjs +18 -4
  330. package/dist/harmony51.mjs.map +1 -1
  331. package/dist/harmony52.cjs +25 -81
  332. package/dist/harmony52.cjs.map +1 -1
  333. package/dist/harmony52.mjs +25 -81
  334. package/dist/harmony52.mjs.map +1 -1
  335. package/dist/harmony53.cjs +13 -57
  336. package/dist/harmony53.cjs.map +1 -1
  337. package/dist/harmony53.mjs +12 -56
  338. package/dist/harmony53.mjs.map +1 -1
  339. package/dist/harmony54.cjs +14 -18
  340. package/dist/harmony54.cjs.map +1 -1
  341. package/dist/harmony54.mjs +14 -18
  342. package/dist/harmony54.mjs.map +1 -1
  343. package/dist/harmony55.cjs +14 -30
  344. package/dist/harmony55.cjs.map +1 -1
  345. package/dist/harmony55.mjs +14 -30
  346. package/dist/harmony55.mjs.map +1 -1
  347. package/dist/harmony56.cjs +13 -22
  348. package/dist/harmony56.cjs.map +1 -1
  349. package/dist/harmony56.mjs +13 -22
  350. package/dist/harmony56.mjs.map +1 -1
  351. package/dist/harmony57.cjs +14 -52
  352. package/dist/harmony57.cjs.map +1 -1
  353. package/dist/harmony57.mjs +14 -52
  354. package/dist/harmony57.mjs.map +1 -1
  355. package/dist/harmony58.cjs +13 -9
  356. package/dist/harmony58.cjs.map +1 -1
  357. package/dist/harmony58.mjs +13 -9
  358. package/dist/harmony58.mjs.map +1 -1
  359. package/dist/harmony59.cjs +22 -5
  360. package/dist/harmony59.cjs.map +1 -1
  361. package/dist/harmony59.mjs +22 -5
  362. package/dist/harmony59.mjs.map +1 -1
  363. package/dist/harmony6.cjs +1 -1
  364. package/dist/harmony6.mjs +2 -2
  365. package/dist/harmony60.cjs +12 -14
  366. package/dist/harmony60.cjs.map +1 -1
  367. package/dist/harmony60.mjs +12 -14
  368. package/dist/harmony60.mjs.map +1 -1
  369. package/dist/harmony61.cjs +12 -31
  370. package/dist/harmony61.cjs.map +1 -1
  371. package/dist/harmony61.mjs +12 -31
  372. package/dist/harmony61.mjs.map +1 -1
  373. package/dist/harmony62.cjs +17 -5
  374. package/dist/harmony62.cjs.map +1 -1
  375. package/dist/harmony62.mjs +17 -5
  376. package/dist/harmony62.mjs.map +1 -1
  377. package/dist/harmony63.cjs +16 -10
  378. package/dist/harmony63.cjs.map +1 -1
  379. package/dist/harmony63.mjs +16 -10
  380. package/dist/harmony63.mjs.map +1 -1
  381. package/dist/harmony64.cjs +15 -11
  382. package/dist/harmony64.cjs.map +1 -1
  383. package/dist/harmony64.mjs +15 -11
  384. package/dist/harmony64.mjs.map +1 -1
  385. package/dist/harmony65.cjs +15 -18
  386. package/dist/harmony65.cjs.map +1 -1
  387. package/dist/harmony65.mjs +15 -18
  388. package/dist/harmony65.mjs.map +1 -1
  389. package/dist/harmony66.cjs +15 -16
  390. package/dist/harmony66.cjs.map +1 -1
  391. package/dist/harmony66.mjs +15 -16
  392. package/dist/harmony66.mjs.map +1 -1
  393. package/dist/harmony67.cjs +17 -142
  394. package/dist/harmony67.cjs.map +1 -1
  395. package/dist/harmony67.mjs +17 -142
  396. package/dist/harmony67.mjs.map +1 -1
  397. package/dist/harmony68.cjs +16 -19
  398. package/dist/harmony68.cjs.map +1 -1
  399. package/dist/harmony68.mjs +16 -19
  400. package/dist/harmony68.mjs.map +1 -1
  401. package/dist/harmony69.cjs +16 -13
  402. package/dist/harmony69.cjs.map +1 -1
  403. package/dist/harmony69.mjs +16 -13
  404. package/dist/harmony69.mjs.map +1 -1
  405. package/dist/harmony70.cjs +15 -15
  406. package/dist/harmony70.cjs.map +1 -1
  407. package/dist/harmony70.mjs +16 -16
  408. package/dist/harmony70.mjs.map +1 -1
  409. package/dist/harmony71.cjs +15 -16
  410. package/dist/harmony71.cjs.map +1 -1
  411. package/dist/harmony71.mjs +16 -17
  412. package/dist/harmony71.mjs.map +1 -1
  413. package/dist/harmony72.cjs +15 -20
  414. package/dist/harmony72.cjs.map +1 -1
  415. package/dist/harmony72.mjs +15 -20
  416. package/dist/harmony72.mjs.map +1 -1
  417. package/dist/harmony73.cjs +16 -19
  418. package/dist/harmony73.cjs.map +1 -1
  419. package/dist/harmony73.mjs +16 -19
  420. package/dist/harmony73.mjs.map +1 -1
  421. package/dist/harmony74.cjs +15 -8
  422. package/dist/harmony74.cjs.map +1 -1
  423. package/dist/harmony74.mjs +15 -8
  424. package/dist/harmony74.mjs.map +1 -1
  425. package/dist/harmony75.cjs +16 -9
  426. package/dist/harmony75.cjs.map +1 -1
  427. package/dist/harmony75.mjs +16 -9
  428. package/dist/harmony75.mjs.map +1 -1
  429. package/dist/harmony76.cjs +14 -9
  430. package/dist/harmony76.cjs.map +1 -1
  431. package/dist/harmony76.mjs +14 -9
  432. package/dist/harmony76.mjs.map +1 -1
  433. package/dist/harmony77.cjs +14 -9
  434. package/dist/harmony77.cjs.map +1 -1
  435. package/dist/harmony77.mjs +14 -9
  436. package/dist/harmony77.mjs.map +1 -1
  437. package/dist/harmony78.cjs +124 -15
  438. package/dist/harmony78.cjs.map +1 -1
  439. package/dist/harmony78.mjs +124 -15
  440. package/dist/harmony78.mjs.map +1 -1
  441. package/dist/harmony79.cjs +82 -14
  442. package/dist/harmony79.cjs.map +1 -1
  443. package/dist/harmony79.mjs +82 -14
  444. package/dist/harmony79.mjs.map +1 -1
  445. package/dist/harmony80.cjs +6 -14
  446. package/dist/harmony80.cjs.map +1 -1
  447. package/dist/harmony80.mjs +6 -14
  448. package/dist/harmony80.mjs.map +1 -1
  449. package/dist/harmony81.cjs +28 -14
  450. package/dist/harmony81.cjs.map +1 -1
  451. package/dist/harmony81.mjs +28 -14
  452. package/dist/harmony81.mjs.map +1 -1
  453. package/dist/harmony82.cjs +24 -14
  454. package/dist/harmony82.cjs.map +1 -1
  455. package/dist/harmony82.mjs +24 -14
  456. package/dist/harmony82.mjs.map +1 -1
  457. package/dist/harmony83.cjs +141 -8
  458. package/dist/harmony83.cjs.map +1 -1
  459. package/dist/harmony83.mjs +141 -8
  460. package/dist/harmony83.mjs.map +1 -1
  461. package/dist/harmony84.cjs +37 -11
  462. package/dist/harmony84.cjs.map +1 -1
  463. package/dist/harmony84.mjs +37 -11
  464. package/dist/harmony84.mjs.map +1 -1
  465. package/dist/harmony85.cjs +26 -11
  466. package/dist/harmony85.cjs.map +1 -1
  467. package/dist/harmony85.mjs +26 -11
  468. package/dist/harmony85.mjs.map +1 -1
  469. package/dist/harmony86.cjs +4 -9
  470. package/dist/harmony86.cjs.map +1 -1
  471. package/dist/harmony86.mjs +4 -9
  472. package/dist/harmony86.mjs.map +1 -1
  473. package/dist/harmony87.cjs +84 -9
  474. package/dist/harmony87.cjs.map +1 -1
  475. package/dist/harmony87.mjs +84 -9
  476. package/dist/harmony87.mjs.map +1 -1
  477. package/dist/harmony88.cjs +47 -9
  478. package/dist/harmony88.cjs.map +1 -1
  479. package/dist/harmony88.mjs +47 -9
  480. package/dist/harmony88.mjs.map +1 -1
  481. package/dist/harmony89.cjs +18 -88
  482. package/dist/harmony89.cjs.map +1 -1
  483. package/dist/harmony89.mjs +18 -88
  484. package/dist/harmony89.mjs.map +1 -1
  485. package/dist/harmony94.cjs +1 -1
  486. package/dist/harmony94.mjs +1 -1
  487. package/dist/harmony96.cjs +2 -2
  488. package/dist/harmony96.mjs +2 -2
  489. package/dist/harmony99.cjs +4 -4
  490. package/dist/harmony99.mjs +4 -4
  491. package/dist/types/src/features/publicApi/teamUsers.d.ts +5 -19
  492. package/dist/types/src/features/publicApi/types/teamUserTypes.d.ts +8 -32
  493. package/package.json +1 -1
@@ -1,17 +1,14 @@
1
- import { addContributors } from "./harmony11.mjs";
2
- import { sendByPayloadRoute } from "@lokalise/frontend-http-client";
3
- import { useMutation } from "@tanstack/react-query";
4
- function useAddContributorMutation(wretchClient, headers, params, overrides = {}) {
5
- return useMutation({
6
- ...overrides,
7
- mutationFn: async (variables) => sendByPayloadRoute(wretchClient, addContributors, {
8
- headers: await headers.resolve(),
9
- body: variables,
10
- pathParams: params
11
- })
12
- });
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class UnauthorizedError extends Error {
5
+ constructor() {
6
+ super(...arguments);
7
+ __publicField(this, "name", "UnauthorizedError");
8
+ __publicField(this, "status", 401);
9
+ }
13
10
  }
14
11
  export {
15
- useAddContributorMutation
12
+ UnauthorizedError
16
13
  };
17
14
  //# sourceMappingURL=harmony19.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony19.mjs","sources":["../src/features/publicApi/hooks/useAddContributorsMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { addContributors } from '@features/publicApi/contributors'\nimport type {\n\tAddContributorsPathParams,\n\tAddContributorsRequestBody,\n\tAddContributorsResponse,\n\tContributorApiBaseHeader,\n} from '@features/publicApi/types/contributorTypes'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\n\n/**\n * A react-query wrapper about the addContributor public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param headers - Headers to include in the request.\n * @param params - URL parameters\n * @param overrides - Additional options to pass to the query.\n */\nexport function useAddContributorMutation<T>(\n\twretchClient: Wretch<T>,\n\theaders: HeaderBuilder<ContributorApiBaseHeader>,\n\tparams: AddContributorsPathParams,\n\toverrides: ApiMutationOverrides<AddContributorsResponse, AddContributorsRequestBody> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, addContributors, {\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t\tpathParams: params,\n\t\t\t}),\n\t})\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,0BACf,cACA,SACA,QACA,YAAuF,CAAA,GACtF;AACD,SAAO,YAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClB,mBAAmB,cAAc,iBAAiB;AAAA,MACjD,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,MACN,YAAY;AAAA,IACZ,CAAA;AAAA,EAAA,CACF;AACF;"}
1
+ {"version":3,"file":"harmony19.mjs","sources":["../src/features/auth/errors/UnauthorizedError.ts"],"sourcesContent":["export class UnauthorizedError extends Error {\n\toverride readonly name = 'UnauthorizedError'\n\treadonly status = 401\n}\n"],"names":[],"mappings":";;;AAAO,MAAM,0BAA0B,MAAM;AAAA,EAAtC;AAAA;AACY,gCAAO;AAChB,kCAAS;AAAA;AACnB;"}
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const languages = require("./harmony12.cjs");
4
- const frontendHttpClient = require("@lokalise/frontend-http-client");
5
- const reactQuery = require("@tanstack/react-query");
6
- function useAddLanguagesToProjectMutation(wretchClient, params, headers, overrides = {}) {
7
- return reactQuery.useMutation({
8
- ...overrides,
9
- mutationFn: async (variables) => frontendHttpClient.sendByPayloadRoute(wretchClient, languages.addLanguagesToProject, {
10
- pathParams: params,
11
- headers: await headers.resolve(),
12
- body: variables
13
- })
14
- });
3
+ const jwtTokenPayload = require("./harmony121.cjs");
4
+ function parseJwtTokenPayload(token) {
5
+ try {
6
+ const payload = token.split(".")[1];
7
+ const decoded = atob(payload);
8
+ return jwtTokenPayload.JWT_TOKEN_PAYLOAD_SCHEMA.parse(JSON.parse(decoded));
9
+ } catch (_error) {
10
+ return void 0;
11
+ }
15
12
  }
16
- exports.useAddLanguagesToProjectMutation = useAddLanguagesToProjectMutation;
13
+ exports.parseJwtTokenPayload = parseJwtTokenPayload;
17
14
  //# sourceMappingURL=harmony20.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony20.cjs","sources":["../src/features/publicApi/hooks/useAddLanguagesToProjectMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { addLanguagesToProject } from '@features/publicApi/languages'\nimport type {\n\tAddLanguagesToProjectPathParams,\n\tAddLanguagesToProjectRequestBody,\n\tAddLanguagesToProjectResponse,\n} from '@features/publicApi/types/languageTypes'\nimport type { BaseApiEndpointHeader } from '@features/publicApi/types/sharedTypes'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\n\n/**\n * A react-router wrapper about the addLanguagesToProject public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param params - URL parameters\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useAddLanguagesToProjectMutation<T>(\n\twretchClient: Wretch<T>,\n\tparams: AddLanguagesToProjectPathParams,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tAddLanguagesToProjectResponse,\n\t\tAddLanguagesToProjectRequestBody\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, addLanguagesToProject, {\n\t\t\t\tpathParams: params,\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t}),\n\t})\n}\n"],"names":["useMutation","sendByPayloadRoute","addLanguagesToProject"],"mappings":";;;;;AAqBO,SAAS,iCACf,cACA,QACA,SACA,YAGI,CAAA,GACH;AACD,SAAOA,uBAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClBC,sCAAmB,cAAcC,UAAAA,uBAAuB;AAAA,MACvD,YAAY;AAAA,MACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,IACN,CAAA;AAAA,EAAA,CACF;AACF;;"}
1
+ {"version":3,"file":"harmony20.cjs","sources":["../src/features/auth/core/utils/jwtTokenPayload.ts"],"sourcesContent":["import { JWT_TOKEN_PAYLOAD_SCHEMA, type JwtTokenPayload } from '../types/jwtTokenPayload'\n\n/**\n * Parses the payload of a JWT token.\n *\n * @param token - The JWT token to parse.\n */\nexport function parseJwtTokenPayload(token: string): JwtTokenPayload | undefined {\n\ttry {\n\t\tconst payload = token.split('.')[1]\n\t\tconst decoded = atob(payload)\n\t\treturn JWT_TOKEN_PAYLOAD_SCHEMA.parse(JSON.parse(decoded))\n\t} catch (_error) {\n\t\treturn undefined\n\t}\n}\n"],"names":["JWT_TOKEN_PAYLOAD_SCHEMA"],"mappings":";;;AAOO,SAAS,qBAAqB,OAA4C;AAC5E,MAAA;AACH,UAAM,UAAU,MAAM,MAAM,GAAG,EAAE,CAAC;AAC5B,UAAA,UAAU,KAAK,OAAO;AAC5B,WAAOA,gBAAyB,yBAAA,MAAM,KAAK,MAAM,OAAO,CAAC;AAAA,WACjD,QAAQ;AACT,WAAA;AAAA,EAAA;AAET;;"}
@@ -1,17 +1,14 @@
1
- import { addLanguagesToProject } from "./harmony12.mjs";
2
- import { sendByPayloadRoute } from "@lokalise/frontend-http-client";
3
- import { useMutation } from "@tanstack/react-query";
4
- function useAddLanguagesToProjectMutation(wretchClient, params, headers, overrides = {}) {
5
- return useMutation({
6
- ...overrides,
7
- mutationFn: async (variables) => sendByPayloadRoute(wretchClient, addLanguagesToProject, {
8
- pathParams: params,
9
- headers: await headers.resolve(),
10
- body: variables
11
- })
12
- });
1
+ import { JWT_TOKEN_PAYLOAD_SCHEMA } from "./harmony121.mjs";
2
+ function parseJwtTokenPayload(token) {
3
+ try {
4
+ const payload = token.split(".")[1];
5
+ const decoded = atob(payload);
6
+ return JWT_TOKEN_PAYLOAD_SCHEMA.parse(JSON.parse(decoded));
7
+ } catch (_error) {
8
+ return void 0;
9
+ }
13
10
  }
14
11
  export {
15
- useAddLanguagesToProjectMutation
12
+ parseJwtTokenPayload
16
13
  };
17
14
  //# sourceMappingURL=harmony20.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony20.mjs","sources":["../src/features/publicApi/hooks/useAddLanguagesToProjectMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { addLanguagesToProject } from '@features/publicApi/languages'\nimport type {\n\tAddLanguagesToProjectPathParams,\n\tAddLanguagesToProjectRequestBody,\n\tAddLanguagesToProjectResponse,\n} from '@features/publicApi/types/languageTypes'\nimport type { BaseApiEndpointHeader } from '@features/publicApi/types/sharedTypes'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\n\n/**\n * A react-router wrapper about the addLanguagesToProject public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param params - URL parameters\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useAddLanguagesToProjectMutation<T>(\n\twretchClient: Wretch<T>,\n\tparams: AddLanguagesToProjectPathParams,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tAddLanguagesToProjectResponse,\n\t\tAddLanguagesToProjectRequestBody\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, addLanguagesToProject, {\n\t\t\t\tpathParams: params,\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t}),\n\t})\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,iCACf,cACA,QACA,SACA,YAGI,CAAA,GACH;AACD,SAAO,YAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClB,mBAAmB,cAAc,uBAAuB;AAAA,MACvD,YAAY;AAAA,MACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,IACN,CAAA;AAAA,EAAA,CACF;AACF;"}
1
+ {"version":3,"file":"harmony20.mjs","sources":["../src/features/auth/core/utils/jwtTokenPayload.ts"],"sourcesContent":["import { JWT_TOKEN_PAYLOAD_SCHEMA, type JwtTokenPayload } from '../types/jwtTokenPayload'\n\n/**\n * Parses the payload of a JWT token.\n *\n * @param token - The JWT token to parse.\n */\nexport function parseJwtTokenPayload(token: string): JwtTokenPayload | undefined {\n\ttry {\n\t\tconst payload = token.split('.')[1]\n\t\tconst decoded = atob(payload)\n\t\treturn JWT_TOKEN_PAYLOAD_SCHEMA.parse(JSON.parse(decoded))\n\t} catch (_error) {\n\t\treturn undefined\n\t}\n}\n"],"names":[],"mappings":";AAOO,SAAS,qBAAqB,OAA4C;AAC5E,MAAA;AACH,UAAM,UAAU,MAAM,MAAM,GAAG,EAAE,CAAC;AAC5B,UAAA,UAAU,KAAK,OAAO;AAC5B,WAAO,yBAAyB,MAAM,KAAK,MAAM,OAAO,CAAC;AAAA,WACjD,QAAQ;AACT,WAAA;AAAA,EAAA;AAET;"}
@@ -1,17 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const languages = require("./harmony12.cjs");
4
- const frontendHttpClient = require("@lokalise/frontend-http-client");
5
- const reactQuery = require("@tanstack/react-query");
6
- function useBulkUpdateProjectLanguagesMutation(wretchClient, params, headers, overrides = {}) {
7
- return reactQuery.useMutation({
8
- ...overrides,
9
- mutationFn: async (variables) => frontendHttpClient.sendByPayloadRoute(wretchClient, languages.bulkUpdateProjectLanguages, {
10
- pathParams: params,
11
- headers: await headers.resolve(),
12
- body: variables
13
- })
14
- });
3
+ function getJwtTokenFromCookie() {
4
+ const accessToken = getCookie(document.cookie, "accessToken");
5
+ const refreshToken = getCookie(document.cookie, "refreshToken");
6
+ if (!accessToken || !refreshToken) {
7
+ return null;
8
+ }
9
+ return { accessToken, refreshToken };
15
10
  }
16
- exports.useBulkUpdateProjectLanguagesMutation = useBulkUpdateProjectLanguagesMutation;
11
+ function getCsrfTokenFromCookie() {
12
+ return getCookie(document.cookie, "csrf_token") ?? null;
13
+ }
14
+ function getCookie(cookies, name) {
15
+ var _a, _b;
16
+ return (_b = (_a = cookies.split(";").find((cookie) => cookie.trim().startsWith(`${name}=`))) == null ? void 0 : _a.trim()) == null ? void 0 : _b.substring(name.length + 1);
17
+ }
18
+ exports.getCookie = getCookie;
19
+ exports.getCsrfTokenFromCookie = getCsrfTokenFromCookie;
20
+ exports.getJwtTokenFromCookie = getJwtTokenFromCookie;
17
21
  //# sourceMappingURL=harmony21.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony21.cjs","sources":["../src/features/publicApi/hooks/useBulkUpdateProjectLanguagesMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { bulkUpdateProjectLanguages } from '@features/publicApi/languages'\nimport type {\n\tBulkUpdateProjectLanguagesPathParams,\n\tBulkUpdateProjectLanguagesRequestBody,\n\tBulkUpdateProjectLanguagesResponse,\n} from '@features/publicApi/types/languageTypes'\nimport type { BaseApiEndpointHeader } from '@features/publicApi/types/sharedTypes'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\n\n/**\n * A react-router wrapper about the bulkUpdateProjectLanguages public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param params - URL parameters\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useBulkUpdateProjectLanguagesMutation<T>(\n\twretchClient: Wretch<T>,\n\tparams: BulkUpdateProjectLanguagesPathParams,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tBulkUpdateProjectLanguagesResponse,\n\t\tBulkUpdateProjectLanguagesRequestBody\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, bulkUpdateProjectLanguages, {\n\t\t\t\tpathParams: params,\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t}),\n\t})\n}\n"],"names":["useMutation","sendByPayloadRoute","bulkUpdateProjectLanguages"],"mappings":";;;;;AAqBO,SAAS,sCACf,cACA,QACA,SACA,YAGI,CAAA,GACH;AACD,SAAOA,uBAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClBC,sCAAmB,cAAcC,UAAAA,4BAA4B;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,IACN,CAAA;AAAA,EAAA,CACF;AACF;;"}
1
+ {"version":3,"file":"harmony21.cjs","sources":["../src/features/auth/frontend/utils/cookieTokenUtils.ts"],"sourcesContent":["import type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\nexport function getJwtTokenFromCookie(): JwtToken | null {\n\tconst accessToken = getCookie(document.cookie, 'accessToken')\n\tconst refreshToken = getCookie(document.cookie, 'refreshToken')\n\n\tif (!accessToken || !refreshToken) {\n\t\treturn null\n\t}\n\n\treturn { accessToken, refreshToken }\n}\n\nexport function getCsrfTokenFromCookie(): string | null {\n\treturn getCookie(document.cookie, 'csrf_token') ?? null\n}\n\nexport function getCookie(cookies: string, name: string): string | undefined {\n\treturn cookies\n\t\t.split(';')\n\t\t.find((cookie) => cookie.trim().startsWith(`${name}=`))\n\t\t?.trim()\n\t\t?.substring(name.length + 1)\n}\n"],"names":[],"mappings":";;AAEO,SAAS,wBAAyC;AACxD,QAAM,cAAc,UAAU,SAAS,QAAQ,aAAa;AAC5D,QAAM,eAAe,UAAU,SAAS,QAAQ,cAAc;AAE1D,MAAA,CAAC,eAAe,CAAC,cAAc;AAC3B,WAAA;AAAA,EAAA;AAGD,SAAA,EAAE,aAAa,aAAa;AACpC;AAEO,SAAS,yBAAwC;AACvD,SAAO,UAAU,SAAS,QAAQ,YAAY,KAAK;AACpD;AAEgB,SAAA,UAAU,SAAiB,MAAkC;;AACrE,UAAA,mBACL,MAAM,GAAG,EACT,KAAK,CAAC,WAAW,OAAO,OAAO,WAAW,GAAG,IAAI,GAAG,CAAC,MAFhD,mBAGJ,WAHI,mBAIJ,UAAU,KAAK,SAAS;AAC5B;;;;"}
@@ -1,17 +1,21 @@
1
- import { bulkUpdateProjectLanguages } from "./harmony12.mjs";
2
- import { sendByPayloadRoute } from "@lokalise/frontend-http-client";
3
- import { useMutation } from "@tanstack/react-query";
4
- function useBulkUpdateProjectLanguagesMutation(wretchClient, params, headers, overrides = {}) {
5
- return useMutation({
6
- ...overrides,
7
- mutationFn: async (variables) => sendByPayloadRoute(wretchClient, bulkUpdateProjectLanguages, {
8
- pathParams: params,
9
- headers: await headers.resolve(),
10
- body: variables
11
- })
12
- });
1
+ function getJwtTokenFromCookie() {
2
+ const accessToken = getCookie(document.cookie, "accessToken");
3
+ const refreshToken = getCookie(document.cookie, "refreshToken");
4
+ if (!accessToken || !refreshToken) {
5
+ return null;
6
+ }
7
+ return { accessToken, refreshToken };
8
+ }
9
+ function getCsrfTokenFromCookie() {
10
+ return getCookie(document.cookie, "csrf_token") ?? null;
11
+ }
12
+ function getCookie(cookies, name) {
13
+ var _a, _b;
14
+ return (_b = (_a = cookies.split(";").find((cookie) => cookie.trim().startsWith(`${name}=`))) == null ? void 0 : _a.trim()) == null ? void 0 : _b.substring(name.length + 1);
13
15
  }
14
16
  export {
15
- useBulkUpdateProjectLanguagesMutation
17
+ getCookie,
18
+ getCsrfTokenFromCookie,
19
+ getJwtTokenFromCookie
16
20
  };
17
21
  //# sourceMappingURL=harmony21.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony21.mjs","sources":["../src/features/publicApi/hooks/useBulkUpdateProjectLanguagesMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { bulkUpdateProjectLanguages } from '@features/publicApi/languages'\nimport type {\n\tBulkUpdateProjectLanguagesPathParams,\n\tBulkUpdateProjectLanguagesRequestBody,\n\tBulkUpdateProjectLanguagesResponse,\n} from '@features/publicApi/types/languageTypes'\nimport type { BaseApiEndpointHeader } from '@features/publicApi/types/sharedTypes'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\n\n/**\n * A react-router wrapper about the bulkUpdateProjectLanguages public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param params - URL parameters\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useBulkUpdateProjectLanguagesMutation<T>(\n\twretchClient: Wretch<T>,\n\tparams: BulkUpdateProjectLanguagesPathParams,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tBulkUpdateProjectLanguagesResponse,\n\t\tBulkUpdateProjectLanguagesRequestBody\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, bulkUpdateProjectLanguages, {\n\t\t\t\tpathParams: params,\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t}),\n\t})\n}\n"],"names":[],"mappings":";;;AAqBO,SAAS,sCACf,cACA,QACA,SACA,YAGI,CAAA,GACH;AACD,SAAO,YAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClB,mBAAmB,cAAc,4BAA4B;AAAA,MAC5D,YAAY;AAAA,MACZ,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,IACN,CAAA;AAAA,EAAA,CACF;AACF;"}
1
+ {"version":3,"file":"harmony21.mjs","sources":["../src/features/auth/frontend/utils/cookieTokenUtils.ts"],"sourcesContent":["import type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\nexport function getJwtTokenFromCookie(): JwtToken | null {\n\tconst accessToken = getCookie(document.cookie, 'accessToken')\n\tconst refreshToken = getCookie(document.cookie, 'refreshToken')\n\n\tif (!accessToken || !refreshToken) {\n\t\treturn null\n\t}\n\n\treturn { accessToken, refreshToken }\n}\n\nexport function getCsrfTokenFromCookie(): string | null {\n\treturn getCookie(document.cookie, 'csrf_token') ?? null\n}\n\nexport function getCookie(cookies: string, name: string): string | undefined {\n\treturn cookies\n\t\t.split(';')\n\t\t.find((cookie) => cookie.trim().startsWith(`${name}=`))\n\t\t?.trim()\n\t\t?.substring(name.length + 1)\n}\n"],"names":[],"mappings":"AAEO,SAAS,wBAAyC;AACxD,QAAM,cAAc,UAAU,SAAS,QAAQ,aAAa;AAC5D,QAAM,eAAe,UAAU,SAAS,QAAQ,cAAc;AAE1D,MAAA,CAAC,eAAe,CAAC,cAAc;AAC3B,WAAA;AAAA,EAAA;AAGD,SAAA,EAAE,aAAa,aAAa;AACpC;AAEO,SAAS,yBAAwC;AACvD,SAAO,UAAU,SAAS,QAAQ,YAAY,KAAK;AACpD;AAEgB,SAAA,UAAU,SAAiB,MAAkC;AAftE;AAgBC,UAAA,mBACL,MAAM,GAAG,EACT,KAAK,CAAC,WAAW,OAAO,OAAO,WAAW,GAAG,IAAI,GAAG,CAAC,MAFhD,mBAGJ,WAHI,mBAIJ,UAAU,KAAK,SAAS;AAC5B;"}
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const frontendHttpClient = require("@lokalise/frontend-http-client");
4
- const reactQuery = require("@tanstack/react-query");
5
- const score = require("./harmony15.cjs");
6
- function useCreateScoreMutation(wretchClient, headers, overrides = {}) {
7
- return reactQuery.useMutation({
8
- ...overrides,
9
- mutationFn: async ({ segmentId, sourceLanguageId, projectId, keyId, languageId }) => frontendHttpClient.sendByPayloadRoute(wretchClient, score.createScore, {
10
- headers: await headers.resolve(),
11
- pathParams: { projectId, keyId, languageId },
12
- body: { segmentId, sourceLanguageId }
13
- })
14
- });
3
+ const headerBuilder = require("./harmony23.cjs");
4
+ function createHeaderBuilderMiddleware(middleware) {
5
+ return new HeaderBuilderMiddleware(middleware);
15
6
  }
16
- exports.useCreateScoreMutation = useCreateScoreMutation;
7
+ class HeaderBuilderMiddleware {
8
+ constructor(middleware) {
9
+ this.middleware = middleware;
10
+ }
11
+ apply(base) {
12
+ return base.from(async () => {
13
+ const middlewareBuilder = this.middleware(headerBuilder.HeaderBuilder.create());
14
+ return middlewareBuilder instanceof Promise ? middlewareBuilder.then((r) => r.resolve()) : middlewareBuilder.resolve();
15
+ });
16
+ }
17
+ }
18
+ exports.createHeaderBuilderMiddleware = createHeaderBuilderMiddleware;
17
19
  //# sourceMappingURL=harmony22.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony22.cjs","sources":["../src/features/publicApi/hooks/useCreateScoreMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\nimport { createScore } from '../score'\nimport type {\n\tCreateScoreRequestBody,\n\tCreateScoreResponseBody,\n\tScoreRequestQuery,\n} from '../types/scoreTypes'\nimport type { BaseApiEndpointHeader } from '../types/sharedTypes'\n\n/**\n * A react-router wrapper about the createProject public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useCreateScoreMutation<T>(\n\twretchClient: Wretch<T>,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tCreateScoreResponseBody,\n\t\tCreateScoreRequestBody & ScoreRequestQuery\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async ({ segmentId, sourceLanguageId, projectId, keyId, languageId }) =>\n\t\t\tsendByPayloadRoute(wretchClient, createScore, {\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tpathParams: { projectId, keyId, languageId },\n\t\t\t\tbody: { segmentId, sourceLanguageId },\n\t\t\t}),\n\t})\n}\n"],"names":["useMutation","sendByPayloadRoute","createScore"],"mappings":";;;;;AAoBO,SAAS,uBACf,cACA,SACA,YAGI,CAAA,GACH;AACD,SAAOA,uBAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,EAAE,WAAW,kBAAkB,WAAW,OAAO,iBACnEC,mBAAAA,mBAAmB,cAAcC,mBAAa;AAAA,MAC7C,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,YAAY,EAAE,WAAW,OAAO,WAAW;AAAA,MAC3C,MAAM,EAAE,WAAW,iBAAiB;AAAA,IACpC,CAAA;AAAA,EAAA,CACF;AACF;;"}
1
+ {"version":3,"file":"harmony22.cjs","sources":["../src/features/auth/core/headers/createHeaderBuilderMiddleware.ts"],"sourcesContent":["import { HeaderBuilder, type Headers } from '@features/auth/core/headers/headerBuilder'\n\n/**\n * A helper function that creates a HeaderBuilderMiddleware, it removed the\n * complexity of creating a new instance of the middleware class and tracking the input types.\n *\n * @param middleware - A function that modifies a HeaderBuilder\n * @returns - A new instance of HeaderBuilderMiddleware to be used with a HeaderBuilder\n */\nexport function createHeaderBuilderMiddleware<const H extends Headers>(\n\tmiddleware: (builder: HeaderBuilder) => HeaderBuilder<H> | Promise<HeaderBuilder<H>>,\n) {\n\treturn new HeaderBuilderMiddleware<H>(middleware)\n}\n\n// There is no need to have access to the implementation of the HeaderBuilderMiddleware class\n// all users should use the createHeaderBuilderMiddleware function to create a new instance,\n// but I have to export the type for reference outside the file\nexport type { HeaderBuilderMiddleware }\n\n/**\n * A middleware class that allows you to modify a HeaderBuilder in a type-safe way.\n * It receives a builder and returns a new builder with the modifications applied.\n *\n * @example\n * ```typescript\n * const authMiddleware = createHeaderBuilderMiddleware(async (builder) => {\n * const token = await fetchToken()\n * return builder.add('authorization', `Bearer ${token}`)\n * })\n *\n * const builder = HeaderBuilder.create()\n * .with(authMiddleware)\n *\n * const headers = await builder.resolve() // Type of headers is { 'authorization': string }\n * console.log(headers) // { 'authorization': 'Bearer <token>' }\n */\nclass HeaderBuilderMiddleware<const H extends Headers> {\n\tconstructor(\n\t\tprivate readonly middleware: (\n\t\t\tbuilder: HeaderBuilder<Headers>,\n\t\t) => HeaderBuilder<H> | Promise<HeaderBuilder<H>>,\n\t) {}\n\n\tapply<const BH extends Headers>(base: HeaderBuilder<BH>): HeaderBuilder<BH & H> {\n\t\t// Using the `from` method to make the promise lazy - it should only resolve when the builder is resolved\n\t\treturn base.from(async () => {\n\t\t\tconst middlewareBuilder = this.middleware(HeaderBuilder.create())\n\n\t\t\treturn middlewareBuilder instanceof Promise\n\t\t\t\t? middlewareBuilder.then((r) => r.resolve())\n\t\t\t\t: middlewareBuilder.resolve()\n\t\t})\n\t}\n}\n"],"names":["HeaderBuilder"],"mappings":";;;AASO,SAAS,8BACf,YACC;AACM,SAAA,IAAI,wBAA2B,UAAU;AACjD;AAwBA,MAAM,wBAAiD;AAAA,EACtD,YACkB,YAGhB;AAHgB,SAAA,aAAA;AAAA,EAAA;AAAA,EAKlB,MAAgC,MAAgD;AAExE,WAAA,KAAK,KAAK,YAAY;AAC5B,YAAM,oBAAoB,KAAK,WAAWA,cAAA,cAAc,QAAQ;AAEzD,aAAA,6BAA6B,UACjC,kBAAkB,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,IACzC,kBAAkB,QAAQ;AAAA,IAAA,CAC7B;AAAA,EAAA;AAEH;;"}
@@ -1,17 +1,19 @@
1
- import { sendByPayloadRoute } from "@lokalise/frontend-http-client";
2
- import { useMutation } from "@tanstack/react-query";
3
- import { createScore } from "./harmony15.mjs";
4
- function useCreateScoreMutation(wretchClient, headers, overrides = {}) {
5
- return useMutation({
6
- ...overrides,
7
- mutationFn: async ({ segmentId, sourceLanguageId, projectId, keyId, languageId }) => sendByPayloadRoute(wretchClient, createScore, {
8
- headers: await headers.resolve(),
9
- pathParams: { projectId, keyId, languageId },
10
- body: { segmentId, sourceLanguageId }
11
- })
12
- });
1
+ import { HeaderBuilder } from "./harmony23.mjs";
2
+ function createHeaderBuilderMiddleware(middleware) {
3
+ return new HeaderBuilderMiddleware(middleware);
4
+ }
5
+ class HeaderBuilderMiddleware {
6
+ constructor(middleware) {
7
+ this.middleware = middleware;
8
+ }
9
+ apply(base) {
10
+ return base.from(async () => {
11
+ const middlewareBuilder = this.middleware(HeaderBuilder.create());
12
+ return middlewareBuilder instanceof Promise ? middlewareBuilder.then((r) => r.resolve()) : middlewareBuilder.resolve();
13
+ });
14
+ }
13
15
  }
14
16
  export {
15
- useCreateScoreMutation
17
+ createHeaderBuilderMiddleware
16
18
  };
17
19
  //# sourceMappingURL=harmony22.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony22.mjs","sources":["../src/features/publicApi/hooks/useCreateScoreMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\nimport { createScore } from '../score'\nimport type {\n\tCreateScoreRequestBody,\n\tCreateScoreResponseBody,\n\tScoreRequestQuery,\n} from '../types/scoreTypes'\nimport type { BaseApiEndpointHeader } from '../types/sharedTypes'\n\n/**\n * A react-router wrapper about the createProject public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useCreateScoreMutation<T>(\n\twretchClient: Wretch<T>,\n\theaders: HeaderBuilder<BaseApiEndpointHeader>,\n\toverrides: ApiMutationOverrides<\n\t\tCreateScoreResponseBody,\n\t\tCreateScoreRequestBody & ScoreRequestQuery\n\t> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async ({ segmentId, sourceLanguageId, projectId, keyId, languageId }) =>\n\t\t\tsendByPayloadRoute(wretchClient, createScore, {\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tpathParams: { projectId, keyId, languageId },\n\t\t\t\tbody: { segmentId, sourceLanguageId },\n\t\t\t}),\n\t})\n}\n"],"names":[],"mappings":";;;AAoBO,SAAS,uBACf,cACA,SACA,YAGI,CAAA,GACH;AACD,SAAO,YAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,EAAE,WAAW,kBAAkB,WAAW,OAAO,iBACnE,mBAAmB,cAAc,aAAa;AAAA,MAC7C,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,YAAY,EAAE,WAAW,OAAO,WAAW;AAAA,MAC3C,MAAM,EAAE,WAAW,iBAAiB;AAAA,IACpC,CAAA;AAAA,EAAA,CACF;AACF;"}
1
+ {"version":3,"file":"harmony22.mjs","sources":["../src/features/auth/core/headers/createHeaderBuilderMiddleware.ts"],"sourcesContent":["import { HeaderBuilder, type Headers } from '@features/auth/core/headers/headerBuilder'\n\n/**\n * A helper function that creates a HeaderBuilderMiddleware, it removed the\n * complexity of creating a new instance of the middleware class and tracking the input types.\n *\n * @param middleware - A function that modifies a HeaderBuilder\n * @returns - A new instance of HeaderBuilderMiddleware to be used with a HeaderBuilder\n */\nexport function createHeaderBuilderMiddleware<const H extends Headers>(\n\tmiddleware: (builder: HeaderBuilder) => HeaderBuilder<H> | Promise<HeaderBuilder<H>>,\n) {\n\treturn new HeaderBuilderMiddleware<H>(middleware)\n}\n\n// There is no need to have access to the implementation of the HeaderBuilderMiddleware class\n// all users should use the createHeaderBuilderMiddleware function to create a new instance,\n// but I have to export the type for reference outside the file\nexport type { HeaderBuilderMiddleware }\n\n/**\n * A middleware class that allows you to modify a HeaderBuilder in a type-safe way.\n * It receives a builder and returns a new builder with the modifications applied.\n *\n * @example\n * ```typescript\n * const authMiddleware = createHeaderBuilderMiddleware(async (builder) => {\n * const token = await fetchToken()\n * return builder.add('authorization', `Bearer ${token}`)\n * })\n *\n * const builder = HeaderBuilder.create()\n * .with(authMiddleware)\n *\n * const headers = await builder.resolve() // Type of headers is { 'authorization': string }\n * console.log(headers) // { 'authorization': 'Bearer <token>' }\n */\nclass HeaderBuilderMiddleware<const H extends Headers> {\n\tconstructor(\n\t\tprivate readonly middleware: (\n\t\t\tbuilder: HeaderBuilder<Headers>,\n\t\t) => HeaderBuilder<H> | Promise<HeaderBuilder<H>>,\n\t) {}\n\n\tapply<const BH extends Headers>(base: HeaderBuilder<BH>): HeaderBuilder<BH & H> {\n\t\t// Using the `from` method to make the promise lazy - it should only resolve when the builder is resolved\n\t\treturn base.from(async () => {\n\t\t\tconst middlewareBuilder = this.middleware(HeaderBuilder.create())\n\n\t\t\treturn middlewareBuilder instanceof Promise\n\t\t\t\t? middlewareBuilder.then((r) => r.resolve())\n\t\t\t\t: middlewareBuilder.resolve()\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";AASO,SAAS,8BACf,YACC;AACM,SAAA,IAAI,wBAA2B,UAAU;AACjD;AAwBA,MAAM,wBAAiD;AAAA,EACtD,YACkB,YAGhB;AAHgB,SAAA,aAAA;AAAA,EAAA;AAAA,EAKlB,MAAgC,MAAgD;AAExE,WAAA,KAAK,KAAK,YAAY;AAC5B,YAAM,oBAAoB,KAAK,WAAW,cAAc,QAAQ;AAEzD,aAAA,6BAA6B,UACjC,kBAAkB,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,IACzC,kBAAkB,QAAQ;AAAA,IAAA,CAC7B;AAAA,EAAA;AAEH;"}
@@ -1,16 +1,145 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const frontendHttpClient = require("@lokalise/frontend-http-client");
4
- const reactQuery = require("@tanstack/react-query");
5
- const projects = require("./harmony14.cjs");
6
- function useCreateProjectMutation(wretchClient, headers, overrides = {}) {
7
- return reactQuery.useMutation({
8
- ...overrides,
9
- mutationFn: async (variables) => frontendHttpClient.sendByPayloadRoute(wretchClient, projects.createProject, {
10
- headers: await headers.resolve(),
11
- body: variables
12
- })
13
- });
3
+ class HeaderBuilder {
4
+ /**
5
+ * This constructor is private to prevent the creation of a HeaderBuilder, it's an implementation detail
6
+ * that users of this class should not be aware of. The only way to create a HeaderBuilder is through the
7
+ * static create method.
8
+ *
9
+ * @private
10
+ */
11
+ constructor(factories) {
12
+ this.factories = factories;
13
+ }
14
+ static create(initialHeaders = {}) {
15
+ return new HeaderBuilder([() => initialHeaders]);
16
+ }
17
+ /**
18
+ * Adds a single header to the builder by providing a key and a value.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const builder = HeaderBuilder.create()
23
+ * .add('Content-Type', 'application/json')
24
+ * .add('authorization', 'Bearer token')
25
+ *
26
+ * const headers = await builder.resolve()
27
+ * console.log(headers)
28
+ * // { 'Content-Type': 'application/json', 'authorization': 'Bearer token' }
29
+ * ```
30
+ *
31
+ * @param key - The key of the header
32
+ * @param value - The value of the header
33
+ */
34
+ add(key, value) {
35
+ return new HeaderBuilder([...this.factories, () => ({ [key]: value })]);
36
+ }
37
+ /**
38
+ * Adds multiple headers to the builder by providing an object or a promise of an object with the headers.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const builder = HeaderBuilder.create()
43
+ * .and({ 'Content-Type': 'application/json', 'authorization': 'Bearer token' })
44
+ * .and(Promise.resolve({ 'X-Custom-Header': 'custom', 'X-Another-Header': 'another' }))
45
+ *
46
+ * const headers = await builder.resolve()
47
+ * console.log(headers)
48
+ * // Prints: {
49
+ * // 'Content-Type': 'application/json',
50
+ * // 'authorization': 'Bearer token',
51
+ * // 'X-Custom-Header': 'custom',
52
+ * // 'X-Another-Header': 'another'
53
+ * // }
54
+ * ```
55
+ *
56
+ * @param extension - An object with the headers to add
57
+ */
58
+ and(extension) {
59
+ return new HeaderBuilder([...this.factories, () => extension]);
60
+ }
61
+ /**
62
+ * Adds a factory function that returns a promise of headers to the builder.
63
+ * This is useful when you need to fetch some data asynchronously to build the headers.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const builder = HeaderBuilder.create()
68
+ * .from(async () => {
69
+ * const token = await fetchToken()
70
+ * return { 'authorization': `Bearer ${token}` }
71
+ * })
72
+ *
73
+ * const headers = await builder.resolve()
74
+ * console.log(headers) // { 'authorization': 'Bearer <token>' }
75
+ * ```
76
+ *
77
+ * @param factory - A function that returns a promise of headers
78
+ */
79
+ from(factory) {
80
+ return new HeaderBuilder([...this.factories, factory]);
81
+ }
82
+ /**
83
+ * Takes a middleware function that receives the current builder and returns a new, modified, builder.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const authMiddleware = createHeaderBuilderMiddleware(async (builder) => {
88
+ * const token = await fetchToken()
89
+ * return builder.add('authorization', `Bearer ${token}`)
90
+ * })
91
+ *
92
+ * const builder = HeaderBuilder.create()
93
+ * .with(authMiddleware)
94
+ *
95
+ * const headers = await builder.resolve() // Type of headers is { 'authorization': string }
96
+ * console.log(headers) // { 'authorization': 'Bearer <token>' }
97
+ * ```
98
+ *
99
+ * @param middleware
100
+ */
101
+ with(middleware) {
102
+ return middleware.apply(this);
103
+ }
104
+ /**
105
+ * Merges the current builder with another builder.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * const builderA = HeaderBuilder.create()
110
+ * .add('Content-Type', 'application/json')
111
+ *
112
+ * const builderB = HeaderBuilder.create()
113
+ * .add('authorization', 'Bearer token')
114
+ *
115
+ * const mergedBuilder = builderA.merge(builderB)
116
+ *
117
+ * const headers = await mergedBuilder.resolve()
118
+ * console.log(headers)
119
+ * // { 'Content-Type': 'application/json', 'authorization': 'Bearer token' }
120
+ * ```
121
+ *
122
+ * @param builder - The builder to merge with
123
+ */
124
+ merge(builder) {
125
+ return new HeaderBuilder([...this.factories, ...builder.factories]);
126
+ }
127
+ /**
128
+ * Resolves the headers by waiting for all the promises to resolve and merging them together.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const builder = HeaderBuilder.create()
133
+ * .add('Content-Type', 'application/json')
134
+ *
135
+ * const headers = await builder.resolve()
136
+ * console.log(headers) // { 'Content-Type': 'application/json' }
137
+ */
138
+ async resolve() {
139
+ const headers = this.factories.map((header) => header());
140
+ const resolvedHeaders = await Promise.all(headers);
141
+ return Object.assign({}, ...resolvedHeaders);
142
+ }
14
143
  }
15
- exports.useCreateProjectMutation = useCreateProjectMutation;
144
+ exports.HeaderBuilder = HeaderBuilder;
16
145
  //# sourceMappingURL=harmony23.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony23.cjs","sources":["../src/features/publicApi/hooks/useCreateProjectMutation.ts"],"sourcesContent":["import type { HeaderBuilder } from '@features/auth/core/headers/headerBuilder'\nimport { sendByPayloadRoute } from '@lokalise/frontend-http-client'\nimport { useMutation } from '@tanstack/react-query'\nimport type { ApiMutationOverrides } from '@utils/types/apiMutationOverrides'\nimport type { Wretch } from 'wretch'\nimport { createProject } from '../projects'\nimport type {\n\tCreateProjectRequestBody,\n\tProject,\n\tProjectApiBaseHeaders,\n} from '../types/projectTypes'\n\n/**\n * A react-router wrapper about the createProject public API endpoint\n *\n * @param wretchClient - Wretch instance configured to a public API instance.\n * @param headers - A header builder instance to resolve the headers for the request.\n * @param overrides - Additional options to pass to the query.\n */\nexport function useCreateProjectMutation<T>(\n\twretchClient: Wretch<T>,\n\theaders: HeaderBuilder<ProjectApiBaseHeaders>,\n\toverrides: ApiMutationOverrides<Project, CreateProjectRequestBody> = {},\n) {\n\treturn useMutation({\n\t\t...overrides,\n\t\tmutationFn: async (variables) =>\n\t\t\tsendByPayloadRoute(wretchClient, createProject, {\n\t\t\t\theaders: await headers.resolve(),\n\t\t\t\tbody: variables,\n\t\t\t}),\n\t})\n}\n"],"names":["useMutation","sendByPayloadRoute","createProject"],"mappings":";;;;;AAmBO,SAAS,yBACf,cACA,SACA,YAAqE,CAAA,GACpE;AACD,SAAOA,uBAAY;AAAA,IAClB,GAAG;AAAA,IACH,YAAY,OAAO,cAClBC,sCAAmB,cAAcC,SAAAA,eAAe;AAAA,MAC/C,SAAS,MAAM,QAAQ,QAAQ;AAAA,MAC/B,MAAM;AAAA,IACN,CAAA;AAAA,EAAA,CACF;AACF;;"}
1
+ {"version":3,"file":"harmony23.cjs","sources":["../src/features/auth/core/headers/headerBuilder.ts"],"sourcesContent":["import type { HeaderBuilderMiddleware } from '@features/auth/core/headers/createHeaderBuilderMiddleware'\n\nexport type Headers<K extends string = string, V extends string = string> = Record<K, V>\n\n// biome-ignore lint/complexity/noBannedTypes: To represent no headers we need use an empty object\ntype NoHeaders = {}\n\n/**\n * A builder class that helps to build up a set of headers in a type-safe way.\n * It allows you to add headers, merge them together, and resolve them into a single object.\n * The builder is immutable, so every operation returns a new instance of the builder.\n * It offers a middleware function that allows you to modify the builder, asynchronously, in a type-safe way.\n *\n * @example\n * ```typescript\n * const authMiddleware = createHeaderBuilderMiddleware(async (builder) => {\n * const token = await fetchToken()\n * return builder.add('authorization', `Bearer ${token}`)\n * })\n *\n * const builder = HeaderBuilder.create()\n * .add('Content-Type', 'application/json')\n * .and({ 'X-Custom-Header': 'custom', 'X-Another-Header': 'another' })\n * .with(authMiddleware)\n *\n * const headers = await builder.resolve()\n * console.log(headers)\n * // Prints: {\n * // 'Content-Type': 'application/json',\n * // 'X-Custom-Header': 'custom',\n * // 'X-Another-Header': 'another',\n * // 'authorization': 'Bearer <token>'\n * // }\n */\nexport class HeaderBuilder<H extends Headers = NoHeaders> {\n\t/**\n\t * Creates a new HeaderBuilder, optionally with an initial set of headers.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = HeaderBuilder.create()\n\t *\n\t * const builderWithHeaders = HeaderBuilder.create({ 'Content-Type': 'application/json' })\n\t *\n\t * console.log(builder) // {}\n\t * console.log(builderWithHeaders) // { 'Content-Type': 'application/json' }\n\t * ```\n\t */\n\t// biome-ignore lint/complexity/noBannedTypes: If headers are not provided the initial type is an empty object\n\tstatic create<const H extends Headers = {}>(): HeaderBuilder<H>\n\tstatic create<const H extends Headers>(initialHeaders: H): HeaderBuilder<H>\n\tstatic create<const H extends Headers>(initialHeaders = {} as H): HeaderBuilder<H> {\n\t\treturn new HeaderBuilder([() => initialHeaders])\n\t}\n\n\t/**\n\t * This constructor is private to prevent the creation of a HeaderBuilder, it's an implementation detail\n\t * that users of this class should not be aware of. The only way to create a HeaderBuilder is through the\n\t * static create method.\n\t *\n\t * @private\n\t */\n\tprivate constructor(\n\t\t// This is a list of headers that will be put together in the resolve method.\n\t\t// You can think of this as building up a history of added headers that will be\n\t\t// merged together when they are needed.\n\t\tprivate readonly factories: (() => Promise<Headers> | Headers)[],\n\t) {}\n\n\t/**\n\t * Adds a single header to the builder by providing a key and a value.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = HeaderBuilder.create()\n\t * .add('Content-Type', 'application/json')\n\t * .add('authorization', 'Bearer token')\n\t *\n\t * const headers = await builder.resolve()\n\t * console.log(headers)\n\t * // { 'Content-Type': 'application/json', 'authorization': 'Bearer token' }\n\t * ```\n\t *\n\t * @param key - The key of the header\n\t * @param value - The value of the header\n\t */\n\tadd<const K extends string, const V>(key: K, value: V): HeaderBuilder<H & { [k in K]: V }> {\n\t\treturn new HeaderBuilder([...this.factories, () => ({ [key]: value }) as Headers])\n\t}\n\n\t/**\n\t * Adds multiple headers to the builder by providing an object or a promise of an object with the headers.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = HeaderBuilder.create()\n\t * .and({ 'Content-Type': 'application/json', 'authorization': 'Bearer token' })\n\t * .and(Promise.resolve({ 'X-Custom-Header': 'custom', 'X-Another-Header': 'another' }))\n\t *\n\t * const headers = await builder.resolve()\n\t * console.log(headers)\n\t * // Prints: {\n\t * // 'Content-Type': 'application/json',\n\t * // 'authorization': 'Bearer token',\n\t * // 'X-Custom-Header': 'custom',\n\t * // 'X-Another-Header': 'another'\n\t * // }\n\t * ```\n\t *\n\t * @param extension - An object with the headers to add\n\t */\n\tand<const K extends string, const V extends string, E extends Headers<K, V>>(\n\t\textension: E | Promise<E>,\n\t): HeaderBuilder<H & E> {\n\t\treturn new HeaderBuilder([...this.factories, () => extension])\n\t}\n\n\t/**\n\t * Adds a factory function that returns a promise of headers to the builder.\n\t * This is useful when you need to fetch some data asynchronously to build the headers.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = HeaderBuilder.create()\n\t * .from(async () => {\n\t * const token = await fetchToken()\n\t * return { 'authorization': `Bearer ${token}` }\n\t * })\n\t *\n\t * const headers = await builder.resolve()\n\t * console.log(headers) // { 'authorization': 'Bearer <token>' }\n\t * ```\n\t *\n\t * @param factory - A function that returns a promise of headers\n\t */\n\tfrom<E extends Headers>(factory: () => E | Promise<E>): HeaderBuilder<H & E> {\n\t\treturn new HeaderBuilder([...this.factories, factory])\n\t}\n\n\t/**\n\t * Takes a middleware function that receives the current builder and returns a new, modified, builder.\n\t *\n\t * @example\n\t * ```typescript\n\t * const authMiddleware = createHeaderBuilderMiddleware(async (builder) => {\n\t * const token = await fetchToken()\n\t * return builder.add('authorization', `Bearer ${token}`)\n\t * })\n\t *\n\t * const builder = HeaderBuilder.create()\n\t * .with(authMiddleware)\n\t *\n\t * const headers = await builder.resolve() // Type of headers is { 'authorization': string }\n\t * console.log(headers) // { 'authorization': 'Bearer <token>' }\n\t * ```\n\t *\n\t * @param middleware\n\t */\n\twith<const T extends Headers>(middleware: HeaderBuilderMiddleware<T>) {\n\t\treturn middleware.apply(this)\n\t}\n\n\t/**\n\t * Merges the current builder with another builder.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builderA = HeaderBuilder.create()\n\t * .add('Content-Type', 'application/json')\n\t *\n\t * const builderB = HeaderBuilder.create()\n\t * .add('authorization', 'Bearer token')\n\t *\n\t * const mergedBuilder = builderA.merge(builderB)\n\t *\n\t * const headers = await mergedBuilder.resolve()\n\t * console.log(headers)\n\t * // { 'Content-Type': 'application/json', 'authorization': 'Bearer token' }\n\t * ```\n\t *\n\t * @param builder - The builder to merge with\n\t */\n\tmerge<const T extends Headers>(builder: HeaderBuilder<T>): HeaderBuilder<H & T> {\n\t\treturn new HeaderBuilder([...this.factories, ...builder.factories])\n\t}\n\n\t/**\n\t * Resolves the headers by waiting for all the promises to resolve and merging them together.\n\t *\n\t * @example\n\t * ```typescript\n\t * const builder = HeaderBuilder.create()\n\t * .add('Content-Type', 'application/json')\n\t *\n\t * const headers = await builder.resolve()\n\t * console.log(headers) // { 'Content-Type': 'application/json' }\n\t */\n\tasync resolve(): Promise<H> {\n\t\tconst headers = this.factories.map((header) => header())\n\t\tconst resolvedHeaders = await Promise.all(headers)\n\n\t\treturn Object.assign({}, ...resolvedHeaders)\n\t}\n}\n"],"names":[],"mappings":";;AAkCO,MAAM,cAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BjD,YAIU,WAChB;AADgB,SAAA,YAAA;AAAA,EAAA;AAAA,EAflB,OAAO,OAAgC,iBAAiB,IAA2B;AAClF,WAAO,IAAI,cAAc,CAAC,MAAM,cAAc,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkChD,IAAqC,KAAQ,OAA8C;AAC1F,WAAO,IAAI,cAAc,CAAC,GAAG,KAAK,WAAW,OAAO,EAAE,CAAC,GAAG,GAAG,QAAmB,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBlF,IACC,WACuB;AAChB,WAAA,IAAI,cAAc,CAAC,GAAG,KAAK,WAAW,MAAM,SAAS,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9D,KAAwB,SAAqD;AAC5E,WAAO,IAAI,cAAc,CAAC,GAAG,KAAK,WAAW,OAAO,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBtD,KAA8B,YAAwC;AAC9D,WAAA,WAAW,MAAM,IAAI;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuB7B,MAA+B,SAAiD;AACxE,WAAA,IAAI,cAAc,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,SAAS,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcnE,MAAM,UAAsB;AAC3B,UAAM,UAAU,KAAK,UAAU,IAAI,CAAC,WAAW,QAAQ;AACvD,UAAM,kBAAkB,MAAM,QAAQ,IAAI,OAAO;AAEjD,WAAO,OAAO,OAAO,CAAC,GAAG,GAAG,eAAe;AAAA,EAAA;AAE7C;;"}