@shophost/rest-api 2.0.30 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -13
- package/scripts/minify.mjs +110 -0
- package/src/app.js +1 -53
- package/src/core/auth/auth.schema.js +1 -41
- package/src/core/auth/auth.util.js +1 -44
- package/src/core/auth/better-auth.lib.js +1 -100
- package/src/core/auth/generate-password-hash.util.d.ts +0 -3
- package/src/core/auth/generate-password-hash.util.js +1 -30
- package/src/core/auth/headers.schema.js +1 -22
- package/src/core/auth/user.schema.js +1 -30
- package/src/core/db/__generated__/client/browser.d.ts +0 -128
- package/src/core/db/__generated__/client/browser.js +1 -18
- package/src/core/db/__generated__/client/client.d.ts +0 -143
- package/src/core/db/__generated__/client/client.js +1 -35
- package/src/core/db/__generated__/client/commonInputTypes.js +1 -11
- package/src/core/db/__generated__/client/enums.js +1 -200
- package/src/core/db/__generated__/client/internal/class.d.ts +0 -343
- package/src/core/db/__generated__/client/internal/class.js +1 -55
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +0 -234
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +0 -15
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
- package/src/core/db/__generated__/client/models/Account.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Account.js +1 -2
- package/src/core/db/__generated__/client/models/Address.d.ts +0 -701
- package/src/core/db/__generated__/client/models/Address.js +1 -2
- package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -638
- package/src/core/db/__generated__/client/models/Campaign.js +1 -2
- package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -634
- package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
- package/src/core/db/__generated__/client/models/File.d.ts +0 -752
- package/src/core/db/__generated__/client/models/File.js +1 -2
- package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Invitation.js +1 -2
- package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -652
- package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
- package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -679
- package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Member.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Member.js +1 -2
- package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -662
- package/src/core/db/__generated__/client/models/Modifier.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -686
- package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -634
- package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
- package/src/core/db/__generated__/client/models/Order.d.ts +0 -700
- package/src/core/db/__generated__/client/models/Order.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -686
- package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Organization.d.ts +0 -811
- package/src/core/db/__generated__/client/models/Organization.js +1 -2
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -676
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
- package/src/core/db/__generated__/client/models/Payment.d.ts +0 -668
- package/src/core/db/__generated__/client/models/Payment.js +1 -2
- package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -638
- package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
- package/src/core/db/__generated__/client/models/Product.d.ts +0 -746
- package/src/core/db/__generated__/client/models/Product.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -689
- package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -664
- package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
- package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -650
- package/src/core/db/__generated__/client/models/Reservation.js +1 -2
- package/src/core/db/__generated__/client/models/Session.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Session.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -679
- package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -638
- package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
- package/src/core/db/__generated__/client/models/User.d.ts +0 -736
- package/src/core/db/__generated__/client/models/User.js +1 -2
- package/src/core/db/__generated__/client/models/Verification.d.ts +0 -592
- package/src/core/db/__generated__/client/models/Verification.js +1 -2
- package/src/core/db/__generated__/client/models.js +1 -2
- package/src/core/db/index.js +1 -2
- package/src/core/exceptions/http-exception.js +1 -9
- package/src/core/hono/hono.js +1 -123
- package/src/core/lib/prisma.d.ts +9 -1
- package/src/core/lib/prisma.js +1 -11
- package/src/core/logging/pino.js +1 -5
- package/src/core/notifications/email.service.d.ts +0 -15
- package/src/core/notifications/email.service.js +1 -116
- package/src/core/openapi/openapi.lib.js +1 -26
- package/src/core/types/google-maps.types.js +1 -2
- package/src/core/utils/currency.util.js +1 -11
- package/src/core/utils/env.util.js +1 -8
- package/src/core/utils/object.util.d.ts +0 -10
- package/src/core/utils/object.util.js +1 -39
- package/src/core/utils/translations.util.js +0 -2
- package/src/core/utils/zod.util.d.ts +0 -12
- package/src/core/utils/zod.util.js +1 -85
- package/src/db.js +1 -3
- package/src/features/access/access.handler.js +1 -91
- package/src/features/access/access.route.js +1 -220
- package/src/features/access/access.schema.js +1 -108
- package/src/features/access/access.service.js +1 -294
- package/src/features/cart/cart.handler.js +1 -17
- package/src/features/cart/cart.route.js +1 -32
- package/src/features/cart/cart.schema.js +1 -39
- package/src/features/cart/cart.service.d.ts +0 -7
- package/src/features/cart/cart.service.js +1 -97
- package/src/features/cart/cart.util.js +1 -76
- package/src/features/file/file.handler.js +1 -23
- package/src/features/file/file.route.js +1 -34
- package/src/features/file/file.schema.js +1 -77
- package/src/features/file/file.service.d.ts +0 -6
- package/src/features/file/file.service.js +1 -66
- package/src/features/health/health.handler.js +1 -10
- package/src/features/health/health.route.js +1 -25
- package/src/features/index.js +1 -16
- package/src/features/location/location.handler.js +1 -25
- package/src/features/location/location.route.js +1 -56
- package/src/features/location/location.schema.js +1 -50
- package/src/features/location/location.service.d.ts +0 -3
- package/src/features/location/location.service.js +1 -141
- package/src/features/manufacturer/manufacturer.handler.js +1 -53
- package/src/features/manufacturer/manufacturer.route.js +1 -97
- package/src/features/manufacturer/manufacturer.schema.js +1 -125
- package/src/features/manufacturer/manufacturer.service.d.ts +0 -19
- package/src/features/manufacturer/manufacturer.service.js +1 -190
- package/src/features/order/emails/order-confirmation.email.js +1 -229
- package/src/features/order/emails/order-notification.email.js +1 -229
- package/src/features/order/fulfilment.schema.js +1 -3
- package/src/features/order/order.handler.js +1 -54
- package/src/features/order/order.route.js +1 -111
- package/src/features/order/order.schema.js +1 -158
- package/src/features/order/order.service.d.ts +0 -15
- package/src/features/order/order.service.js +1 -306
- package/src/features/order/recipient.schema.js +1 -38
- package/src/features/organization/legal-entity.schema.js +1 -83
- package/src/features/organization/organization-configuration.schema.js +1 -115
- package/src/features/organization/organization.handler.js +1 -48
- package/src/features/organization/organization.route.js +1 -84
- package/src/features/organization/organization.schema.js +1 -64
- package/src/features/organization/organization.service.d.ts +0 -15
- package/src/features/organization/organization.service.js +1 -334
- package/src/features/payment/payment.handler.js +1 -16
- package/src/features/payment/payment.route.js +1 -22
- package/src/features/payment/payment.schema.js +1 -46
- package/src/features/payment/payment.service.js +1 -100
- package/src/features/payment/stripe.service.js +1 -164
- package/src/features/product/product-modifier.schema.js +1 -84
- package/src/features/product/product.handler.js +1 -87
- package/src/features/product/product.route.js +1 -179
- package/src/features/product/product.schema.js +1 -143
- package/src/features/product/product.service.d.ts +0 -25
- package/src/features/product/product.service.js +1 -440
- package/src/features/product-category/product-category.handler.js +1 -59
- package/src/features/product-category/product-category.route.js +1 -139
- package/src/features/product-category/product-category.schema.js +1 -86
- package/src/features/product-category/product-category.service.d.ts +0 -22
- package/src/features/product-category/product-category.service.js +1 -220
- package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
- package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
- package/src/features/reservation/emails/reservation-notification.email.js +1 -93
- package/src/features/reservation/reservation.handler.js +1 -65
- package/src/features/reservation/reservation.route.js +1 -167
- package/src/features/reservation/reservation.schema.js +1 -51
- package/src/features/reservation/reservation.service.d.ts +0 -18
- package/src/features/reservation/reservation.service.js +1 -231
- package/src/features/shipping/shipping.handler.js +1 -32
- package/src/features/shipping/shipping.route.js +1 -51
- package/src/features/shipping/shipping.service.d.ts +0 -7
- package/src/features/shipping/shipping.service.js +1 -96
- package/src/features/shipping-method/shipping-method.handler.js +1 -60
- package/src/features/shipping-method/shipping-method.route.js +1 -144
- package/src/features/shipping-method/shipping-method.schema.js +1 -48
- package/src/features/shipping-method/shipping-method.service.d.ts +0 -25
- package/src/features/shipping-method/shipping-method.service.js +1 -229
- package/src/features/shipping-method/shipping-zone.schema.js +1 -31
- package/src/features/webhook/webhook.handler.js +1 -50
- package/src/features/webhook/webhook.route.js +1 -33
- package/src/index.js +1 -6
- package/src/integrations/next.js +1 -82
- package/src/schemas/address.schema.d.ts +0 -8
- package/src/schemas/address.schema.js +1 -112
- package/src/schemas/currency.schema.d.ts +0 -42
- package/src/schemas/currency.schema.js +1 -118
- package/src/schemas/error.schema.js +1 -12
- package/src/schemas/index.js +1 -29
- package/src/schemas/locales.schema.js +1 -238
- package/src/schemas/number.schema.js +1 -29
- package/src/schemas/pagination.schema.js +1 -54
- package/src/schemas/params.schema.js +1 -20
- package/src/schemas/queries.schema.js +1 -6
- package/src/test/global-setup.d.ts +1 -0
- package/src/test/global-setup.js +1 -0
- package/src/test/integration/api-fixtures.d.ts +4 -16
- package/src/test/integration/api-fixtures.js +1 -225
- package/src/test/integration/seed.d.ts +81 -0
- package/src/test/integration/seed.js +1 -0
- package/src/test/integration/test-helpers.d.ts +107 -924
- package/src/test/integration/test-helpers.js +1 -1100
- package/src/test/setup-test-env.d.ts +1 -1
- package/src/test/setup-test-env.js +1 -29
- package/src/app.js.map +0 -1
- package/src/core/auth/auth.schema.js.map +0 -1
- package/src/core/auth/auth.util.js.map +0 -1
- package/src/core/auth/better-auth.lib.js.map +0 -1
- package/src/core/auth/generate-password-hash.util.js.map +0 -1
- package/src/core/auth/headers.schema.js.map +0 -1
- package/src/core/auth/user.schema.js.map +0 -1
- package/src/core/db/__generated__/client/browser.js.map +0 -1
- package/src/core/db/__generated__/client/client.js.map +0 -1
- package/src/core/db/__generated__/client/commonInputTypes.js.map +0 -1
- package/src/core/db/__generated__/client/enums.js.map +0 -1
- package/src/core/db/__generated__/client/internal/class.js.map +0 -1
- package/src/core/db/__generated__/client/internal/prismaNamespace.js.map +0 -1
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js.map +0 -1
- package/src/core/db/__generated__/client/models/Account.js.map +0 -1
- package/src/core/db/__generated__/client/models/Address.js.map +0 -1
- package/src/core/db/__generated__/client/models/Campaign.js.map +0 -1
- package/src/core/db/__generated__/client/models/ClosingTimes.js.map +0 -1
- package/src/core/db/__generated__/client/models/File.js.map +0 -1
- package/src/core/db/__generated__/client/models/Invitation.js.map +0 -1
- package/src/core/db/__generated__/client/models/LegalEntity.js.map +0 -1
- package/src/core/db/__generated__/client/models/Manufacturer.js.map +0 -1
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Member.js.map +0 -1
- package/src/core/db/__generated__/client/models/Modifier.js.map +0 -1
- package/src/core/db/__generated__/client/models/ModifierGroup.js.map +0 -1
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/OpeningTimes.js.map +0 -1
- package/src/core/db/__generated__/client/models/Order.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrderItem.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrderItemTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Organization.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.js.map +0 -1
- package/src/core/db/__generated__/client/models/Payment.js.map +0 -1
- package/src/core/db/__generated__/client/models/PaymentSession.js.map +0 -1
- package/src/core/db/__generated__/client/models/Product.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductCategory.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductSnapshot.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Reservation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Session.js.map +0 -1
- package/src/core/db/__generated__/client/models/ShippingMethod.js.map +0 -1
- package/src/core/db/__generated__/client/models/ShippingZone.js.map +0 -1
- package/src/core/db/__generated__/client/models/User.js.map +0 -1
- package/src/core/db/__generated__/client/models/Verification.js.map +0 -1
- package/src/core/db/__generated__/client/models.js.map +0 -1
- package/src/core/db/index.js.map +0 -1
- package/src/core/exceptions/http-exception.js.map +0 -1
- package/src/core/hono/hono.js.map +0 -1
- package/src/core/lib/prisma.js.map +0 -1
- package/src/core/logging/pino.js.map +0 -1
- package/src/core/notifications/email.service.js.map +0 -1
- package/src/core/openapi/openapi.lib.js.map +0 -1
- package/src/core/types/google-maps.types.js.map +0 -1
- package/src/core/utils/currency.util.js.map +0 -1
- package/src/core/utils/env.util.js.map +0 -1
- package/src/core/utils/object.util.js.map +0 -1
- package/src/core/utils/translations.util.js.map +0 -1
- package/src/core/utils/zod.util.js.map +0 -1
- package/src/db.js.map +0 -1
- package/src/features/access/access.handler.js.map +0 -1
- package/src/features/access/access.route.js.map +0 -1
- package/src/features/access/access.schema.js.map +0 -1
- package/src/features/access/access.service.js.map +0 -1
- package/src/features/cart/cart.handler.js.map +0 -1
- package/src/features/cart/cart.route.js.map +0 -1
- package/src/features/cart/cart.schema.js.map +0 -1
- package/src/features/cart/cart.service.js.map +0 -1
- package/src/features/cart/cart.util.js.map +0 -1
- package/src/features/file/file.handler.js.map +0 -1
- package/src/features/file/file.route.js.map +0 -1
- package/src/features/file/file.schema.js.map +0 -1
- package/src/features/file/file.service.js.map +0 -1
- package/src/features/health/health.handler.js.map +0 -1
- package/src/features/health/health.route.js.map +0 -1
- package/src/features/index.js.map +0 -1
- package/src/features/location/location.handler.js.map +0 -1
- package/src/features/location/location.route.js.map +0 -1
- package/src/features/location/location.schema.js.map +0 -1
- package/src/features/location/location.service.js.map +0 -1
- package/src/features/manufacturer/manufacturer.handler.js.map +0 -1
- package/src/features/manufacturer/manufacturer.route.js.map +0 -1
- package/src/features/manufacturer/manufacturer.schema.js.map +0 -1
- package/src/features/manufacturer/manufacturer.service.js.map +0 -1
- package/src/features/order/emails/order-confirmation.email.js.map +0 -1
- package/src/features/order/emails/order-notification.email.js.map +0 -1
- package/src/features/order/fulfilment.schema.js.map +0 -1
- package/src/features/order/order.handler.js.map +0 -1
- package/src/features/order/order.route.js.map +0 -1
- package/src/features/order/order.schema.js.map +0 -1
- package/src/features/order/order.service.js.map +0 -1
- package/src/features/order/recipient.schema.js.map +0 -1
- package/src/features/organization/legal-entity.schema.js.map +0 -1
- package/src/features/organization/organization-configuration.schema.js.map +0 -1
- package/src/features/organization/organization.handler.js.map +0 -1
- package/src/features/organization/organization.route.js.map +0 -1
- package/src/features/organization/organization.schema.js.map +0 -1
- package/src/features/organization/organization.service.js.map +0 -1
- package/src/features/payment/payment.handler.js.map +0 -1
- package/src/features/payment/payment.route.js.map +0 -1
- package/src/features/payment/payment.schema.js.map +0 -1
- package/src/features/payment/payment.service.js.map +0 -1
- package/src/features/payment/stripe.service.js.map +0 -1
- package/src/features/product/product-modifier.schema.js.map +0 -1
- package/src/features/product/product.handler.js.map +0 -1
- package/src/features/product/product.route.js.map +0 -1
- package/src/features/product/product.schema.js.map +0 -1
- package/src/features/product/product.service.js.map +0 -1
- package/src/features/product-category/product-category.handler.js.map +0 -1
- package/src/features/product-category/product-category.route.js.map +0 -1
- package/src/features/product-category/product-category.schema.js.map +0 -1
- package/src/features/product-category/product-category.service.js.map +0 -1
- package/src/features/reservation/emails/reservation-cancellation.email.js.map +0 -1
- package/src/features/reservation/emails/reservation-confirmation.email.js.map +0 -1
- package/src/features/reservation/emails/reservation-notification.email.js.map +0 -1
- package/src/features/reservation/reservation.handler.js.map +0 -1
- package/src/features/reservation/reservation.route.js.map +0 -1
- package/src/features/reservation/reservation.schema.js.map +0 -1
- package/src/features/reservation/reservation.service.js.map +0 -1
- package/src/features/shipping/shipping.handler.js.map +0 -1
- package/src/features/shipping/shipping.route.js.map +0 -1
- package/src/features/shipping/shipping.service.js.map +0 -1
- package/src/features/shipping-method/shipping-method.handler.js.map +0 -1
- package/src/features/shipping-method/shipping-method.route.js.map +0 -1
- package/src/features/shipping-method/shipping-method.schema.js.map +0 -1
- package/src/features/shipping-method/shipping-method.service.js.map +0 -1
- package/src/features/shipping-method/shipping-zone.schema.js.map +0 -1
- package/src/features/webhook/webhook.handler.js.map +0 -1
- package/src/features/webhook/webhook.route.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/integrations/next.js.map +0 -1
- package/src/schemas/address.schema.js.map +0 -1
- package/src/schemas/currency.schema.js.map +0 -1
- package/src/schemas/error.schema.js.map +0 -1
- package/src/schemas/index.js.map +0 -1
- package/src/schemas/locales.schema.js.map +0 -1
- package/src/schemas/number.schema.js.map +0 -1
- package/src/schemas/pagination.schema.js.map +0 -1
- package/src/schemas/params.schema.js.map +0 -1
- package/src/schemas/queries.schema.js.map +0 -1
- package/src/test/integration/api-fixtures.js.map +0 -1
- package/src/test/integration/test-helpers.js.map +0 -1
- package/src/test/setup-test-env.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shophost/rest-api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"shophost-rest-api": "./scripts/shophost-rest-api.mjs"
|
|
@@ -67,29 +67,34 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@hono/zod-openapi": "^1.2.2",
|
|
70
|
-
"@prisma/adapter-neon": "^7.
|
|
71
|
-
"@prisma/client": "^7.
|
|
72
|
-
"@prisma/client-runtime-utils": "^7.
|
|
73
|
-
"prisma": "^7.4.2",
|
|
70
|
+
"@prisma/adapter-neon": "^7.5.0",
|
|
71
|
+
"@prisma/client": "^7.5.0",
|
|
72
|
+
"@prisma/client-runtime-utils": "^7.5.0",
|
|
74
73
|
"@react-email/components": "^0.0.36",
|
|
75
|
-
"@vercel/blob": "^0.27.
|
|
76
|
-
"axios": "^1.
|
|
74
|
+
"@vercel/blob": "^0.27.3",
|
|
75
|
+
"axios": "^1.9.0",
|
|
77
76
|
"better-auth": "^1.5.5",
|
|
78
77
|
"date-fns": "^4.1.0",
|
|
79
|
-
"dotenv": "^16.
|
|
80
|
-
"hono": "^4.
|
|
78
|
+
"dotenv": "^16.6.1",
|
|
79
|
+
"hono": "^4.12.8",
|
|
81
80
|
"http-status-codes": "^2.3.0",
|
|
82
|
-
"nanoid": "^5.1.
|
|
83
|
-
"pino": "^9.
|
|
81
|
+
"nanoid": "^5.1.5",
|
|
82
|
+
"pino": "^9.7.0",
|
|
83
|
+
"prisma": "^7.5.0",
|
|
84
84
|
"prisma-extension-pagination": "^0.7.6",
|
|
85
|
-
"resend": "^4.2
|
|
85
|
+
"resend": "^4.5.2",
|
|
86
86
|
"stripe": "^17.7.0",
|
|
87
|
-
"zod": "^4.
|
|
87
|
+
"zod": "^4.3.6"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"next": ">=14.0.0",
|
|
91
91
|
"react": ">=18.0.0",
|
|
92
92
|
"react-dom": ">=18.0.0"
|
|
93
93
|
},
|
|
94
|
+
"devDependencies": {
|
|
95
|
+
"@prisma/adapter-pg": "^7.5.0",
|
|
96
|
+
"@types/react": "^19.2.14",
|
|
97
|
+
"pg": "^8.20.0"
|
|
98
|
+
},
|
|
94
99
|
"module": "./src/index.js"
|
|
95
100
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { readFile, readdir, unlink, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
|
+
import { minify } from "terser";
|
|
4
|
+
|
|
5
|
+
const DIST_SRC = new URL("../../../dist/packages/rest-api/src", import.meta.url)
|
|
6
|
+
.pathname;
|
|
7
|
+
|
|
8
|
+
const TERSER_OPTIONS = {
|
|
9
|
+
compress: {
|
|
10
|
+
passes: 3,
|
|
11
|
+
dead_code: true,
|
|
12
|
+
drop_debugger: true,
|
|
13
|
+
conditionals: true,
|
|
14
|
+
evaluate: true,
|
|
15
|
+
booleans: true,
|
|
16
|
+
loops: true,
|
|
17
|
+
unused: true,
|
|
18
|
+
if_return: true,
|
|
19
|
+
join_vars: true,
|
|
20
|
+
collapse_vars: true,
|
|
21
|
+
},
|
|
22
|
+
mangle: {
|
|
23
|
+
toplevel: true,
|
|
24
|
+
},
|
|
25
|
+
format: {
|
|
26
|
+
comments: false,
|
|
27
|
+
ecma: 2020,
|
|
28
|
+
},
|
|
29
|
+
module: true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
async function collectFiles(dir, ext) {
|
|
33
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
34
|
+
const files = [];
|
|
35
|
+
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
const fullPath = join(dir, entry.name);
|
|
38
|
+
|
|
39
|
+
if (entry.isDirectory()) {
|
|
40
|
+
files.push(...(await collectFiles(fullPath, ext)));
|
|
41
|
+
} else if (entry.name.endsWith(ext)) {
|
|
42
|
+
files.push(fullPath);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return files;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function run() {
|
|
50
|
+
const jsFiles = await collectFiles(DIST_SRC, ".js");
|
|
51
|
+
const mapFiles = await collectFiles(DIST_SRC, ".js.map");
|
|
52
|
+
|
|
53
|
+
// Remove source maps
|
|
54
|
+
await Promise.all(mapFiles.map((f) => unlink(f)));
|
|
55
|
+
|
|
56
|
+
if (mapFiles.length > 0) {
|
|
57
|
+
console.log(` Removed ${mapFiles.length} source maps`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Minify JS files
|
|
61
|
+
let totalOriginal = 0;
|
|
62
|
+
let totalMinified = 0;
|
|
63
|
+
|
|
64
|
+
const results = await Promise.all(
|
|
65
|
+
jsFiles.map(async (filePath) => {
|
|
66
|
+
const source = await readFile(filePath, "utf-8");
|
|
67
|
+
const result = await minify(source, TERSER_OPTIONS);
|
|
68
|
+
|
|
69
|
+
if (result.code == null) {
|
|
70
|
+
throw new Error(`Terser returned no code for ${filePath}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Strip trailing sourceMappingURL comment if present
|
|
74
|
+
const code = result.code.replace(
|
|
75
|
+
/\/\/# sourceMappingURL=.+\.js\.map\s*$/,
|
|
76
|
+
""
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
await writeFile(filePath, code, "utf-8");
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
file: relative(DIST_SRC, filePath),
|
|
83
|
+
original: source.length,
|
|
84
|
+
minified: code.length,
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
for (const r of results) {
|
|
90
|
+
totalOriginal += r.original;
|
|
91
|
+
totalMinified += r.minified;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const ratio = ((1 - totalMinified / totalOriginal) * 100).toFixed(1);
|
|
95
|
+
console.log(
|
|
96
|
+
` Minified ${jsFiles.length} files (${formatBytes(totalOriginal)} → ${formatBytes(totalMinified)}, ${ratio}% reduction)`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function formatBytes(bytes) {
|
|
101
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
102
|
+
const kb = bytes / 1024;
|
|
103
|
+
if (kb < 1024) return `${kb.toFixed(1)} KB`;
|
|
104
|
+
return `${(kb / 1024).toFixed(1)} MB`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
run().catch((err) => {
|
|
108
|
+
console.error("Minification failed:", err);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
});
|
package/src/app.js
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { cors } from "hono/cors";
|
|
3
|
-
import { createApiRouter, createUnavailableAuth, handleAppError, } from "./core/hono/hono";
|
|
4
|
-
import { buildAccessHandler, buildCartHandler, buildFileHandler, buildHealthHandler, buildLocationHandler, buildManufacturerHandler, buildOrderHandler, buildOrganizationHandler, buildPaymentHandler, buildProductCategoryHandler, buildProductHandler, buildReservationHandler, buildShippingHandler, buildShippingMethodHandler, buildWebhookHandler, } from "./features";
|
|
5
|
-
const defaultCorsOptions = {
|
|
6
|
-
allowHeaders: [
|
|
7
|
-
"Content-Type",
|
|
8
|
-
"Authorization",
|
|
9
|
-
"X-Requested-With",
|
|
10
|
-
"Accept",
|
|
11
|
-
"Origin",
|
|
12
|
-
"X-CSRF-Token",
|
|
13
|
-
],
|
|
14
|
-
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"],
|
|
15
|
-
credentials: true,
|
|
16
|
-
exposeHeaders: ["Content-Length", "X-Kuma-Revision"],
|
|
17
|
-
origin: ["http://localhost:3000"],
|
|
18
|
-
};
|
|
19
|
-
export const buildApiApp = ({ corsOptions, maps, payment, prisma, resolveAuth = () => createUnavailableAuth(), } = {}) => {
|
|
20
|
-
var _a, _b, _c, _d, _e;
|
|
21
|
-
const app = createApiRouter();
|
|
22
|
-
// cors
|
|
23
|
-
app.use("*", cors(Object.assign(Object.assign({}, defaultCorsOptions), corsOptions)));
|
|
24
|
-
// auth
|
|
25
|
-
app.use("*", (c, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
const auth = resolveAuth(c.req.raw, c.req.path);
|
|
27
|
-
c.set("auth", auth);
|
|
28
|
-
Object.assign(c.req.raw, { auth });
|
|
29
|
-
yield next();
|
|
30
|
-
}));
|
|
31
|
-
// error handler
|
|
32
|
-
app.onError((error) => handleAppError(error));
|
|
33
|
-
// routes
|
|
34
|
-
app.route("/", buildHealthHandler());
|
|
35
|
-
app.route("/", buildManufacturerHandler(prisma));
|
|
36
|
-
app.route("/", buildOrganizationHandler(prisma, (_b = (_a = maps === null || maps === void 0 ? void 0 : maps.google) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : ""));
|
|
37
|
-
app.route("/", buildFileHandler(prisma));
|
|
38
|
-
app.route("/", buildProductCategoryHandler(prisma));
|
|
39
|
-
app.route("/", buildProductHandler(prisma));
|
|
40
|
-
app.route("/", buildAccessHandler(prisma));
|
|
41
|
-
app.route("/", buildShippingMethodHandler(prisma));
|
|
42
|
-
app.route("/", buildOrderHandler(prisma, payment !== null && payment !== void 0 ? payment : {}));
|
|
43
|
-
app.route("/", buildCartHandler(prisma));
|
|
44
|
-
app.route("/", buildShippingHandler(prisma, (_d = (_c = maps === null || maps === void 0 ? void 0 : maps.google) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : ""));
|
|
45
|
-
app.route("/", buildLocationHandler(maps !== null && maps !== void 0 ? maps : {}));
|
|
46
|
-
app.route("/", buildPaymentHandler(prisma, payment !== null && payment !== void 0 ? payment : {}));
|
|
47
|
-
app.route("/", buildWebhookHandler(prisma, payment !== null && payment !== void 0 ? payment : {}));
|
|
48
|
-
if ((_e = payment === null || payment === void 0 ? void 0 : payment.stripe) === null || _e === void 0 ? void 0 : _e.resendApiKey) {
|
|
49
|
-
app.route("/", buildReservationHandler(prisma, payment.stripe.resendApiKey));
|
|
50
|
-
}
|
|
51
|
-
return app;
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=app.js.map
|
|
1
|
+
import{__awaiter as o}from"tslib";import{cors as e}from"hono/cors";import{createApiRouter as t,createUnavailableAuth as r,handleAppError as i}from"./core/hono/hono";import{buildAccessHandler as n,buildCartHandler as u,buildFileHandler as l,buildHealthHandler as s,buildLocationHandler as d,buildManufacturerHandler as a,buildOrderHandler as p,buildOrganizationHandler as v,buildPaymentHandler as c,buildProductCategoryHandler as h,buildProductHandler as m,buildReservationHandler as g,buildShippingHandler as A,buildShippingMethodHandler as O,buildWebhookHandler as T}from"./features";const y={allowHeaders:["Content-Type","Authorization","X-Requested-With","Accept","Origin","X-CSRF-Token"],allowMethods:["GET","POST","PUT","DELETE","OPTIONS","PATCH"],credentials:!0,exposeHeaders:["Content-Length","X-Kuma-Revision"],origin:["http://localhost:3000"]};export const buildApiApp=({corsOptions:f,maps:b,payment:E,prisma:q,resolveAuth:w=()=>r()}={})=>{var C,P,j,k,H;const K=t();return K.use("*",e(Object.assign(Object.assign({},y),f))),K.use("*",(e,t)=>o(void 0,void 0,void 0,function*(){const o=w(e.req.raw,e.req.path);e.set("auth",o),Object.assign(e.req.raw,{auth:o}),yield t()})),K.onError(o=>i(o)),K.route("/",s()),K.route("/",a(q)),K.route("/",v(q,null!==(P=null===(C=null==b?void 0:b.google)||void 0===C?void 0:C.key)&&void 0!==P?P:"")),K.route("/",l(q)),K.route("/",h(q)),K.route("/",m(q)),K.route("/",n(q)),K.route("/",O(q)),K.route("/",p(q,null!=E?E:{})),K.route("/",u(q)),K.route("/",A(q,null!==(k=null===(j=null==b?void 0:b.google)||void 0===j?void 0:j.key)&&void 0!==k?k:"")),K.route("/",d(null!=b?b:{})),K.route("/",c(q,null!=E?E:{})),K.route("/",T(q,null!=E?E:{})),(null===(H=null==E?void 0:E.stripe)||void 0===H?void 0:H.resendApiKey)&&K.route("/",g(q,E.stripe.resendApiKey)),K};
|
|
@@ -1,41 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const SignUpSchema = z.object({
|
|
3
|
-
email: z
|
|
4
|
-
.string()
|
|
5
|
-
.min(1, "Email is required")
|
|
6
|
-
.email("Invalid email")
|
|
7
|
-
.openapi({
|
|
8
|
-
example: "user@example.com",
|
|
9
|
-
description: "User's email address",
|
|
10
|
-
}),
|
|
11
|
-
password: z
|
|
12
|
-
.string()
|
|
13
|
-
.min(1, "Password is required")
|
|
14
|
-
.min(8, "Password must be more than 8 characters")
|
|
15
|
-
.max(32, "Password must be less than 32 characters")
|
|
16
|
-
.openapi({
|
|
17
|
-
example: "password123",
|
|
18
|
-
description: "User's password",
|
|
19
|
-
}),
|
|
20
|
-
firstname: z
|
|
21
|
-
.string()
|
|
22
|
-
.min(1, "First name is required")
|
|
23
|
-
.max(32, "First name must be less than 32 characters")
|
|
24
|
-
.openapi({
|
|
25
|
-
example: "John",
|
|
26
|
-
description: "User's first name",
|
|
27
|
-
}),
|
|
28
|
-
lastname: z
|
|
29
|
-
.string()
|
|
30
|
-
.min(1, "Last name is required")
|
|
31
|
-
.max(32, "Last name must be less than 32 characters")
|
|
32
|
-
.openapi({
|
|
33
|
-
example: "Doe",
|
|
34
|
-
description: "User's last name",
|
|
35
|
-
}),
|
|
36
|
-
}).openapi("SignUp");
|
|
37
|
-
export const SignInSchema = SignUpSchema.pick({
|
|
38
|
-
email: true,
|
|
39
|
-
password: true,
|
|
40
|
-
}).openapi("SignIn");
|
|
41
|
-
//# sourceMappingURL=auth.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";export const SignUpSchema=e.object({email:e.string().min(1,"Email is required").email("Invalid email").openapi({example:"user@example.com",description:"User's email address"}),password:e.string().min(1,"Password is required").min(8,"Password must be more than 8 characters").max(32,"Password must be less than 32 characters").openapi({example:"password123",description:"User's password"}),firstname:e.string().min(1,"First name is required").max(32,"First name must be less than 32 characters").openapi({example:"John",description:"User's first name"}),lastname:e.string().min(1,"Last name is required").max(32,"Last name must be less than 32 characters").openapi({example:"Doe",description:"User's last name"})}).openapi("SignUp");export const SignInSchema=SignUpSchema.pick({email:!0,password:!0}).openapi("SignIn");
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HttpException } from "../exceptions/http-exception";
|
|
3
|
-
import { logger } from "../logging/pino";
|
|
4
|
-
export const getCurrentUser = (auth) => (headers) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
|
-
const session = yield auth.api.getSession({
|
|
6
|
-
headers: headers,
|
|
7
|
-
});
|
|
8
|
-
if (!(session === null || session === void 0 ? void 0 : session.user)) {
|
|
9
|
-
throw new HttpException(401, "Unauthorized");
|
|
10
|
-
}
|
|
11
|
-
return session.user;
|
|
12
|
-
});
|
|
13
|
-
export const isGranted = (auth) => (headers, organizationId, accessLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
if (!accessLevel) {
|
|
15
|
-
throw new Error("Resource and access level are required");
|
|
16
|
-
}
|
|
17
|
-
const session = yield auth.api.getSession({
|
|
18
|
-
headers: headers,
|
|
19
|
-
});
|
|
20
|
-
if (!(session === null || session === void 0 ? void 0 : session.user)) {
|
|
21
|
-
throw new HttpException(401, "Unauthorized");
|
|
22
|
-
}
|
|
23
|
-
const hasPermission = yield auth.api.hasPermission({
|
|
24
|
-
headers,
|
|
25
|
-
body: {
|
|
26
|
-
organizationId,
|
|
27
|
-
permissions: {
|
|
28
|
-
project: [accessLevel],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
if (!hasPermission.success) {
|
|
33
|
-
logger.error({
|
|
34
|
-
organizationId,
|
|
35
|
-
accessLevel,
|
|
36
|
-
message: "User does not have permission",
|
|
37
|
-
userId: session.user.id,
|
|
38
|
-
hasPermission,
|
|
39
|
-
});
|
|
40
|
-
throw new HttpException(403, "Forbidden");
|
|
41
|
-
}
|
|
42
|
-
return session.user;
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=auth.util.js.map
|
|
1
|
+
import{__awaiter as e}from"tslib";import{HttpException as o}from"../exceptions/http-exception";import{logger as r}from"../logging/pino";export const getCurrentUser=r=>i=>e(void 0,void 0,void 0,function*(){const e=yield r.api.getSession({headers:i});if(!(null==e?void 0:e.user))throw new o(401,"Unauthorized");return e.user});export const isGranted=i=>(s,n,t)=>e(void 0,void 0,void 0,function*(){if(!t)throw new Error("Resource and access level are required");const e=yield i.api.getSession({headers:s});if(!(null==e?void 0:e.user))throw new o(401,"Unauthorized");const d=yield i.api.hasPermission({headers:s,body:{organizationId:n,permissions:{project:[t]}}});if(!d.success)throw r.error({organizationId:n,accessLevel:t,message:"User does not have permission",userId:e.user.id,hasPermission:d}),new o(403,"Forbidden");return e.user});
|
|
@@ -1,100 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { prismaAdapter } from "better-auth/adapters/prisma";
|
|
3
|
-
import { nextCookies } from "better-auth/next-js";
|
|
4
|
-
import { openAPI, organization } from "better-auth/plugins";
|
|
5
|
-
import { createAccessControl } from "better-auth/plugins/access";
|
|
6
|
-
import { getCurrentUser, isGranted } from "./auth.util";
|
|
7
|
-
const statement = {
|
|
8
|
-
project: ["create", "read", "update", "delete"],
|
|
9
|
-
organization: ["create", "read", "update", "delete"],
|
|
10
|
-
};
|
|
11
|
-
const ac = createAccessControl(statement);
|
|
12
|
-
const readOnly = ac.newRole({
|
|
13
|
-
project: ["read"],
|
|
14
|
-
});
|
|
15
|
-
const member = ac.newRole({
|
|
16
|
-
project: ["read"],
|
|
17
|
-
});
|
|
18
|
-
const manager = ac.newRole({
|
|
19
|
-
project: ["create", "read", "update", "delete"],
|
|
20
|
-
});
|
|
21
|
-
const admin = ac.newRole({
|
|
22
|
-
project: ["create", "read", "update", "delete"],
|
|
23
|
-
organization: ["update"],
|
|
24
|
-
});
|
|
25
|
-
const owner = ac.newRole({
|
|
26
|
-
project: ["create", "read", "update", "delete"],
|
|
27
|
-
organization: ["update", "delete"],
|
|
28
|
-
});
|
|
29
|
-
export const createAuthClient = ({ prisma, baseURL, domain, trustedOrigins, socialProviders, }) => {
|
|
30
|
-
const auth = betterAuth({
|
|
31
|
-
baseURL,
|
|
32
|
-
database: prismaAdapter(prisma, {
|
|
33
|
-
provider: "postgresql",
|
|
34
|
-
}),
|
|
35
|
-
trustedOrigins,
|
|
36
|
-
user: {
|
|
37
|
-
additionalFields: {
|
|
38
|
-
firstname: {
|
|
39
|
-
type: "string",
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
lastname: {
|
|
43
|
-
type: "string",
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
advanced: {
|
|
49
|
-
crossSubDomainCookies: {
|
|
50
|
-
enabled: true,
|
|
51
|
-
domain: domain,
|
|
52
|
-
},
|
|
53
|
-
useSecureCookies: domain !== "localhost",
|
|
54
|
-
defaultCookieAttributes: {
|
|
55
|
-
path: "/",
|
|
56
|
-
sameSite: "lax", // Use "none" if you need cross-site requests, but requires secure: true
|
|
57
|
-
httpOnly: true, // Prevents JavaScript access to cookies
|
|
58
|
-
secure: domain !== "localhost",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
emailAndPassword: {
|
|
62
|
-
enabled: true,
|
|
63
|
-
},
|
|
64
|
-
socialProviders: Object.assign({}, ((socialProviders === null || socialProviders === void 0 ? void 0 : socialProviders.google)
|
|
65
|
-
? {
|
|
66
|
-
google: {
|
|
67
|
-
prompt: "select_account",
|
|
68
|
-
clientId: socialProviders.google.clientId,
|
|
69
|
-
clientSecret: socialProviders.google.clientSecret,
|
|
70
|
-
mapProfileToUser: (profile) => {
|
|
71
|
-
return {
|
|
72
|
-
firstname: profile.given_name,
|
|
73
|
-
lastname: profile.family_name,
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
: {})),
|
|
79
|
-
plugins: [
|
|
80
|
-
openAPI(),
|
|
81
|
-
nextCookies(),
|
|
82
|
-
organization({
|
|
83
|
-
ac,
|
|
84
|
-
roles: {
|
|
85
|
-
member,
|
|
86
|
-
readOnly,
|
|
87
|
-
manager,
|
|
88
|
-
admin,
|
|
89
|
-
owner,
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
],
|
|
93
|
-
});
|
|
94
|
-
return {
|
|
95
|
-
auth,
|
|
96
|
-
getCurrentUser: getCurrentUser(auth),
|
|
97
|
-
isGranted: isGranted(auth),
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=better-auth.lib.js.map
|
|
1
|
+
import{betterAuth as e}from"better-auth";import{prismaAdapter as t}from"better-auth/adapters/prisma";import{nextCookies as r}from"better-auth/next-js";import{openAPI as a,organization as o}from"better-auth/plugins";import{createAccessControl as i}from"better-auth/plugins/access";import{getCurrentUser as n,isGranted as s}from"./auth.util";const l=i({project:["create","read","update","delete"],organization:["create","read","update","delete"]}),d=l.newRole({project:["read"]}),c=l.newRole({project:["read"]}),p=l.newRole({project:["create","read","update","delete"]}),u=l.newRole({project:["create","read","update","delete"],organization:["update"]}),m=l.newRole({project:["create","read","update","delete"],organization:["update","delete"]});export const createAuthClient=({prisma:i,baseURL:g,domain:b,trustedOrigins:h,socialProviders:f})=>{const j=e({baseURL:g,database:t(i,{provider:"postgresql"}),trustedOrigins:h,user:{additionalFields:{firstname:{type:"string",required:!0},lastname:{type:"string",required:!0}}},advanced:{crossSubDomainCookies:{enabled:!0,domain:b},useSecureCookies:"localhost"!==b,defaultCookieAttributes:{path:"/",sameSite:"lax",httpOnly:!0,secure:"localhost"!==b}},emailAndPassword:{enabled:!0},socialProviders:Object.assign({},(null==f?void 0:f.google)?{google:{prompt:"select_account",clientId:f.google.clientId,clientSecret:f.google.clientSecret,mapProfileToUser:e=>({firstname:e.given_name,lastname:e.family_name})}}:{}),plugins:[a(),r(),o({ac:l,roles:{member:c,readOnly:d,manager:p,admin:u,owner:m}})]});return{auth:j,getCurrentUser:n(j),isGranted:s(j)}};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import crypto from "crypto";
|
|
3
|
-
/**
|
|
4
|
-
* Generate a random salt using crypto.
|
|
5
|
-
*/
|
|
6
|
-
function randomBytes() {
|
|
7
|
-
return new Promise((resolve, reject) => crypto.randomBytes(32, (err, saltBuffer) => err ? reject(err) : resolve(saltBuffer)));
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Generate a hash using PBKDF2.
|
|
11
|
-
*/
|
|
12
|
-
function pbkdf2Promisified(password, salt) {
|
|
13
|
-
return new Promise((resolve, reject) => crypto.pbkdf2(password, salt, 25000, // Number of iterations
|
|
14
|
-
512, // Key length
|
|
15
|
-
"sha256", // Digest algorithm
|
|
16
|
-
(err, hashRaw) => (err ? reject(err) : resolve(hashRaw))));
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Generate a salt and hash for the password.
|
|
20
|
-
*/
|
|
21
|
-
export function generatePasswordSaltHash(password) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const saltBuffer = yield randomBytes();
|
|
24
|
-
const salt = saltBuffer.toString("hex");
|
|
25
|
-
const hashRaw = yield pbkdf2Promisified(password, salt);
|
|
26
|
-
const hash = hashRaw.toString("hex");
|
|
27
|
-
return { hash, salt };
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=generate-password-hash.util.js.map
|
|
1
|
+
import{__awaiter as t}from"tslib";import r from"crypto";export function generatePasswordSaltHash(o){return t(this,void 0,void 0,function*(){const t=(yield new Promise((t,o)=>r.randomBytes(32,(r,e)=>r?o(r):t(e)))).toString("hex"),e=yield function(t,o){return new Promise((e,n)=>r.pbkdf2(t,o,25e3,512,"sha256",(t,r)=>t?n(t):e(r)))}(o,t);return{hash:e.toString("hex"),salt:t}})}
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const HeaderSchema = z
|
|
3
|
-
.object({
|
|
4
|
-
"accept-language": z.string().optional().openapi({
|
|
5
|
-
example: "en-US",
|
|
6
|
-
description: "Accept-Language header",
|
|
7
|
-
param: {
|
|
8
|
-
in: "header",
|
|
9
|
-
name: "accept-language",
|
|
10
|
-
},
|
|
11
|
-
}),
|
|
12
|
-
cookie: z.string().optional().openapi({
|
|
13
|
-
example: "session=1234567890",
|
|
14
|
-
description: "Cookie header",
|
|
15
|
-
param: {
|
|
16
|
-
in: "header",
|
|
17
|
-
name: "cookie",
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
})
|
|
21
|
-
.openapi("Headers");
|
|
22
|
-
//# sourceMappingURL=headers.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";export const HeaderSchema=e.object({"accept-language":e.string().optional().openapi({example:"en-US",description:"Accept-Language header",param:{in:"header",name:"accept-language"}}),cookie:e.string().optional().openapi({example:"session=1234567890",description:"Cookie header",param:{in:"header",name:"cookie"}})}).openapi("Headers");
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const UserSchema = z
|
|
3
|
-
.object({
|
|
4
|
-
id: z.string().openapi({
|
|
5
|
-
example: "clm1234567890abcdef",
|
|
6
|
-
description: "User's ID",
|
|
7
|
-
}),
|
|
8
|
-
email: z.string().openapi({
|
|
9
|
-
example: "user@example.com",
|
|
10
|
-
description: "User's email address",
|
|
11
|
-
format: "email",
|
|
12
|
-
}),
|
|
13
|
-
firstname: z.string().openapi({
|
|
14
|
-
example: "John",
|
|
15
|
-
description: "User's first name",
|
|
16
|
-
}),
|
|
17
|
-
lastname: z.string().openapi({
|
|
18
|
-
example: "Doe",
|
|
19
|
-
description: "User's last name",
|
|
20
|
-
}),
|
|
21
|
-
image: z.string().nullable().optional().openapi({
|
|
22
|
-
example: "https://example.com/image.jpg",
|
|
23
|
-
description: "User's profile image",
|
|
24
|
-
}),
|
|
25
|
-
name: z.string().nullable().optional().openapi({
|
|
26
|
-
description: "User's full name (optional)",
|
|
27
|
-
}),
|
|
28
|
-
})
|
|
29
|
-
.openapi("User");
|
|
30
|
-
//# sourceMappingURL=user.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";export const UserSchema=e.object({id:e.string().openapi({example:"clm1234567890abcdef",description:"User's ID"}),email:e.string().openapi({example:"user@example.com",description:"User's email address",format:"email"}),firstname:e.string().openapi({example:"John",description:"User's first name"}),lastname:e.string().openapi({example:"Doe",description:"User's last name"}),image:e.string().nullable().optional().openapi({example:"https://example.com/image.jpg",description:"User's profile image"}),name:e.string().nullable().optional().openapi({description:"User's full name (optional)"})}).openapi("User");
|
|
@@ -2,163 +2,35 @@ import * as Prisma from './internal/prismaNamespaceBrowser';
|
|
|
2
2
|
export { Prisma };
|
|
3
3
|
export * as $Enums from './enums';
|
|
4
4
|
export * from './enums';
|
|
5
|
-
/**
|
|
6
|
-
* Model User
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
5
|
export type User = Prisma.UserModel;
|
|
10
|
-
/**
|
|
11
|
-
* Model Session
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
6
|
export type Session = Prisma.SessionModel;
|
|
15
|
-
/**
|
|
16
|
-
* Model Account
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
7
|
export type Account = Prisma.AccountModel;
|
|
20
|
-
/**
|
|
21
|
-
* Model Verification
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
8
|
export type Verification = Prisma.VerificationModel;
|
|
25
|
-
/**
|
|
26
|
-
* Model Member
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
9
|
export type Member = Prisma.MemberModel;
|
|
30
|
-
/**
|
|
31
|
-
* Model Invitation
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
10
|
export type Invitation = Prisma.InvitationModel;
|
|
35
|
-
/**
|
|
36
|
-
* Model Organization
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
11
|
export type Organization = Prisma.OrganizationModel;
|
|
40
|
-
/**
|
|
41
|
-
* Model OpeningTimes
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
12
|
export type OpeningTimes = Prisma.OpeningTimesModel;
|
|
45
|
-
/**
|
|
46
|
-
* Model ClosingTimes
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
13
|
export type ClosingTimes = Prisma.ClosingTimesModel;
|
|
50
|
-
/**
|
|
51
|
-
* Model OrganizationConfiguration
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
14
|
export type OrganizationConfiguration = Prisma.OrganizationConfigurationModel;
|
|
55
|
-
/**
|
|
56
|
-
* Model Address
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
15
|
export type Address = Prisma.AddressModel;
|
|
60
|
-
/**
|
|
61
|
-
* Model LegalEntity
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
16
|
export type LegalEntity = Prisma.LegalEntityModel;
|
|
65
|
-
/**
|
|
66
|
-
* Model File
|
|
67
|
-
*
|
|
68
|
-
*/
|
|
69
17
|
export type File = Prisma.FileModel;
|
|
70
|
-
/**
|
|
71
|
-
* Model Manufacturer
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
18
|
export type Manufacturer = Prisma.ManufacturerModel;
|
|
75
|
-
/**
|
|
76
|
-
* Model ManufacturerTranslation
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
19
|
export type ManufacturerTranslation = Prisma.ManufacturerTranslationModel;
|
|
80
|
-
/**
|
|
81
|
-
* Model ProductCategory
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
20
|
export type ProductCategory = Prisma.ProductCategoryModel;
|
|
85
|
-
/**
|
|
86
|
-
* Model ProductCategoryTranslation
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
21
|
export type ProductCategoryTranslation = Prisma.ProductCategoryTranslationModel;
|
|
90
|
-
/**
|
|
91
|
-
* Model Product
|
|
92
|
-
*
|
|
93
|
-
*/
|
|
94
22
|
export type Product = Prisma.ProductModel;
|
|
95
|
-
/**
|
|
96
|
-
* Model ProductSnapshot
|
|
97
|
-
*
|
|
98
|
-
*/
|
|
99
23
|
export type ProductSnapshot = Prisma.ProductSnapshotModel;
|
|
100
|
-
/**
|
|
101
|
-
* Model ProductTranslation
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
24
|
export type ProductTranslation = Prisma.ProductTranslationModel;
|
|
105
|
-
/**
|
|
106
|
-
* Model ModifierGroup
|
|
107
|
-
*
|
|
108
|
-
*/
|
|
109
25
|
export type ModifierGroup = Prisma.ModifierGroupModel;
|
|
110
|
-
/**
|
|
111
|
-
* Model ModifierGroupTranslation
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
114
26
|
export type ModifierGroupTranslation = Prisma.ModifierGroupTranslationModel;
|
|
115
|
-
/**
|
|
116
|
-
* Model Modifier
|
|
117
|
-
*
|
|
118
|
-
*/
|
|
119
27
|
export type Modifier = Prisma.ModifierModel;
|
|
120
|
-
/**
|
|
121
|
-
* Model Order
|
|
122
|
-
*
|
|
123
|
-
*/
|
|
124
28
|
export type Order = Prisma.OrderModel;
|
|
125
|
-
/**
|
|
126
|
-
* Model OrderItem
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
29
|
export type OrderItem = Prisma.OrderItemModel;
|
|
130
|
-
/**
|
|
131
|
-
* Model OrderItemTranslation
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
30
|
export type OrderItemTranslation = Prisma.OrderItemTranslationModel;
|
|
135
|
-
/**
|
|
136
|
-
* Model Payment
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
31
|
export type Payment = Prisma.PaymentModel;
|
|
140
|
-
/**
|
|
141
|
-
* Model PaymentSession
|
|
142
|
-
*
|
|
143
|
-
*/
|
|
144
32
|
export type PaymentSession = Prisma.PaymentSessionModel;
|
|
145
|
-
/**
|
|
146
|
-
* Model Campaign
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
33
|
export type Campaign = Prisma.CampaignModel;
|
|
150
|
-
/**
|
|
151
|
-
* Model ShippingMethod
|
|
152
|
-
*
|
|
153
|
-
*/
|
|
154
34
|
export type ShippingMethod = Prisma.ShippingMethodModel;
|
|
155
|
-
/**
|
|
156
|
-
* Model ShippingZone
|
|
157
|
-
*
|
|
158
|
-
*/
|
|
159
35
|
export type ShippingZone = Prisma.ShippingZoneModel;
|
|
160
|
-
/**
|
|
161
|
-
* Model Reservation
|
|
162
|
-
*
|
|
163
|
-
*/
|
|
164
36
|
export type Reservation = Prisma.ReservationModel;
|