@adminide-stack/yantra-mobile 12.0.196-alpha.0 → 12.0.196-alpha.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/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +57 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +11 -1
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/agent-chat/NativeAgentChat.js +7 -0
- package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
- package/lib/features/canvas/extendVideo.js +5 -1
- package/lib/features/canvas/extendVideo.js.map +1 -1
- package/lib/features/canvas/workflow/StepSheet.js +18 -1
- package/lib/features/canvas/workflow/StepSheet.js.map +1 -1
- package/lib/features/canvas/workflow/workflowSteps.js +102 -31
- package/lib/features/canvas/workflow/workflowSteps.js.map +1 -1
- package/lib/features/chat/ComposerMicSend.js +35 -0
- package/lib/features/chat/ComposerMicSend.js.map +1 -0
- package/lib/features/chat/ComposerModeSwitch.js +64 -1
- package/lib/features/chat/ComposerModeSwitch.js.map +1 -1
- package/lib/features/chat/askUser.js +6 -1
- package/lib/features/chat/askUser.js.map +1 -1
- package/lib/features/connectors/ConnectorSheet.js +443 -0
- package/lib/features/connectors/ConnectorSheet.js.map +1 -0
- package/lib/features/connectors/ConnectorsPage.js +320 -0
- package/lib/features/connectors/ConnectorsPage.js.map +1 -0
- package/lib/features/connectors/connectConnector.js +278 -0
- package/lib/features/connectors/connectConnector.js.map +1 -0
- package/lib/features/connectors/connectorCatalog.js +222 -0
- package/lib/features/connectors/connectorCatalog.js.map +1 -0
- package/lib/features/connectors/useConnectorCatalog.js +153 -0
- package/lib/features/connectors/useConnectorCatalog.js.map +1 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js +618 -0
- package/lib/features/home/needsYou/HomeNeedsYou.js.map +1 -0
- package/lib/features/home/needsYou/chatFollowUps.js +333 -0
- package/lib/features/home/needsYou/chatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/format.js +47 -0
- package/lib/features/home/needsYou/format.js.map +1 -0
- package/lib/features/home/needsYou/historyText.js +40 -0
- package/lib/features/home/needsYou/historyText.js.map +1 -0
- package/lib/features/home/needsYou/inboxHighlights.js +152 -0
- package/lib/features/home/needsYou/inboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/panelsSettings.js +71 -0
- package/lib/features/home/needsYou/panelsSettings.js.map +1 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js +13 -0
- package/lib/features/home/needsYou/ported/commandConfirmProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js +91 -0
- package/lib/features/home/needsYou/ported/paymentApprovalProtocol.js.map +1 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js +659 -0
- package/lib/features/home/needsYou/ported/resultCardModels.js.map +1 -0
- package/lib/features/home/needsYou/types.js +1 -0
- package/lib/features/home/needsYou/types.js.map +1 -0
- package/lib/features/home/needsYou/useChatFollowUps.js +149 -0
- package/lib/features/home/needsYou/useChatFollowUps.js.map +1 -0
- package/lib/features/home/needsYou/useHomeBriefing.js +68 -0
- package/lib/features/home/needsYou/useHomeBriefing.js.map +1 -0
- package/lib/features/home/needsYou/useInboxHighlights.js +173 -0
- package/lib/features/home/needsYou/useInboxHighlights.js.map +1 -0
- package/lib/features/home/needsYou/usePanelsSettings.js +105 -0
- package/lib/features/home/needsYou/usePanelsSettings.js.map +1 -0
- package/lib/features/shopping/DealCard.js +8 -1
- package/lib/features/shopping/DealCard.js.map +1 -1
- package/lib/features/shopping/DealRails.js +24 -7
- package/lib/features/shopping/DealRails.js.map +1 -1
- package/lib/features/shopping/DealsPanel.js +1 -1
- package/lib/features/shopping/DealsPanel.js.map +1 -1
- package/lib/features/shopping/HolidayDealsPanel.js +529 -0
- package/lib/features/shopping/HolidayDealsPanel.js.map +1 -0
- package/lib/features/shopping/HolidayDealsParts.js +954 -0
- package/lib/features/shopping/HolidayDealsParts.js.map +1 -0
- package/lib/features/shopping/HolidayOffers.js +351 -0
- package/lib/features/shopping/HolidayOffers.js.map +1 -0
- package/lib/features/shopping/ProductCard.js +80 -14
- package/lib/features/shopping/ProductCard.js.map +1 -1
- package/lib/features/shopping/ProductDetailSheet.js +22 -3
- package/lib/features/shopping/ProductDetailSheet.js.map +1 -1
- package/lib/features/shopping/SavedPanel.js +341 -5
- package/lib/features/shopping/SavedPanel.js.map +1 -1
- package/lib/features/shopping/SearchResults.js +8 -2
- package/lib/features/shopping/SearchResults.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +12 -0
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/shopping/ShoppingExperience.js +56 -19
- package/lib/features/shopping/ShoppingExperience.js.map +1 -1
- package/lib/features/shopping/TrendingSections.js +13 -4
- package/lib/features/shopping/TrendingSections.js.map +1 -1
- package/lib/features/shopping/WatchlistPanel.js +61 -5
- package/lib/features/shopping/WatchlistPanel.js.map +1 -1
- package/lib/features/shopping/catalog.js +41 -2
- package/lib/features/shopping/catalog.js.map +1 -1
- package/lib/features/shopping/chat/brainRouter.js +14 -0
- package/lib/features/shopping/chat/brainRouter.js.map +1 -1
- package/lib/features/shopping/chat/shoppingTurn.js +88 -16
- package/lib/features/shopping/chat/shoppingTurn.js.map +1 -1
- package/lib/features/shopping/hooks/useHolidayDeals.js +388 -0
- package/lib/features/shopping/hooks/useHolidayDeals.js.map +1 -0
- package/lib/features/shopping/hooks/useProductMedia.js +33 -6
- package/lib/features/shopping/hooks/useProductMedia.js.map +1 -1
- package/lib/features/shopping/hooks/useShoppingHistorySync.js +8 -4
- package/lib/features/shopping/hooks/useShoppingHistorySync.js.map +1 -1
- package/lib/features/shopping/hooks/useTrendingProducts.js +11 -3
- package/lib/features/shopping/hooks/useTrendingProducts.js.map +1 -1
- package/lib/features/shopping/savedProducts.js +76 -6
- package/lib/features/shopping/savedProducts.js.map +1 -1
- package/lib/features/shopping/services/aiRelevance.js +212 -0
- package/lib/features/shopping/services/aiRelevance.js.map +1 -0
- package/lib/features/shopping/services/blackFriday.js +301 -0
- package/lib/features/shopping/services/blackFriday.js.map +1 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js +137 -0
- package/lib/features/shopping/services/blackFridayBrowserSites.js.map +1 -0
- package/lib/features/shopping/services/catalogProductSearch.js +21 -3
- package/lib/features/shopping/services/catalogProductSearch.js.map +1 -1
- package/lib/features/shopping/services/holidayDeals.js +143 -0
- package/lib/features/shopping/services/holidayDeals.js.map +1 -0
- package/lib/features/shopping/services/mediaShape.js +7 -0
- package/lib/features/shopping/services/mediaShape.js.map +1 -0
- package/lib/features/shopping/services/modelStep.js +95 -0
- package/lib/features/shopping/services/modelStep.js.map +1 -0
- package/lib/features/shopping/services/modelWords.js +14 -0
- package/lib/features/shopping/services/modelWords.js.map +1 -0
- package/lib/features/shopping/services/productAvailability.js +5 -1
- package/lib/features/shopping/services/productAvailability.js.map +1 -1
- package/lib/features/shopping/services/productFilters.js +2 -2
- package/lib/features/shopping/services/productFilters.js.map +1 -1
- package/lib/features/shopping/services/productMedia.js +103 -18
- package/lib/features/shopping/services/productMedia.js.map +1 -1
- package/lib/features/shopping/services/retailerUrl.js +11 -8
- package/lib/features/shopping/services/retailerUrl.js.map +1 -1
- package/lib/features/shopping/services/salesDealsStore.js +3 -2
- package/lib/features/shopping/services/salesDealsStore.js.map +1 -1
- package/lib/features/shopping/services/savedReads.js +82 -0
- package/lib/features/shopping/services/savedReads.js.map +1 -0
- package/lib/features/shopping/services/searchCardFields.js +2 -0
- package/lib/features/shopping/services/searchCardFields.js.map +1 -1
- package/lib/features/shopping/services/searchRelevance.js +154 -24
- package/lib/features/shopping/services/searchRelevance.js.map +1 -1
- package/lib/features/shopping/services/secondHand.js +12 -0
- package/lib/features/shopping/services/secondHand.js.map +1 -0
- package/lib/features/shopping/services/shoppingProductSearch.js +82 -10
- package/lib/features/shopping/services/shoppingProductSearch.js.map +1 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js +14 -1
- package/lib/features/shopping/services/shoppingSearchConnectorClient.js.map +1 -1
- package/lib/features/shopping/services/shoppingSubgraph.js +2 -1
- package/lib/features/shopping/services/shoppingSubgraph.js.map +1 -1
- package/lib/features/shopping/services/storedGalleries.js +130 -0
- package/lib/features/shopping/services/storedGalleries.js.map +1 -0
- package/lib/features/shopping/services/usedSites.js +263 -0
- package/lib/features/shopping/services/usedSites.js.map +1 -0
- package/lib/features/shopping/services/verifyProducts.js +3 -3
- package/lib/features/shopping/services/verifyProducts.js.map +1 -1
- package/lib/features/shopping/services/watchDeal.js +61 -0
- package/lib/features/shopping/services/watchDeal.js.map +1 -0
- package/lib/features/shopping/shoppingRuntime.js +7 -2
- package/lib/features/shopping/shoppingRuntime.js.map +1 -1
- package/lib/features/shopping/state/accountCaches.js +20 -0
- package/lib/features/shopping/state/accountCaches.js.map +1 -0
- package/lib/features/shopping/state/holidayDealsRequest.js +22 -0
- package/lib/features/shopping/state/holidayDealsRequest.js.map +1 -0
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js +1 -1
- package/lib/features/shopping/tutorials/ShoppingTutorialDock.js.map +1 -1
- package/lib/features/shopping/tutorials/shoppingTutorials.js +2 -0
- package/lib/features/shopping/tutorials/shoppingTutorials.js.map +1 -1
- package/lib/features/shopping/useShoppingSearch.js +74 -18
- package/lib/features/shopping/useShoppingSearch.js.map +1 -1
- package/lib/features/team-chat/TeamChatExperience.js +474 -0
- package/lib/features/team-chat/TeamChatExperience.js.map +1 -0
- package/lib/features/team-chat/api/client.js +198 -0
- package/lib/features/team-chat/api/client.js.map +1 -0
- package/lib/features/team-chat/api/live.js +160 -0
- package/lib/features/team-chat/api/live.js.map +1 -0
- package/lib/features/team-chat/api/ops.js +241 -0
- package/lib/features/team-chat/api/ops.js.map +1 -0
- package/lib/features/team-chat/app.js +12 -0
- package/lib/features/team-chat/app.js.map +1 -0
- package/lib/features/team-chat/components/Avatar.js +107 -0
- package/lib/features/team-chat/components/Avatar.js.map +1 -0
- package/lib/features/team-chat/components/Composer.js +641 -0
- package/lib/features/team-chat/components/Composer.js.map +1 -0
- package/lib/features/team-chat/components/Dialogs.js +598 -0
- package/lib/features/team-chat/components/Dialogs.js.map +1 -0
- package/lib/features/team-chat/components/EmojiPicker.js +165 -0
- package/lib/features/team-chat/components/EmojiPicker.js.map +1 -0
- package/lib/features/team-chat/components/MessageItem.js +658 -0
- package/lib/features/team-chat/components/MessageItem.js.map +1 -0
- package/lib/features/team-chat/components/MessageList.js +248 -0
- package/lib/features/team-chat/components/MessageList.js.map +1 -0
- package/lib/features/team-chat/components/Mrkdwn.js +228 -0
- package/lib/features/team-chat/components/Mrkdwn.js.map +1 -0
- package/lib/features/team-chat/components/QuickSwitcher.js +215 -0
- package/lib/features/team-chat/components/QuickSwitcher.js.map +1 -0
- package/lib/features/team-chat/components/ui.js +662 -0
- package/lib/features/team-chat/components/ui.js.map +1 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js +15 -0
- package/lib/features/team-chat/nativeTeamChatRegistry.js.map +1 -0
- package/lib/features/team-chat/state/fetched.js +39 -0
- package/lib/features/team-chat/state/fetched.js.map +1 -0
- package/lib/features/team-chat/state/lists.js +230 -0
- package/lib/features/team-chat/state/lists.js.map +1 -0
- package/lib/features/team-chat/state/store.js +1108 -0
- package/lib/features/team-chat/state/store.js.map +1 -0
- package/lib/features/team-chat/state/useChannelDirectory.js +21 -0
- package/lib/features/team-chat/state/useChannelDirectory.js.map +1 -0
- package/lib/features/team-chat/theme.js +77 -0
- package/lib/features/team-chat/theme.js.map +1 -0
- package/lib/features/team-chat/utils/composeText.js +72 -0
- package/lib/features/team-chat/utils/composeText.js.map +1 -0
- package/lib/features/team-chat/utils/emoji.js +369 -0
- package/lib/features/team-chat/utils/emoji.js.map +1 -0
- package/lib/features/team-chat/utils/format.js +109 -0
- package/lib/features/team-chat/utils/format.js.map +1 -0
- package/lib/features/team-chat/utils/messageRows.js +24 -0
- package/lib/features/team-chat/utils/messageRows.js.map +1 -0
- package/lib/features/team-chat/utils/mrkdwn.js +222 -0
- package/lib/features/team-chat/utils/mrkdwn.js.map +1 -0
- package/lib/features/team-chat/utils/notify.js +47 -0
- package/lib/features/team-chat/utils/notify.js.map +1 -0
- package/lib/features/team-chat/utils/pickFiles.js +81 -0
- package/lib/features/team-chat/utils/pickFiles.js.map +1 -0
- package/lib/features/team-chat/views/ActivityView.js +235 -0
- package/lib/features/team-chat/views/ActivityView.js.map +1 -0
- package/lib/features/team-chat/views/BrowseView.js +179 -0
- package/lib/features/team-chat/views/BrowseView.js.map +1 -0
- package/lib/features/team-chat/views/ChannelView.js +475 -0
- package/lib/features/team-chat/views/ChannelView.js.map +1 -0
- package/lib/features/team-chat/views/DetailsPane.js +816 -0
- package/lib/features/team-chat/views/DetailsPane.js.map +1 -0
- package/lib/features/team-chat/views/DraftsView.js +212 -0
- package/lib/features/team-chat/views/DraftsView.js.map +1 -0
- package/lib/features/team-chat/views/FilesView.js +152 -0
- package/lib/features/team-chat/views/FilesView.js.map +1 -0
- package/lib/features/team-chat/views/NewMessageView.js +286 -0
- package/lib/features/team-chat/views/NewMessageView.js.map +1 -0
- package/lib/features/team-chat/views/PeopleView.js +118 -0
- package/lib/features/team-chat/views/PeopleView.js.map +1 -0
- package/lib/features/team-chat/views/ProfilePane.js +220 -0
- package/lib/features/team-chat/views/ProfilePane.js.map +1 -0
- package/lib/features/team-chat/views/SavedView.js +113 -0
- package/lib/features/team-chat/views/SavedView.js.map +1 -0
- package/lib/features/team-chat/views/SearchView.js +307 -0
- package/lib/features/team-chat/views/SearchView.js.map +1 -0
- package/lib/features/team-chat/views/Sidebar.js +368 -0
- package/lib/features/team-chat/views/Sidebar.js.map +1 -0
- package/lib/features/team-chat/views/ThreadPane.js +139 -0
- package/lib/features/team-chat/views/ThreadPane.js.map +1 -0
- package/lib/features/team-chat/views/ThreadsView.js +157 -0
- package/lib/features/team-chat/views/ThreadsView.js.map +1 -0
- package/lib/features/webbuilder/WebBuilderExperience.js +276 -42
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +10 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/components/AssetChips.js +61 -0
- package/lib/features/webbuilder/components/AssetChips.js.map +1 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js +100 -0
- package/lib/features/webbuilder/components/AssetSiteChooser.js.map +1 -0
- package/lib/features/webbuilder/components/CommentsLayer.js +485 -0
- package/lib/features/webbuilder/components/CommentsLayer.js.map +1 -0
- package/lib/features/webbuilder/components/Composer.js +16 -2
- package/lib/features/webbuilder/components/Composer.js.map +1 -1
- package/lib/features/webbuilder/components/ComposerModeSwitch.js +71 -0
- package/lib/features/webbuilder/components/ComposerModeSwitch.js.map +1 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js +500 -0
- package/lib/features/webbuilder/components/MyAssetsPicker.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDocument.js +165 -0
- package/lib/features/webbuilder/components/PlanDocument.js.map +1 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js +205 -0
- package/lib/features/webbuilder/components/PlanDraftCard.js.map +1 -0
- package/lib/features/webbuilder/components/PlanView.js +788 -0
- package/lib/features/webbuilder/components/PlanView.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js +334 -0
- package/lib/features/webbuilder/components/PreviewConsoleSheet.js.map +1 -0
- package/lib/features/webbuilder/components/PreviewFrame.js +45 -3
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +94 -10
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +84 -14
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/StudioHome.js +69 -6
- package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js +291 -0
- package/lib/features/webbuilder/components/StyleDirectionsSheet.js.map +1 -0
- package/lib/features/webbuilder/components/VersionChangesView.js +574 -0
- package/lib/features/webbuilder/components/VersionChangesView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js +186 -0
- package/lib/features/webbuilder/components/VersionPreviewView.js.map +1 -0
- package/lib/features/webbuilder/components/VersionsSheet.js +673 -16
- package/lib/features/webbuilder/components/VersionsSheet.js.map +1 -1
- package/lib/features/webbuilder/connectorTemplates.js +6 -1
- package/lib/features/webbuilder/connectorTemplates.js.map +1 -1
- package/lib/features/webbuilder/myAssets.js +101 -0
- package/lib/features/webbuilder/myAssets.js.map +1 -0
- package/lib/features/webbuilder/planChat.js +146 -0
- package/lib/features/webbuilder/planChat.js.map +1 -0
- package/lib/features/webbuilder/planDocument.js +89 -0
- package/lib/features/webbuilder/planDocument.js.map +1 -0
- package/lib/features/webbuilder/planStore.js +55 -0
- package/lib/features/webbuilder/planStore.js.map +1 -0
- package/lib/features/webbuilder/previewCommentsScript.js +218 -0
- package/lib/features/webbuilder/previewCommentsScript.js.map +1 -0
- package/lib/features/webbuilder/previewConsoleScript.js +39 -0
- package/lib/features/webbuilder/previewConsoleScript.js.map +1 -0
- package/lib/features/webbuilder/styleDirections.js +85 -0
- package/lib/features/webbuilder/styleDirections.js.map +1 -0
- package/lib/features/webbuilder/useCanvasComments.js +335 -0
- package/lib/features/webbuilder/useCanvasComments.js.map +1 -0
- package/lib/features/webbuilder/useCatalogTemplates.js +37 -0
- package/lib/features/webbuilder/useCatalogTemplates.js.map +1 -0
- package/lib/features/webbuilder/usePlanMode.js +145 -0
- package/lib/features/webbuilder/usePlanMode.js.map +1 -0
- package/lib/features/webbuilder/useStyleDirections.js +112 -0
- package/lib/features/webbuilder/useStyleDirections.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js +174 -0
- package/lib/features/webbuilder/web/assets/assetsApi.js.map +1 -0
- package/lib/features/webbuilder/web/assets/assetsApi.ts +173 -0
- package/lib/features/webbuilder/web/assets/myAssets.js +341 -0
- package/lib/features/webbuilder/web/assets/myAssets.js.map +1 -0
- package/lib/features/webbuilder/web/assets/myAssets.ts +396 -0
- package/lib/features/webbuilder/web/canvas/elementName.js +46 -0
- package/lib/features/webbuilder/web/canvas/elementName.js.map +1 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js +95 -0
- package/lib/features/webbuilder/web/canvas/visualEditorBridge.js.map +1 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js +24 -0
- package/lib/features/webbuilder/web/chat/agentTurn.js.map +1 -0
- package/lib/features/webbuilder/web/chat/planMode.js +164 -0
- package/lib/features/webbuilder/web/chat/planMode.js.map +1 -0
- package/lib/features/webbuilder/web/chat/realPlans.js +66 -0
- package/lib/features/webbuilder/web/chat/realPlans.js.map +1 -0
- package/lib/features/webbuilder/web/comments/comments.js +336 -0
- package/lib/features/webbuilder/web/comments/comments.js.map +1 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js +59 -0
- package/lib/features/webbuilder/web/comments/commentsApi.js.map +1 -0
- package/lib/features/webbuilder/web/components/planView.js +21 -0
- package/lib/features/webbuilder/web/components/planView.js.map +1 -0
- package/lib/features/webbuilder/web/console/consolePanel.js +43 -0
- package/lib/features/webbuilder/web/console/consolePanel.js.map +1 -0
- package/lib/features/webbuilder/web/console/previewConsole.js +256 -0
- package/lib/features/webbuilder/web/console/previewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js +147 -0
- package/lib/features/webbuilder/web/console/usePreviewConsole.js.map +1 -0
- package/lib/features/webbuilder/web/design/directions.js +419 -1
- package/lib/features/webbuilder/web/design/directions.js.map +1 -1
- package/lib/features/webbuilder/web/history/diffActions.js +222 -0
- package/lib/features/webbuilder/web/history/diffActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js +18 -0
- package/lib/features/webbuilder/web/history/diffHighlight.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionActions.js +272 -0
- package/lib/features/webbuilder/web/history/versionActions.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionDiff.js +338 -0
- package/lib/features/webbuilder/web/history/versionDiff.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreview.js +83 -0
- package/lib/features/webbuilder/web/history/versionPreview.js.map +1 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js +150 -0
- package/lib/features/webbuilder/web/history/versionPreviewMachine.js.map +1 -0
- package/lib/features/webbuilder/web/history/versions.js +326 -1
- package/lib/features/webbuilder/web/history/versions.js.map +1 -1
- package/lib/features/webbuilder/web/hosted/hostedTurn.js +36 -0
- package/lib/features/webbuilder/web/hosted/hostedTurn.js.map +1 -0
- package/lib/features/webbuilder/web/studio/brandKit.js +25 -0
- package/lib/features/webbuilder/web/studio/brandKit.js.map +1 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js +15 -0
- package/lib/features/webbuilder/web/utils/promptSafe.js.map +1 -0
- package/lib/features/webbuilder/web/webServices.js +3 -1
- package/lib/features/webbuilder/web/webServices.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/routes.json +55 -0
- package/lib/screens/Account/index.js +13 -5
- package/lib/screens/Account/index.js.map +1 -1
- package/lib/screens/Chat/index.js +16 -0
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +202 -39
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +52 -38
- package/lib/screens/Home/components/HomeHero.js.map +1 -1
- package/lib/screens/Home/components/homeCatalog.js +8 -1
- package/lib/screens/Home/components/homeCatalog.js.map +1 -1
- package/lib/screens/TeamChat/index.js +41 -0
- package/lib/screens/TeamChat/index.js.map +1 -0
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +9 -2
- package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +13 -3
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js +2 -2
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import {normalizeSha,normalizeRestoreData,buildRestoreCommand,parseRestoreOutput,bookmarkSlug,bookmarkFromData,buildBookmarkCommand,parseBookmarkOutput,normalizeListVersionsData,buildListVersionsCommand,parseListVersionsOutput,isUnknownActionError,plainConnectorError,clampLimit,FALLBACK_VERSION_LIMIT}from'./versions.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __objRest = (source, exclude) => {
|
|
7
|
+
var target = {};
|
|
8
|
+
for (var prop in source)
|
|
9
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
10
|
+
target[prop] = source[prop];
|
|
11
|
+
if (source != null && __getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
13
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
14
|
+
target[prop] = source[prop];
|
|
15
|
+
}
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
19
|
+
function stdoutOf(r) {
|
|
20
|
+
return typeof r.data.stdout === "string" ? r.data.stdout : "";
|
|
21
|
+
}
|
|
22
|
+
const NO_REPO_MESSAGE = "This project has no version history yet.";
|
|
23
|
+
const UNKNOWN_VERSION_MESSAGE = "That version no longer exists in this project.";
|
|
24
|
+
function nativeFailureMessage(r, fallback) {
|
|
25
|
+
var _a;
|
|
26
|
+
const code = typeof ((_a = r.data) == null ? void 0 : _a.errorCode) === "string" ? r.data.errorCode : "";
|
|
27
|
+
if (code === "SANDBOX_NOT_FOUND") return "The project is not running any more. Reload it and try again.";
|
|
28
|
+
if (code === "SANDBOX_UNREACHABLE") return "The project is not answering right now. Try again in a moment.";
|
|
29
|
+
return plainConnectorError(r.error, fallback);
|
|
30
|
+
}
|
|
31
|
+
class NativeSupport {
|
|
32
|
+
constructor() {
|
|
33
|
+
__publicField(this, "missing", /* @__PURE__ */ new Set());
|
|
34
|
+
}
|
|
35
|
+
isMissing(action) {
|
|
36
|
+
return this.missing.has(action);
|
|
37
|
+
}
|
|
38
|
+
markMissing(action) {
|
|
39
|
+
this.missing.add(action);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const pageNativeSupport = new NativeSupport();
|
|
43
|
+
async function tryNative(run, support, action, params) {
|
|
44
|
+
if (support == null ? void 0 : support.isMissing(action)) return "missing";
|
|
45
|
+
if (!params) return null;
|
|
46
|
+
const r = await run(action, params);
|
|
47
|
+
if (!r.successful && isUnknownActionError(r.error, r.data)) {
|
|
48
|
+
support == null ? void 0 : support.markMissing(action);
|
|
49
|
+
return "missing";
|
|
50
|
+
}
|
|
51
|
+
return r;
|
|
52
|
+
}
|
|
53
|
+
async function listVersions(run, sandboxId, opts) {
|
|
54
|
+
const sid = sandboxId.trim();
|
|
55
|
+
if (!sid) return {
|
|
56
|
+
ok: false,
|
|
57
|
+
message: "Wake the preview to see the history."
|
|
58
|
+
};
|
|
59
|
+
const native = await tryNative(run, opts == null ? void 0 : opts.support, "WEBBUILDER_LIST_VERSIONS", {
|
|
60
|
+
sandbox_id: sid,
|
|
61
|
+
limit: clampLimit(opts == null ? void 0 : opts.limit)
|
|
62
|
+
});
|
|
63
|
+
if (native && native !== "missing") {
|
|
64
|
+
if (!native.successful) return {
|
|
65
|
+
ok: false,
|
|
66
|
+
message: nativeFailureMessage(native, "Could not load the history.")
|
|
67
|
+
};
|
|
68
|
+
const list = normalizeListVersionsData(native.data);
|
|
69
|
+
if (list == null ? void 0 : list.noRepo) return {
|
|
70
|
+
ok: false,
|
|
71
|
+
message: NO_REPO_MESSAGE
|
|
72
|
+
};
|
|
73
|
+
if (list) return {
|
|
74
|
+
ok: true,
|
|
75
|
+
value: list,
|
|
76
|
+
viaFallback: false
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
message: "The history came back in an unexpected shape."
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const r = await run("WEBBUILDER_RUN_COMMAND", {
|
|
84
|
+
sandbox_id: sid,
|
|
85
|
+
command: buildListVersionsCommand(Math.min(clampLimit(opts == null ? void 0 : opts.limit), FALLBACK_VERSION_LIMIT))
|
|
86
|
+
});
|
|
87
|
+
if (!r.successful) return {
|
|
88
|
+
ok: false,
|
|
89
|
+
message: r.error || "Could not load the history."
|
|
90
|
+
};
|
|
91
|
+
const parsed = parseListVersionsOutput(stdoutOf(r), {
|
|
92
|
+
truncated: r.data.truncated === true
|
|
93
|
+
});
|
|
94
|
+
if (parsed.ok === false) {
|
|
95
|
+
return {
|
|
96
|
+
ok: false,
|
|
97
|
+
message: parsed.reason === "norepo" ? NO_REPO_MESSAGE : "Could not read the history."
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const _a = parsed, {
|
|
101
|
+
ok: _ok
|
|
102
|
+
} = _a, value = __objRest(_a, [
|
|
103
|
+
"ok"
|
|
104
|
+
]);
|
|
105
|
+
return {
|
|
106
|
+
ok: true,
|
|
107
|
+
value,
|
|
108
|
+
viaFallback: true
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const RESTORE_MESSAGES = {
|
|
112
|
+
none: "The project already matches that version.",
|
|
113
|
+
unknown: UNKNOWN_VERSION_MESSAGE,
|
|
114
|
+
norepo: NO_REPO_MESSAGE,
|
|
115
|
+
failed: "Could not restore that version."
|
|
116
|
+
};
|
|
117
|
+
async function restoreVersion(run, sandboxId, version, opts) {
|
|
118
|
+
var _a;
|
|
119
|
+
const sid = sandboxId.trim();
|
|
120
|
+
const sha = normalizeSha(version.sha);
|
|
121
|
+
if (!sid) return {
|
|
122
|
+
ok: false,
|
|
123
|
+
message: "Wake the preview to restore a version."
|
|
124
|
+
};
|
|
125
|
+
if (!sha) return {
|
|
126
|
+
ok: false,
|
|
127
|
+
message: "That version id is not valid."
|
|
128
|
+
};
|
|
129
|
+
const native = await tryNative(run, opts == null ? void 0 : opts.support, "WEBBUILDER_RESTORE_VERSION", {
|
|
130
|
+
sandbox_id: sid,
|
|
131
|
+
sha
|
|
132
|
+
});
|
|
133
|
+
if (native && native !== "missing") {
|
|
134
|
+
if (!native.successful) {
|
|
135
|
+
const code = typeof ((_a = native.data) == null ? void 0 : _a.errorCode) === "string" ? native.data.errorCode : "";
|
|
136
|
+
const unknownSha = code === "PREFLIGHT_INVALID_PARAM" && /does not exist|no such|unknown/i.test(native.error || "");
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
message: unknownSha ? UNKNOWN_VERSION_MESSAGE : nativeFailureMessage(native, "Could not restore that version.")
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const restored = normalizeRestoreData(native.data);
|
|
143
|
+
if (restored.ok === true) return {
|
|
144
|
+
ok: true,
|
|
145
|
+
value: {
|
|
146
|
+
newHead: restored.newHead
|
|
147
|
+
},
|
|
148
|
+
viaFallback: false
|
|
149
|
+
};
|
|
150
|
+
return {
|
|
151
|
+
ok: false,
|
|
152
|
+
message: restored.reason === "none" ? RESTORE_MESSAGES.none : RESTORE_MESSAGES.failed
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const r = await run("WEBBUILDER_RUN_COMMAND", {
|
|
156
|
+
sandbox_id: sid,
|
|
157
|
+
command: buildRestoreCommand(sha, version.message),
|
|
158
|
+
timeoutMs: 12e4
|
|
159
|
+
}, {
|
|
160
|
+
timeoutMs: 15e4
|
|
161
|
+
});
|
|
162
|
+
if (!r.successful) return {
|
|
163
|
+
ok: false,
|
|
164
|
+
message: r.error || "Could not restore that version."
|
|
165
|
+
};
|
|
166
|
+
const out = parseRestoreOutput(stdoutOf(r));
|
|
167
|
+
if (out.ok === true) return {
|
|
168
|
+
ok: true,
|
|
169
|
+
value: {
|
|
170
|
+
newHead: out.newHead
|
|
171
|
+
},
|
|
172
|
+
viaFallback: true
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
message: RESTORE_MESSAGES[out.reason]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function bookmarkParams(sid, sha, slug, removeCurrent) {
|
|
180
|
+
if (removeCurrent) return {
|
|
181
|
+
sandbox_id: sid,
|
|
182
|
+
name: removeCurrent,
|
|
183
|
+
remove: true
|
|
184
|
+
};
|
|
185
|
+
return slug === null ? null : {
|
|
186
|
+
sandbox_id: sid,
|
|
187
|
+
sha,
|
|
188
|
+
name: slug
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
async function bookmarkVersion(run, sandboxId, sha, name, opts) {
|
|
192
|
+
var _a;
|
|
193
|
+
const sid = sandboxId.trim();
|
|
194
|
+
const s = normalizeSha(sha);
|
|
195
|
+
if (!sid) return {
|
|
196
|
+
ok: false,
|
|
197
|
+
message: "Wake the preview to add bookmarks."
|
|
198
|
+
};
|
|
199
|
+
if (!s) return {
|
|
200
|
+
ok: false,
|
|
201
|
+
message: "That version id is not valid."
|
|
202
|
+
};
|
|
203
|
+
const slug = name === null ? null : bookmarkSlug(name);
|
|
204
|
+
if (name !== null && !slug) return {
|
|
205
|
+
ok: false,
|
|
206
|
+
message: "Give the bookmark a name with letters or numbers."
|
|
207
|
+
};
|
|
208
|
+
const current = bookmarkSlug(String((_a = opts == null ? void 0 : opts.current) != null ? _a : "").replace(/^bookmark\//, ""));
|
|
209
|
+
const removeCurrent = current && current !== slug ? current : null;
|
|
210
|
+
const native = await tryNative(run, opts == null ? void 0 : opts.support, "WEBBUILDER_BOOKMARK_VERSION", bookmarkParams(sid, s, slug, removeCurrent));
|
|
211
|
+
if (native !== "missing") {
|
|
212
|
+
if (native && !native.successful) {
|
|
213
|
+
return {
|
|
214
|
+
ok: false,
|
|
215
|
+
message: nativeFailureMessage(native, "Could not save the bookmark.")
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (slug === null) return {
|
|
219
|
+
ok: true,
|
|
220
|
+
value: {
|
|
221
|
+
bookmark: null
|
|
222
|
+
},
|
|
223
|
+
viaFallback: false
|
|
224
|
+
};
|
|
225
|
+
const set = removeCurrent ? await run("WEBBUILDER_BOOKMARK_VERSION", {
|
|
226
|
+
sandbox_id: sid,
|
|
227
|
+
sha: s,
|
|
228
|
+
name: slug
|
|
229
|
+
}) : native;
|
|
230
|
+
if (!set || !set.successful) {
|
|
231
|
+
return {
|
|
232
|
+
ok: false,
|
|
233
|
+
message: set ? nativeFailureMessage(set, "Could not save the bookmark.") : "Could not save the bookmark."
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
ok: true,
|
|
238
|
+
value: {
|
|
239
|
+
bookmark: bookmarkFromData(set.data) || slug
|
|
240
|
+
},
|
|
241
|
+
viaFallback: false
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const r = await run("WEBBUILDER_RUN_COMMAND", {
|
|
245
|
+
sandbox_id: sid,
|
|
246
|
+
command: buildBookmarkCommand(s, slug)
|
|
247
|
+
});
|
|
248
|
+
if (!r.successful) return {
|
|
249
|
+
ok: false,
|
|
250
|
+
message: r.error || "Could not save the bookmark."
|
|
251
|
+
};
|
|
252
|
+
const out = parseBookmarkOutput(stdoutOf(r));
|
|
253
|
+
if (out === "ok") return {
|
|
254
|
+
ok: true,
|
|
255
|
+
value: {
|
|
256
|
+
bookmark: slug
|
|
257
|
+
},
|
|
258
|
+
viaFallback: true
|
|
259
|
+
};
|
|
260
|
+
if (out === "unknown") return {
|
|
261
|
+
ok: false,
|
|
262
|
+
message: "That version no longer exists in this project."
|
|
263
|
+
};
|
|
264
|
+
if (out === "norepo") return {
|
|
265
|
+
ok: false,
|
|
266
|
+
message: NO_REPO_MESSAGE
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
ok: false,
|
|
270
|
+
message: "Could not save the bookmark."
|
|
271
|
+
};
|
|
272
|
+
}export{NativeSupport,bookmarkVersion,listVersions,pageNativeSupport,restoreVersion};//# sourceMappingURL=versionActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionActions.js","sources":["../../../../../src/features/webbuilder/web/history/versionActions.ts"],"sourcesContent":["/**\n * W17 connector calls: the native WEBBUILDER_LIST_VERSIONS / RESTORE_VERSION / BOOKMARK_VERSION\n * actions, with a WEBBUILDER_RUN_COMMAND git fallback when the agent answers \"unknown action\"\n * (spec §1, \"When an action is missing\"). Web `history/versionActions.ts` (0.20.20). The connector\n * call is injected, so this stays pure and testable; on the phone it is the host's sandbox router\n * (`publishTools.run`), which sends these through the server's sandbox proxy.\n */\n\nimport {\n FALLBACK_VERSION_LIMIT,\n bookmarkFromData,\n bookmarkSlug,\n buildBookmarkCommand,\n buildListVersionsCommand,\n buildRestoreCommand,\n clampLimit,\n isUnknownActionError,\n normalizeListVersionsData,\n normalizeRestoreData,\n normalizeSha,\n parseBookmarkOutput,\n parseListVersionsOutput,\n parseRestoreOutput,\n plainConnectorError,\n type VersionList,\n type WebbuilderVersion,\n} from './versions';\n\n/** A connector answer with its fields unwrapped (web `canvas/types` SandboxActionResult). */\nexport interface SandboxActionResult {\n successful: boolean;\n data: Record<string, unknown>;\n error?: string | null;\n}\n\nexport type RunSandboxAction = (\n action: string,\n params: Record<string, unknown>,\n opts?: { timeoutMs?: number },\n) => Promise<SandboxActionResult>;\n\nexport type ActionOutcome<T> = { ok: true; value: T; viaFallback: boolean } | { ok: false; message: string };\n\nfunction stdoutOf(r: SandboxActionResult): string {\n return typeof r.data.stdout === 'string' ? r.data.stdout : '';\n}\n\nconst NO_REPO_MESSAGE = 'This project has no version history yet.';\nconst UNKNOWN_VERSION_MESSAGE = 'That version no longer exists in this project.';\n\n/** A failed native call as one plain sentence (`data.errorCode` first, then the error's sentence). */\nfunction nativeFailureMessage(r: SandboxActionResult, fallback: string): string {\n const code = typeof r.data?.errorCode === 'string' ? r.data.errorCode : '';\n if (code === 'SANDBOX_NOT_FOUND') return 'The project is not running any more. Reload it and try again.';\n if (code === 'SANDBOX_UNREACHABLE') return 'The project is not answering right now. Try again in a moment.';\n return plainConnectorError(r.error, fallback);\n}\n\n/**\n * Remembers, per session, that the agent lacks the native actions, so later\n * calls go straight to the fallback (one wasted round-trip, not one per click).\n */\nexport class NativeSupport {\n private missing = new Set<string>();\n\n isMissing(action: string): boolean {\n return this.missing.has(action);\n }\n\n markMissing(action: string): void {\n this.missing.add(action);\n }\n}\n\n// One per app run: once the agent says \"unknown action\", go straight to the fallback.\nexport const pageNativeSupport = new NativeSupport();\n\n/** `params: null` = nothing to call natively (still reports 'missing' when the action is known absent). */\nasync function tryNative(\n run: RunSandboxAction,\n support: NativeSupport | undefined,\n action: string,\n params: Record<string, unknown> | null,\n): Promise<SandboxActionResult | null | 'missing'> {\n if (support?.isMissing(action)) return 'missing';\n if (!params) return null;\n const r = await run(action, params);\n if (!r.successful && isUnknownActionError(r.error, r.data)) {\n support?.markMissing(action);\n return 'missing';\n }\n return r;\n}\n\nexport async function listVersions(\n run: RunSandboxAction,\n sandboxId: string,\n opts?: { limit?: number; support?: NativeSupport },\n): Promise<ActionOutcome<VersionList>> {\n const sid = sandboxId.trim();\n if (!sid) return { ok: false, message: 'Wake the preview to see the history.' };\n const native = await tryNative(run, opts?.support, 'WEBBUILDER_LIST_VERSIONS', {\n sandbox_id: sid,\n limit: clampLimit(opts?.limit),\n });\n if (native && native !== 'missing') {\n if (!native.successful)\n return { ok: false, message: nativeFailureMessage(native, 'Could not load the history.') };\n const list = normalizeListVersionsData(native.data);\n if (list?.noRepo) return { ok: false, message: NO_REPO_MESSAGE };\n if (list) return { ok: true, value: list, viaFallback: false };\n return { ok: false, message: 'The history came back in an unexpected shape.' };\n }\n const r = await run('WEBBUILDER_RUN_COMMAND', {\n sandbox_id: sid,\n command: buildListVersionsCommand(Math.min(clampLimit(opts?.limit), FALLBACK_VERSION_LIMIT)),\n });\n if (!r.successful) return { ok: false, message: r.error || 'Could not load the history.' };\n const parsed = parseListVersionsOutput(stdoutOf(r), { truncated: r.data.truncated === true });\n if (parsed.ok === false) {\n return { ok: false, message: parsed.reason === 'norepo' ? NO_REPO_MESSAGE : 'Could not read the history.' };\n }\n const { ok: _ok, ...value } = parsed;\n return { ok: true, value, viaFallback: true };\n}\n\nconst RESTORE_MESSAGES: Record<'none' | 'unknown' | 'norepo' | 'failed', string> = {\n none: 'The project already matches that version.',\n unknown: UNKNOWN_VERSION_MESSAGE,\n norepo: NO_REPO_MESSAGE,\n failed: 'Could not restore that version.',\n};\n\nexport async function restoreVersion(\n run: RunSandboxAction,\n sandboxId: string,\n version: Pick<WebbuilderVersion, 'sha' | 'message'>,\n opts?: { support?: NativeSupport },\n): Promise<ActionOutcome<{ newHead: string | null }>> {\n const sid = sandboxId.trim();\n const sha = normalizeSha(version.sha);\n if (!sid) return { ok: false, message: 'Wake the preview to restore a version.' };\n if (!sha) return { ok: false, message: 'That version id is not valid.' };\n const native = await tryNative(run, opts?.support, 'WEBBUILDER_RESTORE_VERSION', { sandbox_id: sid, sha });\n if (native && native !== 'missing') {\n if (!native.successful) {\n const code = typeof native.data?.errorCode === 'string' ? native.data.errorCode : '';\n const unknownSha =\n code === 'PREFLIGHT_INVALID_PARAM' && /does not exist|no such|unknown/i.test(native.error || '');\n return {\n ok: false,\n message: unknownSha\n ? UNKNOWN_VERSION_MESSAGE\n : nativeFailureMessage(native, 'Could not restore that version.'),\n };\n }\n const restored = normalizeRestoreData(native.data);\n if (restored.ok === true) return { ok: true, value: { newHead: restored.newHead }, viaFallback: false };\n return {\n ok: false,\n message: restored.reason === 'none' ? RESTORE_MESSAGES.none : RESTORE_MESSAGES.failed,\n };\n }\n const r = await run(\n 'WEBBUILDER_RUN_COMMAND',\n { sandbox_id: sid, command: buildRestoreCommand(sha, version.message), timeoutMs: 120_000 },\n { timeoutMs: 150_000 },\n );\n if (!r.successful) return { ok: false, message: r.error || 'Could not restore that version.' };\n const out = parseRestoreOutput(stdoutOf(r));\n if (out.ok === true) return { ok: true, value: { newHead: out.newHead }, viaFallback: true };\n return { ok: false, message: RESTORE_MESSAGES[out.reason] };\n}\n\n/** The native bookmark call: remove the current bookmark first when it is being replaced. */\nfunction bookmarkParams(\n sid: string,\n sha: string,\n slug: string | null,\n removeCurrent: string | null,\n): Record<string, unknown> | null {\n if (removeCurrent) return { sandbox_id: sid, name: removeCurrent, remove: true };\n return slug === null ? null : { sandbox_id: sid, sha, name: slug };\n}\n\n/**\n * Set (`name`) or remove (`name === null`) the bookmark on a version. The\n * native action removes a bookmark by its name, so pass the version's\n * `current` bookmark; setting a new name replaces it (one per version).\n */\nexport async function bookmarkVersion(\n run: RunSandboxAction,\n sandboxId: string,\n sha: string,\n name: string | null,\n opts?: { support?: NativeSupport; current?: string | null },\n): Promise<ActionOutcome<{ bookmark: string | null }>> {\n const sid = sandboxId.trim();\n const s = normalizeSha(sha);\n if (!sid) return { ok: false, message: 'Wake the preview to add bookmarks.' };\n if (!s) return { ok: false, message: 'That version id is not valid.' };\n const slug = name === null ? null : bookmarkSlug(name);\n if (name !== null && !slug) return { ok: false, message: 'Give the bookmark a name with letters or numbers.' };\n const current = bookmarkSlug(String(opts?.current ?? '').replace(/^bookmark\\//, ''));\n const removeCurrent = current && current !== slug ? current : null;\n const native = await tryNative(\n run,\n opts?.support,\n 'WEBBUILDER_BOOKMARK_VERSION',\n bookmarkParams(sid, s, slug, removeCurrent),\n );\n if (native !== 'missing') {\n if (native && !native.successful) {\n return { ok: false, message: nativeFailureMessage(native, 'Could not save the bookmark.') };\n }\n if (slug === null) return { ok: true, value: { bookmark: null }, viaFallback: false };\n const set = removeCurrent\n ? await run('WEBBUILDER_BOOKMARK_VERSION', { sandbox_id: sid, sha: s, name: slug })\n : native;\n if (!set || !set.successful) {\n return {\n ok: false,\n message: set\n ? nativeFailureMessage(set, 'Could not save the bookmark.')\n : 'Could not save the bookmark.',\n };\n }\n return { ok: true, value: { bookmark: bookmarkFromData(set.data) || slug }, viaFallback: false };\n }\n const r = await run('WEBBUILDER_RUN_COMMAND', { sandbox_id: sid, command: buildBookmarkCommand(s, slug) });\n if (!r.successful) return { ok: false, message: r.error || 'Could not save the bookmark.' };\n const out = parseBookmarkOutput(stdoutOf(r));\n if (out === 'ok') return { ok: true, value: { bookmark: slug }, viaFallback: true };\n if (out === 'unknown') return { ok: false, message: 'That version no longer exists in this project.' };\n if (out === 'norepo') return { ok: false, message: NO_REPO_MESSAGE };\n return { ok: false, message: 'Could not save the bookmark.' };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,SAAS,SAAS,CAAgC,EAAA;AAChD,EAAA,OAAO,OAAO,CAAE,CAAA,IAAA,CAAK,WAAW,QAAW,GAAA,CAAA,CAAE,KAAK,MAAS,GAAA,EAAA;AAC7D;AACA,MAAM,eAAkB,GAAA,0CAAA;AACxB,MAAM,uBAA0B,GAAA,gDAAA;AAGhC,SAAS,oBAAA,CAAqB,GAAwB,QAA0B,EAAA;AAlChF,EAAA,IAAA,EAAA;AAmCE,EAAM,MAAA,IAAA,GAAO,SAAO,EAAE,GAAA,CAAA,CAAA,IAAA,KAAF,mBAAQ,SAAc,CAAA,KAAA,QAAA,GAAW,CAAE,CAAA,IAAA,CAAK,SAAY,GAAA,EAAA;AACxE,EAAI,IAAA,IAAA,KAAS,qBAA4B,OAAA,+DAAA;AACzC,EAAI,IAAA,IAAA,KAAS,uBAA8B,OAAA,gEAAA;AAC3C,EAAO,OAAA,mBAAA,CAAoB,CAAE,CAAA,KAAA,EAAO,QAAQ,CAAA;AA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,IACJ,OAAS,EAAA;AAAA,GACX;AACA,EAAO,OAAA;AAAA,IACL,EAAI,EAAA,KAAA;AAAA,IACJ,OAAS,EAAA;AAAA,GACX;AACF"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import {normalizeSha,NO_REPO,shellQuote}from'./versions.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const MAX_STAT_FILES = 150;
|
|
21
|
+
const MAX_PATCH_BYTES = 1e4;
|
|
22
|
+
function baseLines(sha) {
|
|
23
|
+
return [`git cat-file -e '${sha}^{commit}' 2>/dev/null || { echo "__DIFF=unknown"; exit 0; }`, `P=$(git rev-parse -q --verify '${sha}^1' 2>/dev/null)`, 'B="$P"; [ -n "$B" ] || B=$(git hash-object -t tree /dev/null)'];
|
|
24
|
+
}
|
|
25
|
+
const GIT_DIFF = "git -c core.quotePath=false diff --no-color --no-ext-diff -M";
|
|
26
|
+
function buildChangesCommand(sha) {
|
|
27
|
+
const s = normalizeSha(sha);
|
|
28
|
+
if (!s) throw new Error("invalid version id");
|
|
29
|
+
return [NO_REPO, ...baseLines(s), 'echo "__DIFF=ok"', 'echo "__PARENT=$P"', `echo "__COUNT=$(git diff --name-only "$B" '${s}' -- 2>/dev/null | wc -l | tr -d ' ')"`, 'echo "__STAT"', `${GIT_DIFF} --numstat --summary "$B" '${s}' -- 2>/dev/null | head -n ${MAX_STAT_FILES * 2}`, 'echo "__END=1"', "exit 0"].join("\n");
|
|
30
|
+
}
|
|
31
|
+
function literalPath(path) {
|
|
32
|
+
return shellQuote(`:(literal)${path}`);
|
|
33
|
+
}
|
|
34
|
+
function isSafeRepoPath(path) {
|
|
35
|
+
if (typeof path !== "string" || !path || path.length > 500) return false;
|
|
36
|
+
if (/[\0\r\n]/.test(path) || path.startsWith("/") || path.startsWith("-")) return false;
|
|
37
|
+
return !path.split("/").includes("..");
|
|
38
|
+
}
|
|
39
|
+
function buildFileDiffCommand(sha, file) {
|
|
40
|
+
const s = normalizeSha(sha);
|
|
41
|
+
if (!s) throw new Error("invalid version id");
|
|
42
|
+
const paths = [file.oldPath, file.path].filter((p) => Boolean(p));
|
|
43
|
+
if (!paths.length || !paths.every(isSafeRepoPath)) throw new Error("invalid file path");
|
|
44
|
+
const spec = paths.filter((p, i) => paths.indexOf(p) === i).map(literalPath).join(" ");
|
|
45
|
+
return [NO_REPO, ...baseLines(s), "F=$(mktemp 2>/dev/null || echo /tmp/wb-diff-$$)", `${GIT_DIFF} -U3 "$B" '${s}' -- ${spec} > "$F" 2>/dev/null`, 'echo "__DIFF=ok"', `echo "__BYTES=$(wc -c < "$F" | tr -d ' ')"`, 'echo "__PATCH"', `head -c ${MAX_PATCH_BYTES} "$F"`, "echo", 'echo "__END=1"', 'rm -f "$F"', "exit 0"].join("\n");
|
|
46
|
+
}
|
|
47
|
+
function utf8Bytes(ch, out) {
|
|
48
|
+
var _a;
|
|
49
|
+
const cp = (_a = ch.codePointAt(0)) != null ? _a : 0;
|
|
50
|
+
if (cp < 128) out.push(cp);
|
|
51
|
+
else if (cp < 2048) out.push(192 | cp >> 6, 128 | cp & 63);
|
|
52
|
+
else if (cp < 65536) out.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
53
|
+
else out.push(240 | cp >> 18, 128 | cp >> 12 & 63, 128 | cp >> 6 & 63, 128 | cp & 63);
|
|
54
|
+
}
|
|
55
|
+
function decodeUtf8(bytes) {
|
|
56
|
+
let out = "";
|
|
57
|
+
let i = 0;
|
|
58
|
+
while (i < bytes.length) {
|
|
59
|
+
const b = bytes[i];
|
|
60
|
+
let need = 0;
|
|
61
|
+
let cp = 0;
|
|
62
|
+
if (b < 128) cp = b;
|
|
63
|
+
else if (b >= 194 && b < 224) {
|
|
64
|
+
need = 1;
|
|
65
|
+
cp = b & 31;
|
|
66
|
+
} else if (b >= 224 && b < 240) {
|
|
67
|
+
need = 2;
|
|
68
|
+
cp = b & 15;
|
|
69
|
+
} else if (b >= 240 && b < 245) {
|
|
70
|
+
need = 3;
|
|
71
|
+
cp = b & 7;
|
|
72
|
+
} else cp = -1;
|
|
73
|
+
let ok = cp >= 0;
|
|
74
|
+
for (let k = 1; ok && k <= need; k++) {
|
|
75
|
+
const c = bytes[i + k];
|
|
76
|
+
if (c === void 0 || (c & 192) !== 128) ok = false;
|
|
77
|
+
else cp = cp << 6 | c & 63;
|
|
78
|
+
}
|
|
79
|
+
const overlong = need === 2 && cp < 2048 || need === 3 && (cp < 65536 || cp > 1114111);
|
|
80
|
+
const surrogate = cp >= 55296 && cp <= 57343;
|
|
81
|
+
if (ok && !overlong && !surrogate) {
|
|
82
|
+
out += String.fromCodePoint(cp);
|
|
83
|
+
i += need + 1;
|
|
84
|
+
} else {
|
|
85
|
+
out += "\uFFFD";
|
|
86
|
+
i += 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
const SIMPLE_ESCAPES = {
|
|
92
|
+
n: 10,
|
|
93
|
+
t: 9,
|
|
94
|
+
r: 13,
|
|
95
|
+
'"': 34,
|
|
96
|
+
"\\": 92,
|
|
97
|
+
a: 7,
|
|
98
|
+
b: 8,
|
|
99
|
+
f: 12,
|
|
100
|
+
v: 11
|
|
101
|
+
};
|
|
102
|
+
function unquoteGitPath(raw) {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
const v = raw.trim();
|
|
105
|
+
if (!(v.length >= 2 && v.startsWith('"') && v.endsWith('"'))) return v;
|
|
106
|
+
const bytes = [];
|
|
107
|
+
const body = v.slice(1, -1);
|
|
108
|
+
let i = 0;
|
|
109
|
+
while (i < body.length) {
|
|
110
|
+
const c = body[i];
|
|
111
|
+
if (c !== "\\") {
|
|
112
|
+
const cp = (_a = body.codePointAt(i)) != null ? _a : 0;
|
|
113
|
+
const ch = String.fromCodePoint(cp);
|
|
114
|
+
utf8Bytes(ch, bytes);
|
|
115
|
+
i += ch.length;
|
|
116
|
+
} else {
|
|
117
|
+
const next = (_b = body[i + 1]) != null ? _b : "";
|
|
118
|
+
const oct = /^[0-7]{1,3}/.exec(body.slice(i + 1));
|
|
119
|
+
if (oct) {
|
|
120
|
+
bytes.push(parseInt(oct[0], 8) & 255);
|
|
121
|
+
i += 1 + oct[0].length;
|
|
122
|
+
} else if (next in SIMPLE_ESCAPES) {
|
|
123
|
+
bytes.push(SIMPLE_ESCAPES[next]);
|
|
124
|
+
i += 2;
|
|
125
|
+
} else {
|
|
126
|
+
bytes.push(92);
|
|
127
|
+
i += 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return decodeUtf8(bytes);
|
|
132
|
+
}
|
|
133
|
+
function parseRenamePath(raw) {
|
|
134
|
+
const v = unquoteGitPath(raw);
|
|
135
|
+
const brace = /^(.*)\{(.*) => (.*)\}(.*)$/.exec(v);
|
|
136
|
+
const tidy = (p) => p.replace(/\/{2,}/g, "/").replace(/^\//, "");
|
|
137
|
+
if (brace) {
|
|
138
|
+
const [, pre, from, to, post] = brace;
|
|
139
|
+
return {
|
|
140
|
+
path: tidy(`${pre}${to}${post}`),
|
|
141
|
+
oldPath: tidy(`${pre}${from}${post}`)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const arrow = v.indexOf(" => ");
|
|
145
|
+
if (arrow > 0) return {
|
|
146
|
+
path: v.slice(arrow + 4),
|
|
147
|
+
oldPath: v.slice(0, arrow)
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
path: v
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function parseChangesOutput(sha, stdout) {
|
|
154
|
+
var _a, _b, _c, _d, _e;
|
|
155
|
+
const text = String(stdout || "");
|
|
156
|
+
if (/^__GIT=norepo\s*$/m.test(text)) return {
|
|
157
|
+
ok: false,
|
|
158
|
+
reason: "norepo"
|
|
159
|
+
};
|
|
160
|
+
if (/^__DIFF=unknown\s*$/m.test(text)) return {
|
|
161
|
+
ok: false,
|
|
162
|
+
reason: "unknown"
|
|
163
|
+
};
|
|
164
|
+
if (!/^__DIFF=ok\s*$/m.test(text)) return {
|
|
165
|
+
ok: false,
|
|
166
|
+
reason: "unreadable"
|
|
167
|
+
};
|
|
168
|
+
const parent = normalizeSha((_b = (_a = /^__PARENT=(.*)$/m.exec(text)) == null ? void 0 : _a[1]) != null ? _b : "");
|
|
169
|
+
const lines = text.split("\n");
|
|
170
|
+
const start = lines.findIndex((l) => l.trim() === "__STAT");
|
|
171
|
+
const files = [];
|
|
172
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
173
|
+
const created = /* @__PURE__ */ new Set();
|
|
174
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
175
|
+
const body = start >= 0 ? lines.slice(start + 1) : [];
|
|
176
|
+
const end = body.findIndex((l) => l.startsWith("__END="));
|
|
177
|
+
for (const raw of end >= 0 ? body.slice(0, end) : body) {
|
|
178
|
+
const line = raw.replace(/\r$/, "");
|
|
179
|
+
const num = /^(\d+|-)\t(\d+|-)\t(.+)$/.exec(line);
|
|
180
|
+
const mode = num ? null : /^\s(create|delete) mode \d+ (.+)$/.exec(line);
|
|
181
|
+
if (num) {
|
|
182
|
+
const binary = num[1] === "-" && num[2] === "-";
|
|
183
|
+
const {
|
|
184
|
+
path,
|
|
185
|
+
oldPath
|
|
186
|
+
} = parseRenamePath(num[3]);
|
|
187
|
+
if (path) {
|
|
188
|
+
const file = __spreadProps(__spreadValues({
|
|
189
|
+
path
|
|
190
|
+
}, oldPath ? {
|
|
191
|
+
oldPath
|
|
192
|
+
} : {}), {
|
|
193
|
+
status: oldPath ? "renamed" : "modified",
|
|
194
|
+
additions: binary ? null : Number(num[1]),
|
|
195
|
+
deletions: binary ? null : Number(num[2]),
|
|
196
|
+
binary
|
|
197
|
+
});
|
|
198
|
+
files.push(file);
|
|
199
|
+
byPath.set(path, file);
|
|
200
|
+
}
|
|
201
|
+
} else if (mode) {
|
|
202
|
+
(mode[1] === "create" ? created : deleted).add(unquoteGitPath(mode[2]));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
created.forEach((p) => {
|
|
206
|
+
const f = byPath.get(p);
|
|
207
|
+
if (f && f.status === "modified") f.status = "added";
|
|
208
|
+
});
|
|
209
|
+
deleted.forEach((p) => {
|
|
210
|
+
const f = byPath.get(p);
|
|
211
|
+
if (f && f.status === "modified") f.status = "deleted";
|
|
212
|
+
});
|
|
213
|
+
const kept = files.slice(0, MAX_STAT_FILES);
|
|
214
|
+
const count = Number((_d = (_c = /^__COUNT=(\d+)\s*$/m.exec(text)) == null ? void 0 : _c[1]) != null ? _d : NaN);
|
|
215
|
+
return {
|
|
216
|
+
ok: true,
|
|
217
|
+
value: {
|
|
218
|
+
sha: (_e = normalizeSha(sha)) != null ? _e : sha,
|
|
219
|
+
parent,
|
|
220
|
+
files: kept,
|
|
221
|
+
additions: kept.reduce((n, f) => {
|
|
222
|
+
var _a2;
|
|
223
|
+
return n + ((_a2 = f.additions) != null ? _a2 : 0);
|
|
224
|
+
}, 0),
|
|
225
|
+
deletions: kept.reduce((n, f) => {
|
|
226
|
+
var _a2;
|
|
227
|
+
return n + ((_a2 = f.deletions) != null ? _a2 : 0);
|
|
228
|
+
}, 0),
|
|
229
|
+
total: Number.isFinite(count) ? Math.max(count, kept.length) : kept.length
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const HUNK_RE = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/;
|
|
234
|
+
function parseUnifiedDiff(patch, opts) {
|
|
235
|
+
const lines = String(patch || "").replace(/\n+$/, "").split("\n");
|
|
236
|
+
if ((opts == null ? void 0 : opts.truncated) && lines.length) lines.pop();
|
|
237
|
+
const hunks = [];
|
|
238
|
+
let binary = false;
|
|
239
|
+
let cur = null;
|
|
240
|
+
let oldNo = 0;
|
|
241
|
+
let newNo = 0;
|
|
242
|
+
for (const raw of lines) {
|
|
243
|
+
const line = raw.replace(/\r$/, "");
|
|
244
|
+
const h = HUNK_RE.exec(line);
|
|
245
|
+
if (h) {
|
|
246
|
+
oldNo = Number(h[1]);
|
|
247
|
+
newNo = Number(h[3]);
|
|
248
|
+
cur = {
|
|
249
|
+
oldStart: oldNo,
|
|
250
|
+
oldLines: h[2] === void 0 ? 1 : Number(h[2]),
|
|
251
|
+
newStart: newNo,
|
|
252
|
+
newLines: h[4] === void 0 ? 1 : Number(h[4]),
|
|
253
|
+
section: h[5].trim(),
|
|
254
|
+
lines: []
|
|
255
|
+
};
|
|
256
|
+
hunks.push(cur);
|
|
257
|
+
} else if (!cur) {
|
|
258
|
+
if (/^Binary files .* differ$/.test(line) || line === "GIT binary patch") binary = true;
|
|
259
|
+
} else {
|
|
260
|
+
const mark = line[0];
|
|
261
|
+
const bareContext = line === "" && oldNo < cur.oldStart + cur.oldLines && newNo < cur.newStart + cur.newLines;
|
|
262
|
+
if (mark === " " || bareContext) {
|
|
263
|
+
cur.lines.push({
|
|
264
|
+
kind: "context",
|
|
265
|
+
text: line.slice(1),
|
|
266
|
+
oldNo,
|
|
267
|
+
newNo
|
|
268
|
+
});
|
|
269
|
+
oldNo += 1;
|
|
270
|
+
newNo += 1;
|
|
271
|
+
} else if (mark === "+") {
|
|
272
|
+
cur.lines.push({
|
|
273
|
+
kind: "add",
|
|
274
|
+
text: line.slice(1),
|
|
275
|
+
oldNo: null,
|
|
276
|
+
newNo
|
|
277
|
+
});
|
|
278
|
+
newNo += 1;
|
|
279
|
+
} else if (mark === "-") {
|
|
280
|
+
cur.lines.push({
|
|
281
|
+
kind: "del",
|
|
282
|
+
text: line.slice(1),
|
|
283
|
+
oldNo,
|
|
284
|
+
newNo: null
|
|
285
|
+
});
|
|
286
|
+
oldNo += 1;
|
|
287
|
+
} else if (line.startsWith("diff --git ")) {
|
|
288
|
+
cur = null;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return {
|
|
293
|
+
binary,
|
|
294
|
+
hunks: hunks.filter((x) => x.lines.length > 0),
|
|
295
|
+
truncated: Boolean(opts == null ? void 0 : opts.truncated)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function parseFileDiffOutput(stdout, opts) {
|
|
299
|
+
var _a, _b;
|
|
300
|
+
const text = String(stdout || "");
|
|
301
|
+
if (/^__GIT=norepo\s*$/m.test(text)) return {
|
|
302
|
+
ok: false,
|
|
303
|
+
reason: "norepo"
|
|
304
|
+
};
|
|
305
|
+
if (/^__DIFF=unknown\s*$/m.test(text)) return {
|
|
306
|
+
ok: false,
|
|
307
|
+
reason: "unknown"
|
|
308
|
+
};
|
|
309
|
+
if (!/^__DIFF=ok\s*$/m.test(text)) return {
|
|
310
|
+
ok: false,
|
|
311
|
+
reason: "unreadable"
|
|
312
|
+
};
|
|
313
|
+
const bytes = Number((_b = (_a = /^__BYTES=(\d+)\s*$/m.exec(text)) == null ? void 0 : _a[1]) != null ? _b : 0);
|
|
314
|
+
const at = text.indexOf("\n__PATCH\n");
|
|
315
|
+
let patch = at >= 0 ? text.slice(at + "\n__PATCH\n".length) : "";
|
|
316
|
+
const end = patch.lastIndexOf("\n__END=1");
|
|
317
|
+
if (end >= 0) patch = patch.slice(0, end);
|
|
318
|
+
const cut = bytes > MAX_PATCH_BYTES || Boolean(opts == null ? void 0 : opts.truncated) || end < 0;
|
|
319
|
+
return {
|
|
320
|
+
ok: true,
|
|
321
|
+
value: parseUnifiedDiff(patch, {
|
|
322
|
+
truncated: cut
|
|
323
|
+
})
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function hunkLabel(hunk) {
|
|
327
|
+
const useNew = hunk.newLines > 0;
|
|
328
|
+
const start = useNew ? hunk.newStart : hunk.oldStart;
|
|
329
|
+
const count = useNew ? hunk.newLines : hunk.oldLines;
|
|
330
|
+
const range = count <= 1 ? `Line ${start}` : `Lines ${start}\u2013${start + count - 1}`;
|
|
331
|
+
return hunk.section ? `${range} \xB7 ${hunk.section}` : range;
|
|
332
|
+
}
|
|
333
|
+
function isGeneratedFile(path) {
|
|
334
|
+
return /(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?|npm-shrinkwrap\.json)$/.test(path);
|
|
335
|
+
}
|
|
336
|
+
function filesChangedLabel(n) {
|
|
337
|
+
return `${n} ${n === 1 ? "file" : "files"} changed`;
|
|
338
|
+
}export{MAX_PATCH_BYTES,MAX_STAT_FILES,buildChangesCommand,buildFileDiffCommand,decodeUtf8,filesChangedLabel,hunkLabel,isGeneratedFile,isSafeRepoPath,parseChangesOutput,parseFileDiffOutput,parseRenamePath,parseUnifiedDiff,unquoteGitPath};//# sourceMappingURL=versionDiff.js.map
|