@shophost/rest-api 2.0.67 → 2.0.68

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 (128) hide show
  1. package/package.json +1 -1
  2. package/scripts/shophost-rest-api.mjs +198 -1
  3. package/src/bootstrap.js +1 -1
  4. package/src/container.js +1 -1
  5. package/src/core/auth/auth.schema.js +1 -1
  6. package/src/core/auth/auth.util.js +1 -1
  7. package/src/core/auth/better-auth.lib.js +1 -1
  8. package/src/core/auth/generate-password-hash.util.js +1 -1
  9. package/src/core/auth/headers.schema.js +1 -1
  10. package/src/core/auth/user.schema.js +1 -1
  11. package/src/core/db/__generated__/client/browser.js +1 -1
  12. package/src/core/db/__generated__/client/client.js +1 -1
  13. package/src/core/db/__generated__/client/enums.js +1 -1
  14. package/src/core/db/__generated__/client/internal/class.js +788 -1
  15. package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -1
  16. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -1
  17. package/src/core/db/index.js +1 -1
  18. package/src/core/email/components.js +1 -1
  19. package/src/core/exceptions/http-exception.js +1 -1
  20. package/src/core/hono/hono.js +1 -1
  21. package/src/core/lib/prisma.js +1 -1
  22. package/src/core/logging/pino.js +1 -1
  23. package/src/core/notifications/email.service.js +1 -1
  24. package/src/core/openapi/openapi.lib.js +1 -1
  25. package/src/core/utils/currency.util.js +1 -1
  26. package/src/core/utils/env.util.js +1 -1
  27. package/src/core/utils/object.util.js +1 -1
  28. package/src/core/utils/translations.util.js +1 -1
  29. package/src/core/utils/zod.util.js +1 -1
  30. package/src/db.js +1 -1
  31. package/src/features/access/access.handler.js +1 -1
  32. package/src/features/access/access.route.js +1 -1
  33. package/src/features/access/access.schema.js +1 -1
  34. package/src/features/access/access.service.js +1 -1
  35. package/src/features/analytics/analytics.handler.js +1 -1
  36. package/src/features/analytics/analytics.route.js +1 -1
  37. package/src/features/analytics/analytics.schema.js +1 -1
  38. package/src/features/analytics/analytics.service.js +1 -1
  39. package/src/features/cart/cart.handler.js +1 -1
  40. package/src/features/cart/cart.route.js +1 -1
  41. package/src/features/cart/cart.schema.js +1 -1
  42. package/src/features/cart/cart.service.js +1 -1
  43. package/src/features/cart/cart.util.js +1 -1
  44. package/src/features/customer/customer.handler.js +1 -1
  45. package/src/features/customer/customer.route.js +1 -1
  46. package/src/features/customer/customer.schema.js +1 -1
  47. package/src/features/customer/customer.service.js +1 -1
  48. package/src/features/file/file.handler.js +1 -1
  49. package/src/features/file/file.route.js +1 -1
  50. package/src/features/file/file.schema.js +1 -1
  51. package/src/features/file/file.service.js +1 -1
  52. package/src/features/health/health.handler.js +1 -1
  53. package/src/features/health/health.route.js +1 -1
  54. package/src/features/index.js +1 -1
  55. package/src/features/integration/integration-config.js +1 -1
  56. package/src/features/integration/integration-registry.js +1 -1
  57. package/src/features/integration/integration.handler.js +1 -1
  58. package/src/features/integration/integration.route.js +1 -1
  59. package/src/features/integration/integration.schema.js +1 -1
  60. package/src/features/integration/integration.service.js +1 -1
  61. package/src/features/inventory/inventory.service.js +1 -1
  62. package/src/features/location/location.handler.js +1 -1
  63. package/src/features/location/location.route.js +1 -1
  64. package/src/features/location/location.schema.js +1 -1
  65. package/src/features/location/location.service.js +1 -1
  66. package/src/features/manufacturer/manufacturer.handler.js +1 -1
  67. package/src/features/manufacturer/manufacturer.route.js +1 -1
  68. package/src/features/manufacturer/manufacturer.schema.js +1 -1
  69. package/src/features/manufacturer/manufacturer.service.js +1 -1
  70. package/src/features/order/emails/order-confirmation.email.js +1 -1
  71. package/src/features/order/emails/order-notification.email.js +1 -1
  72. package/src/features/order/fulfilment.schema.js +1 -1
  73. package/src/features/order/order-fulfillment.service.js +1 -1
  74. package/src/features/order/order.handler.js +1 -1
  75. package/src/features/order/order.route.js +1 -1
  76. package/src/features/order/order.schema.js +1 -1
  77. package/src/features/order/order.service.js +1 -1
  78. package/src/features/order/recipient.schema.js +1 -1
  79. package/src/features/organization/legal-entity.schema.js +1 -1
  80. package/src/features/organization/organization-configuration.schema.js +1 -1
  81. package/src/features/organization/organization.handler.js +1 -1
  82. package/src/features/organization/organization.route.js +1 -1
  83. package/src/features/organization/organization.schema.js +1 -1
  84. package/src/features/organization/organization.service.js +1 -1
  85. package/src/features/payment/payment-webhook.service.js +1 -1
  86. package/src/features/payment/payment.handler.js +1 -1
  87. package/src/features/payment/payment.route.js +1 -1
  88. package/src/features/payment/payment.schema.js +1 -1
  89. package/src/features/payment/payment.service.js +1 -1
  90. package/src/features/payment/stripe.service.js +1 -1
  91. package/src/features/product/product-modifier.schema.js +1 -1
  92. package/src/features/product/product.handler.js +1 -1
  93. package/src/features/product/product.route.js +1 -1
  94. package/src/features/product/product.schema.js +1 -1
  95. package/src/features/product/product.service.js +1 -1
  96. package/src/features/product-category/product-category.handler.js +1 -1
  97. package/src/features/product-category/product-category.route.js +1 -1
  98. package/src/features/product-category/product-category.schema.js +1 -1
  99. package/src/features/product-category/product-category.service.js +1 -1
  100. package/src/features/reservation/emails/reservation-cancellation.email.js +1 -1
  101. package/src/features/reservation/emails/reservation-confirmation.email.js +1 -1
  102. package/src/features/reservation/emails/reservation-notification.email.js +1 -1
  103. package/src/features/reservation/emails/reservation-updated.email.js +1 -1
  104. package/src/features/reservation/reservation.handler.js +1 -1
  105. package/src/features/reservation/reservation.route.js +1 -1
  106. package/src/features/reservation/reservation.schema.js +1 -1
  107. package/src/features/reservation/reservation.service.js +1 -1
  108. package/src/features/shipping/shipping.handler.js +1 -1
  109. package/src/features/shipping/shipping.route.js +1 -1
  110. package/src/features/shipping/shipping.service.js +1 -1
  111. package/src/features/shipping-method/shipping-method.handler.js +1 -1
  112. package/src/features/shipping-method/shipping-method.route.js +1 -1
  113. package/src/features/shipping-method/shipping-method.schema.js +1 -1
  114. package/src/features/shipping-method/shipping-method.service.js +1 -1
  115. package/src/features/shipping-method/shipping-zone.schema.js +1 -1
  116. package/src/features/webhook/webhook.handler.js +1 -1
  117. package/src/features/webhook/webhook.route.js +1 -1
  118. package/src/index.js +1 -1
  119. package/src/integrations/next.js +1 -1
  120. package/src/schemas/address.schema.js +1 -1
  121. package/src/schemas/currency.schema.js +1 -1
  122. package/src/schemas/error.schema.js +1 -1
  123. package/src/schemas/index.js +1 -1
  124. package/src/schemas/locales.schema.js +1 -1
  125. package/src/schemas/number.schema.js +1 -1
  126. package/src/schemas/pagination.schema.js +1 -1
  127. package/src/schemas/params.schema.js +1 -1
  128. package/src/schemas/queries.schema.js +1 -1
@@ -1 +1 @@
1
- function _0x3a65(_0x32b029,_0x551ebe){_0x32b029=_0x32b029-0x18d;var _0x3e2907=_0x3e29();var _0x3a65cd=_0x3e2907[_0x32b029];if(_0x3a65['pYLzKh']===undefined){var _0x4e9d01=function(_0x28a653){var _0x2865e7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x323aef='',_0x38cf37='';for(var _0x32174e=0x0,_0x1e7304,_0x1dcbe1,_0x53efa9=0x0;_0x1dcbe1=_0x28a653['charAt'](_0x53efa9++);~_0x1dcbe1&&(_0x1e7304=_0x32174e%0x4?_0x1e7304*0x40+_0x1dcbe1:_0x1dcbe1,_0x32174e++%0x4)?_0x323aef+=String['fromCharCode'](0xff&_0x1e7304>>(-0x2*_0x32174e&0x6)):0x0){_0x1dcbe1=_0x2865e7['indexOf'](_0x1dcbe1);}for(var _0x1aaed0=0x0,_0x12d2c4=_0x323aef['length'];_0x1aaed0<_0x12d2c4;_0x1aaed0++){_0x38cf37+='%'+('00'+_0x323aef['charCodeAt'](_0x1aaed0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x38cf37);};_0x3a65['xfiJJL']=_0x4e9d01,_0x3a65['ZvrPjb']={},_0x3a65['pYLzKh']=!![];}var _0x3aded3=_0x3e2907[0x0],_0x13d007=_0x32b029+_0x3aded3,_0x5e7120=_0x3a65['ZvrPjb'][_0x13d007];return!_0x5e7120?(_0x3a65cd=_0x3a65['xfiJJL'](_0x3a65cd),_0x3a65['ZvrPjb'][_0x13d007]=_0x3a65cd):_0x3a65cd=_0x5e7120,_0x3a65cd;}(function(_0x215796,_0x41c589){var _0x2aa37f=_0x3a65,_0x24eb08=_0x3a65,_0x29c02a=_0x215796();while(!![]){try{var _0x5a4730=parseInt(_0x2aa37f(0x195))/0x1+parseInt(_0x2aa37f(0x18e))/0x2*(parseInt(_0x2aa37f(0x191))/0x3)+-parseInt(_0x24eb08(0x190))/0x4*(parseInt(_0x24eb08(0x18f))/0x5)+parseInt(_0x2aa37f(0x194))/0x6*(-parseInt(_0x2aa37f(0x18d))/0x7)+parseInt(_0x24eb08(0x196))/0x8+-parseInt(_0x24eb08(0x193))/0x9+parseInt(_0x2aa37f(0x192))/0xa;if(_0x5a4730===_0x41c589)break;else _0x29c02a['push'](_0x29c02a['shift']());}catch(_0x51c9a7){_0x29c02a['push'](_0x29c02a['shift']());}}}(_0x3e29,0x8c225));export{registerAnalyticsHandlers}from'./analytics/analytics.handler';export{registerAccessHandlers}from'./access/access.handler';export{registerCartHandlers}from'./cart/cart.handler';export{registerCustomerHandlers}from'./customer/customer.handler';export{registerFileHandlers}from'./file/file.handler';export{registerHealthHandlers}from'./health/health.handler';export{registerIntegrationHandlers}from'./integration/integration.handler';export{registerLocationHandlers}from'./location/location.handler';export{registerManufacturerHandlers}from'./manufacturer/manufacturer.handler';export{registerOrderHandlers}from'./order/order.handler';export{registerOrganizationHandlers}from'./organization/organization.handler';export{registerPaymentHandlers}from'./payment/payment.handler';function _0x3e29(){var _0x2b22ab=['ndu1mtGYmNLvq3vHAq','nNHVBfnwrG','mJe5nJa4rvrZBhHT','nJK4mtK2mentENrnEq','mZaXntu0nev6qNvbDa','mte1nJK0uwvivenh','nuTLAuLRrG','mty2mdi5mKz2BMHsvq','m0TtzgDMDG','nZC1ndeYmgrjq1DdzW'];_0x3e29=function(){return _0x2b22ab;};return _0x3e29();}export{registerProductCategoryHandlers}from'./product-category/product-category.handler';export{registerProductHandlers}from'./product/product.handler';export{registerReservationHandlers}from'./reservation/reservation.handler';export{registerShippingHandlers}from'./shipping/shipping.handler';export{registerShippingMethodHandlers}from'./shipping-method/shipping-method.handler';export{registerWebhookHandlers}from'./webhook/webhook.handler';
1
+ export{registerAnalyticsHandlers}from"./analytics/analytics.handler";export{registerAccessHandlers}from"./access/access.handler";export{registerCartHandlers}from"./cart/cart.handler";export{registerCustomerHandlers}from"./customer/customer.handler";export{registerFileHandlers}from"./file/file.handler";export{registerHealthHandlers}from"./health/health.handler";export{registerIntegrationHandlers}from"./integration/integration.handler";export{registerLocationHandlers}from"./location/location.handler";export{registerManufacturerHandlers}from"./manufacturer/manufacturer.handler";export{registerOrderHandlers}from"./order/order.handler";export{registerOrganizationHandlers}from"./organization/organization.handler";export{registerPaymentHandlers}from"./payment/payment.handler";export{registerProductCategoryHandlers}from"./product-category/product-category.handler";export{registerProductHandlers}from"./product/product.handler";export{registerReservationHandlers}from"./reservation/reservation.handler";export{registerShippingHandlers}from"./shipping/shipping.handler";export{registerShippingMethodHandlers}from"./shipping-method/shipping-method.handler";export{registerWebhookHandlers}from"./webhook/webhook.handler";
@@ -1 +1 @@
1
- const _0x124063=_0x3567,_0x24a21b=_0x3567;(function(_0x2f6380,_0x2ad7a9){const _0x568293=_0x3567,_0xad8179=_0x3567,_0x228b77=_0x2f6380();while(!![]){try{const _0x278525=-parseInt(_0x568293(0x188))/0x1*(-parseInt(_0x568293(0x17e))/0x2)+-parseInt(_0xad8179(0x17b))/0x3+-parseInt(_0xad8179(0x191))/0x4+-parseInt(_0x568293(0x17c))/0x5+-parseInt(_0x568293(0x186))/0x6*(-parseInt(_0x568293(0x18f))/0x7)+parseInt(_0xad8179(0x187))/0x8+-parseInt(_0xad8179(0x179))/0x9*(parseInt(_0x568293(0x181))/0xa);if(_0x278525===_0x2ad7a9)break;else _0x228b77['push'](_0x228b77['shift']());}catch(_0x16c9d1){_0x228b77['push'](_0x228b77['shift']());}}}(_0x14fd,0xcfd36));function _0x3567(_0x2d3268,_0x2831cc){_0x2d3268=_0x2d3268-0x179;const _0x14fd21=_0x14fd();let _0x356789=_0x14fd21[_0x2d3268];if(_0x3567['LYMomR']===undefined){var _0x3c8c0d=function(_0x53a462){const _0x2e6b71='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1a7a07='',_0x866792='';for(let _0x2cd321=0x0,_0x32a010,_0x435e4a,_0x44d34e=0x0;_0x435e4a=_0x53a462['charAt'](_0x44d34e++);~_0x435e4a&&(_0x32a010=_0x2cd321%0x4?_0x32a010*0x40+_0x435e4a:_0x435e4a,_0x2cd321++%0x4)?_0x1a7a07+=String['fromCharCode'](0xff&_0x32a010>>(-0x2*_0x2cd321&0x6)):0x0){_0x435e4a=_0x2e6b71['indexOf'](_0x435e4a);}for(let _0x548b7d=0x0,_0x13d3db=_0x1a7a07['length'];_0x548b7d<_0x13d3db;_0x548b7d++){_0x866792+='%'+('00'+_0x1a7a07['charCodeAt'](_0x548b7d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x866792);};_0x3567['aHQfRG']=_0x3c8c0d,_0x3567['jrJewb']={},_0x3567['LYMomR']=!![];}const _0x3783ef=_0x14fd21[0x0],_0x36f8b1=_0x2d3268+_0x3783ef,_0x3a1f88=_0x3567['jrJewb'][_0x36f8b1];return!_0x3a1f88?(_0x356789=_0x3567['aHQfRG'](_0x356789),_0x3567['jrJewb'][_0x36f8b1]=_0x356789):_0x356789=_0x3a1f88,_0x356789;}function _0x14fd(){const _0x2fcc64=['C3vJy2vZCW','zxrOB2rZ','DhjPBq','yxbPs2v5','zNjVBuvTywK','n3HkuuLQEG','y29UzMLN','mty4nJa0mefqqMz0zq','mZzosuHSBwK','C2fMzvbHCNm','ndG4nde4EKDIr0Pf','mZq4odaWCerYsMnk','zMLSDgvY','mNDZwhrkBq','C2vJCMv0s2u','te1lzu0','mZa4odK4mfnKDvjtBq','zgf0yq','zNjVBq','zwnYzxq','zeXPtNG','mZmWnJuWnff3uND0tG','odu2mtqXnKfiteDXsq','mteXoty2mxLNwg9twa','Cgf5BwvUDe0'];_0x14fd=function(){return _0x2fcc64;};return _0x14fd();}import{ResendIntegrationStoredConfigSchema as _0x4bc530,StripeIntegrationStoredConfigSchema as _0x3d3219}from'./integration.schema';export const normalizeSecret=_0x56eca2=>{const _0x4be5cd=_0x3567,_0x2a9937=_0x56eca2?.[_0x4be5cd(0x18c)]();return _0x2a9937||void 0x0;},normalizeEmail=_0x59b8a4=>{const _0x5d8ecd=_0x3567,_0x4f9b67=_0x59b8a4?.[_0x5d8ecd(0x18c)]();return _0x4f9b67||void 0x0;},normalizeStripePaymentMethods=_0x37e60d=>Array[_0x124063(0x183)](new Set(_0x37e60d[_0x24a21b(0x17d)](_0x45b3fb=>_0x45b3fb==='card'||_0x45b3fb==='blik'))),parseStripeStoredConfig=_0x26b259=>{const _0x2dc728=_0x124063,_0x12fe44=_0x124063,_0x462f30={'LMKeM':function(_0x29a1bd,_0x55af40){return _0x29a1bd(_0x55af40);}},_0x2430d0=_0x3d3219[_0x2dc728(0x17a)+'e'](_0x26b259);if(_0x2430d0[_0x12fe44(0x18a)])return{'paymentMethods':_0x2430d0[_0x2dc728(0x182)][_0x2dc728(0x189)+_0x12fe44(0x18b)]?normalizeStripePaymentMethods(_0x2430d0[_0x12fe44(0x182)][_0x12fe44(0x189)+_0x2dc728(0x18b)]):void 0x0,'secretKey':normalizeSecret(_0x2430d0[_0x12fe44(0x182)][_0x12fe44(0x17f)+'y']),'webhookSecret':_0x462f30[_0x2dc728(0x180)](normalizeSecret,_0x2430d0[_0x12fe44(0x182)]['webhookS'+_0x12fe44(0x184)])};},parseResendStoredConfig=_0x4fb384=>{const _0x1d718c=_0x24a21b,_0x3f62aa=_0x24a21b,_0x35715d={'dLiNx':function(_0x5d155e,_0x22c9ad){return _0x5d155e(_0x22c9ad);}},_0x4c19f6=_0x4bc530['safePars'+'e'](_0x4fb384);if(_0x4c19f6[_0x1d718c(0x18a)])return{'apiKey':normalizeSecret(_0x4c19f6['data'][_0x1d718c(0x18d)]),'fromEmail':_0x35715d[_0x1d718c(0x185)](normalizeEmail,_0x4c19f6['data'][_0x3f62aa(0x18e)+'l'])};},getStoredStripeConfig=_0x528574=>parseStripeStoredConfig(_0x528574?.[_0x24a21b(0x190)]),getStoredResendConfig=_0x4b5c45=>parseResendStoredConfig(_0x4b5c45?.[_0x124063(0x190)]);
1
+ import{ResendIntegrationStoredConfigSchema as o,StripeIntegrationStoredConfigSchema as r}from"./integration.schema";export const normalizeSecret=e=>{const t=e?.trim();return t||void 0},normalizeEmail=e=>{const t=e?.trim();return t||void 0},normalizeStripePaymentMethods=e=>Array.from(new Set(e.filter(t=>t==="card"||t==="blik"))),parseStripeStoredConfig=e=>{const t=r.safeParse(e);if(t.success)return{paymentMethods:t.data.paymentMethods?normalizeStripePaymentMethods(t.data.paymentMethods):void 0,secretKey:normalizeSecret(t.data.secretKey),webhookSecret:normalizeSecret(t.data.webhookSecret)}},parseResendStoredConfig=e=>{const t=o.safeParse(e);if(t.success)return{apiKey:normalizeSecret(t.data.apiKey),fromEmail:normalizeEmail(t.data.fromEmail)}},getStoredStripeConfig=e=>parseStripeStoredConfig(e?.config),getStoredResendConfig=e=>parseResendStoredConfig(e?.config);
@@ -1 +1 @@
1
- const _0x1c46ba=_0x506a,_0x30c545=_0x506a;(function(_0x3e2a48,_0x13595e){const _0x436a07=_0x506a,_0x303591=_0x506a,_0x32746c=_0x3e2a48();while(!![]){try{const _0x5d2258=-parseInt(_0x436a07(0x101))/0x1*(parseInt(_0x303591(0x10f))/0x2)+-parseInt(_0x303591(0x10a))/0x3+-parseInt(_0x303591(0xf8))/0x4*(-parseInt(_0x436a07(0x10e))/0x5)+-parseInt(_0x436a07(0x112))/0x6+-parseInt(_0x303591(0xf7))/0x7*(-parseInt(_0x436a07(0xf5))/0x8)+parseInt(_0x436a07(0x110))/0x9+parseInt(_0x436a07(0xff))/0xa;if(_0x5d2258===_0x13595e)break;else _0x32746c['push'](_0x32746c['shift']());}catch(_0x5bb42f){_0x32746c['push'](_0x32746c['shift']());}}}(_0x1ef4,0x549e5));function _0x1ef4(){const _0x192a9a=['zw50CMLLCW','Bg9HzefSBa','Aw50zwDYyxq','BgLZDa','Bg9JywXLq28','Aw9U','ntC5mtu5q1vnwLvS','zMLUze1HBNK','y2XLyxi','zMLSDgvY','ote1nZy1CeXgvhnP','mty4ngnqwfjHAq','mZKZmte2nfbWshvrzG','B3jNyw5PEMe','mJi4ntiYnK1Hzuvwwq','C29YDa','nJCWnJG4zvH4ENvR','DhLWzq','n0nTthjMwq','oe5cAezYtq','B2fKuhjVBwK','DgLVBKLK','C2v0','CufUsuG','Aw5PDgLHBeW','ChjPC21H','ndiXnZq1meHZwNLntW','z2v0','ndyXufznwNjs','zgvSzxrL','DMfSDwvZ'];_0x1ef4=function(){return _0x192a9a;};return _0x1ef4();}function _0x506a(_0x5c0a69,_0x405b61){_0x5c0a69=_0x5c0a69-0xf5;const _0x1ef484=_0x1ef4();let _0x506a0a=_0x1ef484[_0x5c0a69];if(_0x506a['qCMWCz']===undefined){var _0x38873e=function(_0x4fcd1d){const _0x104a30='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x49a910='',_0x37ed68='';for(let _0x18a6c9=0x0,_0x4c220c,_0x3b28e2,_0x35c0e0=0x0;_0x3b28e2=_0x4fcd1d['charAt'](_0x35c0e0++);~_0x3b28e2&&(_0x4c220c=_0x18a6c9%0x4?_0x4c220c*0x40+_0x3b28e2:_0x3b28e2,_0x18a6c9++%0x4)?_0x49a910+=String['fromCharCode'](0xff&_0x4c220c>>(-0x2*_0x18a6c9&0x6)):0x0){_0x3b28e2=_0x104a30['indexOf'](_0x3b28e2);}for(let _0x3c4efe=0x0,_0x1921e8=_0x49a910['length'];_0x3c4efe<_0x1921e8;_0x3c4efe++){_0x37ed68+='%'+('00'+_0x49a910['charCodeAt'](_0x3c4efe)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x37ed68);};_0x506a['eaAFVv']=_0x38873e,_0x506a['IEgeiu']={},_0x506a['qCMWCz']=!![];}const _0x224054=_0x1ef484[0x0],_0x1575d4=_0x5c0a69+_0x224054,_0x23a056=_0x506a['IEgeiu'][_0x1575d4];return!_0x23a056?(_0x506a0a=_0x506a['eaAFVv'](_0x506a0a),_0x506a['IEgeiu'][_0x1575d4]=_0x506a0a):_0x506a0a=_0x23a056,_0x506a0a;}import{__awaiter as _0x3c7607}from'tslib';const e=(_0x2ca363,_0x2461f3)=>_0x2ca363+':'+_0x2461f3;class a{constructor(_0x21eaa7){const _0x18e1c3=_0x506a,_0x2a5a76=_0x506a;this[_0x18e1c3(0xfe)]=_0x21eaa7,this[_0x18e1c3(0x104)]=new Map(),this[_0x18e1c3(0xfd)+_0x2a5a76(0xf9)+'se']=this[_0x2a5a76(0x105)]();}[_0x1c46ba(0x105)](){const _0x306f5b={'qAnIH':function(_0x341a34,_0x2d7172){return _0x341a34===_0x2d7172;}};return _0x3c7607(this,void 0x0,void 0x0,function*(){const _0x352d77=_0x506a,_0x52825f=_0x506a;var _0x4cd517,_0x4847bd;if(!(!((_0x4847bd=(_0x4cd517=this[_0x352d77(0xfe)])===null||_0x4cd517===void 0x0?void 0x0:_0x4cd517[_0x352d77(0x106)+_0x52825f(0x109)])===null||_0x306f5b[_0x352d77(0xfc)](_0x4847bd,void 0x0))&&_0x4847bd[_0x52825f(0x10b)]))return;const _0x3bbd5d=yield this[_0x52825f(0xfe)][_0x52825f(0x106)+_0x352d77(0x109)]['findMany']();this[_0x52825f(0x104)][_0x52825f(0x10c)]();for(const _0x51e3d0 of _0x3bbd5d)this[_0x52825f(0x104)][_0x352d77(0xfb)](e(_0x51e3d0['organiza'+_0x52825f(0xfa)],_0x51e3d0[_0x352d77(0xf6)]),_0x51e3d0);});}['ready'](){return _0x3c7607(this,void 0x0,void 0x0,function*(){const _0xfbaf10=_0x506a,_0x2d00fe=_0x506a;yield this[_0xfbaf10(0xfd)+_0xfbaf10(0xf9)+'se'];});}[_0x30c545(0x100)](_0xabad77,_0x1d5392){if(_0xabad77)return this['entries']['get'](e(_0xabad77,_0x1d5392));}[_0x30c545(0x107)](_0x521954){const _0x6347a1=_0x1c46ba,_0x5315c6=_0x1c46ba;return[...this[_0x6347a1(0x104)][_0x6347a1(0x103)]()][_0x6347a1(0x10d)](_0x58b038=>_0x58b038[_0x5315c6(0x111)+_0x6347a1(0xfa)]===_0x521954)[_0x6347a1(0x113)]((_0x12631f,_0x2c8cd8)=>_0x12631f[_0x6347a1(0xf6)][_0x6347a1(0x108)+'mpare'](_0x2c8cd8[_0x6347a1(0xf6)]));}['upsert'](_0x327cea){const _0x260cb8=_0x1c46ba,_0x5f0261=_0x1c46ba;return this['entries'][_0x260cb8(0xfb)](e(_0x327cea[_0x5f0261(0x111)+_0x260cb8(0xfa)],_0x327cea[_0x5f0261(0xf6)]),_0x327cea),_0x327cea;}[_0x30c545(0x102)](_0x17895d,_0x3a95ff){const _0x528171=_0x1c46ba,_0x53cf83=_0x1c46ba;this[_0x528171(0x104)][_0x528171(0x102)](e(_0x17895d,_0x3a95ff));}}export{a as IntegrationRegistry};
1
+ import{__awaiter as o}from"tslib";const e=(s,t)=>`${s}:${t}`;class a{constructor(t){this.prisma=t,this.entries=new Map,this.initialLoadPromise=this.loadAll()}loadAll(){return o(this,void 0,void 0,function*(){var t,i;if(!(!((i=(t=this.prisma)===null||t===void 0?void 0:t.integration)===null||i===void 0)&&i.findMany))return;const r=yield this.prisma.integration.findMany();this.entries.clear();for(const n of r)this.entries.set(e(n.organizationId,n.type),n)})}ready(){return o(this,void 0,void 0,function*(){yield this.initialLoadPromise})}get(t,i){if(t)return this.entries.get(e(t,i))}list(t){return[...this.entries.values()].filter(i=>i.organizationId===t).sort((i,r)=>i.type.localeCompare(r.type))}upsert(t){return this.entries.set(e(t.organizationId,t.type),t),t}delete(t,i){this.entries.delete(e(t,i))}}export{a as IntegrationRegistry};
@@ -1 +1 @@
1
- function _0x4674(_0x48ec11,_0x100743){_0x48ec11=_0x48ec11-0x195;const _0x45e4e1=_0x45e4();let _0x46741a=_0x45e4e1[_0x48ec11];if(_0x4674['xgpEPV']===undefined){var _0x2cfc24=function(_0x260e0f){const _0x32b6c6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x43e27b='',_0x6d00b='';for(let _0x51c4bc=0x0,_0x4c1d8f,_0x1eab76,_0x25373a=0x0;_0x1eab76=_0x260e0f['charAt'](_0x25373a++);~_0x1eab76&&(_0x4c1d8f=_0x51c4bc%0x4?_0x4c1d8f*0x40+_0x1eab76:_0x1eab76,_0x51c4bc++%0x4)?_0x43e27b+=String['fromCharCode'](0xff&_0x4c1d8f>>(-0x2*_0x51c4bc&0x6)):0x0){_0x1eab76=_0x32b6c6['indexOf'](_0x1eab76);}for(let _0x984e4c=0x0,_0x41b4da=_0x43e27b['length'];_0x984e4c<_0x41b4da;_0x984e4c++){_0x6d00b+='%'+('00'+_0x43e27b['charCodeAt'](_0x984e4c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x6d00b);};_0x4674['OeIWKR']=_0x2cfc24,_0x4674['GlGNlh']={},_0x4674['xgpEPV']=!![];}const _0x283d69=_0x45e4e1[0x0],_0x216899=_0x48ec11+_0x283d69,_0x26e27a=_0x4674['GlGNlh'][_0x216899];return!_0x26e27a?(_0x46741a=_0x4674['OeIWKR'](_0x46741a),_0x4674['GlGNlh'][_0x216899]=_0x46741a):_0x46741a=_0x26e27a,_0x46741a;}(function(_0x488e9c,_0x518ae7){const _0xc2654f=_0x4674,_0x50bfa3=_0x4674,_0xca2f5c=_0x488e9c();while(!![]){try{const _0x14a49d=parseInt(_0xc2654f(0x195))/0x1+-parseInt(_0x50bfa3(0x19c))/0x2+parseInt(_0x50bfa3(0x1b6))/0x3*(-parseInt(_0xc2654f(0x1a9))/0x4)+parseInt(_0xc2654f(0x1b5))/0x5+parseInt(_0x50bfa3(0x1a1))/0x6+-parseInt(_0x50bfa3(0x1b0))/0x7*(parseInt(_0xc2654f(0x1a2))/0x8)+parseInt(_0x50bfa3(0x1a6))/0x9;if(_0x14a49d===_0x518ae7)break;else _0xca2f5c['push'](_0xca2f5c['shift']());}catch(_0x646021){_0xca2f5c['push'](_0xca2f5c['shift']());}}}(_0x45e4,0xd121e));import{__awaiter as _0x118bf9}from'tslib';import{createApiRouter as _0x3870c8}from'../../core/hono/hono';import{integrationRoutes as _0x582276}from'./integration.route';export const registerIntegrationHandlers=_0x182c86=>{const _0x5f36ed=_0x4674,_0x577ee0=_0x4674,_0x2f57ea={'UPvmV':'param'},_0x139219=_0x3870c8();return _0x139219[_0x5f36ed(0x1a3)](_0x582276[_0x577ee0(0x19a)+_0x577ee0(0x19e)],_0x5661fc=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x201576=_0x577ee0,_0x250c9a=_0x577ee0,_0x57905f=_0x5661fc['get'](_0x201576(0x1b8)),_0x1ce96a=_0x5661fc[_0x201576(0x1b1)][_0x250c9a(0x19b)]('param');yield _0x57905f[_0x250c9a(0x1b2)+'d'](_0x201576(0x1ae));const _0x5664e5=yield _0x182c86['getInteg'+_0x201576(0x19e)](_0x1ce96a[_0x250c9a(0x1a8)+_0x201576(0x1b3)]);return _0x5661fc[_0x201576(0x1a5)](_0x5664e5,0xc8);})),_0x139219[_0x577ee0(0x1a3)](_0x582276[_0x577ee0(0x199)+'tegratio'+'n'],_0x2fd9de=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x1cff73=_0x577ee0,_0x1f7bb8=_0x577ee0,_0x414c11=_0x2fd9de[_0x1cff73(0x19d)](_0x1f7bb8(0x1b8)),_0x5ce102=_0x2fd9de[_0x1f7bb8(0x1b1)][_0x1f7bb8(0x19b)](_0x1f7bb8(0x1ad)),_0x51a02c=_0x2fd9de[_0x1cff73(0x1b1)][_0x1f7bb8(0x19b)](_0x1cff73(0x1a5)),_0x533906=yield _0x414c11[_0x1f7bb8(0x1b2)+'d'](_0x1f7bb8(0x19f)),_0x3af7a5=yield _0x182c86[_0x1cff73(0x199)+_0x1f7bb8(0x1af)+'n'](_0x5ce102[_0x1cff73(0x1a8)+_0x1f7bb8(0x1b3)],_0x5ce102['type'],_0x533906['id'],_0x51a02c);return _0x2fd9de[_0x1f7bb8(0x1a5)](_0x3af7a5,0xc8);})),_0x139219['openapi'](_0x582276[_0x577ee0(0x1a4)+_0x577ee0(0x1af)+'n'],_0x306341=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0xd426bd=_0x577ee0,_0x14b80a=_0x577ee0,_0x1f0449=_0x306341[_0xd426bd(0x19d)](_0xd426bd(0x1b8)),_0x251fa8=_0x306341[_0x14b80a(0x1b1)]['valid']('param');return yield _0x1f0449[_0xd426bd(0x1b2)+'d'](_0xd426bd(0x19f)),yield _0x182c86[_0xd426bd(0x1a4)+_0xd426bd(0x1af)+'n'](_0x251fa8[_0xd426bd(0x1a8)+_0xd426bd(0x1b3)],_0x251fa8[_0xd426bd(0x1a0)]),_0x306341[_0xd426bd(0x1b4)](null,0xcc);})),_0x139219[_0x5f36ed(0x1a3)](_0x582276[_0x577ee0(0x1ac)+_0x5f36ed(0x197)],_0x47c9d2=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x383d97=_0x5f36ed,_0x590961=_0x5f36ed,_0x5c3535=_0x47c9d2[_0x383d97(0x19d)](_0x590961(0x1b8)),_0x469b33=_0x47c9d2[_0x383d97(0x1b1)][_0x590961(0x19b)](_0x2f57ea[_0x383d97(0x1b7)]),_0xa68f8e=_0x47c9d2['req'][_0x383d97(0x19b)](_0x383d97(0x1a5));yield _0x5c3535[_0x590961(0x1b2)+'d'](_0x590961(0x19f));const _0x542ef4=yield _0x182c86[_0x383d97(0x1ac)+_0x383d97(0x197)](_0x469b33['organiza'+_0x383d97(0x1b3)],_0xa68f8e['to']);return _0x47c9d2[_0x590961(0x1a5)](_0x542ef4,0xc8);})),_0x139219[_0x577ee0(0x1a3)](_0x582276['createSt'+_0x5f36ed(0x1a7)+_0x5f36ed(0x198)],_0x5d3a5b=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x22f5a6=_0x5f36ed,_0x3b790c=_0x5f36ed,_0x4ad8d1=_0x5d3a5b[_0x22f5a6(0x19d)](_0x22f5a6(0x1b8)),_0xf8c2d8=_0x5d3a5b[_0x22f5a6(0x1b1)][_0x3b790c(0x19b)](_0x3b790c(0x1ad)),_0x26861a=_0x5d3a5b['req'][_0x22f5a6(0x19b)](_0x3b790c(0x1a5)),_0x2f4cfe=yield _0x4ad8d1[_0x3b790c(0x1b2)+'d'](_0x3b790c(0x19f)),_0x2f4029=yield _0x182c86[_0x22f5a6(0x196)+_0x22f5a6(0x1a7)+_0x3b790c(0x198)](_0xf8c2d8[_0x22f5a6(0x1a8)+_0x22f5a6(0x1b3)],_0x2f4cfe[_0x3b790c(0x1aa)],_0x26861a[_0x22f5a6(0x1ab)+'l']);return _0x5d3a5b['json'](_0x2f4029,0xc8);})),_0x139219;};function _0x45e4(){const _0x19a67b=['DgLVBKLK','yM9KEq','ndCXodC0merxsKL0Ca','ovjUAKvUBq','vvb2Bvy','yxv0Aa','mty3mdaYmhfZCKzzAW','y3jLyxrLu3q','rw1HAwW','q2HLy2TVDxq','DxbZzxj0sw4','z2v0sw50zwC','DMfSAwq','nJKZmZuYwvrzwgDP','z2v0','CMf0Aw9UCW','DxbKyxrL','DhLWzq','mJG5mJCZoe5HwvjUAq','nZa5nMnQse1ysG','B3bLBMfWAq','zgvSzxrLsw4','ANnVBG','nduXnZuYm3Dgzgzjwq','CMLWzvrLC3q','B3jNyw5PEMe','mtu0nZy1mLrHzKTgBa','zw1HAwW','CMv0DxjUvxi','C2vUzfrLC3q','CgfYyw0','CMvHza','DgvNCMf0Aw8','otCZn3PpuNv0uG','CMvX','AxnhCMfUDgu'];_0x45e4=function(){return _0x19a67b;};return _0x45e4();}
1
+ import{__awaiter as d}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{integrationRoutes as s}from"./integration.route";export const registerIntegrationHandlers=i=>{const a=u();return a.openapi(s.getIntegrations,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param");yield o.isGranted("read");const e=yield i.getIntegrations(n.organizationId);return t.json(e,200)})),a.openapi(s.upsertIntegration,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json"),r=yield o.isGranted("update"),p=yield i.upsertIntegration(n.organizationId,n.type,r.id,e);return t.json(p,200)})),a.openapi(s.deleteIntegration,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param");return yield o.isGranted("update"),yield i.deleteIntegration(n.organizationId,n.type),t.body(null,204)})),a.openapi(s.sendTestEmail,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json");yield o.isGranted("update");const r=yield i.sendTestEmail(n.organizationId,e.to);return t.json(r,200)})),a.openapi(s.createStripeTestCheckout,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json"),r=yield o.isGranted("update"),p=yield i.createStripeTestCheckout(n.organizationId,r.email,e.returnUrl);return t.json(p,200)})),a};
@@ -1 +1 @@
1
- const _0x39354b=_0x1721,_0x39cb04=_0x1721;(function(_0x1d3fde,_0x57b34d){const _0x3dd43b=_0x1721,_0x295095=_0x1721,_0x4588c3=_0x1d3fde();while(!![]){try{const _0x25584e=parseInt(_0x3dd43b(0x168))/0x1*(parseInt(_0x295095(0x177))/0x2)+-parseInt(_0x295095(0x188))/0x3*(-parseInt(_0x3dd43b(0x19b))/0x4)+parseInt(_0x3dd43b(0x164))/0x5+parseInt(_0x295095(0x17a))/0x6*(parseInt(_0x295095(0x159))/0x7)+parseInt(_0x295095(0x18f))/0x8+parseInt(_0x3dd43b(0x1a2))/0x9*(-parseInt(_0x3dd43b(0x18c))/0xa)+-parseInt(_0x295095(0x18b))/0xb*(parseInt(_0x295095(0x1a3))/0xc);if(_0x25584e===_0x57b34d)break;else _0x4588c3['push'](_0x4588c3['shift']());}catch(_0x4c53c7){_0x4588c3['push'](_0x4588c3['shift']());}}}(_0x4690,0x2cc51));import{z as _0x2992a1}from'@hono/zod-openapi';import{createApiRoute as _0x1c0584}from'../../core/hono/hono';import{ErrorSchema as _0x23dc8f,HeaderSchema as _0x758c64,OrganizationParams as _0x38d5b6}from'../../schemas';import{CreateStripeTestCheckoutResponseSchema as _0x570350,CreateStripeTestCheckoutSchema as _0x55aaec,IntegrationSchema as _0x2b29fb,IntegrationTypeSchema as _0x16f646,SendTestEmailResponseSchema as _0x12617e,SendTestEmailSchema as _0x5489e1,UpsertIntegrationSchema as _0x2e16f0}from'./integration.schema';function _0x4690(){const _0x1999cd=['mti3ntaWnuDVzg9lsW','y3jLyxrLu3q','rw1HAwW','yxjYyxK','ntqYntzgrK5YChq','ue9tva','u2vUzcbuzxm','DhLWzq','B3iGDxbKyxq','ufvu','DhjPCguGvgu','DgLVBG','uMvZzw5KigK','DcbfBwfPBa','Aw9UCYbJB24','CMf0Aw9Uigm','ysbtDhjPCgu','CMf0Aw9UCW','q2HLy2TVDxq','mMHzqMLQta','B2nRihbYB2q','DgLVBNmVC3q','nKDyzxjkva','DgLVBNm','ignVBMzPz3u','BNrLz3jHDgK','BIbJB25MAwC','zxmGyw4GAw4','C2vUzc90zxm','DgLVBNmVoNq','lZPVCMDHBMK','ExbL','DxjHDgLVBG','rgvSzxrLieK','q3jLyxrLifm','Aw50zwDYyxq','ntfmB1DhvwK','zM9YigfUig8','CMLWzs90zxm','mJaZmZm1u2TLvhzz','ntu0mgDQBuvRsW','zMLNDxjLzca','zxH0zw5K','mte3nteYv21ZBgjz','DgvZDcbLBwe','l2LUDgvNCMe','revmrvrf','q3jLyxrLCYa','CMf0Aw9U','DcbZzxnZAw8','r2v0ieLUDgu','C3qGq2HLy2S','EMf0Aw9Uswq','B3bLBMfWAq','r0vu','ndyZodHxrhr1ueS','DgLVBNmVCMu','DxbZzxj0sw4','sw50zwDYyxq','Aw9U','u2vUzhmGysa','BIb3AxrOig0','nta0q2HzuuHL','mZCYCuzrrwDL','vxbZzxj0ieK','C2vUzfrLC3q','DgvZDcb0Agu','mtG2ndm4n0PcrgX6yG','CguGAw50zwC','CMDHBML6yxq','DgvNCMf0Aw8','B25MAwD1CMe','rMv0y2HLCYa','Dwn0CYb0BYa','ienOzwnRB3u','CMLWzvrLC3q','rgvSzxrLCYa','yw4GAw50zwC'];_0x4690=function(){return _0x1999cd;};return _0x4690();}function _0x1721(_0x3d3d2c,_0x52ef60){_0x3d3d2c=_0x3d3d2c-0x159;const _0x46907f=_0x4690();let _0x172146=_0x46907f[_0x3d3d2c];if(_0x1721['RZgJdl']===undefined){var _0x2a08bf=function(_0x53b31e){const _0x3a14b2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2992a1='',_0x1c0584='';for(let _0x23dc8f=0x0,_0x758c64,_0x38d5b6,_0x570350=0x0;_0x38d5b6=_0x53b31e['charAt'](_0x570350++);~_0x38d5b6&&(_0x758c64=_0x23dc8f%0x4?_0x758c64*0x40+_0x38d5b6:_0x38d5b6,_0x23dc8f++%0x4)?_0x2992a1+=String['fromCharCode'](0xff&_0x758c64>>(-0x2*_0x23dc8f&0x6)):0x0){_0x38d5b6=_0x3a14b2['indexOf'](_0x38d5b6);}for(let _0x55aaec=0x0,_0x2b29fb=_0x2992a1['length'];_0x55aaec<_0x2b29fb;_0x55aaec++){_0x1c0584+='%'+('00'+_0x2992a1['charCodeAt'](_0x55aaec)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1c0584);};_0x1721['ASVHjt']=_0x2a08bf,_0x1721['wkTlGN']={},_0x1721['RZgJdl']=!![];}const _0x79cd62=_0x46907f[0x0],_0xf2cfbb=_0x3d3d2c+_0x79cd62,_0x3aa32b=_0x1721['wkTlGN'][_0xf2cfbb];return!_0x3aa32b?(_0x172146=_0x1721['ASVHjt'](_0x172146),_0x1721['wkTlGN'][_0xf2cfbb]=_0x172146):_0x172146=_0x3aa32b,_0x172146;}const r=_0x38d5b6[_0x39354b(0x18e)]({'type':_0x16f646[_0x39354b(0x199)]({'param':{'in':'path','name':_0x39cb04(0x16b)}})}),c=_0x1c0584({'description':_0x39cb04(0x15e)+_0x39cb04(0x187)+_0x39cb04(0x172)+_0x39cb04(0x18d)+_0x39cb04(0x189)+_0x39cb04(0x15b)+_0x39cb04(0x19f),'headers':_0x758c64,'method':_0x39354b(0x19a),'operationId':'getInteg'+_0x39354b(0x175),'path':_0x39cb04(0x182)+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x17b),'pathParams':_0x38d5b6,'responses':{0xc8:_0x2992a1[_0x39354b(0x167)](_0x2b29fb),0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39cb04(0x196)+'grations','tags':['Integrat'+'ion']}),u=_0x1c0584({'body':_0x2e16f0,'description':_0x39354b(0x193)+_0x39354b(0x16c)+_0x39cb04(0x17f)+_0x39354b(0x15c)+_0x39354b(0x17e)+_0x39354b(0x184),'headers':_0x758c64,'method':_0x39354b(0x16d),'operationId':_0x39354b(0x19d)+_0x39354b(0x15c)+'n','path':_0x39354b(0x182)+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x181)+_0x39cb04(0x183),'pathParams':r,'responses':{0xc8:_0x2b29fb,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39354b(0x1a4)+_0x39cb04(0x17d)+'on','tags':[_0x39354b(0x19e)+_0x39cb04(0x19f)]}),I=_0x1c0584({'description':_0x39cb04(0x162)+_0x39354b(0x163)+_0x39354b(0x173)+_0x39354b(0x15d)+_0x39354b(0x16f),'headers':_0x758c64,'method':_0x39cb04(0x192),'operationId':'deleteIn'+_0x39354b(0x15c)+'n','path':_0x39cb04(0x182)+_0x39cb04(0x198)+_0x39354b(0x191)+_0x39354b(0x181)+_0x39cb04(0x183),'pathParams':r,'responses':{0xcc:null,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39cb04(0x185)+_0x39cb04(0x17d)+'on','tags':[_0x39354b(0x19e)+_0x39354b(0x19f)]}),S=_0x1c0584({'body':_0x5489e1,'description':_0x39354b(0x1a0)+_0x39354b(0x190)+'il\x20using'+'\x20the\x20con'+_0x39354b(0x18d)+_0x39354b(0x170)+_0x39354b(0x17d)+'on','headers':_0x758c64,'method':_0x39354b(0x169),'operationId':_0x39cb04(0x1a5)+_0x39cb04(0x166),'path':_0x39354b(0x182)+_0x39354b(0x198)+'/integra'+_0x39354b(0x19c)+_0x39354b(0x180)+'t','pathParams':_0x38d5b6,'responses':{0xc8:_0x12617e,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f,0x1f4:_0x23dc8f},'summary':_0x39cb04(0x16a)+_0x39cb04(0x171),'tags':['Integrat'+'ion']}),T=_0x1c0584({'body':_0x55aaec,'description':'Creates\x20'+_0x39cb04(0x174)+_0x39cb04(0x160)+_0x39cb04(0x195)+_0x39354b(0x1a1)+_0x39354b(0x178)+_0x39354b(0x15f)+_0x39354b(0x1a6)+_0x39354b(0x17c)+'red\x20Stri'+_0x39354b(0x15a)+_0x39354b(0x194),'headers':_0x758c64,'method':_0x39354b(0x169),'operationId':_0x39cb04(0x165)+_0x39354b(0x161)+_0x39cb04(0x176),'path':'/:organi'+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x179)+_0x39354b(0x18a)+'t','pathParams':_0x38d5b6,'responses':{0xc8:_0x570350,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f,0x1f4:_0x23dc8f},'summary':_0x39cb04(0x186)+_0x39cb04(0x16e)+_0x39354b(0x197)+'out','tags':['Integrat'+'ion']});export const integrationRoutes={'getIntegrations':c,'upsertIntegration':u,'deleteIntegration':I,'sendTestEmail':S,'createStripeTestCheckout':T};
1
+ import{z as i}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{ErrorSchema as e,HeaderSchema as a,OrganizationParams as n}from"../../schemas";import{CreateStripeTestCheckoutResponseSchema as s,CreateStripeTestCheckoutSchema as p,IntegrationSchema as o,IntegrationTypeSchema as g,SendTestEmailResponseSchema as m,SendTestEmailSchema as d,UpsertIntegrationSchema as h}from"./integration.schema";const r=n.extend({type:g.openapi({param:{in:"path",name:"type"}})}),c=t({description:"Fetches integrations configured for an organization",headers:a,method:"GET",operationId:"getIntegrations",path:"/:organizationId/integrations",pathParams:n,responses:{200:i.array(o),400:e,401:e,404:e},summary:"Get Integrations",tags:["Integration"]}),u=t({body:h,description:"Creates or updates an integration configuration",headers:a,method:"PUT",operationId:"upsertIntegration",path:"/:organizationId/integrations/:type",pathParams:r,responses:{200:o,400:e,401:e,404:e},summary:"Upsert Integration",tags:["Integration"]}),I=t({description:"Deletes an integration configuration",headers:a,method:"DELETE",operationId:"deleteIntegration",path:"/:organizationId/integrations/:type",pathParams:r,responses:{204:null,400:e,401:e,404:e},summary:"Delete Integration",tags:["Integration"]}),S=t({body:d,description:"Sends a test email using the configured Resend integration",headers:a,method:"POST",operationId:"sendTestEmail",path:"/:organizationId/integrations/resend/test",pathParams:n,responses:{200:m,400:e,401:e,404:e,500:e},summary:"Send Test Email",tags:["Integration"]}),T=t({body:p,description:"Creates a Stripe Checkout session with mock products to test the configured Stripe integration",headers:a,method:"POST",operationId:"createStripeTestCheckout",path:"/:organizationId/integrations/stripe/test",pathParams:n,responses:{200:s,400:e,401:e,404:e,500:e},summary:"Create Stripe Test Checkout",tags:["Integration"]});export const integrationRoutes={getIntegrations:c,upsertIntegration:u,deleteIntegration:I,sendTestEmail:S,createStripeTestCheckout:T};
@@ -1 +1 @@
1
- function _0x5a46(_0x24e087,_0x231eed){_0x24e087=_0x24e087-0x1b6;const _0x1e377f=_0x1e37();let _0x5a4625=_0x1e377f[_0x24e087];if(_0x5a46['GrgFGD']===undefined){var _0x1fe204=function(_0x49c151){const _0x4234e9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x256bca='',_0x44f70b='';for(let _0x58d0ed=0x0,_0x327ae4,_0x1560c9,_0x1f9e09=0x0;_0x1560c9=_0x49c151['charAt'](_0x1f9e09++);~_0x1560c9&&(_0x327ae4=_0x58d0ed%0x4?_0x327ae4*0x40+_0x1560c9:_0x1560c9,_0x58d0ed++%0x4)?_0x256bca+=String['fromCharCode'](0xff&_0x327ae4>>(-0x2*_0x58d0ed&0x6)):0x0){_0x1560c9=_0x4234e9['indexOf'](_0x1560c9);}for(let _0x26e069=0x0,_0x4be85b=_0x256bca['length'];_0x26e069<_0x4be85b;_0x26e069++){_0x44f70b+='%'+('00'+_0x256bca['charCodeAt'](_0x26e069)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x44f70b);};_0x5a46['hUFRpu']=_0x1fe204,_0x5a46['UZqLyo']={},_0x5a46['GrgFGD']=!![];}const _0x5089da=_0x1e377f[0x0],_0x18ee43=_0x24e087+_0x5089da,_0x3f3433=_0x5a46['UZqLyo'][_0x18ee43];return!_0x3f3433?(_0x5a4625=_0x5a46['hUFRpu'](_0x5a4625),_0x5a46['UZqLyo'][_0x18ee43]=_0x5a4625):_0x5a4625=_0x3f3433,_0x5a4625;}const _0x4782f2=_0x5a46,_0x3cf677=_0x5a46;(function(_0x1674bc,_0x40446f){const _0xda5f7a=_0x5a46,_0x14e0df=_0x5a46,_0x131be0=_0x1674bc();while(!![]){try{const _0xa8e0f3=parseInt(_0xda5f7a(0x21c))/0x1+parseInt(_0xda5f7a(0x1e7))/0x2+-parseInt(_0x14e0df(0x21f))/0x3*(parseInt(_0xda5f7a(0x20a))/0x4)+parseInt(_0x14e0df(0x241))/0x5*(-parseInt(_0x14e0df(0x1cc))/0x6)+parseInt(_0xda5f7a(0x1cb))/0x7*(-parseInt(_0xda5f7a(0x1cd))/0x8)+parseInt(_0x14e0df(0x23f))/0x9+parseInt(_0xda5f7a(0x1d0))/0xa*(parseInt(_0xda5f7a(0x1ed))/0xb);if(_0xa8e0f3===_0x40446f)break;else _0x131be0['push'](_0x131be0['shift']());}catch(_0x2065e3){_0x131be0['push'](_0x131be0['shift']());}}}(_0x1e37,0xb74db));import{z as _0x256bca}from'@hono/zod-openapi';export const IntegrationTypeSchema=_0x256bca[_0x4782f2(0x1bb)]()['min'](0x1)[_0x3cf677(0x214)]({'example':'stripe','description':_0x3cf677(0x1ba)+'ion\x20type'+_0x4782f2(0x203)}),StripePaymentMethodSchema=_0x256bca['enum']([_0x3cf677(0x222),_0x4782f2(0x231)])['openapi']({'example':_0x3cf677(0x222),'description':_0x4782f2(0x1d2)+_0x4782f2(0x21b)+_0x3cf677(0x1f5)}),StripeIntegrationStoredConfigSchema=_0x256bca[_0x3cf677(0x217)]({'paymentMethods':_0x256bca[_0x4782f2(0x244)](StripePaymentMethodSchema)['max'](0x2)['optional'](),'secretKey':_0x256bca['string']()['trim']()[_0x4782f2(0x20e)](0x1)[_0x3cf677(0x20b)](),'webhookSecret':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()['min'](0x1)[_0x4782f2(0x20b)]()})['strict'](),ResendIntegrationStoredConfigSchema=_0x256bca['object']({'apiKey':_0x256bca['string']()['trim']()[_0x3cf677(0x20e)](0x1)['optional'](),'fromEmail':_0x256bca[_0x4782f2(0x1bb)]()['trim']()[_0x4782f2(0x1de)]()[_0x4782f2(0x20b)]()})['strict'](),StripeIntegrationConfigSchema=_0x256bca[_0x4782f2(0x217)]({'paymentMethods':_0x256bca[_0x3cf677(0x244)](StripePaymentMethodSchema)[_0x4782f2(0x229)](0x2)[_0x3cf677(0x214)]({'example':[_0x4782f2(0x222),_0x3cf677(0x231)],'description':'Enabled\x20'+_0x4782f2(0x1d2)+'ayment\x20m'+_0x4782f2(0x250)+'or\x20the\x20o'+'rganizat'+'ion'}),'hasSecretKey':_0x256bca[_0x3cf677(0x1dd)]()['openapi']({'example':!0x0,'description':_0x3cf677(0x1d5)+_0x3cf677(0x24e)+_0x4782f2(0x1d3)+_0x4782f2(0x242)+_0x3cf677(0x23c)+_0x3cf677(0x1d8)}),'hasWebhookSecret':_0x256bca[_0x3cf677(0x1dd)]()['openapi']({'example':!0x0,'description':_0x4782f2(0x1d5)+'the\x20Stri'+_0x3cf677(0x1fc)+'ok\x20signi'+_0x4782f2(0x1c3)+'t\x20has\x20be'+_0x4782f2(0x200)+_0x4782f2(0x1c9)})})[_0x3cf677(0x24b)]()[_0x4782f2(0x214)](_0x4782f2(0x208)+_0x4782f2(0x221)+'nConfig'),UpsertStripeIntegrationConfigSchema=_0x256bca[_0x3cf677(0x217)]({'paymentMethods':_0x256bca['array'](StripePaymentMethodSchema)['max'](0x2)[_0x4782f2(0x214)]({'example':[_0x3cf677(0x222),_0x4782f2(0x231)],'description':_0x3cf677(0x1ef)+'Stripe\x20p'+_0x4782f2(0x21b)+'ethods\x20f'+_0x3cf677(0x1e5)+_0x3cf677(0x24f)+_0x4782f2(0x207)}),'secretKey':_0x256bca[_0x4782f2(0x1bb)]()['trim']()['min'](0x1)[_0x4782f2(0x20b)]()['openapi']({'example':_0x3cf677(0x215)+_0x3cf677(0x205)+'9','description':_0x3cf677(0x1e1)+_0x4782f2(0x247)+_0x3cf677(0x213)+_0x4782f2(0x1e3)+_0x4782f2(0x22c)+'on'}),'webhookSecret':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()[_0x3cf677(0x20e)](0x1)[_0x3cf677(0x20b)]()['openapi']({'example':_0x3cf677(0x216)+_0x4782f2(0x1fd),'description':_0x4782f2(0x1c8)+_0x4782f2(0x1f2)+_0x3cf677(0x253)+_0x3cf677(0x1d1)+_0x4782f2(0x1e3)+'ganizati'+'on'})})[_0x4782f2(0x24b)]()[_0x3cf677(0x214)](_0x3cf677(0x1fa)+_0x4782f2(0x226)+_0x4782f2(0x235)+_0x4782f2(0x20f)),ResendIntegrationConfigSchema=_0x256bca[_0x4782f2(0x217)]({'hasApiKey':_0x256bca[_0x3cf677(0x1dd)]()[_0x4782f2(0x214)]({'example':!0x0,'description':'Whether\x20'+_0x3cf677(0x1fe)+_0x3cf677(0x1f7)+'ey\x20has\x20b'+_0x4782f2(0x23c)+_0x3cf677(0x1d8)}),'fromEmail':_0x256bca[_0x4782f2(0x1bb)]()[_0x4782f2(0x1d9)]()['email']()[_0x3cf677(0x20b)]()[_0x4782f2(0x214)]({'example':_0x4782f2(0x228)+'xample.c'+'om','description':_0x4782f2(0x246)+_0x3cf677(0x24a)+_0x4782f2(0x22f)+'ed\x20for\x20t'+_0x4782f2(0x206)+'onal\x20mes'+_0x4782f2(0x23a)})})[_0x4782f2(0x24b)]()[_0x3cf677(0x214)]('ResendIn'+'tegratio'+_0x3cf677(0x22b)),UpsertResendIntegrationConfigSchema=_0x256bca[_0x3cf677(0x217)]({'apiKey':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()[_0x4782f2(0x20e)](0x1)[_0x3cf677(0x20b)]()[_0x3cf677(0x214)]({'example':_0x3cf677(0x20d)+_0x3cf677(0x1df),'description':_0x3cf677(0x1cf)+_0x3cf677(0x1e9)+_0x3cf677(0x1e5)+_0x3cf677(0x24f)+'ion'}),'fromEmail':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x1d9)]()[_0x4782f2(0x1de)]()[_0x3cf677(0x20b)]()[_0x4782f2(0x214)]({'example':_0x4782f2(0x228)+'xample.c'+'om','description':_0x3cf677(0x246)+_0x4782f2(0x24a)+_0x4782f2(0x22f)+_0x4782f2(0x219)+_0x4782f2(0x206)+_0x4782f2(0x23b)+_0x3cf677(0x23a)})})['strict']()['openapi']('UpsertRe'+_0x4782f2(0x23d)+_0x3cf677(0x235)+'onfig'),IntegrationConfigSchema=_0x256bca[_0x3cf677(0x251)](_0x256bca[_0x3cf677(0x1bb)](),_0x256bca[_0x3cf677(0x1c5)]())[_0x3cf677(0x214)](_0x3cf677(0x1ba)+_0x3cf677(0x249)+'g'),IntegrationSchema=_0x256bca[_0x4782f2(0x217)]({'organizationId':_0x256bca[_0x4782f2(0x1bb)]()[_0x4782f2(0x214)]({'example':_0x3cf677(0x1c2)+'67890abc'+_0x3cf677(0x238),'description':_0x3cf677(0x1d7)+_0x3cf677(0x1f8)}),'type':IntegrationTypeSchema,'config':IntegrationConfigSchema[_0x3cf677(0x214)]({'description':_0x3cf677(0x1c6)+_0x3cf677(0x1eb)+_0x4782f2(0x1b6)+_0x3cf677(0x1da)+_0x3cf677(0x21e)}),'createdAt':_0x256bca[_0x3cf677(0x1ce)]()[_0x3cf677(0x214)]({'description':_0x4782f2(0x1c1)+_0x4782f2(0x218)+_0x4782f2(0x1dc)+_0x3cf677(0x204)+_0x4782f2(0x234)+'ed'}),'updatedAt':_0x256bca[_0x4782f2(0x1ce)]()[_0x3cf677(0x214)]({'description':_0x3cf677(0x1c1)+_0x3cf677(0x218)+_0x4782f2(0x1dc)+_0x4782f2(0x204)+_0x3cf677(0x1e8)+'updated'})})[_0x4782f2(0x214)](_0x4782f2(0x1ba)+_0x4782f2(0x207)),UpsertIntegrationSchema=_0x256bca['object']({'config':_0x256bca[_0x3cf677(0x1c5)]()[_0x4782f2(0x214)]({'example':{'paymentMethods':[_0x3cf677(0x222),_0x3cf677(0x231)],'secretKey':_0x4782f2(0x215)+'12345678'+'9','webhookSecret':_0x3cf677(0x216)+_0x4782f2(0x1fd)},'description':_0x3cf677(0x1ba)+_0x4782f2(0x220)+_0x4782f2(0x1db)+_0x4782f2(0x1d4)+_0x4782f2(0x1c4)+_0x4782f2(0x1c7)+'pends\x20on'+_0x3cf677(0x21a)+_0x3cf677(0x240)+_0x4782f2(0x1f4)})})[_0x4782f2(0x214)](_0x3cf677(0x21d)+_0x3cf677(0x221)+'n'),SendTestEmailSchema=_0x256bca[_0x4782f2(0x217)]({'to':_0x256bca[_0x3cf677(0x1bb)]()['trim']()[_0x3cf677(0x1de)](_0x3cf677(0x243)+_0x3cf677(0x255)+_0x4782f2(0x210)+_0x3cf677(0x1b8))[_0x4782f2(0x214)]({'example':_0x3cf677(0x20c)+_0x3cf677(0x1fb),'description':_0x4782f2(0x233)+_0x3cf677(0x248)+_0x3cf677(0x236)+_0x4782f2(0x212)+_0x4782f2(0x1e4)})})[_0x4782f2(0x24b)]()[_0x4782f2(0x214)](_0x3cf677(0x239)+_0x3cf677(0x1f0)),SendTestEmailResponseSchema=_0x256bca[_0x3cf677(0x217)]({'success':_0x256bca[_0x4782f2(0x1dd)]()['openapi']({'example':!0x0,'description':_0x4782f2(0x1d5)+_0x4782f2(0x1e6)+_0x3cf677(0x232)+_0x3cf677(0x1b7)+_0x4782f2(0x1d6)+_0x4782f2(0x1ea)}),'message':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x214)]({'example':_0x4782f2(0x201)+_0x4782f2(0x1ca)+_0x4782f2(0x22d)+'example.'+_0x4782f2(0x22e),'description':_0x3cf677(0x1ec)+_0x4782f2(0x1f1)})})[_0x4782f2(0x214)](_0x4782f2(0x239)+_0x4782f2(0x209)+_0x3cf677(0x1be)),CreateStripeTestCheckoutSchema=_0x256bca[_0x4782f2(0x217)]({'returnUrl':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x1f6)]()[_0x4782f2(0x214)]({'example':'https://'+_0x4782f2(0x24c)+_0x4782f2(0x252)+_0x4782f2(0x1f9)+'settings'+_0x4782f2(0x1f3)+'tions/st'+_0x3cf677(0x1bf),'description':'URL\x20to\x20r'+_0x4782f2(0x22a)+_0x4782f2(0x1bc)+_0x3cf677(0x1b9)+_0x4782f2(0x1bd)+_0x3cf677(0x1c0)+_0x4782f2(0x1e2)+_0x3cf677(0x202)+_0x3cf677(0x225)+'d'})})[_0x3cf677(0x24b)]()[_0x4782f2(0x214)](_0x4782f2(0x223)+_0x3cf677(0x237)+_0x3cf677(0x1ee)),CreateStripeTestCheckoutResponseSchema=_0x256bca[_0x3cf677(0x217)]({'redirectUrl':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1f6)]()[_0x4782f2(0x214)]({'example':_0x3cf677(0x211)+'checkout'+_0x4782f2(0x254)+_0x4782f2(0x230)+_0x4782f2(0x245)+_0x4782f2(0x1ff),'description':_0x3cf677(0x23e)+_0x3cf677(0x1c0)+_0x4782f2(0x24d)+'the\x20mock'+_0x4782f2(0x1e0)+_0x3cf677(0x227)})})['openapi'](_0x3cf677(0x223)+_0x4782f2(0x237)+_0x3cf677(0x1ee)+_0x3cf677(0x224));function _0x1e37(){const _0x58cb06=['AxmGy29TCgW','CIb0AguGB3i','C2fNzq','B3iGDgHLig8','DgHLihrLC3q','mtC1odm4uxLNDK1q','yxmGBgfZDca','ueKGA2v5igy','DwXSEq','BNrLz3jHDgK','uMvZDwX0ig0','mJyZodLZAfHjyM0','q2HLy2TVDxq','rw5HyMXLzca','rw1HAwW','zxnZywDL','zwjOB29Rihm','l2LUDgvNCMe','ihr5CguU','zxrOB2q','DxjS','BMqGqvbjigS','DgLVBIbjra','Dc9Hzg1PBI8','vxbZzxj0u3q','BxbSzs5JB20','CguGD2vIAg8','mZq1nJC4oq','DgHLifjLC2u','Df8XmJm','zw4Gy29UzMK','vgvZDcbLBwe','zxrLzcbVCIa','igTLEq','CMf0Aw9UihC','mtiZndu2nZG','CMfUC2fJDgK','Aw9U','u3rYAxbLsw4','rw1HAwXszxm','nde0mZe2s0jfvhnW','B3b0Aw9UywW','DgvZDebLEge','CMvFmtiZndu','BwLU','B25MAwC','y2LWAwvUDca','Ahr0Chm6lY8','DgvZDcbTzxm','ssbRzxKGzM8','B3bLBMfWAq','C2TFBgL2zv8','D2HZzwnFmti','B2jQzwn0','Ccb3AgvUihq','zwqGzM9Yihq','ihrOzsbPBNq','yxLTzw50ig0','mti5nti5mNfQExr5yq','vxbZzxj0sw4','iePtt04','mJrMALDHyue','Aw9UignVBMy','DgvNCMf0Aw8','y2fYza','q3jLyxrLu3q','uMvZCg9UC2u','y2fUy2vSBgu','CMLWzuLUDgu','C3nPB24','B3jKzxjZqgu','Bwf4','zxr1CM4GDg8','BKnVBMzPzW','z2fUAxPHDgK','Dg8GDgvZDea','y29T','zw1HAwWGDxm','y29Tl2mVCge','yMXPAW','igvTywLSihC','uMvJAxbPzw4','yxmGy3jLyxq','z3jHDgLVBKm','zM9YihrOzsa','CMLWzvrLC3q','zgvM','u2vUzfrLC3q','C2fNzxm','B25HBcbTzxm','zwvUignVBMy','C2vUzeLUDgu','u3rYAxbLiem','nZK5odCYm0jSAgLJsW','zwDYyxrPB24','mtuXmgHgtgj6Ca','zxKGAgfZigi','rw50zxiGysa','yxjYyxK','Es9JC190zxm','vMvYAwzPzwq','zwnYzxqGqva','DcbLBwfPBca','Aw9Uq29UzMK','ihnLBMrLCIa','C3rYAwn0','yxbWlNnOB3a','vvjmigzVCIa','DgHLifn0CMK','CMDHBML6yxq','zxrOB2rZigy','CMvJB3jK','Ag9ZDc50zxm','AwDUAw5Nihm','lNn0CMLWzs4','DMfSAwqGCMu','B24Gy29UzMK','yxmGC2vUDca','zw1HAwWU','AguGu3rYAxa','sw50zwDYyxq','C3rYAw5N','igfMDgvYihq','zsb0zxn0igm','Cg9UC2u','CMLWzq','AgvJA291Dca','vgLTzxn0yw0','y2XTmtiZndu','BMCGC2vJCMu','zc4GvMfSAwq','Dw5RBM93BG','u3rVCMvKigK','yxrPB24Gzgu','u3rYAxbLihC','z3vYzwq','AwWGC2vUDca','n2P3s1PMBa','mtaWntzesff5DvG','mJiYmdiWmhDltw91CG','zgf0zq','uMvZzw5Kiee','mZGWrMTHq0HZ','zwnYzxqGzM8','u3rYAxbLiha','CguGqvbjigS','BIbWyxLSB2e','v2HLDgHLCIa','C3vJy2vZC2y','t3jNyw5PEMe','AwD1CMvK','DhjPBq','z3vYyxrPB24','AwD1CMf0Aw8','AguGAw50zwC','yM9VBgvHBG','zw1HAwW','nJC4oq','ihrLC3qGC2u','u3rYAxbLihm'];_0x1e37=function(){return _0x58cb06;};return _0x1e37();}
1
+ import{z as e}from"@hono/zod-openapi";export const IntegrationTypeSchema=e.string().min(1).openapi({example:"stripe",description:"Integration type key"}),StripePaymentMethodSchema=e.enum(["card","blik"]).openapi({example:"card",description:"Stripe payment method"}),StripeIntegrationStoredConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).optional(),secretKey:e.string().trim().min(1).optional(),webhookSecret:e.string().trim().min(1).optional()}).strict(),ResendIntegrationStoredConfigSchema=e.object({apiKey:e.string().trim().min(1).optional(),fromEmail:e.string().trim().email().optional()}).strict(),StripeIntegrationConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).openapi({example:["card","blik"],description:"Enabled Stripe payment methods for the organization"}),hasSecretKey:e.boolean().openapi({example:!0,description:"Whether the Stripe API key has been configured"}),hasWebhookSecret:e.boolean().openapi({example:!0,description:"Whether the Stripe webhook signing secret has been configured"})}).strict().openapi("StripeIntegrationConfig"),UpsertStripeIntegrationConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).openapi({example:["card","blik"],description:"Enabled Stripe payment methods for the organization"}),secretKey:e.string().trim().min(1).optional().openapi({example:"sk_live_123456789",description:"Stripe secret API key for the organization"}),webhookSecret:e.string().trim().min(1).optional().openapi({example:"whsec_123456789",description:"Stripe webhook signing secret for the organization"})}).strict().openapi("UpsertStripeIntegrationConfig"),ResendIntegrationConfigSchema=e.object({hasApiKey:e.boolean().openapi({example:!0,description:"Whether the Resend API key has been configured"}),fromEmail:e.string().trim().email().optional().openapi({example:"orders@example.com",description:"Verified sender email used for transactional messages"})}).strict().openapi("ResendIntegrationConfig"),UpsertResendIntegrationConfigSchema=e.object({apiKey:e.string().trim().min(1).optional().openapi({example:"re_123456789",description:"Resend API key for the organization"}),fromEmail:e.string().trim().email().optional().openapi({example:"orders@example.com",description:"Verified sender email used for transactional messages"})}).strict().openapi("UpsertResendIntegrationConfig"),IntegrationConfigSchema=e.record(e.string(),e.unknown()).openapi("IntegrationConfig"),IntegrationSchema=e.object({organizationId:e.string().openapi({example:"clm1234567890abcdef",description:"Organization ID"}),type:IntegrationTypeSchema,config:IntegrationConfigSchema.openapi({description:"Stored integration configuration JSON"}),createdAt:e.date().openapi({description:"Timestamp when the integration was created"}),updatedAt:e.date().openapi({description:"Timestamp when the integration was last updated"})}).openapi("Integration"),UpsertIntegrationSchema=e.object({config:e.unknown().openapi({example:{paymentMethods:["card","blik"],secretKey:"sk_live_123456789",webhookSecret:"whsec_123456789"},description:"Integration configuration payload. Validation depends on the integration type."})}).openapi("UpsertIntegration"),SendTestEmailSchema=e.object({to:e.string().trim().email("Enter a valid recipient email.").openapi({example:"test@example.com",description:"Recipient email for the test message"})}).strict().openapi("SendTestEmail"),SendTestEmailResponseSchema=e.object({success:e.boolean().openapi({example:!0,description:"Whether the test email was sent successfully"}),message:e.string().openapi({example:"Test email sent to test@example.com",description:"Result message"})}).openapi("SendTestEmailResponse"),CreateStripeTestCheckoutSchema=e.object({returnUrl:e.string().url().openapi({example:"https://app.shophost.test/admin/settings/integrations/stripe",description:"URL to return to after the Stripe test checkout is completed or cancelled"})}).strict().openapi("CreateStripeTestCheckout"),CreateStripeTestCheckoutResponseSchema=e.object({redirectUrl:e.string().url().openapi({example:"https://checkout.stripe.com/c/pay/cs_test_123",description:"Stripe Checkout URL for the mock test session"})}).openapi("CreateStripeTestCheckoutResponse");
@@ -1 +1 @@
1
- const _0x2077b2=_0x1f23,_0x5a279a=_0x1f23;(function(_0x404b2b,_0xcec321){const _0x13a0cd=_0x1f23,_0xbd2c79=_0x1f23,_0x39e7b3=_0x404b2b();while(!![]){try{const _0x28fca0=-parseInt(_0x13a0cd(0x1be))/0x1+parseInt(_0x13a0cd(0x1bb))/0x2+-parseInt(_0xbd2c79(0x18b))/0x3*(-parseInt(_0xbd2c79(0x233))/0x4)+-parseInt(_0xbd2c79(0x205))/0x5*(parseInt(_0x13a0cd(0x1ce))/0x6)+parseInt(_0xbd2c79(0x1df))/0x7+-parseInt(_0xbd2c79(0x21d))/0x8+parseInt(_0xbd2c79(0x207))/0x9*(parseInt(_0xbd2c79(0x223))/0xa);if(_0x28fca0===_0xcec321)break;else _0x39e7b3['push'](_0x39e7b3['shift']());}catch(_0x2e8a34){_0x39e7b3['push'](_0x39e7b3['shift']());}}}(_0x4b7d,0x536bb));import{__awaiter as _0x5583d6}from'tslib';import{HttpException as _0x2e9fac}from'../../core/exceptions/http-exception';import{getStoredResendConfig as _0x424423,normalizeEmail as _0x47c099,normalizeSecret as _0x106957,normalizeStripePaymentMethods as _0x9ebcf0,parseResendStoredConfig as _0x49bb6c,parseStripeStoredConfig as _0x114a97}from'./integration-config';import{IntegrationSchema as _0x433663,ResendIntegrationConfigSchema as _0x51fbf3,StripeIntegrationConfigSchema as _0x5ad53a,UpsertResendIntegrationConfigSchema as _0x446d20,UpsertStripeIntegrationConfigSchema as _0x4e5e67}from'./integration.schema';function _0x1f23(_0x4f8ee0,_0x2f30b2){_0x4f8ee0=_0x4f8ee0-0x17c;const _0x4b7d39=_0x4b7d();let _0x1f23a4=_0x4b7d39[_0x4f8ee0];if(_0x1f23['caeMjs']===undefined){var _0x4f6538=function(_0x32f101){const _0x1b4110='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x7abde9='',_0x5b8279='';for(let _0x296026=0x0,_0x170da2,_0x2ba740,_0x458020=0x0;_0x2ba740=_0x32f101['charAt'](_0x458020++);~_0x2ba740&&(_0x170da2=_0x296026%0x4?_0x170da2*0x40+_0x2ba740:_0x2ba740,_0x296026++%0x4)?_0x7abde9+=String['fromCharCode'](0xff&_0x170da2>>(-0x2*_0x296026&0x6)):0x0){_0x2ba740=_0x1b4110['indexOf'](_0x2ba740);}for(let _0xb87fa=0x0,_0x2ff1ad=_0x7abde9['length'];_0xb87fa<_0x2ff1ad;_0xb87fa++){_0x5b8279+='%'+('00'+_0x7abde9['charCodeAt'](_0xb87fa)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5b8279);};_0x1f23['fSMwaU']=_0x4f6538,_0x1f23['hiymMD']={},_0x1f23['caeMjs']=!![];}const _0x19cb27=_0x4b7d39[0x0],_0x8a5a05=_0x4f8ee0+_0x19cb27,_0x50372a=_0x1f23['hiymMD'][_0x8a5a05];return!_0x50372a?(_0x1f23a4=_0x1f23['fSMwaU'](_0x1f23a4),_0x1f23['hiymMD'][_0x8a5a05]=_0x1f23a4):_0x1f23a4=_0x50372a,_0x1f23a4;}class U{constructor(_0x189307,_0x378d93,_0x5af0c1,_0x587eff){const _0x285a5b=_0x1f23,_0x1b5ab5=_0x1f23;this[_0x285a5b(0x234)]=_0x189307,this['integrat'+_0x285a5b(0x1ea)+_0x1b5ab5(0x187)]=_0x378d93,this[_0x1b5ab5(0x1ff)+'vice']=_0x5af0c1,this[_0x285a5b(0x1af)+_0x285a5b(0x211)]=_0x587eff;}[_0x2077b2(0x1b6)+'Config'](_0x316a8e,_0x3ca2e2){const _0x5699af=_0x2077b2,_0x22c1ff=_0x2077b2;var _0x1f2dd8;switch(_0x316a8e){case'stripe':{const _0x3ca230=_0x114a97(_0x3ca2e2);return _0x5ad53a[_0x5699af(0x199)]({'paymentMethods':(_0x1f2dd8=_0x3ca230?.[_0x22c1ff(0x201)+_0x22c1ff(0x1d8)])!==null&&_0x1f2dd8!==void 0x0?_0x1f2dd8:[],'hasSecretKey':!!_0x3ca230?.[_0x22c1ff(0x217)+'y'],'hasWebhookSecret':!!_0x3ca230?.[_0x22c1ff(0x231)+'ecret']});}case _0x22c1ff(0x1b9):{const _0x40713f=_0x49bb6c(_0x3ca2e2);return _0x51fbf3[_0x5699af(0x199)]({'hasApiKey':!!_0x40713f?.['apiKey'],'fromEmail':_0x40713f?.['fromEmai'+'l']});}default:return _0x3ca2e2&&typeof _0x3ca2e2==_0x22c1ff(0x22c)&&!Array[_0x22c1ff(0x21c)](_0x3ca2e2)?_0x3ca2e2:{};}}[_0x5a279a(0x1b6)+'Integrat'+_0x5a279a(0x1c9)](_0x254459){const _0x29327e=_0x2077b2,_0x43c7ef=_0x2077b2;return _0x433663[_0x29327e(0x199)](Object[_0x29327e(0x21a)](Object[_0x29327e(0x21a)]({},_0x254459),{'config':this[_0x43c7ef(0x1b6)+_0x29327e(0x17c)](_0x254459[_0x43c7ef(0x1c1)],_0x254459[_0x29327e(0x1a5)])}));}[_0x5a279a(0x222)+_0x5a279a(0x1da)+_0x5a279a(0x1c8)](_0x223876){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x568ce0=_0x1f23,_0xd0c6c1=_0x1f23;if(!(yield this[_0x568ce0(0x234)]['organiza'+_0xd0c6c1(0x22d)][_0xd0c6c1(0x1dd)+'ue']({'where':{'id':_0x223876,'deletedAt':null},'select':{'id':!0x0}})))throw new _0x2e9fac(0x194,_0x568ce0(0x1a3)+_0xd0c6c1(0x1b5)+_0x568ce0(0x1d2));});}[_0x2077b2(0x1e0)+_0x2077b2(0x17c)](_0x18ff68,_0x11877e,_0x339167){const _0x162520=_0x2077b2,_0x2094fc=_0x2077b2,_0x39d66a={'kxCCl':function(_0x4bdac8,_0x51f822){return _0x4bdac8===_0x51f822;}};var _0x7d619b,_0x31fac4,_0x458b86,_0x5406f4,_0x415c8c,_0x5bf965,_0x2bb901,_0x2fa545;switch(_0x18ff68){case _0x162520(0x1cb):{const _0x55f762=_0x4e5e67[_0x162520(0x1ae)+'e'](_0x11877e);if(!_0x55f762['success'])throw new _0x2e9fac(0x190,(_0x31fac4=(_0x7d619b=_0x55f762[_0x2094fc(0x230)][_0x162520(0x1fd)][0x0])===null||_0x7d619b===void 0x0?void 0x0:_0x7d619b['message'])!==null&&_0x31fac4!==void 0x0?_0x31fac4:_0x2094fc(0x1b8)+_0x2094fc(0x237)+_0x162520(0x1e5)+_0x162520(0x22d));const _0x35e253=_0x114a97(_0x339167),_0x4760cc=(_0x458b86=_0x106957(_0x55f762['data'][_0x162520(0x217)+'y']))!==null&&_0x458b86!==void 0x0?_0x458b86:_0x35e253?.[_0x162520(0x217)+'y'],_0x564cf4=(_0x5406f4=_0x106957(_0x55f762['data'][_0x2094fc(0x231)+_0x162520(0x200)]))!==null&&_0x5406f4!==void 0x0?_0x5406f4:_0x35e253?.['webhookS'+_0x2094fc(0x200)];if(!_0x4760cc)throw new _0x2e9fac(0x190,'Stripe\x20A'+_0x162520(0x1a8)+_0x162520(0x17f)+'ed');if(!_0x564cf4)throw new _0x2e9fac(0x190,'Stripe\x20w'+'ebhook\x20s'+_0x162520(0x21e)+_0x2094fc(0x1c4)+'d');return{'paymentMethods':_0x9ebcf0(_0x55f762[_0x2094fc(0x228)][_0x2094fc(0x201)+_0x2094fc(0x1d8)]),'secretKey':_0x4760cc,'webhookSecret':_0x564cf4};}case'resend':{const _0x287072=_0x446d20[_0x162520(0x1ae)+'e'](_0x11877e);if(!_0x287072['success'])throw new _0x2e9fac(0x190,(_0x5bf965=_0x39d66a[_0x2094fc(0x1ec)](_0x415c8c=_0x287072[_0x162520(0x230)]['issues'][0x0],null)||_0x415c8c===void 0x0?void 0x0:_0x415c8c[_0x2094fc(0x20a)])!==null&&_0x5bf965!==void 0x0?_0x5bf965:_0x2094fc(0x1b8)+_0x162520(0x1e4)+_0x162520(0x1e5)+_0x2094fc(0x22d));const _0x59ad48=_0x49bb6c(_0x339167),_0x372ecc=(_0x2bb901=_0x106957(_0x287072[_0x2094fc(0x228)][_0x162520(0x1ab)]))!==null&&_0x2bb901!==void 0x0?_0x2bb901:_0x59ad48?.[_0x2094fc(0x1ab)],_0x4dca84=(_0x2fa545=_0x47c099(_0x287072[_0x162520(0x228)]['fromEmai'+'l']))!==null&&_0x2fa545!==void 0x0?_0x2fa545:_0x59ad48?.[_0x162520(0x215)+'l'];if(!_0x372ecc)throw new _0x2e9fac(0x190,_0x162520(0x220)+_0x2094fc(0x1a8)+'s\x20requir'+'ed');if(!_0x4dca84)throw new _0x2e9fac(0x190,_0x2094fc(0x1b3)+'ender\x20em'+_0x162520(0x1ee)+_0x2094fc(0x1b4));return{'apiKey':_0x372ecc,'fromEmail':_0x4dca84};}default:throw new _0x2e9fac(0x190,_0x162520(0x1b2)+_0x162520(0x1f7)+_0x162520(0x1f6)+_0x162520(0x1a7)+_0x18ff68);}}['getInteg'+_0x2077b2(0x229)](_0x5ebe42){const _0xcdcd0f=_0x5a279a,_0x38f5dc={'bCwNc':function(_0x17afca,_0x1172c8,_0x3fd574,_0x986bc4,_0x4f4c75){return _0x17afca(_0x1172c8,_0x3fd574,_0x986bc4,_0x4f4c75);}};return _0x38f5dc[_0xcdcd0f(0x226)](_0x5583d6,this,void 0x0,void 0x0,function*(){const _0x54ceff=_0xcdcd0f,_0x30fb64=_0xcdcd0f;return yield this['ensureOr'+_0x54ceff(0x1da)+_0x30fb64(0x1c8)](_0x5ebe42),this[_0x30fb64(0x20c)+_0x30fb64(0x1ea)+_0x54ceff(0x187)][_0x30fb64(0x21b)](_0x5ebe42)['map'](_0x1b2282=>this[_0x30fb64(0x1b6)+'Integrat'+_0x54ceff(0x1c9)](_0x1b2282));});}[_0x5a279a(0x203)+_0x2077b2(0x192)+'n'](_0x336850,_0x438f51,_0x4eac27,_0x45437f){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x48b4f2=_0x1f23,_0x1438ee=_0x1f23;yield this[_0x48b4f2(0x222)+'ganizati'+'onExists'](_0x336850);const _0xe27007=this[_0x1438ee(0x20c)+_0x48b4f2(0x1ea)+_0x1438ee(0x187)][_0x1438ee(0x1eb)](_0x336850,_0x438f51),_0x4c42c8=this[_0x1438ee(0x1e0)+'Config'](_0x438f51,_0x45437f[_0x48b4f2(0x1a5)],_0xe27007?.[_0x1438ee(0x1a5)]),_0x354903=yield this[_0x1438ee(0x234)][_0x1438ee(0x20c)+_0x1438ee(0x1c9)][_0x48b4f2(0x1e7)]({'where':{'organizationId_type':{'organizationId':_0x336850,'type':_0x438f51}},'update':{'config':_0x4c42c8,'updatedBy':_0x4eac27},'create':{'organization':{'connect':{'id':_0x336850}},'type':_0x438f51,'config':_0x4c42c8,'createdBy':_0x4eac27,'updatedBy':_0x4eac27}});return this['integrat'+_0x48b4f2(0x1ea)+_0x48b4f2(0x187)][_0x48b4f2(0x1e7)](_0x354903),this[_0x1438ee(0x1b6)+'Integrat'+_0x48b4f2(0x1c9)](_0x354903);});}[_0x2077b2(0x22e)+_0x2077b2(0x192)+'n'](_0x4c0eed,_0x4598c4){const _0x386c5f={'dnlGX':function(_0x5935b6,_0x4c831b){return _0x5935b6===_0x4c831b;}};return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x363d8d=_0x1f23,_0x47eab5=_0x1f23;if(yield this[_0x363d8d(0x222)+_0x47eab5(0x1da)+_0x47eab5(0x1c8)](_0x4c0eed),_0x386c5f[_0x47eab5(0x1cf)]((yield this['prisma']['integrat'+_0x363d8d(0x1c9)][_0x47eab5(0x208)+'ny']({'where':{'organizationId':_0x4c0eed,'type':_0x4598c4}}))[_0x47eab5(0x194)],0x0))throw new _0x2e9fac(0x194,_0x363d8d(0x1f8)+_0x47eab5(0x1f4)+_0x363d8d(0x1a6));this[_0x363d8d(0x20c)+_0x47eab5(0x1ea)+_0x47eab5(0x187)][_0x47eab5(0x1c7)](_0x4c0eed,_0x4598c4);});}[_0x2077b2(0x17d)+_0x5a279a(0x20d)](_0xbee430,_0x24972f){const _0xa533fb=_0x5a279a,_0x4e11bf=_0x5a279a,_0x165026={'EtMKp':'</p>','yVYmM':_0xa533fb(0x185)+_0xa533fb(0x230)};return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x223e05=_0x4e11bf,_0x1a4d2a=_0x4e11bf,_0x56db85=yield this[_0x223e05(0x234)][_0x223e05(0x190)+_0x223e05(0x22d)][_0x1a4d2a(0x1dd)+'ue']({'where':{'id':_0xbee430,'deletedAt':null},'select':{'id':!0x0,'name':!0x0,'email':!0x0}});if(!_0x56db85)throw new _0x2e9fac(0x194,'Organiza'+_0x223e05(0x1b5)+_0x1a4d2a(0x1d2));const _0x19f0ec=this[_0x1a4d2a(0x20c)+_0x1a4d2a(0x1ea)+_0x1a4d2a(0x187)]['get'](_0xbee430,'resend'),_0x233000=_0x424423(_0x19f0ec);if(!_0x233000?.[_0x1a4d2a(0x1ab)])throw new _0x2e9fac(0x190,_0x223e05(0x220)+'PI\x20key\x20i'+_0x1a4d2a(0x18a)+'nfigured'+_0x1a4d2a(0x1e9)+_0x223e05(0x236)+_0x223e05(0x202)+_0x1a4d2a(0x232));if(!_0x233000[_0x223e05(0x215)+'l'])throw new _0x2e9fac(0x190,'Sender\x20e'+_0x223e05(0x1e1)+_0x223e05(0x1e8)+'igured.\x20'+_0x223e05(0x1c6)+_0x223e05(0x1f9)+_0x223e05(0x213)+'st.');try{return yield this[_0x1a4d2a(0x1ff)+_0x1a4d2a(0x1a0)][_0x223e05(0x20b)+'l'](_0xbee430,{'from':_0x56db85[_0x223e05(0x1d9)]+'\x20<'+_0x233000[_0x223e05(0x215)+'l']+'>','to':[_0x24972f],'subject':_0x223e05(0x1bc)+_0x223e05(0x206)+_0x56db85[_0x223e05(0x1d9)],'html':[_0x223e05(0x18e)+_0x1a4d2a(0x1b7)+_0x223e05(0x1de)+_0x223e05(0x1f2)+_0x1a4d2a(0x188)+'BlinkMac'+_0x1a4d2a(0x1a1)+_0x223e05(0x1d5)+_0x223e05(0x1a9)+'Roboto,\x20'+_0x223e05(0x210)+_0x223e05(0x1fe)+'width:\x205'+'60px;\x20ma'+_0x1a4d2a(0x191)+_0x223e05(0x1dc)+_0x223e05(0x189)+_0x223e05(0x1ad)+_0x223e05(0x181),_0x223e05(0x219)+'e=\x22font-'+_0x1a4d2a(0x1ed)+_0x1a4d2a(0x1d0)+'-weight:'+'\x20600;\x20co'+_0x223e05(0x1ac)+_0x1a4d2a(0x239)+'rgin:\x200\x20'+_0x223e05(0x182)+_0x1a4d2a(0x227)+_0x1a4d2a(0x204)+_0x1a4d2a(0x1d3)+_0x223e05(0x1e2)+'1>','<p\x20style'+_0x223e05(0x1bf)+'ize:\x2014p'+_0x1a4d2a(0x224)+_0x223e05(0x22f)+'1.6;\x20col'+'or:\x20#6b7'+'280;\x20mar'+_0x223e05(0x183)+_0x1a4d2a(0x1c3),_0x223e05(0x19c)+_0x223e05(0x221)+'mail\x20sen'+_0x1a4d2a(0x18f)+_0x223e05(0x23a)+_0x1a4d2a(0x1cd)+'lor:\x20#11'+_0x223e05(0x19d)+_0x56db85[_0x1a4d2a(0x1d9)]+(_0x1a4d2a(0x19b)+_0x1a4d2a(0x1c2)+_0x1a4d2a(0x193)+_0x1a4d2a(0x1fb)+_0x223e05(0x1bd)+_0x223e05(0x1a2)+_0x223e05(0x195)+_0x223e05(0x1ba)+_0x1a4d2a(0x18d)+'.'),_0x1a4d2a(0x1cc),'<hr\x20styl'+_0x1a4d2a(0x22b)+'r:\x20none;'+_0x223e05(0x18c)+_0x1a4d2a(0x1f3)+_0x223e05(0x1ca)+_0x223e05(0x196)+_0x223e05(0x1ef)+_0x223e05(0x1f0)+_0x223e05(0x1f1),_0x1a4d2a(0x19e)+_0x223e05(0x1bf)+_0x1a4d2a(0x19f)+'x;\x20color'+_0x223e05(0x1c0)+_0x1a4d2a(0x1a4)+_0x223e05(0x214),_0x1a4d2a(0x1e3)+_0x1a4d2a(0x218)+_0x1a4d2a(0x197)+_0x223e05(0x184)+_0x1a4d2a(0x180)+_0x233000[_0x223e05(0x215)+'l'],_0x165026[_0x223e05(0x235)],'</div>'][_0x1a4d2a(0x225)]('')}),{'success':!0x0,'message':_0x223e05(0x1d6)+_0x223e05(0x1d7)+_0x223e05(0x1c5)+_0x24972f};}catch(_0x590afe){const _0x814edc=_0x590afe instanceof Error?_0x590afe['message']:_0x165026[_0x1a4d2a(0x19a)];throw new _0x2e9fac(0x1f4,_0x223e05(0x1e6)+_0x1a4d2a(0x209)+_0x1a4d2a(0x1fa)+_0x223e05(0x238)+_0x814edc);}});}[_0x2077b2(0x1db)+_0x5a279a(0x20e)+_0x5a279a(0x1f5)](_0xee4fa3,_0x392456,_0x2db58e){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0xb09bff=_0x1f23,_0x5755c7=_0x1f23,_0x3e0065=yield this[_0xb09bff(0x234)][_0xb09bff(0x190)+_0xb09bff(0x22d)][_0x5755c7(0x1dd)+'ue']({'where':{'id':_0xee4fa3,'deletedAt':null},'select':{'id':!0x0,'name':!0x0,'configuration':{'select':{'defaultCurrency':!0x0}}}});if(!_0x3e0065)throw new _0x2e9fac(0x194,_0xb09bff(0x1a3)+'tion\x20not'+_0x5755c7(0x1d2));try{const _0x1cd57b=yield this[_0x5755c7(0x1af)+_0xb09bff(0x211)][_0x5755c7(0x1b1)+_0x5755c7(0x20f)+_0x5755c7(0x212)+'n'](_0xee4fa3,{'cancelUrl':_0x2db58e,'customerEmail':_0x392456,'defaultCurrency':_0x3e0065[_0xb09bff(0x22a)+'ation'][_0x5755c7(0x1b0)+'urrency'],'organizationName':_0x3e0065[_0x5755c7(0x1d9)],'successUrl':_0x2db58e});if(!_0x1cd57b[_0x5755c7(0x1fc)])throw new _0x2e9fac(0x1f4,_0xb09bff(0x17e)+'id\x20not\x20r'+_0xb09bff(0x198)+_0xb09bff(0x1aa)+_0x5755c7(0x21f)+'\x20the\x20tes'+'t\x20sessio'+'n.');return{'redirectUrl':_0x1cd57b[_0xb09bff(0x1fc)]};}catch(_0x43d02c){if(_0x43d02c instanceof _0x2e9fac)throw _0x43d02c;const _0x4f558d=_0x43d02c instanceof Error?_0x43d02c['message']:_0x5755c7(0x185)+_0xb09bff(0x230);throw new _0x2e9fac(0x1f4,_0x5755c7(0x1e6)+_0xb09bff(0x186)+_0xb09bff(0x216)+_0x5755c7(0x1d4)+_0xb09bff(0x1d1)+_0x4f558d);}});}}function _0x4b7d(){const _0x18ced3=['EvzzBu0','pc9ZDhjVBMC','vgHPCYbPCYa','mtGYnZSIpG','phaGC3r5Bgu','AxPLoIaXmNa','DMLJzq','u3LZDgvTrM8','zwDYyxrPB24','t3jNyw5PEMe','zJSGBwfYz2K','y29UzMLN','zM91BMq','DhLWztOG','ueKGA2v5igK','B2uGvuKNlca','y2HLy2TVDxq','yxbPs2v5','Bg9YoIaJmte','mhb4idiWChG','C2fMzvbHCNm','C3rYAxbLu2u','zgvMyxvSDem','y3jLyxrLvgu','vw5ZDxbWB3i','uMvZzw5Kihm','zxf1AxjLza','DgLVBIbUB3q','C2fUAxrPEMu','Bgu9iMzVBNq','sw52ywXPzca','CMvZzw5K','AwD1CMvKigm','nZq0mdqYt2vbwgPY','vgvZDcbfBwe','C2vUzcbPBNq','nJeZodK0svvvsNfv','psjMB250lxm','oIaJownHm2e','DhLWzq','pIb0BYb2zxi','idi0ChG7iJ4','ihjLCxvPCMu','Dg8G','u2f2zsb0Agu','zgvSzxrL','B25fEgLZDhm','Aw9U','ihnVBgLKicm','C3rYAxbL','pc9WpG','DhLSzt0Iy28','mtC4otmZmLHzDMDKuG','zg5Sr1G','ChG7igzVBNq','y2TVDxq6ia','igzVDw5K','B24GAxmGD28','DgvZDcbJAgu','BNqSicDtzwC','vgvZDcbLBwe','AwWGC2vUDca','zxrOB2rZ','BMfTzq','z2fUAxPHDgK','y3jLyxrLu3q','yxv0BZSGCge','zMLUzfvUAxe','lwzHBwLSEtO','mJyXmdKZn0HWBNbRyW','DMfSAwrHDgu','BwfPBcbPCYa','CMTPBMC8l2G','u2vUDcb2Awe','uMvZzw5Kigm','B25MAwD1CMe','rMfPBgvKihq','DxbZzxj0','BM90ignVBMy','lIbtyxzLihq','Aw9UuMvNAxm','z2v0','A3Hdq2W','C2L6ztOGmJa','ywLSigLZihi','BwfYz2LUoIa','mJrWEcaWoYi','ic8+','ic1HChbSzs0','Dg9WoIaXChG','Aw9Uig5VDca','q2HLy2TVDxq','z3jHDgLVBIa','DgvKigLUDgu','sw50zwDYyxq','igLUDgvNCMe','zxn0igvTywK','ihLVDxiGuMu','DxjS','AxnZDwvZ','Awy7ig1HEc0','zw1HAwXtzxi','zwnYzxq','Cgf5BwvUDe0','CMf0Aw9Uigy','DxbZzxj0sw4','BNrLz3jHDgK','nw96EwLuta','AwWGzNjVBsa','ou5fEgTqvW','zgvSzxrLtwe','BYbZzw5Kihq','BwvZC2fNzq','C2vUzevTywK','Aw50zwDYyxq','rw1HAwW','CMLWzvrLC3q','C3rdAgvJA28','C2fUCY1Zzxi','CNzPy2u','DxrtzxnZAw8','DgLVBIbMAxi','BJOGmdSIpG','zNjVBuvTywK','ifn0CMLWzsa','C2vJCMv0s2u','ifnOB3bOB3m','pgGXihn0EwW','yxnZAwDU','BgLZDa','AxnbCNjHEq','mJuZoduZnLbJvvn4BW','zwnYzxqGAxm','ifvstcbMB3i','uMvZzw5Kiee','ysb0zxn0igu','zw5ZDxjLt3i','ndyXodGYmhn4D2fWDG','EdSGBgLUzs0','AM9PBG','yKn3tMm','pKvTywLSigK','zgf0yq','CMf0Aw9UCW','y29UzMLNDxi','zt0IyM9Yzgu','B2jQzwn0','DgLVBG','zgvSzxrLsw4','AgvPz2H0oIa','zxjYB3i','D2vIAg9VA1m','AxjZDc4','ndi2mgTUvw1HzW','ChjPC21H','rxrns3a','AguGAw50zwC','u3rYAxbLigm','BdOG','mtGYnZSGBwe','C3rYB25Nihm','q29UzMLN','C2vUzfrLC3q','u3rYAxbLigq','CYbYzxf1Axi','CJOG','oYi+','mcaXnNb4oYi','z2LUoIaWida','DdSGu2vUzgu','vw5RBM93BIa','BYbJCMvHDgu','Dhj5','C3LZDgvTlca','zgrPBMC6idq','CYbUB3qGy28','mtaYnKPZBLreqW','igjVCMrLCI0','B3jYzwn0BhK','pgrPDIbZDhK','DcbMCM9TidW','B3jNyw5PEMe','CMDPBJOGmca','DgvNCMf0Aw8','Awz5ihrOyxq','y291BNq','igLZignVBMy','ztvLn2vIoYa','DcaMBwLKzg8','zxr1CM4Gysa','CgfYC2u'];_0x4b7d=function(){return _0x18ced3;};return _0x4b7d();}export{U as IntegrationService};
1
+ import{__awaiter as c}from"tslib";import{HttpException as o}from"../../core/exceptions/http-exception";import{getStoredResendConfig as S,normalizeEmail as E,normalizeSecret as v,normalizeStripePaymentMethods as x,parseResendStoredConfig as y,parseStripeStoredConfig as w}from"./integration-config";import{IntegrationSchema as z,ResendIntegrationConfigSchema as k,StripeIntegrationConfigSchema as R,UpsertResendIntegrationConfigSchema as b,UpsertStripeIntegrationConfigSchema as C}from"./integration.schema";class U{constructor(e,i,n,t){this.prisma=e,this.integrationRegistry=i,this.emailService=n,this.stripeService=t}sanitizeConfig(e,i){var n;switch(e){case"stripe":{const t=w(i);return R.parse({paymentMethods:(n=t?.paymentMethods)!==null&&n!==void 0?n:[],hasSecretKey:!!t?.secretKey,hasWebhookSecret:!!t?.webhookSecret})}case"resend":{const t=y(i);return k.parse({hasApiKey:!!t?.apiKey,fromEmail:t?.fromEmail})}default:return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}}sanitizeIntegration(e){return z.parse(Object.assign(Object.assign({},e),{config:this.sanitizeConfig(e.type,e.config)}))}ensureOrganizationExists(e){return c(this,void 0,void 0,function*(){if(!(yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0}})))throw new o(404,"Organization not found")})}validateConfig(e,i,n){var t,r,a,l,g,f,m,p;switch(e){case"stripe":{const d=C.safeParse(i);if(!d.success)throw new o(400,(r=(t=d.error.issues[0])===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"Invalid Stripe configuration");const s=w(n),u=(a=v(d.data.secretKey))!==null&&a!==void 0?a:s?.secretKey,h=(l=v(d.data.webhookSecret))!==null&&l!==void 0?l:s?.webhookSecret;if(!u)throw new o(400,"Stripe API key is required");if(!h)throw new o(400,"Stripe webhook secret is required");return{paymentMethods:x(d.data.paymentMethods),secretKey:u,webhookSecret:h}}case"resend":{const d=b.safeParse(i);if(!d.success)throw new o(400,(f=(g=d.error.issues[0])===null||g===void 0?void 0:g.message)!==null&&f!==void 0?f:"Invalid Resend configuration");const s=y(n),u=(m=v(d.data.apiKey))!==null&&m!==void 0?m:s?.apiKey,h=(p=E(d.data.fromEmail))!==null&&p!==void 0?p:s?.fromEmail;if(!u)throw new o(400,"Resend API key is required");if(!h)throw new o(400,"Resend sender email is required");return{apiKey:u,fromEmail:h}}default:throw new o(400,`Unsupported integration type: ${e}`)}}getIntegrations(e){return c(this,void 0,void 0,function*(){return yield this.ensureOrganizationExists(e),this.integrationRegistry.list(e).map(n=>this.sanitizeIntegration(n))})}upsertIntegration(e,i,n,t){return c(this,void 0,void 0,function*(){yield this.ensureOrganizationExists(e);const r=this.integrationRegistry.get(e,i),a=this.validateConfig(i,t.config,r?.config),l=yield this.prisma.integration.upsert({where:{organizationId_type:{organizationId:e,type:i}},update:{config:a,updatedBy:n},create:{organization:{connect:{id:e}},type:i,config:a,createdBy:n,updatedBy:n}});return this.integrationRegistry.upsert(l),this.sanitizeIntegration(l)})}deleteIntegration(e,i){return c(this,void 0,void 0,function*(){if(yield this.ensureOrganizationExists(e),(yield this.prisma.integration.deleteMany({where:{organizationId:e,type:i}})).count===0)throw new o(404,"Integration not found");this.integrationRegistry.delete(e,i)})}sendTestEmail(e,i){return c(this,void 0,void 0,function*(){const n=yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0,name:!0,email:!0}});if(!n)throw new o(404,"Organization not found");const t=this.integrationRegistry.get(e,"resend"),r=S(t);if(!r?.apiKey)throw new o(400,"Resend API key is not configured. Save the integration first.");if(!r.fromEmail)throw new o(400,"Sender email is not configured. Save the integration first.");try{return yield this.emailService.sendEmail(e,{from:`${n.name} <${r.fromEmail}>`,to:[i],subject:`Test Email from ${n.name}`,html:[`<div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 560px; margin: 0 auto; padding: 40px 20px;">`,'<h1 style="font-size: 20px; font-weight: 600; color: #111827; margin: 0 0 16px;">Email integration is working</h1>','<p style="font-size: 14px; line-height: 1.6; color: #6b7280; margin: 0 0 24px;">',`This is a test email sent from <strong style="color: #111827;">${n.name}</strong> to verify that your Resend integration is configured correctly.`,"</p>",'<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 24px 0;" />','<p style="font-size: 12px; color: #9ca3af; margin: 0;">',`Sent via Shophost &middot; Sender: ${r.fromEmail}`,"</p>","</div>"].join("")}),{success:!0,message:`Test email sent to ${i}`}}catch(a){const l=a instanceof Error?a.message:"Unknown error";throw new o(500,`Failed to send test email: ${l}`)}})}createStripeTestCheckout(e,i,n){return c(this,void 0,void 0,function*(){const t=yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0,name:!0,configuration:{select:{defaultCurrency:!0}}}});if(!t)throw new o(404,"Organization not found");try{const r=yield this.stripeService.createTestCheckoutSession(e,{cancelUrl:n,customerEmail:i,defaultCurrency:t.configuration.defaultCurrency,organizationName:t.name,successUrl:n});if(!r.url)throw new o(500,"Stripe did not return a checkout URL for the test session.");return{redirectUrl:r.url}}catch(r){if(r instanceof o)throw r;const a=r instanceof Error?r.message:"Unknown error";throw new o(500,`Failed to create Stripe test checkout: ${a}`)}})}}export{U as IntegrationService};
@@ -1 +1 @@
1
- const _0xdfc160=_0x2122,_0x3098e2=_0x2122;(function(_0x547dad,_0x4a7c48){const _0x33ab56=_0x2122,_0xa1ff5d=_0x2122,_0x141c1b=_0x547dad();while(!![]){try{const _0x180d2a=-parseInt(_0x33ab56(0xb3))/0x1*(parseInt(_0xa1ff5d(0xee))/0x2)+-parseInt(_0x33ab56(0xbf))/0x3*(parseInt(_0x33ab56(0xd7))/0x4)+-parseInt(_0x33ab56(0xde))/0x5+-parseInt(_0x33ab56(0xd1))/0x6*(-parseInt(_0x33ab56(0xc1))/0x7)+parseInt(_0xa1ff5d(0xeb))/0x8*(-parseInt(_0x33ab56(0xc3))/0x9)+parseInt(_0xa1ff5d(0xaf))/0xa+parseInt(_0xa1ff5d(0xe5))/0xb*(parseInt(_0x33ab56(0xd3))/0xc);if(_0x180d2a===_0x4a7c48)break;else _0x141c1b['push'](_0x141c1b['shift']());}catch(_0x53cc88){_0x141c1b['push'](_0x141c1b['shift']());}}}(_0x50c1,0x5f49f));import{__awaiter as _0x43dec3}from'tslib';function _0x2122(_0x3c6397,_0x181ce8){_0x3c6397=_0x3c6397-0xa1;const _0x50c1d0=_0x50c1();let _0x21225c=_0x50c1d0[_0x3c6397];if(_0x2122['ZPSnto']===undefined){var _0x1d6b50=function(_0x499280){const _0x49e457='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x294c98='',_0x49f615='';for(let _0x20979f=0x0,_0x8b8076,_0x1f3282,_0x4ef56e=0x0;_0x1f3282=_0x499280['charAt'](_0x4ef56e++);~_0x1f3282&&(_0x8b8076=_0x20979f%0x4?_0x8b8076*0x40+_0x1f3282:_0x1f3282,_0x20979f++%0x4)?_0x294c98+=String['fromCharCode'](0xff&_0x8b8076>>(-0x2*_0x20979f&0x6)):0x0){_0x1f3282=_0x49e457['indexOf'](_0x1f3282);}for(let _0x156821=0x0,_0x4243fc=_0x294c98['length'];_0x156821<_0x4243fc;_0x156821++){_0x49f615+='%'+('00'+_0x294c98['charCodeAt'](_0x156821)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x49f615);};_0x2122['uEZKhG']=_0x1d6b50,_0x2122['WDjVCT']={},_0x2122['ZPSnto']=!![];}const _0x271f77=_0x50c1d0[0x0],_0x182969=_0x3c6397+_0x271f77,_0x4c6fd7=_0x2122['WDjVCT'][_0x182969];return!_0x4c6fd7?(_0x21225c=_0x2122['uEZKhG'](_0x21225c),_0x2122['WDjVCT'][_0x182969]=_0x21225c):_0x21225c=_0x4c6fd7,_0x21225c;}import{Prisma as _0x40ab00}from'../../core/db';import{CartItemSchema as _0x10418d}from'../cart/cart.schema';function _0x50c1(){const _0x10e67b=['Aw9UCW','zvf1yw50Axq','r3jVDxbZ','BM9YBwfSAxO','DgL0Bgu','zw0GCMf3igq','CxvHBNrPDhK','zNjVBq','DcbMB3vUza','C3rYAw5NAwy','rgjoDwXS','uhjVzhvJDa','Bwf4','thbeuxq','mJy0mZa2mejSy0P6Cq','EunVBMzSAwm','ChjVy2vZC2u','yxrHigLZigK','ntiXotq1AunntwHo','z2v0','y291BNq','DhjHBNnSyxq','ChjPC21H','yxzHAwXHyMW','CMf3rgf0yq','C2v0','Aw52ywXPzf8','DxbKyxrLtwe','B3jKzxi','zMXPy3rjDgu','mtG5otK2owflyMfQwa','BwfW','mJKWmdy2CfLABMrm','B25MBgLJDa','ovrZvvrSEq','zgvKDwn0zwq','sw52zw50B3i','zMLUzfvUAxe','DgLVBKLK','DMfSDwvZ','DgLVBG','ywXYzwfKEv8','zunHCNrjDgu','DxbKyxrL','EurLzhvJDgu','t3jKzxiGBM8','C3vJy2vZCW','DeL0zw1Z','ntrvz3LMDMu','ChjVzhvJDeK','mJq3ntK2Dvr0tujn','zMLSDgvY','zu9YzgvYsxq','ChjVy2vZC1a','ngnlAejrqG','ywLKt3jKzxi','zff1yw50Axq','A2v5CW','B3jNyw5PEMe','qKfrtNe','Bw9KAwzPzxi','mJy4otq5nxPgD2DYBG','ywrK','zMXHDe1HCa','ANDzqMu','DfzIvuS','zgf0yq','Def0','odi1sfLxvNv2','zMLUze1HBNK','jhrYyw5Zywm','yvfPugK','ChvZAa','BwLU','odeWmdi0q0XUvxfI','yNvPBgrdB24','uMPjseW','mLLxyMLoCa','ywDNCMvNyxq','y29UzMXPy3q','ChjVzhvJDa','AgfZq2fYDem','Aw5ZDwzMAwm','B3v0x29Mx3m','yxnZAwDU','Aw52zw50B3i','AwvUDf9ZDg8','CMvXDwvZDgu'];_0x50c1=function(){return _0x10e67b;};return _0x50c1();}class I extends Error{}class w{constructor(_0x91b9e){const _0x20b166=_0x2122;this[_0x20b166(0xb7)]=_0x91b9e;}[_0xdfc160(0xa4)+_0xdfc160(0xcb)+'ms'](_0x2c66dc,_0x3483a8){const _0x216f74=_0x3098e2,_0x2d1a3e=_0x3098e2,_0x589529={'BAQNq':function(_0x6923e9,_0x16bc75){return _0x6923e9!==_0x16bc75;}};var _0x215c55,_0x3059db,_0x3dc04b;const _0x89b6ec=new Map(_0x3483a8[_0x216f74(0xc0)](_0x187c9a=>[_0x187c9a['id'],_0x187c9a])),_0x2d6abe=new Set(),_0x4285bf=[],_0x233d0a=[],_0x3fa6a8=new Map();for(const _0x9f3978 of _0x2c66dc){const _0x313bfb=_0x89b6ec['get'](_0x9f3978[_0x216f74(0xd2)+'d']),_0x35ae7a=_0x9f3978[_0x2d1a3e(0xa7)]||0x1;if(!_0x313bfb){_0x2d6abe[_0x216f74(0xdf)](_0x9f3978[_0x2d1a3e(0xd2)+'d']),_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978['productI'+'d'],'modifierGroups':_0x9f3978[_0x2d1a3e(0xdd)+_0x216f74(0xa3)],'reason':_0x216f74(0xbb)+'product','requestedQuantity':_0x35ae7a,'resolvedQuantity':0x0});continue;}if(_0x313bfb[_0x2d1a3e(0xb8)+_0x216f74(0xa2)+'y']===null||_0x313bfb[_0x2d1a3e(0xb8)+_0x216f74(0xa2)+'y']===void 0x0){_0x4285bf[_0x216f74(0xe9)](Object['assign'](Object[_0x2d1a3e(0xf5)]({},_0x9f3978),{'modifierGroups':_0x589529[_0x2d1a3e(0xdc)](_0x215c55=_0x9f3978[_0x2d1a3e(0xdd)+_0x2d1a3e(0xa3)],null)&&_0x215c55!==void 0x0?_0x215c55:[],'quantity':_0x35ae7a}));continue;}const _0x2d9872=(_0x3059db=_0x3fa6a8[_0x2d1a3e(0xb4)](_0x313bfb['id']))!==null&&_0x3059db!==void 0x0?_0x3059db:_0x313bfb[_0x216f74(0xb8)+_0x216f74(0xa2)+'y'],_0x15aabe=Math[_0x2d1a3e(0xea)](_0x35ae7a,_0x2d9872);if(_0x3fa6a8[_0x2d1a3e(0xba)](_0x313bfb['id'],Math[_0x216f74(0xad)](_0x2d9872-_0x15aabe,0x0)),_0x15aabe<=0x0){_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978[_0x216f74(0xd2)+'d'],'modifierGroups':_0x9f3978[_0x216f74(0xdd)+_0x216f74(0xa3)],'reason':_0x2d1a3e(0xf4)+'tock','requestedQuantity':_0x35ae7a,'resolvedQuantity':0x0});continue;}_0x15aabe!==_0x35ae7a&&_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978[_0x2d1a3e(0xd2)+'d'],'modifierGroups':_0x9f3978[_0x216f74(0xdd)+_0x2d1a3e(0xa3)],'reason':_0x2d1a3e(0xf3)+_0x216f74(0xf7)+'ck','requestedQuantity':_0x35ae7a,'resolvedQuantity':_0x15aabe}),_0x4285bf[_0x216f74(0xe9)](Object[_0x2d1a3e(0xf5)](Object[_0x216f74(0xf5)]({},_0x9f3978),{'modifierGroups':(_0x3dc04b=_0x9f3978[_0x2d1a3e(0xdd)+_0x2d1a3e(0xa3)])!==null&&_0x3dc04b!==void 0x0?_0x3dc04b:[],'quantity':_0x15aabe}));}return{'adjustments':_0x233d0a,'invalidProductIds':Array[_0x216f74(0xa8)](_0x2d6abe),'normalizedItems':_0x4285bf};}[_0xdfc160(0xf2)+_0xdfc160(0xc2)](_0x4c87ff,_0x1816f7){const _0xa914be=_0x3098e2,_0x1ca1d6=_0x3098e2;return JSON[_0xa914be(0xaa)+'y'](_0x4c87ff)!==JSON[_0x1ca1d6(0xaa)+'y'](_0x1816f7);}[_0x3098e2(0xef)+_0x3098e2(0xd5)+'ems'](_0x3ad1d7){const _0x4e622e=_0xdfc160,_0x32382b=_0xdfc160,_0x4f92de={'tVbUK':'Order\x20it'+_0x4e622e(0xa6)+_0x4e622e(0xb2)+'nvalid'};var _0x1a3971;const _0x8ad78b=new Map();for(const _0x10fe2 of _0x3ad1d7){const _0x406093=_0x10418d['safePars'+'e'](_0x10fe2[_0x32382b(0xb9)]);if(!_0x406093[_0x4e622e(0xcf)])throw new Error(_0x4f92de[_0x4e622e(0xe2)]);const _0x57ef30=_0x406093[_0x32382b(0xe3)],_0xfeb757=_0x8ad78b['get'](_0x57ef30[_0x4e622e(0xd2)+'d']),_0x4aa70d=((_0x1a3971=_0x10fe2[_0x4e622e(0xb6)+_0x4e622e(0xa1)][0x0])===null||_0x1a3971===void 0x0?void 0x0:_0x1a3971[_0x4e622e(0xa5)])||_0x4e622e(0xac);if(_0xfeb757){_0xfeb757[_0x32382b(0xf8)+_0x4e622e(0xd9)+'y']+=_0x57ef30[_0x32382b(0xa7)]||0x1;continue;}_0x8ad78b[_0x4e622e(0xba)](_0x57ef30['productI'+'d'],{'productId':_0x57ef30['productI'+'d'],'requestedQuantity':_0x57ef30[_0x32382b(0xa7)]||0x1,'title':_0x4aa70d});}return _0x8ad78b;}[_0xdfc160(0xec)+_0x3098e2(0xbe)+'ms'](_0x4c6146,_0x753440){const _0x2a3053=_0xdfc160,_0x12b71f=_0xdfc160,_0x9fc880={'jwYBe':function(_0x255951,_0x2cdd83){return _0x255951===_0x2cdd83;},'DjbTP':function(_0x2fbfb6,_0x30b373){return _0x2fbfb6!==_0x30b373;}},_0x18aaf3=new Map(_0x753440[_0x2a3053(0xc0)](_0x5a4b5a=>[_0x5a4b5a['id'],_0x5a4b5a]));return Array[_0x12b71f(0xa8)](_0x4c6146[_0x2a3053(0xc8)]())[_0x2a3053(0xe0)](_0x45c904=>{const _0x59519c=_0x12b71f,_0x2365c6=_0x12b71f;var _0x7dd1d3;const _0x4cc701=_0x18aaf3[_0x59519c(0xb4)](_0x45c904[_0x2365c6(0xd2)+'d']);if(_0x9fc880[_0x2365c6(0xe1)](_0x4cc701?.[_0x2365c6(0xb8)+_0x59519c(0xa2)+'y'],null))return[];const _0xb4b17f=Math['max'](_0x9fc880['DjbTP'](_0x7dd1d3=_0x4cc701?.[_0x2365c6(0xb8)+'eQuantit'+'y'],null)&&_0x7dd1d3!==void 0x0?_0x7dd1d3:0x0,0x0);return _0xb4b17f>=_0x45c904[_0x2365c6(0xf8)+_0x59519c(0xd9)+'y']?[]:[{'productId':_0x45c904[_0x2365c6(0xd2)+'d'],'title':_0x45c904[_0x59519c(0xa5)],'requestedQuantity':_0x45c904[_0x2365c6(0xf8)+_0x59519c(0xd9)+'y'],'availableQuantity':_0xb4b17f}];});}[_0xdfc160(0xd6)+_0xdfc160(0xd8)+_0x3098e2(0xc5)+'y'](_0x30f9c2){const _0x6c5b26=_0x3098e2,_0x285f91=_0x3098e2,_0x441507={'LpDQt':function(_0x202d9e,_0xe00f0f){return _0x202d9e!==_0xe00f0f;},'RjIHL':_0x6c5b26(0xc4),'aQiPi':_0x6c5b26(0xf0)};return _0x43dec3(this,void 0x0,void 0x0,function*(){const _0x1dd94b=_0x6c5b26,_0x3eb431=_0x6c5b26;var _0x3e2fd8;const _0x57648c=yield this[_0x1dd94b(0xb7)][_0x1dd94b(0xbd)]['findUniq'+'ue']({'where':{'id':_0x30f9c2},'include':{'items':{'include':{'translations':!0x0}}}});if(!_0x57648c)throw new Error(_0x3eb431(0xce)+_0x3eb431(0xa9));if(_0x57648c[_0x3eb431(0xf6)+'yDeducte'+'dAt'])return{'status':'already_'+_0x1dd94b(0xb1)+'d'};if(_0x57648c['inventor'+_0x1dd94b(0xb0)+_0x3eb431(0xe4)])return{'conflictItems':(_0x3e2fd8=_0x57648c[_0x1dd94b(0xf6)+'yConflic'+_0x3eb431(0xd0)])!==null&&_0x3e2fd8!==void 0x0?_0x3e2fd8:[],'status':_0x441507[_0x1dd94b(0xe8)]};const _0x4351fe=this[_0x3eb431(0xef)+_0x3eb431(0xd5)+'ems'](_0x57648c['items']);if(_0x4351fe['size']===0x0)return yield this[_0x3eb431(0xb7)]['order'][_0x1dd94b(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':null,'inventoryConflictItems':_0x40ab00[_0x3eb431(0xab)],'inventoryDeductedAt':new Date()}}),{'status':'deducted'};try{return yield this['prisma'][_0x3eb431(0xe7)+_0x1dd94b(0xc9)](_0x495994=>_0x43dec3(this,void 0x0,void 0x0,function*(){const _0x5d6557=_0x3eb431,_0x235f38=_0x3eb431;var _0x39e5c4,_0x2a0c88;const _0x524642=yield _0x495994[_0x5d6557(0xbd)][_0x235f38(0xc6)+'ue']({'where':{'id':_0x30f9c2},'select':{'id':!0x0,'inventoryConflictAt':!0x0,'inventoryConflictItems':!0x0,'inventoryDeductedAt':!0x0,'organizationId':!0x0}});if(!_0x524642)throw new Error(_0x5d6557(0xce)+'t\x20found');if(_0x524642[_0x235f38(0xf6)+_0x5d6557(0xcd)+'dAt'])return{'status':_0x5d6557(0xca)+_0x5d6557(0xb1)+'d'};if(_0x524642[_0x235f38(0xf6)+_0x5d6557(0xb0)+_0x235f38(0xe4)])return{'conflictItems':_0x441507[_0x5d6557(0xae)](_0x39e5c4=_0x524642[_0x235f38(0xf6)+'yConflic'+_0x5d6557(0xd0)],null)&&_0x441507[_0x235f38(0xae)](_0x39e5c4,void 0x0)?_0x39e5c4:[],'status':_0x5d6557(0xf0)};const _0x2763bb=yield _0x495994[_0x5d6557(0xf1)][_0x235f38(0xe6)]({'where':{'id':{'in':Array[_0x235f38(0xa8)](_0x4351fe[_0x5d6557(0xda)]())},'organizationId':_0x524642[_0x5d6557(0xdb)+'tionId']},'select':{'availableQuantity':!0x0,'id':!0x0}}),_0x594c6c=_0x2763bb[_0x5d6557(0xd4)](_0x5dcf2b=>_0x5dcf2b[_0x5d6557(0xb8)+_0x235f38(0xa2)+'y']!==null),_0x5ba993=this[_0x235f38(0xec)+_0x235f38(0xbe)+'ms'](_0x4351fe,_0x2763bb);if(_0x5ba993['length']>0x0)return yield _0x495994[_0x5d6557(0xbd)][_0x235f38(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':new Date(),'inventoryConflictItems':_0x5ba993}}),{'conflictItems':_0x5ba993,'status':_0x5d6557(0xf0)};for(const _0x402b0b of _0x594c6c){const _0xe76952=(_0x2a0c88=_0x4351fe[_0x5d6557(0xb4)](_0x402b0b['id']))===null||_0x2a0c88===void 0x0?void 0x0:_0x2a0c88[_0x5d6557(0xf8)+_0x235f38(0xd9)+'y'];if(!_0xe76952)continue;if((yield _0x495994[_0x235f38(0xf1)][_0x235f38(0xbc)+'ny']({'where':{'id':_0x402b0b['id'],'organizationId':_0x524642['organiza'+_0x235f38(0xc7)],'availableQuantity':{'gte':_0xe76952}},'data':{'availableQuantity':{'decrement':_0xe76952}}}))[_0x235f38(0xb5)]!==0x1)throw new I();}return yield _0x495994[_0x235f38(0xbd)][_0x235f38(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':null,'inventoryConflictItems':_0x40ab00[_0x235f38(0xab)],'inventoryDeductedAt':new Date()}}),{'status':_0x441507[_0x5d6557(0xed)]};}));}catch(_0x50a221){if(!(_0x50a221 instanceof I))throw _0x50a221;const _0x5f76b5=yield this[_0x3eb431(0xb7)][_0x3eb431(0xf1)]['findMany']({'where':{'id':{'in':Array[_0x1dd94b(0xa8)](_0x4351fe[_0x1dd94b(0xda)]())},'organizationId':_0x57648c[_0x3eb431(0xdb)+_0x3eb431(0xc7)]},'select':{'availableQuantity':!0x0,'id':!0x0}}),_0x5bdd50=this[_0x3eb431(0xec)+_0x1dd94b(0xbe)+'ms'](_0x4351fe,_0x5f76b5);return yield this[_0x3eb431(0xb7)][_0x1dd94b(0xbd)][_0x1dd94b(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':new Date(),'inventoryConflictItems':_0x5bdd50}}),{'conflictItems':_0x5bdd50,'status':_0x441507[_0x1dd94b(0xe8)]};}});}}export{w as InventoryService};
1
+ import{__awaiter as v}from"tslib";import{Prisma as m}from"../../core/db";import{CartItemSchema as g}from"../cart/cart.schema";class I extends Error{}class w{constructor(r){this.prisma=r}normalizeCartItems(r,d){var o,t,n;const e=new Map(d.map(i=>[i.id,i])),a=new Set,s=[],l=[],y=new Map;for(const i of r){const u=e.get(i.productId),c=i.quantity||1;if(!u){a.add(i.productId),l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"invalid_product",requestedQuantity:c,resolvedQuantity:0});continue}if(u.availableQuantity===null||u.availableQuantity===void 0){s.push(Object.assign(Object.assign({},i),{modifierGroups:(o=i.modifierGroups)!==null&&o!==void 0?o:[],quantity:c}));continue}const p=(t=y.get(u.id))!==null&&t!==void 0?t:u.availableQuantity,f=Math.min(c,p);if(y.set(u.id,Math.max(p-f,0)),f<=0){l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"out_of_stock",requestedQuantity:c,resolvedQuantity:0});continue}f!==c&&l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"insufficient_stock",requestedQuantity:c,resolvedQuantity:f}),s.push(Object.assign(Object.assign({},i),{modifierGroups:(n=i.modifierGroups)!==null&&n!==void 0?n:[],quantity:f}))}return{adjustments:l,invalidProductIds:Array.from(a),normalizedItems:s}}hasCartConflict(r,d){return JSON.stringify(r)!==JSON.stringify(d)}aggregateOrderItems(r){var d;const o=new Map;for(const t of r){const n=g.safeParse(t.rawData);if(!n.success)throw new Error("Order item raw data is invalid");const e=n.data,a=o.get(e.productId),s=((d=t.translations[0])===null||d===void 0?void 0:d.title)||"Product";if(a){a.requestedQuantity+=e.quantity||1;continue}o.set(e.productId,{productId:e.productId,requestedQuantity:e.quantity||1,title:s})}return o}buildConflictItems(r,d){const o=new Map(d.map(t=>[t.id,t]));return Array.from(r.values()).flatMap(t=>{var n;const e=o.get(t.productId);if(e?.availableQuantity===null)return[];const a=Math.max((n=e?.availableQuantity)!==null&&n!==void 0?n:0,0);return a>=t.requestedQuantity?[]:[{productId:t.productId,title:t.title,requestedQuantity:t.requestedQuantity,availableQuantity:a}]})}processPaidOrderInventory(r){return v(this,void 0,void 0,function*(){var d;const o=yield this.prisma.order.findUnique({where:{id:r},include:{items:{include:{translations:!0}}}});if(!o)throw new Error("Order not found");if(o.inventoryDeductedAt)return{status:"already_processed"};if(o.inventoryConflictAt)return{conflictItems:(d=o.inventoryConflictItems)!==null&&d!==void 0?d:[],status:"conflict"};const t=this.aggregateOrderItems(o.items);if(t.size===0)return yield this.prisma.order.update({where:{id:r},data:{inventoryConflictAt:null,inventoryConflictItems:m.DbNull,inventoryDeductedAt:new Date}}),{status:"deducted"};try{return yield this.prisma.$transaction(n=>v(this,void 0,void 0,function*(){var e,a;const s=yield n.order.findUnique({where:{id:r},select:{id:!0,inventoryConflictAt:!0,inventoryConflictItems:!0,inventoryDeductedAt:!0,organizationId:!0}});if(!s)throw new Error("Order not found");if(s.inventoryDeductedAt)return{status:"already_processed"};if(s.inventoryConflictAt)return{conflictItems:(e=s.inventoryConflictItems)!==null&&e!==void 0?e:[],status:"conflict"};const l=yield n.product.findMany({where:{id:{in:Array.from(t.keys())},organizationId:s.organizationId},select:{availableQuantity:!0,id:!0}}),y=l.filter(u=>u.availableQuantity!==null),i=this.buildConflictItems(t,l);if(i.length>0)return yield n.order.update({where:{id:r},data:{inventoryConflictAt:new Date,inventoryConflictItems:i}}),{conflictItems:i,status:"conflict"};for(const u of y){const c=(a=t.get(u.id))===null||a===void 0?void 0:a.requestedQuantity;if(!c)continue;if((yield n.product.updateMany({where:{id:u.id,organizationId:s.organizationId,availableQuantity:{gte:c}},data:{availableQuantity:{decrement:c}}})).count!==1)throw new I}return yield n.order.update({where:{id:r},data:{inventoryConflictAt:null,inventoryConflictItems:m.DbNull,inventoryDeductedAt:new Date}}),{status:"deducted"}}))}catch(n){if(!(n instanceof I))throw n;const e=yield this.prisma.product.findMany({where:{id:{in:Array.from(t.keys())},organizationId:o.organizationId},select:{availableQuantity:!0,id:!0}}),a=this.buildConflictItems(t,e);return yield this.prisma.order.update({where:{id:r},data:{inventoryConflictAt:new Date,inventoryConflictItems:a}}),{conflictItems:a,status:"conflict"}}})}}export{w as InventoryService};
@@ -1 +1 @@
1
- (function(_0x1f0355,_0x575a24){const _0x400b0a=_0x3a57,_0x2a5877=_0x3a57,_0x3d85eb=_0x1f0355();while(!![]){try{const _0x1e88e9=parseInt(_0x400b0a(0xb8))/0x1+-parseInt(_0x2a5877(0xbf))/0x2+-parseInt(_0x400b0a(0xba))/0x3+-parseInt(_0x400b0a(0xb7))/0x4*(parseInt(_0x400b0a(0xbb))/0x5)+parseInt(_0x2a5877(0xb0))/0x6*(-parseInt(_0x2a5877(0xa7))/0x7)+parseInt(_0x400b0a(0xaf))/0x8+parseInt(_0x400b0a(0xb5))/0x9*(parseInt(_0x400b0a(0xaa))/0xa);if(_0x1e88e9===_0x575a24)break;else _0x3d85eb['push'](_0x3d85eb['shift']());}catch(_0x3a1c88){_0x3d85eb['push'](_0x3d85eb['shift']());}}}(_0x5c27,0x23727));import{__awaiter as _0x4df490}from'tslib';function _0x3a57(_0x16883f,_0x33dedf){_0x16883f=_0x16883f-0xa6;const _0x5c27ef=_0x5c27();let _0x3a5753=_0x5c27ef[_0x16883f];if(_0x3a57['JgKYcJ']===undefined){var _0x48279d=function(_0x55030a){const _0x3ba8da='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x11fd78='',_0x26aa08='';for(let _0x194690=0x0,_0x41e6fb,_0x2d4a55,_0x426ebb=0x0;_0x2d4a55=_0x55030a['charAt'](_0x426ebb++);~_0x2d4a55&&(_0x41e6fb=_0x194690%0x4?_0x41e6fb*0x40+_0x2d4a55:_0x2d4a55,_0x194690++%0x4)?_0x11fd78+=String['fromCharCode'](0xff&_0x41e6fb>>(-0x2*_0x194690&0x6)):0x0){_0x2d4a55=_0x3ba8da['indexOf'](_0x2d4a55);}for(let _0xd795a6=0x0,_0xab688d=_0x11fd78['length'];_0xd795a6<_0xab688d;_0xd795a6++){_0x26aa08+='%'+('00'+_0x11fd78['charCodeAt'](_0xd795a6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x26aa08);};_0x3a57['PNAiXW']=_0x48279d,_0x3a57['rhKYgg']={},_0x3a57['JgKYcJ']=!![];}const _0x722def=_0x5c27ef[0x0],_0x4ad8c2=_0x16883f+_0x722def,_0x39c59f=_0x3a57['rhKYgg'][_0x4ad8c2];return!_0x39c59f?(_0x3a5753=_0x3a57['PNAiXW'](_0x3a5753),_0x3a57['rhKYgg'][_0x4ad8c2]=_0x3a5753):_0x3a5753=_0x39c59f,_0x3a5753;}import{createApiRouter as _0x5ca856}from'../../core/hono/hono';import{locationRoute as _0x1c0811}from'./location.route';function _0x5c27(){const _0x2cf038=['nJC4nZKWEvr1u01q','yxbZiefqssa','z2v0ugXHy2u','CgfYyw0','ndK1mZuWv1jnu2Tp','z2v0','yxv0Aa','CxvLCNK','zxf1AxjLza','r29Vz2XLie0','ndqYnJflEMrcANi','z2v0q3vYCMu','CMvX','mJeXmev5yMfpAq','y3rPB25Z','ANnVBG','BNrvC2vY','A2v5igLZihi','mtK3otG1nK9iELjcuW','nJbyCuzltKS','CgXHy2vjza','DMfSAwq','z2v0uhjLzgK','B3bLBMfWAq','mJm0ndvXqMzpy1q','tMD0Cvq','oeT3C1zvzW','nJaZmtHLy1D5qMO','rgv0ywLSCW','mZG5nti5t0nZq3zP'];_0x5c27=function(){return _0x2cf038;};return _0x5c27();}export const registerLocationHandlers=_0x487aad=>{const _0x4fdee6=_0x3a57,_0x43e3ff=_0x3a57,_0x3f3e15={'NgtqT':_0x4fdee6(0xbe)},_0x539c4e=_0x5ca856(),_0xda84e9=()=>{const _0x227b4b=_0x4fdee6,_0x5aef8a=_0x4fdee6;if(!_0x487aad)throw new Error(_0x227b4b(0xa6)+_0x5aef8a(0xbc)+_0x5aef8a(0xae)+_0x5aef8a(0xc3));return _0x487aad;};return _0x539c4e[_0x4fdee6(0xb4)](_0x1c0811[_0x4fdee6(0xb3)+_0x4fdee6(0xab)],_0x344ce9=>_0x4df490(void 0x0,void 0x0,void 0x0,function*(){const _0x901d52=_0x4fdee6,_0x26ff5e=_0x4fdee6,_0x4f9685=_0x344ce9[_0x901d52(0xc0)]('auth'),_0x4d971f=_0x344ce9[_0x901d52(0xa9)][_0x26ff5e(0xb2)](_0x26ff5e(0xc2));yield _0x4f9685['getCurre'+_0x901d52(0xad)]();const _0x3a417a=yield _0xda84e9()[_0x901d52(0xb3)+'ctions'](_0x4d971f['query'],_0x4d971f['radius']);return _0x344ce9[_0x901d52(0xac)](_0x3a417a,0xc8);})),_0x539c4e[_0x43e3ff(0xb4)](_0x1c0811[_0x43e3ff(0xbd)+_0x43e3ff(0xb9)],_0x5ca29f=>_0x4df490(void 0x0,void 0x0,void 0x0,function*(){const _0x57ff1f=_0x4fdee6,_0x46b0bd=_0x4fdee6,_0x1341be=_0x5ca29f[_0x57ff1f(0xc0)](_0x57ff1f(0xc1)),_0x1d06ec=_0x5ca29f[_0x46b0bd(0xa9)][_0x46b0bd(0xb2)](_0x3f3e15[_0x57ff1f(0xb6)]);yield _0x1341be[_0x46b0bd(0xa8)+_0x57ff1f(0xad)]();const _0x275352=yield _0xda84e9()['getPlace'+_0x57ff1f(0xb9)](_0x1d06ec[_0x57ff1f(0xb1)]);return _0x5ca29f[_0x46b0bd(0xac)](_0x275352,0xc8);})),_0x539c4e;};
1
+ import{__awaiter as s}from"tslib";import{createApiRouter as d}from"../../core/hono/hono";import{locationRoute as u}from"./location.route";export const registerLocationHandlers=n=>{const r=d(),a=()=>{if(!n)throw new Error("Google Maps API key is required");return n};return r.openapi(u.getPredictions,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("query");yield o.getCurrentUser();const i=yield a().getPredictions(t.query,t.radius);return e.json(i,200)})),r.openapi(u.getPlaceDetails,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param");yield o.getCurrentUser();const i=yield a().getPlaceDetails(t.placeId);return e.json(i,200)})),r};
@@ -1 +1 @@
1
- function _0x284f(_0x5d9050,_0x349d99){_0x5d9050=_0x5d9050-0x168;const _0x2c9d06=_0x2c9d();let _0x284f50=_0x2c9d06[_0x5d9050];if(_0x284f['bjkrfW']===undefined){var _0x1bfea8=function(_0x571994){const _0x11ac56='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x9462f1='',_0x3e2f28='';for(let _0x2747be=0x0,_0x45cf65,_0x251f30,_0x19aa36=0x0;_0x251f30=_0x571994['charAt'](_0x19aa36++);~_0x251f30&&(_0x45cf65=_0x2747be%0x4?_0x45cf65*0x40+_0x251f30:_0x251f30,_0x2747be++%0x4)?_0x9462f1+=String['fromCharCode'](0xff&_0x45cf65>>(-0x2*_0x2747be&0x6)):0x0){_0x251f30=_0x11ac56['indexOf'](_0x251f30);}for(let _0x150c9e=0x0,_0x3c2810=_0x9462f1['length'];_0x150c9e<_0x3c2810;_0x150c9e++){_0x3e2f28+='%'+('00'+_0x9462f1['charCodeAt'](_0x150c9e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3e2f28);};_0x284f['mQPHmS']=_0x1bfea8,_0x284f['iQwNLY']={},_0x284f['bjkrfW']=!![];}const _0x378ba7=_0x2c9d06[0x0],_0x5d26f8=_0x5d9050+_0x378ba7,_0x100992=_0x284f['iQwNLY'][_0x5d26f8];return!_0x100992?(_0x284f50=_0x284f['mQPHmS'](_0x284f50),_0x284f['iQwNLY'][_0x5d26f8]=_0x284f50):_0x284f50=_0x100992,_0x284f50;}function _0x2c9d(){const _0x368834=['C3rYAw5N','u2vHCMnOihe','mtq4odmZmgrIDhHvCq','zwqGB24GAxq','y29LCMnL','zsbezxrHAwW','zM9YigeGC3a','ifn0','zxnZ','Aw9UigjHC2u','zgvMyxvSDa','u2vHCMnOihi','zwfYy2GGCxu','uMv0DxjUCYa','DeTSAJrbuJq','nJi0nJjjCNHpseK','B3bLBMfWAq','mtiZie1HAw4','mJy3ntK5mhDquvvYAa','r2v0ifbSywm','z2v0ugXHy2u','BNvTyMvY','rgv0ywLSCW','CYbWBgfJzuK','ysbSAxn0ig8','l3bSywnLCY8','tg9JyxrPB24','ig1LDgvYCW','nwX1AvbVAG','q2HjsK4XDf8','B2nVBxbSzxq','zgv0ywLSCYa','B2jQzwn0','DwvYEq','zIbWBgfJzxm','yxjYyxK','BgfJzsbIyxm','mJyWq3bYquL6','mJy3mtbtBuTtrvi','y3rPB25Z','vgHLieDVB2C','ywrPDxmGAw4','zxmGuhjLzgK','ndGWoti4EgvlvxnK','mJqWotaZtfbhCK9Z','mtKZmduWuLfduuXR','CgXHy2vjza','ieLeigzVCIa','r0vu','zxj5','igzVCIbHDxq','Cgf0Aa','odHeu0P0rem','zcbVBIbHihm','zwnPzMLJiha'];_0x2c9d=function(){return _0x368834;};return _0x2c9d();}const _0x3a1d54=_0x284f,_0x5477c2=_0x284f;(function(_0x2f7247,_0x55345e){const _0x40e96c=_0x284f,_0x350692=_0x284f,_0xf298dc=_0x2f7247();while(!![]){try{const _0x4654e5=-parseInt(_0x40e96c(0x170))/0x1*(-parseInt(_0x40e96c(0x19a))/0x2)+parseInt(_0x40e96c(0x180))/0x3+parseInt(_0x40e96c(0x179))/0x4*(parseInt(_0x350692(0x17a))/0x5)+-parseInt(_0x350692(0x18d))/0x6+-parseInt(_0x40e96c(0x17f))/0x7+parseInt(_0x40e96c(0x188))/0x8*(-parseInt(_0x350692(0x181))/0x9)+parseInt(_0x40e96c(0x19d))/0xa;if(_0x4654e5===_0x55345e)break;else _0xf298dc['push'](_0xf298dc['shift']());}catch(_0x25ca26){_0xf298dc['push'](_0xf298dc['shift']());}}}(_0x2c9d,0x48e50));import{z as _0x9462f1}from'@hono/zod-openapi';import{createApiRoute as _0x3e2f28}from'../../core/hono/hono';import{ErrorSchema as _0x2747be,HeaderSchema as _0x45cf65,PlaceDetailsSchema as _0x251f30,PlaceSchema as _0x19aa36}from'../../schemas';const s=_0x3e2f28({'description':'Returns\x20'+_0x3a1d54(0x16c)+_0x3a1d54(0x176)+_0x5477c2(0x186)+_0x3a1d54(0x172)+_0x3a1d54(0x194)+_0x3a1d54(0x189)+_0x3a1d54(0x197)+_0x5477c2(0x185),'headers':_0x45cf65,'method':_0x3a1d54(0x184),'operationId':'getPredi'+'ctions','path':'/places/'+'predicti'+'on','query':_0x9462f1[_0x3a1d54(0x174)]({'query':_0x9462f1['string']()[_0x3a1d54(0x19b)]({'description':_0x5477c2(0x18c)+_0x3a1d54(0x175),'example':_0x5477c2(0x19c)+_0x3a1d54(0x192)}),'radius':_0x9462f1[_0x3a1d54(0x18f)][_0x5477c2(0x169)]()[_0x3a1d54(0x195)](0x2710)[_0x3a1d54(0x19b)]({'description':_0x3a1d54(0x196)+_0x5477c2(0x17d)+_0x5477c2(0x16f),'example':0x2710})}),'responses':{0xc8:_0x9462f1[_0x3a1d54(0x177)](_0x19aa36),0x190:_0x2747be,0x191:_0x2747be},'summary':_0x5477c2(0x19e)+_0x5477c2(0x17e)+_0x5477c2(0x17b),'tags':[_0x5477c2(0x16e)]}),c=_0x3e2f28({'description':_0x3a1d54(0x198)+_0x3a1d54(0x173)+_0x5477c2(0x191)+_0x5477c2(0x18a)+_0x3a1d54(0x178)+_0x5477c2(0x18e)+_0x5477c2(0x16b)+'d','headers':_0x45cf65,'method':_0x3a1d54(0x184),'operationId':_0x3a1d54(0x168)+_0x5477c2(0x16a),'path':_0x5477c2(0x16d)+':placeId','pathParams':_0x9462f1[_0x5477c2(0x174)]({'placeId':_0x9462f1[_0x5477c2(0x18b)]()['openapi']({'description':_0x5477c2(0x17c)+'le\x20Place'+_0x5477c2(0x183)+'the\x20addr'+_0x3a1d54(0x193),'example':_0x3a1d54(0x171)+_0x3a1d54(0x199)+'GeTYWZ7f'+'rY','param':{'in':_0x5477c2(0x187),'name':_0x3a1d54(0x182)}})}),'responses':{0xc8:_0x251f30,0x190:_0x2747be,0x191:_0x2747be},'summary':_0x3a1d54(0x19e)+_0x3a1d54(0x190)+'s','tags':[_0x3a1d54(0x16e)]});export const locationRoute={'getPredictions':s,'getPlaceDetails':c};
1
+ import{z as e}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{ErrorSchema as a,HeaderSchema as o,PlaceDetailsSchema as r,PlaceSchema as i}from"../../schemas";const s=t({description:"Returns a list of places for autocompletion based on a search query",headers:o,method:"GET",operationId:"getPredictions",path:"/places/prediction",query:e.object({query:e.string().openapi({description:"Search query",example:"123 Main St"}),radius:e.coerce.number().default(1e4).openapi({description:"Search radius in meters",example:1e4})}),responses:{200:e.array(i),400:a,401:a},summary:"Get Places Predictions",tags:["Location"]}),c=t({description:"Returns details for a specific place based on its placeId",headers:o,method:"GET",operationId:"getPlaceDetails",path:"/places/:placeId",pathParams:e.object({placeId:e.string().openapi({description:"The Google Place ID for the address",example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",param:{in:"path",name:"placeId"}})}),responses:{200:r,400:a,401:a},summary:"Get Place Details",tags:["Location"]});export const locationRoute={getPredictions:s,getPlaceDetails:c};
@@ -1 +1 @@
1
- function _0x5ed3(){const _0x1fa8d4=['BgfJzq','otKWnJK2EfHSzhPY','ywrKCMvZCW','CMrPBMf0zq','BguGugXHy2u','CMLWDgLVBIa','vgHLieDVB2C','zhjLC3m','ifn0CMvLDcW','vgHLigXVBMC','vgHLihbVC3q','BhbOys0Yigm','B3vUDhj5igm','vgHLigXHDgK','ieLeigzVCIa','zgrYzxnZ','DgHLigfKzhi','odyXmZmWuMDlDKLS','odber0jgz04','BMqGBgLUzsa','B2jQzwn0','zxnZ','B2yGDgHLige','mZe2nI0Xige','ihrOzsbJB28','ie5LDYbzB3i','Axr1zguGB2y','BNvTyMvY','vgHLigrLC2m','ifn0CMvLDa','mtCXnJyZmeTxCvLsra','B3b0Aw9UywW','vvnb','mJiXmZK2ndbXr3Lezui','zgLUyxrL','ywLSCW','vgHLigzPCNm','mtiZie1HAw4','C3rYAw5N','tMv3ifLVCMS','q2HjsK4XDf8','ugXHy2vezxq','mJi1sKrUCvLM','vgHLieLttYa','vgHLignPDhK','AYWGvvnb','DeTSAJrbuJq','ndy4odrtqLvpr3y','ugXHy2u','B3bLBMfWAq','mtiZndu','ndLhu0zAzfm','ndKYoda0nwjdD2v3AG','DhvKzsbVzIa','ndKYmteXBLPpq3rl','ig9MihrOzsa','u3vPDguGmta'];_0x5ed3=function(){return _0x1fa8d4;};return _0x5ed3();}const _0x589306=_0x54fb,_0x1bd33e=_0x54fb;(function(_0x381ef4,_0x526cf3){const _0x92b021=_0x54fb,_0x1fb882=_0x54fb,_0x510d45=_0x381ef4();while(!![]){try{const _0x53a278=parseInt(_0x92b021(0xf3))/0x1+-parseInt(_0x92b021(0xd7))/0x2+-parseInt(_0x92b021(0xe3))/0x3*(-parseInt(_0x1fb882(0xe8))/0x4)+-parseInt(_0x1fb882(0xed))/0x5+-parseInt(_0x1fb882(0x103))/0x6*(parseInt(_0x92b021(0xec))/0x7)+-parseInt(_0x1fb882(0x104))/0x8*(parseInt(_0x92b021(0xef))/0x9)+parseInt(_0x92b021(0xda))/0xa;if(_0x53a278===_0x526cf3)break;else _0x510d45['push'](_0x510d45['shift']());}catch(_0x47667f){_0x510d45['push'](_0x510d45['shift']());}}}(_0x5ed3,0xa8008));import{z as _0x5dea95}from'@hono/zod-openapi';function _0x54fb(_0x2e35b6,_0x50a582){_0x2e35b6=_0x2e35b6-0xd0;const _0x5ed338=_0x5ed3();let _0x54fbfc=_0x5ed338[_0x2e35b6];if(_0x54fb['djCXxx']===undefined){var _0x10a012=function(_0x20a137){const _0x56c249='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5dea95='',_0x3e530b='';for(let _0x52027c=0x0,_0x11f412,_0x4e248b,_0xd8b23c=0x0;_0x4e248b=_0x20a137['charAt'](_0xd8b23c++);~_0x4e248b&&(_0x11f412=_0x52027c%0x4?_0x11f412*0x40+_0x4e248b:_0x4e248b,_0x52027c++%0x4)?_0x5dea95+=String['fromCharCode'](0xff&_0x11f412>>(-0x2*_0x52027c&0x6)):0x0){_0x4e248b=_0x56c249['indexOf'](_0x4e248b);}for(let _0xce02e1=0x0,_0x1cbee8=_0x5dea95['length'];_0xce02e1<_0x1cbee8;_0xce02e1++){_0x3e530b+='%'+('00'+_0x5dea95['charCodeAt'](_0xce02e1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3e530b);};_0x54fb['FQhvcm']=_0x10a012,_0x54fb['iMPMrj']={},_0x54fb['djCXxx']=!![];}const _0x5914a1=_0x5ed338[0x0],_0x5b0fbb=_0x2e35b6+_0x5914a1,_0x3f0598=_0x54fb['iMPMrj'][_0x5b0fbb];return!_0x3f0598?(_0x54fbfc=_0x54fb['FQhvcm'](_0x54fbfc),_0x54fb['iMPMrj'][_0x5b0fbb]=_0x54fbfc):_0x54fbfc=_0x3f0598,_0x54fbfc;}export const PlaceSchema=_0x5dea95[_0x589306(0x106)]({'placeId':_0x5dea95['string']()['openapi']({'example':_0x1bd33e(0xe1)+_0x589306(0xe7)+'GeTYWZ7f'+'rY','description':_0x589306(0xf8)+_0x1bd33e(0xf6)+_0x589306(0x100)+_0x1bd33e(0x102)+_0x589306(0x107)}),'text':_0x5dea95[_0x1bd33e(0xdf)]()[_0x1bd33e(0xea)]({'example':_0x1bd33e(0xde)+_0x589306(0xfa)+_0x1bd33e(0xd2)+_0x589306(0xe6),'description':_0x1bd33e(0xd5)+_0x1bd33e(0xf7)+'of\x20the\x20p'+_0x589306(0xf2)}),'addressLineOne':_0x5dea95[_0x1bd33e(0xdf)]()['openapi']({'example':_0x589306(0xde)+_0x589306(0xd6),'description':_0x589306(0xdd)+'t\x20line\x20o'+'f\x20the\x20ad'+'dress'}),'addressLineTwo':_0x5dea95[_0x589306(0xdf)]()[_0x1bd33e(0xd8)]()[_0x589306(0xea)]({'example':_0x589306(0xf1)+'0','description':'The\x20seco'+_0x589306(0x105)+_0x589306(0x108)+_0x1bd33e(0x101)}),'latitude':_0x5dea95[_0x589306(0xd4)]()['optional']()[_0x589306(0xea)]({'example':40.712776,'description':_0x589306(0xff)+_0x1bd33e(0xee)+'the\x20coor'+_0x1bd33e(0xdb)}),'longitude':_0x5dea95[_0x589306(0xd4)]()[_0x1bd33e(0xd8)]()[_0x589306(0xea)]({'example':-74.005974,'description':_0x589306(0xfb)+_0x589306(0xd3)+_0x1bd33e(0xd1)+_0x1bd33e(0xf5)})})[_0x1bd33e(0xea)](_0x1bd33e(0xe9)),PlaceDetailsSchema=_0x5dea95[_0x1bd33e(0x106)]({'addressLineOne':_0x5dea95[_0x1bd33e(0xdf)]()[_0x589306(0xea)]({'example':_0x589306(0xde)+_0x1bd33e(0xd6),'description':_0x1bd33e(0xdd)+'t\x20line\x20o'+'f\x20the\x20ad'+_0x1bd33e(0xf9)}),'zipCode':_0x5dea95[_0x589306(0xdf)]()['optional']()[_0x1bd33e(0xea)]({'example':_0x1bd33e(0xeb),'description':_0x1bd33e(0xfc)+'al\x20code\x20'+_0x1bd33e(0x108)+'ddress'}),'city':_0x5dea95[_0x1bd33e(0xdf)]()[_0x589306(0xea)]({'example':_0x589306(0xe0),'description':_0x589306(0xe5)+_0x1bd33e(0xf0)+_0x1bd33e(0xf4)}),'country':_0x5dea95[_0x1bd33e(0xdf)]()[_0x1bd33e(0xea)]({'example':_0x589306(0xd9),'description':_0x589306(0xe4)+_0x589306(0xd0)+_0x589306(0xfd)+_0x589306(0xfe)+'ode'})})['openapi'](_0x1bd33e(0xe2)+_0x1bd33e(0xdc));
1
+ import{z as e}from"@hono/zod-openapi";export const PlaceSchema=e.object({placeId:e.string().openapi({example:"ChIJN1t_tKlj4AR4GeTYWZ7frY",description:"The Google Place ID for the address"}),text:e.string().openapi({example:"123 Main Street, New York, USA",description:"The description of the place"}),addressLineOne:e.string().openapi({example:"123 Main Street",description:"The first line of the address"}),addressLineTwo:e.string().optional().openapi({example:"Suite 100",description:"The second line of the address"}),latitude:e.number().optional().openapi({example:40.712776,description:"The latitude of the coordinate"}),longitude:e.number().optional().openapi({example:-74.005974,description:"The longitude of the coordinate"})}).openapi("Place"),PlaceDetailsSchema=e.object({addressLineOne:e.string().openapi({example:"123 Main Street",description:"The first line of the address"}),zipCode:e.string().optional().openapi({example:"12345",description:"The postal code of the address"}),city:e.string().openapi({example:"New York",description:"The city of the address"}),country:e.string().openapi({example:"USA",description:"The ISO 3166-1 alpha-2 country code"})}).openapi("PlaceDetails");
@@ -1 +1 @@
1
- const _0x5123b8=_0x24e4,_0x2f0d38=_0x24e4;(function(_0x22cb7a,_0x4dbbc3){const _0x45b251=_0x24e4,_0x29c6d3=_0x24e4,_0x14857a=_0x22cb7a();while(!![]){try{const _0x3d5cf3=-parseInt(_0x45b251(0x210))/0x1+-parseInt(_0x45b251(0x1f4))/0x2*(-parseInt(_0x29c6d3(0x1e2))/0x3)+parseInt(_0x29c6d3(0x1d6))/0x4+-parseInt(_0x45b251(0x1f0))/0x5*(-parseInt(_0x29c6d3(0x1ee))/0x6)+-parseInt(_0x29c6d3(0x20d))/0x7*(-parseInt(_0x45b251(0x1de))/0x8)+parseInt(_0x45b251(0x205))/0x9+-parseInt(_0x45b251(0x1d4))/0xa*(parseInt(_0x45b251(0x1d0))/0xb);if(_0x3d5cf3===_0x4dbbc3)break;else _0x14857a['push'](_0x14857a['shift']());}catch(_0x2951e2){_0x14857a['push'](_0x14857a['shift']());}}}(_0x4e1f,0xea5bf));import{__awaiter as _0x22bea0}from'tslib';import _0x24150d,{isAxiosError as _0x55e9bc}from'axios';import{logger as _0x508f09}from'../../core/logging/pino';function _0x24e4(_0x2b65f8,_0x16c077){_0x2b65f8=_0x2b65f8-0x1b4;const _0x4e1fad=_0x4e1f();let _0x24e475=_0x4e1fad[_0x2b65f8];if(_0x24e4['ukptyR']===undefined){var _0x283c18=function(_0x467c47){const _0x4a5c86='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x25c828='',_0x470d98='';for(let _0x3b2dfc=0x0,_0x1b3c5a,_0x3ac9f1,_0x537ab8=0x0;_0x3ac9f1=_0x467c47['charAt'](_0x537ab8++);~_0x3ac9f1&&(_0x1b3c5a=_0x3b2dfc%0x4?_0x1b3c5a*0x40+_0x3ac9f1:_0x3ac9f1,_0x3b2dfc++%0x4)?_0x25c828+=String['fromCharCode'](0xff&_0x1b3c5a>>(-0x2*_0x3b2dfc&0x6)):0x0){_0x3ac9f1=_0x4a5c86['indexOf'](_0x3ac9f1);}for(let _0x581891=0x0,_0x556663=_0x25c828['length'];_0x581891<_0x556663;_0x581891++){_0x470d98+='%'+('00'+_0x25c828['charCodeAt'](_0x581891)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x470d98);};_0x24e4['cOtyiw']=_0x283c18,_0x24e4['JGphDO']={},_0x24e4['ukptyR']=!![];}const _0x1ab25e=_0x4e1fad[0x0],_0xa3e862=_0x2b65f8+_0x1ab25e,_0x3de962=_0x24e4['JGphDO'][_0xa3e862];return!_0x3de962?(_0x24e475=_0x24e4['cOtyiw'](_0x24e475),_0x24e4['JGphDO'][_0xa3e862]=_0x24e475):_0x24e475=_0x3de962,_0x24e475;}class m{constructor(_0xf5a4f8){const _0x3ede70=_0x24e4,_0x866e21=_0x24e4,_0x430bcd={'QcGwH':_0x3ede70(0x1fb)+'places.g'+_0x3ede70(0x1db)+_0x3ede70(0x1ce)};this[_0x866e21(0x1cd)]=_0xf5a4f8,this[_0x866e21(0x1c5)]=_0x24150d[_0x3ede70(0x1d7)]({'baseURL':_0x430bcd['QcGwH'],'headers':{'Content-Type':_0x866e21(0x1e5)+_0x3ede70(0x1b4),'X-Goog-Api-Key':_0xf5a4f8}});}[_0x5123b8(0x1bc)+_0x2f0d38(0x1c1)](_0x4c4838,_0x2f0b04){const _0x322ecd=_0x5123b8,_0x1afe93=_0x5123b8,_0x9a7ed={'PvRPK':_0x322ecd(0x1fa)+_0x1afe93(0x1e8)+_0x1afe93(0x1d8)+_0x1afe93(0x201)+_0x1afe93(0x209)+'d'};return _0x22bea0(this,void 0x0,void 0x0,function*(){const _0x4e4836=_0x1afe93,_0x533796=_0x1afe93;var _0x96521e,_0x2bf16c,_0x2b32b9;if(!_0x4c4838||_0x4c4838['trim']()===''||_0x4c4838['length']<0x3)return[];try{const {data:_0x1f0350}=yield this[_0x4e4836(0x1c5)]['post'](_0x533796(0x1f5)+_0x4e4836(0x1c0)+_0x4e4836(0x1ed),{'input':_0x4c4838,'locationBias':{'circle':{'center':{'latitude':37.7937,'longitude':-122.3965},'radius':_0x2f0b04||0x186a0}}});return _0x1f0350[_0x533796(0x1cf)+_0x4e4836(0x1dd)]['map'](({placePrediction:_0x10c84a})=>({'placeId':_0x10c84a[_0x533796(0x1d1)],'text':_0x10c84a['text'][_0x4e4836(0x1d2)],'addressLineOne':_0x10c84a[_0x533796(0x1e6)+_0x4e4836(0x1e0)][_0x533796(0x1cb)][_0x4e4836(0x1d2)],'addressLineTwo':_0x10c84a['structur'+_0x4e4836(0x1e0)]['secondar'+_0x4e4836(0x1ef)][_0x4e4836(0x1d2)]}));}catch(_0x5b76e2){throw _0x55e9bc(_0x5b76e2)?_0x508f09[_0x4e4836(0x1eb)]({'status':(_0x96521e=_0x5b76e2[_0x533796(0x1d9)])===null||_0x96521e===void 0x0?void 0x0:_0x96521e['status'],'statusText':(_0x2bf16c=_0x5b76e2[_0x533796(0x1d9)])===null||_0x2bf16c===void 0x0?void 0x0:_0x2bf16c[_0x533796(0x20b)+'xt'],'data':(_0x2b32b9=_0x5b76e2['response'])===null||_0x2b32b9===void 0x0?void 0x0:_0x2b32b9['data'],'query':_0x4c4838},_0x9a7ed[_0x533796(0x1b9)]):_0x508f09['error']({'err':_0x5b76e2,'query':_0x4c4838},_0x4e4836(0x200)+_0x4e4836(0x1e4)+_0x533796(0x1f7)+_0x533796(0x1c3)+_0x533796(0x1c6)+_0x4e4836(0x1bb)),_0x5b76e2;}});}['findDist'+_0x2f0d38(0x1b8)+_0x5123b8(0x1ba)+_0x2f0d38(0x1bd)](_0x4bf35e,_0x2701b6){const _0x273544={'bSfbz':function(_0x479b53,_0x493134){return _0x479b53(_0x493134);},'OdBvt':function(_0x5fb523,_0x3ba0d2){return _0x5fb523*_0x3ba0d2;}};return _0x22bea0(this,void 0x0,void 0x0,function*(){const _0x6d35b1=_0x24e4,_0x51b453=_0x24e4,_0x105479=_0x1e128d=>_0x1e128d*(Math['PI']/0xb4),_0x1ba5df=_0x105479(_0x2701b6[_0x6d35b1(0x1d3)]-_0x4bf35e['latitude']),_0x4a16bf=_0x105479(_0x2701b6[_0x6d35b1(0x1e1)+'e']-_0x4bf35e[_0x6d35b1(0x1e1)+'e']),_0x24a0a4=_0x105479(_0x4bf35e[_0x51b453(0x1d3)]),_0x12dc88=_0x273544[_0x6d35b1(0x1e9)](_0x105479,_0x2701b6['latitude']),_0x5566e4=Math[_0x51b453(0x1fd)](_0x1ba5df/0x2)*Math[_0x51b453(0x1fd)](_0x1ba5df/0x2)+_0x273544[_0x51b453(0x20f)](Math[_0x51b453(0x20e)](_0x24a0a4)*Math[_0x6d35b1(0x20e)](_0x12dc88)*Math['sin'](_0x4a16bf/0x2),Math[_0x51b453(0x1fd)](_0x4a16bf/0x2));return 0x18e3*(0x2*Math[_0x51b453(0x1c7)](Math[_0x51b453(0x208)](_0x5566e4),Math['sqrt'](0x1-_0x5566e4)));});}[_0x5123b8(0x1cc)+_0x2f0d38(0x1e3)](_0x9e421d){const _0x57e5df={'sPvbm':function(_0x168904,_0x17d0a9){return _0x168904===_0x17d0a9;}};return _0x22bea0(this,void 0x0,void 0x0,function*(){const _0x2d383d=_0x24e4,_0x487ae0=_0x24e4;var _0x3c9230,_0x4b3635,_0x156ed3;let _0xd8d284;try{_0xd8d284=(yield this[_0x2d383d(0x1c5)]['get'](_0x487ae0(0x20c)+_0x9e421d,{'headers':{'X-Goog-FieldMask':'addressC'+_0x2d383d(0x1be)+_0x2d383d(0x20a)+'matAddre'+_0x2d383d(0x1ca)+_0x487ae0(0x203)+_0x487ae0(0x1c2)+_0x487ae0(0x1f1)+_0x2d383d(0x1b7)+_0x2d383d(0x1fe)+'ess,shor'+'tFormatt'+_0x487ae0(0x1f9)+_0x487ae0(0x1b6)}}))[_0x2d383d(0x1dc)];}catch(_0x834705){throw _0x55e9bc(_0x834705)?_0x508f09[_0x2d383d(0x1eb)]({'status':(_0x3c9230=_0x834705[_0x2d383d(0x1d9)])===null||_0x3c9230===void 0x0?void 0x0:_0x3c9230[_0x487ae0(0x211)],'statusText':(_0x4b3635=_0x834705['response'])===null||_0x57e5df['sPvbm'](_0x4b3635,void 0x0)?void 0x0:_0x4b3635[_0x2d383d(0x20b)+'xt'],'data':(_0x156ed3=_0x834705[_0x487ae0(0x1d9)])===null||_0x57e5df[_0x2d383d(0x1da)](_0x156ed3,void 0x0)?void 0x0:_0x156ed3[_0x2d383d(0x1dc)],'placeId':_0x9e421d},_0x487ae0(0x1fa)+'lace\x20Det'+_0x2d383d(0x206)+_0x487ae0(0x1ea)+_0x2d383d(0x1d5)):_0x508f09['error']({'err':_0x834705,'placeId':_0x9e421d},_0x2d383d(0x200)+_0x2d383d(0x1e4)+'\x20during\x20'+_0x2d383d(0x1c8)+_0x487ae0(0x207)),_0x834705;}const _0x344899={'addressLineOne':'','zipCode':'','country':'','city':'','latitude':_0xd8d284[_0x487ae0(0x1e7)][_0x487ae0(0x1d3)],'longitude':_0xd8d284['location'][_0x487ae0(0x1e1)+'e']};if(!_0xd8d284['addressC'+'omponent'+'s'])return _0x344899;for(const _0x13ab4d of _0xd8d284[_0x487ae0(0x202)+_0x487ae0(0x1be)+'s'])_0x13ab4d['types'][_0x487ae0(0x1b5)](_0x487ae0(0x1f8)+_0x487ae0(0x1ff))&&(_0x344899['addressL'+_0x487ae0(0x1f6)]=_0x13ab4d[_0x487ae0(0x1ec)+'t']),_0x13ab4d[_0x487ae0(0x1df)][_0x2d383d(0x1b5)](_0x487ae0(0x1fc))&&(_0x344899[_0x2d383d(0x1c4)+'ineOne']=_0x13ab4d['shortTex'+'t']+'\x20'+_0x344899[_0x487ae0(0x1c4)+_0x487ae0(0x1f6)]),_0x13ab4d[_0x2d383d(0x1df)][_0x2d383d(0x1b5)](_0x487ae0(0x1f2)+_0x2d383d(0x1c9))&&(_0x344899[_0x2d383d(0x212)]=_0x13ab4d['shortTex'+'t']),_0x13ab4d[_0x2d383d(0x1df)]['includes']('country')&&(_0x344899[_0x487ae0(0x204)]=_0x13ab4d['shortTex'+'t']),_0x13ab4d[_0x2d383d(0x1df)][_0x2d383d(0x1b5)](_0x487ae0(0x1bf))&&(_0x344899[_0x487ae0(0x213)]=_0x13ab4d[_0x2d383d(0x1f3)]);return _0x344899;});}}export{m as LocationService};function _0x4e1f(){const _0x2d7602=['zwqGzxjYB3i','yxbWBgLJyxq','C3rYDwn0Dxi','Bg9JyxrPB24','BgfJzxmGqxu','yLnMyNO','DwvZDcbMywK','zxjYB3i','C2HVCNruzxG','Bgv0zq','nZK4ndjusgTOC3u','EvrLEhq','mtKWEujHDNvt','DgLVBIXWBhu','Cg9ZDgfSx2m','Bg9Uz1rLEhq','nJu1nZm2uNDWEMTf','l3bSywnLCZO','Aw5Lt25L','igr1CMLUzYa','C3rYzwv0x24','zwrbzgrYzxm','r29Vz2XLifa','Ahr0Chm6lY8','CM91Dgu','C2LU','C3rHBefKzhi','Dw1Izxi','vw5LEhbLy3q','DguGCMvXDwu','ywrKCMvZC0m','DhrLzefKzhi','y291BNrYEq','nJe3mdu5oeHOzNvItG','ywLSCYbYzxe','DgfPBhm','C3fYDa','C3qGzMfPBgu','CYXHzhjgB3i','C3rHDhvZvgu','l3bSywnLCY8','mJH0u0ros2m','y29Z','t2rcDNq','nJi0mteYzxDyz3DS','C3rHDhvZ','EMLWq29Kzq','y2L0Eq','Aw9Ul2PZB24','Aw5JBhvKzxm','CYX0ExbLCW','C0nVzguSCg8','yw5JzujLDhC','uhzsueS','zwvUq29VCMq','zxrL','z2v0uhjLzgK','Aw5HDgvZ','B21WB25LBNq','Bg9JywXPDhK','yxv0B2nVBxa','y3rPB25Z','zxnZlgXVy2e','ugXHy2vZiee','ywrKCMvZC0W','y2XPzw50','DxrVy29TCgW','yxrHBJi','ugXHy2uGrgu','B2rL','C3mSzM9YBwe','BwfPBLrLEhq','z2v0ugXHy2u','yxbPs2v5','CY5JB20VDJe','C3vNz2vZDgK','mZa3otiYnJDLDKDMzM0','CgXHy2vjza','Dgv4Da','Bgf0Axr1zgu','mtbjz0TYD3q','BgvK','mZe0mJCZnNHAwwr0vG','y3jLyxrL','Dg9JB21WBgu','CMvZCg9UC2u','C1b2yM0','B29NBgvHCgK','zgf0yq','B25Z','mZuWmti3mNjwvwXzDq','DhLWzxm','zwrgB3jTyxq','Bg9Uz2L0Dwq','nLzJz1nLtG','rgv0ywLSCW'];_0x4e1f=function(){return _0x2d7602;};return _0x4e1f();}
1
+ import{__awaiter as d}from"tslib";import h,{isAxiosError as c}from"axios";import{logger as n}from"../../core/logging/pino";class m{constructor(s){this.apiKey=s,this.client=h.create({baseURL:"https://places.googleapis.com/v1",headers:{"Content-Type":"application/json","X-Goog-Api-Key":s}})}getPredictions(s,a){return d(this,void 0,void 0,function*(){var o,i,r;if(!s||s.trim()===""||s.length<3)return[];try{const{data:e}=yield this.client.post("/places:autocomplete",{input:s,locationBias:{circle:{center:{latitude:37.7937,longitude:-122.3965},radius:a||1e5}}});return e.suggestions.map(({placePrediction:t})=>({placeId:t.placeId,text:t.text.text,addressLineOne:t.structuredFormat.mainText.text,addressLineTwo:t.structuredFormat.secondaryText.text}))}catch(e){throw c(e)?n.error({status:(o=e.response)===null||o===void 0?void 0:o.status,statusText:(i=e.response)===null||i===void 0?void 0:i.statusText,data:(r=e.response)===null||r===void 0?void 0:r.data,query:s},"Google Places Autocomplete request failed"):n.error({err:e,query:s},"Unexpected error during Places Autocomplete"),e}})}findDistanceBetweenCoordinates(s,a){return d(this,void 0,void 0,function*(){const o=p=>p*(Math.PI/180),r=o(a.latitude-s.latitude),e=o(a.longitude-s.longitude),t=o(s.latitude),u=o(a.latitude),l=Math.sin(r/2)*Math.sin(r/2)+Math.cos(t)*Math.cos(u)*Math.sin(e/2)*Math.sin(e/2);return 6371*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))})}getPlaceDetails(s){return d(this,void 0,void 0,function*(){var a,o,i;let r;try{r=(yield this.client.get(`/places/${s}`,{headers:{"X-Goog-FieldMask":"addressComponents,adrFormatAddress,formattedAddress,location,plusCode,postalAddress,shortFormattedAddress,types"}})).data}catch(t){throw c(t)?n.error({status:(a=t.response)===null||a===void 0?void 0:a.status,statusText:(o=t.response)===null||o===void 0?void 0:o.statusText,data:(i=t.response)===null||i===void 0?void 0:i.data,placeId:s},"Google Place Details request failed"):n.error({err:t,placeId:s},"Unexpected error during Place Details"),t}const e={addressLineOne:"",zipCode:"",country:"",city:"",latitude:r.location.latitude,longitude:r.location.longitude};if(!r.addressComponents)return e;for(const t of r.addressComponents)t.types.includes("street_number")&&(e.addressLineOne=t.shortText),t.types.includes("route")&&(e.addressLineOne=t.shortText+" "+e.addressLineOne),t.types.includes("postal_code")&&(e.zipCode=t.shortText),t.types.includes("country")&&(e.country=t.shortText),t.types.includes("locality")&&(e.city=t.longText);return e})}}export{m as LocationService};
@@ -1 +1 @@
1
- (function(_0x544ec6,_0x303739){const _0x234d2f=_0x2e0e,_0x2c8733=_0x2e0e,_0x2772f9=_0x544ec6();while(!![]){try{const _0x47261c=parseInt(_0x234d2f(0x127))/0x1+-parseInt(_0x2c8733(0x113))/0x2*(parseInt(_0x2c8733(0x130))/0x3)+-parseInt(_0x234d2f(0x118))/0x4+-parseInt(_0x234d2f(0x116))/0x5+-parseInt(_0x2c8733(0x12a))/0x6*(parseInt(_0x234d2f(0x120))/0x7)+-parseInt(_0x234d2f(0x117))/0x8+parseInt(_0x2c8733(0x133))/0x9;if(_0x47261c===_0x303739)break;else _0x2772f9['push'](_0x2772f9['shift']());}catch(_0x26010a){_0x2772f9['push'](_0x2772f9['shift']());}}}(_0x9c59,0x53a82));import{__awaiter as _0x57f1ed}from'tslib';import{createApiRouter as _0x3e2dcd}from'../../core/hono/hono';import{manufacturerRoute as _0xd1d917}from'./manufacturer.route';function _0x9c59(){const _0x3ecdbd=['ywn0DxjLCNm','z2v0twfUDwy','mZCXotrLwe5tweC','ANnVBG','AxnhCMfUDgu','C3v1rLO','y3jLyxrL','DxbKyxrLtwe','mtC5n2H4zKr4tW','CgfYyw0','Bg9JywXL','mtC5nJG0mZDbtKPttxy','y3jLyxrLtwe','B3jNyw5PEMe','z2v0','CMvHza','mJb5DfzmwKm','zgvSzxrLtwe','DgLVBKLK','mJKXoti5nuvSsgXTzq','nte1mtmWnejJrxrUDa','nJCXnZKYzgH2veL1','zgvSzxrL','CxvLCNK','y0nmD1G','yxnZAwDU','yxv0Aa','DxbKyxrL','ywn0DxjLCG','ndi3zKPmtfDq','yM9KEq','BNvMywn0Dxi','DMfSAwq','CMvX','B3bLBMfWAq','Evbty1i','mti2mde0AM1qAhjy'];_0x9c59=function(){return _0x3ecdbd;};return _0x9c59();}function _0x2e0e(_0x203aa6,_0x5c3ccd){_0x203aa6=_0x203aa6-0x111;const _0x9c59ab=_0x9c59();let _0x2e0eda=_0x9c59ab[_0x203aa6];if(_0x2e0e['fYXSsI']===undefined){var _0xd437b4=function(_0x3385d3){const _0x2c5eb1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x249899='',_0x22e904='';for(let _0x1fe5fc=0x0,_0x4741de,_0x45753d,_0x3b7665=0x0;_0x45753d=_0x3385d3['charAt'](_0x3b7665++);~_0x45753d&&(_0x4741de=_0x1fe5fc%0x4?_0x4741de*0x40+_0x45753d:_0x45753d,_0x1fe5fc++%0x4)?_0x249899+=String['fromCharCode'](0xff&_0x4741de>>(-0x2*_0x1fe5fc&0x6)):0x0){_0x45753d=_0x2c5eb1['indexOf'](_0x45753d);}for(let _0xb04a6c=0x0,_0x5ecd69=_0x249899['length'];_0xb04a6c<_0x5ecd69;_0xb04a6c++){_0x22e904+='%'+('00'+_0x249899['charCodeAt'](_0xb04a6c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x22e904);};_0x2e0e['bHFyyh']=_0xd437b4,_0x2e0e['rdveKP']={},_0x2e0e['fYXSsI']=!![];}const _0x1aab33=_0x9c59ab[0x0],_0x227e26=_0x203aa6+_0x1aab33,_0x4de8cd=_0x2e0e['rdveKP'][_0x227e26];return!_0x4de8cd?(_0x2e0eda=_0x2e0e['bHFyyh'](_0x2e0eda),_0x2e0e['rdveKP'][_0x227e26]=_0x2e0eda):_0x2e0eda=_0x4de8cd,_0x2e0eda;}export const registerManufacturerHandlers=_0xef9f46=>{const _0x130e52=_0x2e0e,_0x48db82=_0x2e0e,_0x7e3d2c={'yPScR':_0x130e52(0x11d),'suuFZ':_0x130e52(0x11e),'cCLwX':_0x130e52(0x119)},_0x262d2e=_0x3e2dcd();return _0x262d2e[_0x130e52(0x125)](_0xd1d917[_0x130e52(0x134)+_0x130e52(0x122)+'er'],_0x11bcd0=>_0x57f1ed(void 0x0,void 0x0,void 0x0,function*(){const _0x36d483=_0x130e52,_0x18e0ca=_0x130e52,_0x599f2c=_0x11bcd0[_0x36d483(0x111)](_0x36d483(0x11d)),_0x5b8260=_0x11bcd0['req'][_0x36d483(0x123)](_0x36d483(0x131)),_0x56267d=_0x11bcd0['req'][_0x18e0ca(0x123)](_0x18e0ca(0x12b)),_0x2e23ba=yield _0x599f2c[_0x18e0ca(0x12c)+'d'](_0x18e0ca(0x12e)),_0x57cfc1=yield _0xef9f46['createMa'+_0x18e0ca(0x122)+'er'](_0x5b8260[_0x18e0ca(0x135)+_0x18e0ca(0x115)],_0x2e23ba['id'],_0x56267d);return _0x11bcd0[_0x36d483(0x12b)](_0x57cfc1,0xc9);})),_0x262d2e[_0x48db82(0x125)](_0xd1d917[_0x48db82(0x129)+_0x48db82(0x11f)],_0x5973ae=>_0x57f1ed(void 0x0,void 0x0,void 0x0,function*(){const _0x33f6a3=_0x48db82,_0x513089=_0x48db82,_0x117521=_0x5973ae[_0x33f6a3(0x111)](_0x33f6a3(0x11d)),_0x1c6416=_0x5973ae[_0x513089(0x124)][_0x513089(0x123)](_0x33f6a3(0x131)),_0x4ac860=_0x5973ae[_0x33f6a3(0x124)][_0x513089(0x123)](_0x33f6a3(0x11a));yield _0x117521[_0x513089(0x12c)+'d'](_0x33f6a3(0x112));const _0x5d8227=yield _0xef9f46['getManuf'+'acturer'](_0x1c6416[_0x513089(0x135)+_0x33f6a3(0x115)],_0x1c6416['id'],{'locale':_0x4ac860[_0x513089(0x132)]||null});return _0x5973ae[_0x513089(0x12b)](_0x5d8227,0xc8);})),_0x262d2e[_0x130e52(0x125)](_0xd1d917[_0x48db82(0x129)+_0x130e52(0x128)],_0x2c310a=>_0x57f1ed(void 0x0,void 0x0,void 0x0,function*(){const _0x3b53cc=_0x130e52,_0x1d2c38=_0x130e52,_0x358749=_0x2c310a['get'](_0x3b53cc(0x11d)),_0x3f6fba=_0x2c310a['req'][_0x3b53cc(0x123)](_0x3b53cc(0x131)),_0x8121bd=_0x2c310a[_0x3b53cc(0x124)]['valid']('query');yield _0x358749[_0x1d2c38(0x12c)+'d'](_0x1d2c38(0x112));const _0x2c1afd=yield _0xef9f46['getManuf'+'acturers'](_0x3f6fba['organiza'+_0x3b53cc(0x115)],Object[_0x1d2c38(0x11c)](Object[_0x3b53cc(0x11c)]({},_0x8121bd),{'locale':_0x8121bd[_0x3b53cc(0x132)]||null}));return _0x2c310a[_0x1d2c38(0x12b)](_0x2c1afd,0xc8);})),_0x262d2e[_0x48db82(0x125)](_0xd1d917[_0x130e52(0x12f)+_0x48db82(0x122)+'er'],_0x120f0f=>_0x57f1ed(void 0x0,void 0x0,void 0x0,function*(){const _0x2f5c10=_0x48db82,_0x36b1cc=_0x48db82,_0x49b442=_0x120f0f['get'](_0x7e3d2c[_0x2f5c10(0x126)]),_0xd307e=_0x120f0f[_0x36b1cc(0x124)][_0x36b1cc(0x123)](_0x2f5c10(0x131)),_0x3aa299=_0x120f0f[_0x36b1cc(0x124)][_0x2f5c10(0x123)](_0x2f5c10(0x12b)),_0x1f8f3a=yield _0x49b442[_0x2f5c10(0x12c)+'d'](_0x7e3d2c[_0x36b1cc(0x12d)]),_0xd13067=yield _0xef9f46[_0x36b1cc(0x12f)+_0x36b1cc(0x122)+'er'](_0xd307e[_0x36b1cc(0x135)+_0x36b1cc(0x115)],_0xd307e['id'],_0x1f8f3a['id'],_0x3aa299);return _0x120f0f[_0x2f5c10(0x12b)](_0xd13067,0xc8);})),_0x262d2e[_0x130e52(0x125)](_0xd1d917[_0x48db82(0x114)+_0x48db82(0x122)+'er'],_0x517f92=>_0x57f1ed(void 0x0,void 0x0,void 0x0,function*(){const _0x53fa03=_0x48db82,_0x16db4a=_0x48db82,_0x4f590f=_0x517f92['get'](_0x7e3d2c['yPScR']),_0x46871f=_0x517f92[_0x53fa03(0x124)][_0x16db4a(0x123)](_0x53fa03(0x131)),_0x473355=yield _0x4f590f[_0x16db4a(0x12c)+'d'](_0x7e3d2c[_0x16db4a(0x11b)]);return yield _0xef9f46[_0x53fa03(0x114)+_0x53fa03(0x122)+'er'](_0x46871f['organiza'+_0x16db4a(0x115)],_0x46871f['id'],_0x473355['id']),_0x517f92[_0x53fa03(0x121)](null,0xcc);})),_0x262d2e;};
1
+ import{__awaiter as u}from"tslib";import{createApiRouter as l}from"../../core/hono/hono";import{manufacturerRoute as d}from"./manufacturer.route";export const registerManufacturerHandlers=i=>{const o=l();return o.openapi(d.createManufacturer,a=>u(void 0,void 0,void 0,function*(){const r=a.get("auth"),t=a.req.valid("param"),e=a.req.valid("json"),n=yield r.isGranted("create"),s=yield i.createManufacturer(t.organizationId,n.id,e);return a.json(s,201)})),o.openapi(d.getManufacturer,a=>u(void 0,void 0,void 0,function*(){const r=a.get("auth"),t=a.req.valid("param"),e=a.req.valid("query");yield r.isGranted("read");const n=yield i.getManufacturer(t.organizationId,t.id,{locale:e.locale||null});return a.json(n,200)})),o.openapi(d.getManufacturers,a=>u(void 0,void 0,void 0,function*(){const r=a.get("auth"),t=a.req.valid("param"),e=a.req.valid("query");yield r.isGranted("read");const n=yield i.getManufacturers(t.organizationId,Object.assign(Object.assign({},e),{locale:e.locale||null}));return a.json(n,200)})),o.openapi(d.updateManufacturer,a=>u(void 0,void 0,void 0,function*(){const r=a.get("auth"),t=a.req.valid("param"),e=a.req.valid("json"),n=yield r.isGranted("update"),s=yield i.updateManufacturer(t.organizationId,t.id,n.id,e);return a.json(s,200)})),o.openapi(d.deleteManufacturer,a=>u(void 0,void 0,void 0,function*(){const r=a.get("auth"),t=a.req.valid("param"),e=yield r.isGranted("delete");return yield i.deleteManufacturer(t.organizationId,t.id,e.id),a.body(null,204)})),o};
@@ -1 +1 @@
1
- const _0x5ab309=_0x50a9,_0x1e3a31=_0x50a9;(function(_0x596f15,_0x4a78c1){const _0x10bbc7=_0x50a9,_0x170aee=_0x50a9,_0x37c32f=_0x596f15();while(!![]){try{const _0x58848f=parseInt(_0x10bbc7(0x77))/0x1*(parseInt(_0x170aee(0x69))/0x2)+-parseInt(_0x10bbc7(0x7b))/0x3+parseInt(_0x170aee(0x86))/0x4*(parseInt(_0x170aee(0x95))/0x5)+parseInt(_0x10bbc7(0x6b))/0x6+parseInt(_0x170aee(0x96))/0x7*(-parseInt(_0x170aee(0x7c))/0x8)+parseInt(_0x170aee(0x70))/0x9+-parseInt(_0x170aee(0x74))/0xa;if(_0x58848f===_0x4a78c1)break;else _0x37c32f['push'](_0x37c32f['shift']());}catch(_0x3bc5ba){_0x37c32f['push'](_0x37c32f['shift']());}}}(_0x401c,0xa992c));function _0x401c(){const _0x5311b9=['Aw5Nig1HBNu','DgvKigXPC3q','twfUDwzHy3q','otu5ntqXmfL3qKHZrW','u29MDcbKzwW','r0vu','ndm5mtvlD3rxAxi','BNvMywn0Dxi','y3jLyxrLtwe','ywn0DxjLCNm','nZq0nZuZrwHTtNPM','otuYBK1cseTx','DhvYzxjZlZO','revmrvrf','zgvSzxrLtwe','yw4GzxHPC3q','EMf0Aw9U','CMvY','yxjYyxK','ufvu','zMfJDhvYzxi','ne1uDfnVwq','r2v0ie1HBNu','DxbKyxrLtwe','rgvSzxrLie0','ihnWzwnPzMK','ysbUzxCGBwe','yYbVCMDHBMK','yxrPB24','ig9Mig1HBNu','ue9tva','l21HBNvMywm','CYbMB3iGysa','yw51zMfJDhu','DhvYzxjZ','q3jLyxrLCYa','mtm3ndyWnurIzujtCW','ndu4otLHsKDnwfa','DxjLCG','zxiGzM9Yige','vxbKyxrLCYa','EMf0Aw9Uswq','B2jQzwn0','lZPVCMDHBMK','Dw5PB24','ndbfqMjezwi','C3bLy2LMAwm','nZKXmJq4mNftAgHeqW','z2v0twfUDwy','q3jLyxrLie0','vxbKyxrLie0','zxrLCYbHig0','mtG5nJeXmvDYCMXptq'];_0x401c=function(){return _0x5311b9;};return _0x401c();}import{z as _0x705700}from'@hono/zod-openapi';import{createApiRoute as _0x3a56a3}from'../../core/hono/hono';import{ErrorSchema as _0x6a7eb,HeaderSchema as _0x44ec78,OrganizationParams as _0x377a6b,OrganizationWithIdParams as _0x288012,PaginationMetaSchema as _0x3127fb,PaginationQuerySchema as _0x373dc2}from'../../schemas';import{GetResourceQuerySchema as _0xa9ae27}from'../../schemas/queries.schema';function _0x50a9(_0x2d06f0,_0x4c4975){_0x2d06f0=_0x2d06f0-0x67;const _0x401cc8=_0x401c();let _0x50a91f=_0x401cc8[_0x2d06f0];if(_0x50a9['DcJbWY']===undefined){var _0x2bdce5=function(_0x4329d9){const _0x42a393='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x705700='',_0x3a56a3='';for(let _0x6a7eb=0x0,_0x44ec78,_0x377a6b,_0x288012=0x0;_0x377a6b=_0x4329d9['charAt'](_0x288012++);~_0x377a6b&&(_0x44ec78=_0x6a7eb%0x4?_0x44ec78*0x40+_0x377a6b:_0x377a6b,_0x6a7eb++%0x4)?_0x705700+=String['fromCharCode'](0xff&_0x44ec78>>(-0x2*_0x6a7eb&0x6)):0x0){_0x377a6b=_0x42a393['indexOf'](_0x377a6b);}for(let _0x3127fb=0x0,_0x373dc2=_0x705700['length'];_0x3127fb<_0x373dc2;_0x3127fb++){_0x3a56a3+='%'+('00'+_0x705700['charCodeAt'](_0x3127fb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3a56a3);};_0x50a9['DeybDN']=_0x2bdce5,_0x50a9['kRanod']={},_0x50a9['DcJbWY']=!![];}const _0x104115=_0x401cc8[0x0],_0x5157f7=_0x2d06f0+_0x104115,_0x34804b=_0x50a9['kRanod'][_0x5157f7];return!_0x34804b?(_0x50a91f=_0x50a9['DeybDN'](_0x50a91f),_0x50a9['kRanod'][_0x5157f7]=_0x50a91f):_0x50a91f=_0x34804b,_0x50a91f;}import{CreateManufacturerSchema as _0x5be6d2,LocalizedManufacturerSchema as _0x4fb369,ManufacturerSchema as _0xb0e768,UpdateManufacturerSchema as _0x4874df}from'./manufacturer.schema';const p=_0x3a56a3({'description':'Fetches\x20'+'a\x20pagina'+_0x5ab309(0x72)+_0x1e3a31(0x8e)+_0x5ab309(0x85)+_0x5ab309(0x91)+_0x5ab309(0x6a)+'\x20organiz'+_0x1e3a31(0x8d),'headers':_0x44ec78,'method':_0x1e3a31(0x76),'operationId':_0x1e3a31(0x6c)+_0x5ab309(0x7a),'path':_0x1e3a31(0x67)+'zationId'+_0x5ab309(0x90)+_0x1e3a31(0x93),'pathParams':_0x377a6b,'query':_0x373dc2,'responses':{0xc8:_0x705700[_0x5ab309(0x9b)]({'list':_0x705700[_0x1e3a31(0x83)](_0x705700[_0x1e3a31(0x68)]([_0xb0e768,_0x4fb369])),'meta':_0x3127fb}),0x190:_0x6a7eb,0x191:_0x6a7eb},'summary':_0x5ab309(0x87)+_0x5ab309(0x85)+'s','tags':['Manufact'+'urer']}),h=_0x3a56a3({'body':_0x5be6d2,'description':_0x5ab309(0x94)+_0x5ab309(0x8b)+_0x5ab309(0x78)+_0x1e3a31(0x98)+_0x5ab309(0x8a)+_0x1e3a31(0x8c)+_0x1e3a31(0x81),'headers':_0x44ec78,'method':_0x1e3a31(0x8f),'operationId':_0x5ab309(0x79)+_0x1e3a31(0x78)+'er','path':'/:organi'+_0x5ab309(0x9a)+'/manufac'+_0x1e3a31(0x93),'pathParams':_0x377a6b,'responses':{0xc9:_0xb0e768,0x190:_0x6a7eb,0x191:_0x6a7eb,0x194:_0x6a7eb},'summary':_0x5ab309(0x6d)+_0x1e3a31(0x92)+_0x1e3a31(0x82),'tags':[_0x1e3a31(0x73)+_0x5ab309(0x97)]}),M=_0x3a56a3({'headers':_0x44ec78,'method':_0x5ab309(0x76),'operationId':_0x1e3a31(0x6c)+'acturer','path':_0x1e3a31(0x67)+_0x5ab309(0x9a)+_0x1e3a31(0x90)+'turers/:'+'id','pathParams':_0x288012,'query':_0xa9ae27,'responses':{0xc8:_0x705700[_0x5ab309(0x68)]([_0xb0e768,_0x4fb369]),0x191:_0x6a7eb,0x194:_0x6a7eb},'summary':_0x1e3a31(0x87)+_0x1e3a31(0x85),'tags':[_0x1e3a31(0x73)+_0x5ab309(0x97)]}),g=_0x3a56a3({'body':_0x4874df,'description':_0x1e3a31(0x99)+_0x1e3a31(0x80)+_0x1e3a31(0x71)+_0x1e3a31(0x85),'headers':_0x44ec78,'method':_0x5ab309(0x84),'operationId':_0x5ab309(0x88)+_0x1e3a31(0x78)+'er','path':_0x5ab309(0x67)+_0x1e3a31(0x9a)+_0x5ab309(0x90)+_0x1e3a31(0x7d)+'id','pathParams':_0x288012,'responses':{0xc8:_0xb0e768,0x190:_0x6a7eb,0x191:_0x6a7eb,0x194:_0x6a7eb},'summary':_0x1e3a31(0x6e)+_0x1e3a31(0x92)+_0x1e3a31(0x82),'tags':[_0x5ab309(0x73)+_0x5ab309(0x97)]}),y=_0x3a56a3({'description':_0x1e3a31(0x75)+_0x1e3a31(0x6f)+'anufactu'+_0x1e3a31(0x82),'headers':_0x44ec78,'method':_0x1e3a31(0x7e),'operationId':_0x5ab309(0x7f)+_0x1e3a31(0x78)+'er','path':_0x1e3a31(0x67)+'zationId'+'/manufac'+_0x1e3a31(0x7d)+'id','pathParams':_0x288012,'responses':{0xcc:null,0x190:_0x6a7eb,0x191:_0x6a7eb,0x194:_0x6a7eb},'summary':_0x5ab309(0x89)+_0x5ab309(0x92)+'rer','tags':[_0x1e3a31(0x73)+_0x1e3a31(0x97)]});export const manufacturerRoute={'getManufacturers':p,'createManufacturer':h,'getManufacturer':M,'updateManufacturer':g,'deleteManufacturer':y};
1
+ import{z as t}from"@hono/zod-openapi";import{createApiRoute as e}from"../../core/hono/hono";import{ErrorSchema as a,HeaderSchema as r,OrganizationParams as o,OrganizationWithIdParams as n,PaginationMetaSchema as s,PaginationQuerySchema as i}from"../../schemas";import{GetResourceQuerySchema as m}from"../../schemas/queries.schema";import{CreateManufacturerSchema as f,LocalizedManufacturerSchema as c,ManufacturerSchema as u,UpdateManufacturerSchema as d}from"./manufacturer.schema";const p=e({description:"Fetches a paginated list of manufacturers for a specific organization",headers:r,method:"GET",operationId:"getManufacturers",path:"/:organizationId/manufacturers",pathParams:o,query:i,responses:{200:t.object({list:t.array(t.union([u,c])),meta:s}),400:a,401:a},summary:"Get Manufacturers",tags:["Manufacturer"]}),h=e({body:f,description:"Creates a new manufacturer for a specific organization",headers:r,method:"POST",operationId:"createManufacturer",path:"/:organizationId/manufacturers",pathParams:o,responses:{201:u,400:a,401:a,404:a},summary:"Create Manufacturer",tags:["Manufacturer"]}),M=e({headers:r,method:"GET",operationId:"getManufacturer",path:"/:organizationId/manufacturers/:id",pathParams:n,query:m,responses:{200:t.union([u,c]),401:a,404:a},summary:"Get Manufacturer",tags:["Manufacturer"]}),g=e({body:d,description:"Updates an existing manufacturer",headers:r,method:"PUT",operationId:"updateManufacturer",path:"/:organizationId/manufacturers/:id",pathParams:n,responses:{200:u,400:a,401:a,404:a},summary:"Update Manufacturer",tags:["Manufacturer"]}),y=e({description:"Soft deletes a manufacturer",headers:r,method:"DELETE",operationId:"deleteManufacturer",path:"/:organizationId/manufacturers/:id",pathParams:n,responses:{204:null,400:a,401:a,404:a},summary:"Delete Manufacturer",tags:["Manufacturer"]});export const manufacturerRoute={getManufacturers:p,createManufacturer:h,getManufacturer:M,updateManufacturer:g,deleteManufacturer:y};
@@ -1 +1 @@
1
- function _0x1657(_0x2fc493,_0x203592){_0x2fc493=_0x2fc493-0x104;const _0x5373d0=_0x5373();let _0x16576b=_0x5373d0[_0x2fc493];if(_0x1657['YepyMk']===undefined){var _0x3dcf71=function(_0x48a34a){const _0x5112e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xaa2407='',_0x2057c9='';for(let _0x3827b4=0x0,_0x21aaf6,_0x1978f7,_0x3686b8=0x0;_0x1978f7=_0x48a34a['charAt'](_0x3686b8++);~_0x1978f7&&(_0x21aaf6=_0x3827b4%0x4?_0x21aaf6*0x40+_0x1978f7:_0x1978f7,_0x3827b4++%0x4)?_0xaa2407+=String['fromCharCode'](0xff&_0x21aaf6>>(-0x2*_0x3827b4&0x6)):0x0){_0x1978f7=_0x5112e1['indexOf'](_0x1978f7);}for(let _0x42d4dd=0x0,_0x3567ad=_0xaa2407['length'];_0x42d4dd<_0x3567ad;_0x42d4dd++){_0x2057c9+='%'+('00'+_0xaa2407['charCodeAt'](_0x42d4dd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2057c9);};_0x1657['XQwxbc']=_0x3dcf71,_0x1657['SxjbKL']={},_0x1657['YepyMk']=!![];}const _0x7d2420=_0x5373d0[0x0],_0x3f2bf0=_0x2fc493+_0x7d2420,_0x1b9bab=_0x1657['SxjbKL'][_0x3f2bf0];return!_0x1b9bab?(_0x16576b=_0x1657['XQwxbc'](_0x16576b),_0x1657['SxjbKL'][_0x3f2bf0]=_0x16576b):_0x16576b=_0x1b9bab,_0x16576b;}const _0x59e050=_0x1657,_0xac4ff=_0x1657;(function(_0x3708db,_0x4c9caf){const _0x370f28=_0x1657,_0x21a4b1=_0x1657,_0x11f342=_0x3708db();while(!![]){try{const _0x43c797=-parseInt(_0x370f28(0x11f))/0x1+parseInt(_0x370f28(0x10a))/0x2+-parseInt(_0x370f28(0x142))/0x3*(-parseInt(_0x370f28(0x14a))/0x4)+-parseInt(_0x21a4b1(0x119))/0x5*(-parseInt(_0x370f28(0x137))/0x6)+parseInt(_0x21a4b1(0x159))/0x7+-parseInt(_0x21a4b1(0x134))/0x8*(-parseInt(_0x370f28(0x139))/0x9)+parseInt(_0x21a4b1(0x149))/0xa*(-parseInt(_0x21a4b1(0x140))/0xb);if(_0x43c797===_0x4c9caf)break;else _0x11f342['push'](_0x11f342['shift']());}catch(_0x13b3c9){_0x11f342['push'](_0x11f342['shift']());}}}(_0x5373,0x65f87));import{z as _0xaa2407}from'@hono/zod-openapi';import{validateRequiredForDefaultLocale as _0x2057c9}from'../../core/utils/zod.util';import{FileSchema as _0x3827b4}from'../file/file.schema';export const ManufacturerSchema=_0xaa2407[_0x59e050(0x112)]({'id':_0xaa2407[_0xac4ff(0x109)]()[_0xac4ff(0x11b)]({'example':_0xac4ff(0x154)+_0x59e050(0x108)+_0xac4ff(0x10b),'description':'ID\x20of\x20th'+_0xac4ff(0x12e)+_0x59e050(0x11c)}),'name':_0xaa2407['string']()[_0xac4ff(0x11b)]({'example':'Tech\x20Inn'+_0xac4ff(0x151)+_0x59e050(0x10d),'description':_0xac4ff(0x145)+_0x59e050(0x135)+_0x59e050(0x128)}),'logo':_0x3827b4[_0xac4ff(0x106)]()['optional']()[_0xac4ff(0x11b)]({'description':'Logo\x20of\x20'+_0x59e050(0x135)+_0xac4ff(0x128)}),'createdAt':_0xaa2407[_0xac4ff(0x14c)](),'translations':_0xaa2407[_0x59e050(0x143)](_0xaa2407['object']({'locale':_0xaa2407[_0xac4ff(0x109)]()[_0x59e050(0x104)](0x1,_0xac4ff(0x14b)+_0x59e050(0x12b)+'ed')['openapi']({'example':_0xac4ff(0x138),'description':_0xac4ff(0x144)+'ode\x20for\x20'+_0x59e050(0x131)+_0xac4ff(0x12a)}),'about':_0xaa2407[_0xac4ff(0x109)]()[_0xac4ff(0x114)](0x1770,'Maximum\x20'+'characte'+'r\x20limit\x20'+_0xac4ff(0x14e))[_0xac4ff(0x106)]()['optional']()[_0x59e050(0x11b)]({'example':_0xac4ff(0x11a)+_0xac4ff(0x151)+'Inc.\x20is\x20'+_0xac4ff(0x129)+_0xac4ff(0x105)+_0xac4ff(0x127),'description':_0xac4ff(0x13e)+_0xac4ff(0x150)+_0xac4ff(0x155)+_0xac4ff(0x120)+_0x59e050(0x130)+_0x59e050(0x13d)+'ied\x20loca'+'le'})}))[_0xac4ff(0x12f)]()[_0xac4ff(0x11b)]({'description':'List\x20of\x20'+'translat'+'ions\x20for'+'\x20the\x20man'+_0xac4ff(0x147)+'r'})})[_0x59e050(0x11b)](_0x59e050(0x156)+_0xac4ff(0x136)),LocalizedManufacturerSchema=ManufacturerSchema[_0x59e050(0x11e)]({'translations':!0x0})[_0xac4ff(0x153)]({'about':_0xaa2407[_0xac4ff(0x109)]()['nullable']()[_0x59e050(0x12f)]()[_0x59e050(0x10c)]('')})[_0xac4ff(0x11b)]('Localize'+_0x59e050(0x10e)+_0x59e050(0x13f)),CreateManufacturerSchema=_0xaa2407[_0x59e050(0x112)]({'name':_0xaa2407['string']()[_0xac4ff(0x104)](0x1,_0x59e050(0x13c)+_0x59e050(0x141))[_0xac4ff(0x11b)]({'example':'Apple\x20In'+'c.','description':_0xac4ff(0x145)+_0x59e050(0x135)+_0xac4ff(0x128)}),'defaultLocale':_0xaa2407[_0xac4ff(0x109)]()['min'](0x1,_0xac4ff(0x14d)+_0x59e050(0x14f)+_0x59e050(0x12b)+'ed')[_0x59e050(0x11b)]({'example':_0x59e050(0x138),'description':_0x59e050(0x126)+_0xac4ff(0x148)+_0x59e050(0x12d)+_0xac4ff(0x15a)+'acturer'}),'logo':_0x3827b4[_0x59e050(0x106)]()['optional']()[_0x59e050(0x11b)]({'description':_0xac4ff(0x110)+'the\x20manu'+_0x59e050(0x128)}),'translations':_0xaa2407[_0x59e050(0x143)](_0xaa2407[_0x59e050(0x112)]({'locale':_0xaa2407['string']()[_0xac4ff(0x104)](0x1,_0x59e050(0x14b)+_0x59e050(0x12b)+'ed')[_0xac4ff(0x11b)]({'example':_0xac4ff(0x138),'description':_0x59e050(0x144)+'ode\x20for\x20'+_0x59e050(0x131)+_0x59e050(0x12a)}),'about':_0xaa2407[_0x59e050(0x109)]()[_0xac4ff(0x114)](0x1770,'Maximum\x20'+_0xac4ff(0x11d)+_0xac4ff(0x133)+_0xac4ff(0x14e))[_0x59e050(0x106)]()[_0xac4ff(0x12f)]()[_0xac4ff(0x11b)]({'example':_0xac4ff(0x158)+'c.\x20is\x20a\x20'+_0xac4ff(0x113)+_0x59e050(0x132)+'chnology'+_0xac4ff(0x107)+'.','description':_0xac4ff(0x13e)+_0x59e050(0x150)+_0x59e050(0x155)+_0x59e050(0x120)+_0x59e050(0x130)+'e\x20specif'+'ied\x20loca'+'le'})}))[_0xac4ff(0x104)](0x1,_0xac4ff(0x118)+_0xac4ff(0x116)+_0x59e050(0x13a)+'d')['openapi']({'description':_0xac4ff(0x122)+'translat'+_0x59e050(0x121)+_0x59e050(0x146)+_0x59e050(0x147)+'r'}),'logoId':_0xaa2407['string']()[_0xac4ff(0x12f)]()[_0x59e050(0x11b)]({'example':'clf98765'+'43210abc'+_0xac4ff(0x10b),'description':'ID\x20refer'+_0x59e050(0x111)+_0x59e050(0x135)+_0xac4ff(0x128)+_0xac4ff(0x123)+'file'})})['superRef'+_0xac4ff(0x117)](_0x2057c9('about'))[_0x59e050(0x11b)]('CreateMa'+'nufactur'+'er'),UpdateManufacturerSchema=_0xaa2407[_0xac4ff(0x112)]({'name':_0xaa2407[_0x59e050(0x109)]()[_0xac4ff(0x104)](0x1,_0x59e050(0x13c)+_0xac4ff(0x141))[_0xac4ff(0x12f)]()[_0xac4ff(0x11b)]({'example':_0x59e050(0x158)+_0x59e050(0x125)+'ed','description':_0xac4ff(0x145)+_0x59e050(0x135)+_0xac4ff(0x128)}),'logo':_0x3827b4['nullable']()[_0xac4ff(0x12f)]()[_0x59e050(0x11b)]({'description':_0xac4ff(0x110)+'the\x20manu'+_0x59e050(0x128)}),'defaultLocale':_0xaa2407[_0x59e050(0x109)]()['min'](0x1,'Default\x20'+_0xac4ff(0x14f)+_0xac4ff(0x12b)+'ed')[_0xac4ff(0x11b)]({'description':'The\x20defa'+_0xac4ff(0x148)+_0x59e050(0x12d)+_0xac4ff(0x15a)+_0xac4ff(0x157)}),'logoId':_0xaa2407['string']()['nullable']()[_0xac4ff(0x12f)]()[_0xac4ff(0x11b)]({'example':'clf98765'+_0xac4ff(0x108)+_0xac4ff(0x10b),'description':_0xac4ff(0x13b)+'ence\x20to\x20'+'the\x20manu'+_0x59e050(0x128)+_0xac4ff(0x123)+_0x59e050(0x115)}),'translations':_0xaa2407['array'](_0xaa2407[_0x59e050(0x112)]({'locale':_0xaa2407[_0xac4ff(0x109)]()[_0xac4ff(0x104)](0x1,_0xac4ff(0x14b)+_0xac4ff(0x12b)+'ed')['openapi']({'example':_0x59e050(0x138),'description':_0x59e050(0x144)+_0x59e050(0x124)+_0xac4ff(0x131)+_0xac4ff(0x12a)}),'about':_0xaa2407[_0x59e050(0x109)]()[_0x59e050(0x114)](0x1770,_0x59e050(0x15b)+_0x59e050(0x11d)+_0xac4ff(0x133)+_0xac4ff(0x14e))[_0xac4ff(0x106)]()[_0x59e050(0x12f)]()[_0xac4ff(0x11b)]({'example':_0xac4ff(0x158)+_0xac4ff(0x152)+_0x59e050(0x113)+_0x59e050(0x132)+'chnology'+_0xac4ff(0x107)+'.','description':'Descript'+_0x59e050(0x150)+_0xac4ff(0x155)+_0x59e050(0x120)+_0x59e050(0x130)+_0xac4ff(0x13d)+'ied\x20loca'+'le'})}))[_0x59e050(0x12f)]()['openapi']({'description':_0xac4ff(0x122)+_0xac4ff(0x10f)+_0xac4ff(0x121)+'\x20the\x20man'+_0xac4ff(0x147)+'r'})})[_0x59e050(0x11b)](_0xac4ff(0x12c)+_0x59e050(0x120)+'er');function _0x5373(){const _0x203ee1=['zMfJDhvYzxi','ysb0zwnOBM8','C2XHDgLVBG','CYbYzxf1Axi','vxbKyxrLtwe','BguGzM9Yihq','zsbTyw51zMe','B3b0Aw9UywW','zxiGAw4GDgG','DgHLihrYyw4','Aw9UywWGDgu','CIbSAw1PDca','mtuWnde0nev4ru54wa','DgHLig1HBNu','DxjLCG','nJaWoti0D05OzKPy','zw4Tvvm','mtHIzK1UEeC','ihjLCxvPCMu','suqGCMvMzxi','tMfTzsbPCYa','zsbZCgvJAwy','rgvZy3jPChq','DhvYzxi','mJm1ngfkChr2Bq','CMvXDwLYzwq','mJG4m3fkCxj0uG','yxjYyxK','tg9JywXLigm','tMfTzsbVzIa','ihrOzsbTyw4','DwzHy3r1CMu','DwX0igXVy2e','mJK4nZbkAu5wueK','mtm5nMPKrLLeuq','tg9JywXLigK','zgf0zq','rgvMyxvSDca','AxmGnJaWma','Bg9JywXLigK','Aw9UigfIB3u','B3zHDg9YCYa','yY4GAxmGysa','zxH0zw5K','y2XMotG3nJu','Dcb0AguGBwe','twfUDwzHy3q','ywn0DxjLCG','qxbWBguGsw4','mZyWmZe2nKzNv2nuvW','AguGBwfUDwy','twf4Aw11Bsa','BwLU','Bg9NEsbJB20','BNvSBgfIBgu','ignVBxbHBNK','ndmYmtbHyMm','C3rYAw5N','mJm5ntK4ue9Xzev2','zgvM','zgvMyxvSDa','sw5JlG','ze1HBNvMywm','DhjHBNnSyxq','tg9NBYbVzIa','zw5Jzsb0BYa','B2jQzwn0','BxvSDgLUyxq','Bwf4','zMLSzq','Aw9UCYbHCMu','Aw5L','vhjHBNnSyxq','nw9UB3vtrG','vgvJAcbjBM4','B3bLBMfWAq','y3r1CMvY','y2HHCMfJDgu','B21PDa','mZG5mJi3y3HOBg5A','BNvMywn0Dxi','Aw9UCYbMB3i','tgLZDcbVzIa','j3mGBg9NBYa','B2rLigzVCIa','yY4GvxbKyxq','vgHLigrLzMe','CgfUEs4'];_0x5373=function(){return _0x203ee1;};return _0x5373();}
1
+ import{z as e}from"@hono/zod-openapi";import{validateRequiredForDefaultLocale as o}from"../../core/utils/zod.util";import{FileSchema as a}from"../file/file.schema";export const ManufacturerSchema=e.object({id:e.string().openapi({example:"clf9876543210abcdef",description:"ID of the manufacturer"}),name:e.string().openapi({example:"Tech Innovators Inc.",description:"Name of the manufacturer"}),logo:a.nullable().optional().openapi({description:"Logo of the manufacturer"}),createdAt:e.date(),translations:e.array(e.object({locale:e.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:e.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Tech Innovators Inc. is a technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("Manufacturer"),LocalizedManufacturerSchema=ManufacturerSchema.omit({translations:!0}).extend({about:e.string().nullable().optional().default("")}).openapi("LocalizedManufacturer"),CreateManufacturerSchema=e.object({name:e.string().min(1,"Name is required").openapi({example:"Apple Inc.",description:"Name of the manufacturer"}),defaultLocale:e.string().min(1,"Default locale is required").openapi({example:"en-US",description:"The default locale for the manufacturer"}),logo:a.nullable().optional().openapi({description:"Logo of the manufacturer"}),translations:e.array(e.object({locale:e.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:e.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).min(1,"Translations are required").openapi({description:"List of translations for the manufacturer"}),logoId:e.string().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"})}).superRefine(o("about")).openapi("CreateManufacturer"),UpdateManufacturerSchema=e.object({name:e.string().min(1,"Name is required").optional().openapi({example:"Apple Inc. Updated",description:"Name of the manufacturer"}),logo:a.nullable().optional().openapi({description:"Logo of the manufacturer"}),defaultLocale:e.string().min(1,"Default locale is required").openapi({description:"The default locale for the manufacturer"}),logoId:e.string().nullable().optional().openapi({example:"clf9876543210abcdef",description:"ID reference to the manufacturer's logo file"}),translations:e.array(e.object({locale:e.string().min(1,"Locale is required").openapi({example:"en-US",description:"Locale code for the translation"}),about:e.string().max(6e3,"Maximum character limit is 6000").nullable().optional().openapi({example:"Apple Inc. is a multinational technology company.",description:"Description about the manufacturer in the specified locale"})})).optional().openapi({description:"List of translations for the manufacturer"})}).openapi("UpdateManufacturer");
@@ -1 +1 @@
1
- const _0x5bda57=_0x3f33,_0xf1a8a2=_0x3f33;function _0x207d(){const _0x2d3dab=['BMfTzq','zMfJDhvYzxi','Aw5Zzw5ZAxq','zMLUzfvUAxe','CgfNAw5HDgu','ywn0DxjLCG','Aw5JBhvKzq','ndC4odmZmKvdA0L0yq','mZC4ntGZmhvUq3nvEq','mNzIu01kyG','mtG0nJmWog5xCvrqqW','DxbKyxrLtwe','BNvMywn0Dxi','Aw9UCW','y3jLyxrLtwe','DxbKyxrL','zgvSzxrLtwe','mtb4yKH0DKO','DhjHBNnSyxq','Bg9NB0LK','DxjLCIbUB3q','z2v0twfUDwy','ChjPC21H','mtCWnty3BLLvqwPe','y3jLyxrL','igzVDw5K','oxjYv2nJCa','zgvZyW','mJu2mJK3ohfAtfvMDW','CgfYC2u','ywn0DxjLCNm','yxjYyxK','AxzL','BwfW','twfUDwzHy3q','DxjLCG','B2jQzwn0','mte5mtCYmJrkrfPhD0m','zMLUze1HBNu','nJKWota3mfPUsM1Quq','BwfUDwzHy3q','AeLXENm'];_0x207d=function(){return _0x2d3dab;};return _0x207d();}(function(_0x48c658,_0x4250ce){const _0x61443a=_0x3f33,_0x4c8251=_0x3f33,_0x5ac3de=_0x48c658();while(!![]){try{const _0x2698e3=parseInt(_0x61443a(0x1b2))/0x1*(parseInt(_0x4c8251(0x1ce))/0x2)+-parseInt(_0x4c8251(0x1b7))/0x3+-parseInt(_0x4c8251(0x1cc))/0x4+parseInt(_0x61443a(0x1ac))/0x5*(parseInt(_0x61443a(0x1cf))/0x6)+parseInt(_0x61443a(0x1c2))/0x7+parseInt(_0x61443a(0x1c0))/0x8+parseInt(_0x61443a(0x1b5))/0x9*(-parseInt(_0x4c8251(0x1cd))/0xa);if(_0x2698e3===_0x4250ce)break;else _0x5ac3de['push'](_0x5ac3de['shift']());}catch(_0x2c4c09){_0x5ac3de['push'](_0x5ac3de['shift']());}}}(_0x207d,0xcb4a2));import{__awaiter as _0x4f8096}from'tslib';import{z as _0x5c0b92}from'@hono/zod-openapi';import{HttpException as _0x19bee5}from'../../core/exceptions/http-exception';import{flattenTranslationData as _0x410275}from'../../core/utils/zod.util';import{LocalizedManufacturerSchema as _0x3f15f5,ManufacturerSchema as _0x318804,PaginationMetaSchema as _0xa4f93b}from'../../schemas';class M{constructor(_0x10198c){const _0x1b23b0=_0x3f33;this[_0x1b23b0(0x1b1)]=_0x10198c;}['findManu'+_0x5bda57(0x1c6)](_0x32bd23,_0x5e1fe7,_0x5c251f){const _0x4bbc0a=_0x5bda57,_0x37846d=_0x5bda57,_0x6d4e69={'hIqzs':_0x4bbc0a(0x1bd)+_0x4bbc0a(0x1af)+_0x37846d(0x1b4)};return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x88c9db=_0x4bbc0a,_0x24fcbb=_0x4bbc0a,_0x546bb3=yield this[_0x88c9db(0x1b1)][_0x24fcbb(0x1c3)+'urer'][_0x24fcbb(0x1c8)+'ue']({'where':{'id':_0x32bd23,'organizationId':_0x5e1fe7,'deletedAt':null},'include':_0x5c251f?.[_0x24fcbb(0x1cb)]});if(!_0x546bb3)throw new _0x19bee5(0x194,_0x6d4e69[_0x24fcbb(0x1c4)]);return _0x546bb3;});}[_0x5bda57(0x1a9)+'nufactur'+'er'](_0x517c2,_0x1ed9b2,_0x58bfce){return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x457b8d=_0x3f33,_0x22f20b=_0x3f33,_0x4c11d5=yield this[_0x457b8d(0x1b1)]['manufact'+_0x22f20b(0x1be)][_0x22f20b(0x1b3)]({'data':{'name':_0x58bfce[_0x457b8d(0x1c5)],'organizationId':_0x517c2,'createdBy':_0x1ed9b2,'logoId':_0x58bfce[_0x457b8d(0x1ae)],'translations':{'create':_0x58bfce[_0x457b8d(0x1ad)+'ions']}},'include':{'translations':!0x0,'logo':!0x0}});return _0x318804[_0x457b8d(0x1b8)](_0x4c11d5);});}[_0xf1a8a2(0x1b0)+_0xf1a8a2(0x1ca)](_0x22c64e,_0x2a09f7,_0x1fb272){return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x2b3294=_0x3f33,_0x2acd64=_0x3f33,{locale:_0x27ad87}=_0x1fb272,_0x56e9eb=yield this[_0x2b3294(0x1c1)+_0x2b3294(0x1c6)](_0x2a09f7,_0x22c64e,{'include':{'logo':!0x0,'translations':_0x27ad87?{'where':{'locale':_0x27ad87}}:!0x0}});return _0x27ad87?_0x3f15f5[_0x2b3294(0x1b8)](_0x410275(_0x56e9eb)):_0x318804[_0x2b3294(0x1b8)](_0x56e9eb);});}[_0x5bda57(0x1b0)+_0x5bda57(0x1b9)](_0x523a68,_0x35f119){return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x38820f=_0x3f33,_0x4867d1=_0x3f33,{page:_0x3c04d3=0x1,limit:_0x132bab=0xa,search:_0x401d91,locale:_0x42cf75}=_0x35f119,[_0x58a4b7,_0x1f0d27]=yield this[_0x38820f(0x1b1)][_0x4867d1(0x1c3)+_0x4867d1(0x1be)][_0x38820f(0x1c9)]({'orderBy':{'createdAt':_0x4867d1(0x1b6)},'where':Object['assign']({'organizationId':_0x523a68,'deletedAt':null},_0x401d91&&{'name':{'contains':_0x401d91,'mode':_0x4867d1(0x1c7)+_0x4867d1(0x1bb)}}),'include':{'logo':!0x0,'translations':_0x42cf75?{'where':{'locale':_0x42cf75}}:!0x0}})['withPage'+'s']({'page':_0x3c04d3,'limit':_0x132bab});if(!_0x42cf75)return _0x5c0b92[_0x4867d1(0x1bf)]({'meta':_0xa4f93b,'list':_0x5c0b92[_0x38820f(0x1ba)](_0x318804)})[_0x4867d1(0x1b8)]({'meta':_0x1f0d27,'list':_0x58a4b7});const _0x43b483=_0x58a4b7[_0x38820f(0x1bc)](_0x88d042=>_0x410275(_0x88d042));return _0x5c0b92['object']({'meta':_0xa4f93b,'list':_0x5c0b92[_0x4867d1(0x1ba)](_0x3f15f5)})[_0x4867d1(0x1b8)]({'meta':_0x1f0d27,'list':_0x43b483});});}[_0xf1a8a2(0x1d0)+_0xf1a8a2(0x1d1)+'er'](_0x403c83,_0x4d5771,_0x5356d8,_0x348316){return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x253dc2=_0x3f33,_0x451c4d=_0x3f33;yield this[_0x253dc2(0x1c1)+_0x451c4d(0x1c6)](_0x4d5771,_0x403c83);const _0x428161=yield this[_0x451c4d(0x1b1)][_0x253dc2(0x1c3)+_0x451c4d(0x1be)][_0x253dc2(0x1aa)]({'where':{'id':_0x4d5771,'organizationId':_0x403c83,'deletedAt':null},'data':{'updatedBy':_0x5356d8,'name':_0x348316[_0x253dc2(0x1c5)],'translations':{'deleteMany':{},'create':_0x348316[_0x253dc2(0x1ad)+_0x451c4d(0x1a8)]||[]},'logoId':_0x348316['logoId']},'include':{'logo':!0x0,'translations':!0x0}});return _0x318804[_0x451c4d(0x1b8)](_0x428161);});}[_0x5bda57(0x1ab)+_0xf1a8a2(0x1d1)+'er'](_0xf9059,_0x48c298,_0x442696){return _0x4f8096(this,void 0x0,void 0x0,function*(){const _0x39b934=_0x3f33,_0x296c4a=_0x3f33;yield this[_0x39b934(0x1c1)+_0x296c4a(0x1c6)](_0x48c298,_0xf9059),yield this[_0x39b934(0x1b1)][_0x39b934(0x1c3)+_0x296c4a(0x1be)]['update']({'where':{'id':_0x48c298,'organizationId':_0xf9059,'deletedAt':null},'data':{'deletedAt':new Date(),'deletedBy':_0x442696}});});}}function _0x3f33(_0x38197d,_0x48bd9d){_0x38197d=_0x38197d-0x1a8;const _0x207d1e=_0x207d();let _0x3f33d5=_0x207d1e[_0x38197d];if(_0x3f33['afIwjq']===undefined){var _0x1ea9b9=function(_0x5c5f51){const _0x423c75='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x568d39='',_0x1725c5='';for(let _0x266104=0x0,_0x45a6ca,_0xf363c3,_0x2405fb=0x0;_0xf363c3=_0x5c5f51['charAt'](_0x2405fb++);~_0xf363c3&&(_0x45a6ca=_0x266104%0x4?_0x45a6ca*0x40+_0xf363c3:_0xf363c3,_0x266104++%0x4)?_0x568d39+=String['fromCharCode'](0xff&_0x45a6ca>>(-0x2*_0x266104&0x6)):0x0){_0xf363c3=_0x423c75['indexOf'](_0xf363c3);}for(let _0x4e9937=0x0,_0x1327a4=_0x568d39['length'];_0x4e9937<_0x1327a4;_0x4e9937++){_0x1725c5+='%'+('00'+_0x568d39['charCodeAt'](_0x4e9937)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1725c5);};_0x3f33['JSNaEY']=_0x1ea9b9,_0x3f33['qmIUwU']={},_0x3f33['afIwjq']=!![];}const _0x2c6152=_0x207d1e[0x0],_0x502842=_0x38197d+_0x2c6152,_0x1c6938=_0x3f33['qmIUwU'][_0x502842];return!_0x1c6938?(_0x3f33d5=_0x3f33['JSNaEY'](_0x3f33d5),_0x3f33['qmIUwU'][_0x502842]=_0x3f33d5):_0x3f33d5=_0x1c6938,_0x3f33d5;}export{M as ManufacturerService};
1
+ import{__awaiter as i}from"tslib";import{z as u}from"@hono/zod-openapi";import{HttpException as v}from"../../core/exceptions/http-exception";import{flattenTranslationData as d}from"../../core/utils/zod.util";import{LocalizedManufacturerSchema as f,ManufacturerSchema as o,PaginationMetaSchema as m}from"../../schemas";class M{constructor(e){this.prisma=e}findManufacturer(e,a,t){return i(this,void 0,void 0,function*(){const r=yield this.prisma.manufacturer.findUnique({where:{id:e,organizationId:a,deletedAt:null},include:t?.include});if(!r)throw new v(404,"Manufacturer not found");return r})}createManufacturer(e,a,t){return i(this,void 0,void 0,function*(){const r=yield this.prisma.manufacturer.create({data:{name:t.name,organizationId:e,createdBy:a,logoId:t.logoId,translations:{create:t.translations}},include:{translations:!0,logo:!0}});return o.parse(r)})}getManufacturer(e,a,t){return i(this,void 0,void 0,function*(){const{locale:r}=t,n=yield this.findManufacturer(a,e,{include:{logo:!0,translations:r?{where:{locale:r}}:!0}});return r?f.parse(d(n)):o.parse(n)})}getManufacturers(e,a){return i(this,void 0,void 0,function*(){const{page:t=1,limit:r=10,search:n,locale:s}=a,[c,l]=yield this.prisma.manufacturer.paginate({orderBy:{createdAt:"desc"},where:Object.assign({organizationId:e,deletedAt:null},n&&{name:{contains:n,mode:"insensitive"}}),include:{logo:!0,translations:s?{where:{locale:s}}:!0}}).withPages({page:t,limit:r});if(!s)return u.object({meta:m,list:u.array(o)}).parse({meta:l,list:c});const h=c.map(p=>d(p));return u.object({meta:m,list:u.array(f)}).parse({meta:l,list:h})})}updateManufacturer(e,a,t,r){return i(this,void 0,void 0,function*(){yield this.findManufacturer(a,e);const n=yield this.prisma.manufacturer.update({where:{id:a,organizationId:e,deletedAt:null},data:{updatedBy:t,name:r.name,translations:{deleteMany:{},create:r.translations||[]},logoId:r.logoId},include:{logo:!0,translations:!0}});return o.parse(n)})}deleteManufacturer(e,a,t){return i(this,void 0,void 0,function*(){yield this.findManufacturer(a,e),yield this.prisma.manufacturer.update({where:{id:a,organizationId:e,deletedAt:null},data:{deletedAt:new Date,deletedBy:t}})})}}export{M as ManufacturerService};