@cupcodev/ui 2.1.0 → 3.0.2
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 +6 -3
- package/dist/index.cjs +812 -975
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +835 -999
- package/dist/styles.css +1 -3
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -228,7 +228,7 @@ __export(src_exports, {
|
|
|
228
228
|
ModalHeader: () => ModalHeader,
|
|
229
229
|
ModalTitle: () => ModalTitle,
|
|
230
230
|
ModalTrigger: () => ModalTrigger,
|
|
231
|
-
NavbarCupcode: () =>
|
|
231
|
+
NavbarCupcode: () => NavbarCupcode_default,
|
|
232
232
|
NavigationMenu: () => NavigationMenu,
|
|
233
233
|
NavigationMenuContent: () => NavigationMenuContent,
|
|
234
234
|
NavigationMenuIndicator: () => NavigationMenuIndicator,
|
|
@@ -357,7 +357,7 @@ __export(src_exports, {
|
|
|
357
357
|
TooltipTrigger: () => TooltipTrigger,
|
|
358
358
|
USER_PRESENCE_LAST_ACTIVE_COLUMN_ENV_KEY: () => USER_PRESENCE_LAST_ACTIVE_COLUMN_ENV_KEY,
|
|
359
359
|
USER_PRESENCE_SOURCE_COLUMN_ENV_KEY: () => USER_PRESENCE_SOURCE_COLUMN_ENV_KEY,
|
|
360
|
-
UserMenuCupcode: () =>
|
|
360
|
+
UserMenuCupcode: () => UserMenuCupcode_default,
|
|
361
361
|
badgeVariants: () => badgeVariants,
|
|
362
362
|
buildAuthorizeUrl: () => buildAuthorizeUrl,
|
|
363
363
|
buildLogoutUrl: () => buildLogoutUrl,
|
|
@@ -387,6 +387,7 @@ __export(src_exports, {
|
|
|
387
387
|
resolveTelescupImageURL: () => resolveTelescupImageURL,
|
|
388
388
|
responsiveSizeClasses: () => responsiveSizeClasses,
|
|
389
389
|
setCupcodeRuntimeEnv: () => setCupcodeRuntimeEnv,
|
|
390
|
+
slugify: () => slugify,
|
|
390
391
|
sonnerToast: () => import_sonner.toast,
|
|
391
392
|
toast: () => toast,
|
|
392
393
|
toggleVariants: () => toggleVariants,
|
|
@@ -3005,14 +3006,15 @@ var NavbarCupcode = ({
|
|
|
3005
3006
|
}) => {
|
|
3006
3007
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
3007
3008
|
const navRef = React9.useRef(null);
|
|
3009
|
+
const mobileDrawerRef = React9.useRef(null);
|
|
3008
3010
|
const mobileMenuId = React9.useId();
|
|
3009
3011
|
React9.useEffect(() => {
|
|
3010
3012
|
if (!isOpen) return;
|
|
3011
3013
|
const handlePointerDown = (event) => {
|
|
3012
|
-
var _a78;
|
|
3014
|
+
var _a78, _b7;
|
|
3013
3015
|
const target = event.target;
|
|
3014
3016
|
if (!(target instanceof Node)) return;
|
|
3015
|
-
if (!((_a78 = navRef.current) == null ? void 0 : _a78.contains(target))) {
|
|
3017
|
+
if (!((_a78 = navRef.current) == null ? void 0 : _a78.contains(target)) && !((_b7 = mobileDrawerRef.current) == null ? void 0 : _b7.contains(target))) {
|
|
3016
3018
|
setIsOpen(false);
|
|
3017
3019
|
}
|
|
3018
3020
|
};
|
|
@@ -3048,34 +3050,50 @@ var NavbarCupcode = ({
|
|
|
3048
3050
|
window.removeEventListener("resize", handleResize);
|
|
3049
3051
|
};
|
|
3050
3052
|
}, []);
|
|
3051
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "
|
|
3062
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3055
|
+
"nav",
|
|
3056
|
+
{
|
|
3057
|
+
ref: navRef,
|
|
3058
|
+
className: cn(
|
|
3059
|
+
"fixed left-2 right-2 top-[max(env(safe-area-inset-top),0.75rem)] z-[200] overflow-hidden rounded-2xl",
|
|
3060
|
+
"glass border-border/70 shadow-[var(--elevation-3)] md:left-4 md:right-4",
|
|
3061
|
+
className
|
|
3062
|
+
),
|
|
3063
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "cc-container", children: [
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "hidden h-16 items-center justify-between md:flex", children: [
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex-shrink-0", children: logo }),
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center space-x-8", children: items.map((item, index) => {
|
|
3067
|
+
const key = `${item.label}-${index}`;
|
|
3068
|
+
const isActive = item.isActive;
|
|
3069
|
+
const baseClasses = cn(
|
|
3070
|
+
"flex items-center gap-2 text-sm font-semibold text-foreground",
|
|
3071
|
+
"hover:text-primary transition-colors duration-200",
|
|
3072
|
+
"relative after:absolute after:bottom-0 after:left-0 after:h-0.5 after:w-0",
|
|
3073
|
+
"after:bg-primary after:transition-all after:duration-300",
|
|
3074
|
+
"hover:after:w-full",
|
|
3075
|
+
isActive && "text-primary after:w-full"
|
|
3076
|
+
);
|
|
3077
|
+
const handleClick = (event) => {
|
|
3078
|
+
var _a78;
|
|
3079
|
+
(_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
|
|
3080
|
+
};
|
|
3081
|
+
if (item.href.startsWith("#")) {
|
|
3082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3083
|
+
"a",
|
|
3084
|
+
{
|
|
3085
|
+
href: item.href,
|
|
3086
|
+
className: baseClasses,
|
|
3087
|
+
onClick: handleClick,
|
|
3088
|
+
"aria-current": isActive ? "page" : void 0,
|
|
3089
|
+
children: [
|
|
3090
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
|
|
3091
|
+
item.label
|
|
3092
|
+
]
|
|
3093
|
+
},
|
|
3094
|
+
key
|
|
3095
|
+
);
|
|
3096
|
+
}
|
|
3079
3097
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3080
3098
|
"a",
|
|
3081
3099
|
{
|
|
@@ -3090,73 +3108,92 @@ var NavbarCupcode = ({
|
|
|
3090
3108
|
},
|
|
3091
3109
|
key
|
|
3092
3110
|
);
|
|
3093
|
-
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3111
|
+
}) }),
|
|
3112
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex", children: actions })
|
|
3113
|
+
] }),
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative flex h-16 items-center md:hidden", children: [
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3116
|
+
"button",
|
|
3096
3117
|
{
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
"aria-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
)
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
setIsOpen(false)
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
|
|
3144
|
-
item.label
|
|
3145
|
-
] }, key);
|
|
3118
|
+
type: "button",
|
|
3119
|
+
onClick: () => setIsOpen(!isOpen),
|
|
3120
|
+
"aria-controls": mobileMenuId,
|
|
3121
|
+
"aria-expanded": isOpen,
|
|
3122
|
+
"aria-label": isOpen ? "Fechar menu de navega\xE7\xE3o" : "Abrir menu de navega\xE7\xE3o",
|
|
3123
|
+
className: "z-10 inline-flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
3124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.Menu, { className: cn("h-6 w-6 text-foreground", isOpen && "text-primary") })
|
|
3125
|
+
}
|
|
3126
|
+
),
|
|
3127
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "pointer-events-none absolute left-1/2 top-1/2 z-0 w-[min(62vw,18rem)] -translate-x-1/2 -translate-y-1/2 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center justify-center", children: logo }) }),
|
|
3128
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "z-10 ml-auto flex items-center", children: actions != null ? actions : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex h-10 w-10", "aria-hidden": "true" }) })
|
|
3129
|
+
] })
|
|
3130
|
+
] })
|
|
3131
|
+
}
|
|
3132
|
+
),
|
|
3133
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fixed inset-0 z-[240] md:hidden", children: [
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3135
|
+
"button",
|
|
3136
|
+
{
|
|
3137
|
+
type: "button",
|
|
3138
|
+
onClick: () => setIsOpen(false),
|
|
3139
|
+
className: "absolute inset-0 bg-black/45 backdrop-blur-[1.5px]",
|
|
3140
|
+
"aria-label": "Fechar menu de navega\xE7\xE3o"
|
|
3141
|
+
}
|
|
3142
|
+
),
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3144
|
+
"div",
|
|
3145
|
+
{
|
|
3146
|
+
id: mobileMenuId,
|
|
3147
|
+
ref: mobileDrawerRef,
|
|
3148
|
+
className: cn(
|
|
3149
|
+
"glass-strong absolute inset-y-0 left-0 z-10 w-[min(84vw,22rem)] border-r border-border/70 px-3 pb-[max(env(safe-area-inset-bottom),0.75rem)] pt-[max(env(safe-area-inset-top),0.9rem)] text-foreground shadow-[var(--elevation-5)]",
|
|
3150
|
+
"data-[state=open]:animate-in data-[state=open]:slide-in-from-left data-[state=open]:duration-300"
|
|
3151
|
+
),
|
|
3152
|
+
"data-state": "open",
|
|
3153
|
+
children: [
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mb-4 flex items-center justify-between border-b border-border/60 pb-3", children: [
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-sm font-semibold text-foreground/80", children: "Menu" }),
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3157
|
+
"button",
|
|
3158
|
+
{
|
|
3159
|
+
type: "button",
|
|
3160
|
+
onClick: () => setIsOpen(false),
|
|
3161
|
+
className: "inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/50 text-foreground transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
3162
|
+
"aria-label": "Fechar menu de navega\xE7\xE3o",
|
|
3163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react5.X, { className: "h-4 w-4" })
|
|
3146
3164
|
}
|
|
3165
|
+
)
|
|
3166
|
+
] }),
|
|
3167
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "cc-scrollbar cc-scrollbar-purple max-h-[calc(100dvh-9rem)] space-y-2 overflow-y-auto pr-1", children: items.map((item, index) => {
|
|
3168
|
+
const key = `${item.label}-${index}`;
|
|
3169
|
+
const isActive = item.isActive;
|
|
3170
|
+
const classes = cn(
|
|
3171
|
+
"flex min-h-11 items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
3172
|
+
isActive && "text-primary"
|
|
3173
|
+
);
|
|
3174
|
+
const handleClick = (event) => {
|
|
3175
|
+
var _a78;
|
|
3176
|
+
(_a78 = item.onClick) == null ? void 0 : _a78.call(item, event);
|
|
3177
|
+
setIsOpen(false);
|
|
3178
|
+
};
|
|
3179
|
+
if (item.href.startsWith("#")) {
|
|
3147
3180
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
|
|
3148
3181
|
item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
|
|
3149
3182
|
item.label
|
|
3150
3183
|
] }, key);
|
|
3151
|
-
}
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3184
|
+
}
|
|
3185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("a", { href: item.href, className: classes, onClick: handleClick, children: [
|
|
3186
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: item.icon }),
|
|
3187
|
+
item.label
|
|
3188
|
+
] }, key);
|
|
3189
|
+
}) })
|
|
3190
|
+
]
|
|
3191
|
+
}
|
|
3192
|
+
)
|
|
3193
|
+
] })
|
|
3194
|
+
] });
|
|
3159
3195
|
};
|
|
3196
|
+
var NavbarCupcode_default = NavbarCupcode;
|
|
3160
3197
|
|
|
3161
3198
|
// src/components/cupcode/MainNavbar.tsx
|
|
3162
3199
|
var import_react19 = require("react");
|
|
@@ -10941,42 +10978,44 @@ var UserMenuCupcode = ({
|
|
|
10941
10978
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(DialogPrimitive3.Content, { className: "glass-strong fixed inset-y-0 right-0 z-[700] w-full max-w-[27rem] overflow-hidden border-l border-border/70 text-foreground shadow-[var(--elevation-5)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:duration-300 data-[state=open]:duration-500", children: [
|
|
10942
10979
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DialogPrimitive3.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
|
|
10943
10980
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DialogPrimitive3.Description, { className: "sr-only", children: "Painel lateral com perfil, notifica\xE7\xF5es, chat e configura\xE7\xF5es." }),
|
|
10944
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(DialogPrimitive3.Close, { className: "absolute right-3 top-3 z-10 flex h-10 w-10 items-center justify-center rounded-full border border-border/70 bg-background/40 text-foreground transition-all hover:bg-muted/60 sm:-right-[58px]", children: [
|
|
10945
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react10.X, { className: "h-5 w-5" }),
|
|
10946
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Fechar menu" })
|
|
10947
|
-
] }),
|
|
10948
10981
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative flex h-full flex-col p-3 sm:p-4", children: [
|
|
10949
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
"
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10982
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10983
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(DialogPrimitive3.Close, { className: "inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/75 text-primary transition-all hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40", children: [
|
|
10984
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react10.X, { className: "h-5 w-5" }),
|
|
10985
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Fechar menu" })
|
|
10986
|
+
] }),
|
|
10987
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "glass-subtle flex-1 rounded-[1.3rem] p-1", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "grid grid-cols-5 gap-1", children: TAB_ITEMS.map((tab) => {
|
|
10988
|
+
const Icon3 = tab.icon;
|
|
10989
|
+
const isCurrent = tab.id === activeTab;
|
|
10990
|
+
const isChatTab = tab.id === "chat";
|
|
10991
|
+
const isNotificationsTab = tab.id === "notifications";
|
|
10992
|
+
const hasChatUnread = isChatTab && visibleChatUnreadCount > 0;
|
|
10993
|
+
const hasNotificationUnread = isNotificationsTab && !isBadgeSuppressedByFocus && unreadGeneralNotificationsCount > 0;
|
|
10994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10995
|
+
"button",
|
|
10996
|
+
{
|
|
10997
|
+
type: "button",
|
|
10998
|
+
onClick: () => {
|
|
10999
|
+
setIsLogoutConfirmOpen(false);
|
|
11000
|
+
setActiveTab(tab.id);
|
|
11001
|
+
},
|
|
11002
|
+
title: tab.label,
|
|
11003
|
+
className: cn(
|
|
11004
|
+
"flex h-9 w-full items-center justify-center rounded-xl transition-all",
|
|
11005
|
+
isCurrent ? "bg-background text-foreground shadow-[var(--elevation-2)]" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground"
|
|
11006
|
+
),
|
|
11007
|
+
"aria-current": isCurrent ? "page" : void 0,
|
|
11008
|
+
"aria-label": tab.label,
|
|
11009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "relative inline-flex", children: [
|
|
11010
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon3, { className: "h-4 w-4" }),
|
|
11011
|
+
hasNotificationUnread ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: unreadGeneralNotificationsCount > 99 ? "99+" : unreadGeneralNotificationsCount }) : null,
|
|
11012
|
+
hasChatUnread ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: visibleChatUnreadCount > 99 ? "99+" : visibleChatUnreadCount }) : null
|
|
11013
|
+
] })
|
|
10963
11014
|
},
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
),
|
|
10969
|
-
"aria-current": isCurrent ? "page" : void 0,
|
|
10970
|
-
"aria-label": tab.label,
|
|
10971
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "relative inline-flex", children: [
|
|
10972
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon3, { className: "h-4 w-4" }),
|
|
10973
|
-
hasNotificationUnread ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: unreadGeneralNotificationsCount > 99 ? "99+" : unreadGeneralNotificationsCount }) : null,
|
|
10974
|
-
hasChatUnread ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "absolute -right-1.5 -top-1.5 inline-flex h-3.5 min-w-[0.9rem] items-center justify-center rounded-full bg-destructive px-0.5 text-[9px] font-bold leading-none text-destructive-foreground", children: visibleChatUnreadCount > 99 ? "99+" : visibleChatUnreadCount }) : null
|
|
10975
|
-
] })
|
|
10976
|
-
},
|
|
10977
|
-
tab.id
|
|
10978
|
-
);
|
|
10979
|
-
}) }) }),
|
|
11015
|
+
tab.id
|
|
11016
|
+
);
|
|
11017
|
+
}) }) })
|
|
11018
|
+
] }),
|
|
10980
11019
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10981
11020
|
"div",
|
|
10982
11021
|
{
|
|
@@ -11054,6 +11093,7 @@ var UserMenuCupcode = ({
|
|
|
11054
11093
|
}
|
|
11055
11094
|
);
|
|
11056
11095
|
};
|
|
11096
|
+
var UserMenuCupcode_default = UserMenuCupcode;
|
|
11057
11097
|
|
|
11058
11098
|
// src/lib/navigation.tsx
|
|
11059
11099
|
var import_lucide_react11 = require("lucide-react");
|
|
@@ -11076,7 +11116,7 @@ var getMainNavItems = () => [
|
|
|
11076
11116
|
}
|
|
11077
11117
|
];
|
|
11078
11118
|
|
|
11079
|
-
// node_modules/tslib/tslib.es6.mjs
|
|
11119
|
+
// node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
11080
11120
|
function __rest(s, e) {
|
|
11081
11121
|
var t = {};
|
|
11082
11122
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -11116,7 +11156,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
11116
11156
|
});
|
|
11117
11157
|
}
|
|
11118
11158
|
|
|
11119
|
-
// node_modules/@supabase/functions-js/dist/module/helper.js
|
|
11159
|
+
// node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/helper.js
|
|
11120
11160
|
var resolveFetch = (customFetch) => {
|
|
11121
11161
|
if (customFetch) {
|
|
11122
11162
|
return (...args) => customFetch(...args);
|
|
@@ -11124,7 +11164,7 @@ var resolveFetch = (customFetch) => {
|
|
|
11124
11164
|
return (...args) => fetch(...args);
|
|
11125
11165
|
};
|
|
11126
11166
|
|
|
11127
|
-
// node_modules/@supabase/functions-js/dist/module/types.js
|
|
11167
|
+
// node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/types.js
|
|
11128
11168
|
var FunctionsError = class extends Error {
|
|
11129
11169
|
constructor(message, name = "FunctionsError", context) {
|
|
11130
11170
|
super(message);
|
|
@@ -11166,7 +11206,7 @@ var FunctionRegion;
|
|
|
11166
11206
|
FunctionRegion2["UsWest2"] = "us-west-2";
|
|
11167
11207
|
})(FunctionRegion || (FunctionRegion = {}));
|
|
11168
11208
|
|
|
11169
|
-
// node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
11209
|
+
// node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
11170
11210
|
var FunctionsClient = class {
|
|
11171
11211
|
/**
|
|
11172
11212
|
* Creates a new Functions client bound to an Edge Functions URL.
|
|
@@ -11306,7 +11346,7 @@ var FunctionsClient = class {
|
|
|
11306
11346
|
}
|
|
11307
11347
|
};
|
|
11308
11348
|
|
|
11309
|
-
// node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
11349
|
+
// node_modules/.pnpm/@supabase+postgrest-js@2.95.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
11310
11350
|
var PostgrestError = class extends Error {
|
|
11311
11351
|
/**
|
|
11312
11352
|
* @example
|
|
@@ -11344,7 +11384,7 @@ var PostgrestBuilder = class {
|
|
|
11344
11384
|
* ```
|
|
11345
11385
|
*/
|
|
11346
11386
|
constructor(builder) {
|
|
11347
|
-
var _builder$shouldThrowO, _builder$isMaybeSingl;
|
|
11387
|
+
var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
|
|
11348
11388
|
this.shouldThrowOnError = false;
|
|
11349
11389
|
this.method = builder.method;
|
|
11350
11390
|
this.url = builder.url;
|
|
@@ -11354,6 +11394,7 @@ var PostgrestBuilder = class {
|
|
|
11354
11394
|
this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
|
|
11355
11395
|
this.signal = builder.signal;
|
|
11356
11396
|
this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
|
|
11397
|
+
this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
|
|
11357
11398
|
if (builder.fetch) this.fetch = builder.fetch;
|
|
11358
11399
|
else this.fetch = fetch;
|
|
11359
11400
|
}
|
|
@@ -11454,6 +11495,8 @@ var PostgrestBuilder = class {
|
|
|
11454
11495
|
if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
|
|
11455
11496
|
var _fetchError$name2;
|
|
11456
11497
|
let errorDetails = "";
|
|
11498
|
+
let hint = "";
|
|
11499
|
+
let code = "";
|
|
11457
11500
|
const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
|
|
11458
11501
|
if (cause) {
|
|
11459
11502
|
var _cause$message, _cause$code, _fetchError$name, _cause$name;
|
|
@@ -11470,12 +11513,22 @@ ${cause.stack}`;
|
|
|
11470
11513
|
var _fetchError$stack;
|
|
11471
11514
|
errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
|
|
11472
11515
|
}
|
|
11516
|
+
const urlLength = this.url.toString().length;
|
|
11517
|
+
if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
|
|
11518
|
+
code = "";
|
|
11519
|
+
hint = "Request was aborted (timeout or manual cancellation)";
|
|
11520
|
+
if (urlLength > this.urlLengthLimit) hint += `. Note: Your request URL is ${urlLength} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`;
|
|
11521
|
+
} else if ((cause === null || cause === void 0 ? void 0 : cause.name) === "HeadersOverflowError" || (cause === null || cause === void 0 ? void 0 : cause.code) === "UND_ERR_HEADERS_OVERFLOW") {
|
|
11522
|
+
code = "";
|
|
11523
|
+
hint = "HTTP headers exceeded server limits (typically 16KB)";
|
|
11524
|
+
if (urlLength > this.urlLengthLimit) hint += `. Your request URL is ${urlLength} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`;
|
|
11525
|
+
}
|
|
11473
11526
|
return {
|
|
11474
11527
|
error: {
|
|
11475
11528
|
message: `${(_fetchError$name2 = fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) !== null && _fetchError$name2 !== void 0 ? _fetchError$name2 : "FetchError"}: ${fetchError === null || fetchError === void 0 ? void 0 : fetchError.message}`,
|
|
11476
11529
|
details: errorDetails,
|
|
11477
|
-
hint
|
|
11478
|
-
code
|
|
11530
|
+
hint,
|
|
11531
|
+
code
|
|
11479
11532
|
},
|
|
11480
11533
|
data: null,
|
|
11481
11534
|
count: null,
|
|
@@ -12117,11 +12170,12 @@ var PostgrestQueryBuilder = class {
|
|
|
12117
12170
|
* )
|
|
12118
12171
|
* ```
|
|
12119
12172
|
*/
|
|
12120
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
|
|
12173
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
|
|
12121
12174
|
this.url = url;
|
|
12122
12175
|
this.headers = new Headers(headers);
|
|
12123
12176
|
this.schema = schema;
|
|
12124
12177
|
this.fetch = fetch$1;
|
|
12178
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
12125
12179
|
}
|
|
12126
12180
|
/**
|
|
12127
12181
|
* Clone URL and headers to prevent shared state between operations.
|
|
@@ -12152,6 +12206,10 @@ var PostgrestQueryBuilder = class {
|
|
|
12152
12206
|
*
|
|
12153
12207
|
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
12154
12208
|
* numbers.
|
|
12209
|
+
*
|
|
12210
|
+
* @remarks
|
|
12211
|
+
* When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
|
|
12212
|
+
* that match your filters, not the number of rows in the current page. Use this to build pagination UI.
|
|
12155
12213
|
*/
|
|
12156
12214
|
select(columns, options) {
|
|
12157
12215
|
const { head: head2 = false, count: count2 } = options !== null && options !== void 0 ? options : {};
|
|
@@ -12170,7 +12228,8 @@ var PostgrestQueryBuilder = class {
|
|
|
12170
12228
|
url,
|
|
12171
12229
|
headers,
|
|
12172
12230
|
schema: this.schema,
|
|
12173
|
-
fetch: this.fetch
|
|
12231
|
+
fetch: this.fetch,
|
|
12232
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12174
12233
|
});
|
|
12175
12234
|
}
|
|
12176
12235
|
/**
|
|
@@ -12218,7 +12277,8 @@ var PostgrestQueryBuilder = class {
|
|
|
12218
12277
|
headers,
|
|
12219
12278
|
schema: this.schema,
|
|
12220
12279
|
body: values,
|
|
12221
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
12280
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
12281
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12222
12282
|
});
|
|
12223
12283
|
}
|
|
12224
12284
|
/**
|
|
@@ -12327,7 +12387,8 @@ var PostgrestQueryBuilder = class {
|
|
|
12327
12387
|
headers,
|
|
12328
12388
|
schema: this.schema,
|
|
12329
12389
|
body: values,
|
|
12330
|
-
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
|
|
12390
|
+
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
|
|
12391
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12331
12392
|
});
|
|
12332
12393
|
}
|
|
12333
12394
|
/**
|
|
@@ -12362,7 +12423,8 @@ var PostgrestQueryBuilder = class {
|
|
|
12362
12423
|
headers,
|
|
12363
12424
|
schema: this.schema,
|
|
12364
12425
|
body: values,
|
|
12365
|
-
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
|
|
12426
|
+
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
|
|
12427
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12366
12428
|
});
|
|
12367
12429
|
}
|
|
12368
12430
|
/**
|
|
@@ -12394,10 +12456,62 @@ var PostgrestQueryBuilder = class {
|
|
|
12394
12456
|
url,
|
|
12395
12457
|
headers,
|
|
12396
12458
|
schema: this.schema,
|
|
12397
|
-
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
|
|
12459
|
+
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
|
|
12460
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12398
12461
|
});
|
|
12399
12462
|
}
|
|
12400
12463
|
};
|
|
12464
|
+
function _typeof(o) {
|
|
12465
|
+
"@babel/helpers - typeof";
|
|
12466
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
12467
|
+
return typeof o$1;
|
|
12468
|
+
} : function(o$1) {
|
|
12469
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
12470
|
+
}, _typeof(o);
|
|
12471
|
+
}
|
|
12472
|
+
function toPrimitive(t, r) {
|
|
12473
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
12474
|
+
var e = t[Symbol.toPrimitive];
|
|
12475
|
+
if (void 0 !== e) {
|
|
12476
|
+
var i = e.call(t, r || "default");
|
|
12477
|
+
if ("object" != _typeof(i)) return i;
|
|
12478
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
12479
|
+
}
|
|
12480
|
+
return ("string" === r ? String : Number)(t);
|
|
12481
|
+
}
|
|
12482
|
+
function toPropertyKey(t) {
|
|
12483
|
+
var i = toPrimitive(t, "string");
|
|
12484
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
12485
|
+
}
|
|
12486
|
+
function _defineProperty(e, r, t) {
|
|
12487
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
12488
|
+
value: t,
|
|
12489
|
+
enumerable: true,
|
|
12490
|
+
configurable: true,
|
|
12491
|
+
writable: true
|
|
12492
|
+
}) : e[r] = t, e;
|
|
12493
|
+
}
|
|
12494
|
+
function ownKeys(e, r) {
|
|
12495
|
+
var t = Object.keys(e);
|
|
12496
|
+
if (Object.getOwnPropertySymbols) {
|
|
12497
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
12498
|
+
r && (o = o.filter(function(r$1) {
|
|
12499
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
12500
|
+
})), t.push.apply(t, o);
|
|
12501
|
+
}
|
|
12502
|
+
return t;
|
|
12503
|
+
}
|
|
12504
|
+
function _objectSpread2(e) {
|
|
12505
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
12506
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
12507
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
|
|
12508
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
12509
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
12510
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
12511
|
+
});
|
|
12512
|
+
}
|
|
12513
|
+
return e;
|
|
12514
|
+
}
|
|
12401
12515
|
var PostgrestClient = class PostgrestClient2 {
|
|
12402
12516
|
/**
|
|
12403
12517
|
* Creates a PostgREST client.
|
|
@@ -12407,6 +12521,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
12407
12521
|
* @param options.headers - Custom headers
|
|
12408
12522
|
* @param options.schema - Postgres schema to switch to
|
|
12409
12523
|
* @param options.fetch - Custom fetch
|
|
12524
|
+
* @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
|
|
12525
|
+
* @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
|
|
12410
12526
|
* @example
|
|
12411
12527
|
* ```ts
|
|
12412
12528
|
* import PostgrestClient from '@supabase/postgrest-js'
|
|
@@ -12414,14 +12530,38 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
12414
12530
|
* const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
|
|
12415
12531
|
* headers: { apikey: 'public-anon-key' },
|
|
12416
12532
|
* schema: 'public',
|
|
12533
|
+
* timeout: 30000, // 30 second timeout
|
|
12417
12534
|
* })
|
|
12418
12535
|
* ```
|
|
12419
12536
|
*/
|
|
12420
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
|
|
12537
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
|
|
12421
12538
|
this.url = url;
|
|
12422
12539
|
this.headers = new Headers(headers);
|
|
12423
12540
|
this.schemaName = schema;
|
|
12424
|
-
this.
|
|
12541
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
12542
|
+
const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
|
|
12543
|
+
if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
|
|
12544
|
+
const controller = new AbortController();
|
|
12545
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
12546
|
+
const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
|
|
12547
|
+
if (existingSignal) {
|
|
12548
|
+
if (existingSignal.aborted) {
|
|
12549
|
+
clearTimeout(timeoutId);
|
|
12550
|
+
return originalFetch(input, init);
|
|
12551
|
+
}
|
|
12552
|
+
const abortHandler = () => {
|
|
12553
|
+
clearTimeout(timeoutId);
|
|
12554
|
+
controller.abort();
|
|
12555
|
+
};
|
|
12556
|
+
existingSignal.addEventListener("abort", abortHandler, { once: true });
|
|
12557
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
|
|
12558
|
+
clearTimeout(timeoutId);
|
|
12559
|
+
existingSignal.removeEventListener("abort", abortHandler);
|
|
12560
|
+
});
|
|
12561
|
+
}
|
|
12562
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
|
|
12563
|
+
};
|
|
12564
|
+
else this.fetch = originalFetch;
|
|
12425
12565
|
}
|
|
12426
12566
|
/**
|
|
12427
12567
|
* Perform a query on a table or a view.
|
|
@@ -12433,7 +12573,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
12433
12573
|
return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
|
|
12434
12574
|
headers: new Headers(this.headers),
|
|
12435
12575
|
schema: this.schemaName,
|
|
12436
|
-
fetch: this.fetch
|
|
12576
|
+
fetch: this.fetch,
|
|
12577
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12437
12578
|
});
|
|
12438
12579
|
}
|
|
12439
12580
|
/**
|
|
@@ -12447,7 +12588,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
12447
12588
|
return new PostgrestClient2(this.url, {
|
|
12448
12589
|
headers: this.headers,
|
|
12449
12590
|
schema,
|
|
12450
|
-
fetch: this.fetch
|
|
12591
|
+
fetch: this.fetch,
|
|
12592
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12451
12593
|
});
|
|
12452
12594
|
}
|
|
12453
12595
|
/**
|
|
@@ -12510,12 +12652,13 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
12510
12652
|
headers,
|
|
12511
12653
|
schema: this.schemaName,
|
|
12512
12654
|
body,
|
|
12513
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
12655
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
12656
|
+
urlLengthLimit: this.urlLengthLimit
|
|
12514
12657
|
});
|
|
12515
12658
|
}
|
|
12516
12659
|
};
|
|
12517
12660
|
|
|
12518
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
12661
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
12519
12662
|
var WebSocketFactory = class {
|
|
12520
12663
|
/**
|
|
12521
12664
|
* Static-only utility – prevent instantiation.
|
|
@@ -12631,10 +12774,10 @@ Suggested solution: ${env.workaround}`;
|
|
|
12631
12774
|
};
|
|
12632
12775
|
var websocket_factory_default = WebSocketFactory;
|
|
12633
12776
|
|
|
12634
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
12635
|
-
var version = "2.
|
|
12777
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
12778
|
+
var version = "2.95.1";
|
|
12636
12779
|
|
|
12637
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
12780
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
12638
12781
|
var DEFAULT_VERSION = `realtime-js/${version}`;
|
|
12639
12782
|
var VSN_1_0_0 = "1.0.0";
|
|
12640
12783
|
var VSN_2_0_0 = "2.0.0";
|
|
@@ -12678,7 +12821,7 @@ var CONNECTION_STATE;
|
|
|
12678
12821
|
CONNECTION_STATE2["Closed"] = "closed";
|
|
12679
12822
|
})(CONNECTION_STATE || (CONNECTION_STATE = {}));
|
|
12680
12823
|
|
|
12681
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
12824
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
12682
12825
|
var Serializer = class {
|
|
12683
12826
|
constructor(allowedMetadataKeys) {
|
|
12684
12827
|
this.HEADER_LENGTH = 1;
|
|
@@ -12818,7 +12961,7 @@ var Serializer = class {
|
|
|
12818
12961
|
}
|
|
12819
12962
|
};
|
|
12820
12963
|
|
|
12821
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/timer.js
|
|
12964
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
|
|
12822
12965
|
var Timer = class {
|
|
12823
12966
|
constructor(callback, timerCalc) {
|
|
12824
12967
|
this.callback = callback;
|
|
@@ -12843,7 +12986,7 @@ var Timer = class {
|
|
|
12843
12986
|
}
|
|
12844
12987
|
};
|
|
12845
12988
|
|
|
12846
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
12989
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
12847
12990
|
var PostgresTypes;
|
|
12848
12991
|
(function(PostgresTypes2) {
|
|
12849
12992
|
PostgresTypes2["abstime"] = "abstime";
|
|
@@ -13006,7 +13149,7 @@ var httpEndpointURL = (socketUrl) => {
|
|
|
13006
13149
|
return wsUrl.href;
|
|
13007
13150
|
};
|
|
13008
13151
|
|
|
13009
|
-
// node_modules/@supabase/realtime-js/dist/module/lib/push.js
|
|
13152
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
|
|
13010
13153
|
var Push = class {
|
|
13011
13154
|
/**
|
|
13012
13155
|
* Initializes the Push
|
|
@@ -13105,7 +13248,7 @@ var Push = class {
|
|
|
13105
13248
|
}
|
|
13106
13249
|
};
|
|
13107
13250
|
|
|
13108
|
-
// node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
13251
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
13109
13252
|
var REALTIME_PRESENCE_LISTEN_EVENTS;
|
|
13110
13253
|
(function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
|
|
13111
13254
|
REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
|
|
@@ -13337,7 +13480,7 @@ var RealtimePresence = class _RealtimePresence {
|
|
|
13337
13480
|
}
|
|
13338
13481
|
};
|
|
13339
13482
|
|
|
13340
|
-
// node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
13483
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
13341
13484
|
var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
|
|
13342
13485
|
(function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
|
|
13343
13486
|
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
|
|
@@ -13777,15 +13920,15 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
13777
13920
|
}).map((bind) => bind.callback(handledPayload, ref));
|
|
13778
13921
|
} else {
|
|
13779
13922
|
(_b7 = this.bindings[typeLower]) === null || _b7 === void 0 ? void 0 : _b7.filter((bind) => {
|
|
13780
|
-
var _a79, _b8, _c, _d, _e, _f
|
|
13923
|
+
var _a79, _b8, _c, _d, _e, _f;
|
|
13781
13924
|
if (["broadcast", "presence", "postgres_changes"].includes(typeLower)) {
|
|
13782
13925
|
if ("id" in bind) {
|
|
13783
13926
|
const bindId = bind.id;
|
|
13784
13927
|
const bindEvent = (_a79 = bind.filter) === null || _a79 === void 0 ? void 0 : _a79.event;
|
|
13785
|
-
return bindId && ((_b8 = payload.ids) === null || _b8 === void 0 ? void 0 : _b8.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase()))
|
|
13928
|
+
return bindId && ((_b8 = payload.ids) === null || _b8 === void 0 ? void 0 : _b8.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase()));
|
|
13786
13929
|
} else {
|
|
13787
|
-
const bindEvent = (
|
|
13788
|
-
return bindEvent === "*" || bindEvent === ((
|
|
13930
|
+
const bindEvent = (_e = (_d = bind === null || bind === void 0 ? void 0 : bind.filter) === null || _d === void 0 ? void 0 : _d.event) === null || _e === void 0 ? void 0 : _e.toLocaleLowerCase();
|
|
13931
|
+
return bindEvent === "*" || bindEvent === ((_f = payload === null || payload === void 0 ? void 0 : payload.event) === null || _f === void 0 ? void 0 : _f.toLocaleLowerCase());
|
|
13789
13932
|
}
|
|
13790
13933
|
} else {
|
|
13791
13934
|
return bind.type.toLocaleLowerCase() === typeLower;
|
|
@@ -13933,7 +14076,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
13933
14076
|
}
|
|
13934
14077
|
};
|
|
13935
14078
|
|
|
13936
|
-
// node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
14079
|
+
// node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
13937
14080
|
var noop2 = () => {
|
|
13938
14081
|
};
|
|
13939
14082
|
var CONNECTION_TIMEOUTS = {
|
|
@@ -14119,6 +14262,9 @@ Option 2: Install and provide the "ws" package:
|
|
|
14119
14262
|
*/
|
|
14120
14263
|
async removeChannel(channel) {
|
|
14121
14264
|
const status = await channel.unsubscribe();
|
|
14265
|
+
if (status === "ok") {
|
|
14266
|
+
this._remove(channel);
|
|
14267
|
+
}
|
|
14122
14268
|
if (this.channels.length === 0) {
|
|
14123
14269
|
this.disconnect();
|
|
14124
14270
|
}
|
|
@@ -14509,6 +14655,11 @@ Option 2: Install and provide the "ws" package:
|
|
|
14509
14655
|
this.log("transport", `${error}`);
|
|
14510
14656
|
this._triggerChanError();
|
|
14511
14657
|
this._triggerStateCallbacks("error", error);
|
|
14658
|
+
try {
|
|
14659
|
+
this.heartbeatCallback("error");
|
|
14660
|
+
} catch (e) {
|
|
14661
|
+
this.log("error", "error in heartbeat callback", e);
|
|
14662
|
+
}
|
|
14512
14663
|
}
|
|
14513
14664
|
/** @internal */
|
|
14514
14665
|
_triggerChanError() {
|
|
@@ -14686,7 +14837,7 @@ Option 2: Install and provide the "ws" package:
|
|
|
14686
14837
|
}
|
|
14687
14838
|
};
|
|
14688
14839
|
|
|
14689
|
-
// node_modules/iceberg-js/dist/index.mjs
|
|
14840
|
+
// node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
|
|
14690
14841
|
var IcebergError = class extends Error {
|
|
14691
14842
|
constructor(message, opts) {
|
|
14692
14843
|
var _a78;
|
|
@@ -15224,21 +15375,24 @@ var IcebergRestCatalog = class {
|
|
|
15224
15375
|
}
|
|
15225
15376
|
};
|
|
15226
15377
|
|
|
15227
|
-
// node_modules/@supabase/storage-js/dist/index.mjs
|
|
15378
|
+
// node_modules/.pnpm/@supabase+storage-js@2.95.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
15228
15379
|
var StorageError = class extends Error {
|
|
15229
|
-
constructor(message) {
|
|
15380
|
+
constructor(message, namespace = "storage", status, statusCode) {
|
|
15230
15381
|
super(message);
|
|
15231
15382
|
this.__isStorageError = true;
|
|
15232
|
-
this.
|
|
15383
|
+
this.namespace = namespace;
|
|
15384
|
+
this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
|
|
15385
|
+
this.status = status;
|
|
15386
|
+
this.statusCode = statusCode;
|
|
15233
15387
|
}
|
|
15234
15388
|
};
|
|
15235
15389
|
function isStorageError(error) {
|
|
15236
15390
|
return typeof error === "object" && error !== null && "__isStorageError" in error;
|
|
15237
15391
|
}
|
|
15238
15392
|
var StorageApiError = class extends StorageError {
|
|
15239
|
-
constructor(message, status, statusCode) {
|
|
15240
|
-
super(message);
|
|
15241
|
-
this.name = "StorageApiError";
|
|
15393
|
+
constructor(message, status, statusCode, namespace = "storage") {
|
|
15394
|
+
super(message, namespace, status, statusCode);
|
|
15395
|
+
this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
|
|
15242
15396
|
this.status = status;
|
|
15243
15397
|
this.statusCode = statusCode;
|
|
15244
15398
|
}
|
|
@@ -15252,18 +15406,20 @@ var StorageApiError = class extends StorageError {
|
|
|
15252
15406
|
}
|
|
15253
15407
|
};
|
|
15254
15408
|
var StorageUnknownError = class extends StorageError {
|
|
15255
|
-
constructor(message, originalError) {
|
|
15256
|
-
super(message);
|
|
15257
|
-
this.name = "StorageUnknownError";
|
|
15409
|
+
constructor(message, originalError, namespace = "storage") {
|
|
15410
|
+
super(message, namespace);
|
|
15411
|
+
this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
|
|
15258
15412
|
this.originalError = originalError;
|
|
15259
15413
|
}
|
|
15260
15414
|
};
|
|
15261
|
-
var
|
|
15415
|
+
var resolveFetch2 = (customFetch) => {
|
|
15262
15416
|
if (customFetch) return (...args) => customFetch(...args);
|
|
15263
15417
|
return (...args) => fetch(...args);
|
|
15264
15418
|
};
|
|
15265
|
-
var
|
|
15266
|
-
return
|
|
15419
|
+
var isPlainObject = (value) => {
|
|
15420
|
+
if (typeof value !== "object" || value === null) return false;
|
|
15421
|
+
const prototype = Object.getPrototypeOf(value);
|
|
15422
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
15267
15423
|
};
|
|
15268
15424
|
var recursiveToCamel = (item) => {
|
|
15269
15425
|
if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
|
|
@@ -15275,11 +15431,6 @@ var recursiveToCamel = (item) => {
|
|
|
15275
15431
|
});
|
|
15276
15432
|
return result;
|
|
15277
15433
|
};
|
|
15278
|
-
var isPlainObject$1 = (value) => {
|
|
15279
|
-
if (typeof value !== "object" || value === null) return false;
|
|
15280
|
-
const prototype = Object.getPrototypeOf(value);
|
|
15281
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
15282
|
-
};
|
|
15283
15434
|
var isValidBucketName = (bucketName) => {
|
|
15284
15435
|
if (!bucketName || typeof bucketName !== "string") return false;
|
|
15285
15436
|
if (bucketName.length === 0 || bucketName.length > 100) return false;
|
|
@@ -15287,37 +15438,37 @@ var isValidBucketName = (bucketName) => {
|
|
|
15287
15438
|
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
15288
15439
|
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
15289
15440
|
};
|
|
15290
|
-
function
|
|
15441
|
+
function _typeof2(o) {
|
|
15291
15442
|
"@babel/helpers - typeof";
|
|
15292
|
-
return
|
|
15443
|
+
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
15293
15444
|
return typeof o$1;
|
|
15294
15445
|
} : function(o$1) {
|
|
15295
15446
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
15296
|
-
},
|
|
15447
|
+
}, _typeof2(o);
|
|
15297
15448
|
}
|
|
15298
|
-
function
|
|
15299
|
-
if ("object" !=
|
|
15449
|
+
function toPrimitive2(t, r) {
|
|
15450
|
+
if ("object" != _typeof2(t) || !t) return t;
|
|
15300
15451
|
var e = t[Symbol.toPrimitive];
|
|
15301
15452
|
if (void 0 !== e) {
|
|
15302
15453
|
var i = e.call(t, r || "default");
|
|
15303
|
-
if ("object" !=
|
|
15454
|
+
if ("object" != _typeof2(i)) return i;
|
|
15304
15455
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
15305
15456
|
}
|
|
15306
15457
|
return ("string" === r ? String : Number)(t);
|
|
15307
15458
|
}
|
|
15308
|
-
function
|
|
15309
|
-
var i =
|
|
15310
|
-
return "symbol" ==
|
|
15459
|
+
function toPropertyKey2(t) {
|
|
15460
|
+
var i = toPrimitive2(t, "string");
|
|
15461
|
+
return "symbol" == _typeof2(i) ? i : i + "";
|
|
15311
15462
|
}
|
|
15312
|
-
function
|
|
15313
|
-
return (r =
|
|
15463
|
+
function _defineProperty2(e, r, t) {
|
|
15464
|
+
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
15314
15465
|
value: t,
|
|
15315
15466
|
enumerable: true,
|
|
15316
15467
|
configurable: true,
|
|
15317
15468
|
writable: true
|
|
15318
15469
|
}) : e[r] = t, e;
|
|
15319
15470
|
}
|
|
15320
|
-
function
|
|
15471
|
+
function ownKeys2(e, r) {
|
|
15321
15472
|
var t = Object.keys(e);
|
|
15322
15473
|
if (Object.getOwnPropertySymbols) {
|
|
15323
15474
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -15327,75 +15478,166 @@ function ownKeys(e, r) {
|
|
|
15327
15478
|
}
|
|
15328
15479
|
return t;
|
|
15329
15480
|
}
|
|
15330
|
-
function
|
|
15481
|
+
function _objectSpread22(e) {
|
|
15331
15482
|
for (var r = 1; r < arguments.length; r++) {
|
|
15332
15483
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
15333
|
-
r % 2 ?
|
|
15334
|
-
|
|
15335
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
15484
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
|
|
15485
|
+
_defineProperty2(e, r$1, t[r$1]);
|
|
15486
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
|
|
15336
15487
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
15337
15488
|
});
|
|
15338
15489
|
}
|
|
15339
15490
|
return e;
|
|
15340
15491
|
}
|
|
15341
|
-
var _getErrorMessage
|
|
15492
|
+
var _getErrorMessage = (err) => {
|
|
15342
15493
|
var _err$error;
|
|
15343
15494
|
return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === void 0 ? void 0 : _err$error.message) || JSON.stringify(err);
|
|
15344
15495
|
};
|
|
15345
|
-
var handleError
|
|
15346
|
-
if (error
|
|
15347
|
-
const
|
|
15348
|
-
const
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15496
|
+
var handleError = async (error, reject, options, namespace) => {
|
|
15497
|
+
if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
|
|
15498
|
+
const responseError = error;
|
|
15499
|
+
const status = responseError.status || 500;
|
|
15500
|
+
if (typeof responseError.json === "function") responseError.json().then((err) => {
|
|
15501
|
+
const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
|
|
15502
|
+
reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
|
|
15503
|
+
}).catch(() => {
|
|
15504
|
+
if (namespace === "vectors") {
|
|
15505
|
+
const statusCode = status + "";
|
|
15506
|
+
reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
|
|
15507
|
+
} else {
|
|
15508
|
+
const statusCode = status + "";
|
|
15509
|
+
reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
|
|
15510
|
+
}
|
|
15511
|
+
});
|
|
15512
|
+
else {
|
|
15513
|
+
const statusCode = status + "";
|
|
15514
|
+
reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
|
|
15515
|
+
}
|
|
15516
|
+
} else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
|
|
15354
15517
|
};
|
|
15355
|
-
var _getRequestParams
|
|
15518
|
+
var _getRequestParams = (method, options, parameters, body) => {
|
|
15356
15519
|
const params = {
|
|
15357
15520
|
method,
|
|
15358
15521
|
headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
|
|
15359
15522
|
};
|
|
15360
|
-
if (method === "GET" || !body) return params;
|
|
15361
|
-
if (isPlainObject
|
|
15362
|
-
params.headers =
|
|
15523
|
+
if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
15524
|
+
if (isPlainObject(body)) {
|
|
15525
|
+
params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
|
|
15363
15526
|
params.body = JSON.stringify(body);
|
|
15364
15527
|
} else params.body = body;
|
|
15365
15528
|
if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
|
|
15366
|
-
return
|
|
15529
|
+
return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
15367
15530
|
};
|
|
15368
|
-
async function _handleRequest
|
|
15531
|
+
async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
|
|
15369
15532
|
return new Promise((resolve, reject) => {
|
|
15370
|
-
fetcher(url, _getRequestParams
|
|
15533
|
+
fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
|
|
15371
15534
|
if (!result.ok) throw result;
|
|
15372
15535
|
if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
|
|
15536
|
+
if (namespace === "vectors") {
|
|
15537
|
+
const contentType = result.headers.get("content-type");
|
|
15538
|
+
if (result.headers.get("content-length") === "0" || result.status === 204) return {};
|
|
15539
|
+
if (!contentType || !contentType.includes("application/json")) return {};
|
|
15540
|
+
}
|
|
15373
15541
|
return result.json();
|
|
15374
|
-
}).then((data) => resolve(data)).catch((error) => handleError
|
|
15542
|
+
}).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
|
|
15375
15543
|
});
|
|
15376
15544
|
}
|
|
15377
|
-
|
|
15378
|
-
return
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15545
|
+
function createFetchApi(namespace = "storage") {
|
|
15546
|
+
return {
|
|
15547
|
+
get: async (fetcher, url, options, parameters) => {
|
|
15548
|
+
return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
|
|
15549
|
+
},
|
|
15550
|
+
post: async (fetcher, url, body, options, parameters) => {
|
|
15551
|
+
return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
|
|
15552
|
+
},
|
|
15553
|
+
put: async (fetcher, url, body, options, parameters) => {
|
|
15554
|
+
return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
|
|
15555
|
+
},
|
|
15556
|
+
head: async (fetcher, url, options, parameters) => {
|
|
15557
|
+
return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
|
|
15558
|
+
},
|
|
15559
|
+
remove: async (fetcher, url, body, options, parameters) => {
|
|
15560
|
+
return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
|
|
15561
|
+
}
|
|
15562
|
+
};
|
|
15391
15563
|
}
|
|
15392
|
-
var
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15564
|
+
var defaultApi = createFetchApi("storage");
|
|
15565
|
+
var { get, post, put, head, remove } = defaultApi;
|
|
15566
|
+
var vectorsApi = createFetchApi("vectors");
|
|
15567
|
+
var BaseApiClient = class {
|
|
15568
|
+
/**
|
|
15569
|
+
* Creates a new BaseApiClient instance
|
|
15570
|
+
* @param url - Base URL for API requests
|
|
15571
|
+
* @param headers - Default headers for API requests
|
|
15572
|
+
* @param fetch - Optional custom fetch implementation
|
|
15573
|
+
* @param namespace - Error namespace ('storage' or 'vectors')
|
|
15574
|
+
*/
|
|
15575
|
+
constructor(url, headers = {}, fetch$1, namespace = "storage") {
|
|
15576
|
+
this.shouldThrowOnError = false;
|
|
15577
|
+
this.url = url;
|
|
15578
|
+
this.headers = headers;
|
|
15579
|
+
this.fetch = resolveFetch2(fetch$1);
|
|
15580
|
+
this.namespace = namespace;
|
|
15581
|
+
}
|
|
15582
|
+
/**
|
|
15583
|
+
* Enable throwing errors instead of returning them.
|
|
15584
|
+
* When enabled, errors are thrown instead of returned in { data, error } format.
|
|
15585
|
+
*
|
|
15586
|
+
* @returns this - For method chaining
|
|
15587
|
+
*/
|
|
15588
|
+
throwOnError() {
|
|
15589
|
+
this.shouldThrowOnError = true;
|
|
15590
|
+
return this;
|
|
15591
|
+
}
|
|
15592
|
+
/**
|
|
15593
|
+
* Handles API operation with standardized error handling
|
|
15594
|
+
* Eliminates repetitive try-catch blocks across all API methods
|
|
15595
|
+
*
|
|
15596
|
+
* This wrapper:
|
|
15597
|
+
* 1. Executes the operation
|
|
15598
|
+
* 2. Returns { data, error: null } on success
|
|
15599
|
+
* 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
|
|
15600
|
+
* 4. Throws error on failure (if shouldThrowOnError is true)
|
|
15601
|
+
*
|
|
15602
|
+
* @typeParam T - The expected data type from the operation
|
|
15603
|
+
* @param operation - Async function that performs the API call
|
|
15604
|
+
* @returns Promise with { data, error } tuple
|
|
15605
|
+
*
|
|
15606
|
+
* @example
|
|
15607
|
+
* ```typescript
|
|
15608
|
+
* async listBuckets() {
|
|
15609
|
+
* return this.handleOperation(async () => {
|
|
15610
|
+
* return await get(this.fetch, `${this.url}/bucket`, {
|
|
15611
|
+
* headers: this.headers,
|
|
15612
|
+
* })
|
|
15613
|
+
* })
|
|
15614
|
+
* }
|
|
15615
|
+
* ```
|
|
15616
|
+
*/
|
|
15617
|
+
async handleOperation(operation) {
|
|
15618
|
+
var _this = this;
|
|
15619
|
+
try {
|
|
15620
|
+
return {
|
|
15621
|
+
data: await operation(),
|
|
15622
|
+
error: null
|
|
15623
|
+
};
|
|
15624
|
+
} catch (error) {
|
|
15625
|
+
if (_this.shouldThrowOnError) throw error;
|
|
15626
|
+
if (isStorageError(error)) return {
|
|
15627
|
+
data: null,
|
|
15628
|
+
error
|
|
15629
|
+
};
|
|
15630
|
+
throw error;
|
|
15631
|
+
}
|
|
15632
|
+
}
|
|
15633
|
+
};
|
|
15634
|
+
var StreamDownloadBuilder = class {
|
|
15635
|
+
constructor(downloadFn, shouldThrowOnError) {
|
|
15636
|
+
this.downloadFn = downloadFn;
|
|
15637
|
+
this.shouldThrowOnError = shouldThrowOnError;
|
|
15638
|
+
}
|
|
15639
|
+
then(onfulfilled, onrejected) {
|
|
15640
|
+
return this.execute().then(onfulfilled, onrejected);
|
|
15399
15641
|
}
|
|
15400
15642
|
async execute() {
|
|
15401
15643
|
var _this = this;
|
|
@@ -15469,22 +15711,10 @@ var DEFAULT_FILE_OPTIONS = {
|
|
|
15469
15711
|
contentType: "text/plain;charset=UTF-8",
|
|
15470
15712
|
upsert: false
|
|
15471
15713
|
};
|
|
15472
|
-
var StorageFileApi = class {
|
|
15714
|
+
var StorageFileApi = class extends BaseApiClient {
|
|
15473
15715
|
constructor(url, headers = {}, bucketId, fetch$1) {
|
|
15474
|
-
|
|
15475
|
-
this.url = url;
|
|
15476
|
-
this.headers = headers;
|
|
15716
|
+
super(url, headers, fetch$1, "storage");
|
|
15477
15717
|
this.bucketId = bucketId;
|
|
15478
|
-
this.fetch = resolveFetch$1(fetch$1);
|
|
15479
|
-
}
|
|
15480
|
-
/**
|
|
15481
|
-
* Enable throwing errors instead of returning them.
|
|
15482
|
-
*
|
|
15483
|
-
* @category File Buckets
|
|
15484
|
-
*/
|
|
15485
|
-
throwOnError() {
|
|
15486
|
-
this.shouldThrowOnError = true;
|
|
15487
|
-
return this;
|
|
15488
15718
|
}
|
|
15489
15719
|
/**
|
|
15490
15720
|
* Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
|
|
@@ -15495,10 +15725,10 @@ var StorageFileApi = class {
|
|
|
15495
15725
|
*/
|
|
15496
15726
|
async uploadOrUpdate(method, path, fileBody, fileOptions) {
|
|
15497
15727
|
var _this = this;
|
|
15498
|
-
|
|
15728
|
+
return _this.handleOperation(async () => {
|
|
15499
15729
|
let body;
|
|
15500
|
-
const options =
|
|
15501
|
-
let headers =
|
|
15730
|
+
const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
15731
|
+
let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
|
|
15502
15732
|
const metadata = options.metadata;
|
|
15503
15733
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
15504
15734
|
body = new FormData();
|
|
@@ -15516,26 +15746,16 @@ var StorageFileApi = class {
|
|
|
15516
15746
|
if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
|
|
15517
15747
|
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
15518
15748
|
}
|
|
15519
|
-
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers =
|
|
15749
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
|
|
15520
15750
|
const cleanPath = _this._removeEmptyFolders(path);
|
|
15521
15751
|
const _path = _this._getFinalPath(cleanPath);
|
|
15522
|
-
const data = await (method == "PUT" ? put : post
|
|
15752
|
+
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
|
|
15523
15753
|
return {
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
fullPath: data.Key
|
|
15528
|
-
},
|
|
15529
|
-
error: null
|
|
15530
|
-
};
|
|
15531
|
-
} catch (error) {
|
|
15532
|
-
if (_this.shouldThrowOnError) throw error;
|
|
15533
|
-
if (isStorageError(error)) return {
|
|
15534
|
-
data: null,
|
|
15535
|
-
error
|
|
15754
|
+
path: cleanPath,
|
|
15755
|
+
id: data.Id,
|
|
15756
|
+
fullPath: data.Key
|
|
15536
15757
|
};
|
|
15537
|
-
|
|
15538
|
-
}
|
|
15758
|
+
});
|
|
15539
15759
|
}
|
|
15540
15760
|
/**
|
|
15541
15761
|
* Uploads a file to an existing bucket.
|
|
@@ -15621,10 +15841,10 @@ var StorageFileApi = class {
|
|
|
15621
15841
|
const _path = _this3._getFinalPath(cleanPath);
|
|
15622
15842
|
const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
|
|
15623
15843
|
url.searchParams.set("token", token);
|
|
15624
|
-
|
|
15844
|
+
return _this3.handleOperation(async () => {
|
|
15625
15845
|
let body;
|
|
15626
|
-
const options =
|
|
15627
|
-
const headers =
|
|
15846
|
+
const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
|
|
15847
|
+
const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
15628
15848
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
15629
15849
|
body = new FormData();
|
|
15630
15850
|
body.append("cacheControl", options.cacheControl);
|
|
@@ -15638,20 +15858,10 @@ var StorageFileApi = class {
|
|
|
15638
15858
|
headers["content-type"] = options.contentType;
|
|
15639
15859
|
}
|
|
15640
15860
|
return {
|
|
15641
|
-
|
|
15642
|
-
|
|
15643
|
-
fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
|
|
15644
|
-
},
|
|
15645
|
-
error: null
|
|
15646
|
-
};
|
|
15647
|
-
} catch (error) {
|
|
15648
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
15649
|
-
if (isStorageError(error)) return {
|
|
15650
|
-
data: null,
|
|
15651
|
-
error
|
|
15861
|
+
path: cleanPath,
|
|
15862
|
+
fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
|
|
15652
15863
|
};
|
|
15653
|
-
|
|
15654
|
-
}
|
|
15864
|
+
});
|
|
15655
15865
|
}
|
|
15656
15866
|
/**
|
|
15657
15867
|
* Creates a signed upload URL.
|
|
@@ -15685,30 +15895,20 @@ var StorageFileApi = class {
|
|
|
15685
15895
|
*/
|
|
15686
15896
|
async createSignedUploadUrl(path, options) {
|
|
15687
15897
|
var _this4 = this;
|
|
15688
|
-
|
|
15898
|
+
return _this4.handleOperation(async () => {
|
|
15689
15899
|
let _path = _this4._getFinalPath(path);
|
|
15690
|
-
const headers =
|
|
15900
|
+
const headers = _objectSpread22({}, _this4.headers);
|
|
15691
15901
|
if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
|
|
15692
|
-
const data = await post
|
|
15902
|
+
const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
|
|
15693
15903
|
const url = new URL(_this4.url + data.url);
|
|
15694
15904
|
const token = url.searchParams.get("token");
|
|
15695
15905
|
if (!token) throw new StorageError("No token returned by API");
|
|
15696
15906
|
return {
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
token
|
|
15701
|
-
},
|
|
15702
|
-
error: null
|
|
15907
|
+
signedUrl: url.toString(),
|
|
15908
|
+
path,
|
|
15909
|
+
token
|
|
15703
15910
|
};
|
|
15704
|
-
}
|
|
15705
|
-
if (_this4.shouldThrowOnError) throw error;
|
|
15706
|
-
if (isStorageError(error)) return {
|
|
15707
|
-
data: null,
|
|
15708
|
-
error
|
|
15709
|
-
};
|
|
15710
|
-
throw error;
|
|
15711
|
-
}
|
|
15911
|
+
});
|
|
15712
15912
|
}
|
|
15713
15913
|
/**
|
|
15714
15914
|
* Replaces an existing file at the specified path with a new one.
|
|
@@ -15786,24 +15986,14 @@ var StorageFileApi = class {
|
|
|
15786
15986
|
*/
|
|
15787
15987
|
async move(fromPath, toPath, options) {
|
|
15788
15988
|
var _this6 = this;
|
|
15789
|
-
|
|
15790
|
-
return {
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
error: null
|
|
15798
|
-
};
|
|
15799
|
-
} catch (error) {
|
|
15800
|
-
if (_this6.shouldThrowOnError) throw error;
|
|
15801
|
-
if (isStorageError(error)) return {
|
|
15802
|
-
data: null,
|
|
15803
|
-
error
|
|
15804
|
-
};
|
|
15805
|
-
throw error;
|
|
15806
|
-
}
|
|
15989
|
+
return _this6.handleOperation(async () => {
|
|
15990
|
+
return await post(_this6.fetch, `${_this6.url}/object/move`, {
|
|
15991
|
+
bucketId: _this6.bucketId,
|
|
15992
|
+
sourceKey: fromPath,
|
|
15993
|
+
destinationKey: toPath,
|
|
15994
|
+
destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
|
|
15995
|
+
}, { headers: _this6.headers });
|
|
15996
|
+
});
|
|
15807
15997
|
}
|
|
15808
15998
|
/**
|
|
15809
15999
|
* Copies an existing file to a new path in the same bucket.
|
|
@@ -15834,24 +16024,14 @@ var StorageFileApi = class {
|
|
|
15834
16024
|
*/
|
|
15835
16025
|
async copy(fromPath, toPath, options) {
|
|
15836
16026
|
var _this7 = this;
|
|
15837
|
-
|
|
15838
|
-
return {
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
error: null
|
|
15846
|
-
};
|
|
15847
|
-
} catch (error) {
|
|
15848
|
-
if (_this7.shouldThrowOnError) throw error;
|
|
15849
|
-
if (isStorageError(error)) return {
|
|
15850
|
-
data: null,
|
|
15851
|
-
error
|
|
15852
|
-
};
|
|
15853
|
-
throw error;
|
|
15854
|
-
}
|
|
16027
|
+
return _this7.handleOperation(async () => {
|
|
16028
|
+
return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
|
|
16029
|
+
bucketId: _this7.bucketId,
|
|
16030
|
+
sourceKey: fromPath,
|
|
16031
|
+
destinationKey: toPath,
|
|
16032
|
+
destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
|
|
16033
|
+
}, { headers: _this7.headers })).Key };
|
|
16034
|
+
});
|
|
15855
16035
|
}
|
|
15856
16036
|
/**
|
|
15857
16037
|
* Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
|
|
@@ -15906,23 +16086,12 @@ var StorageFileApi = class {
|
|
|
15906
16086
|
*/
|
|
15907
16087
|
async createSignedUrl(path, expiresIn, options) {
|
|
15908
16088
|
var _this8 = this;
|
|
15909
|
-
|
|
16089
|
+
return _this8.handleOperation(async () => {
|
|
15910
16090
|
let _path = _this8._getFinalPath(path);
|
|
15911
|
-
let data = await post
|
|
16091
|
+
let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread22({ expiresIn }, (options === null || options === void 0 ? void 0 : options.transform) ? { transform: options.transform } : {}), { headers: _this8.headers });
|
|
15912
16092
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
data,
|
|
15916
|
-
error: null
|
|
15917
|
-
};
|
|
15918
|
-
} catch (error) {
|
|
15919
|
-
if (_this8.shouldThrowOnError) throw error;
|
|
15920
|
-
if (isStorageError(error)) return {
|
|
15921
|
-
data: null,
|
|
15922
|
-
error
|
|
15923
|
-
};
|
|
15924
|
-
throw error;
|
|
15925
|
-
}
|
|
16093
|
+
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
|
|
16094
|
+
});
|
|
15926
16095
|
}
|
|
15927
16096
|
/**
|
|
15928
16097
|
* Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
|
|
@@ -15964,24 +16133,14 @@ var StorageFileApi = class {
|
|
|
15964
16133
|
*/
|
|
15965
16134
|
async createSignedUrls(paths, expiresIn, options) {
|
|
15966
16135
|
var _this9 = this;
|
|
15967
|
-
|
|
15968
|
-
const data = await post
|
|
16136
|
+
return _this9.handleOperation(async () => {
|
|
16137
|
+
const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
|
|
15969
16138
|
expiresIn,
|
|
15970
16139
|
paths
|
|
15971
16140
|
}, { headers: _this9.headers });
|
|
15972
16141
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
15973
|
-
return {
|
|
15974
|
-
|
|
15975
|
-
error: null
|
|
15976
|
-
};
|
|
15977
|
-
} catch (error) {
|
|
15978
|
-
if (_this9.shouldThrowOnError) throw error;
|
|
15979
|
-
if (isStorageError(error)) return {
|
|
15980
|
-
data: null,
|
|
15981
|
-
error
|
|
15982
|
-
};
|
|
15983
|
-
throw error;
|
|
15984
|
-
}
|
|
16142
|
+
return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
|
|
16143
|
+
});
|
|
15985
16144
|
}
|
|
15986
16145
|
/**
|
|
15987
16146
|
* Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
|
|
@@ -15989,6 +16148,7 @@ var StorageFileApi = class {
|
|
|
15989
16148
|
* @category File Buckets
|
|
15990
16149
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
15991
16150
|
* @param options.transform Transform the asset before serving it to the client.
|
|
16151
|
+
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
15992
16152
|
* @returns BlobDownloadBuilder instance for downloading the file
|
|
15993
16153
|
*
|
|
15994
16154
|
* @example Download file
|
|
@@ -16020,8 +16180,27 @@ var StorageFileApi = class {
|
|
|
16020
16180
|
* }
|
|
16021
16181
|
* })
|
|
16022
16182
|
* ```
|
|
16183
|
+
*
|
|
16184
|
+
* @example Download with cache control (useful in Edge Functions)
|
|
16185
|
+
* ```js
|
|
16186
|
+
* const { data, error } = await supabase
|
|
16187
|
+
* .storage
|
|
16188
|
+
* .from('avatars')
|
|
16189
|
+
* .download('folder/avatar1.png', {}, { cache: 'no-store' })
|
|
16190
|
+
* ```
|
|
16191
|
+
*
|
|
16192
|
+
* @example Download with abort signal
|
|
16193
|
+
* ```js
|
|
16194
|
+
* const controller = new AbortController()
|
|
16195
|
+
* setTimeout(() => controller.abort(), 5000)
|
|
16196
|
+
*
|
|
16197
|
+
* const { data, error } = await supabase
|
|
16198
|
+
* .storage
|
|
16199
|
+
* .from('avatars')
|
|
16200
|
+
* .download('folder/avatar1.png', {}, { signal: controller.signal })
|
|
16201
|
+
* ```
|
|
16023
16202
|
*/
|
|
16024
|
-
download(path, options) {
|
|
16203
|
+
download(path, options, parameters) {
|
|
16025
16204
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
|
|
16026
16205
|
const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
|
|
16027
16206
|
const queryString = transformationQuery ? `?${transformationQuery}` : "";
|
|
@@ -16029,7 +16208,7 @@ var StorageFileApi = class {
|
|
|
16029
16208
|
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
|
|
16030
16209
|
headers: this.headers,
|
|
16031
16210
|
noResolveJson: true
|
|
16032
|
-
});
|
|
16211
|
+
}, parameters);
|
|
16033
16212
|
return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
|
|
16034
16213
|
}
|
|
16035
16214
|
/**
|
|
@@ -16050,19 +16229,9 @@ var StorageFileApi = class {
|
|
|
16050
16229
|
async info(path) {
|
|
16051
16230
|
var _this10 = this;
|
|
16052
16231
|
const _path = _this10._getFinalPath(path);
|
|
16053
|
-
|
|
16054
|
-
return {
|
|
16055
|
-
|
|
16056
|
-
error: null
|
|
16057
|
-
};
|
|
16058
|
-
} catch (error) {
|
|
16059
|
-
if (_this10.shouldThrowOnError) throw error;
|
|
16060
|
-
if (isStorageError(error)) return {
|
|
16061
|
-
data: null,
|
|
16062
|
-
error
|
|
16063
|
-
};
|
|
16064
|
-
throw error;
|
|
16065
|
-
}
|
|
16232
|
+
return _this10.handleOperation(async () => {
|
|
16233
|
+
return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
|
|
16234
|
+
});
|
|
16066
16235
|
}
|
|
16067
16236
|
/**
|
|
16068
16237
|
* Checks the existence of a file.
|
|
@@ -16187,19 +16356,9 @@ var StorageFileApi = class {
|
|
|
16187
16356
|
*/
|
|
16188
16357
|
async remove(paths) {
|
|
16189
16358
|
var _this12 = this;
|
|
16190
|
-
|
|
16191
|
-
return {
|
|
16192
|
-
|
|
16193
|
-
error: null
|
|
16194
|
-
};
|
|
16195
|
-
} catch (error) {
|
|
16196
|
-
if (_this12.shouldThrowOnError) throw error;
|
|
16197
|
-
if (isStorageError(error)) return {
|
|
16198
|
-
data: null,
|
|
16199
|
-
error
|
|
16200
|
-
};
|
|
16201
|
-
throw error;
|
|
16202
|
-
}
|
|
16359
|
+
return _this12.handleOperation(async () => {
|
|
16360
|
+
return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
|
|
16361
|
+
});
|
|
16203
16362
|
}
|
|
16204
16363
|
/**
|
|
16205
16364
|
* Get file metadata
|
|
@@ -16271,20 +16430,10 @@ var StorageFileApi = class {
|
|
|
16271
16430
|
*/
|
|
16272
16431
|
async list(path, options, parameters) {
|
|
16273
16432
|
var _this13 = this;
|
|
16274
|
-
|
|
16275
|
-
const body =
|
|
16276
|
-
return {
|
|
16277
|
-
|
|
16278
|
-
error: null
|
|
16279
|
-
};
|
|
16280
|
-
} catch (error) {
|
|
16281
|
-
if (_this13.shouldThrowOnError) throw error;
|
|
16282
|
-
if (isStorageError(error)) return {
|
|
16283
|
-
data: null,
|
|
16284
|
-
error
|
|
16285
|
-
};
|
|
16286
|
-
throw error;
|
|
16287
|
-
}
|
|
16433
|
+
return _this13.handleOperation(async () => {
|
|
16434
|
+
const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
|
|
16435
|
+
return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
|
|
16436
|
+
});
|
|
16288
16437
|
}
|
|
16289
16438
|
/**
|
|
16290
16439
|
* @experimental this method signature might change in the future
|
|
@@ -16295,20 +16444,10 @@ var StorageFileApi = class {
|
|
|
16295
16444
|
*/
|
|
16296
16445
|
async listV2(options, parameters) {
|
|
16297
16446
|
var _this14 = this;
|
|
16298
|
-
|
|
16299
|
-
const body =
|
|
16300
|
-
return {
|
|
16301
|
-
|
|
16302
|
-
error: null
|
|
16303
|
-
};
|
|
16304
|
-
} catch (error) {
|
|
16305
|
-
if (_this14.shouldThrowOnError) throw error;
|
|
16306
|
-
if (isStorageError(error)) return {
|
|
16307
|
-
data: null,
|
|
16308
|
-
error
|
|
16309
|
-
};
|
|
16310
|
-
throw error;
|
|
16311
|
-
}
|
|
16447
|
+
return _this14.handleOperation(async () => {
|
|
16448
|
+
const body = _objectSpread22({}, options);
|
|
16449
|
+
return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
|
|
16450
|
+
});
|
|
16312
16451
|
}
|
|
16313
16452
|
encodeMetadata(metadata) {
|
|
16314
16453
|
return JSON.stringify(metadata);
|
|
@@ -16333,27 +16472,17 @@ var StorageFileApi = class {
|
|
|
16333
16472
|
return params.join("&");
|
|
16334
16473
|
}
|
|
16335
16474
|
};
|
|
16336
|
-
var version2 = "2.
|
|
16337
|
-
var DEFAULT_HEADERS
|
|
16338
|
-
var StorageBucketApi = class {
|
|
16475
|
+
var version2 = "2.95.1";
|
|
16476
|
+
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
16477
|
+
var StorageBucketApi = class extends BaseApiClient {
|
|
16339
16478
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
16340
|
-
this.shouldThrowOnError = false;
|
|
16341
16479
|
const baseUrl = new URL(url);
|
|
16342
16480
|
if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
|
|
16343
16481
|
if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
|
|
16344
16482
|
}
|
|
16345
|
-
|
|
16346
|
-
|
|
16347
|
-
|
|
16348
|
-
}
|
|
16349
|
-
/**
|
|
16350
|
-
* Enable throwing errors instead of returning them.
|
|
16351
|
-
*
|
|
16352
|
-
* @category File Buckets
|
|
16353
|
-
*/
|
|
16354
|
-
throwOnError() {
|
|
16355
|
-
this.shouldThrowOnError = true;
|
|
16356
|
-
return this;
|
|
16483
|
+
const finalUrl = baseUrl.href.replace(/\/$/, "");
|
|
16484
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
16485
|
+
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
16357
16486
|
}
|
|
16358
16487
|
/**
|
|
16359
16488
|
* Retrieves the details of all Storage buckets within an existing project.
|
|
@@ -16389,20 +16518,10 @@ var StorageBucketApi = class {
|
|
|
16389
16518
|
*/
|
|
16390
16519
|
async listBuckets(options) {
|
|
16391
16520
|
var _this = this;
|
|
16392
|
-
|
|
16521
|
+
return _this.handleOperation(async () => {
|
|
16393
16522
|
const queryString = _this.listBucketOptionsToQueryString(options);
|
|
16394
|
-
return {
|
|
16395
|
-
|
|
16396
|
-
error: null
|
|
16397
|
-
};
|
|
16398
|
-
} catch (error) {
|
|
16399
|
-
if (_this.shouldThrowOnError) throw error;
|
|
16400
|
-
if (isStorageError(error)) return {
|
|
16401
|
-
data: null,
|
|
16402
|
-
error
|
|
16403
|
-
};
|
|
16404
|
-
throw error;
|
|
16405
|
-
}
|
|
16523
|
+
return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
|
|
16524
|
+
});
|
|
16406
16525
|
}
|
|
16407
16526
|
/**
|
|
16408
16527
|
* Retrieves the details of an existing Storage bucket.
|
|
@@ -16439,19 +16558,9 @@ var StorageBucketApi = class {
|
|
|
16439
16558
|
*/
|
|
16440
16559
|
async getBucket(id) {
|
|
16441
16560
|
var _this2 = this;
|
|
16442
|
-
|
|
16443
|
-
return {
|
|
16444
|
-
|
|
16445
|
-
error: null
|
|
16446
|
-
};
|
|
16447
|
-
} catch (error) {
|
|
16448
|
-
if (_this2.shouldThrowOnError) throw error;
|
|
16449
|
-
if (isStorageError(error)) return {
|
|
16450
|
-
data: null,
|
|
16451
|
-
error
|
|
16452
|
-
};
|
|
16453
|
-
throw error;
|
|
16454
|
-
}
|
|
16561
|
+
return _this2.handleOperation(async () => {
|
|
16562
|
+
return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
|
|
16563
|
+
});
|
|
16455
16564
|
}
|
|
16456
16565
|
/**
|
|
16457
16566
|
* Creates a new Storage bucket
|
|
@@ -16492,26 +16601,16 @@ var StorageBucketApi = class {
|
|
|
16492
16601
|
*/
|
|
16493
16602
|
async createBucket(id, options = { public: false }) {
|
|
16494
16603
|
var _this3 = this;
|
|
16495
|
-
|
|
16496
|
-
return {
|
|
16497
|
-
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
error: null
|
|
16506
|
-
};
|
|
16507
|
-
} catch (error) {
|
|
16508
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
16509
|
-
if (isStorageError(error)) return {
|
|
16510
|
-
data: null,
|
|
16511
|
-
error
|
|
16512
|
-
};
|
|
16513
|
-
throw error;
|
|
16514
|
-
}
|
|
16604
|
+
return _this3.handleOperation(async () => {
|
|
16605
|
+
return await post(_this3.fetch, `${_this3.url}/bucket`, {
|
|
16606
|
+
id,
|
|
16607
|
+
name: id,
|
|
16608
|
+
type: options.type,
|
|
16609
|
+
public: options.public,
|
|
16610
|
+
file_size_limit: options.fileSizeLimit,
|
|
16611
|
+
allowed_mime_types: options.allowedMimeTypes
|
|
16612
|
+
}, { headers: _this3.headers });
|
|
16613
|
+
});
|
|
16515
16614
|
}
|
|
16516
16615
|
/**
|
|
16517
16616
|
* Updates a Storage bucket
|
|
@@ -16550,25 +16649,15 @@ var StorageBucketApi = class {
|
|
|
16550
16649
|
*/
|
|
16551
16650
|
async updateBucket(id, options) {
|
|
16552
16651
|
var _this4 = this;
|
|
16553
|
-
|
|
16554
|
-
return {
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
error: null
|
|
16563
|
-
};
|
|
16564
|
-
} catch (error) {
|
|
16565
|
-
if (_this4.shouldThrowOnError) throw error;
|
|
16566
|
-
if (isStorageError(error)) return {
|
|
16567
|
-
data: null,
|
|
16568
|
-
error
|
|
16569
|
-
};
|
|
16570
|
-
throw error;
|
|
16571
|
-
}
|
|
16652
|
+
return _this4.handleOperation(async () => {
|
|
16653
|
+
return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
|
|
16654
|
+
id,
|
|
16655
|
+
name: id,
|
|
16656
|
+
public: options.public,
|
|
16657
|
+
file_size_limit: options.fileSizeLimit,
|
|
16658
|
+
allowed_mime_types: options.allowedMimeTypes
|
|
16659
|
+
}, { headers: _this4.headers });
|
|
16660
|
+
});
|
|
16572
16661
|
}
|
|
16573
16662
|
/**
|
|
16574
16663
|
* Removes all objects inside a single bucket.
|
|
@@ -16596,19 +16685,9 @@ var StorageBucketApi = class {
|
|
|
16596
16685
|
*/
|
|
16597
16686
|
async emptyBucket(id) {
|
|
16598
16687
|
var _this5 = this;
|
|
16599
|
-
|
|
16600
|
-
return {
|
|
16601
|
-
|
|
16602
|
-
error: null
|
|
16603
|
-
};
|
|
16604
|
-
} catch (error) {
|
|
16605
|
-
if (_this5.shouldThrowOnError) throw error;
|
|
16606
|
-
if (isStorageError(error)) return {
|
|
16607
|
-
data: null,
|
|
16608
|
-
error
|
|
16609
|
-
};
|
|
16610
|
-
throw error;
|
|
16611
|
-
}
|
|
16688
|
+
return _this5.handleOperation(async () => {
|
|
16689
|
+
return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
|
|
16690
|
+
});
|
|
16612
16691
|
}
|
|
16613
16692
|
/**
|
|
16614
16693
|
* Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
|
|
@@ -16637,19 +16716,9 @@ var StorageBucketApi = class {
|
|
|
16637
16716
|
*/
|
|
16638
16717
|
async deleteBucket(id) {
|
|
16639
16718
|
var _this6 = this;
|
|
16640
|
-
|
|
16641
|
-
return {
|
|
16642
|
-
|
|
16643
|
-
error: null
|
|
16644
|
-
};
|
|
16645
|
-
} catch (error) {
|
|
16646
|
-
if (_this6.shouldThrowOnError) throw error;
|
|
16647
|
-
if (isStorageError(error)) return {
|
|
16648
|
-
data: null,
|
|
16649
|
-
error
|
|
16650
|
-
};
|
|
16651
|
-
throw error;
|
|
16652
|
-
}
|
|
16719
|
+
return _this6.handleOperation(async () => {
|
|
16720
|
+
return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
|
|
16721
|
+
});
|
|
16653
16722
|
}
|
|
16654
16723
|
listBucketOptionsToQueryString(options) {
|
|
16655
16724
|
const params = {};
|
|
@@ -16663,7 +16732,7 @@ var StorageBucketApi = class {
|
|
|
16663
16732
|
return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
|
|
16664
16733
|
}
|
|
16665
16734
|
};
|
|
16666
|
-
var StorageAnalyticsClient = class {
|
|
16735
|
+
var StorageAnalyticsClient = class extends BaseApiClient {
|
|
16667
16736
|
/**
|
|
16668
16737
|
* @alpha
|
|
16669
16738
|
*
|
|
@@ -16682,25 +16751,9 @@ var StorageAnalyticsClient = class {
|
|
|
16682
16751
|
* ```
|
|
16683
16752
|
*/
|
|
16684
16753
|
constructor(url, headers = {}, fetch$1) {
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
|
|
16688
|
-
this.fetch = resolveFetch$1(fetch$1);
|
|
16689
|
-
}
|
|
16690
|
-
/**
|
|
16691
|
-
* @alpha
|
|
16692
|
-
*
|
|
16693
|
-
* Enable throwing errors instead of returning them in the response
|
|
16694
|
-
* When enabled, failed operations will throw instead of returning { data: null, error }
|
|
16695
|
-
*
|
|
16696
|
-
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
16697
|
-
*
|
|
16698
|
-
* @category Analytics Buckets
|
|
16699
|
-
* @returns This instance for method chaining
|
|
16700
|
-
*/
|
|
16701
|
-
throwOnError() {
|
|
16702
|
-
this.shouldThrowOnError = true;
|
|
16703
|
-
return this;
|
|
16754
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
16755
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
16756
|
+
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
16704
16757
|
}
|
|
16705
16758
|
/**
|
|
16706
16759
|
* @alpha
|
|
@@ -16738,19 +16791,9 @@ var StorageAnalyticsClient = class {
|
|
|
16738
16791
|
*/
|
|
16739
16792
|
async createBucket(name) {
|
|
16740
16793
|
var _this = this;
|
|
16741
|
-
|
|
16742
|
-
return {
|
|
16743
|
-
|
|
16744
|
-
error: null
|
|
16745
|
-
};
|
|
16746
|
-
} catch (error) {
|
|
16747
|
-
if (_this.shouldThrowOnError) throw error;
|
|
16748
|
-
if (isStorageError(error)) return {
|
|
16749
|
-
data: null,
|
|
16750
|
-
error
|
|
16751
|
-
};
|
|
16752
|
-
throw error;
|
|
16753
|
-
}
|
|
16794
|
+
return _this.handleOperation(async () => {
|
|
16795
|
+
return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
|
|
16796
|
+
});
|
|
16754
16797
|
}
|
|
16755
16798
|
/**
|
|
16756
16799
|
* @alpha
|
|
@@ -16800,7 +16843,7 @@ var StorageAnalyticsClient = class {
|
|
|
16800
16843
|
*/
|
|
16801
16844
|
async listBuckets(options) {
|
|
16802
16845
|
var _this2 = this;
|
|
16803
|
-
|
|
16846
|
+
return _this2.handleOperation(async () => {
|
|
16804
16847
|
const queryParams = new URLSearchParams();
|
|
16805
16848
|
if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
|
|
16806
16849
|
if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
|
|
@@ -16809,18 +16852,8 @@ var StorageAnalyticsClient = class {
|
|
|
16809
16852
|
if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
|
|
16810
16853
|
const queryString = queryParams.toString();
|
|
16811
16854
|
const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
|
|
16812
|
-
return {
|
|
16813
|
-
|
|
16814
|
-
error: null
|
|
16815
|
-
};
|
|
16816
|
-
} catch (error) {
|
|
16817
|
-
if (_this2.shouldThrowOnError) throw error;
|
|
16818
|
-
if (isStorageError(error)) return {
|
|
16819
|
-
data: null,
|
|
16820
|
-
error
|
|
16821
|
-
};
|
|
16822
|
-
throw error;
|
|
16823
|
-
}
|
|
16855
|
+
return await get(_this2.fetch, url, { headers: _this2.headers });
|
|
16856
|
+
});
|
|
16824
16857
|
}
|
|
16825
16858
|
/**
|
|
16826
16859
|
* @alpha
|
|
@@ -16855,19 +16888,9 @@ var StorageAnalyticsClient = class {
|
|
|
16855
16888
|
*/
|
|
16856
16889
|
async deleteBucket(bucketName) {
|
|
16857
16890
|
var _this3 = this;
|
|
16858
|
-
|
|
16859
|
-
return {
|
|
16860
|
-
|
|
16861
|
-
error: null
|
|
16862
|
-
};
|
|
16863
|
-
} catch (error) {
|
|
16864
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
16865
|
-
if (isStorageError(error)) return {
|
|
16866
|
-
data: null,
|
|
16867
|
-
error
|
|
16868
|
-
};
|
|
16869
|
-
throw error;
|
|
16870
|
-
}
|
|
16891
|
+
return _this3.handleOperation(async () => {
|
|
16892
|
+
return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
|
|
16893
|
+
});
|
|
16871
16894
|
}
|
|
16872
16895
|
/**
|
|
16873
16896
|
* @alpha
|
|
@@ -17001,395 +17024,157 @@ var StorageAnalyticsClient = class {
|
|
|
17001
17024
|
auth: {
|
|
17002
17025
|
type: "custom",
|
|
17003
17026
|
getHeaders: async () => _this4.headers
|
|
17004
|
-
},
|
|
17005
|
-
fetch: this.fetch
|
|
17006
|
-
});
|
|
17007
|
-
const shouldThrowOnError = this.shouldThrowOnError;
|
|
17008
|
-
return new Proxy(catalog, { get(target, prop) {
|
|
17009
|
-
const value = target[prop];
|
|
17010
|
-
if (typeof value !== "function") return value;
|
|
17011
|
-
return async (...args) => {
|
|
17012
|
-
try {
|
|
17013
|
-
return {
|
|
17014
|
-
data: await value.apply(target, args),
|
|
17015
|
-
error: null
|
|
17016
|
-
};
|
|
17017
|
-
} catch (error) {
|
|
17018
|
-
if (shouldThrowOnError) throw error;
|
|
17019
|
-
return {
|
|
17020
|
-
data: null,
|
|
17021
|
-
error
|
|
17022
|
-
};
|
|
17023
|
-
}
|
|
17024
|
-
};
|
|
17025
|
-
} });
|
|
17026
|
-
}
|
|
17027
|
-
};
|
|
17028
|
-
var DEFAULT_HEADERS = {
|
|
17029
|
-
"X-Client-Info": `storage-js/${version2}`,
|
|
17030
|
-
"Content-Type": "application/json"
|
|
17031
|
-
};
|
|
17032
|
-
var StorageVectorsError = class extends Error {
|
|
17033
|
-
constructor(message) {
|
|
17034
|
-
super(message);
|
|
17035
|
-
this.__isStorageVectorsError = true;
|
|
17036
|
-
this.name = "StorageVectorsError";
|
|
17037
|
-
}
|
|
17038
|
-
};
|
|
17039
|
-
function isStorageVectorsError(error) {
|
|
17040
|
-
return typeof error === "object" && error !== null && "__isStorageVectorsError" in error;
|
|
17041
|
-
}
|
|
17042
|
-
var StorageVectorsApiError = class extends StorageVectorsError {
|
|
17043
|
-
constructor(message, status, statusCode) {
|
|
17044
|
-
super(message);
|
|
17045
|
-
this.name = "StorageVectorsApiError";
|
|
17046
|
-
this.status = status;
|
|
17047
|
-
this.statusCode = statusCode;
|
|
17048
|
-
}
|
|
17049
|
-
toJSON() {
|
|
17050
|
-
return {
|
|
17051
|
-
name: this.name,
|
|
17052
|
-
message: this.message,
|
|
17053
|
-
status: this.status,
|
|
17054
|
-
statusCode: this.statusCode
|
|
17055
|
-
};
|
|
17056
|
-
}
|
|
17057
|
-
};
|
|
17058
|
-
var StorageVectorsUnknownError = class extends StorageVectorsError {
|
|
17059
|
-
constructor(message, originalError) {
|
|
17060
|
-
super(message);
|
|
17061
|
-
this.name = "StorageVectorsUnknownError";
|
|
17062
|
-
this.originalError = originalError;
|
|
17063
|
-
}
|
|
17064
|
-
};
|
|
17065
|
-
var resolveFetch2 = (customFetch) => {
|
|
17066
|
-
if (customFetch) return (...args) => customFetch(...args);
|
|
17067
|
-
return (...args) => fetch(...args);
|
|
17068
|
-
};
|
|
17069
|
-
var isPlainObject = (value) => {
|
|
17070
|
-
if (typeof value !== "object" || value === null) return false;
|
|
17071
|
-
const prototype = Object.getPrototypeOf(value);
|
|
17072
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
17073
|
-
};
|
|
17074
|
-
var _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
|
|
17075
|
-
var handleError = async (error, reject, options) => {
|
|
17076
|
-
if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
|
|
17077
|
-
const status = error.status || 500;
|
|
17078
|
-
const responseError = error;
|
|
17079
|
-
if (typeof responseError.json === "function") responseError.json().then((err) => {
|
|
17080
|
-
const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
|
|
17081
|
-
reject(new StorageVectorsApiError(_getErrorMessage(err), status, statusCode));
|
|
17082
|
-
}).catch(() => {
|
|
17083
|
-
const statusCode = status + "";
|
|
17084
|
-
reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
|
|
17027
|
+
},
|
|
17028
|
+
fetch: this.fetch
|
|
17085
17029
|
});
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
|
|
17097
|
-
|
|
17098
|
-
|
|
17099
|
-
|
|
17100
|
-
|
|
17101
|
-
|
|
17102
|
-
|
|
17030
|
+
const shouldThrowOnError = this.shouldThrowOnError;
|
|
17031
|
+
return new Proxy(catalog, { get(target, prop) {
|
|
17032
|
+
const value = target[prop];
|
|
17033
|
+
if (typeof value !== "function") return value;
|
|
17034
|
+
return async (...args) => {
|
|
17035
|
+
try {
|
|
17036
|
+
return {
|
|
17037
|
+
data: await value.apply(target, args),
|
|
17038
|
+
error: null
|
|
17039
|
+
};
|
|
17040
|
+
} catch (error) {
|
|
17041
|
+
if (shouldThrowOnError) throw error;
|
|
17042
|
+
return {
|
|
17043
|
+
data: null,
|
|
17044
|
+
error
|
|
17045
|
+
};
|
|
17046
|
+
}
|
|
17047
|
+
};
|
|
17048
|
+
} });
|
|
17049
|
+
}
|
|
17103
17050
|
};
|
|
17104
|
-
|
|
17105
|
-
return new Promise((resolve, reject) => {
|
|
17106
|
-
fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
|
|
17107
|
-
if (!result.ok) throw result;
|
|
17108
|
-
if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
|
|
17109
|
-
const contentType = result.headers.get("content-type");
|
|
17110
|
-
if (!contentType || !contentType.includes("application/json")) return {};
|
|
17111
|
-
return result.json();
|
|
17112
|
-
}).then((data) => resolve(data)).catch((error) => handleError(error, reject, options));
|
|
17113
|
-
});
|
|
17114
|
-
}
|
|
17115
|
-
async function post(fetcher, url, body, options, parameters) {
|
|
17116
|
-
return _handleRequest(fetcher, "POST", url, options, parameters, body);
|
|
17117
|
-
}
|
|
17118
|
-
var VectorIndexApi = class {
|
|
17051
|
+
var VectorIndexApi = class extends BaseApiClient {
|
|
17119
17052
|
/** Creates a new VectorIndexApi instance */
|
|
17120
17053
|
constructor(url, headers = {}, fetch$1) {
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
this.fetch = resolveFetch2(fetch$1);
|
|
17125
|
-
}
|
|
17126
|
-
/** Enable throwing errors instead of returning them in the response */
|
|
17127
|
-
throwOnError() {
|
|
17128
|
-
this.shouldThrowOnError = true;
|
|
17129
|
-
return this;
|
|
17054
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
17055
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
17056
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
17130
17057
|
}
|
|
17131
17058
|
/** Creates a new vector index within a bucket */
|
|
17132
17059
|
async createIndex(options) {
|
|
17133
17060
|
var _this = this;
|
|
17134
|
-
|
|
17135
|
-
return {
|
|
17136
|
-
|
|
17137
|
-
error: null
|
|
17138
|
-
};
|
|
17139
|
-
} catch (error) {
|
|
17140
|
-
if (_this.shouldThrowOnError) throw error;
|
|
17141
|
-
if (isStorageVectorsError(error)) return {
|
|
17142
|
-
data: null,
|
|
17143
|
-
error
|
|
17144
|
-
};
|
|
17145
|
-
throw error;
|
|
17146
|
-
}
|
|
17061
|
+
return _this.handleOperation(async () => {
|
|
17062
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
17063
|
+
});
|
|
17147
17064
|
}
|
|
17148
17065
|
/** Retrieves metadata for a specific vector index */
|
|
17149
17066
|
async getIndex(vectorBucketName, indexName) {
|
|
17150
17067
|
var _this2 = this;
|
|
17151
|
-
|
|
17152
|
-
return {
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
error: null
|
|
17158
|
-
};
|
|
17159
|
-
} catch (error) {
|
|
17160
|
-
if (_this2.shouldThrowOnError) throw error;
|
|
17161
|
-
if (isStorageVectorsError(error)) return {
|
|
17162
|
-
data: null,
|
|
17163
|
-
error
|
|
17164
|
-
};
|
|
17165
|
-
throw error;
|
|
17166
|
-
}
|
|
17068
|
+
return _this2.handleOperation(async () => {
|
|
17069
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
17070
|
+
vectorBucketName,
|
|
17071
|
+
indexName
|
|
17072
|
+
}, { headers: _this2.headers });
|
|
17073
|
+
});
|
|
17167
17074
|
}
|
|
17168
17075
|
/** Lists vector indexes within a bucket with optional filtering and pagination */
|
|
17169
17076
|
async listIndexes(options) {
|
|
17170
17077
|
var _this3 = this;
|
|
17171
|
-
|
|
17172
|
-
return {
|
|
17173
|
-
|
|
17174
|
-
error: null
|
|
17175
|
-
};
|
|
17176
|
-
} catch (error) {
|
|
17177
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
17178
|
-
if (isStorageVectorsError(error)) return {
|
|
17179
|
-
data: null,
|
|
17180
|
-
error
|
|
17181
|
-
};
|
|
17182
|
-
throw error;
|
|
17183
|
-
}
|
|
17078
|
+
return _this3.handleOperation(async () => {
|
|
17079
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
17080
|
+
});
|
|
17184
17081
|
}
|
|
17185
17082
|
/** Deletes a vector index and all its data */
|
|
17186
17083
|
async deleteIndex(vectorBucketName, indexName) {
|
|
17187
17084
|
var _this4 = this;
|
|
17188
|
-
|
|
17189
|
-
return {
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
error: null
|
|
17195
|
-
};
|
|
17196
|
-
} catch (error) {
|
|
17197
|
-
if (_this4.shouldThrowOnError) throw error;
|
|
17198
|
-
if (isStorageVectorsError(error)) return {
|
|
17199
|
-
data: null,
|
|
17200
|
-
error
|
|
17201
|
-
};
|
|
17202
|
-
throw error;
|
|
17203
|
-
}
|
|
17085
|
+
return _this4.handleOperation(async () => {
|
|
17086
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
17087
|
+
vectorBucketName,
|
|
17088
|
+
indexName
|
|
17089
|
+
}, { headers: _this4.headers }) || {};
|
|
17090
|
+
});
|
|
17204
17091
|
}
|
|
17205
17092
|
};
|
|
17206
|
-
var VectorDataApi = class {
|
|
17093
|
+
var VectorDataApi = class extends BaseApiClient {
|
|
17207
17094
|
/** Creates a new VectorDataApi instance */
|
|
17208
17095
|
constructor(url, headers = {}, fetch$1) {
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
this.fetch = resolveFetch2(fetch$1);
|
|
17213
|
-
}
|
|
17214
|
-
/** Enable throwing errors instead of returning them in the response */
|
|
17215
|
-
throwOnError() {
|
|
17216
|
-
this.shouldThrowOnError = true;
|
|
17217
|
-
return this;
|
|
17096
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
17097
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
17098
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
17218
17099
|
}
|
|
17219
17100
|
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
17220
17101
|
async putVectors(options) {
|
|
17221
17102
|
var _this = this;
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
return {
|
|
17225
|
-
|
|
17226
|
-
error: null
|
|
17227
|
-
};
|
|
17228
|
-
} catch (error) {
|
|
17229
|
-
if (_this.shouldThrowOnError) throw error;
|
|
17230
|
-
if (isStorageVectorsError(error)) return {
|
|
17231
|
-
data: null,
|
|
17232
|
-
error
|
|
17233
|
-
};
|
|
17234
|
-
throw error;
|
|
17235
|
-
}
|
|
17103
|
+
if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
|
|
17104
|
+
return _this.handleOperation(async () => {
|
|
17105
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
17106
|
+
});
|
|
17236
17107
|
}
|
|
17237
17108
|
/** Retrieves vectors by their keys in batch */
|
|
17238
17109
|
async getVectors(options) {
|
|
17239
17110
|
var _this2 = this;
|
|
17240
|
-
|
|
17241
|
-
return {
|
|
17242
|
-
|
|
17243
|
-
error: null
|
|
17244
|
-
};
|
|
17245
|
-
} catch (error) {
|
|
17246
|
-
if (_this2.shouldThrowOnError) throw error;
|
|
17247
|
-
if (isStorageVectorsError(error)) return {
|
|
17248
|
-
data: null,
|
|
17249
|
-
error
|
|
17250
|
-
};
|
|
17251
|
-
throw error;
|
|
17252
|
-
}
|
|
17111
|
+
return _this2.handleOperation(async () => {
|
|
17112
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
17113
|
+
});
|
|
17253
17114
|
}
|
|
17254
17115
|
/** Lists vectors in an index with pagination */
|
|
17255
17116
|
async listVectors(options) {
|
|
17256
17117
|
var _this3 = this;
|
|
17257
|
-
|
|
17258
|
-
if (options.segmentCount
|
|
17259
|
-
|
|
17260
|
-
if (options.segmentIndex
|
|
17261
|
-
if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
|
|
17262
|
-
}
|
|
17118
|
+
if (options.segmentCount !== void 0) {
|
|
17119
|
+
if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
|
|
17120
|
+
if (options.segmentIndex !== void 0) {
|
|
17121
|
+
if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
|
|
17263
17122
|
}
|
|
17264
|
-
return {
|
|
17265
|
-
data: await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }),
|
|
17266
|
-
error: null
|
|
17267
|
-
};
|
|
17268
|
-
} catch (error) {
|
|
17269
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
17270
|
-
if (isStorageVectorsError(error)) return {
|
|
17271
|
-
data: null,
|
|
17272
|
-
error
|
|
17273
|
-
};
|
|
17274
|
-
throw error;
|
|
17275
17123
|
}
|
|
17124
|
+
return _this3.handleOperation(async () => {
|
|
17125
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
17126
|
+
});
|
|
17276
17127
|
}
|
|
17277
17128
|
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
17278
17129
|
async queryVectors(options) {
|
|
17279
17130
|
var _this4 = this;
|
|
17280
|
-
|
|
17281
|
-
return {
|
|
17282
|
-
|
|
17283
|
-
error: null
|
|
17284
|
-
};
|
|
17285
|
-
} catch (error) {
|
|
17286
|
-
if (_this4.shouldThrowOnError) throw error;
|
|
17287
|
-
if (isStorageVectorsError(error)) return {
|
|
17288
|
-
data: null,
|
|
17289
|
-
error
|
|
17290
|
-
};
|
|
17291
|
-
throw error;
|
|
17292
|
-
}
|
|
17131
|
+
return _this4.handleOperation(async () => {
|
|
17132
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
17133
|
+
});
|
|
17293
17134
|
}
|
|
17294
17135
|
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
17295
17136
|
async deleteVectors(options) {
|
|
17296
17137
|
var _this5 = this;
|
|
17297
|
-
|
|
17298
|
-
|
|
17299
|
-
return {
|
|
17300
|
-
|
|
17301
|
-
error: null
|
|
17302
|
-
};
|
|
17303
|
-
} catch (error) {
|
|
17304
|
-
if (_this5.shouldThrowOnError) throw error;
|
|
17305
|
-
if (isStorageVectorsError(error)) return {
|
|
17306
|
-
data: null,
|
|
17307
|
-
error
|
|
17308
|
-
};
|
|
17309
|
-
throw error;
|
|
17310
|
-
}
|
|
17138
|
+
if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
|
|
17139
|
+
return _this5.handleOperation(async () => {
|
|
17140
|
+
return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
17141
|
+
});
|
|
17311
17142
|
}
|
|
17312
17143
|
};
|
|
17313
|
-
var VectorBucketApi = class {
|
|
17144
|
+
var VectorBucketApi = class extends BaseApiClient {
|
|
17314
17145
|
/** Creates a new VectorBucketApi instance */
|
|
17315
17146
|
constructor(url, headers = {}, fetch$1) {
|
|
17316
|
-
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
this.fetch = resolveFetch2(fetch$1);
|
|
17320
|
-
}
|
|
17321
|
-
/** Enable throwing errors instead of returning them in the response */
|
|
17322
|
-
throwOnError() {
|
|
17323
|
-
this.shouldThrowOnError = true;
|
|
17324
|
-
return this;
|
|
17147
|
+
const finalUrl = url.replace(/\/$/, "");
|
|
17148
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
17149
|
+
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
17325
17150
|
}
|
|
17326
17151
|
/** Creates a new vector bucket */
|
|
17327
17152
|
async createBucket(vectorBucketName) {
|
|
17328
17153
|
var _this = this;
|
|
17329
|
-
|
|
17330
|
-
return {
|
|
17331
|
-
|
|
17332
|
-
error: null
|
|
17333
|
-
};
|
|
17334
|
-
} catch (error) {
|
|
17335
|
-
if (_this.shouldThrowOnError) throw error;
|
|
17336
|
-
if (isStorageVectorsError(error)) return {
|
|
17337
|
-
data: null,
|
|
17338
|
-
error
|
|
17339
|
-
};
|
|
17340
|
-
throw error;
|
|
17341
|
-
}
|
|
17154
|
+
return _this.handleOperation(async () => {
|
|
17155
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
17156
|
+
});
|
|
17342
17157
|
}
|
|
17343
17158
|
/** Retrieves metadata for a specific vector bucket */
|
|
17344
17159
|
async getBucket(vectorBucketName) {
|
|
17345
17160
|
var _this2 = this;
|
|
17346
|
-
|
|
17347
|
-
return {
|
|
17348
|
-
|
|
17349
|
-
error: null
|
|
17350
|
-
};
|
|
17351
|
-
} catch (error) {
|
|
17352
|
-
if (_this2.shouldThrowOnError) throw error;
|
|
17353
|
-
if (isStorageVectorsError(error)) return {
|
|
17354
|
-
data: null,
|
|
17355
|
-
error
|
|
17356
|
-
};
|
|
17357
|
-
throw error;
|
|
17358
|
-
}
|
|
17161
|
+
return _this2.handleOperation(async () => {
|
|
17162
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
17163
|
+
});
|
|
17359
17164
|
}
|
|
17360
17165
|
/** Lists vector buckets with optional filtering and pagination */
|
|
17361
17166
|
async listBuckets(options = {}) {
|
|
17362
17167
|
var _this3 = this;
|
|
17363
|
-
|
|
17364
|
-
return {
|
|
17365
|
-
|
|
17366
|
-
error: null
|
|
17367
|
-
};
|
|
17368
|
-
} catch (error) {
|
|
17369
|
-
if (_this3.shouldThrowOnError) throw error;
|
|
17370
|
-
if (isStorageVectorsError(error)) return {
|
|
17371
|
-
data: null,
|
|
17372
|
-
error
|
|
17373
|
-
};
|
|
17374
|
-
throw error;
|
|
17375
|
-
}
|
|
17168
|
+
return _this3.handleOperation(async () => {
|
|
17169
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
17170
|
+
});
|
|
17376
17171
|
}
|
|
17377
17172
|
/** Deletes a vector bucket (must be empty first) */
|
|
17378
17173
|
async deleteBucket(vectorBucketName) {
|
|
17379
17174
|
var _this4 = this;
|
|
17380
|
-
|
|
17381
|
-
return {
|
|
17382
|
-
|
|
17383
|
-
error: null
|
|
17384
|
-
};
|
|
17385
|
-
} catch (error) {
|
|
17386
|
-
if (_this4.shouldThrowOnError) throw error;
|
|
17387
|
-
if (isStorageVectorsError(error)) return {
|
|
17388
|
-
data: null,
|
|
17389
|
-
error
|
|
17390
|
-
};
|
|
17391
|
-
throw error;
|
|
17392
|
-
}
|
|
17175
|
+
return _this4.handleOperation(async () => {
|
|
17176
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
17177
|
+
});
|
|
17393
17178
|
}
|
|
17394
17179
|
};
|
|
17395
17180
|
var StorageVectorsClient = class extends VectorBucketApi {
|
|
@@ -17586,7 +17371,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
17586
17371
|
*/
|
|
17587
17372
|
async createIndex(options) {
|
|
17588
17373
|
var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
|
|
17589
|
-
return _superprop_getCreateIndex().call(_this5,
|
|
17374
|
+
return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
|
|
17590
17375
|
}
|
|
17591
17376
|
/**
|
|
17592
17377
|
*
|
|
@@ -17609,7 +17394,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
17609
17394
|
*/
|
|
17610
17395
|
async listIndexes(options = {}) {
|
|
17611
17396
|
var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
|
|
17612
|
-
return _superprop_getListIndexes().call(_this6,
|
|
17397
|
+
return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
|
|
17613
17398
|
}
|
|
17614
17399
|
/**
|
|
17615
17400
|
*
|
|
@@ -17742,7 +17527,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
17742
17527
|
*/
|
|
17743
17528
|
async putVectors(options) {
|
|
17744
17529
|
var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
|
|
17745
|
-
return _superprop_getPutVectors().call(_this9,
|
|
17530
|
+
return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
17746
17531
|
vectorBucketName: _this9.vectorBucketName,
|
|
17747
17532
|
indexName: _this9.indexName
|
|
17748
17533
|
}));
|
|
@@ -17771,7 +17556,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
17771
17556
|
*/
|
|
17772
17557
|
async getVectors(options) {
|
|
17773
17558
|
var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
|
|
17774
|
-
return _superprop_getGetVectors().call(_this10,
|
|
17559
|
+
return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
17775
17560
|
vectorBucketName: _this10.vectorBucketName,
|
|
17776
17561
|
indexName: _this10.indexName
|
|
17777
17562
|
}));
|
|
@@ -17800,7 +17585,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
17800
17585
|
*/
|
|
17801
17586
|
async listVectors(options = {}) {
|
|
17802
17587
|
var _superprop_getListVectors = () => super.listVectors, _this11 = this;
|
|
17803
|
-
return _superprop_getListVectors().call(_this11,
|
|
17588
|
+
return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
17804
17589
|
vectorBucketName: _this11.vectorBucketName,
|
|
17805
17590
|
indexName: _this11.indexName
|
|
17806
17591
|
}));
|
|
@@ -17832,7 +17617,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
17832
17617
|
*/
|
|
17833
17618
|
async queryVectors(options) {
|
|
17834
17619
|
var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
|
|
17835
|
-
return _superprop_getQueryVectors().call(_this12,
|
|
17620
|
+
return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
17836
17621
|
vectorBucketName: _this12.vectorBucketName,
|
|
17837
17622
|
indexName: _this12.indexName
|
|
17838
17623
|
}));
|
|
@@ -17860,7 +17645,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
17860
17645
|
*/
|
|
17861
17646
|
async deleteVectors(options) {
|
|
17862
17647
|
var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
|
|
17863
|
-
return _superprop_getDeleteVectors().call(_this13,
|
|
17648
|
+
return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
17864
17649
|
vectorBucketName: _this13.vectorBucketName,
|
|
17865
17650
|
indexName: _this13.indexName
|
|
17866
17651
|
}));
|
|
@@ -17931,10 +17716,10 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
17931
17716
|
}
|
|
17932
17717
|
};
|
|
17933
17718
|
|
|
17934
|
-
// node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
17935
|
-
var version3 = "2.
|
|
17719
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
17720
|
+
var version3 = "2.95.1";
|
|
17936
17721
|
|
|
17937
|
-
// node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
17722
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
17938
17723
|
var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
17939
17724
|
var AUTO_REFRESH_TICK_THRESHOLD = 3;
|
|
17940
17725
|
var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
|
|
@@ -17951,7 +17736,7 @@ var API_VERSIONS = {
|
|
|
17951
17736
|
var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
|
|
17952
17737
|
var JWKS_TTL = 10 * 60 * 1e3;
|
|
17953
17738
|
|
|
17954
|
-
// node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
17739
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
17955
17740
|
var AuthError = class extends Error {
|
|
17956
17741
|
constructor(message, status, code) {
|
|
17957
17742
|
super(message);
|
|
@@ -18065,7 +17850,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
|
|
|
18065
17850
|
}
|
|
18066
17851
|
};
|
|
18067
17852
|
|
|
18068
|
-
// node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
17853
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
18069
17854
|
var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
|
|
18070
17855
|
var IGNORE_BASE64URL = " \n\r=".split("");
|
|
18071
17856
|
var FROM_BASE64URL = (() => {
|
|
@@ -18227,7 +18012,7 @@ function bytesToBase64URL(bytes) {
|
|
|
18227
18012
|
return result.join("");
|
|
18228
18013
|
}
|
|
18229
18014
|
|
|
18230
|
-
// node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
18015
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
18231
18016
|
function expiresAt(expiresIn) {
|
|
18232
18017
|
const timeNow = Math.round(Date.now() / 1e3);
|
|
18233
18018
|
return timeNow + expiresIn;
|
|
@@ -18509,7 +18294,7 @@ function deepClone(obj) {
|
|
|
18509
18294
|
return JSON.parse(JSON.stringify(obj));
|
|
18510
18295
|
}
|
|
18511
18296
|
|
|
18512
|
-
// node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
18297
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
18513
18298
|
var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
|
|
18514
18299
|
var NETWORK_ERROR_CODES = [502, 503, 504];
|
|
18515
18300
|
async function handleError2(error) {
|
|
@@ -18646,10 +18431,10 @@ function hasSession(data) {
|
|
|
18646
18431
|
return data.access_token && data.refresh_token && data.expires_in;
|
|
18647
18432
|
}
|
|
18648
18433
|
|
|
18649
|
-
// node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
18434
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
18650
18435
|
var SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
18651
18436
|
|
|
18652
|
-
// node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
18437
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
18653
18438
|
var GoTrueAdminApi = class {
|
|
18654
18439
|
/**
|
|
18655
18440
|
* Creates an admin API client that can be used to manage users and OAuth clients.
|
|
@@ -19066,7 +18851,7 @@ var GoTrueAdminApi = class {
|
|
|
19066
18851
|
}
|
|
19067
18852
|
};
|
|
19068
18853
|
|
|
19069
|
-
// node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
18854
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
19070
18855
|
function memoryLocalStorageAdapter(store = {}) {
|
|
19071
18856
|
return {
|
|
19072
18857
|
getItem: (key) => {
|
|
@@ -19081,7 +18866,7 @@ function memoryLocalStorageAdapter(store = {}) {
|
|
|
19081
18866
|
};
|
|
19082
18867
|
}
|
|
19083
18868
|
|
|
19084
|
-
// node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
18869
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
19085
18870
|
var internals = {
|
|
19086
18871
|
/**
|
|
19087
18872
|
* @experimental
|
|
@@ -19149,7 +18934,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
|
|
|
19149
18934
|
}));
|
|
19150
18935
|
}
|
|
19151
18936
|
|
|
19152
|
-
// node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
18937
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
19153
18938
|
function polyfillGlobalThis() {
|
|
19154
18939
|
if (typeof globalThis === "object")
|
|
19155
18940
|
return;
|
|
@@ -19169,7 +18954,7 @@ function polyfillGlobalThis() {
|
|
|
19169
18954
|
}
|
|
19170
18955
|
}
|
|
19171
18956
|
|
|
19172
|
-
// node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
18957
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
19173
18958
|
function getAddress(address) {
|
|
19174
18959
|
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
|
|
19175
18960
|
throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
|
|
@@ -19237,7 +19022,7 @@ Request ID: ${requestId}`;
|
|
|
19237
19022
|
${suffix}`;
|
|
19238
19023
|
}
|
|
19239
19024
|
|
|
19240
|
-
// node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
19025
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
19241
19026
|
var WebAuthnError = class extends Error {
|
|
19242
19027
|
constructor({ message, code, cause, name }) {
|
|
19243
19028
|
var _a78;
|
|
@@ -19405,7 +19190,7 @@ function identifyAuthenticationError({ error, options }) {
|
|
|
19405
19190
|
});
|
|
19406
19191
|
}
|
|
19407
19192
|
|
|
19408
|
-
// node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
19193
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
19409
19194
|
var WebAuthnAbortService = class {
|
|
19410
19195
|
/**
|
|
19411
19196
|
* Create an abort signal for a new WebAuthn operation.
|
|
@@ -19700,6 +19485,7 @@ var WebAuthnApi = class {
|
|
|
19700
19485
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
|
|
19701
19486
|
*/
|
|
19702
19487
|
async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
|
|
19488
|
+
var _a78;
|
|
19703
19489
|
try {
|
|
19704
19490
|
const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
|
|
19705
19491
|
factorId,
|
|
@@ -19712,7 +19498,15 @@ var WebAuthnApi = class {
|
|
|
19712
19498
|
if (challengeResponse.webauthn.type === "create") {
|
|
19713
19499
|
const { user } = challengeResponse.webauthn.credential_options.publicKey;
|
|
19714
19500
|
if (!user.name) {
|
|
19715
|
-
|
|
19501
|
+
const nameToUse = friendlyName;
|
|
19502
|
+
if (!nameToUse) {
|
|
19503
|
+
const currentUser = await this.client.getUser();
|
|
19504
|
+
const userData = currentUser.data.user;
|
|
19505
|
+
const fallbackName = ((_a78 = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a78 === void 0 ? void 0 : _a78.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
|
|
19506
|
+
user.name = `${user.id}:${fallbackName}`;
|
|
19507
|
+
} else {
|
|
19508
|
+
user.name = `${user.id}:${nameToUse}`;
|
|
19509
|
+
}
|
|
19716
19510
|
}
|
|
19717
19511
|
if (!user.displayName) {
|
|
19718
19512
|
user.displayName = user.name;
|
|
@@ -19919,7 +19713,7 @@ var WebAuthnApi = class {
|
|
|
19919
19713
|
}
|
|
19920
19714
|
};
|
|
19921
19715
|
|
|
19922
|
-
// node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
19716
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
19923
19717
|
polyfillGlobalThis();
|
|
19924
19718
|
var DEFAULT_OPTIONS = {
|
|
19925
19719
|
url: GOTRUE_URL,
|
|
@@ -20073,10 +19867,16 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
20073
19867
|
}
|
|
20074
19868
|
(_c = this.broadcastChannel) === null || _c === void 0 ? void 0 : _c.addEventListener("message", async (event) => {
|
|
20075
19869
|
this._debug("received broadcast notification from other tab or client", event);
|
|
20076
|
-
|
|
19870
|
+
try {
|
|
19871
|
+
await this._notifyAllSubscribers(event.data.event, event.data.session, false);
|
|
19872
|
+
} catch (error) {
|
|
19873
|
+
this._debug("#broadcastChannel", "error", error);
|
|
19874
|
+
}
|
|
20077
19875
|
});
|
|
20078
19876
|
}
|
|
20079
|
-
this.initialize()
|
|
19877
|
+
this.initialize().catch((error) => {
|
|
19878
|
+
this._debug("#initialize()", "error", error);
|
|
19879
|
+
});
|
|
20080
19880
|
}
|
|
20081
19881
|
/**
|
|
20082
19882
|
* Returns whether error throwing mode is enabled for this client.
|
|
@@ -20599,9 +20399,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
20599
20399
|
}
|
|
20600
20400
|
if (data.session) {
|
|
20601
20401
|
await this._saveSession(data.session);
|
|
20602
|
-
|
|
20603
|
-
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20604
|
-
}, 0);
|
|
20402
|
+
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20605
20403
|
}
|
|
20606
20404
|
return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
|
|
20607
20405
|
} catch (error) {
|
|
@@ -21148,7 +20946,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
21148
20946
|
} else {
|
|
21149
20947
|
const { data, error } = await this._getUser(currentSession.access_token);
|
|
21150
20948
|
if (error) {
|
|
21151
|
-
|
|
20949
|
+
return this._returnResult({ data: { user: null, session: null }, error });
|
|
21152
20950
|
}
|
|
21153
20951
|
session = {
|
|
21154
20952
|
access_token: currentSession.access_token,
|
|
@@ -21330,14 +21128,14 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
21330
21128
|
return await this._useSession(async (result) => {
|
|
21331
21129
|
var _a78;
|
|
21332
21130
|
const { data, error: sessionError } = result;
|
|
21333
|
-
if (sessionError) {
|
|
21131
|
+
if (sessionError && !isAuthSessionMissingError(sessionError)) {
|
|
21334
21132
|
return this._returnResult({ error: sessionError });
|
|
21335
21133
|
}
|
|
21336
21134
|
const accessToken = (_a78 = data.session) === null || _a78 === void 0 ? void 0 : _a78.access_token;
|
|
21337
21135
|
if (accessToken) {
|
|
21338
21136
|
const { error } = await this.admin.signOut(accessToken, scope);
|
|
21339
21137
|
if (error) {
|
|
21340
|
-
if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403))) {
|
|
21138
|
+
if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403) || isAuthSessionMissingError(error))) {
|
|
21341
21139
|
return this._returnResult({ error });
|
|
21342
21140
|
}
|
|
21343
21141
|
}
|
|
@@ -21924,7 +21722,13 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
21924
21722
|
return false;
|
|
21925
21723
|
}
|
|
21926
21724
|
try {
|
|
21927
|
-
this.visibilityChangedCallback = async () =>
|
|
21725
|
+
this.visibilityChangedCallback = async () => {
|
|
21726
|
+
try {
|
|
21727
|
+
await this._onVisibilityChanged(false);
|
|
21728
|
+
} catch (error) {
|
|
21729
|
+
this._debug("#visibilityChangedCallback", "error", error);
|
|
21730
|
+
}
|
|
21731
|
+
};
|
|
21928
21732
|
window === null || window === void 0 ? void 0 : window.addEventListener("visibilitychange", this.visibilityChangedCallback);
|
|
21929
21733
|
await this._onVisibilityChanged(true);
|
|
21930
21734
|
} catch (error) {
|
|
@@ -22157,8 +21961,33 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
22157
21961
|
/**
|
|
22158
21962
|
* {@see GoTrueMFAApi#getAuthenticatorAssuranceLevel}
|
|
22159
21963
|
*/
|
|
22160
|
-
async _getAuthenticatorAssuranceLevel() {
|
|
22161
|
-
var _a78, _b7;
|
|
21964
|
+
async _getAuthenticatorAssuranceLevel(jwt) {
|
|
21965
|
+
var _a78, _b7, _c, _d;
|
|
21966
|
+
if (jwt) {
|
|
21967
|
+
try {
|
|
21968
|
+
const { payload: payload2 } = decodeJWT(jwt);
|
|
21969
|
+
let currentLevel2 = null;
|
|
21970
|
+
if (payload2.aal) {
|
|
21971
|
+
currentLevel2 = payload2.aal;
|
|
21972
|
+
}
|
|
21973
|
+
let nextLevel2 = currentLevel2;
|
|
21974
|
+
const { data: { user }, error: userError } = await this.getUser(jwt);
|
|
21975
|
+
if (userError) {
|
|
21976
|
+
return this._returnResult({ data: null, error: userError });
|
|
21977
|
+
}
|
|
21978
|
+
const verifiedFactors2 = (_b7 = (_a78 = user === null || user === void 0 ? void 0 : user.factors) === null || _a78 === void 0 ? void 0 : _a78.filter((factor) => factor.status === "verified")) !== null && _b7 !== void 0 ? _b7 : [];
|
|
21979
|
+
if (verifiedFactors2.length > 0) {
|
|
21980
|
+
nextLevel2 = "aal2";
|
|
21981
|
+
}
|
|
21982
|
+
const currentAuthenticationMethods2 = payload2.amr || [];
|
|
21983
|
+
return { data: { currentLevel: currentLevel2, nextLevel: nextLevel2, currentAuthenticationMethods: currentAuthenticationMethods2 }, error: null };
|
|
21984
|
+
} catch (error) {
|
|
21985
|
+
if (isAuthError(error)) {
|
|
21986
|
+
return this._returnResult({ data: null, error });
|
|
21987
|
+
}
|
|
21988
|
+
throw error;
|
|
21989
|
+
}
|
|
21990
|
+
}
|
|
22162
21991
|
const { data: { session }, error: sessionError } = await this.getSession();
|
|
22163
21992
|
if (sessionError) {
|
|
22164
21993
|
return this._returnResult({ data: null, error: sessionError });
|
|
@@ -22175,7 +22004,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
22175
22004
|
currentLevel = payload.aal;
|
|
22176
22005
|
}
|
|
22177
22006
|
let nextLevel = currentLevel;
|
|
22178
|
-
const verifiedFactors = (
|
|
22007
|
+
const verifiedFactors = (_d = (_c = session.user.factors) === null || _c === void 0 ? void 0 : _c.filter((factor) => factor.status === "verified")) !== null && _d !== void 0 ? _d : [];
|
|
22179
22008
|
if (verifiedFactors.length > 0) {
|
|
22180
22009
|
nextLevel = "aal2";
|
|
22181
22010
|
}
|
|
@@ -22187,7 +22016,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
22187
22016
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
22188
22017
|
*
|
|
22189
22018
|
* Returns authorization details including client info, scopes, and user information.
|
|
22190
|
-
* If the
|
|
22019
|
+
* If the response includes only a redirect_url field, it means consent was already given - the caller
|
|
22191
22020
|
* should handle the redirect manually if needed.
|
|
22192
22021
|
*/
|
|
22193
22022
|
async _getAuthorizationDetails(authorizationId) {
|
|
@@ -22436,12 +22265,12 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
22436
22265
|
GoTrueClient.nextInstanceID = {};
|
|
22437
22266
|
var GoTrueClient_default = GoTrueClient;
|
|
22438
22267
|
|
|
22439
|
-
// node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
22268
|
+
// node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
22440
22269
|
var AuthClient = GoTrueClient_default;
|
|
22441
22270
|
var AuthClient_default = AuthClient;
|
|
22442
22271
|
|
|
22443
|
-
// node_modules/@supabase/supabase-js/dist/index.mjs
|
|
22444
|
-
var version4 = "2.
|
|
22272
|
+
// node_modules/.pnpm/@supabase+supabase-js@2.95.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
22273
|
+
var version4 = "2.95.1";
|
|
22445
22274
|
var JS_ENV = "";
|
|
22446
22275
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
22447
22276
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -22457,37 +22286,37 @@ var DEFAULT_AUTH_OPTIONS = {
|
|
|
22457
22286
|
flowType: "implicit"
|
|
22458
22287
|
};
|
|
22459
22288
|
var DEFAULT_REALTIME_OPTIONS = {};
|
|
22460
|
-
function
|
|
22289
|
+
function _typeof3(o) {
|
|
22461
22290
|
"@babel/helpers - typeof";
|
|
22462
|
-
return
|
|
22291
|
+
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
22463
22292
|
return typeof o$1;
|
|
22464
22293
|
} : function(o$1) {
|
|
22465
22294
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
22466
|
-
},
|
|
22295
|
+
}, _typeof3(o);
|
|
22467
22296
|
}
|
|
22468
|
-
function
|
|
22469
|
-
if ("object" !=
|
|
22297
|
+
function toPrimitive3(t, r) {
|
|
22298
|
+
if ("object" != _typeof3(t) || !t) return t;
|
|
22470
22299
|
var e = t[Symbol.toPrimitive];
|
|
22471
22300
|
if (void 0 !== e) {
|
|
22472
22301
|
var i = e.call(t, r || "default");
|
|
22473
|
-
if ("object" !=
|
|
22302
|
+
if ("object" != _typeof3(i)) return i;
|
|
22474
22303
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
22475
22304
|
}
|
|
22476
22305
|
return ("string" === r ? String : Number)(t);
|
|
22477
22306
|
}
|
|
22478
|
-
function
|
|
22479
|
-
var i =
|
|
22480
|
-
return "symbol" ==
|
|
22307
|
+
function toPropertyKey3(t) {
|
|
22308
|
+
var i = toPrimitive3(t, "string");
|
|
22309
|
+
return "symbol" == _typeof3(i) ? i : i + "";
|
|
22481
22310
|
}
|
|
22482
|
-
function
|
|
22483
|
-
return (r =
|
|
22311
|
+
function _defineProperty3(e, r, t) {
|
|
22312
|
+
return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
|
|
22484
22313
|
value: t,
|
|
22485
22314
|
enumerable: true,
|
|
22486
22315
|
configurable: true,
|
|
22487
22316
|
writable: true
|
|
22488
22317
|
}) : e[r] = t, e;
|
|
22489
22318
|
}
|
|
22490
|
-
function
|
|
22319
|
+
function ownKeys3(e, r) {
|
|
22491
22320
|
var t = Object.keys(e);
|
|
22492
22321
|
if (Object.getOwnPropertySymbols) {
|
|
22493
22322
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -22497,12 +22326,12 @@ function ownKeys2(e, r) {
|
|
|
22497
22326
|
}
|
|
22498
22327
|
return t;
|
|
22499
22328
|
}
|
|
22500
|
-
function
|
|
22329
|
+
function _objectSpread23(e) {
|
|
22501
22330
|
for (var r = 1; r < arguments.length; r++) {
|
|
22502
22331
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
22503
|
-
r % 2 ?
|
|
22504
|
-
|
|
22505
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
22332
|
+
r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
|
|
22333
|
+
_defineProperty3(e, r$1, t[r$1]);
|
|
22334
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
|
|
22506
22335
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
22507
22336
|
});
|
|
22508
22337
|
}
|
|
@@ -22524,7 +22353,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
|
|
|
22524
22353
|
let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
22525
22354
|
if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
|
|
22526
22355
|
if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
|
|
22527
|
-
return fetch$1(input,
|
|
22356
|
+
return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
|
|
22528
22357
|
};
|
|
22529
22358
|
};
|
|
22530
22359
|
function ensureTrailingSlash(url) {
|
|
@@ -22535,11 +22364,11 @@ function applySettingDefaults(options, defaults) {
|
|
|
22535
22364
|
const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
|
|
22536
22365
|
const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
|
|
22537
22366
|
const result = {
|
|
22538
|
-
db:
|
|
22539
|
-
auth:
|
|
22540
|
-
realtime:
|
|
22367
|
+
db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
|
|
22368
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
|
|
22369
|
+
realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
|
|
22541
22370
|
storage: {},
|
|
22542
|
-
global:
|
|
22371
|
+
global: _objectSpread23(_objectSpread23(_objectSpread23({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread23(_objectSpread23({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
|
|
22543
22372
|
accessToken: async () => ""
|
|
22544
22373
|
};
|
|
22545
22374
|
if (options.accessToken) result.accessToken = options.accessToken;
|
|
@@ -22597,7 +22426,7 @@ var SupabaseClient = class {
|
|
|
22597
22426
|
const DEFAULTS = {
|
|
22598
22427
|
db: DEFAULT_DB_OPTIONS,
|
|
22599
22428
|
realtime: DEFAULT_REALTIME_OPTIONS,
|
|
22600
|
-
auth:
|
|
22429
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
|
|
22601
22430
|
global: DEFAULT_GLOBAL_OPTIONS
|
|
22602
22431
|
};
|
|
22603
22432
|
const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
|
|
@@ -22613,7 +22442,7 @@ var SupabaseClient = class {
|
|
|
22613
22442
|
} });
|
|
22614
22443
|
}
|
|
22615
22444
|
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
|
|
22616
|
-
this.realtime = this._initRealtimeClient(
|
|
22445
|
+
this.realtime = this._initRealtimeClient(_objectSpread23({
|
|
22617
22446
|
headers: this.headers,
|
|
22618
22447
|
accessToken: this._getAccessToken.bind(this)
|
|
22619
22448
|
}, settings.realtime));
|
|
@@ -22621,7 +22450,9 @@ var SupabaseClient = class {
|
|
|
22621
22450
|
this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
|
|
22622
22451
|
headers: this.headers,
|
|
22623
22452
|
schema: settings.db.schema,
|
|
22624
|
-
fetch: this.fetch
|
|
22453
|
+
fetch: this.fetch,
|
|
22454
|
+
timeout: settings.db.timeout,
|
|
22455
|
+
urlLengthLimit: settings.db.urlLengthLimit
|
|
22625
22456
|
});
|
|
22626
22457
|
this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
|
|
22627
22458
|
if (!settings.accessToken) this._listenForAuthEvents();
|
|
@@ -22728,7 +22559,7 @@ var SupabaseClient = class {
|
|
|
22728
22559
|
};
|
|
22729
22560
|
return new SupabaseAuthClient({
|
|
22730
22561
|
url: this.authUrl.href,
|
|
22731
|
-
headers:
|
|
22562
|
+
headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
|
|
22732
22563
|
storageKey,
|
|
22733
22564
|
autoRefreshToken,
|
|
22734
22565
|
persistSession,
|
|
@@ -22744,7 +22575,7 @@ var SupabaseClient = class {
|
|
|
22744
22575
|
});
|
|
22745
22576
|
}
|
|
22746
22577
|
_initRealtimeClient(options) {
|
|
22747
|
-
return new RealtimeClient(this.realtimeUrl.href,
|
|
22578
|
+
return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
|
|
22748
22579
|
}
|
|
22749
22580
|
_listenForAuthEvents() {
|
|
22750
22581
|
return this.auth.onAuthStateChange((event, session) => {
|
|
@@ -28194,6 +28025,11 @@ var useActiveSection = (sectionIds, offset = 180) => {
|
|
|
28194
28025
|
return activeId;
|
|
28195
28026
|
};
|
|
28196
28027
|
|
|
28028
|
+
// src/utils/slug.ts
|
|
28029
|
+
function slugify(value) {
|
|
28030
|
+
return value.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
|
|
28031
|
+
}
|
|
28032
|
+
|
|
28197
28033
|
// src/lib/auth.tsx
|
|
28198
28034
|
var import_react22 = require("react");
|
|
28199
28035
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
@@ -29413,6 +29249,7 @@ var useAuth = () => {
|
|
|
29413
29249
|
resolveTelescupImageURL,
|
|
29414
29250
|
responsiveSizeClasses,
|
|
29415
29251
|
setCupcodeRuntimeEnv,
|
|
29252
|
+
slugify,
|
|
29416
29253
|
sonnerToast,
|
|
29417
29254
|
toast,
|
|
29418
29255
|
toggleVariants,
|