@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
- const _0x4a9380=_0x2e39,_0x4d4472=_0x2e39;function _0x2495(){const _0x418c9f=['zw1HAwWGAxm','vxbKyxrLtwu','BNvSBgfIBgu','B2yGDgHLigK','BYb0AguGAw4','C3rYAw5N','ihjLCxvPCMu','Ag8Gy3jLyxq','zsb1C2vYihC','qsb2ywXPzca','zsbTzw1Izxi','Aw52xZeYmW','y2P1mhO5AZq','vxnLCIbKzxq','ihrOzsbPBNy','rw1HAwWGB2y','uM9SzsbPCYa','ndCWmtbeDMndr1a','zsbPBNzPDge','B3DUzxi','zsbVCMDHBMK','y2XMotG3nJu','q3jLyxrLsw4','uM9SzsbHC3m','DxnLCKbLEge','igzVCIb0Agu','DML0yxrPB24','Dgf0Aw9U','tMv3ihjVBgu','yxnZAwDUihq','zsb1C2vY','AxrL','AxrLzcb1C2u','BNzPDgf0Aw8','CIb0BYbPBNy','B3bLBMfWAq','AwDUzwqGDg8','BwjLCLjVBgu','nZKXmdm5n3DJDMzpwq','mtKYmZq2EgTmv1zc','DgLVBG','mtq4mgrmwMr5Aq','ote1ndzWyKfmDwm','ig1LBwjLCG','AxrHDgLVBG','zIb0AguGAw4','sw52AxrHDgK','rxHWAxjHDgK','DgHLig1LBwi','mtqWuwfevfvk','ntq2mZa4EMT3yNzh','B24Gzgf0zsa','zgf0zq','zxiGAw4GDgG','otf4C0HvvfO','CgvUzgLUzW','EJaWmdbSmxe','vxnLCKLUDMK','zgvM','EMf0Aw9U','CMvXDwLYzwq','DxnYxZeYmW','BxbSzs5JB20','zZv6mxOXEJe','B3b0Aw9UywW','uM9SzsbVzIa','B2jQzwn0','ywLSCW','ntiXotfQwNbcsNC','nJa4CLDpuMTK','mZu5mZHWvKPzAw0','BwvTyMvY','mtjZAvrfENK','m0zrs3jHzG','u3rHDhvZig8','DgLVBIbKzxq','suqGB2yGDgG','t3jNyw5PEMe','BwLU','oenRsvDWsq'];_0x2495=function(){return _0x418c9f;};return _0x2495();}(function(_0x4a5a89,_0x449826){const _0x4bfee7=_0x2e39,_0x10916c=_0x2e39,_0x43203b=_0x4a5a89();while(!![]){try{const _0x3df804=parseInt(_0x4bfee7(0x1a8))/0x1*(parseInt(_0x10916c(0x1d0))/0x2)+parseInt(_0x10916c(0x1ca))/0x3*(parseInt(_0x10916c(0x1b3))/0x4)+-parseInt(_0x4bfee7(0x1b2))/0x5*(parseInt(_0x4bfee7(0x1e2))/0x6)+-parseInt(_0x4bfee7(0x1c7))/0x7*(parseInt(_0x10916c(0x1c6))/0x8)+-parseInt(_0x4bfee7(0x1c5))/0x9*(-parseInt(_0x4bfee7(0x1aa))/0xa)+parseInt(_0x4bfee7(0x1a7))/0xb*(-parseInt(_0x10916c(0x1c9))/0xc)+parseInt(_0x4bfee7(0x1b7))/0xd*(parseInt(_0x10916c(0x1ab))/0xe);if(_0x3df804===_0x449826)break;else _0x43203b['push'](_0x43203b['shift']());}catch(_0x3513d0){_0x43203b['push'](_0x43203b['shift']());}}}(_0x2495,0x7580f));import{z as _0x11f2cf}from'@hono/zod-openapi';function _0x2e39(_0x1e856a,_0x1bdec){_0x1e856a=_0x1e856a-0x19a;const _0x24956a=_0x2495();let _0x2e3954=_0x24956a[_0x1e856a];if(_0x2e39['GkHnaR']===undefined){var _0x6d7b24=function(_0x12cbfc){const _0x2392ef='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x11f2cf='',_0x2868af='';for(let _0x55cc2b=0x0,_0x367411,_0x24d27a,_0x1c5ca5=0x0;_0x24d27a=_0x12cbfc['charAt'](_0x1c5ca5++);~_0x24d27a&&(_0x367411=_0x55cc2b%0x4?_0x367411*0x40+_0x24d27a:_0x24d27a,_0x55cc2b++%0x4)?_0x11f2cf+=String['fromCharCode'](0xff&_0x367411>>(-0x2*_0x55cc2b&0x6)):0x0){_0x24d27a=_0x2392ef['indexOf'](_0x24d27a);}for(let _0x5a3309=0x0,_0xc1198a=_0x11f2cf['length'];_0x5a3309<_0xc1198a;_0x5a3309++){_0x2868af+='%'+('00'+_0x11f2cf['charCodeAt'](_0x5a3309)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2868af);};_0x2e39['BYZdRv']=_0x6d7b24,_0x2e39['WCwKqk']={},_0x2e39['GkHnaR']=!![];}const _0x5e4d12=_0x24956a[0x0],_0x531b4b=_0x1e856a+_0x5e4d12,_0x1be4ec=_0x2e39['WCwKqk'][_0x531b4b];return!_0x1be4ec?(_0x2e3954=_0x2e39['BYZdRv'](_0x2e3954),_0x2e39['WCwKqk'][_0x531b4b]=_0x2e3954):_0x2e3954=_0x1be4ec,_0x2e3954;}export const MemberSchema=_0x11f2cf[_0x4a9380(0x1c3)]({'id':_0x11f2cf[_0x4a9380(0x1d6)]()[_0x4a9380(0x1a4)]({'example':_0x4a9380(0x1e6)+'43210abc'+_0x4a9380(0x1bb),'description':_0x4a9380(0x1cd)+_0x4d4472(0x1db)}),'organizationId':_0x11f2cf[_0x4d4472(0x1d6)]()[_0x4a9380(0x1a4)]({'example':_0x4d4472(0x1dd)+_0x4a9380(0x1b9)+_0x4a9380(0x1c0)+'z','description':_0x4d4472(0x1cd)+_0x4d4472(0x1e5)+_0x4d4472(0x1bc)}),'userId':_0x11f2cf['string']()[_0x4d4472(0x1a4)]({'example':_0x4d4472(0x1be),'description':_0x4a9380(0x1cd)+_0x4d4472(0x19f)}),'role':_0x11f2cf[_0x4d4472(0x1d6)]()[_0x4a9380(0x1a4)]({'example':_0x4a9380(0x1e4),'description':_0x4a9380(0x1c2)+_0x4a9380(0x1b1)+_0x4d4472(0x1b6)+_0x4d4472(0x1e5)+_0x4a9380(0x1bc)}),'createdAt':_0x11f2cf[_0x4a9380(0x1b5)](),'user':_0x11f2cf[_0x4a9380(0x1c3)]({'id':_0x11f2cf['string'](),'firstname':_0x11f2cf[_0x4a9380(0x1d6)](),'lastname':_0x11f2cf[_0x4d4472(0x1d6)](),'email':_0x11f2cf[_0x4d4472(0x1d6)](),'image':_0x11f2cf['string']()[_0x4d4472(0x1d3)]()['optional']()})[_0x4a9380(0x1a4)]({'description':_0x4d4472(0x1de)+_0x4a9380(0x1c4)})})[_0x4a9380(0x1a4)]('Member'),InvitationSchema=_0x11f2cf[_0x4d4472(0x1c3)]({'id':_0x11f2cf['string']()['openapi']({'example':_0x4d4472(0x1dc),'description':_0x4d4472(0x1cd)+_0x4a9380(0x1e3)+'tion'}),'organizationId':_0x11f2cf[_0x4d4472(0x1d6)]()[_0x4a9380(0x1a4)]({'example':'cju0z9k4'+_0x4a9380(0x1b9)+_0x4d4472(0x1c0)+'z','description':_0x4d4472(0x1cd)+_0x4d4472(0x1e5)+_0x4d4472(0x1bc)}),'email':_0x11f2cf[_0x4a9380(0x1d6)]()['email']()[_0x4d4472(0x1a4)]({'example':_0x4a9380(0x1e9)+_0x4a9380(0x1bf),'description':'Email\x20of'+'\x20the\x20inv'+_0x4d4472(0x1a1)+'r'}),'role':_0x11f2cf[_0x4a9380(0x1d6)]()[_0x4d4472(0x1d3)]()[_0x4a9380(0x1c1)]()[_0x4d4472(0x1a4)]({'example':'member','description':'Role\x20ass'+_0x4a9380(0x1a5)+_0x4d4472(0x1df)+_0x4d4472(0x1ad)}),'status':_0x11f2cf[_0x4d4472(0x1d6)]()[_0x4a9380(0x1a4)]({'example':_0x4a9380(0x1b8),'description':_0x4d4472(0x1cb)+_0x4a9380(0x1ae)+_0x4d4472(0x19b)}),'expiresAt':_0x11f2cf[_0x4a9380(0x1b5)]()[_0x4d4472(0x1a4)]({'description':'Expirati'+_0x4d4472(0x1b4)+_0x4d4472(0x1d4)+_0x4a9380(0x1a2)+'n'}),'inviterId':_0x11f2cf[_0x4a9380(0x1d6)]()['openapi']({'description':_0x4d4472(0x1cd)+_0x4a9380(0x1d9)+_0x4a9380(0x1d8)+'ed\x20the\x20i'+_0x4d4472(0x1a2)+'n'}),'createdAt':_0x11f2cf[_0x4a9380(0x1b5)]()['optional']()})['openapi'](_0x4d4472(0x1af)+'on'),CreateInvitationSchema=_0x11f2cf[_0x4a9380(0x1c3)]({'email':_0x11f2cf[_0x4a9380(0x1d6)]()['email'](_0x4d4472(0x1da)+_0x4a9380(0x1d1)+_0x4d4472(0x1d7)+'d')['openapi']({'example':_0x4a9380(0x1e9)+'mple.com','description':_0x4a9380(0x1e0)+'\x20the\x20use'+_0x4d4472(0x1a3)+_0x4d4472(0x1a0)}),'role':_0x11f2cf[_0x4a9380(0x1d6)]()['min'](0x1,'Role\x20is\x20'+_0x4a9380(0x1bd))[_0x4d4472(0x1a4)]({'example':_0x4a9380(0x1c8),'description':'Role\x20to\x20'+_0x4a9380(0x19e)+_0x4d4472(0x1d5)+'vited\x20us'+'er'})})[_0x4d4472(0x1a4)](_0x4a9380(0x1e7)+_0x4d4472(0x19b)),UpdateMemberRoleSchema=_0x11f2cf['object']({'role':_0x11f2cf['string']()[_0x4d4472(0x1cf)](0x1,_0x4d4472(0x1e1)+_0x4a9380(0x1bd))[_0x4d4472(0x1a4)]({'example':'admin','description':_0x4d4472(0x19d)+_0x4d4472(0x19a)+_0x4d4472(0x1ac)})})[_0x4a9380(0x1a4)](_0x4a9380(0x1d2)+_0x4d4472(0x1a6)),UserInvitationSchema=_0x11f2cf[_0x4a9380(0x1c3)]({'id':_0x11f2cf[_0x4d4472(0x1d6)]()[_0x4d4472(0x1a4)]({'example':_0x4a9380(0x1dc),'description':_0x4d4472(0x1cd)+_0x4d4472(0x1e3)+_0x4d4472(0x1a9)}),'organizationId':_0x11f2cf['string']()[_0x4d4472(0x1a4)]({'example':_0x4d4472(0x1dd)+_0x4d4472(0x1b9)+_0x4d4472(0x1c0)+'z','description':_0x4a9380(0x1cd)+'e\x20organi'+_0x4d4472(0x1bc)}),'role':_0x11f2cf['string']()[_0x4a9380(0x1d3)]()[_0x4a9380(0x1c1)]()['openapi']({'example':_0x4a9380(0x1c8),'description':_0x4d4472(0x1e8)+_0x4a9380(0x1a5)+_0x4a9380(0x1df)+_0x4a9380(0x1ad)}),'expiresAt':_0x11f2cf[_0x4a9380(0x1b5)]()[_0x4d4472(0x1a4)]({'description':_0x4a9380(0x1b0)+_0x4a9380(0x1b4)+_0x4a9380(0x1d4)+_0x4d4472(0x1a2)+'n'}),'organization':_0x11f2cf[_0x4d4472(0x1c3)]({'id':_0x11f2cf[_0x4a9380(0x1d6)](),'name':_0x11f2cf['string']()})['openapi']({'description':_0x4d4472(0x1ce)+_0x4a9380(0x1cc)+_0x4a9380(0x1c4)})})[_0x4a9380(0x1a4)](_0x4a9380(0x1ba)+_0x4a9380(0x19c));
1
+ import{z as e}from"@hono/zod-openapi";export const MemberSchema=e.object({id:e.string().openapi({example:"clf9876543210abcdef",description:"ID of the member"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),userId:e.string().openapi({example:"usr_123",description:"ID of the user"}),role:e.string().openapi({example:"owner",description:"Role of the member in the organization"}),createdAt:e.date(),user:e.object({id:e.string(),firstname:e.string(),lastname:e.string(),email:e.string(),image:e.string().nullable().optional()}).openapi({description:"User details"})}).openapi("Member"),InvitationSchema=e.object({id:e.string().openapi({example:"inv_123",description:"ID of the invitation"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),email:e.string().email().openapi({example:"user@example.com",description:"Email of the invited user"}),role:e.string().nullable().optional().openapi({example:"member",description:"Role assigned to the invitation"}),status:e.string().openapi({example:"pending",description:"Status of the invitation"}),expiresAt:e.date().openapi({description:"Expiration date of the invitation"}),inviterId:e.string().openapi({description:"ID of the user who created the invitation"}),createdAt:e.date().optional()}).openapi("Invitation"),CreateInvitationSchema=e.object({email:e.string().email("A valid email is required").openapi({example:"user@example.com",description:"Email of the user to invite"}),role:e.string().min(1,"Role is required").openapi({example:"member",description:"Role to assign to the invited user"})}).openapi("CreateInvitation"),UpdateMemberRoleSchema=e.object({role:e.string().min(1,"Role is required").openapi({example:"admin",description:"New role for the member"})}).openapi("UpdateMemberRole"),UserInvitationSchema=e.object({id:e.string().openapi({example:"inv_123",description:"ID of the invitation"}),organizationId:e.string().openapi({example:"cju0z9k4z0000l1qg5z1z1z1z",description:"ID of the organization"}),role:e.string().nullable().optional().openapi({example:"member",description:"Role assigned to the invitation"}),expiresAt:e.date().openapi({description:"Expiration date of the invitation"}),organization:e.object({id:e.string(),name:e.string()}).openapi({description:"Organization details"})}).openapi("UserInvitation");
@@ -1 +1 @@
1
- function _0x5668(_0x504e7f,_0x25d9fc){_0x504e7f=_0x504e7f-0x156;const _0x2f3790=_0x2f37();let _0x566806=_0x2f3790[_0x504e7f];if(_0x5668['QiiVFV']===undefined){var _0xfe4e1c=function(_0x246c7b){const _0x3ce523='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xa606ab='',_0x1ca931='';for(let _0x2f0ab9=0x0,_0x3fcce8,_0x20ea85,_0xb42430=0x0;_0x20ea85=_0x246c7b['charAt'](_0xb42430++);~_0x20ea85&&(_0x3fcce8=_0x2f0ab9%0x4?_0x3fcce8*0x40+_0x20ea85:_0x20ea85,_0x2f0ab9++%0x4)?_0xa606ab+=String['fromCharCode'](0xff&_0x3fcce8>>(-0x2*_0x2f0ab9&0x6)):0x0){_0x20ea85=_0x3ce523['indexOf'](_0x20ea85);}for(let _0x3f581d=0x0,_0x296123=_0xa606ab['length'];_0x3f581d<_0x296123;_0x3f581d++){_0x1ca931+='%'+('00'+_0xa606ab['charCodeAt'](_0x3f581d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1ca931);};_0x5668['myiUlt']=_0xfe4e1c,_0x5668['SNcNsi']={},_0x5668['QiiVFV']=!![];}const _0xb8ff4c=_0x2f3790[0x0],_0x549aa8=_0x504e7f+_0xb8ff4c,_0x114a65=_0x5668['SNcNsi'][_0x549aa8];return!_0x114a65?(_0x566806=_0x5668['myiUlt'](_0x566806),_0x5668['SNcNsi'][_0x549aa8]=_0x566806):_0x566806=_0x114a65,_0x566806;}const _0x437e36=_0x5668,_0x447e45=_0x5668;(function(_0x437270,_0x5d7012){const _0x41660a=_0x5668,_0x521e5a=_0x5668,_0x5550b6=_0x437270();while(!![]){try{const _0x2d027a=parseInt(_0x41660a(0x199))/0x1*(parseInt(_0x41660a(0x156))/0x2)+parseInt(_0x41660a(0x166))/0x3+-parseInt(_0x521e5a(0x19e))/0x4*(-parseInt(_0x41660a(0x161))/0x5)+parseInt(_0x521e5a(0x18e))/0x6*(-parseInt(_0x521e5a(0x16c))/0x7)+-parseInt(_0x41660a(0x16d))/0x8*(parseInt(_0x521e5a(0x1bc))/0x9)+-parseInt(_0x41660a(0x185))/0xa+parseInt(_0x41660a(0x170))/0xb;if(_0x2d027a===_0x5d7012)break;else _0x5550b6['push'](_0x5550b6['shift']());}catch(_0x126233){_0x5550b6['push'](_0x5550b6['shift']());}}}(_0x2f37,0x87a45));import{__awaiter as _0x231a97}from'tslib';function _0x2f37(){const _0x4a04d=['D2L0AfbHz2u','zgLUzYbPBNy','mJmYmJm1m21Jsg15zW','zMLUzfvUAxe','y3jLyxrLsw4','AxzL','B2jQzwn0','zsbHBM90Agu','BMCGDg8GDgG','BwjLCIbVzIa','igzPCNn0lG','zgvZyW','Aw5Zzw5ZAxq','ihrOzsbVCMC','CIbTzw1Izxi','CgfYC2u','DgHLigXHC3q','yxjYyxK','yxrPB25Z','ig93BMvYlIa','sw52AxrHDgK','AxaGzMLYC3q','BwjLCG','mJK1nZeXmfDHBuDpAq','ywXYzwfKEsa','ywnJzxb0zwq','BwjLCLjVBgu','igXVBMDLCIa','zwfKEsbLEgK','zgvSzxrLtwu','D25LCNnOAxa','v01KwvG','ndi1mtm4nhHwBLfLvG','zsbSyxn0ig8','B3DUzxi','lIbqCM9TB3q','CIbPCYbHBhi','C3qGB3DUzxi','C3rHDhvZ','BM90igeGBwu','B3jNyw5PEMe','DgHLig9Yz2e','twvTyMvYig4','mZi2nxzjEgj2yG','jhrYyw5Zywm','t2HcsuC','ww91igfYzsa','z2v0sw52Axq','mtKZmZm5nNfpDxPpqq','BgyGzNjVBsa','DgHPCYbVCMC','zMLUzezPCNm','B3qGzM91BMq','CIbMAxjZDc4','zMLUze1HBNK','DgLVBG','DxnLCG','ww91ignHBM4','vgHPCYb1C2u','ig9MihrOAxm','DML0yxrPB24','B3vUza','z2v0twvTyMu','y3jLyxrL','C3rZigzVCIa','Aw52AxrHDgK','D25LCI4Gvhi','BgvHDMvpCMC','AxmGDxnLCG','yxrPB24','t25SEsbWzw4','ignHBIbIzsa','B24GAgfZigu','ig93BMvYC2G','CM9Szq','B24GBM90igy','BNzPDgf0Aw8','zw1IzxiGB2y','ovvsufjvsW','DgLVBIbHBhi','DgLVBKLK','zgvSzxrL','CgvUzgLUzW','q2fUBM90igW','yw5ZzMvYig8','zw1HAwW','BML6yxrPB24','BwvTyMvY','BM90igjLBg8','ChjPC21H','B24Gzg9LCYa','mJu4tuTMywfM','zsbPBNzPDge','zsb5B3vYC2u','zIb0AguGBge','qw4Gywn0Axy','AwWGywrKCMu','AMznDhu','zw1VDMuGDgG','DxbKyxrL','yw5PEMf0Aw8','EhbPCMvK','nuPHsvPfuW','q2fUBM90ihi','C0PjCuq','B3LorKG','ywnJzxb0sw4','mtu5mZmZnLHXDMzIDG','ihrVig93BMu','y291BNq','DgHPCYbLBwe','zxHWAxjLC0e','ig9Yz2fUAxO','n0TXyLvLDq','nJK1mJqWu3jMAunV'];_0x2f37=function(){return _0x4a04d;};return _0x2f37();}import{z as _0x343a7c}from'@hono/zod-openapi';import{HttpException as _0x14615f}from'../../core/exceptions/http-exception';import{PaginationMetaSchema as _0x152122}from'../../schemas';import{InvitationSchema as _0x2a6586,MemberSchema as _0x2e8890,UserInvitationSchema as _0x15d923}from'./access.schema';class c{constructor(_0xeb6597){const _0x2533bf=_0x5668;this[_0x2533bf(0x1c7)]=_0xeb6597;}[_0x437e36(0x1ac)+'rs'](_0x5c6d62,_0xb8bb82){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x459439=_0x5668,_0x16cf2a=_0x5668,{page:_0x15f74a=0x1,limit:_0x3987ae=0xa,search:_0x2e4634}=_0xb8bb82,[_0x43986a,_0x1c310c]=yield this[_0x459439(0x1c7)][_0x16cf2a(0x1c5)]['paginate']({'orderBy':{'createdAt':'desc'},'where':Object['assign']({'organizationId':_0x5c6d62},_0x2e4634&&{'user':{'OR':[{'firstname':{'contains':_0x2e4634,'mode':_0x16cf2a(0x17a)+_0x459439(0x173)}},{'lastname':{'contains':_0x2e4634,'mode':_0x459439(0x17a)+_0x16cf2a(0x173)}},{'email':{'contains':_0x2e4634,'mode':_0x16cf2a(0x17a)+_0x16cf2a(0x173)}}]}}),'include':{'user':{'select':{'id':!0x0,'firstname':!0x0,'lastname':!0x0,'email':!0x0,'image':!0x0}}}})[_0x16cf2a(0x16e)+'s']({'page':_0x15f74a,'limit':_0x3987ae});return _0x343a7c[_0x16cf2a(0x174)]({'meta':_0x152122,'list':_0x343a7c['array'](_0x2e8890)})[_0x16cf2a(0x17d)]({'meta':_0x1c310c,'list':_0x43986a});});}['getMembe'+'r'](_0x1aabb8,_0x5cfcf4){const _0x5c56bd=_0x437e36,_0x96d0e8={'oyNFH':function(_0x39a9b4,_0x2d1643,_0x5d9720,_0x27e709,_0x4ae94e){return _0x39a9b4(_0x2d1643,_0x5d9720,_0x27e709,_0x4ae94e);}};return _0x96d0e8[_0x5c56bd(0x164)](_0x231a97,this,void 0x0,void 0x0,function*(){const _0x3e47f4=_0x5c56bd,_0x1498fe=_0x5c56bd,_0xeb2d7f=yield this[_0x3e47f4(0x1c7)]['member'][_0x1498fe(0x171)+'ue']({'where':{'id':_0x5cfcf4,'organizationId':_0x1aabb8},'include':{'user':{'select':{'id':!0x0,'firstname':!0x0,'lastname':!0x0,'email':!0x0,'image':!0x0}}}});if(!_0xeb2d7f)throw new _0x14615f(0x194,_0x3e47f4(0x198)+_0x1498fe(0x1a2));return _0x2e8890['parse'](_0xeb2d7f);});}['updateMe'+_0x447e45(0x188)](_0xd3ffa8,_0x29fead,_0x139c2d,_0x54c062){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x6b6681=_0x5668,_0x436670=_0x5668,_0x46aa53=yield this[_0x6b6681(0x1c7)][_0x436670(0x1c5)][_0x6b6681(0x171)+'ue']({'where':{'id':_0x29fead,'organizationId':_0xd3ffa8},'include':{'user':{'select':{'id':!0x0,'firstname':!0x0,'lastname':!0x0,'email':!0x0,'image':!0x0}}}});if(!_0x46aa53)throw new _0x14615f(0x194,_0x6b6681(0x198)+'ot\x20found');if(_0x46aa53[_0x6b6681(0x1b8)]===_0x436670(0x190)&&_0x54c062['role']!==_0x6b6681(0x190)&&(yield this[_0x436670(0x1c7)][_0x436670(0x1c5)]['count']({'where':{'organizationId':_0xd3ffa8,'role':'owner'}}))<=0x1)throw new _0x14615f(0x190,'Cannot\x20c'+'hange\x20th'+'e\x20role\x20o'+_0x6b6681(0x159)+_0x436670(0x193)+_0x6b6681(0x191)+_0x436670(0x175)+_0x436670(0x17c)+_0x6b6681(0x167)+_0x436670(0x1a3));const _0x5df4b7=yield this[_0x436670(0x1c7)][_0x436670(0x1c5)][_0x436670(0x15e)]({'where':{'id':_0x29fead,'organizationId':_0xd3ffa8},'data':{'role':_0x54c062[_0x436670(0x1b8)]},'include':{'user':{'select':{'id':!0x0,'firstname':!0x0,'lastname':!0x0,'email':!0x0,'image':!0x0}}}});return _0x2e8890[_0x436670(0x17d)](_0x5df4b7);});}[_0x447e45(0x18b)+_0x437e36(0x184)](_0x512bed,_0xe4142a,_0x54de8f){const _0x44ccee=_0x437e36,_0x1592f7=_0x437e36,_0x474de3={'WMdYX':_0x44ccee(0x162)+_0x44ccee(0x15d)+_0x44ccee(0x18f)+_0x1592f7(0x1b0)+_0x44ccee(0x1c2)+_0x1592f7(0x18c)+_0x44ccee(0x178)};return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x17269e=_0x44ccee,_0x1fbb58=_0x44ccee,_0x311a85=yield this[_0x17269e(0x1c7)][_0x1fbb58(0x1c5)][_0x1fbb58(0x171)+'ue']({'where':{'id':_0xe4142a,'organizationId':_0x512bed}});if(!_0x311a85)throw new _0x14615f(0x194,_0x17269e(0x198)+_0x17269e(0x1a2));if(_0x311a85['userId']===_0x54de8f)throw new _0x14615f(0x190,_0x17269e(0x1a7)+'ot\x20remov'+_0x17269e(0x158)+_0x1fbb58(0x19f)+_0x1fbb58(0x197)+_0x1fbb58(0x1c4));if(_0x311a85[_0x1fbb58(0x1b8)]===_0x1fbb58(0x190)&&(yield this[_0x1fbb58(0x1c7)]['member'][_0x17269e(0x168)]({'where':{'organizationId':_0x512bed,'role':_0x17269e(0x190)}}))<=0x1)throw new _0x14615f(0x190,_0x474de3[_0x17269e(0x18d)]);yield this[_0x17269e(0x1c7)]['member'][_0x1fbb58(0x1bf)]({'where':{'id':_0xe4142a,'organizationId':_0x512bed}});});}[_0x447e45(0x1b1)+_0x447e45(0x15f)+'n'](_0x4f2328,_0xf94900){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x25177e=_0x5668,_0x1b5213=_0x5668,_0x10e7f0=yield this['prisma'][_0x25177e(0x1c5)][_0x25177e(0x1a1)+'t']({'where':{'organizationId':_0x4f2328,'userId':_0xf94900}});if(!_0x10e7f0)throw new _0x14615f(0x194,_0x25177e(0x19c)+_0x25177e(0x195)+_0x25177e(0x177)+_0x1b5213(0x1a0)+_0x1b5213(0x15f)+'n');if(_0x10e7f0[_0x25177e(0x1b8)]===_0x25177e(0x190)&&(yield this[_0x25177e(0x1c7)]['member'][_0x25177e(0x168)]({'where':{'organizationId':_0x4f2328,'role':_0x1b5213(0x190)}}))<=0x1)throw new _0x14615f(0x190,_0x25177e(0x1c1)+'eave\x20as\x20'+_0x1b5213(0x17e)+_0x1b5213(0x181)+'Transfer'+_0x1b5213(0x1b7)+_0x1b5213(0x183)+'.');yield this[_0x1b5213(0x1c7)][_0x1b5213(0x1c5)]['delete']({'where':{'id':_0x10e7f0['id'],'organizationId':_0x4f2328}});});}[_0x437e36(0x172)+'vitation'](_0x23c1f8,_0x3f3ce7,_0x3bdce5){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x58222d=_0x5668,_0x33f520=_0x5668;if(yield this['prisma'][_0x58222d(0x1af)+'on'][_0x33f520(0x1a1)+'t']({'where':{'organizationId':_0x23c1f8,'email':_0x3bdce5['email'],'status':_0x58222d(0x1c0),'expiresAt':{'gt':new Date()}}}))throw new _0x14615f(0x190,_0x33f520(0x15a)+_0x58222d(0x157)+_0x33f520(0x1bd)+_0x58222d(0x18a)+_0x33f520(0x1ae)+_0x58222d(0x169)+_0x33f520(0x15b)+'ss');if(yield this[_0x58222d(0x1c7)][_0x33f520(0x1c5)][_0x58222d(0x1a1)+'t']({'where':{'organizationId':_0x23c1f8,'user':{'email':_0x3bdce5[_0x33f520(0x1c3)]}}}))throw new _0x14615f(0x190,_0x58222d(0x1a8)+_0x33f520(0x192)+'eady\x20a\x20m'+_0x33f520(0x1bb)+_0x33f520(0x17b)+_0x58222d(0x15f)+'n');const _0x4c994f=yield this[_0x33f520(0x1c7)][_0x33f520(0x1af)+'on'][_0x33f520(0x1ad)]({'data':{'id':crypto['randomUU'+'ID'](),'organizationId':_0x23c1f8,'email':_0x3bdce5[_0x33f520(0x1c3)],'role':_0x3bdce5[_0x58222d(0x1b8)],'status':'pending','inviterId':_0x3f3ce7,'expiresAt':new Date(Date['now']()+0x2760*0x3c*0x3e8)}});return _0x2a6586[_0x33f520(0x17d)](_0x4c994f);});}[_0x437e36(0x19d)+_0x447e45(0x180)](_0x16fa6b){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x278d81=_0x5668,_0x3039e1=_0x5668,_0x5703e0=yield this[_0x278d81(0x1c7)]['invitati'+'on'][_0x3039e1(0x1a4)]({'where':{'organizationId':_0x16fa6b,'status':_0x278d81(0x1c0)},'orderBy':{'expiresAt':_0x278d81(0x179)}});return _0x343a7c[_0x3039e1(0x17f)](_0x2a6586)['parse'](_0x5703e0);});}['deleteIn'+_0x437e36(0x1aa)](_0x2a60d1,_0x4c17b9){const _0x45a6d0={'OhBIG':function(_0x42f4aa,_0x56fb46){return _0x42f4aa!==_0x56fb46;}};return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x4c460c=_0x5668,_0x4913e1=_0x5668,_0x5c94ec=yield this[_0x4c460c(0x1c7)]['invitati'+'on']['findUniq'+'ue']({'where':{'id':_0x4c17b9,'organizationId':_0x2a60d1}});if(!_0x5c94ec)throw new _0x14615f(0x194,_0x4c460c(0x182)+_0x4913e1(0x1b9)+'ound');if(_0x45a6d0[_0x4c460c(0x19b)](_0x5c94ec[_0x4c460c(0x194)],_0x4913e1(0x1c0)))throw new _0x14615f(0x190,_0x4913e1(0x1b4)+_0x4913e1(0x16f)+'itations'+_0x4913e1(0x1b5)+'revoked');yield this[_0x4913e1(0x1c7)][_0x4913e1(0x1af)+'on'][_0x4c460c(0x1bf)]({'where':{'id':_0x4c17b9}});});}['getUserI'+_0x437e36(0x1ba)+'ns'](_0x23b5fe){return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x3f1fd0=_0x5668,_0x56e46f=_0x5668,_0x4403d6=yield this['prisma'][_0x3f1fd0(0x1af)+'on']['findMany']({'where':{'email':_0x23b5fe,'status':_0x3f1fd0(0x1c0),'expiresAt':{'gt':new Date()}},'include':{'organization':{'select':{'id':!0x0,'name':!0x0}}},'orderBy':{'expiresAt':_0x3f1fd0(0x179)}});return _0x343a7c[_0x3f1fd0(0x17f)](_0x15d923)[_0x3f1fd0(0x17d)](_0x4403d6);});}[_0x447e45(0x165)+_0x447e45(0x1aa)](_0x10da49,_0x482b3b){const _0x379654=_0x447e45,_0x115134=_0x447e45,_0xb60460={'kTyuH':_0x379654(0x182)+'on\x20is\x20no'+_0x379654(0x189)+'pending','jfMtu':_0x379654(0x182)+_0x379654(0x1b6)+_0x379654(0x160),'sJIqD':_0x115134(0x182)+_0x379654(0x1c8)+_0x379654(0x1c6)+_0x115134(0x176)+_0x115134(0x1b2)};return _0x231a97(this,void 0x0,void 0x0,function*(){const _0x538df7=_0x115134,_0x14106f=_0x115134;var _0x5f58cc;const _0xc05bfa=yield this['prisma'][_0x538df7(0x1af)+'on'][_0x538df7(0x171)+'ue']({'where':{'id':_0x10da49}});if(!_0xc05bfa)throw new _0x14615f(0x194,_0x14106f(0x182)+_0x14106f(0x1b9)+_0x538df7(0x1ab));if(_0xc05bfa[_0x538df7(0x194)]!==_0x14106f(0x1c0))throw new _0x14615f(0x190,_0xb60460['kTyuH']);if(_0xc05bfa[_0x538df7(0x16a)+'t']<new Date())throw new _0x14615f(0x190,_0xb60460[_0x14106f(0x15c)]);const _0x366212=yield this[_0x538df7(0x1c7)][_0x14106f(0x1a6)][_0x538df7(0x171)+'ue']({'where':{'id':_0x482b3b}});if(!_0x366212||_0x366212['email']!==_0xc05bfa[_0x14106f(0x1c3)])throw new _0x14615f(0x190,_0xb60460[_0x538df7(0x163)]);if(yield this[_0x14106f(0x1c7)][_0x538df7(0x1c5)]['findFirs'+'t']({'where':{'organizationId':_0xc05bfa[_0x538df7(0x196)+_0x14106f(0x1be)],'userId':_0x482b3b}}))throw new _0x14615f(0x190,_0x14106f(0x19c)+_0x538df7(0x186)+'a\x20member'+_0x538df7(0x1a9)+_0x538df7(0x16b)+_0x538df7(0x1b3));const [_0x2b4ab0]=yield this[_0x14106f(0x1c7)][_0x538df7(0x19a)+_0x538df7(0x1a5)]([this['prisma'][_0x538df7(0x1c5)][_0x538df7(0x1ad)]({'data':{'organizationId':_0xc05bfa[_0x14106f(0x196)+_0x538df7(0x1be)],'userId':_0x482b3b,'role':(_0x5f58cc=_0xc05bfa[_0x538df7(0x1b8)])!==null&&_0x5f58cc!==void 0x0?_0x5f58cc:_0x538df7(0x1c5)},'include':{'user':{'select':{'id':!0x0,'firstname':!0x0,'lastname':!0x0,'email':!0x0,'image':!0x0}}}}),this[_0x538df7(0x1c7)]['invitati'+'on'][_0x14106f(0x15e)]({'where':{'id':_0x10da49},'data':{'status':_0x538df7(0x187)}})]);return _0x2e8890['parse'](_0x2b4ab0);});}}export{c as AccessService};
1
+ import{__awaiter as o}from"tslib";import{z as d}from"@hono/zod-openapi";import{HttpException as n}from"../../core/exceptions/http-exception";import{PaginationMetaSchema as l}from"../../schemas";import{InvitationSchema as h,MemberSchema as u,UserInvitationSchema as w}from"./access.schema";class c{constructor(e){this.prisma=e}getMembers(e,i){return o(this,void 0,void 0,function*(){const{page:t=1,limit:r=10,search:s}=i,[a,m]=yield this.prisma.member.paginate({orderBy:{createdAt:"desc"},where:Object.assign({organizationId:e},s&&{user:{OR:[{firstname:{contains:s,mode:"insensitive"}},{lastname:{contains:s,mode:"insensitive"}},{email:{contains:s,mode:"insensitive"}}]}}),include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}}).withPages({page:t,limit:r});return d.object({meta:l,list:d.array(u)}).parse({meta:m,list:a})})}getMember(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.member.findUnique({where:{id:i,organizationId:e},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});if(!t)throw new n(404,"Member not found");return u.parse(t)})}updateMemberRole(e,i,t,r){return o(this,void 0,void 0,function*(){const s=yield this.prisma.member.findUnique({where:{id:i,organizationId:e},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});if(!s)throw new n(404,"Member not found");if(s.role==="owner"&&r.role!=="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot change the role of the last owner. Promote another member to owner first.");const a=yield this.prisma.member.update({where:{id:i,organizationId:e},data:{role:r.role},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}});return u.parse(a)})}deleteMember(e,i,t){return o(this,void 0,void 0,function*(){const r=yield this.prisma.member.findUnique({where:{id:i,organizationId:e}});if(!r)throw new n(404,"Member not found");if(r.userId===t)throw new n(400,"You cannot remove yourself from the organization");if(r.role==="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot remove the last owner. Transfer ownership first.");yield this.prisma.member.delete({where:{id:i,organizationId:e}})})}leaveOrganization(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.member.findFirst({where:{organizationId:e,userId:i}});if(!t)throw new n(404,"You are not a member of this organization");if(t.role==="owner"&&(yield this.prisma.member.count({where:{organizationId:e,role:"owner"}}))<=1)throw new n(400,"Cannot leave as the last owner. Transfer ownership first.");yield this.prisma.member.delete({where:{id:t.id,organizationId:e}})})}createInvitation(e,i,t){return o(this,void 0,void 0,function*(){if(yield this.prisma.invitation.findFirst({where:{organizationId:e,email:t.email,status:"pending",expiresAt:{gt:new Date}}}))throw new n(400,"An active invitation already exists for this email address");if(yield this.prisma.member.findFirst({where:{organizationId:e,user:{email:t.email}}}))throw new n(400,"This user is already a member of the organization");const a=yield this.prisma.invitation.create({data:{id:crypto.randomUUID(),organizationId:e,email:t.email,role:t.role,status:"pending",inviterId:i,expiresAt:new Date(Date.now()+10080*60*1e3)}});return h.parse(a)})}getInvitations(e){return o(this,void 0,void 0,function*(){const i=yield this.prisma.invitation.findMany({where:{organizationId:e,status:"pending"},orderBy:{expiresAt:"desc"}});return d.array(h).parse(i)})}deleteInvitation(e,i){return o(this,void 0,void 0,function*(){const t=yield this.prisma.invitation.findUnique({where:{id:i,organizationId:e}});if(!t)throw new n(404,"Invitation not found");if(t.status!=="pending")throw new n(400,"Only pending invitations can be revoked");yield this.prisma.invitation.delete({where:{id:i}})})}getUserInvitations(e){return o(this,void 0,void 0,function*(){const i=yield this.prisma.invitation.findMany({where:{email:e,status:"pending",expiresAt:{gt:new Date}},include:{organization:{select:{id:!0,name:!0}}},orderBy:{expiresAt:"desc"}});return d.array(w).parse(i)})}acceptInvitation(e,i){return o(this,void 0,void 0,function*(){var t;const r=yield this.prisma.invitation.findUnique({where:{id:e}});if(!r)throw new n(404,"Invitation not found");if(r.status!=="pending")throw new n(400,"Invitation is no longer pending");if(r.expiresAt<new Date)throw new n(400,"Invitation has expired");const s=yield this.prisma.user.findUnique({where:{id:i}});if(!s||s.email!==r.email)throw new n(400,"Invitation does not belong to this user");if(yield this.prisma.member.findFirst({where:{organizationId:r.organizationId,userId:i}}))throw new n(400,"You are already a member of this organization");const[m]=yield this.prisma.$transaction([this.prisma.member.create({data:{organizationId:r.organizationId,userId:i,role:(t=r.role)!==null&&t!==void 0?t:"member"},include:{user:{select:{id:!0,firstname:!0,lastname:!0,email:!0,image:!0}}}}),this.prisma.invitation.update({where:{id:e},data:{status:"accepted"}})]);return u.parse(m)})}}export{c as AccessService};
@@ -1 +1 @@
1
- (function(_0x202864,_0x4b37b8){const _0x16a6c0=_0x3fd7,_0x591732=_0x3fd7,_0x19f83a=_0x202864();while(!![]){try{const _0x1a675f=-parseInt(_0x16a6c0(0x84))/0x1+-parseInt(_0x591732(0x7e))/0x2*(-parseInt(_0x16a6c0(0x89))/0x3)+parseInt(_0x16a6c0(0x7f))/0x4*(-parseInt(_0x16a6c0(0x81))/0x5)+parseInt(_0x16a6c0(0x86))/0x6+-parseInt(_0x16a6c0(0x8b))/0x7+-parseInt(_0x591732(0x8a))/0x8*(-parseInt(_0x16a6c0(0x83))/0x9)+-parseInt(_0x16a6c0(0x88))/0xa;if(_0x1a675f===_0x4b37b8)break;else _0x19f83a['push'](_0x19f83a['shift']());}catch(_0x4f2bd8){_0x19f83a['push'](_0x19f83a['shift']());}}}(_0x4703,0xd8f1a));import{__awaiter as _0x3367b4}from'tslib';import{createApiRouter as _0x1617db}from'../../core/hono/hono';import{analyticsRoute as _0x410320}from'./analytics.route';function _0x4703(){const _0x423685=['Awv3','ANnVBG','yxv0Aa','AxnhCMfUDgu','CMvHza','CxvLCNK','mtqXmduZmMPvCLr1ua','mtG5ndC0ngHLy1vIAa','z2v0','nujJzxfXCq','DMfSAwq','ndy3mZqZy1nAquXt','mta2mZK2mvnAzfjXrG','CgfYyw0','oti5mJi0ofnACwXAvq','z2v0t3zLCNy','odiYmty3mejQvxLRqW','m3nes0nhtW','mJaWu1fbD01v','mJeYnJeZmuHYqxboua','CMvX','B3jNyw5PEMe'];_0x4703=function(){return _0x423685;};return _0x4703();}function _0x3fd7(_0x290788,_0x336c29){_0x290788=_0x290788-0x7a;const _0x470349=_0x4703();let _0x3fd766=_0x470349[_0x290788];if(_0x3fd7['wJQpDm']===undefined){var _0x523b4a=function(_0x57330f){const _0x4a2636='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x44e77a='',_0x33fcc3='';for(let _0x2178f3=0x0,_0x1ca71b,_0x592348,_0xdb2d8a=0x0;_0x592348=_0x57330f['charAt'](_0xdb2d8a++);~_0x592348&&(_0x1ca71b=_0x2178f3%0x4?_0x1ca71b*0x40+_0x592348:_0x592348,_0x2178f3++%0x4)?_0x44e77a+=String['fromCharCode'](0xff&_0x1ca71b>>(-0x2*_0x2178f3&0x6)):0x0){_0x592348=_0x4a2636['indexOf'](_0x592348);}for(let _0x382025=0x0,_0x4ed17f=_0x44e77a['length'];_0x382025<_0x4ed17f;_0x382025++){_0x33fcc3+='%'+('00'+_0x44e77a['charCodeAt'](_0x382025)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x33fcc3);};_0x3fd7['rVlOgT']=_0x523b4a,_0x3fd7['LgdKEd']={},_0x3fd7['wJQpDm']=!![];}const _0x396036=_0x470349[0x0],_0x1dd3b8=_0x290788+_0x396036,_0x4039b2=_0x3fd7['LgdKEd'][_0x1dd3b8];return!_0x4039b2?(_0x3fd766=_0x3fd7['rVlOgT'](_0x3fd766),_0x3fd7['LgdKEd'][_0x1dd3b8]=_0x3fd766):_0x3fd766=_0x4039b2,_0x3fd766;}export const registerAnalyticsHandlers=_0x9fbeb9=>{const _0x5e627b=_0x3fd7,_0x34ec44=_0x1617db();return _0x34ec44['openapi'](_0x410320[_0x5e627b(0x87)+'iew'],_0xbfab61=>_0x3367b4(void 0x0,void 0x0,void 0x0,function*(){const _0x573f5e=_0x5e627b,_0x3aa357=_0x5e627b,_0x110d07=_0xbfab61[_0x573f5e(0x80)](_0x3aa357(0x7a)),_0x1d9e33=_0xbfab61[_0x3aa357(0x8c)][_0x3aa357(0x82)](_0x3aa357(0x85)),_0x15dddf=_0xbfab61[_0x3aa357(0x8c)][_0x3aa357(0x82)](_0x573f5e(0x7d));yield _0x110d07[_0x573f5e(0x7b)+'d'](_0x3aa357(0x7c));const _0x5c4ce2=yield _0x9fbeb9[_0x573f5e(0x87)+_0x3aa357(0x8e)](_0x1d9e33[_0x3aa357(0x8d)+'tionId'],_0x15dddf);return _0xbfab61[_0x3aa357(0x8f)](_0x5c4ce2,0xc8);})),_0x34ec44;};
1
+ import{__awaiter as s}from"tslib";import{createApiRouter as d}from"../../core/hono/hono";import{analyticsRoute as p}from"./analytics.route";export const registerAnalyticsHandlers=t=>{const e=d();return e.openapi(p.getOverview,r=>s(void 0,void 0,void 0,function*(){const o=r.get("auth"),i=r.req.valid("param"),a=r.req.valid("query");yield o.isGranted("read");const n=yield t.getOverview(i.organizationId,a);return r.json(n,200)})),e};
@@ -1 +1 @@
1
- const _0x391105=_0x1a1d,_0x789f71=_0x1a1d;(function(_0x1b77e1,_0xe51b6a){const _0x2b69a1=_0x1a1d,_0x3ae917=_0x1a1d,_0x219488=_0x1b77e1();while(!![]){try{const _0x108008=parseInt(_0x2b69a1(0x1f4))/0x1*(-parseInt(_0x3ae917(0x1e9))/0x2)+parseInt(_0x2b69a1(0x1eb))/0x3*(-parseInt(_0x2b69a1(0x1e8))/0x4)+parseInt(_0x3ae917(0x200))/0x5*(-parseInt(_0x3ae917(0x1f3))/0x6)+parseInt(_0x2b69a1(0x1f9))/0x7*(-parseInt(_0x2b69a1(0x1f6))/0x8)+parseInt(_0x2b69a1(0x1f8))/0x9+parseInt(_0x3ae917(0x1f5))/0xa*(-parseInt(_0x3ae917(0x1e7))/0xb)+parseInt(_0x2b69a1(0x1fc))/0xc*(parseInt(_0x3ae917(0x1ed))/0xd);if(_0x108008===_0xe51b6a)break;else _0x219488['push'](_0x219488['shift']());}catch(_0x2d0a22){_0x219488['push'](_0x219488['shift']());}}}(_0x16ec,0x61f45));function _0x16ec(){const _0x1f0c05=['mtfly09dCxC','otqZnLfbtKTcCa','mZqXoe5szeD6AG','l2fUywX5DgK','mtq0uxLgAKHV','AwnZigzVCIa','mtnhEg5kuhO','r2v0iefUywW','uMv0DxjUCYa','igrHDguGCMe','DMLLDW','ExrPy3mGt3y','mZmWuM9Pu010','mZyXB291Bg1y','ndq5mtKXmgjYsgXdEG','mZGZnZKYEMDvr0LV','D2L0AgLUige','mJuZmZq1nwLtufnlwa','n1z4C1j3uW','Awv3','qw5HBhL0Awm','mJe0mZm2ndrstwzHBxC','zcbHBMfSExq','r0vu','DgLJC092zxi','mZK5mtvxsfrJA0i','z2v0qw5HBhK','AxPHDgLVBIa','zgfZAgjVyxi'];_0x16ec=function(){return _0x1f0c05;};return _0x16ec();}function _0x1a1d(_0x1529ea,_0x3c2734){_0x1529ea=_0x1529ea-0x1e4;const _0x16ecb6=_0x16ec();let _0x1a1d0c=_0x16ecb6[_0x1529ea];if(_0x1a1d['boZtRD']===undefined){var _0x187d2a=function(_0xf526bf){const _0x875c8a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1498d9='',_0x30c18a='';for(let _0x2bfb09=0x0,_0x326791,_0x9144c2,_0x9abfd2=0x0;_0x9144c2=_0xf526bf['charAt'](_0x9abfd2++);~_0x9144c2&&(_0x326791=_0x2bfb09%0x4?_0x326791*0x40+_0x9144c2:_0x9144c2,_0x2bfb09++%0x4)?_0x1498d9+=String['fromCharCode'](0xff&_0x326791>>(-0x2*_0x2bfb09&0x6)):0x0){_0x9144c2=_0x875c8a['indexOf'](_0x9144c2);}for(let _0x1fecc7=0x0,_0xb07f1e=_0x1498d9['length'];_0x1fecc7<_0xb07f1e;_0x1fecc7++){_0x30c18a+='%'+('00'+_0x1498d9['charCodeAt'](_0x1fecc7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x30c18a);};_0x1a1d['RTvkUg']=_0x187d2a,_0x1a1d['LplCJK']={},_0x1a1d['boZtRD']=!![];}const _0x581c20=_0x16ecb6[0x0],_0x3b2c9a=_0x1529ea+_0x581c20,_0x5a3832=_0x1a1d['LplCJK'][_0x3b2c9a];return!_0x5a3832?(_0x1a1d0c=_0x1a1d['RTvkUg'](_0x1a1d0c),_0x1a1d['LplCJK'][_0x3b2c9a]=_0x1a1d0c):_0x1a1d0c=_0x5a3832,_0x1a1d0c;}import{createApiRoute as _0x1498d9}from'../../core/hono/hono';import{ErrorSchema as _0x30c18a,HeaderSchema as _0x2bfb09,OrganizationParams as _0x326791}from'../../schemas';import{AnalyticsOverviewQuerySchema as _0x9144c2,AnalyticsOverviewSchema as _0x9abfd2}from'./analytics.schema';const n=_0x1498d9({'description':_0x391105(0x1ef)+_0x391105(0x1e6)+_0x789f71(0x1fd)+_0x789f71(0x1ec)+'an\x20organ'+_0x391105(0x1e5)+_0x391105(0x1f7)+_0x391105(0x1f0)+'nge.','headers':_0x2bfb09,'method':_0x391105(0x1fe),'operationId':_0x789f71(0x1e4)+_0x789f71(0x1ff)+_0x789f71(0x1f1),'path':'/:organi'+'zationId'+_0x391105(0x1ea)+'cs/overv'+_0x391105(0x1fa),'pathParams':_0x326791,'query':_0x9144c2,'responses':{0xc8:_0x9abfd2,0x190:_0x30c18a,0x191:_0x30c18a,0x194:_0x30c18a},'summary':_0x391105(0x1ee)+_0x789f71(0x1f2)+'erview','tags':[_0x789f71(0x1fb)+'s']});export const analyticsRoute={'getOverview':n};
1
+ import{createApiRoute as a}from"../../core/hono/hono";import{ErrorSchema as e,HeaderSchema as r,OrganizationParams as t}from"../../schemas";import{AnalyticsOverviewQuerySchema as i,AnalyticsOverviewSchema as o}from"./analytics.schema";const n=a({description:"Returns dashboard analytics for an organization within a date range.",headers:r,method:"GET",operationId:"getAnalyticsOverview",path:"/:organizationId/analytics/overview",pathParams:t,query:i,responses:{200:o,400:e,401:e,404:e},summary:"Get Analytics Overview",tags:["Analytics"]});export const analyticsRoute={getOverview:n};
@@ -1 +1 @@
1
- function _0x5355(_0x36227e,_0x4096a0){_0x36227e=_0x36227e-0x18a;const _0x3a1b2e=_0x3a1b();let _0x53556b=_0x3a1b2e[_0x36227e];if(_0x5355['qTrFQi']===undefined){var _0x28383c=function(_0x5e75c6){const _0x416984='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x23df0b='',_0x52f8fd='';for(let _0x1406fd=0x0,_0x55deb2,_0x14998b,_0x1f2644=0x0;_0x14998b=_0x5e75c6['charAt'](_0x1f2644++);~_0x14998b&&(_0x55deb2=_0x1406fd%0x4?_0x55deb2*0x40+_0x14998b:_0x14998b,_0x1406fd++%0x4)?_0x23df0b+=String['fromCharCode'](0xff&_0x55deb2>>(-0x2*_0x1406fd&0x6)):0x0){_0x14998b=_0x416984['indexOf'](_0x14998b);}for(let _0x5e5995=0x0,_0x5b9abe=_0x23df0b['length'];_0x5e5995<_0x5b9abe;_0x5e5995++){_0x52f8fd+='%'+('00'+_0x23df0b['charCodeAt'](_0x5e5995)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x52f8fd);};_0x5355['HMSbly']=_0x28383c,_0x5355['aJxXcY']={},_0x5355['qTrFQi']=!![];}const _0x31fb70=_0x3a1b2e[0x0],_0x4625ed=_0x36227e+_0x31fb70,_0x2307cf=_0x5355['aJxXcY'][_0x4625ed];return!_0x2307cf?(_0x53556b=_0x5355['HMSbly'](_0x53556b),_0x5355['aJxXcY'][_0x4625ed]=_0x53556b):_0x53556b=_0x2307cf,_0x53556b;}const _0x5ad462=_0x5355,_0x1eb1c1=_0x5355;(function(_0x146c69,_0xbf64c7){const _0x25d47f=_0x5355,_0x3d2d0a=_0x5355,_0x1a5d90=_0x146c69();while(!![]){try{const _0x315c5f=-parseInt(_0x25d47f(0x1b1))/0x1*(parseInt(_0x3d2d0a(0x196))/0x2)+-parseInt(_0x25d47f(0x1ac))/0x3*(parseInt(_0x25d47f(0x1a7))/0x4)+-parseInt(_0x25d47f(0x19c))/0x5*(-parseInt(_0x25d47f(0x1bb))/0x6)+parseInt(_0x3d2d0a(0x1a6))/0x7+-parseInt(_0x3d2d0a(0x19d))/0x8+-parseInt(_0x25d47f(0x1b6))/0x9+parseInt(_0x3d2d0a(0x1b7))/0xa*(parseInt(_0x25d47f(0x1a1))/0xb);if(_0x315c5f===_0xbf64c7)break;else _0x1a5d90['push'](_0x1a5d90['shift']());}catch(_0x18a6dc){_0x1a5d90['push'](_0x1a5d90['shift']());}}}(_0x3a1b,0xde41a));import{z as _0x23df0b}from'@hono/zod-openapi';import{currency as _0x52f8fd}from'../../schemas/currency.schema';import{fulfilmentMethod as _0x1406fd}from'../order/fulfilment.schema';const a=_0x23df0b['enum']([_0x5ad462(0x195),_0x1eb1c1(0x1bc),_0x1eb1c1(0x18f),'bank_tra'+_0x5ad462(0x1a9),_0x5ad462(0x1a4)+'delivery'])[_0x1eb1c1(0x19a)]({'description':_0x5ad462(0x19f)+_0x1eb1c1(0x1b8)+_0x1eb1c1(0x193)+_0x5ad462(0x1b5)+_0x1eb1c1(0x192),'example':_0x1eb1c1(0x195)});export const AnalyticsOverviewQuerySchema=_0x23df0b[_0x1eb1c1(0x1b9)]({'from':_0x23df0b[_0x5ad462(0x1ad)][_0x1eb1c1(0x18a)]()[_0x1eb1c1(0x19a)]({'description':_0x5ad462(0x1b2)+'\x20the\x20rep'+_0x1eb1c1(0x19b)+'ange','example':_0x5ad462(0x1ba)+_0x5ad462(0x199)+_0x5ad462(0x18d)}),'to':_0x23df0b[_0x1eb1c1(0x1ad)][_0x5ad462(0x18a)]()[_0x5ad462(0x19a)]({'description':_0x5ad462(0x18e)+_0x5ad462(0x190)+_0x5ad462(0x1b0)+'ge','example':_0x1eb1c1(0x1ba)+_0x1eb1c1(0x1a0)+_0x5ad462(0x1b3)})});const r=_0x23df0b[_0x1eb1c1(0x1b9)]({'from':_0x23df0b[_0x5ad462(0x18a)](),'to':_0x23df0b['date']()})[_0x5ad462(0x19a)]('Analytic'+_0x1eb1c1(0x18c)),o=_0x23df0b[_0x1eb1c1(0x1b9)]({'currency':_0x52f8fd,'totalSales':_0x23df0b[_0x1eb1c1(0x18b)]()[_0x1eb1c1(0x1a8)](0x0),'paidOrders':_0x23df0b[_0x5ad462(0x18b)]()[_0x1eb1c1(0x198)]()[_0x1eb1c1(0x1a8)](0x0),'averageOrderValue':_0x23df0b[_0x5ad462(0x18b)]()[_0x1eb1c1(0x1a8)](0x0),'reservations':_0x23df0b['number']()[_0x1eb1c1(0x198)]()[_0x1eb1c1(0x1a8)](0x0),'guests':_0x23df0b[_0x5ad462(0x18b)]()[_0x1eb1c1(0x198)]()[_0x5ad462(0x1a8)](0x0)})[_0x5ad462(0x19a)](_0x1eb1c1(0x19e)+_0x5ad462(0x1b4)),i=_0x23df0b[_0x5ad462(0x1b9)]({'date':_0x23df0b['date'](),'label':_0x23df0b[_0x1eb1c1(0x1af)](),'totalSales':_0x23df0b[_0x1eb1c1(0x18b)]()[_0x5ad462(0x1a8)](0x0),'paidOrders':_0x23df0b[_0x1eb1c1(0x18b)]()['int']()[_0x5ad462(0x1a8)](0x0)})[_0x1eb1c1(0x19a)](_0x1eb1c1(0x1bd)+_0x1eb1c1(0x1ab)),m=_0x23df0b[_0x5ad462(0x1b9)]({'date':_0x23df0b[_0x5ad462(0x18a)](),'label':_0x23df0b[_0x1eb1c1(0x1af)](),'reservations':_0x23df0b['number']()[_0x1eb1c1(0x198)]()[_0x5ad462(0x1a8)](0x0),'guests':_0x23df0b[_0x1eb1c1(0x18b)]()[_0x5ad462(0x198)]()[_0x1eb1c1(0x1a8)](0x0)})[_0x1eb1c1(0x19a)]('Reservat'+'ionsByDa'+_0x5ad462(0x197)),s=_0x23df0b['object']({'method':a,'count':_0x23df0b[_0x1eb1c1(0x18b)]()[_0x5ad462(0x198)]()[_0x5ad462(0x1a8)](0x0),'totalSales':_0x23df0b[_0x1eb1c1(0x18b)]()['min'](0x0)})[_0x5ad462(0x19a)](_0x1eb1c1(0x1a5)+_0x5ad462(0x1a2)+_0x5ad462(0x191)+'em'),c=_0x23df0b[_0x5ad462(0x1b9)]({'method':_0x1406fd,'count':_0x23df0b[_0x5ad462(0x18b)]()['int']()[_0x1eb1c1(0x1a8)](0x0),'totalSales':_0x23df0b['number']()[_0x1eb1c1(0x1a8)](0x0)})['openapi'](_0x5ad462(0x1aa)+_0x5ad462(0x1a3)+'ownItem');export const AnalyticsOverviewSchema=_0x23df0b[_0x5ad462(0x1b9)]({'range':r,'summary':o,'salesByDay':_0x23df0b[_0x5ad462(0x1ae)](i),'reservationsByDay':_0x23df0b[_0x1eb1c1(0x1ae)](m),'paymentMethods':_0x23df0b[_0x1eb1c1(0x1ae)](s),'fulfilmentMethods':_0x23df0b[_0x5ad462(0x1ae)](c)})[_0x1eb1c1(0x19a)](_0x1eb1c1(0x19e)+_0x1eb1c1(0x194)+'w');function _0x3a1b(){const _0x5470f1=['qw5HBhL0Awm','vgHLihbHEw0','mZbumJm6ntK','mJCZowHMDvnozW','zxrOB2rcCMu','BNrcCMvHA2q','y2fZAf9VBL8','ugf5BwvUDe0','mte3mZKXotzhBxnLwvi','mti2mZe1nKj4BM5wEa','BwLU','BNnMzxi','rNvSzMLSBwu','yxLqB2LUDa','nMvMsfzKBa','y29LCMnL','yxjYyxK','C3rYAw5N','DgLUzYbYyw4','mu5ir3fota','u3rHCNqGB2y','oJu5lJK5ovO','C1n1Bw1HCNK','zM9YihrOzsa','mJuXmte4ouD6r0D0Ea','ndu1mJbfuMLxvee','zw50ig1LDgG','B2jQzwn0','mJaYnI0Wms0','ntm0suPPz1fI','yMXPAW','u2fSzxncEuq','zgf0zq','BNvTyMvY','C1jHBMDL','oJaWlJaWmfO','rw5Kig9Mihq','Cgf5CgfS','AguGCMvWB3i','ywTKB3DUsxq','B3jKzxi','B2qGDxnLzca','C092zxj2Awu','y2fYza','mJa2odG4mKDzs1bwEq','EvbVAw50','Aw50','mdfumda6mda','B3bLBMfWAq','B3j0Aw5Nihi','mtaWmta1Chf3u1P5','mtm4otu1ndr1vvrPBw8'];_0x3a1b=function(){return _0x5470f1;};return _0x3a1b();}
1
+ import{z as e}from"@hono/zod-openapi";import{currency as t}from"../../schemas/currency.schema";import{fulfilmentMethod as n}from"../order/fulfilment.schema";const a=e.enum(["card","blik","paypal","bank_transfer","cash_on_delivery"]).openapi({description:"The payment method used for the order",example:"card"});export const AnalyticsOverviewQuerySchema=e.object({from:e.coerce.date().openapi({description:"Start of the reporting range",example:"2026-01-01T00:00:00.000Z"}),to:e.coerce.date().openapi({description:"End of the reporting range",example:"2026-01-30T23:59:59.999Z"})});const r=e.object({from:e.date(),to:e.date()}).openapi("AnalyticsRange"),o=e.object({currency:t,totalSales:e.number().min(0),paidOrders:e.number().int().min(0),averageOrderValue:e.number().min(0),reservations:e.number().int().min(0),guests:e.number().int().min(0)}).openapi("AnalyticsSummary"),i=e.object({date:e.date(),label:e.string(),totalSales:e.number().min(0),paidOrders:e.number().int().min(0)}).openapi("SalesByDayPoint"),m=e.object({date:e.date(),label:e.string(),reservations:e.number().int().min(0),guests:e.number().int().min(0)}).openapi("ReservationsByDayPoint"),s=e.object({method:a,count:e.number().int().min(0),totalSales:e.number().min(0)}).openapi("PaymentMethodBreakdownItem"),c=e.object({method:n,count:e.number().int().min(0),totalSales:e.number().min(0)}).openapi("FulfilmentBreakdownItem");export const AnalyticsOverviewSchema=e.object({range:r,summary:o,salesByDay:e.array(i),reservationsByDay:e.array(m),paymentMethods:e.array(s),fulfilmentMethods:e.array(c)}).openapi("AnalyticsOverview");
@@ -1 +1 @@
1
- const _0x120863=_0x7fa1;(function(_0x387c22,_0x29b245){const _0xd156d5=_0x7fa1,_0xe36d15=_0x7fa1,_0x36c45a=_0x387c22();while(!![]){try{const _0x5e07ca=-parseInt(_0xd156d5(0x1af))/0x1+parseInt(_0xe36d15(0x1c3))/0x2+-parseInt(_0xd156d5(0x1d5))/0x3*(parseInt(_0xd156d5(0x1d3))/0x4)+-parseInt(_0xd156d5(0x1c5))/0x5+parseInt(_0xd156d5(0x1bb))/0x6*(-parseInt(_0xe36d15(0x1c6))/0x7)+parseInt(_0xe36d15(0x1b1))/0x8+parseInt(_0xe36d15(0x1a6))/0x9*(parseInt(_0xd156d5(0x1ce))/0xa);if(_0x5e07ca===_0x29b245)break;else _0x36c45a['push'](_0x36c45a['shift']());}catch(_0x2e7260){_0x36c45a['push'](_0x36c45a['shift']());}}}(_0x3a96,0xd76f9));import{__awaiter as _0x2d0c6d}from'tslib';function _0x3a96(){const _0x40ee45=['Dxn0igjLigi','y29UzMLNDxi','v3LRC1m','igvXDwfSihq','Bwv0Ag9K','zMLUzezPCNm','B3jKzxi','zNjVBq','t3jNyw5PEMe','mJCXmZHTzfbHs00','DgLVBIbUB3q','Aw9UCW','CgLJA3vW','BYbGDg9G','DgLVBG','zef0','C29YDa','mtG4nJm4nMX0tgjhEq','Aw9U','odi3ndy2nujYCwjUzq','mtG3nMrhBNDUra','CMvZzxj2yxq','zNvSzMLSBwu','Cgf5BwvUDa','igzVDw5K','Dg90ywXtywW','ChjPC21H','y291BNq','ndb5zhLeug8','BwfW','tu1nigq','zgf0zq','C3rHDhvZ','mJC0nZK2wvDTr3Db','ywXS','ntfVuw5kuge','z2v0','BNrnzxrOB2q','BLrOB0S','z3vLC3rZ','yxrPB24','zMLUze1HBNK','DxjYzw5JEq','mtaYmtu0odzuAunKqKq','ygzYB21Gig0','DMfSDwvZ','zwzVCMuGB3i','y2fUy2vSBgu','zgvSAxzLCNK','Dg90ywW','z2v0t3zLCNy','CgfYC2u','mtu4mdC4muzkrvLeBq','ExL5Es1nts0','odeXodiXnLP0CeH6BG'];_0x3a96=function(){return _0x40ee45;};return _0x3a96();}function _0x7fa1(_0x4f46d7,_0x5616e2){_0x4f46d7=_0x4f46d7-0x1a6;const _0x3a964c=_0x3a96();let _0x7fa11b=_0x3a964c[_0x4f46d7];if(_0x7fa1['tgYsaz']===undefined){var _0x2fd1c4=function(_0x51e07f){const _0x1d95f1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x199923='',_0x5dfa08='';for(let _0x5edcae=0x0,_0x30f44c,_0x35eaa1,_0x58dc27=0x0;_0x35eaa1=_0x51e07f['charAt'](_0x58dc27++);~_0x35eaa1&&(_0x30f44c=_0x5edcae%0x4?_0x30f44c*0x40+_0x35eaa1:_0x35eaa1,_0x5edcae++%0x4)?_0x199923+=String['fromCharCode'](0xff&_0x30f44c>>(-0x2*_0x5edcae&0x6)):0x0){_0x35eaa1=_0x1d95f1['indexOf'](_0x35eaa1);}for(let _0x1838c9=0x0,_0x3ead10=_0x199923['length'];_0x1838c9<_0x3ead10;_0x1838c9++){_0x5dfa08+='%'+('00'+_0x199923['charCodeAt'](_0x1838c9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5dfa08);};_0x7fa1['lisHPr']=_0x2fd1c4,_0x7fa1['cTzpQl']={},_0x7fa1['tgYsaz']=!![];}const _0x2864f4=_0x3a964c[0x0],_0x1776b7=_0x4f46d7+_0x2864f4,_0x2f2970=_0x7fa1['cTzpQl'][_0x1776b7];return!_0x2f2970?(_0x7fa11b=_0x7fa1['lisHPr'](_0x7fa11b),_0x7fa1['cTzpQl'][_0x1776b7]=_0x7fa11b):_0x7fa11b=_0x2f2970,_0x7fa11b;}import{eachDayOfInterval as _0x20b01e,endOfDay as _0x2fa0d6,format as _0x138ae8,startOfDay as _0x372c54}from'date-fns';import{HttpException as _0x62544d}from'../../core/exceptions/http-exception';import{AnalyticsOverviewSchema as _0x281cec}from'./analytics.schema';class P{constructor(_0x36c484){this['prisma']=_0x36c484;}[_0x120863(0x1ad)+'iew'](_0xd0a6d0,_0x88953b){const _0x5d428f=_0x120863,_0x5bad88=_0x120863,_0x7aec78={'nThoK':_0x5d428f(0x1ba)+_0x5d428f(0x1bc)+_0x5bad88(0x1ca),'WyksS':function(_0x1f2a63,_0x5a6781){return _0x1f2a63!==_0x5a6781;},'GTpjY':function(_0x4030bc,_0x3720a9){return _0x4030bc===_0x3720a9;},'ADnIg':function(_0x456d8b,_0x4e1746,_0x3f5e50){return _0x456d8b(_0x4e1746,_0x3f5e50);}};return _0x2d0c6d(this,void 0x0,void 0x0,function*(){const _0x4ce1d4=_0x5d428f,_0x159e70=_0x5d428f;var _0xc6ae98,_0x56f602,_0x2eef07,_0x2e2f35;const _0x38ac34=_0x372c54(_0x88953b[_0x4ce1d4(0x1b9)]),_0x5d3586=_0x2fa0d6(_0x88953b['to']);if(_0x38ac34>_0x5d3586)throw new _0x62544d(0x190,_0x4ce1d4(0x1a7)+_0x4ce1d4(0x1b2)+_0x159e70(0x1a9)+_0x4ce1d4(0x1b5)+_0x159e70(0x1bf));const _0x56a0c8=yield this[_0x4ce1d4(0x1cc)]['organiza'+_0x159e70(0x1c0)][_0x159e70(0x1b7)+'t']({'where':{'id':_0xd0a6d0},'include':{'configuration':!0x0}});if(!_0x56a0c8)throw new _0x62544d(0x194,_0x7aec78[_0x4ce1d4(0x1d8)]);const [_0x557606,_0x23defe]=yield Promise[_0x159e70(0x1d4)]([this[_0x4ce1d4(0x1cc)][_0x159e70(0x1b8)][_0x4ce1d4(0x1db)]({'where':{'organizationId':_0xd0a6d0,'deletedAt':null,'createdAt':{'gte':_0x38ac34,'lte':_0x5d3586}},'select':{'createdAt':!0x0,'cancelledAt':!0x0,'fulfilmentMethod':!0x0,'payment':{'select':{'method':!0x0,'status':!0x0,'total':!0x0}}}}),this[_0x159e70(0x1cc)][_0x159e70(0x1c7)+_0x4ce1d4(0x1c4)][_0x159e70(0x1db)]({'where':{'organizationId':_0xd0a6d0,'date':{'gte':_0x38ac34,'lte':_0x5d3586}},'select':{'date':!0x0,'guests':!0x0,'cancelledAt':!0x0}})]),_0x583829=_0x20b01e({'start':_0x38ac34,'end':_0x5d3586}),_0x1c3e23=_0x583829[_0x4ce1d4(0x1cf)](_0x137157=>({'date':_0x137157,'label':_0x138ae8(_0x137157,_0x159e70(0x1d0)),'totalSales':0x0,'paidOrders':0x0})),_0x3c145b=_0x583829['map'](_0x508f5d=>({'date':_0x508f5d,'label':_0x138ae8(_0x508f5d,'MMM\x20d'),'reservations':0x0,'guests':0x0})),_0x25a3d3=new Map(_0x1c3e23[_0x4ce1d4(0x1cf)]((_0x1fc9e3,_0x3d76cd)=>[_0x138ae8(_0x1fc9e3[_0x159e70(0x1d1)],'yyyy-MM-'+'dd'),_0x3d76cd])),_0x14a46d=new Map(),_0x5b0b8d=new Map([_0x4ce1d4(0x1ab),_0x159e70(0x1be)][_0x159e70(0x1cf)](_0x59e245=>[_0x59e245,{'method':_0x59e245,'count':0x0,'totalSales':0x0}]));let _0x42cc68=0x0,_0x31d39a=0x0;for(const _0x30ad9b of _0x557606){const _0x293904=_0x30ad9b[_0x4ce1d4(0x1aa)+_0x4ce1d4(0x1c1)]===null&&((_0xc6ae98=_0x30ad9b[_0x159e70(0x1c9)])===null||_0xc6ae98===void 0x0?void 0x0:_0xc6ae98[_0x159e70(0x1d2)])==='succeede'+'d',_0x5121bf=_0x138ae8(_0x30ad9b['createdA'+'t'],_0x4ce1d4(0x1b0)+'dd'),_0x38e372=_0x25a3d3[_0x4ce1d4(0x1d6)](_0x5121bf);if(_0x293904&&_0x30ad9b['payment']&&_0x38e372!==void 0x0){_0x1c3e23[_0x38e372][_0x4ce1d4(0x1cb)+'es']+=_0x30ad9b[_0x159e70(0x1c9)][_0x159e70(0x1ac)],_0x1c3e23[_0x38e372]['paidOrde'+'rs']+=0x1,_0x42cc68+=_0x30ad9b[_0x159e70(0x1c9)][_0x159e70(0x1ac)],_0x31d39a+=0x1;const _0x5c49d0=(_0x56f602=_0x14a46d[_0x4ce1d4(0x1d6)](_0x30ad9b[_0x159e70(0x1c9)][_0x4ce1d4(0x1b6)]))!==null&&_0x56f602!==void 0x0?_0x56f602:{'method':_0x30ad9b[_0x4ce1d4(0x1c9)][_0x159e70(0x1b6)],'count':0x0,'totalSales':0x0};_0x5c49d0[_0x4ce1d4(0x1cd)]+=0x1,_0x5c49d0[_0x4ce1d4(0x1cb)+'es']+=_0x30ad9b['payment'][_0x159e70(0x1ac)],_0x14a46d['set'](_0x30ad9b[_0x159e70(0x1c9)][_0x4ce1d4(0x1b6)],_0x5c49d0);}if(_0x30ad9b[_0x159e70(0x1aa)+'dAt']===null&&_0x30ad9b[_0x4ce1d4(0x1c8)+_0x159e70(0x1d7)]){const _0x37b6aa=_0x5b0b8d[_0x159e70(0x1d6)](_0x30ad9b[_0x159e70(0x1c8)+_0x4ce1d4(0x1d7)]);_0x37b6aa&&(_0x37b6aa[_0x159e70(0x1cd)]+=0x1,_0x37b6aa[_0x4ce1d4(0x1cb)+'es']+=_0x7aec78[_0x4ce1d4(0x1b4)](_0x2e2f35=(_0x2eef07=_0x30ad9b[_0x4ce1d4(0x1c9)])===null||_0x7aec78['GTpjY'](_0x2eef07,void 0x0)?void 0x0:_0x2eef07[_0x4ce1d4(0x1ac)],null)&&_0x2e2f35!==void 0x0?_0x2e2f35:0x0);}}let _0x537df3=0x0,_0x6e257a=0x0;for(const _0xa83711 of _0x23defe){if(_0xa83711['cancelle'+_0x159e70(0x1c1)])continue;const _0x47ccf9=_0x7aec78['ADnIg'](_0x138ae8,_0xa83711[_0x4ce1d4(0x1d1)],_0x4ce1d4(0x1b0)+'dd'),_0x3d90da=_0x25a3d3['get'](_0x47ccf9);_0x3d90da!==void 0x0&&(_0x3c145b[_0x3d90da][_0x159e70(0x1c7)+_0x159e70(0x1bd)]+=0x1,_0x3c145b[_0x3d90da][_0x4ce1d4(0x1d9)]+=_0xa83711[_0x159e70(0x1d9)],_0x537df3+=0x1,_0x6e257a+=_0xa83711['guests']);}return _0x281cec[_0x159e70(0x1ae)]({'range':{'from':_0x38ac34,'to':_0x5d3586},'summary':{'currency':_0x56a0c8[_0x4ce1d4(0x1b3)+_0x159e70(0x1da)]['defaultC'+_0x159e70(0x1dc)],'totalSales':_0x42cc68,'paidOrders':_0x31d39a,'averageOrderValue':_0x31d39a>0x0?_0x42cc68/_0x31d39a:0x0,'reservations':_0x537df3,'guests':_0x6e257a},'salesByDay':_0x1c3e23,'reservationsByDay':_0x3c145b,'paymentMethods':Array['from'](_0x14a46d[_0x4ce1d4(0x1a8)]())[_0x4ce1d4(0x1c2)]((_0x5a8985,_0x298beb)=>_0x298beb[_0x4ce1d4(0x1cb)+'es']-_0x5a8985[_0x159e70(0x1cb)+'es']),'fulfilmentMethods':Array[_0x4ce1d4(0x1b9)](_0x5b0b8d['values']())[_0x4ce1d4(0x1c2)]((_0x2e550f,_0x5598d7)=>_0x5598d7[_0x4ce1d4(0x1cb)+'es']-_0x2e550f[_0x4ce1d4(0x1cb)+'es'])});});}}export{P as AnalyticsService};
1
+ import{__awaiter as B}from"tslib";import{eachDayOfInterval as k,endOfDay as E,format as l,startOfDay as I}from"date-fns";import{HttpException as _}from"../../core/exceptions/http-exception";import{AnalyticsOverviewSchema as K}from"./analytics.schema";class P{constructor(o){this.prisma=o}getOverview(o,h){return B(this,void 0,void 0,function*(){var c,u,y,m;const n=I(h.from),r=E(h.to);if(n>r)throw new _(400,"`from` must be before or equal to `to`");const g=yield this.prisma.organization.findFirst({where:{id:o},include:{configuration:!0}});if(!g)throw new _(404,"Organization not found");const[b,x]=yield Promise.all([this.prisma.order.findMany({where:{organizationId:o,deletedAt:null,createdAt:{gte:n,lte:r}},select:{createdAt:!0,cancelledAt:!0,fulfilmentMethod:!0,payment:{select:{method:!0,status:!0,total:!0}}}}),this.prisma.reservation.findMany({where:{organizationId:o,date:{gte:n,lte:r}},select:{date:!0,guests:!0,cancelledAt:!0}})]),S=k({start:n,end:r}),d=S.map(t=>({date:t,label:l(t,"MMM d"),totalSales:0,paidOrders:0})),f=S.map(t=>({date:t,label:l(t,"MMM d"),reservations:0,guests:0})),w=new Map(d.map((t,e)=>[l(t.date,"yyyy-MM-dd"),e])),p=new Map,A=new Map(["delivery","pickup"].map(t=>[t,{method:t,count:0,totalSales:0}]));let v=0,i=0;for(const t of b){const e=t.cancelledAt===null&&((c=t.payment)===null||c===void 0?void 0:c.status)==="succeeded",s=l(t.createdAt,"yyyy-MM-dd"),M=w.get(s);if(e&&t.payment&&M!==void 0){d[M].totalSales+=t.payment.total,d[M].paidOrders+=1,v+=t.payment.total,i+=1;const a=(u=p.get(t.payment.method))!==null&&u!==void 0?u:{method:t.payment.method,count:0,totalSales:0};a.count+=1,a.totalSales+=t.payment.total,p.set(t.payment.method,a)}if(t.cancelledAt===null&&t.fulfilmentMethod){const a=A.get(t.fulfilmentMethod);a&&(a.count+=1,a.totalSales+=(m=(y=t.payment)===null||y===void 0?void 0:y.total)!==null&&m!==void 0?m:0)}}let O=0,D=0;for(const t of x){if(t.cancelledAt)continue;const e=l(t.date,"yyyy-MM-dd"),s=w.get(e);s!==void 0&&(f[s].reservations+=1,f[s].guests+=t.guests,O+=1,D+=t.guests)}return K.parse({range:{from:n,to:r},summary:{currency:g.configuration.defaultCurrency,totalSales:v,paidOrders:i,averageOrderValue:i>0?v/i:0,reservations:O,guests:D},salesByDay:d,reservationsByDay:f,paymentMethods:Array.from(p.values()).sort((t,e)=>e.totalSales-t.totalSales),fulfilmentMethods:Array.from(A.values()).sort((t,e)=>e.totalSales-t.totalSales)})})}}export{P as AnalyticsService};
@@ -1 +1 @@
1
- function _0x49b4(_0x25c7e1,_0x8c653a){_0x25c7e1=_0x25c7e1-0x1aa;const _0x24da9b=_0x24da();let _0x49b4f5=_0x24da9b[_0x25c7e1];if(_0x49b4['ZBtsXz']===undefined){var _0x35f004=function(_0x4b106d){const _0x338bd9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x15541c='',_0x1bdb69='';for(let _0x49a7b5=0x0,_0x494a54,_0x11af4a,_0x574e25=0x0;_0x11af4a=_0x4b106d['charAt'](_0x574e25++);~_0x11af4a&&(_0x494a54=_0x49a7b5%0x4?_0x494a54*0x40+_0x11af4a:_0x11af4a,_0x49a7b5++%0x4)?_0x15541c+=String['fromCharCode'](0xff&_0x494a54>>(-0x2*_0x49a7b5&0x6)):0x0){_0x11af4a=_0x338bd9['indexOf'](_0x11af4a);}for(let _0x43abe9=0x0,_0x372543=_0x15541c['length'];_0x43abe9<_0x372543;_0x43abe9++){_0x1bdb69+='%'+('00'+_0x15541c['charCodeAt'](_0x43abe9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1bdb69);};_0x49b4['VqwIzG']=_0x35f004,_0x49b4['mBfDjE']={},_0x49b4['ZBtsXz']=!![];}const _0x5201d3=_0x24da9b[0x0],_0x43710c=_0x25c7e1+_0x5201d3,_0x4dac2b=_0x49b4['mBfDjE'][_0x43710c];return!_0x4dac2b?(_0x49b4f5=_0x49b4['VqwIzG'](_0x49b4f5),_0x49b4['mBfDjE'][_0x43710c]=_0x49b4f5):_0x49b4f5=_0x4dac2b,_0x49b4f5;}function _0x24da(){const _0x1e7337=['CMvX','mtGYnJDzCLnit2C','CgfYyw0','yxrH','mtaYmJq2t0zpy3Lo','mta1DvjsDKn0','mJeWntf5AgD5D0K','DMfSAwq','mZLty05LBfa','mtqWmfDmshzXsa','mZa4AuDXBw9k','nJbWEKrAzei','mtq5mtG3nxvpD2XnDa','ntyYmZuZnuLLzwTTqW','mtiXnZi0tfPbwe5s','B3jNyw5PEMe','B3bLBMfWAq','ANnVBG','DgLVBKLK','mta0otmYotjqDu5Tv0S','mtjNq1rMu2W','z2v0q2fYDeq'];_0x24da=function(){return _0x1e7337;};return _0x24da();}(function(_0x309251,_0x4aa241){const _0x3c291d=_0x49b4,_0x47705f=_0x49b4,_0x46a74e=_0x309251();while(!![]){try{const _0x21fd8e=-parseInt(_0x3c291d(0x1bd))/0x1*(parseInt(_0x3c291d(0x1ba))/0x2)+parseInt(_0x47705f(0x1ab))/0x3*(-parseInt(_0x3c291d(0x1b4))/0x4)+parseInt(_0x47705f(0x1b3))/0x5+-parseInt(_0x47705f(0x1aa))/0x6*(parseInt(_0x47705f(0x1b0))/0x7)+parseInt(_0x47705f(0x1af))/0x8*(-parseInt(_0x47705f(0x1ac))/0x9)+-parseInt(_0x3c291d(0x1b1))/0xa*(parseInt(_0x47705f(0x1b2))/0xb)+parseInt(_0x3c291d(0x1b9))/0xc*(parseInt(_0x3c291d(0x1ae))/0xd);if(_0x21fd8e===_0x4aa241)break;else _0x46a74e['push'](_0x46a74e['shift']());}catch(_0x1e7c1f){_0x46a74e['push'](_0x46a74e['shift']());}}}(_0x24da,0x92990));import{__awaiter as _0x2b6c67}from'tslib';import{createApiRouter as _0x260129}from'../../core/hono/hono';import{cartRoute as _0x44af31}from'./cart.route';export const registerCartHandlers=_0x459cda=>{const _0x23473a=_0x49b4,_0x2fbeb1=_0x49b4,_0x29c5c5=_0x260129();return _0x29c5c5[_0x23473a(0x1b6)](_0x44af31[_0x23473a(0x1bb)+_0x2fbeb1(0x1bf)],_0x5e3b3d=>_0x2b6c67(void 0x0,void 0x0,void 0x0,function*(){const _0x452d70=_0x2fbeb1,_0x690059=_0x2fbeb1,_0x72d9ef=_0x5e3b3d[_0x452d70(0x1bc)][_0x690059(0x1ad)](_0x452d70(0x1be)),_0x1a4d0d=_0x5e3b3d['req'][_0x452d70(0x1ad)](_0x690059(0x1b7)),_0x5c642b=_0x5e3b3d['req'][_0x452d70(0x1ad)]('query'),_0x3479b0=yield _0x459cda[_0x690059(0x1bb)+_0x690059(0x1bf)](_0x72d9ef[_0x452d70(0x1b5)+_0x690059(0x1b8)],_0x1a4d0d,_0x5c642b);return _0x5e3b3d['json'](_0x3479b0,0xc8);})),_0x29c5c5;};
1
+ import{__awaiter as p}from"tslib";import{createApiRouter as d}from"../../core/hono/hono";import{cartRoute as s}from"./cart.route";export const registerCartHandlers=o=>{const t=d();return t.openapi(s.getCartData,r=>p(void 0,void 0,void 0,function*(){const a=r.req.valid("param"),e=r.req.valid("json"),i=r.req.valid("query"),n=yield o.getCartData(a.organizationId,e,i);return r.json(n,200)})),t};
@@ -1 +1 @@
1
- function _0x2929(_0x519862,_0x25009b){_0x519862=_0x519862-0xad;const _0x13f69c=_0x13f6();let _0x2929ae=_0x13f69c[_0x519862];if(_0x2929['dPmXYV']===undefined){var _0x5c56d7=function(_0x133b40){const _0x329971='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2bbb2c='',_0x5738c0='';for(let _0x420bde=0x0,_0x278463,_0x3234b5,_0x5bfbd6=0x0;_0x3234b5=_0x133b40['charAt'](_0x5bfbd6++);~_0x3234b5&&(_0x278463=_0x420bde%0x4?_0x278463*0x40+_0x3234b5:_0x3234b5,_0x420bde++%0x4)?_0x2bbb2c+=String['fromCharCode'](0xff&_0x278463>>(-0x2*_0x420bde&0x6)):0x0){_0x3234b5=_0x329971['indexOf'](_0x3234b5);}for(let _0x21d4ad=0x0,_0x4f65ae=_0x2bbb2c['length'];_0x21d4ad<_0x4f65ae;_0x21d4ad++){_0x5738c0+='%'+('00'+_0x2bbb2c['charCodeAt'](_0x21d4ad)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5738c0);};_0x2929['iLsSvm']=_0x5c56d7,_0x2929['xqWJxL']={},_0x2929['dPmXYV']=!![];}const _0x23dda0=_0x13f69c[0x0],_0x5761c7=_0x519862+_0x23dda0,_0x2fcf41=_0x2929['xqWJxL'][_0x5761c7];return!_0x2fcf41?(_0x2929ae=_0x2929['iLsSvm'](_0x2929ae),_0x2929['xqWJxL'][_0x5761c7]=_0x2929ae):_0x2929ae=_0x2fcf41,_0x2929ae;}const _0x389098=_0x2929,_0x3fb25f=_0x2929;function _0x13f6(){const _0xac796b=['mZjzr0v3veO','ntuYmtHdEM1YCwm','z2v0q2fYDeq','rMv0y2HLCYa','r2v0iezVCM0','ndC3nte3nunOBwH6zW','zgvMyxvSDa','lZPVCMDHBMK','yxrH','q2fYDa','otKZmdKWDhb3sLvZ','mZi1nZuWCM9ru2n3','mtyYmteXzLDpufLw','mtK2ndvhyLbcvge','mZe0nZKWA3LKvNbP','l2nHCNq','otjhyw1cuMO','B2jQzwn0'];_0x13f6=function(){return _0xac796b;};return _0x13f6();}(function(_0x4e3f6b,_0x11ebf2){const _0x12ecb1=_0x2929,_0x34ae4d=_0x2929,_0x1eaf85=_0x4e3f6b();while(!![]){try{const _0x53242a=-parseInt(_0x12ecb1(0xb9))/0x1+-parseInt(_0x34ae4d(0xb1))/0x2+parseInt(_0x12ecb1(0xb2))/0x3+parseInt(_0x34ae4d(0xb6))/0x4*(parseInt(_0x12ecb1(0xb3))/0x5)+-parseInt(_0x12ecb1(0xb0))/0x6+parseInt(_0x34ae4d(0xb4))/0x7*(-parseInt(_0x34ae4d(0xb8))/0x8)+parseInt(_0x12ecb1(0xbd))/0x9;if(_0x53242a===_0x11ebf2)break;else _0x1eaf85['push'](_0x1eaf85['shift']());}catch(_0x14631a){_0x1eaf85['push'](_0x1eaf85['shift']());}}}(_0x13f6,0x1b383));import{z as _0x2bbb2c}from'@hono/zod-openapi';import{createApiRoute as _0x5738c0}from'../../core/hono/hono';import{CartDataSchema as _0x420bde,CartSchema as _0x278463,ErrorSchema as _0x3234b5,HeaderSchema as _0x5bfbd6,locale as _0x21d4ad,OrganizationParams as _0x4f65ae}from'../../schemas';const d=_0x5738c0({'body':_0x278463,'description':_0x389098(0xbb)+'formatte'+'d\x20cart\x20d'+_0x389098(0xae),'headers':_0x5bfbd6,'method':'POST','operationId':_0x389098(0xba)+'ata','path':_0x389098(0xad)+'zationId'+_0x3fb25f(0xb5),'pathParams':_0x4f65ae,'query':_0x2bbb2c[_0x389098(0xb7)]({'locale':_0x21d4ad[_0x3fb25f(0xbe)]('en')}),'responses':{0xc8:_0x420bde,0x190:_0x3234b5,0x191:_0x3234b5},'summary':_0x3fb25f(0xbc)+'atted\x20Ca'+'rt','tags':[_0x389098(0xaf)]});export const cartRoute={'getCartData':d};
1
+ import{z as t}from"@hono/zod-openapi";import{createApiRoute as r}from"../../core/hono/hono";import{CartDataSchema as e,CartSchema as o,ErrorSchema as a,HeaderSchema as m,locale as c,OrganizationParams as s}from"../../schemas";const d=r({body:o,description:"Fetches formatted cart data",headers:m,method:"POST",operationId:"getCartData",path:"/:organizationId/cart",pathParams:s,query:t.object({locale:c.default("en")}),responses:{200:e,400:a,401:a},summary:"Get Formatted Cart",tags:["Cart"]});export const cartRoute={getCartData:d};
@@ -1 +1 @@
1
- const _0x8b5fd7=_0x1e91,_0x490656=_0x1e91;function _0x1e91(_0x4b6898,_0x145e3f){_0x4b6898=_0x4b6898-0xcd;const _0x2fe6b6=_0x2fe6();let _0x1e910e=_0x2fe6b6[_0x4b6898];if(_0x1e91['grgxuX']===undefined){var _0xaada60=function(_0xba599a){const _0x14f988='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2d26f3='',_0x2e7d60='';for(let _0x5893e1=0x0,_0x38a17a,_0x37eb93,_0x1d1202=0x0;_0x37eb93=_0xba599a['charAt'](_0x1d1202++);~_0x37eb93&&(_0x38a17a=_0x5893e1%0x4?_0x38a17a*0x40+_0x37eb93:_0x37eb93,_0x5893e1++%0x4)?_0x2d26f3+=String['fromCharCode'](0xff&_0x38a17a>>(-0x2*_0x5893e1&0x6)):0x0){_0x37eb93=_0x14f988['indexOf'](_0x37eb93);}for(let _0x3e9c82=0x0,_0x47e344=_0x2d26f3['length'];_0x3e9c82<_0x47e344;_0x3e9c82++){_0x2e7d60+='%'+('00'+_0x2d26f3['charCodeAt'](_0x3e9c82)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2e7d60);};_0x1e91['PnMwAk']=_0xaada60,_0x1e91['kfdLCh']={},_0x1e91['grgxuX']=!![];}const _0x41ac61=_0x2fe6b6[0x0],_0x5ad27c=_0x4b6898+_0x41ac61,_0x4dd53e=_0x1e91['kfdLCh'][_0x5ad27c];return!_0x4dd53e?(_0x1e910e=_0x1e91['PnMwAk'](_0x1e910e),_0x1e91['kfdLCh'][_0x5ad27c]=_0x1e910e):_0x1e910e=_0x4dd53e,_0x1e910e;}(function(_0x14fbb1,_0xccb08c){const _0x50bd97=_0x1e91,_0x126f0c=_0x1e91,_0x3ca207=_0x14fbb1();while(!![]){try{const _0x447b9b=-parseInt(_0x50bd97(0x100))/0x1*(parseInt(_0x50bd97(0xd4))/0x2)+parseInt(_0x50bd97(0xf4))/0x3+-parseInt(_0x126f0c(0xdd))/0x4+parseInt(_0x50bd97(0xe9))/0x5+parseInt(_0x126f0c(0xe6))/0x6*(parseInt(_0x50bd97(0xfc))/0x7)+parseInt(_0x50bd97(0x101))/0x8*(parseInt(_0x126f0c(0xd5))/0x9)+-parseInt(_0x50bd97(0xd8))/0xa*(parseInt(_0x50bd97(0x109))/0xb);if(_0x447b9b===_0xccb08c)break;else _0x3ca207['push'](_0x3ca207['shift']());}catch(_0x66d197){_0x3ca207['push'](_0x3ca207['shift']());}}}(_0x2fe6,0xe47ee));function _0x2fe6(){const _0x2b0015=['ihjLCxvLC3q','CM1HBgL6yxq','BgLJDa','mtGYndq4D25Hqxnx','mtKYnNHtzKnsAW','Bw9KAwzPzxi','B3b0Aw9UywW','mtG1nZqWuwfvrKPS','yxjYyxK','B2jQzwn0','zgvM','zgvMyxvSDa','mJKYmZCZmNbOq0LbDq','Aw52ywXPzf8','ChjVzhvJDa','AwvUDf9ZDg8','y3vPza','y2XMotG3nJu','ignHCNq','igfJy2vWDgu','y2XNmtiZndu','mtmWofvUAwTAEa','C2HHCgu','zsbWCM9KDwm','mJKYotmWmg5tDMjpqq','zwqGChjVzhu','nJC4otbHyMm','zsbZzwXLy3q','ig1VzgLMAwu','zxH0zw5K','q2fYDenVBMy','r3jVDxbZ','zwqGyNKGDgG','DcbPBIb0Agu','q2fYDefKANu','oty5nteZsenuzxfo','ig9MihrOAxm','zwqGBw9KAwy','Aw9U','BNvTyMvY','yxnVBG','Dg9JAW','CMvJB3jK','mZa1mdz6D3rwzhq','uxvHBNrPDhK','ndmYmtbHyMm','igL0zw0GAw4','mtLutw1OwKm','nJGWmJrpyxfsuKy','zsbHzMzLy3q','AwvY','zxiGz3jVDxa','suqGB2yGDgG','C3rYAw5N','B3bLBMfWAq','Aw50','mty1zw5Aq1fL','zsbTB2rPzMK','q2fYDeL0zw0','BwLU','Aw5ZDwzMAwm'];_0x2fe6=function(){return _0x2b0015;};return _0x2fe6();}import{z as _0x2d26f3}from'@hono/zod-openapi';import{LocalizedProductSchema as _0x2e7d60}from'../product/product.schema';export const CartProductsMappingSchema=_0x2d26f3[_0x8b5fd7(0xfb)](_0x2d26f3[_0x490656(0x106)]()[_0x8b5fd7(0x107)]({'example':_0x8b5fd7(0xe2)+_0x8b5fd7(0xfe)+'def','description':'ID\x20of\x20th'+_0x8b5fd7(0xe8)+_0x8b5fd7(0xf2)+_0x490656(0xe3)}),_0x2e7d60),CartItemSchema=_0x2d26f3[_0x490656(0xda)]({'productId':_0x2d26f3[_0x490656(0x106)]()[_0x490656(0xe1)]()[_0x8b5fd7(0x107)]({'example':_0x8b5fd7(0xe2)+_0x8b5fd7(0xfe)+_0x490656(0xdb),'description':_0x8b5fd7(0x105)+_0x490656(0xe8)+_0x490656(0xf2)+'\x20cart'}),'quantity':_0x2d26f3[_0x490656(0xf8)]()[_0x8b5fd7(0xdc)](0x1)['optional']()[_0x490656(0x107)]({'example':0x2,'description':'Quantity'+_0x8b5fd7(0xf5)+_0x490656(0xff)+'\x20the\x20car'+'t'}),'modifierGroups':_0x2d26f3[_0x8b5fd7(0xd9)](_0x2d26f3[_0x8b5fd7(0xda)]({'id':_0x2d26f3[_0x8b5fd7(0x106)]()[_0x8b5fd7(0xe1)]()[_0x8b5fd7(0x107)]({'example':_0x8b5fd7(0xe5)+_0x490656(0xeb)+_0x8b5fd7(0xdb),'description':_0x8b5fd7(0x105)+_0x8b5fd7(0xcd)+_0x490656(0x104)}),'modifiers':_0x2d26f3[_0x8b5fd7(0xd9)](_0x2d26f3['object']({'id':_0x2d26f3[_0x490656(0x106)]()[_0x8b5fd7(0xe1)]()['openapi']({'example':'clh98765'+_0x8b5fd7(0xfe)+'def','description':'ID\x20of\x20th'+_0x8b5fd7(0xec)+_0x490656(0xf6)+_0x8b5fd7(0x103)}),'quantity':_0x2d26f3[_0x490656(0xf8)]()[_0x8b5fd7(0xdc)](0x1)[_0x8b5fd7(0x107)]({'example':0x1,'description':_0x8b5fd7(0xfd)+_0x8b5fd7(0xf5)+_0x8b5fd7(0xed)+'r'})}))}))})[_0x490656(0x107)](_0x8b5fd7(0xce)),CartSchema=_0x2d26f3[_0x490656(0xda)]({'items':_0x2d26f3[_0x490656(0xd9)](CartItemSchema),'shippingMethodId':_0x2d26f3[_0x490656(0x106)]()['cuid']()['optional']()}),CartAdjustmentReasonSchema=_0x2d26f3['enum']([_0x8b5fd7(0xde)+_0x490656(0xdf),'out_of_s'+_0x8b5fd7(0xfa),_0x490656(0xd0)+_0x490656(0xe0)+'ck'])[_0x8b5fd7(0x107)](_0x8b5fd7(0xf3)+'stmentRe'+_0x490656(0xf9)),CartAdjustmentSchema=_0x2d26f3[_0x490656(0xda)]({'productId':_0x2d26f3[_0x8b5fd7(0x106)]()[_0x8b5fd7(0xe1)]()['openapi']({'example':_0x8b5fd7(0xe2)+_0x8b5fd7(0xfe)+_0x8b5fd7(0xdb),'description':'ID\x20of\x20th'+_0x8b5fd7(0x102)+_0x490656(0xea)+'ct'}),'modifierGroups':CartItemSchema[_0x8b5fd7(0xe7)][_0x490656(0xd6)+_0x490656(0xf0)][_0x490656(0xd7)](),'reason':CartAdjustmentReasonSchema,'requestedQuantity':_0x2d26f3[_0x8b5fd7(0xf8)]()[_0x490656(0x108)]()[_0x8b5fd7(0xcf)](0x0)[_0x490656(0x107)]({'example':0x3,'description':_0x8b5fd7(0xfd)+_0x490656(0xd1)+_0x8b5fd7(0xf1)+'e\x20custom'+'er'}),'resolvedQuantity':_0x2d26f3[_0x8b5fd7(0xf8)]()[_0x8b5fd7(0x108)]()[_0x490656(0xcf)](0x0)[_0x8b5fd7(0x107)]({'example':0x1,'description':_0x490656(0xfd)+_0x490656(0xe4)+'d\x20after\x20'+'stock\x20no'+_0x8b5fd7(0xd2)+_0x8b5fd7(0xf7)})})[_0x490656(0x107)]('CartAdju'+'stment'),CartDataSchema=_0x2d26f3[_0x8b5fd7(0xda)]({'invalidProductIds':_0x2d26f3[_0x8b5fd7(0xd9)](_0x2d26f3['string']()),'normalizedItems':_0x2d26f3['array'](CartItemSchema),'adjustments':_0x2d26f3[_0x490656(0xd9)](CartAdjustmentSchema),'products':CartProductsMappingSchema,'shipping':_0x2d26f3[_0x8b5fd7(0xf8)]()['optional'](),'subtotal':_0x2d26f3[_0x8b5fd7(0xf8)](),'total':_0x2d26f3[_0x490656(0xf8)]()}),CartConflictSchema=CartDataSchema[_0x8b5fd7(0xee)]({'message':_0x2d26f3[_0x8b5fd7(0x106)]()})[_0x8b5fd7(0x107)](_0x490656(0xef)+_0x8b5fd7(0xd3));
1
+ import{z as t}from"@hono/zod-openapi";import{LocalizedProductSchema as e}from"../product/product.schema";export const CartProductsMappingSchema=t.record(t.string().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),e),CartItemSchema=t.object({productId:t.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the product in the cart"}),quantity:t.number().default(1).optional().openapi({example:2,description:"Quantity of this item in the cart"}),modifierGroups:t.array(t.object({id:t.string().cuid().openapi({example:"clg1234567890abcdef",description:"ID of the modifier group"}),modifiers:t.array(t.object({id:t.string().cuid().openapi({example:"clh9876543210abcdef",description:"ID of the selected modifier"}),quantity:t.number().default(1).openapi({example:1,description:"Quantity of this modifier"})}))}))}).openapi("CartItem"),CartSchema=t.object({items:t.array(CartItemSchema),shippingMethodId:t.string().cuid().optional()}),CartAdjustmentReasonSchema=t.enum(["invalid_product","out_of_stock","insufficient_stock"]).openapi("CartAdjustmentReason"),CartAdjustmentSchema=t.object({productId:t.string().cuid().openapi({example:"clf9876543210abcdef",description:"ID of the affected product"}),modifierGroups:CartItemSchema.shape.modifierGroups.optional(),reason:CartAdjustmentReasonSchema,requestedQuantity:t.number().int().min(0).openapi({example:3,description:"Quantity requested by the customer"}),resolvedQuantity:t.number().int().min(0).openapi({example:1,description:"Quantity accepted after stock normalization"})}).openapi("CartAdjustment"),CartDataSchema=t.object({invalidProductIds:t.array(t.string()),normalizedItems:t.array(CartItemSchema),adjustments:t.array(CartAdjustmentSchema),products:CartProductsMappingSchema,shipping:t.number().optional(),subtotal:t.number(),total:t.number()}),CartConflictSchema=CartDataSchema.extend({message:t.string()}).openapi("CartConflict");
@@ -1 +1 @@
1
- const _0x4a808a=_0x4988,_0x1d77d5=_0x4988;function _0x4988(_0x3fab23,_0x2d65ab){_0x3fab23=_0x3fab23-0x16f;const _0x4381ac=_0x4381();let _0x4988b9=_0x4381ac[_0x3fab23];if(_0x4988['GCHPyQ']===undefined){var _0x219e43=function(_0x145adc){const _0x46982f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x23aec6='',_0x1a2dc9='';for(let _0x1b1bc1=0x0,_0x14b5c7,_0x19cdc8,_0x2f4d55=0x0;_0x19cdc8=_0x145adc['charAt'](_0x2f4d55++);~_0x19cdc8&&(_0x14b5c7=_0x1b1bc1%0x4?_0x14b5c7*0x40+_0x19cdc8:_0x19cdc8,_0x1b1bc1++%0x4)?_0x23aec6+=String['fromCharCode'](0xff&_0x14b5c7>>(-0x2*_0x1b1bc1&0x6)):0x0){_0x19cdc8=_0x46982f['indexOf'](_0x19cdc8);}for(let _0x82444b=0x0,_0x5e1ce0=_0x23aec6['length'];_0x82444b<_0x5e1ce0;_0x82444b++){_0x1a2dc9+='%'+('00'+_0x23aec6['charCodeAt'](_0x82444b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1a2dc9);};_0x4988['AUIttn']=_0x219e43,_0x4988['kaMekF']={},_0x4988['GCHPyQ']=!![];}const _0x2139c6=_0x4381ac[0x0],_0x2bd381=_0x3fab23+_0x2139c6,_0x1cbf3b=_0x4988['kaMekF'][_0x2bd381];return!_0x1cbf3b?(_0x4988b9=_0x4988['AUIttn'](_0x4988b9),_0x4988['kaMekF'][_0x2bd381]=_0x4988b9):_0x4988b9=_0x1cbf3b,_0x4988b9;}(function(_0x1da139,_0x44489e){const _0x2948e9=_0x4988,_0xec2455=_0x4988,_0x26d879=_0x1da139();while(!![]){try{const _0x4da787=parseInt(_0x2948e9(0x17f))/0x1+-parseInt(_0xec2455(0x171))/0x2*(-parseInt(_0x2948e9(0x196))/0x3)+parseInt(_0xec2455(0x18e))/0x4+parseInt(_0xec2455(0x18d))/0x5+-parseInt(_0x2948e9(0x176))/0x6*(-parseInt(_0xec2455(0x183))/0x7)+parseInt(_0x2948e9(0x19a))/0x8+-parseInt(_0xec2455(0x195))/0x9*(parseInt(_0xec2455(0x170))/0xa);if(_0x4da787===_0x44489e)break;else _0x26d879['push'](_0x26d879['shift']());}catch(_0x2b7061){_0x26d879['push'](_0x26d879['shift']());}}}(_0x4381,0x7a4d3));import{__awaiter as _0x4d4e86}from'tslib';import{flattenTranslationData as _0x38dadf}from'../../core/utils/zod.util';import{CartDataSchema as _0x1a2c64,LocalizedProductSchema as _0x1526fd}from'../../schemas';class I{constructor(_0x280448,_0x2dd61a){const _0x49be00=_0x4988,_0x5561a3=_0x4988;this[_0x49be00(0x189)]=_0x280448,this[_0x5561a3(0x178)+_0x49be00(0x17c)]=_0x2dd61a;}[_0x4a808a(0x180)+_0x4a808a(0x175)+_0x4a808a(0x197)](_0x3d3926,_0x58f968,_0x5e7a58){return _0x4d4e86(this,void 0x0,void 0x0,function*(){const _0x6d80d2=_0x4988,_0x34882b=_0x4988,_0x5cd751={'nByOm':function(_0x4c36a1,_0x4c43be){return _0x4c36a1!==_0x4c43be;}};var _0x27505c,_0x2bad4c;const _0x248c8a=_0x5e7a58?yield this[_0x6d80d2(0x189)][_0x34882b(0x17a)+_0x6d80d2(0x184)]['findUniq'+'ue']({'where':{'id':_0x5e7a58},'include':{'shippingZones':!0x0}}):null,_0x165afb=_0x3d3926[_0x6d80d2(0x192)]((_0x5a9554,_0xa7774f)=>{const _0x2240a1=_0x6d80d2,_0x315f6f=_0x6d80d2;var _0x326a61,_0x12373b;const _0x3091d1=_0x58f968[_0x2240a1(0x173)](_0x16b92e=>_0x16b92e['id']===_0xa7774f['productI'+'d']);if(!_0x3091d1)return _0x5a9554;const _0xb539dd=(_0x12373b=_0x5cd751['nByOm'](_0x326a61=_0x3091d1[_0x2240a1(0x199)+'edBasePr'+_0x2240a1(0x17b)],null)&&_0x326a61!==void 0x0?_0x326a61:_0x3091d1[_0x315f6f(0x18c)+'e'])!==null&&_0x12373b!==void 0x0?_0x12373b:0x0;return _0x5a9554+_0xb539dd*(_0xa7774f[_0x315f6f(0x177)]||0x1);},0x0),_0x2ae10a=(_0x27505c=_0x248c8a?.[_0x6d80d2(0x17a)+_0x34882b(0x16f)][0x0])===null||_0x27505c===void 0x0?void 0x0:_0x27505c[_0x6d80d2(0x188)];return{'total':_0x165afb+(_0x2ae10a??0x0),'subtotal':_0x165afb,'shipping':(_0x2bad4c=_0x248c8a?.[_0x6d80d2(0x17a)+_0x34882b(0x16f)][0x0])===null||_0x2bad4c===void 0x0?void 0x0:_0x2bad4c[_0x34882b(0x188)]};});}[_0x4a808a(0x187)+_0x1d77d5(0x174)](_0x2420db,_0x116a24,_0x19f023){return _0x4d4e86(this,void 0x0,void 0x0,function*(){const _0x5a7252=_0x4988,_0x3e1174=_0x4988,{locale:_0x3883ba}=_0x19f023,_0x4d63e1=new Set(_0x116a24[_0x5a7252(0x190)][_0x3e1174(0x181)](_0x889cd7=>_0x889cd7[_0x3e1174(0x179)+'d'])),_0x53deda=yield this['prisma'][_0x5a7252(0x191)][_0x3e1174(0x18f)]({'where':{'id':{'in':Array[_0x3e1174(0x172)](_0x4d63e1)},'organizationId':_0x2420db,'deletedAt':null,'publishedAt':{'not':null}},'include':{'translations':_0x3883ba?{'where':{'locale':_0x3883ba}}:!0x0,'images':!0x0,'categories':{'include':{'translations':{'where':{'locale':_0x3883ba}}}},'modifierGroups':{'include':{'translations':{'where':{'locale':_0x3883ba}},'modifiers':!0x0}}}}),_0x3f1dca=this[_0x3e1174(0x178)+'yService'][_0x5a7252(0x17e)+_0x5a7252(0x18a)+'ms'](_0x116a24[_0x5a7252(0x190)],_0x53deda[_0x5a7252(0x181)](_0x45922e=>({'id':_0x45922e['id'],'availableQuantity':_0x45922e[_0x3e1174(0x186)+_0x3e1174(0x185)+'y']}))),_0x3ba83b=yield this[_0x3e1174(0x180)+_0x5a7252(0x175)+_0x3e1174(0x197)](_0x3f1dca['normaliz'+_0x3e1174(0x193)],_0x53deda,_0x116a24[_0x3e1174(0x17a)+'MethodId']);return _0x1a2c64[_0x3e1174(0x194)](Object[_0x3e1174(0x18b)](Object[_0x3e1174(0x18b)]({},_0x3ba83b),{'adjustments':_0x3f1dca[_0x5a7252(0x198)+_0x5a7252(0x19b)],'invalidProductIds':_0x3f1dca[_0x5a7252(0x17d)+_0x5a7252(0x182)+'s'],'normalizedItems':_0x3f1dca[_0x3e1174(0x17e)+_0x5a7252(0x193)],'products':_0x53deda['reduce']((_0x47a133,_0x1dbda5)=>(_0x47a133[_0x1dbda5['id']]=_0x1526fd[_0x3e1174(0x194)](_0x38dadf(_0x1dbda5)),_0x47a133),{})}));});}}export{I as CartService};function _0x4381(){const _0x4c6550=['ChjVzhvJDa','CMvKDwnL','zwrjDgvTCW','CgfYC2u','oxDIu1rcDW','mti2ue1OuerI','zwfRzg93BG','ywrQDxn0Bwu','zgLZy291BNq','mZeWmtKZnKXTz2Xdzq','BNrZ','wM9Uzxm','mJiWmZy3mZbJDuzmD0O','mty4ntrquwrWwwS','zNjVBq','zMLUza','yxrH','zvbYAwnLqNi','odKWmdrmu2LItLa','CxvHBNrPDhK','Aw52zw50B3i','ChjVzhvJDeK','C2HPChbPBMC','AwnL','EvnLCNzPy2u','Aw52ywXPzfa','BM9YBwfSAxO','mJy5nZm1B0f2AML0','y2fSy3vSyxq','BwfW','CM9KDwn0swq','mZCXuvL4AvPp','twv0Ag9K','zvf1yw50Axq','yxzHAwXHyMW','z2v0q2fYDeq','ChjPy2u','ChjPC21H','zunHCNrjDgu','yxnZAwDU','yMfZzvbYAwm','mZq2ndGYnuntBhjRzG','odu2mty4t0X3vLHS','zMLUze1HBNK','AxrLBxm'];_0x4381=function(){return _0x4c6550;};return _0x4381();}
1
+ import{__awaiter as v}from"tslib";import{flattenTranslationData as g}from"../../core/utils/zod.util";import{CartDataSchema as w,LocalizedProductSchema as y}from"../../schemas";class I{constructor(o,n){this.prisma=o,this.inventoryService=n}calculatePriceBreakdown(o,n,l){return v(this,void 0,void 0,function*(){var t,a;const i=l?yield this.prisma.shippingMethod.findUnique({where:{id:l},include:{shippingZones:!0}}):null,r=o.reduce((d,m)=>{var c,u;const p=n.find(f=>f.id===m.productId);if(!p)return d;const h=(u=(c=p.discountedBasePrice)!==null&&c!==void 0?c:p.basePrice)!==null&&u!==void 0?u:0;return d+h*(m.quantity||1)},0),s=(t=i?.shippingZones[0])===null||t===void 0?void 0:t.price;return{total:r+(s??0),subtotal:r,shipping:(a=i?.shippingZones[0])===null||a===void 0?void 0:a.price}})}getCartData(o,n,l){return v(this,void 0,void 0,function*(){const{locale:t}=l,a=new Set(n.items.map(e=>e.productId)),i=yield this.prisma.product.findMany({where:{id:{in:Array.from(a)},organizationId:o,deletedAt:null,publishedAt:{not:null}},include:{translations:t?{where:{locale:t}}:!0,images:!0,categories:{include:{translations:{where:{locale:t}}}},modifierGroups:{include:{translations:{where:{locale:t}},modifiers:!0}}}}),r=this.inventoryService.normalizeCartItems(n.items,i.map(e=>({id:e.id,availableQuantity:e.availableQuantity}))),s=yield this.calculatePriceBreakdown(r.normalizedItems,i,n.shippingMethodId);return w.parse(Object.assign(Object.assign({},s),{adjustments:r.adjustments,invalidProductIds:r.invalidProductIds,normalizedItems:r.normalizedItems,products:i.reduce((e,d)=>(e[d.id]=y.parse(g(d)),e),{})}))})}}export{I as CartService};
@@ -1 +1 @@
1
- (function(_0x46f4e1,_0x5ecdfe){const _0x9c2f92=_0x524a,_0x1222d2=_0x524a,_0x2ebd75=_0x46f4e1();while(!![]){try{const _0x3ce92d=-parseInt(_0x9c2f92(0x122))/0x1+-parseInt(_0x9c2f92(0x116))/0x2+-parseInt(_0x1222d2(0x11c))/0x3+-parseInt(_0x1222d2(0x123))/0x4+parseInt(_0x9c2f92(0x129))/0x5+-parseInt(_0x1222d2(0x12b))/0x6*(parseInt(_0x9c2f92(0x10f))/0x7)+-parseInt(_0x1222d2(0x113))/0x8*(-parseInt(_0x9c2f92(0x115))/0x9);if(_0x3ce92d===_0x5ecdfe)break;else _0x2ebd75['push'](_0x2ebd75['shift']());}catch(_0xc3b222){_0x2ebd75['push'](_0x2ebd75['shift']());}}}(_0x3bae,0x1fd7d));function _0x524a(_0x60f4ec,_0x327623){_0x60f4ec=_0x60f4ec-0x10f;const _0x3baefd=_0x3bae();let _0x524ad8=_0x3baefd[_0x60f4ec];if(_0x524a['WmEaJV']===undefined){var _0x2d4c72=function(_0x4c63e0){const _0x555a85='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5bf8ba='',_0x48638c='';for(let _0x3f6379=0x0,_0x2a193a,_0x5566b4,_0x6d8042=0x0;_0x5566b4=_0x4c63e0['charAt'](_0x6d8042++);~_0x5566b4&&(_0x2a193a=_0x3f6379%0x4?_0x2a193a*0x40+_0x5566b4:_0x5566b4,_0x3f6379++%0x4)?_0x5bf8ba+=String['fromCharCode'](0xff&_0x2a193a>>(-0x2*_0x3f6379&0x6)):0x0){_0x5566b4=_0x555a85['indexOf'](_0x5566b4);}for(let _0x2e1f02=0x0,_0x1be761=_0x5bf8ba['length'];_0x2e1f02<_0x1be761;_0x2e1f02++){_0x48638c+='%'+('00'+_0x5bf8ba['charCodeAt'](_0x2e1f02)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x48638c);};_0x524a['gUpmYF']=_0x2d4c72,_0x524a['OMpzrJ']={},_0x524a['WmEaJV']=!![];}const _0x2fc55f=_0x3baefd[0x0],_0x4a468e=_0x60f4ec+_0x2fc55f,_0x2bc8da=_0x524a['OMpzrJ'][_0x4a468e];return!_0x2bc8da?(_0x524ad8=_0x524a['gUpmYF'](_0x524ad8),_0x524a['OMpzrJ'][_0x4a468e]=_0x524ad8):_0x524ad8=_0x2bc8da,_0x524ad8;}function _0x3bae(){const _0x32fb6b=['mty4mtG2veTvr1vf','ntaZmJy4DgrVuKft','yxbZAg90swq','Bw9KAwzPzxi','DgL0Bgu','r3jVDxbZ','AM9PBG','mZK2mZqWAeD4Du9g','BgvUz3rO','mtaYC0rts2vI','zM9YrwfJAa','ChjPy2u','nJG3mtLsChP5ywC','uhjVzhvJDca','ChjVzhvJDa','DhjHBNnSyxq','nZyZnJbVBevwwvy','D2L0Acbjrca','ode5seDUBvjo','ndy5ndiYuvvbrfPU','zMLUzfvUAxe','ig5VDcbMB3u','Aw9UCW','yMfZzvbYAwm','zMLUza','mZy1ndKZBu9kzhzk','ChjVzhvJDeK','Bg9JywXL','ChvZAa','BwfW','CxvHBNrPDhK'];_0x3bae=function(){return _0x32fb6b;};return _0x3bae();}import{__awaiter as _0x5b2a2d}from'tslib';export const transformCartItemToOrderItem=_0x20cc93=>_0x39cfff=>_0x5b2a2d(void 0x0,void 0x0,void 0x0,function*(){const _0x5e6f1e=_0x524a,_0x22fc3a=_0x524a,_0x16e8b6=yield _0x20cc93[_0x5e6f1e(0x111)][_0x22fc3a(0x117)+'ue']({'where':{'id':_0x39cfff[_0x5e6f1e(0x11d)+'d']},'include':{'translations':!0x0,'modifierGroups':{'include':{'translations':!0x0,'modifiers':!0x0}},'images':!0x0}});if(!_0x16e8b6)throw new Error(_0x5e6f1e(0x110)+_0x22fc3a(0x114)+_0x39cfff[_0x22fc3a(0x11d)+'d']+(_0x5e6f1e(0x118)+'nd'));const _0x3d51ee=_0x16e8b6['images'][0x0];let _0x5af8c5=_0x16e8b6[_0x22fc3a(0x11a)+'e'];const _0x30c108=_0x16e8b6[_0x5e6f1e(0x112)+_0x22fc3a(0x119)][_0x22fc3a(0x120)](_0x2fd247=>{const _0x2af287=_0x5e6f1e,_0x4815d3=_0x5e6f1e,_0x228197=[];_0x39cfff[_0x2af287(0x125)+_0x2af287(0x127)][_0x2af287(0x12c)](_0x2e3802=>{const _0x4866ca=_0x2af287,_0x29b860=_0x2af287;var _0x57d2dc;const _0x5bf322=_0x16e8b6[_0x4866ca(0x125)+'Groups'][_0x4866ca(0x11b)](_0xedcfe6=>_0xedcfe6['id']===_0x2e3802['id']);if(_0x5bf322){const _0x1c4654=_0x5bf322['translat'+_0x4866ca(0x119)]['find'](_0x15dabd=>_0x15dabd[_0x29b860(0x11e)]===_0x2fd247[_0x4866ca(0x11e)]),_0x4d95e6=[];_0x2e3802[_0x29b860(0x125)+'s'][_0x29b860(0x12c)](_0x356b2e=>{const _0x32d049=_0x29b860,_0x4fb58d=_0x29b860,_0x2586e3=_0x5bf322[_0x32d049(0x125)+'s']['find'](_0x1e783a=>_0x1e783a['id']===_0x356b2e['id']);_0x2586e3&&(_0x5af8c5+=_0x2586e3[_0x4fb58d(0x12d)]*_0x356b2e['quantity'],_0x4d95e6[_0x4fb58d(0x11f)](''+_0x2586e3[_0x32d049(0x126)]+(_0x356b2e['quantity']>0x1?'\x20('+_0x356b2e[_0x32d049(0x121)]+'x)':'')));}),_0x4d95e6[_0x4866ca(0x12a)]>0x0&&_0x228197['push']((_0x1c4654?.[_0x4866ca(0x126)]||((_0x57d2dc=_0x5bf322['translat'+_0x29b860(0x119)][0x0])===null||_0x57d2dc===void 0x0?void 0x0:_0x57d2dc[_0x4866ca(0x126)])||'')+':\x20'+_0x4d95e6[_0x4866ca(0x128)](',\x20'));}});const _0x31cf57=_0x228197[_0x2af287(0x128)](',\x20');return{'locale':_0x2fd247[_0x4815d3(0x11e)],'title':_0x2fd247[_0x4815d3(0x126)]||'','subtitle':_0x31cf57||''};}),_0x180f80=_0x39cfff[_0x22fc3a(0x121)]||0x1,_0x485bd2=_0x5af8c5*_0x180f80;return{'translations':{'create':_0x30c108},'unitPrice':_0x5af8c5,'totalPrice':_0x485bd2,'quantity':_0x180f80,'rawData':_0x39cfff,'imageId':_0x3d51ee?.['id'],'productSnapshotId':_0x16e8b6['latestSn'+_0x22fc3a(0x124)]};});
1
+ import{__awaiter as q}from"tslib";export const transformCartItemToOrderItem=m=>o=>q(void 0,void 0,void 0,function*(){const t=yield m.product.findUnique({where:{id:o.productId},include:{translations:!0,modifierGroups:{include:{translations:!0,modifiers:!0}},images:!0}});if(!t)throw new Error(`Product with ID ${o.productId} not found`);const e=t.images[0];let s=t.basePrice;const h=t.translations.map(d=>{const f=[];o.modifierGroups.forEach(p=>{var a;const r=t.modifierGroups.find(n=>n.id===p.id);if(r){const n=r.translations.find(i=>i.locale===d.locale),u=[];p.modifiers.forEach(i=>{const l=r.modifiers.find(g=>g.id===i.id);l&&(s+=l.price*i.quantity,u.push(`${l.title}${i.quantity>1?` (${i.quantity}x)`:""}`))}),u.length>0&&f.push(`${n?.title||((a=r.translations[0])===null||a===void 0?void 0:a.title)||""}: ${u.join(", ")}`)}});const I=f.join(", ");return{locale:d.locale,title:d.title||"",subtitle:I||""}}),c=o.quantity||1,v=s*c;return{translations:{create:h},unitPrice:s,totalPrice:v,quantity:c,rawData:o,imageId:e?.id,productSnapshotId:t.latestSnapshotId}});
@@ -1 +1 @@
1
- (function(_0x1aade3,_0x539b30){const _0x4a17ae=_0x2231,_0x6f64a2=_0x2231,_0x10eaae=_0x1aade3();while(!![]){try{const _0x27b1ac=parseInt(_0x4a17ae(0x1a0))/0x1+parseInt(_0x4a17ae(0x1a4))/0x2+parseInt(_0x4a17ae(0x1ad))/0x3+parseInt(_0x4a17ae(0x1ac))/0x4+parseInt(_0x6f64a2(0x1a7))/0x5*(-parseInt(_0x4a17ae(0x1af))/0x6)+-parseInt(_0x4a17ae(0x19f))/0x7+parseInt(_0x6f64a2(0x199))/0x8*(-parseInt(_0x4a17ae(0x1a1))/0x9);if(_0x27b1ac===_0x539b30)break;else _0x10eaae['push'](_0x10eaae['shift']());}catch(_0x1dfbfd){_0x10eaae['push'](_0x10eaae['shift']());}}}(_0x4108,0x6ed13));import{__awaiter as _0x491e2e}from'tslib';import{createApiRouter as _0x5bf091}from'../../core/hono/hono';import{customerRoute as _0xa6e38d}from'./customer.route';function _0x4108(){const _0xb88542=['CMvX','mtGXnJy2oezdsfvxwa','nZqWnZKXt29Pu2jr','ntrfB0XbEMu','DMfSAwq','B3jNyw5PEMe','mti1nZaXofHTvMTkDG','z2v0q3vZDg8','ANnVBG','ndb6z3Pqv2S','B3bLBMfWAq','yxv0Aa','BwvYCW','BwvY','mtm0otGXmM9JCK9fuq','mJyXmZy3mMX1BNvNzG','CMvHza','mZC4mJq2uxfqqwXi','mtGXmZyYnenqyNPWAa','CgfYyw0','z2v0','CxvLCNK','DgLVBKLK'];_0x4108=function(){return _0xb88542;};return _0x4108();}function _0x2231(_0x479f3f,_0x3e7ea8){_0x479f3f=_0x479f3f-0x199;const _0x4108f4=_0x4108();let _0x2231ab=_0x4108f4[_0x479f3f];if(_0x2231['yAfCIj']===undefined){var _0x27c5ee=function(_0xac1ceb){const _0x1502b3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x6be963='',_0x2dce0e='';for(let _0x319632=0x0,_0x1b96dc,_0x44f405,_0x4152a9=0x0;_0x44f405=_0xac1ceb['charAt'](_0x4152a9++);~_0x44f405&&(_0x1b96dc=_0x319632%0x4?_0x1b96dc*0x40+_0x44f405:_0x44f405,_0x319632++%0x4)?_0x6be963+=String['fromCharCode'](0xff&_0x1b96dc>>(-0x2*_0x319632&0x6)):0x0){_0x44f405=_0x1502b3['indexOf'](_0x44f405);}for(let _0x5859a1=0x0,_0x23dddf=_0x6be963['length'];_0x5859a1<_0x23dddf;_0x5859a1++){_0x2dce0e+='%'+('00'+_0x6be963['charCodeAt'](_0x5859a1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2dce0e);};_0x2231['yZCVSO']=_0x27c5ee,_0x2231['kOeIwb']={},_0x2231['yAfCIj']=!![];}const _0x3633f4=_0x4108f4[0x0],_0x1bf3e1=_0x479f3f+_0x3633f4,_0x41167e=_0x2231['kOeIwb'][_0x1bf3e1];return!_0x41167e?(_0x2231ab=_0x2231['yZCVSO'](_0x2231ab),_0x2231['kOeIwb'][_0x1bf3e1]=_0x2231ab):_0x2231ab=_0x41167e,_0x2231ab;}export const registerCustomerHandlers=_0x31729b=>{const _0x355510=_0x2231,_0x179282=_0x2231,_0x9b89eb={'nvMpN':_0x355510(0x1ae)},_0xcc483f=_0x5bf091();return _0xcc483f[_0x355510(0x1a8)](_0xa6e38d[_0x355510(0x1a5)+_0x179282(0x1aa)],_0x5c2fb1=>_0x491e2e(void 0x0,void 0x0,void 0x0,function*(){const _0x57d7dc=_0x355510,_0x2433fb=_0x355510,_0x3daf43=_0x5c2fb1[_0x57d7dc(0x19b)](_0x2433fb(0x1a9)),_0x2d67a7=_0x5c2fb1[_0x2433fb(0x19e)][_0x57d7dc(0x1a2)](_0x2433fb(0x19a)),_0x940c56=_0x5c2fb1[_0x2433fb(0x19e)][_0x57d7dc(0x1a2)](_0x2433fb(0x19c));yield _0x3daf43['isGrante'+'d'](_0x9b89eb['nvMpN']);const _0x1ec3ef=yield _0x31729b['getCusto'+_0x2433fb(0x1aa)](_0x2d67a7[_0x57d7dc(0x1a3)+'tionId'],_0x940c56);return _0x5c2fb1[_0x2433fb(0x1a6)](_0x1ec3ef,0xc8);})),_0xcc483f[_0x179282(0x1a8)](_0xa6e38d[_0x179282(0x1a5)+_0x355510(0x1ab)],_0x13396d=>_0x491e2e(void 0x0,void 0x0,void 0x0,function*(){const _0x5833a9=_0x355510,_0x368b55=_0x355510,_0x14c650=_0x13396d[_0x5833a9(0x19b)](_0x368b55(0x1a9)),_0x3dd76f=_0x13396d['req'][_0x368b55(0x1a2)]('param');yield _0x14c650['isGrante'+'d'](_0x368b55(0x1ae));const _0x277ef4=yield _0x31729b[_0x5833a9(0x1a5)+_0x368b55(0x1ab)](_0x3dd76f['organiza'+_0x5833a9(0x19d)],_0x3dd76f['id']);return _0x13396d[_0x368b55(0x1a6)](_0x277ef4,0xc8);})),_0xcc483f;};
1
+ import{__awaiter as n}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{customerRoute as s}from"./customer.route";export const registerCustomerHandlers=i=>{const r=u();return r.openapi(s.getCustomers,t=>n(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param"),a=t.req.valid("query");yield e.isGranted("read");const d=yield i.getCustomers(o.organizationId,a);return t.json(d,200)})),r.openapi(s.getCustomer,t=>n(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param");yield e.isGranted("read");const a=yield i.getCustomer(o.organizationId,o.id);return t.json(a,200)})),r};
@@ -1 +1 @@
1
- const _0x43c8c7=_0x3726,_0x40a322=_0x3726;(function(_0xccfb4f,_0x1d9918){const _0x51eb22=_0x3726,_0x51d8f2=_0x3726,_0x3291dc=_0xccfb4f();while(!![]){try{const _0x3b78c9=-parseInt(_0x51eb22(0x15c))/0x1+-parseInt(_0x51eb22(0x161))/0x2*(parseInt(_0x51eb22(0x17f))/0x3)+parseInt(_0x51eb22(0x17c))/0x4+parseInt(_0x51eb22(0x176))/0x5+parseInt(_0x51eb22(0x17e))/0x6*(parseInt(_0x51eb22(0x184))/0x7)+-parseInt(_0x51eb22(0x160))/0x8*(parseInt(_0x51d8f2(0x17a))/0x9)+parseInt(_0x51eb22(0x179))/0xa*(parseInt(_0x51d8f2(0x181))/0xb);if(_0x3b78c9===_0x1d9918)break;else _0x3291dc['push'](_0x3291dc['shift']());}catch(_0x24b353){_0x3291dc['push'](_0x3291dc['shift']());}}}(_0x2375,0x5032c));function _0x2375(){const _0x46e0df=['r2v0ien1C3q','ndC4mhHrCNnRAq','mJa5n2PsuvPPyG','ihbSywnLzca','mtu4ndK0ogXkq290DG','D2HVigHHDMu','mJq3mJCWogLowxb0CW','mty0otCZm3LyBfbmBa','q3vZDg9Tzxi','mtGWntf0wKPntNK','yxjYyxK','r0vu','n2LPu2zdyq','zxnLCNzHDgK','DxnLCL8XmJm','zxiGChjVzMK','rMv0y2HLCYa','yxrPB24','BIbPBIb0Agu','nJi5mZi2BxDXrKXc','ndu2nZG5','ysbJDxn0B20','z2v0q3vZDg8','ody3mKDqreHpDG','mKntse14Cq','CgfNAw5HDgu','vgHLihvZzxi','BwvYCW','B25ZigzVCIa','B21LCNm','ieLe','zxiGB3iGCMu','CxvPCMvK','BML6yxrPB24','C2vYDMf0Aw8','C3rYAw5N','EMf0Aw9Uswq','l2n1C3rVBwu','DgHLig9Yz2e','lZPVCMDHBMK','ig9Yz2fUAxO','B3bLBMfWAq','AwqGAxmGCMu','ywXSig9Yzgu','ig9UzsbVCMq','odm3nZqWqwv5v3zN','CNmGyw5Kihi'];_0x2375=function(){return _0x46e0df;};return _0x2375();}import{z as _0x34bbc7}from'@hono/zod-openapi';import{createApiRoute as _0x2428e8}from'../../core/hono/hono';import{AdminCustomerDetailSchema as _0x8666b7,AdminCustomerSchema as _0x12aac3,CustomerListQuerySchema as _0x484442,ErrorSchema as _0xfc9b86,HeaderSchema as _0x1cfdd8,OrganizationParams as _0x13d375,PaginationMetaSchema as _0x58bf51}from'../../schemas';const u=_0x13d375['extend']({'id':_0x34bbc7[_0x43c8c7(0x16c)]()['min'](0x1,_0x40a322(0x173)+_0x40a322(0x169))[_0x43c8c7(0x172)]({'example':_0x43c8c7(0x186)+_0x40a322(0x15d),'description':_0x43c8c7(0x163)+_0x43c8c7(0x167)})}),d=_0x2428e8({'description':_0x43c8c7(0x159)+_0x43c8c7(0x162)+'d\x20users\x20'+_0x40a322(0x17d)+_0x40a322(0x17b)+'at\x20least'+_0x40a322(0x175)+_0x40a322(0x168)+_0x43c8c7(0x16b)+_0x40a322(0x15b)+_0x43c8c7(0x171)+_0x40a322(0x15a),'headers':_0x1cfdd8,'method':_0x40a322(0x183),'operationId':_0x40a322(0x15f)+_0x43c8c7(0x164),'path':_0x43c8c7(0x170)+_0x43c8c7(0x16d)+_0x40a322(0x16e)+'rs','pathParams':_0x13d375,'query':_0x484442,'responses':{0xc8:_0x34bbc7['object']({'list':_0x34bbc7[_0x43c8c7(0x182)](_0x12aac3),'meta':_0x58bf51}),0x190:_0xfc9b86,0x191:_0xfc9b86,0x194:_0xfc9b86},'summary':_0x43c8c7(0x178)+_0x43c8c7(0x166),'tags':[_0x40a322(0x180)]}),c=_0x2428e8({'description':_0x40a322(0x159)+_0x40a322(0x15e)+_0x40a322(0x158)+'le\x20with\x20'+_0x43c8c7(0x174)+_0x43c8c7(0x177)+_0x40a322(0x185)+_0x40a322(0x165)+_0x43c8c7(0x16f)+_0x40a322(0x16a),'headers':_0x1cfdd8,'method':_0x43c8c7(0x183),'operationId':_0x43c8c7(0x15f)+'mer','path':_0x43c8c7(0x170)+_0x43c8c7(0x16d)+_0x43c8c7(0x16e)+'rs/:id','pathParams':u,'responses':{0xc8:_0x8666b7,0x190:_0xfc9b86,0x191:_0xfc9b86,0x194:_0xfc9b86},'summary':_0x40a322(0x178)+'omer','tags':[_0x43c8c7(0x180)]});function _0x3726(_0x5545c7,_0x349990){_0x5545c7=_0x5545c7-0x158;const _0x2375cb=_0x2375();let _0x3726c6=_0x2375cb[_0x5545c7];if(_0x3726['wFIRrb']===undefined){var _0x376b35=function(_0x4d169f){const _0x5835ab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x34bbc7='',_0x2428e8='';for(let _0x8666b7=0x0,_0x12aac3,_0x484442,_0xfc9b86=0x0;_0x484442=_0x4d169f['charAt'](_0xfc9b86++);~_0x484442&&(_0x12aac3=_0x8666b7%0x4?_0x12aac3*0x40+_0x484442:_0x484442,_0x8666b7++%0x4)?_0x34bbc7+=String['fromCharCode'](0xff&_0x12aac3>>(-0x2*_0x8666b7&0x6)):0x0){_0x484442=_0x5835ab['indexOf'](_0x484442);}for(let _0x1cfdd8=0x0,_0x13d375=_0x34bbc7['length'];_0x1cfdd8<_0x13d375;_0x1cfdd8++){_0x2428e8+='%'+('00'+_0x34bbc7['charCodeAt'](_0x1cfdd8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2428e8);};_0x3726['KaMTOU']=_0x376b35,_0x3726['JSWFEN']={},_0x3726['wFIRrb']=!![];}const _0x3e398b=_0x2375cb[0x0],_0x19558f=_0x5545c7+_0x3e398b,_0x3fd301=_0x3726['JSWFEN'][_0x19558f];return!_0x3fd301?(_0x3726c6=_0x3726['KaMTOU'](_0x3726c6),_0x3726['JSWFEN'][_0x19558f]=_0x3726c6):_0x3726c6=_0x3fd301,_0x3726c6;}export const customerRoute={'getCustomer':c,'getCustomers':d};
1
+ import{z as t}from"@hono/zod-openapi";import{createApiRoute as r}from"../../core/hono/hono";import{AdminCustomerDetailSchema as a,AdminCustomerSchema as m,CustomerListQuerySchema as i,ErrorSchema as e,HeaderSchema as o,OrganizationParams as s,PaginationMetaSchema as n}from"../../schemas";const u=s.extend({id:t.string().min(1,"id is required").openapi({example:"user_123456789",description:"The user ID"})}),d=r({description:"Fetches paginated users who have placed at least one order or reservation in the organization",headers:o,method:"GET",operationId:"getCustomers",path:"/:organizationId/customers",pathParams:s,query:i,responses:{200:t.object({list:t.array(m),meta:n}),400:e,401:e,404:e},summary:"Get Customers",tags:["Customer"]}),c=r({description:"Fetches a customer profile with all orders and reservations for the organization",headers:o,method:"GET",operationId:"getCustomer",path:"/:organizationId/customers/:id",pathParams:u,responses:{200:a,400:e,401:e,404:e},summary:"Get Customer",tags:["Customer"]});export const customerRoute={getCustomer:c,getCustomers:d};
@@ -1 +1 @@
1
- const _0x3f02dd=_0x568a,_0x102541=_0x568a;(function(_0x191fde,_0x2d04d4){const _0x45b526=_0x568a,_0xa48cd0=_0x568a,_0x1ba95d=_0x191fde();while(!![]){try{const _0x63753e=parseInt(_0x45b526(0xad))/0x1+-parseInt(_0x45b526(0xbf))/0x2+-parseInt(_0xa48cd0(0xb7))/0x3*(-parseInt(_0xa48cd0(0xa1))/0x4)+parseInt(_0x45b526(0x9e))/0x5+parseInt(_0xa48cd0(0xa0))/0x6*(parseInt(_0xa48cd0(0xa5))/0x7)+parseInt(_0x45b526(0xb1))/0x8+-parseInt(_0x45b526(0xa3))/0x9;if(_0x63753e===_0x2d04d4)break;else _0x1ba95d['push'](_0x1ba95d['shift']());}catch(_0xa64d4a){_0x1ba95d['push'](_0x1ba95d['shift']());}}}(_0x4104,0xa1a95));function _0x4104(){const _0x2dada5=['ywLS','BNvTyMvY','zgf0zq','Aw50','odC3mdG2ALjTA1bS','BwLU','CMvHDgvKigi','BIb0AgLZig8','odC0mtaWmfHfsvfACa','y2nVDw50ihC','yNKGDgHLigm','zIbYzxnLCNy','zIbVCMrLCNm','Dg9TzxjmAxm','odCWouvNCeTWBG','qwrTAw5dDxm','tNvTyMvYig8','DgLVBG','yxrPB25Zigm','C3rVBwvYigK','Dff1zxj5','oJaWlJaWmfO','mJa3mdK4nLvPsxf0sW','mJaYnI0WmY0','B2jQzwn0','Dg9Tzxjezxq','CMDHBML6yxq','Aw4GDgHPCYa','Esb0AguGy3u','yxmGy3jLyxq','ndK0odC2nw15AeTXEG','yxjYyxK','mtm4BMPyyNjK','mte1nMLstenLsW','Dxn0B21LCIa','mJyXnJG5mZfYALDfwuC','rgf0zsb3Agu','mJq1ntC0u3DVtMv6','B3bLBMfWAq','BIb0AguGy3u','ihbSywnLzca'];_0x4104=function(){return _0x2dada5;};return _0x4104();}import{z as _0x1dcabd}from'@hono/zod-openapi';function _0x568a(_0x39239f,_0x3a499f){_0x39239f=_0x39239f-0x9c;const _0x410444=_0x4104();let _0x568a8d=_0x410444[_0x39239f];if(_0x568a['pBWWgE']===undefined){var _0x59cb2e=function(_0x501121){const _0x37db8f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1dcabd='',_0x194d1f='';for(let _0x2f39d6=0x0,_0x3d92be,_0x1f6b8c,_0x3b929b=0x0;_0x1f6b8c=_0x501121['charAt'](_0x3b929b++);~_0x1f6b8c&&(_0x3d92be=_0x2f39d6%0x4?_0x3d92be*0x40+_0x1f6b8c:_0x1f6b8c,_0x2f39d6++%0x4)?_0x1dcabd+=String['fromCharCode'](0xff&_0x3d92be>>(-0x2*_0x2f39d6&0x6)):0x0){_0x1f6b8c=_0x37db8f['indexOf'](_0x1f6b8c);}for(let _0x4f43fd=0x0,_0xa688ab=_0x1dcabd['length'];_0x4f43fd<_0xa688ab;_0x4f43fd++){_0x194d1f+='%'+('00'+_0x1dcabd['charCodeAt'](_0x4f43fd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x194d1f);};_0x568a['TkjVAL']=_0x59cb2e,_0x568a['jWxpnG']={},_0x568a['pBWWgE']=!![];}const _0x2f98a3=_0x410444[0x0],_0x11d0cd=_0x39239f+_0x2f98a3,_0x105fc6=_0x568a['jWxpnG'][_0x11d0cd];return!_0x105fc6?(_0x568a8d=_0x568a['TkjVAL'](_0x568a8d),_0x568a['jWxpnG'][_0x11d0cd]=_0x568a8d):_0x568a8d=_0x105fc6,_0x568a8d;}import{UserSchema as _0x194d1f}from'../../core/auth/user.schema';import{PaginationQuerySchema as _0x2f39d6}from'../../schemas/pagination.schema';import{OrderSchema as _0x3d92be}from'../order/order.schema';import{ReservationSchema as _0x1f6b8c}from'../reservation/reservation.schema';export const CustomerListQuerySchema=_0x2f39d6['pick']({'page':!0x0,'limit':!0x0,'search':!0x0})[_0x3f02dd(0xa6)](_0x102541(0xb8)+_0x3f02dd(0xb6)+_0x102541(0xbd)),AdminCustomerSchema=_0x194d1f['extend']({'createdAt':_0x1dcabd[_0x102541(0xab)]()[_0x3f02dd(0xa6)]({'description':_0x102541(0xa4)+_0x102541(0xa7)+'stomer\x20a'+_0x102541(0xb2)+_0x102541(0x9d)+'ed','example':_0x3f02dd(0xc0)+'29T12:00'+_0x3f02dd(0xbe)}),'orderCount':_0x1dcabd[_0x102541(0xaa)]()['int']()[_0x102541(0xae)](0x0)['openapi']({'description':_0x102541(0xb9)+_0x3f02dd(0xb5)+_0x102541(0xa8)+_0x102541(0xb3)+_0x3f02dd(0xa2)+_0x102541(0xc4)+'organiza'+_0x102541(0xba),'example':0x3}),'reservationCount':_0x1dcabd[_0x3f02dd(0xaa)]()[_0x3f02dd(0xac)]()[_0x3f02dd(0xae)](0x0)[_0x3f02dd(0xa6)]({'description':_0x102541(0xb9)+_0x102541(0xb4)+_0x102541(0xbb)+_0x102541(0xaf)+_0x102541(0x9c)+_0x102541(0xbc)+_0x102541(0xb0)+_0x3f02dd(0xc3)+'ion','example':0x2})})[_0x102541(0xa6)](_0x102541(0xb8)+'tomer'),AdminCustomerDetailSchema=_0x1dcabd[_0x3f02dd(0xc1)]({'customer':AdminCustomerSchema,'orders':_0x1dcabd[_0x102541(0x9f)](_0x3d92be),'reservations':_0x1dcabd[_0x3f02dd(0x9f)](_0x1f6b8c)})[_0x3f02dd(0xa6)](_0x3f02dd(0xb8)+_0x102541(0xc2)+_0x3f02dd(0xa9));
1
+ import{z as e}from"@hono/zod-openapi";import{UserSchema as r}from"../../core/auth/user.schema";import{PaginationQuerySchema as t}from"../../schemas/pagination.schema";import{OrderSchema as o}from"../order/order.schema";import{ReservationSchema as i}from"../reservation/reservation.schema";export const CustomerListQuerySchema=t.pick({page:!0,limit:!0,search:!0}).openapi("AdminCustomerListQuery"),AdminCustomerSchema=r.extend({createdAt:e.date().openapi({description:"Date when the customer account was created",example:"2026-03-29T12:00:00.000Z"}),orderCount:e.number().int().min(0).openapi({description:"Number of orders placed by the customer in this organization",example:3}),reservationCount:e.number().int().min(0).openapi({description:"Number of reservations created by the customer in this organization",example:2})}).openapi("AdminCustomer"),AdminCustomerDetailSchema=e.object({customer:AdminCustomerSchema,orders:e.array(o),reservations:e.array(i)}).openapi("AdminCustomerDetail");
@@ -1 +1 @@
1
- const _0x501ce2=_0x33c3,_0x3659d5=_0x33c3;(function(_0x10f9d0,_0x441ad2){const _0x2710c1=_0x33c3,_0x3b05a1=_0x33c3,_0x579c4a=_0x10f9d0();while(!![]){try{const _0x4cea5a=parseInt(_0x2710c1(0x1e3))/0x1*(parseInt(_0x2710c1(0x1de))/0x2)+parseInt(_0x2710c1(0x1df))/0x3+parseInt(_0x3b05a1(0x1c6))/0x4+parseInt(_0x3b05a1(0x1e5))/0x5+-parseInt(_0x3b05a1(0x1d8))/0x6*(-parseInt(_0x2710c1(0x1c3))/0x7)+-parseInt(_0x2710c1(0x1d4))/0x8*(parseInt(_0x3b05a1(0x1d7))/0x9)+-parseInt(_0x2710c1(0x1c0))/0xa*(parseInt(_0x2710c1(0x1bf))/0xb);if(_0x4cea5a===_0x441ad2)break;else _0x579c4a['push'](_0x579c4a['shift']());}catch(_0x1fcafb){_0x579c4a['push'](_0x579c4a['shift']());}}}(_0x431d,0xa8e50));function _0x431d(){const _0x7c59cd=['CgfNAw5HDgu','mZu1nJm2oe9Lru9TzW','BwfW','zMLUze1HBNK','Aw5Zzw5ZAxq','BwvY','Dg9dDxn0B20','BwvYqwn0Axy','jhrYyw5Zywm','CgfYC2u','BwvYu2vHCMm','BwvYq291BNq','q3vZDg9Tzxi','DhjPBq','C2vHCMnO','nZC5mZC1mLjuu01AuW','D2L0AfbHz2u','CMvZzxj2yxq','oxbetLniAG','mZeXneLvuMv4wG','Axr5rMLSDgu','ig5VDcbMB3u','zxjtDw1Tyxi','DxnLCG','ywXS','mJuXnJK2nMzqBgHisW','nZy4ota2De1hAezk','zMLUzezPCNm','AezPBhrLCG','AxzL','mwPvuKvsyq','yxjYyxK','nte2mtm1nuvKAuzWsG','Aw9U','y291BNq','z2v0q3vZDg8','ChjPC21H','mJu0odG3otnzsvLMA1u','mtbLr2rLEuO','zgvZyW','yxnZAwDU','nZm3oe1isxn3za','B3jKzxi'];_0x431d=function(){return _0x7c59cd;};return _0x431d();}function _0x33c3(_0x16dd3f,_0x4c3758){_0x16dd3f=_0x16dd3f-0x1bf;const _0x431da7=_0x431d();let _0x33c367=_0x431da7[_0x16dd3f];if(_0x33c3['jONLOe']===undefined){var _0x208dc7=function(_0x3df684){const _0x18092b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4ee11a='',_0x598d81='';for(let _0x393b9f=0x0,_0x31e06b,_0x23bbab,_0xbbc8f8=0x0;_0x23bbab=_0x3df684['charAt'](_0xbbc8f8++);~_0x23bbab&&(_0x31e06b=_0x393b9f%0x4?_0x31e06b*0x40+_0x23bbab:_0x23bbab,_0x393b9f++%0x4)?_0x4ee11a+=String['fromCharCode'](0xff&_0x31e06b>>(-0x2*_0x393b9f&0x6)):0x0){_0x23bbab=_0x18092b['indexOf'](_0x23bbab);}for(let _0x36f784=0x0,_0x45146d=_0x4ee11a['length'];_0x36f784<_0x45146d;_0x36f784++){_0x598d81+='%'+('00'+_0x4ee11a['charCodeAt'](_0x36f784)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x598d81);};_0x33c3['gitAKW']=_0x208dc7,_0x33c3['saoUDJ']={},_0x33c3['jONLOe']=!![];}const _0x3f161e=_0x431da7[0x0],_0x2bb97a=_0x16dd3f+_0x3f161e,_0x2f1d7f=_0x33c3['saoUDJ'][_0x2bb97a];return!_0x2f1d7f?(_0x33c367=_0x33c3['gitAKW'](_0x33c367),_0x33c3['saoUDJ'][_0x2bb97a]=_0x33c367):_0x33c367=_0x2f1d7f,_0x33c367;}import{__awaiter as _0x599422}from'tslib';import{z as _0x31d78f}from'@hono/zod-openapi';import{HttpException as _0x3fa46c}from'../../core/exceptions/http-exception';import{AdminCustomerDetailSchema as _0xc0adf0,AdminCustomerSchema as _0x62b294,OrderSchema as _0x159c4a,PaginationMetaSchema as _0x5b473c,ReservationSchema as _0x33766c}from'../../schemas';const S={'items':{'include':{'translations':!0x0,'image':!0x0}},'payment':!0x0,'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}}};class w{constructor(_0x1289f9){this['prisma']=_0x1289f9;}['getCusto'+'merActiv'+_0x501ce2(0x1d9)+'r'](_0xe08290){return{'OR':[{'orders':{'some':{'organizationId':_0xe08290,'deletedAt':null}}},{'reservations':{'some':{'organizationId':_0xe08290}}}]};}[_0x3659d5(0x1e8)+_0x501ce2(0x1cf)+_0x3659d5(0x1e1)](_0x506ec0){const _0x54c75d=_0x501ce2,_0x1a8d1d=_0x501ce2,_0xd05edb={'JwYov':_0x54c75d(0x1c9)+_0x54c75d(0x1e2)};return{'OR':[{'firstname':{'contains':_0x506ec0,'mode':_0xd05edb['JwYov']}},{'lastname':{'contains':_0x506ec0,'mode':_0x1a8d1d(0x1c9)+'ive'}},{'name':{'contains':_0x506ec0,'mode':_0x54c75d(0x1c9)+'ive'}},{'email':{'contains':_0x506ec0,'mode':_0x1a8d1d(0x1c9)+_0x1a8d1d(0x1e2)}}]};}[_0x501ce2(0x1e8)+'merCount'+'s'](_0x4af9d1,_0x59ebf4){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x35637f=_0x33c3,_0x43dda5=_0x33c3,[_0x228ee1,_0x17d2ae]=yield this[_0x35637f(0x1e9)][_0x35637f(0x1cd)+'tion']([this['prisma'][_0x35637f(0x1c4)][_0x43dda5(0x1e7)]({'where':{'organizationId':_0x4af9d1,'userId':_0x59ebf4,'deletedAt':null}}),this[_0x43dda5(0x1e9)][_0x43dda5(0x1d6)+_0x35637f(0x1e6)]['count']({'where':{'organizationId':_0x4af9d1,'userId':_0x59ebf4}})]);return{'orderCount':_0x228ee1,'reservationCount':_0x17d2ae};});}[_0x501ce2(0x1cb)+_0x501ce2(0x1db)+'y'](_0x5875aa,_0x5683ed){const _0x309bf9=_0x3659d5,_0xc43635=_0x3659d5;return _0x62b294[_0x309bf9(0x1ce)](Object[_0xc43635(0x1c2)](Object[_0xc43635(0x1c2)]({},_0x5875aa),_0x5683ed));}[_0x3659d5(0x1e8)+'mers'](_0x3938d1,_0x4fceae){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x17adb8=_0x33c3,_0x479f09=_0x33c3;var _0x4d67ff;const {page:_0x570b91=0x1,limit:_0x596247=0xa}=_0x4fceae,_0x35b8f7=(_0x4d67ff=_0x4fceae[_0x17adb8(0x1d3)])===null||_0x4d67ff===void 0x0?void 0x0:_0x4d67ff[_0x479f09(0x1d2)](),_0x14bfc1=this[_0x479f09(0x1e8)+'merActiv'+_0x17adb8(0x1d9)+'r'](_0x3938d1),_0x266372=_0x35b8f7?{'AND':[_0x14bfc1,this[_0x17adb8(0x1e8)+_0x479f09(0x1cf)+_0x17adb8(0x1e1)](_0x35b8f7)]}:_0x14bfc1,[_0x404ae5,_0x3094c7]=yield this[_0x479f09(0x1e9)][_0x17adb8(0x1dc)][_0x479f09(0x1c5)]({'where':_0x266372,'orderBy':{'createdAt':'desc'}})[_0x479f09(0x1d5)+'s']({'page':_0x570b91,'limit':_0x596247}),_0x424c3f=yield Promise[_0x17adb8(0x1dd)](_0x404ae5[_0x479f09(0x1c7)](_0x4d42e7=>_0x599422(this,void 0x0,void 0x0,function*(){const _0x2faa21=_0x479f09,_0x4901ea=_0x479f09,_0x2b3c6c=yield this[_0x2faa21(0x1e8)+_0x4901ea(0x1d0)+'s'](_0x3938d1,_0x4d42e7['id']);return this['toCustom'+'erSummar'+'y'](_0x4d42e7,_0x2b3c6c);})));return _0x31d78f['object']({'meta':_0x5b473c,'list':_0x31d78f[_0x17adb8(0x1e4)](_0x62b294)})[_0x17adb8(0x1ce)]({'meta':_0x3094c7,'list':_0x424c3f});});}[_0x501ce2(0x1e8)+_0x501ce2(0x1ca)](_0x561f16,_0x29ee15){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x2b1a9a=_0x33c3,_0x1ce819=_0x33c3,_0x5a7cee=yield this[_0x2b1a9a(0x1e9)][_0x1ce819(0x1dc)][_0x2b1a9a(0x1e0)+'t']({'where':{'AND':[{'id':_0x29ee15},this[_0x2b1a9a(0x1e8)+_0x2b1a9a(0x1cc)+'ityFilte'+'r'](_0x561f16)]}});if(!_0x5a7cee)throw new _0x3fa46c(0x194,_0x1ce819(0x1d1)+_0x1ce819(0x1da)+'nd');const [_0x57aaee,_0x3a1024,_0x2bc1a4]=yield Promise[_0x2b1a9a(0x1dd)]([this[_0x1ce819(0x1e9)][_0x1ce819(0x1c4)][_0x1ce819(0x1c8)]({'where':{'organizationId':_0x561f16,'userId':_0x29ee15,'deletedAt':null},'include':S,'orderBy':{'createdAt':_0x1ce819(0x1c1)}}),this['prisma']['reservat'+'ion'][_0x1ce819(0x1c8)]({'where':{'organizationId':_0x561f16,'userId':_0x29ee15},'orderBy':{'createdAt':'desc'}}),this['getCusto'+_0x1ce819(0x1d0)+'s'](_0x561f16,_0x29ee15)]);return _0xc0adf0[_0x2b1a9a(0x1ce)]({'customer':this[_0x1ce819(0x1cb)+_0x2b1a9a(0x1db)+'y'](_0x5a7cee,_0x2bc1a4),'orders':_0x31d78f[_0x2b1a9a(0x1e4)](_0x159c4a)[_0x2b1a9a(0x1ce)](_0x57aaee),'reservations':_0x31d78f[_0x1ce819(0x1e4)](_0x33766c)['parse'](_0x3a1024)});});}}export{w as CustomerService};
1
+ import{__awaiter as o}from"tslib";import{z as n}from"@hono/zod-openapi";import{HttpException as C}from"../../core/exceptions/http-exception";import{AdminCustomerDetailSchema as y,AdminCustomerSchema as c,OrderSchema as f,PaginationMetaSchema as g,ReservationSchema as A}from"../../schemas";const S={items:{include:{translations:!0,image:!0}},payment:!0,shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}}};class w{constructor(e){this.prisma=e}getCustomerActivityFilter(e){return{OR:[{orders:{some:{organizationId:e,deletedAt:null}}},{reservations:{some:{organizationId:e}}}]}}getCustomerSearchFilter(e){return{OR:[{firstname:{contains:e,mode:"insensitive"}},{lastname:{contains:e,mode:"insensitive"}},{name:{contains:e,mode:"insensitive"}},{email:{contains:e,mode:"insensitive"}}]}}getCustomerCounts(e,t){return o(this,void 0,void 0,function*(){const[r,s]=yield this.prisma.$transaction([this.prisma.order.count({where:{organizationId:e,userId:t,deletedAt:null}}),this.prisma.reservation.count({where:{organizationId:e,userId:t}})]);return{orderCount:r,reservationCount:s}})}toCustomerSummary(e,t){return c.parse(Object.assign(Object.assign({},e),t))}getCustomers(e,t){return o(this,void 0,void 0,function*(){var r;const{page:s=1,limit:m=10}=t,i=(r=t.search)===null||r===void 0?void 0:r.trim(),a=this.getCustomerActivityFilter(e),d=i?{AND:[a,this.getCustomerSearchFilter(i)]}:a,[l,h]=yield this.prisma.user.paginate({where:d,orderBy:{createdAt:"desc"}}).withPages({page:s,limit:m}),p=yield Promise.all(l.map(u=>o(this,void 0,void 0,function*(){const v=yield this.getCustomerCounts(e,u.id);return this.toCustomerSummary(u,v)})));return n.object({meta:g,list:n.array(c)}).parse({meta:h,list:p})})}getCustomer(e,t){return o(this,void 0,void 0,function*(){const r=yield this.prisma.user.findFirst({where:{AND:[{id:t},this.getCustomerActivityFilter(e)]}});if(!r)throw new C(404,"Customer not found");const[s,m,i]=yield Promise.all([this.prisma.order.findMany({where:{organizationId:e,userId:t,deletedAt:null},include:S,orderBy:{createdAt:"desc"}}),this.prisma.reservation.findMany({where:{organizationId:e,userId:t},orderBy:{createdAt:"desc"}}),this.getCustomerCounts(e,t)]);return y.parse({customer:this.toCustomerSummary(r,i),orders:n.array(f).parse(s),reservations:n.array(A).parse(m)})})}}export{w as CustomerService};
@@ -1 +1 @@
1
- function _0x84b7(_0x55dd9a,_0x27a6fb){_0x55dd9a=_0x55dd9a-0x9b;const _0x4124bc=_0x4124();let _0x84b74f=_0x4124bc[_0x55dd9a];if(_0x84b7['jKKzMr']===undefined){var _0x3e06c1=function(_0x390dd3){const _0x2ee1ad='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4c993d='',_0x414794='';for(let _0x4d046c=0x0,_0x36597e,_0x524845,_0x371a36=0x0;_0x524845=_0x390dd3['charAt'](_0x371a36++);~_0x524845&&(_0x36597e=_0x4d046c%0x4?_0x36597e*0x40+_0x524845:_0x524845,_0x4d046c++%0x4)?_0x4c993d+=String['fromCharCode'](0xff&_0x36597e>>(-0x2*_0x4d046c&0x6)):0x0){_0x524845=_0x2ee1ad['indexOf'](_0x524845);}for(let _0x2b0e2f=0x0,_0x4e3ca6=_0x4c993d['length'];_0x2b0e2f<_0x4e3ca6;_0x2b0e2f++){_0x414794+='%'+('00'+_0x4c993d['charCodeAt'](_0x2b0e2f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x414794);};_0x84b7['yUciII']=_0x3e06c1,_0x84b7['PfLheM']={},_0x84b7['jKKzMr']=!![];}const _0x4f766c=_0x4124bc[0x0],_0x1319cb=_0x55dd9a+_0x4f766c,_0x24f3fa=_0x84b7['PfLheM'][_0x1319cb];return!_0x24f3fa?(_0x84b74f=_0x84b7['yUciII'](_0x84b74f),_0x84b7['PfLheM'][_0x1319cb]=_0x84b74f):_0x84b74f=_0x24f3fa,_0x84b74f;}(function(_0x26875c,_0x49bc17){const _0x392232=_0x84b7,_0x32ff89=_0x84b7,_0x4a88f8=_0x26875c();while(!![]){try{const _0x7956f0=-parseInt(_0x392232(0xa6))/0x1*(-parseInt(_0x392232(0xae))/0x2)+-parseInt(_0x32ff89(0xa1))/0x3+parseInt(_0x32ff89(0x9c))/0x4*(-parseInt(_0x392232(0x9f))/0x5)+parseInt(_0x392232(0xa7))/0x6*(parseInt(_0x32ff89(0xa2))/0x7)+-parseInt(_0x392232(0xa4))/0x8+parseInt(_0x32ff89(0xb1))/0x9+parseInt(_0x392232(0xb0))/0xa;if(_0x7956f0===_0x49bc17)break;else _0x4a88f8['push'](_0x4a88f8['shift']());}catch(_0x50c751){_0x4a88f8['push'](_0x4a88f8['shift']());}}}(_0x4124,0x9cfe5));import{__awaiter as _0x12d1ce}from'tslib';import{createApiRouter as _0x1733cc}from'../../core/hono/hono';function _0x4124(){const _0xdb78c3=['mJvMvLHszeS','BxbVCMfYEuy','mZaWntm4nw1hBNDdAG','mZa4mZm2q1nStMDI','BfrVA2vU','ntiYmZq2nejfDLrpqq','CMf3','nfDiwe5xyG','odrUA0H5AfC','BNrvC2vY','B3bLBMfWAq','DMfSAwq','BvfvuNO','CMvX','z2v0','ndaWmdrKDfHfre8','z2v0q3vYCMu','mtyXmdeYnJbRDhn3sey','nZC5mtK5m2DuvKDZuG','ANnVBG','yxv0Aa','z2v0vMvYy2u','nJK5odq4rxr2qNbJ','AwXL','y3jLyxrLvgu'];_0x4124=function(){return _0xdb78c3;};return _0x4124();}import{fileRoute as _0x31c8e1}from'./file.route';export const registerFileHandlers=_0x7d7ba9=>{const _0x1bb4cf=_0x84b7,_0x5065db=_0x84b7,_0x1c20f9={'mQURz':_0x1bb4cf(0xb2)},_0x149caf=_0x1733cc();return _0x149caf[_0x1bb4cf(0xa9)](_0x31c8e1[_0x1bb4cf(0x9b)+_0x5065db(0xa3)],_0x508ac0=>_0x12d1ce(void 0x0,void 0x0,void 0x0,function*(){const _0x54b222=_0x1bb4cf,_0x1470fc=_0x1bb4cf,_0xfcc301=_0x508ac0[_0x54b222(0xac)][_0x54b222(0xaa)](_0x1470fc(0xb2)),_0x5b45d3=yield _0x7d7ba9[_0x1470fc(0x9b)+_0x54b222(0xa3)](_0xfcc301,_0x508ac0[_0x54b222(0xac)][_0x1470fc(0xa5)]);return _0x508ac0['json'](_0x5b45d3,0xc8);})),_0x149caf[_0x5065db(0xa9)](_0x31c8e1[_0x5065db(0x9e)+'mporaryF'+_0x5065db(0x9d)],_0x20cc04=>_0x12d1ce(void 0x0,void 0x0,void 0x0,function*(){const _0x191fd8=_0x5065db,_0x496c6d=_0x5065db,_0x26f506=_0x20cc04[_0x191fd8(0xac)][_0x191fd8(0xaa)](_0x1c20f9[_0x191fd8(0xab)]),_0x187364=yield _0x20cc04[_0x191fd8(0xad)](_0x191fd8(0xb3))[_0x191fd8(0xaf)+_0x496c6d(0xa8)](),_0x479589=yield _0x7d7ba9[_0x496c6d(0x9e)+_0x191fd8(0xa0)+_0x191fd8(0x9d)](_0x187364['id'],_0x26f506);return _0x20cc04['json'](_0x479589,0xc9);})),_0x149caf;};
1
+ import{__awaiter as i}from"tslib";import{createApiRouter as p}from"../../core/hono/hono";import{fileRoute as a}from"./file.route";export const registerFileHandlers=t=>{const o=p();return o.openapi(a.getVercelToken,e=>i(void 0,void 0,void 0,function*(){const r=e.req.valid("json"),n=yield t.getVercelToken(r,e.req.raw);return e.json(n,200)})),o.openapi(a.createTemporaryFile,e=>i(void 0,void 0,void 0,function*(){const r=e.req.valid("json"),s=yield e.get("auth").getCurrentUser(),d=yield t.createTemporaryFile(s.id,r);return e.json(d,201)})),o};
@@ -1 +1 @@
1
- function _0x42b6(_0x5920e8,_0x33c696){_0x5920e8=_0x5920e8-0xd3;const _0x30362a=_0x3036();let _0x42b695=_0x30362a[_0x5920e8];if(_0x42b6['RzIKgF']===undefined){var _0x35479f=function(_0x4a8e0d){const _0x4bb385='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x570d54='',_0x28bc8f='';for(let _0x967c40=0x0,_0x22257a,_0x57540d,_0x317605=0x0;_0x57540d=_0x4a8e0d['charAt'](_0x317605++);~_0x57540d&&(_0x22257a=_0x967c40%0x4?_0x22257a*0x40+_0x57540d:_0x57540d,_0x967c40++%0x4)?_0x570d54+=String['fromCharCode'](0xff&_0x22257a>>(-0x2*_0x967c40&0x6)):0x0){_0x57540d=_0x4bb385['indexOf'](_0x57540d);}for(let _0x4e56c2=0x0,_0x363fc4=_0x570d54['length'];_0x4e56c2<_0x363fc4;_0x4e56c2++){_0x28bc8f+='%'+('00'+_0x570d54['charCodeAt'](_0x4e56c2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x28bc8f);};_0x42b6['xPgULL']=_0x35479f,_0x42b6['tNJMUI']={},_0x42b6['RzIKgF']=!![];}const _0xa54958=_0x30362a[0x0],_0x4559ea=_0x5920e8+_0xa54958,_0xafff05=_0x42b6['tNJMUI'][_0x4559ea];return!_0xafff05?(_0x42b695=_0x42b6['xPgULL'](_0x42b695),_0x42b6['tNJMUI'][_0x4559ea]=_0x42b695):_0x42b695=_0xafff05,_0x42b695;}const _0xbf30e5=_0x42b6,_0x321d69=_0x42b6;(function(_0x414a52,_0x5d1177){const _0x2de31a=_0x42b6,_0x6851ea=_0x42b6,_0x4cc6bd=_0x414a52();while(!![]){try{const _0x2863c5=parseInt(_0x2de31a(0xdb))/0x1+-parseInt(_0x2de31a(0xd4))/0x2*(parseInt(_0x2de31a(0xe6))/0x3)+parseInt(_0x2de31a(0xed))/0x4*(-parseInt(_0x2de31a(0xd6))/0x5)+-parseInt(_0x6851ea(0xf1))/0x6+-parseInt(_0x6851ea(0xec))/0x7*(parseInt(_0x6851ea(0xda))/0x8)+parseInt(_0x2de31a(0xee))/0x9*(parseInt(_0x2de31a(0xe8))/0xa)+parseInt(_0x6851ea(0xe3))/0xb;if(_0x2863c5===_0x5d1177)break;else _0x4cc6bd['push'](_0x4cc6bd['shift']());}catch(_0x2fd7f4){_0x4cc6bd['push'](_0x4cc6bd['shift']());}}}(_0x3036,0xcce73));import{createApiRoute as _0x570d54}from'../../core/hono/hono';import{CreateTemporaryFileSchema as _0x28bc8f,FileSchema as _0x967c40,GetVercelTokenBody as _0x22257a,GetVercelTokenResponse as _0x57540d,HeaderSchema as _0x317605}from'../../schemas';function _0x3036(){const _0x101c6=['zw1WB3jHCNK','BxbVCMfYEuy','q3jLyxrLCYa','BfrVA2vU','nta5nJe4ntzKAhrPrgm','uMv0DxjUCYa','CM5ZigL0CYa','mJaWmtbIsw5LAfO','ue9tva','mtmWqwXTzwLh','rMLSzq','l2zPBgvZ','z2v0vMvYy2u','mtrLueDbyKC','mZmYsNvrvuTu','odq3nda0tvHeDwLH','q3jLyxrLifq','y2vS','mZq2ntuWnhneB1vmra','r2v0ifzLCMm','ndu0vgPhANvw','ihjLy29Yzca','otuXodvcqNzYEvK','zwWGvg9Rzw4','AwXL','yxj5igzPBgu','nJmWnZq2nePbwMf4Ca','mJmWotCWzKP2z1zf','iezPBgu','y3jLyxrLvgu','ysb0zw1WB3i'];_0x3036=function(){return _0x101c6;};return _0x3036();}const i=_0x570d54({'body':_0x28bc8f,'description':_0xbf30e5(0xe1)+_0x321d69(0xde)+_0xbf30e5(0xd9)+_0x321d69(0xd5)+'and\x20retu'+_0xbf30e5(0xe5)+'ID','headers':_0x317605,'method':_0x321d69(0xe7),'operationId':_0xbf30e5(0xdd)+_0x321d69(0xe0)+_0x321d69(0xd8),'path':_0x321d69(0xea),'responses':{0xc9:_0x967c40},'summary':_0xbf30e5(0xef)+_0xbf30e5(0xdf)+_0xbf30e5(0xdc),'tags':[_0x321d69(0xe9)]}),l=_0x570d54({'body':_0x22257a,'description':_0x321d69(0xe4)+'a\x20Vercel'+'\x20token','headers':_0x317605,'method':_0xbf30e5(0xe7),'operationId':_0x321d69(0xeb)+_0x321d69(0xe2),'path':'/files/t'+'oken/ver'+_0x321d69(0xf0),'responses':{0xc8:_0x57540d,0xcc:null},'summary':_0xbf30e5(0xd3)+_0x321d69(0xd7),'tags':[_0x321d69(0xe9)]});export const fileRoute={'createTemporaryFile':i,'getVercelToken':l};
1
+ import{createApiRoute as e}from"../../core/hono/hono";import{CreateTemporaryFileSchema as o,FileSchema as t,GetVercelTokenBody as a,GetVercelTokenResponse as s,HeaderSchema as r}from"../../schemas";const i=e({body:o,description:"Creates a temporary file record and returns its ID",headers:r,method:"POST",operationId:"createTemporaryFile",path:"/files",responses:{201:t},summary:"Create Temporary File",tags:["File"]}),l=e({body:a,description:"Returns a Vercel token",headers:r,method:"POST",operationId:"getVercelToken",path:"/files/token/vercel",responses:{200:s,204:null},summary:"Get Vercel Token",tags:["File"]});export const fileRoute={createTemporaryFile:i,getVercelToken:l};
@@ -1 +1 @@
1
- const _0x367060=_0x37e3,_0x4eabce=_0x37e3;(function(_0x2a6aea,_0x2db296){const _0x3a08a0=_0x37e3,_0x517387=_0x37e3,_0x9ec103=_0x2a6aea();while(!![]){try{const _0x108905=parseInt(_0x3a08a0(0x72))/0x1*(parseInt(_0x3a08a0(0xa5))/0x2)+-parseInt(_0x3a08a0(0x8f))/0x3*(parseInt(_0x3a08a0(0x9f))/0x4)+-parseInt(_0x3a08a0(0x7a))/0x5*(-parseInt(_0x517387(0x8d))/0x6)+parseInt(_0x517387(0x77))/0x7*(parseInt(_0x3a08a0(0xa2))/0x8)+parseInt(_0x517387(0x87))/0x9*(-parseInt(_0x3a08a0(0x9b))/0xa)+parseInt(_0x517387(0xa4))/0xb*(-parseInt(_0x3a08a0(0x84))/0xc)+-parseInt(_0x517387(0x7b))/0xd*(-parseInt(_0x3a08a0(0x80))/0xe);if(_0x108905===_0x2db296)break;else _0x9ec103['push'](_0x9ec103['shift']());}catch(_0x4693a2){_0x9ec103['push'](_0x9ec103['shift']());}}}(_0x2671,0xe52f6));import{z as _0x525e58}from'@hono/zod-openapi';function _0x2671(){const _0x3ad6fb=['odmXnZqZoxPJwvbgDa','zsbVzIb0Agu','ndmYmtbHyMm','DhLWzq','B2jQzwn0','mtr0DhnztLC','EMf0Aw9U','zsbVCMDHBMK','C3rYAw5N','mZzQA3fqEwe','zgLZy3jPBwK','AwvUDc10B2S','odi5odLtzfLowuy','BNvTyMvY','u2L6zsbVzIa','rMLSzw5HBwu','BMf0zwrvBMK','y2XTmtiZndu','mtu2y2H4BhL3','B3b0Aw9UywW','m0jIwhv4sq','tMfTzsbVzIa','yMXVyI5Nzw4','l2zPBgu','BwLU','CMvXDwLYzwq','BNvSBgfIBgu','l3bHDgGVDg8','B2fKlwnVBxa','vxbSB2fKzwq','rMLSzq','igLUigj5Dgu','mtC1me9wzunsuq','B3bLBMfWAq','ugf0AcbVzIa','suqGB2yGDgG','odC0mZzUEwvPy2O','DgHLigzPBgu','Aw1Hz2uVCg4','ndGWodaXnMDvsgTXrq','BgL0zxjHBa','mZa2nZKZm2T1BvzdsG','ntK4v0LZAKHN','tuLnrsb0Exa','DwLYzwq','zxjHDguTy2W','yM9VBgvHBG','CxvPCMvK','igLZihjLCxu','yMXVyI51CgW','AxjLza','u2L6zsbPCYa','suqGAxmGCMu','zsbPCYbYzxe','yw55','igzPBgu','zxHHBxbSzs4','nJztD2rqqLm','nJC4otbHyMm','Bgv0zwq','Cg5N','zgvM','mtrlvhj2ueK','zsbMAwXL','y2XMotG3nJu','mJK3otCWC3vQC0X4'];_0x2671=function(){return _0x3ad6fb;};return _0x2671();}function _0x37e3(_0x1d0260,_0x389692){_0x1d0260=_0x1d0260-0x6f;const _0x26716a=_0x2671();let _0x37e331=_0x26716a[_0x1d0260];if(_0x37e3['LTAUSM']===undefined){var _0x4d70a8=function(_0x42db17){const _0x20b7ab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x525e58='',_0x58e07d='';for(let _0x30308b=0x0,_0x2f2225,_0x57096c,_0x4e36a9=0x0;_0x57096c=_0x42db17['charAt'](_0x4e36a9++);~_0x57096c&&(_0x2f2225=_0x30308b%0x4?_0x2f2225*0x40+_0x57096c:_0x57096c,_0x30308b++%0x4)?_0x525e58+=String['fromCharCode'](0xff&_0x2f2225>>(-0x2*_0x30308b&0x6)):0x0){_0x57096c=_0x20b7ab['indexOf'](_0x57096c);}for(let _0x6b580f=0x0,_0x1a70ae=_0x525e58['length'];_0x6b580f<_0x1a70ae;_0x6b580f++){_0x58e07d+='%'+('00'+_0x525e58['charCodeAt'](_0x6b580f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58e07d);};_0x37e3['rSJdqG']=_0x4d70a8,_0x37e3['HwgXYS']={},_0x37e3['LTAUSM']=!![];}const _0x3f0d80=_0x26716a[0x0],_0x50cc4a=_0x1d0260+_0x3f0d80,_0x4be0d9=_0x37e3['HwgXYS'][_0x50cc4a];return!_0x4be0d9?(_0x37e331=_0x37e3['rSJdqG'](_0x37e331),_0x37e3['HwgXYS'][_0x50cc4a]=_0x37e331):_0x37e331=_0x4be0d9,_0x37e331;}const i=_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x367060(0xa3)](_0x4eabce(0x91)+_0x4eabce(0xa8)+_0x367060(0x86)+'en'),'payload':_0x525e58[_0x367060(0x7f)]({'pathname':_0x525e58[_0x4eabce(0x83)](),'callbackUrl':_0x525e58[_0x367060(0x83)](),'multipart':_0x525e58[_0x367060(0xa9)](),'clientPayload':_0x525e58[_0x367060(0x83)]()['nullable']()})}),t=_0x525e58[_0x4eabce(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x367060(0xac)+_0x4eabce(0x97)+_0x367060(0x74)),'payload':_0x525e58[_0x367060(0x7f)]({'blob':_0x525e58[_0x4eabce(0x6f)](),'tokenPayload':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x95)]()[_0x367060(0x8e)]()})});export const GetVercelTokenBody=_0x525e58[_0x4eabce(0x85)+_0x367060(0x8b)+'on'](_0x4eabce(0x7e),[i,t]),GetVercelTokenResponse=_0x525e58[_0x367060(0x85)+'natedUni'+'on']('type',[_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x367060(0x91)+_0x4eabce(0xa8)+_0x4eabce(0x86)+'en'),'clientToken':_0x525e58[_0x4eabce(0x83)]()}),_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x4eabce(0xac)+_0x4eabce(0x97)+_0x367060(0x74)),'response':_0x525e58[_0x367060(0xa3)]('ok')})]),CreateTemporaryFileSchema=_0x525e58[_0x4eabce(0x7f)]({'mimeType':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0xa6)+_0x4eabce(0xb0)+_0x367060(0xa7))['openapi']({'example':'image/pn'+'g','description':'MIME\x20typ'+_0x367060(0x7c)+_0x4eabce(0x70)}),'size':_0x525e58[_0x4eabce(0x88)]()[_0x367060(0x93)](0x1,_0x367060(0xae)+_0x4eabce(0x94))[_0x4eabce(0x9c)]({'example':0x400,'description':_0x367060(0x89)+_0x4eabce(0xa0)+_0x367060(0x9a)+'s'}),'filename':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0x8a)+_0x367060(0xab)+_0x367060(0xad))['openapi']({'example':'example.'+_0x4eabce(0x75),'description':_0x367060(0x90)+_0x4eabce(0xa0)}),'organizationId':_0x525e58[_0x367060(0x83)]()['optional']()[_0x367060(0x9c)]({'example':_0x367060(0x8c)+_0x4eabce(0x73)+_0x4eabce(0x76),'description':_0x367060(0x9e)+_0x367060(0x82)+_0x4eabce(0x81)})}),FileSchema=_0x525e58['object']({'id':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x93)](0x1,_0x367060(0xaf)+_0x4eabce(0xaa))[_0x4eabce(0x9c)]({'example':_0x4eabce(0x79)+_0x4eabce(0x7d)+_0x367060(0x76),'description':'ID\x20of\x20th'+_0x367060(0x78)}),'url':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x93)](0x1,'Path\x20is\x20'+_0x367060(0x94))[_0x4eabce(0x9c)]({'example':_0x367060(0x96)+_0x367060(0x92),'description':_0x4eabce(0x9d)+_0x4eabce(0xa0)}),'mimeType':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x367060(0xa6)+'e\x20is\x20req'+_0x4eabce(0xa7))[_0x4eabce(0x9c)]({'example':_0x367060(0xa1)+'g','description':_0x4eabce(0xa6)+_0x4eabce(0x7c)+_0x367060(0x70)}),'size':_0x525e58[_0x4eabce(0x88)]()['min'](0x1,_0x367060(0xae)+_0x4eabce(0x94))['openapi']({'example':0x400,'description':_0x367060(0x89)+_0x4eabce(0xa0)+_0x367060(0x9a)+'s'}),'filename':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0x8a)+_0x4eabce(0xab)+'ired')[_0x367060(0x9c)]({'example':_0x367060(0x71)+_0x367060(0x75),'description':_0x4eabce(0x90)+_0x367060(0xa0)})})[_0x4eabce(0x9c)](_0x4eabce(0x98)+_0x4eabce(0x99));
1
+ import{z as e}from"@hono/zod-openapi";const i=e.object({type:e.literal("blob.generate-client-token"),payload:e.object({pathname:e.string(),callbackUrl:e.string(),multipart:e.boolean(),clientPayload:e.string().nullable()})}),t=e.object({type:e.literal("blob.upload-completed"),payload:e.object({blob:e.any(),tokenPayload:e.string().nullable().optional()})});export const GetVercelTokenBody=e.discriminatedUnion("type",[i,t]),GetVercelTokenResponse=e.discriminatedUnion("type",[e.object({type:e.literal("blob.generate-client-token"),clientToken:e.string()}),e.object({type:e.literal("blob.upload-completed"),response:e.literal("ok")})]),CreateTemporaryFileSchema=e.object({mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"}),organizationId:e.string().optional().openapi({example:"clm1234567890abcdef",description:"ID of the organization"})}),FileSchema=e.object({id:e.string().min(1,"ID is required").openapi({example:"clf9876543210abcdef",description:"ID of the file"}),url:e.string().min(1,"Path is required").openapi({example:"/path/to/file",description:"Path of the file"}),mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"})}).openapi("UploadedFile");
@@ -1 +1 @@
1
- const _0x4eb28a=_0x3ae5,_0x1a01b2=_0x3ae5;(function(_0x10a6dd,_0x27a576){const _0x53ad7a=_0x3ae5,_0x53b5ec=_0x3ae5,_0x9e214e=_0x10a6dd();while(!![]){try{const _0x127281=parseInt(_0x53ad7a(0x14a))/0x1*(-parseInt(_0x53b5ec(0x153))/0x2)+-parseInt(_0x53ad7a(0x142))/0x3+-parseInt(_0x53ad7a(0x15e))/0x4*(-parseInt(_0x53b5ec(0x13f))/0x5)+-parseInt(_0x53ad7a(0x13e))/0x6*(parseInt(_0x53ad7a(0x160))/0x7)+parseInt(_0x53b5ec(0x14f))/0x8+-parseInt(_0x53ad7a(0x165))/0x9*(parseInt(_0x53ad7a(0x15c))/0xa)+parseInt(_0x53b5ec(0x140))/0xb;if(_0x127281===_0x27a576)break;else _0x9e214e['push'](_0x9e214e['shift']());}catch(_0x5d192c){_0x9e214e['push'](_0x9e214e['shift']());}}}(_0x2e3f,0x89b87));import{__awaiter as _0x49c52a}from'tslib';import{handleUpload as _0x1756e8}from'@vercel/blob/client';import{logger as _0x3e963b}from'../../core/logging/pino';import{FileSchema as _0x485e3d,GetVercelTokenResponse as _0x1a18b7}from'../../schemas';class m{constructor(_0x4f5411){const _0xe1c236=_0x3ae5;this[_0xe1c236(0x147)]=_0x4f5411;}[_0x4eb28a(0x152)+_0x1a01b2(0x156)](_0x30d629,_0x488059){const _0x23b7f1=_0x4eb28a,_0x498301=_0x4eb28a,_0x2309f6={'tBgta':_0x23b7f1(0x15f)+_0x498301(0x150)+_0x498301(0x141)+'d','BlgaT':_0x498301(0x15a)+'g','GZEVy':_0x23b7f1(0x163)+'oad\x20comp'+_0x498301(0x13a)};return _0x49c52a(this,void 0x0,void 0x0,function*(){const _0x5097c1=yield _0x1756e8({'body':_0x30d629,'request':_0x488059,'onBeforeGenerateToken':()=>_0x49c52a(this,void 0x0,void 0x0,function*(){const _0x159cfa=_0x3ae5,_0x3ffb0e=_0x3ae5;if(_0x30d629[_0x159cfa(0x13b)]!==_0x3ffb0e(0x158)+_0x159cfa(0x15d)+_0x3ffb0e(0x166)+'en')throw new Error(_0x159cfa(0x151)+_0x3ffb0e(0x13b));if(!_0x30d629[_0x159cfa(0x149)][_0x3ffb0e(0x15f)+_0x3ffb0e(0x162)])throw new Error(_0x2309f6[_0x3ffb0e(0x13d)]);return yield _0x488059[_0x3ffb0e(0x143)]['getCurre'+_0x3ffb0e(0x14c)](),{'addRandomSuffix':!0x0,'allowedContentTypes':['image/jp'+'eg',_0x2309f6[_0x3ffb0e(0x161)],_0x3ffb0e(0x167)+'f'],'tokenPayload':_0x30d629[_0x3ffb0e(0x149)][_0x159cfa(0x15f)+_0x3ffb0e(0x162)]};}),'onUploadCompleted':_0x285edd=>_0x49c52a(this,[_0x285edd],void 0x0,function*({blob:_0x3e8ace,tokenPayload:_0xfaace2}){const _0x29dbb2=_0x3ae5,_0x43b9e4=_0x3ae5;if(_0x3e963b[_0x29dbb2(0x154)]({'blob':_0x3e8ace,'tokenPayload':_0xfaace2},_0x2309f6['GZEVy']),!_0xfaace2)throw new Error(_0x29dbb2(0x148)+_0x43b9e4(0x164)+'required');const {fileId:_0x58c907}=JSON[_0x43b9e4(0x157)](_0xfaace2);yield this[_0x29dbb2(0x147)][_0x43b9e4(0x13c)][_0x43b9e4(0x146)]({'where':{'id':_0x58c907},'data':{'filename':_0x3e8ace[_0x43b9e4(0x15b)],'url':_0x3e8ace[_0x29dbb2(0x14b)],'mimeType':_0x3e8ace[_0x43b9e4(0x144)+_0x29dbb2(0x14e)],'status':_0x43b9e4(0x145)+'d'}});})});return _0x1a18b7['parse'](_0x5097c1);});}[_0x4eb28a(0x155)+_0x4eb28a(0x14d)+'ile'](_0x59453d,_0x326aaf){return _0x49c52a(this,void 0x0,void 0x0,function*(){const _0x5763f4=_0x3ae5,_0x23c1a7=_0x3ae5,_0x18eca8=yield this[_0x5763f4(0x147)]['file'][_0x23c1a7(0x159)]({'data':Object['assign'](Object['assign']({},_0x326aaf),{'url':'-','createdBy':_0x59453d})});return _0x485e3d[_0x23c1a7(0x157)](_0x18eca8);});}}function _0x3ae5(_0x51737b,_0x406a24){_0x51737b=_0x51737b-0x13a;const _0x2e3f9e=_0x2e3f();let _0x3ae5a6=_0x2e3f9e[_0x51737b];if(_0x3ae5['GdxWik']===undefined){var _0x1fabd4=function(_0xad7578){const _0x3ebc1b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x433465='',_0x2f3c37='';for(let _0x54fc0e=0x0,_0x6e75f9,_0x4d783a,_0x192e57=0x0;_0x4d783a=_0xad7578['charAt'](_0x192e57++);~_0x4d783a&&(_0x6e75f9=_0x54fc0e%0x4?_0x6e75f9*0x40+_0x4d783a:_0x4d783a,_0x54fc0e++%0x4)?_0x433465+=String['fromCharCode'](0xff&_0x6e75f9>>(-0x2*_0x54fc0e&0x6)):0x0){_0x4d783a=_0x3ebc1b['indexOf'](_0x4d783a);}for(let _0x24dd7c=0x0,_0x12cea1=_0x433465['length'];_0x24dd7c<_0x12cea1;_0x24dd7c++){_0x2f3c37+='%'+('00'+_0x433465['charCodeAt'](_0x24dd7c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2f3c37);};_0x3ae5['pAIMRo']=_0x1fabd4,_0x3ae5['ndQrcY']={},_0x3ae5['GdxWik']=!![];}const _0x3f1191=_0x2e3f9e[0x0],_0x1a7cba=_0x51737b+_0x3f1191,_0x290e5f=_0x3ae5['ndQrcY'][_0x1a7cba];return!_0x290e5f?(_0x3ae5a6=_0x3ae5['pAIMRo'](_0x3ae5a6),_0x3ae5['ndQrcY'][_0x1a7cba]=_0x3ae5a6):_0x3ae5a6=_0x290e5f,_0x3ae5a6;}export{m as FileService};function _0x2e3f(){const _0x35d655=['EwXVywqGAxm','sw52ywXPzca','z2v0vMvYy2u','nZeYodu0rwrnD3Hz','Aw5MBW','y3jLyxrLvgu','BfrVA2vU','CgfYC2u','yMXVyI5Nzw4','y3jLyxrL','Aw1Hz2uVCg4','Cgf0Ag5HBwu','mtb3EM1pBKS','zxjHDguTy2W','ntu2z3nAue5v','y2XPzw50uge','mJm3mJKZuwXSsKf2','qMXNyvq','EwXVywq','yMXVyIb1CgW','Bg9HzcbPCYa','nJqZnJG5mfbSsLnWEG','AwvUDc10B2S','Aw1Hz2uVz2K','Bgv0zwq','DhLWzq','zMLSzq','DejNDge','mtKYq1zfCwvQ','mZG3mZv6zuPHDK4','mtGYmZi3ntnkzKzZywK','ihjLCxvPCMu','mJy2odi2D1vmB0zi','yxv0Aa','y29UDgvUDfq','y29TCgXLDgu','DxbKyxrL','ChjPC21H','Dg9Rzw5qyxK','Cgf5Bg9Hza','mwvTBgn5CW','DxjS','BNrvC2vY','BxbVCMfYEuy','ExbL','nJaWnZuYwM9lDxvc'];_0x2e3f=function(){return _0x35d655;};return _0x2e3f();}
1
+ import{__awaiter as i}from"tslib";import{handleUpload as d}from"@vercel/blob/client";import{logger as s}from"../../core/logging/pino";import{FileSchema as p,GetVercelTokenResponse as c}from"../../schemas";class m{constructor(e){this.prisma=e}getVercelToken(e,r){return i(this,void 0,void 0,function*(){const o=yield d({body:e,request:r,onBeforeGenerateToken:()=>i(this,void 0,void 0,function*(){if(e.type!=="blob.generate-client-token")throw new Error("Invalid type");if(!e.payload.clientPayload)throw new Error("clientPayload is required");return yield r.auth.getCurrentUser(),{addRandomSuffix:!0,allowedContentTypes:["image/jpeg","image/png","image/gif"],tokenPayload:e.payload.clientPayload}}),onUploadCompleted:n=>i(this,[n],void 0,function*({blob:t,tokenPayload:a}){if(s.info({blob:t,tokenPayload:a},"blob upload completed"),!a)throw new Error("tokenPayload is required");const{fileId:l}=JSON.parse(a);yield this.prisma.file.update({where:{id:l},data:{filename:t.pathname,url:t.url,mimeType:t.contentType,status:"completed"}})})});return c.parse(o)})}createTemporaryFile(e,r){return i(this,void 0,void 0,function*(){const o=yield this.prisma.file.create({data:Object.assign(Object.assign({},r),{url:"-",createdBy:e})});return p.parse(o)})}}export{m as FileService};
@@ -1 +1 @@
1
- (function(_0x280500,_0x544ae1){const _0x29719c=_0x594e,_0x5a8e1a=_0x594e,_0x49f51a=_0x280500();while(!![]){try{const _0x2a1b3f=parseInt(_0x29719c(0x96))/0x1+-parseInt(_0x5a8e1a(0x9a))/0x2*(-parseInt(_0x29719c(0x97))/0x3)+-parseInt(_0x5a8e1a(0x95))/0x4+parseInt(_0x5a8e1a(0x94))/0x5+-parseInt(_0x29719c(0x9b))/0x6+-parseInt(_0x5a8e1a(0x99))/0x7+parseInt(_0x29719c(0x98))/0x8*(parseInt(_0x29719c(0x9c))/0x9);if(_0x2a1b3f===_0x544ae1)break;else _0x49f51a['push'](_0x49f51a['shift']());}catch(_0x1b0cd2){_0x49f51a['push'](_0x49f51a['shift']());}}}(_0x3d1a,0x703da));import{createApiRouter as _0x8d6946}from'../../core/hono/hono';import{healthRoute as _0x5e64a8}from'./health.route';function _0x594e(_0x2ce89f,_0x3a9eac){_0x2ce89f=_0x2ce89f-0x94;const _0x3d1a0f=_0x3d1a();let _0x594eb5=_0x3d1a0f[_0x2ce89f];if(_0x594e['sjWJYP']===undefined){var _0x3e0744=function(_0x168328){const _0x7098e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1e0f08='',_0x207d32='';for(let _0x564861=0x0,_0x4260ca,_0x321083,_0x34cc5b=0x0;_0x321083=_0x168328['charAt'](_0x34cc5b++);~_0x321083&&(_0x4260ca=_0x564861%0x4?_0x4260ca*0x40+_0x321083:_0x321083,_0x564861++%0x4)?_0x1e0f08+=String['fromCharCode'](0xff&_0x4260ca>>(-0x2*_0x564861&0x6)):0x0){_0x321083=_0x7098e1['indexOf'](_0x321083);}for(let _0x3f0af8=0x0,_0x1efd30=_0x1e0f08['length'];_0x3f0af8<_0x1efd30;_0x3f0af8++){_0x207d32+='%'+('00'+_0x1e0f08['charCodeAt'](_0x3f0af8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x207d32);};_0x594e['BjfBXJ']=_0x3e0744,_0x594e['RGNMba']={},_0x594e['sjWJYP']=!![];}const _0x38c177=_0x3d1a0f[0x0],_0x37843d=_0x2ce89f+_0x38c177,_0x3b2377=_0x594e['RGNMba'][_0x37843d];return!_0x3b2377?(_0x594eb5=_0x594e['BjfBXJ'](_0x594eb5),_0x594e['RGNMba'][_0x37843d]=_0x594eb5):_0x594eb5=_0x3b2377,_0x594eb5;}export const registerHealthHandlers=()=>{const _0x547dc0=_0x594e,_0x31b9b0=_0x594e,_0x212f59=_0x8d6946();return _0x212f59[_0x547dc0(0x9d)](_0x5e64a8['ping'],_0x37106c=>_0x37106c[_0x547dc0(0x9e)]({'ok':!0x0},0xc8)),_0x212f59;};function _0x3d1a(){const _0x1b2212=['mJi0ntiZnMrLuKzZAq','mti1mZDsBuLOz00','B3bLBMfWAq','ANnVBG','ntmWotvYwwTmrM4','nZi0mtu2ywzNALHy','ntK4mtCXEe5iALL5','nNPbB1vjzW','mZyWuNjRwxbM','nJK5odzcyvnNBxe','mZuZnta2teTHqKD6'];_0x3d1a=function(){return _0x1b2212;};return _0x3d1a();}
1
+ import{createApiRouter as t}from"../../core/hono/hono";import{healthRoute as o}from"./health.route";export const registerHealthHandlers=()=>{const r=t();return r.openapi(o.ping,e=>e.json({ok:!0},200)),r};
@@ -1 +1 @@
1
- function _0x266c(){const _0x3b99a8=['ntzKqNjntNq','oda4ndy0EenVsxPf','otG1ndy4B3LwDg1S','m056sM1KrG','Axr5','mtyXnJm0nMDOCxjpvq','yM9VBgvHBG','mtGXmZe0DfffuuDA','sw5KAwnHDgu','y2SGAxrZige','l3bPBMC','igLZigf2ywK','DMfPBgfIAwW','oteZExHtvu9m','mtu4nJG1qwf5txnb','otyXodbnC1L0wKO','B3bLBMfWAq','BgfIBgu','ihnLCNzPy2u','zsb0BYbJAgu','mJKZnZe4zNvdtvzJ','r0vu','sgvHBhrO','ugLUzW','ugLUz3mGDgG','CgLUzW','mtvrwhfUzva','zsbZzxj2Awm','zsbYzwXLDMe','B2jQzwn0','BMn5ihnJB3i'];_0x266c=function(){return _0x3b99a8;};return _0x266c();}const _0x1aae8b=_0x5432,_0x131b69=_0x5432;(function(_0x3ec01e,_0xe73e2a){const _0x582b6c=_0x5432,_0x232e94=_0x5432,_0x3ebd4e=_0x3ec01e();while(!![]){try{const _0x2493de=-parseInt(_0x582b6c(0x1bc))/0x1*(parseInt(_0x582b6c(0x1cd))/0x2)+parseInt(_0x582b6c(0x1c7))/0x3+parseInt(_0x232e94(0x1bb))/0x4+parseInt(_0x582b6c(0x1b4))/0x5*(-parseInt(_0x582b6c(0x1ba))/0x6)+parseInt(_0x582b6c(0x1c0))/0x7*(-parseInt(_0x582b6c(0x1b9))/0x8)+parseInt(_0x232e94(0x1be))/0x9+-parseInt(_0x582b6c(0x1c8))/0xa*(-parseInt(_0x232e94(0x1c6))/0xb);if(_0x2493de===_0xe73e2a)break;else _0x3ebd4e['push'](_0x3ebd4e['shift']());}catch(_0x345e5f){_0x3ebd4e['push'](_0x3ebd4e['shift']());}}}(_0x266c,0x3d493));function _0x5432(_0x99400e,_0x5631f4){_0x99400e=_0x99400e-0x1b3;const _0x266c6d=_0x266c();let _0x54328e=_0x266c6d[_0x99400e];if(_0x5432['sWznvh']===undefined){var _0x3d5166=function(_0x2b976e){const _0x285d6a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4bae1c='',_0x209e65='';for(let _0x42783a=0x0,_0x35bdda,_0x1002ea,_0x5d9103=0x0;_0x1002ea=_0x2b976e['charAt'](_0x5d9103++);~_0x1002ea&&(_0x35bdda=_0x42783a%0x4?_0x35bdda*0x40+_0x1002ea:_0x1002ea,_0x42783a++%0x4)?_0x4bae1c+=String['fromCharCode'](0xff&_0x35bdda>>(-0x2*_0x42783a&0x6)):0x0){_0x1002ea=_0x285d6a['indexOf'](_0x1002ea);}for(let _0x34b63b=0x0,_0x4715d9=_0x4bae1c['length'];_0x34b63b<_0x4715d9;_0x34b63b++){_0x209e65+='%'+('00'+_0x4bae1c['charCodeAt'](_0x34b63b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x209e65);};_0x5432['JMrdUn']=_0x3d5166,_0x5432['aMzKtw']={},_0x5432['sWznvh']=!![];}const _0x1a87c5=_0x266c6d[0x0],_0x3fac6d=_0x99400e+_0x1a87c5,_0x5bfea5=_0x5432['aMzKtw'][_0x3fac6d];return!_0x5bfea5?(_0x54328e=_0x5432['JMrdUn'](_0x54328e),_0x5432['aMzKtw'][_0x3fac6d]=_0x54328e):_0x54328e=_0x5bfea5,_0x54328e;}import{z as _0x4bae1c}from'@hono/zod-openapi';import{createApiRoute as _0x209e65}from'../../core/hono/hono';import{ErrorSchema as _0x42783a,HeaderSchema as _0x35bdda}from'../../schemas';const r=_0x209e65({'description':_0x1aae8b(0x1d1)+_0x1aae8b(0x1b6)+_0x1aae8b(0x1b8)+_0x1aae8b(0x1b5)+_0x131b69(0x1cc)+_0x1aae8b(0x1c2)+_0x1aae8b(0x1c5)+_0x1aae8b(0x1bd),'headers':_0x35bdda,'method':_0x131b69(0x1ce),'operationId':_0x131b69(0x1b3),'path':_0x1aae8b(0x1c3),'responses':{0xc8:_0x4bae1c[_0x1aae8b(0x1b7)]({'ok':_0x4bae1c[_0x131b69(0x1bf)]()[_0x1aae8b(0x1c9)]({'description':_0x131b69(0x1c1)+'s\x20if\x20the'+_0x1aae8b(0x1cb)+_0x131b69(0x1c4)+_0x131b69(0x1ca),'example':!0x0})}),0x1f4:_0x42783a},'summary':_0x1aae8b(0x1d0),'tags':[_0x1aae8b(0x1cf)]});export const healthRoute={'ping':r};
1
+ import{z as e}from"@hono/zod-openapi";import{createApiRoute as i}from"../../core/hono/hono";import{ErrorSchema as o,HeaderSchema as t}from"../../schemas";const r=i({description:"Pings the relevancy score service to check its availability",headers:t,method:"GET",operationId:"ping",path:"/ping",responses:{200:e.object({ok:e.boolean().openapi({description:"Indicates if the service is available",example:!0})}),500:o},summary:"Ping",tags:["Health"]});export const healthRoute={ping:r};