@unchainedshop/plugins 4.3.5 → 4.5.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.
- package/README.md +137 -0
- package/lib/delivery/post.d.ts +0 -1
- package/lib/delivery/post.js +0 -1
- package/lib/delivery/send-message.d.ts +0 -1
- package/lib/delivery/send-message.js +0 -1
- package/lib/delivery/stores.d.ts +0 -1
- package/lib/delivery/stores.js +0 -1
- package/lib/enrollments/licensed.d.ts +0 -1
- package/lib/enrollments/licensed.js +0 -1
- package/lib/events/aws-eventbridge.d.ts +0 -1
- package/lib/events/aws-eventbridge.js +0 -3
- package/lib/events/node-event-emitter.d.ts +0 -1
- package/lib/events/node-event-emitter.js +0 -1
- package/lib/events/redis.d.ts +0 -1
- package/lib/events/redis.js +0 -1
- package/lib/files/gridfs/adapter.d.ts +3 -4
- package/lib/files/gridfs/adapter.js +6 -6
- package/lib/files/gridfs/handler-express.d.ts +2 -3
- package/lib/files/gridfs/handler-express.js +6 -9
- package/lib/files/gridfs/handler-fastify.d.ts +1 -2
- package/lib/files/gridfs/handler-fastify.js +6 -9
- package/lib/files/gridfs/index.d.ts +2 -3
- package/lib/files/gridfs/index.js +2 -3
- package/lib/files/gridfs/module.d.ts +0 -1
- package/lib/files/gridfs/module.js +0 -4
- package/lib/files/gridfs/sign.d.ts +0 -1
- package/lib/files/gridfs/sign.js +0 -1
- package/lib/files/minio/handler-express.d.ts +0 -1
- package/lib/files/minio/handler-express.js +0 -1
- package/lib/files/minio/handler-fastify.d.ts +1 -2
- package/lib/files/minio/handler-fastify.js +2 -1
- package/lib/files/minio/index.d.ts +1 -2
- package/lib/files/minio/index.js +1 -5
- package/lib/filters/local-search.d.ts +1 -2
- package/lib/filters/local-search.js +8 -20
- package/lib/filters/strict-equal.d.ts +0 -1
- package/lib/filters/strict-equal.js +0 -1
- package/lib/payment/apple-iap/adapter.d.ts +0 -1
- package/lib/payment/apple-iap/adapter.js +3 -5
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -2
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +2 -1
- package/lib/payment/apple-iap/fix-periods.d.ts +1 -2
- package/lib/payment/apple-iap/fix-periods.js +1 -1
- package/lib/payment/apple-iap/handler-express.d.ts +0 -1
- package/lib/payment/apple-iap/handler-express.js +2 -5
- package/lib/payment/apple-iap/handler-fastify.d.ts +1 -2
- package/lib/payment/apple-iap/handler-fastify.js +4 -5
- package/lib/payment/apple-iap/index.d.ts +2 -3
- package/lib/payment/apple-iap/index.js +2 -3
- package/lib/payment/apple-iap/module.d.ts +1 -2
- package/lib/payment/apple-iap/module.js +1 -2
- package/lib/payment/apple-iap/verify-receipt.d.ts +0 -1
- package/lib/payment/apple-iap/verify-receipt.js +0 -4
- package/lib/payment/braintree.d.ts +0 -1
- package/lib/payment/braintree.js +0 -5
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -2
- package/lib/payment/cryptopay/db/CryptopayTransactions.js +2 -1
- package/lib/payment/cryptopay/denote-amount.d.ts +0 -24
- package/lib/payment/cryptopay/denote-amount.js +2 -26
- package/lib/payment/cryptopay/derive-btc-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js +4 -14
- package/lib/payment/cryptopay/derive-eth-address.d.ts +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js +1 -3
- package/lib/payment/cryptopay/handle-webhook.d.ts +2 -3
- package/lib/payment/cryptopay/handle-webhook.js +3 -3
- package/lib/payment/cryptopay/handler-express.d.ts +0 -1
- package/lib/payment/cryptopay/handler-express.js +1 -2
- package/lib/payment/cryptopay/handler-fastify.d.ts +1 -2
- package/lib/payment/cryptopay/handler-fastify.js +2 -2
- package/lib/payment/cryptopay/index.d.ts +2 -3
- package/lib/payment/cryptopay/index.js +2 -3
- package/lib/payment/cryptopay/module.d.ts +1 -2
- package/lib/payment/cryptopay/module.js +2 -3
- package/lib/payment/cryptopay/plugin.d.ts +1 -2
- package/lib/payment/cryptopay/plugin.js +8 -37
- package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorize.js +0 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/cancel.js +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts +8 -9
- package/lib/payment/datatrans-v2/api/index.js +9 -10
- package/lib/payment/datatrans-v2/api/init.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/init.js +2 -4
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -3
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/secureFields.js +1 -3
- package/lib/payment/datatrans-v2/api/settle.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/settle.js +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/status.js +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts +0 -1
- package/lib/payment/datatrans-v2/api/types.js +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts +1 -2
- package/lib/payment/datatrans-v2/api/validate.js +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js +0 -2
- package/lib/payment/datatrans-v2/getPaths.d.ts +0 -1
- package/lib/payment/datatrans-v2/getPaths.js +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts +0 -1
- package/lib/payment/datatrans-v2/handler-express.js +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.d.ts +1 -2
- package/lib/payment/datatrans-v2/handler-fastify.js +1 -2
- package/lib/payment/datatrans-v2/index.d.ts +0 -1
- package/lib/payment/datatrans-v2/index.js +3 -14
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -5
- package/lib/payment/datatrans-v2/parseRegistrationData.js +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +1 -2
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js +0 -2
- package/lib/payment/invoice-prepaid.d.ts +0 -1
- package/lib/payment/invoice-prepaid.js +0 -1
- package/lib/payment/invoice.d.ts +0 -1
- package/lib/payment/invoice.js +0 -1
- package/lib/payment/paypal-checkout.d.ts +0 -1
- package/lib/payment/paypal-checkout.js +0 -11
- package/lib/payment/payrexx/api/index.d.ts +15 -15
- package/lib/payment/payrexx/api/index.js +15 -27
- package/lib/payment/payrexx/api/makeFetcher.d.ts +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js +0 -1
- package/lib/payment/payrexx/handler-express.d.ts +0 -1
- package/lib/payment/payrexx/handler-express.js +0 -4
- package/lib/payment/payrexx/handler-fastify.d.ts +1 -2
- package/lib/payment/payrexx/handler-fastify.js +0 -4
- package/lib/payment/payrexx/index.d.ts +0 -1
- package/lib/payment/payrexx/index.js +9 -35
- package/lib/payment/payrexx/payrexx.d.ts +0 -1
- package/lib/payment/payrexx/payrexx.js +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts +0 -1
- package/lib/payment/postfinance-checkout/api-client.js +0 -6
- package/lib/payment/postfinance-checkout/api-types.d.ts +49 -44
- package/lib/payment/postfinance-checkout/api-types.js +43 -51
- package/lib/payment/postfinance-checkout/api.d.ts +1 -2
- package/lib/payment/postfinance-checkout/api.js +2 -3
- package/lib/payment/postfinance-checkout/handler-express.d.ts +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts +1 -2
- package/lib/payment/postfinance-checkout/handler-fastify.js +1 -2
- package/lib/payment/postfinance-checkout/index.d.ts +2 -3
- package/lib/payment/postfinance-checkout/index.js +7 -10
- package/lib/payment/postfinance-checkout/types.d.ts +11 -10
- package/lib/payment/postfinance-checkout/types.js +9 -12
- package/lib/payment/postfinance-checkout/utils.d.ts +2 -3
- package/lib/payment/postfinance-checkout/utils.js +1 -2
- package/lib/payment/saferpay/adapter.d.ts +1 -2
- package/lib/payment/saferpay/adapter.js +2 -5
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts +6 -7
- package/lib/payment/saferpay/api/api/SaferpayClient.js +2 -2
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js +0 -1
- package/lib/payment/saferpay/api/index.d.ts +4 -5
- package/lib/payment/saferpay/api/index.js +1 -2
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts +4 -5
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Request.js +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Response.js +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts +2 -3
- package/lib/payment/saferpay/api/models/TransactionCancel.js +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts +3 -4
- package/lib/payment/saferpay/api/models/TransactionCapture.js +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts +0 -1
- package/lib/payment/saferpay/buildSignature.js +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -2
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js +1 -1
- package/lib/payment/saferpay/getReturnPath.d.ts +0 -1
- package/lib/payment/saferpay/getReturnPath.js +0 -1
- package/lib/payment/saferpay/handler-express.d.ts +0 -1
- package/lib/payment/saferpay/handler-express.js +1 -2
- package/lib/payment/saferpay/handler-fastify.d.ts +1 -2
- package/lib/payment/saferpay/handler-fastify.js +1 -2
- package/lib/payment/saferpay/index.d.ts +2 -3
- package/lib/payment/saferpay/index.js +2 -3
- package/lib/payment/saferpay/module.d.ts +2 -3
- package/lib/payment/saferpay/module.js +2 -2
- package/lib/payment/stripe/handler-express.d.ts +0 -1
- package/lib/payment/stripe/handler-express.js +1 -2
- package/lib/payment/stripe/handler-fastify.d.ts +1 -2
- package/lib/payment/stripe/handler-fastify.js +1 -2
- package/lib/payment/stripe/index.d.ts +0 -1
- package/lib/payment/stripe/index.js +1 -4
- package/lib/payment/stripe/stripe.d.ts +1 -2
- package/lib/payment/stripe/stripe.js +2 -3
- package/lib/presets/all-express.d.ts +1 -2
- package/lib/presets/all-express.js +9 -10
- package/lib/presets/all-fastify.d.ts +2 -3
- package/lib/presets/all-fastify.js +9 -10
- package/lib/presets/all.d.ts +23 -24
- package/lib/presets/all.js +20 -25
- package/lib/presets/base-express.d.ts +0 -1
- package/lib/presets/base-express.js +1 -2
- package/lib/presets/base-fastify.d.ts +1 -2
- package/lib/presets/base-fastify.js +1 -3
- package/lib/presets/base.d.ts +23 -24
- package/lib/presets/base.js +23 -33
- package/lib/presets/countries/ch.d.ts +2 -3
- package/lib/presets/countries/ch.js +2 -3
- package/lib/presets/crypto-express.d.ts +1 -2
- package/lib/presets/crypto-express.js +2 -3
- package/lib/presets/crypto-fastify.d.ts +1 -2
- package/lib/presets/crypto-fastify.js +2 -3
- package/lib/presets/crypto.d.ts +6 -7
- package/lib/presets/crypto.js +6 -8
- package/lib/pricing/delivery-swiss-tax.d.ts +1 -2
- package/lib/pricing/delivery-swiss-tax.js +2 -3
- package/lib/pricing/discount-100-off.d.ts +1 -2
- package/lib/pricing/discount-100-off.js +0 -4
- package/lib/pricing/discount-half-price-manual.d.ts +1 -2
- package/lib/pricing/discount-half-price-manual.js +0 -4
- package/lib/pricing/discount-half-price.d.ts +1 -2
- package/lib/pricing/discount-half-price.js +0 -4
- package/lib/pricing/free-delivery.d.ts +1 -2
- package/lib/pricing/free-delivery.js +0 -1
- package/lib/pricing/free-payment.d.ts +1 -2
- package/lib/pricing/free-payment.js +0 -1
- package/lib/pricing/order-delivery.d.ts +1 -2
- package/lib/pricing/order-delivery.js +0 -2
- package/lib/pricing/order-discount.d.ts +1 -2
- package/lib/pricing/order-discount.js +0 -4
- package/lib/pricing/order-items-discount.d.ts +0 -1
- package/lib/pricing/order-items-discount.js +0 -5
- package/lib/pricing/order-items.d.ts +0 -1
- package/lib/pricing/order-items.js +0 -2
- package/lib/pricing/order-payment.d.ts +0 -1
- package/lib/pricing/order-payment.js +0 -2
- package/lib/pricing/order-round.d.ts +1 -2
- package/lib/pricing/order-round.js +0 -6
- package/lib/pricing/product-catalog-price-options.d.ts +0 -1
- package/lib/pricing/product-catalog-price-options.js +0 -1
- package/lib/pricing/product-catalog-price.d.ts +1 -2
- package/lib/pricing/product-catalog-price.js +2 -3
- package/lib/pricing/product-discount.d.ts +0 -1
- package/lib/pricing/product-discount.js +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts +1 -2
- package/lib/pricing/product-price-rateconversion.js +0 -4
- package/lib/pricing/product-round.d.ts +1 -2
- package/lib/pricing/product-round.js +0 -1
- package/lib/pricing/product-swiss-tax.d.ts +1 -2
- package/lib/pricing/product-swiss-tax.js +2 -5
- package/lib/pricing/tax/ch.d.ts +2 -3
- package/lib/pricing/tax/ch.js +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts +1 -2
- package/lib/pricing/utils/isDeliveryAddressInCountry.js +0 -1
- package/lib/quotations/manual.d.ts +0 -1
- package/lib/quotations/manual.js +0 -1
- package/lib/warehousing/eth-minter.d.ts +0 -1
- package/lib/warehousing/eth-minter.js +2 -11
- package/lib/warehousing/store.d.ts +0 -1
- package/lib/warehousing/store.js +0 -1
- package/lib/worker/budgetsms.d.ts +0 -1
- package/lib/worker/budgetsms.js +4 -52
- package/lib/worker/bulk-import.d.ts +1 -2
- package/lib/worker/bulk-import.js +1 -3
- package/lib/worker/bulkgate.d.ts +0 -1
- package/lib/worker/bulkgate.js +7 -20
- package/lib/worker/email.d.ts +0 -1
- package/lib/worker/email.js +0 -3
- package/lib/worker/enrollment-order-generator.d.ts +0 -1
- package/lib/worker/enrollment-order-generator.js +1 -2
- package/lib/worker/error-notifications.d.ts +1 -2
- package/lib/worker/error-notifications.js +2 -4
- package/lib/worker/export-token.d.ts +1 -2
- package/lib/worker/export-token.js +1 -2
- package/lib/worker/external.d.ts +1 -2
- package/lib/worker/external.js +0 -1
- package/lib/worker/heartbeat.d.ts +0 -1
- package/lib/worker/heartbeat.js +0 -1
- package/lib/worker/http-request.d.ts +1 -2
- package/lib/worker/http-request.js +0 -3
- package/lib/worker/message.d.ts +2 -3
- package/lib/worker/message.js +2 -3
- package/lib/worker/push-notification.d.ts +0 -1
- package/lib/worker/push-notification.js +0 -1
- package/lib/worker/twilio.d.ts +0 -1
- package/lib/worker/twilio.js +1 -2
- package/lib/worker/update-coinbase-rates.d.ts +0 -1
- package/lib/worker/update-coinbase-rates.js +3 -6
- package/lib/worker/update-ecb-rates.d.ts +0 -1
- package/lib/worker/update-ecb-rates.js +2 -6
- package/lib/worker/update-token-ownership.d.ts +1 -2
- package/lib/worker/update-token-ownership.js +4 -6
- package/lib/worker/zombie-killer.d.ts +1 -2
- package/lib/worker/zombie-killer.js +2 -9
- package/package.json +20 -25
- package/lib/delivery/post.d.ts.map +0 -1
- package/lib/delivery/post.js.map +0 -1
- package/lib/delivery/send-message.d.ts.map +0 -1
- package/lib/delivery/send-message.js.map +0 -1
- package/lib/delivery/stores.d.ts.map +0 -1
- package/lib/delivery/stores.js.map +0 -1
- package/lib/enrollments/licensed.d.ts.map +0 -1
- package/lib/enrollments/licensed.js.map +0 -1
- package/lib/events/aws-eventbridge.d.ts.map +0 -1
- package/lib/events/aws-eventbridge.js.map +0 -1
- package/lib/events/node-event-emitter.d.ts.map +0 -1
- package/lib/events/node-event-emitter.js.map +0 -1
- package/lib/events/redis.d.ts.map +0 -1
- package/lib/events/redis.js.map +0 -1
- package/lib/files/gridfs/adapter.d.ts.map +0 -1
- package/lib/files/gridfs/adapter.js.map +0 -1
- package/lib/files/gridfs/handler-express.d.ts.map +0 -1
- package/lib/files/gridfs/handler-express.js.map +0 -1
- package/lib/files/gridfs/handler-fastify.d.ts.map +0 -1
- package/lib/files/gridfs/handler-fastify.js.map +0 -1
- package/lib/files/gridfs/index.d.ts.map +0 -1
- package/lib/files/gridfs/index.js.map +0 -1
- package/lib/files/gridfs/module.d.ts.map +0 -1
- package/lib/files/gridfs/module.js.map +0 -1
- package/lib/files/gridfs/sign.d.ts.map +0 -1
- package/lib/files/gridfs/sign.js.map +0 -1
- package/lib/files/minio/handler-express.d.ts.map +0 -1
- package/lib/files/minio/handler-express.js.map +0 -1
- package/lib/files/minio/handler-fastify.d.ts.map +0 -1
- package/lib/files/minio/handler-fastify.js.map +0 -1
- package/lib/files/minio/index.d.ts.map +0 -1
- package/lib/files/minio/index.js.map +0 -1
- package/lib/filters/local-search.d.ts.map +0 -1
- package/lib/filters/local-search.js.map +0 -1
- package/lib/filters/strict-equal.d.ts.map +0 -1
- package/lib/filters/strict-equal.js.map +0 -1
- package/lib/payment/apple-iap/adapter.d.ts.map +0 -1
- package/lib/payment/apple-iap/adapter.js.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +0 -1
- package/lib/payment/apple-iap/fix-periods.d.ts.map +0 -1
- package/lib/payment/apple-iap/fix-periods.js.map +0 -1
- package/lib/payment/apple-iap/handler-express.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-express.js.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.d.ts.map +0 -1
- package/lib/payment/apple-iap/handler-fastify.js.map +0 -1
- package/lib/payment/apple-iap/index.d.ts.map +0 -1
- package/lib/payment/apple-iap/index.js.map +0 -1
- package/lib/payment/apple-iap/module.d.ts.map +0 -1
- package/lib/payment/apple-iap/module.js.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.d.ts.map +0 -1
- package/lib/payment/apple-iap/verify-receipt.js.map +0 -1
- package/lib/payment/braintree.d.ts.map +0 -1
- package/lib/payment/braintree.js.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +0 -1
- package/lib/payment/cryptopay/db/CryptopayTransactions.js.map +0 -1
- package/lib/payment/cryptopay/denote-amount.d.ts.map +0 -1
- package/lib/payment/cryptopay/denote-amount.js.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-btc-address.js.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.d.ts.map +0 -1
- package/lib/payment/cryptopay/derive-eth-address.js.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.d.ts.map +0 -1
- package/lib/payment/cryptopay/handle-webhook.js.map +0 -1
- package/lib/payment/cryptopay/handler-express.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-express.js.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/cryptopay/handler-fastify.js.map +0 -1
- package/lib/payment/cryptopay/index.d.ts.map +0 -1
- package/lib/payment/cryptopay/index.js.map +0 -1
- package/lib/payment/cryptopay/module.d.ts.map +0 -1
- package/lib/payment/cryptopay/module.js.map +0 -1
- package/lib/payment/cryptopay/plugin.d.ts.map +0 -1
- package/lib/payment/cryptopay/plugin.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorize.js.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/cancel.js.map +0 -1
- package/lib/payment/datatrans-v2/api/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/index.js.map +0 -1
- package/lib/payment/datatrans-v2/api/init.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/init.js.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/secureFields.js.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/settle.js.map +0 -1
- package/lib/payment/datatrans-v2/api/status.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/status.js.map +0 -1
- package/lib/payment/datatrans-v2/api/types.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/types.js.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/api/validate.js.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/generateSignature.js.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/getPaths.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-express.js.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/handler-fastify.js.map +0 -1
- package/lib/payment/datatrans-v2/index.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/index.js.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.d.ts.map +0 -1
- package/lib/payment/datatrans-v2/splitProperties.js.map +0 -1
- package/lib/payment/invoice-prepaid.d.ts.map +0 -1
- package/lib/payment/invoice-prepaid.js.map +0 -1
- package/lib/payment/invoice.d.ts.map +0 -1
- package/lib/payment/invoice.js.map +0 -1
- package/lib/payment/paypal-checkout.d.ts.map +0 -1
- package/lib/payment/paypal-checkout.js.map +0 -1
- package/lib/payment/payrexx/api/index.d.ts.map +0 -1
- package/lib/payment/payrexx/api/index.js.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.d.ts.map +0 -1
- package/lib/payment/payrexx/api/makeFetcher.js.map +0 -1
- package/lib/payment/payrexx/handler-express.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-express.js.map +0 -1
- package/lib/payment/payrexx/handler-fastify.d.ts.map +0 -1
- package/lib/payment/payrexx/handler-fastify.js.map +0 -1
- package/lib/payment/payrexx/index.d.ts.map +0 -1
- package/lib/payment/payrexx/index.js.map +0 -1
- package/lib/payment/payrexx/payrexx.d.ts.map +0 -1
- package/lib/payment/payrexx/payrexx.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-client.js.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api-types.js.map +0 -1
- package/lib/payment/postfinance-checkout/api.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/api.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-express.js.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/handler-fastify.js.map +0 -1
- package/lib/payment/postfinance-checkout/index.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/index.js.map +0 -1
- package/lib/payment/postfinance-checkout/types.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/types.js.map +0 -1
- package/lib/payment/postfinance-checkout/utils.d.ts.map +0 -1
- package/lib/payment/postfinance-checkout/utils.js.map +0 -1
- package/lib/payment/saferpay/adapter.d.ts.map +0 -1
- package/lib/payment/saferpay/adapter.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayClient.js.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts.map +0 -1
- package/lib/payment/saferpay/api/api/SaferpayConnection.js.map +0 -1
- package/lib/payment/saferpay/api/index.d.ts.map +0 -1
- package/lib/payment/saferpay/api/index.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentMethods.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageAssert.js.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/PaymentPageInitialize.js.map +0 -1
- package/lib/payment/saferpay/api/models/Request.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Request.js.map +0 -1
- package/lib/payment/saferpay/api/models/Response.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Response.js.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/Transaction.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCancel.js.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.d.ts.map +0 -1
- package/lib/payment/saferpay/api/models/TransactionCapture.js.map +0 -1
- package/lib/payment/saferpay/buildSignature.d.ts.map +0 -1
- package/lib/payment/saferpay/buildSignature.js.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +0 -1
- package/lib/payment/saferpay/db/SaferpayTransactionsCollection.js.map +0 -1
- package/lib/payment/saferpay/getReturnPath.d.ts.map +0 -1
- package/lib/payment/saferpay/getReturnPath.js.map +0 -1
- package/lib/payment/saferpay/handler-express.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-express.js.map +0 -1
- package/lib/payment/saferpay/handler-fastify.d.ts.map +0 -1
- package/lib/payment/saferpay/handler-fastify.js.map +0 -1
- package/lib/payment/saferpay/index.d.ts.map +0 -1
- package/lib/payment/saferpay/index.js.map +0 -1
- package/lib/payment/saferpay/module.d.ts.map +0 -1
- package/lib/payment/saferpay/module.js.map +0 -1
- package/lib/payment/stripe/handler-express.d.ts.map +0 -1
- package/lib/payment/stripe/handler-express.js.map +0 -1
- package/lib/payment/stripe/handler-fastify.d.ts.map +0 -1
- package/lib/payment/stripe/handler-fastify.js.map +0 -1
- package/lib/payment/stripe/index.d.ts.map +0 -1
- package/lib/payment/stripe/index.js.map +0 -1
- package/lib/payment/stripe/stripe.d.ts.map +0 -1
- package/lib/payment/stripe/stripe.js.map +0 -1
- package/lib/presets/all-express.d.ts.map +0 -1
- package/lib/presets/all-express.js.map +0 -1
- package/lib/presets/all-fastify.d.ts.map +0 -1
- package/lib/presets/all-fastify.js.map +0 -1
- package/lib/presets/all.d.ts.map +0 -1
- package/lib/presets/all.js.map +0 -1
- package/lib/presets/base-express.d.ts.map +0 -1
- package/lib/presets/base-express.js.map +0 -1
- package/lib/presets/base-fastify.d.ts.map +0 -1
- package/lib/presets/base-fastify.js.map +0 -1
- package/lib/presets/base.d.ts.map +0 -1
- package/lib/presets/base.js.map +0 -1
- package/lib/presets/countries/ch.d.ts.map +0 -1
- package/lib/presets/countries/ch.js.map +0 -1
- package/lib/presets/crypto-express.d.ts.map +0 -1
- package/lib/presets/crypto-express.js.map +0 -1
- package/lib/presets/crypto-fastify.d.ts.map +0 -1
- package/lib/presets/crypto-fastify.js.map +0 -1
- package/lib/presets/crypto.d.ts.map +0 -1
- package/lib/presets/crypto.js.map +0 -1
- package/lib/pricing/delivery-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/delivery-swiss-tax.js.map +0 -1
- package/lib/pricing/discount-100-off.d.ts.map +0 -1
- package/lib/pricing/discount-100-off.js.map +0 -1
- package/lib/pricing/discount-half-price-manual.d.ts.map +0 -1
- package/lib/pricing/discount-half-price-manual.js.map +0 -1
- package/lib/pricing/discount-half-price.d.ts.map +0 -1
- package/lib/pricing/discount-half-price.js.map +0 -1
- package/lib/pricing/free-delivery.d.ts.map +0 -1
- package/lib/pricing/free-delivery.js.map +0 -1
- package/lib/pricing/free-payment.d.ts.map +0 -1
- package/lib/pricing/free-payment.js.map +0 -1
- package/lib/pricing/order-delivery.d.ts.map +0 -1
- package/lib/pricing/order-delivery.js.map +0 -1
- package/lib/pricing/order-discount.d.ts.map +0 -1
- package/lib/pricing/order-discount.js.map +0 -1
- package/lib/pricing/order-items-discount.d.ts.map +0 -1
- package/lib/pricing/order-items-discount.js.map +0 -1
- package/lib/pricing/order-items.d.ts.map +0 -1
- package/lib/pricing/order-items.js.map +0 -1
- package/lib/pricing/order-payment.d.ts.map +0 -1
- package/lib/pricing/order-payment.js.map +0 -1
- package/lib/pricing/order-round.d.ts.map +0 -1
- package/lib/pricing/order-round.js.map +0 -1
- package/lib/pricing/product-catalog-price-options.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price-options.js.map +0 -1
- package/lib/pricing/product-catalog-price.d.ts.map +0 -1
- package/lib/pricing/product-catalog-price.js.map +0 -1
- package/lib/pricing/product-discount.d.ts.map +0 -1
- package/lib/pricing/product-discount.js.map +0 -1
- package/lib/pricing/product-price-rateconversion.d.ts.map +0 -1
- package/lib/pricing/product-price-rateconversion.js.map +0 -1
- package/lib/pricing/product-round.d.ts.map +0 -1
- package/lib/pricing/product-round.js.map +0 -1
- package/lib/pricing/product-swiss-tax.d.ts.map +0 -1
- package/lib/pricing/product-swiss-tax.js.map +0 -1
- package/lib/pricing/tax/ch.d.ts.map +0 -1
- package/lib/pricing/tax/ch.js.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts.map +0 -1
- package/lib/pricing/utils/isDeliveryAddressInCountry.js.map +0 -1
- package/lib/quotations/manual.d.ts.map +0 -1
- package/lib/quotations/manual.js.map +0 -1
- package/lib/warehousing/eth-minter.d.ts.map +0 -1
- package/lib/warehousing/eth-minter.js.map +0 -1
- package/lib/warehousing/store.d.ts.map +0 -1
- package/lib/warehousing/store.js.map +0 -1
- package/lib/worker/budgetsms.d.ts.map +0 -1
- package/lib/worker/budgetsms.js.map +0 -1
- package/lib/worker/bulk-import.d.ts.map +0 -1
- package/lib/worker/bulk-import.js.map +0 -1
- package/lib/worker/bulkgate.d.ts.map +0 -1
- package/lib/worker/bulkgate.js.map +0 -1
- package/lib/worker/email.d.ts.map +0 -1
- package/lib/worker/email.js.map +0 -1
- package/lib/worker/enrollment-order-generator.d.ts.map +0 -1
- package/lib/worker/enrollment-order-generator.js.map +0 -1
- package/lib/worker/error-notifications.d.ts.map +0 -1
- package/lib/worker/error-notifications.js.map +0 -1
- package/lib/worker/export-token.d.ts.map +0 -1
- package/lib/worker/export-token.js.map +0 -1
- package/lib/worker/external.d.ts.map +0 -1
- package/lib/worker/external.js.map +0 -1
- package/lib/worker/heartbeat.d.ts.map +0 -1
- package/lib/worker/heartbeat.js.map +0 -1
- package/lib/worker/http-request.d.ts.map +0 -1
- package/lib/worker/http-request.js.map +0 -1
- package/lib/worker/message.d.ts.map +0 -1
- package/lib/worker/message.js.map +0 -1
- package/lib/worker/push-notification.d.ts.map +0 -1
- package/lib/worker/push-notification.js.map +0 -1
- package/lib/worker/twilio.d.ts.map +0 -1
- package/lib/worker/twilio.js.map +0 -1
- package/lib/worker/update-coinbase-rates.d.ts.map +0 -1
- package/lib/worker/update-coinbase-rates.js.map +0 -1
- package/lib/worker/update-ecb-rates.d.ts.map +0 -1
- package/lib/worker/update-ecb-rates.js.map +0 -1
- package/lib/worker/update-token-ownership.d.ts.map +0 -1
- package/lib/worker/update-token-ownership.js.map +0 -1
- package/lib/worker/zombie-killer.d.ts.map +0 -1
- package/lib/worker/zombie-killer.js.map +0 -1
- package/readme.md +0 -5
- package/src/delivery/post.ts +0 -30
- package/src/delivery/send-message.ts +0 -50
- package/src/delivery/stores.ts +0 -53
- package/src/enrollments/licensed.ts +0 -61
- package/src/events/aws-eventbridge.ts +0 -45
- package/src/events/node-event-emitter.ts +0 -18
- package/src/events/redis.ts +0 -34
- package/src/files/gridfs/adapter.ts +0 -176
- package/src/files/gridfs/handler-express.ts +0 -145
- package/src/files/gridfs/handler-fastify.ts +0 -177
- package/src/files/gridfs/index.ts +0 -6
- package/src/files/gridfs/module.ts +0 -54
- package/src/files/gridfs/sign.ts +0 -28
- package/src/files/minio/handler-express.ts +0 -35
- package/src/files/minio/handler-fastify.ts +0 -44
- package/src/files/minio/index.ts +0 -232
- package/src/filters/local-search.ts +0 -101
- package/src/filters/strict-equal.ts +0 -30
- package/src/payment/apple-iap/adapter.ts +0 -153
- package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +0 -14
- package/src/payment/apple-iap/fix-periods.ts +0 -31
- package/src/payment/apple-iap/handler-express.ts +0 -140
- package/src/payment/apple-iap/handler-fastify.ts +0 -147
- package/src/payment/apple-iap/index.ts +0 -6
- package/src/payment/apple-iap/module.ts +0 -34
- package/src/payment/apple-iap/verify-receipt.ts +0 -27
- package/src/payment/braintree.ts +0 -167
- package/src/payment/cryptopay/db/CryptopayTransactions.ts +0 -16
- package/src/payment/cryptopay/denote-amount.test.ts +0 -28
- package/src/payment/cryptopay/denote-amount.ts +0 -29
- package/src/payment/cryptopay/derive-btc-address.test.ts +0 -22
- package/src/payment/cryptopay/derive-btc-address.ts +0 -46
- package/src/payment/cryptopay/derive-eth-address.test.ts +0 -22
- package/src/payment/cryptopay/derive-eth-address.ts +0 -40
- package/src/payment/cryptopay/handle-webhook.ts +0 -103
- package/src/payment/cryptopay/handler-express.ts +0 -21
- package/src/payment/cryptopay/handler-fastify.ts +0 -24
- package/src/payment/cryptopay/index.ts +0 -7
- package/src/payment/cryptopay/module.ts +0 -138
- package/src/payment/cryptopay/plugin.ts +0 -282
- package/src/payment/cryptopay/readme.md +0 -23
- package/src/payment/datatrans-v2/api/authorize.ts +0 -17
- package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +0 -20
- package/src/payment/datatrans-v2/api/cancel.ts +0 -13
- package/src/payment/datatrans-v2/api/index.ts +0 -24
- package/src/payment/datatrans-v2/api/init.ts +0 -43
- package/src/payment/datatrans-v2/api/makeFetcher.ts +0 -52
- package/src/payment/datatrans-v2/api/secureFields.ts +0 -19
- package/src/payment/datatrans-v2/api/settle.ts +0 -13
- package/src/payment/datatrans-v2/api/status.ts +0 -8
- package/src/payment/datatrans-v2/api/types.ts +0 -378
- package/src/payment/datatrans-v2/api/validate.ts +0 -13
- package/src/payment/datatrans-v2/generateSignature.test.ts +0 -18
- package/src/payment/datatrans-v2/generateSignature.ts +0 -36
- package/src/payment/datatrans-v2/getPaths.ts +0 -25
- package/src/payment/datatrans-v2/handler-express.ts +0 -91
- package/src/payment/datatrans-v2/handler-fastify.ts +0 -97
- package/src/payment/datatrans-v2/index.ts +0 -524
- package/src/payment/datatrans-v2/parseRegistrationData.ts +0 -34
- package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +0 -16
- package/src/payment/datatrans-v2/splitProperties.ts +0 -58
- package/src/payment/invoice-prepaid.ts +0 -40
- package/src/payment/invoice.ts +0 -36
- package/src/payment/paypal-checkout.ts +0 -127
- package/src/payment/payrexx/api/index.ts +0 -84
- package/src/payment/payrexx/api/makeFetcher.ts +0 -83
- package/src/payment/payrexx/handler-express.ts +0 -93
- package/src/payment/payrexx/handler-fastify.ts +0 -105
- package/src/payment/payrexx/index.ts +0 -248
- package/src/payment/payrexx/payrexx.ts +0 -65
- package/src/payment/payrexx/readme.md +0 -4
- package/src/payment/postfinance-checkout/api-client.ts +0 -111
- package/src/payment/postfinance-checkout/api-types.ts +0 -111
- package/src/payment/postfinance-checkout/api.ts +0 -114
- package/src/payment/postfinance-checkout/handler-express.ts +0 -44
- package/src/payment/postfinance-checkout/handler-fastify.ts +0 -53
- package/src/payment/postfinance-checkout/index.ts +0 -271
- package/src/payment/postfinance-checkout/types.ts +0 -27
- package/src/payment/postfinance-checkout/utils.ts +0 -39
- package/src/payment/saferpay/adapter.ts +0 -273
- package/src/payment/saferpay/api/api/SaferpayClient.ts +0 -79
- package/src/payment/saferpay/api/api/SaferpayConnection.ts +0 -36
- package/src/payment/saferpay/api/index.ts +0 -8
- package/src/payment/saferpay/api/models/PaymentMethods.ts +0 -26
- package/src/payment/saferpay/api/models/PaymentPageAssert.ts +0 -75
- package/src/payment/saferpay/api/models/PaymentPageInitialize.ts +0 -58
- package/src/payment/saferpay/api/models/Request.ts +0 -14
- package/src/payment/saferpay/api/models/Response.ts +0 -9
- package/src/payment/saferpay/api/models/Transaction.ts +0 -6
- package/src/payment/saferpay/api/models/TransactionCancel.ts +0 -15
- package/src/payment/saferpay/api/models/TransactionCapture.ts +0 -20
- package/src/payment/saferpay/buildSignature.ts +0 -9
- package/src/payment/saferpay/db/SaferpayTransactionsCollection.ts +0 -13
- package/src/payment/saferpay/getReturnPath.ts +0 -10
- package/src/payment/saferpay/handler-express.ts +0 -71
- package/src/payment/saferpay/handler-fastify.ts +0 -80
- package/src/payment/saferpay/index.ts +0 -6
- package/src/payment/saferpay/module.ts +0 -41
- package/src/payment/stripe/handler-express.ts +0 -135
- package/src/payment/stripe/handler-fastify.ts +0 -151
- package/src/payment/stripe/index.ts +0 -163
- package/src/payment/stripe/readme.md +0 -12
- package/src/payment/stripe/stripe.ts +0 -137
- package/src/presets/all-express.ts +0 -51
- package/src/presets/all-fastify.ts +0 -72
- package/src/presets/all.ts +0 -37
- package/src/presets/base-express.ts +0 -7
- package/src/presets/base-fastify.ts +0 -20
- package/src/presets/base.ts +0 -42
- package/src/presets/countries/ch.ts +0 -2
- package/src/presets/crypto-express.ts +0 -12
- package/src/presets/crypto-fastify.ts +0 -15
- package/src/presets/crypto.ts +0 -11
- package/src/pricing/delivery-swiss-tax.ts +0 -78
- package/src/pricing/discount-100-off.test.ts +0 -41
- package/src/pricing/discount-100-off.ts +0 -48
- package/src/pricing/discount-half-price-manual.test.ts +0 -52
- package/src/pricing/discount-half-price-manual.ts +0 -47
- package/src/pricing/discount-half-price.test.ts +0 -52
- package/src/pricing/discount-half-price.ts +0 -50
- package/src/pricing/free-delivery.test.ts +0 -10
- package/src/pricing/free-delivery.ts +0 -36
- package/src/pricing/free-payment.ts +0 -37
- package/src/pricing/licenced-enrollment.test.ts +0 -38
- package/src/pricing/order-delivery.test.ts +0 -9
- package/src/pricing/order-delivery.ts +0 -47
- package/src/pricing/order-discount.test.ts +0 -10
- package/src/pricing/order-discount.ts +0 -123
- package/src/pricing/order-items-discount.ts +0 -86
- package/src/pricing/order-items.ts +0 -61
- package/src/pricing/order-payment.ts +0 -48
- package/src/pricing/order-round.ts +0 -174
- package/src/pricing/plugins-index.test.ts +0 -5
- package/src/pricing/product-catalog-price-options.ts +0 -67
- package/src/pricing/product-catalog-price.ts +0 -71
- package/src/pricing/product-discount.ts +0 -97
- package/src/pricing/product-price-rateconversion.ts +0 -74
- package/src/pricing/product-round.ts +0 -66
- package/src/pricing/product-swiss-tax.ts +0 -102
- package/src/pricing/tax/ch.test.ts +0 -20
- package/src/pricing/tax/ch.ts +0 -65
- package/src/pricing/utils/isDeliveryAddressInCountry.test.ts +0 -106
- package/src/pricing/utils/isDeliveryAddressInCountry.ts +0 -26
- package/src/quotations/manual.ts +0 -26
- package/src/warehousing/eth-minter.ts +0 -167
- package/src/warehousing/store.ts +0 -45
- package/src/worker/budgetsms.ts +0 -268
- package/src/worker/bulk-import.ts +0 -77
- package/src/worker/bulkgate.ts +0 -138
- package/src/worker/email.ts +0 -165
- package/src/worker/enrollment-order-generator.ts +0 -94
- package/src/worker/error-notifications.ts +0 -83
- package/src/worker/export-token.ts +0 -32
- package/src/worker/external.ts +0 -17
- package/src/worker/heartbeat.ts +0 -37
- package/src/worker/http-request.ts +0 -71
- package/src/worker/message.ts +0 -56
- package/src/worker/push-notification.ts +0 -121
- package/src/worker/twilio.ts +0 -78
- package/src/worker/update-coinbase-rates.ts +0 -76
- package/src/worker/update-ecb-rates.ts +0 -115
- package/src/worker/update-token-ownership.ts +0 -70
- package/src/worker/zombie-killer.ts +0 -139
- package/tests/mock/datatrans/v1/secure-fields.json +0 -4
- package/tests/mock/datatrans/v1/transactions/authorize.json +0 -48
- package/tests/mock/datatrans/v1/transactions/card_check_authorized.json +0 -47
- package/tests/mock/datatrans/v1/transactions/payment_alias_authorized/settle.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_alias_authorized.json +0 -48
- package/tests/mock/datatrans/v1/transactions/payment_authorized/cancel.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized/settle.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized.json +0 -48
- package/tests/mock/datatrans/v1/transactions/payment_authorized_low_amount/cancel.json +0 -1
- package/tests/mock/datatrans/v1/transactions/payment_authorized_low_amount.json +0 -48
- package/tests/mock/datatrans/v1/transactions/validate.json +0 -1
- package/tests/mock/datatrans/v1/transactions.json +0 -4
- package/tests/mock/payrexx/Gateway/1000001.json +0 -106
- package/tests/mock/payrexx/Gateway.json +0 -24
- package/tests/mock/payrexx/transaction_example1.json +0 -65
- package/tests/mock/payrexx/transaction_example2.json +0 -65
- package/tests/mock/payrexx/transaction_example3.json +0 -94
- package/tsconfig.json +0 -9
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Readable, PassThrough } from 'node:stream';
|
|
2
|
-
import { finished, pipeline } from 'node:stream/promises';
|
|
3
|
-
import mime from 'mime/lite';
|
|
4
|
-
import {
|
|
5
|
-
FileAdapter,
|
|
6
|
-
FileDirector,
|
|
7
|
-
buildHashedFilename,
|
|
8
|
-
resolveExpirationDate,
|
|
9
|
-
IFileAdapter,
|
|
10
|
-
} from '@unchainedshop/file-upload';
|
|
11
|
-
import { UploadFileData } from '@unchainedshop/file-upload';
|
|
12
|
-
import sign from './sign.js';
|
|
13
|
-
import { filesSettings } from '@unchainedshop/core-files';
|
|
14
|
-
import { UnchainedCore } from '@unchainedshop/core';
|
|
15
|
-
import { GridFSFileUploadsModule } from './index.js';
|
|
16
|
-
|
|
17
|
-
const { GRIDFS_PUT_SERVER_PATH = '/gridfs' } = process.env;
|
|
18
|
-
|
|
19
|
-
const { ROOT_URL } = process.env;
|
|
20
|
-
|
|
21
|
-
const bufferToStream = (buffer: any) => {
|
|
22
|
-
const stream = new Readable();
|
|
23
|
-
stream.push(buffer);
|
|
24
|
-
stream.push(null);
|
|
25
|
-
|
|
26
|
-
return stream;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const GridFSAdapter: IFileAdapter<
|
|
30
|
-
UnchainedCore & {
|
|
31
|
-
modules: GridFSFileUploadsModule;
|
|
32
|
-
}
|
|
33
|
-
> = {
|
|
34
|
-
key: 'shop.unchained.file-upload-plugin.gridfs',
|
|
35
|
-
label: 'Uploads files to Database using GridFS',
|
|
36
|
-
version: '1.0.0',
|
|
37
|
-
|
|
38
|
-
...FileAdapter,
|
|
39
|
-
async createDownloadURL(file, expiry) {
|
|
40
|
-
// If public, just return the stored path from the db
|
|
41
|
-
if (!file?.meta?.isPrivate) return file?.url || null;
|
|
42
|
-
|
|
43
|
-
const expiryTimestamp =
|
|
44
|
-
expiry ||
|
|
45
|
-
new Date(new Date().getTime() + (filesSettings?.privateFileSharingMaxAge || 0)).getTime();
|
|
46
|
-
|
|
47
|
-
const signature = await sign(file.path, file._id, expiryTimestamp);
|
|
48
|
-
return `${file.url}?s=${signature}&e=${expiryTimestamp}`;
|
|
49
|
-
},
|
|
50
|
-
async createSignedURL(directoryName, fileName) {
|
|
51
|
-
const expiryDate = resolveExpirationDate();
|
|
52
|
-
const hashedFilename = await buildHashedFilename(directoryName, fileName, expiryDate);
|
|
53
|
-
const signature = await sign(directoryName, hashedFilename, expiryDate.getTime());
|
|
54
|
-
|
|
55
|
-
const putURL = new URL(
|
|
56
|
-
`${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${encodeURIComponent(
|
|
57
|
-
fileName,
|
|
58
|
-
)}?e=${expiryDate.getTime()}&s=${signature}`,
|
|
59
|
-
ROOT_URL,
|
|
60
|
-
).href;
|
|
61
|
-
const url = `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${hashedFilename}`;
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
_id: hashedFilename,
|
|
65
|
-
directoryName,
|
|
66
|
-
expiryDate,
|
|
67
|
-
fileName,
|
|
68
|
-
type: mime.getType(fileName),
|
|
69
|
-
putURL,
|
|
70
|
-
url,
|
|
71
|
-
} as UploadFileData & { putURL: string };
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
async uploadFileFromStream(directoryName: string, rawFile: any, { modules }, options = {}) {
|
|
75
|
-
let stream: Readable;
|
|
76
|
-
let fileName;
|
|
77
|
-
let fileId;
|
|
78
|
-
if (rawFile instanceof Promise) {
|
|
79
|
-
const { filename: f, createReadStream, fileId: forcedFileId } = await rawFile;
|
|
80
|
-
fileName = decodeURIComponent(f);
|
|
81
|
-
stream = createReadStream();
|
|
82
|
-
fileId = forcedFileId;
|
|
83
|
-
} else {
|
|
84
|
-
fileName = decodeURIComponent(rawFile.filename);
|
|
85
|
-
stream = bufferToStream(Buffer.from(rawFile.buffer, 'base64'));
|
|
86
|
-
fileId = rawFile.fileId;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const expiryDate = resolveExpirationDate();
|
|
90
|
-
const hashedFilename = await buildHashedFilename(directoryName, fileName, expiryDate);
|
|
91
|
-
const type = mime.getType(fileName) || (await Promise.resolve(rawFile)).mimetype;
|
|
92
|
-
|
|
93
|
-
const writeStream = await modules.gridfsFileUploads.createWriteStream(
|
|
94
|
-
directoryName,
|
|
95
|
-
fileId || hashedFilename,
|
|
96
|
-
fileName,
|
|
97
|
-
{
|
|
98
|
-
metadata: { 'content-type': type },
|
|
99
|
-
chunkSizeBytes: 1024 * 1024, // 1MB
|
|
100
|
-
...options,
|
|
101
|
-
},
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
await pipeline(
|
|
105
|
-
stream,
|
|
106
|
-
new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
|
|
107
|
-
writeStream,
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
await finished(writeStream, { readable: false });
|
|
111
|
-
|
|
112
|
-
const { length } = writeStream;
|
|
113
|
-
const url = `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${encodeURIComponent(hashedFilename)}`;
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
_id: fileId || hashedFilename,
|
|
117
|
-
directoryName,
|
|
118
|
-
expiryDate: null,
|
|
119
|
-
fileName,
|
|
120
|
-
size: length,
|
|
121
|
-
type,
|
|
122
|
-
url,
|
|
123
|
-
} as UploadFileData;
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
async uploadFileFromURL(
|
|
127
|
-
directoryName: string,
|
|
128
|
-
{ fileLink, fileName: fname, fileId, headers }: any,
|
|
129
|
-
{ modules },
|
|
130
|
-
) {
|
|
131
|
-
const { href } = new URL(fileLink);
|
|
132
|
-
const fileName = decodeURIComponent(fname || href.split('/').pop());
|
|
133
|
-
|
|
134
|
-
const expiryDate = resolveExpirationDate();
|
|
135
|
-
const hashedFilename = await buildHashedFilename(directoryName, fileName, expiryDate);
|
|
136
|
-
|
|
137
|
-
const response = await fetch(href, { headers });
|
|
138
|
-
if (!response.ok) throw new Error(`Unexpected response for ${href}: ${response.statusText}`);
|
|
139
|
-
const type = mime.getType(fileName) || response.headers.get('content-type');
|
|
140
|
-
|
|
141
|
-
const writeStream = await modules.gridfsFileUploads.createWriteStream(
|
|
142
|
-
directoryName,
|
|
143
|
-
fileId || hashedFilename,
|
|
144
|
-
fileName,
|
|
145
|
-
{
|
|
146
|
-
metadata: { 'content-type': type },
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
await pipeline(response.body as unknown as Readable, new PassThrough(), writeStream);
|
|
150
|
-
const { length } = writeStream;
|
|
151
|
-
const url = `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${encodeURIComponent(hashedFilename)}`;
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
_id: fileId || hashedFilename,
|
|
155
|
-
directoryName,
|
|
156
|
-
expiryDate: null,
|
|
157
|
-
fileName,
|
|
158
|
-
size: length,
|
|
159
|
-
type,
|
|
160
|
-
url,
|
|
161
|
-
} as UploadFileData;
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
async createDownloadStream(file, { modules }: any) {
|
|
165
|
-
const readStream = await modules.gridfsFileUploads.createReadStream(file.path, file._id);
|
|
166
|
-
return readStream;
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
async removeFiles(files, { modules }: any) {
|
|
170
|
-
await Promise.all(
|
|
171
|
-
files.map(async ({ _id, path }) => modules.gridfsFileUploads.removeFileFromBucket(path, _id)),
|
|
172
|
-
);
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
FileDirector.registerAdapter(GridFSAdapter);
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { pipeline, finished } from 'node:stream/promises';
|
|
2
|
-
import { PassThrough } from 'node:stream';
|
|
3
|
-
import { buildHashedFilename } from '@unchainedshop/file-upload';
|
|
4
|
-
import express from 'express';
|
|
5
|
-
import sign from './sign.js';
|
|
6
|
-
import { GridFSFileUploadsModule } from './module.js';
|
|
7
|
-
import { Context } from '@unchainedshop/api';
|
|
8
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
9
|
-
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
10
|
-
|
|
11
|
-
const { ROOT_URL, GRIDFS_PUT_SERVER_PATH = '/gridfs' } = process.env;
|
|
12
|
-
|
|
13
|
-
const logger = createLogger('unchained:gridfs');
|
|
14
|
-
|
|
15
|
-
const gridfsHandler = async (
|
|
16
|
-
req: express.Request & {
|
|
17
|
-
unchainedContext: Context & {
|
|
18
|
-
modules: GridFSFileUploadsModule;
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
res: express.Response,
|
|
22
|
-
) => {
|
|
23
|
-
try {
|
|
24
|
-
const { services, modules } = req.unchainedContext;
|
|
25
|
-
const url = new URL(req.url, ROOT_URL);
|
|
26
|
-
const [, directoryNameRaw, fileNameRaw] = url.pathname.split('/');
|
|
27
|
-
const directoryName = decodeURIComponent(directoryNameRaw);
|
|
28
|
-
const fileName = decodeURIComponent(fileNameRaw);
|
|
29
|
-
|
|
30
|
-
/* This is a file upload endpoint, and thus we need to allow CORS.
|
|
31
|
-
else we'd need proxies for all kinds of things for storefronts */
|
|
32
|
-
res.setHeader('Access-Control-Allow-Methods', 'GET, PUT');
|
|
33
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
34
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
35
|
-
|
|
36
|
-
if (req.method === 'OPTIONS') {
|
|
37
|
-
res.status(200).end();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (req.method === 'PUT') {
|
|
42
|
-
const { s: signature, e: expiryTimestamp } = req.query;
|
|
43
|
-
const expiryDate = new Date(parseInt(expiryTimestamp as string, 10));
|
|
44
|
-
const fileId = await buildHashedFilename(directoryName, fileName, expiryDate);
|
|
45
|
-
if ((await sign(directoryName, fileId, expiryDate.getTime())) === signature) {
|
|
46
|
-
const file = await modules.files.findFile({ fileId });
|
|
47
|
-
|
|
48
|
-
if (!file) {
|
|
49
|
-
res.status(404).send('File not found');
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (file.expires === null) {
|
|
54
|
-
res.status(400).send('File already linked');
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
// If the type is octet-stream, prefer mimetype lookup from the filename
|
|
58
|
-
// Else prefer the content-type header
|
|
59
|
-
const type =
|
|
60
|
-
req.header('Content-Type') === 'application/octet-stream'
|
|
61
|
-
? file.type || req.header('Content-Type')
|
|
62
|
-
: req.header('Content-Type') || file.type;
|
|
63
|
-
|
|
64
|
-
const writeStream = await modules.gridfsFileUploads.createWriteStream(
|
|
65
|
-
directoryName,
|
|
66
|
-
fileId,
|
|
67
|
-
fileName,
|
|
68
|
-
{
|
|
69
|
-
chunkSizeBytes: 1024 * 1024, // 1MB
|
|
70
|
-
metadata: { 'content-type': type },
|
|
71
|
-
},
|
|
72
|
-
);
|
|
73
|
-
await pipeline(
|
|
74
|
-
req,
|
|
75
|
-
new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
|
|
76
|
-
writeStream,
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
await finished(writeStream, { readable: false });
|
|
80
|
-
|
|
81
|
-
const { length } = writeStream;
|
|
82
|
-
await services.files.linkFile({ fileId, size: length, type });
|
|
83
|
-
|
|
84
|
-
res.status(200).end();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
res.status(403).end();
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (req.method === 'GET') {
|
|
92
|
-
const { s: signature, e: expiryTimestamp } = req.query;
|
|
93
|
-
const fileDocument = await modules.files.findFile({
|
|
94
|
-
url: `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${fileName}`,
|
|
95
|
-
});
|
|
96
|
-
if (fileDocument?.meta?.isPrivate) {
|
|
97
|
-
const expiry = parseInt(expiryTimestamp as string, 10);
|
|
98
|
-
if (expiry <= Date.now()) {
|
|
99
|
-
res.status(403).send('Access restricted: Expired.');
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const fileUploadAdapter = getFileAdapter();
|
|
104
|
-
const signedUrl = await fileUploadAdapter.createDownloadURL(fileDocument, expiry);
|
|
105
|
-
|
|
106
|
-
if (!signedUrl || new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
|
|
107
|
-
res.status(403).send('Access restricted: Invalid signature.');
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
} else if (!fileDocument) {
|
|
111
|
-
res.status(404).end();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const file = await modules.gridfsFileUploads.getFileInfo(directoryName, fileDocument._id);
|
|
116
|
-
|
|
117
|
-
if (file?.metadata?.['content-type']) {
|
|
118
|
-
res.setHeader('Content-Type', file.metadata['content-type']);
|
|
119
|
-
}
|
|
120
|
-
if (file?.length) {
|
|
121
|
-
res.setHeader('Content-Length', file?.length.toString());
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const readStream = await modules.gridfsFileUploads.createReadStream(
|
|
125
|
-
directoryName,
|
|
126
|
-
fileDocument._id,
|
|
127
|
-
);
|
|
128
|
-
readStream.pipe(res, { end: false });
|
|
129
|
-
await finished(readStream);
|
|
130
|
-
res.status(200).end();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
res.status(404).end();
|
|
134
|
-
} catch (e) {
|
|
135
|
-
if (e.code === 'ENOENT') {
|
|
136
|
-
logger.warn(e);
|
|
137
|
-
res.status(404).send();
|
|
138
|
-
} else {
|
|
139
|
-
logger.warn(e);
|
|
140
|
-
res.status(503).send({ name: e.name, code: e.code, message: e.message });
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export default gridfsHandler;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { finished, pipeline } from 'node:stream/promises';
|
|
2
|
-
import { PassThrough } from 'node:stream';
|
|
3
|
-
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
4
|
-
import { buildHashedFilename } from '@unchainedshop/file-upload';
|
|
5
|
-
import sign from './sign.js';
|
|
6
|
-
import { GridFSFileUploadsModule } from './module.js';
|
|
7
|
-
import { Context } from '@unchainedshop/api';
|
|
8
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
9
|
-
import { getFileAdapter } from '@unchainedshop/core-files';
|
|
10
|
-
|
|
11
|
-
const logger = createLogger('unchained:gridfs');
|
|
12
|
-
|
|
13
|
-
const { GRIDFS_PUT_SERVER_PATH = '/gridfs' } = process.env;
|
|
14
|
-
|
|
15
|
-
const gridfsHandler: RouteHandlerMethod = async (
|
|
16
|
-
req: FastifyRequest & {
|
|
17
|
-
unchainedContext: Context & {
|
|
18
|
-
modules: GridFSFileUploadsModule;
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
reply,
|
|
22
|
-
) => {
|
|
23
|
-
try {
|
|
24
|
-
const { services, modules } = req.unchainedContext;
|
|
25
|
-
const { directoryName, fileName } = req.params as any;
|
|
26
|
-
|
|
27
|
-
/* This is a file upload endpoint, and thus we need to allow CORS.
|
|
28
|
-
else we'd need proxies for all kinds of things for storefronts */
|
|
29
|
-
reply.header('Access-Control-Allow-Methods', 'GET, PUT');
|
|
30
|
-
reply.header('Access-Control-Allow-Headers', 'content-type');
|
|
31
|
-
reply.header('Access-Control-Allow-Origin', '*');
|
|
32
|
-
|
|
33
|
-
if (req.method === 'OPTIONS') {
|
|
34
|
-
reply.status(200);
|
|
35
|
-
return reply.send();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (req.method === 'PUT') {
|
|
39
|
-
const { s: signature, e: expiryTimestamp } = req.query as Record<string, string>;
|
|
40
|
-
const expiryDate = new Date(parseInt(expiryTimestamp as string, 10));
|
|
41
|
-
const fileId = await buildHashedFilename(directoryName, fileName, expiryDate);
|
|
42
|
-
if ((await sign(directoryName, fileId, expiryDate.getTime())) === signature) {
|
|
43
|
-
const file = await modules.files.findFile({ fileId });
|
|
44
|
-
|
|
45
|
-
if (!file) {
|
|
46
|
-
reply.status(404);
|
|
47
|
-
logger.error('File not found', { fileId });
|
|
48
|
-
return reply.send({
|
|
49
|
-
success: false,
|
|
50
|
-
message: 'File not found',
|
|
51
|
-
name: 'FILE_NOT_FOUND',
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (file.expires === null) {
|
|
56
|
-
reply.status(400);
|
|
57
|
-
logger.error('File already linked', { fileId });
|
|
58
|
-
return reply.send({
|
|
59
|
-
success: false,
|
|
60
|
-
message: 'File already linked',
|
|
61
|
-
name: 'FILE_ALREADY_LINKED',
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
// If the type is octet-stream, prefer mimetype lookup from the filename
|
|
65
|
-
// Else prefer the content-type header
|
|
66
|
-
const type =
|
|
67
|
-
req.headers['content-type'] === 'application/octet-stream'
|
|
68
|
-
? file.type || (req.headers['content-type'] as string)
|
|
69
|
-
: (req.headers['content-type'] as string) || file.type;
|
|
70
|
-
|
|
71
|
-
const writeStream = await modules.gridfsFileUploads.createWriteStream(
|
|
72
|
-
directoryName,
|
|
73
|
-
fileId,
|
|
74
|
-
fileName,
|
|
75
|
-
{
|
|
76
|
-
chunkSizeBytes: 1024 * 1024, // 1MB
|
|
77
|
-
metadata: { 'content-type': type },
|
|
78
|
-
},
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
await pipeline(
|
|
82
|
-
req.raw,
|
|
83
|
-
new PassThrough({ highWaterMark: 1024 * 1024 * 4 }), // 4MB Buffer
|
|
84
|
-
writeStream,
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
await finished(writeStream, { readable: false });
|
|
88
|
-
|
|
89
|
-
const { length } = writeStream;
|
|
90
|
-
await services.files.linkFile({ fileId, size: length, type });
|
|
91
|
-
|
|
92
|
-
reply.status(200);
|
|
93
|
-
return reply.send({
|
|
94
|
-
success: true,
|
|
95
|
-
fileId,
|
|
96
|
-
size: length,
|
|
97
|
-
type,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
logger.error('Invalid signature', { fileId, expiryDate });
|
|
101
|
-
reply.status(403);
|
|
102
|
-
return reply.send({
|
|
103
|
-
success: false,
|
|
104
|
-
message: 'Access restricted: Invalid signature.',
|
|
105
|
-
name: 'INVALID_SIGNATURE',
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (req.method === 'GET') {
|
|
110
|
-
const { s: signature, e: expiryTimestamp } = req.query as Record<string, string>;
|
|
111
|
-
const fileDocument = await modules.files.findFile({
|
|
112
|
-
url: `${GRIDFS_PUT_SERVER_PATH}/${directoryName}/${fileName}`,
|
|
113
|
-
});
|
|
114
|
-
if (fileDocument?.meta?.isPrivate) {
|
|
115
|
-
const expiry = parseInt(expiryTimestamp as string, 10);
|
|
116
|
-
if (expiry <= Date.now()) {
|
|
117
|
-
logger.error('URL Expired', { fileName, expiry });
|
|
118
|
-
reply.status(403);
|
|
119
|
-
return reply.send({
|
|
120
|
-
success: false,
|
|
121
|
-
message: 'Access restricted: URL expired.',
|
|
122
|
-
name: 'URL_EXPIRED',
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const fileUploadAdapter = getFileAdapter();
|
|
127
|
-
const signedUrl = await fileUploadAdapter.createDownloadURL(fileDocument, expiry);
|
|
128
|
-
|
|
129
|
-
if (!signedUrl || new URL(signedUrl, 'file://').searchParams.get('s') !== signature) {
|
|
130
|
-
reply.status(403);
|
|
131
|
-
logger.error('Invalid signature', { fileName, expiry });
|
|
132
|
-
return reply.send({
|
|
133
|
-
success: false,
|
|
134
|
-
message: 'Access restricted: Invalid signature.',
|
|
135
|
-
name: 'INVALID_SIGNATURE',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
} else if (!fileDocument) {
|
|
139
|
-
logger.error('File not found', { fileName });
|
|
140
|
-
reply.status(404);
|
|
141
|
-
return reply.send();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const file = await modules.gridfsFileUploads.getFileInfo(directoryName, fileDocument._id);
|
|
145
|
-
|
|
146
|
-
if (file?.metadata?.['content-type']) {
|
|
147
|
-
reply.header('content-type', file.metadata['content-type']);
|
|
148
|
-
}
|
|
149
|
-
if (file?.length) {
|
|
150
|
-
reply.header('content-length', file?.length.toString());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const readStream = await modules.gridfsFileUploads.createReadStream(
|
|
154
|
-
directoryName,
|
|
155
|
-
fileDocument._id,
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
reply.status(200);
|
|
159
|
-
return reply.send(readStream);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
reply.status(404);
|
|
163
|
-
return reply.send();
|
|
164
|
-
} catch (e) {
|
|
165
|
-
logger.error(e);
|
|
166
|
-
|
|
167
|
-
if (e.code === 'ENOENT') {
|
|
168
|
-
reply.status(404);
|
|
169
|
-
return reply.send();
|
|
170
|
-
} else {
|
|
171
|
-
reply.status(504);
|
|
172
|
-
return reply.send({ success: false, name: e.name, code: e.code, message: e.message });
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export default gridfsHandler;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { mongodb } from '@unchainedshop/mongodb';
|
|
2
|
-
|
|
3
|
-
export const configureGridFSFileUploadModule = ({ db }) => {
|
|
4
|
-
// eslint-disable-next-line
|
|
5
|
-
let { GridFSBucket } = mongodb;
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
createWriteStream: async (
|
|
9
|
-
directoryName,
|
|
10
|
-
fileId,
|
|
11
|
-
fileName,
|
|
12
|
-
uploadOptions: mongodb.GridFSBucketWriteStream['options'],
|
|
13
|
-
) => {
|
|
14
|
-
const options = { bucketName: `file_uploads_${directoryName}` };
|
|
15
|
-
const bucket = new GridFSBucket(db, options);
|
|
16
|
-
|
|
17
|
-
if (fileId) {
|
|
18
|
-
try {
|
|
19
|
-
// Try removing the target if it already exists
|
|
20
|
-
await bucket.delete(fileId);
|
|
21
|
-
} catch {
|
|
22
|
-
/* */
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return bucket.openUploadStreamWithId(fileId, fileName, uploadOptions);
|
|
27
|
-
},
|
|
28
|
-
getFileInfo: async (directoryName, fileId) => {
|
|
29
|
-
const options = { bucketName: `file_uploads_${directoryName}` };
|
|
30
|
-
const bucket = new GridFSBucket(db, options);
|
|
31
|
-
return bucket.find({ _id: fileId }).next();
|
|
32
|
-
},
|
|
33
|
-
createReadStream: async (directoryName, fileId) => {
|
|
34
|
-
const options = { bucketName: `file_uploads_${directoryName}` };
|
|
35
|
-
const bucket = new GridFSBucket(db, options);
|
|
36
|
-
return bucket.openDownloadStream(fileId);
|
|
37
|
-
},
|
|
38
|
-
removeFileFromBucket: async (directoryName, fileId) => {
|
|
39
|
-
const options = { bucketName: `file_uploads_${directoryName}` };
|
|
40
|
-
const bucket = new GridFSBucket(db, options);
|
|
41
|
-
return bucket.delete(fileId);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default {
|
|
47
|
-
gridfsFileUploads: {
|
|
48
|
-
configure: configureGridFSFileUploadModule,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export interface GridFSFileUploadsModule {
|
|
53
|
-
gridfsFileUploads: ReturnType<typeof configureGridFSFileUploadModule>;
|
|
54
|
-
}
|
package/src/files/gridfs/sign.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { UNCHAINED_GRIDFS_PUT_UPLOAD_SECRET } = process.env;
|
|
2
|
-
|
|
3
|
-
const sign = async (directoryName, hash, expiryTimestamp) => {
|
|
4
|
-
if (!UNCHAINED_GRIDFS_PUT_UPLOAD_SECRET)
|
|
5
|
-
throw new Error(
|
|
6
|
-
'To enable PUT based uploads or signed downloads you have to provide a random UNCHAINED_GRIDFS_PUT_UPLOAD_SECRET environment variable',
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
const key = await crypto.subtle.importKey(
|
|
10
|
-
'raw',
|
|
11
|
-
new TextEncoder().encode(UNCHAINED_GRIDFS_PUT_UPLOAD_SECRET),
|
|
12
|
-
{ name: 'HMAC', hash: 'SHA-256' },
|
|
13
|
-
false,
|
|
14
|
-
['sign'],
|
|
15
|
-
);
|
|
16
|
-
const signatureBinary = await crypto.subtle.sign(
|
|
17
|
-
'HMAC',
|
|
18
|
-
key,
|
|
19
|
-
new TextEncoder().encode([directoryName, hash, expiryTimestamp].join(':')),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const hmacSubtle = Array.from(new Uint8Array(signatureBinary))
|
|
23
|
-
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
24
|
-
.join('');
|
|
25
|
-
return hmacSubtle;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default sign;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
2
|
-
|
|
3
|
-
const logger = createLogger('unchained:minio');
|
|
4
|
-
|
|
5
|
-
const { MINIO_WEBHOOK_AUTH_TOKEN } = process.env;
|
|
6
|
-
|
|
7
|
-
const isAuthorized = ({ authorization = '' }) => {
|
|
8
|
-
const [type, token] = authorization.split(' ');
|
|
9
|
-
return type === 'Bearer' && token === MINIO_WEBHOOK_AUTH_TOKEN;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const minioHandler = async (req, res) => {
|
|
13
|
-
try {
|
|
14
|
-
if (req.method === 'POST' && req.body) {
|
|
15
|
-
const { headers } = req;
|
|
16
|
-
const { Records = [], EventName } = req.body;
|
|
17
|
-
if (EventName === 's3:ObjectCreated:Put' && isAuthorized(headers)) {
|
|
18
|
-
const [{ s3 }] = Records;
|
|
19
|
-
const { object } = s3;
|
|
20
|
-
const { size, contentType: type } = object;
|
|
21
|
-
const [fileId] = object.key.split('.');
|
|
22
|
-
const { services } = req.unchainedContext;
|
|
23
|
-
await services.files.linkFile({ fileId, type, size });
|
|
24
|
-
res.status(200).end();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
res.status(404).end();
|
|
29
|
-
} catch (e) {
|
|
30
|
-
logger.error(e);
|
|
31
|
-
res.status(503).send({ name: e.name, code: e.code, message: e.message });
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default minioHandler;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Context } from '@unchainedshop/api';
|
|
2
|
-
import { createLogger } from '@unchainedshop/logger';
|
|
3
|
-
import { FastifyRequest, RouteHandlerMethod } from 'fastify';
|
|
4
|
-
|
|
5
|
-
const logger = createLogger('unchained:minio');
|
|
6
|
-
|
|
7
|
-
const { MINIO_WEBHOOK_AUTH_TOKEN } = process.env;
|
|
8
|
-
|
|
9
|
-
const isAuthorized = ({ authorization = '' }) => {
|
|
10
|
-
const [type, token] = authorization.split(' ');
|
|
11
|
-
return type === 'Bearer' && token === MINIO_WEBHOOK_AUTH_TOKEN;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const minioHandler: RouteHandlerMethod = async (
|
|
15
|
-
req: FastifyRequest & {
|
|
16
|
-
unchainedContext: Context;
|
|
17
|
-
},
|
|
18
|
-
res,
|
|
19
|
-
) => {
|
|
20
|
-
try {
|
|
21
|
-
if (req.body) {
|
|
22
|
-
const { headers } = req;
|
|
23
|
-
const { Records = [], EventName } = req.body as Record<string, any>;
|
|
24
|
-
if (EventName === 's3:ObjectCreated:Put' && isAuthorized(headers)) {
|
|
25
|
-
const [{ s3 }] = Records;
|
|
26
|
-
const { object } = s3;
|
|
27
|
-
const { size, contentType: type } = object;
|
|
28
|
-
const [fileId] = object.key.split('.');
|
|
29
|
-
const { services } = req.unchainedContext;
|
|
30
|
-
await services.files.linkFile({ fileId, type, size });
|
|
31
|
-
res.status(200);
|
|
32
|
-
return res.send();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
res.status(404);
|
|
36
|
-
return res.send();
|
|
37
|
-
} catch (e) {
|
|
38
|
-
logger.error(e);
|
|
39
|
-
res.status(503);
|
|
40
|
-
return res.send({ name: e.name, code: e.code, message: e.message });
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default minioHandler;
|