@burdenoff/fe-libs 2026.616.2 → 2026.617.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;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoEvF"}
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;AAoBD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiFvF"}
@@ -25,41 +25,53 @@ var t = e`
25
25
  "GetFilesRecentPage",
26
26
  "GetFiles"
27
27
  ];
28
- async function i(e) {
29
- let { client: i, blob: a, filename: o, mimeType: s, folderId: c, onProgress: l } = e, u = o.includes(".") ? o.substring(o.lastIndexOf(".") + 1) : "";
30
- l?.(0);
31
- let d = await i.mutate({
28
+ function i(e) {
29
+ if (!e || typeof e != "object") return !1;
30
+ let t = e;
31
+ return t.networkError ? !0 : (t.graphQLErrors ?? []).some((e) => e?.extensions?.code === "INTERNAL_SERVER_ERROR");
32
+ }
33
+ async function a(e) {
34
+ let { client: a, blob: o, filename: s, mimeType: c, folderId: l, onProgress: u } = e, d = s.includes(".") ? s.substring(s.lastIndexOf(".") + 1) : "";
35
+ u?.(0);
36
+ let f = await a.mutate({
32
37
  mutation: t,
33
38
  variables: { input: {
34
- fileName: o,
35
- fileSize: String(a.size),
36
- mimeType: s,
37
- extension: u,
38
- folderId: c
39
+ fileName: s,
40
+ fileSize: String(o.size),
41
+ mimeType: c,
42
+ extension: d,
43
+ folderId: l
39
44
  } }
40
- }), f = d.data?.initiateUpload?.session, p = d.data?.initiateUpload?.uploadUrl;
41
- if (!f || !p) throw Error("initiateUpload did not return a presigned URL");
42
- l?.(10), await new Promise((e, t) => {
45
+ }), p = f.data?.initiateUpload?.session, m = f.data?.initiateUpload?.uploadUrl;
46
+ if (!p || !m) throw Error("initiateUpload did not return a presigned URL");
47
+ u?.(10), await new Promise((e, t) => {
43
48
  let n = new XMLHttpRequest();
44
49
  n.upload.addEventListener("progress", (e) => {
45
50
  if (e.lengthComputable) {
46
51
  let t = 10 + Math.round(e.loaded / e.total * 80);
47
- l?.(t);
52
+ u?.(t);
48
53
  }
49
54
  }), n.addEventListener("load", () => {
50
- n.status >= 200 && n.status < 300 ? (l?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
51
- }), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", p), n.setRequestHeader("Content-Type", s), n.send(a);
55
+ n.status >= 200 && n.status < 300 ? (u?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
56
+ }), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", m), n.setRequestHeader("Content-Type", c), n.send(o);
52
57
  });
53
- let m = (await i.mutate({
54
- mutation: n,
55
- variables: { input: {
56
- sessionId: f.id,
57
- folderId: c
58
- } },
59
- refetchQueries: r
60
- })).data?.completeUpload?.file;
61
- if (!m) throw Error("completeUpload did not return a file");
62
- return l?.(100), m;
58
+ let h;
59
+ for (let e = 0;; e++) try {
60
+ h = (await a.mutate({
61
+ mutation: n,
62
+ variables: { input: {
63
+ sessionId: p.id,
64
+ folderId: l
65
+ } },
66
+ refetchQueries: r
67
+ })).data?.completeUpload?.file;
68
+ break;
69
+ } catch (t) {
70
+ if (e >= 2 || !i(t)) throw t;
71
+ await new Promise((t) => setTimeout(t, 400 * (e + 1)));
72
+ }
73
+ if (!h) throw Error("completeUpload did not return a file");
74
+ return u?.(100), h;
63
75
  }
64
76
  //#endregion
65
- export { r as FILES_AFTER_SAVE_REFETCH, i as uploadBlobToFiles };
77
+ export { r as FILES_AFTER_SAVE_REFETCH, a as uploadBlobToFiles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.616.2",
3
+ "version": "2026.617.1",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "imports": {