@mohasinac/appkit 2.8.10 → 3.0.1
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/dist/_internal/client/features/layout/SidebarCollapseToggle.js +1 -5
- package/dist/_internal/server/features/auctions/actions.js +0 -1
- package/dist/_internal/server/features/auctions/og.js +0 -1
- package/dist/_internal/server/features/auctions/service.js +0 -4
- package/dist/_internal/server/features/auth/capabilities.js +0 -1
- package/dist/_internal/server/features/blog/actions.js +0 -2
- package/dist/_internal/server/features/brands/actions.js +0 -2
- package/dist/_internal/server/features/cart/actions.js +0 -3
- package/dist/_internal/server/features/checkout/actions.js +11 -20
- package/dist/_internal/server/features/events/actions.js +0 -3
- package/dist/_internal/server/features/events/og.js +0 -1
- package/dist/_internal/server/features/events/service.js +0 -2
- package/dist/_internal/server/features/grouped/data.js +0 -2
- package/dist/_internal/server/features/orders/actions.js +0 -4
- package/dist/_internal/server/features/pre-orders/actions.js +0 -1
- package/dist/_internal/server/features/pre-orders/og.js +0 -1
- package/dist/_internal/server/features/pre-orders/service.js +0 -1
- package/dist/_internal/server/features/products/actions.js +0 -6
- package/dist/_internal/server/features/products/service.js +0 -1
- package/dist/_internal/server/features/promotions/actions.js +0 -3
- package/dist/_internal/server/features/reviews/actions.js +0 -3
- package/dist/_internal/server/functions/https.js +0 -6
- package/dist/_internal/server/functions/manifest.js +0 -1
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.js +1 -1
- package/dist/_internal/server/jobs/core/wrapJobHandler.js +0 -1
- package/dist/_internal/shared/listing-types/action-tracker.js +1 -1
- package/dist/_internal/shared/serialization/index.js +0 -4
- package/dist/_internal/shared/styles/themed.js +0 -3
- package/dist/client/api/ApiError.js +1 -4
- package/dist/client/api/surface-error.js +0 -1
- package/dist/client/api/useApiQuery.js +0 -1
- package/dist/configs/next.js +0 -1
- package/dist/configs/tailwind.js +0 -1
- package/dist/contracts/field-ops.js +0 -2
- package/dist/core/EventBus.js +0 -2
- package/dist/core/Logger.js +0 -6
- package/dist/core/Queue.js +0 -2
- package/dist/core/hooks/useSyncManager.js +4 -4
- package/dist/core/mutation-events.js +0 -1
- package/dist/core/newsletter.repository.js +2 -6
- package/dist/errors/api-error.js +0 -1
- package/dist/errors/authentication-error.js +0 -1
- package/dist/errors/authorization-error.js +0 -1
- package/dist/errors/base-error.js +1 -3
- package/dist/errors/database-error.js +0 -1
- package/dist/errors/error-handler.js +1 -5
- package/dist/errors/error-mapping.js +1 -6
- package/dist/errors/normalize.js +0 -4
- package/dist/errors/not-found-error.js +0 -1
- package/dist/errors/razorpay-unreachable.js +0 -1
- package/dist/errors/validation-error.js +0 -1
- package/dist/features/about/components/FAQPageView.js +1 -3
- package/dist/features/about/components/FeesView.js +1 -3
- package/dist/features/about/components/HelpPageView.js +1 -3
- package/dist/features/about/components/PublicProfileView.js +4 -4
- package/dist/features/account/components/AddressBook.js +1 -3
- package/dist/features/account/components/AddressForm.js +0 -1
- package/dist/features/account/components/AddressesIndexListing.js +0 -1
- package/dist/features/account/components/MessagesView.js +1 -3
- package/dist/features/account/components/NotificationBell.js +3 -14
- package/dist/features/account/components/NotificationPreferencesPanel.js +1 -1
- package/dist/features/account/components/UserOffersPanel.js +0 -2
- package/dist/features/account/components/UserSidebar.js +1 -3
- package/dist/features/admin/components/AdminBlogEditorView.js +0 -1
- package/dist/features/admin/components/AdminBundleEditorView.js +0 -1
- package/dist/features/admin/components/AdminBundlesView.js +0 -1
- package/dist/features/admin/components/AdminCarouselEditorView.js +1 -5
- package/dist/features/admin/components/AdminCarouselView.js +1 -4
- package/dist/features/admin/components/AdminCartsView.js +0 -1
- package/dist/features/admin/components/AdminMediaView.js +1 -3
- package/dist/features/admin/components/AdminPayoutsView.js +0 -1
- package/dist/features/admin/components/AdminProductsView.js +1 -3
- package/dist/features/admin/components/AdminSidebar.js +1 -3
- package/dist/features/admin/components/AdminSiteSettingsView.js +1 -5
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +7 -13
- package/dist/features/admin/components/DashboardStats.js +1 -7
- package/dist/features/admin/components/DataListingView.js +1 -5
- package/dist/features/admin/components/DataTable.js +1 -3
- package/dist/features/admin/components/analytics/AdminAnalyticsCharts.js +1 -3
- package/dist/features/admin/components/analytics/AdminStatCard.js +1 -7
- package/dist/features/admin/components/analytics/AdminTopProductsTable.js +1 -3
- package/dist/features/admin/components/sections/adminSectionsBuildParse.js +0 -5
- package/dist/features/admin/hooks/useAdminListingData.js +0 -5
- package/dist/features/admin/hooks/useChat.js +0 -3
- package/dist/features/admin/repository/chat.repository.js +0 -1
- package/dist/features/admin/repository/notification.repository.js +1 -4
- package/dist/features/auctions/components/AuctionBidsTable.js +1 -7
- package/dist/features/auctions/components/AuctionDetailPageView.js +1 -6
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +3 -15
- package/dist/features/auctions/components/PlaceBidFormClient.js +0 -3
- package/dist/features/auctions/repository/bid.repository.js +0 -1
- package/dist/features/auth/components/ForgotPasswordView.js +0 -1
- package/dist/features/auth/components/LoginForm.js +0 -1
- package/dist/features/auth/components/RegisterForm.js +0 -1
- package/dist/features/auth/components/ResetPasswordView.js +0 -1
- package/dist/features/auth/hooks/useAuth.js +0 -1
- package/dist/features/auth/repository/session.repository.js +0 -1
- package/dist/features/auth/repository/token.repository.js +0 -2
- package/dist/features/auth/repository/user.repository.js +0 -1
- package/dist/features/blog/api/[slug]/route.js +1 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +1 -5
- package/dist/features/blog/components/BlogIndexListing.js +0 -1
- package/dist/features/blog/components/BlogListView.js +1 -5
- package/dist/features/blog/components/BlogPostView.js +1 -3
- package/dist/features/cart/components/CartDrawer.js +2 -6
- package/dist/features/cart/repository/cart.repository.js +0 -1
- package/dist/features/categories/api/route.js +0 -1
- package/dist/features/categories/components/BrandDetailPageView.js +1 -13
- package/dist/features/categories/components/BundleDetailView.js +1 -5
- package/dist/features/categories/components/BundleItemsPicker.js +1 -5
- package/dist/features/categories/components/CategoriesIndexListing.js +0 -1
- package/dist/features/categories/components/CategoriesIndexPageView.js +0 -1
- package/dist/features/categories/components/CategoryBundlesListing.js +1 -3
- package/dist/features/categories/components/CategoryDetailPageView.js +1 -16
- package/dist/features/categories/components/CategoryGrid.js +1 -5
- package/dist/features/categories/components/CategorySelectorCreate.js +0 -1
- package/dist/features/categories/components/CategoryTableColumns.js +2 -6
- package/dist/features/categories/components/CategoryTree.js +1 -3
- package/dist/features/categories/components/ConcernCard.js +1 -3
- package/dist/features/collections/components/CollectionCard.js +1 -5
- package/dist/features/contact/email.js +0 -1
- package/dist/features/events/actions/event-actions.js +0 -1
- package/dist/features/events/api/[id]/route.js +0 -1
- package/dist/features/events/components/AdminEventEditorView.js +1 -2
- package/dist/features/events/components/EventCard.js +2 -8
- package/dist/features/events/components/EventRaffleEntryForm.js +1 -3
- package/dist/features/events/components/EventRaffleWinnerView.js +1 -3
- package/dist/features/events/components/EventRafflesSection.js +0 -1
- package/dist/features/events/components/EventsIndexListing.js +0 -1
- package/dist/features/events/hooks/useBulkEvent.js +0 -1
- package/dist/features/events/repository/event-entry.repository.js +0 -1
- package/dist/features/faq/components/ContactCTA.js +1 -3
- package/dist/features/faq/components/FAQAccordion.js +1 -3
- package/dist/features/faq/components/FAQCategorySidebar.js +1 -3
- package/dist/features/faq/components/RelatedFAQs.js +1 -5
- package/dist/features/filters/AsyncFacetSection.js +1 -3
- package/dist/features/filters/FilterFacetSection.js +4 -14
- package/dist/features/forms/Checkbox.js +1 -3
- package/dist/features/forms/Slider.js +1 -3
- package/dist/features/history/hooks/useHistory.js +0 -1
- package/dist/features/history/repository/user-history.repository.js +0 -2
- package/dist/features/homepage/actions/carousel-actions.js +0 -1
- package/dist/features/homepage/actions/homepage-section-actions.js +1 -3
- package/dist/features/homepage/api/carousel/route.js +0 -1
- package/dist/features/homepage/api/route.js +0 -1
- package/dist/features/homepage/components/AdSlot.js +3 -9
- package/dist/features/homepage/components/AdvertisementBanner.js +2 -12
- package/dist/features/homepage/components/BeforeAfterCard.js +1 -5
- package/dist/features/homepage/components/CharacterHotspotForm.js +2 -10
- package/dist/features/homepage/components/CollectionCardsSection.js +1 -3
- package/dist/features/homepage/components/CustomCardsSection.js +1 -5
- package/dist/features/homepage/components/FeaturedResultsSection.js +1 -3
- package/dist/features/homepage/components/GoogleReviewsSection.js +1 -3
- package/dist/features/homepage/components/HeroCarousel.js +5 -26
- package/dist/features/homepage/components/HeroSection.js +2 -6
- package/dist/features/homepage/components/HowItWorksSection.js +2 -8
- package/dist/features/homepage/components/MarketplaceHomepageView.js +0 -8
- package/dist/features/homepage/components/NewsletterBanner.js +2 -10
- package/dist/features/homepage/components/PromoGrid.js +1 -3
- package/dist/features/homepage/components/SecurityHighlightsSection.js +2 -6
- package/dist/features/homepage/components/ShopByCategorySection.js +2 -6
- package/dist/features/homepage/components/SocialPostCard.js +1 -3
- package/dist/features/homepage/components/StatsCounterSection.js +1 -5
- package/dist/features/homepage/components/TrustBadges.js +1 -3
- package/dist/features/homepage/components/TrustFeaturesSection.js +1 -3
- package/dist/features/homepage/components/WelcomeSection.js +2 -16
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +1 -5
- package/dist/features/homepage/lib/social-feed-fetcher.js +0 -8
- package/dist/features/layout/AppLayoutShell.js +1 -3
- package/dist/features/layout/BottomNavbar.js +1 -11
- package/dist/features/media/MediaAudio.js +2 -6
- package/dist/features/media/MediaImage.js +0 -1
- package/dist/features/media/MediaLightbox.js +3 -9
- package/dist/features/media/MediaVideo.js +2 -8
- package/dist/features/media/upload/MediaUploadField.js +1 -3
- package/dist/features/messages/hooks/useConversation.js +0 -2
- package/dist/features/messages/hooks/useConversations.js +0 -1
- package/dist/features/messages/repository/conversations.repository.js +0 -1
- package/dist/features/orders/api/track/[trackingId]/route.js +0 -1
- package/dist/features/orders/components/OrdersList.js +1 -3
- package/dist/features/orders/components/RefundHistoryTable.js +1 -3
- package/dist/features/orders/repository/orders.repository.js +0 -2
- package/dist/features/payments/repository/payout.repository.js +0 -1
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +2 -6
- package/dist/features/pre-orders/components/PreOrderActionsClient.js +0 -1
- package/dist/features/pre-orders/components/PreOrderBadge.js +1 -3
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +1 -5
- package/dist/features/products/api/route.js +1 -3
- package/dist/features/products/components/CompareOverlay.js +1 -6
- package/dist/features/products/components/FeatureBadge.js +1 -3
- package/dist/features/products/components/MakeOfferButton.js +0 -2
- package/dist/features/products/components/MarketplaceBundleCard.js +1 -3
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +1 -3
- package/dist/features/products/components/PrizeDrawDetailPageView.js +0 -2
- package/dist/features/products/components/PrizeDrawItemsEditor.js +1 -3
- package/dist/features/products/components/PrizeDrawsSection.js +1 -3
- package/dist/features/products/components/ProductDetailPageView.js +0 -6
- package/dist/features/products/components/ProductFeatureBadges.js +1 -3
- package/dist/features/products/components/ProductFeaturesSelector.js +0 -1
- package/dist/features/products/components/ProductGrid.js +5 -15
- package/dist/features/products/components/ShareButton.js +1 -1
- package/dist/features/products/components/ShowGroupSection.js +3 -7
- package/dist/features/products/components/SublistingCarouselSection.js +2 -4
- package/dist/features/products/repository/product-features.repository.js +0 -1
- package/dist/features/products/repository/products.repository.js +0 -1
- package/dist/features/promotions/components/CouponCard.js +2 -5
- package/dist/features/promotions/repository/coupons.repository.js +0 -1
- package/dist/features/reviews/api/route.js +0 -1
- package/dist/features/reviews/components/ReviewDetailShell.js +3 -13
- package/dist/features/reviews/components/ReviewModal.js +1 -5
- package/dist/features/reviews/components/ReviewSummary.js +2 -6
- package/dist/features/reviews/components/ReviewsIndexListing.js +0 -1
- package/dist/features/reviews/components/ReviewsList.js +1 -7
- package/dist/features/reviews/repository/reviews.repository.js +0 -3
- package/dist/features/scams/actions/scam-actions.js +1 -1
- package/dist/features/scams/components/ScamProfileView.js +1 -3
- package/dist/features/search/components/Search.js +2 -8
- package/dist/features/search/components/SearchFiltersRow.js +1 -3
- package/dist/features/seller/components/PhysicalLocationModal.js +1 -5
- package/dist/features/seller/components/SellerAddressesView.js +1 -6
- package/dist/features/seller/components/SellerAnalyticsAlertsView.js +1 -4
- package/dist/features/seller/components/SellerBidsView.js +1 -3
- package/dist/features/seller/components/SellerBundlesView.js +0 -1
- package/dist/features/seller/components/SellerCouponEditorView.js +1 -3
- package/dist/features/seller/components/SellerFeaturesView.js +0 -1
- package/dist/features/seller/components/SellerGoogleReviewsView.js +1 -1
- package/dist/features/seller/components/SellerLiveView.js +1 -3
- package/dist/features/seller/components/SellerOffersPanel.js +0 -2
- package/dist/features/seller/components/SellerOrdersView.js +1 -6
- package/dist/features/seller/components/SellerPayoutMethodsView.js +0 -1
- package/dist/features/seller/components/SellerPayoutRequestView.js +1 -1
- package/dist/features/seller/components/SellerPayoutSettingsView.js +1 -1
- package/dist/features/seller/components/SellerProductShell.js +2 -4
- package/dist/features/seller/components/SellerProductsCards.js +1 -3
- package/dist/features/seller/components/SellerProductsView.js +1 -7
- package/dist/features/seller/components/SellerReviewsView.js +1 -4
- package/dist/features/seller/components/SellerShippingConfigsView.js +1 -4
- package/dist/features/seller/components/SellerShippingView.js +1 -1
- package/dist/features/seller/components/SellerSidebar.js +4 -12
- package/dist/features/seller/components/SellerStoreCategoriesView.js +0 -2
- package/dist/features/seller/components/SellerTemplatesView.js +0 -1
- package/dist/features/seller/components/analytics/SellerRevenueChart.js +1 -3
- package/dist/features/seller/components/analytics/SellerTopProducts.js +1 -3
- package/dist/features/seller/hooks/useSellerListingData.js +0 -5
- package/dist/features/seller/repository/offer.repository.js +0 -1
- package/dist/features/server-errors/repository/server-errors.repository.js +0 -2
- package/dist/features/shell/FormShell.js +2 -15
- package/dist/features/shell/QuickFormDrawer.js +1 -5
- package/dist/features/site-settings/components/NavPermissionsManager.js +1 -3
- package/dist/features/site-settings/components/ThemeManagerView.js +0 -1
- package/dist/features/stores/api/[storeSlug]/reviews/route.js +0 -1
- package/dist/features/stores/components/StoreGuideHubView.js +1 -1
- package/dist/features/stores/components/StoreHeader.js +1 -7
- package/dist/features/stores/components/StoreReviewsListing.js +0 -1
- package/dist/features/stores/components/StoresIndexListing.js +0 -1
- package/dist/features/stores/repository/store.repository.js +0 -2
- package/dist/features/support/repository/support.repository.js +0 -1
- package/dist/features/wishlist/components/WishlistPage.js +1 -3
- package/dist/features/wishlist/hooks/useWishlistCount.js +1 -1
- package/dist/features/wishlist/repository/user-wishlist.repository.js +0 -2
- package/dist/http/ApiClient.js +4 -12
- package/dist/index.js +0 -1
- package/dist/monitoring/client-logger.js +7 -22
- package/dist/monitoring/error-tracking.js +0 -1
- package/dist/monitoring/performance.js +0 -1
- package/dist/monitoring/server-logger.js +11 -33
- package/dist/next/api/api-response.js +1 -4
- package/dist/next/api/apiHandler.js +1 -5
- package/dist/next/api/errorHandler.js +0 -3
- package/dist/next/api/parseJsonBody.js +0 -1
- package/dist/next/api/routeHandler.js +1 -8
- package/dist/next/cache-middleware.js +1 -3
- package/dist/next/middleware/chain.js +0 -1
- package/dist/next/middleware/pii-scrubber.js +0 -2
- package/dist/providers/auth-firebase/provider.js +0 -1
- package/dist/providers/db-firebase/admin.js +0 -1
- package/dist/providers/db-firebase/base.js +0 -4
- package/dist/providers/db-firebase/base.repository.js +0 -3
- package/dist/providers/db-firebase/field-ops.js +0 -2
- package/dist/providers/db-firebase/helpers.js +0 -4
- package/dist/providers/db-firebase/realtime.js +3 -15
- package/dist/providers/db-firebase/sieve.js +2 -8
- package/dist/providers/payment-razorpay/index.js +0 -3
- package/dist/providers/shipping-shiprocket/index.js +0 -1
- package/dist/providers/storage-firebase/client.js +0 -4
- package/dist/react/contexts/SessionContext.js +0 -1
- package/dist/react/hooks/useCountdown.js +0 -1
- package/dist/security/authorization.js +0 -1
- package/dist/security/pii-encrypt.js +0 -4
- package/dist/security/pii-redact.js +0 -3
- package/dist/seed/manifest.js +1 -6
- package/dist/seed/runner.js +0 -2
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/DataTable.js +2 -6
- package/dist/ui/components/Anchor.js +0 -1
- package/dist/ui/components/AvatarDisplay.js +1 -3
- package/dist/ui/components/BackgroundRenderer.js +2 -6
- package/dist/ui/components/BaseListingCard.js +0 -1
- package/dist/ui/components/Button.js +0 -4
- package/dist/ui/components/Card.js +2 -6
- package/dist/ui/components/Details.js +2 -8
- package/dist/ui/components/Dialog.js +0 -1
- package/dist/ui/components/FallbackShell.js +5 -17
- package/dist/ui/components/Fieldset.js +2 -6
- package/dist/ui/components/HorizontalRule.js +0 -1
- package/dist/ui/components/HotspotMarker.js +1 -3
- package/dist/ui/components/IconBox.js +0 -1
- package/dist/ui/components/Iframe.js +0 -1
- package/dist/ui/components/ImageGallery.js +1 -3
- package/dist/ui/components/ImageLightbox.js +1 -5
- package/dist/ui/components/Kbd.js +0 -1
- package/dist/ui/components/Motion.js +1 -3
- package/dist/ui/components/NavbarChevron.js +0 -1
- package/dist/ui/components/PasswordStrengthIndicator.js +1 -3
- package/dist/ui/components/Progress.js +2 -6
- package/dist/ui/components/Quote.js +1 -4
- package/dist/ui/components/Responsive.js +0 -4
- package/dist/ui/components/RowActionMenu.js +1 -3
- package/dist/ui/components/Scrim.js +0 -1
- package/dist/ui/components/SiteLogo.js +1 -9
- package/dist/ui/components/Skeleton.js +1 -3
- package/dist/ui/components/Slider.js +1 -3
- package/dist/ui/components/StickyToolbar.js +0 -1
- package/dist/ui/components/TabStrip.js +1 -3
- package/dist/ui/components/Toast.js +1 -3
- package/dist/ui/components/Tooltip.js +1 -4
- package/dist/ui/components/UnsavedChangesModal.js +1 -3
- package/dist/ui/rich-text/RichText.js +1 -1
- package/dist/utils/action-response.js +0 -1
- package/dist/utils/date.formatter.js +0 -1
- package/dist/utils/object.helper.js +0 -2
- package/dist/utils/schema-ui.js +1 -3
- package/dist/validation/input.validator.js +0 -1
- package/dist/validation/schemas.js +1 -3
- package/package.json +5 -2
- package/scripts/bundle-css.mjs +47 -0
- package/scripts/copy-assets.mjs +34 -0
- package/scripts/dedupe-peer-deps.mjs +81 -0
|
@@ -40,10 +40,8 @@ function serializeError(error) {
|
|
|
40
40
|
}
|
|
41
41
|
return serialized;
|
|
42
42
|
}
|
|
43
|
-
// audit-unknown-ok: this is the entry-point normaliser that accepts arbitrary
|
|
44
43
|
// log-data payloads (Error, Date, primitive, object). Output is bounded by the
|
|
45
44
|
// downstream JSON-stringify contract.
|
|
46
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
47
45
|
function normalizeLogData(data) {
|
|
48
46
|
if (data instanceof Error)
|
|
49
47
|
return serializeError(data);
|
|
@@ -138,12 +136,10 @@ async function writeLog(entry) {
|
|
|
138
136
|
}
|
|
139
137
|
}
|
|
140
138
|
export const serverLogger = {
|
|
141
|
-
// audit-unknown-ok: logger entry-point — accepts arbitrary log data, normalised internally
|
|
142
139
|
debug(message, data) {
|
|
143
140
|
const sanitized = data ? redactPii(normalizeLogData(data)) : undefined;
|
|
144
141
|
console.debug(`[DEBUG] ${message}`, sanitized);
|
|
145
142
|
},
|
|
146
|
-
// audit-unknown-ok: logger entry-point — accepts arbitrary log data
|
|
147
143
|
info(message, data) {
|
|
148
144
|
const sanitized = data ? redactPii(normalizeLogData(data)) : undefined;
|
|
149
145
|
const entry = {
|
|
@@ -154,9 +150,8 @@ export const serverLogger = {
|
|
|
154
150
|
};
|
|
155
151
|
console.info(`[INFO] ${message}`, sanitized);
|
|
156
152
|
if (isFileLoggingEnabled)
|
|
157
|
-
writeLog(entry).catch(() => { });
|
|
153
|
+
writeLog(entry).catch(() => { });
|
|
158
154
|
},
|
|
159
|
-
// audit-unknown-ok: logger entry-point — accepts arbitrary log data
|
|
160
155
|
warn(message, data) {
|
|
161
156
|
const sanitized = data ? redactPii(normalizeLogData(data)) : undefined;
|
|
162
157
|
const entry = {
|
|
@@ -167,9 +162,8 @@ export const serverLogger = {
|
|
|
167
162
|
};
|
|
168
163
|
console.warn(`[WARN] ${message}`, sanitized);
|
|
169
164
|
if (isFileLoggingEnabled)
|
|
170
|
-
writeLog(entry).catch(() => { });
|
|
165
|
+
writeLog(entry).catch(() => { });
|
|
171
166
|
},
|
|
172
|
-
// audit-unknown-ok: logger entry-point — accepts arbitrary log data
|
|
173
167
|
error(message, data) {
|
|
174
168
|
const sanitized = data ? redactPii(normalizeLogData(data)) : undefined;
|
|
175
169
|
const entry = {
|
|
@@ -180,7 +174,7 @@ export const serverLogger = {
|
|
|
180
174
|
};
|
|
181
175
|
console.error(`[ERROR] ${message}`, sanitized);
|
|
182
176
|
if (isFileLoggingEnabled)
|
|
183
|
-
writeLog(entry).catch(() => { });
|
|
177
|
+
writeLog(entry).catch(() => { });
|
|
184
178
|
},
|
|
185
179
|
};
|
|
186
180
|
/** Pull the commonly needed headers from a NextRequest in one call. */
|
|
@@ -193,9 +187,7 @@ export const extractRequestMetadata = (request) => ({
|
|
|
193
187
|
"unknown",
|
|
194
188
|
referer: request.headers.get("referer") ?? "none",
|
|
195
189
|
});
|
|
196
|
-
function buildServerMeta(
|
|
197
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
198
|
-
error, context) {
|
|
190
|
+
function buildServerMeta(error, context) {
|
|
199
191
|
const base = {
|
|
200
192
|
...context,
|
|
201
193
|
timestamp: new Date().toISOString(),
|
|
@@ -226,9 +218,7 @@ error, context) {
|
|
|
226
218
|
}
|
|
227
219
|
return base;
|
|
228
220
|
}
|
|
229
|
-
export const logServerError = (message,
|
|
230
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
231
|
-
error, context) => {
|
|
221
|
+
export const logServerError = (message, error, context) => {
|
|
232
222
|
serverLogger.error(message, buildServerMeta(error, context));
|
|
233
223
|
};
|
|
234
224
|
export const logServerWarning = (message, data) => {
|
|
@@ -240,18 +230,14 @@ export const logServerInfo = (message, data) => {
|
|
|
240
230
|
export const logServerDebug = (message, data) => {
|
|
241
231
|
serverLogger.debug(message, { ...data, timestamp: new Date().toISOString() });
|
|
242
232
|
};
|
|
243
|
-
export const logApiRouteError = (endpoint,
|
|
244
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
245
|
-
error, request, context) => {
|
|
233
|
+
export const logApiRouteError = (endpoint, error, request, context) => {
|
|
246
234
|
logServerError(`API Route Error: ${endpoint}`, error, {
|
|
247
235
|
...context,
|
|
248
236
|
endpoint,
|
|
249
237
|
...(request ? extractRequestMetadata(request) : {}),
|
|
250
238
|
});
|
|
251
239
|
};
|
|
252
|
-
export const logDatabaseError = (operation, collection,
|
|
253
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
254
|
-
error, context) => {
|
|
240
|
+
export const logDatabaseError = (operation, collection, error, context) => {
|
|
255
241
|
logServerError(`Database Error: ${operation} on ${collection}`, error, {
|
|
256
242
|
...context,
|
|
257
243
|
operation,
|
|
@@ -259,9 +245,7 @@ error, context) => {
|
|
|
259
245
|
type: "database",
|
|
260
246
|
});
|
|
261
247
|
};
|
|
262
|
-
export const logServerAuthError = (operation,
|
|
263
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
264
|
-
error, context) => {
|
|
248
|
+
export const logServerAuthError = (operation, error, context) => {
|
|
265
249
|
logServerError(`Authentication Error: ${operation}`, error, {
|
|
266
250
|
...context,
|
|
267
251
|
operation,
|
|
@@ -277,18 +261,14 @@ export const logAuthorizationError = (userId, resource, action, context) => {
|
|
|
277
261
|
type: "authorization",
|
|
278
262
|
});
|
|
279
263
|
};
|
|
280
|
-
export const logEmailError = (recipient,
|
|
281
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
282
|
-
error, context) => {
|
|
264
|
+
export const logEmailError = (recipient, error, context) => {
|
|
283
265
|
logServerError(`Email Send Failed to ${recipient}`, error, {
|
|
284
266
|
...context,
|
|
285
267
|
recipient,
|
|
286
268
|
type: "email",
|
|
287
269
|
});
|
|
288
270
|
};
|
|
289
|
-
export const logStorageError = (operation, filePath,
|
|
290
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
291
|
-
error, context) => {
|
|
271
|
+
export const logStorageError = (operation, filePath, error, context) => {
|
|
292
272
|
logServerError(`Storage Error: ${operation} on ${filePath}`, error, {
|
|
293
273
|
...context,
|
|
294
274
|
operation,
|
|
@@ -296,9 +276,7 @@ error, context) => {
|
|
|
296
276
|
type: "storage",
|
|
297
277
|
});
|
|
298
278
|
};
|
|
299
|
-
export const logExternalApiError = (serviceName, endpoint,
|
|
300
|
-
// audit-unknown-ok: error-handler entry point — receives thrown values
|
|
301
|
-
error, context) => {
|
|
279
|
+
export const logExternalApiError = (serviceName, endpoint, error, context) => {
|
|
302
280
|
logServerError(`External API Error: ${serviceName} - ${endpoint}`, error, {
|
|
303
281
|
...context,
|
|
304
282
|
serviceName,
|
|
@@ -13,9 +13,7 @@ export function successResponse(data, message, status = 200, meta) {
|
|
|
13
13
|
...(meta && { meta }),
|
|
14
14
|
}, { status });
|
|
15
15
|
}
|
|
16
|
-
export function errorResponse(error, status = 400,
|
|
17
|
-
// audit-unknown-ok: Generic response wrapper — issues field arbitrary
|
|
18
|
-
details) {
|
|
16
|
+
export function errorResponse(error, status = 400, details) {
|
|
19
17
|
return NextResponse.json({
|
|
20
18
|
success: false,
|
|
21
19
|
error,
|
|
@@ -27,7 +25,6 @@ export const ApiErrors = {
|
|
|
27
25
|
unauthorized: (message = "Unauthorized") => errorResponse(message, 401),
|
|
28
26
|
forbidden: (message = "Forbidden") => errorResponse(message, 403),
|
|
29
27
|
notFound: (resource = "Resource") => errorResponse(`${resource} not found`, 404),
|
|
30
|
-
// audit-unknown-ok: Generic response wrapper — issues field arbitrary
|
|
31
28
|
badRequest: (message = "Bad request", details) => errorResponse(message, 400, details),
|
|
32
29
|
internalError: (message = "Internal server error") => errorResponse(message, 500),
|
|
33
30
|
validationError: (details) => errorResponse("Validation failed", 422, details),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { normalizeError } from "../../errors/normalize";
|
|
2
2
|
async function validateSchema(request, schema) {
|
|
3
|
-
// audit-unknown-ok: Next.js route dispatcher boundary
|
|
4
3
|
if (typeof schema.safeParse === "function") {
|
|
5
4
|
const body = await request.json();
|
|
6
5
|
const result = schema.safeParse(body);
|
|
@@ -14,7 +13,6 @@ async function validateSchema(request, schema) {
|
|
|
14
13
|
return { validationError: false, data };
|
|
15
14
|
}
|
|
16
15
|
catch {
|
|
17
|
-
// audit-unknown-ok: TS structural escape — TInput
|
|
18
16
|
return { validationError: false, data: undefined };
|
|
19
17
|
}
|
|
20
18
|
}
|
|
@@ -47,9 +45,7 @@ async function applyRateLimitCheck(request, config, applyRateLimit, getRateLimit
|
|
|
47
45
|
}
|
|
48
46
|
return { blocked: false, headers };
|
|
49
47
|
}
|
|
50
|
-
async function applySchemaValidation(request, schema,
|
|
51
|
-
// audit-unknown-ok: Next.js route dispatcher boundary
|
|
52
|
-
errorResponse) {
|
|
48
|
+
async function applySchemaValidation(request, schema, errorResponse) {
|
|
53
49
|
const schemaResult = await validateSchema(request, schema);
|
|
54
50
|
if (schemaResult.validationError) {
|
|
55
51
|
return { invalid: true, response: errorResponse("Validation failed", 400, schemaResult.issues) };
|
|
@@ -34,14 +34,12 @@ import { NextResponse } from "next/server.js";
|
|
|
34
34
|
*/
|
|
35
35
|
export function createApiErrorHandler(options) {
|
|
36
36
|
const { isAppError, getStatusCode, toJSON, logger, internalErrorCode = "INTERNAL_ERROR", internalErrorMessage = "An internal server error occurred", } = options;
|
|
37
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
38
37
|
return function handleApiError(error) {
|
|
39
38
|
// Known AppError subclass — structured response
|
|
40
39
|
if (isAppError(error)) {
|
|
41
40
|
const status = getStatusCode(error);
|
|
42
41
|
if (status >= 500) {
|
|
43
42
|
logger.error("API Error", {
|
|
44
|
-
// audit-unknown-ok: error JSON serialization boundary
|
|
45
43
|
body: toJSON(error),
|
|
46
44
|
});
|
|
47
45
|
}
|
|
@@ -51,7 +49,6 @@ export function createApiErrorHandler(options) {
|
|
|
51
49
|
if (error !== null &&
|
|
52
50
|
typeof error === "object" &&
|
|
53
51
|
"issues" in error &&
|
|
54
|
-
// audit-unknown-ok: error JSON serialization boundary
|
|
55
52
|
Array.isArray(error.issues)) {
|
|
56
53
|
return NextResponse.json({
|
|
57
54
|
success: false,
|
|
@@ -12,7 +12,6 @@ import { ValidationError } from "../../errors";
|
|
|
12
12
|
* const body = await parseJsonBody<{ name?: string }>(request, { allowEmpty: true });
|
|
13
13
|
*/
|
|
14
14
|
export async function parseJsonBody(request, options) {
|
|
15
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
16
15
|
let raw;
|
|
17
16
|
try {
|
|
18
17
|
const text = await request.text();
|
|
@@ -108,7 +108,6 @@ function resolveBodySchema(schema) {
|
|
|
108
108
|
const entry = SCHEMAS.api[schema];
|
|
109
109
|
if (!entry || !("body" in entry) || !entry.body)
|
|
110
110
|
return null;
|
|
111
|
-
// audit-unknown-ok: TS structural escape — ParseableSchema
|
|
112
111
|
return entry.body;
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
@@ -119,9 +118,7 @@ function resolveBodySchema(schema) {
|
|
|
119
118
|
* soon as every consumer is updated, after which `success` is removed from
|
|
120
119
|
* this helper and the audit re-runs to enforce the cleanup.
|
|
121
120
|
*/
|
|
122
|
-
function errorJson(status, code, message, requestId,
|
|
123
|
-
// audit-unknown-ok: Route handler body schema parse boundary
|
|
124
|
-
issues) {
|
|
121
|
+
function errorJson(status, code, message, requestId, issues) {
|
|
125
122
|
return NextResponse.json({
|
|
126
123
|
ok: false,
|
|
127
124
|
success: false, // deprecated — for compat during the migration sweep
|
|
@@ -190,7 +187,6 @@ export function createRouteHandler(options) {
|
|
|
190
187
|
return errorJson(500, HTTP_ERROR_CODES.INTERNAL, `Route schema not registered: ${String(options.schema)}`, requestId);
|
|
191
188
|
}
|
|
192
189
|
if (resolvedSchema) {
|
|
193
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
194
190
|
let raw;
|
|
195
191
|
try {
|
|
196
192
|
raw = await request.json();
|
|
@@ -248,7 +244,6 @@ export function createRouteHandler(options) {
|
|
|
248
244
|
response.headers.set("Cache-Control", buildPublicCacheControl(policy));
|
|
249
245
|
}
|
|
250
246
|
return response;
|
|
251
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
252
247
|
}
|
|
253
248
|
catch (err) {
|
|
254
249
|
void normalizeError(err);
|
|
@@ -271,11 +266,9 @@ export function createRouteHandler(options) {
|
|
|
271
266
|
}
|
|
272
267
|
// -- console-side surface ---------------------------------------------
|
|
273
268
|
if (mapped.status >= 500) {
|
|
274
|
-
// eslint-disable-next-line no-console
|
|
275
269
|
console.error(`[createRouteHandler] ${request.method} ${new URL(request.url).pathname} failed [${requestId}]`, err);
|
|
276
270
|
}
|
|
277
271
|
else if (mapped.status >= 400 && mapped.status !== 401 && mapped.status !== 403) {
|
|
278
|
-
// eslint-disable-next-line no-console
|
|
279
272
|
console.warn(`[createRouteHandler] ${request.method} ${new URL(request.url).pathname} failed (${mapped.status}) [${requestId}]`, mapped.code, mapped.message);
|
|
280
273
|
}
|
|
281
274
|
return errorJson(mapped.status, mapped.code, mapped.message, requestId, mapped.issues);
|
|
@@ -30,9 +30,7 @@ function isCacheable(request, config) {
|
|
|
30
30
|
return methods.includes(request.method);
|
|
31
31
|
}
|
|
32
32
|
export function withCache(handler, config = {}) {
|
|
33
|
-
return async (request,
|
|
34
|
-
// audit-unknown-ok: Next.js middleware boundary
|
|
35
|
-
...args) => {
|
|
33
|
+
return async (request, ...args) => {
|
|
36
34
|
if (!isCacheable(request, config)) {
|
|
37
35
|
return handler(request, ...args);
|
|
38
36
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
const ENC_PREFIX = "enc:v1:";
|
|
3
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
4
3
|
function scrubValue(value) {
|
|
5
4
|
if (typeof value === "string" && value.startsWith(ENC_PREFIX)) {
|
|
6
5
|
return "[encrypted]";
|
|
@@ -29,7 +28,6 @@ export const piiScrubberMiddleware = async (_request, _ctx, next) => {
|
|
|
29
28
|
const contentType = response.headers.get("content-type") ?? "";
|
|
30
29
|
if (!contentType.includes("application/json"))
|
|
31
30
|
return response;
|
|
32
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
33
31
|
let body;
|
|
34
32
|
try {
|
|
35
33
|
body = await response.json();
|
|
@@ -15,7 +15,6 @@ const EXPECTED_AUTH_CODES = new Set([
|
|
|
15
15
|
"auth/user-disabled",
|
|
16
16
|
"auth/user-not-found",
|
|
17
17
|
]);
|
|
18
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
19
18
|
function isExpectedAuthError(err) {
|
|
20
19
|
return EXPECTED_AUTH_CODES.has(err.code ?? "");
|
|
21
20
|
}
|
|
@@ -48,7 +48,6 @@ function get(key) {
|
|
|
48
48
|
return globalThis[key] ?? null;
|
|
49
49
|
}
|
|
50
50
|
function set(key, value) {
|
|
51
|
-
// audit-unknown-ok: Admin SDK init — global type augmentation
|
|
52
51
|
globalThis[key] = value;
|
|
53
52
|
}
|
|
54
53
|
// --- App ----------------------------------------------------------------------
|
|
@@ -35,7 +35,6 @@ export class FirebaseRepository {
|
|
|
35
35
|
return deserializeTimestamps({
|
|
36
36
|
id: snap.id,
|
|
37
37
|
...(snap.data() ?? {}),
|
|
38
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
40
|
// -- IReadRepository --------------------------------------------------------
|
|
@@ -100,7 +99,6 @@ export class FirebaseRepository {
|
|
|
100
99
|
const totalPages = total === 0 ? 0 : Math.max(1, Math.ceil(total / perPage));
|
|
101
100
|
return { data, total, page, perPage, totalPages };
|
|
102
101
|
}
|
|
103
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
104
102
|
async findWhere(field, op, value) {
|
|
105
103
|
const snap = await this.getCollection()
|
|
106
104
|
.where(field, op, value)
|
|
@@ -169,7 +167,6 @@ export class FirebaseRepository {
|
|
|
169
167
|
return doc;
|
|
170
168
|
}
|
|
171
169
|
/** Find first document where `field == value`. */
|
|
172
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
173
170
|
async findOneBy(field, value) {
|
|
174
171
|
const snap = await this.getCollection()
|
|
175
172
|
.where(field, "==", value)
|
|
@@ -195,7 +192,6 @@ const TOKEN_TO_OP = {
|
|
|
195
192
|
"@=": "array-contains",
|
|
196
193
|
};
|
|
197
194
|
/** Best-effort scalar coercion for sieve filter values. */
|
|
198
|
-
// audit-unknown-ok: Base repository coerceValue — accepts any cell value
|
|
199
195
|
function coerceValue(raw) {
|
|
200
196
|
if (raw === "true")
|
|
201
197
|
return true;
|
|
@@ -18,7 +18,6 @@ export class BaseRepository {
|
|
|
18
18
|
return deserializeTimestamps({
|
|
19
19
|
id: snap.id,
|
|
20
20
|
...(snap.data() ?? {}),
|
|
21
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
async findById(id) {
|
|
@@ -41,7 +40,6 @@ export class BaseRepository {
|
|
|
41
40
|
}
|
|
42
41
|
return doc;
|
|
43
42
|
}
|
|
44
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
45
43
|
async findBy(field, value) {
|
|
46
44
|
try {
|
|
47
45
|
const snapshot = await this.getCollection()
|
|
@@ -54,7 +52,6 @@ export class BaseRepository {
|
|
|
54
52
|
throw new DatabaseError(`Failed to find documents by ${field}`, error);
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
58
55
|
async findOneBy(field, value) {
|
|
59
56
|
try {
|
|
60
57
|
const snapshot = await this.getCollection()
|
|
@@ -6,9 +6,7 @@ import { FieldValue } from "firebase-admin/firestore";
|
|
|
6
6
|
export const firebaseFieldOps = {
|
|
7
7
|
serverTimestamp: () => FieldValue.serverTimestamp(),
|
|
8
8
|
increment: (n) => FieldValue.increment(n),
|
|
9
|
-
// audit-unknown-ok: Firestore field operations SDK boundary
|
|
10
9
|
arrayUnion: (...elements) => FieldValue.arrayUnion(...elements),
|
|
11
|
-
// audit-unknown-ok: Firestore field operations SDK boundary
|
|
12
10
|
arrayRemove: (...elements) => FieldValue.arrayRemove(...elements),
|
|
13
11
|
deleteField: () => FieldValue.delete(),
|
|
14
12
|
};
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
* FieldValue sentinels (increment, arrayUnion, deleteField, etc.) are not
|
|
13
13
|
* stripped.
|
|
14
14
|
*/
|
|
15
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
16
15
|
function isPlainObject(v) {
|
|
17
16
|
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
18
17
|
return false;
|
|
19
|
-
// audit-unknown-ok: TS structural escape
|
|
20
18
|
const proto = Object.getPrototypeOf(v);
|
|
21
19
|
return proto === Object.prototype || proto === null;
|
|
22
20
|
}
|
|
@@ -68,11 +66,9 @@ export function deserializeTimestamps(obj) {
|
|
|
68
66
|
if (typeof obj === "object" &&
|
|
69
67
|
!(obj instanceof Date) &&
|
|
70
68
|
typeof obj.toDate === "function") {
|
|
71
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
72
69
|
return obj.toDate();
|
|
73
70
|
}
|
|
74
71
|
if (Array.isArray(obj)) {
|
|
75
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
76
72
|
return obj.map(deserializeTimestamps);
|
|
77
73
|
}
|
|
78
74
|
if (typeof obj === "object" && !(obj instanceof Date)) {
|
|
@@ -31,7 +31,6 @@ export class FirebaseRealtimeRepository {
|
|
|
31
31
|
const snap = await this.nodeRef(id).get();
|
|
32
32
|
if (!snap.exists())
|
|
33
33
|
return null;
|
|
34
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
35
34
|
return { id, ...snap.val() };
|
|
36
35
|
}
|
|
37
36
|
async findAll(query) {
|
|
@@ -46,9 +45,7 @@ export class FirebaseRealtimeRepository {
|
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
const raw = snap.val();
|
|
49
|
-
let data = Object.entries(raw).map(
|
|
50
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
51
|
-
([id, val]) => ({ id, ...val }));
|
|
48
|
+
let data = Object.entries(raw).map(([id, val]) => ({ id, ...val }));
|
|
52
49
|
// Basic server-side sort (RTDB has no native multi-field sort)
|
|
53
50
|
if (query?.sort) {
|
|
54
51
|
const key = query.sort;
|
|
@@ -74,7 +71,6 @@ export class FirebaseRealtimeRepository {
|
|
|
74
71
|
totalPages,
|
|
75
72
|
};
|
|
76
73
|
}
|
|
77
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
78
74
|
async findWhere(field, _op, value) {
|
|
79
75
|
// RTDB Admin SDK supports orderByChild + equalTo for == only
|
|
80
76
|
const snap = await this.nodeRef()
|
|
@@ -84,23 +80,19 @@ export class FirebaseRealtimeRepository {
|
|
|
84
80
|
if (!snap.exists())
|
|
85
81
|
return [];
|
|
86
82
|
const raw = snap.val();
|
|
87
|
-
return Object.entries(raw).map(
|
|
88
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
89
|
-
([id, val]) => ({ id, ...val }));
|
|
83
|
+
return Object.entries(raw).map(([id, val]) => ({ id, ...val }));
|
|
90
84
|
}
|
|
91
85
|
// -- IWriteRepository -------------------------------------------------------
|
|
92
86
|
async create(data) {
|
|
93
87
|
const now = Date.now();
|
|
94
88
|
const payload = { ...data, createdAt: now, updatedAt: now };
|
|
95
89
|
const ref = await this.nodeRef().push(payload);
|
|
96
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
97
90
|
return { id: ref.key, ...payload };
|
|
98
91
|
}
|
|
99
92
|
async update(id, data) {
|
|
100
93
|
const payload = { ...data, updatedAt: Date.now() };
|
|
101
94
|
await this.nodeRef(id).update(payload);
|
|
102
95
|
const snap = await this.nodeRef(id).get();
|
|
103
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
104
96
|
return { id, ...snap.val() };
|
|
105
97
|
}
|
|
106
98
|
async delete(id) {
|
|
@@ -123,15 +115,12 @@ export class FirebaseRealtimeRepository {
|
|
|
123
115
|
subscribe(id, cb) {
|
|
124
116
|
const ref = this.nodeRef(id);
|
|
125
117
|
const handler = (snap) => {
|
|
126
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
127
118
|
cb(snap.exists() ? { id, ...snap.val() } : null);
|
|
128
119
|
};
|
|
129
120
|
ref.on("value", handler);
|
|
130
121
|
return () => ref.off("value", handler);
|
|
131
122
|
}
|
|
132
|
-
subscribeWhere(field,
|
|
133
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
134
|
-
value, cb) {
|
|
123
|
+
subscribeWhere(field, value, cb) {
|
|
135
124
|
const ref = this.nodeRef()
|
|
136
125
|
.orderByChild(field)
|
|
137
126
|
.equalTo(value);
|
|
@@ -141,7 +130,6 @@ export class FirebaseRealtimeRepository {
|
|
|
141
130
|
return;
|
|
142
131
|
}
|
|
143
132
|
const raw = snap.val();
|
|
144
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
145
133
|
cb(Object.entries(raw).map(([id, v]) => ({ id, ...v })));
|
|
146
134
|
};
|
|
147
135
|
ref.on("value", handler);
|
|
@@ -135,16 +135,13 @@ export async function applySieveToFirestore(params) {
|
|
|
135
135
|
// Apply filters + sorts once; count without reading docs.
|
|
136
136
|
const filteredQ = processor.apply(effective, baseQuery, {
|
|
137
137
|
applyPagination: false,
|
|
138
|
-
// audit-unknown-ok: TS structural escape — Firebase SDK type
|
|
139
138
|
});
|
|
140
139
|
const total = await getFirestoreCount(filteredQ);
|
|
141
140
|
// Apply pagination on top of the already-filtered query — avoids re-applying
|
|
142
141
|
// the full Sieve DSL from the base.
|
|
143
142
|
const pagedQ = filteredQ.offset((page - 1) * pageSize).limit(pageSize);
|
|
144
143
|
const snap = await pagedQ.get();
|
|
145
|
-
const items = snap.docs.map(
|
|
146
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
147
|
-
(d) => deserializeTimestamps({ id: d.id, ...d.data() }));
|
|
144
|
+
const items = snap.docs.map((d) => deserializeTimestamps({ id: d.id, ...d.data() }));
|
|
148
145
|
const totalPages = total === 0 ? 0 : Math.max(1, Math.ceil(total / pageSize));
|
|
149
146
|
return {
|
|
150
147
|
items,
|
|
@@ -180,16 +177,13 @@ export class FirebaseSieveRepository extends FirebaseRepository {
|
|
|
180
177
|
// Apply filters + sorts once; count without reading docs.
|
|
181
178
|
const filteredQ = processor.apply(effective, base, {
|
|
182
179
|
applyPagination: false,
|
|
183
|
-
// audit-unknown-ok: TS structural escape — Firebase SDK type
|
|
184
180
|
});
|
|
185
181
|
const total = await getFirestoreCount(filteredQ);
|
|
186
182
|
// Apply pagination on top of the already-filtered query — avoids re-applying
|
|
187
183
|
// the full Sieve DSL from the base.
|
|
188
184
|
const pagedQ = filteredQ.offset((page - 1) * pageSize).limit(pageSize);
|
|
189
185
|
const snap = await pagedQ.get();
|
|
190
|
-
const items = snap.docs.map((d) =>
|
|
191
|
-
// audit-unknown-ok: TS structural escape — TResult
|
|
192
|
-
deserializeTimestamps({ id: d.id, ...d.data() }));
|
|
186
|
+
const items = snap.docs.map((d) => deserializeTimestamps({ id: d.id, ...d.data() }));
|
|
193
187
|
const totalPages = total === 0 ? 0 : Math.max(1, Math.ceil(total / pageSize));
|
|
194
188
|
return {
|
|
195
189
|
items,
|
|
@@ -148,7 +148,6 @@ export async function createRazorpayOrder(opts) {
|
|
|
148
148
|
receipt: opts.receipt ?? `rcpt_${Date.now()}`,
|
|
149
149
|
notes: opts.notes,
|
|
150
150
|
});
|
|
151
|
-
// audit-unknown-ok: TS structural escape — RazorpayOrder
|
|
152
151
|
return order;
|
|
153
152
|
}
|
|
154
153
|
/**
|
|
@@ -159,7 +158,6 @@ export async function createRazorpayOrder(opts) {
|
|
|
159
158
|
export async function fetchRazorpayOrder(orderId) {
|
|
160
159
|
const razorpay = await getRazorpayInstance();
|
|
161
160
|
const order = await razorpay.orders.fetch(orderId);
|
|
162
|
-
// audit-unknown-ok: TS structural escape — RazorpayOrder
|
|
163
161
|
return order;
|
|
164
162
|
}
|
|
165
163
|
/**
|
|
@@ -203,6 +201,5 @@ export async function createRazorpayRefund(paymentId, amountPaise) {
|
|
|
203
201
|
if (amountPaise)
|
|
204
202
|
opts.amount = amountPaise;
|
|
205
203
|
const refund = await razorpay.payments.refund(paymentId, opts);
|
|
206
|
-
// audit-unknown-ok: TS structural escape — RazorpayRefundResult
|
|
207
204
|
return refund;
|
|
208
205
|
}
|
|
@@ -33,7 +33,6 @@ export function createStorageHelpers(storage) {
|
|
|
33
33
|
});
|
|
34
34
|
const url = await getDownloadURL(uploadResult.ref);
|
|
35
35
|
return { url, ref: uploadResult.ref, uploadResult };
|
|
36
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
37
36
|
}
|
|
38
37
|
catch (error) {
|
|
39
38
|
void normalizeError(error);
|
|
@@ -70,7 +69,6 @@ export function createStorageHelpers(storage) {
|
|
|
70
69
|
async function getFileUrl(path) {
|
|
71
70
|
try {
|
|
72
71
|
return await getDownloadURL(ref(storage, path));
|
|
73
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
74
72
|
}
|
|
75
73
|
catch (error) {
|
|
76
74
|
void normalizeError(error);
|
|
@@ -81,7 +79,6 @@ export function createStorageHelpers(storage) {
|
|
|
81
79
|
async function deleteFile(path) {
|
|
82
80
|
try {
|
|
83
81
|
await deleteObject(ref(storage, path));
|
|
84
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
85
82
|
}
|
|
86
83
|
catch (error) {
|
|
87
84
|
void normalizeError(error);
|
|
@@ -96,7 +93,6 @@ export function createStorageHelpers(storage) {
|
|
|
96
93
|
try {
|
|
97
94
|
const result = await listAll(ref(storage, folderPath));
|
|
98
95
|
return result.items;
|
|
99
|
-
// audit-unknown-ok: error-handler entry point — accepts thrown values of any shape
|
|
100
96
|
}
|
|
101
97
|
catch (error) {
|
|
102
98
|
void normalizeError(error);
|
|
@@ -141,7 +141,6 @@ export function SessionProvider({ children, initialUser, endpoints: endpointOver
|
|
|
141
141
|
stats: data.stats,
|
|
142
142
|
metadata: data.metadata,
|
|
143
143
|
scamAwarenessAcknowledgedAt: data.scamAwarenessAcknowledgedAt
|
|
144
|
-
// audit-unknown-ok: TS structural escape — primitive cast
|
|
145
144
|
? new Date(data.scamAwarenessAcknowledgedAt)
|
|
146
145
|
: null,
|
|
147
146
|
dismissedBannerHash: data.dismissedBannerHash,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
/** Resolve any date-like value into a ms timestamp. */
|
|
4
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
5
4
|
function resolveMs(endDate) {
|
|
6
5
|
if (!endDate)
|
|
7
6
|
return NaN;
|
|
@@ -17,7 +17,6 @@ const ROLE_HIERARCHY = {
|
|
|
17
17
|
seller: 2,
|
|
18
18
|
user: 1,
|
|
19
19
|
};
|
|
20
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
21
20
|
export function requireAuth(user) {
|
|
22
21
|
if (!user) {
|
|
23
22
|
throw new AuthenticationError(ERROR_MESSAGES.AUTH.UNAUTHORIZED);
|
|
@@ -208,7 +208,6 @@ export function encryptPayoutDetails(details) {
|
|
|
208
208
|
if (bank && typeof bank === "object" && !Array.isArray(bank) && !(bank instanceof Date)) {
|
|
209
209
|
result.bankAccount = encryptPiiFields({ ...bank }, ["accountNumber"]);
|
|
210
210
|
}
|
|
211
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
212
211
|
return result;
|
|
213
212
|
}
|
|
214
213
|
/**
|
|
@@ -225,7 +224,6 @@ export function decryptPayoutDetails(details) {
|
|
|
225
224
|
if (bank && typeof bank === "object" && !Array.isArray(bank) && !(bank instanceof Date)) {
|
|
226
225
|
result.bankAccount = decryptPiiFields({ ...bank }, ["accountNumber"]);
|
|
227
226
|
}
|
|
228
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
229
227
|
return result;
|
|
230
228
|
}
|
|
231
229
|
/**
|
|
@@ -243,7 +241,6 @@ export function encryptShippingConfig(config) {
|
|
|
243
241
|
if (addr && typeof addr === "object" && !Array.isArray(addr) && !(addr instanceof Date)) {
|
|
244
242
|
result.pickupAddress = encryptPiiFields({ ...addr }, ["phone", "email", "address", "address2"]);
|
|
245
243
|
}
|
|
246
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
247
244
|
return result;
|
|
248
245
|
}
|
|
249
246
|
/**
|
|
@@ -260,7 +257,6 @@ export function decryptShippingConfig(config) {
|
|
|
260
257
|
if (addr && typeof addr === "object" && !Array.isArray(addr) && !(addr instanceof Date)) {
|
|
261
258
|
result.pickupAddress = decryptPiiFields({ ...addr }, ["phone", "email", "address", "address2"]);
|
|
262
259
|
}
|
|
263
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
264
260
|
return result;
|
|
265
261
|
}
|
|
266
262
|
/**
|