@ram_28/kf-ai-sdk 1.0.11 → 1.0.12
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 +55 -48
- package/dist/api/client.d.ts +14 -14
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/datetime.d.ts +5 -5
- package/dist/api/datetime.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +2 -2
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.mjs +27 -0
- package/dist/api.types.cjs +1 -0
- package/dist/api.types.d.ts +4 -0
- package/dist/api.types.d.ts.map +1 -0
- package/dist/api.types.mjs +1 -0
- package/dist/auth/AuthProvider.d.ts +3 -3
- package/dist/auth/AuthProvider.d.ts.map +1 -1
- package/dist/auth/authClient.d.ts +4 -4
- package/dist/auth/authClient.d.ts.map +1 -1
- package/dist/auth/authConfig.d.ts +5 -5
- package/dist/auth/authConfig.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/types.d.ts +21 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/useAuth.d.ts +2 -2
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth.cjs +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +280 -0
- package/dist/auth.types.cjs +1 -0
- package/dist/auth.types.d.ts +2 -0
- package/dist/auth.types.d.ts.map +1 -0
- package/dist/auth.types.mjs +1 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/client-C15j4O5B.cjs +1 -0
- package/dist/client-CfvLiGfP.js +233 -0
- package/dist/cn-Dr87sK3i.js +2775 -0
- package/dist/cn-mXUIg4vp.cjs +1 -0
- package/dist/components/hooks/index.d.ts +3 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/index.d.ts +2 -2
- package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/types.d.ts +19 -31
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +5 -5
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +67 -76
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +2 -2
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
- package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +3 -3
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
- package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/index.d.ts +1 -1
- package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +65 -67
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/index.d.ts +1 -1
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +10 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +2 -2
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/filter.cjs +1 -0
- package/dist/filter.d.ts +3 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.mjs +6 -0
- package/dist/filter.types.cjs +1 -0
- package/dist/filter.types.d.ts +2 -0
- package/dist/filter.types.d.ts.map +1 -0
- package/dist/filter.types.mjs +1 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.mjs +1346 -0
- package/dist/form.types.cjs +1 -0
- package/dist/form.types.d.ts +2 -0
- package/dist/form.types.d.ts.map +1 -0
- package/dist/form.types.mjs +1 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/kanban.cjs +13 -0
- package/dist/kanban.d.ts +5 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.mjs +694 -0
- package/dist/kanban.types.cjs +1 -0
- package/dist/kanban.types.d.ts +2 -0
- package/dist/kanban.types.d.ts.map +1 -0
- package/dist/kanban.types.mjs +1 -0
- package/dist/kanban.ui.cjs +1 -0
- package/dist/kanban.ui.d.ts +2 -0
- package/dist/kanban.ui.d.ts.map +1 -0
- package/dist/kanban.ui.mjs +104 -0
- package/dist/metadata-2FLBsFcf.cjs +1 -0
- package/dist/metadata-DBcoDth-.js +43 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.mjs +148 -0
- package/dist/table.types.cjs +1 -0
- package/dist/table.types.d.ts +2 -0
- package/dist/table.types.d.ts.map +1 -0
- package/dist/table.types.mjs +1 -0
- package/dist/types/base-fields.d.ts +45 -45
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/common.d.ts +45 -61
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.mjs +1 -0
- package/dist/useFilter-CXFqEHyI.js +129 -0
- package/dist/useFilter-D-bCDo6Z.cjs +1 -0
- package/dist/utils/formatting.d.ts +4 -4
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.mjs +105 -0
- package/package.json +147 -9
- package/sdk/api/client.ts +51 -51
- package/sdk/api/datetime.ts +5 -5
- package/sdk/api/index.ts +28 -33
- package/sdk/api/metadata.ts +4 -4
- package/sdk/api.ts +24 -0
- package/sdk/api.types.ts +58 -0
- package/sdk/auth/AuthProvider.tsx +18 -18
- package/sdk/auth/authClient.ts +9 -9
- package/sdk/auth/authConfig.ts +9 -9
- package/sdk/auth/index.ts +5 -5
- package/sdk/auth/types.ts +21 -21
- package/sdk/auth/useAuth.ts +2 -2
- package/sdk/auth.ts +22 -0
- package/sdk/auth.types.ts +28 -0
- package/sdk/base-types.ts +45 -0
- package/sdk/components/hooks/index.ts +22 -22
- package/sdk/components/hooks/useFilter/index.ts +8 -14
- package/sdk/components/hooks/useFilter/types.ts +29 -58
- package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
- package/sdk/components/hooks/useForm/apiClient.ts +8 -8
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
- package/sdk/components/hooks/useForm/index.ts +24 -24
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
- package/sdk/components/hooks/useForm/types.ts +66 -82
- package/sdk/components/hooks/useForm/useForm.ts +15 -21
- package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
- package/sdk/components/hooks/useKanban/context.ts +3 -3
- package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
- package/sdk/components/hooks/useKanban/index.ts +26 -26
- package/sdk/components/hooks/useKanban/types.ts +69 -71
- package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
- package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
- package/sdk/components/hooks/useTable/index.ts +5 -1
- package/sdk/components/hooks/useTable/types.ts +10 -10
- package/sdk/components/hooks/useTable/useTable.ts +10 -10
- package/sdk/filter.ts +13 -0
- package/sdk/filter.types.ts +17 -0
- package/sdk/form.ts +15 -0
- package/sdk/form.types.ts +46 -0
- package/sdk/kanban.ts +23 -0
- package/sdk/kanban.types.ts +50 -0
- package/sdk/kanban.ui.ts +16 -0
- package/sdk/table.ts +7 -0
- package/sdk/table.types.ts +13 -0
- package/sdk/types/base-fields.ts +47 -47
- package/sdk/types/common.ts +47 -71
- package/sdk/types/index.ts +1 -1
- package/sdk/utils/formatting.ts +4 -4
- package/sdk/utils.ts +10 -0
- package/dist/index.cjs +0 -45
- package/dist/index.mjs +0 -6387
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
let o = {
|
|
2
|
+
baseUrl: "",
|
|
3
|
+
headers: {
|
|
4
|
+
"Content-Type": "application/json"
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
function u(e) {
|
|
8
|
+
o.baseUrl = e;
|
|
9
|
+
}
|
|
10
|
+
function h(e) {
|
|
11
|
+
o.headers = { ...o.headers, ...e };
|
|
12
|
+
}
|
|
13
|
+
function d() {
|
|
14
|
+
return { ...o.headers };
|
|
15
|
+
}
|
|
16
|
+
function y() {
|
|
17
|
+
return o.baseUrl || "";
|
|
18
|
+
}
|
|
19
|
+
function i(e) {
|
|
20
|
+
if (e == null)
|
|
21
|
+
return e;
|
|
22
|
+
if (Array.isArray(e))
|
|
23
|
+
return e.map((s) => i(s));
|
|
24
|
+
if (typeof e == "object") {
|
|
25
|
+
if ("$__dt__" in e)
|
|
26
|
+
return new Date(e.$__dt__ * 1e3);
|
|
27
|
+
if ("$__d__" in e)
|
|
28
|
+
return new Date(e.$__d__);
|
|
29
|
+
const s = {};
|
|
30
|
+
for (const [n, t] of Object.entries(e))
|
|
31
|
+
s[n] = i(t);
|
|
32
|
+
return s;
|
|
33
|
+
}
|
|
34
|
+
return e;
|
|
35
|
+
}
|
|
36
|
+
function w(e) {
|
|
37
|
+
const s = o.baseUrl, n = o.headers;
|
|
38
|
+
return {
|
|
39
|
+
async get(t) {
|
|
40
|
+
const r = await fetch(`${s}/api/app/${e}/${t}/read`, {
|
|
41
|
+
method: "GET",
|
|
42
|
+
headers: n
|
|
43
|
+
});
|
|
44
|
+
if (!r.ok)
|
|
45
|
+
throw new Error(`Failed to get ${e} ${t}: ${r.statusText}`);
|
|
46
|
+
const a = await r.json();
|
|
47
|
+
return i(a.Data);
|
|
48
|
+
},
|
|
49
|
+
async create(t) {
|
|
50
|
+
const r = await fetch(`${s}/api/app/${e}/create`, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: n,
|
|
53
|
+
body: JSON.stringify(t)
|
|
54
|
+
});
|
|
55
|
+
if (!r.ok)
|
|
56
|
+
throw new Error(`Failed to create ${e}: ${r.statusText}`);
|
|
57
|
+
return r.json();
|
|
58
|
+
},
|
|
59
|
+
async update(t, r) {
|
|
60
|
+
const a = await fetch(`${s}/api/app/${e}/${t}/update`, {
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: n,
|
|
63
|
+
body: JSON.stringify(r)
|
|
64
|
+
});
|
|
65
|
+
if (!a.ok)
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Failed to update ${e} ${t}: ${a.statusText}`
|
|
68
|
+
);
|
|
69
|
+
return a.json();
|
|
70
|
+
},
|
|
71
|
+
async delete(t) {
|
|
72
|
+
const r = await fetch(`${s}/api/app/${e}/${t}/delete`, {
|
|
73
|
+
method: "DELETE",
|
|
74
|
+
headers: n
|
|
75
|
+
});
|
|
76
|
+
if (!r.ok)
|
|
77
|
+
throw new Error(
|
|
78
|
+
`Failed to delete ${e} ${t}: ${r.statusText}`
|
|
79
|
+
);
|
|
80
|
+
return r.json();
|
|
81
|
+
},
|
|
82
|
+
async list(t) {
|
|
83
|
+
const r = {
|
|
84
|
+
Type: "List",
|
|
85
|
+
...t
|
|
86
|
+
}, a = await fetch(`${s}/api/app/${e}/list`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: n,
|
|
89
|
+
body: JSON.stringify(r)
|
|
90
|
+
});
|
|
91
|
+
if (!a.ok)
|
|
92
|
+
throw new Error(`Failed to list ${e}: ${a.statusText}`);
|
|
93
|
+
return {
|
|
94
|
+
Data: (await a.json()).Data.map((f) => i(f))
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
async count(t) {
|
|
98
|
+
var p, $;
|
|
99
|
+
const r = {
|
|
100
|
+
Type: "Metric",
|
|
101
|
+
GroupBy: [],
|
|
102
|
+
Metric: [{ Field: "_id", Type: "Count" }],
|
|
103
|
+
...(t == null ? void 0 : t.Filter) && { Filter: t.Filter }
|
|
104
|
+
}, a = await fetch(`${s}/api/app/${e}/metric`, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: n,
|
|
107
|
+
body: JSON.stringify(r)
|
|
108
|
+
});
|
|
109
|
+
if (!a.ok)
|
|
110
|
+
throw new Error(`Failed to count ${e}: ${a.statusText}`);
|
|
111
|
+
return { Count: (($ = (p = (await a.json()).Data) == null ? void 0 : p[0]) == null ? void 0 : $.count__id) ?? 0 };
|
|
112
|
+
},
|
|
113
|
+
// ============================================================
|
|
114
|
+
// DRAFT/INTERACTIVE OPERATIONS
|
|
115
|
+
// ============================================================
|
|
116
|
+
async draft(t) {
|
|
117
|
+
const r = await fetch(`${s}/api/app/${e}/draft`, {
|
|
118
|
+
method: "POST",
|
|
119
|
+
headers: n,
|
|
120
|
+
body: JSON.stringify(t)
|
|
121
|
+
});
|
|
122
|
+
if (!r.ok)
|
|
123
|
+
throw new Error(
|
|
124
|
+
`Failed to create draft for ${e}: ${r.statusText}`
|
|
125
|
+
);
|
|
126
|
+
return r.json();
|
|
127
|
+
},
|
|
128
|
+
async draftUpdate(t, r) {
|
|
129
|
+
const a = await fetch(`${s}/api/app/${e}/${t}/draft`, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: n,
|
|
132
|
+
body: JSON.stringify(r)
|
|
133
|
+
});
|
|
134
|
+
if (!a.ok)
|
|
135
|
+
throw new Error(
|
|
136
|
+
`Failed to update draft for ${e} ${t}: ${a.statusText}`
|
|
137
|
+
);
|
|
138
|
+
return a.json();
|
|
139
|
+
},
|
|
140
|
+
async draftPatch(t, r) {
|
|
141
|
+
const a = await fetch(`${s}/api/app/${e}/${t}/draft`, {
|
|
142
|
+
method: "PATCH",
|
|
143
|
+
headers: n,
|
|
144
|
+
body: JSON.stringify(r)
|
|
145
|
+
});
|
|
146
|
+
if (!a.ok)
|
|
147
|
+
throw new Error(
|
|
148
|
+
`Failed to patch draft for ${e} ${t}: ${a.statusText}`
|
|
149
|
+
);
|
|
150
|
+
return a.json();
|
|
151
|
+
},
|
|
152
|
+
async draftInteraction(t) {
|
|
153
|
+
const r = await fetch(`${s}/api/app/${e}/draft`, {
|
|
154
|
+
method: "PATCH",
|
|
155
|
+
headers: n,
|
|
156
|
+
body: JSON.stringify(t)
|
|
157
|
+
});
|
|
158
|
+
if (!r.ok)
|
|
159
|
+
throw new Error(
|
|
160
|
+
`Failed to create interactive draft for ${e}: ${r.statusText}`
|
|
161
|
+
);
|
|
162
|
+
return r.json();
|
|
163
|
+
},
|
|
164
|
+
// ============================================================
|
|
165
|
+
// QUERY OPERATIONS
|
|
166
|
+
// ============================================================
|
|
167
|
+
async metric(t) {
|
|
168
|
+
const r = {
|
|
169
|
+
Type: "Metric",
|
|
170
|
+
...t
|
|
171
|
+
}, a = await fetch(`${s}/api/app/${e}/metric`, {
|
|
172
|
+
method: "POST",
|
|
173
|
+
headers: n,
|
|
174
|
+
body: JSON.stringify(r)
|
|
175
|
+
});
|
|
176
|
+
if (!a.ok)
|
|
177
|
+
throw new Error(
|
|
178
|
+
`Failed to get metrics for ${e}: ${a.statusText}`
|
|
179
|
+
);
|
|
180
|
+
return a.json();
|
|
181
|
+
},
|
|
182
|
+
async pivot(t) {
|
|
183
|
+
const r = {
|
|
184
|
+
Type: "Pivot",
|
|
185
|
+
...t
|
|
186
|
+
}, a = await fetch(`${s}/api/app/${e}/pivot`, {
|
|
187
|
+
method: "POST",
|
|
188
|
+
headers: n,
|
|
189
|
+
body: JSON.stringify(r)
|
|
190
|
+
});
|
|
191
|
+
if (!a.ok)
|
|
192
|
+
throw new Error(
|
|
193
|
+
`Failed to get pivot data for ${e}: ${a.statusText}`
|
|
194
|
+
);
|
|
195
|
+
return a.json();
|
|
196
|
+
},
|
|
197
|
+
// ============================================================
|
|
198
|
+
// METADATA OPERATIONS
|
|
199
|
+
// ============================================================
|
|
200
|
+
async fields() {
|
|
201
|
+
const t = await fetch(`${s}/api/app/${e}/fields`, {
|
|
202
|
+
method: "GET",
|
|
203
|
+
headers: n
|
|
204
|
+
});
|
|
205
|
+
if (!t.ok)
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Failed to get fields for ${e}: ${t.statusText}`
|
|
208
|
+
);
|
|
209
|
+
return t.json();
|
|
210
|
+
},
|
|
211
|
+
async fetchField(t, r) {
|
|
212
|
+
const a = await fetch(
|
|
213
|
+
`${s}/api/app/${e}/${t}/field/${r}/fetch`,
|
|
214
|
+
{
|
|
215
|
+
method: "GET",
|
|
216
|
+
headers: n
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
if (!a.ok)
|
|
220
|
+
throw new Error(
|
|
221
|
+
`Failed to fetch field ${r} for ${e}: ${a.statusText}`
|
|
222
|
+
);
|
|
223
|
+
return (await a.json()).Data;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
w as a,
|
|
229
|
+
h as b,
|
|
230
|
+
y as c,
|
|
231
|
+
d as g,
|
|
232
|
+
u as s
|
|
233
|
+
};
|