@ai4b-team/fsaos-gateway-sdk 4.2.2 → 4.3.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/README.md +5 -0
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +3 -3
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +31 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +31 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/iife/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-
|
|
1
|
+
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-11-10T14:04:27.053Z */
|
|
2
2
|
"use strict";var __FSAOS_UI__=(()=>{var m=Object.create;var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),N=(e,i)=>{for(var a in i)r(e,a,{get:i[a],enumerable:!0})},s=(e,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!h.call(e,t)&&t!==a&&r(e,t,{get:()=>i[t],enumerable:!(l=g(i,t))||l.enumerable});return e};var x=(e,i,a)=>(a=e!=null?m(f(e)):{},s(i||!e||!e.__esModule?r(a,"default",{value:e,enumerable:!0}):a,e)),b=e=>s(r({},"__esModule",{value:!0}),e);var d=y((V,c)=>{c.exports=React});var P={};N(P,{Badge:()=>z,Breadcrumbs:()=>A,Button:()=>D,Card:()=>w,DataView:()=>R,Detail:()=>_,Empty:()=>I,FilePreview:()=>O,Form:()=>F,Grid:()=>k,Image:()=>G,Link:()=>E,Page:()=>v,Router:()=>T,Sidebar:()=>S,Spinner:()=>B,Stack:()=>C,Table:()=>j,Tabs:()=>W,Video:()=>H});var n=x(d(),1);function o(){return(typeof window<"u"&&window.__FSAOS_CONFIG__||{}).edgeBaseUrl||""}function v(e){return(0,n.createElement)("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column"},className:e.className||""},e.children)}function C(e){let i=e.direction||"vertical";return(0,n.createElement)("div",{style:{display:"flex",flexDirection:i==="horizontal"?"row":"column",gap:e.gap||"0.5rem",padding:e.padding||"0",alignItems:e.align||"stretch",justifyContent:e.justify||"flex-start",flex:e.flex||"initial"},className:e.className||""},e.children)}function k(e){return(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:"repeat("+(e.columns||3)+", 1fr)",gap:e.gap||"1rem",padding:e.padding||"0"},className:e.className||""},e.children)}function S(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"row",minHeight:"100vh"},className:e.className||""},e.children)}function w(e){return(0,n.createElement)("div",{style:{border:"1px solid var(--color-border, #e5e7eb)",borderRadius:"var(--border-radius, 0.5rem)",padding:e.padding||"1rem",background:"var(--color-surface, #fff)"},className:e.className||"",onClick:e.onClick},e.children)}function z(e){return(0,n.createElement)("span",{style:{display:"inline-flex",alignItems:"center",padding:"0.125rem 0.5rem",fontSize:"0.75rem",fontWeight:"500",borderRadius:"9999px",background:e.color||"#e5e7eb",color:e.textColor||"#374151"},className:e.className||""},e.children||e.label)}function B(e){let i=e.size||"1.5rem";return(0,n.createElement)("div",{style:{width:i,height:i,border:"2px solid #e5e7eb",borderTopColor:"var(--color-primary, #3b82f6)",borderRadius:"50%",animation:"fsaos-spin 0.6s linear infinite"}})}function D(e){return(0,n.createElement)("button",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",borderRadius:"var(--border-radius, 0.375rem)",border:e.variant==="outline"?"1px solid var(--color-border, #d1d5db)":"none",background:e.variant==="outline"||e.variant==="ghost"?"transparent":"var(--color-primary, #3b82f6)",color:e.variant==="outline"||e.variant==="ghost"?"var(--color-text, #1a1a1a)":"#fff",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?"0.5":"1",gap:"0.5rem"},className:e.className||"",onClick:e.onClick,disabled:e.disabled},e.children||e.label)}function I(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"3rem",color:"var(--color-text-secondary, #6b7280)",textAlign:"center"}},e.icon?(0,n.createElement)("div",{style:{fontSize:"2rem",marginBottom:"0.5rem"}},e.icon):null,(0,n.createElement)("div",{style:{fontWeight:500,marginBottom:"0.25rem"}},e.title||e.message||e.children||"No items"),e.description?(0,n.createElement)("div",{style:{fontSize:"0.875rem",opacity:.7}},e.description):null)}function R(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function j(e){return(0,n.createElement)("table",{className:e.className||""},e.children)}function F(e){return(0,n.createElement)("form",{className:e.className||"",onSubmit:e.onSubmit},e.children)}function _(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function T(e){return(0,n.createElement)("div",null,e.children)}function E(e){return(0,n.createElement)("a",{href:e.href||e.to,className:e.className||"",onClick:e.onClick},e.children)}function W(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function A(e){return(0,n.createElement)("nav",{className:e.className||""},e.children)}function G(e){return(0,n.createElement)("img",{src:e.src||(e.path?o()+e.path:""),alt:e.alt||"",className:e.className||"",style:e.style})}function H(e){return(0,n.createElement)("video",{src:e.src||(e.path?o()+e.path:""),controls:!0,className:e.className||""})}function O(e){return(0,n.createElement)("div",{className:e.className||""},e.children||"File preview")}return b(P);})();
|
|
3
3
|
//# sourceMappingURL=ui.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1364,6 +1364,9 @@ function resubscribeAll(isReconnect = false) {
|
|
|
1364
1364
|
sendPathSubscribe(sub.path, sub.event_types);
|
|
1365
1365
|
}
|
|
1366
1366
|
if (!isReconnect) return;
|
|
1367
|
+
catchUpAfterGap("reconnect");
|
|
1368
|
+
}
|
|
1369
|
+
function catchUpAfterGap(reason) {
|
|
1367
1370
|
try {
|
|
1368
1371
|
const qc = getQueryClient();
|
|
1369
1372
|
refreshInfiniteItemsAfterReconnect(qc);
|
|
@@ -1372,9 +1375,9 @@ function resubscribeAll(isReconnect = false) {
|
|
|
1372
1375
|
void qc.invalidateQueries({ queryKey: vfsKeys.item(sub.path) });
|
|
1373
1376
|
void qc.invalidateQueries({ queryKey: vfsKeys.children(sub.path) });
|
|
1374
1377
|
}
|
|
1375
|
-
log("
|
|
1378
|
+
log("catchUpAfterGap:", reason, "- invalidated", activePaths.size, "paths");
|
|
1376
1379
|
} catch (err) {
|
|
1377
|
-
log("
|
|
1380
|
+
log("catchUpAfterGap: cache invalidation skipped", err);
|
|
1378
1381
|
}
|
|
1379
1382
|
}
|
|
1380
1383
|
function sendMessage(msg) {
|
|
@@ -1397,6 +1400,10 @@ function handleMessage(raw) {
|
|
|
1397
1400
|
console.warn("[WS] Server error:", msg.message);
|
|
1398
1401
|
return;
|
|
1399
1402
|
}
|
|
1403
|
+
if (msg.type === "resync") {
|
|
1404
|
+
catchUpAfterGap(typeof msg.reason === "string" ? msg.reason : "resync");
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1400
1407
|
if (msg.type === "event" || msg.event_type) {
|
|
1401
1408
|
const eventType = msg.event_type || "message";
|
|
1402
1409
|
const data = msg.data || msg;
|
|
@@ -5652,14 +5659,27 @@ function getRequiredFormFields(typeDef) {
|
|
|
5652
5659
|
(f) => required.has(f.key) || f.default_value === void 0
|
|
5653
5660
|
);
|
|
5654
5661
|
}
|
|
5655
|
-
var _idCounter = 0;
|
|
5656
5662
|
function generateUploadId() {
|
|
5657
|
-
return
|
|
5663
|
+
if (globalThis.crypto?.randomUUID) return globalThis.crypto.randomUUID();
|
|
5664
|
+
const bytes = new Uint8Array(16);
|
|
5665
|
+
if (globalThis.crypto?.getRandomValues) {
|
|
5666
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
5667
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
5668
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
5669
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
5670
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
5671
|
+
}
|
|
5672
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
5673
|
+
const n = Math.floor(Math.random() * 16);
|
|
5674
|
+
return (c === "x" ? n : n & 3 | 8).toString(16);
|
|
5675
|
+
});
|
|
5658
5676
|
}
|
|
5659
5677
|
async function uploadFile(file, options, onProgress, signal2) {
|
|
5660
5678
|
const fileName = options.name || (file instanceof File ? file.name : `file-${Date.now()}`);
|
|
5661
5679
|
const contentType = file.type || "application/octet-stream";
|
|
5662
5680
|
const itemType = options.itemType || "file";
|
|
5681
|
+
const collisionPolicy = options.collisionPolicy || "keep_both";
|
|
5682
|
+
const uploadId = collisionPolicy === "keep_both" ? generateUploadId() : void 0;
|
|
5663
5683
|
const createParams = {
|
|
5664
5684
|
parent_path: options.parentPath,
|
|
5665
5685
|
item_type: itemType,
|
|
@@ -5668,7 +5688,9 @@ async function uploadFile(file, options, onProgress, signal2) {
|
|
|
5668
5688
|
...options.typeData || {},
|
|
5669
5689
|
file_source: {
|
|
5670
5690
|
type: "upload",
|
|
5671
|
-
content_type: contentType
|
|
5691
|
+
content_type: contentType,
|
|
5692
|
+
collision_policy: collisionPolicy,
|
|
5693
|
+
...uploadId ? { upload_id: uploadId } : {}
|
|
5672
5694
|
}
|
|
5673
5695
|
}
|
|
5674
5696
|
};
|
|
@@ -5770,6 +5792,7 @@ function useFileUpload() {
|
|
|
5770
5792
|
const fileName = options.name || file.name;
|
|
5771
5793
|
const contentType = file.type || "application/octet-stream";
|
|
5772
5794
|
const itemType = options.itemType || "file";
|
|
5795
|
+
const collisionPolicy = options.collisionPolicy || "keep_both";
|
|
5773
5796
|
let itemId = existingState?.itemId || null;
|
|
5774
5797
|
let itemPath = existingState?.itemPath || null;
|
|
5775
5798
|
let storageKey = existingState?.storageKey || null;
|
|
@@ -5786,7 +5809,9 @@ function useFileUpload() {
|
|
|
5786
5809
|
...options.typeData || {},
|
|
5787
5810
|
file_source: {
|
|
5788
5811
|
type: "upload",
|
|
5789
|
-
content_type: contentType
|
|
5812
|
+
content_type: contentType,
|
|
5813
|
+
collision_policy: collisionPolicy,
|
|
5814
|
+
...collisionPolicy === "keep_both" ? { upload_id: uploadId } : {}
|
|
5790
5815
|
}
|
|
5791
5816
|
}
|
|
5792
5817
|
});
|