@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.
Files changed (193) hide show
  1. package/README.md +55 -48
  2. package/dist/api/client.d.ts +14 -14
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/datetime.d.ts +5 -5
  5. package/dist/api/datetime.d.ts.map +1 -1
  6. package/dist/api/index.d.ts +1 -1
  7. package/dist/api/index.d.ts.map +1 -1
  8. package/dist/api/metadata.d.ts +2 -2
  9. package/dist/api/metadata.d.ts.map +1 -1
  10. package/dist/api.cjs +1 -0
  11. package/dist/api.d.ts +4 -0
  12. package/dist/api.d.ts.map +1 -0
  13. package/dist/api.mjs +27 -0
  14. package/dist/api.types.cjs +1 -0
  15. package/dist/api.types.d.ts +4 -0
  16. package/dist/api.types.d.ts.map +1 -0
  17. package/dist/api.types.mjs +1 -0
  18. package/dist/auth/AuthProvider.d.ts +3 -3
  19. package/dist/auth/AuthProvider.d.ts.map +1 -1
  20. package/dist/auth/authClient.d.ts +4 -4
  21. package/dist/auth/authClient.d.ts.map +1 -1
  22. package/dist/auth/authConfig.d.ts +5 -5
  23. package/dist/auth/authConfig.d.ts.map +1 -1
  24. package/dist/auth/index.d.ts +1 -1
  25. package/dist/auth/index.d.ts.map +1 -1
  26. package/dist/auth/types.d.ts +21 -21
  27. package/dist/auth/types.d.ts.map +1 -1
  28. package/dist/auth/useAuth.d.ts +2 -2
  29. package/dist/auth/useAuth.d.ts.map +1 -1
  30. package/dist/auth.cjs +1 -0
  31. package/dist/auth.d.ts +5 -0
  32. package/dist/auth.d.ts.map +1 -0
  33. package/dist/auth.mjs +280 -0
  34. package/dist/auth.types.cjs +1 -0
  35. package/dist/auth.types.d.ts +2 -0
  36. package/dist/auth.types.d.ts.map +1 -0
  37. package/dist/auth.types.mjs +1 -0
  38. package/dist/base-types.d.ts +2 -0
  39. package/dist/base-types.d.ts.map +1 -0
  40. package/dist/client-C15j4O5B.cjs +1 -0
  41. package/dist/client-CfvLiGfP.js +233 -0
  42. package/dist/cn-Dr87sK3i.js +2775 -0
  43. package/dist/cn-mXUIg4vp.cjs +1 -0
  44. package/dist/components/hooks/index.d.ts +3 -3
  45. package/dist/components/hooks/index.d.ts.map +1 -1
  46. package/dist/components/hooks/useFilter/index.d.ts +2 -2
  47. package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
  48. package/dist/components/hooks/useFilter/types.d.ts +19 -31
  49. package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
  50. package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
  51. package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
  52. package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
  53. package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
  54. package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
  55. package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
  56. package/dist/components/hooks/useForm/index.d.ts +5 -5
  57. package/dist/components/hooks/useForm/index.d.ts.map +1 -1
  58. package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
  59. package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
  60. package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
  61. package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
  62. package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
  63. package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
  64. package/dist/components/hooks/useForm/types.d.ts +67 -76
  65. package/dist/components/hooks/useForm/types.d.ts.map +1 -1
  66. package/dist/components/hooks/useForm/useForm.d.ts +2 -2
  67. package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
  68. package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
  69. package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
  70. package/dist/components/hooks/useKanban/context.d.ts +3 -3
  71. package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
  72. package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
  73. package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
  74. package/dist/components/hooks/useKanban/index.d.ts +1 -1
  75. package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
  76. package/dist/components/hooks/useKanban/types.d.ts +65 -67
  77. package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
  78. package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
  79. package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
  80. package/dist/components/hooks/useTable/index.d.ts +1 -1
  81. package/dist/components/hooks/useTable/index.d.ts.map +1 -1
  82. package/dist/components/hooks/useTable/types.d.ts +10 -10
  83. package/dist/components/hooks/useTable/types.d.ts.map +1 -1
  84. package/dist/components/hooks/useTable/useTable.d.ts +2 -2
  85. package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
  86. package/dist/filter.cjs +1 -0
  87. package/dist/filter.d.ts +3 -0
  88. package/dist/filter.d.ts.map +1 -0
  89. package/dist/filter.mjs +6 -0
  90. package/dist/filter.types.cjs +1 -0
  91. package/dist/filter.types.d.ts +2 -0
  92. package/dist/filter.types.d.ts.map +1 -0
  93. package/dist/filter.types.mjs +1 -0
  94. package/dist/form.cjs +1 -0
  95. package/dist/form.d.ts +3 -0
  96. package/dist/form.d.ts.map +1 -0
  97. package/dist/form.mjs +1346 -0
  98. package/dist/form.types.cjs +1 -0
  99. package/dist/form.types.d.ts +2 -0
  100. package/dist/form.types.d.ts.map +1 -0
  101. package/dist/form.types.mjs +1 -0
  102. package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
  103. package/dist/jsx-runtime-DGlMoOmv.js +630 -0
  104. package/dist/kanban.cjs +13 -0
  105. package/dist/kanban.d.ts +5 -0
  106. package/dist/kanban.d.ts.map +1 -0
  107. package/dist/kanban.mjs +694 -0
  108. package/dist/kanban.types.cjs +1 -0
  109. package/dist/kanban.types.d.ts +2 -0
  110. package/dist/kanban.types.d.ts.map +1 -0
  111. package/dist/kanban.types.mjs +1 -0
  112. package/dist/kanban.ui.cjs +1 -0
  113. package/dist/kanban.ui.d.ts +2 -0
  114. package/dist/kanban.ui.d.ts.map +1 -0
  115. package/dist/kanban.ui.mjs +104 -0
  116. package/dist/metadata-2FLBsFcf.cjs +1 -0
  117. package/dist/metadata-DBcoDth-.js +43 -0
  118. package/dist/table.cjs +1 -0
  119. package/dist/table.d.ts +2 -0
  120. package/dist/table.d.ts.map +1 -0
  121. package/dist/table.mjs +148 -0
  122. package/dist/table.types.cjs +1 -0
  123. package/dist/table.types.d.ts +2 -0
  124. package/dist/table.types.d.ts.map +1 -0
  125. package/dist/table.types.mjs +1 -0
  126. package/dist/types/base-fields.d.ts +45 -45
  127. package/dist/types/base-fields.d.ts.map +1 -1
  128. package/dist/types/common.d.ts +45 -61
  129. package/dist/types/common.d.ts.map +1 -1
  130. package/dist/types.cjs +1 -0
  131. package/dist/types.mjs +1 -0
  132. package/dist/useFilter-CXFqEHyI.js +129 -0
  133. package/dist/useFilter-D-bCDo6Z.cjs +1 -0
  134. package/dist/utils/formatting.d.ts +4 -4
  135. package/dist/utils/formatting.d.ts.map +1 -1
  136. package/dist/utils.cjs +4 -0
  137. package/dist/utils.d.ts +3 -0
  138. package/dist/utils.d.ts.map +1 -0
  139. package/dist/utils.mjs +105 -0
  140. package/package.json +147 -9
  141. package/sdk/api/client.ts +51 -51
  142. package/sdk/api/datetime.ts +5 -5
  143. package/sdk/api/index.ts +28 -33
  144. package/sdk/api/metadata.ts +4 -4
  145. package/sdk/api.ts +24 -0
  146. package/sdk/api.types.ts +58 -0
  147. package/sdk/auth/AuthProvider.tsx +18 -18
  148. package/sdk/auth/authClient.ts +9 -9
  149. package/sdk/auth/authConfig.ts +9 -9
  150. package/sdk/auth/index.ts +5 -5
  151. package/sdk/auth/types.ts +21 -21
  152. package/sdk/auth/useAuth.ts +2 -2
  153. package/sdk/auth.ts +22 -0
  154. package/sdk/auth.types.ts +28 -0
  155. package/sdk/base-types.ts +45 -0
  156. package/sdk/components/hooks/index.ts +22 -22
  157. package/sdk/components/hooks/useFilter/index.ts +8 -14
  158. package/sdk/components/hooks/useFilter/types.ts +29 -58
  159. package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
  160. package/sdk/components/hooks/useForm/apiClient.ts +8 -8
  161. package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
  162. package/sdk/components/hooks/useForm/index.ts +24 -24
  163. package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
  164. package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
  165. package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
  166. package/sdk/components/hooks/useForm/types.ts +66 -82
  167. package/sdk/components/hooks/useForm/useForm.ts +15 -21
  168. package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
  169. package/sdk/components/hooks/useKanban/context.ts +3 -3
  170. package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
  171. package/sdk/components/hooks/useKanban/index.ts +26 -26
  172. package/sdk/components/hooks/useKanban/types.ts +69 -71
  173. package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
  174. package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
  175. package/sdk/components/hooks/useTable/index.ts +5 -1
  176. package/sdk/components/hooks/useTable/types.ts +10 -10
  177. package/sdk/components/hooks/useTable/useTable.ts +10 -10
  178. package/sdk/filter.ts +13 -0
  179. package/sdk/filter.types.ts +17 -0
  180. package/sdk/form.ts +15 -0
  181. package/sdk/form.types.ts +46 -0
  182. package/sdk/kanban.ts +23 -0
  183. package/sdk/kanban.types.ts +50 -0
  184. package/sdk/kanban.ui.ts +16 -0
  185. package/sdk/table.ts +7 -0
  186. package/sdk/table.types.ts +13 -0
  187. package/sdk/types/base-fields.ts +47 -47
  188. package/sdk/types/common.ts +47 -71
  189. package/sdk/types/index.ts +1 -1
  190. package/sdk/utils/formatting.ts +4 -4
  191. package/sdk/utils.ts +10 -0
  192. package/dist/index.cjs +0 -45
  193. package/dist/index.mjs +0 -6387
@@ -6,13 +6,13 @@
6
6
  import { useState, useMemo, useCallback, useRef, useEffect } from "react";
7
7
  import { useQuery, useMutation, useQueryClient, useQueries, keepPreviousData } from "@tanstack/react-query";
8
8
  import { api } from "../../../api";
9
- import type { ListOptions, ListResponse } from "../../../types/common";
9
+ import type { ListOptionsType, ListResponseType } from "../../../types/common";
10
10
  import { useFilter } from "../useFilter";
11
11
 
12
12
  import type {
13
- UseKanbanOptions,
14
- UseKanbanReturn,
15
- KanbanCard,
13
+ UseKanbanOptionsType,
14
+ UseKanbanReturnType,
15
+ KanbanCardType,
16
16
  } from "./types";
17
17
  import { useDragDropManager } from "./dragDropManager";
18
18
 
@@ -21,11 +21,10 @@ import { useDragDropManager } from "./dragDropManager";
21
21
  // ============================================================
22
22
 
23
23
  export function useKanban<T extends Record<string, any> = Record<string, any>>(
24
- options: UseKanbanOptions<T>
25
- ): UseKanbanReturn<T> {
24
+ options: UseKanbanOptionsType<T>
25
+ ): UseKanbanReturnType<T> {
26
26
  const {
27
27
  columns: columnConfigs,
28
- cardSource,
29
28
  source,
30
29
  enableDragDrop = true,
31
30
  initialState,
@@ -36,13 +35,6 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
36
35
  onError,
37
36
  } = options;
38
37
 
39
- // Use source or cardSource (backwards compatibility)
40
- const dataSource = source || cardSource;
41
-
42
- if (!dataSource) {
43
- throw new Error('useKanban requires either "source" or "cardSource" parameter');
44
- }
45
-
46
38
  // ============================================================
47
39
  // STATE MANAGEMENT
48
40
  // ============================================================
@@ -95,7 +87,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
95
87
 
96
88
  // Helper to generate API options for a specific column
97
89
  // This is used for both initial fetching and mutation updates
98
- const getColumnApiOptions = useCallback((columnId: string): ListOptions => {
90
+ const getColumnApiOptions = useCallback((columnId: string): ListOptionsType => {
99
91
  // 1. Construct Compound Filter Payload
100
92
  const columnFilterObject = {
101
93
  LHSField: "columnId",
@@ -128,7 +120,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
128
120
  }
129
121
 
130
122
  // 2. Construct API Options
131
- const opts: ListOptions = {
123
+ const opts: ListOptionsType = {
132
124
  Page: 1, // Always page 1 due to expanding PageSize strategy
133
125
  PageSize: columnPagination[columnId] || 10,
134
126
  Filter: combinedPayload,
@@ -163,10 +155,10 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
163
155
  queries: columnConfigs.map((column) => {
164
156
  const opts = getColumnApiOptions(column.id);
165
157
  return {
166
- queryKey: ["kanban-cards", dataSource, column.id, opts],
167
- queryFn: async (): Promise<ListResponse<KanbanCard<T>>> => {
158
+ queryKey: ["kanban-cards", source, column.id, opts],
159
+ queryFn: async (): Promise<ListResponseType<KanbanCardType<T>>> => {
168
160
  try {
169
- return await api<KanbanCard<T>>(dataSource).list(opts);
161
+ return await api<KanbanCardType<T>>(source).list(opts);
170
162
  } catch (err) {
171
163
  throw err;
172
164
  }
@@ -185,9 +177,9 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
185
177
  await Promise.all(columnQueries.map(q => q.refetch()));
186
178
  };
187
179
 
188
- const cardApiOptions = useMemo((): ListOptions => {
180
+ const cardApiOptions = useMemo((): ListOptionsType => {
189
181
  // This is for the GLOBAL count (ignoring column split)
190
- const opts: ListOptions = {};
182
+ const opts: ListOptionsType = {};
191
183
  if (search.query) opts.Search = search.query;
192
184
  if (filter.payload) opts.Filter = filter.payload;
193
185
  return opts;
@@ -198,10 +190,10 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
198
190
  isLoading: isLoadingCount,
199
191
  error: countError,
200
192
  } = useQuery({
201
- queryKey: ["kanban-count", dataSource, cardApiOptions],
193
+ queryKey: ["kanban-count", source, cardApiOptions],
202
194
  queryFn: async () => {
203
195
  try {
204
- return await api<KanbanCard<T>>(dataSource).count(cardApiOptions);
196
+ return await api<KanbanCardType<T>>(source).count(cardApiOptions);
205
197
  } catch (err) {
206
198
  if (onErrorRef.current) {
207
199
  onErrorRef.current(err as Error);
@@ -218,19 +210,19 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
218
210
  // ============================================================
219
211
 
220
212
  const createCardMutation = useMutation({
221
- mutationFn: async (card: Partial<KanbanCard<T>> & { columnId: string }) => {
213
+ mutationFn: async (card: Partial<KanbanCardType<T>> & { columnId: string }) => {
222
214
  const position = card.position ?? 999999;
223
- const response = await api<KanbanCard<T>>(dataSource).create({ ...card, position });
215
+ const response = await api<KanbanCardType<T>>(source).create({ ...card, position });
224
216
  return response._id;
225
217
  },
226
218
  onMutate: async (newCardVariables) => {
227
219
  const columnId = newCardVariables.columnId;
228
220
  const opts = getColumnApiOptions(columnId);
229
- const queryKey = ["kanban-cards", dataSource, columnId, opts];
221
+ const queryKey = ["kanban-cards", source, columnId, opts];
230
222
 
231
223
  await queryClient.cancelQueries({ queryKey });
232
224
 
233
- const previousCards = queryClient.getQueryData<ListResponse<KanbanCard<T>>>(queryKey);
225
+ const previousCards = queryClient.getQueryData<ListResponseType<KanbanCardType<T>>>(queryKey);
234
226
 
235
227
  if (previousCards) {
236
228
  const currentCards = previousCards.Data;
@@ -243,9 +235,9 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
243
235
  position,
244
236
  _created_at: new Date(),
245
237
  _modified_at: new Date(),
246
- } as KanbanCard<T>;
238
+ } as KanbanCardType<T>;
247
239
 
248
- queryClient.setQueryData<ListResponse<KanbanCard<T>>>(queryKey, {
240
+ queryClient.setQueryData<ListResponseType<KanbanCardType<T>>>(queryKey, {
249
241
  ...previousCards,
250
242
  Data: [...previousCards.Data, newCard],
251
243
  });
@@ -260,7 +252,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
260
252
  onCardCreateRef.current?.({
261
253
  _id: cardId,
262
254
  ..._variables,
263
- } as KanbanCard<T>);
255
+ } as KanbanCardType<T>);
264
256
  },
265
257
  onError: (error, _variables, context) => {
266
258
  if (context?.previousCards && context?.queryKey) {
@@ -271,17 +263,17 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
271
263
  onSettled: (_data, _error, variables) => {
272
264
  const columnId = variables.columnId;
273
265
  const opts = getColumnApiOptions(columnId);
274
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource, columnId, opts] });
266
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source, columnId, opts] });
275
267
  }
276
268
  });
277
269
 
278
270
  const updateCardMutation = useMutation({
279
- mutationFn: async ({ id, updates }: { id: string; updates: Partial<KanbanCard<T>> }) => {
280
- await api<KanbanCard<T>>(dataSource).update(id, updates);
271
+ mutationFn: async ({ id, updates }: { id: string; updates: Partial<KanbanCardType<T>> }) => {
272
+ await api<KanbanCardType<T>>(source).update(id, updates);
281
273
  return { id, updates };
282
274
  },
283
275
  onMutate: async () => {
284
- await queryClient.cancelQueries({ queryKey: ["kanban-cards", dataSource] });
276
+ await queryClient.cancelQueries({ queryKey: ["kanban-cards", source] });
285
277
  return {};
286
278
  },
287
279
  onSuccess: async (result) => {
@@ -291,17 +283,17 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
291
283
  onErrorRef.current?.(error as Error);
292
284
  },
293
285
  onSettled: () => {
294
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource] });
286
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source] });
295
287
  }
296
288
  });
297
289
 
298
290
  const deleteCardMutation = useMutation({
299
291
  mutationFn: async (id: string) => {
300
- await api(dataSource).delete(id);
292
+ await api(source).delete(id);
301
293
  return id;
302
294
  },
303
295
  onMutate: async () => {
304
- await queryClient.cancelQueries({ queryKey: ["kanban-cards", dataSource] });
296
+ await queryClient.cancelQueries({ queryKey: ["kanban-cards", source] });
305
297
  return {};
306
298
  },
307
299
  onSuccess: async (id) => {
@@ -311,27 +303,27 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
311
303
  onErrorRef.current?.(error as Error);
312
304
  },
313
305
  onSettled: () => {
314
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource] });
306
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source] });
315
307
  }
316
308
  });
317
309
 
318
310
  const moveCardMutation = useMutation({
319
311
  mutationFn: async ({ cardId, fromColumnId, toColumnId, position }: { cardId: string; fromColumnId: string; toColumnId: string; position?: number }) => {
320
312
  const updates: any = { columnId: toColumnId, ...(position !== undefined && { position }) };
321
- await api<KanbanCard<T>>(dataSource).update(cardId, updates);
313
+ await api<KanbanCardType<T>>(source).update(cardId, updates);
322
314
  return { cardId, fromColumnId, toColumnId, position };
323
315
  },
324
316
  onMutate: async ({ cardId, fromColumnId, toColumnId, position }) => {
325
317
  const fromOpts = getColumnApiOptions(fromColumnId);
326
318
  const toOpts = getColumnApiOptions(toColumnId);
327
- const fromQueryKey = ["kanban-cards", dataSource, fromColumnId, fromOpts];
328
- const toQueryKey = ["kanban-cards", dataSource, toColumnId, toOpts];
319
+ const fromQueryKey = ["kanban-cards", source, fromColumnId, fromOpts];
320
+ const toQueryKey = ["kanban-cards", source, toColumnId, toOpts];
329
321
 
330
322
  await queryClient.cancelQueries({ queryKey: fromQueryKey });
331
323
  await queryClient.cancelQueries({ queryKey: toQueryKey });
332
324
 
333
- const previousFromData = queryClient.getQueryData<ListResponse<KanbanCard<T>>>(fromQueryKey);
334
- const previousToData = queryClient.getQueryData<ListResponse<KanbanCard<T>>>(toQueryKey);
325
+ const previousFromData = queryClient.getQueryData<ListResponseType<KanbanCardType<T>>>(fromQueryKey);
326
+ const previousToData = queryClient.getQueryData<ListResponseType<KanbanCardType<T>>>(toQueryKey);
335
327
 
336
328
  if (previousFromData && previousToData) {
337
329
  const cardToMove = previousFromData.Data.find(c => c._id === cardId);
@@ -387,8 +379,8 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
387
379
  onSettled: (_data, _error, variables) => {
388
380
  const fromOpts = getColumnApiOptions(variables.fromColumnId);
389
381
  const toOpts = getColumnApiOptions(variables.toColumnId);
390
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource, variables.fromColumnId, fromOpts] });
391
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource, variables.toColumnId, toOpts] });
382
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source, variables.fromColumnId, fromOpts] });
383
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source, variables.toColumnId, toOpts] });
392
384
  }
393
385
  });
394
386
 
@@ -397,13 +389,13 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
397
389
  const updates = cardIds.map((id, index) => ({ id, position: index, columnId }));
398
390
  await Promise.all(
399
391
  updates.map((update) =>
400
- api<KanbanCard<T>>(dataSource).update(update.id, { position: update.position, columnId: update.columnId } as Partial<KanbanCard<T>>)
392
+ api<KanbanCardType<T>>(source).update(update.id, { position: update.position, columnId: update.columnId } as Partial<KanbanCardType<T>>)
401
393
  )
402
394
  );
403
395
  },
404
396
  onMutate: async ({ columnId }) => {
405
397
  const opts = getColumnApiOptions(columnId);
406
- const queryKey = ["kanban-cards", dataSource, columnId, opts];
398
+ const queryKey = ["kanban-cards", source, columnId, opts];
407
399
  await queryClient.cancelQueries({ queryKey });
408
400
  return {};
409
401
  },
@@ -413,7 +405,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
413
405
  },
414
406
  onSettled: (_data, _error, variables) => {
415
407
  const opts = getColumnApiOptions(variables.columnId);
416
- queryClient.invalidateQueries({ queryKey: ["kanban-cards", dataSource, variables.columnId, opts] });
408
+ queryClient.invalidateQueries({ queryKey: ["kanban-cards", source, variables.columnId, opts] });
417
409
  }
418
410
  });
419
411
 
@@ -422,7 +414,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
422
414
  // ============================================================
423
415
 
424
416
  const handleCardMove = useCallback(
425
- async (card: KanbanCard<T>, fromColumnId: string, toColumnId: string) => {
417
+ async (card: KanbanCardType<T>, fromColumnId: string, toColumnId: string) => {
426
418
  try {
427
419
  await moveCardMutation.mutateAsync({
428
420
  cardId: card._id,
@@ -477,7 +469,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
477
469
  // ============================================================
478
470
 
479
471
  const getCardProps = useCallback(
480
- (card: KanbanCard<T>) => ({
472
+ (card: KanbanCardType<T>) => ({
481
473
  draggable: true,
482
474
  role: "option",
483
475
  "aria-selected": enableDragDrop && dragDropManager.draggedCard?._id === card._id,
@@ -587,7 +579,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
587
579
  // Card Operations (Flat Access)
588
580
  createCard: createCardMutation.mutateAsync,
589
581
  updateCard: useCallback(
590
- async (id: string, updates: Partial<KanbanCard<T>>) => {
582
+ async (id: string, updates: Partial<KanbanCardType<T>>) => {
591
583
  await updateCardMutation.mutateAsync({ id, updates });
592
584
  },
593
585
  [updateCardMutation]
@@ -6,7 +6,7 @@
6
6
  import { useState, useMemo, useCallback, useRef } from "react";
7
7
  import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
8
8
  import { api } from "../../../api";
9
- import type { ListOptions, ListResponse } from "../../../types/common";
9
+ import type { ListOptionsType, ListResponseType } from "../../../types/common";
10
10
 
11
11
  // ============================================================
12
12
  // TYPE DEFINITIONS
@@ -121,8 +121,8 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
121
121
  // API OPTIONS
122
122
  // ============================================================
123
123
 
124
- const apiOptions = useMemo((): ListOptions => {
125
- const opts: ListOptions = {};
124
+ const apiOptions = useMemo((): ListOptionsType => {
125
+ const opts: ListOptionsType = {};
126
126
 
127
127
  // Default sorting by column and position - using correct API format
128
128
  opts.Sort = [
@@ -151,7 +151,7 @@ export function useKanban<T extends Record<string, any> = Record<string, any>>(
151
151
  refetch: refetchCards,
152
152
  } = useQuery({
153
153
  queryKey: ["kanban-cards", source, apiOptions],
154
- queryFn: async (): Promise<ListResponse<KanbanCard<T>>> => {
154
+ queryFn: async (): Promise<ListResponseType<KanbanCard<T>>> => {
155
155
  try {
156
156
  return await api<KanbanCard<T>>(source).list(apiOptions);
157
157
  } catch (err) {
@@ -2,4 +2,8 @@
2
2
  export { useTable } from "./useTable";
3
3
 
4
4
  // Types
5
- export type { ColumnDefinition, UseTableOptions, UseTableReturn } from "./types";
5
+ export type {
6
+ ColumnDefinitionType,
7
+ UseTableOptionsType,
8
+ UseTableReturnType,
9
+ } from "./types";
@@ -1,11 +1,11 @@
1
- import type { ListResponse, ConditionGroupOperator } from "../../../types/common";
2
- import type { Condition, ConditionGroup, UseFilterReturn } from "../useFilter";
1
+ import type { ListResponseType, ConditionGroupOperatorType } from "../../../types/common";
2
+ import type { ConditionType, ConditionGroupType, UseFilterReturnType } from "../useFilter";
3
3
 
4
4
  // ============================================================
5
5
  // TYPE DEFINITIONS
6
6
  // ============================================================
7
7
 
8
- export interface ColumnDefinition<T> {
8
+ export interface ColumnDefinitionType<T> {
9
9
  /** Field name from the data type */
10
10
  fieldId: keyof T;
11
11
  /** Display label (optional, defaults to fieldId) */
@@ -18,11 +18,11 @@ export interface ColumnDefinition<T> {
18
18
  transform?: (value: any, row: T) => React.ReactNode;
19
19
  }
20
20
 
21
- export interface UseTableOptions<T> {
21
+ export interface UseTableOptionsType<T> {
22
22
  /** Data source identifier */
23
23
  source: string;
24
24
  /** Column configurations */
25
- columns: ColumnDefinition<T>[];
25
+ columns: ColumnDefinitionType<T>[];
26
26
  /** Enable sorting functionality */
27
27
  enableSorting?: boolean;
28
28
  /** Enable filtering functionality */
@@ -39,8 +39,8 @@ export interface UseTableOptions<T> {
39
39
  field: keyof T;
40
40
  direction: "asc" | "desc";
41
41
  };
42
- filters?: Array<Condition | ConditionGroup>;
43
- filterOperator?: ConditionGroupOperator;
42
+ filters?: Array<ConditionType | ConditionGroupType>;
43
+ filterOperator?: ConditionGroupOperatorType;
44
44
  };
45
45
  /** Error callback */
46
46
  onError?: (error: Error) => void;
@@ -48,7 +48,7 @@ export interface UseTableOptions<T> {
48
48
  onSuccess?: (data: T[]) => void;
49
49
  }
50
50
 
51
- export interface UseTableReturn<T> {
51
+ export interface UseTableReturnType<T> {
52
52
  // Data
53
53
  rows: T[];
54
54
  totalItems: number;
@@ -77,7 +77,7 @@ export interface UseTableReturn<T> {
77
77
  };
78
78
 
79
79
  // Filter (Simplified chainable API)
80
- filter: UseFilterReturn;
80
+ filter: UseFilterReturnType;
81
81
 
82
82
  // Pagination (Flat Access)
83
83
  pagination: {
@@ -94,5 +94,5 @@ export interface UseTableReturn<T> {
94
94
  };
95
95
 
96
96
  // Operations
97
- refetch: () => Promise<ListResponse<T>>;
97
+ refetch: () => Promise<ListResponseType<T>>;
98
98
  }
@@ -1,9 +1,9 @@
1
1
  import { useState, useMemo, useCallback } from "react";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { api } from "../../../api";
4
- import type { ListResponse, ListOptions } from "../../../types/common";
4
+ import type { ListResponseType, ListOptionsType } from "../../../types/common";
5
5
  import { useFilter } from "../useFilter";
6
- import type { UseTableOptions, UseTableReturn } from "./types";
6
+ import type { UseTableOptionsType, UseTableReturnType } from "./types";
7
7
 
8
8
  // ============================================================
9
9
  // INTERNAL STATE TYPES
@@ -28,8 +28,8 @@ interface PaginationState {
28
28
  // ============================================================
29
29
 
30
30
  export function useTable<T = any>(
31
- options: UseTableOptions<T>
32
- ): UseTableReturn<T> {
31
+ options: UseTableOptionsType<T>
32
+ ): UseTableReturnType<T> {
33
33
  // ============================================================
34
34
  // STATE MANAGEMENT
35
35
  // ============================================================
@@ -62,8 +62,8 @@ export function useTable<T = any>(
62
62
  // ============================================================
63
63
 
64
64
  // Options for count query - excludes sorting and pagination (they don't affect count)
65
- const countApiOptions = useMemo((): ListOptions => {
66
- const opts: ListOptions = {};
65
+ const countApiOptions = useMemo((): ListOptionsType => {
66
+ const opts: ListOptionsType = {};
67
67
 
68
68
  // Add search query (affects count)
69
69
  if (search.query) {
@@ -79,8 +79,8 @@ export function useTable<T = any>(
79
79
  }, [search.query, filter.payload]);
80
80
 
81
81
  // Options for list query - includes all options
82
- const apiOptions = useMemo((): ListOptions => {
83
- const opts: ListOptions = { ...countApiOptions };
82
+ const apiOptions = useMemo((): ListOptionsType => {
83
+ const opts: ListOptionsType = { ...countApiOptions };
84
84
 
85
85
  // Add sorting - using correct API format: [{ "fieldName": "ASC" }]
86
86
  if (sorting.field && sorting.direction) {
@@ -112,7 +112,7 @@ export function useTable<T = any>(
112
112
  refetch: queryRefetch,
113
113
  } = useQuery({
114
114
  queryKey: ["table", options.source, apiOptions],
115
- queryFn: async (): Promise<ListResponse<T>> => {
115
+ queryFn: async (): Promise<ListResponseType<T>> => {
116
116
  try {
117
117
  const response = await api<T>(options.source).list(apiOptions);
118
118
  if (options.onSuccess) {
@@ -244,7 +244,7 @@ export function useTable<T = any>(
244
244
  // REFETCH OPERATION
245
245
  // ============================================================
246
246
 
247
- const refetch = useCallback(async (): Promise<ListResponse<T>> => {
247
+ const refetch = useCallback(async (): Promise<ListResponseType<T>> => {
248
248
  const [listResult] = await Promise.all([queryRefetch(), countRefetch()]);
249
249
  return listResult.data || { Data: [] };
250
250
  }, [queryRefetch, countRefetch]);
package/sdk/filter.ts ADDED
@@ -0,0 +1,13 @@
1
+ // ============================================================
2
+ // FILTER MODULE - Main Entry Point
3
+ // @ram_28/kf-ai-sdk/filter
4
+ // ============================================================
5
+
6
+ // Main hook
7
+ export { useFilter } from './components/hooks/useFilter/useFilter';
8
+
9
+ // Type guards
10
+ export {
11
+ isCondition,
12
+ isConditionGroup,
13
+ } from './components/hooks/useFilter/types';
@@ -0,0 +1,17 @@
1
+ // ============================================================
2
+ // FILTER MODULE - Type Exports
3
+ // @ram_28/kf-ai-sdk/filter/types
4
+ // ============================================================
5
+
6
+ export type {
7
+ // Core hook types
8
+ UseFilterOptionsType,
9
+ UseFilterReturnType,
10
+
11
+ // Filter condition types (re-exported from common)
12
+ ConditionType,
13
+ ConditionGroupType,
14
+ ConditionGroupOperatorType,
15
+ FilterType,
16
+ FilterRHSTypeType,
17
+ } from './components/hooks/useFilter/types';
package/sdk/form.ts ADDED
@@ -0,0 +1,15 @@
1
+ // ============================================================
2
+ // FORM MODULE - Main Entry Point
3
+ // @ram_28/kf-ai-sdk/form
4
+ // ============================================================
5
+
6
+ // Main hook
7
+ export { useForm } from './components/hooks/useForm/useForm';
8
+
9
+ // Error handling utilities
10
+ export {
11
+ parseApiError,
12
+ isNetworkError,
13
+ isValidationError,
14
+ clearCache as clearFormCache,
15
+ } from './components/hooks/useForm/apiClient';
@@ -0,0 +1,46 @@
1
+ // ============================================================
2
+ // FORM MODULE - Type Exports
3
+ // @ram_28/kf-ai-sdk/form/types
4
+ // ============================================================
5
+
6
+ export type {
7
+ // Core hook types
8
+ UseFormOptionsType,
9
+ UseFormReturnType,
10
+ HandleSubmitType,
11
+
12
+ // Form operation types
13
+ FormOperationType,
14
+ FormModeType,
15
+ InteractionModeType,
16
+
17
+ // Form field configuration
18
+ FormFieldConfigType,
19
+ FormSchemaConfigType,
20
+ FormFieldTypeType,
21
+ SelectOptionType,
22
+ FieldPermissionType,
23
+ FieldRuleIdsType,
24
+
25
+ // Result types
26
+ FieldValidationResultType,
27
+ SubmissionResultType,
28
+
29
+ // BDO Schema types
30
+ BDOSchemaType,
31
+ BDOFieldDefinitionType,
32
+ SchemaValidationRuleType,
33
+ ComputedFieldFormulaType,
34
+ DefaultValueExpressionType,
35
+ ReferenceFieldConfigType,
36
+ FieldOptionsConfigType,
37
+ BusinessObjectRulesType,
38
+ RolePermissionType,
39
+
40
+ // Expression types
41
+ ExpressionTreeType,
42
+ ExpressionContextType,
43
+
44
+ // Rule types
45
+ RuleTypeType,
46
+ } from "./components/hooks/useForm/types";
package/sdk/kanban.ts ADDED
@@ -0,0 +1,23 @@
1
+ // ============================================================
2
+ // KANBAN MODULE - Main Entry Point
3
+ // @ram_28/kf-ai-sdk/kanban
4
+ // ============================================================
5
+
6
+ // Main hook
7
+ export { useKanban } from './components/hooks/useKanban/useKanban';
8
+
9
+ // Context
10
+ export { KanbanContext, useKanbanContext } from './components/hooks/useKanban/context';
11
+
12
+ // Utilities
13
+ export {
14
+ mergeCardsIntoColumns,
15
+ calculateCardPosition,
16
+ calculateColumnPosition,
17
+ normalizePositions,
18
+ handleKanbanApiError,
19
+ validateApiResponse,
20
+ } from './components/hooks/useKanban/apiClient';
21
+
22
+ // Drag drop manager
23
+ export { useDragDropManager } from './components/hooks/useKanban/dragDropManager';
@@ -0,0 +1,50 @@
1
+ // ============================================================
2
+ // KANBAN MODULE - Type Exports
3
+ // @ram_28/kf-ai-sdk/kanban/types
4
+ // ============================================================
5
+
6
+ export type {
7
+ // Core hook types
8
+ UseKanbanOptionsType,
9
+ UseKanbanReturnType,
10
+
11
+ // Data structures
12
+ KanbanCardType,
13
+ KanbanColumnType,
14
+ ColumnConfigType,
15
+ ColumnDefinitionType,
16
+ BaseKanbanCardType,
17
+ KanbanCardWithDataType,
18
+
19
+ // Operations
20
+ CardOperationsType,
21
+ SearchOperationsType,
22
+
23
+ // Drag & Drop
24
+ DragDropStateType,
25
+ DragDropHandlersType,
26
+ DragDropManagerType,
27
+
28
+ // API Types
29
+ CardApiResponseType,
30
+ ColumnApiResponseType,
31
+ MoveCardRequestType,
32
+ ReorderRequestType,
33
+ BulkCardUpdateRequestType,
34
+ BulkColumnUpdateRequestType,
35
+
36
+ // Validation
37
+ ValidationResultType,
38
+ CardValidationContextType,
39
+ ColumnValidationContextType,
40
+
41
+ // Events
42
+ KanbanEventTypeType,
43
+ KanbanEventType,
44
+
45
+ // Utility Types
46
+ ExtractCardTypeType,
47
+ PartialByType,
48
+ CreateCardInputType,
49
+ CreateColumnInputType,
50
+ } from './components/hooks/useKanban/types';
@@ -0,0 +1,16 @@
1
+ // ============================================================
2
+ // KANBAN UI MODULE - Component Exports
3
+ // @ram_28/kf-ai-sdk/kanban/ui
4
+ // ============================================================
5
+
6
+ export {
7
+ Kanban,
8
+ KanbanColumn,
9
+ KanbanColumnHeader,
10
+ KanbanColumnTitle,
11
+ KanbanColumnContent,
12
+ KanbanCard,
13
+ KanbanCardTitle,
14
+ KanbanCardDescription,
15
+ KanbanColumnFooter,
16
+ } from './components/ui/kanban/Kanban';
package/sdk/table.ts ADDED
@@ -0,0 +1,7 @@
1
+ // ============================================================
2
+ // TABLE MODULE - Main Entry Point
3
+ // @ram_28/kf-ai-sdk/table
4
+ // ============================================================
5
+
6
+ // Main hook
7
+ export { useTable } from './components/hooks/useTable/useTable';
@@ -0,0 +1,13 @@
1
+ // ============================================================
2
+ // TABLE MODULE - Type Exports
3
+ // @ram_28/kf-ai-sdk/table/types
4
+ // ============================================================
5
+
6
+ export type {
7
+ // Core hook types
8
+ UseTableOptionsType,
9
+ UseTableReturnType,
10
+
11
+ // Column definition
12
+ ColumnDefinitionType,
13
+ } from './components/hooks/useTable/types';