@mohasinac/appkit 3.0.0 → 3.0.2
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 +13 -14
- 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/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/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.d.ts +1 -1
- package/dist/index.js +5 -3
- 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 -6
- 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/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 -3
- 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 +92 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { serverLogger } from "../monitoring";
|
|
2
2
|
import { AuthorizationError, NotFoundError, ValidationError, } from "../errors";
|
|
3
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
4
3
|
export function handleActionError(err) {
|
|
5
4
|
const devDebug = process.env.NODE_ENV === "development"
|
|
6
5
|
? { stack: err instanceof Error ? err.stack : String(err) }
|
|
@@ -6,7 +6,6 @@ import { getDefaultLocale } from "../core/baseline-resolver";
|
|
|
6
6
|
* Resolve any date-like value (Date, ISO string, number, or Firestore Timestamp JSON)
|
|
7
7
|
* into a native Date object. Returns null for falsy or unparseable input.
|
|
8
8
|
*/
|
|
9
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
10
9
|
export function resolveDate(value) {
|
|
11
10
|
if (!value)
|
|
12
11
|
return null;
|
|
@@ -44,7 +44,6 @@ export function deepClone(obj) {
|
|
|
44
44
|
if (obj === null || typeof obj !== "object")
|
|
45
45
|
return obj;
|
|
46
46
|
if (Array.isArray(obj))
|
|
47
|
-
// audit-unknown-ok: TS structural escape — generic param
|
|
48
47
|
return obj.map((item) => deepClone(item));
|
|
49
48
|
const cloned = {};
|
|
50
49
|
const objectRecord = obj;
|
|
@@ -53,7 +52,6 @@ export function deepClone(obj) {
|
|
|
53
52
|
});
|
|
54
53
|
return cloned;
|
|
55
54
|
}
|
|
56
|
-
// audit-unknown-ok: type-narrowing entry point — accepts any value, narrows by typeof/Array.isArray
|
|
57
55
|
export function isEqual(obj1, obj2) {
|
|
58
56
|
if (obj1 === obj2)
|
|
59
57
|
return true;
|
package/dist/utils/schema-ui.js
CHANGED
|
@@ -112,9 +112,7 @@ const DEFAULT_OMIT = ["id", "createdAt", "updatedAt", "deletedAt"];
|
|
|
112
112
|
* @param options Optional config: `omit`, `include`.
|
|
113
113
|
* @returns Array of `DerivedField` descriptors, one per schema property.
|
|
114
114
|
*/
|
|
115
|
-
export function deriveFormFields(
|
|
116
|
-
// audit-unknown-ok: Zod schema UI introspection — schema is caller-defined
|
|
117
|
-
schema, options = {}) {
|
|
115
|
+
export function deriveFormFields(schema, options = {}) {
|
|
118
116
|
const zodLike = schema;
|
|
119
117
|
// Unwrap ZodEffects to reach the ZodObject
|
|
120
118
|
const unwrapped = unwrapZodType(zodLike);
|
|
@@ -185,9 +185,7 @@ export const trimDataSchema = z
|
|
|
185
185
|
// ============================================
|
|
186
186
|
// REQUEST VALIDATION HELPERS
|
|
187
187
|
// ============================================
|
|
188
|
-
export function validateRequestBody(schema,
|
|
189
|
-
// audit-unknown-ok: callback entry point — accepts arbitrary payload value
|
|
190
|
-
body) {
|
|
188
|
+
export function validateRequestBody(schema, body) {
|
|
191
189
|
const result = schema.safeParse(body);
|
|
192
190
|
if (result.success) {
|
|
193
191
|
return { success: true, data: result.data };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohasinac/appkit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -124,7 +124,10 @@
|
|
|
124
124
|
"scripts/init-config.mjs",
|
|
125
125
|
"scripts/labels-extract.mjs",
|
|
126
126
|
"scripts/seed-cli.mjs",
|
|
127
|
-
"scripts/seed-cli-loader.mjs"
|
|
127
|
+
"scripts/seed-cli-loader.mjs",
|
|
128
|
+
"scripts/dedupe-peer-deps.mjs",
|
|
129
|
+
"scripts/copy-assets.mjs",
|
|
130
|
+
"scripts/bundle-css.mjs"
|
|
128
131
|
],
|
|
129
132
|
"bin": {
|
|
130
133
|
"appkit-sieve-audit": "./scripts/sieve-audit.mjs",
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bundle-css.mjs — Flatten all @import chains in dist/styles.css into a single
|
|
3
|
+
* concatenated file. Turbopack (Next.js 16+) does not reliably resolve nested
|
|
4
|
+
* CSS @import chains from node_modules, so shipping a flat file is the safest
|
|
5
|
+
* approach for both webpack and Turbopack consumers.
|
|
6
|
+
*
|
|
7
|
+
* Runs after copy-assets.mjs + tailwindcss build, so dist/ already has every
|
|
8
|
+
* individual .style.css and tokens.css file.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
11
|
+
import { join, dirname, resolve } from "path";
|
|
12
|
+
|
|
13
|
+
const DIST = new URL("../dist", import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, "$1");
|
|
14
|
+
const ENTRY = join(DIST, "styles.css");
|
|
15
|
+
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
|
|
18
|
+
function stripComments(css) {
|
|
19
|
+
return css.replace(/\/\*[\s\S]*?\*\//g, match => " ".repeat(match.length));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function inlineImports(filePath) {
|
|
23
|
+
if (seen.has(filePath)) return "";
|
|
24
|
+
seen.add(filePath);
|
|
25
|
+
|
|
26
|
+
const css = readFileSync(filePath, "utf8");
|
|
27
|
+
const dir = dirname(filePath);
|
|
28
|
+
const stripped = stripComments(css);
|
|
29
|
+
|
|
30
|
+
return css.replace(/@import\s+["']([^"']+)["']\s*;/g, (_match, relPath, offset) => {
|
|
31
|
+
if (stripped.substring(offset, offset + _match.length).trim() === "") return _match;
|
|
32
|
+
const resolved = resolve(dir, relPath);
|
|
33
|
+
try {
|
|
34
|
+
return inlineImports(resolved);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error(`[bundle-css] WARNING: could not resolve @import "${relPath}" from ${filePath}`);
|
|
37
|
+
return _match;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const bundled = inlineImports(ENTRY);
|
|
43
|
+
writeFileSync(ENTRY, bundled, "utf8");
|
|
44
|
+
|
|
45
|
+
const lines = bundled.split("\n").length;
|
|
46
|
+
const bytes = Buffer.byteLength(bundled, "utf8");
|
|
47
|
+
console.log(`[bundle-css] Bundled ${seen.size} CSS files into dist/styles.css (${lines} lines, ${(bytes / 1024).toFixed(1)} KB)`);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-build: copy non-TypeScript assets (CSS, etc.) from src/ to dist/
|
|
3
|
+
* preserving the directory structure.
|
|
4
|
+
*/
|
|
5
|
+
import { readdir, copyFile, mkdir, stat } from "fs/promises";
|
|
6
|
+
import { join, relative, dirname, extname } from "path";
|
|
7
|
+
|
|
8
|
+
const ASSET_EXTENSIONS = new Set([".css", ".json", ".svg", ".png"]);
|
|
9
|
+
const SRC = new URL("../src", import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, "$1");
|
|
10
|
+
const DIST = new URL("../dist", import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, "$1");
|
|
11
|
+
|
|
12
|
+
async function walk(dir) {
|
|
13
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
14
|
+
const files = [];
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const full = join(dir, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
files.push(...(await walk(full)));
|
|
19
|
+
} else if (ASSET_EXTENSIONS.has(extname(entry.name))) {
|
|
20
|
+
files.push(full);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return files;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const assets = await walk(SRC);
|
|
27
|
+
for (const src of assets) {
|
|
28
|
+
const rel = relative(SRC, src);
|
|
29
|
+
const dst = join(DIST, rel);
|
|
30
|
+
await mkdir(dirname(dst), { recursive: true });
|
|
31
|
+
await copyFile(src, dst);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.log(`Copied ${assets.length} asset file(s) to dist/`);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
* dedupe-peer-deps.mjs — postinstall hook
|
|
4
|
+
*
|
|
5
|
+
* Prevents the Turbopack "dual-instance" SSR crash that bit prod on 2026-06-10
|
|
6
|
+
* (appkit 2.8.8 → "No QueryClient set" on every server-rendered route).
|
|
7
|
+
*
|
|
8
|
+
* Root cause: when appkit is used as a local-file/submodule dependency
|
|
9
|
+
* (consumer's `package.json` uses `"@mohasinac/appkit": "file:./appkit"`),
|
|
10
|
+
* running `cd appkit && npm install` populates `appkit/node_modules/` with
|
|
11
|
+
* the same peerDependencies that the consumer already has at its root
|
|
12
|
+
* `node_modules/`. Turbopack 16 then resolves appkit-internal imports of those
|
|
13
|
+
* packages to the *appkit-local* copy while the consumer's imports resolve to
|
|
14
|
+
* the root copy — producing two separate `QueryClientContext` instances (and
|
|
15
|
+
* two of every other React context the peer deps use). useContext mismatches
|
|
16
|
+
* crash SSR.
|
|
17
|
+
*
|
|
18
|
+
* Fix: after any `npm install` inside appkit, delete the peer-dep duplicates.
|
|
19
|
+
* Node's module resolution walks up to the consumer's `node_modules/`, so all
|
|
20
|
+
* imports — both from appkit's own tsc and from Turbopack — land on the single
|
|
21
|
+
* consumer copy.
|
|
22
|
+
*
|
|
23
|
+
* This is idempotent and silent when there's nothing to delete (e.g. when
|
|
24
|
+
* appkit is consumed from npm where peerDeps were never installed).
|
|
25
|
+
*/
|
|
26
|
+
import { readFileSync, readdirSync, rmSync, existsSync } from "node:fs";
|
|
27
|
+
import { fileURLToPath } from "node:url";
|
|
28
|
+
import { dirname, resolve } from "node:path";
|
|
29
|
+
|
|
30
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
const pkgPath = resolve(here, "..", "package.json");
|
|
32
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
33
|
+
const peers = Object.keys(pkg.peerDependencies || {});
|
|
34
|
+
|
|
35
|
+
// Packages to remove:
|
|
36
|
+
// 1. Every entry in peerDependencies.
|
|
37
|
+
// 2. Transitive runtime deps of peers that ship their own React context (or any
|
|
38
|
+
// other top-level singleton). Pruning the peer alone is not enough — the
|
|
39
|
+
// transitive carries the duplicate context. List them explicitly so we
|
|
40
|
+
// never accidentally prune type-only packages.
|
|
41
|
+
const TRANSITIVE_RUNTIME_DUPS = [
|
|
42
|
+
// @tanstack/react-query (peer) → bundles @tanstack/query-core, which owns
|
|
43
|
+
// QueryClientContext. Without this prune, Turbopack picks up the appkit-local
|
|
44
|
+
// query-core and a parallel QueryClientContext instance ships in the SSR
|
|
45
|
+
// bundle, producing the "No QueryClient set" crash on every page (2026-06-11).
|
|
46
|
+
"@tanstack/query-core",
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
// Peer deps that have NO React context / module-scope singleton and that the
|
|
50
|
+
// consumer may not install at the root (e.g. firebase-functions ships only in
|
|
51
|
+
// the Firebase Cloud Functions deploy, not the Next.js consumer). Keeping them
|
|
52
|
+
// in appkit/node_modules lets `tsc -p appkit` resolve their types when the
|
|
53
|
+
// consumer-root copy is absent. The dual-instance crash (2026-06-10) cannot
|
|
54
|
+
// occur here because none of these packages own a top-level React context.
|
|
55
|
+
const SAFE_TO_KEEP = new Set([
|
|
56
|
+
"firebase-functions",
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
const removed = [];
|
|
60
|
+
|
|
61
|
+
function removeIfPresent(absPath, label) {
|
|
62
|
+
if (existsSync(absPath)) {
|
|
63
|
+
rmSync(absPath, { recursive: true, force: true });
|
|
64
|
+
removed.push(label);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (const dep of [...peers, ...TRANSITIVE_RUNTIME_DUPS]) {
|
|
69
|
+
if (SAFE_TO_KEEP.has(dep)) continue;
|
|
70
|
+
removeIfPresent(resolve(here, "..", "node_modules", dep), dep);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Clean up now-empty scope dirs (e.g. @tanstack/) so subsequent `npm install`
|
|
74
|
+
// doesn't trip on a phantom entry.
|
|
75
|
+
const scopesTouched = new Set();
|
|
76
|
+
for (const dep of [...peers, ...TRANSITIVE_RUNTIME_DUPS]) {
|
|
77
|
+
if (dep.startsWith("@")) scopesTouched.add(dep.split("/")[0]);
|
|
78
|
+
}
|
|
79
|
+
for (const scope of scopesTouched) {
|
|
80
|
+
const scopeDir = resolve(here, "..", "node_modules", scope);
|
|
81
|
+
try {
|
|
82
|
+
if (existsSync(scopeDir) && readdirSync(scopeDir).length === 0) {
|
|
83
|
+
rmSync(scopeDir, { recursive: true, force: true });
|
|
84
|
+
}
|
|
85
|
+
} catch {}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (removed.length > 0) {
|
|
89
|
+
console.log(
|
|
90
|
+
`[appkit/postinstall] removed ${removed.length} peer-dep duplicate(s) from appkit/node_modules: ${removed.join(", ")}`,
|
|
91
|
+
);
|
|
92
|
+
}
|