@burdenoff/fe-libs 2026.618.1 → 2026.619.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadBlob.d.ts","sourceRoot":"","sources":["../../src/storage/uploadBlob.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyBxD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,UAKpC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"uploadBlob.d.ts","sourceRoot":"","sources":["../../src/storage/uploadBlob.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAyBxD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,UAKpC,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AA6CD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,YAAY,CAAC,CA+HvB"}
|
|
@@ -28,50 +28,74 @@ var t = e`
|
|
|
28
28
|
function i(e) {
|
|
29
29
|
if (!e || typeof e != "object") return !1;
|
|
30
30
|
let t = e;
|
|
31
|
-
return t.networkError ? !0 : (t.graphQLErrors ?? []).some((e) => e?.extensions?.code === "INTERNAL_SERVER_ERROR");
|
|
31
|
+
return t.networkError ? !0 : (t.errors ?? t.graphQLErrors ?? []).some((e) => e?.extensions?.code === "INTERNAL_SERVER_ERROR");
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
function a(e) {
|
|
34
|
+
if (!e || typeof e != "object") return;
|
|
35
|
+
let t = e, n = (t.errors ?? t.graphQLErrors)?.[0]?.message;
|
|
36
|
+
if (typeof n == "string" && n.length > 0) return n;
|
|
37
|
+
if (typeof t.message == "string" && t.message.length > 0) return t.message;
|
|
38
|
+
}
|
|
39
|
+
async function o(e) {
|
|
40
|
+
let { client: o, blob: s, filename: c, mimeType: l, folderId: u, onProgress: d } = e, f = c.includes(".") ? c.substring(c.lastIndexOf(".") + 1) : "";
|
|
41
|
+
d?.(0);
|
|
42
|
+
let p = await o.mutate({
|
|
37
43
|
mutation: t,
|
|
38
44
|
variables: { input: {
|
|
39
|
-
fileName:
|
|
40
|
-
fileSize: String(
|
|
41
|
-
mimeType:
|
|
42
|
-
extension:
|
|
43
|
-
folderId:
|
|
45
|
+
fileName: c,
|
|
46
|
+
fileSize: String(s.size),
|
|
47
|
+
mimeType: l,
|
|
48
|
+
extension: f,
|
|
49
|
+
folderId: u
|
|
44
50
|
} }
|
|
45
|
-
}),
|
|
46
|
-
if (!
|
|
47
|
-
|
|
51
|
+
}), m = p.data?.initiateUpload?.session, h = p.data?.initiateUpload?.uploadUrl;
|
|
52
|
+
if (!m || !h) throw Error(a(p.error) ?? "initiateUpload did not return a presigned URL");
|
|
53
|
+
d?.(10), await new Promise((e, t) => {
|
|
48
54
|
let n = new XMLHttpRequest();
|
|
49
55
|
n.upload.addEventListener("progress", (e) => {
|
|
50
56
|
if (e.lengthComputable) {
|
|
51
57
|
let t = 10 + Math.round(e.loaded / e.total * 80);
|
|
52
|
-
|
|
58
|
+
d?.(t);
|
|
53
59
|
}
|
|
54
60
|
}), n.addEventListener("load", () => {
|
|
55
|
-
n.status >= 200 && n.status < 300 ? (
|
|
56
|
-
}), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT",
|
|
61
|
+
n.status >= 200 && n.status < 300 ? (d?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
|
|
62
|
+
}), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", h), n.setRequestHeader("Content-Type", l), n.send(s);
|
|
57
63
|
});
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
let g = async () => {
|
|
65
|
+
try {
|
|
66
|
+
let e = await o.mutate({
|
|
67
|
+
mutation: n,
|
|
68
|
+
variables: { input: {
|
|
69
|
+
sessionId: m.id,
|
|
70
|
+
folderId: u
|
|
71
|
+
} },
|
|
72
|
+
refetchQueries: r
|
|
73
|
+
}), t = e.data?.completeUpload?.file ?? void 0;
|
|
74
|
+
if (t) return { file: t };
|
|
75
|
+
let s = e.error;
|
|
76
|
+
return {
|
|
77
|
+
retryable: i(s),
|
|
78
|
+
message: a(s)
|
|
79
|
+
};
|
|
80
|
+
} catch (e) {
|
|
81
|
+
if (!i(e)) throw e;
|
|
82
|
+
return {
|
|
83
|
+
retryable: !0,
|
|
84
|
+
message: a(e)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, _, v;
|
|
88
|
+
for (let e = 0; e <= 2; e++) {
|
|
89
|
+
e > 0 && await new Promise((t) => setTimeout(t, 400 * e));
|
|
90
|
+
let t = await g();
|
|
91
|
+
if (t.file) {
|
|
92
|
+
_ = t.file;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (v = t.message ?? v, !t.retryable) break;
|
|
72
96
|
}
|
|
73
|
-
if (!
|
|
74
|
-
return
|
|
97
|
+
if (!_) throw Error(v ?? "completeUpload did not return a file");
|
|
98
|
+
return d?.(100), _;
|
|
75
99
|
}
|
|
76
100
|
//#endregion
|
|
77
|
-
export { r as FILES_AFTER_SAVE_REFETCH,
|
|
101
|
+
export { r as FILES_AFTER_SAVE_REFETCH, o as uploadBlobToFiles };
|