@burdenoff/fe-libs 2026.1112.3 → 2026.1112.5
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 +7 -0
- package/dist/shared/assistant/api.js +47 -45
- package/dist/shared/assistant/createSandboxAssistantTransport.js +2 -1
- package/dist/shared/assistant/gatewayClient.js +1 -0
- package/dist/shared/assistant/index.d.ts +4 -0
- package/dist/shared/assistant/keepAlive.d.ts +74 -0
- package/dist/shared/assistant/keepAlive.js +77 -0
- package/dist/shared/assistant/prewarm.d.ts +20 -0
- package/dist/shared/assistant/prewarm.js +25 -4
- package/dist/shared/assistant/runtime.d.ts +7 -2
- package/dist/shared/assistant/runtime.js +23 -22
- package/dist/shared/assistant/signInWarm.d.ts +60 -0
- package/dist/shared/assistant/signInWarm.js +111 -0
- package/dist/shared/assistant/snapshotPoller.d.ts +16 -0
- package/dist/shared/assistant/snapshotPoller.js +29 -22
- package/dist/shared/assistant/staleSession.d.ts +27 -0
- package/dist/shared/assistant/staleSession.js +15 -0
- package/dist/shared/assistant/turnProgress.d.ts +16 -0
- package/dist/shared/assistant/turnProgress.js +30 -4
- package/dist/shared/assistant/ui/AssistantChatArea.js +1286 -1271
- package/dist/shared/assistant/ui/AssistantOverlay.d.ts +7 -0
- package/dist/shared/assistant/ui/AssistantOverlay.js +256 -248
- package/dist/shared/assistant/usageReporting.d.ts +18 -0
- package/dist/shared/assistant/usageReporting.js +17 -5
- package/dist/shared/assistant/useAssistantHeartbeat.d.ts +24 -4
- package/dist/shared/assistant/useAssistantHeartbeat.js +43 -24
- package/dist/shared/assistant/useAssistantSignInWarm.d.ts +19 -0
- package/dist/shared/assistant/useAssistantSignInWarm.js +55 -0
- package/dist/shared/assistant/writeProposals.d.ts +9 -0
- package/dist/shared/components/assistantWidget/AssistantWidget.d.ts +7 -0
- package/dist/shared/components/assistantWidget/AssistantWidget.js +289 -285
- package/dist/shared/providers/shell/AuthTokenProvider.d.ts +6 -0
- package/dist/shared/providers/shell/AuthTokenProvider.js +4 -1
- package/dist/shared/providers/shell/index.d.ts +1 -1
- package/dist/shared-assistant.js +374 -370
- package/dist/shared-providers-shell.js +12 -12
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +6 -5
- package/dist/storage/uploadBlob.d.ts +3 -0
- package/dist/storage/uploadBlob.js +39 -37
- package/dist/storage/uploadVisibility.d.ts +3 -0
- package/dist/storage/uploadVisibility.js +6 -0
- package/dist/storage/useSaveToFiles.d.ts +3 -0
- package/dist/storage/useSaveToFiles.js +57 -53
- package/package.json +1 -1
|
@@ -16,15 +16,15 @@ import { FeatureGate as U } from "./shared/feature-flags/FeatureGate.js";
|
|
|
16
16
|
import { GeographyProvider as W, useGeography as G } from "./shared/geography/GeographyProvider.js";
|
|
17
17
|
import { PermissionProvider as K, SUPER_ADMIN_ACTOR_TYPE as q, SUPER_ADMIN_ROLE as J, hasMatchingPermission as Y, isSuperAdminBypass as X, matchPermission as Z, usePermission as Q, usePermissionLoading as $, usePermissions as ee, useRole as te, useSafePermissions as ne } from "./shared/providers/shell/PermissionProvider.js";
|
|
18
18
|
import { EVERYTHING_SURFACE_ID as re, PersonaSurfaceProvider as ie, resolveSurfaceForRoles as ae, synthesizeSimulatedPermissionStrings as oe, usePersonaSurface as se, useSafePersonaSurface as ce } from "./shared/providers/shell/PersonaSurfaceProvider.js";
|
|
19
|
-
import { AuthTokenProvider as le, useAuthToken as ue } from "./shared/providers/shell/AuthTokenProvider.js";
|
|
20
|
-
import { MultiGatewayProvider as
|
|
21
|
-
import { ObservabilityProvider as
|
|
22
|
-
import { RYBBIT_TRACK_ENDPOINT as
|
|
23
|
-
import { maskRoute as
|
|
24
|
-
import { GatewayRoute as
|
|
25
|
-
import { ProfileI18nBridge as
|
|
26
|
-
import { ProfileGeographyBridge as
|
|
27
|
-
import { AppShellContextProvider as
|
|
28
|
-
import { PageConversationContextProvider as
|
|
29
|
-
import { clearWorkspaceWideSelection as
|
|
30
|
-
export { O as ActiveContextProvider,
|
|
19
|
+
import { AuthTokenProvider as le, useAuthToken as ue, useAuthTokenOrNull as de } from "./shared/providers/shell/AuthTokenProvider.js";
|
|
20
|
+
import { MultiGatewayProvider as fe } from "./shared/providers/shell/MultiGatewayProvider.js";
|
|
21
|
+
import { ObservabilityProvider as pe } from "./shared/providers/shell/ObservabilityProvider.js";
|
|
22
|
+
import { RYBBIT_TRACK_ENDPOINT as me, buildCrashReport as he, crashReportingConsentGranted as ge, createCrashReportingPipeline as _e, createRybbitCrashReporter as ve, detectCrashReportPlatform as ye, reportError as be, setActiveCrashReportingPipeline as xe } from "./shared/providers/shell/crashReporting.js";
|
|
23
|
+
import { maskRoute as Se, scrubTelemetryText as Ce } from "./shared/events/sinks/telemetryScrub.js";
|
|
24
|
+
import { GatewayRoute as we, getMicrofrontendGateway as Te, withGateway as Ee } from "./shared/providers/shell/GatewayRouter.js";
|
|
25
|
+
import { ProfileI18nBridge as De } from "./shared/providers/shell/ProfileI18nBridge.js";
|
|
26
|
+
import { ProfileGeographyBridge as Oe } from "./shared/providers/shell/ProfileGeographyBridge.js";
|
|
27
|
+
import { AppShellContextProvider as ke, useAppShell as Ae } from "./shared/providers/shell/AppShellContext.js";
|
|
28
|
+
import { PageConversationContextProvider as je, usePageConversationContext as Me, useRegisterPageConversationContext as Ne } from "./shared/providers/shell/PageConversationContextProvider.js";
|
|
29
|
+
import { clearWorkspaceWideSelection as Pe, isWorkspaceWideSelection as Fe, selectWorkspaceWide as Ie } from "./shared/providers/shell/WorkspaceWideSelection.js";
|
|
30
|
+
export { O as ActiveContextProvider, ke as AppShellContextProvider, p as AuthBridgeClient, d as AuthProvider, le as AuthTokenProvider, L as ContextManagerProvider, re as EVERYTHING_SURFACE_ID, z as FeatureFlagProvider, j as FeatureFlagsProvider, U as FeatureGate, we as GatewayRoute, W as GeographyProvider, N as GlobalUiProvider, n as I18nProvider, r as LOCALE_DIRECTION, fe as MultiGatewayProvider, pe as ObservabilityProvider, je as PageConversationContextProvider, K as PermissionProvider, ie as PersonaSurfaceProvider, Oe as ProfileGeographyBridge, De as ProfileI18nBridge, v as ProfileStorage, me as RYBBIT_TRACK_ENDPOINT, q as SUPER_ADMIN_ACTOR_TYPE, J as SUPER_ADMIN_ROLE, F as ShellUiProvider, e as ThemeProvider, he as buildCrashReport, y as clearActiveProfileId, i as clearTranslationCache, Pe as clearWorkspaceWideSelection, ge as crashReportingConsentGranted, _e as createCrashReportingPipeline, ve as createRybbitCrashReporter, m as destroyAuthBridge, ye as detectCrashReportPlatform, b as getActiveContext, x as getActiveTokens, S as getActiveUser, h as getAuthBridge, Te as getMicrofrontendGateway, C as getProfileLocale, Y as hasMatchingPermission, g as initAuthBridge, _ as isAuthBridgeInitialized, X as isSuperAdminBypass, a as isTranslationAttempted, Fe as isWorkspaceWideSelection, o as localeDirection, w as logoutActiveProfile, Se as maskRoute, Z as matchPermission, T as removeAllProfiles, be as reportError, ae as resolveSurfaceForRoles, Ce as scrubTelemetryText, Ie as selectWorkspaceWide, xe as setActiveCrashReportingPipeline, E as setProfileLocale, D as setProfiles, oe as synthesizeSimulatedPermissionStrings, k as useActiveContext, A as useActiveContextOrNull, Ae as useAppShell, f as useAuth, ue as useAuthToken, de as useAuthTokenOrNull, R as useContextManager, B as useFeatureFlag, V as useFeatureFlagDetails, H as useFeatureFlagValue, M as useFeatureFlags, G as useGeography, P as useGlobalUi, s as useI18n, c as useOptionalI18n, Me as usePageConversationContext, Q as usePermission, $ as usePermissionLoading, ee as usePermissions, se as usePersonaSurface, Ne as useRegisterPageConversationContext, te as useRole, ne as useSafePermissions, ce as useSafePersonaSurface, l as useShellLabel, u as useShellNumberFormat, I as useShellUi, t as useTheme, Ee as withGateway };
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { SaveToFilesDialog } from './SaveToFilesDialog';
|
|
|
6
6
|
export { useSaveToFiles } from './useSaveToFiles';
|
|
7
7
|
export type { SavedFile, UseSaveToFilesResult } from './useSaveToFiles';
|
|
8
8
|
export { uploadBlobToFiles, FILES_AFTER_SAVE_REFETCH } from './uploadBlob';
|
|
9
|
+
export { fileUploadVisibility } from './uploadVisibility';
|
|
10
|
+
export type { FileUploadVisibility } from './uploadVisibility';
|
|
9
11
|
export type { UploadBlobParams, UploadedFile, SaveToFilesStep, SaveToFilesRetryNotice, } from './uploadBlob';
|
|
10
12
|
export { classifyFilesError, decideFilesRetry, runWithFilesRetry, COLD_START_MAX_ATTEMPTS, COLD_START_RETRY_DELAYS_MS, COLD_START_RETRY_BUDGET_MS, } from './retryPolicy';
|
|
11
13
|
export type { FilesRetryKind, FilesRetryDecision, FilesRetryNotice, FilesRetryContext, } from './retryPolicy';
|
package/dist/storage/index.js
CHANGED
|
@@ -3,8 +3,9 @@ import { SaveToFilesButton as t } from "./SaveToFilesButton.js";
|
|
|
3
3
|
import { SaveToFilesDialog as n } from "./SaveToFilesDialog.js";
|
|
4
4
|
import { useSaveToFiles as r } from "./useSaveToFiles.js";
|
|
5
5
|
import { FILES_AFTER_SAVE_REFETCH as i, uploadBlobToFiles as a } from "./uploadBlob.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
6
|
+
import { fileUploadVisibility as o } from "./uploadVisibility.js";
|
|
7
|
+
import { COLD_START_MAX_ATTEMPTS as s, COLD_START_RETRY_BUDGET_MS as c, COLD_START_RETRY_DELAYS_MS as l, classifyFilesError as u, decideFilesRetry as d, runWithFilesRetry as f } from "./retryPolicy.js";
|
|
8
|
+
import { FILES_WARMUP_COOLDOWN_MS as p, useFilesServiceWarmup as m, warmFilesService as h } from "./warmFilesService.js";
|
|
9
|
+
import { FILES_STORAGE_QUOTA_NAME as g, FilesPortAbortError as _, FilesPortError as v, createApolloFilesPort as y } from "./filesPort.js";
|
|
10
|
+
import { createPinnedFilesPort as b } from "./pinnedFilesPort.js";
|
|
11
|
+
export { s as COLD_START_MAX_ATTEMPTS, c as COLD_START_RETRY_BUDGET_MS, l as COLD_START_RETRY_DELAYS_MS, i as FILES_AFTER_SAVE_REFETCH, g as FILES_STORAGE_QUOTA_NAME, p as FILES_WARMUP_COOLDOWN_MS, _ as FilesPortAbortError, v as FilesPortError, t as SaveToFilesButton, n as SaveToFilesDialog, e as StorageFolderPicker, u as classifyFilesError, y as createApolloFilesPort, b as createPinnedFilesPort, d as decideFilesRetry, o as fileUploadVisibility, f as runWithFilesRetry, a as uploadBlobToFiles, m as useFilesServiceWarmup, r as useSaveToFiles, h as warmFilesService };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloClient } from '@apollo/client';
|
|
2
2
|
import { extractErrorMessage, FilesRetryNotice } from './retryPolicy';
|
|
3
|
+
import { FileUploadVisibility } from './uploadVisibility';
|
|
3
4
|
export { extractErrorMessage };
|
|
4
5
|
/**
|
|
5
6
|
* Apollo invalidations every "Save to Files" caller benefits from — pulled
|
|
@@ -18,6 +19,8 @@ export interface UploadBlobParams {
|
|
|
18
19
|
filename: string;
|
|
19
20
|
mimeType: string;
|
|
20
21
|
folderId: string;
|
|
22
|
+
/** Omitted means PRIVATE. WORKSPACE is an intentional audience, never PUBLIC. */
|
|
23
|
+
visibility?: FileUploadVisibility;
|
|
21
24
|
onProgress?: (pct: number) => void;
|
|
22
25
|
/**
|
|
23
26
|
* Fired before each retry wait. The upload is still running — this exists so the UI
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { extractErrorMessage as e, runWithFilesRetry as t } from "./retryPolicy.js";
|
|
2
|
-
import {
|
|
2
|
+
import { fileUploadVisibility as n } from "./uploadVisibility.js";
|
|
3
|
+
import { gql as r } from "@apollo/client";
|
|
3
4
|
// src/storage/uploadBlob.ts
|
|
4
|
-
var
|
|
5
|
+
var i = r`
|
|
5
6
|
mutation SaveToFiles_InitiateUpload($input: InitiateUploadInput!) {
|
|
6
7
|
initiateUpload(input: $input) {
|
|
7
8
|
session {
|
|
@@ -10,7 +11,7 @@ var r = n`
|
|
|
10
11
|
uploadUrl
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
`,
|
|
14
|
+
`, a = r`
|
|
14
15
|
mutation SaveToFiles_CompleteUpload($input: CompleteUploadInput!) {
|
|
15
16
|
completeUpload(input: $input) {
|
|
16
17
|
file {
|
|
@@ -20,27 +21,28 @@ var r = n`
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
`,
|
|
24
|
+
`, o = [
|
|
24
25
|
"GetFilesRootBrowsePage",
|
|
25
26
|
"GetFilesFolderBrowsePage",
|
|
26
27
|
"GetFilesRecentPage",
|
|
27
28
|
"GetFiles"
|
|
28
29
|
];
|
|
29
|
-
async function
|
|
30
|
-
let { client:
|
|
31
|
-
...
|
|
32
|
-
...
|
|
30
|
+
async function s(r) {
|
|
31
|
+
let { client: s, blob: c, filename: l, mimeType: u, folderId: d, onProgress: f, onRetry: p } = r, m = n(r.visibility), h = l.includes(".") ? l.substring(l.lastIndexOf(".") + 1) : "", g = {
|
|
32
|
+
...r.now ? { now: r.now } : {},
|
|
33
|
+
...r.sleep ? { sleep: r.sleep } : {}
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
let e = await
|
|
37
|
-
mutation:
|
|
35
|
+
f?.(0);
|
|
36
|
+
let _ = await t(async () => {
|
|
37
|
+
let e = await s.mutate({
|
|
38
|
+
mutation: i,
|
|
38
39
|
variables: { input: {
|
|
39
|
-
fileName:
|
|
40
|
-
fileSize: String(
|
|
41
|
-
mimeType:
|
|
42
|
-
extension:
|
|
43
|
-
folderId:
|
|
40
|
+
fileName: l,
|
|
41
|
+
fileSize: String(c.size),
|
|
42
|
+
mimeType: u,
|
|
43
|
+
extension: h,
|
|
44
|
+
folderId: d,
|
|
45
|
+
visibility: m
|
|
44
46
|
} }
|
|
45
47
|
}), t = e.data?.initiateUpload?.session, n = e.data?.initiateUpload?.uploadUrl;
|
|
46
48
|
return t && n ? {
|
|
@@ -54,34 +56,34 @@ async function o(n) {
|
|
|
54
56
|
error: e.error
|
|
55
57
|
};
|
|
56
58
|
}, {
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
+
...g,
|
|
60
|
+
...p ? { onRetry: (e) => p({
|
|
59
61
|
...e,
|
|
60
62
|
step: "initiate"
|
|
61
63
|
}) } : {}
|
|
62
64
|
});
|
|
63
|
-
if (!
|
|
64
|
-
let { session:
|
|
65
|
-
|
|
65
|
+
if (!_.value) throw Error(e(_.error) ?? "initiateUpload did not return a presigned URL");
|
|
66
|
+
let { session: v, uploadUrl: y } = _.value;
|
|
67
|
+
f?.(10), await new Promise((e, t) => {
|
|
66
68
|
let n = new XMLHttpRequest();
|
|
67
69
|
n.upload.addEventListener("progress", (e) => {
|
|
68
70
|
if (e.lengthComputable) {
|
|
69
71
|
let t = 10 + Math.round(e.loaded / e.total * 80);
|
|
70
|
-
|
|
72
|
+
f?.(t);
|
|
71
73
|
}
|
|
72
74
|
}), n.addEventListener("load", () => {
|
|
73
|
-
n.status >= 200 && n.status < 300 ? (
|
|
74
|
-
}), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT",
|
|
75
|
+
n.status >= 200 && n.status < 300 ? (f?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
|
|
76
|
+
}), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", y), n.setRequestHeader("Content-Type", u), n.send(c);
|
|
75
77
|
});
|
|
76
|
-
let
|
|
77
|
-
let e = await
|
|
78
|
-
mutation:
|
|
78
|
+
let b = await t(async () => {
|
|
79
|
+
let e = await s.mutate({
|
|
80
|
+
mutation: a,
|
|
79
81
|
variables: { input: {
|
|
80
|
-
sessionId:
|
|
81
|
-
fileSize: String(
|
|
82
|
-
folderId:
|
|
82
|
+
sessionId: v.id,
|
|
83
|
+
fileSize: String(c.size),
|
|
84
|
+
folderId: d
|
|
83
85
|
} },
|
|
84
|
-
refetchQueries:
|
|
86
|
+
refetchQueries: o
|
|
85
87
|
}), t = e.data?.completeUpload?.file;
|
|
86
88
|
return t ? {
|
|
87
89
|
ok: !0,
|
|
@@ -92,13 +94,13 @@ async function o(n) {
|
|
|
92
94
|
};
|
|
93
95
|
}, {
|
|
94
96
|
allow: ["cold-start", "transient-blip"],
|
|
95
|
-
...
|
|
96
|
-
...
|
|
97
|
+
...g,
|
|
98
|
+
...p ? { onRetry: (e) => p({
|
|
97
99
|
...e,
|
|
98
100
|
step: "complete"
|
|
99
101
|
}) } : {}
|
|
100
102
|
});
|
|
101
|
-
if (!
|
|
102
|
-
return
|
|
103
|
+
if (!b.value) throw Error(e(b.error) ?? "completeUpload did not return a file");
|
|
104
|
+
return f?.(100), b.value;
|
|
103
105
|
}
|
|
104
|
-
export {
|
|
106
|
+
export { o as FILES_AFTER_SAVE_REFETCH, e as extractErrorMessage, s as uploadBlobToFiles };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloClient } from '@apollo/client';
|
|
2
2
|
import { SaveToFilesSource } from './SaveToFilesButton';
|
|
3
|
+
import { FileUploadVisibility } from './uploadVisibility';
|
|
3
4
|
import { SaveToFilesRetryNotice } from './uploadBlob';
|
|
4
5
|
export interface SavedFile {
|
|
5
6
|
id: string;
|
|
@@ -10,6 +11,8 @@ export interface UseSaveToFilesResult {
|
|
|
10
11
|
save: (params: {
|
|
11
12
|
source: SaveToFilesSource;
|
|
12
13
|
folderPath: string;
|
|
14
|
+
/** Applies to blob uploads; sandbox copies currently support PRIVATE only. */
|
|
15
|
+
visibility?: FileUploadVisibility;
|
|
13
16
|
/**
|
|
14
17
|
* Fired before each retry wait. Purely informational — the save is still in
|
|
15
18
|
* flight. Exists so a caller rendering its own chip can say why a cold start is
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { fileUploadVisibility as e } from "./uploadVisibility.js";
|
|
2
|
+
import { extractErrorMessage as t, runWithFilesRetry as n } from "./retryPolicy.js";
|
|
3
|
+
import { FILES_AFTER_SAVE_REFETCH as r, uploadBlobToFiles as i } from "./uploadBlob.js";
|
|
4
|
+
import { useState as a } from "react";
|
|
5
|
+
import { gql as o } from "@apollo/client";
|
|
6
|
+
import { useApolloClient as s } from "@apollo/client/react";
|
|
6
7
|
// src/storage/useSaveToFiles.ts
|
|
7
|
-
var
|
|
8
|
+
var c = o`
|
|
8
9
|
mutation SaveToFiles_EnsureFolderByPath($path: String!) {
|
|
9
10
|
ensureFolderByPath(path: $path) {
|
|
10
11
|
id
|
|
@@ -12,7 +13,7 @@ var s = a`
|
|
|
12
13
|
path
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
`,
|
|
16
|
+
`, l = o`
|
|
16
17
|
mutation SaveToFiles_SaveSandboxArtifact($input: SaveSandboxArtifactInput!) {
|
|
17
18
|
saveSandboxArtifactToFiles(input: $input) {
|
|
18
19
|
id
|
|
@@ -21,18 +22,18 @@ var s = a`
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
`;
|
|
24
|
-
async function
|
|
25
|
-
let a = await
|
|
26
|
-
let
|
|
27
|
-
mutation:
|
|
25
|
+
async function u(e, r, i = {}) {
|
|
26
|
+
let a = await n(async () => {
|
|
27
|
+
let t = await e.mutate({
|
|
28
|
+
mutation: c,
|
|
28
29
|
variables: { path: r }
|
|
29
|
-
}),
|
|
30
|
-
return
|
|
30
|
+
}), n = t.data?.ensureFolderByPath?.id;
|
|
31
|
+
return n ? {
|
|
31
32
|
ok: !0,
|
|
32
|
-
value:
|
|
33
|
+
value: n
|
|
33
34
|
} : {
|
|
34
35
|
ok: !1,
|
|
35
|
-
error:
|
|
36
|
+
error: t.error
|
|
36
37
|
};
|
|
37
38
|
}, {
|
|
38
39
|
...i.onRetry ? { onRetry: (e) => i.onRetry?.({
|
|
@@ -43,56 +44,59 @@ async function l(n, r, i = {}) {
|
|
|
43
44
|
...i.sleep ? { sleep: i.sleep } : {}
|
|
44
45
|
});
|
|
45
46
|
if (a.value !== void 0) return a.value;
|
|
46
|
-
throw Error(
|
|
47
|
+
throw Error(t(a.error) ?? `Could not resolve folder for path: ${r}`);
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
let
|
|
49
|
+
function d() {
|
|
50
|
+
let n = s(), [o, c] = a(!1), [d, f] = a(null), [p, m] = a(0), [h, g] = a(null);
|
|
50
51
|
return {
|
|
51
|
-
save: async (
|
|
52
|
-
|
|
53
|
-
let
|
|
54
|
-
|
|
52
|
+
save: async (a) => {
|
|
53
|
+
c(!0), f(null), m(0), g(null);
|
|
54
|
+
let o = (e) => {
|
|
55
|
+
g(e), a.onRetry?.(e);
|
|
55
56
|
};
|
|
56
57
|
try {
|
|
57
|
-
let
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
let s = e(a.visibility);
|
|
59
|
+
if (a.source.kind !== "blob" && s !== "PRIVATE") throw Error("Sandbox artifact saves do not support WORKSPACE visibility");
|
|
60
|
+
let c = await u(n, a.folderPath, { onRetry: o });
|
|
61
|
+
if (g(null), a.source.kind === "sandbox-artifact") {
|
|
62
|
+
let e = await n.mutate({
|
|
63
|
+
mutation: l,
|
|
61
64
|
variables: { input: {
|
|
62
|
-
sandboxId:
|
|
63
|
-
sessionId:
|
|
64
|
-
path:
|
|
65
|
-
folderId:
|
|
66
|
-
filename:
|
|
65
|
+
sandboxId: a.source.sandboxId,
|
|
66
|
+
sessionId: a.source.sessionId,
|
|
67
|
+
path: a.source.path,
|
|
68
|
+
folderId: c,
|
|
69
|
+
filename: a.source.filename ?? null
|
|
67
70
|
} },
|
|
68
|
-
refetchQueries:
|
|
69
|
-
}),
|
|
70
|
-
if (!
|
|
71
|
-
return
|
|
71
|
+
refetchQueries: r
|
|
72
|
+
}), i = e.data?.saveSandboxArtifactToFiles;
|
|
73
|
+
if (!i) throw Error(t(e.error) ?? "saveSandboxArtifactToFiles returned no file");
|
|
74
|
+
return m(100), i;
|
|
72
75
|
}
|
|
73
|
-
let
|
|
74
|
-
if (!
|
|
75
|
-
let
|
|
76
|
-
return await
|
|
77
|
-
client:
|
|
78
|
-
blob:
|
|
79
|
-
filename:
|
|
80
|
-
mimeType:
|
|
81
|
-
folderId:
|
|
82
|
-
onProgress:
|
|
83
|
-
|
|
76
|
+
let d = await a.source.getBlob();
|
|
77
|
+
if (!d) throw Error("Cancelled: no bytes to save");
|
|
78
|
+
let f = d.blob, p = d.filename ?? a.source.filename, h = d.mimeType ?? a.source.mimeType;
|
|
79
|
+
return await i({
|
|
80
|
+
client: n,
|
|
81
|
+
blob: f,
|
|
82
|
+
filename: p,
|
|
83
|
+
mimeType: h,
|
|
84
|
+
folderId: c,
|
|
85
|
+
onProgress: m,
|
|
86
|
+
visibility: s,
|
|
87
|
+
onRetry: o
|
|
84
88
|
});
|
|
85
89
|
} catch (e) {
|
|
86
90
|
let t = e instanceof Error ? e : Error(String(e));
|
|
87
|
-
throw
|
|
91
|
+
throw f(t), t;
|
|
88
92
|
} finally {
|
|
89
|
-
|
|
93
|
+
c(!1), g(null);
|
|
90
94
|
}
|
|
91
95
|
},
|
|
92
|
-
isPending:
|
|
93
|
-
error:
|
|
94
|
-
progress:
|
|
95
|
-
retry:
|
|
96
|
+
isPending: o,
|
|
97
|
+
error: d,
|
|
98
|
+
progress: p,
|
|
99
|
+
retry: h
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
|
-
export {
|
|
102
|
+
export { u as resolveFolderIdByPath, d as useSaveToFiles };
|