@shophost/rest-api 2.0.34 → 2.0.36
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/LICENSE +17 -13
- package/README.md +76 -66
- package/package.json +2 -2
- package/scripts/minify-dist.mjs +45 -0
- package/src/app.js +1 -53
- package/src/app.js.map +1 -1
- 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.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.js +1 -18
- 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.js +769 -55
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +2 -2
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
- package/src/core/db/__generated__/client/models/Account.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Account.js +1 -2
- package/src/core/db/__generated__/client/models/Address.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Address.js +1 -2
- package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Campaign.js +1 -2
- package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
- package/src/core/db/__generated__/client/models/File.d.ts +0 -5
- package/src/core/db/__generated__/client/models/File.js +1 -2
- package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Invitation.js +1 -2
- package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -5
- package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
- package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Member.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Member.js +1 -2
- package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Modifier.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -5
- package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
- package/src/core/db/__generated__/client/models/Order.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Order.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -5
- package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Organization.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Organization.js +1 -2
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -5
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
- package/src/core/db/__generated__/client/models/Payment.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Payment.js +1 -2
- package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -5
- package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
- package/src/core/db/__generated__/client/models/Product.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Product.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
- package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Reservation.js +1 -2
- package/src/core/db/__generated__/client/models/Session.d.ts +0 -5
- package/src/core/db/__generated__/client/models/Session.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -5
- package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
- package/src/core/db/__generated__/client/models/User.d.ts +0 -5
- package/src/core/db/__generated__/client/models/User.js +1 -2
- package/src/core/db/__generated__/client/models/Verification.d.ts +0 -5
- 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/email/components.d.ts +16 -0
- package/src/core/email/components.js +1 -0
- package/src/core/email/components.js.map +1 -0
- package/src/core/exceptions/http-exception.js +1 -9
- package/src/core/hono/hono.js +1 -123
- package/src/core/lib/prisma.d.ts +8 -8
- package/src/core/lib/prisma.js +1 -11
- package/src/core/logging/pino.js +1 -5
- 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.js +1 -39
- package/src/core/utils/translations.util.js +0 -1
- 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/analytics/analytics.handler.d.ts +2 -0
- package/src/features/analytics/analytics.handler.js +1 -0
- package/src/features/analytics/analytics.handler.js.map +1 -0
- package/src/features/analytics/analytics.route.d.ts +3 -0
- package/src/features/analytics/analytics.route.js +1 -0
- package/src/features/analytics/analytics.route.js.map +1 -0
- package/src/features/analytics/analytics.schema.d.ts +86 -0
- package/src/features/analytics/analytics.schema.js +1 -0
- package/src/features/analytics/analytics.schema.js.map +1 -0
- package/src/features/analytics/analytics.service.d.ts +45 -0
- package/src/features/analytics/analytics.service.js +1 -0
- package/src/features/analytics/analytics.service.js.map +1 -0
- package/src/features/cart/cart.handler.js +1 -17
- package/src/features/cart/cart.route.js +1 -32
- package/src/features/cart/cart.schema.d.ts +1 -1
- package/src/features/cart/cart.schema.js +1 -39
- package/src/features/cart/cart.service.d.ts +1 -1
- 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.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.d.ts +1 -0
- package/src/features/index.js +1 -16
- package/src/features/index.js.map +1 -1
- 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.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.js +1 -190
- package/src/features/order/emails/order-confirmation.email.js +1 -229
- package/src/features/order/emails/order-confirmation.email.js.map +1 -1
- package/src/features/order/emails/order-notification.email.js +1 -229
- package/src/features/order/emails/order-notification.email.js.map +1 -1
- 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.d.ts +4 -4
- package/src/features/order/order.schema.js +1 -158
- package/src/features/order/order.service.d.ts +4 -4
- 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.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.d.ts +3 -3
- package/src/features/payment/payment.schema.js +1 -46
- package/src/features/payment/payment.service.d.ts +1 -1
- 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.d.ts +3 -3
- package/src/features/product/product.schema.js +1 -143
- package/src/features/product/product.service.d.ts +2 -2
- 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.js +1 -220
- package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
- package/src/features/reservation/emails/reservation-cancellation.email.js.map +1 -1
- package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
- package/src/features/reservation/emails/reservation-confirmation.email.js.map +1 -1
- package/src/features/reservation/emails/reservation-notification.email.js +1 -93
- package/src/features/reservation/emails/reservation-notification.email.js.map +1 -1
- package/src/features/reservation/reservation.handler.js +1 -65
- package/src/features/reservation/reservation.route.js +1 -167
- package/src/features/reservation/reservation.schema.d.ts +1 -1
- package/src/features/reservation/reservation.schema.js +1 -51
- 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.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.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.js +1 -112
- package/src/schemas/currency.schema.js +1 -118
- package/src/schemas/error.schema.js +1 -12
- package/src/schemas/index.d.ts +1 -0
- package/src/schemas/index.js +1 -29
- package/src/schemas/index.js.map +1 -1
- 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.js +1 -37
- package/src/test/integration/api-fixtures.js +1 -160
- package/src/test/integration/seed.js +1 -368
- package/src/test/integration/test-helpers.d.ts +2 -0
- package/src/test/integration/test-helpers.js +1 -154
- package/src/test/integration/test-helpers.js.map +1 -1
- package/src/test/setup-test-env.js +1 -7
|
@@ -1072,11 +1072,6 @@ export type ManufacturerTranslationFindManyArgs<ExtArgs extends runtime.Types.Ex
|
|
|
1072
1072
|
* Skip the first `n` ManufacturerTranslations.
|
|
1073
1073
|
*/
|
|
1074
1074
|
skip?: number;
|
|
1075
|
-
/**
|
|
1076
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1077
|
-
*
|
|
1078
|
-
* Filter by unique combinations of ManufacturerTranslations.
|
|
1079
|
-
*/
|
|
1080
1075
|
distinct?: Prisma.ManufacturerTranslationScalarFieldEnum | Prisma.ManufacturerTranslationScalarFieldEnum[];
|
|
1081
1076
|
};
|
|
1082
1077
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ManufacturerTranslation.js.map
|
|
1
|
+
export{};
|
|
@@ -1067,11 +1067,6 @@ export type MemberFindManyArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
|
|
1067
1067
|
* Skip the first `n` Members.
|
|
1068
1068
|
*/
|
|
1069
1069
|
skip?: number;
|
|
1070
|
-
/**
|
|
1071
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1072
|
-
*
|
|
1073
|
-
* Filter by unique combinations of Members.
|
|
1074
|
-
*/
|
|
1075
1070
|
distinct?: Prisma.MemberScalarFieldEnum | Prisma.MemberScalarFieldEnum[];
|
|
1076
1071
|
};
|
|
1077
1072
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Member.js.map
|
|
1
|
+
export{};
|
|
@@ -1167,11 +1167,6 @@ export type ModifierFindManyArgs<ExtArgs extends runtime.Types.Extensions.Intern
|
|
|
1167
1167
|
* Skip the first `n` Modifiers.
|
|
1168
1168
|
*/
|
|
1169
1169
|
skip?: number;
|
|
1170
|
-
/**
|
|
1171
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1172
|
-
*
|
|
1173
|
-
* Filter by unique combinations of Modifiers.
|
|
1174
|
-
*/
|
|
1175
1170
|
distinct?: Prisma.ModifierScalarFieldEnum | Prisma.ModifierScalarFieldEnum[];
|
|
1176
1171
|
};
|
|
1177
1172
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Modifier.js.map
|
|
1
|
+
export{};
|
|
@@ -1194,11 +1194,6 @@ export type ModifierGroupFindManyArgs<ExtArgs extends runtime.Types.Extensions.I
|
|
|
1194
1194
|
* Skip the first `n` ModifierGroups.
|
|
1195
1195
|
*/
|
|
1196
1196
|
skip?: number;
|
|
1197
|
-
/**
|
|
1198
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1199
|
-
*
|
|
1200
|
-
* Filter by unique combinations of ModifierGroups.
|
|
1201
|
-
*/
|
|
1202
1197
|
distinct?: Prisma.ModifierGroupScalarFieldEnum | Prisma.ModifierGroupScalarFieldEnum[];
|
|
1203
1198
|
};
|
|
1204
1199
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ModifierGroup.js.map
|
|
1
|
+
export{};
|
|
@@ -967,11 +967,6 @@ export type ModifierGroupTranslationFindManyArgs<ExtArgs extends runtime.Types.E
|
|
|
967
967
|
* Skip the first `n` ModifierGroupTranslations.
|
|
968
968
|
*/
|
|
969
969
|
skip?: number;
|
|
970
|
-
/**
|
|
971
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
972
|
-
*
|
|
973
|
-
* Filter by unique combinations of ModifierGroupTranslations.
|
|
974
|
-
*/
|
|
975
970
|
distinct?: Prisma.ModifierGroupTranslationScalarFieldEnum | Prisma.ModifierGroupTranslationScalarFieldEnum[];
|
|
976
971
|
};
|
|
977
972
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ModifierGroupTranslation.js.map
|
|
1
|
+
export{};
|
|
@@ -1003,11 +1003,6 @@ export type OpeningTimesFindManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
|
|
1003
1003
|
* Skip the first `n` OpeningTimes.
|
|
1004
1004
|
*/
|
|
1005
1005
|
skip?: number;
|
|
1006
|
-
/**
|
|
1007
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1008
|
-
*
|
|
1009
|
-
* Filter by unique combinations of OpeningTimes.
|
|
1010
|
-
*/
|
|
1011
1006
|
distinct?: Prisma.OpeningTimesScalarFieldEnum | Prisma.OpeningTimesScalarFieldEnum[];
|
|
1012
1007
|
};
|
|
1013
1008
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=OpeningTimes.js.map
|
|
1
|
+
export{};
|
|
@@ -2511,11 +2511,6 @@ export type OrderFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalA
|
|
|
2511
2511
|
* Skip the first `n` Orders.
|
|
2512
2512
|
*/
|
|
2513
2513
|
skip?: number;
|
|
2514
|
-
/**
|
|
2515
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
2516
|
-
*
|
|
2517
|
-
* Filter by unique combinations of Orders.
|
|
2518
|
-
*/
|
|
2519
2514
|
distinct?: Prisma.OrderScalarFieldEnum | Prisma.OrderScalarFieldEnum[];
|
|
2520
2515
|
};
|
|
2521
2516
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Order.js.map
|
|
1
|
+
export{};
|
|
@@ -1482,11 +1482,6 @@ export type OrderItemFindManyArgs<ExtArgs extends runtime.Types.Extensions.Inter
|
|
|
1482
1482
|
* Skip the first `n` OrderItems.
|
|
1483
1483
|
*/
|
|
1484
1484
|
skip?: number;
|
|
1485
|
-
/**
|
|
1486
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1487
|
-
*
|
|
1488
|
-
* Filter by unique combinations of OrderItems.
|
|
1489
|
-
*/
|
|
1490
1485
|
distinct?: Prisma.OrderItemScalarFieldEnum | Prisma.OrderItemScalarFieldEnum[];
|
|
1491
1486
|
};
|
|
1492
1487
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=OrderItem.js.map
|
|
1
|
+
export{};
|
|
@@ -967,11 +967,6 @@ export type OrderItemTranslationFindManyArgs<ExtArgs extends runtime.Types.Exten
|
|
|
967
967
|
* Skip the first `n` OrderItemTranslations.
|
|
968
968
|
*/
|
|
969
969
|
skip?: number;
|
|
970
|
-
/**
|
|
971
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
972
|
-
*
|
|
973
|
-
* Filter by unique combinations of OrderItemTranslations.
|
|
974
|
-
*/
|
|
975
970
|
distinct?: Prisma.OrderItemTranslationScalarFieldEnum | Prisma.OrderItemTranslationScalarFieldEnum[];
|
|
976
971
|
};
|
|
977
972
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=OrderItemTranslation.js.map
|
|
1
|
+
export{};
|
|
@@ -3516,11 +3516,6 @@ export type OrganizationFindManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
|
|
3516
3516
|
* Skip the first `n` Organizations.
|
|
3517
3517
|
*/
|
|
3518
3518
|
skip?: number;
|
|
3519
|
-
/**
|
|
3520
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
3521
|
-
*
|
|
3522
|
-
* Filter by unique combinations of Organizations.
|
|
3523
|
-
*/
|
|
3524
3519
|
distinct?: Prisma.OrganizationScalarFieldEnum | Prisma.OrganizationScalarFieldEnum[];
|
|
3525
3520
|
};
|
|
3526
3521
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Organization.js.map
|
|
1
|
+
export{};
|
|
@@ -1681,11 +1681,6 @@ export type OrganizationConfigurationFindManyArgs<ExtArgs extends runtime.Types.
|
|
|
1681
1681
|
* Skip the first `n` OrganizationConfigurations.
|
|
1682
1682
|
*/
|
|
1683
1683
|
skip?: number;
|
|
1684
|
-
/**
|
|
1685
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1686
|
-
*
|
|
1687
|
-
* Filter by unique combinations of OrganizationConfigurations.
|
|
1688
|
-
*/
|
|
1689
1684
|
distinct?: Prisma.OrganizationConfigurationScalarFieldEnum | Prisma.OrganizationConfigurationScalarFieldEnum[];
|
|
1690
1685
|
};
|
|
1691
1686
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=OrganizationConfiguration.js.map
|
|
1
|
+
export{};
|
|
@@ -1291,11 +1291,6 @@ export type PaymentFindManyArgs<ExtArgs extends runtime.Types.Extensions.Interna
|
|
|
1291
1291
|
* Skip the first `n` Payments.
|
|
1292
1292
|
*/
|
|
1293
1293
|
skip?: number;
|
|
1294
|
-
/**
|
|
1295
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1296
|
-
*
|
|
1297
|
-
* Filter by unique combinations of Payments.
|
|
1298
|
-
*/
|
|
1299
1294
|
distinct?: Prisma.PaymentScalarFieldEnum | Prisma.PaymentScalarFieldEnum[];
|
|
1300
1295
|
};
|
|
1301
1296
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Payment.js.map
|
|
1
|
+
export{};
|
|
@@ -1170,11 +1170,6 @@ export type PaymentSessionFindManyArgs<ExtArgs extends runtime.Types.Extensions.
|
|
|
1170
1170
|
* Skip the first `n` PaymentSessions.
|
|
1171
1171
|
*/
|
|
1172
1172
|
skip?: number;
|
|
1173
|
-
/**
|
|
1174
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1175
|
-
*
|
|
1176
|
-
* Filter by unique combinations of PaymentSessions.
|
|
1177
|
-
*/
|
|
1178
1173
|
distinct?: Prisma.PaymentSessionScalarFieldEnum | Prisma.PaymentSessionScalarFieldEnum[];
|
|
1179
1174
|
};
|
|
1180
1175
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=PaymentSession.js.map
|
|
1
|
+
export{};
|
|
@@ -2833,11 +2833,6 @@ export type ProductFindManyArgs<ExtArgs extends runtime.Types.Extensions.Interna
|
|
|
2833
2833
|
* Skip the first `n` Products.
|
|
2834
2834
|
*/
|
|
2835
2835
|
skip?: number;
|
|
2836
|
-
/**
|
|
2837
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
2838
|
-
*
|
|
2839
|
-
* Filter by unique combinations of Products.
|
|
2840
|
-
*/
|
|
2841
2836
|
distinct?: Prisma.ProductScalarFieldEnum | Prisma.ProductScalarFieldEnum[];
|
|
2842
2837
|
};
|
|
2843
2838
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Product.js.map
|
|
1
|
+
export{};
|
|
@@ -1686,11 +1686,6 @@ export type ProductCategoryFindManyArgs<ExtArgs extends runtime.Types.Extensions
|
|
|
1686
1686
|
* Skip the first `n` ProductCategories.
|
|
1687
1687
|
*/
|
|
1688
1688
|
skip?: number;
|
|
1689
|
-
/**
|
|
1690
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1691
|
-
*
|
|
1692
|
-
* Filter by unique combinations of ProductCategories.
|
|
1693
|
-
*/
|
|
1694
1689
|
distinct?: Prisma.ProductCategoryScalarFieldEnum | Prisma.ProductCategoryScalarFieldEnum[];
|
|
1695
1690
|
};
|
|
1696
1691
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ProductCategory.js.map
|
|
1
|
+
export{};
|
|
@@ -1107,11 +1107,6 @@ export type ProductCategoryTranslationFindManyArgs<ExtArgs extends runtime.Types
|
|
|
1107
1107
|
* Skip the first `n` ProductCategoryTranslations.
|
|
1108
1108
|
*/
|
|
1109
1109
|
skip?: number;
|
|
1110
|
-
/**
|
|
1111
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1112
|
-
*
|
|
1113
|
-
* Filter by unique combinations of ProductCategoryTranslations.
|
|
1114
|
-
*/
|
|
1115
1110
|
distinct?: Prisma.ProductCategoryTranslationScalarFieldEnum | Prisma.ProductCategoryTranslationScalarFieldEnum[];
|
|
1116
1111
|
};
|
|
1117
1112
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ProductCategoryTranslation.js.map
|
|
1
|
+
export{};
|
|
@@ -1134,11 +1134,6 @@ export type ProductSnapshotFindManyArgs<ExtArgs extends runtime.Types.Extensions
|
|
|
1134
1134
|
* Skip the first `n` ProductSnapshots.
|
|
1135
1135
|
*/
|
|
1136
1136
|
skip?: number;
|
|
1137
|
-
/**
|
|
1138
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1139
|
-
*
|
|
1140
|
-
* Filter by unique combinations of ProductSnapshots.
|
|
1141
|
-
*/
|
|
1142
1137
|
distinct?: Prisma.ProductSnapshotScalarFieldEnum | Prisma.ProductSnapshotScalarFieldEnum[];
|
|
1143
1138
|
};
|
|
1144
1139
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ProductSnapshot.js.map
|
|
1
|
+
export{};
|
|
@@ -1107,11 +1107,6 @@ export type ProductTranslationFindManyArgs<ExtArgs extends runtime.Types.Extensi
|
|
|
1107
1107
|
* Skip the first `n` ProductTranslations.
|
|
1108
1108
|
*/
|
|
1109
1109
|
skip?: number;
|
|
1110
|
-
/**
|
|
1111
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1112
|
-
*
|
|
1113
|
-
* Filter by unique combinations of ProductTranslations.
|
|
1114
|
-
*/
|
|
1115
1110
|
distinct?: Prisma.ProductTranslationScalarFieldEnum | Prisma.ProductTranslationScalarFieldEnum[];
|
|
1116
1111
|
};
|
|
1117
1112
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ProductTranslation.js.map
|
|
1
|
+
export{};
|
|
@@ -1433,11 +1433,6 @@ export type ReservationFindManyArgs<ExtArgs extends runtime.Types.Extensions.Int
|
|
|
1433
1433
|
* Skip the first `n` Reservations.
|
|
1434
1434
|
*/
|
|
1435
1435
|
skip?: number;
|
|
1436
|
-
/**
|
|
1437
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1438
|
-
*
|
|
1439
|
-
* Filter by unique combinations of Reservations.
|
|
1440
|
-
*/
|
|
1441
1436
|
distinct?: Prisma.ReservationScalarFieldEnum | Prisma.ReservationScalarFieldEnum[];
|
|
1442
1437
|
};
|
|
1443
1438
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Reservation.js.map
|
|
1
|
+
export{};
|
|
@@ -1102,11 +1102,6 @@ export type SessionFindManyArgs<ExtArgs extends runtime.Types.Extensions.Interna
|
|
|
1102
1102
|
* Skip the first `n` Sessions.
|
|
1103
1103
|
*/
|
|
1104
1104
|
skip?: number;
|
|
1105
|
-
/**
|
|
1106
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1107
|
-
*
|
|
1108
|
-
* Filter by unique combinations of Sessions.
|
|
1109
|
-
*/
|
|
1110
1105
|
distinct?: Prisma.SessionScalarFieldEnum | Prisma.SessionScalarFieldEnum[];
|
|
1111
1106
|
};
|
|
1112
1107
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Session.js.map
|
|
1
|
+
export{};
|
|
@@ -1656,11 +1656,6 @@ export type ShippingMethodFindManyArgs<ExtArgs extends runtime.Types.Extensions.
|
|
|
1656
1656
|
* Skip the first `n` ShippingMethods.
|
|
1657
1657
|
*/
|
|
1658
1658
|
skip?: number;
|
|
1659
|
-
/**
|
|
1660
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1661
|
-
*
|
|
1662
|
-
* Filter by unique combinations of ShippingMethods.
|
|
1663
|
-
*/
|
|
1664
1659
|
distinct?: Prisma.ShippingMethodScalarFieldEnum | Prisma.ShippingMethodScalarFieldEnum[];
|
|
1665
1660
|
};
|
|
1666
1661
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ShippingMethod.js.map
|
|
1
|
+
export{};
|
|
@@ -1152,11 +1152,6 @@ export type ShippingZoneFindManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
|
|
1152
1152
|
* Skip the first `n` ShippingZones.
|
|
1153
1153
|
*/
|
|
1154
1154
|
skip?: number;
|
|
1155
|
-
/**
|
|
1156
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1157
|
-
*
|
|
1158
|
-
* Filter by unique combinations of ShippingZones.
|
|
1159
|
-
*/
|
|
1160
1155
|
distinct?: Prisma.ShippingZoneScalarFieldEnum | Prisma.ShippingZoneScalarFieldEnum[];
|
|
1161
1156
|
};
|
|
1162
1157
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=ShippingZone.js.map
|
|
1
|
+
export{};
|
|
@@ -1834,11 +1834,6 @@ export type UserFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalAr
|
|
|
1834
1834
|
* Skip the first `n` Users.
|
|
1835
1835
|
*/
|
|
1836
1836
|
skip?: number;
|
|
1837
|
-
/**
|
|
1838
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
1839
|
-
*
|
|
1840
|
-
* Filter by unique combinations of Users.
|
|
1841
|
-
*/
|
|
1842
1837
|
distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[];
|
|
1843
1838
|
};
|
|
1844
1839
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=User.js.map
|
|
1
|
+
export{};
|
|
@@ -840,11 +840,6 @@ export type VerificationFindManyArgs<ExtArgs extends runtime.Types.Extensions.In
|
|
|
840
840
|
* Skip the first `n` Verifications.
|
|
841
841
|
*/
|
|
842
842
|
skip?: number;
|
|
843
|
-
/**
|
|
844
|
-
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
|
|
845
|
-
*
|
|
846
|
-
* Filter by unique combinations of Verifications.
|
|
847
|
-
*/
|
|
848
843
|
distinct?: Prisma.VerificationScalarFieldEnum | Prisma.VerificationScalarFieldEnum[];
|
|
849
844
|
};
|
|
850
845
|
/**
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=Verification.js.map
|
|
1
|
+
export{};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=models.js.map
|
|
1
|
+
export{};
|
package/src/core/db/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export*from"./__generated__/client/client";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const Body: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
3
|
+
export declare const Button: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
4
|
+
export declare const Column: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
5
|
+
export declare const Container: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
6
|
+
export declare const Head: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
7
|
+
export declare const Heading: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
8
|
+
export declare const Hr: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
9
|
+
export declare const Html: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
10
|
+
export declare const Img: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
11
|
+
export declare const Link: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
12
|
+
export declare const Preview: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
13
|
+
export declare const Row: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
14
|
+
export declare const Section: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
15
|
+
export declare const Tailwind: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
16
|
+
export declare const Text: React.ElementType<any, keyof React.JSX.IntrinsicElements>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Body as o,Button as e,Column as n,Container as i,Head as c,Heading as s,Hr as m,Html as r,Img as l,Link as x,Preview as R,Row as p,Section as E,Tailwind as d,Text as H}from"@react-email/components";const t=a=>a;export const Body=t(o),Button=t(e),Column=t(n),Container=t(i),Head=t(c),Heading=t(s),Hr=t(m),Html=t(r),Img=t(l),Link=t(x),Preview=t(R),Row=t(p),Section=t(E),Tailwind=t(d),Text=t(H);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../../../../packages/rest-api/src/core/email/components.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,IAAI,cAAc,EACtB,MAAM,IAAI,gBAAgB,EAC1B,MAAM,IAAI,gBAAgB,EAC1B,SAAS,IAAI,mBAAmB,EAChC,IAAI,IAAI,cAAc,EACtB,OAAO,IAAI,iBAAiB,EAC5B,EAAE,IAAI,YAAY,EAClB,IAAI,IAAI,cAAc,EACtB,GAAG,IAAI,aAAa,EACpB,IAAI,IAAI,cAAc,EACtB,OAAO,IAAI,iBAAiB,EAC5B,GAAG,IAAI,aAAa,EACpB,OAAO,IAAI,iBAAiB,EAC5B,QAAQ,IAAI,kBAAkB,EAC9B,IAAI,IAAI,cAAc,GACvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,gBAAgB,GAAG,CAAC,SAAkB,EAAE,EAAE,CAC9C,SAA8B,CAAC;AAEjC,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,GAAG,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
class
|
|
2
|
-
constructor(status, message) {
|
|
3
|
-
super(message);
|
|
4
|
-
this.status = status;
|
|
5
|
-
this.message = message;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export { HttpException };
|
|
9
|
-
//# sourceMappingURL=http-exception.js.map
|
|
1
|
+
class r extends Error{constructor(s,t){super(t),this.status=s,this.message=t}}export{r as HttpException};
|
package/src/core/hono/hono.js
CHANGED
|
@@ -1,123 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRoute, OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
-
import { getReasonPhrase, StatusCodes } from "http-status-codes";
|
|
4
|
-
import { HttpException } from "../exceptions/http-exception";
|
|
5
|
-
const toOpenApiPath = (path) => {
|
|
6
|
-
return path.replace(/:([A-Za-z0-9_]+)/g, "{$1}");
|
|
7
|
-
};
|
|
8
|
-
const buildResponse = (status, schema) => {
|
|
9
|
-
const description = status === StatusCodes.NO_CONTENT
|
|
10
|
-
? "No Content"
|
|
11
|
-
: getReasonPhrase(status);
|
|
12
|
-
if (!schema || status === StatusCodes.NO_CONTENT) {
|
|
13
|
-
return { description };
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
content: {
|
|
17
|
-
"application/json": {
|
|
18
|
-
schema,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
description,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export const createApiRoute = ({ body, bodyRequired = true, description, headers, method, operationId, path, pathParams, query, responses, summary, tags, }) => {
|
|
25
|
-
return createRoute({
|
|
26
|
-
description,
|
|
27
|
-
method: method.toLowerCase(),
|
|
28
|
-
operationId,
|
|
29
|
-
path: toOpenApiPath(path),
|
|
30
|
-
request: Object.assign(Object.assign(Object.assign(Object.assign({}, (body
|
|
31
|
-
? {
|
|
32
|
-
body: {
|
|
33
|
-
content: {
|
|
34
|
-
"application/json": {
|
|
35
|
-
schema: body,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
required: bodyRequired,
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
: {})), (headers ? { headers } : {})), (pathParams ? { params: pathParams } : {})), (query ? { query } : {})),
|
|
42
|
-
responses: Object.fromEntries(Object.entries(responses).map(([status, schema]) => [
|
|
43
|
-
Number(status),
|
|
44
|
-
buildResponse(Number(status), schema),
|
|
45
|
-
])),
|
|
46
|
-
summary,
|
|
47
|
-
tags,
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
export const createApiRouter = () => {
|
|
51
|
-
return new OpenAPIHono({
|
|
52
|
-
defaultHook: (result, c) => {
|
|
53
|
-
if (result.success) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
return c.json({
|
|
57
|
-
error: result.error.flatten(),
|
|
58
|
-
message: "Validation Error",
|
|
59
|
-
status: StatusCodes.BAD_REQUEST,
|
|
60
|
-
}, StatusCodes.BAD_REQUEST);
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export const createUnavailableAuth = () => ({
|
|
65
|
-
getCurrentUser: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
throw new Error("Auth is not available for OpenAPI generation.");
|
|
67
|
-
}),
|
|
68
|
-
isGranted: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
-
throw new Error("Auth is not available for OpenAPI generation.");
|
|
70
|
-
}),
|
|
71
|
-
});
|
|
72
|
-
export const attachAuthContext = (app, auth) => {
|
|
73
|
-
app.use("*", (c, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
-
c.set("auth", auth);
|
|
75
|
-
Object.assign(c.req.raw, { auth });
|
|
76
|
-
yield next();
|
|
77
|
-
}));
|
|
78
|
-
return app;
|
|
79
|
-
};
|
|
80
|
-
export const handleAppError = (error) => {
|
|
81
|
-
var _a;
|
|
82
|
-
if (error instanceof HttpException) {
|
|
83
|
-
return new Response(JSON.stringify({
|
|
84
|
-
message: error.message,
|
|
85
|
-
status: error.status,
|
|
86
|
-
}), {
|
|
87
|
-
headers: {
|
|
88
|
-
"content-type": "application/json",
|
|
89
|
-
},
|
|
90
|
-
status: error.status,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
const authStatus = typeof (error === null || error === void 0 ? void 0 : error.statusCode) === "number"
|
|
94
|
-
? error.statusCode
|
|
95
|
-
: undefined;
|
|
96
|
-
if (!authStatus || authStatus >= StatusCodes.INTERNAL_SERVER_ERROR) {
|
|
97
|
-
console.error(error);
|
|
98
|
-
}
|
|
99
|
-
if (authStatus) {
|
|
100
|
-
const message = ((_a = error === null || error === void 0 ? void 0 : error.body) === null || _a === void 0 ? void 0 : _a.message) ||
|
|
101
|
-
(error === null || error === void 0 ? void 0 : error.message) ||
|
|
102
|
-
getReasonPhrase(authStatus);
|
|
103
|
-
return new Response(JSON.stringify({
|
|
104
|
-
message,
|
|
105
|
-
status: authStatus,
|
|
106
|
-
}), {
|
|
107
|
-
headers: {
|
|
108
|
-
"content-type": "application/json",
|
|
109
|
-
},
|
|
110
|
-
status: authStatus,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return new Response(JSON.stringify({
|
|
114
|
-
message: "Internal Server Error",
|
|
115
|
-
status: StatusCodes.INTERNAL_SERVER_ERROR,
|
|
116
|
-
}), {
|
|
117
|
-
headers: {
|
|
118
|
-
"content-type": "application/json",
|
|
119
|
-
},
|
|
120
|
-
status: StatusCodes.INTERNAL_SERVER_ERROR,
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=hono.js.map
|
|
1
|
+
import{__awaiter as i}from"tslib";import{createRoute as m,OpenAPIHono as O}from"@hono/zod-openapi";import{getReasonPhrase as c,StatusCodes as o}from"http-status-codes";import{HttpException as g}from"../exceptions/http-exception";const N=t=>t.replace(/:([A-Za-z0-9_]+)/g,"{$1}"),A=(t,n)=>{const e=t===o.NO_CONTENT?"No Content":c(t);return!n||t===o.NO_CONTENT?{description:e}:{content:{"application/json":{schema:n}},description:e}};export const createApiRoute=({body:t,bodyRequired:n=!0,description:e,headers:s,method:p,operationId:d,path:R,pathParams:a,query:r,responses:l,summary:E,tags:f})=>m({description:e,method:p.toLowerCase(),operationId:d,path:N(R),request:Object.assign(Object.assign(Object.assign(Object.assign({},t?{body:{content:{"application/json":{schema:t}},required:n}}:{}),s?{headers:s}:{}),a?{params:a}:{}),r?{query:r}:{}),responses:Object.fromEntries(Object.entries(l).map(([u,v])=>[Number(u),A(Number(u),v)])),summary:E,tags:f}),createApiRouter=()=>new O({defaultHook:(t,n)=>{if(!t.success)return n.json({error:t.error.flatten(),message:"Validation Error",status:o.BAD_REQUEST},o.BAD_REQUEST)}}),createUnavailableAuth=()=>({getCurrentUser:()=>i(void 0,void 0,void 0,function*(){throw new Error("Auth is not available for OpenAPI generation.")}),isGranted:()=>i(void 0,void 0,void 0,function*(){throw new Error("Auth is not available for OpenAPI generation.")})}),attachAuthContext=(t,n)=>(t.use("*",(e,s)=>i(void 0,void 0,void 0,function*(){e.set("auth",n),Object.assign(e.req.raw,{auth:n}),yield s()})),t),handleAppError=t=>{var n;if(t instanceof g)return new Response(JSON.stringify({message:t.message,status:t.status}),{headers:{"content-type":"application/json"},status:t.status});const e=typeof t?.statusCode=="number"?t.statusCode:void 0;if((!e||e>=o.INTERNAL_SERVER_ERROR)&&console.error(t),e){const s=((n=t?.body)===null||n===void 0?void 0:n.message)||t?.message||c(e);return new Response(JSON.stringify({message:s,status:e}),{headers:{"content-type":"application/json"},status:e})}return new Response(JSON.stringify({message:"Internal Server Error",status:o.INTERNAL_SERVER_ERROR}),{headers:{"content-type":"application/json"},status:o.INTERNAL_SERVER_ERROR})};
|