@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
@@ -1,24 +1,18 @@
1
1
  import type {
2
- Condition,
3
- ConditionGroup,
4
- ConditionGroupOperator,
5
- Filter,
6
- FilterRHSType,
7
- // Legacy types for backwards compatibility
8
- FilterCondition,
9
- FilterOperator,
2
+ ConditionType,
3
+ ConditionGroupType,
4
+ ConditionGroupOperatorType,
5
+ FilterType,
6
+ FilterRHSTypeType,
10
7
  } from "../../../types/common";
11
8
 
12
9
  // Re-export from common types for convenience
13
10
  export type {
14
- Condition,
15
- ConditionGroup,
16
- ConditionGroupOperator,
17
- Filter,
18
- FilterRHSType,
19
- // Legacy re-exports
20
- FilterCondition,
21
- FilterOperator,
11
+ ConditionType,
12
+ ConditionGroupType,
13
+ ConditionGroupOperatorType,
14
+ FilterType,
15
+ FilterRHSTypeType,
22
16
  };
23
17
 
24
18
  // ============================================================
@@ -29,8 +23,8 @@ export type {
29
23
  * Type guard to check if an item is a ConditionGroup (has nested Condition array)
30
24
  */
31
25
  export const isConditionGroup = (
32
- item: Condition | ConditionGroup
33
- ): item is ConditionGroup => {
26
+ item: ConditionType | ConditionGroupType
27
+ ): item is ConditionGroupType => {
34
28
  return "Condition" in item;
35
29
  };
36
30
 
@@ -38,25 +32,11 @@ export const isConditionGroup = (
38
32
  * Type guard to check if an item is a leaf Condition (has LHSField)
39
33
  */
40
34
  export const isCondition = (
41
- item: Condition | ConditionGroup
42
- ): item is Condition => {
35
+ item: ConditionType | ConditionGroupType
36
+ ): item is ConditionType => {
43
37
  return "LHSField" in item;
44
38
  };
45
39
 
46
- // ============================================================
47
- // LEGACY TYPE GUARDS (for backwards compatibility)
48
- // ============================================================
49
-
50
- /**
51
- * @deprecated Use `isConditionGroup` instead
52
- */
53
- export const isFilterLogical = isConditionGroup;
54
-
55
- /**
56
- * @deprecated Use `isCondition` instead
57
- */
58
- export const isFilterCondition = isCondition;
59
-
60
40
  // ============================================================
61
41
  // HOOK-SPECIFIC TYPE DEFINITIONS
62
42
  // ============================================================
@@ -64,29 +44,29 @@ export const isFilterCondition = isCondition;
64
44
  /**
65
45
  * Hook options (minimal configuration)
66
46
  */
67
- export interface UseFilterOptions {
47
+ export interface UseFilterOptionsType {
68
48
  /** Initial filter conditions */
69
- initialConditions?: Array<Condition | ConditionGroup>;
49
+ initialConditions?: Array<ConditionType | ConditionGroupType>;
70
50
  /** Initial operator for combining conditions (defaults to "And") */
71
- initialOperator?: ConditionGroupOperator;
51
+ initialOperator?: ConditionGroupOperatorType;
72
52
  }
73
53
 
74
54
  /**
75
55
  * Hook return interface with nested filter support
76
56
  */
77
- export interface UseFilterReturn {
57
+ export interface UseFilterReturnType {
78
58
  // ============================================================
79
59
  // STATE (read-only)
80
60
  // ============================================================
81
61
 
82
62
  /** Current operator for combining root-level conditions ("And" | "Or" | "Not") */
83
- operator: ConditionGroupOperator;
63
+ operator: ConditionGroupOperatorType;
84
64
 
85
65
  /** Current filter items (with id populated) */
86
- items: Array<Condition | ConditionGroup>;
66
+ items: Array<ConditionType | ConditionGroupType>;
87
67
 
88
68
  /** Ready-to-use API payload (id stripped, undefined if no conditions) */
89
- payload: Filter | undefined;
69
+ payload: FilterType | undefined;
90
70
 
91
71
  /** Whether any conditions exist */
92
72
  hasConditions: boolean;
@@ -99,27 +79,27 @@ export interface UseFilterReturn {
99
79
  * Add a leaf condition at root level
100
80
  * @returns The id of the created condition
101
81
  */
102
- add: (condition: Omit<Condition, "id">) => string;
82
+ add: (condition: Omit<ConditionType, "id">) => string;
103
83
 
104
84
  /**
105
85
  * Add a condition group at root level
106
86
  * @returns The id of the created group
107
87
  */
108
- addGroup: (operator: ConditionGroupOperator) => string;
88
+ addGroup: (operator: ConditionGroupOperatorType) => string;
109
89
 
110
90
  /**
111
91
  * Add a leaf condition to a specific parent group
112
92
  * @param parentId - The id of the parent ConditionGroup
113
93
  * @returns The id of the created condition
114
94
  */
115
- addTo: (parentId: string, condition: Omit<Condition, "id">) => string;
95
+ addTo: (parentId: string, condition: Omit<ConditionType, "id">) => string;
116
96
 
117
97
  /**
118
98
  * Add a condition group to a specific parent group
119
99
  * @param parentId - The id of the parent ConditionGroup
120
100
  * @returns The id of the created group
121
101
  */
122
- addGroupTo: (parentId: string, operator: ConditionGroupOperator) => string;
102
+ addGroupTo: (parentId: string, operator: ConditionGroupOperatorType) => string;
123
103
 
124
104
  // ============================================================
125
105
  // UPDATE OPERATIONS
@@ -130,14 +110,14 @@ export interface UseFilterReturn {
130
110
  * @param id - The id of the condition to update
131
111
  * @param updates - Partial updates to apply
132
112
  */
133
- update: (id: string, updates: Partial<Omit<Condition, "id">>) => void;
113
+ update: (id: string, updates: Partial<Omit<ConditionType, "id">>) => void;
134
114
 
135
115
  /**
136
116
  * Update a condition group's operator by id
137
117
  * @param id - The id of the group to update
138
118
  * @param operator - The new operator
139
119
  */
140
- updateOperator: (id: string, operator: ConditionGroupOperator) => void;
120
+ updateOperator: (id: string, operator: ConditionGroupOperatorType) => void;
141
121
 
142
122
  // ============================================================
143
123
  // REMOVE & ACCESS
@@ -154,7 +134,7 @@ export interface UseFilterReturn {
154
134
  * @param id - The id to look up
155
135
  * @returns The item or undefined if not found
156
136
  */
157
- get: (id: string) => Condition | ConditionGroup | undefined;
137
+ get: (id: string) => ConditionType | ConditionGroupType | undefined;
158
138
 
159
139
  // ============================================================
160
140
  // UTILITY
@@ -164,14 +144,5 @@ export interface UseFilterReturn {
164
144
  clear: () => void;
165
145
 
166
146
  /** Set the root operator for combining conditions */
167
- setOperator: (op: ConditionGroupOperator) => void;
168
-
169
- // ============================================================
170
- // LEGACY API (for backwards compatibility)
171
- // ============================================================
172
-
173
- /**
174
- * @deprecated Use `items` instead
175
- */
176
- conditions: Array<Condition | ConditionGroup>;
147
+ setOperator: (op: ConditionGroupOperatorType) => void;
177
148
  }
@@ -1,11 +1,11 @@
1
1
  import { useState, useCallback, useMemo } from "react";
2
2
  import type {
3
- Condition,
4
- ConditionGroup,
5
- ConditionGroupOperator,
6
- Filter,
3
+ ConditionType,
4
+ ConditionGroupType,
5
+ ConditionGroupOperatorType,
6
+ FilterType,
7
7
  } from "../../../types/common";
8
- import type { UseFilterOptions, UseFilterReturn } from "./types";
8
+ import type { UseFilterOptionsType, UseFilterReturnType } from "./types";
9
9
  import { isConditionGroup } from "./types";
10
10
 
11
11
  // ============================================================
@@ -24,7 +24,7 @@ const generateId = (): string => {
24
24
  /**
25
25
  * Ensure an item has an id
26
26
  */
27
- const ensureId = <T extends Condition | ConditionGroup>(item: T): T => {
27
+ const ensureId = <T extends ConditionType | ConditionGroupType>(item: T): T => {
28
28
  if (!item.id) {
29
29
  return { ...item, id: generateId() };
30
30
  }
@@ -35,8 +35,8 @@ const ensureId = <T extends Condition | ConditionGroup>(item: T): T => {
35
35
  * Deep clone and ensure all items have ids
36
36
  */
37
37
  const cloneWithIds = (
38
- items: Array<Condition | ConditionGroup>
39
- ): Array<Condition | ConditionGroup> => {
38
+ items: Array<ConditionType | ConditionGroupType>
39
+ ): Array<ConditionType | ConditionGroupType> => {
40
40
  return items.map((item) => {
41
41
  const withId = ensureId(item);
42
42
  if (isConditionGroup(withId)) {
@@ -53,18 +53,18 @@ const cloneWithIds = (
53
53
  * Strip id fields from items for API payload
54
54
  */
55
55
  const stripIds = (
56
- items: Array<Condition | ConditionGroup>
57
- ): Array<Condition | ConditionGroup> => {
56
+ items: Array<ConditionType | ConditionGroupType>
57
+ ): Array<ConditionType | ConditionGroupType> => {
58
58
  return items.map((item) => {
59
59
  if (isConditionGroup(item)) {
60
60
  const { id, ...rest } = item;
61
61
  return {
62
62
  ...rest,
63
63
  Condition: stripIds(item.Condition),
64
- } as ConditionGroup;
64
+ } as ConditionGroupType;
65
65
  }
66
66
  const { id, ...rest } = item;
67
- return rest as Condition;
67
+ return rest as ConditionType;
68
68
  });
69
69
  };
70
70
 
@@ -72,9 +72,9 @@ const stripIds = (
72
72
  * Find an item by id in a tree structure
73
73
  */
74
74
  const findById = (
75
- items: Array<Condition | ConditionGroup>,
75
+ items: Array<ConditionType | ConditionGroupType>,
76
76
  id: string
77
- ): Condition | ConditionGroup | undefined => {
77
+ ): ConditionType | ConditionGroupType | undefined => {
78
78
  for (const item of items) {
79
79
  if (item.id === id) {
80
80
  return item;
@@ -91,10 +91,10 @@ const findById = (
91
91
  * Find a parent group by child id
92
92
  */
93
93
  const findParentById = (
94
- items: Array<Condition | ConditionGroup>,
94
+ items: Array<ConditionType | ConditionGroupType>,
95
95
  childId: string,
96
- parent: ConditionGroup | null = null
97
- ): ConditionGroup | null => {
96
+ parent: ConditionGroupType | null = null
97
+ ): ConditionGroupType | null => {
98
98
  for (const item of items) {
99
99
  if (item.id === childId) {
100
100
  return parent;
@@ -111,10 +111,10 @@ const findParentById = (
111
111
  * Update an item in the tree by id
112
112
  */
113
113
  const updateInTree = (
114
- items: Array<Condition | ConditionGroup>,
114
+ items: Array<ConditionType | ConditionGroupType>,
115
115
  id: string,
116
- updater: (item: Condition | ConditionGroup) => Condition | ConditionGroup
117
- ): Array<Condition | ConditionGroup> => {
116
+ updater: (item: ConditionType | ConditionGroupType) => ConditionType | ConditionGroupType
117
+ ): Array<ConditionType | ConditionGroupType> => {
118
118
  return items.map((item) => {
119
119
  if (item.id === id) {
120
120
  return updater(item);
@@ -133,9 +133,9 @@ const updateInTree = (
133
133
  * Remove an item from the tree by id
134
134
  */
135
135
  const removeFromTree = (
136
- items: Array<Condition | ConditionGroup>,
136
+ items: Array<ConditionType | ConditionGroupType>,
137
137
  id: string
138
- ): Array<Condition | ConditionGroup> => {
138
+ ): Array<ConditionType | ConditionGroupType> => {
139
139
  return items
140
140
  .filter((item) => item.id !== id)
141
141
  .map((item) => {
@@ -153,10 +153,10 @@ const removeFromTree = (
153
153
  * Add an item to a specific parent in the tree
154
154
  */
155
155
  const addToParent = (
156
- items: Array<Condition | ConditionGroup>,
156
+ items: Array<ConditionType | ConditionGroupType>,
157
157
  parentId: string,
158
- newItem: Condition | ConditionGroup
159
- ): Array<Condition | ConditionGroup> => {
158
+ newItem: ConditionType | ConditionGroupType
159
+ ): Array<ConditionType | ConditionGroupType> => {
160
160
  return items.map((item) => {
161
161
  if (item.id === parentId && isConditionGroup(item)) {
162
162
  return {
@@ -178,18 +178,18 @@ const addToParent = (
178
178
  // USE FILTER HOOK - Nested Filter Support
179
179
  // ============================================================
180
180
 
181
- export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
181
+ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnType {
182
182
  // Initialize items with ids
183
- const [items, setItems] = useState<Array<Condition | ConditionGroup>>(() =>
183
+ const [items, setItems] = useState<Array<ConditionType | ConditionGroupType>>(() =>
184
184
  cloneWithIds(options.initialConditions || [])
185
185
  );
186
186
 
187
- const [operator, setOperatorState] = useState<ConditionGroupOperator>(
187
+ const [operator, setOperatorState] = useState<ConditionGroupOperatorType>(
188
188
  options.initialOperator || "And"
189
189
  );
190
190
 
191
191
  // Build payload for API (strip ids)
192
- const payload = useMemo((): Filter | undefined => {
192
+ const payload = useMemo((): FilterType | undefined => {
193
193
  if (items.length === 0) return undefined;
194
194
  return {
195
195
  Operator: operator,
@@ -203,16 +203,16 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
203
203
  // ADD OPERATIONS
204
204
  // ============================================================
205
205
 
206
- const add = useCallback((condition: Omit<Condition, "id">): string => {
206
+ const add = useCallback((condition: Omit<ConditionType, "id">): string => {
207
207
  const id = generateId();
208
- const newCondition: Condition = { ...condition, id };
208
+ const newCondition: ConditionType = { ...condition, id };
209
209
  setItems((prev) => [...prev, newCondition]);
210
210
  return id;
211
211
  }, []);
212
212
 
213
- const addGroup = useCallback((groupOperator: ConditionGroupOperator): string => {
213
+ const addGroup = useCallback((groupOperator: ConditionGroupOperatorType): string => {
214
214
  const id = generateId();
215
- const newGroup: ConditionGroup = {
215
+ const newGroup: ConditionGroupType = {
216
216
  id,
217
217
  Operator: groupOperator,
218
218
  Condition: [],
@@ -222,9 +222,9 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
222
222
  }, []);
223
223
 
224
224
  const addTo = useCallback(
225
- (parentId: string, condition: Omit<Condition, "id">): string => {
225
+ (parentId: string, condition: Omit<ConditionType, "id">): string => {
226
226
  const id = generateId();
227
- const newCondition: Condition = { ...condition, id };
227
+ const newCondition: ConditionType = { ...condition, id };
228
228
  setItems((prev) => addToParent(prev, parentId, newCondition));
229
229
  return id;
230
230
  },
@@ -232,9 +232,9 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
232
232
  );
233
233
 
234
234
  const addGroupTo = useCallback(
235
- (parentId: string, groupOperator: ConditionGroupOperator): string => {
235
+ (parentId: string, groupOperator: ConditionGroupOperatorType): string => {
236
236
  const id = generateId();
237
- const newGroup: ConditionGroup = {
237
+ const newGroup: ConditionGroupType = {
238
238
  id,
239
239
  Operator: groupOperator,
240
240
  Condition: [],
@@ -250,7 +250,7 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
250
250
  // ============================================================
251
251
 
252
252
  const update = useCallback(
253
- (id: string, updates: Partial<Omit<Condition, "id">>): void => {
253
+ (id: string, updates: Partial<Omit<ConditionType, "id">>): void => {
254
254
  setItems((prev) =>
255
255
  updateInTree(prev, id, (item) => {
256
256
  if (!isConditionGroup(item)) {
@@ -264,7 +264,7 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
264
264
  );
265
265
 
266
266
  const updateOperator = useCallback(
267
- (id: string, newOperator: ConditionGroupOperator): void => {
267
+ (id: string, newOperator: ConditionGroupOperatorType): void => {
268
268
  setItems((prev) =>
269
269
  updateInTree(prev, id, (item) => {
270
270
  if (isConditionGroup(item)) {
@@ -286,7 +286,7 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
286
286
  }, []);
287
287
 
288
288
  const get = useCallback(
289
- (id: string): Condition | ConditionGroup | undefined => {
289
+ (id: string): ConditionType | ConditionGroupType | undefined => {
290
290
  return findById(items, id);
291
291
  },
292
292
  [items]
@@ -300,7 +300,7 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
300
300
  setItems([]);
301
301
  }, []);
302
302
 
303
- const setOperator = useCallback((op: ConditionGroupOperator): void => {
303
+ const setOperator = useCallback((op: ConditionGroupOperatorType): void => {
304
304
  setOperatorState(op);
305
305
  }, []);
306
306
 
@@ -332,8 +332,5 @@ export function useFilter(options: UseFilterOptions = {}): UseFilterReturn {
332
332
  // Utility
333
333
  clear,
334
334
  setOperator,
335
-
336
- // Legacy API
337
- conditions: items,
338
335
  };
339
336
  }
@@ -4,7 +4,7 @@
4
4
  // Handles schema fetching and form submissions
5
5
 
6
6
  import { api, getBdoSchema } from "../../../api";
7
- import type { BDOSchema, FormOperation, SubmissionResult } from "./types";
7
+ import type { BDOSchemaType, FormOperationType, SubmissionResultType } from "./types";
8
8
 
9
9
  // ============================================================
10
10
  // SCHEMA FETCHING
@@ -13,7 +13,7 @@ import type { BDOSchema, FormOperation, SubmissionResult } from "./types";
13
13
  /**
14
14
  * Fetch BDO schema from backend metadata endpoint
15
15
  */
16
- export async function fetchFormSchema(source: string): Promise<BDOSchema> {
16
+ export async function fetchFormSchema(source: string): Promise<BDOSchemaType> {
17
17
  try {
18
18
  // Use the new metadata API client to fetch BDO schema
19
19
  const bdoResp = await getBdoSchema(source);
@@ -25,7 +25,7 @@ export async function fetchFormSchema(source: string): Promise<BDOSchema> {
25
25
  }
26
26
 
27
27
  // Return the full BDO schema - the form processor will extract what it needs
28
- return bdoSchema as BDOSchema;
28
+ return bdoSchema as BDOSchemaType;
29
29
  } catch (error) {
30
30
  console.error(`Schema fetch error for ${source}:`, error);
31
31
  throw new Error(
@@ -40,7 +40,7 @@ export async function fetchFormSchema(source: string): Promise<BDOSchema> {
40
40
  export async function fetchFormSchemaWithRetry(
41
41
  source: string,
42
42
  maxRetries: number = 3
43
- ): Promise<BDOSchema> {
43
+ ): Promise<BDOSchemaType> {
44
44
  let lastError: Error;
45
45
 
46
46
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
@@ -88,10 +88,10 @@ export async function fetchRecord<T = any>(
88
88
  */
89
89
  export async function submitFormData<T = any>(
90
90
  source: string,
91
- operation: FormOperation,
91
+ operation: FormOperationType,
92
92
  data: Partial<T>,
93
93
  recordId?: string
94
- ): Promise<SubmissionResult> {
94
+ ): Promise<SubmissionResultType> {
95
95
  try {
96
96
  let result;
97
97
 
@@ -242,7 +242,7 @@ export function validateFormData<T>(
242
242
  export function cleanFormData<T>(
243
243
  data: Partial<T>,
244
244
  computedFields: string[],
245
- operation: FormOperation = "create",
245
+ operation: FormOperationType = "create",
246
246
  originalData?: Partial<T>
247
247
  ): Partial<T> {
248
248
  const cleanedData: Partial<T> = {};
@@ -404,7 +404,7 @@ export function clearCache(keyPrefix?: string): void {
404
404
  */
405
405
  export async function fetchFormSchemaWithCache(
406
406
  source: string
407
- ): Promise<BDOSchema> {
407
+ ): Promise<BDOSchemaType> {
408
408
  const cacheKey = `schema:${source}`;
409
409
  const cached = getCacheData(cacheKey);
410
410
 
@@ -4,10 +4,10 @@
4
4
  // Evaluates backend expression trees for form validation
5
5
 
6
6
  import type {
7
- ExpressionTree,
8
- ExpressionContext,
9
- FieldValidationResult,
10
- SchemaValidationRule,
7
+ ExpressionTreeType,
8
+ ExpressionContextType,
9
+ FieldValidationResultType,
10
+ SchemaValidationRuleType,
11
11
  } from "./types";
12
12
 
13
13
  // ============================================================
@@ -137,7 +137,7 @@ const FUNCTIONS = {
137
137
  /**
138
138
  * Evaluate an expression tree node
139
139
  */
140
- function evaluateNode(node: ExpressionTree, context: ExpressionContext): any {
140
+ function evaluateNode(node: ExpressionTreeType, context: ExpressionContextType): any {
141
141
  switch (node.Type) {
142
142
  case "Literal":
143
143
  return node.Value;
@@ -217,8 +217,8 @@ function evaluateNode(node: ExpressionTree, context: ExpressionContext): any {
217
217
  * Get value from identifier based on source
218
218
  */
219
219
  function getIdentifierValue(
220
- node: ExpressionTree,
221
- context: ExpressionContext
220
+ node: ExpressionTreeType,
221
+ context: ExpressionContextType
222
222
  ): any {
223
223
  const { Name, Source } = node;
224
224
 
@@ -292,8 +292,8 @@ function evaluateBinaryOperation(operator: string, left: any, right: any): any {
292
292
  */
293
293
  function evaluateLogicalOperation(
294
294
  operator: string,
295
- args: ExpressionTree[],
296
- context: ExpressionContext
295
+ args: ExpressionTreeType[],
296
+ context: ExpressionContextType
297
297
  ): boolean {
298
298
  switch (operator) {
299
299
  case "AND":
@@ -313,11 +313,11 @@ function evaluateLogicalOperation(
313
313
  * Evaluate a complete expression tree
314
314
  */
315
315
  export function evaluateExpression(
316
- expressionTree: ExpressionTree,
316
+ expressionTree: ExpressionTreeType,
317
317
  formValues: Record<string, any>,
318
318
  referenceData: Record<string, any> = {}
319
319
  ): any {
320
- const context: ExpressionContext = {
320
+ const context: ExpressionContextType = {
321
321
  formValues,
322
322
  systemValues: getSystemValues(),
323
323
  referenceData,
@@ -337,10 +337,10 @@ export function evaluateExpression(
337
337
  export function validateField<T = Record<string, any>>(
338
338
  fieldName: string,
339
339
  fieldValue: any,
340
- validationRules: SchemaValidationRule[],
340
+ validationRules: SchemaValidationRuleType[],
341
341
  formValues: T,
342
342
  referenceData: Record<string, any> = {}
343
- ): FieldValidationResult<T> {
343
+ ): FieldValidationResultType<T> {
344
344
  // If no validation rules, field is valid
345
345
  if (!validationRules || validationRules.length === 0) {
346
346
  return { isValid: true };
@@ -380,13 +380,13 @@ export function validateField<T = Record<string, any>>(
380
380
  export function validateCrossField<T = Record<string, any>>(
381
381
  validationRules: Array<{
382
382
  Id: string;
383
- Condition: { ExpressionTree: ExpressionTree };
383
+ Condition: { ExpressionTree: ExpressionTreeType };
384
384
  Message: string;
385
385
  }>,
386
386
  formValues: T,
387
387
  referenceData: Record<string, any> = {}
388
- ): FieldValidationResult<T>[] {
389
- const results: FieldValidationResult<T>[] = [];
388
+ ): FieldValidationResultType<T>[] {
389
+ const results: FieldValidationResultType<T>[] = [];
390
390
 
391
391
  for (const rule of validationRules) {
392
392
  try {
@@ -415,7 +415,7 @@ export function validateCrossField<T = Record<string, any>>(
415
415
  * Calculate computed field value
416
416
  */
417
417
  export function calculateComputedValue(
418
- expressionTree: ExpressionTree,
418
+ expressionTree: ExpressionTreeType,
419
419
  formValues: Record<string, any>,
420
420
  referenceData: Record<string, any> = {}
421
421
  ): any {
@@ -431,7 +431,7 @@ export function calculateComputedValue(
431
431
  * Calculate default field value
432
432
  */
433
433
  export function calculateDefaultValue(
434
- expressionTree: ExpressionTree,
434
+ expressionTree: ExpressionTreeType,
435
435
  formValues: Record<string, any> = {},
436
436
  referenceData: Record<string, any> = {}
437
437
  ): any {
@@ -7,46 +7,46 @@ export { useForm } from './useForm';
7
7
 
8
8
  // === TYPES: Core (Always needed) ===
9
9
  export type {
10
- UseFormOptions,
11
- UseFormReturn,
12
- FormOperation,
13
- FormMode,
10
+ UseFormOptionsType,
11
+ UseFormReturnType,
12
+ FormOperationType,
13
+ FormModeType,
14
14
  } from './types';
15
15
 
16
16
  // === TYPES: Form Field Configuration (For dynamic form rendering) ===
17
17
  export type {
18
- FormFieldConfig,
19
- FormSchemaConfig,
20
- FormFieldType,
21
- SelectOption,
22
- FieldPermission,
23
- FieldRuleIds,
18
+ FormFieldConfigType,
19
+ FormSchemaConfigType,
20
+ FormFieldTypeType,
21
+ SelectOptionType,
22
+ FieldPermissionType,
23
+ FieldRuleIdsType,
24
24
  } from './types';
25
25
 
26
26
  // === TYPES: Result Types ===
27
27
  export type {
28
- FieldValidationResult,
29
- SubmissionResult,
28
+ FieldValidationResultType,
29
+ SubmissionResultType,
30
30
  } from './types';
31
31
 
32
32
  // === TYPES: BDO Schema (For advanced schema manipulation) ===
33
33
  export type {
34
- BDOSchema,
35
- BDOFieldDefinition,
36
- SchemaValidationRule,
37
- ComputedFieldFormula,
38
- DefaultValueExpression,
39
- ReferenceFieldConfig,
40
- FieldOptionsConfig,
41
- ExpressionTree,
42
- BusinessObjectRules,
43
- RolePermission,
44
- RuleType,
34
+ BDOSchemaType,
35
+ BDOFieldDefinitionType,
36
+ SchemaValidationRuleType,
37
+ ComputedFieldFormulaType,
38
+ DefaultValueExpressionType,
39
+ ReferenceFieldConfigType,
40
+ FieldOptionsConfigType,
41
+ ExpressionTreeType,
42
+ BusinessObjectRulesType,
43
+ RolePermissionType,
44
+ RuleTypeType,
45
45
  } from './types';
46
46
 
47
47
  // === TYPES: Expression Evaluation (For custom expression handling) ===
48
48
  export type {
49
- ExpressionContext,
49
+ ExpressionContextType,
50
50
  } from './types';
51
51
 
52
52
  // === UTILITIES: Error Handling ===