@burdenoff/fe-libs 2026.1007.5 → 2026.1008.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/api.d.ts +11 -0
- package/dist/shared/assistant/api.d.ts.map +1 -1
- package/dist/shared/assistant/api.js +6 -2
- package/dist/shared/assistant/attachmentCommit.d.ts +175 -0
- package/dist/shared/assistant/attachmentCommit.d.ts.map +1 -0
- package/dist/shared/assistant/attachmentCommit.js +638 -0
- package/dist/shared/assistant/attachments.d.ts +39 -19
- package/dist/shared/assistant/attachments.d.ts.map +1 -1
- package/dist/shared/assistant/conversation.d.ts +14 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.d.ts +8 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/shared/assistant/createSandboxAssistantTransport.js +70 -51
- package/dist/shared/assistant/history/historyEngine.js +280 -280
- package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
- package/dist/shared/assistant/history/historyMapping.js +19 -12
- package/dist/shared/assistant/i18nManifest.d.ts +23 -2
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +26 -3
- package/dist/shared/assistant/index.d.ts +9 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.d.ts +23 -0
- package/dist/shared/assistant/localUiCommandCopy.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommandCopy.js +60 -23
- package/dist/shared/assistant/localUiCommands.d.ts +29 -0
- package/dist/shared/assistant/localUiCommands.d.ts.map +1 -1
- package/dist/shared/assistant/localUiCommands.js +18 -7
- package/dist/shared/assistant/types.d.ts +19 -8
- package/dist/shared/assistant/types.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +1624 -1266
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +18 -3
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +5 -0
- package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageItem.js +89 -84
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts +5 -0
- package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMessageList.js +26 -25
- package/dist/shared/assistant/ui/AssistantUiOfferLink.d.ts +45 -0
- package/dist/shared/assistant/ui/AssistantUiOfferLink.d.ts.map +1 -0
- package/dist/shared/assistant/ui/AssistantUiOfferLink.js +56 -0
- package/dist/shared/assistant/ui/assistantOverlayState.d.ts +9 -0
- package/dist/shared/assistant/ui/assistantOverlayState.d.ts.map +1 -1
- package/dist/shared/assistant/ui/assistantOverlayState.js +37 -28
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.d.ts +8 -5
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.js +26 -9
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +3 -2
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +214 -125
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +15 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +127 -118
- package/dist/shared/assistant/ui/voice/VoiceConversationView.d.ts +6 -1
- package/dist/shared/assistant/ui/voice/VoiceConversationView.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceConversationView.js +7 -7
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts +6 -1
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/voice/VoiceTranscriptDrawer.js +15 -12
- package/dist/shared/assistant/uiActions/actOnResolve.d.ts +108 -0
- package/dist/shared/assistant/uiActions/actOnResolve.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/actOnResolve.js +51 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts +29 -0
- package/dist/shared/assistant/uiActions/linkContext.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/linkContext.js +37 -10
- package/dist/shared/assistant/uiActions/navIntent.d.ts +58 -0
- package/dist/shared/assistant/uiActions/navIntent.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/navIntent.js +79 -0
- package/dist/shared/assistant/uiActions/navigateAction.d.ts +6 -1
- package/dist/shared/assistant/uiActions/navigateAction.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/navigateAction.js +18 -14
- package/dist/shared/assistant/uiActions/navigationOutcome.d.ts +16 -2
- package/dist/shared/assistant/uiActions/navigationOutcome.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/navigationOutcome.js +6 -2
- package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts +39 -0
- package/dist/shared/assistant/uiActions/offerYesOnSurface.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/offerYesOnSurface.js +34 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts +14 -0
- package/dist/shared/assistant/uiActions/uiCatalogue.d.ts.map +1 -1
- package/dist/shared/assistant/uiActions/uiCatalogue.js +23 -3
- package/dist/shared/assistant/uiActions/uiOffers.d.ts +249 -0
- package/dist/shared/assistant/uiActions/uiOffers.d.ts.map +1 -0
- package/dist/shared/assistant/uiActions/uiOffers.js +195 -0
- package/dist/shared/assistant/useAssistantAttachments.d.ts +20 -2
- package/dist/shared/assistant/useAssistantAttachments.d.ts.map +1 -1
- package/dist/shared/assistant/useAssistantAttachments.js +146 -202
- package/dist/shared/assistant/useAttachmentCommitter.d.ts +17 -0
- package/dist/shared/assistant/useAttachmentCommitter.d.ts.map +1 -0
- package/dist/shared/assistant/useAttachmentCommitter.js +41 -0
- package/dist/shared/assistant/voiceCommit.d.ts +36 -0
- package/dist/shared/assistant/voiceCommit.d.ts.map +1 -0
- package/dist/shared/assistant/voiceCommit.js +24 -0
- package/dist/shared/assistant/writeProposals.d.ts +6 -0
- package/dist/shared/assistant/writeProposals.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplyBinder.d.ts +40 -0
- package/dist/shared/assistant/writeReplyBinder.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplyBinder.js +100 -83
- package/dist/shared/assistant/writeReplySend.d.ts +14 -0
- package/dist/shared/assistant/writeReplySend.d.ts.map +1 -1
- package/dist/shared/assistant/writeReplySend.js +32 -29
- package/dist/shared/hooks/index.d.ts +2 -0
- package/dist/shared/hooks/index.d.ts.map +1 -1
- package/dist/shared/navigation/unsavedChanges.d.ts +83 -0
- package/dist/shared/navigation/unsavedChanges.d.ts.map +1 -0
- package/dist/shared/navigation/unsavedChanges.js +46 -0
- package/dist/shared-assistant.js +247 -238
- package/dist/shared-hooks.js +10 -9
- package/dist/shared.js +20 -19
- package/dist/storage/filesPort.d.ts +111 -0
- package/dist/storage/filesPort.d.ts.map +1 -0
- package/dist/storage/filesPort.js +262 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +9 -8
- package/package.json +1 -1
package/dist/shared-hooks.js
CHANGED
|
@@ -16,10 +16,10 @@ import { useExclusiveMenu as A } from "./shared/hooks/useExclusiveMenu.js";
|
|
|
16
16
|
import { useLocalStorage as j } from "./shared/hooks/useLocalStorage.js";
|
|
17
17
|
import { useSessionStorage as M } from "./shared/hooks/useSessionStorage.js";
|
|
18
18
|
import { usePrevious as N, usePreviousDistinct as P, usePreviousHistory as F } from "./shared/hooks/usePrevious.js";
|
|
19
|
-
import { useConditionalToggle as I, useToggle as L, useToggleObject as
|
|
20
|
-
import { usePagination as
|
|
21
|
-
import { useAsync as
|
|
22
|
-
import { MODIFIER_KEYS as
|
|
19
|
+
import { useConditionalToggle as I, useToggle as L, useToggleObject as R } from "./shared/hooks/useToggle.js";
|
|
20
|
+
import { usePagination as z } from "./shared/hooks/usePagination.js";
|
|
21
|
+
import { useAsync as B, useAsyncImmediate as V } from "./shared/hooks/useAsync.js";
|
|
22
|
+
import { MODIFIER_KEYS as te, PLATFORM_TYPES as H } from "./shared/keyboard/types.js";
|
|
23
23
|
import { useKeyboardShortcuts as U } from "./shared/keyboard/useKeyboardShortcuts.js";
|
|
24
24
|
import { useHotkeys as W } from "./shared/keyboard/useHotkeys.js";
|
|
25
25
|
import { useShortcutHelp as G } from "./shared/keyboard/useShortcutHelp.js";
|
|
@@ -35,13 +35,14 @@ import { usePushDeviceRegistration as se } from "./shared/hooks/usePushDeviceReg
|
|
|
35
35
|
import { QUOTA_EXHAUSTED_EVENT as ce, dispatchQuotaExhausted as le, useQuotaErrorToast as ue } from "./shared/hooks/useQuotaErrorToast.js";
|
|
36
36
|
import { PLAN_USAGE_SNAPSHOT_EVENT as de, publishPlanUsageSnapshot as fe, useUpgradePrompt as pe } from "./shared/hooks/useUpgradePrompt.js";
|
|
37
37
|
import { appendContextToPath as me, useCurrentContextSearchParams as he } from "./shared/hooks/useCurrentContextSearchParams.js";
|
|
38
|
-
import ge,
|
|
38
|
+
import { UNSAVED_CHANGE_LABEL_MAX as ge, listUnsavedChanges as _e, registerUnsavedChange as ve, unsavedChangesBlocking as ye, useUnsavedChanges as be } from "./shared/navigation/unsavedChanges.js";
|
|
39
|
+
import xe, { use as Se } from "react";
|
|
39
40
|
//#region src/shared/hooks/index.ts
|
|
40
|
-
var $ =
|
|
41
|
-
function
|
|
42
|
-
let e =
|
|
41
|
+
var $ = xe.createContext(null);
|
|
42
|
+
function Ce() {
|
|
43
|
+
let e = Se($);
|
|
43
44
|
if (!e) throw Error("useMicrofrontendContext must be used within a MicrofrontendProvider");
|
|
44
45
|
return e;
|
|
45
46
|
}
|
|
46
47
|
//#endregion
|
|
47
|
-
export { C as BREAKPOINTS, a as ConsoleTransport, K as GLOBAL_SHORTCUT_CATEGORIES, n as LogLevel, r as LogManager, ee as Logger,
|
|
48
|
+
export { C as BREAKPOINTS, a as ConsoleTransport, K as GLOBAL_SHORTCUT_CATEGORIES, n as LogLevel, r as LogManager, ee as Logger, te as MODIFIER_KEYS, $ as MicrofrontendContext, de as PLAN_USAGE_SNAPSHOT_EVENT, H as PLATFORM_TYPES, re as PUSH_DEVICE_ID_STORAGE_KEY, ce as QUOTA_EXHAUSTED_EVENT, ge as UNSAVED_CHANGE_LABEL_MAX, me as appendContextToPath, q as createGlobalShortcuts, c as detectPlatform, le as dispatchQuotaExhausted, l as formatKeyCombo, u as getDisplayKeysForPlatform, J as getGlobalShortcutsByCategory, ie as getOrCreatePushDeviceId, d as getShortcutLabel, f as isMac, p as isMobileDevice, m as isTabletDevice, _e as listUnsavedChanges, i as logManager, h as matchesKeyCombo, Y as mergeShortcuts, g as normalizeKey, _ as normalizePlatformCombo, v as parseKeyCombo, fe as publishPlanUsageSnapshot, ae as registerPushDevice, ve as registerUnsavedChange, y as shouldEnableKeyboardShortcuts, b as shouldIgnoreShortcut, oe as unregisterPushDevice, ye as unsavedChangesBlocking, B as useAsync, V as useAsyncImmediate, w as useBreakpoint, I as useConditionalToggle, e as useCopyToClipboard, he as useCurrentContextSearchParams, x as useDebounce, A as useExclusiveMenu, Z as useHasAnimated, W as useHotkeys, O as useKeyPress, k as useKeyboardShortcut, U as useKeyboardShortcuts, j as useLocalStorage, X as useLogger, t as useMediaQuery, Ce as useMicrofrontendContext, T as useMobileBreakpoint, E as useOnClickOutside, D as useOnClickOutsideWithRef, s as usePWA, z as usePagination, N as usePrevious, P as usePreviousDistinct, F as usePreviousHistory, se as usePushDeviceRegistration, ue as useQuotaErrorToast, ne as useRecordProductVisit, Q as useReferralAttribution, o as useReturnFocus, M as useSessionStorage, G as useShortcutHelp, S as useThrottle, L as useToggle, R as useToggleObject, be as useUnsavedChanges, pe as useUpgradePrompt };
|
package/dist/shared.js
CHANGED
|
@@ -114,27 +114,28 @@ import { usePushDeviceRegistration as fa } from "./shared/hooks/usePushDeviceReg
|
|
|
114
114
|
import { QUOTA_EXHAUSTED_EVENT as pa, dispatchQuotaExhausted as ma, useQuotaErrorToast as ha } from "./shared/hooks/useQuotaErrorToast.js";
|
|
115
115
|
import { PLAN_USAGE_SNAPSHOT_EVENT as ga, publishPlanUsageSnapshot as _a, useUpgradePrompt as va } from "./shared/hooks/useUpgradePrompt.js";
|
|
116
116
|
import { appendContextToPath as ya, useCurrentContextSearchParams as ba } from "./shared/hooks/useCurrentContextSearchParams.js";
|
|
117
|
-
import {
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
121
|
-
import {
|
|
122
|
-
import {
|
|
123
|
-
import {
|
|
124
|
-
import {
|
|
125
|
-
import {
|
|
126
|
-
import {
|
|
127
|
-
import {
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
import {
|
|
117
|
+
import { UNSAVED_CHANGE_LABEL_MAX as xa, listUnsavedChanges as Sa, registerUnsavedChange as Ca, unsavedChangesBlocking as wa, useUnsavedChanges as Ta } from "./shared/navigation/unsavedChanges.js";
|
|
118
|
+
import { MicrofrontendContext as Ea, useMicrofrontendContext as Da } from "./shared-hooks.js";
|
|
119
|
+
import { withTourProgressStatus as Oa } from "./shared/tours/progress.js";
|
|
120
|
+
import { detectDeviceType as ka, getResponsiveSelector as Aa } from "./shared/tours/types.js";
|
|
121
|
+
import { useTourPlayer as ja } from "./shared/tours/useTourPlayer.js";
|
|
122
|
+
import { TourSpotlight as Ma } from "./shared/tours/TourSpotlight.js";
|
|
123
|
+
import { TourTooltip as Na } from "./shared/tours/TourTooltip.js";
|
|
124
|
+
import { TourPlayerProvider as Pa, useIsTourPlaying as Fa, useStartTour as Ia, useStopTour as La, useTourPlayerContext as Ra } from "./shared/tours/TourPlayerProvider.js";
|
|
125
|
+
import { TourPlayer as za, TourTriggerButton as Ba, usePlayTour as Va } from "./shared/tours/TourPlayer.js";
|
|
126
|
+
import { getTourContextRank as Ha, getTourRouteCatalog as Ua, getTourRouteModules as Wa, getTourRoutePages as Ga, isTourVisibleForContext as Ka, normalizeTourPath as qa, registerTourRouteCatalog as Ja, resolveTourTargetPath as Ya } from "./shared/tours/routeCatalog.js";
|
|
127
|
+
import { ToursProvider as Xa, useAutoStartTour as Za, useSafeToursContext as Qa, useTours as $a, useToursContext as eo } from "./shared/tours/ToursContext.js";
|
|
128
|
+
import { TourInitializer as to } from "./shared/tours/TourInitializer.js";
|
|
129
|
+
import { AppShellProvider as no, resolveAppShellObservabilityConfig as ro } from "./shared/providers/AppShellProvider.js";
|
|
130
|
+
import { MicrofrontendProvider as io } from "./shared-providers.js";
|
|
131
|
+
import { TourTrigger as ao } from "./shared/tours/TourTrigger.js";
|
|
131
132
|
import "./shared-tours.js";
|
|
132
|
-
import { acknowledgeNativePurchase as
|
|
133
|
-
import { getNativeEntryRoutes as
|
|
134
|
-
import { getPushOptInController as
|
|
133
|
+
import { acknowledgeNativePurchase as oo, getNativeProducts as so, getNativePurchases as co, installNativeIAP as lo, isNativeIAPAvailable as uo, purchaseNativeProduct as fo, restoreNativePurchases as po } from "./shared/native/purchases.js";
|
|
134
|
+
import { getNativeEntryRoutes as mo, shouldShowNativeWelcome as ho } from "./shared/native/entry.js";
|
|
135
|
+
import { getPushOptInController as go, registerPushOptInController as _o } from "./shared/native/push-optin.js";
|
|
135
136
|
import "./shared-native.js";
|
|
136
137
|
import "./shared/actors/index.js";
|
|
137
138
|
//#region src/shared/index.ts
|
|
138
|
-
var
|
|
139
|
+
var vo = "1.0.0";
|
|
139
140
|
//#endregion
|
|
140
|
-
export { Qr as ASSISTANT_WIDGET_TOGGLE_EVENT, mr as AccessDenied, ar as ActorIdentity, _i as AnalyticsConsentBanner, vt as ApolloClient, yt as ApolloProvider, wr as AppErrorBoundary, hn as AppInitializer,
|
|
141
|
+
export { Qr as ASSISTANT_WIDGET_TOGGLE_EVENT, mr as AccessDenied, ar as ActorIdentity, _i as AnalyticsConsentBanner, vt as ApolloClient, yt as ApolloProvider, wr as AppErrorBoundary, hn as AppInitializer, no as AppShellProvider, $r as AssistantWidget, Ve as BACKEND_ERROR_EVENT, Se as BOTMANOR_PRODUCT_SLUG, Ai as BREAKPOINTS, gi as BackendAuditSink, hi as BroadcastChannelSink, Oe as COMMON_SHELL_LESS_ROUTES, He as CONNECTION_STATUS_EVENT, xr as ConditionalShell, Sn as ConsoleTransport, jr as ContextConversationWidget, Pe as DEFAULT_PAGE_SIZE, ke as DEFAULT_SHELL_CONFIG, R as DESKTOP_UPDATE_UNSUPPORTED, z as DESKTOP_WINDOW_STATE_DEFAULT, pi as DesktopUpdateToast, mi as DevtoolsSink, cr as ErrorBoundary, gr as ErrorFallback, Ci as EventBusProvider, vo as FE_SHARED_VERSION, Tr as FeatureFlagProvider, Ar as FeatureGate, Fe as GATEWAYS, ea as GLOBAL_SHORTCUT_CATEGORIES, dt as GatewayProvider, Ln as INLINE_ENCODE, bt as InMemoryCache, Gr as KeyboardHelpDialogWrapper, _r as LoadingFallback, vn as LogLevel, bn as LogManager, yn as Logger, Yi as MODIFIER_KEYS, ei as Markdown, Ea as MicrofrontendContext, br as MicrofrontendErrorBoundary, io as MicrofrontendProvider, Si as OtelBrowserSink, ga as PLAN_USAGE_SNAPSHOT_EVENT, Xi as PLATFORM_TYPES, Ce as PRODUCTS, ge as PRODUCT_SLUG_EMIT, _e as PRODUCT_SLUG_RENAMES, we as PRODUCT_URLS, er as PULL_TO_REFRESH_THRESHOLD, ca as PUSH_DEVICE_ID_STORAGE_KEY, Cr as PWAInstallBanner, vr as PageLoadingFallback, dr as PermissionButton, hr as PermissionDenied, fr as PermissionGate, pr as PermissionLink, On as QUOTA_EXHAUSTED_CODE, pa as QUOTA_EXHAUSTED_EVENT, Kr as QuotaMeter, kn as RESOURCE_CAP_EXCEEDED_CODE, lr as RequireAuth, ur as RequireGuest, vi as RybbitSink, at as SSELink, Zt as SSORedirectSpinner, nn as SSO_DEPOSITED_PARAM, An as STORAGE_QUOTA_EXCEEDED_CODE, Xn as SafeAreaView, yr as SectionLoadingFallback, to as TourInitializer, za as TourPlayer, Pa as TourPlayerProvider, Ma as TourSpotlight, Na as TourTooltip, ao as TourTrigger, Ba as TourTriggerButton, Xa as ToursProvider, xa as UNSAVED_CHANGE_LABEL_MAX, jn as UPGRADE_ERROR_CODES, qr as UPGRADE_PROMPT_EVENT, Xr as UpgradeInlineBanner, Jr as UpgradePromptModal, _t as WsLink, oo as acknowledgeNativePurchase, r as alertTokens, ya as appendContextToPath, Dt as attemptTokenRefresh, rn as beginSsoNavigation, B as bootDesktopShell, or as buildActorFallback, Mn as buildQuotaExhaustedMessage, an as buildSsoDepositUrl, m as capitalizeFirst, h as capitalizeWords, i as categoryTokens, Qt as checkRemoteSLO, $t as checkSLO, Ot as clearAuthSessionStorage, Xe as clearGraphqlFetchResponseCache, en as clearLocalAuthState, Nt as clearSSoCookie, Pt as clearShellSsoCookies, on as clearSsoDepositState, sn as clearSsoNavigation, Cn as clearUserContext, Bn as cn, tr as computePullOffset, nr as computePullProgress, cn as consumeSsoDepositMarker, n as createApolloClient, wi as createEventBus, ta as createGlobalShortcuts, ot as createGraphQLClient, En as createProfileScopedStorage, V as desktopCheckForUpdates, H as desktopDeepLinkToPath, U as desktopInstallUpdate, W as desktopNotify, G as desktopOpenExternal, K as desktopSetBadgeCount, q as desktopSetLocale, J as desktopSetTheme, Y as desktopSetTrayQuickActions, ka as detectDeviceType, Mr as detectPlatform, Ue as dispatchBackendErrorEvent, ma as dispatchQuotaExhausted, Yr as dispatchUpgradePrompt, Rn as downscaleImage, ve as emitProductSlug, We as extractBackendError, Nn as extractQuotaExhaustedExtensions, Pn as extractUpgradeErrorExtensions, Te as findProductConfig, g as formatBytes, _ as formatCompactNumber, v as formatCurrency, y as formatCurrencyCompact, b as formatDate, x as formatDateTime, S as formatDuration, Nr as formatKeyCombo, C as formatList, w as formatNumber, T as formatOrdinal, E as formatPercentage, D as formatRelativeTime, O as formatTime, a as getAlertTokens, I as getCapacitorPlatform, o as getCategoryTokens, X as getDesktopAuthBridgeConfig, Z as getDesktopBridge, Q as getDesktopGatewayBases, $ as getDesktopGatewayUrls, ee as getDesktopRuntimeConfig, te as getDesktopUpdateState, ne as getDesktopWindowState, Pr as getDisplayKeysForPlatform, Ie as getGatewayConfig, Le as getGatewayUrl, st as getGlobalClient, na as getGlobalShortcutsByCategory, Re as getGraphQLEndpoint, re as getLegacyDesktopRuntime, Vt as getNativeBridge, mo as getNativeEntryRoutes, so as getNativeProducts, co as getNativePurchases, la as getOrCreatePushDeviceId, Ht as getPlatform, Ee as getProductUrl, De as getProductsWithUrls, Dn as getProfileScopedKey, s as getProgressTokens, go as getPushOptInController, Aa as getResponsiveSelector, tn as getSSORedirectUrl, Ft as getSSoCookie, Ae as getShellConfig, Fr as getShortcutLabel, c as getStatusBadgeTokens, l as getStatusTokens, Ze as getStoredAuthToken, Qe as getStoredLocale, $e as getStoredOrganizationId, et as getStoredProjectId, tt as getStoredWorkspaceId, nt as getStoredWorkspaceToken, Ha as getTourContextRank, Ua as getTourRouteCatalog, Wa as getTourRouteModules, Ga as getTourRoutePages, u as getTrendTokens, ct as getWorkspaceClient, ze as getWorkspaceTokenPayload, xt as gql, rt as graphqlFetch, kt as hasAuthGraphQLErrors, lt as initializeAppClients, wn as initializeLogger, ie as installDesktopDeepLinkHandler, ae as installDesktopNavigateHandler, de as installGatewayFetchRewrite, lo as installNativeIAP, Ge as isAbortError, Ut as isAndroid, At as isAuthGraphQLError, jt as isAuthNetworkError, Ke as isBackendErrorDisplay, L as isCapacitorNative, P as isChunkLoadError, oe as isDesktop, Wt as isElectron, Gt as isIOS, Kt as isInstalledApp, Ir as isMac, Lr as isMobileDevice, qt as isNative, uo as isNativeIAPAvailable, Fn as isQuotaExhaustedError, ye as isSameProductSlug, It as isSharedSsoCookieDomain, je as isShellLessRoute, ln as isSsoNavigationPending, Jt as isStandalonePWA, Rr as isTabletDevice, Ka as isTourVisibleForContext, qe as isTransportError, Lt as isTrustedSsoOrigin, In as isUpgradeError, Yt as isWeb, Xt as isWebBrowser, Be as isWorkspaceTokenValidForContext, F as lazyWithRetry, be as legacyProductSlug, Sa as listUnsavedChanges, xn as logManager, Je as markConnectionHealthy, un as markSsoDepositDone, dn as markSsoDepositPending, zr as matchesKeyCombo, ra as mergeShortcuts, fn as mintSsoSessionTokens, Vn as nativeActionSheet, Hn as nativeConfirm, Un as nativeCopyText, Wn as nativeImpact, Gn as nativeNotify, Kn as nativeOpenUrl, qn as nativeSelection, Jn as nativeShare, Yn as nativeToast, Br as normalizeKey, Vr as normalizePlatformCombo, xe as normalizeProductSlug, qa as normalizeTourPath, se as onDesktopUpdateState, ce as onDesktopWindowState, Hr as parseKeyCombo, k as pluralize, d as progressTokens, _a as publishPlanUsageSnapshot, fo as purchaseNativeProduct, yi as readAnalyticsConsent, bi as readAnalyticsConsentChoice, Zn as readInitialNetworkStatus, Rt as readShellSsoCookie, pn as readSsoDepositState, Mt as redirectToLogin, Qn as reduceNetworkStatus, le as registerDesktopNavigator, ua as registerPushDevice, _o as registerPushOptInController, Ja as registerTourRouteCatalog, Ca as registerUnsavedChange, ut as resetAppClients, ci as resolveActionSheetOutcome, ro as resolveAppShellObservabilityConfig, me as resolveAuthBridgeConfig, fe as resolveGatewayBases, it as resolveGatewayUrl, ue as resolveGatewayUrls, he as resolveShellAuthBridgeConfig, Ya as resolveTourTargetPath, po as restoreNativePurchases, zn as selectInlineBase64, xi as setAnalyticsConsent, zt as setSSoCookie, Bt as setShellSsoCookies, Tn as setUserContext, mn as shouldAttemptSsoDeposit, Ur as shouldEnableKeyboardShortcuts, Wr as shouldIgnoreShortcut, Me as shouldShowBreadcrumb, ho as shouldShowNativeWelcome, Ne as shouldShowSidebar, Ye as shouldToastBackendError, A as slugify, f as statusTokens, pe as suppressConsole, j as toCamelCase, M as toPascalCase, p as trendTokens, N as truncateText, da as unregisterPushDevice, wa as unsavedChangesBlocking, li as useActionSheet, sr as useActorProfiles, St as useApolloClient, ii as useAppState, qi as useAsync, Ji as useAsyncImmediate, Za as useAutoStartTour, ji as useBreakpoint, Ui as useConditionalToggle, e as useCopyToClipboard, ba as useCurrentContextSearchParams, Oi as useDebounce, ui as useDesktop, di as useDesktopUpdateState, fi as useDesktopWindowState, ai as useDeviceInfo, Ti as useEvent, Ei as useEventBus, Di as useEventEmitter, Li as useExclusiveMenu, Dr as useFeatureFlag, Or as useFeatureFlagDetails, kr as useFeatureFlagValue, Er as useFeatureFlags, ft as useGateway, pt as useGatewayClient, oi as useHaptics, aa as useHasAnimated, gt as useHasAuthToken, Qi as useHotkeys, Fa as useIsTourPlaying, Fi as useKeyPress, Ii as useKeyboardShortcut, Zi as useKeyboardShortcuts, Ct as useLazyQuery, Ri as useLocalStorage, ia as useLogger, t as useMediaQuery, Da as useMicrofrontendContext, Mi as useMobileBreakpoint, wt as useMutation, ri as useNativeKeyboard, ti as useNativePlatform, $n as useNetworkStatus, Ni as useOnClickOutside, Pi as useOnClickOutsideWithRef, Sr as usePWA, Ki as usePagination, Va as usePlayTour, Bi as usePrevious, Vi as usePreviousDistinct, Hi as usePreviousHistory, rr as usePullToRefresh, fa as usePushDeviceRegistration, Tt as useQuery, ha as useQuotaErrorToast, sa as useRecordProductVisit, oa as useReferralAttribution, gn as useRegistryHelpers, ir as useReturnFocus, ni as useSafeArea, mt as useSafeGateway, ht as useSafeGatewayClient, Qa as useSafeToursContext, zi as useSessionStorage, _n as useShellNavigate, $i as useShortcutHelp, Ia as useStartTour, si as useStatusBar, La as useStopTour, Et as useSubscription, ki as useThrottle, Wi as useToggle, Gi as useToggleObject, ja as useTourPlayer, Ra as useTourPlayerContext, $a as useTours, eo as useToursContext, Ta as useUnsavedChanges, va as useUpgradePrompt, Zr as useVoiceInput, Oa as withTourProgressStatus };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ApolloClient } from '@apollo/client';
|
|
2
|
+
import { FilesRetryKind } from './retryPolicy';
|
|
3
|
+
/** The quota a `completeUpload` is metered against. */
|
|
4
|
+
export declare const FILES_STORAGE_QUOTA_NAME = "platform.files.storage_bytes";
|
|
5
|
+
/** The step a {@link FilesPortError} came from. */
|
|
6
|
+
export type FilesPortOperation = 'ensureFolder' | 'initiate' | 'put' | 'complete' | 'getSession' | 'listSessions' | 'abort' | 'getDownloadUrl' | 'deleteFile' | 'getStorageQuota';
|
|
7
|
+
/**
|
|
8
|
+
* A failed port call. `message` is the server's own reason when there is one (never a
|
|
9
|
+
* generic sentence that blames the wrong culprit); `source` is the raw in-band error
|
|
10
|
+
* for classification.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FilesPortError extends Error {
|
|
13
|
+
readonly operation: FilesPortOperation;
|
|
14
|
+
/** The raw in-band Apollo error (or `{ statusCode }` for a failed PUT). */
|
|
15
|
+
readonly source: unknown;
|
|
16
|
+
/** HTTP status of a failed PUT; undefined for every GraphQL operation. */
|
|
17
|
+
readonly httpStatus?: number | undefined;
|
|
18
|
+
constructor(operation: FilesPortOperation, message: string,
|
|
19
|
+
/** The raw in-band Apollo error (or `{ statusCode }` for a failed PUT). */
|
|
20
|
+
source: unknown,
|
|
21
|
+
/** HTTP status of a failed PUT; undefined for every GraphQL operation. */
|
|
22
|
+
httpStatus?: number | undefined);
|
|
23
|
+
/** Cold start / transient blip / null (an answer, not an outage). */
|
|
24
|
+
get retryKind(): FilesRetryKind | null;
|
|
25
|
+
}
|
|
26
|
+
/** Thrown by {@link FilesPort.put} when its signal aborts the transfer. */
|
|
27
|
+
export declare class FilesPortAbortError extends Error {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export interface FilesFolder {
|
|
31
|
+
id: string;
|
|
32
|
+
path: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface InitiateUploadParams {
|
|
35
|
+
fileName: string;
|
|
36
|
+
fileSize: number;
|
|
37
|
+
mimeType: string;
|
|
38
|
+
extension: string;
|
|
39
|
+
/** Omit to stage bytes with no folder; `completeUpload` may then carry the folder. */
|
|
40
|
+
folderId?: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface InitiatedUpload {
|
|
43
|
+
sessionId: string;
|
|
44
|
+
/** Null for a MULTIPART session (files over 5 MiB): this port cannot upload those. */
|
|
45
|
+
uploadUrl: string | null;
|
|
46
|
+
uploadType: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface CompleteUploadParams {
|
|
49
|
+
sessionId: string;
|
|
50
|
+
fileSize: number;
|
|
51
|
+
folderId?: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface CompletedUpload {
|
|
54
|
+
fileId: string;
|
|
55
|
+
name: string | null;
|
|
56
|
+
folderId: string | null;
|
|
57
|
+
/** Present when the server selected it; callers fall back to {@link FilesPort.getDownloadUrl}. */
|
|
58
|
+
downloadUrl: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface UploadSessionInfo {
|
|
61
|
+
id: string;
|
|
62
|
+
/** 'IN_PROGRESS' | 'FINALIZED' | 'ABORTED' | 'EXPIRED' ... as the server spells it. */
|
|
63
|
+
status: string;
|
|
64
|
+
fileId: string | null;
|
|
65
|
+
}
|
|
66
|
+
export interface PutParams {
|
|
67
|
+
url: string;
|
|
68
|
+
blob: Blob;
|
|
69
|
+
mimeType: string;
|
|
70
|
+
/** 0..1 of the transfer. */
|
|
71
|
+
onProgress?: (fraction: number) => void;
|
|
72
|
+
signal?: AbortSignal;
|
|
73
|
+
}
|
|
74
|
+
export type StorageQuotaState =
|
|
75
|
+
/** The lookup was not possible or not conclusive: callers must carry on and let the real call decide. */
|
|
76
|
+
{
|
|
77
|
+
state: 'unknown';
|
|
78
|
+
}
|
|
79
|
+
/** The workspace has no assignment for the storage quota: `completeUpload` is refused with QUOTA_NOT_PROVISIONED. */
|
|
80
|
+
| {
|
|
81
|
+
state: 'not-provisioned';
|
|
82
|
+
} | {
|
|
83
|
+
state: 'ok';
|
|
84
|
+
remainingBytes: number | null;
|
|
85
|
+
};
|
|
86
|
+
export interface FilesPort {
|
|
87
|
+
ensureFolder(path: string): Promise<FilesFolder>;
|
|
88
|
+
initiate(params: InitiateUploadParams): Promise<InitiatedUpload>;
|
|
89
|
+
put(params: PutParams): Promise<void>;
|
|
90
|
+
complete(params: CompleteUploadParams): Promise<CompletedUpload>;
|
|
91
|
+
/** Null when the server has no such session (or it is not the caller's). */
|
|
92
|
+
getSession(sessionId: string): Promise<UploadSessionInfo | null>;
|
|
93
|
+
/** The caller's recent sessions: the reconcile fallback when `getSession` is unavailable. */
|
|
94
|
+
listSessions(): Promise<UploadSessionInfo[]>;
|
|
95
|
+
abort(sessionId: string): Promise<boolean>;
|
|
96
|
+
getDownloadUrl(fileId: string): Promise<string | null>;
|
|
97
|
+
/** Hard delete (row, object, usage decrement). */
|
|
98
|
+
deleteFile(fileId: string): Promise<boolean>;
|
|
99
|
+
/** Optional: a read-only look at the storage quota so a doomed commit can fail before it creates anything. */
|
|
100
|
+
getStorageQuota?(): Promise<StorageQuotaState>;
|
|
101
|
+
}
|
|
102
|
+
/** The Apollo surface the adapter needs: narrow, so it is trivial to fake. */
|
|
103
|
+
export type FilesPortClient = Pick<ApolloClient, 'mutate' | 'query'>;
|
|
104
|
+
export interface ApolloFilesPortOptions {
|
|
105
|
+
/** Current workspace id, for the quota read. Without it `getStorageQuota` is omitted. */
|
|
106
|
+
getWorkspaceId?: () => string;
|
|
107
|
+
/** Test seam: the XHR constructor (defaults to the global). */
|
|
108
|
+
xhr?: () => XMLHttpRequest;
|
|
109
|
+
}
|
|
110
|
+
export declare function createApolloFilesPort(client: FilesPortClient, options?: ApolloFilesPortOptions): FilesPort;
|
|
111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|
2
|
+
import { FILES_AFTER_SAVE_REFETCH as n } from "./uploadBlob.js";
|
|
3
|
+
import { gql as r } from "@apollo/client";
|
|
4
|
+
//#region src/storage/filesPort.ts
|
|
5
|
+
var i = r`
|
|
6
|
+
mutation SaveToFiles_EnsureFolderByPath($path: String!) {
|
|
7
|
+
ensureFolderByPath(path: $path) {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
path
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`, a = r`
|
|
14
|
+
mutation SaveToFiles_InitiateUpload($input: InitiateUploadInput!) {
|
|
15
|
+
initiateUpload(input: $input) {
|
|
16
|
+
session {
|
|
17
|
+
id
|
|
18
|
+
status
|
|
19
|
+
fileId
|
|
20
|
+
uploadType
|
|
21
|
+
}
|
|
22
|
+
uploadUrl
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`, o = r`
|
|
26
|
+
mutation SaveToFiles_CompleteUpload($input: CompleteUploadInput!) {
|
|
27
|
+
completeUpload(input: $input) {
|
|
28
|
+
fileId
|
|
29
|
+
file {
|
|
30
|
+
id
|
|
31
|
+
name
|
|
32
|
+
folderId
|
|
33
|
+
downloadUrl
|
|
34
|
+
}
|
|
35
|
+
session {
|
|
36
|
+
id
|
|
37
|
+
status
|
|
38
|
+
fileId
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`, s = r`
|
|
43
|
+
query SaveToFiles_GetUploadSession($id: ID!) {
|
|
44
|
+
getUploadSession(sessionId: $id) {
|
|
45
|
+
id
|
|
46
|
+
status
|
|
47
|
+
fileId
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`, c = r`
|
|
51
|
+
query SaveToFiles_GetMyUploadSessions {
|
|
52
|
+
getMyUploadSessions(pagination: { limit: 100 }) {
|
|
53
|
+
total
|
|
54
|
+
sessions {
|
|
55
|
+
id
|
|
56
|
+
status
|
|
57
|
+
fileId
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`, l = r`
|
|
62
|
+
mutation SaveToFiles_AbortUpload($id: ID!) {
|
|
63
|
+
abortUpload(sessionId: $id)
|
|
64
|
+
}
|
|
65
|
+
`, u = r`
|
|
66
|
+
mutation SaveToFiles_PermanentlyDeleteFile($id: ID!) {
|
|
67
|
+
permanentlyDeleteFile(id: $id)
|
|
68
|
+
}
|
|
69
|
+
`, d = r`
|
|
70
|
+
query AssistantAttachmentUrl($id: ID!) {
|
|
71
|
+
getFileDownloadUrl(id: $id)
|
|
72
|
+
}
|
|
73
|
+
`, f = r`
|
|
74
|
+
query SaveToFiles_WorkspaceQuota($workspaceId: ID!) {
|
|
75
|
+
workspaceQuotaStatuses(workspaceId: $workspaceId) {
|
|
76
|
+
quotaName
|
|
77
|
+
currentValue
|
|
78
|
+
limit
|
|
79
|
+
noLimit
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`, p = "platform.files.storage_bytes", m = class extends Error {
|
|
83
|
+
operation;
|
|
84
|
+
source;
|
|
85
|
+
httpStatus;
|
|
86
|
+
constructor(e, t, n, r) {
|
|
87
|
+
super(t), this.operation = e, this.source = n, this.httpStatus = r, this.name = "FilesPortError";
|
|
88
|
+
}
|
|
89
|
+
get retryKind() {
|
|
90
|
+
return e(this.source);
|
|
91
|
+
}
|
|
92
|
+
}, h = class extends Error {
|
|
93
|
+
constructor() {
|
|
94
|
+
super("Upload PUT aborted"), this.name = "AbortError";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
function g(e, n, r) {
|
|
98
|
+
if (n.error) throw new m(e, t(n.error) ?? r, n.error);
|
|
99
|
+
}
|
|
100
|
+
function _(e) {
|
|
101
|
+
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
102
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
103
|
+
let t = Number(e);
|
|
104
|
+
return Number.isFinite(t) ? t : null;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function v(e, t = {}) {
|
|
109
|
+
let r = {
|
|
110
|
+
async ensureFolder(t) {
|
|
111
|
+
let n = await e.mutate({
|
|
112
|
+
mutation: i,
|
|
113
|
+
variables: { path: t }
|
|
114
|
+
});
|
|
115
|
+
g("ensureFolder", n, `Could not resolve folder for path: ${t}`);
|
|
116
|
+
let r = n.data?.ensureFolderByPath;
|
|
117
|
+
if (!r?.id) throw new m("ensureFolder", `Could not resolve folder for path: ${t}`, void 0);
|
|
118
|
+
return {
|
|
119
|
+
id: r.id,
|
|
120
|
+
path: r.path ?? null
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
async initiate(t) {
|
|
124
|
+
let n = await e.mutate({
|
|
125
|
+
mutation: a,
|
|
126
|
+
variables: { input: {
|
|
127
|
+
fileName: t.fileName,
|
|
128
|
+
fileSize: String(t.fileSize),
|
|
129
|
+
mimeType: t.mimeType,
|
|
130
|
+
extension: t.extension,
|
|
131
|
+
...t.folderId ? { folderId: t.folderId } : {}
|
|
132
|
+
} }
|
|
133
|
+
});
|
|
134
|
+
g("initiate", n, "initiateUpload did not return a session");
|
|
135
|
+
let r = n.data?.initiateUpload;
|
|
136
|
+
if (!r?.session?.id) throw new m("initiate", "initiateUpload did not return a session", void 0);
|
|
137
|
+
return {
|
|
138
|
+
sessionId: r.session.id,
|
|
139
|
+
uploadUrl: r.uploadUrl ?? null,
|
|
140
|
+
uploadType: r.session.uploadType ?? null
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
put(e) {
|
|
144
|
+
return y(e, t.xhr ?? (() => new XMLHttpRequest()));
|
|
145
|
+
},
|
|
146
|
+
async complete(t) {
|
|
147
|
+
let r = await e.mutate({
|
|
148
|
+
mutation: o,
|
|
149
|
+
variables: { input: {
|
|
150
|
+
sessionId: t.sessionId,
|
|
151
|
+
fileSize: String(t.fileSize),
|
|
152
|
+
...t.folderId ? { folderId: t.folderId } : {}
|
|
153
|
+
} },
|
|
154
|
+
refetchQueries: n
|
|
155
|
+
});
|
|
156
|
+
g("complete", r, "completeUpload did not return a file");
|
|
157
|
+
let i = r.data?.completeUpload, a = i?.file?.id ?? i?.fileId ?? i?.session?.fileId ?? null;
|
|
158
|
+
if (!a) throw new m("complete", "completeUpload did not return a file", void 0);
|
|
159
|
+
return {
|
|
160
|
+
fileId: a,
|
|
161
|
+
name: i?.file?.name ?? null,
|
|
162
|
+
folderId: i?.file?.folderId ?? null,
|
|
163
|
+
downloadUrl: i?.file?.downloadUrl ?? null
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
async getSession(t) {
|
|
167
|
+
let n = await e.query({
|
|
168
|
+
query: s,
|
|
169
|
+
variables: { id: t },
|
|
170
|
+
fetchPolicy: "no-cache"
|
|
171
|
+
});
|
|
172
|
+
g("getSession", n, "getUploadSession failed");
|
|
173
|
+
let r = n.data?.getUploadSession;
|
|
174
|
+
return r ? {
|
|
175
|
+
id: r.id,
|
|
176
|
+
status: r.status,
|
|
177
|
+
fileId: r.fileId ?? null
|
|
178
|
+
} : null;
|
|
179
|
+
},
|
|
180
|
+
async listSessions() {
|
|
181
|
+
let t = await e.query({
|
|
182
|
+
query: c,
|
|
183
|
+
fetchPolicy: "no-cache"
|
|
184
|
+
});
|
|
185
|
+
return g("listSessions", t, "getMyUploadSessions failed"), (t.data?.getMyUploadSessions?.sessions ?? []).map((e) => ({
|
|
186
|
+
id: e.id,
|
|
187
|
+
status: e.status,
|
|
188
|
+
fileId: e.fileId ?? null
|
|
189
|
+
}));
|
|
190
|
+
},
|
|
191
|
+
async abort(t) {
|
|
192
|
+
let n = await e.mutate({
|
|
193
|
+
mutation: l,
|
|
194
|
+
variables: { id: t }
|
|
195
|
+
});
|
|
196
|
+
return g("abort", n, "abortUpload failed"), n.data?.abortUpload === !0;
|
|
197
|
+
},
|
|
198
|
+
async getDownloadUrl(t) {
|
|
199
|
+
let n = await e.query({
|
|
200
|
+
query: d,
|
|
201
|
+
variables: { id: t },
|
|
202
|
+
fetchPolicy: "no-cache"
|
|
203
|
+
});
|
|
204
|
+
return g("getDownloadUrl", n, "getFileDownloadUrl failed"), n.data?.getFileDownloadUrl ?? null;
|
|
205
|
+
},
|
|
206
|
+
async deleteFile(t) {
|
|
207
|
+
let r = await e.mutate({
|
|
208
|
+
mutation: u,
|
|
209
|
+
variables: { id: t },
|
|
210
|
+
refetchQueries: n
|
|
211
|
+
});
|
|
212
|
+
return g("deleteFile", r, "permanentlyDeleteFile failed"), r.data?.permanentlyDeleteFile === !0;
|
|
213
|
+
}
|
|
214
|
+
}, h = t.getWorkspaceId;
|
|
215
|
+
return h && (r.getStorageQuota = async () => {
|
|
216
|
+
let t = h();
|
|
217
|
+
if (!t) return { state: "unknown" };
|
|
218
|
+
let n = await e.query({
|
|
219
|
+
query: f,
|
|
220
|
+
variables: { workspaceId: t },
|
|
221
|
+
fetchPolicy: "no-cache"
|
|
222
|
+
});
|
|
223
|
+
g("getStorageQuota", n, "workspaceQuotaStatuses failed");
|
|
224
|
+
let r = n.data?.workspaceQuotaStatuses;
|
|
225
|
+
if (!r) return { state: "unknown" };
|
|
226
|
+
let i = r.find((e) => e.quotaName === p);
|
|
227
|
+
if (!i) return { state: "not-provisioned" };
|
|
228
|
+
if (i.noLimit) return {
|
|
229
|
+
state: "ok",
|
|
230
|
+
remainingBytes: null
|
|
231
|
+
};
|
|
232
|
+
let a = _(i.limit), o = _(i.currentValue);
|
|
233
|
+
return a === null || o === null ? {
|
|
234
|
+
state: "ok",
|
|
235
|
+
remainingBytes: null
|
|
236
|
+
} : {
|
|
237
|
+
state: "ok",
|
|
238
|
+
remainingBytes: Math.max(0, a - o)
|
|
239
|
+
};
|
|
240
|
+
}), r;
|
|
241
|
+
}
|
|
242
|
+
function y(e, t) {
|
|
243
|
+
let { url: n, blob: r, mimeType: i, onProgress: a, signal: o } = e;
|
|
244
|
+
return new Promise((e, s) => {
|
|
245
|
+
if (o?.aborted) {
|
|
246
|
+
s(new h());
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
let c = t(), l = () => c.abort(), u = () => o?.removeEventListener("abort", l);
|
|
250
|
+
o?.addEventListener("abort", l, { once: !0 }), c.upload.addEventListener("progress", (e) => {
|
|
251
|
+
e.lengthComputable && e.total > 0 && a?.(e.loaded / e.total);
|
|
252
|
+
}), c.addEventListener("load", () => {
|
|
253
|
+
u(), c.status >= 200 && c.status < 300 ? (a?.(1), e()) : s(new m("put", `Upload PUT failed with status ${c.status}`, { statusCode: c.status }, c.status));
|
|
254
|
+
}), c.addEventListener("error", () => {
|
|
255
|
+
u(), s(new m("put", "Upload PUT network error", { networkError: /* @__PURE__ */ Error("PUT") }));
|
|
256
|
+
}), c.addEventListener("abort", () => {
|
|
257
|
+
u(), s(new h());
|
|
258
|
+
}), c.open("PUT", n), c.setRequestHeader("Content-Type", i), c.send(r);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { p as FILES_STORAGE_QUOTA_NAME, h as FilesPortAbortError, m as FilesPortError, v as createApolloFilesPort };
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ export type { UploadBlobParams, UploadedFile, SaveToFilesStep, SaveToFilesRetryN
|
|
|
10
10
|
export { classifyFilesError, decideFilesRetry, runWithFilesRetry, COLD_START_MAX_ATTEMPTS, COLD_START_RETRY_DELAYS_MS, COLD_START_RETRY_BUDGET_MS, } from './retryPolicy';
|
|
11
11
|
export type { FilesRetryKind, FilesRetryDecision, FilesRetryNotice, FilesRetryContext, } from './retryPolicy';
|
|
12
12
|
export { warmFilesService, useFilesServiceWarmup, FILES_WARMUP_COOLDOWN_MS, } from './warmFilesService';
|
|
13
|
+
export { createApolloFilesPort, FilesPortError, FilesPortAbortError, FILES_STORAGE_QUOTA_NAME, } from './filesPort';
|
|
14
|
+
export type { FilesPort, FilesPortClient, FilesPortOperation, ApolloFilesPortOptions, FilesFolder, InitiateUploadParams, InitiatedUpload, CompleteUploadParams, CompletedUpload, UploadSessionInfo, PutParams, StorageQuotaState, } from './filesPort';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,iBAAiB,GAClB,MAAM,aAAa,CAAC"}
|
package/dist/storage/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { COLD_START_MAX_ATTEMPTS as e, COLD_START_RETRY_BUDGET_MS as t, COLD_START_RETRY_DELAYS_MS as n, classifyFilesError as r, decideFilesRetry as i, runWithFilesRetry as a } from "./retryPolicy.js";
|
|
2
|
+
import { FILES_AFTER_SAVE_REFETCH as o, uploadBlobToFiles as s } from "./uploadBlob.js";
|
|
3
|
+
import { FILES_STORAGE_QUOTA_NAME as c, FilesPortAbortError as l, FilesPortError as u, createApolloFilesPort as d } from "./filesPort.js";
|
|
4
|
+
import { StorageFolderPicker as f } from "./StorageFolderPicker.js";
|
|
5
|
+
import { useSaveToFiles as p } from "./useSaveToFiles.js";
|
|
6
|
+
import { SaveToFilesDialog as m } from "./SaveToFilesDialog.js";
|
|
7
|
+
import { SaveToFilesButton as h } from "./SaveToFilesButton.js";
|
|
8
|
+
import { FILES_WARMUP_COOLDOWN_MS as g, useFilesServiceWarmup as _, warmFilesService as v } from "./warmFilesService.js";
|
|
9
|
+
export { e as COLD_START_MAX_ATTEMPTS, t as COLD_START_RETRY_BUDGET_MS, n as COLD_START_RETRY_DELAYS_MS, o as FILES_AFTER_SAVE_REFETCH, c as FILES_STORAGE_QUOTA_NAME, g as FILES_WARMUP_COOLDOWN_MS, l as FilesPortAbortError, u as FilesPortError, h as SaveToFilesButton, m as SaveToFilesDialog, f as StorageFolderPicker, r as classifyFilesError, d as createApolloFilesPort, i as decideFilesRetry, a as runWithFilesRetry, s as uploadBlobToFiles, _ as useFilesServiceWarmup, p as useSaveToFiles, v as warmFilesService };
|