@ram_28/kf-ai-sdk 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +90 -90
- package/dist/components/hooks/useFilter/types.d.ts +25 -22
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +736 -1745
- package/dist/kanban.cjs +2 -2
- package/dist/kanban.mjs +469 -835
- package/dist/kanban.ui.cjs +1 -1
- package/dist/kanban.ui.mjs +27 -27
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +2 -2
- package/dist/useFilter-Dofowpr_.cjs +1 -0
- package/dist/useFilter-Dv-mr9QW.js +117 -0
- package/package.json +1 -1
- package/sdk/components/hooks/useFilter/types.ts +28 -24
- package/sdk/components/hooks/useFilter/useFilter.llm.txt +199 -331
- package/sdk/components/hooks/useFilter/useFilter.ts +28 -40
- package/dist/jsx-runtime-BYECrxsp.cjs +0 -30
- package/dist/jsx-runtime-DGlMoOmv.js +0 -630
- package/dist/useFilter-CXFqEHyI.js +0 -129
- package/dist/useFilter-D-bCDo6Z.cjs +0 -1
- package/dist/useQuery-BScHEo7x.cjs +0 -1
- package/dist/useQuery-KpZFg80c.js +0 -748
package/dist/auth.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var z=Object.defineProperty;var J=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M=(e,t,n)=>J(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("
|
|
1
|
+
"use strict";var z=Object.defineProperty;var J=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M=(e,t,n)=>J(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react/jsx-runtime"),r=require("react"),K=require("@tanstack/react-query"),x=require("./client-C15j4O5B.cjs"),H={sessionEndpoint:"/api/id",providers:{google:{loginPath:"/api/auth/google/login",logoutPath:"/api/auth/logout"}},defaultProvider:"google",autoRedirect:!1,sessionCheckInterval:0,retry:{count:3,delay:1e3},staleTime:5*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!0};let h={...H};function N(e){h={...h,...e,providers:{...h.providers,...e.providers},retry:{...h.retry,...e.retry}}}function X(e,t){h.providers[e]=t}function b(){return{...h}}function k(){return h.baseUrl||x.getApiBaseUrl()||(typeof window<"u"?window.location.origin:"")}function Y(e){return h.providers[e]}function Z(){h={...H}}class m extends Error{constructor(n,o){super(n);M(this,"statusCode");this.name="AuthenticationError",this.statusCode=o}}async function D(){const e=b(),t=k(),n=x.getDefaultHeaders(),o=await fetch(`${t}${e.sessionEndpoint}`,{method:"GET",headers:n,credentials:"include"});if(!o.ok)throw o.status===401||o.status===403?new m("Not authenticated",o.status):new m(`Session check failed: ${o.statusText}`,o.status);return await o.json()}function W(e,t){return new Promise(()=>{const n=b(),o=k();if(!o)throw new Error('Auth base URL is not configured. Call setApiBaseUrl("https://...") or configureAuth({ baseUrl: "https://..." }) first.');const i=e||n.defaultProvider,c=Y(i);if(!c){const w=Object.keys(n.providers||{}).join(", ")||"none";throw new Error(`Auth provider "${i}" is not configured. Available providers: ${w}`)}if(!c.loginPath)throw new Error(`Login path not configured for provider "${i}". Configure it with: configureAuth({ providers: { ${i}: { loginPath: '/api/auth/...' } } })`);let f;try{f=new URL(`${o}${c.loginPath}`)}catch{throw new Error(`Failed to construct login URL. Base URL: "${o}", Login path: "${c.loginPath}". Ensure baseUrl is a valid URL (e.g., "https://example.com").`)}(t!=null&&t.callbackUrl||n.callbackUrl)&&f.searchParams.set("callbackUrl",(t==null?void 0:t.callbackUrl)||n.callbackUrl||window.location.href),t!=null&&t.params&&Object.entries(t.params).forEach(([w,v])=>{f.searchParams.set(w,v)}),window.location.href=f.toString()})}async function ee(e){const t=b(),n=k(),o=x.getDefaultHeaders(),i=Y(t.defaultProvider),c=i==null?void 0:i.logoutPath;if(c&&(e==null?void 0:e.callLogoutEndpoint)!==!1)try{await fetch(`${n}${c}`,{method:"POST",headers:o,credentials:"include"})}catch(f){console.warn("Logout endpoint call failed:",f)}e!=null&&e.redirectUrl?window.location.href=e.redirectUrl:t.loginRedirectUrl&&(window.location.href=t.loginRedirectUrl)}const G=r.createContext(null),_=["auth","session"];function te({children:e,config:t,onAuthChange:n,onError:o,loadingComponent:i,unauthenticatedComponent:c,skipInitialCheck:f=!1}){const w=r.useRef(!1);t&&!w.current&&(N(t),w.current=!0);const v=K.useQueryClient(),l=b(),{data:a,isLoading:g,error:U,refetch:R,isFetching:C}=K.useQuery({queryKey:_,queryFn:D,enabled:!f,retry:(s,y)=>y instanceof m&&(y.statusCode===401||y.statusCode===403)?!1:s<l.retry.count,retryDelay:l.retry.delay,staleTime:l.staleTime,gcTime:l.staleTime*2,refetchOnWindowFocus:l.refetchOnWindowFocus??!0,refetchOnReconnect:l.refetchOnReconnect??!0,refetchInterval:l.sessionCheckInterval||!1}),[S,L]=r.useState(null),d=r.useMemo(()=>g||C?"loading":a!=null&&a.userDetails?"authenticated":"unauthenticated",[g,C,a]),u=(a==null?void 0:a.userDetails)||null,$=(a==null?void 0:a.staticBaseUrl)||null,B=(a==null?void 0:a.buildId)||null,O=d==="authenticated",E=r.useRef(n);E.current=n;const P=r.useRef(o);P.current=o,r.useEffect(()=>{var s;g||(s=E.current)==null||s.call(E,d,u)},[d,u,g]),r.useEffect(()=>{var s;U&&(L(U),(s=P.current)==null||s.call(P,U))},[U]),r.useEffect(()=>{d==="unauthenticated"&&l.autoRedirect&&!g&&W()},[d,g,l.autoRedirect]);const j=r.useCallback((s,y)=>{W(s,y)},[]),p=r.useCallback(async s=>{v.removeQueries({queryKey:_}),await ee(s)},[v]),q=r.useCallback(async()=>{if(C)return a||null;try{return(await R()).data||null}catch(s){return L(s),null}},[R,C,a]),I=r.useCallback(s=>(u==null?void 0:u.Role)===s,[u]),T=r.useCallback(s=>s.includes((u==null?void 0:u.Role)||""),[u]),F=r.useCallback(()=>{L(null)},[]),Q=r.useCallback(()=>{R()},[R]),V=r.useMemo(()=>({user:u,staticBaseUrl:$,buildId:B,status:d,isAuthenticated:O,isLoading:g,login:j,logout:p,refreshSession:q,hasRole:I,hasAnyRole:T,error:S,clearError:F,_forceCheck:Q}),[u,$,B,d,O,g,j,p,q,I,T,S,F,Q]);return d==="loading"&&i?A.jsx(A.Fragment,{children:i}):d==="unauthenticated"&&!l.autoRedirect&&c?A.jsx(A.Fragment,{children:c}):A.jsx(G.Provider,{value:V,children:e})}function re(){const e=r.useContext(G);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function ne(){const e=re();return r.useMemo(()=>({user:e.user,staticBaseUrl:e.staticBaseUrl,buildId:e.buildId,status:e.status,isAuthenticated:e.isAuthenticated,isLoading:e.isLoading,login:e.login,logout:e.logout,refreshSession:e.refreshSession,hasRole:e.hasRole,hasAnyRole:e.hasAnyRole,error:e.error,clearError:e.clearError}),[e.user,e.staticBaseUrl,e.buildId,e.status,e.isAuthenticated,e.isLoading,e.login,e.logout,e.refreshSession,e.hasRole,e.hasAnyRole,e.error,e.clearError])}exports.AuthProvider=te;exports.AuthenticationError=m;exports.configureAuth=N;exports.getAuthBaseUrl=k;exports.getAuthConfig=b;exports.resetAuthConfig=Z;exports.setAuthProvider=X;exports.useAuth=ne;
|
package/dist/auth.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _ = (e, t, r) =>
|
|
4
|
-
import {
|
|
5
|
-
import { useRef as
|
|
6
|
-
import {
|
|
7
|
-
import { c as
|
|
8
|
-
const
|
|
1
|
+
var X = Object.defineProperty;
|
|
2
|
+
var Z = (e, t, r) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var _ = (e, t, r) => Z(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as C, Fragment as N } from "react/jsx-runtime";
|
|
5
|
+
import { useRef as L, useState as D, useMemo as $, useEffect as p, useCallback as g, createContext as ee, useContext as te } from "react";
|
|
6
|
+
import { useQueryClient as re, useQuery as ne } from "@tanstack/react-query";
|
|
7
|
+
import { c as oe, g as H } from "./client-CfvLiGfP.js";
|
|
8
|
+
const M = {
|
|
9
9
|
sessionEndpoint: "/api/id",
|
|
10
10
|
providers: {
|
|
11
11
|
google: {
|
|
@@ -24,8 +24,8 @@ const H = {
|
|
|
24
24
|
refetchOnWindowFocus: !1,
|
|
25
25
|
refetchOnReconnect: !0
|
|
26
26
|
};
|
|
27
|
-
let d = { ...
|
|
28
|
-
function
|
|
27
|
+
let d = { ...M };
|
|
28
|
+
function ie(e) {
|
|
29
29
|
d = {
|
|
30
30
|
...d,
|
|
31
31
|
...e,
|
|
@@ -39,58 +39,58 @@ function oe(e) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ge(e, t) {
|
|
43
43
|
d.providers[e] = t;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function E() {
|
|
46
46
|
return { ...d };
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return d.baseUrl ||
|
|
48
|
+
function x() {
|
|
49
|
+
return d.baseUrl || oe() || (typeof window < "u" ? window.location.origin : "");
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function V(e) {
|
|
52
52
|
return d.providers[e];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
d = { ...
|
|
54
|
+
function we() {
|
|
55
|
+
d = { ...M };
|
|
56
56
|
}
|
|
57
|
-
class
|
|
57
|
+
class k extends Error {
|
|
58
58
|
constructor(r, n) {
|
|
59
59
|
super(r);
|
|
60
60
|
_(this, "statusCode");
|
|
61
61
|
this.name = "AuthenticationError", this.statusCode = n;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
async function
|
|
65
|
-
const e =
|
|
64
|
+
async function ae() {
|
|
65
|
+
const e = E(), t = x(), r = H(), n = await fetch(`${t}${e.sessionEndpoint}`, {
|
|
66
66
|
method: "GET",
|
|
67
67
|
headers: r,
|
|
68
68
|
credentials: "include"
|
|
69
69
|
});
|
|
70
70
|
if (!n.ok)
|
|
71
|
-
throw n.status === 401 || n.status === 403 ? new
|
|
71
|
+
throw n.status === 401 || n.status === 403 ? new k("Not authenticated", n.status) : new k(
|
|
72
72
|
`Session check failed: ${n.statusText}`,
|
|
73
73
|
n.status
|
|
74
74
|
);
|
|
75
75
|
return await n.json();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Y(e, t) {
|
|
78
78
|
return new Promise(() => {
|
|
79
|
-
const r =
|
|
79
|
+
const r = E(), n = x();
|
|
80
80
|
if (!n)
|
|
81
81
|
throw new Error(
|
|
82
82
|
'Auth base URL is not configured. Call setApiBaseUrl("https://...") or configureAuth({ baseUrl: "https://..." }) first.'
|
|
83
83
|
);
|
|
84
|
-
const
|
|
84
|
+
const a = e || r.defaultProvider, c = V(a);
|
|
85
85
|
if (!c) {
|
|
86
86
|
const w = Object.keys(r.providers || {}).join(", ") || "none";
|
|
87
87
|
throw new Error(
|
|
88
|
-
`Auth provider "${
|
|
88
|
+
`Auth provider "${a}" is not configured. Available providers: ${w}`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
if (!c.loginPath)
|
|
92
92
|
throw new Error(
|
|
93
|
-
`Login path not configured for provider "${
|
|
93
|
+
`Login path not configured for provider "${a}". Configure it with: configureAuth({ providers: { ${a}: { loginPath: '/api/auth/...' } } })`
|
|
94
94
|
);
|
|
95
95
|
let h;
|
|
96
96
|
try {
|
|
@@ -103,13 +103,13 @@ function N(e, t) {
|
|
|
103
103
|
(t != null && t.callbackUrl || r.callbackUrl) && h.searchParams.set(
|
|
104
104
|
"callbackUrl",
|
|
105
105
|
(t == null ? void 0 : t.callbackUrl) || r.callbackUrl || window.location.href
|
|
106
|
-
), t != null && t.params && Object.entries(t.params).forEach(([w,
|
|
107
|
-
h.searchParams.set(w,
|
|
106
|
+
), t != null && t.params && Object.entries(t.params).forEach(([w, U]) => {
|
|
107
|
+
h.searchParams.set(w, U);
|
|
108
108
|
}), window.location.href = h.toString();
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
async function
|
|
112
|
-
const t =
|
|
111
|
+
async function se(e) {
|
|
112
|
+
const t = E(), r = x(), n = H(), a = V(t.defaultProvider), c = a == null ? void 0 : a.logoutPath;
|
|
113
113
|
if (c && (e == null ? void 0 : e.callLogoutEndpoint) !== !1)
|
|
114
114
|
try {
|
|
115
115
|
await fetch(`${r}${c}`, {
|
|
@@ -122,86 +122,86 @@ async function ie(e) {
|
|
|
122
122
|
}
|
|
123
123
|
e != null && e.redirectUrl ? window.location.href = e.redirectUrl : t.loginRedirectUrl && (window.location.href = t.loginRedirectUrl);
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
function
|
|
125
|
+
const z = ee(null), G = ["auth", "session"];
|
|
126
|
+
function ye({
|
|
127
127
|
children: e,
|
|
128
128
|
config: t,
|
|
129
129
|
onAuthChange: r,
|
|
130
130
|
onError: n,
|
|
131
|
-
loadingComponent:
|
|
131
|
+
loadingComponent: a,
|
|
132
132
|
unauthenticatedComponent: c,
|
|
133
133
|
skipInitialCheck: h = !1
|
|
134
134
|
}) {
|
|
135
|
-
const w =
|
|
136
|
-
t && !w.current && (
|
|
137
|
-
const
|
|
138
|
-
data:
|
|
135
|
+
const w = L(!1);
|
|
136
|
+
t && !w.current && (ie(t), w.current = !0);
|
|
137
|
+
const U = re(), u = E(), {
|
|
138
|
+
data: i,
|
|
139
139
|
isLoading: f,
|
|
140
140
|
error: v,
|
|
141
141
|
refetch: A,
|
|
142
|
-
isFetching:
|
|
143
|
-
} =
|
|
144
|
-
queryKey:
|
|
145
|
-
queryFn:
|
|
142
|
+
isFetching: m
|
|
143
|
+
} = ne({
|
|
144
|
+
queryKey: G,
|
|
145
|
+
queryFn: ae,
|
|
146
146
|
enabled: !h,
|
|
147
|
-
retry: (o, y) => y instanceof
|
|
147
|
+
retry: (o, y) => y instanceof k && (y.statusCode === 401 || y.statusCode === 403) ? !1 : o < u.retry.count,
|
|
148
148
|
retryDelay: u.retry.delay,
|
|
149
149
|
staleTime: u.staleTime,
|
|
150
150
|
gcTime: u.staleTime * 2,
|
|
151
151
|
refetchOnWindowFocus: u.refetchOnWindowFocus ?? !0,
|
|
152
152
|
refetchOnReconnect: u.refetchOnReconnect ?? !0,
|
|
153
153
|
refetchInterval: u.sessionCheckInterval || !1
|
|
154
|
-
}), [S,
|
|
154
|
+
}), [S, P] = D(null), l = $(() => f || m ? "loading" : i != null && i.userDetails ? "authenticated" : "unauthenticated", [f, m, i]), s = (i == null ? void 0 : i.userDetails) || null, B = (i == null ? void 0 : i.staticBaseUrl) || null, I = (i == null ? void 0 : i.buildId) || null, O = l === "authenticated", b = L(r);
|
|
155
155
|
b.current = r;
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
const R = L(n);
|
|
157
|
+
R.current = n, p(() => {
|
|
158
158
|
var o;
|
|
159
|
-
f || (o = b.current) == null || o.call(b, l,
|
|
160
|
-
}, [l,
|
|
159
|
+
f || (o = b.current) == null || o.call(b, l, s);
|
|
160
|
+
}, [l, s, f]), p(() => {
|
|
161
161
|
var o;
|
|
162
|
-
v && (
|
|
163
|
-
}, [v]),
|
|
164
|
-
l === "unauthenticated" && u.autoRedirect && !f &&
|
|
162
|
+
v && (P(v), (o = R.current) == null || o.call(R, v));
|
|
163
|
+
}, [v]), p(() => {
|
|
164
|
+
l === "unauthenticated" && u.autoRedirect && !f && Y();
|
|
165
165
|
}, [l, f, u.autoRedirect]);
|
|
166
|
-
const
|
|
166
|
+
const T = g(
|
|
167
167
|
(o, y) => {
|
|
168
|
-
|
|
168
|
+
Y(o, y);
|
|
169
169
|
},
|
|
170
170
|
[]
|
|
171
171
|
), F = g(
|
|
172
172
|
async (o) => {
|
|
173
|
-
|
|
173
|
+
U.removeQueries({ queryKey: G }), await se(o);
|
|
174
174
|
},
|
|
175
|
-
[
|
|
176
|
-
),
|
|
177
|
-
if (
|
|
178
|
-
return
|
|
175
|
+
[U]
|
|
176
|
+
), j = g(async () => {
|
|
177
|
+
if (m)
|
|
178
|
+
return i || null;
|
|
179
179
|
try {
|
|
180
180
|
return (await A()).data || null;
|
|
181
181
|
} catch (o) {
|
|
182
|
-
return
|
|
182
|
+
return P(o), null;
|
|
183
183
|
}
|
|
184
|
-
}, [A,
|
|
185
|
-
(o) => (
|
|
186
|
-
[
|
|
184
|
+
}, [A, m, i]), q = g(
|
|
185
|
+
(o) => (s == null ? void 0 : s.Role) === o,
|
|
186
|
+
[s]
|
|
187
187
|
), Q = g(
|
|
188
|
-
(o) => o.includes((
|
|
189
|
-
[
|
|
188
|
+
(o) => o.includes((s == null ? void 0 : s.Role) || ""),
|
|
189
|
+
[s]
|
|
190
190
|
), K = g(() => {
|
|
191
|
-
|
|
191
|
+
P(null);
|
|
192
192
|
}, []), W = g(() => {
|
|
193
193
|
A();
|
|
194
|
-
}, [A]),
|
|
194
|
+
}, [A]), J = $(
|
|
195
195
|
() => ({
|
|
196
|
-
user:
|
|
197
|
-
staticBaseUrl:
|
|
198
|
-
buildId:
|
|
196
|
+
user: s,
|
|
197
|
+
staticBaseUrl: B,
|
|
198
|
+
buildId: I,
|
|
199
199
|
status: l,
|
|
200
|
-
isAuthenticated:
|
|
200
|
+
isAuthenticated: O,
|
|
201
201
|
isLoading: f,
|
|
202
|
-
login:
|
|
202
|
+
login: T,
|
|
203
203
|
logout: F,
|
|
204
|
-
refreshSession:
|
|
204
|
+
refreshSession: j,
|
|
205
205
|
hasRole: q,
|
|
206
206
|
hasAnyRole: Q,
|
|
207
207
|
error: S,
|
|
@@ -209,15 +209,15 @@ function we({
|
|
|
209
209
|
_forceCheck: W
|
|
210
210
|
}),
|
|
211
211
|
[
|
|
212
|
-
|
|
213
|
-
j,
|
|
212
|
+
s,
|
|
214
213
|
B,
|
|
215
|
-
l,
|
|
216
214
|
I,
|
|
217
|
-
|
|
215
|
+
l,
|
|
218
216
|
O,
|
|
219
|
-
|
|
217
|
+
f,
|
|
220
218
|
T,
|
|
219
|
+
F,
|
|
220
|
+
j,
|
|
221
221
|
q,
|
|
222
222
|
Q,
|
|
223
223
|
S,
|
|
@@ -225,17 +225,17 @@ function we({
|
|
|
225
225
|
W
|
|
226
226
|
]
|
|
227
227
|
);
|
|
228
|
-
return l === "loading" &&
|
|
228
|
+
return l === "loading" && a ? /* @__PURE__ */ C(N, { children: a }) : l === "unauthenticated" && !u.autoRedirect && c ? /* @__PURE__ */ C(N, { children: c }) : /* @__PURE__ */ C(z.Provider, { value: J, children: e });
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
const e =
|
|
230
|
+
function ce() {
|
|
231
|
+
const e = te(z);
|
|
232
232
|
if (!e)
|
|
233
233
|
throw new Error("useAuth must be used within an AuthProvider");
|
|
234
234
|
return e;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const e =
|
|
238
|
-
return
|
|
236
|
+
function Ue() {
|
|
237
|
+
const e = ce();
|
|
238
|
+
return $(
|
|
239
239
|
() => ({
|
|
240
240
|
user: e.user,
|
|
241
241
|
staticBaseUrl: e.staticBaseUrl,
|
|
@@ -269,12 +269,12 @@ function ye() {
|
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
271
|
export {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
272
|
+
ye as AuthProvider,
|
|
273
|
+
k as AuthenticationError,
|
|
274
|
+
ie as configureAuth,
|
|
275
|
+
x as getAuthBaseUrl,
|
|
276
|
+
E as getAuthConfig,
|
|
277
|
+
we as resetAuthConfig,
|
|
278
|
+
ge as setAuthProvider,
|
|
279
|
+
Ue as useAuth
|
|
280
280
|
};
|
|
@@ -8,6 +8,17 @@ export declare const isConditionGroup: (item: ConditionType | ConditionGroupType
|
|
|
8
8
|
* Type guard to check if an item is a leaf Condition (has LHSField)
|
|
9
9
|
*/
|
|
10
10
|
export declare const isCondition: (item: ConditionType | ConditionGroupType) => item is ConditionType;
|
|
11
|
+
/**
|
|
12
|
+
* Builder interface for fluent condition group construction
|
|
13
|
+
*/
|
|
14
|
+
export interface ConditionGroupBuilder {
|
|
15
|
+
/** The id of the created group */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** Add a condition to this group */
|
|
18
|
+
addCondition(condition: Omit<ConditionType, "id">): ConditionGroupBuilder;
|
|
19
|
+
/** Add a nested condition group */
|
|
20
|
+
addConditionGroup(operator: ConditionGroupOperatorType): ConditionGroupBuilder;
|
|
21
|
+
}
|
|
11
22
|
/**
|
|
12
23
|
* Hook options (minimal configuration)
|
|
13
24
|
*/
|
|
@@ -30,53 +41,45 @@ export interface UseFilterReturnType {
|
|
|
30
41
|
/** Whether any conditions exist */
|
|
31
42
|
hasConditions: boolean;
|
|
32
43
|
/**
|
|
33
|
-
* Add a leaf condition at root level
|
|
34
|
-
* @
|
|
35
|
-
|
|
36
|
-
add: (condition: Omit<ConditionType, "id">) => string;
|
|
37
|
-
/**
|
|
38
|
-
* Add a condition group at root level
|
|
39
|
-
* @returns The id of the created group
|
|
40
|
-
*/
|
|
41
|
-
addGroup: (operator: ConditionGroupOperatorType) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Add a leaf condition to a specific parent group
|
|
44
|
-
* @param parentId - The id of the parent ConditionGroup
|
|
44
|
+
* Add a leaf condition at root level or to a specific parent group
|
|
45
|
+
* @param condition - The condition to add (without id)
|
|
46
|
+
* @param parentId - Optional id of the parent ConditionGroup. If omitted, adds at root level
|
|
45
47
|
* @returns The id of the created condition
|
|
46
48
|
*/
|
|
47
|
-
|
|
49
|
+
addCondition: (condition: Omit<ConditionType, "id">, parentId?: string) => string;
|
|
48
50
|
/**
|
|
49
|
-
* Add a condition group to a specific parent group
|
|
50
|
-
* @param
|
|
51
|
+
* Add a condition group at root level or to a specific parent group
|
|
52
|
+
* @param operator - The operator for the new group ("And" | "Or" | "Not")
|
|
53
|
+
* @param parentId - Optional id of the parent ConditionGroup. If omitted, adds at root level
|
|
51
54
|
* @returns The id of the created group
|
|
52
55
|
*/
|
|
53
|
-
|
|
56
|
+
addConditionGroup: (operator: ConditionGroupOperatorType, parentId?: string) => string;
|
|
54
57
|
/**
|
|
55
58
|
* Update a leaf condition by id
|
|
56
59
|
* @param id - The id of the condition to update
|
|
57
60
|
* @param updates - Partial updates to apply
|
|
58
61
|
*/
|
|
59
|
-
|
|
62
|
+
updateCondition: (id: string, updates: Partial<Omit<ConditionType, "id">>) => void;
|
|
60
63
|
/**
|
|
61
64
|
* Update a condition group's operator by id
|
|
62
65
|
* @param id - The id of the group to update
|
|
63
66
|
* @param operator - The new operator
|
|
64
67
|
*/
|
|
65
|
-
|
|
68
|
+
updateGroupOperator: (id: string, operator: ConditionGroupOperatorType) => void;
|
|
66
69
|
/**
|
|
67
70
|
* Remove a condition or group by id
|
|
68
71
|
* @param id - The id of the item to remove
|
|
69
72
|
*/
|
|
70
|
-
|
|
73
|
+
removeCondition: (id: string) => void;
|
|
71
74
|
/**
|
|
72
75
|
* Get a condition or group by id
|
|
73
76
|
* @param id - The id to look up
|
|
74
77
|
* @returns The item or undefined if not found
|
|
75
78
|
*/
|
|
76
|
-
|
|
79
|
+
getCondition: (id: string) => ConditionType | ConditionGroupType | undefined;
|
|
77
80
|
/** Clear all conditions */
|
|
78
|
-
|
|
81
|
+
clearAllConditions: () => void;
|
|
79
82
|
/** Set the root operator for combining conditions */
|
|
80
|
-
|
|
83
|
+
setRootOperator: (op: ConditionGroupOperatorType) => void;
|
|
81
84
|
}
|
|
82
85
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useFilter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,GAClB,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,aAAa,GAAG,kBAAkB,KACvC,IAAI,IAAI,kBAEV,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,aAAa,GAAG,kBAAkB,KACvC,IAAI,IAAI,aAEV,CAAC;AAMF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,kBAAkB,CAAC,CAAC;IAC9D,oEAAoE;IACpE,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAKlC,kFAAkF;IAClF,QAAQ,EAAE,0BAA0B,CAAC;IAErC,+CAA+C;IAC/C,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,kBAAkB,CAAC,CAAC;IAEjD,yEAAyE;IACzE,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IAEhC,mCAAmC;IACnC,aAAa,EAAE,OAAO,CAAC;IAMvB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useFilter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,GAClB,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,aAAa,GAAG,kBAAkB,KACvC,IAAI,IAAI,kBAEV,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,aAAa,GAAG,kBAAkB,KACvC,IAAI,IAAI,aAEV,CAAC;AAMF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,oCAAoC;IACpC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,qBAAqB,CAAC;IAE1E,mCAAmC;IACnC,iBAAiB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,qBAAqB,CAAC;CAChF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,kBAAkB,CAAC,CAAC;IAC9D,oEAAoE;IACpE,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAKlC,kFAAkF;IAClF,QAAQ,EAAE,0BAA0B,CAAC;IAErC,+CAA+C;IAC/C,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,kBAAkB,CAAC,CAAC;IAEjD,yEAAyE;IACzE,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IAEhC,mCAAmC;IACnC,aAAa,EAAE,OAAO,CAAC;IAMvB;;;;;OAKG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAElF;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,QAAQ,EAAE,0BAA0B,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAMvF;;;;OAIG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;IAEnF;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAMhF;;;OAGG;IACH,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC;;;;OAIG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,aAAa,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAM7E,2BAA2B;IAC3B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAE/B,qDAAqD;IACrD,eAAe,EAAE,CAAC,EAAE,EAAE,0BAA0B,KAAK,IAAI,CAAC;CAC3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilter.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useFilter/useFilter.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA6KzE,wBAAgB,SAAS,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useFilter.d.ts","sourceRoot":"","sources":["../../../../sdk/components/hooks/useFilter/useFilter.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA6KzE,wBAAgB,SAAS,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CA+IjF"}
|
package/dist/filter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./useFilter-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./useFilter-Dofowpr_.cjs");exports.isCondition=i.isCondition;exports.isConditionGroup=i.isConditionGroup;exports.useFilter=i.useFilter;
|
package/dist/filter.mjs
CHANGED