@unchainedshop/plugins 4.0.0-rc.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/lib/accounts/google-oauth.d.ts +4 -0
  2. package/lib/accounts/google-oauth.d.ts.map +1 -0
  3. package/lib/accounts/google-oauth.js +145 -0
  4. package/lib/accounts/google-oauth.js.map +1 -0
  5. package/lib/accounts/linkedin-oauth.d.ts +4 -0
  6. package/lib/accounts/linkedin-oauth.d.ts.map +1 -0
  7. package/lib/accounts/linkedin-oauth.js +82 -0
  8. package/lib/accounts/linkedin-oauth.js.map +1 -0
  9. package/lib/delivery/send-message.js.map +1 -1
  10. package/lib/enrollments/licensed.js +15 -2
  11. package/lib/enrollments/licensed.js.map +1 -1
  12. package/lib/files/gridfs/adapter.d.ts.map +1 -1
  13. package/lib/files/gridfs/adapter.js +11 -8
  14. package/lib/files/gridfs/adapter.js.map +1 -1
  15. package/lib/files/gridfs/gridfs-adapter.d.ts +3 -0
  16. package/lib/files/gridfs/gridfs-adapter.d.ts.map +1 -0
  17. package/lib/files/gridfs/gridfs-adapter.js +97 -0
  18. package/lib/files/gridfs/gridfs-adapter.js.map +1 -0
  19. package/lib/files/gridfs/gridfs-webhook.d.ts +11 -0
  20. package/lib/files/gridfs/gridfs-webhook.d.ts.map +1 -0
  21. package/lib/files/gridfs/gridfs-webhook.js +84 -0
  22. package/lib/files/gridfs/gridfs-webhook.js.map +1 -0
  23. package/lib/files/gridfs/handler-express.d.ts.map +1 -1
  24. package/lib/files/gridfs/handler-express.js +21 -25
  25. package/lib/files/gridfs/handler-express.js.map +1 -1
  26. package/lib/files/gridfs/handler-fastify.d.ts.map +1 -1
  27. package/lib/files/gridfs/handler-fastify.js +50 -13
  28. package/lib/files/gridfs/handler-fastify.js.map +1 -1
  29. package/lib/files/gridfs/module.d.ts +2 -2
  30. package/lib/files/minio/handler-express.d.ts.map +1 -1
  31. package/lib/files/minio/handler-express.js +4 -7
  32. package/lib/files/minio/handler-express.js.map +1 -1
  33. package/lib/files/minio/handler-fastify.js +2 -2
  34. package/lib/files/minio/handler-fastify.js.map +1 -1
  35. package/lib/files/minio/index.d.ts +1 -1
  36. package/lib/files/minio/index.d.ts.map +1 -1
  37. package/lib/files/minio/index.js +7 -7
  38. package/lib/files/minio/index.js.map +1 -1
  39. package/lib/files/minio/minio-adapter.d.ts +6 -0
  40. package/lib/files/minio/minio-adapter.d.ts.map +1 -0
  41. package/lib/files/minio/minio-adapter.js +181 -0
  42. package/lib/files/minio/minio-adapter.js.map +1 -0
  43. package/lib/files/minio/minio-webhook.d.ts +2 -0
  44. package/lib/files/minio/minio-webhook.d.ts.map +1 -0
  45. package/lib/files/minio/minio-webhook.js +33 -0
  46. package/lib/files/minio/minio-webhook.js.map +1 -0
  47. package/lib/filters/local-search.js +1 -1
  48. package/lib/filters/local-search.js.map +1 -1
  49. package/lib/filters/strict-equal.js +0 -18
  50. package/lib/filters/strict-equal.js.map +1 -1
  51. package/lib/payment/apple-iap/adapter.js +12 -10
  52. package/lib/payment/apple-iap/adapter.js.map +1 -1
  53. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
  54. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +1 -1
  55. package/lib/payment/apple-iap/handler-express.d.ts.map +1 -1
  56. package/lib/payment/apple-iap/handler-express.js +14 -10
  57. package/lib/payment/apple-iap/handler-express.js.map +1 -1
  58. package/lib/payment/apple-iap/handler-fastify.d.ts.map +1 -1
  59. package/lib/payment/apple-iap/handler-fastify.js +15 -8
  60. package/lib/payment/apple-iap/handler-fastify.js.map +1 -1
  61. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +9 -0
  62. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts.map +1 -0
  63. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +17 -0
  64. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +1 -0
  65. package/lib/payment/apple-iap/module.d.ts +4 -4
  66. package/lib/payment/apple-iap/module.d.ts.map +1 -1
  67. package/lib/payment/apple-iap/module.js +4 -2
  68. package/lib/payment/apple-iap/module.js.map +1 -1
  69. package/lib/payment/braintree.js +3 -1
  70. package/lib/payment/braintree.js.map +1 -1
  71. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
  72. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +1 -1
  73. package/lib/payment/cryptopay/derive-btc-address.d.ts.map +1 -1
  74. package/lib/payment/cryptopay/derive-btc-address.js +2 -3
  75. package/lib/payment/cryptopay/derive-btc-address.js.map +1 -1
  76. package/lib/payment/cryptopay/derive-eth-address.d.ts.map +1 -1
  77. package/lib/payment/cryptopay/derive-eth-address.js +5 -3
  78. package/lib/payment/cryptopay/derive-eth-address.js.map +1 -1
  79. package/lib/payment/cryptopay/handle-webhook.js +2 -2
  80. package/lib/payment/cryptopay/handle-webhook.js.map +1 -1
  81. package/lib/payment/cryptopay/handler-express.d.ts.map +1 -1
  82. package/lib/payment/cryptopay/handler-express.js +4 -7
  83. package/lib/payment/cryptopay/handler-express.js.map +1 -1
  84. package/lib/payment/cryptopay/handler-fastify.js +1 -1
  85. package/lib/payment/cryptopay/handler-fastify.js.map +1 -1
  86. package/lib/payment/cryptopay/middleware.d.ts +2 -0
  87. package/lib/payment/cryptopay/middleware.d.ts.map +1 -0
  88. package/lib/payment/cryptopay/middleware.js +75 -0
  89. package/lib/payment/cryptopay/middleware.js.map +1 -0
  90. package/lib/payment/cryptopay/module/configureCryptopayModule.d.ts +25 -0
  91. package/lib/payment/cryptopay/module/configureCryptopayModule.d.ts.map +1 -0
  92. package/lib/payment/cryptopay/module/configureCryptopayModule.js +75 -0
  93. package/lib/payment/cryptopay/module/configureCryptopayModule.js.map +1 -0
  94. package/lib/payment/cryptopay/module.d.ts +2 -2
  95. package/lib/payment/cryptopay/module.d.ts.map +1 -1
  96. package/lib/payment/cryptopay/module.js +4 -4
  97. package/lib/payment/cryptopay/module.js.map +1 -1
  98. package/lib/payment/cryptopay/plugin.d.ts.map +1 -1
  99. package/lib/payment/cryptopay/plugin.js +18 -4
  100. package/lib/payment/cryptopay/plugin.js.map +1 -1
  101. package/lib/payment/datatrans-v2/handler-express.d.ts.map +1 -1
  102. package/lib/payment/datatrans-v2/handler-express.js +13 -11
  103. package/lib/payment/datatrans-v2/handler-express.js.map +1 -1
  104. package/lib/payment/datatrans-v2/handler-fastify.d.ts.map +1 -1
  105. package/lib/payment/datatrans-v2/handler-fastify.js +11 -5
  106. package/lib/payment/datatrans-v2/handler-fastify.js.map +1 -1
  107. package/lib/payment/datatrans-v2/index.js +63 -37
  108. package/lib/payment/datatrans-v2/index.js.map +1 -1
  109. package/lib/payment/datatrans-v2/middleware.d.ts +2 -0
  110. package/lib/payment/datatrans-v2/middleware.d.ts.map +1 -0
  111. package/lib/payment/datatrans-v2/middleware.js +68 -0
  112. package/lib/payment/datatrans-v2/middleware.js.map +1 -0
  113. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +1 -1
  114. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +1 -1
  115. package/lib/payment/paypal-checkout.js +4 -2
  116. package/lib/payment/paypal-checkout.js.map +1 -1
  117. package/lib/payment/payrexx/api/index.d.ts +1 -1
  118. package/lib/payment/payrexx/api/index.d.ts.map +1 -1
  119. package/lib/payment/payrexx/api/makeFetcher.d.ts +1 -1
  120. package/lib/payment/payrexx/api/makeFetcher.d.ts.map +1 -1
  121. package/lib/payment/payrexx/api/makeFetcher.js +1 -1
  122. package/lib/payment/payrexx/api/makeFetcher.js.map +1 -1
  123. package/lib/payment/payrexx/handler-express.d.ts.map +1 -1
  124. package/lib/payment/payrexx/handler-express.js +15 -15
  125. package/lib/payment/payrexx/handler-express.js.map +1 -1
  126. package/lib/payment/payrexx/handler-fastify.js +23 -15
  127. package/lib/payment/payrexx/handler-fastify.js.map +1 -1
  128. package/lib/payment/payrexx/index.js +21 -15
  129. package/lib/payment/payrexx/index.js.map +1 -1
  130. package/lib/payment/payrexx/middleware.d.ts +2 -0
  131. package/lib/payment/payrexx/middleware.d.ts.map +1 -0
  132. package/lib/payment/payrexx/middleware.js +86 -0
  133. package/lib/payment/payrexx/middleware.js.map +1 -0
  134. package/lib/payment/postfinance-checkout/api-client.d.ts.map +1 -1
  135. package/lib/payment/postfinance-checkout/api-client.js +7 -7
  136. package/lib/payment/postfinance-checkout/api-client.js.map +1 -1
  137. package/lib/payment/postfinance-checkout/handler-express.js +7 -8
  138. package/lib/payment/postfinance-checkout/handler-express.js.map +1 -1
  139. package/lib/payment/postfinance-checkout/handler-fastify.d.ts.map +1 -1
  140. package/lib/payment/postfinance-checkout/handler-fastify.js +6 -4
  141. package/lib/payment/postfinance-checkout/handler-fastify.js.map +1 -1
  142. package/lib/payment/postfinance-checkout/index.d.ts.map +1 -1
  143. package/lib/payment/postfinance-checkout/index.js +20 -7
  144. package/lib/payment/postfinance-checkout/index.js.map +1 -1
  145. package/lib/payment/postfinance-checkout/middleware.d.ts +2 -0
  146. package/lib/payment/postfinance-checkout/middleware.d.ts.map +1 -0
  147. package/lib/payment/postfinance-checkout/middleware.js +38 -0
  148. package/lib/payment/postfinance-checkout/middleware.js.map +1 -0
  149. package/lib/payment/saferpay/adapter.d.ts.map +1 -1
  150. package/lib/payment/saferpay/adapter.js +9 -0
  151. package/lib/payment/saferpay/adapter.js.map +1 -1
  152. package/lib/payment/saferpay/handler-express.d.ts.map +1 -1
  153. package/lib/payment/saferpay/handler-express.js +10 -8
  154. package/lib/payment/saferpay/handler-express.js.map +1 -1
  155. package/lib/payment/saferpay/handler-fastify.d.ts.map +1 -1
  156. package/lib/payment/saferpay/handler-fastify.js +11 -5
  157. package/lib/payment/saferpay/handler-fastify.js.map +1 -1
  158. package/lib/payment/saferpay/middleware.d.ts +2 -0
  159. package/lib/payment/saferpay/middleware.d.ts.map +1 -0
  160. package/lib/payment/saferpay/middleware.js +57 -0
  161. package/lib/payment/saferpay/middleware.js.map +1 -0
  162. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.d.ts +10 -0
  163. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.d.ts.map +1 -0
  164. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.js +24 -0
  165. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.js.map +1 -0
  166. package/lib/payment/saferpay/module.d.ts +2 -2
  167. package/lib/payment/stripe/handler-express.js +25 -17
  168. package/lib/payment/stripe/handler-express.js.map +1 -1
  169. package/lib/payment/stripe/handler-fastify.d.ts.map +1 -1
  170. package/lib/payment/stripe/handler-fastify.js +33 -12
  171. package/lib/payment/stripe/handler-fastify.js.map +1 -1
  172. package/lib/payment/stripe/index.js +21 -15
  173. package/lib/payment/stripe/index.js.map +1 -1
  174. package/lib/payment/stripe/middleware.d.ts +6 -0
  175. package/lib/payment/stripe/middleware.d.ts.map +1 -0
  176. package/lib/payment/stripe/middleware.js +114 -0
  177. package/lib/payment/stripe/middleware.js.map +1 -0
  178. package/lib/payment/stripe/stripe.d.ts +2 -2
  179. package/lib/payment/stripe/stripe.d.ts.map +1 -1
  180. package/lib/payment/stripe/stripe.js +14 -11
  181. package/lib/payment/stripe/stripe.js.map +1 -1
  182. package/lib/plugins-index.d.ts +48 -0
  183. package/lib/plugins-index.d.ts.map +1 -0
  184. package/lib/plugins-index.js +107 -0
  185. package/lib/plugins-index.js.map +1 -0
  186. package/lib/presets/all.d.ts +8 -6
  187. package/lib/presets/all.d.ts.map +1 -1
  188. package/lib/presets/all.js +3 -1
  189. package/lib/presets/all.js.map +1 -1
  190. package/lib/pricing/delivery-swiss-tax.d.ts.map +1 -1
  191. package/lib/pricing/delivery-swiss-tax.js +13 -20
  192. package/lib/pricing/delivery-swiss-tax.js.map +1 -1
  193. package/lib/pricing/order-discount.d.ts.map +1 -1
  194. package/lib/pricing/order-discount.js +5 -3
  195. package/lib/pricing/order-discount.js.map +1 -1
  196. package/lib/pricing/order-round.d.ts.map +1 -1
  197. package/lib/pricing/order-round.js +4 -3
  198. package/lib/pricing/order-round.js.map +1 -1
  199. package/lib/pricing/product-catalog-price-options.d.ts +2 -0
  200. package/lib/pricing/product-catalog-price-options.d.ts.map +1 -0
  201. package/lib/pricing/product-catalog-price-options.js +52 -0
  202. package/lib/pricing/product-catalog-price-options.js.map +1 -0
  203. package/lib/pricing/product-catalog-price.d.ts.map +1 -1
  204. package/lib/pricing/product-catalog-price.js +26 -2
  205. package/lib/pricing/product-catalog-price.js.map +1 -1
  206. package/lib/pricing/product-price-rateconversion.js +3 -3
  207. package/lib/pricing/product-price-rateconversion.js.map +1 -1
  208. package/lib/pricing/product-swiss-tax.d.ts +1 -5
  209. package/lib/pricing/product-swiss-tax.d.ts.map +1 -1
  210. package/lib/pricing/product-swiss-tax.js +26 -22
  211. package/lib/pricing/product-swiss-tax.js.map +1 -1
  212. package/lib/pricing/tax/ch.d.ts +7 -2
  213. package/lib/pricing/tax/ch.d.ts.map +1 -1
  214. package/lib/pricing/tax/ch.js +16 -1
  215. package/lib/pricing/tax/ch.js.map +1 -1
  216. package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts +7 -0
  217. package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts.map +1 -0
  218. package/lib/pricing/utils/isDeliveryAddressInCountry.js +13 -0
  219. package/lib/pricing/utils/isDeliveryAddressInCountry.js.map +1 -0
  220. package/lib/warehousing/eth-minter.js +23 -11
  221. package/lib/warehousing/eth-minter.js.map +1 -1
  222. package/lib/worker/budgetsms.d.ts +10 -0
  223. package/lib/worker/budgetsms.d.ts.map +1 -0
  224. package/lib/worker/budgetsms.js +217 -0
  225. package/lib/worker/budgetsms.js.map +1 -0
  226. package/lib/worker/bulk-import.d.ts +1 -1
  227. package/lib/worker/bulk-import.d.ts.map +1 -1
  228. package/lib/worker/bulk-import.js +11 -33
  229. package/lib/worker/bulk-import.js.map +1 -1
  230. package/lib/worker/bulkgate.d.ts +2 -0
  231. package/lib/worker/bulkgate.d.ts.map +1 -0
  232. package/lib/worker/bulkgate.js +104 -0
  233. package/lib/worker/bulkgate.js.map +1 -0
  234. package/lib/worker/email.d.ts.map +1 -1
  235. package/lib/worker/email.js +25 -7
  236. package/lib/worker/email.js.map +1 -1
  237. package/lib/worker/enrollment-order-generator.d.ts.map +1 -1
  238. package/lib/worker/enrollment-order-generator.js +7 -49
  239. package/lib/worker/enrollment-order-generator.js.map +1 -1
  240. package/lib/worker/error-notifications.js +1 -1
  241. package/lib/worker/error-notifications.js.map +1 -1
  242. package/lib/worker/export-token.d.ts.map +1 -1
  243. package/lib/worker/export-token.js +0 -1
  244. package/lib/worker/export-token.js.map +1 -1
  245. package/lib/worker/message.d.ts +1 -1
  246. package/lib/worker/message.d.ts.map +1 -1
  247. package/lib/worker/message.js +4 -2
  248. package/lib/worker/message.js.map +1 -1
  249. package/lib/worker/sms.js +17 -17
  250. package/lib/worker/sms.js.map +1 -1
  251. package/lib/worker/twilio.d.ts +2 -0
  252. package/lib/worker/twilio.d.ts.map +1 -0
  253. package/lib/worker/twilio.js +60 -0
  254. package/lib/worker/twilio.js.map +1 -0
  255. package/package.json +22 -33
  256. package/src/delivery/send-message.ts +1 -1
  257. package/src/enrollments/licensed.ts +15 -2
  258. package/src/files/gridfs/adapter.ts +12 -7
  259. package/src/files/gridfs/handler-express.ts +23 -25
  260. package/src/files/gridfs/handler-fastify.ts +53 -14
  261. package/src/files/minio/handler-express.ts +4 -7
  262. package/src/files/minio/handler-fastify.ts +2 -2
  263. package/src/files/minio/index.ts +16 -16
  264. package/src/filters/local-search.ts +1 -1
  265. package/src/filters/strict-equal.ts +0 -21
  266. package/src/payment/apple-iap/adapter.ts +12 -14
  267. package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
  268. package/src/payment/apple-iap/handler-express.ts +17 -11
  269. package/src/payment/apple-iap/handler-fastify.ts +19 -9
  270. package/src/payment/apple-iap/module.ts +9 -4
  271. package/src/payment/braintree.ts +4 -1
  272. package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
  273. package/src/payment/cryptopay/derive-btc-address.ts +1 -3
  274. package/src/payment/cryptopay/derive-eth-address.ts +5 -3
  275. package/src/payment/cryptopay/handle-webhook.ts +6 -6
  276. package/src/payment/cryptopay/handler-express.ts +4 -7
  277. package/src/payment/cryptopay/handler-fastify.ts +1 -1
  278. package/src/payment/cryptopay/module.ts +8 -5
  279. package/src/payment/cryptopay/plugin.ts +21 -4
  280. package/src/payment/datatrans-v2/handler-express.ts +17 -12
  281. package/src/payment/datatrans-v2/handler-fastify.ts +15 -6
  282. package/src/payment/datatrans-v2/index.ts +82 -50
  283. package/src/payment/paypal-checkout.ts +4 -2
  284. package/src/payment/payrexx/api/index.ts +1 -1
  285. package/src/payment/payrexx/api/makeFetcher.ts +2 -2
  286. package/src/payment/payrexx/handler-express.ts +24 -32
  287. package/src/payment/payrexx/handler-fastify.ts +33 -33
  288. package/src/payment/payrexx/index.ts +26 -16
  289. package/src/payment/postfinance-checkout/api-client.ts +13 -8
  290. package/src/payment/postfinance-checkout/handler-express.ts +8 -8
  291. package/src/payment/postfinance-checkout/handler-fastify.ts +7 -4
  292. package/src/payment/postfinance-checkout/index.ts +20 -8
  293. package/src/payment/saferpay/adapter.ts +14 -2
  294. package/src/payment/saferpay/handler-express.ts +14 -13
  295. package/src/payment/saferpay/handler-fastify.ts +14 -9
  296. package/src/payment/stripe/handler-express.ts +33 -33
  297. package/src/payment/stripe/handler-fastify.ts +40 -27
  298. package/src/payment/stripe/index.ts +18 -16
  299. package/src/payment/stripe/stripe.ts +17 -12
  300. package/src/presets/all.ts +3 -1
  301. package/src/pricing/delivery-swiss-tax.ts +16 -31
  302. package/src/pricing/order-discount.ts +6 -4
  303. package/src/pricing/order-round.ts +5 -4
  304. package/src/pricing/product-catalog-price-options.ts +67 -0
  305. package/src/pricing/product-catalog-price.ts +25 -2
  306. package/src/pricing/product-price-rateconversion.ts +3 -3
  307. package/src/pricing/product-swiss-tax.ts +39 -40
  308. package/src/pricing/tax/ch.ts +33 -7
  309. package/src/pricing/utils/isDeliveryAddressInCountry.test.ts +106 -0
  310. package/src/pricing/utils/isDeliveryAddressInCountry.ts +26 -0
  311. package/src/warehousing/eth-minter.ts +30 -11
  312. package/src/worker/budgetsms.ts +268 -0
  313. package/src/worker/bulk-import.ts +12 -53
  314. package/src/worker/bulkgate.ts +138 -0
  315. package/src/worker/email.ts +30 -8
  316. package/src/worker/enrollment-order-generator.ts +14 -72
  317. package/src/worker/error-notifications.ts +2 -2
  318. package/src/worker/export-token.ts +0 -1
  319. package/src/worker/message.ts +5 -3
  320. package/src/worker/{sms.ts → twilio.ts} +15 -26
  321. package/src/pricing/product-swiss-tax.test.ts +0 -139
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/plugins",
3
- "version": "4.0.0-rc.8",
3
+ "version": "4.0.0",
4
4
  "main": "lib/plugins-index.js",
5
5
  "types": "lib/plugins-index.d.ts",
6
6
  "exports": {
@@ -34,37 +34,34 @@
34
34
  },
35
35
  "homepage": "https://github.com/unchainedshop/unchained#readme",
36
36
  "dependencies": {
37
- "@unchainedshop/api": "^4.0.0-rc.4",
38
- "@unchainedshop/core-delivery": "^4.0.0-rc.4",
39
- "@unchainedshop/core-enrollments": "^4.0.0-rc.4",
40
- "@unchainedshop/core-orders": "^4.0.0-rc.4",
41
- "@unchainedshop/core-payment": "^4.0.0-rc.4",
42
- "@unchainedshop/core-products": "^4.0.0-rc.4",
43
- "@unchainedshop/core-warehousing": "^4.0.0-rc.4",
44
- "@unchainedshop/core-worker": "^4.0.0-rc.4",
45
- "@unchainedshop/events": "^4.0.0-rc.4",
46
- "@unchainedshop/file-upload": "^4.0.0-rc.4",
47
- "@unchainedshop/logger": "^4.0.0-rc.4",
48
- "@unchainedshop/utils": "^4.0.0-rc.4",
49
- "event-iterator": "^2.0.0",
50
- "JSONStream": "^1.3.5"
37
+ "@unchainedshop/api": "^4.0.0",
38
+ "@unchainedshop/core-delivery": "^4.0.0",
39
+ "@unchainedshop/core-enrollments": "^4.0.0",
40
+ "@unchainedshop/core-orders": "^4.0.0",
41
+ "@unchainedshop/core-payment": "^4.0.0",
42
+ "@unchainedshop/core-products": "^4.0.0",
43
+ "@unchainedshop/core-warehousing": "^4.0.0",
44
+ "@unchainedshop/core-worker": "^4.0.0",
45
+ "@unchainedshop/events": "^4.0.0",
46
+ "@unchainedshop/file-upload": "^4.0.0",
47
+ "@unchainedshop/logger": "^4.0.0",
48
+ "@unchainedshop/utils": "^4.0.0"
51
49
  },
52
50
  "peerDependencies": {
53
51
  "@aws-sdk/client-eventbridge": ">= 3.714 < 4",
54
52
  "@breejs/later": "^4.2.0",
55
53
  "@paypal/checkout-server-sdk": "1.x",
56
54
  "@redis/client": ">= 1 < 6",
57
- "@scure/bip32": ">= 1.7 < 2",
58
- "@scure/btc-signer": ">= 1.8 < 2",
55
+ "@scure/bip32": ">= 2",
56
+ "@scure/btc-signer": ">= 2",
57
+ "mime": ">= 4 < 5",
59
58
  "expiry-map": "2.x",
60
59
  "express": ">= 5 < 6",
61
60
  "fastify": ">= 5.2 < 6",
62
- "mime-types": ">= 2 < 4",
63
61
  "minio": "8.x",
64
62
  "nodemailer": ">= 6.9 < 8",
65
- "open": "10.x",
66
- "p-memoize": "7.x",
67
- "stripe": ">= 17 < 19",
63
+ "p-memoize": "8.x",
64
+ "stripe": ">= 19 < 20",
68
65
  "web-push": ">= 3.6 <4",
69
66
  "xml-js": ">= 1.6 < 2"
70
67
  },
@@ -96,18 +93,12 @@
96
93
  "fastify": {
97
94
  "optional": true
98
95
  },
99
- "mime-types": {
100
- "optional": true
101
- },
102
96
  "minio": {
103
97
  "optional": true
104
98
  },
105
99
  "nodemailer": {
106
100
  "optional": true
107
101
  },
108
- "open": {
109
- "optional": true
110
- },
111
102
  "p-memoize": {
112
103
  "optional": true
113
104
  },
@@ -125,20 +116,18 @@
125
116
  "@breejs/later": "^4.2.0",
126
117
  "@paypal/checkout-server-sdk": "^1.0.3",
127
118
  "@redis/client": "^5.6.0",
128
- "@scure/bip32": "^1.7.0",
129
- "@scure/btc-signer": "^1.8.1",
119
+ "@scure/bip32": "^2.0.0",
120
+ "@scure/btc-signer": "^2.0.0",
130
121
  "@types/breejs__later": "^4.1.5",
131
122
  "@types/express": "^5.0.3",
132
123
  "@types/node": "^24.0.13",
133
124
  "expiry-map": "^2.0.0",
134
125
  "express": "^5.1.0",
135
126
  "fastify": "^5.4.0",
136
- "mime-types": "^3.0.1",
137
127
  "minio": "^8.0.5",
138
128
  "nodemailer": "^7.0.5",
139
- "open": "^10.1.2",
140
- "p-memoize": "^7.1.1",
141
- "stripe": "^18.3.0",
129
+ "p-memoize": "^8.0.0",
130
+ "stripe": "^19.1.0",
142
131
  "tsx": "^4.20.3",
143
132
  "typescript": "^5.8.3",
144
133
  "web-push": "^3.6.7",
@@ -38,7 +38,7 @@ const SendMessage: IDeliveryAdapter = {
38
38
  retries: 0,
39
39
  input: {
40
40
  template: 'DELIVERY',
41
- orderId: order._id,
41
+ orderId: order!._id,
42
42
  config,
43
43
  },
44
44
  });
@@ -21,11 +21,12 @@ const LicensedEnrollments: IEnrollmentAdapter = {
21
21
  },
22
22
 
23
23
  actions: (params) => {
24
+ const { enrollment } = params;
24
25
  return {
25
26
  ...EnrollmentAdapter.actions(params),
26
27
 
27
28
  isValidForActivation: async () => {
28
- const periods = params.enrollment?.periods || [];
29
+ const periods = enrollment?.periods || [];
29
30
  return periods.findIndex(rangeMatcher()) !== -1;
30
31
  },
31
32
 
@@ -36,8 +37,20 @@ const LicensedEnrollments: IEnrollmentAdapter = {
36
37
  configurationForOrder: async (context) => {
37
38
  const { period } = context;
38
39
  const beginningOfPeriod = period.start.getTime() <= new Date().getTime();
40
+
41
+ if (!enrollment) throw new Error('Enrollment missing in context');
39
42
  if (beginningOfPeriod) {
40
- return context;
43
+ return {
44
+ period,
45
+ orderContext: {},
46
+ orderPositionTemplates: [
47
+ {
48
+ quantity: 1,
49
+ productId: enrollment.productId,
50
+ originalProductId: enrollment.productId,
51
+ },
52
+ ],
53
+ };
41
54
  }
42
55
  return null;
43
56
  },
@@ -1,6 +1,6 @@
1
1
  import { Readable, PassThrough } from 'node:stream';
2
- import { pipeline } from 'node:stream/promises';
3
- import mimeType from 'mime-types';
2
+ import { finished, pipeline } from 'node:stream/promises';
3
+ import mime from 'mime/lite';
4
4
  import {
5
5
  FileAdapter,
6
6
  FileDirector,
@@ -36,7 +36,7 @@ export const GridFSAdapter: IFileAdapter<
36
36
  ...FileAdapter,
37
37
  async createDownloadURL(file, expiry) {
38
38
  // If public, just return the stored path from the db
39
- if (!file.meta?.isPrivate) return file?.url;
39
+ if (!file?.meta?.isPrivate) return file?.url || null;
40
40
 
41
41
  const expiryTimestamp =
42
42
  expiry ||
@@ -63,7 +63,7 @@ export const GridFSAdapter: IFileAdapter<
63
63
  directoryName,
64
64
  expiryDate,
65
65
  fileName,
66
- type: mimeType.lookup(fileName),
66
+ type: mime.getType(fileName),
67
67
  putURL,
68
68
  url,
69
69
  } as UploadFileData & { putURL: string };
@@ -83,7 +83,7 @@ export const GridFSAdapter: IFileAdapter<
83
83
 
84
84
  const expiryDate = resolveExpirationDate();
85
85
  const hashedFilename = await buildHashedFilename(directoryName, fileName, expiryDate);
86
- const type = mimeType.lookup(fileName) || (await Promise.resolve(rawFile)).mimetype;
86
+ const type = mime.getType(fileName) || (await Promise.resolve(rawFile)).mimetype;
87
87
 
88
88
  const writeStream = await modules.gridfsFileUploads.createWriteStream(
89
89
  directoryName,
@@ -91,14 +91,19 @@ export const GridFSAdapter: IFileAdapter<
91
91
  fileName,
92
92
  {
93
93
  metadata: { 'content-type': type },
94
+ chunkSizeBytes: 1024 * 1024, // 1MB
94
95
  ...options,
95
96
  },
96
97
  );
98
+
97
99
  await pipeline(
98
100
  stream,
99
- new PassThrough({ allowHalfOpen: true, highWaterMark: 1024 * 1024 }),
101
+ new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
100
102
  writeStream,
101
103
  );
104
+
105
+ await finished(writeStream, { readable: false });
106
+
102
107
  const { length } = writeStream;
103
108
  const url = `/gridfs/${directoryName}/${encodeURIComponent(hashedFilename)}`;
104
109
 
@@ -126,7 +131,7 @@ export const GridFSAdapter: IFileAdapter<
126
131
 
127
132
  const response = await fetch(href, { headers });
128
133
  if (!response.ok) throw new Error(`Unexpected response for ${href}: ${response.statusText}`);
129
- const type = mimeType.lookup(fileName) || response.headers.get('content-type');
134
+ const type = mime.getType(fileName) || response.headers.get('content-type');
130
135
 
131
136
  const writeStream = await modules.gridfsFileUploads.createWriteStream(
132
137
  directoryName,
@@ -10,7 +10,7 @@ import { getFileAdapter } from '@unchainedshop/core-files';
10
10
 
11
11
  const { ROOT_URL } = process.env;
12
12
 
13
- const logger = createLogger('unchained:plugins:gridfs');
13
+ const logger = createLogger('unchained:gridfs');
14
14
 
15
15
  const gridfsHandler = async (
16
16
  req: express.Request & {
@@ -34,8 +34,7 @@ const gridfsHandler = async (
34
34
  res.setHeader('Access-Control-Allow-Origin', '*');
35
35
 
36
36
  if (req.method === 'OPTIONS') {
37
- res.statusCode = 200;
38
- res.end();
37
+ res.status(200).end();
39
38
  return;
40
39
  }
41
40
 
@@ -45,9 +44,14 @@ const gridfsHandler = async (
45
44
  const fileId = await buildHashedFilename(directoryName, fileName, expiryDate);
46
45
  if ((await sign(directoryName, fileId, expiryDate.getTime())) === signature) {
47
46
  const file = await modules.files.findFile({ fileId });
47
+
48
+ if (!file) {
49
+ res.status(404).send('File not found');
50
+ return;
51
+ }
52
+
48
53
  if (file.expires === null) {
49
- res.statusCode = 400;
50
- res.end('File already linked');
54
+ res.status(400).send('File already linked');
51
55
  return;
52
56
  }
53
57
  // If the type is octet-stream, prefer mimetype lookup from the filename
@@ -62,24 +66,25 @@ const gridfsHandler = async (
62
66
  fileId,
63
67
  fileName,
64
68
  {
69
+ chunkSizeBytes: 1024 * 1024, // 1MB
65
70
  metadata: { 'content-type': type },
66
71
  },
67
72
  );
68
73
  await pipeline(
69
74
  req,
70
- new PassThrough({ allowHalfOpen: true, highWaterMark: 1024 * 1024 }),
75
+ new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
71
76
  writeStream,
72
77
  );
73
78
 
79
+ await finished(writeStream, { readable: false });
80
+
74
81
  const { length } = writeStream;
75
82
  await services.files.linkFile({ fileId, size: length, type });
76
83
 
77
- res.statusCode = 200;
78
- res.end();
84
+ res.status(200).end();
79
85
  return;
80
86
  }
81
- res.statusCode = 403;
82
- res.end();
87
+ res.status(403).end();
83
88
  return;
84
89
  }
85
90
 
@@ -91,22 +96,19 @@ const gridfsHandler = async (
91
96
  if (fileDocument?.meta?.isPrivate) {
92
97
  const expiry = parseInt(expiryTimestamp as string, 10);
93
98
  if (expiry <= Date.now()) {
94
- res.statusCode = 403;
95
- res.end('Access restricted: Expired.');
99
+ res.status(403).send('Access restricted: Expired.');
96
100
  return;
97
101
  }
98
102
 
99
103
  const fileUploadAdapter = getFileAdapter();
100
104
  const signedUrl = await fileUploadAdapter.createDownloadURL(fileDocument, expiry);
101
105
 
102
- if (new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
103
- res.statusCode = 403;
104
- res.end('Access restricted: Invalid signature.');
106
+ if (!signedUrl || new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
107
+ res.status(403).send('Access restricted: Invalid signature.');
105
108
  return;
106
109
  }
107
110
  } else if (!fileDocument) {
108
- res.statusCode = 404;
109
- res.end();
111
+ res.status(404).end();
110
112
  return;
111
113
  }
112
114
  if (file?.metadata?.['content-type']) {
@@ -119,21 +121,17 @@ const gridfsHandler = async (
119
121
  const readStream = await modules.gridfsFileUploads.createReadStream(directoryName, fileId);
120
122
  readStream.pipe(res, { end: false });
121
123
  await finished(readStream);
122
- res.statusCode = 200;
123
- res.end();
124
+ res.status(200).end();
124
125
  return;
125
126
  }
126
- res.statusCode = 404;
127
- res.end();
127
+ res.status(404).end();
128
128
  } catch (e) {
129
129
  if (e.code === 'ENOENT') {
130
130
  logger.warn(e);
131
- res.statusCode = 404;
132
- res.end(e.message);
131
+ res.status(404).send();
133
132
  } else {
134
133
  logger.warn(e);
135
- res.statusCode = 503;
136
- res.end(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
134
+ res.status(503).send({ name: e.name, code: e.code, message: e.message });
137
135
  }
138
136
  }
139
137
  };
@@ -1,4 +1,4 @@
1
- import { pipeline } from 'node:stream/promises';
1
+ import { finished, pipeline } from 'node:stream/promises';
2
2
  import { PassThrough } from 'node:stream';
3
3
  import { FastifyRequest, RouteHandlerMethod } from 'fastify';
4
4
  import { buildHashedFilename } from '@unchainedshop/file-upload';
@@ -8,7 +8,7 @@ import { Context } from '@unchainedshop/api';
8
8
  import { createLogger } from '@unchainedshop/logger';
9
9
  import { getFileAdapter } from '@unchainedshop/core-files';
10
10
 
11
- const logger = createLogger('unchained:plugins:gridfs');
11
+ const logger = createLogger('unchained:gridfs');
12
12
 
13
13
  const gridfsHandler: RouteHandlerMethod = async (
14
14
  req: FastifyRequest & {
@@ -39,9 +39,25 @@ const gridfsHandler: RouteHandlerMethod = async (
39
39
  const fileId = await buildHashedFilename(directoryName, fileName, expiryDate);
40
40
  if ((await sign(directoryName, fileId, expiryDate.getTime())) === signature) {
41
41
  const file = await modules.files.findFile({ fileId });
42
+
43
+ if (!file) {
44
+ reply.status(404);
45
+ logger.error('File not found', { fileId });
46
+ return reply.send({
47
+ success: false,
48
+ message: 'File not found',
49
+ name: 'FILE_NOT_FOUND',
50
+ });
51
+ }
52
+
42
53
  if (file.expires === null) {
43
54
  reply.status(400);
44
- return reply.send('File already linked');
55
+ logger.error('File already linked', { fileId });
56
+ return reply.send({
57
+ success: false,
58
+ message: 'File already linked',
59
+ name: 'FILE_ALREADY_LINKED',
60
+ });
45
61
  }
46
62
  // If the type is octet-stream, prefer mimetype lookup from the filename
47
63
  // Else prefer the content-type header
@@ -55,25 +71,37 @@ const gridfsHandler: RouteHandlerMethod = async (
55
71
  fileId,
56
72
  fileName,
57
73
  {
74
+ chunkSizeBytes: 1024 * 1024, // 1MB
58
75
  metadata: { 'content-type': type },
59
76
  },
60
77
  );
61
78
 
62
79
  await pipeline(
63
80
  req.raw,
64
- new PassThrough({ allowHalfOpen: true, highWaterMark: 1024 * 1024 }),
81
+ new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
65
82
  writeStream,
66
83
  );
67
84
 
85
+ await finished(writeStream, { readable: false });
86
+
68
87
  const { length } = writeStream;
69
88
  await services.files.linkFile({ fileId, size: length, type });
70
89
 
71
90
  reply.status(200);
72
- return reply.send();
91
+ return reply.send({
92
+ success: true,
93
+ fileId,
94
+ size: length,
95
+ type,
96
+ });
73
97
  }
74
-
98
+ logger.error('Invalid signature', { fileId, expiryDate });
75
99
  reply.status(403);
76
- return reply.send();
100
+ return reply.send({
101
+ success: false,
102
+ message: 'Access restricted: Invalid signature.',
103
+ name: 'INVALID_SIGNATURE',
104
+ });
77
105
  }
78
106
 
79
107
  if (req.method === 'GET') {
@@ -84,18 +112,29 @@ const gridfsHandler: RouteHandlerMethod = async (
84
112
  if (fileDocument?.meta?.isPrivate) {
85
113
  const expiry = parseInt(expiryTimestamp as string, 10);
86
114
  if (expiry <= Date.now()) {
115
+ logger.error('URL Expired', { fileId, expiry });
87
116
  reply.status(403);
88
- return reply.send('Access restricted: Expired.');
117
+ return reply.send({
118
+ success: false,
119
+ message: 'Access restricted: URL expired.',
120
+ name: 'URL_EXPIRED',
121
+ });
89
122
  }
90
123
 
91
124
  const fileUploadAdapter = getFileAdapter();
92
125
  const signedUrl = await fileUploadAdapter.createDownloadURL(fileDocument, expiry);
93
126
 
94
- if (new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
127
+ if (!signedUrl || new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
95
128
  reply.status(403);
96
- return reply.send('Access restricted: Invalid signature.');
129
+ logger.error('Invalid signature', { fileId, expiry });
130
+ return reply.send({
131
+ success: false,
132
+ message: 'Access restricted: Invalid signature.',
133
+ name: 'INVALID_SIGNATURE',
134
+ });
97
135
  }
98
136
  } else if (!fileDocument) {
137
+ logger.error('File not found', { fileId });
99
138
  reply.status(404);
100
139
  return reply.send();
101
140
  }
@@ -116,14 +155,14 @@ const gridfsHandler: RouteHandlerMethod = async (
116
155
  reply.status(404);
117
156
  return reply.send();
118
157
  } catch (e) {
158
+ logger.error(e);
159
+
119
160
  if (e.code === 'ENOENT') {
120
- logger.warn(e);
121
161
  reply.status(404);
122
- return reply.send({ name: e.name, code: e.code, message: e.message });
162
+ return reply.send();
123
163
  } else {
124
- logger.warn(e);
125
164
  reply.status(504);
126
- return reply.send({ name: e.name, code: e.code, message: e.message });
165
+ return reply.send({ success: false, name: e.name, code: e.code, message: e.message });
127
166
  }
128
167
  }
129
168
  };
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from '@unchainedshop/logger';
2
2
 
3
- const logger = createLogger('unchained:plugins:minio');
3
+ const logger = createLogger('unchained:minio');
4
4
 
5
5
  const { MINIO_WEBHOOK_AUTH_TOKEN } = process.env;
6
6
 
@@ -21,17 +21,14 @@ const minioHandler = async (req, res) => {
21
21
  const [fileId] = object.key.split('.');
22
22
  const { services } = req.unchainedContext;
23
23
  await services.files.linkFile({ fileId, type, size });
24
- res.writeHead(200);
25
- res.end();
24
+ res.status(200).end();
26
25
  return;
27
26
  }
28
27
  }
29
- res.writeHead(404);
30
- res.end();
28
+ res.status(404).end();
31
29
  } catch (e) {
32
30
  logger.error(e);
33
- res.writeHead(503);
34
- res.end(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
31
+ res.status(503).send({ name: e.name, code: e.code, message: e.message });
35
32
  }
36
33
  };
37
34
 
@@ -2,7 +2,7 @@ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import { FastifyRequest, RouteHandlerMethod } from 'fastify';
4
4
 
5
- const logger = createLogger('unchained:plugins:minio');
5
+ const logger = createLogger('unchained:minio');
6
6
 
7
7
  const { MINIO_WEBHOOK_AUTH_TOKEN } = process.env;
8
8
 
@@ -37,7 +37,7 @@ const minioHandler: RouteHandlerMethod = async (
37
37
  } catch (e) {
38
38
  logger.error(e);
39
39
  res.status(503);
40
- return res.send(JSON.stringify({ name: e.name, code: e.code, message: e.message }));
40
+ return res.send({ name: e.name, code: e.code, message: e.message });
41
41
  }
42
42
  };
43
43
 
@@ -8,13 +8,13 @@ import {
8
8
  resolveExpirationDate,
9
9
  IFileAdapter,
10
10
  } from '@unchainedshop/file-upload';
11
- import mimeType from 'mime-types';
11
+ import mime from 'mime/lite';
12
12
  import { Client } from 'minio';
13
13
  import { AssumeRoleProvider } from 'minio/dist/esm/AssumeRoleProvider.mjs';
14
14
  import { expiryOffsetInMs } from '@unchainedshop/file-upload/lib/put-expiration.js';
15
15
  import { createLogger } from '@unchainedshop/logger';
16
16
 
17
- const logger = createLogger('unchained:plugins:minio');
17
+ const logger = createLogger('unchained:minio');
18
18
 
19
19
  const {
20
20
  MINIO_ACCESS_KEY,
@@ -28,7 +28,7 @@ const {
28
28
  AMAZON_S3_SESSION_TOKEN,
29
29
  } = process.env;
30
30
 
31
- let client: Client;
31
+ let client: Client | null = null;
32
32
 
33
33
  export async function connectToMinio() {
34
34
  if (!MINIO_ENDPOINT || !MINIO_BUCKET_NAME) {
@@ -56,8 +56,8 @@ export async function connectToMinio() {
56
56
  if (MINIO_STS_ENDPOINT) {
57
57
  const ap = new AssumeRoleProvider({
58
58
  stsEndpoint: MINIO_STS_ENDPOINT,
59
- accessKey: MINIO_ACCESS_KEY,
60
- secretKey: MINIO_SECRET_KEY,
59
+ accessKey: MINIO_ACCESS_KEY!,
60
+ secretKey: MINIO_SECRET_KEY!,
61
61
  });
62
62
  // eslint-disable-next-line
63
63
  // @ts-ignore
@@ -76,17 +76,17 @@ const generateMinioPath = (directoryName: string, fileName: string) => {
76
76
  };
77
77
 
78
78
  const generateMinioUrl = (directoryName: string, hashedFilename: string) => {
79
- return `${MINIO_ENDPOINT}/${MINIO_BUCKET_NAME}/${generateMinioPath(directoryName, hashedFilename)}`;
79
+ return `${MINIO_ENDPOINT}/${MINIO_BUCKET_NAME!}/${generateMinioPath(directoryName, hashedFilename)}`;
80
80
  };
81
81
 
82
82
  connectToMinio().then(function setClient(c) {
83
- client = c;
83
+ client = c || client;
84
84
  });
85
85
 
86
86
  const getObjectStats = async (fileName: string) => {
87
87
  if (!client) throw new Error('Minio not connected, check env variables');
88
88
 
89
- return client.statObject(MINIO_BUCKET_NAME, fileName);
89
+ return client.statObject(MINIO_BUCKET_NAME!, fileName);
90
90
  };
91
91
 
92
92
  const bufferToStream = (buffer: any) => {
@@ -116,7 +116,7 @@ export const MinioAdapter: IFileAdapter = {
116
116
  const _id = await buildHashedFilename(directoryName, fileName, expiryDate);
117
117
 
118
118
  const url = await client.presignedPutObject(
119
- MINIO_BUCKET_NAME,
119
+ MINIO_BUCKET_NAME!,
120
120
  generateMinioPath(directoryName, _id),
121
121
  expiryOffsetInMs() / 1000,
122
122
  );
@@ -126,7 +126,7 @@ export const MinioAdapter: IFileAdapter = {
126
126
  directoryName,
127
127
  expiryDate,
128
128
  fileName,
129
- type: mimeType.lookup(fileName),
129
+ type: mime.getType(fileName),
130
130
  putURL: url,
131
131
  url: generateMinioUrl(directoryName, _id),
132
132
  } as UploadFileData & { putURL: string };
@@ -139,7 +139,7 @@ export const MinioAdapter: IFileAdapter = {
139
139
  return `${path}/${_id}`;
140
140
  });
141
141
 
142
- await client.removeObjects(MINIO_BUCKET_NAME, fileIds);
142
+ await client.removeObjects(MINIO_BUCKET_NAME!, fileIds);
143
143
  },
144
144
 
145
145
  async uploadFileFromStream(directoryName: string, rawFile: any) {
@@ -157,14 +157,14 @@ export const MinioAdapter: IFileAdapter = {
157
157
  }
158
158
 
159
159
  const _id = await buildHashedFilename(directoryName, fileName, new Date());
160
- const type = mimeType.lookup(fileName) || (await Promise.resolve(rawFile)).mimetype;
160
+ const type = mime.getType(fileName) || (await Promise.resolve(rawFile)).mimetype;
161
161
 
162
162
  const metaData = {
163
163
  'Content-Type': type,
164
164
  };
165
165
 
166
166
  await client.putObject(
167
- MINIO_BUCKET_NAME,
167
+ MINIO_BUCKET_NAME!,
168
168
  generateMinioPath(directoryName, _id),
169
169
  stream,
170
170
  undefined,
@@ -193,14 +193,14 @@ export const MinioAdapter: IFileAdapter = {
193
193
 
194
194
  const url = new URL(fileLink);
195
195
  const response = await fetch(url, { headers });
196
- const type = mimeType.lookup(fileName) || response.headers['content-type'];
196
+ const type = mime.getType(fileName) || response.headers['content-type'];
197
197
  const readable = Readable.fromWeb(response.body as ReadableStream<Uint8Array<ArrayBufferLike>>);
198
198
  const metaData = {
199
199
  'Content-Type': type,
200
200
  };
201
201
 
202
202
  await client.putObject(
203
- MINIO_BUCKET_NAME,
203
+ MINIO_BUCKET_NAME!,
204
204
  generateMinioPath(directoryName, hashedFilename),
205
205
  readable,
206
206
  undefined,
@@ -222,7 +222,7 @@ export const MinioAdapter: IFileAdapter = {
222
222
  async createDownloadStream(file) {
223
223
  if (!client) throw new Error('Minio not connected, check env variables');
224
224
 
225
- const stream = await client.getObject(MINIO_BUCKET_NAME, generateMinioPath(file.path, file._id));
225
+ const stream = await client.getObject(MINIO_BUCKET_NAME!, generateMinioPath(file.path, file._id));
226
226
  return stream;
227
227
  },
228
228
  };
@@ -5,7 +5,7 @@ import { FilterDirector, FilterAdapter, IFilterAdapter } from '@unchainedshop/co
5
5
  import { createLogger } from '@unchainedshop/logger';
6
6
  import { isDocumentDBCompatModeEnabled } from '@unchainedshop/mongodb';
7
7
 
8
- const logger = createLogger('unchained:core-filters:local-search');
8
+ const logger = createLogger('unchained:local-search');
9
9
 
10
10
  const LocalSearch: IFilterAdapter = {
11
11
  ...FilterAdapter,