deepspace 0.3.6 → 0.3.8
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/cli.js +487 -156
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +14 -50
- package/dist/index.js.map +1 -1
- package/dist/worker.d.ts +65 -22
- package/dist/worker.js +6 -6
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6707,7 +6707,6 @@ declare function PlatformProvider({ children }: {
|
|
|
6707
6707
|
* - Exponential backoff reconnect (500ms -> 10s max)
|
|
6708
6708
|
* - Ping every 30s
|
|
6709
6709
|
* - Cleanup on unmount or scopeId change
|
|
6710
|
-
* - User name forwarding
|
|
6711
6710
|
*
|
|
6712
6711
|
* Usage:
|
|
6713
6712
|
* const state = usePlatformWS({
|
package/dist/index.js
CHANGED
|
@@ -1532,13 +1532,6 @@ function RecordProviderCore({
|
|
|
1532
1532
|
baseUrl = `${protocol}//${window.location.host}`;
|
|
1533
1533
|
}
|
|
1534
1534
|
const params = new URLSearchParams();
|
|
1535
|
-
if (profile) {
|
|
1536
|
-
params.set("userId", profile.id);
|
|
1537
|
-
params.set("isAdmin", String(profile.isAdmin));
|
|
1538
|
-
if (profile.name) params.set("userName", profile.name);
|
|
1539
|
-
if (profile.email) params.set("userEmail", profile.email);
|
|
1540
|
-
if (profile.imageUrl) params.set("userImageUrl", profile.imageUrl);
|
|
1541
|
-
}
|
|
1542
1535
|
try {
|
|
1543
1536
|
const tokenFn = getAuthTokenProp ?? getAuthToken;
|
|
1544
1537
|
const token = await tokenFn();
|
|
@@ -2004,12 +1997,6 @@ function ScopeConnection({
|
|
|
2004
1997
|
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
2005
1998
|
const baseUrl = wsUrl?.replace(/^http/, "ws") ?? `${protocol}//${window.location.host}`;
|
|
2006
1999
|
const params = new URLSearchParams();
|
|
2007
|
-
if (profile) {
|
|
2008
|
-
params.set("userId", profile.id);
|
|
2009
|
-
if (profile.name) params.set("userName", profile.name);
|
|
2010
|
-
if (profile.email) params.set("userEmail", profile.email);
|
|
2011
|
-
if (profile.imageUrl) params.set("userImageUrl", profile.imageUrl);
|
|
2012
|
-
}
|
|
2013
2000
|
try {
|
|
2014
2001
|
const tokenFn = getAuthTokenRef.current ?? getAuthToken;
|
|
2015
2002
|
const token = await tokenFn();
|
|
@@ -4530,15 +4517,12 @@ var MAX_RECONNECT_DELAY = 1e4;
|
|
|
4530
4517
|
var BASE_RECONNECT_DELAY = 500;
|
|
4531
4518
|
function usePlatformWS(options) {
|
|
4532
4519
|
const { path, scopeId, initialState, onMessage } = options;
|
|
4533
|
-
const { user } = useAuthUser();
|
|
4534
4520
|
const wsRef = useRef15(null);
|
|
4535
4521
|
const pingIntervalRef = useRef15(null);
|
|
4536
4522
|
const [state, setState] = useState15(initialState);
|
|
4537
4523
|
const reconnectAttemptRef = useRef15(0);
|
|
4538
4524
|
const reconnectTimerRef = useRef15(null);
|
|
4539
4525
|
const mountedRef = useRef15(true);
|
|
4540
|
-
const userRef = useRef15(user);
|
|
4541
|
-
userRef.current = user;
|
|
4542
4526
|
const onMessageRef = useRef15(onMessage);
|
|
4543
4527
|
onMessageRef.current = onMessage;
|
|
4544
4528
|
const initialStateRef = useRef15(initialState);
|
|
@@ -4562,7 +4546,6 @@ function usePlatformWS(options) {
|
|
|
4562
4546
|
}
|
|
4563
4547
|
const params = new URLSearchParams();
|
|
4564
4548
|
params.set("token", token);
|
|
4565
|
-
if (userRef.current?.fullName) params.set("userName", userRef.current.fullName);
|
|
4566
4549
|
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
|
4567
4550
|
const ws = new WebSocket(
|
|
4568
4551
|
`${protocol}//${window.location.host}/platform/ws/${path}/${scopeId}?${params}`
|
|
@@ -5718,33 +5701,13 @@ function ToastProvider({
|
|
|
5718
5701
|
);
|
|
5719
5702
|
}
|
|
5720
5703
|
var TOAST_CONFIG = {
|
|
5721
|
-
success: {
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
iconBg: "bg-success-muted"
|
|
5726
|
-
},
|
|
5727
|
-
error: {
|
|
5728
|
-
Icon: AlertCircleIcon,
|
|
5729
|
-
border: "border-danger-border",
|
|
5730
|
-
text: "text-destructive",
|
|
5731
|
-
iconBg: "bg-danger-muted"
|
|
5732
|
-
},
|
|
5733
|
-
warning: {
|
|
5734
|
-
Icon: AlertTriangleIcon,
|
|
5735
|
-
border: "border-warning-border",
|
|
5736
|
-
text: "text-warning",
|
|
5737
|
-
iconBg: "bg-warning-muted"
|
|
5738
|
-
},
|
|
5739
|
-
info: {
|
|
5740
|
-
Icon: InfoIcon,
|
|
5741
|
-
border: "border-info-border",
|
|
5742
|
-
text: "text-info",
|
|
5743
|
-
iconBg: "bg-info-muted"
|
|
5744
|
-
}
|
|
5704
|
+
success: { Icon: CheckCircleIcon, accent: "bg-success", icon: "text-success" },
|
|
5705
|
+
error: { Icon: AlertCircleIcon, accent: "bg-destructive", icon: "text-destructive" },
|
|
5706
|
+
warning: { Icon: AlertTriangleIcon, accent: "bg-warning", icon: "text-warning" },
|
|
5707
|
+
info: { Icon: InfoIcon, accent: "bg-info", icon: "text-info" }
|
|
5745
5708
|
};
|
|
5746
5709
|
function ToastItem({ toast, onDismiss }) {
|
|
5747
|
-
const { Icon: Icon2,
|
|
5710
|
+
const { Icon: Icon2, accent, icon } = TOAST_CONFIG[toast.type];
|
|
5748
5711
|
const [exiting, setExiting] = useState16(false);
|
|
5749
5712
|
useEffect19(() => {
|
|
5750
5713
|
if (exiting) {
|
|
@@ -5756,25 +5719,26 @@ function ToastItem({ toast, onDismiss }) {
|
|
|
5756
5719
|
"div",
|
|
5757
5720
|
{
|
|
5758
5721
|
className: `
|
|
5759
|
-
flex items-start gap-
|
|
5760
|
-
|
|
5761
|
-
|
|
5722
|
+
relative flex items-start gap-2.5 min-w-[260px] max-w-[360px]
|
|
5723
|
+
overflow-hidden rounded-lg border border-border bg-popover
|
|
5724
|
+
text-popover-foreground pl-3.5 pr-2 py-2.5 shadow-lg
|
|
5762
5725
|
${exiting ? "animate-out fade-out-0 slide-out-to-right-2 duration-150" : "animate-in fade-in-0 slide-in-from-right-2 duration-200"}
|
|
5763
5726
|
`,
|
|
5764
5727
|
role: "alert",
|
|
5765
5728
|
children: [
|
|
5766
|
-
/* @__PURE__ */ jsx27("span", { className: `
|
|
5729
|
+
/* @__PURE__ */ jsx27("span", { className: `absolute inset-y-0 left-0 w-[3px] ${accent}`, "aria-hidden": true }),
|
|
5730
|
+
/* @__PURE__ */ jsx27(Icon2, { className: `mt-0.5 h-4 w-4 shrink-0 ${icon}` }),
|
|
5767
5731
|
/* @__PURE__ */ jsxs9("div", { className: "flex-1 min-w-0", children: [
|
|
5768
|
-
/* @__PURE__ */ jsx27("p", { className: "font-medium
|
|
5769
|
-
toast.description && /* @__PURE__ */ jsx27("p", { className: "text-
|
|
5732
|
+
/* @__PURE__ */ jsx27("p", { className: "text-[13px] font-medium leading-tight", children: toast.title }),
|
|
5733
|
+
toast.description && /* @__PURE__ */ jsx27("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: toast.description })
|
|
5770
5734
|
] }),
|
|
5771
5735
|
/* @__PURE__ */ jsx27(
|
|
5772
5736
|
"button",
|
|
5773
5737
|
{
|
|
5774
5738
|
onClick: () => setExiting(true),
|
|
5775
|
-
className: "shrink-0 p-1
|
|
5739
|
+
className: "-mr-0.5 shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
|
|
5776
5740
|
"aria-label": "Dismiss",
|
|
5777
|
-
children: /* @__PURE__ */ jsx27(CloseIcon, { className: "
|
|
5741
|
+
children: /* @__PURE__ */ jsx27(CloseIcon, { className: "h-3.5 w-3.5" })
|
|
5778
5742
|
}
|
|
5779
5743
|
)
|
|
5780
5744
|
]
|